diff --git a/Android.mk b/Android.mk new file mode 100644 index 0000000000000000000000000000000000000000..fd5795a2721bfafbc40c0406e700052cfeb6c99f --- /dev/null +++ b/Android.mk @@ -0,0 +1,39 @@ +# +# Copyright (C) 2012 The Android Open Source Project +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +ifeq ($(TARGET_SOC), exynos5422) +exynos5422_dirs := \ + mobicore \ + gralloc \ + libdisplaymodule \ + libhwcutilsmodule \ + libhdmimodule \ + libhwjpeg \ + libsecurepath + +ifeq ($(BOARD_USES_VIRTUAL_DISPLAY), true) +exynos5422_dirs += \ + libvirtualdisplaymodule +endif + +ifeq ($(BOARD_USES_TRUST_KEYMASTER), true) +exynos5422_dirs += \ + libkeymaster +endif + +include $(call all-named-subdir-makefiles,$(exynos5422_dirs)) + +endif diff --git a/exynos5422.mk b/exynos5422.mk new file mode 100644 index 0000000000000000000000000000000000000000..69b69310066d5ec81f543b37dc740c8f7117de5e --- /dev/null +++ b/exynos5422.mk @@ -0,0 +1,25 @@ +# +# Copyright (C) 2013 The Android Open Source Project +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +# Video Codecs +PRODUCT_PACKAGES += \ + libOMX.Exynos.VP8.Encoder + +# Keymaster +ifeq ($(BOARD_USES_TRUST_KEYMASTER), true) +PRODUCT_PACKAGES += \ + keystore.exynos5 +endif diff --git a/gralloc/Android.mk b/gralloc/Android.mk new file mode 100644 index 0000000000000000000000000000000000000000..6c8451954234887cbd59d58c41ef2ed63c97cd5d --- /dev/null +++ b/gralloc/Android.mk @@ -0,0 +1,40 @@ +# Copyright (C) 2013 The Android Open Source Project +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +LOCAL_PATH := $(call my-dir) + +# HAL module implemenation stored in +# hw/..so +include $(CLEAR_VARS) + +LOCAL_MODULE_PATH := $(TARGET_OUT_VENDOR_SHARED_LIBRARIES)/hw +LOCAL_SHARED_LIBRARIES := liblog libcutils libion libutils + +LOCAL_C_INCLUDES := \ + $(LOCAL_PATH)/../include \ + $(TOP)/hardware/samsung_slsi/exynos/include \ + $(TOP)/hardware/samsung_slsi/exynos5/include + +LOCAL_SRC_FILES := \ + gralloc.cpp \ + framebuffer.cpp \ + mapper.cpp + +LOCAL_MODULE := gralloc.exynos5 +LOCAL_CFLAGS:= -DLOG_TAG=\"gralloc\" +LOCAL_MODULE_TAGS := optional +LOCAL_MODULE_OWNER := samsung_arm + +include $(BUILD_SHARED_LIBRARY) diff --git a/gralloc/framebuffer.cpp b/gralloc/framebuffer.cpp new file mode 100644 index 0000000000000000000000000000000000000000..e3ff9f1da1100f33414b319d4669cfa3775dad17 --- /dev/null +++ b/gralloc/framebuffer.cpp @@ -0,0 +1,274 @@ +/* + * Copyright (C) 2013 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include + +#include + +#include +#include + +#include +#include + +#include +#include +#include +#include +#include + +#include + +#include +#include + +#if HAVE_ANDROID_OS +#include +#endif + +#include "gralloc_priv.h" +#include "gr.h" + +/*****************************************************************************/ + +// numbers of buffers for page flipping +#define NUM_BUFFERS 2 +#define HWC_EXIST 0 + +struct hwc_callback_entry +{ + void (*callback)(void *, private_handle_t *); + void *data; +}; + +typedef android::Vector hwc_callback_queue_t; + +struct fb_context_t { + framebuffer_device_t device; +}; + +/*****************************************************************************/ + +static int fb_setSwapInterval(struct framebuffer_device_t* dev, + int interval) +{ + fb_context_t* ctx = (fb_context_t*)dev; + if (interval < dev->minSwapInterval || interval > dev->maxSwapInterval) + return -EINVAL; + // FIXME: implement fb_setSwapInterval + return 0; +} + +static int fb_post(struct framebuffer_device_t* dev, buffer_handle_t buffer) +{ + if (private_handle_t::validate(buffer) < 0) + return -EINVAL; + + private_handle_t const* hnd = reinterpret_cast(buffer); + private_module_t* m = reinterpret_cast(dev->common.module); +#if HWC_EXIST + hwc_callback_queue_t *queue = reinterpret_cast(m->queue); + pthread_mutex_lock(&m->queue_lock); + if(queue->isEmpty()) + pthread_mutex_unlock(&m->queue_lock); + else { + private_handle_t *hnd = private_handle_t::dynamicCast(buffer); + struct hwc_callback_entry entry = queue->top(); + queue->pop(); + pthread_mutex_unlock(&m->queue_lock); + entry.callback(entry.data, hnd); + } +#else + // If we can't do the page_flip, just copy the buffer to the front + // FIXME: use copybit HAL instead of memcpy + void* fb_vaddr; + void* buffer_vaddr; + + m->base.lock(&m->base, m->framebuffer, + GRALLOC_USAGE_SW_WRITE_RARELY, + 0, 0, m->info.xres, m->info.yres, + &fb_vaddr); + + m->base.lock(&m->base, buffer, + GRALLOC_USAGE_SW_READ_RARELY, + 0, 0, m->info.xres, m->info.yres, + &buffer_vaddr); + + memcpy(fb_vaddr, buffer_vaddr, m->finfo.line_length * m->info.yres); + + m->base.unlock(&m->base, buffer); + m->base.unlock(&m->base, m->framebuffer); +#endif + return 0; +} + +/*****************************************************************************/ + +static int fb_close(struct hw_device_t *dev) +{ + fb_context_t* ctx = (fb_context_t*)dev; + if (ctx) { + free(ctx); + } + return 0; +} + +int init_fb(struct private_module_t* module) +{ + char const * const device_template[] = { + "/dev/graphics/fb%u", + "/dev/fb%u", + NULL + }; + + int fd = -1; + int i = 0; + + fd = open("/dev/graphics/fb0", O_RDWR); + if (fd < 0) { + ALOGE("/dev/graphics/fb0 Open fail"); + return -errno; + } + + struct fb_fix_screeninfo finfo; + if (ioctl(fd, FBIOGET_FSCREENINFO, &finfo) == -1) { + ALOGE("Fail to get FB Screen Info"); + close(fd); + return -errno; + } + + struct fb_var_screeninfo info; + if (ioctl(fd, FBIOGET_VSCREENINFO, &info) == -1) { + ALOGE("First, Fail to get FB VScreen Info"); + close(fd); + return -errno; + } + + int refreshRate = 1000000000000000LLU / + ( + uint64_t( info.upper_margin + info.lower_margin + info.yres ) + * ( info.left_margin + info.right_margin + info.xres ) + * info.pixclock + ); + + if (refreshRate == 0) + refreshRate = 60*1000; /* 60 Hz */ + + float xdpi = (info.xres * 25.4f) / info.width; + float ydpi = (info.yres * 25.4f) / info.height; + float fps = refreshRate / 1000.0f; + + ALOGI("using (id=%s)\n" + "xres = %d px\n" + "yres = %d px\n" + "width = %d mm (%f dpi)\n" + "height = %d mm (%f dpi)\n" + "refresh rate = %.2f Hz\n", + finfo.id, info.xres, info.yres, info.width, xdpi, info.height, ydpi, + fps); + + module->xres = info.xres; + module->yres = info.yres; + module->line_length = info.xres; + module->xdpi = xdpi; + module->ydpi = ydpi; + module->fps = fps; + module->info = info; + module->finfo = finfo; + + size_t fbSize = roundUpToPageSize(finfo.line_length * info.yres_virtual); + module->framebuffer = new private_handle_t(dup(fd), fbSize, 0); + + void* vaddr = mmap(0, fbSize, PROT_READ|PROT_WRITE, MAP_SHARED, fd, 0); + if (vaddr == MAP_FAILED) { + ALOGE("Error mapping the framebuffer (%s)", strerror(errno)); + close(fd); + return -errno; + } + module->framebuffer->base = vaddr; + memset(vaddr, 0, fbSize); + + close(fd); + + return 0; +} + +int fb_device_open(hw_module_t const* module, const char* name, + hw_device_t** device) +{ + int status = -EINVAL; +#ifdef GRALLOC_16_BITS + int bits_per_pixel = 16; + int format = HAL_PIXEL_FORMAT_RGB_565; +#else + int bits_per_pixel = 32; + int format = HAL_PIXEL_FORMAT_RGBA_8888; +#endif + + alloc_device_t* gralloc_device; + status = gralloc_open(module, &gralloc_device); + if (status < 0) { + ALOGE("Fail to Open gralloc device"); + return status; + } + + framebuffer_device_t *dev = (framebuffer_device_t *)malloc(sizeof(framebuffer_device_t)); + if (dev == NULL) { + ALOGE("Failed to allocate memory for dev"); + gralloc_close(gralloc_device); + return status; + } + + private_module_t* m = (private_module_t*)module; + status = init_fb(m); + if (status < 0) { + ALOGE("Fail to init framebuffer"); + free(dev); + gralloc_close(gralloc_device); + return status; + } + + /* initialize our state here */ + memset(dev, 0, sizeof(*dev)); + + /* initialize the procs */ + dev->common.tag = HARDWARE_DEVICE_TAG; + dev->common.version = 0; + dev->common.module = const_cast(module); + dev->common.close = fb_close; + dev->setSwapInterval = 0; + dev->post = fb_post; + dev->setUpdateRect = 0; + dev->compositionComplete = 0; + m->queue = new hwc_callback_queue_t; + pthread_mutex_init(&m->queue_lock, NULL); + + int stride = m->line_length / (bits_per_pixel >> 3); + const_cast(dev->flags) = 0; + const_cast(dev->width) = m->xres; + const_cast(dev->height) = m->yres; + const_cast(dev->stride) = stride; + const_cast(dev->format) = format; + const_cast(dev->xdpi) = m->xdpi; + const_cast(dev->ydpi) = m->ydpi; + const_cast(dev->fps) = m->fps; + const_cast(dev->minSwapInterval) = 1; + const_cast(dev->maxSwapInterval) = 1; + *device = &dev->common; + status = 0; + + return status; +} diff --git a/gralloc/gr.h b/gralloc/gr.h new file mode 100644 index 0000000000000000000000000000000000000000..6fe26b6afc22ceb109f01fe7107a1edcc7ad01ff --- /dev/null +++ b/gralloc/gr.h @@ -0,0 +1,43 @@ +/* + * Copyright (C) 2013 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef GR_H_ +#define GR_H_ + +#include +#include +#include +#include +#include +#include + +#include + +/*****************************************************************************/ + +struct private_module_t; +struct private_handle_t; + +#ifndef SUPPORT_DIRECT_FB +inline size_t roundUpToPageSize(size_t x) { + return (x + (PAGE_SIZE-1)) & ~(PAGE_SIZE-1); +} +#endif + +int grallocMap(gralloc_module_t const* module, private_handle_t *hnd); +int grallocUnmap(gralloc_module_t const* module, private_handle_t *hnd); + +#endif /* GR_H_ */ diff --git a/gralloc/gralloc.cpp b/gralloc/gralloc.cpp new file mode 100644 index 0000000000000000000000000000000000000000..84097896a11fc9f0225e51ffe487c65b7fb37632 --- /dev/null +++ b/gralloc/gralloc.cpp @@ -0,0 +1,457 @@ +/* + * Copyright (C) 2013 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifdef HAVE_ANDROID_OS // just want PAGE_SIZE define +# include +#else +# include +#endif +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +#include +#include +#include +#include + +#include +#include + +#include "gralloc_priv.h" +#include "exynos_format.h" +#include "gr.h" + +#define ION_HEAP_EXYNOS_CONTIG_MASK (1 << 4) +#define ION_EXYNOS_FIMD_VIDEO_MASK (1 << 28) +#define ION_EXYNOS_MFC_OUTPUT_MASK (1 << 26) +#define ION_EXYNOS_MFC_INPUT_MASK (1 << 25) +#define ION_EXYNOS_G2D_WFD_MASK (1 << 22) +#define MB_1 (1024*1024) + +#define ION_FLAG_PRESERVE_KMAP 4 + +/*****************************************************************************/ + +struct gralloc_context_t { + alloc_device_t device; + /* our private data here */ +}; + +static int gralloc_alloc_buffer(alloc_device_t* dev, + size_t size, int usage, buffer_handle_t* pHandle); + +/*****************************************************************************/ + +int fb_device_open(const hw_module_t* module, const char* name, + hw_device_t** device); + +static int gralloc_device_open(const hw_module_t* module, const char* name, + hw_device_t** device); + +extern int gralloc_lock(gralloc_module_t const* module, + buffer_handle_t handle, int usage, + int l, int t, int w, int h, + void** vaddr); + +extern int gralloc_unlock(gralloc_module_t const* module, + buffer_handle_t handle); + +extern int gralloc_register_buffer(gralloc_module_t const* module, + buffer_handle_t handle); + +extern int gralloc_unregister_buffer(gralloc_module_t const* module, + buffer_handle_t handle); + +/*****************************************************************************/ + +static struct hw_module_methods_t gralloc_module_methods = { +open: gralloc_device_open +}; + +struct private_module_t HAL_MODULE_INFO_SYM = { +base: { + common: { + tag: HARDWARE_MODULE_TAG, + version_major: 1, + version_minor: 0, + id: GRALLOC_HARDWARE_MODULE_ID, + name: "Graphics Memory Allocator Module", + author: "The Android Open Source Project", + methods: &gralloc_module_methods + }, + registerBuffer: gralloc_register_buffer, + unregisterBuffer: gralloc_unregister_buffer, + lock: gralloc_lock, + unlock: gralloc_unlock, +}, +framebuffer: 0, +flags: 0, +numBuffers: 0, +bufferMask: 0, +lock: PTHREAD_MUTEX_INITIALIZER, +currentBuffer: 0, +ionfd: -1, +}; + +/*****************************************************************************/ + +static unsigned int _select_heap(int usage) +{ + unsigned int heap_mask; + if (usage & GRALLOC_USAGE_PROTECTED) + heap_mask = ION_HEAP_EXYNOS_CONTIG_MASK; + else + heap_mask = ION_HEAP_SYSTEM_MASK; + + if (usage & GRALLOC_USAGE_GPU_BUFFER) + heap_mask = ION_HEAP_EXYNOS_CONTIG_MASK; + + return heap_mask; +} + +static int gralloc_alloc_rgb(int ionfd, int w, int h, int format, int usage, + unsigned int ion_flags, private_handle_t **hnd, int *stride) +{ + size_t size, bpr, alignment = 0, ext_size=256; + int bpp = 0, vstride, fd, err; + unsigned int heap_mask = _select_heap(usage); + + switch (format) { + case HAL_PIXEL_FORMAT_EXYNOS_ARGB_8888: + case HAL_PIXEL_FORMAT_RGBA_8888: + case HAL_PIXEL_FORMAT_RGBX_8888: + case HAL_PIXEL_FORMAT_BGRA_8888: + bpp = 4; + break; + case HAL_PIXEL_FORMAT_RGB_888: + bpp = 3; + break; + case HAL_PIXEL_FORMAT_RGB_565: + case HAL_PIXEL_FORMAT_RAW_SENSOR: + bpp = 2; + break; + case HAL_PIXEL_FORMAT_BLOB: + *stride = w; + vstride = h; + size = w * h; + break; + default: + return -EINVAL; + } + + if (format != HAL_PIXEL_FORMAT_BLOB) { + if ((usage & GRALLOC_USAGE_HW_VIDEO_ENCODER) || (format == HAL_PIXEL_FORMAT_BGRA_8888)) { + bpr = ALIGN(w, 16)* bpp; + vstride = ALIGN(h, 16); + } else { + bpr = ALIGN(w*bpp, 16); + vstride = h; + } + if (vstride < h + 2) + size = bpr * (h + 2); + else + size = bpr * vstride; + *stride = bpr / bpp; + size = ALIGN(size, PAGE_SIZE)+ext_size; + } + + if (usage & GRALLOC_USAGE_PROTECTED) { + if (usage & GRALLOC_USAGE_PRIVATE_NONSECURE) + alignment = 0; + else + alignment = MB_1; + if ((usage & GRALLOC_USAGE_PRIVATE_NONSECURE) && (usage & GRALLOC_USAGE_PHYSICALLY_LINEAR)) + ion_flags |= ION_EXYNOS_G2D_WFD_MASK; + else + ion_flags |= ION_EXYNOS_FIMD_VIDEO_MASK; + } + + err = ion_alloc_fd(ionfd, size, alignment, heap_mask, ion_flags, + &fd); + if (err) { + if (usage & GRALLOC_USAGE_GPU_BUFFER) { + usage &= ~GRALLOC_USAGE_GPU_BUFFER; + heap_mask = _select_heap(usage); + err = ion_alloc_fd(ionfd, size, alignment, heap_mask, ion_flags, + &fd); + if (err) + return err; + } + else + return err; + } + *hnd = new private_handle_t(fd, size, usage, w, h, format, *stride, + vstride); + + return err; +} + +static int gralloc_alloc_framework_yuv(int ionfd, int w, int h, int format, + int usage, unsigned int ion_flags, + private_handle_t **hnd, int *stride) +{ + size_t size=0, ext_size=256; + int err, fd; + unsigned int heap_mask = _select_heap(usage); + + switch (format) { + case HAL_PIXEL_FORMAT_YV12: + case HAL_PIXEL_FORMAT_EXYNOS_YCbCr_420_P: + *stride = ALIGN(w, 16); + size = (*stride * h) + (ALIGN(*stride / 2, 16) * h) + ext_size; + break; + case HAL_PIXEL_FORMAT_YCrCb_420_SP: + *stride = w; + size = *stride * ALIGN(h, 16) * 3 / 2 + ext_size; + break; + default: + ALOGE("invalid yuv format %d\n", format); + return -EINVAL; + } + + err = ion_alloc_fd(ionfd, size, 0, heap_mask, ion_flags, &fd); + if (err) + return err; + + *hnd = new private_handle_t(fd, size, usage, w, h, format, *stride, h); + return err; +} + +static int gralloc_alloc_yuv(int ionfd, int w, int h, int format, + int usage, unsigned int ion_flags, + private_handle_t **hnd, int *stride) +{ + size_t luma_size=0, chroma_size=0, ext_size=256; + int err, planes, fd = -1, fd1 = -1, fd2 = -1; + size_t luma_vstride; + unsigned int heap_mask = _select_heap(usage); + + *stride = ALIGN(w, 16); + + if (format == HAL_PIXEL_FORMAT_IMPLEMENTATION_DEFINED) { + ALOGV("HAL_PIXEL_FORMAT_IMPLEMENTATION_DEFINED : usage(%x), flags(%x)\n", usage, ion_flags); + if ((usage & GRALLOC_USAGE_HW_CAMERA_ZSL) == GRALLOC_USAGE_HW_CAMERA_ZSL) { + format = HAL_PIXEL_FORMAT_YCbCr_422_I; // YUYV + } else if (usage & GRALLOC_USAGE_HW_TEXTURE) { + format = HAL_PIXEL_FORMAT_EXYNOS_YV12_M; + } else if (usage & GRALLOC_USAGE_HW_VIDEO_ENCODER) { + format = HAL_PIXEL_FORMAT_EXYNOS_YCbCr_420_SP_M; // NV12M + } + } + if (usage & GRALLOC_USAGE_PROTECTED) + ion_flags |= ION_EXYNOS_MFC_OUTPUT_MASK; + + switch (format) { + case HAL_PIXEL_FORMAT_EXYNOS_YV12_M: + case HAL_PIXEL_FORMAT_EXYNOS_YCbCr_420_P_M: + { + *stride = ALIGN(w, 32); + luma_vstride = ALIGN(h, 16); + luma_size = luma_vstride * *stride + ext_size; + chroma_size = (luma_vstride / 2) * ALIGN(*stride / 2, 16) + ext_size; + planes = 3; + break; + } + case HAL_PIXEL_FORMAT_EXYNOS_YCbCr_420_SP_M_TILED: + { + size_t chroma_vstride = ALIGN(h / 2, 32); + luma_vstride = ALIGN(h, 32); + luma_size = luma_vstride * *stride + ext_size; + chroma_size = chroma_vstride * *stride + ext_size; + planes = 2; + break; + } + case HAL_PIXEL_FORMAT_YV12: + case HAL_PIXEL_FORMAT_EXYNOS_YCbCr_420_P: + case HAL_PIXEL_FORMAT_YCrCb_420_SP: + return gralloc_alloc_framework_yuv(ionfd, w, h, format, usage, + ion_flags, hnd, stride); + case HAL_PIXEL_FORMAT_EXYNOS_YCrCb_420_SP_M: + case HAL_PIXEL_FORMAT_EXYNOS_YCrCb_420_SP_M_FULL: + case HAL_PIXEL_FORMAT_EXYNOS_YCbCr_420_SP_M: + { + luma_vstride = ALIGN(h, 16); + luma_size = *stride * luma_vstride+ext_size; + chroma_size = *stride * ALIGN(luma_vstride / 2, 8)+ext_size; + planes = 2; + break; + } + case HAL_PIXEL_FORMAT_YCbCr_422_I: + { + luma_vstride = h; + luma_size = luma_vstride * *stride * 2+ext_size; + chroma_size = 0; + planes = 1; + break; + } + default: + ALOGE("invalid yuv format %d\n", format); + return -EINVAL; + } + + err = ion_alloc_fd(ionfd, luma_size, 0, heap_mask, ion_flags, &fd); + if (err) + return err; + if (planes == 1) { + *hnd = new private_handle_t(fd, luma_size, usage, w, h, + format, *stride, luma_vstride); + } else { + err = ion_alloc_fd(ionfd, chroma_size, 0, heap_mask, ion_flags, &fd1); + if (err) + goto err1; + if (planes == 3) { + err = ion_alloc_fd(ionfd, chroma_size, 0, heap_mask, ion_flags, &fd2); + if (err) + goto err2; + + *hnd = new private_handle_t(fd, fd1, fd2, luma_size, usage, w, h, + format, *stride, luma_vstride); + } else { + *hnd = new private_handle_t(fd, fd1, luma_size, usage, w, h, format, + *stride, luma_vstride); + } + } + return err; + +err2: + close(fd1); +err1: + close(fd); + return err; +} + +static int gralloc_alloc(alloc_device_t* dev, + int w, int h, int format, int usage, + buffer_handle_t* pHandle, int* pStride) +{ + int stride; + int err; + unsigned int ion_flags = 0; + private_handle_t *hnd = NULL; + + if (!pHandle || !pStride || w <= 0 || h <= 0) + return -EINVAL; + + if( (usage & GRALLOC_USAGE_SW_READ_MASK) == GRALLOC_USAGE_SW_READ_OFTEN ) + ion_flags = ION_FLAG_CACHED | ION_FLAG_CACHED_NEEDS_SYNC | ION_FLAG_PRESERVE_KMAP; + + private_module_t* m = reinterpret_cast + (dev->common.module); + gralloc_module_t* module = reinterpret_cast + (dev->common.module); + + if ((usage & GRALLOC_USAGE_GPU_BUFFER) && (w*h != (m->xres)*(m->yres))) + usage &= ~GRALLOC_USAGE_GPU_BUFFER; + + err = gralloc_alloc_rgb(m->ionfd, w, h, format, usage, ion_flags, &hnd, + &stride); + if (err) + err = gralloc_alloc_yuv(m->ionfd, w, h, format, usage, ion_flags, + &hnd, &stride); + if (err) + goto err; + + *pHandle = hnd; + *pStride = stride; + return 0; +err: + if (!hnd) + return err; + close(hnd->fd); + if (hnd->fd1 >= 0) + close(hnd->fd1); + if (hnd->fd2 >= 0) + close(hnd->fd2); + delete hnd; + return err; +} + +static int gralloc_free(alloc_device_t* dev, + buffer_handle_t handle) +{ + if (private_handle_t::validate(handle) < 0) + return -EINVAL; + + private_handle_t const* hnd = reinterpret_cast(handle); + gralloc_module_t* module = reinterpret_cast( + dev->common.module); + if (hnd->base) + grallocUnmap(module, const_cast(hnd)); + + close(hnd->fd); + if (hnd->fd1 >= 0) + close(hnd->fd1); + if (hnd->fd2 >= 0) + close(hnd->fd2); + + delete hnd; + return 0; +} + +/*****************************************************************************/ + +static int gralloc_close(struct hw_device_t *dev) +{ + gralloc_context_t* ctx = reinterpret_cast(dev); + if (ctx) { + /* TODO: keep a list of all buffer_handle_t created, and free them + * all here. + */ + free(ctx); + } + return 0; +} + +int gralloc_device_open(const hw_module_t* module, const char* name, + hw_device_t** device) +{ + int status = -EINVAL; + if (!strcmp(name, GRALLOC_HARDWARE_GPU0)) { + gralloc_context_t *dev; + dev = (gralloc_context_t*)malloc(sizeof(*dev)); + + /* initialize our state here */ + memset(dev, 0, sizeof(*dev)); + + /* initialize the procs */ + dev->device.common.tag = HARDWARE_DEVICE_TAG; + dev->device.common.version = 0; + dev->device.common.module = const_cast(module); + dev->device.common.close = gralloc_close; + + dev->device.alloc = gralloc_alloc; + dev->device.free = gralloc_free; + + private_module_t *p = reinterpret_cast(dev->device.common.module); + p->ionfd = ion_open(); + + *device = &dev->device.common; + status = 0; + } else { + status = fb_device_open(module, name, device); + } + return status; +} diff --git a/gralloc/mapper.cpp b/gralloc/mapper.cpp new file mode 100644 index 0000000000000000000000000000000000000000..915b540c1d7ada80f08c1028c0522cca892e2c4e --- /dev/null +++ b/gralloc/mapper.cpp @@ -0,0 +1,273 @@ +/* + * Copyright (C) 2013 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include +#include +#include +#include +#include + +#include +#include +#include + +#include +#include + +#include +#include + +#include "gralloc_priv.h" +#include "exynos_format.h" + +#include +#include + +/*****************************************************************************/ + +static int gralloc_map(gralloc_module_t const* module, buffer_handle_t handle) +{ + size_t chroma_vstride = 0; + size_t chroma_size = 0; + size_t ext_size = 256; + + private_handle_t *hnd = (private_handle_t*)handle; + + switch (hnd->format) { + case HAL_PIXEL_FORMAT_EXYNOS_YCbCr_420_SP_M_TILED: + chroma_vstride = ALIGN(hnd->height / 2, 32); + chroma_size = chroma_vstride * hnd->stride + ext_size; + break; + case HAL_PIXEL_FORMAT_EXYNOS_YCrCb_420_SP_M: + case HAL_PIXEL_FORMAT_EXYNOS_YCrCb_420_SP_M_FULL: + case HAL_PIXEL_FORMAT_EXYNOS_YCbCr_420_SP_M: + chroma_size = hnd->stride * ALIGN(hnd->vstride / 2, 8) + ext_size; + break; + case HAL_PIXEL_FORMAT_EXYNOS_YV12_M: + case HAL_PIXEL_FORMAT_EXYNOS_YCbCr_420_P_M: + chroma_size = (hnd->vstride / 2) * ALIGN(hnd->stride / 2, 16) + ext_size; + break; + default: + break; + } + + void* mappedAddress = mmap(0, hnd->size, PROT_READ|PROT_WRITE, MAP_SHARED, + hnd->fd, 0); + if (mappedAddress == MAP_FAILED) { + ALOGE("%s: could not mmap %s", __func__, strerror(errno)); + return -errno; + } + ALOGV("%s: base %p %d %d %d %d\n", __func__, mappedAddress, hnd->size, + hnd->width, hnd->height, hnd->stride); + hnd->base = mappedAddress; + + if (hnd->fd1 >= 0) { + void *mappedAddress1 = (void*)mmap(0, chroma_size, PROT_READ|PROT_WRITE, + MAP_SHARED, hnd->fd1, 0); + hnd->base1 = mappedAddress1; + } + if (hnd->fd2 >= 0) { + void *mappedAddress2 = (void*)mmap(0, chroma_size, PROT_READ|PROT_WRITE, + MAP_SHARED, hnd->fd2, 0); + hnd->base2 = mappedAddress2; + } + + return 0; +} + +static int gralloc_unmap(gralloc_module_t const* module, buffer_handle_t handle) +{ + private_handle_t* hnd = (private_handle_t*)handle; + size_t chroma_vstride = 0; + size_t chroma_size = 0; + size_t ext_size = 256; + + switch (hnd->format) { + case HAL_PIXEL_FORMAT_EXYNOS_YCbCr_420_SP_M_TILED: + chroma_vstride = ALIGN(hnd->height / 2, 32); + chroma_size = chroma_vstride * hnd->stride + ext_size; + break; + case HAL_PIXEL_FORMAT_EXYNOS_YCrCb_420_SP_M: + case HAL_PIXEL_FORMAT_EXYNOS_YCrCb_420_SP_M_FULL: + case HAL_PIXEL_FORMAT_EXYNOS_YCbCr_420_SP_M: + chroma_size = hnd->stride * ALIGN(hnd->vstride / 2, 8) + ext_size; + break; + case HAL_PIXEL_FORMAT_EXYNOS_YV12_M: + case HAL_PIXEL_FORMAT_EXYNOS_YCbCr_420_P_M: + chroma_size = (hnd->vstride / 2) * ALIGN(hnd->stride / 2, 16) + ext_size; + break; + default: + break; + } + + if (!hnd->base) + return 0; + + if (munmap(hnd->base, hnd->size) < 0) { + ALOGE("%s :could not unmap %s %p %d", __func__, strerror(errno), + hnd->base, hnd->size); + } + ALOGV("%s: base %p %d %d %d %d\n", __func__, hnd->base, hnd->size, + hnd->width, hnd->height, hnd->stride); + hnd->base = 0; + if (hnd->fd1 >= 0) { + if (!hnd->base1) + return 0; + if (munmap(hnd->base1, chroma_size) < 0) { + ALOGE("%s :could not unmap %s %p %d", __func__, strerror(errno), + hnd->base1, chroma_size); + } + hnd->base1 = 0; + } + if (hnd->fd2 >= 0) { + if (!hnd->base2) + return 0; + if (munmap(hnd->base2, chroma_size) < 0) { + ALOGE("%s :could not unmap %s %p %d", __func__, strerror(errno), + hnd->base2, chroma_size); + } + hnd->base2 = 0; + } + return 0; +} + +/*****************************************************************************/ + +int grallocMap(gralloc_module_t const* module, private_handle_t *hnd) +{ + return gralloc_map(module, hnd); +} + +int grallocUnmap(gralloc_module_t const* module, private_handle_t *hnd) +{ + return gralloc_unmap(module, hnd); +} + +int getIonFd(gralloc_module_t const *module) +{ + private_module_t* m = const_cast(reinterpret_cast(module)); + if (m->ionfd == -1) + m->ionfd = ion_open(); + return m->ionfd; +} + +static pthread_mutex_t sMapLock = PTHREAD_MUTEX_INITIALIZER; + +/*****************************************************************************/ + +int gralloc_register_buffer(gralloc_module_t const* module, + buffer_handle_t handle) +{ + int err; + if (private_handle_t::validate(handle) < 0) + return -EINVAL; + + err = gralloc_map(module, handle); + + private_handle_t* hnd = (private_handle_t*)handle; + ALOGV("%s: base %p %d %d %d %d\n", __func__, hnd->base, hnd->size, + hnd->width, hnd->height, hnd->stride); + + int ret; + ret = ion_import(getIonFd(module), hnd->fd, &hnd->handle); + if (ret) + ALOGE("error importing handle %d %x\n", hnd->fd, hnd->format); + if (hnd->fd1 >= 0) { + ret = ion_import(getIonFd(module), hnd->fd1, &hnd->handle1); + if (ret) + ALOGE("error importing handle1 %d %x\n", hnd->fd1, hnd->format); + } + if (hnd->fd2 >= 0) { + ret = ion_import(getIonFd(module), hnd->fd2, &hnd->handle2); + if (ret) + ALOGE("error importing handle2 %d %x\n", hnd->fd2, hnd->format); + } + + return err; +} + +int gralloc_unregister_buffer(gralloc_module_t const* module, + buffer_handle_t handle) +{ + if (private_handle_t::validate(handle) < 0) + return -EINVAL; + + private_handle_t* hnd = (private_handle_t*)handle; + ALOGV("%s: base %p %d %d %d %d\n", __func__, hnd->base, hnd->size, + hnd->width, hnd->height, hnd->stride); + + gralloc_unmap(module, handle); + + if (hnd->handle) + ion_free(getIonFd(module), hnd->handle); + if (hnd->handle1) + ion_free(getIonFd(module), hnd->handle1); + if (hnd->handle2) + ion_free(getIonFd(module), hnd->handle2); + + return 0; +} + +int gralloc_lock(gralloc_module_t const* module, + buffer_handle_t handle, int usage, + int l, int t, int w, int h, + void** vaddr) +{ + // this is called when a buffer is being locked for software + // access. in thin implementation we have nothing to do since + // not synchronization with the h/w is needed. + // typically this is used to wait for the h/w to finish with + // this buffer if relevant. the data cache may need to be + // flushed or invalidated depending on the usage bits and the + // hardware. + + if (private_handle_t::validate(handle) < 0) + return -EINVAL; + + private_handle_t* hnd = (private_handle_t*)handle; + if (!hnd->base) + gralloc_map(module, hnd); + *vaddr = (void*)hnd->base; + + if (hnd->fd1 >= 0) + vaddr[1] = (void*)hnd->base1; + if (hnd->fd2 >= 0) + vaddr[2] = (void*)hnd->base2; + + return 0; +} + +int gralloc_unlock(gralloc_module_t const* module, + buffer_handle_t handle) +{ + // we're done with a software buffer. nothing to do in this + // implementation. typically this is used to flush the data cache. + if (private_handle_t::validate(handle) < 0) + return -EINVAL; + + private_handle_t* hnd = (private_handle_t*)handle; + + if (!((hnd->flags & GRALLOC_USAGE_SW_READ_MASK) == GRALLOC_USAGE_SW_READ_OFTEN)) + return 0; + + ion_sync_fd(getIonFd(module), hnd->fd); + if (hnd->fd1 >= 0) + ion_sync_fd(getIonFd(module), hnd->fd1); + if (hnd->fd2 >= 0) + ion_sync_fd(getIonFd(module), hnd->fd2); + + return 0; +} diff --git a/include/ExynosJpegApi.h b/include/ExynosJpegApi.h new file mode 100644 index 0000000000000000000000000000000000000000..58fb937c593e62717b35a0505d32dcaad2086e0f --- /dev/null +++ b/include/ExynosJpegApi.h @@ -0,0 +1,252 @@ +/* + * Copyright Samsung Electronics Co.,LTD. + * Copyright (C) 2012~2013 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef __EXYNOS_JPEG_BASE_H__ +#define __EXYNOS_JPEG_BASE_H__ + +#include "videodev2.h" +#include "videodev2_exynos_media.h" + +#define JPEG_CACHE_OFF (0) +#define JPEG_CACHE_ON (1) + +#define JPEG_BUF_TYPE_USER_PTR (1) +#define JPEG_BUF_TYPE_DMA_BUF (2) + +class ExynosJpegBase { +public: + #define JPEG_MAX_PLANE_CNT (3) + ExynosJpegBase(); + virtual ~ExynosJpegBase(); + + enum ERROR_JPEG_HAL { + ERROR_JPEG_DEVICE_ALREADY_CREATE = -0x100, + ERROR_INVALID_JPEG_MODE, + ERROR_CANNOT_OPEN_JPEG_DEVICE, + ERROR_JPEG_DEVICE_ALREADY_CLOSED, + ERROR_JPEG_DEVICE_ALREADY_DESTROY, + ERROR_JPEG_DEVICE_NOT_CREATE_YET, + ERROR_INVALID_COLOR_FORMAT, + ERROR_INVALID_JPEG_FORMAT, + ERROR_INVALID_IMAGE_SIZE, + ERROR_JPEG_CONFIG_POINTER_NULL, + ERROR_INVALID_JPEG_CONFIG, + ERROR_IN_BUFFER_CREATE_FAIL, + ERROR_OUT_BUFFER_CREATE_FAIL, + ERROR_EXCUTE_FAIL, + ERROR_JPEG_SIZE_TOO_SMALL, + ERROR_CANNOT_CHANGE_CACHE_SETTING, + ERROR_SIZE_NOT_SET_YET, + ERROR_BUFFR_IS_NULL, + ERROR_BUFFER_TOO_SMALL, + ERROR_GET_SIZE_FAIL, + ERROR_BUF_NOT_SET_YET, + ERROR_REQBUF_FAIL, + ERROR_INVALID_V4l2_BUF_TYPE = -0x80, + ERROR_INVALID_SELECT, + ERROR_MMAP_FAILED, + ERROR_FAIL, + ERROR_NONE = 0 + }; + + enum MODE { + MODE_ENCODE = 0, + MODE_DECODE + }; + + struct BUFFER{ + int numOfPlanes; + int i_addr[JPEG_MAX_PLANE_CNT]; + char *c_addr[JPEG_MAX_PLANE_CNT]; + int size[JPEG_MAX_PLANE_CNT]; + }; + + struct BUF_INFO{ + int numOfPlanes; + enum v4l2_memory memory; + enum v4l2_buf_type buf_type; + int reserved[4]; + }; + + struct PIX_FMT{ + int in_fmt; + int out_fmt; + int reserved[4]; + }; + + struct CONFIG{ + int mode; + int enc_qual; + int width; + int height; + int scaled_width; + int scaled_height; + int numOfPlanes; + int sizeJpeg; + union { + PIX_FMT enc_fmt; + PIX_FMT dec_fmt; + } pix; + int reserved[8]; + }; + + int setSize(int iW, int iH); + int setCache(int iValue); + void *getJpegConfig(void); + int selectJpegHW(int iSel); + int ckeckJpegSelct(enum MODE eMode); + +protected: + bool t_bFlagCreate; + bool t_bFlagCreateInBuf; + bool t_bFlagCreateOutBuf; + bool t_bFlagExcute; + bool t_bFlagSelect; + int t_iCacheValue; + int t_iSelectNode; + int t_iPlaneNum; + int t_iJpegFd; + + struct CONFIG t_stJpegConfig; + struct BUFFER t_stJpegInbuf; + struct BUFFER t_stJpegOutbuf; + + int t_v4l2Querycap(int iFd); + int t_v4l2SetJpegcomp(int iFd, int iQuality); + int t_v4l2SetFmt(int iFd, enum v4l2_buf_type eType, struct CONFIG *pstConfig); + int t_v4l2GetFmt(int iFd, enum v4l2_buf_type eType, struct CONFIG *pstConfig); + int t_v4l2Reqbufs(int iFd, int iBufCount, struct BUF_INFO *pstBufInfo); + int t_v4l2Querybuf(int iFd, struct BUF_INFO *pstBufInfo, struct BUFFER *pstBuf); + int t_v4l2Qbuf(int iFd, struct BUF_INFO *pstBufInfo, struct BUFFER *pstBuf); + int t_v4l2Dqbuf(int iFd, enum v4l2_buf_type eType, enum v4l2_memory eMemory, int iNumPlanes); + int t_v4l2StreamOn(int iFd, enum v4l2_buf_type eType); + int t_v4l2StreamOff(int iFd, enum v4l2_buf_type eType); + int t_v4l2SetCtrl(int iFd, int iCid, int iValue); + int t_v4l2GetCtrl(int iFd, int iCid); + + int create(enum MODE eMode); + int openJpeg(enum MODE eMode); + int openNode(enum MODE eMode); + int destroy(int iInBufs, int iOutBufs); + int setJpegConfig(enum MODE eMode, void *pConfig); + int setColorFormat(enum MODE eMode, int iV4l2ColorFormat); + int setJpegFormat(enum MODE eMode, int iV4l2JpegFormat); + int setColorBufSize(enum MODE eMode, int *piBufSize, int iSize); + int setColorBufSize(int iFormat, int *piBufSize, int iSize, int width, int height); + + int checkBufType(struct BUFFER *pstBuf); + int getBufType(struct BUFFER *pstBuf); + + int getBuf(bool bCreateBuf, struct BUFFER *pstBuf, int *piBuf, int *iBufSize, int iSize, int iPlaneNum); + int setBuf(struct BUFFER *pstBuf, int *piBuf, int *iSize, int iPlaneNum); + + int getBuf(bool bCreateBuf, struct BUFFER *pstBuf, char **pcBuf, int *iBufSize, int iSize, int iPlaneNum); + int setBuf(struct BUFFER *pstBuf, char **pcBuf, int *iSize, int iPlaneNum); + int updateConfig(enum MODE eMode, int iInBufs, int iOutBufs, int iInBufPlanes, int iOutBufPlanes); + int execute(int iInBufPlanes, int iOutBufPlanes); +}; + +/* + * ExynosJpegEncoder class + */ +class ExynosJpegEncoder : public ExynosJpegBase { +public: + ExynosJpegEncoder(); + virtual ~ExynosJpegEncoder(); + + enum QUALITY { + QUALITY_LEVEL_1 = 0, /* high */ + QUALITY_LEVEL_2, + QUALITY_LEVEL_3, + QUALITY_LEVEL_4, + QUALITY_LEVEL_5, + QUALITY_LEVEL_6, /* low */ + }; + + int create(void); + int destroy(void); + + int setJpegConfig(void* pConfig); + + int checkInBufType(void); + int checkOutBufType(void); + + int getInBuf(int *piBuf, int *piInputSize, int iSize); + int getOutBuf(int *piBuf, int *piOutputSize); + + int setInBuf(int *piBuf, int *iSize); + int setOutBuf(int iBuf, int iSize); + + int getInBuf(char **pcBuf, int *piInputSize, int iSize); + int getOutBuf(char **pcBuf, int *piOutputSize); + + int setInBuf(char **pcBuf, int *iSize); + int setOutBuf(char *pcBuf, int iSize); + + int getSize(int *piWidth, int *piHeight); + int getColorFormat(void); + int setColorFormat(int iV4l2ColorFormat); + int setJpegFormat(int iV4l2JpegFormat); + int setColorBufSize(int *piBufSize, int iSize); + int updateConfig(void); + + int setQuality(int iQuality); + int getJpegSize(void); + + int encode(void); +}; + +/* + * ExynosJpegDecoder class + */ +class ExynosJpegDecoder : public ExynosJpegBase { +public: + ExynosJpegDecoder(); + virtual ~ExynosJpegDecoder(); + + int create(void); + int destroy(void); + + int setJpegConfig(void* pConfig); + + int checkInBufType(void); + int checkOutBufType(void); + + int getInBuf(int *piBuf, int *piInputSize); + int getOutBuf(int *picBuf, int *piOutputSize, int iSize); + + int setInBuf(int iBuf, int iSize); + int setOutBuf(int *piBuf, int *iSize); + + int getInBuf(char **pcBuf, int *piInputSize); + int getOutBuf(char **pcBuf, int *piOutputSize, int iSize); + + int setInBuf(char *pcBuf, int iSize); + int setOutBuf(char **pcBuf, int *iSize); + + int getSize(int *piWidth, int *piHeight); + int setColorFormat(int iV4l2ColorFormat); + int setJpegFormat(int iV4l2JpegFormat); + int updateConfig(void); + + int setScaledSize(int iW, int iH); + int setJpegSize(int iJpegSize); + + int decode(void); +}; + +#endif /* __EXYNOS_JPEG_BASE_H__ */ diff --git a/include/gralloc_priv.h b/include/gralloc_priv.h new file mode 100755 index 0000000000000000000000000000000000000000..059a018fca53092c2b1238eb8e8766a239ae75a2 --- /dev/null +++ b/include/gralloc_priv.h @@ -0,0 +1,178 @@ +/* + * Copyright (C) 2013 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef GRALLOC_PRIV_H_ +#define GRALLOC_PRIV_H_ + +#include +#include +#include +#include +#include +#include +#include + +#include + +#include + +/*****************************************************************************/ + +struct private_module_t; +struct private_handle_t; + +struct private_module_t { + gralloc_module_t base; + + private_handle_t* framebuffer; + uint32_t flags; + uint32_t numBuffers; + uint32_t bufferMask; + pthread_mutex_t lock; + buffer_handle_t currentBuffer; + int ionfd; + + struct fb_var_screeninfo info; + struct fb_fix_screeninfo finfo; + int xres; + int yres; + int line_length; + float xdpi; + float ydpi; + float fps; + void *queue; + pthread_mutex_t queue_lock; + +}; + +/*****************************************************************************/ + +#ifdef __cplusplus +struct private_handle_t : public native_handle { +#else +struct private_handle_t { + struct native_handle nativeHandle; +#endif + + enum { + PRIV_FLAGS_FRAMEBUFFER = 0x00000001, + PRIV_FLAGS_USES_UMP = 0x00000002, + PRIV_FLAGS_USES_ION = 0x00000020 + }; + + // file-descriptors + int fd; + int fd1; + int fd2; + // ints + int magic; + int flags; + int size; + int offset; + + int format; + int width; + int height; + int stride; + int vstride; + + // FIXME: the attributes below should be out-of-line + void *base; + void *base1; + void *base2; + struct ion_handle *handle; + struct ion_handle *handle1; + struct ion_handle *handle2; + +#ifdef __cplusplus + static const int sNumFds = 3; + static const int sNumInts = 15; + static const int sMagic = 0x3141592; + + private_handle_t(int fd, int size, int flags) : + fd(fd), fd1(-1), fd2(-1), magic(sMagic), flags(flags), size(size), + offset(0), format(0), width(0), height(0), stride(0), + vstride(0), base(0), base1(0), base2(0), handle(0), handle1(0), + handle2(0) + { + version = sizeof(native_handle); + numInts = sNumInts + 2; + numFds = sNumFds - 2; + } + + private_handle_t(int fd, int size, int flags, int w, + int h, int format, int stride, int vstride) : + fd(fd), fd1(-1), fd2(-1), magic(sMagic), flags(flags), size(size), + offset(0), format(format), width(w), height(h), stride(stride), + vstride(vstride), base(0), base1(0), base2(0), handle(0), handle1(0), + handle2(0) + { + version = sizeof(native_handle); + numInts = sNumInts + 2; + numFds = sNumFds - 2; + } + + private_handle_t(int fd, int fd1, int size, int flags, int w, + int h, int format, int stride, int vstride) : + fd(fd), fd1(fd1), fd2(-1), magic(sMagic), flags(flags), size(size), + offset(0), format(format), width(w), height(h), stride(stride), + vstride(vstride), base(0), base1(0), base2(0), handle(0), handle1(0), + handle2(0) + { + version = sizeof(native_handle); + numInts = sNumInts + 1; + numFds = sNumFds - 1; + } + + private_handle_t(int fd, int fd1, int fd2, int size, int flags, int w, + int h, int format, int stride, int vstride) : + fd(fd), fd1(fd1), fd2(fd2), magic(sMagic), flags(flags), size(size), + offset(0), format(format), width(w), height(h), stride(stride), + vstride(vstride), base(0), base1(0), base2(0), handle(0), handle1(0), + handle2(0) + { + version = sizeof(native_handle); + numInts = sNumInts; + numFds = sNumFds; + } + ~private_handle_t() { + magic = 0; + } + + static int validate(const native_handle* h) { + const private_handle_t* hnd = (const private_handle_t*)h; + if (!h || h->version != sizeof(native_handle) || + hnd->numInts + hnd->numFds != sNumInts + sNumFds || + hnd->magic != sMagic) + { + ALOGE("invalid gralloc handle (at %p)", reinterpret_cast(const_cast(h))); + return -EINVAL; + } + return 0; + } + + static private_handle_t* dynamicCast(const native_handle* in) + { + if (validate(in) == 0) + return (private_handle_t*) in; + + return NULL; + } + +#endif +}; + +#endif /* GRALLOC_PRIV_H_ */ diff --git a/include/sec_g2d_comp.h b/include/sec_g2d_comp.h new file mode 100644 index 0000000000000000000000000000000000000000..14ce4166dd20cd75fbdbe0680689098a21757083 --- /dev/null +++ b/include/sec_g2d_comp.h @@ -0,0 +1,78 @@ +/* + * Copyright Samsung Electronics Co.,LTD. + * Copyright (C) 2013 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +#include +#include + +/* int comp_value[src][dst][scale][filter_mode][blending_mode] + * [src] + * 0 : kRGB_565_Config + * 1 : kARGB_4444_Config + * 2 : kARGB_8888_Config + * 3 : kNo_Config + * [dst] + * 0 : kRGB_565_Config + * 1 : kARGB_4444_Config + * 2 : kARGB_8888_Config + * [scale] + * 0 : No scaling + * 1 : Scaling_up + * 2 : Scaling_down + * [filter_mode] + * 0 : nearest + * 1 : bilinear + * [blending_mode] + * 0 : SRC + * 1 : SRC_OVER + */ + +int comp_value[3][2][3][2][2] = { +//rgb565 to rgb565 +//{ nearest }, { bilinear } +//{ SRC , SRC_OVER }, { SRC , SRC_OVER } +{{ +{{ 135* 76,1920*1080 }, { 125* 70, 922* 519 }}, //No scaling +{{ 121* 68, 438* 246 }, { 111* 62, 145* 81 }}, //Scaling up +{{ 119* 67, 374* 211 }, { 96* 54, 144* 81 }}}, //Scaling down +//rgb565 to argb8888 +{ +{{ 194* 109, 221* 124 }, { 197* 111, 203* 114 }}, //No Scaling +{{ 201* 113, 201* 113 }, { 155* 87, 159* 89 }}, //Scaling up +{{ 202* 114, 200* 112 }, { 125* 70, 116* 66 }}} //Scaling down +}, +//argb8888 to rgb565 +{{ +{{ 136* 77, 343* 193 }, { 139* 78, 357* 201 }}, //No Scaling +{{ 148* 83, 282* 159 }, { 107* 60, 143* 81 }}, //Scaling up +{{ 144* 81, 243* 137 }, { 95* 53, 122* 69 }}}, //Scaling down +//argb8888 to argb8888 +{ +{{ 744* 418, 712* 401 }, { 736* 414, 478* 269 }}, //No Scaling +{{ 406* 228, 305* 172 }, { 187* 105, 162* 91 }}, //Scaling up +{{ 307* 173, 257* 144 }, { 118* 66, 115* 65 }}} //Scaling down +}, +//No Src to rgb565 (Not measured yet) +{{ +{{8000*8000,8000*8000 }, {8000*8000,8000*8000 }}, //No Scaling +{{8000*8000,8000*8000 }, {8000*8000,8000*8000 }}, //Scaling up +{{8000*8000,8000*8000 }, {8000*8000,8000*8000 }}}, //Scaling down +//No src to argb8888 (Fill to argb8888) +{ +{{1920*1080,1279* 719 }, {1266* 712,1276* 718 }}, //No Scaling +{{1272* 715,1272* 715 }, {1258* 707,1278* 719 }}, //Scaling up +{{1269* 714,1269* 714 }, {1258* 708,1271* 715 }}} //Scaling down +} +}; diff --git a/libcamera/Android.mk b/libcamera/Android.mk new file mode 100644 index 0000000000000000000000000000000000000000..0f5e33cbd6b88049383012f3ed800500ba5106fe --- /dev/null +++ b/libcamera/Android.mk @@ -0,0 +1,142 @@ +# Copyright (C) 2012 The Android Open Source Project +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +ifeq ($(TARGET_BOOTLOADER_BOARD_NAME), xyref5422) + +LOCAL_PATH:= $(call my-dir) + +################# +# libexynoscamera + +include $(CLEAR_VARS) + +LOCAL_PRELINK_MODULE := false + +LOCAL_SHARED_LIBRARIES:= libutils libcutils libbinder liblog libcamera_client libhardware +LOCAL_SHARED_LIBRARIES += libexynosutils libhwjpeg libexynosv4l2 libexynosgscaler libion_exynos libcsc +LOCAL_SHARED_LIBRARIES += libexpat libstlport +LOCAL_SHARED_LIBRARIES += libpower + +LOCAL_CFLAGS += -DGAIA_FW_BETA +LOCAL_CFLAGS += -DMAIN_CAMERA_SENSOR_NAME=$(BOARD_BACK_CAMERA_SENSOR) +LOCAL_CFLAGS += -DFRONT_CAMERA_SENSOR_NAME=$(BOARD_FRONT_CAMERA_SENSOR) +ifeq ($(BOARD_CAMERA_DISPLAY_WQHD), true) + LOCAL_CFLAGS += -DCAMERA_DISPLAY_WQHD +endif +LOCAL_CFLAGS += -DUSE_CAMERA_ESD_RESET +LOCAL_CFLAGS += -DBACK_ROTATION=$(BOARD_BACK_CAMERA_ROTATION) +LOCAL_CFLAGS += -DFRONT_ROTATION=$(BOARD_FRONT_CAMERA_ROTATION) + +LOCAL_C_INCLUDES += \ + $(LOCAL_PATH)/../include \ + $(LOCAL_PATH)/../libcamera \ + $(TOP)/hardware/samsung_slsi/exynos/libcamera/54xx \ + $(TOP)/hardware/samsung_slsi/exynos/libcamera/54xx/JpegEncoderForCamera \ + $(TOP)/hardware/samsung_slsi/exynos/libcamera/common \ + $(TOP)/hardware/samsung_slsi/exynos/libcamera/common/Pipes \ + $(TOP)/hardware/samsung_slsi/exynos/libcamera/common/Activities \ + $(TOP)/hardware/samsung_slsi/exynos/libcamera/common/Buffers \ + $(LOCAL_PATH)/../libcamera/Vendor \ + $(TOP)/hardware/samsung_slsi/exynos/include \ + $(TOP)/hardware/samsung_slsi/$(TARGET_SOC)/include \ + $(TOP)/hardware/samsung_slsi/$(TARGET_BOARD_PLATFORM)/include \ + $(TOP)/hardware/samsung_slsi/$(TARGET_BOARD_PLATFORM)/libcamera \ + $(TOP)/hardware/libhardware_legacy/include/hardware_legacy \ + $(TOP)/vendor/samsung/feature/CscFeature/libsecnativefeature \ + $(TOP)/bionic \ + $(TOP)/external/expat/lib \ + $(TOP)/external/stlport/stlport + +LOCAL_SRC_FILES:= \ + ExynosCameraSensorInfo.cpp \ + ../../exynos/libcamera/common/ExynosCameraFrame.cpp \ + ../../exynos/libcamera/common/ExynosCameraMemory.cpp \ + ../../exynos/libcamera/common/ExynosCameraUtils.cpp \ + ../../exynos/libcamera/common/ExynosCameraNode.cpp \ + ../../exynos/libcamera/common/ExynosCameraFrameSelector.cpp \ + ../../exynos/libcamera/common/Pipes/ExynosCameraPipe.cpp \ + ../../exynos/libcamera/common/Pipes/ExynosCameraPipeFlite.cpp \ + ../../exynos/libcamera/common/Pipes/ExynosCameraPipe3AA_ISP.cpp \ + ../../exynos/libcamera/common/Pipes/ExynosCameraPipeSCC.cpp \ + ../../exynos/libcamera/common/Pipes/ExynosCameraPipeSCP.cpp \ + ../../exynos/libcamera/common/Pipes/ExynosCameraPipeGSC.cpp \ + ../../exynos/libcamera/common/Pipes/ExynosCameraPipeJpeg.cpp \ + ../../exynos/libcamera/common/Pipes/ExynosCameraPipe3AA.cpp \ + ../../exynos/libcamera/common/Pipes/ExynosCameraPipe3AC.cpp \ + ../../exynos/libcamera/common/Pipes/ExynosCameraPipeISP.cpp \ + ../../exynos/libcamera/common/Buffers/ExynosCameraBufferManager.cpp \ + ../../exynos/libcamera/common/Buffers/ExynosCameraBufferLocker.cpp \ + ../../exynos/libcamera/common/Activities/ExynosCameraActivityBase.cpp \ + ../../exynos/libcamera/common/Activities/ExynosCameraActivityAutofocus.cpp \ + ../../exynos/libcamera/common/Activities/ExynosCameraActivityFlash.cpp \ + ../../exynos/libcamera/common/Activities/ExynosCameraActivitySpecialCapture.cpp \ + ../../exynos/libcamera/common/Activities/ExynosCameraActivityUCTL.cpp \ + ../../exynos/libcamera/54xx/JpegEncoderForCamera/ExynosJpegEncoderForCamera.cpp \ + ../../exynos/libcamera/54xx/ExynosCamera.cpp \ + ../../exynos/libcamera/54xx/ExynosCameraParameters.cpp \ + ../../exynos/libcamera/54xx/ExynosCameraFrameFactory.cpp \ + ../../exynos/libcamera/54xx/ExynosCameraFrameReprocessingFactory.cpp \ + ../../exynos/libcamera/54xx/ExynosCameraFrameFactoryFront.cpp \ + ../../exynos/libcamera/54xx/ExynosCameraActivityControl.cpp\ + ../../exynos/libcamera/54xx/ExynosCameraUtilsModule.cpp \ + ../../exynos/libcamera/54xx/ExynosCameraScalableSensor.cpp + +LOCAL_MODULE_TAGS := optional +LOCAL_MODULE := libexynoscamera + +include $(BUILD_SHARED_LIBRARY) + +################# +# libcamera + +include $(CLEAR_VARS) + +# HAL module implemenation stored in +# hw/..so +LOCAL_MODULE_PATH := $(TARGET_OUT_SHARED_LIBRARIES)/hw + +LOCAL_C_INCLUDES += \ + $(LOCAL_PATH)/../include \ + $(LOCAL_PATH)/../libcamera \ + $(LOCAL_PATH)/../libcamera/Vendor \ + $(TOP)/hardware/samsung_slsi/exynos/libcamera/54xx \ + $(TOP)/hardware/samsung_slsi/exynos/libcamera/54xx/JpegEncoderForCamera \ + $(TOP)/hardware/samsung_slsi/exynos/libcamera/common \ + $(TOP)/hardware/samsung_slsi/exynos/libcamera/common/Pipes \ + $(TOP)/hardware/samsung_slsi/exynos/libcamera/common/Activities \ + $(TOP)/hardware/samsung_slsi/exynos/libcamera/common/Buffers \ + $(TOP)/hardware/samsung_slsi/exynos/include \ + $(TOP)/hardware/samsung_slsi/$(TARGET_SOC)/include \ + $(TOP)/hardware/samsung_slsi/$(TARGET_BOARD_PLATFORM)/include \ + $(TOP)/hardware/samsung_slsi/$(TARGET_BOARD_PLATFORM)/libcamera \ + frameworks/native/include \ + system/media/camera/include + +LOCAL_SRC_FILES:= \ + ../../exynos/libcamera/common/ExynosCameraInterface.cpp + +LOCAL_CFLAGS += -DGAIA_FW_BETA +LOCAL_CFLAGS += -DBACK_ROTATION=$(BOARD_BACK_CAMERA_ROTATION) +LOCAL_CFLAGS += -DFRONT_ROTATION=$(BOARD_FRONT_CAMERA_ROTATION) + +LOCAL_SHARED_LIBRARIES:= libutils libcutils libbinder liblog libcamera_client libhardware +LOCAL_SHARED_LIBRARIES += libexynosutils libhwjpeg libexynosv4l2 libcsc libion_exynos libexynoscamera + +LOCAL_MODULE := camera.$(TARGET_BOOTLOADER_BOARD_NAME) + +LOCAL_MODULE_TAGS := optional + +include $(BUILD_SHARED_LIBRARY) + +endif diff --git a/libcamera/ExynosCameraConfig.h b/libcamera/ExynosCameraConfig.h new file mode 100644 index 0000000000000000000000000000000000000000..8692730c459c893da808d0637075f7e385233dd1 --- /dev/null +++ b/libcamera/ExynosCameraConfig.h @@ -0,0 +1,382 @@ +/* + * Copyright 2013, Samsung Electronics Co. LTD + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed toggle an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/*! + * \file ExynosCameraConfig.h + * \brief hearder file for ExynosCameraConfig + * \author Pilsun Jang(pilsun.jang@samsung.com) + * \date 2013/7/15 + * + */ + +#ifndef EXYNOS_CAMERA_CONFIG_H__ +#define EXYNOS_CAMERA_CONFIG_H__ + +#include + +#define BUILD_DATE() ALOGE("Build Date is (%s) (%s) ", __DATE__, __TIME__) +#define WHERE_AM_I() ALOGE("[(%s)%d] ", __FUNCTION__, __LINE__) +#define LOG_DELAY() usleep(100000) + +#define TARGET_ANDROID_VER_MAJ 4 +#define TARGET_ANDROID_VER_MIN 4 + +#define XPaste(s) s +#define Paste2(a, b) XPaste(a)b +#define ID "[%s]-" +#define ID_PARM m_name + +#define CLOGD(fmt, ...) \ + ALOGD(Paste2(ID, fmt), ID_PARM, ##__VA_ARGS__) + +#define CLOGV(fmt, ...) \ + ALOGV(Paste2(ID, fmt), ID_PARM, ##__VA_ARGS__) + +#define CLOGW(fmt, ...) \ + ALOGW(Paste2(ID, fmt), ID_PARM, ##__VA_ARGS__) + +#define CLOGE(fmt, ...) \ + ALOGE(Paste2(ID, fmt), ID_PARM, ##__VA_ARGS__) + +#define CLOGI(fmt, ...) \ + ALOGI(Paste2(ID, fmt), ID_PARM, ##__VA_ARGS__) + +#define CLOGT(cnt, fmt, ...) \ + if (cnt != 0) CLOGI(Paste2("#TRACE#", fmt), ##__VA_ARGS__) \ + +#define CLOG_ASSERT(fmt, ...) \ + android_printAssert(NULL, LOG_TAG, Paste2(ID, fmt), ID_PARM, ##__VA_ARGS__); + +#define ROUND_UP(x, a) (((x) + ((a)-1)) / (a) * (a)) +#define ROUND_OFF_HALF(x, dig) ((float)(floor((x) * pow(10.0f, dig) + 0.5) / pow(10.0f, dig))) + +#define CAMERA_ISP_ALIGN (8) +#define CAMERA_MAGIC_ALIGN (16) +/* This value for GSC alignment refer to "csc.h" */ +#define GSCALER_IMG_ALIGN (16) + +#define INITIAL_SKIP_FRAME (8) +#define EFFECT_SKIP_FRAME (1) +#define SMART_STAY_SKIP_COMPENSATION (1) + +/* Functions tobe enable */ +/* #define START_PICTURE_THREAD */ +/* #define SET_SETFILE_BY_SHOT */ + +#define SET_SETFILE_BY_SET_CTRL +#ifdef SET_SETFILE_BY_SET_CTRL +#define SET_SETFILE_BY_SET_CTRL_3AA_ISP (true) +#define SET_SETFILE_BY_SET_CTRL_ISP (true) +#define SET_SETFILE_BY_SET_CTRL_SCP (true) +#endif + +/* #define USE_DVFS_LOCK */ +/* #define SENSOR_NAME_GET_FROM_FILE */ +/* #define RESERVED_MEMORY_ENABLE */ +#define RESERVED_BUFFER_COUNT_MAX (5) +/* #define USE_BNS_RECORDING */ +/* #define FPS_CHECK */ +#define USE_FD_AE +#define FD_ROTATION (true) + +#define SHOT_RECOVERY (true) +#ifdef SHOT_RECOVERY +#define SHOT_RECOVERY_COUNT (0) +#else +#define SHOT_RECOVERY_COUNT (0) +#endif + +#define USE_ADAPTIVE_CSC_RECORDING (false) +#define USE_HIGHSPEED_RECORDING (false) + +#define USE_FASTEN_AE_STABLE (false) +#define FASTEN_AE_WIDTH (1312) +#define FASTEN_AE_HEIGHT (738) +#define FASTEN_AE_FPS (120) +#define DEFAULT_BNS_RATIO (2) +#define USE_CAMERA_SIZE_TABLE (true) + +#define USE_PURE_BAYER_REPROCESSING (true) + +/* This USE_DYNAMIC_BAYER define is for default scenario. + * See for details of dynamic bayer setting + */ +#define USE_DYNAMIC_BAYER (false) + +enum REPROCESSING_BAYER_MODE { + REPROCESSING_BAYER_MODE_NONE = 0, /* This means capture do not use reprocessing */ + REPROCESSING_BAYER_MODE_PURE_ALWAYS_ON, + REPROCESSING_BAYER_MODE_DIRTY_ALWAYS_ON, + REPROCESSING_BAYER_MODE_PURE_DYNAMIC, + REPROCESSING_BAYER_MODE_DIRTY_DYNAMIC, + REPROCESSING_BAYER_MODE_MAX, +}; + +#define USE_DYNAMIC_SCC_REAR (false) +#define USE_DYNAMIC_SCC_FRONT (false) + +#define USE_GSC_FOR_CAPTURE_BACK (false) +#define USE_GSC_FOR_CAPTURE_FRONT (true) + +#define MAX_SERIES_SHOT_COUNT (21) + +#ifdef SENSOR_NAME_GET_FROM_FILE +#define SENSOR_NAME_PATH_BACK "vendor specifics" +#define SSENSOR_NAME_PATH_BACK "vendor specifics" +#endif + +#define EXYNOS_CAMERA_NAME_STR_SIZE (256) +#define CAMERA_PACKED_BAYER_ENABLE +#define USE_BUFFER_WITH_STRIDE + +#define MAIN_CAMERA_FLITE_NUM FIMC_IS_VIDEO_SS0_NUM +#define MAIN_CAMERA_3AA_NUM FIMC_IS_VIDEO_3A0_NUM +#define MAIN_CAMERA_3AP_NUM FIMC_IS_VIDEO_3A0P_NUM +#define MAIN_CAMERA_3AC_NUM FIMC_IS_VIDEO_3A0C_NUM +#define MAIN_CAMERA_3AA_OTF (1) +#define MAIN_CAMERA_REPROCESSING (true) +#define MAIN_CAMERA_SCC_CAPTURE (false) + +#define FRONT_CAMERA_FLITE_NUM FIMC_IS_VIDEO_SS1_NUM +#define FRONT_CAMERA_3AA_NUM FIMC_IS_VIDEO_3A1_NUM +#define FRONT_CAMERA_3AP_NUM FIMC_IS_VIDEO_3A1P_NUM +#define FRONT_CAMERA_3AA_OTF (0) +#define FRONT_CAMERA_REPROCESSING (false) +#define FRONT_CAMERA_SCC_CAPTURE (true) + +#define REPROCESSING_3AA_NUM FIMC_IS_VIDEO_3A1_NUM + +#define REPROCESSING_SHIFT (28) +#define OTF_3AA_SHIFT (24) +#define SSX_VINDEX_SHIFT (16) +#define TAX_VINDEX_SHIFT (8) + +#define SENSOR_NOBLOCK_SHIFT (28) +#define SENSOR_INSTANT_SHIFT (16) +#define SENSOR_SSTREAM_SHIFT (0) + +#define NODE_PREFIX "/dev/video" + +#define PREVIEW_GSC_NODE_NUM (4) /* 4 = MSC from Exynos5420 */ +#define PICTURE_GSC_NODE_NUM (5) /* 0,1,2 = GSC */ +#define VIDEO_GSC_NODE_NUM (4) + +#define MAX_BUFFERS (32) +#define NUM_BAYER_BUFFERS (6 + REPROCESSING_BAYER_HOLD_COUNT + SHOT_RECOVERY_COUNT) +#define INIT_BAYER_BUFFERS (5 + SHOT_RECOVERY_COUNT) +#define NUM_PREVIEW_BUFFERS (9 + SHOT_RECOVERY_COUNT) +#define NUM_PREVIEW_SPARE_BUFFERS (3) +#define NUM_PICTURE_BUFFERS NUM_BAYER_BUFFERS +#define NUM_REPROCESSING_BUFFERS (1) +#define NUM_RECORDING_BUFFERS (8) +#define NUM_FASTAESTABLE_BUFFER (10) +#define NUM_PREVIEW_BUFFERS_MARGIN (2) +#define NUM_FRAME_PREPARE_COUNT (6) +#define NUM_BURST_GSC_JPEG_INIT_BUFFER (4) /* Number of pre-allicated buffer for burst shot + Increasing this number will increase takePicture()'s + response time. Currently it is defined as + (# of JPEG save thread) + 1 */ + +/* TO DO : will remove */ +#define REPROCESSING_BAYER_HOLD_COUNT (1) +#define FRONT_NUM_BAYER_BUFFERS (6) +#define FRONT_NUM_PICTURE_BUFFERS FRONT_NUM_BAYER_BUFFERS + +#define MFC_7X_BUFFER_OFFSET (256) + +#define V4L2_CAMERA_MEMORY_TYPE (V4L2_MEMORY_DMABUF) /* (V4L2_MEMORY_USERPTR) */ +#define JPEG_INPUT_COLOR_FMT (V4L2_PIX_FMT_YUYV) +#define CAMERA_BAYER_FORMAT (V4L2_PIX_FMT_SBGGR12) + +#define ERROR_POLLING_DETECTED (-1001) +#define ERROR_DQ_BLOCKED_DETECTED (-1002) +#define ERROR_DQ_BLOCKED_COUNT (20) +#define WARNING_3AA_THREAD_INTERVAL (100000) +#define WARNING_SCP_THREAD_INTERVAL (100000) +#define MONITOR_THREAD_INTERVAL (200000) + +#define FRAME_MIN_NUM (3) + +#define EXYNOS_CAMERA_BUFFER_MAX_PLANES (4) /* img buffer 3 + metadata 1 */ +#define EXYNOS_CAMERA_META_PLANE_SIZE (32 * 1024) +#define GRALLOC_LOCK_FOR_CAMERA (GRALLOC_SET_USAGE_FOR_CAMERA) + +#define EXYNOS_CAMERA_PREVIEW_FPS_REFERENCE (60) + +#define NUM_OF_DETECTED_FACES (16) +#define NUM_OF_DETECTED_FACES_THRESHOLD (0) + +#define PERFRAME_NODE_GROUP_MAX (3) +#define PERFRAME_NODE_GROUP_0 (0) +#define PERFRAME_NODE_GROUP_1 (1) +#define PERFRAME_NODE_GROUP_2 (2) + +#define PERFRAME_INFO_INDEX_MAX (3) +#define PERFRAME_INFO_INDEX_0 (0) +#define PERFRAME_INFO_INDEX_1 (1) +#define PERFRAME_INFO_INDEX_2 (2) + +#define PERFRAME_CONTROL_NODE_3AA +/* #define PERFRAME_CONTROL_NODE_ISP */ +#define PERFRAME_INFO_3AA PERFRAME_INFO_INDEX_0 +#define PERFRAME_INFO_ISP PERFRAME_INFO_INDEX_1 +#define PERFRAME_INFO_DIRTY_REPROCESSING_ISP PERFRAME_INFO_INDEX_0 + +#define PERFRAME_INFO_PURE_REPROCESSING_3AA PERFRAME_INFO_INDEX_0 +#define PERFRAME_INFO_PURE_REPROCESSING_ISP PERFRAME_INFO_INDEX_1 + +#define PERFRAME_3AA_POS PER_FRAME_GROUP_0 +#define PERFRAME_ISP_POS PER_FRAME_GROUP_1 + +#define PERFRAME_BACK_3AC_POS (0) +#define PERFRAME_BACK_3AP_POS (1) +#define PERFRAME_BACK_SCC_POS (0) +#define PERFRAME_BACK_SCP_POS (0) + +#define PERFRAME_REPROCESSING_3AP_POS (0) +#define PERFRAME_REPROCESSING_SCC_POS (0) +#define PERFRAME_FRONT_3AP_POS (0) +#define PERFRAME_FRONT_SCC_POS (0) +#define PERFRAME_FRONT_SCP_POS (1) + +#define WAITING_TIME (5000) /* 5msec */ +#define TOTAL_WAITING_TIME (3000 * 1000) /* 3000msec */ +#define TOTAL_WAITING_COUNT (3) +#define TOTAL_FLASH_WATING_COUNT (10) + +#define DM_WAITING_TIME (30 * 1000) /* 30msec */ +#define DM_WAITING_COUNT (10) + +/* callback state */ +#define CALLBACK_STATE_PREVIEW_META (1) +#define CALLBACK_STATE_PREVIEW_FRAME (2) +#define CALLBACK_STATE_RAW_IMAGE (3) +#define CALLBACK_STATE_POSTVIEW_FRAME (4) +#define CALLBACK_STATE_COMPRESSED_IMAGE (5) + +#define GRALLOC_SET_USAGE_FOR_CAMERA \ + (GRALLOC_USAGE_SW_READ_OFTEN | \ + GRALLOC_USAGE_SW_WRITE_OFTEN | \ + GRALLOC_USAGE_HW_TEXTURE | \ + GRALLOC_USAGE_HW_COMPOSER | \ + GRALLOC_USAGE_EXTERNAL_DISP) + +enum YUV_RANGE { + YUV_FULL_RANGE = 0, + YUV_LIMITED_RANGE = 1, +}; + +enum pipeline { + PIPE_FLITE = 0, + PIPE_3AC, + PIPE_ISP, + PIPE_3AA_ISP, + PIPE_SCC, + PIPE_SCP, + PIPE_GSC, + PIPE_GSC_VIDEO, + PIPE_GSC_PICTURE, + PIPE_JPEG, + MAX_PIPE_NUM, + + PIPE_FLITE_FRONT = 100, + PIPE_3AA_FRONT, + PIPE_3AC_FRONT, + PIPE_ISP_FRONT, + PIPE_SCC_FRONT, + PIPE_SCP_FRONT, + PIPE_GSC_FRONT, + PIPE_GSC_PICTURE_FRONT, + PIPE_GSC_VIDEO_FRONT, + PIPE_JPEG_FRONT, + MAX_PIPE_NUM_FRONT, + + PIPE_3AA_REPROCESSING = 200, + PIPE_3AC_REPROCESSING, + PIPE_ISP_REPROCESSING, + PIPE_SCC_REPROCESSING, + PIPE_SCP_REPROCESSING, + PIPE_GSC_REPROCESSING, + PIPE_JPEG_REPROCESSING, + MAX_PIPE_NUM_REPROCESSING +}; + +enum fimc_is_video_dev_num { + FIMC_IS_VIDEO_SS0_NUM = 100, + FIMC_IS_VIDEO_SS1_NUM = 101, + FIMC_IS_VIDEO_SS2_NUM = 102, + FIMC_IS_VIDEO_SS3_NUM = 103, + FIMC_IS_VIDEO_3A0_NUM = 110, + FIMC_IS_VIDEO_3A0C_NUM = 111, + FIMC_IS_VIDEO_3A0P_NUM = 112, + FIMC_IS_VIDEO_3A1_NUM = 114, + FIMC_IS_VIDEO_3A1C_NUM = 115, + FIMC_IS_VIDEO_3A1P_NUM = 116, + FIMC_IS_VIDEO_ISP_NUM = 130, + FIMC_IS_VIDEO_SCC_NUM = 134, + FIMC_IS_VIDEO_SCP_NUM = 137, + FIMC_IS_VIDEO_VDC_NUM = 140, + FIMC_IS_VIDEO_VDO_NUM = 141, + FIMC_IS_VIDEO_FD_NUM = 146, + FIMC_IS_VIDEO_MAX_NUM = 149, +}; + +typedef enum +{ + SENSOR_NAME_NOTHING = 0, + SENSOR_NAME_S5K3H2 = 1, // 1 ~ 100, SLSI sensors + SENSOR_NAME_S5K6A3 = 2, + SENSOR_NAME_S5K3H5 = 3, + SENSOR_NAME_S5K3H7 = 4, + SENSOR_NAME_S5K3H7_SUNNY = 5, + SENSOR_NAME_S5K3H7_SUNNY_2M = 6, + SENSOR_NAME_S5K6B2 = 7, + SENSOR_NAME_S5K3L2 = 8, + SENSOR_NAME_S5K4E5 = 9, + SENSOR_NAME_S5K2P2 = 10, + SENSOR_NAME_S5K8B1 = 11, + SENSOR_NAME_S5K1P2 = 12, + + SENSOR_NAME_IMX135 = 101, // 101 ~ 200 Sony sensors + + SENSOR_NAME_SR261 = 201, // 201 ~ 300 Other vendor sensors + + SENSOR_NAME_END, + SENSOR_NAME_CUSTOM = 301, +/* HACK: Remove this define after Driver commonized */ + SENSOR_NAME_IMX134, + SENSOR_NAME_S5K4H5, + SENSOR_NAME_IMX175, +/* End of HACK */ +}IS_SensorNameEnum; + + +/* This struct used in recording callback */ +/* This struct passes to OMX */ +struct addrs { + uint32_t type; /* make sure that this is 4 byte. */ + unsigned int fdPlaneY; + unsigned int fdPlaneCbcr; + unsigned int bufIndex; + unsigned int reserved; +}; + +/* for test */ +/* #define SCALABLE_ON */ +/* #define TEST_GED_HIGH_SPEED_RECORDING */ +/* #define TEST_APP_HIGH_SPEED_RECORDING */ /* for ArtCamera */ + +#endif /* EXYNOS_CAMERA_CONFIG_H__ */ diff --git a/libcamera/ExynosCameraSensorInfo.cpp b/libcamera/ExynosCameraSensorInfo.cpp new file mode 100644 index 0000000000000000000000000000000000000000..eec870da1df9474207972fe7068cebb9de72876f --- /dev/null +++ b/libcamera/ExynosCameraSensorInfo.cpp @@ -0,0 +1,1750 @@ +/* +** +** Copyright 2013, Samsung Electronics Co. LTD +** +** Licensed under the Apache License, Version 2.0 (the "License"); +** you may not use this file except in compliance with the License. +** You may obtain a copy of the License at +** +** http://www.apache.org/licenses/LICENSE-2.0 +** +** Unless required by applicable law or agreed to in writing, software +** distributed under the License is distributed on an "AS IS" BASIS, +** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +** See the License for the specific language governing permissions and +** limitations under the License. +*/ + +/*#define LOG_NDEBUG 0 */ +#define LOG_TAG "ExynosCameraUtils" +#include + +#include "ExynosCameraSensorInfo.h" + +namespace android { + +#ifdef SENSOR_NAME_GET_FROM_FILE +int g_rearSensorId = -1; +int g_frontSensorId = -1; +#endif + +struct ExynosSensorInfo *createSensorInfo(int camId) +{ + struct ExynosSensorInfo *sensorInfo = NULL; + int sensorName = getSensorId(camId); + if (sensorName < 0) { + ALOGE("ERR(%s[%d]): Inavalid camId, sensor name is nothing", __FUNCTION__, __LINE__); + sensorName = SENSOR_NAME_NOTHING; + } + + switch (sensorName) { + case SENSOR_NAME_S5K6B2: + sensorInfo = new ExynosSensorS5K6B2(); + break; + case SENSOR_NAME_S5K3L2: + sensorInfo = new ExynosSensorS5K3L2(); + break; + case SENSOR_NAME_S5K2P2: + sensorInfo = new ExynosSensorS5K2P2(); + break; + case SENSOR_NAME_IMX135: + sensorInfo = new ExynosSensorIMX135(); + break; + case SENSOR_NAME_IMX134: + sensorInfo = new ExynosSensorIMX134(); + break; + case SENSOR_NAME_S5K6A3: + sensorInfo = new ExynosSensorS5K6A3(); + break; + case SENSOR_NAME_S5K3H5: + sensorInfo = new ExynosSensorS5K3H5(); + break; + case SENSOR_NAME_S5K4H5: + sensorInfo = new ExynosSensorS5K4H5(); + break; + case SENSOR_NAME_S5K3H7: + case SENSOR_NAME_S5K3H7_SUNNY: + sensorInfo = new ExynosSensorS5K3H7(); + break; + case SENSOR_NAME_IMX175: + sensorInfo = new ExynosSensorIMX175(); + break; + case SENSOR_NAME_S5K8B1: + sensorInfo = new ExynosSensorS5K8B1(); + break; + default: + ALOGW("WRN(%s[%d]): Unknown sensor, create default sensor", __FUNCTION__, __LINE__); + sensorInfo = new ExynosSensorInfo(); + break; + } + + return sensorInfo; +} + +bool needGSCForCapture(int camId) +{ + return (camId == CAMERA_ID_BACK) ? USE_GSC_FOR_CAPTURE_BACK : USE_GSC_FOR_CAPTURE_FRONT; +} + +int getSensorId(int camId) +{ + int sensorId = -1; + +#ifdef SENSOR_NAME_GET_FROM_FILE + int &curSensorId = (camId == CAMERA_ID_BACK) ? g_rearSensorId : g_frontSensorId; + + if (curSensorId < 0) { + curSensorId = getSensorIdFromFile(camId); + if (curSensorId < 0) { + ALOGE("ERR(%s): invalid sensor ID %d", __FUNCTION__, sensorId); + } + } + + sensorId = curSensorId; +#else + if (camId == CAMERA_ID_BACK) { + sensorId = MAIN_CAMERA_SENSOR_NAME; + } else if (camId == CAMERA_ID_FRONT) { + sensorId = FRONT_CAMERA_SENSOR_NAME; + } else { + ALOGE("ERR(%s):Unknown camera ID(%d)", __FUNCTION__, camId); + } +#endif + + return sensorId; +} + +ExynosSensorInfo::ExynosSensorInfo() +{ + maxPreviewW = 1920; + maxPreviewH = 1080; + maxPictureW = 4128; + maxPictureH = 3096; + maxVideoW = 1920; + maxVideoH = 1080; + maxSensorW = 4128; + maxSensorH = 3096; + maxThumbnailW = 512; + maxThumbnailH = 384; + + fNumberNum = 22; + fNumberDen = 10; + focalLengthNum = 420; + focalLengthDen = 100; + focusDistanceNum = 0; + focusDistanceDen = 0; + apertureNum = 227; + apertureDen = 100; + horizontalViewAngle = 51.2f; + verticalViewAngle = 39.4f; + focalLengthIn35mmLength = 31; + + minExposureCompensation = -4; + maxExposureCompensation = 4; + exposureCompensationStep = 0.5f; + maxNumDetectedFaces = 16; + maxNumFocusAreas = 1; + maxNumMeteringAreas = 1; + maxZoomLevel = ZOOM_LEVEL_MAX; + maxZoomRatio = 400; + + zoomSupport = true; + smoothZoomSupport = false; + videoSnapshotSupport = true; + videoStabilizationSupport = true; + autoWhiteBalanceLockSupport = true; + autoExposureLockSupport = true; + + antiBandingList = + ANTIBANDING_AUTO + | ANTIBANDING_50HZ + | ANTIBANDING_60HZ + | ANTIBANDING_OFF + ; + + effectList = + EFFECT_NONE + | EFFECT_MONO + | EFFECT_NEGATIVE + | EFFECT_SOLARIZE + | EFFECT_SEPIA + | EFFECT_POSTERIZE + | EFFECT_WHITEBOARD + | EFFECT_BLACKBOARD + | EFFECT_AQUA; + + flashModeList = + FLASH_MODE_OFF + | FLASH_MODE_AUTO + | FLASH_MODE_ON + | FLASH_MODE_RED_EYE + | FLASH_MODE_TORCH; + + focusModeList = + FOCUS_MODE_AUTO + | FOCUS_MODE_INFINITY + | FOCUS_MODE_MACRO + | FOCUS_MODE_FIXED + | FOCUS_MODE_EDOF + | FOCUS_MODE_CONTINUOUS_VIDEO + | FOCUS_MODE_CONTINUOUS_PICTURE + | FOCUS_MODE_TOUCH; + + sceneModeList = + SCENE_MODE_AUTO + | SCENE_MODE_ACTION + | SCENE_MODE_PORTRAIT + | SCENE_MODE_LANDSCAPE + | SCENE_MODE_NIGHT + | SCENE_MODE_NIGHT_PORTRAIT + | SCENE_MODE_THEATRE + | SCENE_MODE_BEACH + | SCENE_MODE_SNOW + | SCENE_MODE_SUNSET + | SCENE_MODE_STEADYPHOTO + | SCENE_MODE_FIREWORKS + | SCENE_MODE_SPORTS + | SCENE_MODE_PARTY + | SCENE_MODE_CANDLELIGHT; + + whiteBalanceList = + WHITE_BALANCE_AUTO + | WHITE_BALANCE_INCANDESCENT + | WHITE_BALANCE_FLUORESCENT + | WHITE_BALANCE_WARM_FLUORESCENT + | WHITE_BALANCE_DAYLIGHT + | WHITE_BALANCE_CLOUDY_DAYLIGHT + | WHITE_BALANCE_TWILIGHT + | WHITE_BALANCE_SHADE; + + previewSizeLutMax = 0; + pictureSizeLutMax = 0; + videoSizeLutMax = 0; + previewSizeLut = NULL; + pictureSizeLut = NULL; + videoSizeLut = NULL; + videoSizeLutHighSpeed = NULL; + sizeTableSupport = false; + + /* vendor specifics */ + highResolutionCallbackW = 3264; + highResolutionCallbackH = 1836; + highSpeedRecording60WFHD = 1920; + highSpeedRecording60HFHD = 1080; + highSpeedRecording60W = 1008; + highSpeedRecording60H = 566; + highSpeedRecording120W = 1008; + highSpeedRecording120H = 566; + scalableSensorSupport = true; + bnsSupport = false; + minFps = 0; + maxFps = 30; +} + +ExynosSensorIMX135::ExynosSensorIMX135() +{ + maxPreviewW = 1920; + maxPreviewH = 1080; + maxPictureW = 4128; + maxPictureH = 3096; + maxVideoW = 1920; + maxVideoH = 1080; + maxSensorW = 4128; + maxSensorH = 3096; + maxThumbnailW = 512; + maxThumbnailH = 384; + + fNumberNum = 22; + fNumberDen = 10; + focalLengthNum = 420; + focalLengthDen = 100; + focusDistanceNum = 0; + focusDistanceDen = 0; + apertureNum = 227; + apertureDen = 100; + horizontalViewAngle = 51.2f; + verticalViewAngle = 39.4f; + focalLengthIn35mmLength = 31; + + minFps = 1; + maxFps = 30; + + minExposureCompensation = -4; + maxExposureCompensation = 4; + exposureCompensationStep = 0.5f; + maxNumDetectedFaces = 16; + maxNumFocusAreas = 2; + maxNumMeteringAreas = 32; + maxZoomLevel = ZOOM_LEVEL_MAX; + maxZoomRatio = 400; + + zoomSupport = true; + smoothZoomSupport = false; + videoSnapshotSupport = true; + videoStabilizationSupport = true; + autoWhiteBalanceLockSupport = true; + autoExposureLockSupport = true; + + antiBandingList = + ANTIBANDING_AUTO + | ANTIBANDING_50HZ + | ANTIBANDING_60HZ + | ANTIBANDING_OFF + ; + + effectList = + EFFECT_NONE + | EFFECT_MONO + | EFFECT_NEGATIVE + /*| EFFECT_SOLARIZE*/ + | EFFECT_SEPIA + | EFFECT_POSTERIZE + /*| EFFECT_WHITEBOARD*/ + /*| EFFECT_BLACKBOARD*/ + | EFFECT_AQUA + ; + + flashModeList = + FLASH_MODE_OFF + | FLASH_MODE_AUTO + | FLASH_MODE_ON + /*| FLASH_MODE_RED_EYE*/ + | FLASH_MODE_TORCH; + + focusModeList = + FOCUS_MODE_AUTO + /*| FOCUS_MODE_INFINITY*/ + | FOCUS_MODE_MACRO + /*| FOCUS_MODE_FIXED*/ + /*| FOCUS_MODE_EDOF*/ + | FOCUS_MODE_CONTINUOUS_VIDEO + | FOCUS_MODE_CONTINUOUS_PICTURE + | FOCUS_MODE_TOUCH; + + sceneModeList = + SCENE_MODE_AUTO + | SCENE_MODE_ACTION + | SCENE_MODE_PORTRAIT + | SCENE_MODE_LANDSCAPE + | SCENE_MODE_NIGHT + | SCENE_MODE_NIGHT_PORTRAIT + | SCENE_MODE_THEATRE + | SCENE_MODE_BEACH + | SCENE_MODE_SNOW + | SCENE_MODE_SUNSET + | SCENE_MODE_STEADYPHOTO + | SCENE_MODE_FIREWORKS + | SCENE_MODE_SPORTS + | SCENE_MODE_PARTY + | SCENE_MODE_CANDLELIGHT; + + whiteBalanceList = + WHITE_BALANCE_AUTO + | WHITE_BALANCE_INCANDESCENT + | WHITE_BALANCE_FLUORESCENT + /*| WHITE_BALANCE_WARM_FLUORESCENT*/ + | WHITE_BALANCE_DAYLIGHT + | WHITE_BALANCE_CLOUDY_DAYLIGHT + /*| WHITE_BALANCE_TWILIGHT*/ + /*| WHITE_BALANCE_SHADE*/ + ; + + previewSizeLutMax = 0; + pictureSizeLutMax = 0; + videoSizeLutMax = 0; + previewSizeLut = NULL; + pictureSizeLut = NULL; + videoSizeLut = NULL; + videoSizeLutHighSpeed = NULL; + sizeTableSupport = false; + + /* vendor specifics */ + highResolutionCallbackW = 3264; + highResolutionCallbackH = 1836; + highSpeedRecording60WFHD = 1920; + highSpeedRecording60HFHD = 1080; + highSpeedRecording60W = 1008; + highSpeedRecording60H = 566; + highSpeedRecording120W = 1008; + highSpeedRecording120H = 566; + scalableSensorSupport = true; + bnsSupport = false; +}; + +ExynosSensorIMX134::ExynosSensorIMX134() +{ + maxPreviewW = 1920; + maxPreviewH = 1080; + maxPictureW = 3264; + maxPictureH = 2448; + maxVideoW = 1920; + maxVideoH = 1080; + maxSensorW = 3264; + maxSensorH = 2448; + + maxThumbnailW = 512; + maxThumbnailH = 384; + + fNumberNum = 22; + fNumberDen = 10; + focalLengthNum = 420; + focalLengthDen = 100; + focusDistanceNum = 0; + focusDistanceDen = 0; + apertureNum = 227; + apertureDen = 100; + horizontalViewAngle = 51.2f; + verticalViewAngle = 39.4f; + focalLengthIn35mmLength = 31; + + minFps = 1; + maxFps = 30; + + minExposureCompensation = -4; + maxExposureCompensation = 4; + exposureCompensationStep = 0.5f; + maxNumDetectedFaces = 16; + maxNumFocusAreas = 2; + maxNumMeteringAreas = 32; + maxZoomLevel = ZOOM_LEVEL_MAX; + maxZoomRatio = 400; + + zoomSupport = true; + smoothZoomSupport = false; + videoSnapshotSupport = true; + videoStabilizationSupport = false; + autoWhiteBalanceLockSupport = false; + autoExposureLockSupport = true; + + antiBandingList = + ANTIBANDING_AUTO + | ANTIBANDING_50HZ + | ANTIBANDING_60HZ + | ANTIBANDING_OFF + ; + + effectList = + EFFECT_NONE + | EFFECT_MONO + | EFFECT_NEGATIVE + /*| EFFECT_SOLARIZE*/ + | EFFECT_SEPIA + | EFFECT_POSTERIZE + /*| EFFECT_WHITEBOARD*/ + /*| EFFECT_BLACKBOARD*/ + | EFFECT_AQUA + ; + + flashModeList = + FLASH_MODE_OFF + | FLASH_MODE_AUTO + | FLASH_MODE_ON + /*| FLASH_MODE_RED_EYE*/ + | FLASH_MODE_TORCH; + + focusModeList = + FOCUS_MODE_AUTO + /*| FOCUS_MODE_INFINITY*/ + | FOCUS_MODE_MACRO + /*| FOCUS_MODE_FIXED*/ + /*| FOCUS_MODE_EDOF*/ + | FOCUS_MODE_CONTINUOUS_VIDEO + | FOCUS_MODE_CONTINUOUS_PICTURE + | FOCUS_MODE_TOUCH; + + sceneModeList = + SCENE_MODE_AUTO + | SCENE_MODE_ACTION + | SCENE_MODE_PORTRAIT + | SCENE_MODE_LANDSCAPE + | SCENE_MODE_NIGHT + | SCENE_MODE_NIGHT_PORTRAIT + | SCENE_MODE_THEATRE + | SCENE_MODE_BEACH + | SCENE_MODE_SNOW + | SCENE_MODE_SUNSET + | SCENE_MODE_STEADYPHOTO + | SCENE_MODE_FIREWORKS + | SCENE_MODE_SPORTS + | SCENE_MODE_PARTY + | SCENE_MODE_CANDLELIGHT; + + whiteBalanceList = + WHITE_BALANCE_AUTO + | WHITE_BALANCE_INCANDESCENT + | WHITE_BALANCE_FLUORESCENT + /*| WHITE_BALANCE_WARM_FLUORESCENT*/ + | WHITE_BALANCE_DAYLIGHT + | WHITE_BALANCE_CLOUDY_DAYLIGHT + /*| WHITE_BALANCE_TWILIGHT*/ + /*| WHITE_BALANCE_SHADE*/ + ; + + previewSizeLutMax = 0; + pictureSizeLutMax = 0; + videoSizeLutMax = 0; + previewSizeLut = NULL; + pictureSizeLut = NULL; + videoSizeLut = NULL; + videoSizeLutHighSpeed = NULL; + sizeTableSupport = false; + + /* vendor specifics */ + /* + burstPanoramaW = 3264; + burstPanoramaH = 1836; + highSpeedRecording60WFHD = 1920; + highSpeedRecording60HFHD = 1080; + highSpeedRecording60W = 1008; + highSpeedRecording60H = 566; + highSpeedRecording120W = 1008; + highSpeedRecording120H = 566; + scalableSensorSupport = true; + */ + bnsSupport = false; +}; + +ExynosSensorS5K3L2::ExynosSensorS5K3L2() +{ + maxPreviewW = 1920; + maxPreviewH = 1080; + maxPictureW = 4128; + maxPictureH = 3096; + maxVideoW = 1920; + maxVideoH = 1080; + maxSensorW = 4128; + maxSensorH = 3096; + maxThumbnailW = 512; + maxThumbnailH = 384; + + fNumberNum = 22; + fNumberDen = 10; + focalLengthNum = 420; + focalLengthDen = 100; + focusDistanceNum = 0; + focusDistanceDen = 0; + apertureNum = 227; + apertureDen = 100; + horizontalViewAngle = 51.2f; + verticalViewAngle = 39.4f; + focalLengthIn35mmLength = 31; + + minFps = 1; + maxFps = 30; + + minExposureCompensation = -4; + maxExposureCompensation = 4; + exposureCompensationStep = 0.5f; + maxNumDetectedFaces = 16; + maxNumFocusAreas = 2; + maxNumMeteringAreas = 32; + maxZoomLevel = ZOOM_LEVEL_MAX; + maxZoomRatio = 400; + + zoomSupport = true; + smoothZoomSupport = false; + videoSnapshotSupport = true; + videoStabilizationSupport = true; + autoWhiteBalanceLockSupport = true; + autoExposureLockSupport = true; + + antiBandingList = + ANTIBANDING_AUTO + | ANTIBANDING_50HZ + | ANTIBANDING_60HZ + | ANTIBANDING_OFF + ; + + effectList = + EFFECT_NONE + | EFFECT_MONO + | EFFECT_NEGATIVE + /*| EFFECT_SOLARIZE*/ + | EFFECT_SEPIA + | EFFECT_POSTERIZE + /*| EFFECT_WHITEBOARD*/ + /*| EFFECT_BLACKBOARD*/ + | EFFECT_AQUA + ; + + flashModeList = + FLASH_MODE_OFF + | FLASH_MODE_AUTO + | FLASH_MODE_ON + /*| FLASH_MODE_RED_EYE*/ + | FLASH_MODE_TORCH; + + focusModeList = + FOCUS_MODE_AUTO + /*| FOCUS_MODE_INFINITY*/ + | FOCUS_MODE_MACRO + /*| FOCUS_MODE_FIXED*/ + /*| FOCUS_MODE_EDOF*/ + | FOCUS_MODE_CONTINUOUS_VIDEO + | FOCUS_MODE_CONTINUOUS_PICTURE + | FOCUS_MODE_TOUCH; + + sceneModeList = + SCENE_MODE_AUTO + | SCENE_MODE_ACTION + | SCENE_MODE_PORTRAIT + | SCENE_MODE_LANDSCAPE + | SCENE_MODE_NIGHT + | SCENE_MODE_NIGHT_PORTRAIT + | SCENE_MODE_THEATRE + | SCENE_MODE_BEACH + | SCENE_MODE_SNOW + | SCENE_MODE_SUNSET + | SCENE_MODE_STEADYPHOTO + | SCENE_MODE_FIREWORKS + | SCENE_MODE_SPORTS + | SCENE_MODE_PARTY + | SCENE_MODE_CANDLELIGHT; + + whiteBalanceList = + WHITE_BALANCE_AUTO + | WHITE_BALANCE_INCANDESCENT + | WHITE_BALANCE_FLUORESCENT + /*| WHITE_BALANCE_WARM_FLUORESCENT*/ + | WHITE_BALANCE_DAYLIGHT + | WHITE_BALANCE_CLOUDY_DAYLIGHT + /*| WHITE_BALANCE_TWILIGHT*/ + /*| WHITE_BALANCE_SHADE*/ + ; + + /* vendor specifics */ + highResolutionCallbackW = 3264; + highResolutionCallbackH = 1836; + highSpeedRecording60WFHD = 1920; + highSpeedRecording60HFHD = 1080; + highSpeedRecording60W = 2056; + highSpeedRecording60H = 1152; + highSpeedRecording120W = 1024; + highSpeedRecording120H = 574; + scalableSensorSupport = true; + bnsSupport = false; + + if (bnsSupport == true) { + previewSizeLutMax = sizeof(PREVIEW_SIZE_LUT_3L2_BNS) / (sizeof(int) * SIZE_OF_LUT); + videoSizeLutMax = sizeof(VIDEO_SIZE_LUT_3L2_BNS) / (sizeof(int) * SIZE_OF_LUT); + previewSizeLut = PREVIEW_SIZE_LUT_3L2_BNS; + videoSizeLut = VIDEO_SIZE_LUT_3L2_BNS; + } else { + previewSizeLutMax = sizeof(PREVIEW_SIZE_LUT_3L2) / (sizeof(int) * SIZE_OF_LUT); + videoSizeLutMax = sizeof(VIDEO_SIZE_LUT_3L2) / (sizeof(int) * SIZE_OF_LUT); + previewSizeLut = PREVIEW_SIZE_LUT_3L2; + videoSizeLut = VIDEO_SIZE_LUT_3L2; + } + pictureSizeLutMax = sizeof(PICTURE_SIZE_LUT_3L2) / (sizeof(int) * SIZE_OF_LUT); + pictureSizeLut = PICTURE_SIZE_LUT_3L2; + videoSizeLutHighSpeed = VIDEO_SIZE_LUT_HIGH_SPEED_3L2; + sizeTableSupport = true; +}; + +ExynosSensorS5K2P2::ExynosSensorS5K2P2() +{ + maxPreviewW = 3840; + maxPreviewH = 2160; + maxPictureW = 5312; + maxPictureH = 2988; + maxVideoW = 3840; + maxVideoH = 2160; + maxSensorW = 5312; + maxSensorH = 2990; + maxThumbnailW = 512; + maxThumbnailH = 384; + + fNumberNum = 22; + fNumberDen = 10; + focalLengthNum = 420; + focalLengthDen = 100; + focusDistanceNum = 0; + focusDistanceDen = 0; + apertureNum = 227; + apertureDen = 100; + horizontalViewAngle = 51.2f; + verticalViewAngle = 39.4f; + focalLengthIn35mmLength = 31; + + minFps = 1; + maxFps = 30; + + minExposureCompensation = -4; + maxExposureCompensation = 4; + exposureCompensationStep = 0.5f; + maxNumDetectedFaces = 16; + maxNumFocusAreas = 2; + maxNumMeteringAreas = 32; + maxZoomLevel = ZOOM_LEVEL_MAX; + maxZoomRatio = 400; + + zoomSupport = true; + smoothZoomSupport = false; + videoSnapshotSupport = true; + videoStabilizationSupport = true; + autoWhiteBalanceLockSupport = true; + autoExposureLockSupport = true; + + antiBandingList = + ANTIBANDING_AUTO + | ANTIBANDING_50HZ + | ANTIBANDING_60HZ + | ANTIBANDING_OFF + ; + + effectList = + EFFECT_NONE + | EFFECT_MONO + | EFFECT_NEGATIVE + /*| EFFECT_SOLARIZE*/ + | EFFECT_SEPIA + | EFFECT_POSTERIZE + /*| EFFECT_WHITEBOARD*/ + /*| EFFECT_BLACKBOARD*/ + | EFFECT_AQUA + ; + + flashModeList = + FLASH_MODE_OFF + | FLASH_MODE_AUTO + | FLASH_MODE_ON + //| FLASH_MODE_RED_EYE + | FLASH_MODE_TORCH; + + focusModeList = + FOCUS_MODE_AUTO + //| FOCUS_MODE_INFINITY + | FOCUS_MODE_MACRO + //| FOCUS_MODE_FIXED + //| FOCUS_MODE_EDOF + | FOCUS_MODE_CONTINUOUS_VIDEO + | FOCUS_MODE_CONTINUOUS_PICTURE + | FOCUS_MODE_TOUCH; + + sceneModeList = + SCENE_MODE_AUTO + | SCENE_MODE_ACTION + | SCENE_MODE_PORTRAIT + | SCENE_MODE_LANDSCAPE + | SCENE_MODE_NIGHT + | SCENE_MODE_NIGHT_PORTRAIT + | SCENE_MODE_THEATRE + | SCENE_MODE_BEACH + | SCENE_MODE_SNOW + | SCENE_MODE_SUNSET + | SCENE_MODE_STEADYPHOTO + | SCENE_MODE_FIREWORKS + | SCENE_MODE_SPORTS + | SCENE_MODE_PARTY + | SCENE_MODE_CANDLELIGHT; + + whiteBalanceList = + WHITE_BALANCE_AUTO + | WHITE_BALANCE_INCANDESCENT + | WHITE_BALANCE_FLUORESCENT + //| WHITE_BALANCE_WARM_FLUORESCENT + | WHITE_BALANCE_DAYLIGHT + | WHITE_BALANCE_CLOUDY_DAYLIGHT + //| WHITE_BALANCE_TWILIGHT + //| WHITE_BALANCE_SHADE + ; + + /* vendor specifics */ + highResolutionCallbackW = 3264; + highResolutionCallbackH = 1836; + highSpeedRecording60WFHD = 1920; + highSpeedRecording60HFHD = 1080; + highSpeedRecording60W = 1008; + highSpeedRecording60H = 566; + highSpeedRecording120W = 1008; + highSpeedRecording120H = 566; + scalableSensorSupport = true; + bnsSupport = true; + + if (bnsSupport == true) { + previewSizeLutMax = sizeof(PREVIEW_SIZE_LUT_2P2_BNS) / (sizeof(int) * SIZE_OF_LUT); + videoSizeLutMax = sizeof(VIDEO_SIZE_LUT_2P2_BNS) / (sizeof(int) * SIZE_OF_LUT); + pictureSizeLutMax = sizeof(PICTURE_SIZE_LUT_2P2) / (sizeof(int) * SIZE_OF_LUT); + previewSizeLut = PREVIEW_SIZE_LUT_2P2_BNS; + videoSizeLut = VIDEO_SIZE_LUT_2P2_BNS; + pictureSizeLut = PICTURE_SIZE_LUT_2P2; + videoSizeLutHighSpeed = VIDEO_SIZE_LUT_HIGH_SPEED_2P2_BNS; + sizeTableSupport = true; + } else { + previewSizeLutMax = 0; + pictureSizeLutMax = 0; + videoSizeLutMax = 0; + previewSizeLut = NULL; + pictureSizeLut = NULL; + videoSizeLut = NULL; + videoSizeLutHighSpeed = NULL; + sizeTableSupport = false; + } +}; + +ExynosSensorS5K6B2::ExynosSensorS5K6B2() +{ + maxPreviewW = 1920; + maxPreviewH = 1080; + maxPictureW = 1920; + maxPictureH = 1080; + maxVideoW = 1920; + maxVideoH = 1080; + maxSensorW = 1920; + maxSensorH = 1080; + maxThumbnailW = 512; + maxThumbnailH = 384; + + fNumberNum = 22; + fNumberDen = 10; + focalLengthNum = 420; + focalLengthDen = 100; + focusDistanceNum = 0; + focusDistanceDen = 0; + apertureNum = 227; + apertureDen = 100; + horizontalViewAngle = 51.2f; + verticalViewAngle = 39.4f; + focalLengthIn35mmLength = 31; + + minFps = 1; + maxFps = 30; + + minExposureCompensation = -4; + maxExposureCompensation = 4; + exposureCompensationStep = 0.5f; + maxNumDetectedFaces = 16; + maxNumFocusAreas = 1; + maxNumMeteringAreas = 32; + maxZoomLevel = ZOOM_LEVEL_MAX; + maxZoomRatio = 400; + + zoomSupport = true; + smoothZoomSupport = false; + videoSnapshotSupport = true; + videoStabilizationSupport = true; + autoWhiteBalanceLockSupport = true; + autoExposureLockSupport = true; + + antiBandingList = + ANTIBANDING_AUTO + | ANTIBANDING_50HZ + | ANTIBANDING_60HZ + | ANTIBANDING_OFF + ; + + effectList = + EFFECT_NONE + | EFFECT_MONO + | EFFECT_NEGATIVE + /*| EFFECT_SOLARIZE*/ + | EFFECT_SEPIA + | EFFECT_POSTERIZE + /*| EFFECT_WHITEBOARD*/ + /*| EFFECT_BLACKBOARD*/ + | EFFECT_AQUA + ; + + flashModeList = + FLASH_MODE_OFF + /*| FLASH_MODE_AUTO*/ + /*| FLASH_MODE_ON*/ + /*| FLASH_MODE_RED_EYE*/ + /*| FLASH_MODE_TORCH*/ + ; + + focusModeList = + /* FOCUS_MODE_AUTO*/ + FOCUS_MODE_INFINITY + /*| FOCUS_MODE_MACRO*/ + /*| FOCUS_MODE_FIXED*/ + /*| FOCUS_MODE_EDOF*/ + /*| FOCUS_MODE_CONTINUOUS_VIDEO*/ + /*| FOCUS_MODE_CONTINUOUS_PICTURE*/ + /*| FOCUS_MODE_TOUCH*/ + ; + + sceneModeList = + SCENE_MODE_AUTO + | SCENE_MODE_ACTION + | SCENE_MODE_PORTRAIT + | SCENE_MODE_LANDSCAPE + | SCENE_MODE_NIGHT + | SCENE_MODE_NIGHT_PORTRAIT + | SCENE_MODE_THEATRE + | SCENE_MODE_BEACH + | SCENE_MODE_SNOW + | SCENE_MODE_SUNSET + | SCENE_MODE_STEADYPHOTO + | SCENE_MODE_FIREWORKS + | SCENE_MODE_SPORTS + | SCENE_MODE_PARTY + | SCENE_MODE_CANDLELIGHT; + + whiteBalanceList = + WHITE_BALANCE_AUTO + | WHITE_BALANCE_INCANDESCENT + | WHITE_BALANCE_FLUORESCENT + /* WHITE_BALANCE_WARM_FLUORESCENT*/ + | WHITE_BALANCE_DAYLIGHT + | WHITE_BALANCE_CLOUDY_DAYLIGHT + /* WHITE_BALANCE_TWILIGHT*/ + /* WHITE_BALANCE_SHADE*/ + ; + + previewSizeLutMax = 0; + pictureSizeLutMax = 0; + videoSizeLutMax = 0; + previewSizeLut = NULL; + pictureSizeLut = NULL; + videoSizeLut = NULL; + videoSizeLutHighSpeed = NULL; + sizeTableSupport = false; + + /* vendor specifics */ + highResolutionCallbackW = 3264; + highResolutionCallbackH = 1836; + highSpeedRecording60WFHD = 1920; + highSpeedRecording60HFHD = 1080; + highSpeedRecording60W = 1008; + highSpeedRecording60H = 566; + highSpeedRecording120W = 1008; + highSpeedRecording120H = 566; + scalableSensorSupport = true; + bnsSupport = false; +}; + + +ExynosSensorS5K3H7::ExynosSensorS5K3H7() +{ + maxPreviewW = 1920; + maxPreviewH = 1080; + maxPictureW = 3248; + maxPictureH = 2438; + maxVideoW = 1920; + maxVideoH = 1080; + maxSensorW = 3248; + maxSensorH = 2438; + + maxThumbnailW = 512; + maxThumbnailH = 384; + + fNumberNum = 22; + fNumberDen = 10; + focalLengthNum = 420; + focalLengthDen = 100; + focusDistanceNum = 0; + focusDistanceDen = 0; + apertureNum = 227; + apertureDen = 100; + horizontalViewAngle = 51.2f; + verticalViewAngle = 39.4f; + focalLengthIn35mmLength = 31; + + minFps = 1; + maxFps = 30; + + minExposureCompensation = -4; + maxExposureCompensation = 4; + exposureCompensationStep = 0.5f; + maxNumDetectedFaces = 16; + maxNumFocusAreas = 2; + maxNumMeteringAreas = 32; + maxZoomLevel = ZOOM_LEVEL_MAX; + maxZoomRatio = 400; + + zoomSupport = true; + smoothZoomSupport = false; + videoSnapshotSupport = true; + videoStabilizationSupport = false; + autoWhiteBalanceLockSupport = true; + autoExposureLockSupport = true; + + antiBandingList = + ANTIBANDING_AUTO + | ANTIBANDING_50HZ + | ANTIBANDING_60HZ + | ANTIBANDING_OFF + ; + + effectList = + EFFECT_NONE + | EFFECT_MONO + | EFFECT_NEGATIVE + /*| EFFECT_SOLARIZE*/ + | EFFECT_SEPIA + | EFFECT_POSTERIZE + /*| EFFECT_WHITEBOARD*/ + /*| EFFECT_BLACKBOARD*/ + | EFFECT_AQUA + ; + + flashModeList = + FLASH_MODE_OFF + | FLASH_MODE_AUTO + | FLASH_MODE_ON + /*| FLASH_MODE_RED_EYE*/ + | FLASH_MODE_TORCH; + + focusModeList = + FOCUS_MODE_AUTO + /*| FOCUS_MODE_INFINITY*/ + | FOCUS_MODE_MACRO + /*| FOCUS_MODE_FIXED*/ + /*| FOCUS_MODE_EDOF*/ + | FOCUS_MODE_CONTINUOUS_VIDEO + | FOCUS_MODE_CONTINUOUS_PICTURE + | FOCUS_MODE_TOUCH; + + sceneModeList = + SCENE_MODE_AUTO + | SCENE_MODE_ACTION + | SCENE_MODE_PORTRAIT + | SCENE_MODE_LANDSCAPE + | SCENE_MODE_NIGHT + | SCENE_MODE_NIGHT_PORTRAIT + | SCENE_MODE_THEATRE + | SCENE_MODE_BEACH + | SCENE_MODE_SNOW + | SCENE_MODE_SUNSET + | SCENE_MODE_STEADYPHOTO + | SCENE_MODE_FIREWORKS + | SCENE_MODE_SPORTS + | SCENE_MODE_PARTY + | SCENE_MODE_CANDLELIGHT; + + whiteBalanceList = + WHITE_BALANCE_AUTO + | WHITE_BALANCE_INCANDESCENT + | WHITE_BALANCE_FLUORESCENT + /*| WHITE_BALANCE_WARM_FLUORESCENT*/ + | WHITE_BALANCE_DAYLIGHT + | WHITE_BALANCE_CLOUDY_DAYLIGHT + /*| WHITE_BALANCE_TWILIGHT*/ + /*| WHITE_BALANCE_SHADE*/ + ; + + /* vendor specifics */ + /* + burstPanoramaW = 3264; + burstPanoramaH = 1836; + highSpeedRecording60WFHD = 1920; + highSpeedRecording60HFHD = 1080; + highSpeedRecording60W = 1008; + highSpeedRecording60H = 566; + highSpeedRecording120W = 1008; + highSpeedRecording120H = 566; + scalableSensorSupport = true; + */ + bnsSupport = false; + + if (bnsSupport == true) { + previewSizeLutMax = 0; + pictureSizeLutMax = 0; + videoSizeLutMax = 0; + previewSizeLut = NULL; + pictureSizeLut = NULL; + videoSizeLut = NULL; + videoSizeLutHighSpeed = NULL; + sizeTableSupport = false; + } else { + previewSizeLutMax = sizeof(PREVIEW_SIZE_LUT_3H7) / (sizeof(int) * SIZE_OF_LUT); + videoSizeLutMax = sizeof(VIDEO_SIZE_LUT_3H7) / (sizeof(int) * SIZE_OF_LUT); + pictureSizeLutMax = sizeof(PICTURE_SIZE_LUT_3H7) / (sizeof(int) * SIZE_OF_LUT); + previewSizeLut = PREVIEW_SIZE_LUT_3H7; + videoSizeLut = VIDEO_SIZE_LUT_3H7; + pictureSizeLut = PICTURE_SIZE_LUT_3H7; + videoSizeLutHighSpeed = VIDEO_SIZE_LUT_HIGH_SPEED_3H7; + sizeTableSupport = true; + } +}; + +ExynosSensorS5K3H5::ExynosSensorS5K3H5() +{ + maxPreviewW = 1920; + maxPreviewH = 1080; + maxPictureW = 3248; + maxPictureH = 2438; + maxVideoW = 1920; + maxVideoH = 1080; + maxSensorW = 3248; + maxSensorH = 2438; + + maxThumbnailW = 512; + maxThumbnailH = 384; + + fNumberNum = 22; + fNumberDen = 10; + focalLengthNum = 420; + focalLengthDen = 100; + focusDistanceNum = 0; + focusDistanceDen = 0; + apertureNum = 227; + apertureDen = 100; + horizontalViewAngle = 51.2f; + verticalViewAngle = 39.4f; + focalLengthIn35mmLength = 31; + + minFps = 1; + maxFps = 30; + + minExposureCompensation = -4; + maxExposureCompensation = 4; + exposureCompensationStep = 0.5f; + maxNumDetectedFaces = 16; + maxNumFocusAreas = 2; + maxNumMeteringAreas = 32; + maxZoomLevel = ZOOM_LEVEL_MAX; + maxZoomRatio = 400; + + zoomSupport = true; + smoothZoomSupport = false; + videoSnapshotSupport = true; + videoStabilizationSupport = false; + autoWhiteBalanceLockSupport = true; + autoExposureLockSupport = true; + + antiBandingList = + ANTIBANDING_AUTO + | ANTIBANDING_50HZ + | ANTIBANDING_60HZ + | ANTIBANDING_OFF + ; + + effectList = + EFFECT_NONE + | EFFECT_MONO + | EFFECT_NEGATIVE + /*| EFFECT_SOLARIZE*/ + | EFFECT_SEPIA + | EFFECT_POSTERIZE + /*| EFFECT_WHITEBOARD*/ + /*| EFFECT_BLACKBOARD*/ + | EFFECT_AQUA + ; + + flashModeList = + FLASH_MODE_OFF + | FLASH_MODE_AUTO + | FLASH_MODE_ON + /*| FLASH_MODE_RED_EYE*/ + | FLASH_MODE_TORCH; + + focusModeList = + FOCUS_MODE_AUTO + /*| FOCUS_MODE_INFINITY*/ + | FOCUS_MODE_MACRO + /*| FOCUS_MODE_FIXED*/ + /*| FOCUS_MODE_EDOF*/ + | FOCUS_MODE_CONTINUOUS_VIDEO + | FOCUS_MODE_CONTINUOUS_PICTURE + | FOCUS_MODE_TOUCH; + + sceneModeList = + SCENE_MODE_AUTO + | SCENE_MODE_ACTION + | SCENE_MODE_PORTRAIT + | SCENE_MODE_LANDSCAPE + | SCENE_MODE_NIGHT + | SCENE_MODE_NIGHT_PORTRAIT + | SCENE_MODE_THEATRE + | SCENE_MODE_BEACH + | SCENE_MODE_SNOW + | SCENE_MODE_SUNSET + | SCENE_MODE_STEADYPHOTO + | SCENE_MODE_FIREWORKS + | SCENE_MODE_SPORTS + | SCENE_MODE_PARTY + | SCENE_MODE_CANDLELIGHT; + + whiteBalanceList = + WHITE_BALANCE_AUTO + | WHITE_BALANCE_INCANDESCENT + | WHITE_BALANCE_FLUORESCENT + /*| WHITE_BALANCE_WARM_FLUORESCENT*/ + | WHITE_BALANCE_DAYLIGHT + | WHITE_BALANCE_CLOUDY_DAYLIGHT + /*| WHITE_BALANCE_TWILIGHT*/ + /*| WHITE_BALANCE_SHADE*/ + ; + + previewSizeLutMax = 0; + pictureSizeLutMax = 0; + videoSizeLutMax = 0; + previewSizeLut = NULL; + pictureSizeLut = NULL; + videoSizeLut = NULL; + videoSizeLutHighSpeed = NULL; + sizeTableSupport = false; + + /* vendor specifics */ + /* + burstPanoramaW = 3264; + burstPanoramaH = 1836; + highSpeedRecording60WFHD = 1920; + highSpeedRecording60HFHD = 1080; + highSpeedRecording60W = 1008; + highSpeedRecording60H = 566; + highSpeedRecording120W = 1008; + highSpeedRecording120H = 566; + scalableSensorSupport = true; + */ + bnsSupport = false; +}; + +ExynosSensorS5K4H5::ExynosSensorS5K4H5() +{ + maxPreviewW = 1920; + maxPreviewH = 1080; + maxPictureW = 3264; + maxPictureH = 2448; + maxVideoW = 1920; + maxVideoH = 1080; + maxSensorW = 3264; + maxSensorH = 2448; + + maxThumbnailW = 512; + maxThumbnailH = 384; + + fNumberNum = 22; + fNumberDen = 10; + focalLengthNum = 420; + focalLengthDen = 100; + focusDistanceNum = 0; + focusDistanceDen = 0; + apertureNum = 227; + apertureDen = 100; + horizontalViewAngle = 51.2f; + verticalViewAngle = 39.4f; + focalLengthIn35mmLength = 31; + + minFps = 1; + maxFps = 30; + + minExposureCompensation = -4; + maxExposureCompensation = 4; + exposureCompensationStep = 0.5f; + maxNumDetectedFaces = 16; + maxNumFocusAreas = 2; + maxNumMeteringAreas = 32; + maxZoomLevel = ZOOM_LEVEL_MAX; + maxZoomRatio = 400; + + zoomSupport = true; + smoothZoomSupport = false; + videoSnapshotSupport = true; + videoStabilizationSupport = false; + autoWhiteBalanceLockSupport = false; + autoExposureLockSupport = true; + + antiBandingList = + ANTIBANDING_AUTO + | ANTIBANDING_50HZ + | ANTIBANDING_60HZ + | ANTIBANDING_OFF + ; + + effectList = + EFFECT_NONE + | EFFECT_MONO + | EFFECT_NEGATIVE + /*| EFFECT_SOLARIZE*/ + | EFFECT_SEPIA + | EFFECT_POSTERIZE + /*| EFFECT_WHITEBOARD*/ + /*| EFFECT_BLACKBOARD*/ + | EFFECT_AQUA + ; + + flashModeList = + FLASH_MODE_OFF + | FLASH_MODE_AUTO + | FLASH_MODE_ON + /*| FLASH_MODE_RED_EYE*/ + | FLASH_MODE_TORCH; + + focusModeList = + FOCUS_MODE_AUTO + /*| FOCUS_MODE_INFINITY*/ + | FOCUS_MODE_MACRO + /*| FOCUS_MODE_FIXED*/ + /*| FOCUS_MODE_EDOF*/ + | FOCUS_MODE_CONTINUOUS_VIDEO + | FOCUS_MODE_CONTINUOUS_PICTURE + | FOCUS_MODE_TOUCH; + + sceneModeList = + SCENE_MODE_AUTO + | SCENE_MODE_ACTION + | SCENE_MODE_PORTRAIT + | SCENE_MODE_LANDSCAPE + | SCENE_MODE_NIGHT + | SCENE_MODE_NIGHT_PORTRAIT + | SCENE_MODE_THEATRE + | SCENE_MODE_BEACH + | SCENE_MODE_SNOW + | SCENE_MODE_SUNSET + | SCENE_MODE_STEADYPHOTO + | SCENE_MODE_FIREWORKS + | SCENE_MODE_SPORTS + | SCENE_MODE_PARTY + | SCENE_MODE_CANDLELIGHT; + + whiteBalanceList = + WHITE_BALANCE_AUTO + | WHITE_BALANCE_INCANDESCENT + | WHITE_BALANCE_FLUORESCENT + /*| WHITE_BALANCE_WARM_FLUORESCENT*/ + | WHITE_BALANCE_DAYLIGHT + | WHITE_BALANCE_CLOUDY_DAYLIGHT + /*| WHITE_BALANCE_TWILIGHT*/ + /*| WHITE_BALANCE_SHADE*/ + ; + + /* vendor specifics */ + /* + burstPanoramaW = 3264; + burstPanoramaH = 1836; + highSpeedRecording60WFHD = 1920; + highSpeedRecording60HFHD = 1080; + highSpeedRecording60W = 1008; + highSpeedRecording60H = 566; + highSpeedRecording120W = 1008; + highSpeedRecording120H = 566; + scalableSensorSupport = true; + */ + bnsSupport = false; + + if (bnsSupport == true) { + previewSizeLutMax = 0; + pictureSizeLutMax = 0; + videoSizeLutMax = 0; + previewSizeLut = NULL; + pictureSizeLut = NULL; + videoSizeLut = NULL; + videoSizeLutHighSpeed = NULL; + sizeTableSupport = false; + } else { + previewSizeLutMax = sizeof(PREVIEW_SIZE_LUT_4H5) / (sizeof(int) * SIZE_OF_LUT); + videoSizeLutMax = sizeof(VIDEO_SIZE_LUT_4H5) / (sizeof(int) * SIZE_OF_LUT); + pictureSizeLutMax = sizeof(PICTURE_SIZE_LUT_4H5) / (sizeof(int) * SIZE_OF_LUT); + previewSizeLut = PREVIEW_SIZE_LUT_4H5; + videoSizeLut = VIDEO_SIZE_LUT_4H5; + pictureSizeLut = PICTURE_SIZE_LUT_4H5; + videoSizeLutHighSpeed = VIDEO_SIZE_LUT_HIGH_SPEED_4H5; + sizeTableSupport = true; + } +}; + +ExynosSensorS5K6A3::ExynosSensorS5K6A3() +{ + maxPreviewW = 1280; + maxPreviewH = 720; + maxPictureW = 1392; + maxPictureH = 1402; + maxVideoW = 1920; + maxVideoH = 1080; + maxSensorW = 1392; + maxSensorH = 1402; + + maxThumbnailW = 512; + maxThumbnailH = 384; + + fNumberNum = 22; + fNumberDen = 10; + focalLengthNum = 420; + focalLengthDen = 100; + focusDistanceNum = 0; + focusDistanceDen = 0; + apertureNum = 227; + apertureDen = 100; + horizontalViewAngle = 51.2f; + verticalViewAngle = 39.4f; + focalLengthIn35mmLength = 31; + + minFps = 1; + maxFps = 30; + + minExposureCompensation = -4; + maxExposureCompensation = 4; + exposureCompensationStep = 0.5f; + maxNumDetectedFaces = 16; + maxNumFocusAreas = 2; + maxNumMeteringAreas = 32; + maxZoomLevel = ZOOM_LEVEL_MAX; + maxZoomRatio = 400; + + zoomSupport = true; + smoothZoomSupport = false; + videoSnapshotSupport = true; + videoStabilizationSupport = false; + autoWhiteBalanceLockSupport = false; + autoExposureLockSupport = true; + + antiBandingList = + ANTIBANDING_AUTO + | ANTIBANDING_50HZ + | ANTIBANDING_60HZ + | ANTIBANDING_OFF + ; + + effectList = + EFFECT_NONE + | EFFECT_MONO + | EFFECT_NEGATIVE + /*| EFFECT_SOLARIZE*/ + | EFFECT_SEPIA + | EFFECT_POSTERIZE + /*| EFFECT_WHITEBOARD*/ + /*| EFFECT_BLACKBOARD*/ + | EFFECT_AQUA + ; + + flashModeList = + FLASH_MODE_OFF; + /*| FLASH_MODE_AUTO*/ + /*| FLASH_MODE_ON*/ + /*| FLASH_MODE_RED_EYE*/ + /*| FLASH_MODE_TORCH;*/ + + focusModeList = + /*FOCUS_MODE_AUTO*/ + FOCUS_MODE_INFINITY; + /*| FOCUS_MODE_INFINITY*/ + /*| FOCUS_MODE_MACRO*/ + /*| FOCUS_MODE_FIXED*/ + /*| FOCUS_MODE_EDOF*/ + /*| FOCUS_MODE_CONTINUOUS_VIDEO*/ + /*| FOCUS_MODE_CONTINUOUS_PICTURE*/ + /*| FOCUS_MODE_TOUCH*/ + ; + + sceneModeList = + SCENE_MODE_AUTO + | SCENE_MODE_ACTION + | SCENE_MODE_PORTRAIT + | SCENE_MODE_LANDSCAPE + | SCENE_MODE_NIGHT + | SCENE_MODE_NIGHT_PORTRAIT + | SCENE_MODE_THEATRE + | SCENE_MODE_BEACH + | SCENE_MODE_SNOW + | SCENE_MODE_SUNSET + | SCENE_MODE_STEADYPHOTO + | SCENE_MODE_FIREWORKS + | SCENE_MODE_SPORTS + | SCENE_MODE_PARTY + | SCENE_MODE_CANDLELIGHT; + + whiteBalanceList = + WHITE_BALANCE_AUTO + | WHITE_BALANCE_INCANDESCENT + | WHITE_BALANCE_FLUORESCENT + /*| WHITE_BALANCE_WARM_FLUORESCENT*/ + | WHITE_BALANCE_DAYLIGHT + | WHITE_BALANCE_CLOUDY_DAYLIGHT + /*| WHITE_BALANCE_TWILIGHT*/ + /*| WHITE_BALANCE_SHADE*/ + ; + + previewSizeLutMax = 0; + pictureSizeLutMax = 0; + videoSizeLutMax = 0; + previewSizeLut = NULL; + pictureSizeLut = NULL; + videoSizeLut = NULL; + videoSizeLutHighSpeed = NULL; + sizeTableSupport = false; + + /* vendor specifics */ + /* + burstPanoramaW = 3264; + burstPanoramaH = 1836; + highSpeedRecording60WFHD = 1920; + highSpeedRecording60HFHD = 1080; + highSpeedRecording60W = 1008; + highSpeedRecording60H = 566; + highSpeedRecording120W = 1008; + highSpeedRecording120H = 566; + scalableSensorSupport = true; + */ + bnsSupport = false; +}; + +ExynosSensorIMX175::ExynosSensorIMX175() +{ + maxPreviewW = 1920; + maxPreviewH = 1080; + maxPictureW = 3264; + maxPictureH = 2448; + maxVideoW = 1920; + maxVideoH = 1080; + maxSensorW = 3264; + maxSensorH = 2448; + + maxThumbnailW = 512; + maxThumbnailH = 384; + + fNumberNum = 26; + fNumberDen = 10; + focalLengthNum = 370; + focalLengthDen = 100; + focusDistanceNum = 0; + focusDistanceDen = 0; + apertureNum = 276; + apertureDen = 100; + horizontalViewAngle = 51.2f; + verticalViewAngle = 39.4f; + focalLengthIn35mmLength = 31; + + minFps = 1; + maxFps = 30; + + minExposureCompensation = -4; + maxExposureCompensation = 4; + exposureCompensationStep = 0.5f; + maxNumDetectedFaces = 16; + maxNumFocusAreas = 2; + maxNumMeteringAreas = 32; + maxZoomLevel = ZOOM_LEVEL_MAX; + maxZoomRatio = 400; + + zoomSupport = true; + smoothZoomSupport = false; + videoSnapshotSupport = true; + videoStabilizationSupport = false; + autoWhiteBalanceLockSupport = true; + autoExposureLockSupport = true; + + antiBandingList = + ANTIBANDING_AUTO + | ANTIBANDING_50HZ + | ANTIBANDING_60HZ + | ANTIBANDING_OFF + ; + + effectList = + EFFECT_NONE + | EFFECT_MONO + | EFFECT_NEGATIVE + /*| EFFECT_SOLARIZE*/ + | EFFECT_SEPIA + | EFFECT_POSTERIZE + /*| EFFECT_WHITEBOARD*/ + /*| EFFECT_BLACKBOARD*/ + | EFFECT_AQUA + ; + + flashModeList = + FLASH_MODE_OFF + | FLASH_MODE_AUTO + | FLASH_MODE_ON + /*| FLASH_MODE_RED_EYE*/ + | FLASH_MODE_TORCH; + + focusModeList = + FOCUS_MODE_AUTO + /*| FOCUS_MODE_INFINITY*/ + | FOCUS_MODE_MACRO + /*| FOCUS_MODE_FIXED*/ + /*| FOCUS_MODE_EDOF*/ + | FOCUS_MODE_CONTINUOUS_VIDEO + | FOCUS_MODE_CONTINUOUS_PICTURE + | FOCUS_MODE_TOUCH; + + sceneModeList = + SCENE_MODE_AUTO + | SCENE_MODE_ACTION + | SCENE_MODE_PORTRAIT + | SCENE_MODE_LANDSCAPE + | SCENE_MODE_NIGHT + | SCENE_MODE_NIGHT_PORTRAIT + | SCENE_MODE_THEATRE + | SCENE_MODE_BEACH + | SCENE_MODE_SNOW + | SCENE_MODE_SUNSET + | SCENE_MODE_STEADYPHOTO + | SCENE_MODE_FIREWORKS + | SCENE_MODE_SPORTS + | SCENE_MODE_PARTY + | SCENE_MODE_CANDLELIGHT; + + whiteBalanceList = + WHITE_BALANCE_AUTO + | WHITE_BALANCE_INCANDESCENT + | WHITE_BALANCE_FLUORESCENT + /*| WHITE_BALANCE_WARM_FLUORESCENT*/ + | WHITE_BALANCE_DAYLIGHT + | WHITE_BALANCE_CLOUDY_DAYLIGHT + /*| WHITE_BALANCE_TWILIGHT*/ + /*| WHITE_BALANCE_SHADE*/ + ; + + /* vendor specifics */ + /* + burstPanoramaW = 3264; + burstPanoramaH = 1836; + highSpeedRecording60WFHD = 1920; + highSpeedRecording60HFHD = 1080; + highSpeedRecording60W = 1008; + highSpeedRecording60H = 566; + highSpeedRecording120W = 1008; + highSpeedRecording120H = 566; + scalableSensorSupport = true; + */ + bnsSupport = false; + + if (bnsSupport == true) { + previewSizeLutMax = 0; + pictureSizeLutMax = 0; + videoSizeLutMax = 0; + previewSizeLut = NULL; + pictureSizeLut = NULL; + videoSizeLut = NULL; + videoSizeLutHighSpeed = NULL; + sizeTableSupport = false; + } else { + previewSizeLutMax = sizeof(PREVIEW_SIZE_LUT_IMX175) / (sizeof(int) * SIZE_OF_LUT); + videoSizeLutMax = sizeof(VIDEO_SIZE_LUT_IMX175) / (sizeof(int) * SIZE_OF_LUT); + pictureSizeLutMax = sizeof(PICTURE_SIZE_LUT_IMX175) / (sizeof(int) * SIZE_OF_LUT); + previewSizeLut = PREVIEW_SIZE_LUT_IMX175; + videoSizeLut = VIDEO_SIZE_LUT_IMX175; + pictureSizeLut = PICTURE_SIZE_LUT_IMX175; + videoSizeLutHighSpeed = VIDEO_SIZE_LUT_HIGH_SPEED_IMX175; + sizeTableSupport = true; + } +}; + +ExynosSensorS5K8B1::ExynosSensorS5K8B1() +{ + maxPreviewW = 1920; + maxPreviewH = 1080; + maxPictureW = 1920; + maxPictureH = 1080; + maxVideoW = 1920; + maxVideoH = 1080; + maxSensorW = 1920; + maxSensorH = 1080; + maxThumbnailW = 512; + maxThumbnailH = 384; + + fNumberNum = 22; + fNumberDen = 10; + focalLengthNum = 420; + focalLengthDen = 100; + focusDistanceNum = 0; + focusDistanceDen = 0; + apertureNum = 227; + apertureDen = 100; + horizontalViewAngle = 51.2f; + verticalViewAngle = 39.4f; + focalLengthIn35mmLength = 31; + + minFps = 1; + maxFps = 30; + + minExposureCompensation = -4; + maxExposureCompensation = 4; + exposureCompensationStep = 0.5f; + maxNumDetectedFaces = 16; + maxNumFocusAreas = 1; + maxNumMeteringAreas = 32; + maxZoomLevel = ZOOM_LEVEL_MAX; + maxZoomRatio = 400; + + zoomSupport = true; + smoothZoomSupport = false; + videoSnapshotSupport = true; + videoStabilizationSupport = true; + autoWhiteBalanceLockSupport = true; + autoExposureLockSupport = true; + + antiBandingList = + ANTIBANDING_AUTO + | ANTIBANDING_50HZ + | ANTIBANDING_60HZ + | ANTIBANDING_OFF + ; + + effectList = + EFFECT_NONE + | EFFECT_MONO + | EFFECT_NEGATIVE + /*| EFFECT_SOLARIZE*/ + | EFFECT_SEPIA + | EFFECT_POSTERIZE + /*| EFFECT_WHITEBOARD*/ + /*| EFFECT_BLACKBOARD*/ + | EFFECT_AQUA + ; + + flashModeList = + FLASH_MODE_OFF + /*| FLASH_MODE_AUTO*/ + /*| FLASH_MODE_ON*/ + /*| FLASH_MODE_RED_EYE*/ + /*| FLASH_MODE_TORCH*/ + ; + + focusModeList = + /* FOCUS_MODE_AUTO*/ + FOCUS_MODE_INFINITY + /*| FOCUS_MODE_MACRO*/ + /*| FOCUS_MODE_FIXED*/ + /*| FOCUS_MODE_EDOF*/ + /*| FOCUS_MODE_CONTINUOUS_VIDEO*/ + /*| FOCUS_MODE_CONTINUOUS_PICTURE*/ + /*| FOCUS_MODE_TOUCH*/ + ; + + sceneModeList = + SCENE_MODE_AUTO + | SCENE_MODE_ACTION + | SCENE_MODE_PORTRAIT + | SCENE_MODE_LANDSCAPE + | SCENE_MODE_NIGHT + | SCENE_MODE_NIGHT_PORTRAIT + | SCENE_MODE_THEATRE + | SCENE_MODE_BEACH + | SCENE_MODE_SNOW + | SCENE_MODE_SUNSET + | SCENE_MODE_STEADYPHOTO + | SCENE_MODE_FIREWORKS + | SCENE_MODE_SPORTS + | SCENE_MODE_PARTY + | SCENE_MODE_CANDLELIGHT; + + whiteBalanceList = + WHITE_BALANCE_AUTO + | WHITE_BALANCE_INCANDESCENT + | WHITE_BALANCE_FLUORESCENT + /* WHITE_BALANCE_WARM_FLUORESCENT*/ + | WHITE_BALANCE_DAYLIGHT + | WHITE_BALANCE_CLOUDY_DAYLIGHT + /* WHITE_BALANCE_TWILIGHT*/ + /* WHITE_BALANCE_SHADE*/ + ; + + previewSizeLutMax = 0; + pictureSizeLutMax = 0; + videoSizeLutMax = 0; + previewSizeLut = NULL; + pictureSizeLut = NULL; + videoSizeLut = NULL; + videoSizeLutHighSpeed = NULL; + sizeTableSupport = false; + + /* vendor specifics */ + highResolutionCallbackW = 3264; + highResolutionCallbackH = 1836; + highSpeedRecording60WFHD = 1920; + highSpeedRecording60HFHD = 1080; + highSpeedRecording60W = 1008; + highSpeedRecording60H = 566; + highSpeedRecording120W = 1008; + highSpeedRecording120H = 566; + scalableSensorSupport = true; + bnsSupport = false; +}; + +}; /* namespace android */ diff --git a/libcamera/ExynosCameraSensorInfo.h b/libcamera/ExynosCameraSensorInfo.h new file mode 100644 index 0000000000000000000000000000000000000000..7d978083c3c8d839dffcc05a31e0fa8568c28339 --- /dev/null +++ b/libcamera/ExynosCameraSensorInfo.h @@ -0,0 +1,562 @@ +/* +** +** Copyright 2013, Samsung Electronics Co. LTD +** +** Licensed under the Apache License, Version 2.0 (the "License"); +** you may not use this file except in compliance with the License. +** You may obtain a copy of the License at +** +** http://www.apache.org/licenses/LICENSE-2.0 +** +** Unless required by applicable law or agreed to in writing, software +** distributed under the License is distributed on an "AS IS" BASIS, +** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +** See the License for the specific language governing permissions and +** limitations under the License. +*/ + +#ifndef EXYNOS_CAMERA_SENSOR_INFO_H +#define EXYNOS_CAMERA_SENSOR_INFO_H + +#include +#include +#include "ExynosCameraConfig.h" +#include "ExynosCameraSizeTable.h" +#include "fimc-is-metadata.h" + +/*TODO: This values will be changed */ +#define BACK_CAMERA_AUTO_FOCUS_DISTANCES_STR "0.10,1.20,Infinity" +#define FRONT_CAMERA_FOCUS_DISTANCES_STR "0.20,0.25,Infinity" + +#define BACK_CAMERA_MACRO_FOCUS_DISTANCES_STR "0.10,0.20,Infinity" +#define BACK_CAMERA_INFINITY_FOCUS_DISTANCES_STR "0.10,1.20,Infinity" + +#define BACK_CAMERA_FOCUS_DISTANCE_INFINITY "Infinity" +#define FRONT_CAMERA_FOCUS_DISTANCE_INFINITY "Infinity" + +#define UNIQUE_ID_BUF_SIZE (32) + +#define EFFECTMODE_META_2_HAL(x) (1 << x) + +namespace android { + +#ifdef SENSOR_NAME_GET_FROM_FILE +int getSensorIdFromFile(int camId); +#endif + +struct exynos_camera_info { +public: + int previewW; + int previewH; + int previewFormat; + int previewStride; + + int pictureW; + int pictureH; + int pictureFormat; + + int videoW; + int videoH; + + /* This size for internal */ + int hwSensorW; + int hwSensorH; + int hwPreviewW; + int hwPreviewH; + int previewSizeRatioId; + int hwPictureW; + int hwPictureH; + int pictureSizeRatioId; + int hwDisW; + int hwDisH; + int videoSizeRatioId; + int hwPreviewFormat; + + int hwBayerCropW; + int hwBayerCropH; + int hwBayerCropX; + int hwBayerCropY; + + int bnsW; + int bnsH; + + int jpegQuality; + int thumbnailW; + int thumbnailH; + int thumbnailQuality; + + int intelligentMode; + bool visionMode; + int visionModeFps; + int visionModeAeTarget; + + bool recordingHint; + bool dualMode; + bool dualRecordingHint; + bool effectHint; + bool highSpeedRecording; + bool videoStabilization; + bool swVdisMode; + bool swVdisUIMode; + bool highResolutionCallbackMode; + bool is3dnrMode; + bool isDrcMode; + bool isOdcMode; + + int zoom; + int rotation; + int flipHorizontal; + int flipVertical; + bool autoExposureLock; + + int meteringMode; + bool isTouchMetering; + + int sceneMode; + int focusMode; + int flashMode; + int whiteBalanceMode; + bool autoWhiteBalanceLock; + int numValidFocusArea; + + double gpsLatitude; + double gpsLongitude; + double gpsAltitude; + long gpsTimeStamp; + + long long int cityId; + unsigned char weatherId; + + bool hdrMode; + bool wdrMode; + int shotMode; + bool antiShake; + int vtMode; + bool gamma; + bool slowAe; + int seriesShotCount; + + bool scalableSensorMode; + char imageUniqueId[UNIQUE_ID_BUF_SIZE]; + bool samsungCamera; + + int autoFocusMacroPosition; + int deviceOrientation; + uint32_t bnsScaleRatio; + + int seriesShotMode; +#ifdef BURST_CAPTURE + int seriesShotSaveLocation; + char seriesShotFilePath[100]; +#endif +}; + +struct ExynosSensorInfo { +public: + int maxPreviewW; + int maxPreviewH; + int maxPictureW; + int maxPictureH; + int maxVideoW; + int maxVideoH; + int maxSensorW; + int maxSensorH; + + int maxThumbnailW; + int maxThumbnailH; + + int fNumberNum; + int fNumberDen; + int focalLengthNum; + int focalLengthDen; + int focusDistanceNum; + int focusDistanceDen; + int apertureNum; + int apertureDen; + float horizontalViewAngle; + float verticalViewAngle; + int focalLengthIn35mmLength; + + int minFps; + int maxFps; + + int minExposureCompensation; + int maxExposureCompensation; + float exposureCompensationStep; + int maxNumDetectedFaces; + uint32_t maxNumFocusAreas; + uint32_t maxNumMeteringAreas; + int maxZoomLevel; + int maxZoomRatio; + + bool zoomSupport; + bool smoothZoomSupport; + bool videoSnapshotSupport; + bool videoStabilizationSupport; + bool autoWhiteBalanceLockSupport; + bool autoExposureLockSupport; + + int antiBandingList; + int effectList; + int flashModeList; + int focusModeList; + int sceneModeList; + int whiteBalanceList; + + int previewSizeLutMax; + int pictureSizeLutMax; + int videoSizeLutMax; + int (*previewSizeLut)[SIZE_OF_LUT]; + int (*pictureSizeLut)[SIZE_OF_LUT]; + int (*videoSizeLut)[SIZE_OF_LUT]; + int (*videoSizeLutHighSpeed)[SIZE_OF_LUT]; + bool sizeTableSupport; + + /* vendor specifics */ + int highResolutionCallbackW; + int highResolutionCallbackH; + int highSpeedRecording60WFHD; + int highSpeedRecording60HFHD; + int highSpeedRecording60W; + int highSpeedRecording60H; + int highSpeedRecording120W; + int highSpeedRecording120H; + bool scalableSensorSupport; + bool bnsSupport; +public: + ExynosSensorInfo(); +}; + +struct ExynosSensorIMX135 : public ExynosSensorInfo { +public: + ExynosSensorIMX135(); +}; + +struct ExynosSensorIMX134 : public ExynosSensorInfo { +public: + ExynosSensorIMX134(); +}; + +struct ExynosSensorS5K3L2 : public ExynosSensorInfo { +public: + ExynosSensorS5K3L2(); +}; + +struct ExynosSensorS5K2P2 : public ExynosSensorInfo { +public: + ExynosSensorS5K2P2(); +}; + +struct ExynosSensorS5K6B2 : public ExynosSensorInfo { +public: + ExynosSensorS5K6B2(); +}; + +struct ExynosSensorS5K3H7 : public ExynosSensorInfo { +public: + ExynosSensorS5K3H7(); +}; + +struct ExynosSensorS5K3H5 : public ExynosSensorInfo { +public: + ExynosSensorS5K3H5(); +}; + +struct ExynosSensorS5K4H5 : public ExynosSensorInfo { +public: + ExynosSensorS5K4H5(); +}; + +struct ExynosSensorS5K6A3 : public ExynosSensorInfo { +public: + ExynosSensorS5K6A3(); +}; + +struct ExynosSensorIMX175 : public ExynosSensorInfo { +public: + ExynosSensorIMX175(); +}; + +struct ExynosSensorS5K8B1 : public ExynosSensorInfo { +public: + ExynosSensorS5K8B1(); +}; + +/* Helpper functions */ +struct ExynosSensorInfo *createSensorInfo(int sensorName); +int getSensorId(int camId); + +bool needGSCForCapture(int camId); + +static int PREVIEW_LIST[][SIZE_OF_RESOLUTION] = +{ + { 5312, 2988, SIZE_RATIO_16_9}, + { 4128, 3096, SIZE_RATIO_4_3}, + { 4096, 3072, SIZE_RATIO_4_3}, + { 3840, 2160, SIZE_RATIO_16_9}, + { 3200, 2400, SIZE_RATIO_4_3}, + { 3072, 1728, SIZE_RATIO_16_9}, + { 2592, 1944, SIZE_RATIO_4_3}, + { 2592, 1936, SIZE_RATIO_4_3}, /* not exactly matched ratio */ + { 2560, 1920, SIZE_RATIO_4_3}, + { 2560, 1440, SIZE_RATIO_16_9}, + { 2048, 1536, SIZE_RATIO_4_3}, + { 1920, 1440, SIZE_RATIO_4_3}, + { 1920, 1080, SIZE_RATIO_16_9}, + { 1600, 1200, SIZE_RATIO_4_3}, +/* { 1446, 1080, SIZE_RATIO_4_3}, *//* preview ratio for 2592x1936 */ +/* remove for CTS */ + { 1440, 1080, SIZE_RATIO_4_3}, + /* { 1392, 1392, SIZE_RATIO_1_1}, */ /* remove for CTS */ + { 1280, 960, SIZE_RATIO_4_3}, + { 1280, 720, SIZE_RATIO_16_9}, +/* { 1080, 1080, SIZE_RATIO_1_1}, */ + { 1056, 864, SIZE_RATIO_11_9}, + { 1024, 768, SIZE_RATIO_4_3}, + { 960, 720, SIZE_RATIO_4_3}, +/* { 1024, 574, SIZE_RATIO_16_9}, vendor specific *//* not exactly matched ratio */ +/* { 1008, 568, SIZE_RATIO_16_9}, vendor specific *//* not exactly matched ratio */ + { 800, 600, SIZE_RATIO_4_3}, + { 800, 480, SIZE_RATIO_5_3}, + { 800, 450, SIZE_RATIO_16_9}, + { 720, 720, SIZE_RATIO_1_1}, + { 720, 480, SIZE_RATIO_3_2}, + { 640, 480, SIZE_RATIO_4_3}, + { 528, 432, SIZE_RATIO_11_9}, + { 480, 320, SIZE_RATIO_3_2}, + { 480, 270, SIZE_RATIO_16_9}, + { 352, 288, SIZE_RATIO_11_9}, + { 320, 240, SIZE_RATIO_4_3}, +/* SCP can support up to 1/16 x 1/16 scale down. */ +/* { 176, 144, SIZE_RATIO_11_9} */ +}; + +static int PICTURE_LIST[][SIZE_OF_RESOLUTION] = +{ + { 5312, 2988, SIZE_RATIO_16_9}, + { 4128, 3096, SIZE_RATIO_4_3}, + { 4128, 2322, SIZE_RATIO_16_9}, + { 4096, 3072, SIZE_RATIO_4_3}, + { 4096, 2304, SIZE_RATIO_16_9}, + { 3840, 2160, SIZE_RATIO_16_9}, + { 3264, 2448, SIZE_RATIO_4_3}, + { 3264, 1836, SIZE_RATIO_16_9}, + { 3200, 2400, SIZE_RATIO_4_3}, + { 3072, 1728, SIZE_RATIO_16_9}, + { 2988, 2988, SIZE_RATIO_1_1}, + { 2592, 1944, SIZE_RATIO_4_3}, + { 2592, 1936, SIZE_RATIO_4_3}, /* not exactly matched ratio */ + { 2560, 1920, SIZE_RATIO_4_3}, + { 2448, 2448, SIZE_RATIO_1_1}, + { 2048, 1536, SIZE_RATIO_4_3}, + { 2048, 1152, SIZE_RATIO_16_9}, + { 1920, 1080, SIZE_RATIO_16_9}, + { 1600, 1200, SIZE_RATIO_4_3}, + { 1440, 1080, SIZE_RATIO_4_3}, + /* { 1392, 1392, SIZE_RATIO_1_1}, */ /* remove for CTS */ + { 1280, 960, SIZE_RATIO_4_3}, + { 1280, 720, SIZE_RATIO_16_9}, + { 1024, 768, SIZE_RATIO_4_3}, +/* { 1024, 574, SIZE_RATIO_16_9}, vendor specific *//* not exactly matched ratio */ +/* { 1008, 568, SIZE_RATIO_16_9}, vendor specific *//* not exactly matched ratio */ + { 800, 600, SIZE_RATIO_4_3}, + { 800, 480, SIZE_RATIO_5_3}, + { 800, 450, SIZE_RATIO_16_9}, + { 720, 480, SIZE_RATIO_3_2}, + { 640, 480, SIZE_RATIO_4_3}, + /* { 528, 432, SIZE_RATIO_11_9}, */ /* remove for CTS */ + { 512, 384, SIZE_RATIO_4_3}, + { 512, 288, SIZE_RATIO_11_9}, + { 480, 320, SIZE_RATIO_3_2}, + /* { 352, 288, SIZE_RATIO_16_9}, */ /* remove for CTS */ + { 320, 240, SIZE_RATIO_4_3}, + { 320, 180, SIZE_RATIO_16_9}, +/* TODO : will be support after enable REPROCESSING */ +/* { 176, 144, SIZE_RATIO_11_9} */ +}; + +static int THUMBNAIL_LIST[][SIZE_OF_RESOLUTION] = +{ + { 512, 384, SIZE_RATIO_4_3}, + { 320, 240, SIZE_RATIO_4_3}, + { 0, 0, SIZE_RATIO_1_1} +}; + +static int VIDEO_LIST[][SIZE_OF_RESOLUTION] = +{ +/* + * When GED camera App goes into Recording mode, + * App set the Preview size to the 1st size of the video list. + * In case the 1st size of the list is UHD, + * although App do FHD recording, App do preview with UHD. + * So, the useless electric current is wasted. + * Conclusion: The 1st of the list set the LCD size until GED camera App is modified. + */ + { 1920, 1080, SIZE_RATIO_16_9}, + { 3840, 2160, SIZE_RATIO_16_9}, + { 1440, 1080, SIZE_RATIO_4_3}, + { 1280, 720, SIZE_RATIO_16_9}, + { 960, 720, SIZE_RATIO_4_3}, + { 800, 450, SIZE_RATIO_16_9}, + { 720, 480, SIZE_RATIO_3_2}, + { 640, 480, SIZE_RATIO_4_3}, + { 480, 320, SIZE_RATIO_3_2}, + { 352, 288, SIZE_RATIO_11_9}, + { 320, 240, SIZE_RATIO_4_3}, + { 176, 144, SIZE_RATIO_11_9} +}; + +static int FPS_RANGE_LIST[][2] = +{ + { 5000, 5000}, + { 7000, 7000}, + { 15000, 15000}, + { 24000, 24000}, + { 27000, 27000}, + { 4000, 30000}, + { 10000, 30000}, + { 15000, 30000}, + { 30000, 30000}, + { 30000, 60000}, + { 60000, 60000}, + { 60000, 120000}, + { 120000, 120000}, +}; + +enum CAMERA_ID { + CAMERA_ID_BACK = 0, + CAMERA_ID_FRONT = 1, + CAMERA_ID_MAX, +}; + +enum MODE { + MODE_PREVIEW = 0, + MODE_PICTURE, + MODE_VIDEO, + MODE_THUMBNAIL, +}; + +enum { + ANTIBANDING_AUTO = (1 << 0), + ANTIBANDING_50HZ = (1 << 1), + ANTIBANDING_60HZ = (1 << 2), + ANTIBANDING_OFF = (1 << 3), +}; + +enum { + SCENE_MODE_AUTO = (1 << 0), + SCENE_MODE_ACTION = (1 << 1), + SCENE_MODE_PORTRAIT = (1 << 2), + SCENE_MODE_LANDSCAPE = (1 << 3), + SCENE_MODE_NIGHT = (1 << 4), + SCENE_MODE_NIGHT_PORTRAIT = (1 << 5), + SCENE_MODE_THEATRE = (1 << 6), + SCENE_MODE_BEACH = (1 << 7), + SCENE_MODE_SNOW = (1 << 8), + SCENE_MODE_SUNSET = (1 << 9), + SCENE_MODE_STEADYPHOTO = (1 << 10), + SCENE_MODE_FIREWORKS = (1 << 11), + SCENE_MODE_SPORTS = (1 << 12), + SCENE_MODE_PARTY = (1 << 13), + SCENE_MODE_CANDLELIGHT = (1 << 14), +}; + +enum { + FOCUS_MODE_AUTO = (1 << 0), + FOCUS_MODE_INFINITY = (1 << 1), + FOCUS_MODE_MACRO = (1 << 2), + FOCUS_MODE_FIXED = (1 << 3), + FOCUS_MODE_EDOF = (1 << 4), + FOCUS_MODE_CONTINUOUS_VIDEO = (1 << 5), + FOCUS_MODE_CONTINUOUS_PICTURE = (1 << 6), + FOCUS_MODE_TOUCH = (1 << 7), + FOCUS_MODE_CONTINUOUS_PICTURE_MACRO = (1 << 8), +}; + +enum { + WHITE_BALANCE_AUTO = (1 << 0), + WHITE_BALANCE_INCANDESCENT = (1 << 1), + WHITE_BALANCE_FLUORESCENT = (1 << 2), + WHITE_BALANCE_WARM_FLUORESCENT = (1 << 3), + WHITE_BALANCE_DAYLIGHT = (1 << 4), + WHITE_BALANCE_CLOUDY_DAYLIGHT = (1 << 5), + WHITE_BALANCE_TWILIGHT = (1 << 6), + WHITE_BALANCE_SHADE = (1 << 7), +}; + +enum { + FLASH_MODE_OFF = (1 << 0), + FLASH_MODE_AUTO = (1 << 1), + FLASH_MODE_ON = (1 << 2), + FLASH_MODE_RED_EYE = (1 << 3), + FLASH_MODE_TORCH = (1 << 4), +}; + +enum { + EFFECT_NONE = (1 << COLORCORRECTION_MODE_FAST), + EFFECT_MONO = (1 << COLORCORRECTION_MODE_EFFECT_MONO), + EFFECT_NEGATIVE = (1 << COLORCORRECTION_MODE_EFFECT_NEGATIVE), + EFFECT_SOLARIZE = (1 << COLORCORRECTION_MODE_EFFECT_SOLARIZE), + EFFECT_SEPIA = (1 << COLORCORRECTION_MODE_EFFECT_SEPIA), + EFFECT_POSTERIZE = (1 << COLORCORRECTION_MODE_EFFECT_POSTERIZE), + EFFECT_WHITEBOARD = (1 << COLORCORRECTION_MODE_EFFECT_WHITEBOARD), + EFFECT_BLACKBOARD = (1 << COLORCORRECTION_MODE_EFFECT_BLACKBOARD), + EFFECT_AQUA = (1 << COLORCORRECTION_MODE_EFFECT_AQUA), +}; + +/* Metering */ +enum { + METERING_MODE_AVERAGE = (1 << 0), + METERING_MODE_CENTER = (1 << 1), + METERING_MODE_MATRIX = (1 << 2), + METERING_MODE_SPOT = (1 << 3), +}; + +/* Contrast */ +enum { + CONTRAST_AUTO = (1 << 0), + CONTRAST_MINUS_2 = (1 << 1), + CONTRAST_MINUS_1 = (1 << 2), + CONTRAST_DEFAULT = (1 << 3), + CONTRAST_PLUS_1 = (1 << 4), + CONTRAST_PLUS_2 = (1 << 5), +}; + +/* Shot mode */ +enum SHOT_MODE { + SHOT_MODE_NORMAL = 0x00, + SHOT_MODE_AUTO = 0x01, + SHOT_MODE_BEAUTY_FACE = 0x02, + SHOT_MODE_BEST_PHOTO = 0x03, + SHOT_MODE_DRAMA = 0x04, + SHOT_MODE_BEST_FACE = 0x05, + SHOT_MODE_ERASER = 0x06, + SHOT_MODE_PANORAMA = 0x07, + SHOT_MODE_3D_PANORAMA = 0x08, + SHOT_MODE_RICH_TONE = 0x09, + SHOT_MODE_NIGHT = 0x0A, + SHOT_MODE_STORY = 0x0B, + SHOT_MODE_AUTO_PORTRAIT = 0x0C, + SHOT_MODE_PET = 0x0D, + SHOT_MODE_GOLF = 0x0E, + SHOT_MODE_ANIMATED_SCENE = 0x0F, + SHOT_MODE_NIGHT_SCENE = 0x10, + SHOT_MODE_SPORTS = 0x11, + SHOT_MODE_SLOWMOTION = 0x12, + SHOT_MODE_MAGIC = 0x13, + SHOT_MODE_MAX, +}; + +enum SERIES_SHOT_MODE { + SERIES_SHOT_MODE_NONE = 0, + SERIES_SHOT_MODE_LLS = 1, + SERIES_SHOT_MODE_SIS = 2, + SERIES_SHOT_MODE_BURST = 3, + SERIES_SHOT_MODE_ERASER = 4, + SERIES_SHOT_MODE_BEST_FACE = 5, + SERIES_SHOT_MODE_BEST_PHOTO = 6, + SERIES_SHOT_MODE_MAGIC = 7, + SERIES_SHOT_MODE_MAX, +}; +}; /* namespace android */ +#endif diff --git a/libcamera/Vendor/SecCameraConfig.h b/libcamera/Vendor/SecCameraConfig.h new file mode 100644 index 0000000000000000000000000000000000000000..5eedfbd0175b68fa54ceb864db4843ec61a784c8 --- /dev/null +++ b/libcamera/Vendor/SecCameraConfig.h @@ -0,0 +1,28 @@ +/* + * Copyright 2013, Samsung Electronics Co. LTD + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed toggle an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/*! + * \file SecCameraConfig.h + * \brief hearder file for SecCameraConfig + * \author Pilsun Jang(pilsun.jang@samsung.com) + * \date 2013/7/15 + * + */ + +#ifndef SEC_CAMERA_CONFIG_H__ +#define SEC_CAMERA_CONFIG_H__ + +#endif /* EXYNOS_CAMERA_CONFIG_H__ */ diff --git a/libdisplaymodule/Android.mk b/libdisplaymodule/Android.mk new file mode 100644 index 0000000000000000000000000000000000000000..3b155db2f57fb91c92fca740129a58b2b22d0ab6 --- /dev/null +++ b/libdisplaymodule/Android.mk @@ -0,0 +1,41 @@ +# Copyright (C) 2008 The Android Open Source Project +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +ifeq ($(filter-out exynos5,$(TARGET_BOARD_PLATFORM)),) + +LOCAL_PATH:= $(call my-dir) +include $(CLEAR_VARS) + +LOCAL_PRELINK_MODULE := false +LOCAL_SHARED_LIBRARIES := liblog libutils libcutils libexynosutils libexynosv4l2 libsync libhwcutils libexynosgscaler libdisplay libmpp + +LOCAL_C_INCLUDES := \ + $(LOCAL_PATH)/../../exynos5/include \ + $(TOP)/hardware/samsung_slsi/exynos/include \ + $(TOP)/hardware/samsung_slsi/exynos/libexynosutils \ + $(TOP)/hardware/samsung_slsi/$(TARGET_SOC)/include \ + $(TOP)/hardware/samsung_slsi/$(TARGET_SOC)/libhwcmodule \ + $(TOP)/hardware/samsung_slsi/exynos/libhwc \ + $(TOP)/hardware/samsung_slsi/exynos/libhwcUtils \ + $(TOP)/hardware/samsung_slsi/exynos/libdisplay \ + $(TOP)/hardware/samsung_slsi/exynos/libmpp + +LOCAL_SRC_FILES := \ + ExynosPrimaryDisplay.cpp + +LOCAL_MODULE_TAGS := eng +LOCAL_MODULE := libdisplaymodule +include $(BUILD_SHARED_LIBRARY) + +endif diff --git a/libdisplaymodule/ExynosPrimaryDisplay.cpp b/libdisplaymodule/ExynosPrimaryDisplay.cpp new file mode 100644 index 0000000000000000000000000000000000000000..7c38593ddf12e4e37cc126e45e22253aff3b41b5 --- /dev/null +++ b/libdisplaymodule/ExynosPrimaryDisplay.cpp @@ -0,0 +1,11 @@ +#include "ExynosPrimaryDisplay.h" +#include "ExynosHWCModule.h" + +ExynosPrimaryDisplay::ExynosPrimaryDisplay(int numGSCs, struct exynos5_hwc_composer_device_1_t *pdev) : + ExynosOverlayDisplay(numGSCs, pdev) +{ +} + +ExynosPrimaryDisplay::~ExynosPrimaryDisplay() +{ +} diff --git a/libdisplaymodule/ExynosPrimaryDisplay.h b/libdisplaymodule/ExynosPrimaryDisplay.h new file mode 100644 index 0000000000000000000000000000000000000000..e4e4291271766395fe8a4135dfa1c40472190cbd --- /dev/null +++ b/libdisplaymodule/ExynosPrimaryDisplay.h @@ -0,0 +1,12 @@ +#ifndef EXYNOS_DISPLAY_MODULE_H +#define EXYNOS_DISPLAY_MODULE_H + +#include "ExynosOverlayDisplay.h" + +class ExynosPrimaryDisplay : public ExynosOverlayDisplay { + public: + ExynosPrimaryDisplay(int numGSCs, struct exynos5_hwc_composer_device_1_t *pdev); + ~ExynosPrimaryDisplay(); +}; + +#endif diff --git a/libhdmimodule/Android.mk b/libhdmimodule/Android.mk new file mode 100644 index 0000000000000000000000000000000000000000..aa228fd270a36c9d91cf6077921aef2d3881ee57 --- /dev/null +++ b/libhdmimodule/Android.mk @@ -0,0 +1,50 @@ +# Copyright (C) 2008 The Android Open Source Project +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +ifeq ($(filter-out exynos5,$(TARGET_BOARD_PLATFORM)),) + +LOCAL_PATH:= $(call my-dir) +include $(CLEAR_VARS) + +LOCAL_PRELINK_MODULE := false +LOCAL_SHARED_LIBRARIES := liblog libutils libcutils libexynosutils libexynosv4l2 libsync libhdmi libdisplay + +LOCAL_C_INCLUDES := \ + $(LOCAL_PATH)/../../exynos5/include \ + $(TOP)/hardware/samsung_slsi/exynos/include \ + $(TOP)/hardware/samsung_slsi/exynos/libexynosutils \ + $(TOP)/hardware/samsung_slsi/$(TARGET_SOC)/include \ + $(TOP)/hardware/samsung_slsi/$(TARGET_SOC)/libhwcmodule \ + $(TOP)/hardware/samsung_slsi/exynos/libhwc \ + $(TOP)/hardware/samsung_slsi/exynos/libhwcutils \ + $(TOP)/hardware/samsung_slsi/exynos/libdisplay + +ifeq ($(BOARD_HDMI_INCAPABLE), true) +LOCAL_C_INCLUDES += $(TOP)/hardware/samsung_slsi/exynos/libhdmi_dummy +else +ifeq ($(BOARD_USES_NEW_HDMI), true) +LOCAL_C_INCLUDES += $(TOP)/hardware/samsung_slsi/exynos/libhdmi +else +LOCAL_C_INCLUDES += $(TOP)/hardware/samsung_slsi/exynos/libhdmi_legacy +endif +endif + +LOCAL_SRC_FILES := \ + ExynosExternalDisplayModule.cpp + +LOCAL_MODULE_TAGS := eng +LOCAL_MODULE := libhdmimodule +include $(BUILD_SHARED_LIBRARY) + +endif diff --git a/libhdmimodule/ExynosExternalDisplayModule.cpp b/libhdmimodule/ExynosExternalDisplayModule.cpp new file mode 100644 index 0000000000000000000000000000000000000000..0e0b33b68265ccbfe9fb99dc87faa03779fe0062 --- /dev/null +++ b/libhdmimodule/ExynosExternalDisplayModule.cpp @@ -0,0 +1,10 @@ +#include "ExynosExternalDisplayModule.h" + +ExynosExternalDisplayModule::ExynosExternalDisplayModule(struct exynos5_hwc_composer_device_1_t *pdev) + : ExynosExternalDisplay(pdev) +{ +} + +ExynosExternalDisplayModule::~ExynosExternalDisplayModule() +{ +} diff --git a/libhdmimodule/ExynosExternalDisplayModule.h b/libhdmimodule/ExynosExternalDisplayModule.h new file mode 100644 index 0000000000000000000000000000000000000000..5639fb8e13fad8359005943c07d9f3a7fb4f9aa1 --- /dev/null +++ b/libhdmimodule/ExynosExternalDisplayModule.h @@ -0,0 +1,12 @@ +#ifndef EXYNOS_EXTERNAL_DISPLAY_MODULE_H +#define EXYNOS_EXTERNAL_DISPLAY_MODULE_H + +#include "ExynosExternalDisplay.h" + +class ExynosExternalDisplayModule : public ExynosExternalDisplay { + public: + ExynosExternalDisplayModule(struct exynos5_hwc_composer_device_1_t *pdev); + ~ExynosExternalDisplayModule(); +}; + +#endif diff --git a/libhwcmodule/ExynosHWCModule.h b/libhwcmodule/ExynosHWCModule.h new file mode 100644 index 0000000000000000000000000000000000000000..fb20a06df80350addabbd3288b0acbff494029f3 --- /dev/null +++ b/libhwcmodule/ExynosHWCModule.h @@ -0,0 +1,83 @@ +/* + * Copyright (C) 2012 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef ANDROID_EXYNOS_HWC_MODULE_H_ +#define ANDROID_EXYNOS_HWC_MODULE_H_ +#include + +#define VSYNC_DEV_PREFIX "/sys/devices/" +#define VSYNC_DEV_MIDDLE "14680000.sysmmu/14640000.sysmmu/" +#define VSYNC_DEV_NAME "14400000.fimd_fb/vsync" + +#define FIMD_WORD_SIZE_BYTES 16 +#define FIMD_BURSTLEN 8 +#define FIMD_ADDED_BURSTLEN_BYTES 4 +#define FIMD_BW_OVERLAP_CHECK + +#define TRY_SECOND_VSYNC_DEV +#ifdef TRY_SECOND_VSYNC_DEV +#define VSYNC_DEV_NAME2 "exynos5-fb.1/vsync" +#define VSYNC_DEV_MIDDLE2 "platform/exynos-sysmmu.30/exynos-sysmmu.11/" +#endif + +#define DUAL_VIDEO_OVERLAY_SUPPORT + +#ifdef FIMD_BW_OVERLAP_CHECK +const size_t MAX_NUM_FIMD_DMA_CH = 2; +const uint32_t FIMD_DMA_CH_IDX[] = {0, 1, 1, 1, 0}; +const uint32_t FIMD_DMA_CH_BW_SET1[MAX_NUM_FIMD_DMA_CH] = {1920 * 1080 *2, 1920 * 1080 *2}; +const uint32_t FIMD_DMA_CH_BW_SET2[MAX_NUM_FIMD_DMA_CH] = {2560 * 1600, 2560 * 1600 *2}; +const uint32_t FIMD_DMA_CH_OVERLAP_CNT_SET1[MAX_NUM_FIMD_DMA_CH] = {2, 2}; +const uint32_t FIMD_DMA_CH_OVERLAP_CNT_SET2[MAX_NUM_FIMD_DMA_CH] = {1, 2}; + +inline void fimd_bw_overlap_limits_init(int xres, int yres, + uint32_t *fimd_dma_chan_max_bw, uint32_t *fimd_dma_chan_max_overlap_cnt) +{ + if (xres * yres > 1920 * 1080) { + for (size_t i = 0; i < MAX_NUM_FIMD_DMA_CH; i++) { + fimd_dma_chan_max_bw[i] = FIMD_DMA_CH_BW_SET2[i]; + fimd_dma_chan_max_overlap_cnt[i] = FIMD_DMA_CH_OVERLAP_CNT_SET2[i]; + } + } else { + for (size_t i = 0; i < MAX_NUM_FIMD_DMA_CH; i++) { + fimd_dma_chan_max_bw[i] = FIMD_DMA_CH_BW_SET1[i]; + fimd_dma_chan_max_overlap_cnt[i] = FIMD_DMA_CH_OVERLAP_CNT_SET1[i]; + } + } +} +#endif + +const size_t GSC_DST_W_ALIGNMENT_RGB888 = 16; +const size_t GSC_DST_CROP_W_ALIGNMENT_RGB888 = 1; +const size_t GSC_W_ALIGNMENT = 16; +const size_t GSC_H_ALIGNMENT = 16; +const size_t GSC_DST_H_ALIGNMENT_RGB888 = 1; +const size_t FIMD_GSC_IDX = 0; +const size_t FIMD_GSC_SEC_IDX = 1; +const size_t HDMI_GSC_IDX = 2; +#ifdef USES_VIRTUAL_DISPLAY +const size_t WFD_GSC_IDX = 3; +#else +const size_t WFD_GSC_DRM_IDX = 3; +#endif +const int FIMD_GSC_USAGE_IDX[] = {FIMD_GSC_IDX, FIMD_GSC_SEC_IDX}; +#ifdef USES_VIRTUAL_DISPLAY +const int AVAILABLE_GSC_UNITS[] = { 0, 1, 1, 1 }; +#else +const int AVAILABLE_GSC_UNITS[] = { 0, 1, 1, 5 }; +#endif + +#endif diff --git a/libhwcutilsmodule/Android.mk b/libhwcutilsmodule/Android.mk new file mode 100644 index 0000000000000000000000000000000000000000..9eb6b2e42abe2bc05c3739bfa7c85ddb98f0c8a4 --- /dev/null +++ b/libhwcutilsmodule/Android.mk @@ -0,0 +1,45 @@ +# Copyright (C) 2008 The Android Open Source Project +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +ifeq ($(filter-out exynos5,$(TARGET_BOARD_PLATFORM)),) + +LOCAL_PATH:= $(call my-dir) +include $(CLEAR_VARS) + +LOCAL_PRELINK_MODULE := false +LOCAL_SHARED_LIBRARIES := liblog libutils libcutils libexynosutils libexynosv4l2 libsync libhwcutils libexynosgscaler libmpp + +ifeq ($(BOARD_USES_VIRTUAL_DISPLAY), true) +LOCAL_CFLAGS += -DUSES_VIRTUAL_DISPLAY +endif + +LOCAL_C_INCLUDES := \ + $(LOCAL_PATH)/../../exynos5/include \ + $(TOP)/hardware/samsung_slsi/exynos/include \ + $(TOP)/hardware/samsung_slsi/exynos/libexynosutils \ + $(TOP)/hardware/samsung_slsi/$(TARGET_SOC)/include \ + $(TOP)/hardware/samsung_slsi/$(TARGET_SOC)/libhwcmodule \ + $(TOP)/hardware/samsung_slsi/exynos/libhwc \ + $(TOP)/hardware/samsung_slsi/exynos/libhwcutils \ + $(TOP)/hardware/samsung_slsi/exynos/libdisplay \ + $(TOP)/hardware/samsung_slsi/exynos/libmpp + +LOCAL_SRC_FILES := \ + ExynosMPPModule.cpp + +LOCAL_MODULE_TAGS := eng +LOCAL_MODULE := libhwcutilsmodule +include $(BUILD_SHARED_LIBRARY) + +endif diff --git a/libhwcutilsmodule/ExynosMPPModule.cpp b/libhwcutilsmodule/ExynosMPPModule.cpp new file mode 100644 index 0000000000000000000000000000000000000000..2bf375151880f68a096a694d87307fec639837ce --- /dev/null +++ b/libhwcutilsmodule/ExynosMPPModule.cpp @@ -0,0 +1,11 @@ +#include "ExynosMPPModule.h" +#include "ExynosDisplay.h" + +ExynosMPPModule::ExynosMPPModule(ExynosDisplay *display, int index) + : ExynosMPP(display, index) +{ +} + +ExynosMPPModule::~ExynosMPPModule() +{ +} diff --git a/libhwcutilsmodule/ExynosMPPModule.h b/libhwcutilsmodule/ExynosMPPModule.h new file mode 100644 index 0000000000000000000000000000000000000000..4ab85fe2bc3a35b48aa2344399aa18447d04c734 --- /dev/null +++ b/libhwcutilsmodule/ExynosMPPModule.h @@ -0,0 +1,14 @@ +#ifndef EXYNOS_MPP_MODULE_H +#define EXYNOS_MPP_MODULE_H + +#include "ExynosMPP.h" + +class ExynosDisplay; + +class ExynosMPPModule : public ExynosMPP { + public: + ExynosMPPModule(ExynosDisplay *display, int index); + ~ExynosMPPModule(); +}; + +#endif diff --git a/libhwjpeg/Android.mk b/libhwjpeg/Android.mk new file mode 100644 index 0000000000000000000000000000000000000000..a6ae75e261dbaacfd7a41633bb52cd75529e5f3d --- /dev/null +++ b/libhwjpeg/Android.mk @@ -0,0 +1,39 @@ +# Copyright (C) 2013 The Android Open Source Project +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +LOCAL_PATH:= $(call my-dir) +include $(CLEAR_VARS) + +LOCAL_MODULE_TAGS := optional + +LOCAL_MODULE := libhwjpeg + +LOCAL_C_INCLUDES := \ + $(LOCAL_PATH)/../include \ + $(TOP)/hardware/samsung_slsi/exynos/libexynosutils \ + $(TOP)/hardware/samsung_slsi/exynos/include + +LOCAL_SRC_FILES := \ + ExynosJpegEncoder.cpp \ + ExynosJpegDecoder.cpp \ + ExynosJpegBase.cpp \ + ExynosJpegBase_Dependence.cpp + +LOCAL_SHARED_LIBRARIES := \ + libutils \ + liblog \ + libexynosutils \ + libion_exynos + +include $(BUILD_SHARED_LIBRARY) diff --git a/libhwjpeg/ExynosJpegBase.cpp b/libhwjpeg/ExynosJpegBase.cpp new file mode 100644 index 0000000000000000000000000000000000000000..4162f66622a6188c0efee5826fbde64135b4ea9b --- /dev/null +++ b/libhwjpeg/ExynosJpegBase.cpp @@ -0,0 +1,854 @@ +/* + * Copyright Samsung Electronics Co.,LTD. + * Copyright (C) 2013 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "ExynosJpegApi.h" + +#define MAXIMUM_JPEG_SIZE(n) ((65535 - (n)) * 32768) + +#define JPEG_ERROR_LOG(fmt,...) ALOGE(fmt,##__VA_ARGS__) + +ExynosJpegBase::ExynosJpegBase() +{ + memset(&t_stJpegOutbuf, 0, sizeof(struct BUFFER)); + memset(&t_stJpegConfig, 0, sizeof(struct CONFIG)); + memset(&t_stJpegInbuf, 0, sizeof(struct BUFFER)); + t_bFlagCreate = false; + t_bFlagCreateInBuf = false; + t_bFlagCreateOutBuf = false; + t_bFlagExcute = false; + t_bFlagSelect = false; + t_iCacheValue = 0; + t_iSelectNode = 0; // 0:jpeg2 hx , 1:jpeg2 hx , 2:jpeg hx; + t_iPlaneNum = 0; + t_iJpegFd = 0; +} + +ExynosJpegBase::~ExynosJpegBase() +{ +} + +int ExynosJpegBase::t_v4l2Querycap(int iFd) +{ + struct v4l2_capability cap; + int iRet = ERROR_NONE; + + iRet = ioctl(iFd, VIDIOC_QUERYCAP, &cap); + if (iRet < 0) { + JPEG_ERROR_LOG("[%s:%d]: VIDIOC_QUERYCAP failed\n", __func__, iRet); + return iRet; + } + + return iRet; +} + +int ExynosJpegBase::t_v4l2SetJpegcomp(int iFd, int iQuality) +{ + struct v4l2_jpegcompression arg; + int iRet = ERROR_NONE; + + arg.quality = iQuality; + + iRet = ioctl(iFd, VIDIOC_S_JPEGCOMP, &arg); + if (iRet < 0) { + JPEG_ERROR_LOG("[%s:%d]: VIDIOC_S_JPEGCOMP failed\n", __func__, iRet); + return iRet; + } + + return iRet; +} + +int ExynosJpegBase::t_v4l2SetFmt(int iFd, enum v4l2_buf_type eType, struct CONFIG *pstConfig) +{ + struct v4l2_format fmt; + int iRet = ERROR_NONE; + + fmt.type = eType; + fmt.fmt.pix_mp.width = pstConfig->width; + fmt.fmt.pix_mp.height = pstConfig->height; + fmt.fmt.pix_mp.field = V4L2_FIELD_ANY; + + if (pstConfig->mode == MODE_ENCODE) + fmt.fmt.pix_mp.colorspace = V4L2_COLORSPACE_JPEG; + + switch (fmt.type) { + case V4L2_BUF_TYPE_VIDEO_OUTPUT: + case V4L2_BUF_TYPE_VIDEO_CAPTURE: + break; + case V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE: + if (pstConfig->mode == MODE_ENCODE) { + fmt.fmt.pix_mp.pixelformat = pstConfig->pix.enc_fmt.in_fmt; + fmt.fmt.pix_mp.plane_fmt[0].sizeimage = 1; + } else { + fmt.fmt.pix_mp.pixelformat = pstConfig->pix.dec_fmt.in_fmt; + fmt.fmt.pix_mp.plane_fmt[0].sizeimage = pstConfig->sizeJpeg; + } + break; + case V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE: + if (pstConfig->mode == MODE_ENCODE) { + fmt.fmt.pix_mp.pixelformat = pstConfig->pix.enc_fmt.out_fmt; + fmt.fmt.pix_mp.plane_fmt[0].sizeimage = 1; + } else { + fmt.fmt.pix_mp.pixelformat = pstConfig->pix.dec_fmt.out_fmt; + fmt.fmt.pix_mp.width = pstConfig->scaled_width; + fmt.fmt.pix_mp.height = pstConfig->scaled_height; + } + break; + default: + return ERROR_INVALID_V4l2_BUF_TYPE; + } + + iRet = ioctl(iFd, VIDIOC_S_FMT, &fmt); + if (iRet < 0) { + JPEG_ERROR_LOG("[%s:%d]: VIDIOC_S_FMT failed\n", __func__, iRet); + return iRet; + } + + return iRet; +} + +int ExynosJpegBase::t_v4l2GetFmt(int iFd, enum v4l2_buf_type eType, struct CONFIG *pstConfig) +{ + struct v4l2_format fmt; + int iRet = ERROR_NONE; + + fmt.type = eType; + iRet = ioctl(iFd, VIDIOC_G_FMT, &fmt); + if (iRet < 0) { + JPEG_ERROR_LOG("[%s:%d]: VIDIOC_G_FMT failed\n", __func__, iRet); + return iRet; + } + + switch (fmt.type) { + case V4L2_BUF_TYPE_VIDEO_OUTPUT: // fall through + case V4L2_BUF_TYPE_VIDEO_CAPTURE: + pstConfig->width = fmt.fmt.pix.width; + pstConfig->height = fmt.fmt.pix.height; + break; + case V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE: + pstConfig->width = fmt.fmt.pix_mp.width; + pstConfig->height = fmt.fmt.pix_mp.height; + if (pstConfig->mode == MODE_ENCODE) + pstConfig->pix.enc_fmt.in_fmt = fmt.fmt.pix_mp.pixelformat; + else + pstConfig->pix.dec_fmt.in_fmt = fmt.fmt.pix_mp.pixelformat; + break; + case V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE: + pstConfig->width = fmt.fmt.pix_mp.width; + pstConfig->height = fmt.fmt.pix_mp.height; + if (pstConfig->mode == MODE_ENCODE) + pstConfig->pix.enc_fmt.out_fmt = fmt.fmt.pix_mp.pixelformat; + else + pstConfig->pix.dec_fmt.out_fmt = fmt.fmt.pix_mp.pixelformat; + break; + default: + return ERROR_INVALID_V4l2_BUF_TYPE; + } + + return iRet; +} + +int ExynosJpegBase::t_v4l2Reqbufs(int iFd, int iBufCount, struct BUF_INFO *pstBufInfo) +{ + struct v4l2_requestbuffers req; + int iRet = ERROR_NONE; + + memset(&req, 0, sizeof(v4l2_requestbuffers)); + + req.type = pstBufInfo->buf_type; + req.memory = pstBufInfo->memory; + req.count = iBufCount; + + iRet = ioctl(iFd, VIDIOC_REQBUFS, &req); + if (iRet < 0) { + JPEG_ERROR_LOG("[%s:%d]: VIDIOC_REQBUFS failed\n", __func__, iRet); + return iRet; + } + + return iRet; +} + +int ExynosJpegBase::t_v4l2Querybuf(int iFd, struct BUF_INFO *pstBufInfo, struct BUFFER *pstBuf) +{ + struct v4l2_buffer v4l2_buf; + struct v4l2_plane plane[JPEG_MAX_PLANE_CNT]; + int iRet = ERROR_NONE; + + memset(plane, 0, (int)JPEG_MAX_PLANE_CNT * sizeof(struct v4l2_plane)); + + v4l2_buf.index = 0; + v4l2_buf.type = pstBufInfo->buf_type; + v4l2_buf.memory = pstBufInfo->memory; + v4l2_buf.length = pstBufInfo->numOfPlanes; + v4l2_buf.m.planes = plane; + + iRet = ioctl(iFd, VIDIOC_QUERYBUF, &v4l2_buf); + if (iRet < 0) { + JPEG_ERROR_LOG("[%s:%d]: VIDIOC_QUERYBUF failed\n", __func__, iRet); + return iRet; + } + + for (unsigned int i= 0; i < v4l2_buf.length; i++) { + pstBuf->size[i] = v4l2_buf.m.planes[i].length; + pstBuf->c_addr[i] = (char *)mmap(0, pstBuf->size[i], + PROT_READ | PROT_WRITE, MAP_SHARED, iFd, + v4l2_buf.m.planes[i].m.mem_offset); + + if ((pstBuf->c_addr[i] == MAP_FAILED) || (pstBuf->size[i] <= 0)) { + JPEG_ERROR_LOG("[%s]: mmap failed\n", __func__); + return ERROR_MMAP_FAILED; + } + } + + pstBuf->numOfPlanes = v4l2_buf.length; + + return iRet; +} + +int ExynosJpegBase::t_v4l2Qbuf(int iFd, struct BUF_INFO *pstBufInfo, struct BUFFER *pstBuf) +{ + struct v4l2_buffer v4l2_buf; + struct v4l2_plane plane[JPEG_MAX_PLANE_CNT]; + int iRet = ERROR_NONE; + + memset(&v4l2_buf, 0, sizeof(struct v4l2_buffer)); + memset(plane, 0, (int)JPEG_MAX_PLANE_CNT * sizeof(struct v4l2_plane)); + + v4l2_buf.index = 0; + v4l2_buf.type = pstBufInfo->buf_type; + v4l2_buf.memory = pstBufInfo->memory; + v4l2_buf.field = V4L2_FIELD_ANY; + v4l2_buf.length = pstBufInfo->numOfPlanes; + v4l2_buf.m.planes = plane; + + if (pstBufInfo->memory == V4L2_MEMORY_USERPTR) { + for (int i = 0; i < pstBufInfo->numOfPlanes; i++) { + v4l2_buf.m.planes[i].m.userptr = (unsigned long)pstBuf->c_addr[i]; + v4l2_buf.m.planes[i].length = pstBuf->size[i]; + } + } + + if (pstBufInfo->memory == V4L2_MEMORY_DMABUF) { + for (int i = 0; i < pstBufInfo->numOfPlanes; i++) { + v4l2_buf.m.planes[i].m.fd = (unsigned long)pstBuf->i_addr[i]; + v4l2_buf.m.planes[i].length = pstBuf->size[i]; + } + } + + iRet = ioctl(iFd, VIDIOC_QBUF, &v4l2_buf); + if (iRet < 0) { + JPEG_ERROR_LOG("[%s:%d] VIDIOC_QBUF failed\n", __func__, iRet); + pstBuf->numOfPlanes = 0; + return iRet; + } + + return iRet; +} + +int ExynosJpegBase::t_v4l2Dqbuf(int iFd, enum v4l2_buf_type eType, enum v4l2_memory eMemory, int iNumPlanes) +{ + struct v4l2_buffer buf; + struct v4l2_plane planes[3]; + int iRet = ERROR_NONE; + + memset(&buf, 0, sizeof(struct v4l2_buffer)); + memset(planes, 0, sizeof(struct v4l2_plane) * 3); + + buf.type = eType; + buf.memory = eMemory; + buf.length = iNumPlanes; + buf.m.planes = planes; + + iRet = ioctl(iFd, VIDIOC_DQBUF, &buf); + if (iRet < 0) { + JPEG_ERROR_LOG("[%s:%d] VIDIOC_DQBUF failed\n", __func__, iRet); + return iRet; + } + + if (buf.flags & V4L2_BUF_FLAG_ERROR) + JPEG_ERROR_LOG("[%s:%d] Buffer status is error\n", __func__, buf.flags); + + if ((eType == V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE) && (t_stJpegConfig.mode == MODE_ENCODE)) + t_stJpegConfig.sizeJpeg = buf.m.planes[0].bytesused; + + return iRet; +} + +int ExynosJpegBase::t_v4l2StreamOn(int iFd, enum v4l2_buf_type eType) +{ + int iRet = ERROR_NONE; + + iRet = ioctl(iFd, VIDIOC_STREAMON, &eType); + if (iRet < 0) { + JPEG_ERROR_LOG("[%s:%d] VIDIOC_STREAMON failed\n", __func__, iRet); + return iRet; + } + + return iRet; +} + +int ExynosJpegBase::t_v4l2StreamOff(int iFd, enum v4l2_buf_type eType) +{ + int iRet = ERROR_NONE; + + iRet = ioctl(iFd, VIDIOC_STREAMOFF, &eType); + if (iRet < 0) { + JPEG_ERROR_LOG("[%s:%d] VIDIOC_STREAMOFF failed\n", __func__, iRet); + return iRet; + } + + return iRet; +} + +int ExynosJpegBase::t_v4l2SetCtrl(int iFd, int iCid, int iValue) +{ + struct v4l2_control vc; + int iRet = ERROR_NONE; + + vc.id = iCid; + vc.value = iValue; + + iRet = ioctl(iFd, VIDIOC_S_CTRL, &vc); + if (iRet < 0) { + JPEG_ERROR_LOG("[%s] VIDIOC_S_CTRL failed : cid(%d), value(%d)\n", __func__, iCid, iValue); + return iRet; + } + + return iRet; +} + +int ExynosJpegBase::t_v4l2GetCtrl(int iFd, int iCid) +{ + struct v4l2_control ctrl; + int iRet = ERROR_NONE; + + ctrl.id = iCid; + + iRet = ioctl(iFd, VIDIOC_G_CTRL, &ctrl); + if (iRet < 0) { + JPEG_ERROR_LOG("[%s] VIDIOC_G_CTRL failed : cid(%d)\n", __func__, ctrl.id); + return iRet; + } + + return ctrl.value; +} + +int ExynosJpegBase::create(enum MODE eMode) +{ + if (t_bFlagCreate == true) + return ERROR_JPEG_DEVICE_ALREADY_CREATE; + + memset(&t_stJpegConfig, 0, sizeof(struct CONFIG)); + memset(&t_stJpegInbuf, 0, sizeof(struct BUFFER)); + memset(&t_stJpegOutbuf, 0, sizeof(struct BUFFER)); + + t_stJpegConfig.mode = eMode; + t_bFlagCreate = true; + t_bFlagCreateInBuf = false; + t_bFlagCreateOutBuf = false; + t_bFlagExcute = false; + t_bFlagSelect = false; + t_iCacheValue = 0; + t_iSelectNode = 0; + t_iPlaneNum = 0; + + return ERROR_NONE; +} + +int ExynosJpegBase::openJpeg(enum MODE eMode) +{ + int iRet = ERROR_NONE; + + iRet = openNode(eMode); + if (iRet != ERROR_NONE) + return iRet; + + iRet = t_v4l2Querycap(t_iJpegFd); + if (iRet < 0) { + JPEG_ERROR_LOG("[%s]: QUERYCAP failed\n", __func__); + close(t_iJpegFd); + return ERROR_CANNOT_OPEN_JPEG_DEVICE; + } + + return ERROR_NONE; +} + +int ExynosJpegBase::destroy(int iInBufs, int iOutBufs) +{ + if (t_bFlagCreate == false) + return ERROR_JPEG_DEVICE_ALREADY_DESTROY; + + if (t_iJpegFd > 0) { + struct BUF_INFO stBufInfo; + + if (t_bFlagExcute) { + t_v4l2StreamOff(t_iJpegFd, V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE); + t_v4l2StreamOff(t_iJpegFd, V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE); + } + + if (t_bFlagExcute) { + stBufInfo.numOfPlanes = iInBufs; + stBufInfo.memory = V4L2_MEMORY_MMAP; + + stBufInfo.buf_type = V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE; + t_v4l2Reqbufs(t_iJpegFd, 0, &stBufInfo); + + stBufInfo.numOfPlanes = iOutBufs; + stBufInfo.buf_type = V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE; + t_v4l2Reqbufs(t_iJpegFd, 0, &stBufInfo); + } + + close(t_iJpegFd); + } + + t_iJpegFd = -1; + t_bFlagCreate = false; + return ERROR_NONE; +} + +int ExynosJpegBase::setSize(int iW, int iH) +{ + int mcu_x_size = 0; + + if (t_bFlagCreate == false) + return ERROR_JPEG_DEVICE_NOT_CREATE_YET; + + switch (t_stJpegConfig.pix.enc_fmt.out_fmt) { + case V4L2_PIX_FMT_JPEG_444: + case V4L2_PIX_FMT_JPEG_GRAY: + mcu_x_size = 8; + break; + case V4L2_PIX_FMT_JPEG_422: + case V4L2_PIX_FMT_JPEG_420: + mcu_x_size = 16; + break; + default: + mcu_x_size = 8; + break; + } + + if (iH < 0 || iW < 0 || (iW * iH) > MAXIMUM_JPEG_SIZE(mcu_x_size)) + return ERROR_INVALID_IMAGE_SIZE; + + t_stJpegConfig.width = iW; + t_stJpegConfig.height = iH; + + return ERROR_NONE; +} + +int ExynosJpegBase::setJpegConfig(enum MODE eMode, void *pConfig) +{ + if (t_bFlagCreate == false) + return ERROR_JPEG_DEVICE_NOT_CREATE_YET; + + if (pConfig == NULL) + return ERROR_JPEG_CONFIG_POINTER_NULL; + + memcpy(&t_stJpegConfig, pConfig, sizeof(struct CONFIG)); + + switch (eMode) { + case MODE_ENCODE: + switch (t_stJpegConfig.pix.enc_fmt.in_fmt) { + case V4L2_PIX_FMT_YUYV: + case V4L2_PIX_FMT_NV12: + case V4L2_PIX_FMT_NV21: + case V4L2_PIX_FMT_YUV420: + case V4L2_PIX_FMT_RGB565X: + case V4L2_PIX_FMT_BGR32: + case V4L2_PIX_FMT_RGB32: + t_iPlaneNum = 1; + break; + default: + JPEG_ERROR_LOG("%s::Invalid input color format(%d) fail\n", __func__, t_stJpegConfig.pix.enc_fmt.in_fmt); + t_iPlaneNum = 0; + return ERROR_INVALID_COLOR_FORMAT; + } + break; + case MODE_DECODE: + switch (t_stJpegConfig.pix.dec_fmt.out_fmt) { + case V4L2_PIX_FMT_YUYV: + case V4L2_PIX_FMT_NV12: + case V4L2_PIX_FMT_NV21: + case V4L2_PIX_FMT_YUV420: + case V4L2_PIX_FMT_RGB565X: + case V4L2_PIX_FMT_BGR32: + case V4L2_PIX_FMT_RGB32: + t_iPlaneNum = 1; + break; + default: + JPEG_ERROR_LOG("%s::Invalid input color format(%d) fail\n", __func__, t_stJpegConfig.pix.dec_fmt.out_fmt); + t_iPlaneNum = 0; + return ERROR_INVALID_COLOR_FORMAT; + } + break; + default: + t_iPlaneNum = 0; + return ERROR_INVALID_JPEG_MODE; + break; + } + + return ERROR_NONE; +} + +void *ExynosJpegBase::getJpegConfig(void) +{ + if (t_bFlagCreate == false) + return NULL; + + return &t_stJpegConfig; +} + +int ExynosJpegBase::getBuf(bool bCreateBuf, struct BUFFER *pstBuf, char **pcBuf, int *iBufSize, int iSize, int iPlaneNum) +{ + if (t_bFlagCreate == false) + return ERROR_JPEG_DEVICE_NOT_CREATE_YET; + + if (bCreateBuf == false) + return ERROR_BUF_NOT_SET_YET; + + if ((pcBuf == NULL) || (iSize == 0)) + return ERROR_BUFFR_IS_NULL; + + if (iSize < iPlaneNum) + return ERROR_BUFFER_TOO_SMALL; + + if (checkBufType(pstBuf) & JPEG_BUF_TYPE_USER_PTR) { + for (int i = 0; i < iPlaneNum; i++) + pcBuf[i] = pstBuf->c_addr[i]; + } else { + for (int i = 0; i < iPlaneNum; i++) + pcBuf[i] = NULL; + } + + for (int i = 0; i < iPlaneNum; i++) + iBufSize[i] = pstBuf->size[i]; + + return ERROR_NONE; +} + +int ExynosJpegBase::setBuf(struct BUFFER *pstBuf, char **pcBuf, int *iSize, int iPlaneNum) +{ + if (t_bFlagCreate == false) + return ERROR_JPEG_DEVICE_NOT_CREATE_YET; + + if (iPlaneNum <= 0) + return ERROR_BUFFER_TOO_SMALL; + + for (int i = 0; i < iPlaneNum; i++) { + if (pcBuf[i] == NULL) { + memset(pstBuf, 0, sizeof(struct BUFFER)); + return ERROR_BUFFR_IS_NULL; + } + if (iSize[i] <= 0) { + memset(pstBuf, 0, sizeof(struct BUFFER)); + return ERROR_BUFFER_TOO_SMALL; + } + pstBuf->c_addr[i] = pcBuf[i]; + pstBuf->size[i] = iSize[i]; + } + + pstBuf->numOfPlanes = iPlaneNum; + + return ERROR_NONE; +} + +int ExynosJpegBase::getBuf(bool bCreateBuf, struct BUFFER *pstBuf, int *piBuf, int *iBufSize, int iSize, int iPlaneNum) +{ + if (t_bFlagCreate == false) + return ERROR_JPEG_DEVICE_NOT_CREATE_YET; + + if (bCreateBuf == false) + return ERROR_BUF_NOT_SET_YET; + + if ((piBuf == NULL) || (iSize == 0)) + return ERROR_BUFFR_IS_NULL; + + if (iSize < iPlaneNum) + return ERROR_BUFFER_TOO_SMALL; + + if (checkBufType(pstBuf) & JPEG_BUF_TYPE_DMA_BUF) { + for (int i = 0; i < iPlaneNum; i++) + piBuf[i] = pstBuf->i_addr[i]; + } else { + for (int i = 0; i < iPlaneNum; i++) + piBuf[i] = 0; + } + + for (int i = 0; i < iPlaneNum; i++) + iBufSize[i] = pstBuf->size[i]; + + return ERROR_NONE; +} + +int ExynosJpegBase::setBuf(struct BUFFER *pstBuf, int *piBuf, int *iSize, int iPlaneNum) +{ + if (t_bFlagCreate == false) + return ERROR_JPEG_DEVICE_NOT_CREATE_YET; + + if (iPlaneNum <= 0) + return ERROR_BUFFER_TOO_SMALL; + + for (int i = 0; i < iPlaneNum; i++) { + if (piBuf[i] == 0) { + memset(pstBuf, 0, sizeof(struct BUFFER)); + return ERROR_BUFFR_IS_NULL; + } + if (iSize[i] <= 0) { + memset(pstBuf, 0, sizeof(struct BUFFER)); + return ERROR_BUFFER_TOO_SMALL; + } + pstBuf->i_addr[i] = piBuf[i]; + pstBuf->size[i] = iSize[i]; + } + + pstBuf->numOfPlanes = iPlaneNum; + + return ERROR_NONE; +} + +int ExynosJpegBase::setCache(int iValue) +{ + if (t_bFlagCreate == false) + return ERROR_JPEG_DEVICE_NOT_CREATE_YET; + + t_iCacheValue = iValue; + + return ERROR_NONE; +} + +int ExynosJpegBase::setJpegFormat(enum MODE eMode, int iV4l2JpegFormat) +{ + if (t_bFlagCreate == false) + return ERROR_JPEG_DEVICE_NOT_CREATE_YET; + + switch(iV4l2JpegFormat) { + case V4L2_PIX_FMT_JPEG_444: + case V4L2_PIX_FMT_JPEG_422: + case V4L2_PIX_FMT_JPEG_420: + case V4L2_PIX_FMT_JPEG_GRAY: + switch (eMode) { + case MODE_ENCODE: + t_stJpegConfig.pix.enc_fmt.out_fmt = iV4l2JpegFormat; + break; + case MODE_DECODE: + t_stJpegConfig.pix.dec_fmt.in_fmt = iV4l2JpegFormat; + break; + default: + return ERROR_INVALID_JPEG_MODE; + } + break; + default: + return ERROR_INVALID_JPEG_FORMAT; + } + + return ERROR_NONE; +} + +int ExynosJpegBase::setColorBufSize(enum MODE eMode, int *piBufSize, int iSize) +{ + int iFormat; + + switch (eMode) { + case MODE_ENCODE: + iFormat = t_stJpegConfig.pix.enc_fmt.in_fmt; + break; + case MODE_DECODE: + iFormat = t_stJpegConfig.pix.dec_fmt.out_fmt; + break; + default: + return ERROR_INVALID_JPEG_MODE; + } + + return setColorBufSize(iFormat, piBufSize, iSize, t_stJpegConfig.width, t_stJpegConfig.height); +} + +int ExynosJpegBase::setColorBufSize(int iFormat, int *piBufSize, int iSize, int width, int height) +{ + int pBufSize[3]; + + if(iSize > 3) + return ERROR_INVALID_IMAGE_SIZE; + + switch (iFormat) { + case V4L2_PIX_FMT_YUYV: + case V4L2_PIX_FMT_RGB565X: + pBufSize[0] = width * height * 2; + pBufSize[1] = 0; + pBufSize[2] = 0; + break; + case V4L2_PIX_FMT_RGB32: + case V4L2_PIX_FMT_BGR32: + pBufSize[0] = width * height * 4; + pBufSize[1] = 0; + pBufSize[2] = 0; + break; + case V4L2_PIX_FMT_NV21: + case V4L2_PIX_FMT_NV12: + case V4L2_PIX_FMT_YUV420: + case V4L2_PIX_FMT_YVU420: + pBufSize[0] = (width * height * 3) >> 1; + pBufSize[1] = 0; + pBufSize[2] = 0; + break; + case V4L2_PIX_FMT_YUV444: + pBufSize[0] = width * height * 3; + pBufSize[1] = 0; + pBufSize[2] = 0; + break; + default: + pBufSize[0] = width * height * 4; + pBufSize[1] = width * height * 4; + pBufSize[2] = width * height * 4; + break; + } + + memcpy(piBufSize, pBufSize, iSize * sizeof(int)); + + return ERROR_NONE; +} + +int ExynosJpegBase::updateConfig(enum MODE eMode, int iInBufs, int iOutBufs, int iInBufPlanes, int iOutBufPlanes) +{ + if (t_bFlagCreate == false) + return ERROR_JPEG_DEVICE_NOT_CREATE_YET; + + int iRet = ERROR_NONE; + + iRet = openJpeg(eMode); + if (iRet != ERROR_NONE) + return iRet; + + if (eMode == MODE_ENCODE) { + iRet = t_v4l2SetJpegcomp(t_iJpegFd, t_stJpegConfig.enc_qual); + if (iRet < 0) { + JPEG_ERROR_LOG("[%s,%d]: S_JPEGCOMP failed\n", __func__, iRet); + return ERROR_INVALID_JPEG_CONFIG; + } + } + + t_stJpegConfig.numOfPlanes = iInBufPlanes; + t_stJpegConfig.mode = eMode; + + iRet = t_v4l2SetFmt(t_iJpegFd, V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE, &t_stJpegConfig); + if (iRet < 0) { + JPEG_ERROR_LOG("[%s,%d]: jpeg input S_FMT failed\n", __func__, iRet); + return ERROR_INVALID_JPEG_CONFIG; + } + + struct BUF_INFO stBufInfo; + + stBufInfo.numOfPlanes = iInBufs; + stBufInfo.buf_type = V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE; + stBufInfo.memory = (enum v4l2_memory)getBufType(&t_stJpegInbuf); + + iRet = t_v4l2Reqbufs(t_iJpegFd, iInBufs, &stBufInfo); + if (iRet < 0) { + JPEG_ERROR_LOG("[%s:%d]: Input REQBUFS failed\n", __func__, iRet); + return ERROR_EXCUTE_FAIL; + } + + t_stJpegConfig.numOfPlanes = iOutBufPlanes; + iRet = t_v4l2SetFmt(t_iJpegFd, V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE, &t_stJpegConfig); + if (iRet < 0) { + JPEG_ERROR_LOG("[%s,%d]: jpeg output S_FMT failed\n", __func__, iRet); + return ERROR_INVALID_JPEG_CONFIG; + } + + stBufInfo.numOfPlanes = iOutBufs; + stBufInfo.buf_type = V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE; + stBufInfo.memory = (enum v4l2_memory)getBufType(&t_stJpegOutbuf); + + iRet = t_v4l2Reqbufs(t_iJpegFd, iOutBufs, &stBufInfo); + if (iRet < 0) { + JPEG_ERROR_LOG("[%s:%d]: Output REQBUFS failed\n", __func__, iRet); + return ERROR_REQBUF_FAIL; + } + + return ERROR_NONE; +} + +int ExynosJpegBase::execute(int iInBufPlanes, int iOutBufPlanes) +{ + if (t_bFlagCreate == false) + return ERROR_JPEG_DEVICE_NOT_CREATE_YET; + + struct BUF_INFO stBufInfo; + int iRet = ERROR_NONE; + + t_bFlagExcute = true; + + stBufInfo.numOfPlanes = iInBufPlanes; + stBufInfo.buf_type = V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE; + stBufInfo.memory = (enum v4l2_memory)getBufType(&t_stJpegInbuf); + + iRet = t_v4l2Qbuf(t_iJpegFd, &stBufInfo, &t_stJpegInbuf); + if (iRet < 0) { + JPEG_ERROR_LOG("[%s:%d]: Input QBUF failed\n", __func__, iRet); + return ERROR_EXCUTE_FAIL; + } + + stBufInfo.numOfPlanes = iOutBufPlanes; + stBufInfo.buf_type = V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE; + stBufInfo.memory = (enum v4l2_memory)getBufType(&t_stJpegOutbuf); + + iRet = t_v4l2Qbuf(t_iJpegFd, &stBufInfo, &t_stJpegOutbuf); + if (iRet < 0) { + JPEG_ERROR_LOG("[%s:%d]: Output QBUF failed\n", __func__, iRet); + return ERROR_EXCUTE_FAIL; + } + + iRet = t_v4l2StreamOn(t_iJpegFd, V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE); + if (iRet < 0) { + JPEG_ERROR_LOG("[%s:%d]: input stream on failed\n", __func__, iRet); + return ERROR_EXCUTE_FAIL; + } + iRet = t_v4l2StreamOn(t_iJpegFd, V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE); + if (iRet < 0) { + JPEG_ERROR_LOG("[%s:%d]: output stream on failed\n", __func__, iRet); + return ERROR_EXCUTE_FAIL; + } + + iRet = t_v4l2Dqbuf(t_iJpegFd, V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE, V4L2_MEMORY_MMAP, iInBufPlanes); + if (iRet < 0) { + JPEG_ERROR_LOG("[%s:%d]: Intput DQBUF failed\n", __func__, iRet); + return ERROR_EXCUTE_FAIL; + } + iRet = t_v4l2Dqbuf(t_iJpegFd, V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE, V4L2_MEMORY_MMAP, iOutBufPlanes); + if (iRet < 0) { + JPEG_ERROR_LOG("[%s:%d]: Output DQBUF failed\n", __func__, iRet); + return ERROR_EXCUTE_FAIL; + } + + return ERROR_NONE; +} + diff --git a/libhwjpeg/ExynosJpegBase_Dependence.cpp b/libhwjpeg/ExynosJpegBase_Dependence.cpp new file mode 100644 index 0000000000000000000000000000000000000000..437e99c39229988a391d08a5d1345fe971ce8c67 --- /dev/null +++ b/libhwjpeg/ExynosJpegBase_Dependence.cpp @@ -0,0 +1,217 @@ +/* + * Copyright Samsung Electronics Co.,LTD. + * Copyright (C) 2013 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "ExynosJpegApi.h" + +#define JPEG_DEC_NODE "/dev/video11" +#define JPEG_ENC_NODE "/dev/video12" +#define JPEG2_DEC_NODE "/dev/video13" +#define JPEG2_ENC_NODE "/dev/video14" + +#define JPEG_ERROR_LOG(fmt,...) ALOGE(fmt,##__VA_ARGS__) + +int ExynosJpegBase::ckeckJpegSelct(enum MODE eMode) +{ + if (t_bFlagSelect == false) { + return ERROR_NONE; + } else { + switch (eMode) { + case MODE_ENCODE: + switch (t_stJpegConfig.pix.enc_fmt.in_fmt) { + case V4L2_PIX_FMT_YUYV: + case V4L2_PIX_FMT_NV12: + case V4L2_PIX_FMT_NV21: + case V4L2_PIX_FMT_RGB565X: + case V4L2_PIX_FMT_BGR32: + case V4L2_PIX_FMT_RGB32: + case V4L2_PIX_FMT_YUV420: + return ERROR_NONE; + default: + JPEG_ERROR_LOG("ERR(%s):JPEG device was not matching with colorformat\n", __func__); + return ERROR_INVALID_SELECT; + } + break; + case MODE_DECODE: + switch (t_stJpegConfig.pix.enc_fmt.out_fmt) { + case V4L2_PIX_FMT_YUYV: + case V4L2_PIX_FMT_NV12: + case V4L2_PIX_FMT_NV21: + case V4L2_PIX_FMT_RGB565X: + case V4L2_PIX_FMT_BGR32: + case V4L2_PIX_FMT_RGB32: + case V4L2_PIX_FMT_YUV420: + return ERROR_NONE; + default: + JPEG_ERROR_LOG("ERR(%s):JPEG device was not matching with colorformat\n", __func__); + return ERROR_INVALID_SELECT; + } + default: + break; + } + } + + return ERROR_NONE; +} + +int ExynosJpegBase::selectJpegHW(int iSel) +{ + t_iSelectNode = iSel; + + int iRet = ckeckJpegSelct((enum MODE)t_stJpegConfig.mode); + t_bFlagSelect = true; + + return iRet; +} + +int ExynosJpegBase::openNode(enum MODE eMode) +{ + switch (t_iSelectNode) { + case 0: + case 1: + switch (eMode) { + case MODE_ENCODE: + t_iJpegFd = open(JPEG_ENC_NODE, O_RDWR, 0); + break; + case MODE_DECODE: + t_iJpegFd = open(JPEG_DEC_NODE, O_RDWR, 0); + break; + default: + break; + } + break; + case 2: + switch (eMode) { + case MODE_ENCODE: + t_iJpegFd = open(JPEG2_ENC_NODE, O_RDWR, 0); + break; + case MODE_DECODE: + t_iJpegFd = open(JPEG2_DEC_NODE, O_RDWR, 0); + break; + default: + break; + } + break; + default: + break; + } + + if (t_iJpegFd < 0) { + t_iJpegFd = -1; + JPEG_ERROR_LOG("[%s]: JPEG_NODE open failed\n", __func__); + return ERROR_CANNOT_OPEN_JPEG_DEVICE; + } + + if (t_iJpegFd <= 0) { + t_iJpegFd = -1; + JPEG_ERROR_LOG("ERR(%s):JPEG device was closed\n", __func__); + return ERROR_JPEG_DEVICE_ALREADY_CLOSED; + } + + return ERROR_NONE; +} + +int ExynosJpegBase::setColorFormat(enum MODE eMode, int iV4l2ColorFormat) +{ + if (t_bFlagCreate == false) + return ERROR_JPEG_DEVICE_NOT_CREATE_YET; + + switch (eMode) { + case MODE_ENCODE: + switch(iV4l2ColorFormat) { + case V4L2_PIX_FMT_YUYV: + case V4L2_PIX_FMT_NV12: + case V4L2_PIX_FMT_NV21: + case V4L2_PIX_FMT_YUV420: + case V4L2_PIX_FMT_RGB565X: + case V4L2_PIX_FMT_RGB32: + case V4L2_PIX_FMT_BGR32: + t_iPlaneNum = 1; + t_stJpegConfig.pix.enc_fmt.in_fmt = iV4l2ColorFormat; + break; + default: + JPEG_ERROR_LOG("%s::Invalid input color format(%d) fail\n", __func__, iV4l2ColorFormat); + t_iPlaneNum = 0; + return ERROR_INVALID_COLOR_FORMAT; + } + break; + case MODE_DECODE: + switch(iV4l2ColorFormat) { + case V4L2_PIX_FMT_YUYV: + case V4L2_PIX_FMT_NV12: + case V4L2_PIX_FMT_NV21: + case V4L2_PIX_FMT_YUV420: + case V4L2_PIX_FMT_RGB565X: + case V4L2_PIX_FMT_RGB32: + case V4L2_PIX_FMT_BGR32: + t_iPlaneNum = 1; + t_stJpegConfig.pix.dec_fmt.out_fmt = iV4l2ColorFormat; + break; + default: + JPEG_ERROR_LOG("%s::Invalid input color format(%d) fail\n", __func__, iV4l2ColorFormat); + t_iPlaneNum = 0; + return ERROR_INVALID_COLOR_FORMAT; + } + break; + default: + t_iPlaneNum = 0; + return ERROR_INVALID_JPEG_MODE; + } + + int iRet = ckeckJpegSelct(eMode); + t_bFlagSelect = true; + + return iRet; +} + +int ExynosJpegBase::checkBufType(struct BUFFER *pstBuf) +{ + int ret =0; + if ((int)pstBuf->c_addr[0] != 0 && (int)pstBuf->c_addr[0] != -1) + ret = ret|JPEG_BUF_TYPE_USER_PTR; + + if (pstBuf->i_addr[0] > 0) + ret = ret|JPEG_BUF_TYPE_DMA_BUF; + + return ret; +} + +int ExynosJpegBase::getBufType(struct BUFFER *pstBuf) +{ + if (checkBufType(pstBuf) & JPEG_BUF_TYPE_DMA_BUF) + return V4L2_MEMORY_DMABUF; + else if (checkBufType(pstBuf) & JPEG_BUF_TYPE_USER_PTR) + return V4L2_MEMORY_USERPTR; + else + return 0; +} diff --git a/libhwjpeg/ExynosJpegDecoder.cpp b/libhwjpeg/ExynosJpegDecoder.cpp new file mode 100644 index 0000000000000000000000000000000000000000..c959dc882c2bec6611acfb87bde46430c70d30bd --- /dev/null +++ b/libhwjpeg/ExynosJpegDecoder.cpp @@ -0,0 +1,229 @@ +/* + * Copyright Samsung Electronics Co.,LTD. + * Copyright (C) 2013 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "ExynosJpegApi.h" + +#define JPEG_ERROR_LOG(fmt,...) ALOGE(fmt,##__VA_ARGS__) + +#define NUM_JPEG_DEC_IN_PLANES (1) +#define NUM_JPEG_DEC_OUT_PLANES (1) +#define NUM_JPEG_DEC_IN_BUFS (1) +#define NUM_JPEG_DEC_OUT_BUFS (1) + +#define MAXIMUM_JPEG_SIZE(n) ((65535 - (n)) * 32768) + +ExynosJpegDecoder::ExynosJpegDecoder() +{ + t_iJpegFd = -1; + t_bFlagCreate = false; +} + +ExynosJpegDecoder::~ExynosJpegDecoder() +{ + if (t_bFlagCreate == true) + this->destroy(); +} + +int ExynosJpegDecoder::create(void) +{ + return ExynosJpegBase::create(MODE_DECODE); +} + +int ExynosJpegDecoder::destroy(void) +{ + return ExynosJpegBase::destroy(NUM_JPEG_DEC_IN_BUFS, NUM_JPEG_DEC_OUT_BUFS); +} + +int ExynosJpegDecoder::setJpegConfig(void *pConfig) +{ + return ExynosJpegBase::setJpegConfig(MODE_DECODE, pConfig); +} + +int ExynosJpegDecoder::checkInBufType(void) +{ + return checkBufType(&t_stJpegInbuf); +} + +int ExynosJpegDecoder::checkOutBufType(void) +{ + return checkBufType(&t_stJpegOutbuf); +} + +int ExynosJpegDecoder::getInBuf(char **pcBuf, int *piInputSize) +{ + return getBuf(t_bFlagCreateInBuf, &t_stJpegInbuf, pcBuf, piInputSize, + NUM_JPEG_DEC_IN_PLANES, NUM_JPEG_DEC_IN_PLANES); +} + +int ExynosJpegDecoder::getOutBuf(char **pcBuf, int *piOutputSize, int iSize) +{ + return getBuf(t_bFlagCreateOutBuf, &t_stJpegOutbuf, pcBuf, piOutputSize, iSize, t_iPlaneNum); +} + +int ExynosJpegDecoder::setInBuf(char *pcBuf, int iSize) +{ + int iRet = ERROR_NONE; + iRet = setBuf(&t_stJpegInbuf, &pcBuf, &iSize, NUM_JPEG_DEC_IN_PLANES); + + if (iRet == ERROR_NONE) + t_bFlagCreateInBuf = true; + + return iRet; +} + +int ExynosJpegDecoder::setOutBuf(char **pcBuf, int *iSize) +{ + int iRet = ERROR_NONE; + iRet = setBuf(&t_stJpegOutbuf, pcBuf, iSize, t_iPlaneNum); + + if (iRet == ERROR_NONE) + t_bFlagCreateOutBuf = true; + + return iRet; +} + +int ExynosJpegDecoder::getInBuf(int *piBuf, int *piInputSize) +{ + return getBuf(t_bFlagCreateInBuf, &t_stJpegInbuf, piBuf, piInputSize, + NUM_JPEG_DEC_IN_PLANES, NUM_JPEG_DEC_IN_PLANES); +} + +int ExynosJpegDecoder::getOutBuf(int *piBuf, int *piOutputSize, int iSize) +{ + return getBuf(t_bFlagCreateOutBuf, &t_stJpegOutbuf, piBuf, piOutputSize, iSize, t_iPlaneNum); +} + +int ExynosJpegDecoder::setInBuf(int piBuf, int iSize) +{ + int iRet = ERROR_NONE; + iRet = setBuf(&t_stJpegInbuf, &piBuf, &iSize, NUM_JPEG_DEC_IN_PLANES); + + if (iRet == ERROR_NONE) + t_bFlagCreateInBuf = true; + + return iRet; +} + +int ExynosJpegDecoder::setOutBuf(int *piBuf, int *iSize) +{ + int iRet = ERROR_NONE; + iRet = setBuf(&t_stJpegOutbuf, piBuf, iSize, t_iPlaneNum); + + if (iRet == ERROR_NONE) + t_bFlagCreateOutBuf = true; + + return iRet; +} + +int ExynosJpegDecoder::getSize(int *piW, int *piH) +{ + if (t_bFlagCreate == false) + return ERROR_JPEG_DEVICE_NOT_CREATE_YET; + + int iRet = t_v4l2GetFmt(t_iJpegFd, V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE, &t_stJpegConfig); + if (iRet < 0) { + JPEG_ERROR_LOG("[%s,%d]: get image size failed\n", __func__, iRet); + return ERROR_GET_SIZE_FAIL; + } + + *piW = t_stJpegConfig.width; + *piH = t_stJpegConfig.height; + + return ERROR_NONE; +} + +int ExynosJpegDecoder::setColorFormat(int iV4l2ColorFormat) +{ + return ExynosJpegBase::setColorFormat(MODE_DECODE, iV4l2ColorFormat); +} + +int ExynosJpegDecoder::setJpegFormat(int iV4l2JpegFormat) +{ + return ExynosJpegBase::setJpegFormat(MODE_DECODE, iV4l2JpegFormat); +} + +int ExynosJpegDecoder::updateConfig(void) +{ + return ExynosJpegBase::updateConfig(MODE_DECODE, + NUM_JPEG_DEC_IN_BUFS, NUM_JPEG_DEC_OUT_BUFS, + NUM_JPEG_DEC_IN_PLANES, NUM_JPEG_DEC_OUT_PLANES); +} + +int ExynosJpegDecoder::setScaledSize(int iW, int iH) +{ + int mcu_x_size = 0; + + if (t_bFlagCreate == false) + return ERROR_JPEG_DEVICE_NOT_CREATE_YET; + + switch (t_stJpegConfig.pix.enc_fmt.out_fmt) { + case V4L2_PIX_FMT_JPEG_444: + case V4L2_PIX_FMT_JPEG_GRAY: + mcu_x_size = 8; + break; + case V4L2_PIX_FMT_JPEG_422: + case V4L2_PIX_FMT_JPEG_420: + mcu_x_size = 16; + break; + default: + mcu_x_size = 8; + break; + } + + if (iH < 0 || iW < 0 || (iW * iH) > MAXIMUM_JPEG_SIZE(mcu_x_size)) + return ERROR_INVALID_IMAGE_SIZE; + + t_stJpegConfig.scaled_width = iW; + t_stJpegConfig.scaled_height = iH; + + return ERROR_NONE; +} + +int ExynosJpegDecoder::setJpegSize(int iJpegSize) +{ + if (t_bFlagCreate == false) + return ERROR_JPEG_DEVICE_NOT_CREATE_YET; + + if (iJpegSize <= 0) + return ERROR_JPEG_SIZE_TOO_SMALL; + + t_stJpegConfig.sizeJpeg = iJpegSize; + + return ERROR_NONE; +} + +int ExynosJpegDecoder::decode(void) +{ + return ExynosJpegBase::execute(NUM_JPEG_DEC_OUT_PLANES, t_iPlaneNum); +} diff --git a/libhwjpeg/ExynosJpegEncoder.cpp b/libhwjpeg/ExynosJpegEncoder.cpp new file mode 100644 index 0000000000000000000000000000000000000000..0d5876f78908159f59d4db750b77c7ba2040790a --- /dev/null +++ b/libhwjpeg/ExynosJpegEncoder.cpp @@ -0,0 +1,226 @@ +/* + * Copyright Samsung Electronics Co.,LTD. + * Copyright (C) 2013 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "ExynosJpegApi.h" + +#define JPEG_ERROR_LOG(fmt,...) + +#define NUM_JPEG_ENC_IN_PLANES (1) +#define NUM_JPEG_ENC_OUT_PLANES (1) +#define NUM_JPEG_ENC_IN_BUFS (1) +#define NUM_JPEG_ENC_OUT_BUFS (1) + +ExynosJpegEncoder::ExynosJpegEncoder() +{ + t_iJpegFd = -1; + t_bFlagCreate = false; +} + +ExynosJpegEncoder::~ExynosJpegEncoder() +{ + if (t_bFlagCreate == true) + this->destroy(); +} + +int ExynosJpegEncoder::create(void) +{ + return ExynosJpegBase::create(MODE_ENCODE); +} + +int ExynosJpegEncoder::destroy(void) +{ + return ExynosJpegBase::destroy(NUM_JPEG_ENC_IN_BUFS, NUM_JPEG_ENC_OUT_BUFS); +} + +int ExynosJpegEncoder::setJpegConfig(void *pConfig) +{ + return ExynosJpegBase::setJpegConfig(MODE_ENCODE, pConfig); +} + +int ExynosJpegEncoder::checkInBufType(void) +{ + return checkBufType(&t_stJpegInbuf); +} + +int ExynosJpegEncoder::checkOutBufType(void) +{ + return checkBufType(&t_stJpegOutbuf); +} + +int ExynosJpegEncoder::getInBuf(char **pcBuf, int *piInputSize, int iSize) +{ + return getBuf(t_bFlagCreateInBuf, &t_stJpegInbuf, pcBuf, piInputSize, iSize, t_iPlaneNum); +} + +int ExynosJpegEncoder::getOutBuf(char **pcBuf, int *piOutputSize) +{ + return getBuf(t_bFlagCreateOutBuf, &t_stJpegOutbuf, pcBuf, piOutputSize, + NUM_JPEG_ENC_OUT_PLANES, NUM_JPEG_ENC_OUT_PLANES); +} + +int ExynosJpegEncoder::setInBuf(char **pcBuf, int *iSize) +{ + int iRet = ERROR_NONE; + iRet = setBuf(&t_stJpegInbuf, pcBuf, iSize, t_iPlaneNum); + + if (iRet == ERROR_NONE) + t_bFlagCreateInBuf = true; + + return iRet; +} + +int ExynosJpegEncoder::setOutBuf(char *pcBuf, int iSize) +{ + int iRet = ERROR_NONE; + iRet = setBuf(&t_stJpegOutbuf, &pcBuf, &iSize, NUM_JPEG_ENC_OUT_PLANES); + + if (iRet == ERROR_NONE) + t_bFlagCreateOutBuf = true; + + return iRet; +} + +int ExynosJpegEncoder::getInBuf(int *piBuf, int *piInputSize, int iSize) +{ + return getBuf(t_bFlagCreateInBuf, &t_stJpegInbuf, piBuf, piInputSize, iSize, t_iPlaneNum); +} + +int ExynosJpegEncoder::getOutBuf(int *piBuf, int *piOutputSize) +{ + return getBuf(t_bFlagCreateOutBuf, &t_stJpegOutbuf, piBuf, piOutputSize, + NUM_JPEG_ENC_OUT_PLANES, NUM_JPEG_ENC_OUT_PLANES); +} + +int ExynosJpegEncoder::setInBuf(int *piBuf, int *iSize) +{ + int iRet = ERROR_NONE; + iRet = setBuf(&t_stJpegInbuf, piBuf, iSize, t_iPlaneNum); + + if (iRet == ERROR_NONE) + t_bFlagCreateInBuf = true; + + return iRet; +} + +int ExynosJpegEncoder::setOutBuf(int piBuf, int iSize) +{ + int iRet = ERROR_NONE; + iRet = setBuf(&t_stJpegOutbuf, &piBuf, &iSize, NUM_JPEG_ENC_OUT_PLANES); + + if (iRet == ERROR_NONE) + t_bFlagCreateOutBuf = true; + + return iRet; +} + +int ExynosJpegEncoder::getSize(int *piW, int *piH) +{ + if (t_bFlagCreate == false) + return ERROR_JPEG_DEVICE_NOT_CREATE_YET; + + if (t_stJpegConfig.width == 0 && t_stJpegConfig.height == 0) + return ERROR_SIZE_NOT_SET_YET; + + *piW = t_stJpegConfig.width; + *piH = t_stJpegConfig.height; + + return ERROR_NONE; +} + +int ExynosJpegEncoder::getColorFormat(void) +{ + return t_stJpegConfig.pix.enc_fmt.in_fmt; +} + +int ExynosJpegEncoder::setColorFormat(int iV4l2ColorFormat) +{ + return ExynosJpegBase::setColorFormat(MODE_ENCODE, iV4l2ColorFormat); +} + +int ExynosJpegEncoder::setJpegFormat(int iV4l2JpegFormat) +{ + return ExynosJpegBase::setJpegFormat(MODE_ENCODE, iV4l2JpegFormat); +} + +int ExynosJpegEncoder::setColorBufSize(int *piBufSize, int iSize) +{ + return ExynosJpegBase::setColorBufSize(MODE_ENCODE, piBufSize, iSize); +} + +int ExynosJpegEncoder::updateConfig(void) +{ + return ExynosJpegBase::updateConfig(MODE_ENCODE, + NUM_JPEG_ENC_IN_BUFS, NUM_JPEG_ENC_OUT_BUFS, + NUM_JPEG_ENC_IN_PLANES, NUM_JPEG_ENC_OUT_PLANES); +} + +int ExynosJpegEncoder::setQuality(int iV4l2Quality) +{ + if (t_bFlagCreate == false) + return ERROR_JPEG_DEVICE_NOT_CREATE_YET; + + if (iV4l2Quality >= 96) + t_stJpegConfig.enc_qual = QUALITY_LEVEL_1; + else if (iV4l2Quality >= 92) + t_stJpegConfig.enc_qual = QUALITY_LEVEL_2; + else if (iV4l2Quality >= 38) + t_stJpegConfig.enc_qual = QUALITY_LEVEL_4; + else if (iV4l2Quality >= 30) + t_stJpegConfig.enc_qual = QUALITY_LEVEL_5; + else + t_stJpegConfig.enc_qual = QUALITY_LEVEL_6; + + return ERROR_NONE; +} + +int ExynosJpegEncoder::getJpegSize(void) +{ + if (t_bFlagCreate == false) + return 0; + + int iSize = -1; + iSize = t_stJpegConfig.sizeJpeg; + + if (iSize < 0) { + JPEG_ERROR_LOG("%s::Fail to JPEG output buffer!!\n", __func__); + return 0; + } + + return iSize; +} + +int ExynosJpegEncoder::encode(void) +{ + return ExynosJpegBase::execute(t_iPlaneNum, NUM_JPEG_ENC_OUT_PLANES); +} diff --git a/libkeymaster/Android.mk b/libkeymaster/Android.mk new file mode 100644 index 0000000000000000000000000000000000000000..60f191fa9f79b75cbdd04e18e65a39cb7c0cf194 --- /dev/null +++ b/libkeymaster/Android.mk @@ -0,0 +1,34 @@ +# Copyright (C) 2012 The Android Open Source Project +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +LOCAL_PATH := $(call my-dir) + + +include $(CLEAR_VARS) + +MOBICORE_PATH := hardware/samsung_slsi/exynos5422/mobicore + +LOCAL_MODULE := keystore.exynos5 +LOCAL_MODULE_PATH := $(TARGET_OUT_VENDOR_SHARED_LIBRARIES)/hw +LOCAL_SRC_FILES := keymaster_mobicore.cpp tlcTeeKeymaster_if.c +LOCAL_C_INCLUDES := \ + external/openssl/include \ + $(MOBICORE_PATH)/daemon/ClientLib/public \ + $(MOBICORE_PATH)/common/MobiCore/inc/ +LOCAL_C_FLAGS = -fvisibility=hidden -Wall -Werror +LOCAL_SHARED_LIBRARIES := libcrypto liblog libMcClient +LOCAL_MODULE_TAGS := optional +LOCAL_MODULE_CLASS := SHARED_LIBRARIES + +include $(BUILD_SHARED_LIBRARY) diff --git a/libkeymaster/keymaster_mobicore.cpp b/libkeymaster/keymaster_mobicore.cpp new file mode 100644 index 0000000000000000000000000000000000000000..2211760a9de8a110124e33476f3071e6399d9939 --- /dev/null +++ b/libkeymaster/keymaster_mobicore.cpp @@ -0,0 +1,482 @@ +/* + * Copyright (C) 2012 Samsung Electronics Co., LTD + * Copyright (C) 2012 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include +#include +#include + +#include +#include + +#include +#include +#include +#include +#include + +#include + +#define LOG_TAG "ExynosKeyMaster" +#include + +#include + +#define RSA_KEY_BUFFER_SIZE 1536 +#define RSA_KEY_MAX_SIZE (2048 >> 3) + +struct BIGNUM_Delete { + void operator()(BIGNUM* p) const { + BN_free(p); + } +}; +typedef UniquePtr Unique_BIGNUM; + +struct EVP_PKEY_Delete { + void operator()(EVP_PKEY* p) const { + EVP_PKEY_free(p); + } +}; +typedef UniquePtr Unique_EVP_PKEY; + +struct PKCS8_PRIV_KEY_INFO_Delete { + void operator()(PKCS8_PRIV_KEY_INFO* p) const { + PKCS8_PRIV_KEY_INFO_free(p); + } +}; +typedef UniquePtr Unique_PKCS8_PRIV_KEY_INFO; + +struct RSA_Delete { + void operator()(RSA* p) const { + RSA_free(p); + } +}; +typedef UniquePtr Unique_RSA; + +typedef UniquePtr Unique_keymaster_device_t; + +/** + * Many OpenSSL APIs take ownership of an argument on success but don't free the argument + * on failure. This means we need to tell our scoped pointers when we've transferred ownership, + * without triggering a warning by not using the result of release(). + */ +#define OWNERSHIP_TRANSFERRED(obj) \ + typeof (obj.release()) _dummy __attribute__((unused)) = obj.release() + +/* + * Checks this thread's error queue and logs if necessary. + */ +static void logOpenSSLError(const char* location) { + int error = ERR_get_error(); + + if (error != 0) { + char message[256]; + ERR_error_string_n(error, message, sizeof(message)); + ALOGE("OpenSSL error in %s %d: %s", location, error, message); + } + + ERR_clear_error(); + ERR_remove_state(0); +} + +static int exynos_km_generate_keypair(const keymaster_device_t* dev, + const keymaster_keypair_t key_type, const void* key_params, + uint8_t** keyBlob, size_t* keyBlobLength) { + teeResult_t ret = TEE_ERR_NONE; + + if (key_type != TYPE_RSA) { + ALOGE("Unsupported key type %d", key_type); + return -1; + } else if (key_params == NULL) { + ALOGE("key_params == null"); + return -1; + } + + keymaster_rsa_keygen_params_t* rsa_params = (keymaster_rsa_keygen_params_t*) key_params; + + if ((rsa_params->modulus_size != 512) && + (rsa_params->modulus_size != 1024) && + (rsa_params->modulus_size != 2048)) { + ALOGE("key size(%d) is not supported\n", rsa_params->modulus_size); + return -1; + } + + UniquePtr keyDataPtr(reinterpret_cast(malloc(RSA_KEY_BUFFER_SIZE))); + if (keyDataPtr.get() == NULL) { + ALOGE("memory allocation is failed"); + return -1; + } + + ret = TEE_RSAGenerateKeyPair(TEE_KEYPAIR_RSACRT, keyDataPtr.get(), RSA_KEY_BUFFER_SIZE, + rsa_params->modulus_size, (uint32_t)rsa_params->public_exponent, + keyBlobLength); + if (ret != TEE_ERR_NONE) { + ALOGE("TEE_RSAGenerateKeyPair() is failed: %d", ret); + return -1; + } + + *keyBlob = keyDataPtr.release(); + + return 0; +} + +static int exynos_km_import_keypair(const keymaster_device_t* dev, + const uint8_t* key, const size_t key_length, + uint8_t** key_blob, size_t* key_blob_length) { + uint8_t kbuf[RSA_KEY_BUFFER_SIZE]; + teeRsaKeyMeta_t metadata; + uint32_t key_len = 0; + teeResult_t ret = TEE_ERR_NONE; + + if (key == NULL) { + ALOGE("input key == NULL"); + return -1; + } else if (key_blob == NULL || key_blob_length == NULL) { + ALOGE("output key blob or length == NULL"); + return -1; + } + + /* decoding */ + Unique_PKCS8_PRIV_KEY_INFO pkcs8(d2i_PKCS8_PRIV_KEY_INFO(NULL, &key, key_length)); + if (pkcs8.get() == NULL) { + logOpenSSLError("pkcs4.get"); + return -1; + } + + /* assign to EVP */ + Unique_EVP_PKEY pkey(EVP_PKCS82PKEY(pkcs8.get())); + if (pkey.get() == NULL) { + logOpenSSLError("pkey.get"); + return -1; + } + OWNERSHIP_TRANSFERRED(pkcs8); + + /* change key format */ + Unique_RSA rsa(EVP_PKEY_get1_RSA(pkey.get())); + if (rsa.get() == NULL) { + logOpenSSLError("get rsa key format"); + return -1; + } + + key_len += sizeof(metadata); + + metadata.lenpubmod = BN_bn2bin(rsa->n, kbuf + key_len); + key_len += metadata.lenpubmod; + if (metadata.lenpubmod == (512 >> 3)) + metadata.keysize = TEE_RSA_KEY_SIZE_512; + else if (metadata.lenpubmod == (1024 >> 3)) + metadata.keysize = TEE_RSA_KEY_SIZE_1024; + else if (metadata.lenpubmod == (2048 >> 3)) + metadata.keysize = TEE_RSA_KEY_SIZE_2048; + else { + ALOGE("key size(%d) is not supported\n", metadata.lenpubmod << 3); + return -1; + } + + metadata.lenpubexp = BN_bn2bin(rsa->e, kbuf + key_len); + key_len += metadata.lenpubexp; + + if ((rsa->p != NULL) && (rsa->q != NULL) && (rsa->dmp1 != NULL) && + (rsa->dmq1 != NULL) && (rsa->iqmp != NULL)) + { + metadata.keytype = TEE_KEYPAIR_RSACRT; + metadata.rsacrtpriv.lenp = BN_bn2bin(rsa->p, kbuf + key_len); + key_len += metadata.rsacrtpriv.lenp; + metadata.rsacrtpriv.lenq = BN_bn2bin(rsa->q, kbuf + key_len); + key_len += metadata.rsacrtpriv.lenq; + metadata.rsacrtpriv.lendp = BN_bn2bin(rsa->dmp1, kbuf + key_len); + key_len += metadata.rsacrtpriv.lendp; + metadata.rsacrtpriv.lendq = BN_bn2bin(rsa->dmq1, kbuf + key_len); + key_len += metadata.rsacrtpriv.lendq; + metadata.rsacrtpriv.lenqinv = BN_bn2bin(rsa->iqmp, kbuf + key_len); + key_len += metadata.rsacrtpriv.lenqinv; + } else { + metadata.keytype = TEE_KEYPAIR_RSA; + metadata.rsapriv.lenpriexp = BN_bn2bin(rsa->d, kbuf + key_len); + key_len += metadata.rsapriv.lenpriexp; + } + + metadata.rfu = 0; + metadata.rfulen = 0; + + memcpy(kbuf, &metadata, sizeof(metadata)); + + UniquePtr outPtr(reinterpret_cast(malloc(RSA_KEY_BUFFER_SIZE))); + if (outPtr.get() == NULL) { + ALOGE("memory allocation is failed"); + return -1; + } + + *key_blob_length = RSA_KEY_BUFFER_SIZE; + + ret = TEE_KeyImport(kbuf, key_len, outPtr.get(), key_blob_length); + if (ret != TEE_ERR_NONE) { + ALOGE("TEE_KeyImport() is failed: %d", ret); + return -1; + } + + *key_blob = outPtr.release(); + + return 0; +} + +static int exynos_km_get_keypair_public(const struct keymaster_device* dev, + const uint8_t* key_blob, const size_t key_blob_length, + uint8_t** x509_data, size_t* x509_data_length) { + uint32_t bin_mod_len; + uint32_t bin_exp_len; + teeResult_t ret = TEE_ERR_NONE; + + if (x509_data == NULL || x509_data_length == NULL) { + ALOGE("output public key buffer == NULL"); + return -1; + } + + UniquePtr binModPtr(reinterpret_cast(malloc(RSA_KEY_MAX_SIZE))); + if (binModPtr.get() == NULL) { + ALOGE("memory allocation is failed"); + return -1; + } + + UniquePtr binExpPtr(reinterpret_cast(malloc(sizeof(uint32_t)))); + if (binExpPtr.get() == NULL) { + ALOGE("memory allocation is failed"); + return -1; + } + + bin_mod_len = RSA_KEY_MAX_SIZE; + bin_exp_len = sizeof(uint32_t); + + ret = TEE_GetPubKey(key_blob, key_blob_length, binModPtr.get(), &bin_mod_len, binExpPtr.get(), + &bin_exp_len); + if (ret != TEE_ERR_NONE) { + ALOGE("TEE_GetPubKey() is failed: %d", ret); + return -1; + } + + Unique_BIGNUM bn_mod(BN_new()); + if (bn_mod.get() == NULL) { + ALOGE("memory allocation is failed"); + return -1; + } + + Unique_BIGNUM bn_exp(BN_new()); + if (bn_exp.get() == NULL) { + ALOGE("memory allocation is failed"); + return -1; + } + + BN_bin2bn(binModPtr.get(), bin_mod_len, bn_mod.get()); + BN_bin2bn(binExpPtr.get(), bin_exp_len, bn_exp.get()); + + /* assign to RSA */ + Unique_RSA rsa(RSA_new()); + if (rsa.get() == NULL) { + logOpenSSLError("rsa.get"); + return -1; + } + + RSA* rsa_tmp = rsa.get(); + + rsa_tmp->n = bn_mod.release(); + rsa_tmp->e = bn_exp.release(); + + /* assign to EVP */ + Unique_EVP_PKEY pkey(EVP_PKEY_new()); + if (pkey.get() == NULL) { + logOpenSSLError("allocate EVP_PKEY"); + return -1; + } + + if (EVP_PKEY_assign_RSA(pkey.get(), rsa.get()) == 0) { + logOpenSSLError("assing RSA to EVP_PKEY"); + return -1; + } + OWNERSHIP_TRANSFERRED(rsa); + + /* change to x.509 format */ + int len = i2d_PUBKEY(pkey.get(), NULL); + if (len <= 0) { + logOpenSSLError("i2d_PUBKEY"); + return -1; + } + + UniquePtr key(static_cast(malloc(len))); + if (key.get() == NULL) { + ALOGE("Could not allocate memory for public key data"); + return -1; + } + + unsigned char* tmp = reinterpret_cast(key.get()); + if (i2d_PUBKEY(pkey.get(), &tmp) != len) { + logOpenSSLError("Compare results"); + return -1; + } + + *x509_data_length = len; + *x509_data = key.release(); + + return 0; +} + +static int exynos_km_sign_data(const keymaster_device_t* dev, + const void* params, + const uint8_t* keyBlob, const size_t keyBlobLength, + const uint8_t* data, const size_t dataLength, + uint8_t** signedData, size_t* signedDataLength) { + teeResult_t ret = TEE_ERR_NONE; + + if (data == NULL) { + ALOGE("input data to sign == NULL"); + return -1; + } else if (signedData == NULL || signedDataLength == NULL) { + ALOGE("output signature buffer == NULL"); + return -1; + } + + keymaster_rsa_sign_params_t* sign_params = (keymaster_rsa_sign_params_t*) params; + if (sign_params->digest_type != DIGEST_NONE) { + ALOGE("Cannot handle digest type %d", sign_params->digest_type); + return -1; + } else if (sign_params->padding_type != PADDING_NONE) { + ALOGE("Cannot handle padding type %d", sign_params->padding_type); + return -1; + } + + UniquePtr signedDataPtr(reinterpret_cast(malloc(RSA_KEY_MAX_SIZE))); + if (signedDataPtr.get() == NULL) { + ALOGE("memory allocation is failed"); + return -1; + } + + *signedDataLength = RSA_KEY_MAX_SIZE; + + /* binder gives us read-only mappings we can't use with mobicore */ + void *tmpData = malloc(dataLength); + memcpy(tmpData, data, dataLength); + ret = TEE_RSASign(keyBlob, keyBlobLength, (const uint8_t *)tmpData, dataLength, signedDataPtr.get(), + signedDataLength, TEE_RSA_NODIGEST_NOPADDING); + free(tmpData); + if (ret != TEE_ERR_NONE) { + ALOGE("TEE_RSASign() is failed: %d", ret); + return -1; + } + + *signedData = signedDataPtr.release(); + + return 0; +} + +static int exynos_km_verify_data(const keymaster_device_t* dev, + const void* params, + const uint8_t* keyBlob, const size_t keyBlobLength, + const uint8_t* signedData, const size_t signedDataLength, + const uint8_t* signature, const size_t signatureLength) { + bool result; + teeResult_t ret = TEE_ERR_NONE; + + if (signedData == NULL || signature == NULL) { + ALOGE("data or signature buffers == NULL"); + return -1; + } + + keymaster_rsa_sign_params_t* sign_params = (keymaster_rsa_sign_params_t*) params; + if (sign_params->digest_type != DIGEST_NONE) { + ALOGE("Cannot handle digest type %d", sign_params->digest_type); + return -1; + } else if (sign_params->padding_type != PADDING_NONE) { + ALOGE("Cannot handle padding type %d", sign_params->padding_type); + return -1; + } else if (signatureLength != signedDataLength) { + ALOGE("signed data length must be signature length"); + return -1; + } + + void *tmpSignedData = malloc(signedDataLength); + memcpy(tmpSignedData, signedData, signedDataLength); + void *tmpSig = malloc(signatureLength); + memcpy(tmpSig, signature, signatureLength); + ret = TEE_RSAVerify(keyBlob, keyBlobLength, (const uint8_t*)tmpSignedData, signedDataLength, (const uint8_t *)tmpSig, + signatureLength, TEE_RSA_NODIGEST_NOPADDING, &result); + free(tmpSignedData); + free(tmpSig); + if (ret != TEE_ERR_NONE) { + ALOGE("TEE_RSAVerify() is failed: %d", ret); + return -1; + } + + return (result == true) ? 0 : -1; +} + +/* Close an opened Exynos KM instance */ +static int exynos_km_close(hw_device_t *dev) { + free(dev); + return 0; +} + +/* + * Generic device handling + */ +static int exynos_km_open(const hw_module_t* module, const char* name, + hw_device_t** device) { + if (strcmp(name, KEYSTORE_KEYMASTER) != 0) + return -EINVAL; + + Unique_keymaster_device_t dev(new keymaster_device_t); + if (dev.get() == NULL) + return -ENOMEM; + + dev->common.tag = HARDWARE_DEVICE_TAG; + dev->common.version = 1; + dev->common.module = (struct hw_module_t*) module; + dev->common.close = exynos_km_close; + + dev->flags = 0; + + dev->generate_keypair = exynos_km_generate_keypair; + dev->import_keypair = exynos_km_import_keypair; + dev->get_keypair_public = exynos_km_get_keypair_public; + dev->delete_keypair = NULL; + dev->delete_all = NULL; + dev->sign_data = exynos_km_sign_data; + dev->verify_data = exynos_km_verify_data; + + ERR_load_crypto_strings(); + ERR_load_BIO_strings(); + + *device = reinterpret_cast(dev.release()); + + return 0; +} + +static struct hw_module_methods_t keystore_module_methods = { + open: exynos_km_open, +}; + +struct keystore_module HAL_MODULE_INFO_SYM +__attribute__ ((visibility ("default"))) = { + common: { + tag: HARDWARE_MODULE_TAG, + version_major: 1, + version_minor: 0, + id: KEYSTORE_HARDWARE_MODULE_ID, + name: "Keymaster Exynos HAL", + author: "Samsung S.LSI", + methods: &keystore_module_methods, + dso: 0, + reserved: {}, + }, +}; diff --git a/libkeymaster/tci.h b/libkeymaster/tci.h new file mode 100644 index 0000000000000000000000000000000000000000..3b59aa1fe186df3192fa197f3d8eb3327819e529 --- /dev/null +++ b/libkeymaster/tci.h @@ -0,0 +1,84 @@ +/* + * Copyright (c) 2013 TRUSTONIC LIMITED + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of the TRUSTONIC LIMITED nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; + * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef __TCI_H__ +#define __TCI_H__ + + +typedef uint32_t tciCommandId_t; +typedef uint32_t tciResponseId_t; +typedef uint32_t tciReturnCode_t; + + +/**< Responses have bit 31 set */ +#define RSP_ID_MASK (1U << 31) +#define RSP_ID(cmdId) (((uint32_t)(cmdId)) | RSP_ID_MASK) +#define IS_CMD(cmdId) ((((uint32_t)(cmdId)) & RSP_ID_MASK) == 0) +#define IS_RSP(cmdId) ((((uint32_t)(cmdId)) & RSP_ID_MASK) == RSP_ID_MASK) + + +/** + * Return codes + */ +#define RET_OK 0 +#define RET_ERR_UNKNOWN_CMD 1 +#define RET_ERR_NOT_SUPPORTED 2 +#define RET_ERR_INVALID_BUFFER 3 +#define RET_ERR_INVALID_KEY_SIZE 4 +#define RET_ERR_INVALID_KEY_TYPE 5 +#define RET_ERR_INVALID_LENGTH 6 +#define RET_ERR_INVALID_EXPONENT 7 +#define RET_ERR_KEY_GENERATION 8 +#define RET_ERR_SIGN 9 +#define RET_ERR_VERIFY 10 +#define RET_ERR_DIGEST 11 +#define RET_ERR_SECURE_OBJECT 12 +#define RET_ERR_INTERNAL_ERROR 13 +/* ... add more error codes when needed */ + + +/** + * TCI command header. + */ +typedef struct{ + tciCommandId_t commandId; /**< Command ID */ +} tciCommandHeader_t; + + +/** + * TCI response header. + */ +typedef struct{ + tciResponseId_t responseId; /**< Response ID (must be command ID | RSP_ID_MASK )*/ + tciReturnCode_t returnCode; /**< Return code of command */ +} tciResponseHeader_t; + +#endif // __TCI_H__ diff --git a/libkeymaster/tlTeeKeymaster_Api.h b/libkeymaster/tlTeeKeymaster_Api.h new file mode 100644 index 0000000000000000000000000000000000000000..22647996f3ea5209b32bc9f310ce40d729f5b398 --- /dev/null +++ b/libkeymaster/tlTeeKeymaster_Api.h @@ -0,0 +1,262 @@ +/* + * Copyright (c) 2013 TRUSTONIC LIMITED + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of the TRUSTONIC LIMITED nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; + * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef __TLTEEKEYMASTERAPI_H__ +#define __TLTEEKEYMASTERAPI_H__ + +#include "tci.h" + + + +/** + * Command ID's + */ +#define CMD_ID_TEE_RSA_GEN_KEY_PAIR 1 +#define CMD_ID_TEE_RSA_SIGN 2 +#define CMD_ID_TEE_RSA_VERIFY 3 +#define CMD_ID_TEE_HMAC_GEN_KEY 4 +#define CMD_ID_TEE_HMAC_SIGN 5 +#define CMD_ID_TEE_HMAC_VERIFY 6 +#define CMD_ID_TEE_KEY_IMPORT 7 +#define CMD_ID_TEE_GET_PUB_KEY 8 +/*... add more command ids when needed */ + + +/** + * Command message. + * + * @param len Length of the data to process. + * @param data Data to be processed + */ +typedef struct { + tciCommandHeader_t header; /**< Command header */ + uint32_t len; /**< Length of data to process */ +} command_t; + + +/** + * Response structure + */ +typedef struct { + tciResponseHeader_t header; /**< Response header */ + uint32_t len; +} response_t; + + +/** + * Generate key data + * Response data contains generated RSA key pair data is + * wrapped as below: + * + * |-- Key metadata --|-- Public key (plaintext) --|-- Private key (encrypted) --| + */ +typedef struct { + uint32_t type; /**< Key pair type. RSA or RSACRT */ + uint32_t keysize; /**< Key size in bits, e.g. 1024, 2048,.. */ + uint32_t exponent; /**< Exponent number */ + uint32_t keydata; /**< Key data buffer passed by TLC */ + uint32_t keydatalen; /**< Length of key data buffer */ + uint32_t solen; /**< Secure object length (of key data) (provided by the trustlet) */ +} rsagenkey_t; + + +/** + * RSA sign data structure + */ +typedef struct { + uint32_t keydata; /**< Key data buffer */ + uint32_t keydatalen; /**< Length of key data buffer */ + uint32_t plaindata; /**< Plaintext data buffer */ + uint32_t plaindatalen; /**< Length of plaintext data buffer */ + uint32_t signaturedata; /**< Signature data buffer */ + uint32_t signaturedatalen; /**< Length of signature data buffer */ + uint32_t algorithm; /**< Signing algorithm */ +} rsasign_t; + + +/** + * RSA signature verify data structure + */ +typedef struct { + uint32_t keydata; /**< Key data buffer */ + uint32_t keydatalen; /**< Length of key data buffer */ + uint32_t plaindata; /**< Plaintext data buffer */ + uint32_t plaindatalen; /**< Length of plaintext data buffer */ + uint32_t signaturedata; /**< Signature data buffer */ + uint32_t signaturedatalen; /**< Length of signature data buffer */ + uint32_t algorithm; /**< Signing algorithm */ + bool validity; /**< Signature validity */ +} rsaverify_t; + + +/** + * Generate HMAC key data + * Response data contains generated HMAC key data that is + * wrapped as below: + * + * |-- HMAC key (encrypted) --| + */ +typedef struct { + uint32_t keydata; /**< Key data buffer passed by TLC */ + uint32_t keydatalen; /**< Length of key data buffer */ + uint32_t solen; /**< Secure object length (of key data) (provided by the trustlet) */ +} hmacgenkey_t; + + +/** + * HMAC sign data structure + */ +typedef struct { + uint32_t keydata; /**< Key data buffer */ + uint32_t keydatalen; /**< Length of key data buffer */ + uint32_t plaindata; /**< Plaintext data buffer */ + uint32_t plaindatalen; /**< Length of plaintext data buffer */ + uint32_t signaturedata; /**< Signature data buffer */ + uint32_t signaturedatalen; /**< Length of signature data buffer */ + uint32_t digest; /**< Digest algorithm */ +} hmacsign_t; + + +/** + * HMAC signature verify data structure + */ +typedef struct { + uint32_t keydata; /**< Key data buffer */ + uint32_t keydatalen; /**< Length of key data buffer */ + uint32_t plaindata; /**< Plaintext data buffer */ + uint32_t plaindatalen; /**< Length of plaintext data buffer */ + uint32_t signaturedata; /**< Signature data buffer */ + uint32_t signaturedatalen; /**< Length of signature data buffer */ + uint32_t digest; /**< Digest algorithm */ + bool validity; /**< Signature validity */ +} hmacverify_t; + +/** + * RSA private key metadata (Private modulus and exponent lengths) + */ +typedef struct { + uint32_t lenprimod; /**< Private key modulus length */ + uint32_t lenpriexp; /**< Private key exponent length */ +} rsaprivkeymeta_t; + + +/** + * RSA CRT private key metadata + */ +typedef struct { + uint32_t lenprimod; /**< Private key modulus length */ + uint32_t lenp; /**< Prime p length */ + uint32_t lenq; /**< Prime q length */ + uint32_t lendp; /**< DP length */ + uint32_t lendq; /**< DQ length */ + uint32_t lenqinv; /**< QP length */ +} rsacrtprivkeymeta_t; + + +/** + * Key metadata (key size, modulus/exponent lengths, etc..) + */ +typedef struct { + uint32_t keytype; /**< RSA key pair type. RSA or RSA CRT */ + uint32_t keysize; /**< RSA key size */ + uint32_t lenpubmod; /**< Public key modulus length */ + uint32_t lenpubexp; /**< Public key exponent length */ + union { + rsaprivkeymeta_t rsapriv; /**< RSA private key */ + rsacrtprivkeymeta_t rsacrtpriv; /**< RSA CRT private key */ + }; + uint32_t rfu; /**< Reserved for future use */ + uint32_t rfulen; /**< Reserved for future use */ +} rsakeymeta_t; + +/** + * Key import data structure + */ +typedef struct { + uint32_t keydata; /**< Key data buffer */ + uint32_t keydatalen; /**< Length of key data buffer */ + uint32_t sodata; /**< Wrapped buffer */ + uint32_t sodatalen; /**< Length of wrapped data buffer */ +} keyimport_t; + + +/** + * Get public key data structure + */ +typedef struct { + uint32_t type; /**< Key type */ + uint32_t keydata; /**< Key data buffer */ + uint32_t keydatalen; /**< Length of key data buffer */ + uint32_t modulus; /**< Modulus */ + uint32_t moduluslen; /**< Modulus length */ + uint32_t exponent; /**< Exponent */ + uint32_t exponentlen; /**< Exponent length */ +} getpubkey_t; + + +/** + * TCI message data. + */ +typedef struct { + union { + command_t command; + response_t response; + }; + + union { + rsagenkey_t rsagenkey; + rsasign_t rsasign; + rsaverify_t rsaverify; + hmacgenkey_t hmacgenkey; + hmacsign_t hmacsign; + hmacverify_t hmacverify; + keyimport_t keyimport; + getpubkey_t getpubkey; + }; + +} tciMessage_t, *tciMessage_ptr; + + +/** + * Overall TCI structure. + */ +typedef struct { + tciMessage_t message; /**< TCI message */ +} tci_t; + + +/** + * Trustlet UUID + */ +#define TEE_KEYMASTER_TL_UUID { { 7, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } } + + +#endif // __TLTEEKEYMASTERAPI_H__ diff --git a/libkeymaster/tlTeeKeymaster_log.h b/libkeymaster/tlTeeKeymaster_log.h new file mode 100644 index 0000000000000000000000000000000000000000..6665f960cff5b272eb25c1ccc1f365cef54ee759 --- /dev/null +++ b/libkeymaster/tlTeeKeymaster_log.h @@ -0,0 +1,48 @@ +/* + * Copyright (c) 2013 TRUSTONIC LIMITED + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of the TRUSTONIC LIMITED nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; + * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef __TLTEEKEYMASTERLOG_H__ +#define __TLTEEKEYMASTERLOG_H__ + +#include + +#ifndef LOG_TAG +#define LOG_TAG "TlcTeeKeyMaster" +#endif // LOG_TAG + +/* Macro definitions */ +#define LOG_D(...) __android_log_print(ANDROID_LOG_DEBUG , LOG_TAG, __VA_ARGS__) +#define LOG_I(...) __android_log_print(ANDROID_LOG_INFO , LOG_TAG, __VA_ARGS__) +#define LOG_W(...) __android_log_print(ANDROID_LOG_WARN , LOG_TAG, __VA_ARGS__) +#define LOG_E(...) __android_log_print(ANDROID_LOG_ERROR , LOG_TAG, __VA_ARGS__) + + +#endif // __TLTEEKEYMASTERLOG_H__ diff --git a/libkeymaster/tlcTeeKeymaster_if.c b/libkeymaster/tlcTeeKeymaster_if.c new file mode 100644 index 0000000000000000000000000000000000000000..8654ea977a29856210f70530464d284ee75c495b --- /dev/null +++ b/libkeymaster/tlcTeeKeymaster_if.c @@ -0,0 +1,1073 @@ +/* + * Copyright (c) 2013 TRUSTONIC LIMITED + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of the TRUSTONIC LIMITED nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; + * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include + +#include "MobiCoreDriverApi.h" +#include "tlTeeKeymaster_Api.h" +#include "tlTeeKeymaster_log.h" +#include "tlcTeeKeymaster_if.h" + + +/* Global definitions */ +static const uint32_t gDeviceId = MC_DEVICE_ID_DEFAULT; +static const mcUuid_t gUuid = TEE_KEYMASTER_TL_UUID; + +/** + * TEE_Open + * + * Open session to the TEE Keymaster trustlet + * + * @param pSessionHandle [out] Return pointer to the session handle + */ +static tciMessage_ptr TEE_Open( + mcSessionHandle_t *pSessionHandle +){ + tciMessage_ptr pTci = NULL; + mcResult_t mcRet; + + do + { + + /* Validate session handle */ + if (!pSessionHandle) + { + LOG_E("TEE_Open(): Invalid session handle\n"); + break; + } + + /* Initialize session handle data */ + memset(pSessionHandle, 0, sizeof(mcSessionHandle_t)); + + /* Open MobiCore device */ + mcRet = mcOpenDevice(gDeviceId); + if (MC_DRV_OK != mcRet) + { + LOG_E("TEE_Open(): mcOpenDevice returned: %d\n", mcRet); + break; + } + + /* Allocating WSM for TCI */ + mcRet = mcMallocWsm(gDeviceId, 0, sizeof(tciMessage_t), (uint8_t **) &pTci, 0); + if (MC_DRV_OK != mcRet) + { + LOG_E("TEE_Open(): mcMallocWsm returned: %d\n", mcRet); + break; + } + + /* Open session the TEE Keymaster trustlet */ + pSessionHandle->deviceId = gDeviceId; + mcRet = mcOpenSession(pSessionHandle, + &gUuid, + (uint8_t *) pTci, + (uint32_t) sizeof(tciMessage_t)); + if (MC_DRV_OK != mcRet) + { + LOG_E("TEE_Open(): mcOpenSession returned: %d\n", mcRet); + break; + } + + } while (false); + + return pTci; +} + + +/** + * TEE_Close + * + * Close session to the TEE Keymaster trustlet + * + * @param sessionHandle [in] Session handle + */ +static void TEE_Close( + mcSessionHandle_t *pSessionHandle +){ + teeResult_t ret = TEE_ERR_NONE; + mcResult_t mcRet; + + do { + + /* Validate session handle */ + if (!pSessionHandle) + { + LOG_E("TEE_Close(): Invalid session handle\n"); + break; + } + + /* Close session */ + mcRet = mcCloseSession(pSessionHandle); + if (MC_DRV_OK != mcRet) + { + LOG_E("TEE_Close(): mcCloseSession returned: %d\n", mcRet); + ret = TEE_ERR_SESSION; + break; + } + + /* Close MobiCore device */ + mcRet = mcCloseDevice(gDeviceId); + if (MC_DRV_OK != mcRet) + { + LOG_E("TEE_Close(): mcCloseDevice returned: %d\n", mcRet); + ret = TEE_ERR_MC_DEVICE; + } + + } while (false); +} + + +/** + * TEE_RSAGenerateKeyPair + * + * Generates RSA key pair and returns key pair data as wrapped object + * + * @param keyType [in] Key pair type. RSA or RSACRT + * @param keyData [in] Pointer to the key data buffer + * @param keyDataLength [in] Key data buffer length + * @param keySize [in] Key size + * @param exponent [in] Exponent number + * @param soLen [out] Key data secure object length + */ +teeResult_t TEE_RSAGenerateKeyPair( + teeRsaKeyPairType_t keyType, + uint8_t* keyData, + uint32_t keyDataLength, + uint32_t keySize, + uint32_t exponent, + uint32_t* soLen +){ + teeResult_t ret = TEE_ERR_NONE; + tciMessage_ptr pTci = NULL; + mcSessionHandle_t sessionHandle; + mcBulkMap_t mapInfo; + mcResult_t mcRet; + + do { + + /* Open session to the trustlet */ + pTci = TEE_Open(&sessionHandle); + if (!pTci) { + ret = TEE_ERR_MEMORY; + break; + } + + /* Map memory to the secure world */ + mcRet = mcMap(&sessionHandle, keyData, keyDataLength, &mapInfo); + if (MC_DRV_OK != mcRet) { + ret = TEE_ERR_MAP; + break; + } + + /* Update TCI buffer */ + pTci->command.header.commandId = CMD_ID_TEE_RSA_GEN_KEY_PAIR; + pTci->rsagenkey.type = keyType; + pTci->rsagenkey.keysize = keySize; + pTci->rsagenkey.keydata = (uint32_t)mapInfo.sVirtualAddr; + pTci->rsagenkey.keydatalen = keyDataLength; + pTci->rsagenkey.exponent = exponent; + + /* Notify the trustlet */ + mcRet = mcNotify(&sessionHandle); + if (MC_DRV_OK != mcRet) + { + ret = TEE_ERR_NOTIFICATION; + break; + } + + /* Wait for response from the trustlet */ + if (MC_DRV_OK != mcWaitNotification(&sessionHandle, MC_INFINITE_TIMEOUT)) + { + ret = TEE_ERR_NOTIFICATION; + break; + } + + /* Unmap memory */ + mcRet = mcUnmap(&sessionHandle, keyData, &mapInfo); + if (MC_DRV_OK != mcRet) + { + ret = TEE_ERR_MAP; + break; + } + + if (RET_OK != pTci->response.header.returnCode) + { + LOG_E("TEE_RSAGenerateKeyPair(): TEE Keymaster trustlet returned: 0x%.8x\n", + pTci->response.header.returnCode); + ret = TEE_ERR_FAIL; + break; + } + + /* Update secure object length */ + *soLen = pTci->rsagenkey.solen; + + } while (false); + + /* Close session to the trustlet */ + TEE_Close(&sessionHandle); + + return ret; +} + + +/** + * TEE_RSASign + * + * Signs given plain data and returns signature data + * + * @param keyData [in] Pointer to key data buffer + * @param keyDataLength [in] Key data buffer length + * @param plainData [in] Pointer to plain data to be signed + * @param plainDataLength [in] Plain data length + * @param signatureData [out] Pointer to signature data + * @param signatureDataLength [out] Signature data length + * @param algorithm [in] RSA signature algorithm + */ +teeResult_t TEE_RSASign( + const uint8_t* keyData, + const uint32_t keyDataLength, + const uint8_t* plainData, + const uint32_t plainDataLength, + uint8_t* signatureData, + uint32_t* signatureDataLength, + teeRsaSigAlg_t algorithm +){ + teeResult_t ret = TEE_ERR_NONE; + tciMessage_ptr pTci = NULL; + mcSessionHandle_t sessionHandle; + mcBulkMap_t keyMapInfo; + mcBulkMap_t plainMapInfo; + mcBulkMap_t signatureMapInfo; + mcResult_t mcRet; + + do { + + /* Open session to the trustlet */ + pTci = TEE_Open(&sessionHandle); + if (!pTci) { + ret = TEE_ERR_MEMORY; + break; + } + + /* Map memory to the secure world */ + mcRet = mcMap(&sessionHandle, (void*)keyData, keyDataLength, &keyMapInfo); + if (MC_DRV_OK != mcRet) { + ret = TEE_ERR_MAP; + break; + } + + mcRet = mcMap(&sessionHandle, (void*)plainData, plainDataLength, &plainMapInfo); + if (MC_DRV_OK != mcRet) { + ret = TEE_ERR_MAP; + break; + } + + mcRet = mcMap(&sessionHandle, (void*)signatureData, *signatureDataLength, &signatureMapInfo); + if (MC_DRV_OK != mcRet) { + ret = TEE_ERR_MAP; + break; + } + + /* Update TCI buffer */ + pTci->command.header.commandId = CMD_ID_TEE_RSA_SIGN; + pTci->rsasign.keydata = (uint32_t)keyMapInfo.sVirtualAddr; + pTci->rsasign.keydatalen = keyDataLength; + + pTci->rsasign.plaindata = (uint32_t)plainMapInfo.sVirtualAddr; + pTci->rsasign.plaindatalen = plainDataLength; + + pTci->rsasign.signaturedata = (uint32_t)signatureMapInfo.sVirtualAddr; + pTci->rsasign.signaturedatalen = *signatureDataLength; + + pTci->rsasign.algorithm = algorithm; + + /* Notify the trustlet */ + mcRet = mcNotify(&sessionHandle); + if (MC_DRV_OK != mcRet) + { + ret = TEE_ERR_NOTIFICATION; + break; + } + + /* Wait for response from the trustlet */ + if (MC_DRV_OK != mcWaitNotification(&sessionHandle, MC_INFINITE_TIMEOUT)) + { + ret = TEE_ERR_NOTIFICATION; + break; + } + + /* Unmap memory */ + mcRet = mcUnmap(&sessionHandle, (void*)keyData, &keyMapInfo); + if (MC_DRV_OK != mcRet) + { + ret = TEE_ERR_MAP; + break; + } + + mcRet = mcUnmap(&sessionHandle, (void*)plainData, &plainMapInfo); + if (MC_DRV_OK != mcRet) + { + ret = TEE_ERR_MAP; + break; + } + + mcRet = mcUnmap(&sessionHandle, (void*)signatureData, &signatureMapInfo); + if (MC_DRV_OK != mcRet) + { + ret = TEE_ERR_MAP; + break; + } + + if (RET_OK != pTci->response.header.returnCode) + { + LOG_E("TEE_RSASign(): TEE Keymaster trustlet returned: 0x%.8x\n", + pTci->response.header.returnCode); + ret = TEE_ERR_FAIL; + break; + } + + /* Retrieve signature data length */ + *signatureDataLength = pTci->rsasign.signaturedatalen; + + } while (false); + + /* Close session to the trustlet */ + TEE_Close(&sessionHandle); + + return ret; +} + + +/** + * TEE_RSAVerify + * + * Verifies given data with RSA public key and return status + * + * @param keyData [in] Pointer to key data buffer + * @param keyDataLength [in] Key data buffer length + * @param plainData [in] Pointer to plain data to be signed + * @param plainDataLength [in] Plain data length + * @param signatureData [in] Pointer to signed data + * @param signatureData [in] Plain data length + * @param algorithm [in] RSA signature algorithm + * @param validity [out] Signature validity + */ +teeResult_t TEE_RSAVerify( + const uint8_t* keyData, + const uint32_t keyDataLength, + const uint8_t* plainData, + const uint32_t plainDataLength, + const uint8_t* signatureData, + const uint32_t signatureDataLength, + teeRsaSigAlg_t algorithm, + bool *validity +){ + teeResult_t ret = TEE_ERR_NONE; + tciMessage_ptr pTci = NULL; + mcSessionHandle_t sessionHandle; + mcBulkMap_t keyMapInfo; + mcBulkMap_t plainMapInfo; + mcBulkMap_t signatureMapInfo; + mcResult_t mcRet; + + do { + + /* Open session to the trustlet */ + pTci = TEE_Open(&sessionHandle); + if (!pTci) { + ret = TEE_ERR_MEMORY; + break; + } + + /* Map memory to the secure world */ + mcRet = mcMap(&sessionHandle, (void*)keyData, keyDataLength, &keyMapInfo); + if (MC_DRV_OK != mcRet) { + ret = TEE_ERR_MAP; + break; + } + + mcRet = mcMap(&sessionHandle, (void*)plainData, plainDataLength, &plainMapInfo); + if (MC_DRV_OK != mcRet) { + ret = TEE_ERR_MAP; + break; + } + + mcRet = mcMap(&sessionHandle, (void*)signatureData, signatureDataLength, &signatureMapInfo); + if (MC_DRV_OK != mcRet) { + ret = TEE_ERR_MAP; + break; + } + + /* Update TCI buffer */ + pTci->command.header.commandId = CMD_ID_TEE_RSA_VERIFY; + pTci->rsaverify.keydata = (uint32_t)keyMapInfo.sVirtualAddr; + pTci->rsaverify.keydatalen = keyDataLength; + + pTci->rsaverify.plaindata = (uint32_t)plainMapInfo.sVirtualAddr; + pTci->rsaverify.plaindatalen = plainDataLength; + + pTci->rsaverify.signaturedata = (uint32_t)signatureMapInfo.sVirtualAddr; + pTci->rsaverify.signaturedatalen = signatureDataLength; + + pTci->rsaverify.algorithm = algorithm; + pTci->rsaverify.validity = false; + + /* Notify the trustlet */ + mcRet = mcNotify(&sessionHandle); + if (MC_DRV_OK != mcRet) + { + ret = TEE_ERR_NOTIFICATION; + break; + } + + /* Wait for response from the trustlet */ + if (MC_DRV_OK != mcWaitNotification(&sessionHandle, MC_INFINITE_TIMEOUT)) + { + ret = TEE_ERR_NOTIFICATION; + break; + } + + /* Unmap memory */ + mcRet = mcUnmap(&sessionHandle, (void*)keyData, &keyMapInfo); + if (MC_DRV_OK != mcRet) + { + ret = TEE_ERR_MAP; + break; + } + + mcRet = mcUnmap(&sessionHandle, (void*)plainData, &plainMapInfo); + if (MC_DRV_OK != mcRet) + { + ret = TEE_ERR_MAP; + break; + } + + mcRet = mcUnmap(&sessionHandle, (void*)signatureData, &signatureMapInfo); + if (MC_DRV_OK != mcRet) + { + ret = TEE_ERR_MAP; + break; + } + + if (RET_OK != pTci->response.header.returnCode) + { + LOG_E("TEE_RSAVerify(): TEE Keymaster trustlet returned: 0x%.8x\n", + pTci->response.header.returnCode); + ret = TEE_ERR_FAIL; + break; + } + + *validity = pTci->rsaverify.validity; + + } while (false); + + /* Close session to the trustlet */ + TEE_Close(&sessionHandle); + + return ret; +} + + +/** + * TEE_HMACKeyGenerate + * + * Generates random key for HMAC calculation and returns key data as wrapped object + * (key is encrypted) + * + * @param keyData [out] Pointer to key data + * @param keyDataLength [in] Key data buffer length + * @param soLen [out] Key data secure object length + */ +teeResult_t TEE_HMACKeyGenerate( + uint8_t* keyData, + uint32_t keyDataLength, + uint32_t* soLen +){ + teeResult_t ret = TEE_ERR_NONE; + tciMessage_ptr pTci = NULL; + mcSessionHandle_t sessionHandle; + mcBulkMap_t keyMapInfo; + mcResult_t mcRet; + + do { + + /* Open session to the trustlet */ + pTci = TEE_Open(&sessionHandle); + if (!pTci) { + ret = TEE_ERR_MEMORY; + break; + } + + /* Map memory to the secure world */ + mcRet = mcMap(&sessionHandle, (void*)keyData, keyDataLength, &keyMapInfo); + if (MC_DRV_OK != mcRet) { + ret = TEE_ERR_MAP; + break; + } + + /* Update TCI buffer */ + pTci->command.header.commandId = CMD_ID_TEE_HMAC_GEN_KEY; + pTci->hmacgenkey.keydata = (uint32_t)keyMapInfo.sVirtualAddr; + pTci->hmacgenkey.keydatalen = keyDataLength; + + /* Notify the trustlet */ + mcRet = mcNotify(&sessionHandle); + if (MC_DRV_OK != mcRet) + { + ret = TEE_ERR_NOTIFICATION; + break; + } + + /* Wait for response from the trustlet */ + if (MC_DRV_OK != mcWaitNotification(&sessionHandle, MC_INFINITE_TIMEOUT)) + { + ret = TEE_ERR_NOTIFICATION; + break; + } + + /* Unmap memory */ + mcRet = mcUnmap(&sessionHandle, (void*)keyData, &keyMapInfo); + if (MC_DRV_OK != mcRet) + { + ret = TEE_ERR_MAP; + break; + } + + if (RET_OK != pTci->response.header.returnCode) + { + LOG_E("TEE_RSAVerify(): TEE Keymaster trustlet returned: 0x%.8x\n", + pTci->response.header.returnCode); + ret = TEE_ERR_FAIL; + } + + /* Update secure object length */ + *soLen = pTci->hmacgenkey.solen; + + }while (false); + + /* Close session to the trustlet */ + TEE_Close(&sessionHandle); + + return ret; +} + +/** + * TEE_HMACSign + * + * Signs given plain data and returns HMAC signature data + * + * @param keyData [in] Pointer to key data buffer + * @param keyDataLength [in] Key data buffer length + * @param plainData [in] Pointer to plain data to be signed + * @param plainDataLength [in] Plain data length + * @param signatureData [out] Pointer to signature data + * @param signatureDataLength [out] Signature data length + * @param digest [in] Digest type + */ +teeResult_t TEE_HMACSign( + const uint8_t* keyData, + const uint32_t keyDataLength, + const uint8_t* plainData, + const uint32_t plainDataLength, + uint8_t* signatureData, + uint32_t* signatureDataLength, + teeDigest_t digest +){ + teeResult_t ret = TEE_ERR_NONE; + tciMessage_ptr pTci = NULL; + mcSessionHandle_t sessionHandle; + mcBulkMap_t keyMapInfo; + mcBulkMap_t plainMapInfo; + mcBulkMap_t signatureMapInfo; + mcResult_t mcRet; + + do { + + /* Open session to the trustlet */ + pTci = TEE_Open(&sessionHandle); + if (!pTci) { + ret = TEE_ERR_MEMORY; + break; + } + + /* Map memory to the secure world */ + mcRet = mcMap(&sessionHandle, (void*)keyData, keyDataLength, &keyMapInfo); + if (MC_DRV_OK != mcRet) { + ret = TEE_ERR_MAP; + break; + } + + mcRet = mcMap(&sessionHandle, (void*)plainData, plainDataLength, &plainMapInfo); + if (MC_DRV_OK != mcRet) { + ret = TEE_ERR_MAP; + break; + } + + mcRet = mcMap(&sessionHandle, (void*)signatureData, *signatureDataLength, &signatureMapInfo); + if (MC_DRV_OK != mcRet) { + ret = TEE_ERR_MAP; + break; + } + + /* Update TCI buffer */ + pTci->command.header.commandId = CMD_ID_TEE_HMAC_SIGN; + pTci->hmacsign.keydata = (uint32_t)keyMapInfo.sVirtualAddr; + pTci->hmacsign.keydatalen = keyDataLength; + + pTci->hmacsign.plaindata = (uint32_t)plainMapInfo.sVirtualAddr; + pTci->hmacsign.plaindatalen = plainDataLength; + + pTci->hmacsign.signaturedata = (uint32_t)signatureMapInfo.sVirtualAddr; + pTci->hmacsign.signaturedatalen = *signatureDataLength; + + pTci->hmacsign.digest = digest; + + /* Notify the trustlet */ + mcRet = mcNotify(&sessionHandle); + if (MC_DRV_OK != mcRet) + { + ret = TEE_ERR_NOTIFICATION; + break; + } + + /* Wait for response from the trustlet */ + if (MC_DRV_OK != mcWaitNotification(&sessionHandle, MC_INFINITE_TIMEOUT)) + { + ret = TEE_ERR_NOTIFICATION; + break; + } + + /* Unmap memory */ + mcRet = mcUnmap(&sessionHandle, (void*)keyData, &keyMapInfo); + if (MC_DRV_OK != mcRet) + { + ret = TEE_ERR_MAP; + break; + } + + mcRet = mcUnmap(&sessionHandle, (void*)plainData, &plainMapInfo); + if (MC_DRV_OK != mcRet) + { + ret = TEE_ERR_MAP; + break; + } + + mcRet = mcUnmap(&sessionHandle, (void*)signatureData, &signatureMapInfo); + if (MC_DRV_OK != mcRet) + { + ret = TEE_ERR_MAP; + break; + } + + if (RET_OK != pTci->response.header.returnCode) + { + LOG_E("TEE_HMACSign(): TEE Keymaster trustlet returned: 0x%.8x\n", + pTci->response.header.returnCode); + ret = TEE_ERR_FAIL; + break; + } + + /* Retrieve signature data length */ + *signatureDataLength = pTci->hmacsign.signaturedatalen; + + } while (false); + + /* Close session to the trustlet */ + TEE_Close(&sessionHandle); + + return ret; +} + + +/** + * TEE_HMACVerify + * + * Verifies given data HMAC key data and return status + * + * @param plainData [in] Pointer to plain data to be signed + * @param plainDataLength [in] Plain data length + * @param signatureData [in] Pointer to signed data + * @param signatureData [in] Plain data length + * @param digest [in] Digest type + * @param validity [out] Signature validity + */ +teeResult_t TEE_HMACVerify( + const uint8_t* keyData, + const uint32_t keyDataLength, + const uint8_t* plainData, + const uint32_t plainDataLength, + const uint8_t* signatureData, + const uint32_t signatureDataLength, + teeDigest_t digest, + bool *validity +){ + teeResult_t ret = TEE_ERR_NONE; + tciMessage_ptr pTci = NULL; + mcSessionHandle_t sessionHandle; + mcBulkMap_t keyMapInfo; + mcBulkMap_t plainMapInfo; + mcBulkMap_t signatureMapInfo; + mcResult_t mcRet; + + do { + + /* Open session to the trustlet */ + pTci = TEE_Open(&sessionHandle); + if (!pTci) { + ret = TEE_ERR_MEMORY; + break; + } + + /* Map memory to the secure world */ + mcRet = mcMap(&sessionHandle, (void*)keyData, keyDataLength, &keyMapInfo); + if (MC_DRV_OK != mcRet) { + ret = TEE_ERR_MAP; + break; + } + + mcRet = mcMap(&sessionHandle, (void*)plainData, plainDataLength, &plainMapInfo); + if (MC_DRV_OK != mcRet) { + ret = TEE_ERR_MAP; + break; + } + + mcRet = mcMap(&sessionHandle, (void*)signatureData, signatureDataLength, &signatureMapInfo); + if (MC_DRV_OK != mcRet) { + ret = TEE_ERR_MAP; + break; + } + + /* Update TCI buffer */ + pTci->command.header.commandId = CMD_ID_TEE_HMAC_VERIFY; + pTci->hmacverify.keydata = (uint32_t)keyMapInfo.sVirtualAddr; + pTci->hmacverify.keydatalen = keyDataLength; + + pTci->hmacverify.plaindata = (uint32_t)plainMapInfo.sVirtualAddr; + pTci->hmacverify.plaindatalen = plainDataLength; + + pTci->hmacverify.signaturedata = (uint32_t)signatureMapInfo.sVirtualAddr; + pTci->hmacverify.signaturedatalen = signatureDataLength; + + pTci->hmacverify.digest = digest; + pTci->hmacverify.validity = false; + + /* Notify the trustlet */ + mcRet = mcNotify(&sessionHandle); + if (MC_DRV_OK != mcRet) + { + ret = TEE_ERR_NOTIFICATION; + break; + } + + /* Wait for response from the trustlet */ + if (MC_DRV_OK != mcWaitNotification(&sessionHandle, MC_INFINITE_TIMEOUT)) + { + ret = TEE_ERR_NOTIFICATION; + break; + } + + /* Unmap memory */ + mcRet = mcUnmap(&sessionHandle, (void*)keyData, &keyMapInfo); + if (MC_DRV_OK != mcRet) + { + ret = TEE_ERR_MAP; + break; + } + + mcRet = mcUnmap(&sessionHandle, (void*)plainData, &plainMapInfo); + if (MC_DRV_OK != mcRet) + { + ret = TEE_ERR_MAP; + break; + } + + mcRet = mcUnmap(&sessionHandle, (void*)signatureData, &signatureMapInfo); + if (MC_DRV_OK != mcRet) + { + ret = TEE_ERR_MAP; + break; + } + + if (RET_OK != pTci->response.header.returnCode) + { + LOG_E("TEE_HMACVerify(): TEE Keymaster trustlet returned: 0x%.8x\n", + pTci->response.header.returnCode); + ret = TEE_ERR_FAIL; + break; + } + + *validity = pTci->hmacverify.validity; + + } while (false); + + /* Close session to the trustlet */ + TEE_Close(&sessionHandle); + + return ret; +} + + +/** + * TEE_KeyImport + * + * Imports key data and returns key data as secure object + * + * Key data needs to be in the following format + * + * RSA key data: + * |--key metadata--|--public modulus--|--public exponent--|--private exponent--| + * + * RSA CRT key data: + * |--key metadata--|--public modulus--|--public exponent--|--P--|--Q--|--DP--|--DQ--|--Qinv--| + * + * Where: + * P: secret prime factor + * Q: secret prime factor + * DP: d mod (p-1) + * DQ: d mod (q-1) + * Qinv: q^-1 mod p + * + * @param keyData [in] Pointer to key data + * @param keyDataLength [in] Key data length + * @param soData [out] Pointer to wrapped key data + * @param soDataLength [out] Wrapped key data length + */ +teeResult_t TEE_KeyImport( + const uint8_t* keyData, + const uint32_t keyDataLength, + uint8_t* soData, + uint32_t* soDataLength +){ + teeResult_t ret = TEE_ERR_NONE; + tciMessage_ptr pTci = NULL; + mcSessionHandle_t sessionHandle; + mcBulkMap_t keyMapInfo; + mcBulkMap_t soMapInfo; + mcResult_t mcRet; + + do { + + /* Open session to the trustlet */ + pTci = TEE_Open(&sessionHandle); + if (!pTci) { + ret = TEE_ERR_MEMORY; + break; + } + + /* Map memory to the secure world */ + mcRet = mcMap(&sessionHandle, (void*)keyData, keyDataLength, &keyMapInfo); + if (MC_DRV_OK != mcRet) { + ret = TEE_ERR_MAP; + break; + } + + mcRet = mcMap(&sessionHandle, (void*)soData, *soDataLength, &soMapInfo); + if (MC_DRV_OK != mcRet) { + ret = TEE_ERR_MAP; + break; + } + + /* Update TCI buffer */ + pTci->command.header.commandId = CMD_ID_TEE_KEY_IMPORT; + pTci->keyimport.keydata = (uint32_t)keyMapInfo.sVirtualAddr; + pTci->keyimport.keydatalen = keyDataLength; + pTci->keyimport.sodata = (uint32_t)soMapInfo.sVirtualAddr; + pTci->keyimport.sodatalen = *soDataLength; + + /* Notify the trustlet */ + mcRet = mcNotify(&sessionHandle); + if (MC_DRV_OK != mcRet) + { + ret = TEE_ERR_NOTIFICATION; + break; + } + + /* Wait for response from the trustlet */ + if (MC_DRV_OK != mcWaitNotification(&sessionHandle, MC_INFINITE_TIMEOUT)) + { + ret = TEE_ERR_NOTIFICATION; + break; + } + + /* Unmap memory */ + mcRet = mcUnmap(&sessionHandle, (void*)keyData, &keyMapInfo); + if (MC_DRV_OK != mcRet) + { + ret = TEE_ERR_MAP; + break; + } + + mcRet = mcUnmap(&sessionHandle, (void*)soData, &soMapInfo); + if (MC_DRV_OK != mcRet) + { + ret = TEE_ERR_MAP; + break; + } + + if (RET_OK != pTci->response.header.returnCode) + { + LOG_E("TEE_KeyWrap(): TEE Keymaster trustlet returned: 0x%.8x\n", + pTci->response.header.returnCode); + ret = TEE_ERR_FAIL; + break; + } + + /* Update secure object length */ + *soDataLength = pTci->keyimport.sodatalen; + + } while (false); + + /* Close session to the trustlet */ + TEE_Close(&sessionHandle); + + return ret; +} + + +/** * TEE_GetPubKey + * + * Retrieves public key daya (modulus and exponent) from wrapped key data + * + * @param keyData [in] Pointer to key data + * @param keyDataLength [in] Key data length + * @param modulus [out] Pointer to public key modulus data + * @param modulusLength [out] Modulus data length + * @param exponent [out] Pointer to public key exponent data + * @param exponentLength [out] Exponent data length + */ +teeResult_t TEE_GetPubKey( + const uint8_t* keyData, + const uint32_t keyDataLength, + uint8_t* modulus, + uint32_t* modulusLength, + uint8_t* exponent, + uint32_t* exponentLength +){ + teeResult_t ret = TEE_ERR_NONE; + tciMessage_ptr pTci = NULL; + mcSessionHandle_t sessionHandle; + mcBulkMap_t keyMapInfo; + mcBulkMap_t modMapInfo; + mcBulkMap_t expMapInfo; + mcResult_t mcRet; + + do { + + /* Open session to the trustlet */ + pTci = TEE_Open(&sessionHandle); + if (!pTci) { + ret = TEE_ERR_MEMORY; + break; + } + + /* Map memory to the secure world */ + mcRet = mcMap(&sessionHandle, (void*)keyData, keyDataLength, &keyMapInfo); + if (MC_DRV_OK != mcRet) { + ret = TEE_ERR_MAP; + break; + } + + mcRet = mcMap(&sessionHandle, (void*)modulus, *modulusLength, &modMapInfo); + if (MC_DRV_OK != mcRet) { + ret = TEE_ERR_MAP; + break; + } + + mcRet = mcMap(&sessionHandle, (void*)exponent, *exponentLength, &expMapInfo); + if (MC_DRV_OK != mcRet) { + ret = TEE_ERR_MAP; + break; + } + + /* Update TCI buffer */ + pTci->command.header.commandId = CMD_ID_TEE_GET_PUB_KEY; + pTci->getpubkey.keydata = (uint32_t)keyMapInfo.sVirtualAddr; + pTci->getpubkey.keydatalen = keyDataLength; + pTci->getpubkey.modulus = (uint32_t)modMapInfo.sVirtualAddr; + pTci->getpubkey.moduluslen = *modulusLength; + pTci->getpubkey.exponent = (uint32_t)expMapInfo.sVirtualAddr; + pTci->getpubkey.exponentlen = *exponentLength; + + /* Notify the trustlet */ + mcRet = mcNotify(&sessionHandle); + if (MC_DRV_OK != mcRet) + { + ret = TEE_ERR_NOTIFICATION; + break; + } + + /* Wait for response from the trustlet */ + if (MC_DRV_OK != mcWaitNotification(&sessionHandle, MC_INFINITE_TIMEOUT)) + { + ret = TEE_ERR_NOTIFICATION; + break; + } + + /* Unmap memory */ + mcRet = mcUnmap(&sessionHandle, (void*)keyData, &keyMapInfo); + if (MC_DRV_OK != mcRet) + { + ret = TEE_ERR_MAP; + break; + } + + mcRet = mcUnmap(&sessionHandle, (void*)modulus, &modMapInfo); + if (MC_DRV_OK != mcRet) + { + ret = TEE_ERR_MAP; + break; + } + + mcRet = mcUnmap(&sessionHandle, (void*)exponent, &expMapInfo); + if (MC_DRV_OK != mcRet) + { + ret = TEE_ERR_MAP; + break; + } + + if (RET_OK != pTci->response.header.returnCode) + { + LOG_E("TEE_GetPubKey(): TEE Keymaster trustlet returned: 0x%.8x\n", + pTci->response.header.returnCode); + ret = TEE_ERR_FAIL; + break; + } + + /* Update modulus and exponent lengths */ + *modulusLength = pTci->getpubkey.moduluslen; + *exponentLength = pTci->getpubkey.exponentlen; + + } while (false); + + /* Close session to the trustlet */ + TEE_Close(&sessionHandle); + + return ret; +} diff --git a/libkeymaster/tlcTeeKeymaster_if.h b/libkeymaster/tlcTeeKeymaster_if.h new file mode 100644 index 0000000000000000000000000000000000000000..13f20f153b8322ca886c1fb0a6e4b87924e8d88e --- /dev/null +++ b/libkeymaster/tlcTeeKeymaster_if.h @@ -0,0 +1,324 @@ +/* + * Copyright (c) 2013 TRUSTONIC LIMITED + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of the TRUSTONIC LIMITED nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; + * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef __TLCTEEKEYMASTERIF_H__ +#define __TLCTEEKEYMASTERIF_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include + + +/** + * Key sizes + */ +#define TEE_RSA_KEY_SIZE_512 512 +#define TEE_RSA_KEY_SIZE_1024 1024 +#define TEE_RSA_KEY_SIZE_2048 2048 + + +/* error codes */ +typedef enum +{ + TEE_ERR_NONE = 0, + TEE_ERR_FAIL = 1, + TEE_ERR_INVALID_BUFFER = 2, + TEE_ERR_BUFFER_TOO_SMALL = 3, + TEE_ERR_NOT_IMPLEMENTED = 4, + TEE_ERR_SESSION = 5, + TEE_ERR_MC_DEVICE = 6, + TEE_ERR_NOTIFICATION = 7, + TEE_ERR_MEMORY = 8, + TEE_ERR_MAP = 9 + /* more can be added as required */ +} teeResult_t; + + +/* RSA key pair types */ +typedef enum { + TEE_KEYPAIR_RSA = 1, /**< RSA public and RSA private key. */ + TEE_KEYPAIR_RSACRT = 2 /**< RSA public and RSA CRT private key. */ +} teeRsaKeyPairType_t; + + +/* Supported RSA signature algorithms */ +typedef enum +{ + /* RSA */ + TEE_RSA_SHA_ISO9796 = 1, /**< 20-byte SHA-1 digest, padded according to the ISO 9796-2 scheme as specified in EMV '96 and EMV 2000, encrypted using RSA. */ + TEE_RSA_SHA_ISO9796_MR = 2, /**< 20-byte SHA-1 digest, padded according to the ISO9796-2 specification and encrypted using RSA. */ + TEE_RSA_SHA_PKCS1 = 3, /**< 20-byte SHA-1 digest, padded according to the PKCS#1 (v1.5) scheme, and encrypted using RSA. */ + TEE_RSA_SHA256_PSS = 4, /**< SHA-256 digest and PSS padding */ + TEE_RSA_SHA1_PSS = 5, /**< SHA-256 digest and PSS padding */ + TEE_RSA_NODIGEST_NOPADDING = 6, /**< No digest and padding */ +} teeRsaSigAlg_t; + + +/* Digest types */ +typedef enum +{ + TEE_DIGEST_SHA1, + TEE_DIGEST_SHA256 +} teeDigest_t; + + +/** + * RSA private key metadata (Private modulus and exponent lengths) + */ +typedef struct { + uint32_t lenprimod; /**< Private key modulus length */ + uint32_t lenpriexp; /**< Private key exponent length */ +} teeRsaPrivKeyMeta_t; + + +/** + * RSA CRT private key metadata (Private modulus and exponent lengths) + */ +typedef struct { + uint32_t lenprimod; /**< Private key modulus length */ + uint32_t lenp; /**< Prime p length */ + uint32_t lenq; /**< Prime q length */ + uint32_t lendp; /**< DP length */ + uint32_t lendq; /**< DQ length */ + uint32_t lenqinv; /**< QP length */ +} teeRsaCrtPrivKeyMeta_t; + + +/** + * Key metadata (public key hash, key size, modulus/exponent lengths, etc..) + */ +typedef struct { + uint32_t keytype; /**< Key type, e.g. RSA */ + uint32_t keysize; /**< Key size, e.g. 1024, 2048 */ + uint32_t lenpubmod; /**< Public key modulus length */ + uint32_t lenpubexp; /**< Public key exponent length */ + union { + teeRsaPrivKeyMeta_t rsapriv; /**< RSA private key */ + teeRsaCrtPrivKeyMeta_t rsacrtpriv; /**< RSA CRT private key */ + }; + uint32_t rfu; /**< Reserved for future use */ + uint32_t rfulen; /**< Reserved for future use */ +} teeRsaKeyMeta_t; + +/** + * TEE_RSAGenerateKeyPair + * + * Generates RSA key pair and returns key pair data as wrapped object + * + * @param keyType [in] Key pair type. RSA or RSACRT + * @param keyData [in] Pointer to the key data buffer + * @param keyDataLength [in] Key data buffer length + * @param keySize [in] Key size + * @param exponent [in] Exponent number + * @param soLen [out] Key data secure object length + */ +teeResult_t TEE_RSAGenerateKeyPair( + teeRsaKeyPairType_t keyType, + uint8_t* keyData, + uint32_t keyDataLength, + uint32_t keySize, + uint32_t exponent, + uint32_t* soLen); + + +/** + * TEE_RSASign + * + * Signs given plain data and returns signature data + * + * @param keyData [in] Pointer to key data buffer + * @param keyDataLength [in] Key data buffer length + * @param plainData [in] Pointer to plain data to be signed + * @param plainDataLength [in] Plain data length + * @param signatureData [out] Pointer to signature data + * @param signatureDataLength [out] Signature data length + * @param algorithm [in] RSA signature algorithm + */ +teeResult_t TEE_RSASign( + const uint8_t* keyData, + const uint32_t keyDataLength, + const uint8_t* plainData, + const uint32_t plainDataLength, + uint8_t* signatureData, + uint32_t* signatureDataLength, + teeRsaSigAlg_t algorithm); + + +/** + * TEE_RSAVerify + * + * Verifies given data with RSA public key and return status + * + * @param keyData [in] Pointer to key data buffer + * @param keyDataLength [in] Key data buffer length + * @param plainData [in] Pointer to plain data to be signed + * @param plainDataLength [in] Plain data length + * @param signatureData [in] Pointer to signed data + * @param signatureData [in] Plain data length + * @param algorithm [in] RSA signature algorithm + * @param validity [out] Signature validity + */ +teeResult_t TEE_RSAVerify( + const uint8_t* keyData, + const uint32_t keyDataLength, + const uint8_t* plainData, + const uint32_t plainDataLength, + const uint8_t* signatureData, + const uint32_t signatureDataLength, + teeRsaSigAlg_t algorithm, + bool *validity); + + +/** + * TEE_HMACKeyGenerate + * + * Generates random key for HMAC calculation and returns key data as wrapped object + * (key is encrypted) + * + * @param keyData [out] Pointer to key data + * @param keyDataLength [in] Key data buffer length + * @param soLen [out] Key data secure object length + */ +teeResult_t TEE_HMACKeyGenerate( + uint8_t* keyData, + uint32_t keyDataLength, + uint32_t* soLen); + + +/** + * TEE_HMACSign + * + * Signs given plain data and returns HMAC signature data + * + * @param keyData [in] Pointer to key data buffer + * @param keyDataLength [in] Key data buffer length + * @param plainData [in] Pointer to plain data to be signed + * @param plainDataLength [in] Plain data length + * @param signatureData [out] Pointer to signature data + * @param signatureDataLength [out] Signature data length + * @param digest [in] Digest type + */ +teeResult_t TEE_HMACSign( + const uint8_t* keyData, + const uint32_t keyDataLength, + const uint8_t* plainData, + const uint32_t plainDataLength, + uint8_t* signatureData, + uint32_t* signatureDataLength, + teeDigest_t digest); + + +/** + * TEE_HMACVerify + * + * Verifies given data HMAC key data and return status + * + * @param keyData [in] Pointer to key data buffer + * @param keyDataLength [in] Key data buffer length + * @param plainData [in] Pointer to plain data to be signed + * @param plainDataLength [in] Plain data length + * @param signatureData [in] Pointer to signed data + * @param signatureData [in] Plain data length + * @param digest [in] Digest type + * @param validity [out] Signature validity + */ +teeResult_t TEE_HMACVerify( + const uint8_t* keyData, + const uint32_t keyDataLength, + const uint8_t* plainData, + const uint32_t plainDataLength, + const uint8_t* signatureData, + const uint32_t signatureDataLength, + teeDigest_t digest, + bool *validity); + + +/** + * TEE_KeyImport + * + * Imports key data and returns key data as secure object + * + * Key data needs to be in the following format + * + * RSA key data: + * |--key metadata--|--public modulus--|--public exponent--|--private exponent--| + * + * RSA CRT key data: + * |--key metadata--|--public modulus--|--public exponent--|--P--|--Q--|--DP--|--DQ--|--Qinv--| + * + * Where: + * P: secret prime factor + * Q: secret prime factor + * DP: d mod (p-1) + * DQ: d mod (q-1) + * Qinv: q^-1 mod p + * + * @param keyData [in] Pointer to key data + * @param keyDataLength [in] Key data length + * @param soData [out] Pointer to wrapped key data + * @param soDataLength [out] Wrapped key data length + */ +teeResult_t TEE_KeyImport( + const uint8_t* keyData, + const uint32_t keyDataLength, + uint8_t* soData, + uint32_t* soDataLength); + + +/** + * TEE_GetPubKey + * + * Retrieves public key daya (modulus and exponent) from wrapped key data + * + * @param keyData [in] Pointer to key data + * @param keyDataLength [in] Key data length + * @param modulus [out] Pointer to public key modulus data + * @param modulusLength [out] Modulus data length + * @param exponent [out] Pointer to public key exponent data + * @param exponentLength [out] Exponent data length + */ +teeResult_t TEE_GetPubKey( + const uint8_t* keyData, + const uint32_t keyDataLength, + uint8_t* modulus, + uint32_t* modulusLength, + uint8_t* exponent, + uint32_t* exponentLength); + + +#ifdef __cplusplus +} +#endif + +#endif // __TLCTEEKEYMASTERIF_H__ diff --git a/libsecurepath/Android.mk b/libsecurepath/Android.mk new file mode 100644 index 0000000000000000000000000000000000000000..9abd4c81dddd7d374dafdb6c489b72f2a685dc17 --- /dev/null +++ b/libsecurepath/Android.mk @@ -0,0 +1,40 @@ +# +# +# Copyright (C) 2009 The Android Open Source Project +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +LOCAL_PATH := $(call my-dir) + + +############################################################################### +# libcsecurepath.a +include $(CLEAR_VARS) +LOCAL_MODULE := libsecurepath +BUILD_DATE := \"`date '+%Y.%m.%d'`\" +LOCAL_CPPFLAGS := -Wall -D_BUILD_DATE=$(BUILD_DATE) +LOCAL_SRC_FILES += \ + tlc_communication.cpp \ + content_protect.cpp \ + sec_g2ddrm.cpp + +LOCAL_C_INCLUDES += \ + $(LOCAL_PATH)/../../exynos5/include \ + $(TOP)/hardware/samsung_slsi/exynos/include + +LOCAL_SHARED_LIBRARIES += libMcClient + +include hardware/samsung_slsi/$(TARGET_SOC)/mobicore/common/LogWrapper/Android.mk + +include $(BUILD_STATIC_LIBRARY) diff --git a/libsecurepath/content_protect.cpp b/libsecurepath/content_protect.cpp new file mode 100644 index 0000000000000000000000000000000000000000..3999506b645b5a3eb627fcf6f289600beae7b686 --- /dev/null +++ b/libsecurepath/content_protect.cpp @@ -0,0 +1,145 @@ +/* + * Copyright (C) 2012 Samsung Electronics Co., LTD + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include +#include +#include +#include + +#include "tlsecdrm_api.h" +#define LOG_TAG "drm_content_protect" +#include "log.h" +#include "tlc_communication.h" +#include "content_protect.h" + +mc_comm_ctx cp_ctx; + +struct protect_info { + uint32_t dev; + uint32_t enable; +}; + +#define SMEM_PATH "/dev/s5p-smem" + +#define SECMEM_IOC_SET_TZPC _IOWR('S', 11, struct protect_info) + +#define PROTECT_DEV_MFC0 0 +#define PROTECT_DEV_MFC1 1 +#define PROTECT_DEV_HEVC 2 +#define PROTECT_DEV_GSC0 3 +#define PROTECT_DEV_GSC1 4 +#define PROTECT_DEV_GSC2 5 + +extern "C" cpResult_t CP_Enable_Path_Protection(uint32_t protect_ip) +{ + cpResult_t cp_result = CP_SUCCESS; + struct protect_info prot; + int fd_secmem, ret; + + LOG_I("[CONTENT_PROTECT] : CP_Enable_Path_Protection"); + + fd_secmem = open(SMEM_PATH, O_RDWR); + if (fd_secmem < 0) { + LOG_E("s5p-smem open error!!"); + return CP_ERROR_ENABLE_PATH_PROTECTION_FAILED; + } + + switch (protect_ip) { + case CP_PROTECT_MFC: + prot.dev = PROTECT_DEV_MFC0; + break; + case CP_PROTECT_MFC1: + prot.dev = PROTECT_DEV_MFC1; + break; + case CP_PROTECT_GSC0: + prot.dev = PROTECT_DEV_GSC0; + break; + case CP_PROTECT_GSC1: + prot.dev = PROTECT_DEV_GSC1; + break; + case CP_PROTECT_GSC2: + prot.dev = PROTECT_DEV_GSC2; + break; + default: + prot.dev = -1; + LOG_E("Fail to protect Content path due to wrong ID (%d)", protect_ip); + close(fd_secmem); + return CP_ERROR_ENABLE_PATH_PROTECTION_FAILED; + } + + prot.enable = 1; + ret = ioctl(fd_secmem, SECMEM_IOC_SET_TZPC, &prot); + if (ret != 0) { + LOG_E("Fail to get SECMEM SET TZPC:SET TZPC ret(%d)", ret); + close(fd_secmem); + return CP_ERROR_ENABLE_PATH_PROTECTION_FAILED; + } + close(fd_secmem); + + LOG_I("[CONTENT_PROTECT] : CP_Enable_Path_Protection. return value(%d)", cp_result); + return cp_result; +} + +extern "C" cpResult_t CP_Disable_Path_Protection(uint32_t protect_ip) +{ + cpResult_t cp_result = CP_SUCCESS; + struct protect_info prot; + int fd_secmem, ret; + + LOG_I("[CONTENT_PROTECT] : CP_Disable_Path_Protection"); + + fd_secmem = open(SMEM_PATH, O_RDWR); + if (fd_secmem < 0) { + LOG_E("s5p-smem open error!!"); + return CP_ERROR_DISABLE_PATH_PROTECTION_FAILED; + } + + switch (protect_ip) { + case CP_PROTECT_MFC: + prot.dev = PROTECT_DEV_MFC0; + break; + case CP_PROTECT_MFC1: + prot.dev = PROTECT_DEV_MFC1; + break; + case CP_PROTECT_GSC0: + prot.dev = PROTECT_DEV_GSC0; + break; + case CP_PROTECT_GSC1: + prot.dev = PROTECT_DEV_GSC1; + break; + case CP_PROTECT_GSC2: + prot.dev = PROTECT_DEV_GSC2; + break; + default: + prot.dev = -1; + LOG_E("Fail to protect Content path due to wrong ID (%d)", protect_ip); + close(fd_secmem); + return CP_ERROR_ENABLE_PATH_PROTECTION_FAILED; + } + + prot.enable = 0; + ret = ioctl(fd_secmem, SECMEM_IOC_SET_TZPC, &prot); + if (ret != 0) { + LOG_E("Fail to get SECMEM SET TZPC:SET TZPC ret(%d)", ret); + close(fd_secmem); + return CP_ERROR_DISABLE_PATH_PROTECTION_FAILED; + } + close(fd_secmem); + + LOG_I("[CONTENT_PROTECT] : CP_Disable_Path_Protection. return value(%d)", cp_result); + return cp_result; +} + diff --git a/libsecurepath/sec_g2ddrm.cpp b/libsecurepath/sec_g2ddrm.cpp new file mode 100644 index 0000000000000000000000000000000000000000..47a99458d50dfcfc212c7e549e487fb58ff60e0a --- /dev/null +++ b/libsecurepath/sec_g2ddrm.cpp @@ -0,0 +1,330 @@ +/* + * Copyright (C) 2012 Samsung Electronics Co., LTD + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include +#include +#include +#include +#include +#include +#include + +#include "tlsecdrm_api.h" +#define LOG_TAG "sec_g2ddrm" +#include "log.h" +#include "tlc_communication.h" +#include "sec_g2ddrm.h" + +#define SMEM_PATH "/dev/s5p-smem" +#define SECMEM_IOC_GET_FD_PHYS_ADDR _IOWR('S', 8, struct secfd_info) +#define ion_phys_addr_t unsigned long + +struct secfd_info { + int fd; + ion_phys_addr_t phys; +}; + +mc_comm_ctx ctx; +int g_fd_secmem; + +static mcResult_t tlc_initialize(void) { + mcResult_t mcRet; + + memset(&ctx, 0x00, sizeof(ctx)); + ctx.device_id = MC_DEVICE_ID_DEFAULT; + ctx.uuid = (mcUuid_t)TL_SECDRM_UUID; + ctx.initialized = false; + + mcRet = tlc_open(&ctx); + if (MC_DRV_OK != mcRet) { + LOG_E("open TL session failed!"); + return mcRet; + } + + ctx.initialized = true; + + return MC_DRV_OK; +} + +static mcResult_t tlc_terminate(void) { + mcResult_t mcRet; + + if (ctx.initialized == true) { + mcRet = tlc_close(&ctx); + if (MC_DRV_OK != mcRet) { + LOG_E("close TL session failed!"); + return mcRet; + } + + memset(&ctx, 0x00, sizeof(ctx)); + ctx.initialized = false; + } + + return MC_DRV_OK; +} + +int get_fd_phyaddr_from_kernel(struct secfd_info *secfd) +{ + int ret; + + ret = ioctl(g_fd_secmem, SECMEM_IOC_GET_FD_PHYS_ADDR, secfd); + if (ret != 0) { + LOG_E("Fail to get SECFD info: ret(%s)", strerror(errno)); + return -1; + } + + LOG_I("___ION_FD_KERNEL::fd(%d), phyaddr(0x%x)", secfd->fd, secfd->phys); + return 0; +} + +g2ddrmResult_t sec_g2d_activate(enum driver_act act) +{ + int m_g2dFd; + + m_g2dFd = open(SEC_G2D_DEV_NAME, O_RDWR); + if (m_g2dFd < 0) { + LOG_E("%s::open(%s) fail(%s)\n", __func__, SEC_G2D_DEV_NAME, strerror(errno)); + return G2DDRM_ERROR_INIT_FAILED; + } + + enum driver_act g2d_act = act; + if (ioctl(m_g2dFd, FIMG2D_BITBLT_ACTIVATE, &g2d_act) < 0) { + LOG_E("%s::ioctl(%s) %d fail(%s)\n", __func__, SEC_G2D_DEV_NAME, act, strerror(errno)); + close(m_g2dFd); + return G2DDRM_ERROR_INIT_FAILED; + } + close(m_g2dFd); + LOG_I("G2D %s is completed", act==DRV_DEACT? "DEACT":"ACT"); + + return G2DDRM_SUCCESS; +} + +extern "C" g2ddrmResult_t G2DDRM_Initialize(void) +{ + mcResult_t mcRet; + g2ddrmResult_t ret = G2DDRM_SUCCESS; + struct tciMessage_t *tci = NULL; + + LOG_I("G2DDRM_Initialize(): secure G2D driver initialization"); + do { + if (sec_g2d_activate(DRV_DEACT) != 0) { + ret = G2DDRM_ERROR_INIT_FAILED; + break; + } + + LOG_I("Open the Trustlet"); + + g_fd_secmem = open(SMEM_PATH, O_RDWR); + if (g_fd_secmem < 0) { + LOG_E("open S5P-MEM device error"); + ret = G2DDRM_ERROR_INIT_FAILED; + break; + } + + mcRet = tlc_initialize(); + if (MC_DRV_OK != mcRet) { + LOG_E("Tlc Open Error"); + ret = G2DDRM_ERROR_INIT_FAILED; + close(g_fd_secmem); + break; + } + + LOG_I("Check TCI buffer"); + tci = ctx.tci_msg; + if (NULL == tci) { + LOG_E("TCI has not been set up properly - exiting"); + ret = G2DDRM_ERROR_INIT_FAILED; + close(g_fd_secmem); + break; + } + + LOG_I("Prepare command message in TCI"); + tci->cmd.id = CMD_G2DDRM_INITIALIZE; + mcRet = tlc_communicate(&ctx); + if (MC_DRV_OK != mcRet) { + LOG_E("tlc_communicate Error!"); + ret = G2DDRM_ERROR_INIT_FAILED; + close(g_fd_secmem); + break; + } + + if ((RSP_ID(CMD_G2DDRM_INITIALIZE) != tci->resp.id)) { + LOG_E("Trustlet did not send a response : %d", tci->resp.id); + ret = G2DDRM_ERROR_INIT_FAILED; + close(g_fd_secmem); + break; + } + LOG_I("Trustlet response is completed"); + + if (tci->resp.return_code != RET_TL_G2DDRM_OK) { + LOG_E("Trustlet did not send a valid return code : %d", tci->resp.return_code); + ret = G2DDRM_ERROR_INIT_FAILED; + close(g_fd_secmem); + break; + } + LOG_I("Check the Trustlet return code is completed"); + + ret = G2DDRM_SUCCESS; + } while (false); + + LOG_I("G2DDRM_Initialize(): secure G2D driver is initialized. ret(%d)", ret); + return ret; +} + +extern "C" g2ddrmResult_t G2DDRM_Blit(struct fimg2d_blit_raw *cmd) +{ + mcResult_t mcRet; + g2ddrmResult_t ret = G2DDRM_SUCCESS; + mcBulkMap_t mapInfo; + struct tciMessage_t *tci = NULL; + struct secfd_info secfd; + + mapInfo.sVirtualAddr = NULL; + + do { + secfd.fd = cmd->src.addr.start; + if (get_fd_phyaddr_from_kernel(&secfd) < 0) { + LOG_E("fail to get src phyaddr from fd(%d)", secfd.fd); + ret = G2DDRM_ERROR_BLIT_FAILED; + break; + } + cmd->src.addr.start = secfd.phys; + + secfd.fd = cmd->dst.addr.start; + if (get_fd_phyaddr_from_kernel(&secfd) < 0) { + LOG_E("fail to get dst phyaddr from fd(%d)", secfd.fd); + ret = G2DDRM_ERROR_BLIT_FAILED; + break; + } + cmd->dst.addr.start = secfd.phys; + + secfd.fd = cmd->dst.plane2.start; + if (get_fd_phyaddr_from_kernel(&secfd) < 0) { + LOG_E("fail to get plane2 phyaddr from fd(%d)", secfd.fd); + ret = G2DDRM_ERROR_BLIT_FAILED; + break; + } + cmd->dst.plane2.start = secfd.phys; + + LOG_I("Check TCI buffer"); + tci = ctx.tci_msg; + if (NULL == tci) { + LOG_E("TCI has not been set up properly - exiting"); + ret = G2DDRM_ERROR_BLIT_FAILED; + close(g_fd_secmem); + break; + } + LOG_I("Prepare command message in TCI"); + + tci->cmd.id = CMD_G2DDRM_BLIT; + tci->blit.op = cmd->op; + tci->blit.param = cmd->param; + tci->blit.src = cmd->src; + tci->blit.dst = cmd->dst; + tci->blit.msk = cmd->msk; + tci->blit.tmp = cmd->tmp; + tci->blit.sync = cmd->sync; + tci->blit.seq_no = cmd->seq_no; + + mcRet = tlc_communicate(&ctx); + if (MC_DRV_OK != mcRet) { + LOG_E("tlc_communicate Error!"); + ret = G2DDRM_ERROR_BLIT_FAILED; + break; + } + + if ((RSP_ID(CMD_G2DDRM_BLIT) != tci->resp.id)) { + LOG_E("Trustlet did not send a response : %d", tci->resp.id); + ret = G2DDRM_ERROR_BLIT_FAILED; + break; + } + LOG_I("Trustlet response is completed"); + + if (tci->resp.return_code != RET_TL_G2DDRM_OK) { + LOG_E("Trustlet did not send a valid return code : %d", tci->resp.return_code); + ret = G2DDRM_ERROR_BLIT_FAILED; + break; + } + LOG_I("Check the Trustlet return code is completed"); + + ret = G2DDRM_SUCCESS; + } while (false); + + LOG_I("G2DDRM_Blit(): secure G2D driver blit is done. ret(%d)", ret); + return ret; +} + +extern "C" g2ddrmResult_t G2DDRM_Terminate(void) +{ + mcResult_t mcRet; + g2ddrmResult_t ret = G2DDRM_SUCCESS; + struct tciMessage_t *tci = NULL; + + LOG_I("G2DDRM_Terminate(): secure G2D driver termination"); + do { + LOG_I("Check TCI buffer"); + + tci = ctx.tci_msg; + if (NULL == tci) { + LOG_E("TCI has not been set up properly - exiting"); + ret = G2DDRM_ERROR_EXIT_FAILED; + close(g_fd_secmem); + break; + } + LOG_I("Prepare command message in TCI"); + tci->cmd.id = CMD_G2DDRM_TERMINATE; + + mcRet = tlc_communicate(&ctx); + if (MC_DRV_OK != mcRet) { + LOG_E("tlc_communicate Error!"); + ret = G2DDRM_ERROR_EXIT_FAILED; + break; + } + + if ((RSP_ID(CMD_G2DDRM_TERMINATE) != tci->resp.id)) { + LOG_E("Trustlet did not send a response : %d", tci->resp.id); + ret = G2DDRM_ERROR_EXIT_FAILED; + break; + } + LOG_I("Trustlet response is completed"); + + if (tci->resp.return_code != RET_TL_G2DDRM_OK) { + LOG_E("Trustlet did not send a valid return code : %d", tci->resp.return_code); + ret = G2DDRM_ERROR_EXIT_FAILED; + break; + } + + mcRet = tlc_terminate(); + if (MC_DRV_OK != mcRet) { + LOG_E("Tlc Close Error"); + ret = G2DDRM_ERROR_EXIT_FAILED; + break; + } + + LOG_I("Check the Trustlet return code is completed"); + + close(g_fd_secmem); + if (sec_g2d_activate(DRV_ACT) != 0) { + ret = G2DDRM_ERROR_EXIT_FAILED; + break; + } + + ret = G2DDRM_SUCCESS; + } while (false); + + LOG_I("G2DDRM_Terminate(): secure G2D driver is terminated. ret(%d)", ret); + return ret; +} diff --git a/libsecurepath/tci.h b/libsecurepath/tci.h new file mode 100644 index 0000000000000000000000000000000000000000..0365eb387b33cc0dac7cba9ade6fd7312600982a --- /dev/null +++ b/libsecurepath/tci.h @@ -0,0 +1,55 @@ +/* + * Copyright (C) 2012 Samsung Electronics Co., LTD + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + +#ifndef TCI_H_ +#define TCI_H_ + +typedef uint32_t tciCommandId_t; +typedef uint32_t tciResponseId_t; +typedef uint32_t tciReturnCode_t; + +/**< Responses have bit 31 set */ +#define RSP_ID_MASK (1U << 31) +#define RSP_ID(cmdId) (((uint32_t)(cmdId)) | RSP_ID_MASK) +#define IS_CMD(cmdId) ((((uint32_t)(cmdId)) & RSP_ID_MASK) == 0) +#define IS_RSP(cmdId) ((((uint32_t)(cmdId)) & RSP_ID_MASK) == RSP_ID_MASK) + +/** + * Return codes of Trustlet commands. + */ +#define RET_OK 0 /**< Set, if processing is error free */ +#define RET_ERR_UNKNOWN_CMD 1 /**< Unknown command */ +#define RET_CUSTOM_START 2 +#define RET_ERR_MAP 3 +#define RET_ERR_UNMAP 4 + +/** + * TCI command header. + */ +typedef struct { + tciCommandId_t commandId; /**< Command ID */ +} tciCommandHeader_t; + +/** + * TCI response header. + */ +typedef struct { + tciResponseId_t responseId; /**< Response ID (must be command ID | RSP_ID_MASK )*/ + tciReturnCode_t returnCode; /**< Return code of command */ +} tciResponseHeader_t; + +#endif // TCI_H_ diff --git a/libsecurepath/tlc_communication.cpp b/libsecurepath/tlc_communication.cpp new file mode 100644 index 0000000000000000000000000000000000000000..1f6636afa0f0737d89cc96a32f3621d568ee2b40 --- /dev/null +++ b/libsecurepath/tlc_communication.cpp @@ -0,0 +1,131 @@ +/* + * Copyright (C) 2012 Samsung Electronics Co., LTD + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include + +#include "tlc_communication.h" + +#define LOG_TAG "tlc_communication" +#include "log.h" + +mcResult_t tlc_open(mc_comm_ctx *comm_ctx) { + mcResult_t mcRet; + + LOG_I("open() called"); + do { + // ------------------------------------------------------------- + // Step 1: Open the MobiCore device + LOG_I("Opening MobiCore device"); + mcRet = mcOpenDevice(comm_ctx->device_id); + if (MC_DRV_OK != mcRet) + LOG_I("mcOpenDevice result: %d", mcRet); + + + // ------------------------------------------------------------- + // Step 2: Allocate WSM buffer for the TCI + LOG_I("Allocating WSM for TCI"); + mcRet = mcMallocWsm(comm_ctx->device_id, 0, sizeof(tciMessage_t), (uint8_t **)&(comm_ctx->tci_msg), 0); + if (MC_DRV_OK != mcRet) { + LOG_E("Allocation of TCI WSM failed: %d", mcRet); + break; + } + + // ------------------------------------------------------------- + // Step 3: Open session with the Trustlet + LOG_I("Opening the session"); + bzero(&(comm_ctx->handle), sizeof(mcSessionHandle_t)); // Clear the session handle + + comm_ctx->handle.deviceId = comm_ctx->device_id; // The device ID (default device is used) + + mcRet = mcOpenSession(&(comm_ctx->handle), &(comm_ctx->uuid), (uint8_t *)(comm_ctx->tci_msg), + (uint32_t) sizeof(tciMessage_t)); + if (MC_DRV_OK != mcRet) { + LOG_E("Open session failed: %d", mcRet); + break; + } + + LOG_I("tlc_open() succeeded"); + } while (false); + + return mcRet; +} + +mcResult_t tlc_close(mc_comm_ctx *comm_ctx) { + mcResult_t mcRet; + + LOG_I("close() called"); + do { + + // ------------------------------------------------------------- + // Step 1: Free WSM + LOG_I("Free WSM"); + mcRet = mcFreeWsm((comm_ctx->device_id), (uint8_t *)(comm_ctx->tci_msg)); + if (MC_DRV_OK != mcRet) { + LOG_E("Free WSM failed: %d", mcRet); + break; + } + + // ------------------------------------------------------------- + // Step 2: Close session with the Trustlet + LOG_I("Closing the session"); + mcRet = mcCloseSession(&(comm_ctx->handle)); + if (MC_DRV_OK != mcRet) { + LOG_E("Closing session failed: %d", mcRet); + break; + } + + // ------------------------------------------------------------- + // Step 3: Close the MobiCore device + LOG_I("Closing MobiCore device"); + mcRet = mcCloseDevice(comm_ctx->device_id); + if (MC_DRV_OK != mcRet) { + LOG_E("Closing MobiCore device failed: %d", mcRet); + break; + } + + LOG_I("tlc_close() succeeded"); + } while (false); + + return mcRet; +} + +mcResult_t tlc_communicate(mc_comm_ctx *comm_ctx) { + mcResult_t mcRet; + + do { + // ------------------------------------------------------------- + // Step 1: signal the Trustlet + mcRet = mcNotify(&(comm_ctx->handle)); + if (MC_DRV_OK != mcRet) { + LOG_E("Notify failed: %d", mcRet); + break; + } + LOG_I("mcNotify is completed\n"); + + // ------------------------------------------------------------- + // Step 2: Wait for the Trustlet response + mcRet = mcWaitNotification(&(comm_ctx->handle), -1); + if (MC_DRV_OK != mcRet) { + LOG_E("Wait for response notification failed: %d", mcRet); + break; + } + + LOG_I("mcWaitNotification is completed"); + + } while (false); + + return mcRet; +} diff --git a/libsecurepath/tlc_communication.h b/libsecurepath/tlc_communication.h new file mode 100644 index 0000000000000000000000000000000000000000..be401a38c6a6a9ff35cc36c7de7dd49de1f01ba7 --- /dev/null +++ b/libsecurepath/tlc_communication.h @@ -0,0 +1,35 @@ +/* + * Copyright (C) 2012 Samsung Electronics Co., LTD + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef TLC_COMMUNICATION_H_ +#define TLC_COMMUNICATION_H_ + +#include "MobiCoreDriverApi.h" +#include "tlsecdrm_api.h" + +typedef struct { + uint32_t device_id; + mcUuid_t uuid; + mcSessionHandle_t handle; + tciMessage_t *tci_msg; + bool initialized; +} mc_comm_ctx; + +mcResult_t tlc_open(mc_comm_ctx *comm_ctx); +mcResult_t tlc_close(mc_comm_ctx *comm_ctx); +mcResult_t tlc_communicate(mc_comm_ctx *comm_ctx); + +#endif diff --git a/libsecurepath/tlsecdrm_api.h b/libsecurepath/tlsecdrm_api.h new file mode 100644 index 0000000000000000000000000000000000000000..ec09ccb0b4c80ddc24c0601daa311929a903ff58 --- /dev/null +++ b/libsecurepath/tlsecdrm_api.h @@ -0,0 +1,115 @@ +/* + * Copyright (C) 2012 Samsung Electronics Co., LTD + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef TLG2DDRM_API_H_ +#define TLG2DDRM_API_H_ + +#include "tci.h" +#include "sec_g2d_4x.h" + +/* Command ID's for communication Trustlet Connector -> Trustlet. */ +#define CMD_INITIALIZE 0x00000001 +#define CMD_TERMINATE 0x00000002 +#define CMD_LOAD_MFC_FW 0x00000003 +#define CMD_ENABLE_PATH_PROTECTION 0x00000004 +#define CMD_DISABLE_PATH_PROTECTION 0x00000005 +#define CMD_G2DDRM_INITIALIZE 0x00000006 +#define CMD_G2DDRM_BLIT 0x00000007 +#define CMD_G2DDRM_TERMINATE 0x00000008 + +/* Return codes */ +#define RET_TL_SECDRM_OK 0x00000000 +#define RET_TL_G2DDRM_OK 0x00000000 + +/* Error codes */ +#define RET_ERR_INITIALIZATION 0x00001001 +#define RET_ERR_FINALIZATION 0x00001002 +#define RET_ERR_SSS_INIT 0x00001003 +#define RET_ERR_SSS_EXIT 0x00001004 +#define RET_ERR_LOAD_MFC_FW 0x00001005 +#define RET_ERR_START_CONTENT_PROTECT 0x00001006 +#define RET_ERR_STOP_CONTENT_PROTECT 0x00001007 +#define RET_ERR_G2DDRM_INIT 0x00001008 +#define RET_ERR_G2DDRM_BLIT 0x00001009 +#define RET_ERR_G2DDRM_EXIT 0x0000100A + +/* Termination codes */ +#define EXIT_ERROR ((uint32_t)(-1)) + +/* Maximum data length. */ +#define MAX_DATA_LEN 512 + +/* mcMap/mcUnmap test parameters */ +#define MAX_BUF_LEN 65536 /* 64KB */ +#define TEST_CHAR_TLC_TO_TL 'A' /* Trustlet Connecotr send to Trustlet */ +#define TEST_CHAR_TL_TO_TLC 'B' /* Trustlet send to Trustlet Connector */ + +/* TCI message data. */ +struct tci_cmd_t { + uint32_t id; + uint32_t data_len; + uint8_t *data_ptr; + uint8_t data[MAX_DATA_LEN]; +}; + +struct tci_resp_t { + uint32_t id; + uint32_t return_code; + uint32_t data_len; + uint8_t *data_ptr; + uint8_t data[MAX_DATA_LEN]; +}; + +struct tci_blit_t { + uint32_t id; + enum blit_op op; + struct fimg2d_param param; + struct fimg2d_image src; + struct fimg2d_image msk; + struct fimg2d_image tmp; + struct fimg2d_image dst; + enum blit_sync sync; + unsigned int seq_no; +}; + +struct tci_meminfo_t { + uint32_t id; + uint32_t return_code; + uint32_t chunk_num; + struct secchunk_info *chunk_info; +}; + +struct tci_mfcfw_t { + uint32_t id; + uint32_t return_code; + uint8_t *mfc_fw_virtaddr; + uint32_t mfc_fw_len; +}; + +struct tciMessage_t { + union { + struct tci_cmd_t cmd; /* Command message structure */ + struct tci_resp_t resp; /* Response message structure */ + struct tci_meminfo_t meminfo; /* Command message for secure mem information */ + struct tci_mfcfw_t mfcfw; /* Command message for MFC FW */ + struct tci_blit_t blit; /* Command message for G2D blit */ + }; +}; + +/* Trustlet UUID. */ +#define TL_SECDRM_UUID { { 2, 1, 0, 0, 8, 3, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0 } } + +#endif /* TLG2DDRM_API_H_ */ diff --git a/libvirtualdisplaymodule/Android.mk b/libvirtualdisplaymodule/Android.mk new file mode 100644 index 0000000000000000000000000000000000000000..bc422eb8e9035d4159897060a6dcc383da00fa71 --- /dev/null +++ b/libvirtualdisplaymodule/Android.mk @@ -0,0 +1,43 @@ +# Copyright (C) 2008 The Android Open Source Project +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +ifeq ($(filter-out exynos5,$(TARGET_BOARD_PLATFORM)),) + +LOCAL_PATH:= $(call my-dir) +include $(CLEAR_VARS) + +LOCAL_PRELINK_MODULE := false +LOCAL_SHARED_LIBRARIES := liblog libutils libcutils libexynosutils libexynosv4l2 libsync libdisplay libvirtualdisplay + +LOCAL_CFLAGS += -DUSES_VIRTUAL_DISPLAY + +LOCAL_C_INCLUDES := \ + $(LOCAL_PATH)/../../exynos5/include \ + $(TOP)/hardware/samsung_slsi/exynos/include \ + $(TOP)/hardware/samsung_slsi/exynos/libexynosutils \ + $(TOP)/hardware/samsung_slsi/$(TARGET_SOC)/include \ + $(TOP)/hardware/samsung_slsi/$(TARGET_SOC)/libhwcmodule \ + $(TOP)/hardware/samsung_slsi/exynos/libhwc \ + $(TOP)/hardware/samsung_slsi/exynos/libhwcutils \ + $(TOP)/hardware/samsung_slsi/exynos/libdisplay \ + $(TOP)/hardware/samsung_slsi/exynos/libvirtualdisplay + +LOCAL_SRC_FILES := \ + ExynosVirtualDisplayModule.cpp + +LOCAL_MODULE_TAGS := eng +LOCAL_MODULE := libvirtualdisplaymodule +include $(BUILD_SHARED_LIBRARY) + +endif diff --git a/libvirtualdisplaymodule/ExynosVirtualDisplayModule.cpp b/libvirtualdisplaymodule/ExynosVirtualDisplayModule.cpp new file mode 100644 index 0000000000000000000000000000000000000000..10fe1fc0e75ce7c65848581e30e65c96cc7c8de1 --- /dev/null +++ b/libvirtualdisplaymodule/ExynosVirtualDisplayModule.cpp @@ -0,0 +1,37 @@ +#include "ExynosVirtualDisplayModule.h" + +ExynosVirtualDisplayModule::ExynosVirtualDisplayModule(struct exynos5_hwc_composer_device_1_t *pdev) + : ExynosVirtualDisplay(pdev) +{ + mGLESFormat = HAL_PIXEL_FORMAT_RGBA_8888; +} + +ExynosVirtualDisplayModule::~ExynosVirtualDisplayModule() +{ +} + +int32_t ExynosVirtualDisplayModule::getDisplayAttributes(const uint32_t attribute) +{ + switch(attribute) { + case HWC_DISPLAY_COMPOSITION_TYPE: + return mCompositionType; + case HWC_DISPLAY_GLES_FORMAT: + return mGLESFormat; + case HWC_DISPLAY_SINK_BQ_FORMAT: + return HAL_PIXEL_FORMAT_EXYNOS_YCbCr_420_SP_M; + case HWC_DISPLAY_SINK_BQ_USAGE: + return mSinkUsage; + case HWC_DISPLAY_SINK_BQ_WIDTH: + if (mDisplayWidth == 0) + return mWidth; + return mDisplayWidth; + case HWC_DISPLAY_SINK_BQ_HEIGHT: + if (mDisplayHeight == 0) + return mHeight; + return mDisplayHeight; + default: + ALOGE("unknown display attribute %u", attribute); + return -EINVAL; + } + return 0; +} diff --git a/libvirtualdisplaymodule/ExynosVirtualDisplayModule.h b/libvirtualdisplaymodule/ExynosVirtualDisplayModule.h new file mode 100644 index 0000000000000000000000000000000000000000..44c31ff41e9faf60ede7ca9143dcd147870c6c3f --- /dev/null +++ b/libvirtualdisplaymodule/ExynosVirtualDisplayModule.h @@ -0,0 +1,14 @@ +#ifndef EXYNOS_VIRTUAL_DISPLAY_MODULE_H +#define EXYNOS_VIRTUAL_DISPLAY_MODULE_H + +#include "ExynosVirtualDisplay.h" + +class ExynosVirtualDisplayModule : public ExynosVirtualDisplay { + public: + ExynosVirtualDisplayModule(struct exynos5_hwc_composer_device_1_t *pdev); + ~ExynosVirtualDisplayModule(); + + virtual int32_t getDisplayAttributes(const uint32_t attribute); +}; + +#endif diff --git a/mobicore/Android.mk b/mobicore/Android.mk new file mode 100644 index 0000000000000000000000000000000000000000..9f26a5d42bc231cd60b121111b89165c25d59c6d --- /dev/null +++ b/mobicore/Android.mk @@ -0,0 +1,45 @@ +# ============================================================================= +# +# Makefile pointing to all makefiles within the project. +# +# ============================================================================= +MOBICORE_PROJECT_PATH := $(call my-dir) +# Setup common variables +LOG_WRAPPER := $(MOBICORE_PROJECT_PATH)/common/LogWrapper +COMP_PATH_MobiCore := $(MOBICORE_PROJECT_PATH)/common/MobiCore +COMP_PATH_MobiCoreDriverMod := $(MOBICORE_PROJECT_PATH)/include + + +# Application wide Cflags +GLOBAL_INCLUDES := bionic \ + external/stlport/stlport \ + $(COMP_PATH_MobiCore)/inc \ + $(COMP_PATH_MobiCoreDriverMod)/Public \ + $(COMP_PATH_MobiCore)/inc/TlCm \ + $(COMP_PATH_MobiCore)/inc/GP \ + $(MOBICORE_PROJECT_PATH)/common/DrSecureStorage + +GLOBAL_LIBRARIES := libstlport + +# Include the Daemon +include $(MOBICORE_PROJECT_PATH)/daemon/Android.mk + +MC_INCLUDE_DIR := $(COMP_PATH_MobiCore)/inc \ + $(COMP_PATH_MobiCore)/inc/GP \ + $(COMP_PATH_MobiCore)/inc/TlCm \ + $(COMP_PATH_MobiCore)/inc/TlCm/2.0 \ + $(MOBICORE_PROJECT_PATH)/daemon/ClientLib/public \ + $(MOBICORE_PROJECT_PATH)/daemon/Registry/Public + +MC_DEBUG := _DEBUG +SYSTEM_LIB_DIR=/system/lib +GDM_PROVLIB_SHARED_LIBS=libMcClient +# Include the provisioning lib +include $(MOBICORE_PROJECT_PATH)/provlib/Android.mk + + +MOBICORE_DIR_INC := $(MC_INCLUDE_DIR) $(MOBICORE_PROJECT_PATH)/common/curl/include +include $(MOBICORE_PROJECT_PATH)/common/curl/Android.mk +include $(MOBICORE_PROJECT_PATH)/rootpa/Code/Android/app/jni/Android.mk +include $(MOBICORE_PROJECT_PATH)/rootpa/Code/Android/lib/Android.mk +include $(MOBICORE_PROJECT_PATH)/rootpa/Code/Android/app/Android.mk diff --git a/mobicore/CleanSpec.mk b/mobicore/CleanSpec.mk new file mode 100644 index 0000000000000000000000000000000000000000..7dd6f6cf54a2d09a9a38b34896b7da3d0ee73ac3 --- /dev/null +++ b/mobicore/CleanSpec.mk @@ -0,0 +1,61 @@ +# Copyright (C) 2007 The Android Open Source Project +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +# If you don't need to do a full clean build but would like to touch +# a file or delete some intermediate files, add a clean step to the end +# of the list. These steps will only be run once, if they haven't been +# run before. +# +# E.g.: +# $(call add-clean-step, touch -c external/sqlite/sqlite3.h) +# $(call add-clean-step, rm -rf $(PRODUCT_OUT)/obj/STATIC_LIBRARIES/libz_intermediates) +# +# Always use "touch -c" and "rm -f" or "rm -rf" to gracefully deal with +# files that are missing or have been moved. +# +# Use $(PRODUCT_OUT) to get to the "out/target/product/blah/" directory. +# Use $(OUT_DIR) to refer to the "out" directory. +# +# If you need to re-do something that's already mentioned, just copy +# the command and add it to the bottom of the list. E.g., if a change +# that you made last week required touching a file and a change you +# made today requires touching the same file, just copy the old +# touch step and add it to the end of the list. +# +# ************************************************ +# NEWER CLEAN STEPS MUST BE AT THE END OF THE LIST +# ************************************************ + +# For example: +#$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/APPS/AndroidTests_intermediates) +#$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/JAVA_LIBRARIES/core_intermediates) +#$(call add-clean-step, find $(OUT_DIR) -type f -name "IGTalkSession*" -print0 | xargs -0 rm -f) +#$(call add-clean-step, rm -rf $(PRODUCT_OUT)/data/*) +#$(call add-clean-step, rm -rf $(PRODUCT_OUT)/obj/EXECUTABLES/openssl_intermediates) +#$(call add-clean-step, rm -rf $(PRODUCT_OUT)/obj/EXECUTABLES/openssl_intermediates) +#$(call add-clean-step, rm -rf $(PRODUCT_OUT)/obj/SHARED_LIBRARIES/libcrypto_intermediates $(PRODUCT_OUT)/obj/SHARED_LIBRARIES/libssl_intermediates $(PRODUCT_OUT)/obj/EXECUTABLES/openssl_intermediates $(PRODUCT_OUT)/obj/EXECUTABLES/ssltest_intermediates) +#$(call add-clean-step, rm -rf $(PRODUCT_OUT)/obj/SHARED_LIBRARIES/libcrypto_intermediates $(PRODUCT_OUT)/obj/SHARED_LIBRARIES/libssl_intermediates $(PRODUCT_OUT)/obj/EXECUTABLES/openssl_intermediates $(PRODUCT_OUT)/obj/EXECUTABLES/ssltest_intermediates) +#$(call add-clean-step, rm -rf $(PRODUCT_OUT)/obj/SHARED_LIBRARIES/libcrypto_intermediates $(PRODUCT_OUT)/obj/SHARED_LIBRARIES/libssl_intermediates $(PRODUCT_OUT)/obj/EXECUTABLES/openssl_intermediates $(PRODUCT_OUT)/obj/EXECUTABLES/ssltest_intermediates) +#$(call add-clean-step, rm -rf $(PRODUCT_OUT)/obj/SHARED_LIBRARIES/libcrypto_intermediates $(PRODUCT_OUT)/obj/SHARED_LIBRARIES/libssl_intermediates $(PRODUCT_OUT)/obj/EXECUTABLES/openssl_intermediates $(PRODUCT_OUT)/obj/EXECUTABLES/ssltest_intermediates) +#$(call add-clean-step, rm -rf $(PRODUCT_OUT)/obj/SHARED_LIBRARIES/libcrypto_intermediates $(PRODUCT_OUT)/obj/SHARED_LIBRARIES/libssl_intermediates $(PRODUCT_OUT)/obj/EXECUTABLES/openssl_intermediates $(PRODUCT_OUT)/obj/EXECUTABLES/ssltest_intermediates) +#$(call add-clean-step, rm -rf $(PRODUCT_OUT)/obj/SHARED_LIBRARIES/libssl_intermediates) +#$(call add-clean-step, rm -rf $(PRODUCT_OUT)/obj/SHARED_LIBRARIES/libcrypto_intermediates) +#$(call add-clean-step, rm -rf $(PRODUCT_OUT)/obj/STATIC_LIBRARIES/libssl_static_intermediates) +#$(call add-clean-step, rm -rf $(PRODUCT_OUT)/obj/STATIC_LIBRARIES/libcrypto_static_intermediates) +#$(call add-clean-step, rm -rf $(PRODUCT_OUT)/obj/EXECUTABLES/*ssl*_intermediates $(PRODUCT_OUT)/obj/*/libssl_*intermediates $(PRODUCT_OUT)/obj/*/libcrypto_*intermediates) + +# ************************************************ +# NEWER CLEAN STEPS MUST BE AT THE END OF THE LIST +# ************************************************ diff --git a/mobicore/MODULE_LICENSE_BSD b/mobicore/MODULE_LICENSE_BSD new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/mobicore/NOTICE b/mobicore/NOTICE new file mode 100644 index 0000000000000000000000000000000000000000..d742e22f8b18a45c3d122d47a838f7a911c41b38 --- /dev/null +++ b/mobicore/NOTICE @@ -0,0 +1,25 @@ + Copyright Giesecke & Devrient GmbH 2009 - 2012 + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + 3. The name of the author may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. \ No newline at end of file diff --git a/mobicore/README.android b/mobicore/README.android new file mode 100644 index 0000000000000000000000000000000000000000..29edee1a5733a395978a2e2f9eaf9486d765a617 --- /dev/null +++ b/mobicore/README.android @@ -0,0 +1,64 @@ +MobiCore Daemon in Android +--- +Command line +-- +The MobiCore Daemon supports 4 command line options. It also displays them with the help option: + +# ./mcDriverDaemon -h +usage: ./mcDriverDaemon [-mdsbh] +Start MobiCore Daemon + +-h show this help +-b fork to background +-m IMAGE load mobicore from IMAGE to DDR +-s disable daemon scheduler(default enabled) +-r DRIVER load dyamic driver + +-b Forks the daemon to background + +# ./mcDriverDaemon -b + +Makes the daemon run in background and returns immediate control to the shell. No need to use shell forking with & + +-m Loads a mobicore image to DDR + +# ./mcDriverDaemon -m /data/app/mobicore.img + +Loads the mobicore.img to DDR and starts executing it. + +-s Disables NQ IRQ scheduler + +# ./mcDriverDaemon -s + +-r Loads dynamic driver at startup. The full path of the driver binary must be given, eg. /data/app/driver.drbin + +# ./mcDriverDaemon -r /data/app/driver.drbin + +Custom registry locations +-- +Registry fallback + +In case of a Device wipe in Android the /data/app/mcRegistry folder will be deleted with all it's contents. To overcome +this the daemon supports a fallback location(eg /system/app/mcRegistry): it first tries to load the trustlet +from /data/app/mcRegistry/[uuid].tlbin and if it fails then it tries to read the trustlet from /system/app/mcRegistry/[uuid].tlb + +Both paths are completely configurable for the Daemon using 2 environment variables:MC_REGISTRY_PATH and MC_REGISTRY_FALLBACK_PATH + +For example if you want to use /data/app/mcRegistry as the default path and /system/app/mcRegistry as the fallback path: + +$ export MC_REGISTRY_PATH=/data/app/mcRegistry +$ export MC_REGISTRY_FALLBACK_PATH=/system/app/mcRegistry +$ /data/app/mcDriverDaemon + +Custom authtoken path +-- + +The authtoken file is created at provisioning and is by default located in /data/app/mcRegistry/00000.authtoken + +Because a device wipe could delete this file and make MobiCore unusable a new environment variable has been added to change the +default behaviour: MC_AUTH_TOKEN_PATH + +$ export MC_AUTH_TOKEN_PATH=/efs +$ /data/app/mcDriverDaemon + +This would change the location of the authtoken file to /efs diff --git a/mobicore/common/DrSecureStorage/dci.h b/mobicore/common/DrSecureStorage/dci.h new file mode 100644 index 0000000000000000000000000000000000000000..c805f5cb4cc09387147f84612b8f373f072c4706 --- /dev/null +++ b/mobicore/common/DrSecureStorage/dci.h @@ -0,0 +1,57 @@ +/* + * Copyright (c) 2013 TRUSTONIC LIMITED + * All rights reserved + * + * The present software is the confidential and proprietary information of + * TRUSTONIC LIMITED. You shall not disclose the present software and shall + * use it only in accordance with the terms of the license agreement you + * entered into with TRUSTONIC LIMITED. This software may be subject to + * export or import laws in certain countries. + */ + +/** + * @file dci.h + * @brief Contains DCI (Driver Control + * Interface) definitions and data structures + * + */ + +#ifndef __DCI_H__ +#define __DCI_H__ + + +typedef uint32_t dciCommandId_t; +typedef uint32_t dciResponseId_t; +typedef uint32_t dciReturnCode_t; + +/**< Responses have bit 31 set */ +#define RSP_ID_MASK (1U << 31) +#define RSP_ID(cmdId) (((uint32_t)(cmdId)) | RSP_ID_MASK) +#define IS_CMD(cmdId) ((((uint32_t)(cmdId)) & RSP_ID_MASK) == 0) +#define IS_RSP(cmdId) ((((uint32_t)(cmdId)) & RSP_ID_MASK) == RSP_ID_MASK) + +/** + * Return codes of driver commands. + */ +#define RET_OK 0 +#define RET_ERR_UNKNOWN_CMD 1 +#define RET_ERR_NOT_SUPPORTED 2 +#define RET_ERR_INTERNAL_ERROR 3 +/* ... add more error codes when needed */ + +/** + * DCI command header. + */ +typedef struct{ + dciCommandId_t commandId; /**< Command ID */ +} dciCommandHeader_t; + +/** + * DCI response header. + */ +typedef struct{ + dciResponseId_t responseId; /**< Response ID (must be command ID | RSP_ID_MASK )*/ + dciReturnCode_t returnCode; /**< Return code of command */ +} dciResponseHeader_t; + +#endif // __DCI_H__ diff --git a/mobicore/common/DrSecureStorage/drError.h b/mobicore/common/DrSecureStorage/drError.h new file mode 100644 index 0000000000000000000000000000000000000000..d686bc1df1dd3e7ceb60b4e3f10875abccaf3710 --- /dev/null +++ b/mobicore/common/DrSecureStorage/drError.h @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2013 TRUSTONIC LIMITED + * All rights reserved + * + * The present software is the confidential and proprietary information of + * TRUSTONIC LIMITED. You shall not disclose the present software and shall + * use it only in accordance with the terms of the license agreement you + * entered into with TRUSTONIC LIMITED. This software may be subject to + * export or import laws in certain countries. + */ + +/** + * @file drError.h + * @brief Error id definitions + * + */ + +#ifndef __DRERROR_H__ +#define __DRERROR_H__ + +/** + * Driver fatal error codes. + */ +typedef enum { + E_DR_OK = 0, /**< Success */ + E_DR_IPC = 1, /**< IPC error */ + E_DR_INTERNAL = 2, /**< Internal error */ + /* ... add more error codes when required */ +} drError_t; + + +#endif // __DRERROR_H__ + + diff --git a/mobicore/common/DrSecureStorage/drSecureStorage_Api.h b/mobicore/common/DrSecureStorage/drSecureStorage_Api.h new file mode 100644 index 0000000000000000000000000000000000000000..0ca75491a21c9fb1acda16e66afd81bf6bb4910a --- /dev/null +++ b/mobicore/common/DrSecureStorage/drSecureStorage_Api.h @@ -0,0 +1,101 @@ +/* + * Copyright (c) 2013 TRUSTONIC LIMITED + * All rights reserved + * + * The present software is the confidential and proprietary information of + * TRUSTONIC LIMITED. You shall not disclose the present software and shall + * use it only in accordance with the terms of the license agreement you + * entered into with TRUSTONIC LIMITED. This software may be subject to + * export or import laws in certain countries. + */ + +/** + * @file drSecureStorage_Api.h + * @brief Contains DCI command definitions and data structures + * + */ + +#ifndef __DRTEMPLATEAPI_H__ +#define __DRTEMPLATEAPI_H__ + +#include "dci.h" +#include "tee_internal_api.h" + + +#define RW_DATA_SIZE 4096 + +/** + * Command ID's for communication + * FSD <--> STH + */ + +#define STH_MESSAGE_TYPE_LOOK 0 +#define STH_MESSAGE_TYPE_READ 1 +#define STH_MESSAGE_TYPE_WRITE 2 +#define STH_MESSAGE_TYPE_DELETE 3 + +#define CMD_ST_SYNC 5 +#define NOTIFY_DCIH 6 +#define NOTIFY_IPCH 7 +/*... add more command ids when needed */ + +#define STH_PUBLIC_FILE_NAME_SIZE 20 + +typedef struct { + uint32_t status; + uint8_t type; + uint8_t reserved0; + uint16_t flags; + uint32_t payloadLen; + TEE_UUID uuid; + unsigned char filename[STH_PUBLIC_FILE_NAME_SIZE]; + unsigned char payload[]; +} STH_FSD_message_t; + +typedef struct +{ + char header[5]; + unsigned char version; + uint16_t cryptoLen; + uint32_t dataLen; +}FSD_plaintext; + +/** + * command message. + * + * @param len Lenght of the data to process. + * @param data Data to be processed + */ +typedef struct { + dciCommandHeader_t header; /**< Command header */ + uint32_t len; /**< Length of data to process */ +} cmd_t; + + +/** + * Response structure + */ +typedef struct { + dciResponseHeader_t header; /**< Response header */ + uint32_t len; +} rsp_t; + +/** + * DCI message data. + */ +typedef struct { + union { + cmd_t command; + rsp_t response; + }; + + STH_FSD_message_t sth_request; +} dciMessage_t; + +/** + * Driver UUID. Update accordingly after reserving UUID + */ +#define DRV_STH_UUID { { 0x07, 0x05, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } } + + +#endif // __DRTEMPLATEAPI_H__ diff --git a/mobicore/common/DrSecureStorage/tee_internal_api.h b/mobicore/common/DrSecureStorage/tee_internal_api.h new file mode 100644 index 0000000000000000000000000000000000000000..05119a3473e12fe768610acb0c329b83602d6cb6 --- /dev/null +++ b/mobicore/common/DrSecureStorage/tee_internal_api.h @@ -0,0 +1,1109 @@ +/* + * Copyright (c) 2012 Trusted Logic Mobility SAS. + * All Rights Reserved. + * + * The present software is the confidential and proprietary information of + * Trusted Logic Mobility SAS. You shall not disclose the present software + * and shall use it only in accordance with the terms of the license + * agreement you entered into with Trusted Logic Mobility SAS. + * "Trusted Logic" is a registered trademark of Trusted Logic SAS. + * This software may be subject to export or import laws in certain + * countries. + */ + +//TODO: Remove functions that are not provided in potato release + +#ifndef __TEE_INTERNAL_API_H__ +#define __TEE_INTERNAL_API_H__ + +typedef uint32_t TEE_Result; + +#define TEE_SUCCESS ((TEE_Result)0x00000000) + +/** + * Generic error code : Generic error + **/ +#define TEE_ERROR_GENERIC ((TEE_Result)0xFFFF0000) + +/** + * Generic error code : The underlying security system denies the access to the + * object + **/ +#define TEE_ERROR_ACCESS_DENIED ((TEE_Result)0xFFFF0001) + +/** + * Generic error code : The pending operation is cancelled. + **/ +#define TEE_ERROR_CANCEL ((TEE_Result)0xFFFF0002) + +/** + * Generic error code : The underlying system detects a conflict + **/ +#define TEE_ERROR_ACCESS_CONFLICT ((TEE_Result)0xFFFF0003) + +/** + * Generic error code : Too much data for the operation or some data remain + * unprocessed by the operation. + **/ +#define TEE_ERROR_EXCESS_DATA ((TEE_Result)0xFFFF0004) + +/** + * Generic error code : Error of data format + **/ +#define TEE_ERROR_BAD_FORMAT ((TEE_Result)0xFFFF0005) + +/** + * Generic error code : The specified parameters are invalid + **/ +#define TEE_ERROR_BAD_PARAMETERS ((TEE_Result)0xFFFF0006) + +/** + * Generic error code : Illegal state for the operation. + **/ +#define TEE_ERROR_BAD_STATE ((TEE_Result)0xFFFF0007) + +/** + * Generic error code : The item is not found + **/ +#define TEE_ERROR_ITEM_NOT_FOUND ((TEE_Result)0xFFFF0008) + +/** + * Generic error code : The specified operation is not implemented + **/ +#define TEE_ERROR_NOT_IMPLEMENTED ((TEE_Result)0xFFFF0009) + +/** + * Generic error code : The specified operation is not supported + **/ +#define TEE_ERROR_NOT_SUPPORTED ((TEE_Result)0xFFFF000A) + +/** + * Generic error code : Insufficient data is available for the operation. + **/ +#define TEE_ERROR_NO_DATA ((TEE_Result)0xFFFF000B) + +/** + * Generic error code : Not enough memory to perform the operation + **/ +#define TEE_ERROR_OUT_OF_MEMORY ((TEE_Result)0xFFFF000C) + +/** + * Generic error code : The service is currently unable to handle the request; + * try later + **/ +#define TEE_ERROR_BUSY ((TEE_Result)0xFFFF000D) + +/** + * Generic error code : security violation + **/ +#define TEE_ERROR_SECURITY ((TEE_Result)0xFFFF000F) + +/** + * Generic error code : the buffer is too short + **/ +#define TEE_ERROR_SHORT_BUFFER ((TEE_Result)0xFFFF0010) + +/** + * Generic error code : the operation is not terminated + **/ +#define TEE_PENDING ((TEE_Result)0xFFFF2000) + +/** + * Generic error code : A timeout occurred + **/ +#define TEE_ERROR_TIMEOUT ((TEE_Result)0xFFFF3001) + +/** + * Generic error code : Overflow + **/ +#define TEE_ERROR_OVERFLOW ((TEE_Result)0xFFFF300F) + +/*------------------------------------------------------------------------------ + Communication Error Codes +------------------------------------------------------------------------------*/ + +/** + * Generic communication error + **/ +#define TEE_ERROR_COMMUNICATION ((TEE_Result)0xFFFF000E) + +/** + * Error of communication: The target of the connection is dead + **/ +#define TEE_ERROR_TARGET_DEAD ((TEE_Result)0xFFFF3024) + +/*------------------------------------------------------------------------------ + Storage Error Codes +------------------------------------------------------------------------------*/ + +/** File system error code: not enough space to complete the operation. */ +#define TEE_ERROR_STORAGE_NO_SPACE ((TEE_Result)0xFFFF3041) + +/*------------------------------------------------------------------------------ + Crypto error codes +------------------------------------------------------------------------------*/ +#define TEE_ERROR_MAC_INVALID ((TEE_Result)0xFFFF3071) + +#define TEE_ERROR_SIGNATURE_INVALID ((TEE_Result)0xFFFF3072) + +/*------------------------------------------------------------------------------ + Date error codes +------------------------------------------------------------------------------*/ +#define TEE_ERROR_TIME_NOT_SET ((TEE_Result)0xFFFF5000) + +#define TEE_ERROR_TIME_NEEDS_RESET ((TEE_Result)0xFFFF5001) + + +/** Definition of an UUID (from RFC 4122 http://www.ietf.org/rfc/rfc4122.txt) */ +typedef struct +{ + uint32_t timeLow; + uint16_t timeMid; + uint16_t timeHiAndVersion; + uint8_t clockSeqAndNode[8]; +} TEE_UUID; + +/** Type definition for a TEE Identity */ +typedef struct TEE_Identity +{ + uint32_t login; + TEE_UUID uuid; +} TEE_Identity; + +typedef uint32_t S_HANDLE; + +#define S_VAR_NOT_USED(variable) do{(void)(variable);}while(0); + +#define OUT +#define IN + +#define TEE_EXPORT +#define TA_EXPORT + + +/*--------------------------------------------------------- + Common type definition +---------------------------------------------------------*/ + +typedef union +{ + + struct + { + void* buffer; + size_t size; + } memref; + + struct + { + uint32_t a; + uint32_t b; + } value; + +} +TEE_Param; + +typedef S_HANDLE TEE_TASessionHandle; +typedef S_HANDLE TEE_PropSetHandle; +typedef S_HANDLE TEE_ObjectHandle; +typedef S_HANDLE TEE_ObjectEnumHandle; +typedef S_HANDLE TEE_OperationHandle; + +#define TEE_HANDLE_NULL ((S_HANDLE)0) + +#define TEE_PARAM_TYPES(t0,t1,t2,t3) ((t0) | ((t1) << 4) | ((t2) << 8) | ((t3) << 12)) +#define TEE_PARAM_TYPE_GET(t, i) (((t) >> (i*4)) & 0xF) + +typedef enum { + TEE_DATA_SEEK_SET, + TEE_DATA_SEEK_CUR, + TEE_DATA_SEEK_END + } TEE_Whence; + +typedef struct TEE_Time +{ + uint32_t seconds; + uint32_t millis; +} TEE_Time; + +typedef struct { + uint32_t algorithm; + uint32_t operationClass; + uint32_t mode; + uint32_t digestLength; + uint32_t maxKeySize; + uint32_t keySize; + uint32_t requiredKeyUsage; + uint32_t handleState; + } TEE_OperationInfo; + + +typedef enum { + TEE_MODE_ENCRYPT, + TEE_MODE_DECRYPT, + TEE_MODE_SIGN, + TEE_MODE_VERIFY, + TEE_MODE_MAC, + TEE_MODE_DIGEST, + TEE_MODE_DERIVE + } TEE_OperationMode; + + +typedef struct { + uint32_t attributeID; + union + { + struct + { + void* buffer; + size_t length; + }ref; + struct + { + uint32_t a, b; + }value; + }content; + } TEE_Attribute; + +typedef struct { + uint32_t objectType; + uint32_t objectSize; + uint32_t maxObjectSize; + uint32_t objectUsage; + uint32_t dataSize; + uint32_t dataPosition; + uint32_t handleFlags; + } TEE_ObjectInfo; + + +/*------------------------------------------------------------------------------ + Constants +------------------------------------------------------------------------------*/ + +#define TEE_TIMEOUT_INFINITE 0xFFFFFFFF + +/* Login types */ +#define TEE_LOGIN_PUBLIC 0x00000000 +#define TEE_LOGIN_USER 0x00000001 +#define TEE_LOGIN_GROUP 0x00000002 +#define TEE_LOGIN_APPLICATION 0x00000004 +#define TEE_LOGIN_APPLICATION_USER 0x00000005 +#define TEE_LOGIN_APPLICATION_GROUP 0x00000006 +#define TEE_LOGIN_TRUSTED_APP 0xF0000000 + +/* Parameter types */ +#define TEE_PARAM_TYPE_NONE 0x0 +#define TEE_PARAM_TYPE_VALUE_INPUT 0x1 +#define TEE_PARAM_TYPE_VALUE_OUTPUT 0x2 +#define TEE_PARAM_TYPE_VALUE_INOUT 0x3 +#define TEE_PARAM_TYPE_MEMREF_INPUT 0x5 +#define TEE_PARAM_TYPE_MEMREF_OUTPUT 0x6 +#define TEE_PARAM_TYPE_MEMREF_INOUT 0x7 + +#define TEE_MEMORY_ACCESS_READ 0x00000001 +#define TEE_MEMORY_ACCESS_WRITE 0x00000002 +#define TEE_MEMORY_ACCESS_ANY_OWNER 0x00000004 + +#define TEE_ORIGIN_API 1 +#define TEE_ORIGIN_COMMS 2 +#define TEE_ORIGIN_TEE 3 +#define TEE_ORIGIN_TRUSTED_APP 4 + +/* Property Sets Pseudo Handles */ +#define TEE_PROPSET_CURRENT_TA (TEE_PropSetHandle)0xFFFFFFFF +#define TEE_PROPSET_CURRENT_CLIENT (TEE_PropSetHandle)0xFFFFFFFE +#define TEE_PROPSET_TEE_IMPLEMENTATION (TEE_PropSetHandle)0xFFFFFFFD + +/* Allocation hints */ +#define TEE_ALLOCATION_HINT_ZEROED 0x00000000 + +/* Crypto Usage Constants */ +#define TEE_USAGE_EXTRACTABLE 0x00000001 +#define TEE_USAGE_ENCRYPT 0x00000002 +#define TEE_USAGE_DECRYPT 0x00000004 +#define TEE_USAGE_MAC 0x00000008 +#define TEE_USAGE_SIGN 0x00000010 +#define TEE_USAGE_VERIFY 0x00000020 +#define TEE_USAGE_DERIVE 0x00000040 + +/* Crypto Handle Flag Constants */ +#define TEE_HANDLE_FLAG_PERSISTENT 0x00010000 +#define TEE_HANDLE_FLAG_INITIALIZED 0x00020000 +#define TEE_HANDLE_FLAG_KEY_SET 0x00040000 +#define TEE_HANDLE_FLAG_EXPECT_TWO_KEYS 0x00080000 + +/* Crypto Operation Constants */ +#define TEE_OPERATION_CIPHER 1 +#define TEE_OPERATION_MAC 3 +#define TEE_OPERATION_AE 4 +#define TEE_OPERATION_DIGEST 5 +#define TEE_OPERATION_ASYMMETRIC_CIPHER 6 +#define TEE_OPERATION_ASYMMETRIC_SIGNATURE 7 +#define TEE_OPERATION_KEY_DERIVATION 8 + +/* Crypto Algortithm Constants */ +#define TEE_ALG_AES_ECB_NOPAD 0x10000010 +#define TEE_ALG_AES_CBC_NOPAD 0x10000110 +#define TEE_ALG_AES_CTR 0x10000210 +#define TEE_ALG_AES_CTS 0x10000310 +#define TEE_ALG_AES_XTS 0x10000410 +#define TEE_ALG_AES_CBC_MAC_NOPAD 0x30000110 +#define TEE_ALG_AES_CBC_MAC_PKCS5 0x30000510 +#define TEE_ALG_AES_CMAC 0x30000610 +#define TEE_ALG_AES_CCM 0x40000710 +#define TEE_ALG_AES_GCM 0x40000810 +#define TEE_ALG_DES_ECB_NOPAD 0x10000011 +#define TEE_ALG_DES_CBC_NOPAD 0x10000111 +#define TEE_ALG_DES_CBC_MAC_NOPAD 0x30000111 +#define TEE_ALG_DES_CBC_MAC_PKCS5 0x30000511 +#define TEE_ALG_DES_CMAC 0x30000611 +#define TEE_ALG_DES3_ECB_NOPAD 0x10000013 +#define TEE_ALG_DES3_CBC_NOPAD 0x10000113 +#define TEE_ALG_DES3_CBC_MAC_NOPAD 0x30000113 +#define TEE_ALG_DES3_CBC_MAC_PKCS5 0x30000513 +#define TEE_ALG_DES3_CMAC 0x30000613 +#define TEE_ALG_RSASSA_PKCS1_V1_5_MD5 0x70001830 +#define TEE_ALG_RSASSA_PKCS1_V1_5_SHA1 0x70002830 +#define TEE_ALG_RSASSA_PKCS1_V1_5_SHA224 0x70003830 +#define TEE_ALG_RSASSA_PKCS1_V1_5_SHA256 0x70004830 +#define TEE_ALG_RSASSA_PKCS1_V1_5_SHA384 0x70005830 +#define TEE_ALG_RSASSA_PKCS1_V1_5_SHA512 0x70006830 +#define TEE_ALG_RSASSA_PKCS1_PSS_MGF1_SHA1 0x70212930 +#define TEE_ALG_RSASSA_PKCS1_PSS_MGF1_SHA224 0x70313930 +#define TEE_ALG_RSASSA_PKCS1_PSS_MGF1_SHA256 0x70414930 +#define TEE_ALG_RSASSA_PKCS1_PSS_MGF1_SHA384 0x70515930 +#define TEE_ALG_RSASSA_PKCS1_PSS_MGF1_SHA512 0x70616930 +#define TEE_ALG_RSAES_PKCS1_V1_5 0x60000130 +#define TEE_ALG_RSAES_PKCS1_OAEP_MGF1_SHA1 0x60210230 +#define TEE_ALG_RSAES_PKCS1_OAEP_MGF1_SHA224 0x60310230 +#define TEE_ALG_RSAES_PKCS1_OAEP_MGF1_SHA256 0x60410230 +#define TEE_ALG_RSAES_PKCS1_OAEP_MGF1_SHA384 0x60510230 +#define TEE_ALG_RSAES_PKCS1_OAEP_MGF1_SHA512 0x60610230 +#define TEE_ALG_RSA_NOPAD 0x60000030 +#define TEE_ALG_DSA_SHA1 0x70002131 +#define TEE_ALG_DH_DERIVE_SHARED_SECRET 0x80000032 +#define TEE_ALG_MD5 0x50000001 +#define TEE_ALG_SHA1 0x50000002 +#define TEE_ALG_SHA224 0x50000003 +#define TEE_ALG_SHA256 0x50000004 +#define TEE_ALG_SHA384 0x50000005 +#define TEE_ALG_SHA512 0x50000006 +#define TEE_ALG_HMAC_MD5 0x30000001 +#define TEE_ALG_HMAC_SHA1 0x30000002 +#define TEE_ALG_HMAC_SHA224 0x30000003 +#define TEE_ALG_HMAC_SHA256 0x30000004 +#define TEE_ALG_HMAC_SHA384 0x30000005 +#define TEE_ALG_HMAC_SHA512 0x30000006 + +/* Storage ID Values */ +#define TEE_STORAGE_PRIVATE 0x00000001 + +/* Data Flags */ +#define TEE_DATA_FLAG_ACCESS_READ 0x00000001 +#define TEE_DATA_FLAG_ACCESS_WRITE 0x00000002 +#define TEE_DATA_FLAG_ACCESS_WRITE_META 0x00000004 +#define TEE_DATA_FLAG_SHARE_READ 0x00000010 +#define TEE_DATA_FLAG_SHARE_WRITE 0x00000020 +#define TEE_DATA_FLAG_CREATE 0x00000200 +#define TEE_DATA_FLAG_EXCLUSIVE 0x00000400 + +/* Misc */ +#define TEE_DATA_MAX_POSITION 0xFFFFFFFF +#define TEE_OBJECT_ID_MAX_LEN 0x40 + +/* Object Types */ +#define TEE_TYPE_AES 0xA0000010 +#define TEE_TYPE_DES 0xA0000011 +#define TEE_TYPE_DES3 0xA0000013 +#define TEE_TYPE_HMAC_MD5 0xA0000001 +#define TEE_TYPE_HMAC_SHA1 0xA0000002 +#define TEE_TYPE_HMAC_SHA224 0xA0000003 +#define TEE_TYPE_HMAC_SHA256 0xA0000004 +#define TEE_TYPE_HMAC_SHA384 0xA0000005 +#define TEE_TYPE_HMAC_SHA512 0xA0000006 +#define TEE_TYPE_RSA_PUBLIC_KEY 0xA0000030 +#define TEE_TYPE_RSA_KEYPAIR 0xA1000030 +#define TEE_TYPE_DSA_PUBLIC_KEY 0xA0000031 +#define TEE_TYPE_DSA_KEYPAIR 0xA1000031 +#define TEE_TYPE_DH_KEYPAIR 0xA1000032 +#define TEE_TYPE_GENERIC_SECRET 0xA0000000 + +/* Object Attribute Identifier Flags - bits 28 and 29 indicate the type (value/ref) and its visibility */ +#define TEE_ATTR_FLAG_VALUE 0x20000000 +#define TEE_ATTR_FLAG_PUBLIC 0x10000000 + +/* Operation and Object Attribute ID Values */ +#define TEE_ATTR_SECRET_VALUE 0xC0000000 +#define TEE_ATTR_RSA_MODULUS 0xD0000130 +#define TEE_ATTR_RSA_PUBLIC_EXPONENT 0xD0000230 +#define TEE_ATTR_RSA_PRIVATE_EXPONENT 0xC0000330 +#define TEE_ATTR_RSA_PRIME1 0xC0000430 // p +#define TEE_ATTR_RSA_PRIME2 0xC0000530 // q +#define TEE_ATTR_RSA_EXPONENT1 0xC0000630 // dp +#define TEE_ATTR_RSA_EXPONENT2 0xC0000730 // dq +#define TEE_ATTR_RSA_COEFFICIENT 0xC0000830 // iq +#define TEE_ATTR_DSA_PRIME 0xD0001031 // p +#define TEE_ATTR_DSA_SUBPRIME 0xD0001131 // q +#define TEE_ATTR_DSA_BASE 0xD0001231 // g +#define TEE_ATTR_DSA_PUBLIC_VALUE 0xD0000131 // y +#define TEE_ATTR_DSA_PRIVATE_VALUE 0xC0000231 // x +#define TEE_ATTR_DH_PRIME 0xD0001032 // p +#define TEE_ATTR_DH_SUBPRIME 0xD0001132 // q +#define TEE_ATTR_DH_BASE 0xD0001232 // g +#define TEE_ATTR_DH_X_BITS 0xF0001332 // type "Value" not "Ref" +#define TEE_ATTR_DH_PUBLIC_VALUE 0xD0000132 // y +#define TEE_ATTR_DH_PRIVATE_VALUE 0xC0000232 // x +#define TEE_ATTR_RSA_OAEP_LABEL 0xD0000930 +#define TEE_ATTR_RSA_PSS_SALT_LENGTH 0xF0000A30 // type "Value" not "Ref" + +/*------------------------------------------------------------------------------ + Trusted Application Interface + ------------------------------------------------------------------------------*/ + +TEE_Result TA_EXPORT TA_CreateEntryPoint(void); + +void TA_EXPORT TA_DestroyEntryPoint(void); + +TEE_Result TA_EXPORT TA_OpenSessionEntryPoint(uint32_t nParamTypes, + TEE_Param pParams[4], + void** ppSessionContext); + +void TA_EXPORT TA_CloseSessionEntryPoint(void* pSessionContext); + +TEE_Result TA_EXPORT TA_InvokeCommandEntryPoint( + void* pSessionContext, + uint32_t nCommandID, + uint32_t nParamTypes, + TEE_Param pParams[4] + ); + + +/*------------------------------------------------------------------------------ + Trusted Core Framework APIs + ------------------------------------------------------------------------------*/ + +void TEE_EXPORT TEE_Panic(TEE_Result nPanicCode); + + +/*------------------------------------------------------------------------------ + Property Access Functions + ------------------------------------------------------------------------------*/ + +TEE_Result TEE_EXPORT TEE_GetPropertyAsString( + TEE_PropSetHandle propsetOrEnumerator, + char* name, + char* valueBuffer, + size_t* valueBufferLen ); + +TEE_Result TEE_EXPORT TEE_GetPropertyAsBool( + TEE_PropSetHandle propsetOrEnumerator, + char* name, + bool* value ); + +TEE_Result TEE_EXPORT TEE_GetPropertyAsU32 ( + TEE_PropSetHandle propsetOrEnumerator, + char* name, + uint32_t* value ); + +TEE_Result TEE_EXPORT TEE_GetPropertyAsBinaryBlock( + TEE_PropSetHandle propsetOrEnumerator, + char* name, + void* valueBuffer, + size_t* valueBufferLen ); + +TEE_Result TEE_EXPORT TEE_GetPropertyAsUUID( + TEE_PropSetHandle propsetOrEnumerator, + char* name, + TEE_UUID* value ); + +TEE_Result TEE_EXPORT TEE_GetPropertyAsIdentity( + TEE_PropSetHandle propsetOrEnumerator, + char* name, + TEE_Identity* value ); + +TEE_Result TEE_EXPORT TEE_AllocatePropertyEnumerator( + TEE_PropSetHandle* enumerator ); + +void TEE_EXPORT TEE_FreePropertyEnumerator( + TEE_PropSetHandle enumerator ); + +void TEE_EXPORT TEE_StartPropertyEnumerator( + TEE_PropSetHandle enumerator, + TEE_PropSetHandle propSet ); + +void TEE_EXPORT TEE_ResetPropertyEnumerator( + TEE_PropSetHandle enumerator ); + +TEE_Result TEE_EXPORT TEE_GetPropertyName( + TEE_PropSetHandle enumerator, + void* nameBuffer, + size_t* nameBufferLen ); + +TEE_Result TEE_EXPORT TEE_GetNextProperty( + TEE_PropSetHandle enumerator ); + + +/*------------------------------------------------------------------------------ + Internal Client API + ------------------------------------------------------------------------------*/ + +TEE_Result TEE_EXPORT TEE_OpenTASession( TEE_UUID* destination, // [in] + uint32_t cancellationRequestTimeout, + uint32_t paramTypes, + TEE_Param params[4], // [inout] + TEE_TASessionHandle* session, // [out] + uint32_t* returnOrigin + ); + +void TEE_EXPORT TEE_CloseTASession(TEE_TASessionHandle session); + +TEE_Result TEE_EXPORT TEE_InvokeTACommand(TEE_TASessionHandle session, + uint32_t cancellationRequestTimeout, + uint32_t commandID, + uint32_t paramTypes, + TEE_Param params[4], + uint32_t* returnOrigin + ); + +/*------------------------------------------------------------------------------ + Cancellation Functions + ------------------------------------------------------------------------------*/ + +bool TEE_EXPORT TEE_GetCancellationFlag( void ); +bool TEE_EXPORT TEE_UnmaskCancellation( void ); +bool TEE_EXPORT TEE_MaskCancellation( void ); + + +/*------------------------------------------------------------------------------ + Memory Management Functions + ------------------------------------------------------------------------------*/ + +TEE_Result TEE_EXPORT TEE_CheckMemoryAccessRights(uint32_t accessFlags, + void* buffer, size_t size + ); + +void TEE_EXPORT TEE_SetInstanceData( void* instanceData ); + +TEE_EXPORT void* TEE_GetInstanceData( void ); + +/** + * Allocates a block of memory from a heap. The address of the allocated block + * is aligned on a 8-bytes boundary. A block allocated by {malloc} must + * be freed by {free}. + * + * @param nSize Number of bytes to be allocated. A zero value is invalid. + * + * @return A pointer to the allocated memory block or + * NULL if the block cannot be allocated. + **/ +TEE_EXPORT void* TEE_Malloc(uint32_t size, uint32_t hint); + +/** + * Reallocates a block of memory from a heap. + * This function enables you to resize a memory block. + * + * If pBlock is NULL, {realloc} is equivalent to {malloc}. + * In particular, if nNewSize is 0, the function returns NULL. + * + * If pBlock is not NULL and nNewSize is 0, then + * {realloc} is equivalent to {free} and returns NULL. + * + * If nNewSize is less or equal to the current size of the block, + * the block is trucated, the content of the block is left unchanged and + * the function returns pBlock. + * + * If nNewSize is greater than the current size of the block, the size + * of the block is increased. The whole content of the block is copied at the + * beginning of the new block. If possible, the block is enlarged in place and + * the function retuns pBlock. If this is not possible, a new block + * is allocated with the new size, the content of the current block is copied, + * the current block is freed and the function retuns the pointer on the new + * block. + * @param pBlock Pointer to the block of memory that the function + * reallocates. This value may be null or returned by an + * earlier call to the {malloc} or {realloc} + * function. + * + * @param nNewSize New size of the memory block, in bytes. + * This value may be zero. A memory block's size can be + * increased or decreased by using this function. + * + * @return A pointer to the reallocated memory block or + * NULL if nNewSize is zero or if an error is detected. + **/ +TEE_EXPORT void* TEE_Realloc(void* buffer, uint32_t newSize); + +/** + * Frees a memory block allocated from a heap by the {malloc} or + * {realloc} function. + * + * This function does nothing if pBlock is set to NULL. + * + * @param pBlock Pointer to the memory block to be freed. + * This pointer is returned by an earlier call + * to the {malloc} or {realloc} function. + **/ +void TEE_EXPORT TEE_Free(void *buffer); + +void TEE_EXPORT TEE_MemMove(void* dest, void* src, uint32_t size); + +int32_t TEE_EXPORT TEE_MemCompare(void* buffer1, void* buffer2, uint32_t size); + +void TEE_EXPORT TEE_MemFill(void* buffer, uint32_t x, uint32_t size ); + + +/*------------------------------------------------------------------------------ + Time Functions + ------------------------------------------------------------------------------*/ + +TEE_Result TEE_EXPORT TEE_Wait(uint32_t timeout); + +void TEE_EXPORT TEE_GetSystemTime(TEE_Time* time); + +void TEE_EXPORT TEE_GetREETime(TEE_Time* time); + +TEE_Result TEE_EXPORT TEE_GetTAPersistentTime(TEE_Time* time); + +TEE_Result TEE_EXPORT TEE_SetTAPersistentTime(TEE_Time* time); + + +/*------------------------------------------------------------------------------ + Arithmetical Functions +------------------------------------------------------------------------------*/ + +typedef uint32_t TEE_BigInt; +typedef uint32_t TEE_BigIntFMMContext; +typedef uint32_t TEE_BigIntFMM; + +#define TEE_BigIntSizeInU32(n) ((((n)+31)/32)+2) + +void TEE_EXPORT TEE_BigIntInit( + OUT TEE_BigInt *bigInt, + IN size_t len); + +int32_t TEE_EXPORT TEE_BigIntCmp( + IN TEE_BigInt *op1, + IN TEE_BigInt *op2); + +int32_t TEE_EXPORT TEE_BigIntCmpS32( + IN TEE_BigInt *op, + IN int32_t shortVal); + +TEE_Result TEE_EXPORT TEE_BigIntConvertFromOctetString( + OUT TEE_BigInt *dest, + IN uint8_t *buffer, + IN size_t bufferLen, + IN int32_t sign); + +TEE_Result TEE_EXPORT TEE_BigIntConvertToOctetString( + OUT void *buffer, + OUT size_t *bufferLen, + IN TEE_BigInt *bigInt); + +void TEE_EXPORT TEE_BigIntConvertFromS32( + OUT TEE_BigInt *dest, + IN int32_t shortVal); + +TEE_Result TEE_EXPORT TEE_BigIntConvertToS32( + OUT int32_t *dest, + IN TEE_BigInt *src); + +void TEE_EXPORT TEE_BigIntShiftRight( + OUT TEE_BigInt *dest, + IN TEE_BigInt *op, + IN size_t bits); + +bool TEE_EXPORT TEE_BigIntGetBit( + IN TEE_BigInt *src, + IN uint32_t bitIndex); + +uint32_t TEE_EXPORT TEE_BigIntGetBitCount( + IN TEE_BigInt *src); + +void TEE_EXPORT TEE_BigIntAdd( + OUT TEE_BigInt *dest, + IN TEE_BigInt *op1, + IN TEE_BigInt *op2); + +void TEE_EXPORT TEE_BigIntSub( + OUT TEE_BigInt *dest, + IN TEE_BigInt *op1, + IN TEE_BigInt *op2); + +size_t TEE_EXPORT TEE_BigIntFMMContextSizeInU32( + size_t modulusSizeInBits); + +size_t TEE_EXPORT TEE_BigIntFMMSizeInU32( + size_t modulusSizeInBits); + +void TEE_EXPORT TEE_BigIntInitFMMContext( + OUT TEE_BigIntFMMContext *context, + size_t len, + IN TEE_BigInt *modulus); + +void TEE_EXPORT TEE_BigIntInitFMM( + OUT TEE_BigIntFMM *bigIntFMM, + size_t len); + +void TEE_EXPORT TEE_BigIntNeg( + OUT TEE_BigInt *dest, + IN TEE_BigInt *op); + +void TEE_EXPORT TEE_BigIntMul( + OUT TEE_BigInt *dest, + IN TEE_BigInt *op1, + IN TEE_BigInt *op2); + +void TEE_EXPORT TEE_BigIntSquare( + OUT TEE_BigInt *dest, + IN TEE_BigInt *op); + +void TEE_EXPORT TEE_BigIntDiv( + OUT TEE_BigInt *dest_q, + OUT TEE_BigInt *dest_r, + IN TEE_BigInt *op1, + IN TEE_BigInt *op2); + +void TEE_EXPORT TEE_BigIntMod( + OUT TEE_BigInt *dest, + IN TEE_BigInt *op, + IN TEE_BigInt *n); + +void TEE_EXPORT TEE_BigIntAddMod( + OUT TEE_BigInt *dest, + IN TEE_BigInt *op1, + IN TEE_BigInt *op2, + IN TEE_BigInt *n); + +void TEE_EXPORT TEE_BigIntSubMod( + OUT TEE_BigInt *dest, + IN TEE_BigInt *op1, + IN TEE_BigInt *op2, + IN TEE_BigInt *n); + +void TEE_EXPORT TEE_BigIntMulMod( + OUT TEE_BigInt *dest, + IN TEE_BigInt *op1, + IN TEE_BigInt *op2, + IN TEE_BigInt *n); + +void TEE_EXPORT TEE_BigIntSquareMod( + OUT TEE_BigInt *dest, + IN TEE_BigInt *op, + IN TEE_BigInt *n); + +void TEE_EXPORT TEE_BigIntInvMod( + OUT TEE_BigInt *dest, + IN TEE_BigInt *op, + IN TEE_BigInt *n); + +bool TEE_EXPORT TEE_BigIntRelativePrime( + IN TEE_BigInt *op1, + IN TEE_BigInt *op2); + +void TEE_EXPORT TEE_BigIntComputeExtendedGcd( + OUT TEE_BigInt *gcd, + OUT TEE_BigInt *u, + OUT TEE_BigInt *v, + IN TEE_BigInt *op1, + IN TEE_BigInt *op2); + +int32_t TEE_EXPORT TEE_BigIntIsProbablePrime( + IN TEE_BigInt *op, + uint32_t confidenceLevel); + +void TEE_EXPORT TEE_BigIntConvertToFMM( + OUT TEE_BigIntFMM *dest, + IN TEE_BigInt *src, + IN TEE_BigInt *n, + IN TEE_BigIntFMMContext *context); + +void TEE_EXPORT TEE_BigIntConvertFromFMM( + OUT TEE_BigInt *dest, + IN TEE_BigIntFMM *src, + IN TEE_BigInt *n, + IN TEE_BigIntFMMContext *context); + +void TEE_EXPORT TEE_BigIntComputeFMM( + OUT TEE_BigIntFMM *dest, + IN TEE_BigIntFMM *op1, + IN TEE_BigIntFMM *op2, + IN TEE_BigInt *n, + IN TEE_BigIntFMMContext *context); + + /*------------------------------------------------------------------------------ + Cryptographic Operations API + ------------------------------------------------------------------------------*/ + + /*------------------------------------------------------------------------------ + Generic Operations Functions + ------------------------------------------------------------------------------*/ +TEE_Result TEE_EXPORT TEE_AllocateOperation(TEE_OperationHandle* operation, + uint32_t algorithm, + uint32_t mode, + uint32_t maxKeySize); + +void TEE_EXPORT TEE_FreeOperation(TEE_OperationHandle operation); + +void TEE_EXPORT TEE_GetOperationInfo(TEE_OperationHandle operation, + TEE_OperationInfo* operationInfo); + + +void TEE_EXPORT TEE_ResetOperation(TEE_OperationHandle operation); + +TEE_Result TEE_EXPORT TEE_SetOperationKey(TEE_OperationHandle operation, + TEE_ObjectHandle key); + +TEE_Result TEE_EXPORT TEE_SetOperationKey2(TEE_OperationHandle operation, + TEE_ObjectHandle key1, + TEE_ObjectHandle key2); + +void TEE_EXPORT TEE_CopyOperation(TEE_OperationHandle dstOperation, + TEE_OperationHandle srcOperation); + + +/* Message Digest Functions */ +void TEE_EXPORT TEE_DigestUpdate(TEE_OperationHandle operation, + void* chunk, + size_t chunkSize); + +TEE_Result TEE_EXPORT TEE_DigestDoFinal(TEE_OperationHandle operation, + void* chunk, + size_t chunkLen, + void* hash, + size_t* hashLen); + +/* Symmetric Cipher Functions */ +void TEE_EXPORT TEE_CipherInit(TEE_OperationHandle operation, + void* IV, + size_t IVLen); + +TEE_Result TEE_EXPORT TEE_CipherUpdate(TEE_OperationHandle operation, + void* srcData, + size_t srcLen, + void* destData, + size_t* destLen); + +TEE_Result TEE_EXPORT TEE_CipherDoFinal(TEE_OperationHandle operation, + void* srcData, + size_t srcLen, + void* destData, + size_t* destLen); + +/*---------------------------------------------------------------------------- + MAC Functions +-----------------------------------------------------------------------------*/ +void TEE_EXPORT TEE_MACInit(TEE_OperationHandle operation, + void* IV, + size_t IVLen); + +void TEE_EXPORT TEE_MACUpdate(TEE_OperationHandle operation, + void* chunk, + size_t chunkSize); + +TEE_Result TEE_EXPORT TEE_MACComputeFinal(TEE_OperationHandle operation, + void* message, + size_t messageLen, + void* mac, + size_t* macLen); + +TEE_Result TEE_EXPORT TEE_MACCompareFinal(TEE_OperationHandle operation, + void* message, + size_t messageLen, + void* mac, + size_t macLen); + +/*---------------------------------------------------------------------------- + Authenticated Encryption Functions ---------------------------------------- + ---------------------------------------------------------------------------*/ +TEE_Result TEE_EXPORT TEE_AEInit(TEE_OperationHandle operation, + void* nonce, + size_t nonceLen, + uint32_t tagLen, + uint32_t AADLen, + uint32_t payloadLen); + +void TEE_EXPORT TEE_AEUpdateAAD(TEE_OperationHandle operation, + void* AADdata, + size_t AADdataLen); + +TEE_Result TEE_EXPORT TEE_AEUpdate(TEE_OperationHandle operation, + void* srcData, + size_t srcLen, + void* destData, + size_t* destLen); + + TEE_Result TEE_EXPORT TEE_AEEncryptFinal(TEE_OperationHandle operation, + void* srcData, + size_t srcLen, + void* destData, + size_t* destLen, + void* tag, + size_t* tagLen); + +TEE_Result TEE_EXPORT TEE_AEDecryptFinal(TEE_OperationHandle operation, + void* srcData, + size_t srcLen, + void* destData, + size_t* destLen, + void* tag, + size_t tagLen); + +/*----------------------------------------------------------------------------- + Asymmetric Functions +-----------------------------------------------------------------------------*/ +TEE_Result TEE_EXPORT TEE_AsymmetricEncrypt(TEE_OperationHandle operation, + TEE_Attribute* params, + uint32_t paramCount, + void* srcData, + size_t srcLen, + void* destData, + size_t* destLen); + +TEE_Result TEE_EXPORT TEE_AsymmetricDecrypt(TEE_OperationHandle operation, + TEE_Attribute* params, + uint32_t paramCount, + void* srcData, + size_t srcLen, + void* destData, + size_t* destLen); + +TEE_Result TEE_EXPORT TEE_AsymmetricSignDigest(TEE_OperationHandle operation, + TEE_Attribute* params, + uint32_t paramCount, + void* digest, + size_t digestLen, + void* signature, + size_t* signatureLen); + +TEE_Result TEE_EXPORT TEE_AsymmetricVerifyDigest(TEE_OperationHandle operation, + TEE_Attribute* params, + uint32_t paramCount, + void* digest, + size_t digestLen, + void* signature, + size_t signatureLen); + +/*----------------------------------------------------------------------------- + Key Derivation Functions +-----------------------------------------------------------------------------*/ +void TEE_EXPORT TEE_DeriveKey(TEE_OperationHandle operation, + TEE_Attribute* params, + uint32_t paramCount, + TEE_ObjectHandle derivedKey); + + +/*----------------------------------------------------------------------------- + Random Data Generation Function +-----------------------------------------------------------------------------*/ +void TEE_EXPORT TEE_GenerateRandom(void* randomBuffer, + size_t randomBufferLen); + + +/*------------------------------------------------------------------------------ + Trusted Storage Functions +------------------------------------------------------------------------------*/ + +/* Generic Object Functions */ +void TEE_EXPORT TEE_GetObjectInfo(TEE_ObjectHandle object, + TEE_ObjectInfo* objectInfo); + +void TEE_EXPORT TEE_RestrictObjectUsage(TEE_ObjectHandle object, + uint32_t objectUsage); + +TEE_Result TEE_EXPORT TEE_GetObjectBufferAttribute(TEE_ObjectHandle object, + uint32_t attributeID, + void* buffer, + size_t* size); + +TEE_Result TEE_EXPORT TEE_GetObjectValueAttribute(TEE_ObjectHandle object, + uint32_t attributeID, + uint32_t* a, + uint32_t* b); + +void TEE_EXPORT TEE_CloseObject(TEE_ObjectHandle object); + +/* Transient Object Functions */ +TEE_Result TEE_EXPORT TEE_AllocateTransientObject(uint32_t objectType, + uint32_t maxObjectSize, + TEE_ObjectHandle* object); + +void TEE_EXPORT TEE_FreeTransientObject(TEE_ObjectHandle object); + +void TEE_EXPORT TEE_ResetTransientObject(TEE_ObjectHandle object); + +TEE_Result TEE_EXPORT TEE_PopulateTransientObject(TEE_ObjectHandle object, + TEE_Attribute* attrs, + uint32_t attrCount); + +void TEE_EXPORT TEE_InitRefAttribute(TEE_Attribute* attr, + uint32_t attributeID, + void* buffer, + size_t length); + +void TEE_EXPORT TEE_InitValueAttribute(TEE_Attribute* attr, + uint32_t attributeID, + uint32_t a, + uint32_t b); + +void TEE_EXPORT TEE_CopyObjectAttributes(TEE_ObjectHandle destObject, + TEE_ObjectHandle srcObject); + +TEE_Result TEE_EXPORT TEE_GenerateKey(TEE_ObjectHandle object, + uint32_t keySize, + TEE_Attribute* params, + uint32_t paramCount); + +/* Persistant Object Functions */ +TEE_Result TEE_EXPORT TEE_CreatePersistentObject(uint32_t storageID, + void* objectID, + size_t objectIDLen, + uint32_t flags, + TEE_ObjectHandle attributes, + void* initialData, + size_t initialDataLen, + TEE_ObjectHandle* object); + +TEE_Result TEE_EXPORT TEE_OpenPersistentObject(uint32_t storageID, + void* objectID, + size_t objectIDLen, + uint32_t flags, + TEE_ObjectHandle* object); + +void TEE_EXPORT TEE_CloseAndDeletePersistentObject(TEE_ObjectHandle object); + +TEE_Result TEE_EXPORT TEE_RenamePersistentObject(TEE_ObjectHandle object, + void* newObjectID, + size_t newObjectIDLen); + +TEE_Result TEE_EXPORT TEE_AllocatePersistentObjectEnumerator(TEE_ObjectEnumHandle* objectEnumerator); + +void TEE_EXPORT TEE_FreePersistentObjectEnumerator(TEE_ObjectEnumHandle objectEnumerator); + +void TEE_EXPORT TEE_ResetPersistentObjectEnumerator(TEE_ObjectEnumHandle objectEnumerator); + +TEE_Result TEE_EXPORT TEE_StartPersistentObjectEnumerator(TEE_ObjectEnumHandle objectEnumerator, + uint32_t storageID); + +TEE_Result TEE_EXPORT TEE_GetNextPersistentObject(TEE_ObjectEnumHandle objectEnumerator, + TEE_ObjectInfo* objectInfo, + void* objectID, + size_t* objectIDLen); + +TEE_Result TEE_EXPORT TEE_ReadObjectData(TEE_ObjectHandle object, + void* buffer, + size_t size, + uint32_t* count); + +TEE_Result TEE_EXPORT TEE_WriteObjectData(TEE_ObjectHandle object, + void* buffer, + size_t size); + +TEE_Result TEE_EXPORT TEE_TruncateObjectData(TEE_ObjectHandle object, + uint32_t size); + +TEE_Result TEE_EXPORT TEE_SeekObjectData(TEE_ObjectHandle object, + int32_t offset, + TEE_Whence whence); + +#endif /* __TEE_INTERNAL_API_H__ */ diff --git a/mobicore/common/DrSecureStorage/tlDriverApi.h b/mobicore/common/DrSecureStorage/tlDriverApi.h new file mode 100644 index 0000000000000000000000000000000000000000..6f420562ade335b2fd650a1df47f127609601765 --- /dev/null +++ b/mobicore/common/DrSecureStorage/tlDriverApi.h @@ -0,0 +1,96 @@ +/* + * Copyright (c) 2013 TRUSTONIC LIMITED + * All rights reserved + * + * The present software is the confidential and proprietary information of + * TRUSTONIC LIMITED. You shall not disclose the present software and shall + * use it only in accordance with the terms of the license agreement you + * entered into with TRUSTONIC LIMITED. This software may be subject to + * export or import laws in certain countries. + */ + +/** + * @file tlDriverApi.h + * @brief Contains trustlet API definitions + * + */ + +#ifndef __TLDRIVERAPI_H__ +#define __TLDRIVERAPI_H__ + +#include "tlStd.h" +#include "TlApi/TlApiError.h" + + +/** + * Open session to the driver with given data + * + * @return session id + */ +_TLAPI_EXTERN_C uint32_t tlApiOpenSession( void ); + + +/** + * Close session + * + * @param sid session id + * + * @return TLAPI_OK upon success or specific error + */ +_TLAPI_EXTERN_C tlApiResult_t tlApiCloseSession( uint32_t sid ); + + +/** + * Inits session data (sample data 01) + * + * @param length data length + * @param address data address + * + * @return TLAPI_OK upon success or specific error + */ +_TLAPI_EXTERN_C tlApiResult_t tlApiInitSampleData01( + uint32_t sid, + uint32_t length, + uint32_t address); + + +/** + * Inits session data (sample data 02) + * + * @param data + * + * @return TLAPI_OK upon success or specific error + */ +_TLAPI_EXTERN_C tlApiResult_t tlApiInitSampleData02( + uint32_t sid, + uint32_t data); + + +/** + * Executes command + * + * @param sid session id + * @param commandId command id + * + * @return TLAPI_OK upon success or specific error + */ +_TLAPI_EXTERN_C tlApiResult_t tlApiExecute( + uint32_t sid, + uint32_t commandId); + + +/** tlApi function to call driver via IPC. + * Sends a MSG_RQ message via IPC to a MobiCore driver. + * + * @param driverID The driver to send the IPC to. + * @param pMarParam MPointer to marshaling parameters to send to the driver. + * + * @return TLAPI_OK + * @return E_TLAPI_COM_ERROR in case of an IPC error. + */ +_TLAPI_EXTERN_C tlApiResult_t tlApi_callDriver( + uint32_t driver_ID, + void* pMarParam); + + +#endif // __TLDRIVERAPI_H__ diff --git a/mobicore/common/LogWrapper/Android.mk b/mobicore/common/LogWrapper/Android.mk new file mode 100644 index 0000000000000000000000000000000000000000..b869c2ba2213fc76b051cfd57ff81194cb974a05 --- /dev/null +++ b/mobicore/common/LogWrapper/Android.mk @@ -0,0 +1,15 @@ +# ============================================================================= +# +# MobiCore log wrapper to be included by Android components / products +# +# ============================================================================= + +# This is not a separate module. +# Only for inclusion by other modules. + +LOCAL_SHARED_LIBRARIES += liblog + +# Enable logging to logcat per default +LOCAL_CFLAGS += -DLOG_ANDROID + +LOCAL_C_INCLUDES += $(call my-dir) \ No newline at end of file diff --git a/mobicore/common/LogWrapper/log.h b/mobicore/common/LogWrapper/log.h new file mode 100644 index 0000000000000000000000000000000000000000..c297845350694c7a20c9ad2189a8ca90a0676651 --- /dev/null +++ b/mobicore/common/LogWrapper/log.h @@ -0,0 +1,235 @@ +/** Log wrapper for Android. + * @{ + * @file + * + * Maps LOG_*() macros to __android_log_print() if LOG_ANDROID is defined. + * Adds some extra info to log output like LOG_TAG, file name and line number. + * + * + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. The name of the author may not be used to endorse or promote + * products derived from this software without specific prior + * written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS + * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +#ifndef TLCWRAPPERANDROIDLOG_H_ +#define TLCWRAPPERANDROIDLOG_H_ + +#ifndef WIN32 +#include +#define GETPID getpid +#else +#include +#define GETPID _getpid +#endif +#include +#ifndef WIN32 +#include +#endif + +/** LOG_I(fmt, args...) + * Informative logging, only shown in debug version + */ + +/** LOG_W(fmt, args...) + * Warnings logging, only shown in debug version + */ + +/** LOG_E(fmt, args...) + * Error logging, shown in debug and release version + */ + +/** LOG_V(fmt, args...) + * Verbose logging, shown in debug version if the including file defines LOG_VERBOSE + */ + +/** LOG_I_BUF(szDescriptor, blob, sizeOfBlob) + * Binary logging, line-wise output to LOG_I + */ + +#define EOL "\n" +#define DUMMY_FUNCTION() do{}while(0) + +#ifdef LOG_ANDROID +// log to adb logcat +#ifdef NDEBUG // no logging in debug version + #define LOG_I(fmt, args...) DUMMY_FUNCTION() + #define LOG_W(fmt, args...) DUMMY_FUNCTION() +#else + // add LINE + #define LOG_I(fmt, args...) LOG_i(fmt";%d", ## args, __LINE__) + #define LOG_W(fmt, args...) LOG_w(fmt";%d", ## args, __LINE__) +#endif + // LOG_E is always defined + #define _LOG_E(fmt, args...) LOG_e(fmt, ## args) + + // actually mapping to log system, adding level and tag. + #define LOG_i(...) __android_log_print(ANDROID_LOG_INFO, LOG_TAG, __VA_ARGS__) + #define LOG_w(...) __android_log_print(ANDROID_LOG_WARN, LOG_TAG, __VA_ARGS__) + #define LOG_e(...) __android_log_print(ANDROID_LOG_ERROR, LOG_TAG, __VA_ARGS__) + +#else //!defined(LOG_ANDROID) +// log to std.out using printf + + // #level / #LOG_TAG ( process_id): __VA_ARGS__ + // Example: + // I/McDrvBasicTest_0_1( 4075): setUp + #define _LOG_x(_x_,...) \ + do \ + { \ + printf("%s/%s(%d): ",_x_,LOG_TAG,GETPID()); \ + printf(__VA_ARGS__); \ + printf(EOL); \ + } while(1!=1) + + +#ifdef NDEBUG // no logging in debug version + #define LOG_I(fmt, ...) DUMMY_FUNCTION() + #define LOG_W(fmt, ...) DUMMY_FUNCTION() +#else + #define LOG_I(...) _LOG_x("I",__VA_ARGS__) + #define LOG_W(...) _LOG_x("W",__VA_ARGS__) +#endif + #define _LOG_E(...) _LOG_x("E",__VA_ARGS__) + + #define LOG_i(...) printf(__VA_ARGS__) + #define LOG_w(...) printf(__VA_ARGS__) + #define LOG_e(...) printf(__VA_ARGS__) + +#endif //defined(LOG_ANDROID) + +#if defined(LOG_VERBOSE) +#define LOG_V LOG_I +#else +#define LOG_V(...) DUMMY_FUNCTION() +#endif + +/** LOG_E() needs to be more prominent: + * Display "*********** ERROR ***********" before actual error message. + */ +#define LOG_E(...) \ + do \ + { \ + _LOG_E(" *****************************"); \ + _LOG_E(" *** ERROR: " __VA_ARGS__); \ + _LOG_E(" *** Detected in %s/%u()", __FUNCTION__, __LINE__); \ + _LOG_E(" *****************************"); \ + } while(1!=1) + +#define LOG_ERRNO(MESSAGE) \ + LOG_E("%s failed with \"%s\"(errno %i)", MESSAGE, strerror(errno), errno); + +#define LOG_I_BUF LOG_I_Buf + +#ifndef WIN32 +__attribute__ ((unused)) +#endif +static void LOG_I_Buf( + const char * szDescriptor, + const void * blob, + size_t sizeOfBlob +) { + + #define CPL 0x10 // chars per line + #define OVERHEAD 20 + + char buffer[CPL * 4 + OVERHEAD]; + + uint32_t index = 0; + + uint32_t moreThanOneLine = (sizeOfBlob > CPL); + uint32_t blockLen = CPL; + uint32_t addr = 0; + uint32_t i = 0; + + if (NULL != szDescriptor) + { + index += sprintf(&buffer[index], "%s", szDescriptor); + } + + if (moreThanOneLine) + { + if (NULL == szDescriptor) + { + index += sprintf(&buffer[index], "memory dump"); + } + index += sprintf(&buffer[index], " (0x%08x, %d bytes)", (uint32_t)blob,sizeOfBlob); + LOG_I("%s", buffer); + index = 0; + } + else if (NULL == szDescriptor) + { + index += sprintf(&buffer[index], "Data at 0x%08x: ", (uint32_t)blob); + } + + if(sizeOfBlob == 0) { + LOG_I("%s", buffer); + } + else + { + while (sizeOfBlob > 0) + { + if (sizeOfBlob < blockLen) + { + blockLen = sizeOfBlob; + } + + // address + if (moreThanOneLine) + { + index += sprintf(&buffer[index], "0x%08X | ",addr); + addr += CPL; + } + // bytes as hex + for (i=0; i32)?c:'.'); + } + + blob = &(((const char *)blob)[blockLen]); + sizeOfBlob -= blockLen; + + // print line to logcat / stdout + LOG_I("%s", buffer); + index = 0; + } + } +} + +#endif /** TLCWRAPPERANDROIDLOG_H_ */ + +/** @} */ diff --git a/mobicore/common/MobiCore/inc/DrApi/DrApi.h b/mobicore/common/MobiCore/inc/DrApi/DrApi.h new file mode 100644 index 0000000000000000000000000000000000000000..9ae1187736840756ecd26c8895ebc4acd38f96c4 --- /dev/null +++ b/mobicore/common/MobiCore/inc/DrApi/DrApi.h @@ -0,0 +1,28 @@ +/* + * Copyright (c) 2013 TRUSTONIC LIMITED + * All rights reserved + * + * The present software is the confidential and proprietary information of + * TRUSTONIC LIMITED. You shall not disclose the present software and shall + * use it only in accordance with the terms of the license agreement you + * entered into with TRUSTONIC LIMITED. This software may be subject to + * export or import laws in certain countries. + */ + +#ifndef __DRAPI_H__ +#define __DRAPI_H__ + +#if defined(DRIVER) +#include "drStd.h" +#endif +#include "DrApi/version.h" +#include "DrApi/DrApiError.h" +#include "DrApi/DrApiMcSystem.h" +#include "DrApi/DrApiMm.h" +#include "DrApi/DrApiThread.h" +#include "DrApi/DrApiLogging.h" +#include "DrApi/DrApiHeap.h" +#include "DrApi/DrApiFastCall.h" +#include "DrApi/DrApiTime.h" + +#endif // __DRAPI_H__ diff --git a/mobicore/common/MobiCore/inc/DrApi/DrApiCommon.h b/mobicore/common/MobiCore/inc/DrApi/DrApiCommon.h new file mode 100644 index 0000000000000000000000000000000000000000..973d86d699ffa97d0bd049f2218e7a9afa5c5ed7 --- /dev/null +++ b/mobicore/common/MobiCore/inc/DrApi/DrApiCommon.h @@ -0,0 +1,84 @@ +/* + * Copyright (c) 2013 TRUSTONIC LIMITED + * All rights reserved + * + * The present software is the confidential and proprietary information of + * TRUSTONIC LIMITED. You shall not disclose the present software and shall + * use it only in accordance with the terms of the license agreement you + * entered into with TRUSTONIC LIMITED. This software may be subject to + * export or import laws in certain countries. + */ + +#ifndef __DRAPICOMMON_H__ +#define __DRAPICOMMON_H__ + +#include "DrApi/DrApiError.h" + +#ifdef __cplusplus +extern "C" { +#endif + +//------------------------------------------------------------------------------ +/** Definitions */ + +#define SHIFT_4KB (12U) /**< SIZE_4KB is 1 << SHIFT_4KB aka. 2^SHIFT_4KB. */ +#define SIZE_4KB (1 << SHIFT_4KB) /**< Size of 1 KiB. */ +typedef uint8_t page4KB_t[SIZE_4KB]; /**< 4 KiB page. */ +typedef page4KB_t *page4KB_ptr; /**< pointer to 4 KiB page. */ + +#define PTR2VAL(p) ((uintptr_t)(p)) +#define VAL2PTR(v) ((addr_t)(v)) +#define FUNC_PTR(func) VAL2PTR( PTR2VAL( func ) ) + +//Stack types +typedef uint32_t stackEntry_t; +typedef stackEntry_t *stackEntry_ptr; +typedef stackEntry_ptr stackTop_ptr; + +//============================================================================== +//Common integer types +typedef unsigned int u32_t; +typedef unsigned short u16_t; +typedef unsigned char u08_t; +typedef u32_t word_t; + +//Common result type +typedef word_t drApiResult_t; + +//MTK types +typedef word_t taskid_t, *taskid_ptr; /**< task id data type. */ +typedef word_t threadno_t, *threadno_ptr; /**< thread no. data type. */ +typedef word_t threadid_t, *threadid_ptr; /**< thread id data type. */ + + +// interrupt mode flags. The design of the bits is that most common setting +// RISING, EDGE, PERIODIC maps to the value the value 0. Not all mode +// combinations may be available for each interrupt. +#define INTR_MODE_MASK_TRIGGER (1U<<0) +#define INTR_MODE_TRIGGER_LEVEL INTR_MODE_MASK_TRIGGER +#define INTR_MODE_TRIGGER_EDGE 0 +#define INTR_MODE_MASK_CONDITION (1U<<1) +#define INTR_MODE_CONDITION_FALLING INTR_MODE_MASK_CONDITION +#define INTR_MODE_CONDITION_LOW INTR_MODE_MASK_CONDITION +#define INTR_MODE_CONDITION_RISING 0 +#define INTR_MODE_CONDITION_HIGH 0 +#define INTR_MODE_MASK_OCCURANCE (1U<<2) +#define INTR_MODE_OCCURANCE_ONESHOT INTR_MODE_MASK_OCCURANCE +#define INTR_MODE_OCCURANCE_PERIODIC 0 + +// convenience constants +#define INTR_MODE_RAISING_EDGE (INTR_MODE_TRIGGER_EDGE | INTR_MODE_CONDITION_RISING) +#define INTR_MODE_FALLING_EDGE (INTR_MODE_TRIGGER_EDGE | INTR_MODE_CONDITION_FALLING) +#define INTR_MODE_LOW_LEVEL (INTR_MODE_TRIGGER_LEVEL | INTR_MODE_CONDITION_LOW) +#define INTR_MODE_HIGH_LEVEL (INTR_MODE_TRIGGER_LEVEL | INTR_MODE_CONDITION_HIGH) + +//Interrupt types +typedef word_t intrNo_t, *intrNo_ptr; /**< interrupt number. */ +typedef word_t intrMode_t, *intrMode_ptr; /**< interrupt mode. */ + +#ifdef __cplusplus +} +#endif + +#endif //__DRAPICOMMON_H__ + diff --git a/mobicore/common/MobiCore/inc/DrApi/DrApiError.h b/mobicore/common/MobiCore/inc/DrApi/DrApiError.h new file mode 100644 index 0000000000000000000000000000000000000000..fbac0b1808eb441599586e0d039edc7b69cfa303 --- /dev/null +++ b/mobicore/common/MobiCore/inc/DrApi/DrApiError.h @@ -0,0 +1,67 @@ +/* + * Copyright (c) 2013 TRUSTONIC LIMITED + * All rights reserved + * + * The present software is the confidential and proprietary information of + * TRUSTONIC LIMITED. You shall not disclose the present software and shall + * use it only in accordance with the terms of the license agreement you + * entered into with TRUSTONIC LIMITED. This software may be subject to + * export or import laws in certain countries. + */ + +#ifndef __DRAPIERROR_H__ +#define __DRAPIERROR_H__ + +/* + * DRAPI error codes. + * MAJOR part of error code is stable. + * MAJOR part may be used in testing for specific error code. + * + * Detail error codes may change in different releases + * Please do not test DETAIL part when comparing error codes. + */ +#define DRAPI_ERROR_MAJOR(ecode) ((ecode) & 0xFFF) /**< Get MAJOR part of error code. */ +#define DRAPI_ERROR_MAJOR_CODE(ecode) ((ecode) & 0xFF) /**< Get MAJOR_CODE part of error code. */ +#define DRAPI_ERROR_MAJOR_COMPONENT(ecode) (((ecode)>>8) & 0xF) /**< Get MAJOR_COMPONENT part of error code. */ + +#define DRAPI_ERROR_DETAIL(ecode) (((ecode)>>12) & 0xFFF) /**< Get detail part of error code. */ + +#define DRAPI_ERROR_CREATE(ecode, detail) (((ecode)&0xFFF)|((detail&0xFFF)<<12)) /**< Create error code */ + +//============================================================================== +// Error code defintitions + +#define DRAPI_OK 0x0 /**< Returns on successful execution of a function. */ + +#define E_DRAPI_KERNEL_ERROR 0xF01 /**< Kernel returned error. */ +#define E_DRAPI_INVALID_PARAMETER 0xF02 /**< Invalid parameter. */ +#define E_DRAPI_NOT_PERMITTED 0xF03 /**< Permission error */ +#define E_DRAPI_IPC_ERROR 0xF04 /**< Error in IPC. */ +#define E_DRAPI_TASK_NOT_ACCEPTABLE 0xF05 /**< Task not acceptable for operation. */ +#define E_DRAPI_CANNOT_MAP 0xF06 /**< Cannot create mapping. */ +#define E_DRAPI_DRV_NO_SUCH_CLIENT 0xF07 /**< Client does not exist. */ +#define E_DRAPI_CANNOT_INIT 0xF08 /**< Cannot be initialized. */ +#define E_DRAPI_NOT_IMPLEMENTED 0xF09 /**< Function not yet implemented. */ + + +// Error codes inherited from MTK +#define E_OK 0 /**< no error. */ +#define E_INVALID 1 /**< invalid argument. */ +#define E_BADTASK 2 /**< current task does not own target task. */ +#define E_NOTACTIVATED 3 /**< task has not been activated. */ +#define E_NOTOWNER 4 /**< current task does not own specified task. */ +#define E_ACTIVATED 5 /**< task has been activated. */ +#define E_LIMIT 6 /**< limit broken. */ +#define E_NOABILITY 7 /**< no permission. */ +#define E_STARTED 8 /**< task or thread does have been started. */ +#define E_BADMAP 9 /**< invalid mapping. architecture specific error. */ +#define E_MAPPED 10 /**< mapping overlaps existing mapping. */ +#define E_NOTSTARTED 11 /**< thread has been started. */ +#define E_TIMEOUT 12 /**< timeout period expired. */ +#define E_ABORT 13 /**< operation aborted. */ +#define E_MSGTYPE 14 /**< message to send is not of the type the receiver is waiting for. */ +#define E_MSGLENGTH 15 /**< message to send exceeds message length the receiver is waiting for. */ + + +#endif // __DRAPIERROR_H__ + diff --git a/mobicore/common/MobiCore/inc/DrApi/DrApiFastCall.h b/mobicore/common/MobiCore/inc/DrApi/DrApiFastCall.h new file mode 100644 index 0000000000000000000000000000000000000000..6477fe3485a7c20cac39a9f1ace36eb0cf0cbac0 --- /dev/null +++ b/mobicore/common/MobiCore/inc/DrApi/DrApiFastCall.h @@ -0,0 +1,117 @@ +/* + * Copyright (c) 2013 TRUSTONIC LIMITED + * All rights reserved + * + * The present software is the confidential and proprietary information of + * TRUSTONIC LIMITED. You shall not disclose the present software and shall + * use it only in accordance with the terms of the license agreement you + * entered into with TRUSTONIC LIMITED. This software may be subject to + * export or import laws in certain countries. + */ + +#ifndef FASTCALL_H_ +#define FASTCALL_H_ + +/** Firmware Driver and Fastcall Handlers + * + * Mobicore can have one firmware driver. Such driver is loaded + * typically at boot, and cannot be unloaded. Firmware driver is + * intended to act as system integration means, and is not intended + * to act as typical peripheral driver. + * + * Fastcall handlers + * Firmware driver can register fastcall handler in some platforms. + * Fastcall handler is called for fastcalls unknown to Mobicore. + * + * Fastcall handlers get driver memory mappings in range of 0-2MB + * at the time handler is installed. Driver must not unmap any of + * these mappings. If new mappings are made, they cannot be relied + * to be visible in fastcall hook function. + * + * Fastcall handler may map sections (of size 1M). These mappings are not + * visible to driver. + * + * Fastcall handler gets access to number of registers at the time of + * fastcall was made in NWd. Actual number of registers depends on + * platform, but is always at least 4 (r0-r3). + * + * Notes on use of Fastcall handlers + * Fastcall handlers + * - cannot call any TlApi or DrApi functions. + * - cannot have synchronization with firmware driver. + * - do not have large stack. If stack is needed, switch to your own. + * - may be executed concurrently in all CPUs. + * - must not cause exceptions. There is no means to recover in case + * of exception. + * + */ + +#define FASTCALL_OWNER_TZOS (0xFF000000) +#define FASTCALL_OWNER_SIP (0x81000000) +#define FASTCALL_OWNER_OEM (0x83000000) +#define FASTCALL_OWNER_STD (0x84000000) + +#define FASTCALL_OWNER_MASK (0xFF000000) + +#define FCH_L1_MAX 12 + +typedef word_t *fastcall_registers_t; + +/** Context for FCs hook call + * + * This is (currently) shared between all processors + */ +struct fcContext { + word_t size; // Size of context + // Callback to modify L1 entry. + // idx is the address in MBytes of the entry to modify (starting at 8MB). + // (for example idx=2 will modify the entry for address 10MB) + // Return the virtual address corresponding to modified entry. + // Return NULL if there is an error. + // 64 bits version must be used to modify L1 table in LPAE mode. + void *(*setL1Entry)(struct fcContext *context, word_t idx, word_t entry); + word_t registers; // Number of registers available in fastcall + void (*prepareIdenticalMapping)(struct fcContext *context, addr_t start, word_t length, word_t flags); + void (*generateFcNotification)(struct fcContext *context); + void *(*setL1Entry64)(struct fcContext *context, word_t idx, uint64_t entry); +}; + +/* Fastcall handler initialization + * + * Called once before any fastcall. + * Can map memories for fastcall context. + * This function must never cause any exceptions. + * Call is executed in SVC mode. + * + * Return value + * 0 Successfull initialization. + * Other cancel hook installation + */ +typedef word_t (*fcInitHook)( + struct fcContext *context +); + + +/* Fastcall handler + * + * Executed possibly concurrently in all CPUs. + * This function must never cause any exceptions. + * Call is executed in IRQ mode. + * On Entry + * fastcall_regs_t[0]...fastcall_regs_t[15] contain input registers. + * On exit + * fastcall_regs_t[0]...fastcall_regs_t[N] contain r0...rN. + * If driver did not handle fastcall, registers must be unmodified. + * If driver handled fastcall registers r0...r3 may be modified. + * Registers beyond r3 must not be modified. Result of any + * modification is unpredictable. + * Return values + * Nonzero return value means that fastcall is handled. + */ +typedef word_t (*fcEntryHook)( + fastcall_registers_t *regs_t, + struct fcContext *context +); + + +#endif /* FASTCALL_H_ */ diff --git a/mobicore/common/MobiCore/inc/DrApi/DrApiHeap.h b/mobicore/common/MobiCore/inc/DrApi/DrApiHeap.h new file mode 100644 index 0000000000000000000000000000000000000000..8f93a2406dace0bcb13c89a902e64db74d991725 --- /dev/null +++ b/mobicore/common/MobiCore/inc/DrApi/DrApiHeap.h @@ -0,0 +1,78 @@ +/* + * Copyright (c) 2013 TRUSTONIC LIMITED + * All rights reserved + * + * The present software is the confidential and proprietary information of + * TRUSTONIC LIMITED. You shall not disclose the present software and shall + * use it only in accordance with the terms of the license agreement you + * entered into with TRUSTONIC LIMITED. This software may be subject to + * export or import laws in certain countries. + */ + +#ifndef __DRAPIHEAP_H__ +#define __DRAPIHEAP_H__ + +#if TBASE_API_LEVEL >= 3 + +#include "DrApi/DrApiCommon.h" +#include "DrApi/DrApiError.h" + +/** + * Allocates a block of memory from the heap. + * The address of the allocated block is aligned on a 8-bytes boundary. A block + * allocated by drApiMalloc must be freed by drApiFree. + * If the size of the space requested is zero, the value returned is still a + * non-NULL pointer that the Trusted Application must not attempt to access. + * + * @param size: [in] the number of bytes to be allocated. + * + * @param hint: [in] must be 0 + * + * @return Upon successful completion, with size not equal to zero, the + * function returns a pointer to the allocated space. + * Otherwise, a NULL pointer is returned. + **/ +_DRAPI_EXTERN_C void* drApiMalloc(uint32_t size, uint32_t hint); + +/** + * Reallocates a block of memory from a heap. + * This function allows resizing a memory block. + * If buffer is NULL, drApiRealloc is equivalent to drApiMalloc. + * If buffer is not NULL and newSize is 0, then drApiRealloc is equivalent to + * drApiFree and returns a non-NULL pointer that the Trusted Application must + * not attempt to access. + * If newSize is less or equal to the current size of the block, the block is + * truncated, the content of the block is left unchanged and the function + * returns buffer. + * If newSize is greater than the current size of the block, the size of the + * block is increased. The whole content of the block is copied at the beginning + * of the new block. If possible, the block is enlarged in place and the + * function returns buffer. If this is not possible, a new block is allocated + * with the new size, the content of the current block is copied, the current + * block is freed and the function returns the pointer on the new block. + * + * @param buffer: [in] Pointer to the block of memory that the function + * reallocates. + * This value may be null or returned by an earlier call + * to drApiMalloc or drApiRealloc. + * + * @param newSize: [in] size of the memory block in bytes. + * This value may be zero. + * + * @return A pointer to the reallocated memory block, a non-NULL pointer if the + * newSize is zero or NULL if an error is detected. + **/ +_DRAPI_EXTERN_C void* drApiRealloc(void* buffer, uint32_t newSize); + + +/** + * Frees a memory block allocated from a heap by drApiMalloc or drApiRealloc. + * This function does nothing if buffer is NULL. + * + * @param buffer: [in] Pointer to the block of memory to be freed. + **/ +_DRAPI_EXTERN_C void drApiFree(void* buffer); + +#endif /* TBASE_API_LEVEL */ + +#endif /* !defined(__DRAPIHEAP_H__) */ diff --git a/mobicore/common/MobiCore/inc/DrApi/DrApiIpcMsg.h b/mobicore/common/MobiCore/inc/DrApi/DrApiIpcMsg.h new file mode 100644 index 0000000000000000000000000000000000000000..410a6e30c188b9b5d257a4fd7eb6322ed2313da0 --- /dev/null +++ b/mobicore/common/MobiCore/inc/DrApi/DrApiIpcMsg.h @@ -0,0 +1,280 @@ +/* + * Copyright (c) 2013 TRUSTONIC LIMITED + * All rights reserved + * + * The present software is the confidential and proprietary information of + * TRUSTONIC LIMITED. You shall not disclose the present software and shall + * use it only in accordance with the terms of the license agreement you + * entered into with TRUSTONIC LIMITED. This software may be subject to + * export or import laws in certain countries. + */ +#ifndef __DRAPI_IPCMSG_H__ +#define __DRAPI_IPCMSG_H__ + +#include "DrApiCommon.h" + +#ifdef __cplusplus +extern "C" { +#endif + +//------------------------------------------------------------------------------ +/** Possible message types/event types of the system. */ +typedef enum { + MSG_NULL = 0, // Used for initializing state machines + MSG_RQ = 1, + // Client Request, blocks until MSG_RS is received + // Client -> Server + MSG_RS = 2, + // Driver Response, answer to MSG_RQ + // Server -> Client + MSG_RD = 3, + // Driver becomes ready + // Server -> IPCH + MSG_NOT = 4, + // Notification to NWd for a session, send-only message with no + // response + // client/server -> IPCH; + MSG_CLOSE_TRUSTLET = 5, + // Close Trustlet, must be answered by MSG_CLOSE_TRUSTLET_ACK + // MSH -> IPCH, IPCH -> Server + MSG_CLOSE_TRUSTLET_ACK = 6, + // Close Trustlet Ack, in response to MSG_CLOSE_TRUSTLET + // Server -> IPCH + MSG_MAP = 7, + // Map Client into Server, send-only message with no reponse + //Server -> IPCH; + MSG_ERR_NOT = 8, + // Error Notification + // EXCH/SIQH -> IPCH + MSG_CLOSE_DRIVER = 9, + // Close Driver, must be answered with MSG_CLOSE_DRIVER_ACK + // MSH -> IPCH, IPCH -> Driver/Server + MSG_CLOSE_DRIVER_ACK = 10, + // Close Driver Ack, response to MSG_CLOSE_DRIVER + // Driver/Server -> IPCH, IPCH -> MSH + MSG_GET_DRIVER_VERSION = 11, + // Get driver version, used for response also + // Client <-> IPCH + MSG_GET_DRAPI_VERSION = 12, + // Get DrApi version, used for response also + // Driver <-> IPCH */ + MSG_SET_NOTIFICATION_HANDLER = 13, + // Set (change) the SIQ handler thread, used for response also + // Driver <-> IPCH + MSG_GET_REGISTRY_ENTRY = 14, + // Get registry entry, available only if MC_FEATURE_DEBUG_SUPPORT is + // set, used for response also + // Driver <-> IPCH + MSG_DRV_NOT = 15, + // Notification to a Trustlet, looks like a notification from NWd for + // the Trustlet, send-only message with no response + // Driver -> Trustlet + MSG_SET_FASTCALL_HANDLER = 16, + // install a FastCall handler, used for response also + // Driver <-> IPCH + MSG_GET_CLIENT_ROOT_AND_SP_ID = 17, + // get Root DI and SP ID, used for response also + // Driver <-> IPCH + MSG_SUSPEND = 18, + // Suspend, requires MSG_SUSPEND_ACK as response + // MSH -> IPCH, IPCH -> driver + MSG_SUSPEND_ACK = 19, + // Suspend Ack, response to MSG_SUSPEND + // driver -> IPCH, IPCH -> MSH + MSG_RESUME = 20, + // resume, , requires MSG_RESUME_ACK as response + // MSH -> IPCH, IPCH -> driver + MSG_RESUME_ACK = 21, + // resume, , response to MSG_RESUME + // driver -> IPCH, IPCH -> MSH + MSG_GET_ENDORSEMENT_SO = 22, + // get SO from RTM for the Endorsement functionality + // Driver <-> IPCH + MSG_GET_SERVICE_VERSION = 23, + // get version of service (TA) + // Driver <-> IPCH + MSG_ERROR = 24, + // IPCH returns error to Driver + // IPCH <-> DRIVER + MSG_CALL_FASTCALL = 25, + // Call fastcall from driver + // DRIVER -> IPCH -> MTK -> FASTCALL -> return +} message_t; + + +//------------------------------------------------------------------------------ +/** Waits with infinite timeout for IPC. + * + * @param ipcPartner IPC partner to signal. + * @param pMr0 IPC register 0. + * @param pMr1 IPC register 1. + * @param pMr2 IPC register 2. + * + * @returns DRAPI_OK in case of success + * @returns any combination of DRAPI_ERROR_CREATE(Driver specific error code, MTK error code) + */ +drApiResult_t drApiIpcWaitForMessage( + threadid_t *pIpcPartner, + uint32_t *pMr0, + uint32_t *pMr1, + uint32_t *pMr2 +); + +//------------------------------------------------------------------------------ +/** + * Send ready message or answer to IPCH and waits for a client request + * + * @param ipcPeer Destination to send message to. + * @param ipcMsg IPC message. + * @param ipcData Additional IPC data. + * + * @returns DRAPI_OK in case of success + * @returns any combination of DRAPI_ERROR_CREATE(Driver specific error code, MTK error code) + */ +drApiResult_t drApiIpcCallToIPCH( + threadid_t *pIpcPeer, + message_t *pIpcMsg, + uint32_t *pIpcData +); + +//------------------------------------------------------------------------------ +/** Sets signal. + * The signal (SIGNAL) is used by a thread to inform another thread about an event. + * The signal operation is asynchronous, which means that the operation will return + * immediately without blocking the user. Function uses auto-clear signals, meaning that + * the signal is cleared automatically when the receiver receives it. + * + * It is up to the destination of the signal to pick up and process the information. + * + * @param receiver Thread to set the signal for. + * + * @returns DRAPI_OK in case of success + * @returns any combination of DRAPI_ERROR_CREATE(Driver specific error code, MTK error code) + */ +drApiResult_t drApiIpcSignal( + const threadid_t receiver +); + +//------------------------------------------------------------------------------ +/** Signal wait operation. + * A thread uses the sigWait operation to check if a signal has occurred. If no signal is + * pending the thread will block until a signal arrives. + * + * @returns DRAPI_OK in case of success + * @returns any combination of DRAPI_ERROR_CREATE(Driver specific error code, MTK error code) + */ +drApiResult_t drApiIpcSigWait( void ); + +//------------------------------------------------------------------------------ +/** Notify NWd driver + * + * @returns DRAPI_OK in case of success + * @returns any combination of DRAPI_ERROR_CREATE(Driver specific error code, MTK error code) + */ +drApiResult_t drApiNotify( void ); + + +//------------------------------------------------------------------------------ +/** + * Makes control syscall with given parameters + * + * @param controlid control id + * @param param1 parameter 1 + * @param param2 parameter 2 + * @param param3 parameter 3 + * @param param4 parameter 4 + * @param *data set by control syscall + * + * @returns DRAPI_OK in case of success + * @returns any combination of DRAPI_ERROR_CREATE(Driver specific error code, MTK error code) + */ +drApiResult_t drApiSyscallControl( + uint32_t controlid, + uint32_t param1, + uint32_t param2, + uint32_t param3, + uint32_t param4, + uint32_t *data +); + + +//------------------------------------------------------------------------------ +/** Reads OEM data starting from given offset + * + * @param offset data offset + * @param data set by control syscall + * + * @returns DRAPI_OK in case of success + * @returns any combination of DRAPI_ERROR_CREATE(Driver specific error code, MTK error code) + */ +drApiResult_t drApiReadOemData( + const uint32_t offset, + uint32_t *data +); + +//------------------------------------------------------------------------------ +/** Sends notification to client + * + * @param client Client's thread id + * * + * @return MTK return code + */ +drApiResult_t drApiNotifyClient( + const threadid_t client +); + +//------------------------------------------------------------------------------ +/** Returns ID of Root and Service Provider ID of the specified client + * + * @param rootId ID of Root + * @param spId Service Provider ID + * @param client Thread ID + * + * @returns DRAPI_OK in case of success + * @returns any combination of DRAPI_ERROR_CREATE(Driver specific error code, MTK error code) + */ +drApiResult_t drApiGetClientRootAndSpId( + uint32_t *rootId, + uint32_t *spId, + const threadid_t client +); + + +//------------------------------------------------------------------------------ +/** + * Handles unknown messages + * This function has to be called by Driver if it receives a message it doesn’t recognize + * + * @param ipcPeer Sender of message. + * @param ipcMsg IPC message. + * @param ipcData Additional IPC data. + * + * @returns DRAPI_OK in case of success + * @returns any combination of DRAPI_ERROR_CREATE(Driver specific error code, MTK error code) + */ +drApiResult_t drApiIpcUnknownMessage( + threadid_t *pIpcPeer, + message_t *pIpcMsg, + uint32_t *pIpcData +); + +//------------------------------------------------------------------------------ +#if TBASE_API_LEVEL >= 3 +/** + * Makes request to t-base to update notification thread + * + * @param threadNo Number of the new notification thread. + * + * @retval DRAPI_OK or relevant error code. + */ +drApiResult_t drApiUpdateNotificationThread( + threadno_t threadno +); +#endif /* TBASE_API_LEVEL */ + +#ifdef __cplusplus +} +#endif + +#endif /** __DRAPI_IPCMSG_H__ */ + diff --git a/mobicore/common/MobiCore/inc/DrApi/DrApiLogging.h b/mobicore/common/MobiCore/inc/DrApi/DrApiLogging.h new file mode 100644 index 0000000000000000000000000000000000000000..8e59d5be7d4415d9e3644abde3e9a8a17a5a664b --- /dev/null +++ b/mobicore/common/MobiCore/inc/DrApi/DrApiLogging.h @@ -0,0 +1,71 @@ +/* + * Copyright (c) 2013 TRUSTONIC LIMITED + * All rights reserved + * + * The present software is the confidential and proprietary information of + * TRUSTONIC LIMITED. You shall not disclose the present software and shall + * use it only in accordance with the terms of the license agreement you + * entered into with TRUSTONIC LIMITED. This software may be subject to + * export or import laws in certain countries. + */ + +#ifndef __DRAPILOGGING_H__ +#define __DRAPILOGGING_H__ + +#include "DrApi/DrApiCommon.h" +#include "DrApi/DrApiError.h" + +/** Formatted logging functions. + * + * drApiLogvPrintf, drApiLogPrintf + * + * Minimal printf-like function to print logging message to NWd log. + * + * Supported formatters: + * %s String, NULL value emit "". + * %x %X hex + * %p pointer (hex with fixed width of 8) + * %d %i signed decimal + * %u unsigned decimal + * %t timestamp (if available in platform). NOTE: This does not consume any value in parameter list. + * %% outputs single % + * + * %s, %x, %d, and %u support width (example %5s). Width is interpreted as minimum number of characters. + * Hex number is left padded using '0' to desired width. + * Decimal number is left padded using ' ' to desired width. + * String is right padded to desired length. + * + * Newline is used to terminate logging line. + * + * @param fmt Formatter + * @param args Argument list. + */ +_DRAPI_EXTERN_C void drApiLogvPrintf( + const char *fmt, + va_list args); + +_DRAPI_EXTERN_C void drApiLogPrintf( + const char *fmt, + ...); + +#if defined(__INCLUDE_DEBUG) + + #define drDbgPrintf(...) drApiLogPrintf(__VA_ARGS__) + #define drDbgvPrintf(...) drApiLogvPrintf(__VA_ARGS__) + +#else + + #define drDbgPrintf(...) DUMMY_FUNCTION() + #define drDbgvPrintf(...) DUMMY_FUNCTION() + +#endif // __INCLUDE_DEBUG + +#ifndef EOL + #define EOL "\n" +#endif + +#define drDbgPrintLnf(...) do{drDbgPrintf(__VA_ARGS__);dbgS(EOL);}while(FALSE) + + +#endif // __DRAPILOGGING_H__ + diff --git a/mobicore/common/MobiCore/inc/DrApi/DrApiMcSystem.h b/mobicore/common/MobiCore/inc/DrApi/DrApiMcSystem.h new file mode 100644 index 0000000000000000000000000000000000000000..d9a4f042a94b09edaa810a2da0a44452848479f5 --- /dev/null +++ b/mobicore/common/MobiCore/inc/DrApi/DrApiMcSystem.h @@ -0,0 +1,49 @@ +/* + * Copyright (c) 2013 TRUSTONIC LIMITED + * All rights reserved + * + * The present software is the confidential and proprietary information of + * TRUSTONIC LIMITED. You shall not disclose the present software and shall + * use it only in accordance with the terms of the license agreement you + * entered into with TRUSTONIC LIMITED. This software may be subject to + * export or import laws in certain countries. + */ + +#ifndef __DRAPIMCSYSTEM_H__ +#define __DRAPIMCSYSTEM_H__ + +#include "DrApiCommon.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/** Get information about the implementation of the MobiCore Driver API version. + * + * @param drApiVersion pointer to Driver Api version. + * @returns DRAPI_OK if version has been set + * @returns any combination of DRAPI_ERROR_CREATE(Driver specific error code, MTK error code) + */ +_DRAPI_EXTERN_C drApiResult_t drApiGetVersion( + uint32_t *drApiVersion); + +/** Install fastcall handler + * + * @param entryTable pointer to entry table. + * @param fastcallId fastcall ID. + * @returns DRAPI_OK if version has been set + * @returns any combination of DRAPI_ERROR_CREATE(Driver specific error code, MTK error code) + */ +_DRAPI_EXTERN_C drApiResult_t drApiInstallFc( + void *entryTable, uint32_t fastcallId); + + +_DRAPI_EXTERN_C drApiResult_t drApiFastCall( + uint32_t *fastcall_registers, + uint32_t size); +#ifdef __cplusplus +} +#endif + +#endif // __DRAPIMCSYSTEM_H__ + diff --git a/mobicore/common/MobiCore/inc/DrApi/DrApiMm.h b/mobicore/common/MobiCore/inc/DrApi/DrApiMm.h new file mode 100644 index 0000000000000000000000000000000000000000..0ccd991f925bb59108ef73f78487022c6206c64f --- /dev/null +++ b/mobicore/common/MobiCore/inc/DrApi/DrApiMm.h @@ -0,0 +1,305 @@ +/* + * Copyright (c) 2013 TRUSTONIC LIMITED + * All rights reserved + * + * The present software is the confidential and proprietary information of + * TRUSTONIC LIMITED. You shall not disclose the present software and shall + * use it only in accordance with the terms of the license agreement you + * entered into with TRUSTONIC LIMITED. This software may be subject to + * export or import laws in certain countries. + */ + +#ifndef __DRAPIMM_H__ +#define __DRAPIMM_H__ + +#include "DrApiCommon.h" + +#ifdef __cplusplus +extern "C" { +#endif + +//------------------------------------------------------------------------------ +/** Definitions */ + +/** Memory mapping attributes. */ +#define MAP_READABLE (1U << 0) /**< mapping gives have the ability to do read access. */ +#define MAP_WRITABLE (1U << 1) /**< mapping gives have the ability to do write access. */ +#define MAP_EXECUTABLE (1U << 2) /**< mapping gives have the ability to do program execution. */ +#define MAP_UNCACHED (1U << 3) /**< mapping gives have uncached memory access. */ +#define MAP_IO (1U << 4) /**< mapping gives have memory mapped I/O access. Will ignore MAP_UNCACHED, as this would be implied anyway. */ + +//------------------------------------------------------------------------------ +/** Maximum number of parameter . */ +#define MAX_MAR_LIST_LENGTH 8 /**< Maximum list of possible marshaling parameters. */ +/** Marshaled union. */ +typedef struct { + uint32_t functionId; /**< Function identifier. */ + union { + uint32_t parameter[MAX_MAR_LIST_LENGTH]; /* untyped parameter list (expands union to 8 entries) */ + } payload; +} drApiMarshalingParam_t, *drApiMarshalingParam_ptr; + + +//------------------------------------------------------------------------------ +/** Address translation from trustlet to Driver address space. + * Translates an address/pointer given by a Trustlet to the Driver mapping. + * Checks correct address range and null pointer. + * + * @param addr Address in trustlet address space. + * @returns address in Driver virtual space + * @returns NULL if address is equal to NULL or if address is out of D3-D8 address space + */ +addr_t drApiAddrTranslateAndCheck(addr_t addr); + +//------------------------------------------------------------------------------ +#if TBASE_API_LEVEL >= 3 + +/** Addresses translation for a buffer from trustlet to driver address space. + * Checks that the buffer given by its start address and its length fits correct address range. + * Translate the start address/pointer given by a trustlet to the driver's mapping. + * + * @param addr Start address of the buffer in trustlet address space. + * @param len Length of the buffer + * @returns start address in Driver virtual space + * @returns NULL if address is equal to NULL or if the buffer is out of D3-D8 address space + */ +addr_t drApiAddrTranslateAndCheckBuffer(addr_t adr, uint32_t len); + +#endif /* TBASE_API_LEVEL */ + +//------------------------------------------------------------------------------ +/** Maps requesting client and return translated pointer to request parameters + * + * @param ipcReqClient client requesting a service + * @param params pointer to marshaled parameter in client address space + * @returns pointer to parameter for request in the current address space + * @returns NULL in case of error + */ +drApiMarshalingParam_ptr drApiMapClientAndParams( + threadid_t ipcReqClient, + uint32_t params +); + +//------------------------------------------------------------------------------ + +/** Maps a physical page to a virtual address. + * All addresses and lengths must be multiples of page size (4K). + * + * @param startVirt virtual address in Driver address space + * @param len Length of area + * @param startPhys physical address of hardware + * @param attr mapping attributes + * @returns DRAPI_OK in case of success + * @returns E_DRAPI_INVALID_PARAMETER in case any input parameter is not page size aligned or designated virtual memory area does not fit into D1-D2 address range + * @returns any combination of DRAPI_ERROR_CREATE(Driver specific error code, MTK error code) + */ + +drApiResult_t drApiMapPhys( + const addr_t startVirt, + const uint32_t len, + const addr_t startPhys, + const uint32_t attr +); +#if TBASE_API_LEVEL >= 3 +drApiResult_t drApiMapPhys64( + const addr_t startVirt, + const uint32_t len, + const uint64_t startPhys, + const uint32_t attr +); +#endif /* TBASE_API_LEVEL */ + +/** Removes mapping for virtual pages. + * All addresses and lengths must be multiples of page size (4K). + * + * @param startVirt virtual address in Driver address space + * @param len Length of area + * @returns DRAPI_OK in case of success + * @returns E_DRAPI_INVALID_PARAMETER in case any input parameter is not page size aligned or designated virtual memory area does not fit into D1-D2 address range + * @returns any combination of DRAPI_ERROR_CREATE(Driver specific error code, MTK error code) + */ + +drApiResult_t drApiUnmap( + const addr_t startVirt, + const uint32_t len +); + +//------------------------------------------------------------------------------ +/** The function removes mapping for a single page. + * + * @param startVirt virtual address in Driver address space + * @returns DRAPI_OK in case of success + * @returns E_DRAPI_INVALID_PARAMETER in case any input parameter is not page size aligned or designated virtual memory area does not fit into D1-D2 address range + * @returns any combination of DRAPI_ERROR_CREATE(Driver specific error code, MTK error code) + */ +drApiResult_t drApiUnmapPage4KB( + const page4KB_ptr virtPage +); + +//------------------------------------------------------------------------------ +/** Maps a single physical page to a virtual address + * + * @param physPage virtual address in Driver address space + * @param startPhys physical address of hardware + * @param attr mapping attributes + * @returns DRAPI_OK in case of success + * @returns E_DRAPI_INVALID_PARAMETER in case any input parameter is not page size aligned or designated virtual memory area does not fit into D1-D2 address range + * @returns any combination of DRAPI_ERROR_CREATE(Driver specific error code, MTK error code) + */ +drApiResult_t drApiMapPhysPage4KB( + const page4KB_ptr virtPage, + const page4KB_ptr physPage, + const uint32_t attr +); +#if TBASE_API_LEVEL >= 3 +drApiResult_t drApiMapPhysPage4KB64( + const page4KB_ptr virtPage, + const uint64_t physPage, + const uint32_t attr +); +#endif /* TBASE_API_LEVEL */ + +//------------------------------------------------------------------------------ +/** Maps a physical page with hardware interface + * This is prepared auxiliary function that at first removes mapping of the virtPage (if present) + * and then maps it with MAP_READABLE | MAP_WRITABLE | MAP_IO attributes + * + * @param physPage virtual address in Driver address space + * @param startPhys physical address of hardware + * @returns DRAPI_OK in case of success + * @returns E_DRAPI_INVALID_PARAMETER in case any input parameter is not page size aligned or designated virtual memory area does not fit into D1-D2 address range + * @returns any combination of DRAPI_ERROR_CREATE(Driver specific error code, MTK error code) + */ +drApiResult_t drApiMapPhysPage4KBWithHardware( + const page4KB_ptr virtPage, + const page4KB_ptr physPage +); +#if TBASE_API_LEVEL >= 3 +drApiResult_t drApiMapPhysPage4KBWithHardware64( + const page4KB_ptr virtPage, + const uint64_t physPage +); +#endif /* TBASE_API_LEVEL */ + +//------------------------------------------------------------------------------ +/** Converts virtual address (in Driver address space) to physical address + * + * @param taskid Reserved for Future Use. It must be set to zero. + * @param virtAddr virtual address in Driver address space + * @param physAddr physical address + * @returns DRAPI_OK in case of success + * @returns any combination of DRAPI_ERROR_CREATE(Driver specific error code, MTK error code) + */ +drApiResult_t drApiVirt2Phys( + const taskid_t taskid, + const addr_t virtAddr, + addr_t * physAddr +); +#if TBASE_API_LEVEL >= 3 +drApiResult_t drApiVirt2Phys64( + const taskid_t taskid, + const addr_t virtAddr, + uint64_t * physAddr +); +#endif /* TBASE_API_LEVEL */ + +//------------------------------------------------------------------------------ +/** Clean all data cache + * + * NOTE: Currently addr is always NULL. + * When extending this for not-clean-all, one can assume that there is + * more parameters ONLY if addr is non-NULL. + * Also this ensures that more specific cleans are mapped to cleanall, if specific clean is not supported. + * + * @param none + * @returns DRAPI_OK in case of success + * @returns any combination of DRAPI_ERROR_CREATE(Driver specific error code, MTK error code) + */ +drApiResult_t drApiCacheDataCleanAll( void ); + + +//------------------------------------------------------------------------------ +/** Cleans and invalidates all data cache + * + * NOTE: Currently addr is always NULL. + * When extending this for not-clean-invalidate-all, one can assume that there is + * more parameters ONLY if addr is non-NULL. + * Also this ensures that more specific cleans are mapped to cleanall, if specific clean is not supported. + * + * @param none + * @returns DRAPI_OK in case of success + * @returns any combination of DRAPI_ERROR_CREATE(Driver specific error code, MTK error code) + */ +drApiResult_t drApiCacheDataCleanInvalidateAll( void ); + + +//------------------------------------------------------------------------------ +#if TBASE_API_LEVEL >= 3 + +/** Clean a portion of the data cache by MVA + * + * @param virtAddrStart + * @param virtAddrEnd + * @returns DRAPI_OK in case of success + * @returns any combination of DRAPI_ERROR_CREATE(Driver specific error code, MTK error code) + */ +drApiResult_t drApiCacheDataCleanRange( + addr_t *virtAddrStart, + uint32_t len, + uint32_t flags +); + + +//------------------------------------------------------------------------------ +/** Cleans and invalidates a portion of data cache by MVA + * + * @param virtAddrStart + * @param virtAddrEnd + * @returns DRAPI_OK in case of success + * @returns any combination of DRAPI_ERROR_CREATE(Driver specific error code, MTK error code) + */ +drApiResult_t drApiCacheDataCleanInvalidateRange( + addr_t *virtAddrStart, + uint32_t len, + uint32_t flags +); + +//------------------------------------------------------------------------------ +/** Cache clean attributes */ +#define DRAPI_CACHE_ALL (0xff) +#define DRAPI_CACHE_L1_ONLY (0x1) +#define DRAPI_CACHE_L1_L2 (0x2) +#endif /* TBASE_API_LEVEL */ + +//------------------------------------------------------------------------------ +/** Memory type attributes */ +#define DRAPI_PHYS_MEM_TYPE_HIGH_SECURE (1U<<0) /**< High secure memory. (Typically iRam) */ +#define DRAPI_PHYS_MEM_TYPE_SECURE (1U<<1) /**< Secure memory in Dram */ +#define DRAPI_PHYS_MEM_TYPE_NON_SECURE (1U<<2) /**< NonSecure memory in Dram. Accessible from NonSecure world */ + +/** Returns physical memory type (secure or non-secure) + * + * @param type pointer to address where type is returned + * @param addr start address of checked memory + * @param size size checked memory + * @returns E_OK in case of success + */ + +drApiResult_t drApiGetPhysMemType( + uint32_t *type, + addr_t addr, + uint32_t size + ); +#if TBASE_API_LEVEL >= 3 +drApiResult_t drApiGetPhysMemType64( + uint32_t *type, + uint64_t addr, + uint32_t size + ); +#endif /* TBASE_API_LEVEL */ + +#ifdef __cplusplus +} +#endif + +#endif // __DRAPIMM_H__ diff --git a/mobicore/common/MobiCore/inc/DrApi/DrApiThread.h b/mobicore/common/MobiCore/inc/DrApi/DrApiThread.h new file mode 100644 index 0000000000000000000000000000000000000000..45c297ff13f0786c66dc334dd61934e185a4156d --- /dev/null +++ b/mobicore/common/MobiCore/inc/DrApi/DrApiThread.h @@ -0,0 +1,265 @@ +/* + * Copyright (c) 2013 TRUSTONIC LIMITED + * All rights reserved + * + * The present software is the confidential and proprietary information of + * TRUSTONIC LIMITED. You shall not disclose the present software and shall + * use it only in accordance with the terms of the license agreement you + * entered into with TRUSTONIC LIMITED. This software may be subject to + * export or import laws in certain countries. + */ + +#ifndef __DRAPI_THREAD_H__ +#define __DRAPI_THREAD_H__ + +#include "DrApiCommon.h" +#include "DrApiIpcMsg.h" + +#ifdef __cplusplus +extern "C" { +#endif + +//------------------------------------------------------------------------------ +/** Definitions */ +#define NILTASK 0 /**< returns NILTASK. */ +#define NILTHREAD 0 /**< returns NILTHREAD. */ + +#define MAX_PRIORITY (15U) /**< maximum priority of a task or thread. */ + +#if defined(DRIVER) +#define ANYINTR 0x0000FFFF /**< returns ANYINTR. */ +#endif + +#define TASK_THREAD_QUOTA_SHL 24 +#define TASK_TIME_QUOTA_MASK ((1 << TASK_THREAD_QUOTA_SHL) - 1) /**< mask to get/set time quota of a task. */ +#define TIME_INFINITE ((time_t)TASK_TIME_QUOTA_MASK) /**< returns infinite. */ + +/* Control ids for drApiThreadExRegs() API call */ +#define THREAD_EX_REGS_IP (1U << 0) /**< currently set instruction pointer of the thread is replaced by the specified instruction pointer. */ +#define THREAD_EX_REGS_SP (1U << 1) /**< currently set stack pointer of the thread is replaced by the specified stack pointer. */ + +//------------------------------------------------------------------------------ +// Time data type +typedef word_t time_t, *time_ptr; + + +//------------------------------------------------------------------------------ +/** + * Returns task ID for current task. + * + * @returns taskid + * @returns 0 in case of any error + */ +taskid_t drApiGetTaskid( void ); + +//------------------------------------------------------------------------------ +/** + * The function returns thread ID corresponding to task ID and thread number specified. + * + * @param taskid taskid having the thread. + * @param threadno Thread number in task. + * + * @returns Thread ID in case of success + * @returns 0 if task ID or thread number are invalid. + */ +threadid_t drApiTaskidGetThreadid( + taskid_t taskid, + threadno_t threadNo +); + +//------------------------------------------------------------------------------ +/** + * The function returns thread ID for current task corresponding to thread number specified. + * + * @param threadNo Thread number in current task. + * + * @returns Thread ID in case of success + * @returns 0 thread number is invalid. + * + */ +threadid_t drApiGetLocalThreadid( + threadno_t threadNo +); + +//------------------------------------------------------------------------------ +/** Suspend current thread. + * + * @param timeout Time to suspend thread. + * + * @returns DRAPI_OK in case of success + * @returns any combination of DRAPI_ERROR_CREATE(Driver specific error code, MTK error code) + */ +drApiResult_t drApiThreadSleep( + time_t timeout +); + +//------------------------------------------------------------------------------ +/** Starts a thread in Driver. + * @param threadNo Thread number in task. + * @param threadEntry Thread entry function + * @param stackPointer Thread top stack pointer (declared statically using DECLARE_STACK) + * @param priority Thread priority (Maximum level is defined as MAX_PRIORITY, higher priority level corresponds to higher priority thread) + * @param localExceptionHandler The parameter specifies the number of a thread that serves as an exception handler + * + * @returns DRAPI_OK in case of success + * @returns any combination of DRAPI_ERROR_CREATE(Driver specific error code, MTK error code) + */ +drApiResult_t drApiStartThread( + const threadno_t threadNo, + const addr_t threadEntry, + const stackTop_ptr stackPointer, + const uint32_t priority, + const threadno_t localExceptionHandlerThreadNo +); + + +//------------------------------------------------------------------------------ +/** Stop a thread in Driver. + * If thread no. of thread to stop is set to NILTHREAD, + * the current thread is stopped. The to stopped thread is detached from any + * previously attached interrupts. If any thread is waiting for stopped thread + * to do any ipc, this ipc is aborted. + * + * @param threadNo Thread number in task. + * + * @returns DRAPI_OK in case of success + * @returns any combination of DRAPI_ERROR_CREATE(Driver specific error code, MTK error code) + */ + +drApiResult_t drApiStopThread( + const threadno_t threadNo +); + + +//------------------------------------------------------------------------------ +/** Resumes a thread in Driver. + * + * @param threadNo Thread number in task. + * + * @returns DRAPI_OK in case of success + * @returns any combination of DRAPI_ERROR_CREATE(Driver specific error code, MTK error code) + */ + +drApiResult_t drApiResumeThread( + const threadno_t threadNo +); + + +//------------------------------------------------------------------------------ +/** Sets priority level for a thread in Driver. + * @param threadNo Thread number in task. + * @param priority Thread priority (Maximum level is defined as MAX_PRIORITY, higher priority level corresponds to higher priority thread) + * + * @returns DRAPI_OK in case of success + * @returns any combination of DRAPI_ERROR_CREATE(Driver specific error code, MTK error code) + */ +drApiResult_t drApiSetThreadPriority( + const threadno_t threadNo, + const uint32_t priority +); + +//------------------------------------------------------------------------------ +/** + * Sets the value registers for specified thread. + * if the @ref THREAD_EX_REGS_IP bit of argument ctrl is set, the currently set instruction pointer is exchanged by the value of the argument ip (3). + * if the @ref THREAD_EX_REGS_SP bit of argument ctrl is set, the currently set stack pointer is exchanged by the value of the argument sp (4). + * + * @param threadNo Number of the thread. + * @param ctrl Control flags + * @param ip ip value + * @param sp sp value + * + * @returns DRAPI_OK in case of success + * @returns any combination of DRAPI_ERROR_CREATE(Driver specific error code, MTK error code) + */ +drApiResult_t drApiThreadExRegs( + const threadno_t threadNo, + const uint32_t ctrl, + const addr_t ip, + const addr_t sp +); + +//------------------------------------------------------------------------------ +#if TBASE_API_LEVEL >= 3 +/** + * Restart an internal thread with given IP and SP. + * + * @param threadNo Number of the thread. + * @param ip ip value + * @param sp sp value + * + * @retval DRAPI_OK or relevant error code. + */ +drApiResult_t drApiRestartThread( + const threadno_t threadno, + const addr_t ip, + const addr_t sp +); +#endif /* TBASE_API_LEVEL */ + +//------------------------------------------------------------------------------ +/** Attaches an interrupt with the specified trigger condition to current thread. + * Please refer to the target platform specific MobiCore documentation about + * the trigger modes supported for each interrupt. In most cases, the mode + * parameters will be INTR_MODE_RAISING_EDGE, as interrupts usually indicate + * that a certain event has happened. + * + * @param intrNo interrupt number. + * @param intrMode interrupt mode. + * + * @returns DRAPI_OK in case of success + * @returns any combination of DRAPI_ERROR_CREATE(Driver specific error code, MTK error code) + */ +drApiResult_t drApiIntrAttach( + intrNo_t intrNo, + intrMode_t intrMode +); + + +//------------------------------------------------------------------------------ +/** Detaches interrupt from current thread. + * + * @param intrNo interrupt number. + * + * @returns DRAPI_OK in case of success + * @returns any combination of DRAPI_ERROR_CREATE(Driver specific error code, MTK error code) + */ +drApiResult_t drApiIntrDetach( + intrNo_t intrNo +); + +//------------------------------------------------------------------------------ +/** Wait with infinite timeout for interrupt message from kernel. + * + * @param intrNo interrupt number (if ANYINTR is used, the interrupt is returned in the parameter intrRet). + * @param timeout timeout to wait (allowed the same values as for MTK signal_wait()). + * @param pIntrRet receives interrupt. Parameter can be NULL if caller does not need this. + * + * @returns DRAPI_OK in case of success + * @returns any combination of DRAPI_ERROR_CREATE(Driver specific error code, MTK error code) + */ +drApiResult_t drApiWaitForIntr( + const intrNo_t intrNo, + const uint32_t timeout, + intrNo_t *pIntrRet +); + +//------------------------------------------------------------------------------ +/** + * Trigger software interrupt in the NWd to notify it. + * + * @param intrNo interrupt number. + * + * @returns DRAPI_OK in case of success + * @returns any combination of DRAPI_ERROR_CREATE(Driver specific error code, MTK error code) + */ +drApiResult_t drApiTriggerIntr( + intrNo_t intrNo +); + + +#ifdef __cplusplus +} +#endif + +#endif // __DRAPI_THREAD_H__ diff --git a/mobicore/common/MobiCore/inc/DrApi/version.h b/mobicore/common/MobiCore/inc/DrApi/version.h new file mode 100644 index 0000000000000000000000000000000000000000..b8621b4c9e8971dfaddac7c7ee351c9c9affbe0d --- /dev/null +++ b/mobicore/common/MobiCore/inc/DrApi/version.h @@ -0,0 +1,17 @@ +/* + * Copyright (c) 2013 TRUSTONIC LIMITED + * All rights reserved + * + * The present software is the confidential and proprietary information of + * TRUSTONIC LIMITED. You shall not disclose the present software and shall + * use it only in accordance with the terms of the license agreement you + * entered into with TRUSTONIC LIMITED. This software may be subject to + * export or import laws in certain countries. + */ +#ifndef DRAPI_VERSION_H_ +#define DRAPI_VERSION_H_ + +#define DRAPI_VERSION_MAJOR 1 +#define DRAPI_VERSION_MINOR 1 + +#endif /** DRAPI_VERSION_H_ */ diff --git a/mobicore/common/MobiCore/inc/FwDrv/DrApiFastCall.h b/mobicore/common/MobiCore/inc/FwDrv/DrApiFastCall.h new file mode 100644 index 0000000000000000000000000000000000000000..6477fe3485a7c20cac39a9f1ace36eb0cf0cbac0 --- /dev/null +++ b/mobicore/common/MobiCore/inc/FwDrv/DrApiFastCall.h @@ -0,0 +1,117 @@ +/* + * Copyright (c) 2013 TRUSTONIC LIMITED + * All rights reserved + * + * The present software is the confidential and proprietary information of + * TRUSTONIC LIMITED. You shall not disclose the present software and shall + * use it only in accordance with the terms of the license agreement you + * entered into with TRUSTONIC LIMITED. This software may be subject to + * export or import laws in certain countries. + */ + +#ifndef FASTCALL_H_ +#define FASTCALL_H_ + +/** Firmware Driver and Fastcall Handlers + * + * Mobicore can have one firmware driver. Such driver is loaded + * typically at boot, and cannot be unloaded. Firmware driver is + * intended to act as system integration means, and is not intended + * to act as typical peripheral driver. + * + * Fastcall handlers + * Firmware driver can register fastcall handler in some platforms. + * Fastcall handler is called for fastcalls unknown to Mobicore. + * + * Fastcall handlers get driver memory mappings in range of 0-2MB + * at the time handler is installed. Driver must not unmap any of + * these mappings. If new mappings are made, they cannot be relied + * to be visible in fastcall hook function. + * + * Fastcall handler may map sections (of size 1M). These mappings are not + * visible to driver. + * + * Fastcall handler gets access to number of registers at the time of + * fastcall was made in NWd. Actual number of registers depends on + * platform, but is always at least 4 (r0-r3). + * + * Notes on use of Fastcall handlers + * Fastcall handlers + * - cannot call any TlApi or DrApi functions. + * - cannot have synchronization with firmware driver. + * - do not have large stack. If stack is needed, switch to your own. + * - may be executed concurrently in all CPUs. + * - must not cause exceptions. There is no means to recover in case + * of exception. + * + */ + +#define FASTCALL_OWNER_TZOS (0xFF000000) +#define FASTCALL_OWNER_SIP (0x81000000) +#define FASTCALL_OWNER_OEM (0x83000000) +#define FASTCALL_OWNER_STD (0x84000000) + +#define FASTCALL_OWNER_MASK (0xFF000000) + +#define FCH_L1_MAX 12 + +typedef word_t *fastcall_registers_t; + +/** Context for FCs hook call + * + * This is (currently) shared between all processors + */ +struct fcContext { + word_t size; // Size of context + // Callback to modify L1 entry. + // idx is the address in MBytes of the entry to modify (starting at 8MB). + // (for example idx=2 will modify the entry for address 10MB) + // Return the virtual address corresponding to modified entry. + // Return NULL if there is an error. + // 64 bits version must be used to modify L1 table in LPAE mode. + void *(*setL1Entry)(struct fcContext *context, word_t idx, word_t entry); + word_t registers; // Number of registers available in fastcall + void (*prepareIdenticalMapping)(struct fcContext *context, addr_t start, word_t length, word_t flags); + void (*generateFcNotification)(struct fcContext *context); + void *(*setL1Entry64)(struct fcContext *context, word_t idx, uint64_t entry); +}; + +/* Fastcall handler initialization + * + * Called once before any fastcall. + * Can map memories for fastcall context. + * This function must never cause any exceptions. + * Call is executed in SVC mode. + * + * Return value + * 0 Successfull initialization. + * Other cancel hook installation + */ +typedef word_t (*fcInitHook)( + struct fcContext *context +); + + +/* Fastcall handler + * + * Executed possibly concurrently in all CPUs. + * This function must never cause any exceptions. + * Call is executed in IRQ mode. + * On Entry + * fastcall_regs_t[0]...fastcall_regs_t[15] contain input registers. + * On exit + * fastcall_regs_t[0]...fastcall_regs_t[N] contain r0...rN. + * If driver did not handle fastcall, registers must be unmodified. + * If driver handled fastcall registers r0...r3 may be modified. + * Registers beyond r3 must not be modified. Result of any + * modification is unpredictable. + * Return values + * Nonzero return value means that fastcall is handled. + */ +typedef word_t (*fcEntryHook)( + fastcall_registers_t *regs_t, + struct fcContext *context +); + + +#endif /* FASTCALL_H_ */ diff --git a/mobicore/common/MobiCore/inc/GP/tee_type.h b/mobicore/common/MobiCore/inc/GP/tee_type.h new file mode 100644 index 0000000000000000000000000000000000000000..8cf58988fa3f64c2b0864acd1c88a1efc1881023 --- /dev/null +++ b/mobicore/common/MobiCore/inc/GP/tee_type.h @@ -0,0 +1,143 @@ +/** + * Copyright (c) 2013 TRUSTONIC LIMITED + * All rights reserved + * + * The present software is the confidential and proprietary information of + * TRUSTONIC LIMITED. You shall not disclose the present software and shall + * use it only in accordance with the terms of the license agreement you + * entered into with TRUSTONIC LIMITED. This software may be subject to + * export or import laws in certain countries. + */ + +/** + * Definition of the machine-specific integer types + **/ +#ifndef __TEE_TYPE_H__ +#define __TEE_TYPE_H__ + +/* C99 integer types */ +#if (!defined(__STDC_VERSION__) || __STDC_VERSION__ < 199901L) &&(!defined(ANDROID)) + +#include + +/* Figure out if a 64-bit integer types is available */ +#if \ + defined(_MSC_VER) || \ + defined(__SYMBIAN32__) || \ + defined(_WIN32_WCE) || \ + (defined(ULLONG_MAX) && ULLONG_MAX == 0xFFFFFFFFFFFFFFFFULL) || \ + (defined(ULONG_LONG_MAX) && ULONG_LONG_MAX == 0xFFFFFFFFFFFFFFFFULL) +typedef unsigned long long uint64_t; +typedef long long int64_t; +#else +#define __S_TYPE_INT64_UNDEFINED +#endif + +#if UINT_MAX == 0xFFFFFFFF +typedef unsigned int uint32_t; +typedef int int32_t; +#elif ULONG_MAX == 0xFFFFFFFF +typedef unsigned long uint32_t; +typedef long int32_t; +#else +#error This compiler is not supported. +#endif + +#if USHRT_MAX == 0xFFFF +typedef unsigned short uint16_t; +typedef short int16_t; +#else +#error This compiler is not supported. +#endif + +#if UCHAR_MAX == 0xFF +typedef unsigned char uint8_t; +typedef signed char int8_t; +#else +#error This compiler is not supported. +#endif + +#if !defined(__cplusplus) +typedef unsigned char bool; +#define false ( (bool)0 ) +#define true ( (bool)1 ) +#endif + +#else /* !defined(__STDC_VERSION__) || __STDC_VERSION__ < 199901L */ + +#include +#include + +#endif /* !(!defined(__STDC_VERSION__) || __STDC_VERSION__ < 199901L) */ + +#include + +#ifndef NULL +# ifdef __cplusplus +# define NULL 0 +# else +# define NULL ((void *)0) +# endif +#endif + +#define IN +#define OUT + +/* + * Definition of other common types + */ + +// to delete when all completed +typedef uint32_t TEE_Result; +typedef TEE_Result TEEC_Result; + +typedef uint32_t TEE_HANDLE; + +/** Definition of an UUID (from RFC 4122 http://www.ietf.org/rfc/rfc4122.txt) */ +typedef struct TEE_UUID { + uint32_t timeLow; + uint16_t timeMid; + uint16_t timeHiAndVersion; + uint8_t clockSeqAndNode[8]; +} TEE_UUID; +typedef TEE_UUID TEEC_UUID; + +/** Type definition for a TEE Identity */ +typedef struct TEE_Identity { + uint32_t login; + TEE_UUID uuid; +} TEE_Identity; + +typedef struct __TEE_PropSetHandle { + unsigned char reserved; +} __TEE_PropSetHandle; + +typedef struct __TEE_PropSetHandle* TEE_PropSetHandle; + +/* Property Sets Pseudo Handles */ +#define TEE_PROPSET_CURRENT_TA (TEE_PropSetHandle)0xFFFFFFFF +#define TEE_PROPSET_CURRENT_CLIENT (TEE_PropSetHandle)0xFFFFFFFE +#define TEE_PROPSET_TEE_IMPLEMENTATION (TEE_PropSetHandle)0xFFFFFFFD + + +/* DLL Import/Export directives */ + +#if defined(WIN32) || defined(__ARMCC_VERSION) || defined(__WINSCW__) || defined(_WIN32_WCE) +# define S_DLL_EXPORT __declspec(dllexport) +# define S_DLL_IMPORT __declspec(dllimport) +# define S_NO_RETURN __declspec(noreturn) +#elif defined(__GNUC__) +# define S_DLL_EXPORT __attribute__ ((visibility ("default"))) +# define S_DLL_IMPORT __attribute__ ((visibility ("default"))) +# define S_NO_RETURN __attribute__ ((noreturn)) +#else +# define S_DLL_EXPORT +# define S_DLL_IMPORT +# define S_NO_RETURN +#endif + +#if defined(_MSC_VER) +#define __func__ __FUNCTION__ +#endif + +#endif /* __TEE_TYPE_H__ */ diff --git a/mobicore/common/MobiCore/inc/GP/uuid_attestation.h b/mobicore/common/MobiCore/inc/GP/uuid_attestation.h new file mode 100644 index 0000000000000000000000000000000000000000..ab8f1be582580caf9b6152f653ddc24f707020aa --- /dev/null +++ b/mobicore/common/MobiCore/inc/GP/uuid_attestation.h @@ -0,0 +1,60 @@ +/** + * Copyright (c) 2013 TRUSTONIC LIMITED + * All rights reserved + * + * The present software is the confidential and proprietary information of + * TRUSTONIC LIMITED. You shall not disclose the present software and shall + * use it only in accordance with the terms of the license agreement you + * entered into with TRUSTONIC LIMITED. This software may be subject to + * export or import laws in certain countries. + */ + +#ifndef __TEE_UUID_ATTESTATION_H__ +#define __TEE_UUID_ATTESTATION_H__ + +#include "tee_type.h" + +// Sizes of the fields of attestation structure +#define AT_MAGIC_SIZE 8 +#define AT_SIZE_SIZE sizeof(uint32_t) +#define AT_VERSION_SIZE sizeof(uint32_t) +#define AT_UUID_SIZE sizeof(TEE_UUID) + +// Sizes of the fields used to generate signature +#define AT_TAG_SIZE 20 +#define AT_SHA1_HASH_SIZE 20 + +// Max size of RSA modulus supported +#define AT_MODULUS_MAX_SIZE 256 +// Max size of RSA public exponent supported +#define AT_PUBLIC_EXPO_MAX_SIZE 4 + +// Attestation version +#define AT_VERSION 1 + +// Name space ID (the UUID of the RSA OID) +const uint8_t RSA_OID_UUID[AT_UUID_SIZE] = {0x6b, 0x8e, 0x02, 0x6b, 0x63, 0xc1, 0x5d, 0x58, 0xb0, 0x64, 0x00, 0xd3, 0x51, 0x89, 0xce, 0x65}; +// Magic word +const char MAGIC[AT_MAGIC_SIZE] = "TAUUID\0"; + +// Tag for signature generation +const char TAG[AT_TAG_SIZE]="Trusted Application"; + +// Public key structure +typedef struct uuid_public_key { + uint32_t type; // TEE TYPE RSA KEYPAIR: 0xa0000030 + uint16_t modulus_bytes; // Length of the modulus in bytes + uint16_t exponent_bytes; // Length of the exponent in bytes + uint8_t data[]; // Key material +} uuid_public_key; + +// Attestation structure +typedef struct uuid_attestation { + uint8_t magic[AT_MAGIC_SIZE]; // Magic word: "TAUUID\0\0" + uint32_t size; // Attestation size (4 bytes) + uint32_t version; // Version number: 1 (4 bytes) + uint8_t uuid[AT_UUID_SIZE]; // UUID + uuid_public_key key; // Public key +} uuid_attestation; + +#endif /* __TEE_UUID_ATTESTATION_H__ */ diff --git a/mobicore/common/MobiCore/inc/McLib/GpTci.h b/mobicore/common/MobiCore/inc/McLib/GpTci.h new file mode 100644 index 0000000000000000000000000000000000000000..3a561fb40a42d52477aad9eb65d350f693a6a17b --- /dev/null +++ b/mobicore/common/MobiCore/inc/McLib/GpTci.h @@ -0,0 +1,96 @@ +/* + * Copyright (c) 2013 TRUSTONIC LIMITED + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of the TRUSTONIC LIMITED nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; + * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef _GP_TCI_H_ +#define _GP_TCI_H_ + +typedef struct { + uint32_t a; + uint32_t b; +} TEE_Value; + +#if defined (TRUSTEDAPP) +typedef struct { + void *sVirtualAddr; /**< The virtual address of the Bulk buffer regarding the address space of the Trustlet, already includes a possible offset! */ + uint32_t sVirtualLen; /**< Length of the mapped Bulk buffer */ +} mcBulkMap_t; +#endif + +typedef struct { + mcBulkMap_t mapInfo; + uint32_t outputSize; +} _TEEC_MemoryReferenceInternal; + +typedef union { + TEE_Value value; + _TEEC_MemoryReferenceInternal memref; +} _TEEC_ParameterInternal; + +typedef enum { + _TA_OPERATION_OPEN_SESSION = 1, + _TA_OPERATION_INVOKE_COMMAND = 2, + _TA_OPERATION_CLOSE_SESSION = 3, +} _TEEC_TCI_type; + +typedef struct { + _TEEC_TCI_type type; + uint32_t commandId; + uint32_t paramTypes; + _TEEC_ParameterInternal params[4]; + bool isCancelled; +} _TEEC_OperationInternal; + +typedef struct { + char header[8];// = "TCIGP000"`: version indicator (to support future format changes) + TEEC_UUID destination; + _TEEC_OperationInternal operation; //the data of the ongoing operation (if any) + uint32_t ready; + // The following fields are set by the secure world (in a future version, they may also be set by the normal world communication layer): + uint32_t returnOrigin; + uint32_t returnStatus; +} _TEEC_TCI; + +#define TEEC_MEMREF_WHOLE 0xC +#define TEEC_MEMREF_PARTIAL_INPUT 0xD +#define TEEC_MEMREF_PARTIAL_OUTPUT 0xE +#define TEEC_MEMREF_PARTIAL_INOUT 0xF + +/** + * Termination codes + */ +#define TA_EXIT_CODE_PANIC (300) +#define TA_EXIT_CODE_TCI (301) +#define TA_EXIT_CODE_PARAMS (302) +#define TA_EXIT_CODE_FINISHED (303) +#define TA_EXIT_CODE_SESSIONSTATE (304) +#define TA_EXIT_CODE_CREATEFAILED (305) + +#endif // _GP_TCI_H_ diff --git a/mobicore/common/MobiCore/inc/McLib/TlApiCryptoMarshal.h b/mobicore/common/MobiCore/inc/McLib/TlApiCryptoMarshal.h new file mode 100644 index 0000000000000000000000000000000000000000..641a0cecfed8e4f41442c37620439ea91ca7fa7f --- /dev/null +++ b/mobicore/common/MobiCore/inc/McLib/TlApiCryptoMarshal.h @@ -0,0 +1,388 @@ + /* + * Copyright (c) 2013 TRUSTONIC LIMITED + * All rights reserved + * + * The present software is the confidential and proprietary information of + * TRUSTONIC LIMITED. You shall not disclose the present software and shall + * use it only in accordance with the terms of the license agreement you + * entered into with TRUSTONIC LIMITED. This software may be subject to + * export or import laws in certain countries. + * + * + * @addtogroup TlApi + * @{ + * @file + * Marshaling types and declarations. + * + * Functions for the marshaling of function ID and parameters. + * + */ + +#ifndef __TLAPICRYPTOMARSHAL_H__ +#define __TLAPICRYPTOMARSHAL_H__ + + +#include "mcDriverId.h" + +#include "TlApi/TlApiError.h" +#include "TlApi/TlApiCrypto.h" +#include "TlApi/TlApiSecurity.h" +#include "TlApi/TlApiMcSystem.h" +#include "TlApi/TlApiTime.h" + + +/** Each function must have its own ID. + * Extend this list if you add a new function. + */ +typedef enum { + FID_KPD_GRAB_KEYPAD = 0, /**< Function to reserve the keypad. */ + FID_KPD_GET_C, /**< Function to read a character from the keypad. */ + FID_KPD_GET_MULTIPLE_C, /**< Function to read multiple characters from the keypad. */ + FID_KPD_RELEASE_KEYPAD /**< Function to release the grabbed keypad. */ +} kpdFuncID_t; + + +/** Each function must have its own ID. + * Extend this list if you add a new function. + */ +typedef enum { + FID_CRYPTO_MD = 0, /**< ID for message digest algorithms. */ + FID_CRYPTO_MD_INIT = 1, /**< Function to init a message digest. */ + FID_CRYPTO_MD_INIT_WITH_DATA = 2, /**< Function to init a message digest with data. */ + FID_CRYPTO_MD_UPDATE = 3, /**< Function to update a message digest. */ + FID_CRYPTO_MD_DOFINAL = 4, /**< Function to finalize a message digest. */ + + FID_CRYPTO_SIG = 5, /**< ID for signature algorithms. */ + FID_CRYPTO_SIG_INIT = 6, /**< Function to init a signature. */ + FID_CRYPTO_SIG_INIT_WITH_DATA = 7, /**< Function to init a signature with data. */ + FID_CRYPTO_SIG_UPDATE = 8, /**< Function to update a signature. */ + FID_CRYPTO_SIG_SIGN = 9, /**< Function to make a signature. */ + FID_CRYPTO_SIG_VERIFY = 10, /**< Function to verify a signature. */ + + FID_CRYPTO_RNG = 11, /**< ID for RNG algorithms. */ + FID_CRYPTO_RNG_GENERATE_DATA = 12, /**< Function to generate random data. */ + + FID_CRYPTO_CIPHER = 13, /**< ID for cipher algorithms. */ + FID_CRYPTO_CIPHER_INIT = 14, /**< Function to init a cipher. */ + FID_CRYPTO_CIPHER_INIT_WITH_DATA = 15, /**< Function to init a cipher with data. */ + FID_CRYPTO_CIPHER_UPDATE = 16, /**< Function to update a cipher. */ + FID_CRYPTO_CIPHER_DOFINAL = 17, /**< Function to finalize a cipher. */ + + FID_CRYPTO_SESSION_ABORT = 18, /**< Function to abort a crypto session. */ + + FID_CRYPTO_GENERATE_KEY_PAIR = 19, /**< Function to generate a key pair. */ + FID_CRYPTO_GENERATE_KEY_PAIR_BUFFER = 20, /**< Function to generate a key pair into a buffer. */ + + FID_SECURITY_WRAP_OBJECT = 21, /**< Function to wrap given data and create a secure object. */ + FID_SECURITY_UNWRAP_OBJECT = 22, /**< Function to unwrap given secure object and create plaintext data. */ + FID_SECURITY_GET_SUID = 23, /**< Function to acquire System on chip Unique ID. */ + FID_SECURITY_IS_DEVICE_BOUND = 24, /**< Currently not used. */ + FID_SECURITY_BIND_DEVICE = 25, /**< Currently not used. */ + + FID_SYSTEM_GET_VERSION = 26, /**< Function to get information about the underlying MobiCore version. */ + + FID_SECURITY_GET_TIME_STAMP = 27, /**< Function to get a secure time stamp. */ + + FID_SECURITY_DERIVE_KEY = 28, /**< Function to derive key. */ + + FID_CRYPTO_MD_DOFINAL_WITHOUT_CLOSE = 29, /**< Function to finalize a message digest without close. */ + FID_CRYPTO_OVERWRITE_KEY = 30, /**< Function to overwrite key. */ + FID_CRYPTO_MAC_INIT = 31, /**< Function to initialize hmac structures with key that is earlier given. */ + FID_CRYPTO_SIG_SIGN_WITHOUT_CLOSE = 32, /**< Function to finalize a sign without close. */ + FID_CRYPTO_SIG_VERIFY_WITHOUT_CLOSE = 33, /**< Function to finalize a verify without close. */ + FID_CRYPTO_CIPHER_WITHOUT_CLOSE = 34, /**< Function to finalize a cipher without close. */ + FID_SECURITY_ENDORSE = 35, /**< Function to create endorsement */ + + FID_CRYPTO_CIPHER_UPDATE_IV = 36, /**< Function to update cipher IV */ + +} cryptoFuncID_t; + + +/** Marshaled function parameters. + * structs and union of marshaling parameters via TlApi. + * + * @note The structs can NEVER be packed ! + * @note The structs can NOT used via sizeof(..) ! + */ +typedef struct { + tlApiCrSession_t sessionHandle; /* handle of session to be aborted */ +} tlApiCrAbort_t, *tlApiCrAbort_ptr; + + +typedef struct { + tlApiKeyPair_t *keyPair; /* reference to key pair structure */ + tlApiKeyPairType_t type; /* see enum keyPairType_t */ + size_t len; /* requested byte length of keys */ + uint8_t *buffer; /* reference to buffer into which generated key components are written */ + size_t bufferLen; /* length of buffer for generated components */ +} tlApiCrGenerateKeyPair_t, *tlApiCrGenerateKeyPair_ptr; + + +typedef struct { + tlApiCrSession_t *pSessionHandle; /* reference to generated Cipher session handle */ + tlApiCipherAlg_t alg; /* see enum cipherMode_t */ + tlApiCipherMode_t mode; /* TLAPI_MODE_ENCRYPT or TLAPI_MODE_DECRYPT */ + const tlApiKey_t *key; /* key for this session */ + const uint8_t *buffer; /* reference to algorithm specific data like initial values for CBC */ + size_t bufferLen; /* length of buffer containing algorithm specific data */ +} tlApiCipherInit_t, *tlApiCipherInit_ptr; + +typedef struct { + tlApiCrSession_t sessionHandle; /* handle of a running Cipher session */ + const uint8_t *srcData; /* reference to input data to be encrypted/decrypted */ + size_t srcLen; /* byte length of input data to be encrypted/decrypted */ + uint8_t *destData; /* reference to result area */ + size_t *destLen; /* [in] byte length of output buffer. [out] byte length of generated output data */ +} tlApiCipherUpdate_t, *tlApiCipherUpdate_ptr; + + +typedef struct { + tlApiCrSession_t sessionHandle; /* handle of a running Cipher session */ + const uint8_t *srcData; /* reference to input data to be encrypted/decrypted */ + size_t srcLen; /* byte length of input data to be encrypted/decrypted */ + uint8_t *destData; /* reference to result area */ + size_t *destLen; /* [in] byte length of buffer for output data. [out] byte length of generated output */ +} tlApiCipherDoFinal_t, *tlApiCipherDoFinal_ptr; + + +typedef struct { + tlApiCrSession_t *pSessionHandle; /* reference to generated Signatures session handle */ + const tlApiKey_t *key; /* key for this session */ + tlApiSigMode_t mode; /* TLAPI_MODE_SIGN or TLAPI_MODE_VERIFY */ + tlApiSigAlg_t alg; /* see enum of algorithms */ + const uint8_t *buffer; /* reference to algorithm specific data like seed for hash */ + size_t bufferLen; /* length of buffer containing algorithm specific data */ +} tlApiSignatureInit_t, *tlApiSignatureInit_ptr; + + +typedef struct { + tlApiCrSession_t sessionHandle; /* handle of a running Signature session */ + const uint8_t *message; /* reference to message to be signed/verified */ + size_t messageLen; /* byte length of message */ +} tlApiSignatureUpdate_t, *tlApiSignatureUpdate_ptr; + + +typedef struct { + tlApiCrSession_t sessionHandle; /* handle of a running Signature session */ + const uint8_t *message; /* reference to message to be signed */ + size_t messageLen; /* byte length of message */ + uint8_t *signature; /* reference to generated signature */ + size_t *signatureLen; /* [in] byte length of signature buffer. [out] byte length of generated signature */ +} tlApiSignatureSign_t, *tlApiSignatureSign_ptr; + + +typedef struct { + tlApiCrSession_t sessionHandle; /* handle of a running Signature session */ + const uint8_t *message; /* reference to message to be verified */ + size_t messageLen; /* byte length of message */ + const uint8_t *signature; /* reference to signature to be verified */ + size_t signatureLen; /* byte length of signature */ + bool *validity; /* reference to verification result, TRUE if verified, otherwise FALSE */ +} tlApiSignatureVerify_t, *tlApiSignatureVerify_ptr; + +typedef struct { + tlApiCrSession_t *pSessionHandle; /* reference to generated Message Digest session handle */ + tlApiMdAlg_t alg; /* see enum mdAlg_t */ + const uint8_t *buffer; /* reference to previously calculated hash data */ + const uint8_t *lenPreHashedData; /* byte array in big endian format containing length of previously calculated hash */ +} tlApiMessageDigestInit_t, *tlApiMessageDigestInit_ptr; + + +typedef struct { + tlApiCrSession_t sessionHandle; /* handle of a running session Message Digest session */ + const uint8_t *message; /* reference to message to be hashed */ + size_t messageLen; /* byte length of input data to be hashed */ +} tlApiMessageDigestUpdate_t, *tlApiMessageDigestUpdate_ptr; + + +typedef struct { + tlApiCrSession_t sessionHandle; /* handle of a running session Message Digest session */ + const uint8_t *message; /* reference to message to be hashed */ + size_t messageLen; /* byte length of message */ + uint8_t *hash; /* reference to generated hash */ + size_t *hashLen; /* [in] byte length of hash buffer. [out] byte length of generated hash data */ +} tlApiMessageDigestDoFinal_t, *tlApiMessageDigestDoFinal_ptr; + + +typedef struct { + tlApiRngAlg_t alg; /* see enum randomDataGenerationAlg_t */ + uint8_t *randomBuffer; /* reference to generated random data */ + size_t *randomLen; /* byte length of requested random data */ +} tlApiRandomGenerateData_t, *tlApiRandomGenerateData_ptr; + + +typedef struct { + uint32_t unused; /* place holder - unused !!! */ +} tlApiGrabKeypad_t, *tlApiGrabKeypad_ptr; + + +typedef struct { + uint32_t *c; /* pointer to the rx-character */ + uint32_t timeout; /* time in milliseconds to wait */ +} tlApiGetKeypadEvent_t, *tlApiGetKeypadEvent_ptr; + + +typedef struct { + uint32_t unused; /* place holder - unused !!! */ +} tlApiReleaseKeypadGrab_t, *tlApiReleaseKeypadGrab_ptr; + + +typedef struct { + const void *src; /* Source data. */ + size_t plainLen; /* Length of header. */ + size_t encryptedLen; /* Length of payload to encrypt. */ + void *dest; /* Destination buffer (secure object). */ + size_t *destLen; /* [in] Length of the destination buffer. + [out] Length of output data. */ + mcSoContext_t context; /* Context of operation. */ + mcSoLifeTime_t lifetime; /** Secure object lifetime and flags combined. */ + const tlApiSpTrustletId_t *consumer; /* NULL or trustlet identifier for delegated wrapping. */ +} tlApiWrapObject_t, *tlApiWrapObject_ptr; + + +typedef struct { + void *src; /* Source data (secure object). */ + void *dest; /* Destination buffer (unwrapped data). */ + size_t *destLen; /* [in] Length of the destination buffer. + [out] Length of output data. */ + size_t srcLen; /* [in] Length of the source buffer. */ + uint32_t flags; /* [in] Flags for unwrap. */ +} tlApiUnwrapObject_t, *tlApiUnwrapObject_ptr; + + +typedef struct { + mcSuid_t *suid; /**< System on chip Unique ID */ +} tlApiGetSuid_t, *tlApiGetSuid_ptr; + + +typedef struct { + mcVersionInfo_t *mcVersionInfo; /**< Version of MobiCore */ +} tlApiGetMcVersion_t, *tlApiGetMcVersion_ptr; + + +typedef struct { + timestamp_t *ts; /**< Returned time stamp */ + tsSource_t source; /**< Requested timer source */ +} tlApiGetTimeStamp_t, *tlApiGetTimeStamp_ptr; + + +typedef struct { + const void *seed; /* Source seed. */ + size_t seedLen; /* Length of seed. */ + void *dest; /* Destination buffer (key). */ + size_t destLen; /* Length of the destination buffer. */ + mcSoContext_t context; /* Context of operation. */ + mcSoLifeTime_t lifetime; /** key lifetime. */ +} tlApiDeriveKey_t, *tlApiDeriveKey_ptr; + +typedef struct { + tlApiCrSession_t sessionHandle; /* handle of a running session Message Digest session */ + const uint8_t *message; /* reference to message to be hashed */ + size_t messageLen; /* byte length of message */ + uint8_t *hash; /* reference to generated hash */ + size_t *hashLen; /* [in] byte length of hash buffer. [out] byte length of generated hash data */ +} tlApiMessageDigestDoFinalWithOutClose_t, *tlApiMessageDigestDoFinalWithOutClose_ptr; + +typedef struct { + tlApiCrSession_t sessionHandle; + const tlApiKey_t *keyData; +} tlApiOverwriteKey_t, *tlApiOverwriteKey_ptr; + +typedef struct { + tlApiCrSession_t sessionHandle; + uint8_t *iv; + size_t ivLen; +} tlApiMacInit_t, *tlApiMacInit_ptr; + +typedef struct { + tlApiCrSession_t sessionHandle; + const uint8_t *iv; + size_t ivLen; +} tlApiCipherUpdateIV_t, *tlApiCipherUpdateIV_ptr; + +#define STH_PUBLIC_FILE_NAME_SIZE 20 +typedef struct S_UUID_t { + uint32_t timeLow; + uint16_t timeMid; + uint16_t timeHiAndVersion; + uint8_t clockSeqAndNode[8]; +} UUID_t; + +typedef enum { + STH_MESSAGE_TYPE_LOOK = 0, + STH_MESSAGE_TYPE_READ, + STH_MESSAGE_TYPE_WRITE, + STH_MESSAGE_TYPE_DELETE +} tlApiStorageOps_t; + +typedef struct { + uint32_t status; + uint8_t type; + uint8_t reserved0; + uint16_t flags; + uint32_t payloadLen; + UUID_t uuid; + unsigned char filename[STH_PUBLIC_FILE_NAME_SIZE]; + unsigned char payload[]; +} STH_TA_message_t; + +/*typedef struct { + storageOps_t operation; + union { + storageLook_t look; + storageRead_t read; + storageWrite_t write; + storageDelete_t del; + }payload; +} marshalingParam;*/ // merge to marshalingParam + +typedef struct { + const void *msg; /* Source message. */ + size_t msgLen; /* Length of message. */ + void *dst; /* Destination buffer (endorsement). */ + size_t *dstLen; /* Length of the destination buffer. */ + mcScope_t scope; /* Scope of the endorsement. */ +} tlApiEndorse_t; + +/** Maximum number of parameter . */ +#define MAX_MAR_LIST_LENGTH 8 /**< Maximum list of possible marshaling parameters. */ + +/** Marshaled union. */ +typedef struct { + uint32_t functionId; /**< Function identifier. */ + union { + tlApiCrAbort_t crAbort; + tlApiCrGenerateKeyPair_t crGenerateKeyPair; + tlApiCipherInit_t cipherInit; + tlApiCipherUpdate_t cipherUpdate; + tlApiCipherDoFinal_t cipherDoFinal; + tlApiSignatureInit_t signatureInit; + tlApiSignatureUpdate_t signatureUpdate; + tlApiSignatureSign_t signatureSign; + tlApiSignatureVerify_t signatureVerify; + tlApiMessageDigestInit_t messageDigestInit; + tlApiMessageDigestUpdate_t messageDigestUpdate; + tlApiMessageDigestDoFinal_t messageDigestDoFinal; + tlApiRandomGenerateData_t randomGenerateData; + tlApiGrabKeypad_t grabKeypad; + tlApiGetKeypadEvent_t getKeypadEvent; + tlApiReleaseKeypadGrab_t releaseKeypadGrab; + tlApiWrapObject_t wrapObject; + tlApiUnwrapObject_t unwrapObject; + tlApiGetSuid_t getSuid; + tlApiGetMcVersion_t getVersion; + tlApiGetTimeStamp_t getTimeStamp; + tlApiDeriveKey_t deriveKey; + tlApiOverwriteKey_t overwriteKey; + tlApiMacInit_t macInit; + tlApiEndorse_t endorse; + tlApiCipherUpdateIV_t cipherUpdateIV; + tlApiResult_t retVal; + STH_TA_message_t taMessage; + uint32_t parameter[MAX_MAR_LIST_LENGTH]; /* untyped parameter list (expands union to 8 entries) */ + } payload; +} marshalingParamCR_t, *marshalingParamCR_ptr; + +#endif // __TLAPICRYPTOMARSHAL_H__ + +/** @} */ diff --git a/mobicore/common/MobiCore/inc/McLib/TlApiStorageMarshal.h b/mobicore/common/MobiCore/inc/McLib/TlApiStorageMarshal.h new file mode 100644 index 0000000000000000000000000000000000000000..b1848ebc975bc725e016b5ed9d02f85f1b119329 --- /dev/null +++ b/mobicore/common/MobiCore/inc/McLib/TlApiStorageMarshal.h @@ -0,0 +1,88 @@ +/* + * Copyright (c) 2013 TRUSTONIC LIMITED + * All rights reserved + * + * The present software is the confidential and proprietary information of + * TRUSTONIC LIMITED. You shall not disclose the present software and shall + * use it only in accordance with the terms of the license agreement you + * entered into with TRUSTONIC LIMITED. This software may be subject to + * export or import laws in certain countries. + */ + + +#ifndef __TEE_STORAGE_H__ +#define __TEE_STORAGE_H__ +#include +#include + +#include "tee_internal_api.h" +#include "TlApi/TlApi.h" + +#include "TlApiCryptoMarshal.h" +#include "TlApiImpl.h" + +#define MC_FLAG_FILE_MAY_EXIST ( 1 << 0 ) +#define MC_DRV_ID_STORAGE 0x0200 + +#define TLAPI_FNC_CR_SIGN_INIT_ID 19 +#define TLAPI_FNC_CR_SIGN_UPDATE_ID 20 +#define TLAPI_FNC_CR_SIGN_SIGN_ID 21 +#define TLAPI_FNC_CR_SIGN_VERIFY_ID 22 + + +/* ** should be put in TlApiMarshal.h ** */ +typedef struct +{ + uint32_t dataLen; + uint32_t position; + unsigned char objectID[TEE_OBJECT_ID_MAX_LEN]; + unsigned char data[0]; +}_TEE_PersistentData; + + +typedef struct +{ + uint32_t flags; + uint8_t version; + uint8_t objectIDLen; + uint16_t cryptoLen; + _TEE_PersistentData *persistent; + unsigned char crypto[0]; +}TEE_FileObject; + +typedef struct +{ + uint32_t flags; + uint8_t version; + uint8_t objectIDLen; + uint16_t cryptoLen; + _TEE_PersistentData *persistent; +}__TEE_ObjectHandle; + +typedef struct +{ + char header[5]; + unsigned char version; + uint16_t cryptoLen; + uint32_t dataLen; +}STH_plaintext; + +typedef struct { + uint8_t objectIDLen; + unsigned char reserved1[7]; + unsigned char objectID[TEE_OBJECT_ID_MAX_LEN]; + unsigned char data[]; +}STH_ciphertext; + +typedef struct { + char header[6]; + unsigned char version; + unsigned char objectIDLen; + TEE_UUID uuid; + unsigned char objectID[TEE_OBJECT_ID_MAX_LEN]; +} STH_file_name; + +#define PLAIN_TEXT_HEADER ("fname") + + +#endif // __TEE_STORAGE_H__ diff --git a/mobicore/common/MobiCore/inc/McLib/TlApiTuiMarshal.h b/mobicore/common/MobiCore/inc/McLib/TlApiTuiMarshal.h new file mode 100644 index 0000000000000000000000000000000000000000..28c7808c363b56bf803666d0ebd0e7a95e00999b --- /dev/null +++ b/mobicore/common/MobiCore/inc/McLib/TlApiTuiMarshal.h @@ -0,0 +1,64 @@ +/** @addtogroup DRIVER_TUI + * @{ + * @file drApiMarshal.h + * Marshaling types and declarations for TUI driver and trustlet. + * + * Functions for the marshaling of function ID and parameters. + * + * + */ +#ifndef __TLAPIMARSHAL_TUI_H__ +#define __TLAPIMARSHAL_TUI_H__ + +#include "TlApi/TlApiError.h" +#include "TlApi/TlApiTui.h" + +/** Invalid session id. Returned in case of an error. */ +#define DR_SID_INVALID 0xffffffff + +/** Each function must have its own ID. + * Extend this list if you add a new function. + */ +typedef enum { + FID_DR_NONE = 0, + FID_DR_OPEN_SESSION, + FID_DR_CLOSE_SESSION, + FID_DR_RESERVED0, + FID_DR_SET_IMAGE, + FID_DR_GET_SCREEN_INFO, + FID_DR_GET_TOUCH_EVENT, + FID_DR_RESERVED1, +} tuiFuncID_t; + +/** Marshaled function parameters. + * structs and union of marshaling parameters via TlApi. + * + * @note The structs can NEVER be packed ! + * @note The structs can NOT used via sizeof(..) ! + */ +typedef struct { + union{ + uint32_t *version; + uint32_t *securityLevel; + tlApiTuiImage_ptr image; + tlApiTuiScreenInfo_ptr screenInfo; + tlApiTuiTouchEvent_ptr touchEvent; + }content; + tlApiTuiCoordinates_t coordinates; + +} tuiMarshalingData_t, *tuiMarshalingData_ptr; + +/** Union of marshaling parameters. */ +/* If adding any function, add the marshaling structure here */ +typedef struct { + uint32_t functionId; /**< Function identifier. */ + union { + tuiMarshalingData_t params; + tlApiResult_t retVal; /** Return value */ + } payload; + +} tuiMarshalingParam_t, *tuiMarshalingParam_ptr; + +#endif // __TLAPIMARSHAL_TUI_H__ + +/** @} */ diff --git a/mobicore/common/MobiCore/inc/McLib/mcLibWB.h b/mobicore/common/MobiCore/inc/McLib/mcLibWB.h new file mode 100644 index 0000000000000000000000000000000000000000..91b8cdfd9f2658467cbdc6ec0a9689917420e607 --- /dev/null +++ b/mobicore/common/MobiCore/inc/McLib/mcLibWB.h @@ -0,0 +1,16 @@ +/** @addtogroup MC_RTM_START + * @{ + * @file + * + * + */ + +/** Index of flags to be checked after mcWaitNotification */ +#define MCLIB_WB_INDEX_NOTIFICATION_FLAGS (0) +#define MCLIB_WB_NOTIFICATION_FLAG_CA_DEAD (1) + +/** Index of entry in which the base address of heap is stored. */ +#define MCLIB_WB_INDEX_HEAP_BASE_ADDRESS (1) + +/** Index of flags to be checked after mcWaitNotification */ +#define MCLIB_WB_INDEX_CONTEXT (2) diff --git a/mobicore/common/MobiCore/inc/McLib/mclib_size.h b/mobicore/common/MobiCore/inc/McLib/mclib_size.h new file mode 100644 index 0000000000000000000000000000000000000000..a9fbb487998a2c4dea87a48f26756c0e93da1a4b --- /dev/null +++ b/mobicore/common/MobiCore/inc/McLib/mclib_size.h @@ -0,0 +1,18 @@ +/* + * mclib_size.h + * + * Created on: Oct 22, 2013 + * Author: lukhan01 + */ + +#ifndef MCLIB_SIZE_H_ +#define MCLIB_SIZE_H_ + +// Note: this file is read by .c and .sct file, no magic allowed. +// Please modify these values manually. +#define MCLIB_PAGES 5 +#define MCLIB_SIZE 0x00005000 +#define MCLIB_BASE 0x000FA000 + + +#endif /* MCLIB_SIZE_H_ */ diff --git a/mobicore/common/MobiCore/inc/McLib/tplay_marshal.h b/mobicore/common/MobiCore/inc/McLib/tplay_marshal.h new file mode 100644 index 0000000000000000000000000000000000000000..955aa896aeb17ca0888bfbe816c8607b3c77fd41 --- /dev/null +++ b/mobicore/common/MobiCore/inc/McLib/tplay_marshal.h @@ -0,0 +1,72 @@ +/* + * Copyright (c) 2013 TRUSTONIC LIMITED + * All rights reserved + * + * The present software is the confidential and proprietary information of + * TRUSTONIC LIMITED. You shall not disclose the present software and shall + * use it only in accordance with the terms of the license agreement you + * entered into with TRUSTONIC LIMITED. This software may be subject to + * export or import laws in certain countries. + */ + +#ifndef __TPLAY_MARSHAL_H__ +#define __TPLAY_MARSHAL_H__ __FILE__ + +#include "DrApi/DrApiCommon.h" +#include "TlApi/TlApiError.h" +#include "TlApi/TPlay.h" + +/** + * Driver ID + */ +#define TPLAY_DR_ID TB_DRV_ID_TPLAY + +/** + * Function id definitions + */ +#define FID_DR_OPEN_SESSION 1 +#define FID_DR_CLOSE_SESSION 2 +#define FID_DR_PROCESS_DRM_CONTENT 3 +#define FID_DR_CHECK_LINK 4 +#define FID_DR_UNKNOWN_CMD 100 /* For test purposes */ + +/** + * Secure cipher request data structure. + * This structure helps define a buffer that contains mixed encrypted and clear data. + */ +typedef struct { + uint8_t sHandle; + tlApiDrmDecryptContext_t decryptCtx; + uint8_t *input; + tlApiDrmInputSegmentDescriptor_t inputDesc; + uint32_t processMode; + uint8_t *rfu; +} tlDrmApiDrmContent_t, *tlDrmApiDrmContent_ptr; + +/** + * Link status data structure. + */ +typedef struct { + uint8_t sHandle; + tlApiDrmLink_t link; +} tlDrmApiLink_t, *tlDrmApiLink_ptr; + +/** + * Union of marshaling parameters. */ +/* If adding any function, add the marshaling structure here + */ +typedef struct { + uint32_t functionId; /* Function identifier. */ + union { + uint8_t *returned_sHandle; + uint8_t sHandle_to_close; + tlDrmApiDrmContent_t drmContent; + tlDrmApiLink_t link; + int32_t retVal; /* Return value */ + } payload; +} tplayMarshalingParam_t, *tplayMarshalingParam_ptr; + + +#endif // __TPLAY_MARSHAL_H__ + + diff --git a/mobicore/common/MobiCore/inc/Mci/mci.h b/mobicore/common/MobiCore/inc/Mci/mci.h new file mode 100644 index 0000000000000000000000000000000000000000..b9011e5037e44d9d1a7acaef8ae75372ea1303ef --- /dev/null +++ b/mobicore/common/MobiCore/inc/Mci/mci.h @@ -0,0 +1,97 @@ +/* + * Copyright (c) 2013 TRUSTONIC LIMITED + * All rights reserved + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. The name of the author may not be used to endorse or promote + * products derived from this software without specific prior + * written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS + * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * + *

Introduction

+ * The MobiCore Control Interface (MCI) is the interface for integrating G&D MobiCore technology into the + * rich operating system running in the non-secure part of an ARM TrustZone enabled platform. + * + *

Interface overview

+ * The Structure of the MobiCore control interface is depicted in the figure below: + * @image html DoxyOverviewMci500x.png "MobiCore control interface" + * @image latex DoxyOverviewMci500x.png "MobiCore control interface" width=12cm + * + * The MCI is composed of the following interfaces: + *
    + * + *
  • MobiCore control protocol (MCP) interface.

  • + * The MCP interface is responsible for the main communicating with the MobiCore. This involves sending commands for starting + * and stopping of Trustlets as well as checking their corresponding answers. MCP information is exchanged in a + * world shared memory buffer which needs to be initially established between NWd and SWd using the FastCall interface.
    + * + *
  • Notification queue interface.

  • + * Notifications inform the MobiCore runtime environment that information is pending in a WSM buffer. + * The Trustlet Connector (TLC) and the corresponding Trustlet also utilize this buffer to + * notify each other about new data within the Trustlet Connector Interface (TCI). Therefore the TLC writes + * a notification including the session ID to the buffer. The driver informs the MobiCore + * about the availability of a notification with the use of a SIQ. On the secure side the Runtime Management + * notifies the Trustlet, according to the given session ID, about the availability of new data. + * The same mechanism is used vice versa for writing data back to the None-secure world. + * + *
  • FastCall interface.

  • + * The FastCall interface of the MobiCore system is used to transfer control from the Non-secure World (NWd) to the + * Secure World (SWd) and back. There are three mechanisms the NWd shall use to interact with the MobiCore Monitor: + * FastCall, N-SIQ and NQ-IRQ (Notification IRQ). FastCall and N-SIQ operations are used to hand over control + * to the MobiCore. Both functions make use of the SMC [ARM11] operation. + * + *
+ * + * You can find more information about the interfaces in the respective modules description. + * + *

Version history

+ * + * + * + * + * + * + * + * + * + *
DateVersionChanges
2009-06-250.1Initial Release
2009-07-010.2Major rewrite
2009-08-060.3Added documentation for FastCall helper functions
2009-09-100.4Update of constant naming. Modification of doxygen config.
2010-03-090.5Added fastCallPower() helper function for MC_FC_POWER.
2010-05-100.6Restructuring of load format header.
2011-07-190.7update to reflect current code changes.
+ * + * + * @file + * @defgroup FCI FastCall Interface + * + * @defgroup NQ Notification Queue + * + * @defgroup MCP MobiCore Control Protocol + * + */ +#ifndef MCI_H_ +#define MCI_H_ + +#include "version.h" +#include "mcifc.h" +#include "mcinq.h" +#include "mcimcp.h" + +#endif /** MCI_H_ */ + +/** @} */ diff --git a/mobicore/common/MobiCore/inc/Mci/mcifc.h b/mobicore/common/MobiCore/inc/Mci/mcifc.h new file mode 100644 index 0000000000000000000000000000000000000000..12c34d6ab374d065fe3bc908b46813d5a94a629f --- /dev/null +++ b/mobicore/common/MobiCore/inc/Mci/mcifc.h @@ -0,0 +1,142 @@ +/* + * Copyright (c) 2013 TRUSTONIC LIMITED + * All rights reserved + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. The name of the author may not be used to endorse or promote + * products derived from this software without specific prior + * written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS + * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * + * @addtogroup FCI + * @{ + * @file + * FastCall declarations. + * + * Holds the functions for SIQ, YIELD and FastCall for switching to the secure world. + * + + */ +#ifndef MCIFC_H_ +#define MCIFC_H_ + +/** @name MobiCore FastCall Defines + * Defines for the two different FastCall's. + */ +/** @{ */ + +// --- global ---- +#define MC_FC_INVALID ((uint32_t) 0 ) /**< Invalid FastCall ID */ +#define MC_FC_INIT ((uint32_t)(-1)) /**< Initializing FastCall. */ +#define MC_FC_INFO ((uint32_t)(-2)) /**< Info FastCall. */ + +// following defines are currently frozen, so they will candidate for later big-change +// --- sleep modes --- +#define MC_FC_SLEEP ((uint32_t)(-3)) /**< enter power-sleep */ +#define MC_FC_AFTR ((uint32_t)(-5)) /**< enter AFTR-sleep (called from core-0) */ +// --- wake-up access --- +#define MC_FC_CORE_X_WAKEUP ((uint32_t)(-4)) /**< wakeup/boot core-x (optional core-number in r1, not "0" ) */ +#define MC_FC_C15_RESUME ((uint32_t)(-11)) /**< Write power control & diag registers */ +#define MC_FC_CMD_SAVE ((uint32_t)(-6)) /**< Save core context to CP15 table(r1 is core number) */ +#define MC_FC_CMD_SHUTDOWN ((uint32_t)(-7)) /**< Shutdown core(r1 is core number, cache flush is expected) */ +// --- L2 cache access --- +#define MC_FC_L2X0_CTRL ((uint32_t)(-21)) /**< Write to L2X0 control register */ +#define MC_FC_L2X0_SETUP1 ((uint32_t)(-22)) /**< Setup L2X0 register - part 1 */ +#define MC_FC_L2X0_SETUP2 ((uint32_t)(-23)) /**< Setup L2X0 register - part 2 */ +#define MC_FC_L2X0_INVALL ((uint32_t)(-24)) /**< Invalidate all L2 cache */ +#define MC_FC_L2X0_DEBUG ((uint32_t)(-25)) /**< Write L2X0 debug register */ +#define MC_FC_SW_RESET ((uint32_t)(-26)) /**< SW Reset if DDR has leftover content */ +// --- MEM traces --- +#define MC_FC_MEM_TRACE ((uint32_t)(-31)) /**< Enable SWd tracing via memory */ +// --- system settings --- + +#define MC_FC_STAT_COUNTER ((uint32_t)(-41)) /**< Require status counter */ +#define MC_FC_CP15_REG ((uint32_t)(-101)) /**< general CP15/cache register update */ +// --- store value in sDDRRAM --- +#define MC_FC_STORE_BINFO ((uint32_t)(-201)) /**< write a 32bit value in secure DDRRAM in incremented art (max 2kB) */ +#define MC_FC_LOAD_BINFO ((uint32_t)(-202)) /**< load a 32bit value from secure DDRRAM using an offset */ + +// Broadcom Specific Fastcalls +#define MC_FC_BCM_VC_CORE_START ((uint32_t)(-301)) /**< Set the VC Core start address*/ +#define MC_FC_MAX_ID ((uint32_t)(0xFFFF0000)) /**< Maximum allowed FastCall ID */ + +#define MC_FC_SWAP_CPU ((uint32_t)(0x84000005)) /**< Change new active Core */ +// r1 is requested status (0,1,2), on return r2 holds this status value + +/** @} */ + +/** @name MobiCore SMC Defines + * Defines the different secure monitor calls (SMC) for world switching. + * @{ */ +#define MC_SMC_N_YIELD 0x3 /**< Yield to switch from NWd to SWd. */ +#define MC_SMC_N_SIQ 0x4 /**< SIQ to switch from NWd to SWd. */ +/** @} */ + +/** @name MobiCore status + * MobiCore status information. + * @{ */ +#define MC_STATUS_NOT_INITIALIZED 0 /**< MobiCore is not yet initialized. FastCall FcInit() has to be used function to set up MobiCore.*/ +#define MC_STATUS_BAD_INIT 1 /**< Bad parameters have been passed in FcInit(). */ +#define MC_STATUS_INITIALIZED 2 /**< MobiCore did initialize properly. */ +#define MC_STATUS_HALT 3 /**< MobiCore kernel halted due to an unrecoverable exception. Further information is available extended info */ +/** @} */ + +/** @name Extended Info Identifiers + * Extended info parameters for MC_FC_INFO to obtain further information depending on MobiCore state. + * @{ */ +#define MC_EXT_INFO_ID_MCI_VERSION 0 /**< Version of the MobiCore Control Interface (MCI) */ +#define MC_EXT_INFO_ID_FLAGS 1 /**< MobiCore control flags */ +#define MC_EXT_INFO_ID_HALT_CODE 2 /**< MobiCore halt condition code */ +#define MC_EXT_INFO_ID_HALT_IP 3 /**< MobiCore halt condition instruction pointer */ +#define MC_EXT_INFO_ID_FAULT_CNT 4 /**< MobiCore fault counter */ +#define MC_EXT_INFO_ID_FAULT_CAUSE 5 /**< MobiCore last fault cause */ +#define MC_EXT_INFO_ID_FAULT_META 6 /**< MobiCore last fault meta */ +#define MC_EXT_INFO_ID_FAULT_THREAD 7 /**< MobiCore last fault threadid */ +#define MC_EXT_INFO_ID_FAULT_IP 8 /**< MobiCore last fault instruction pointer */ +#define MC_EXT_INFO_ID_FAULT_SP 9 /**< MobiCore last fault stack pointer */ +#define MC_EXT_INFO_ID_FAULT_ARCH_DFSR 10 /**< MobiCore last fault ARM arch information */ +#define MC_EXT_INFO_ID_FAULT_ARCH_ADFSR 11 /**< MobiCore last fault ARM arch information */ +#define MC_EXT_INFO_ID_FAULT_ARCH_DFAR 12 /**< MobiCore last fault ARM arch information */ +#define MC_EXT_INFO_ID_FAULT_ARCH_IFSR 13 /**< MobiCore last fault ARM arch information */ +#define MC_EXT_INFO_ID_FAULT_ARCH_AIFSR 14 /**< MobiCore last fault ARM arch information */ +#define MC_EXT_INFO_ID_FAULT_ARCH_IFAR 15 /**< MobiCore last fault ARM arch information */ +#define MC_EXT_INFO_ID_MC_CONFIGURED 16 /**< MobiCore configured by Daemon via fc_init flag */ +#define MC_EXT_INFO_ID_MC_SCHED_STATUS 17 /**< MobiCore scheduling status: idle/non-idle */ +#define MC_EXT_INFO_ID_MC_STATUS 18 /**< MobiCore runtime status: initialized, halted */ +#define MC_EXT_INFO_ID_MC_EXC_PARTNER 19 /**< MobiCore exception handler last partner */ +#define MC_EXT_INFO_ID_MC_EXC_IPCPEER 20 /**< MobiCore exception handler last peer */ +#define MC_EXT_INFO_ID_MC_EXC_IPCMSG 21 /**< MobiCore exception handler last IPC message */ +#define MC_EXT_INFO_ID_MC_EXC_IPCDATA 22 /**< MobiCore exception handler last IPC data */ + +/** @} */ + +/** @name FastCall return values + * Return values of the MobiCore FastCalls. + * @{ */ +#define MC_FC_RET_OK 0 /**< No error. Everything worked fine. */ +#define MC_FC_RET_ERR_INVALID 1 /**< FastCall was not successful. */ +#define MC_FC_RET_ERR_ALREADY_INITIALIZED 5 /**< MobiCore has already been initialized. */ +/** @} */ + +#endif /** MCIFC_H_ */ + +/** @} */ diff --git a/mobicore/common/MobiCore/inc/Mci/mcifcfunc.h b/mobicore/common/MobiCore/inc/Mci/mcifcfunc.h new file mode 100644 index 0000000000000000000000000000000000000000..895507ec0384d2e59ae99447bb4d8bc342bbfe02 --- /dev/null +++ b/mobicore/common/MobiCore/inc/Mci/mcifcfunc.h @@ -0,0 +1,193 @@ +/* + * Copyright (c) 2013 TRUSTONIC LIMITED + * All rights reserved + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. The name of the author may not be used to endorse or promote + * products derived from this software without specific prior + * written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS + * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * + * @addtogroup FCI + * @{ + * @file + * Declaration of FastCall helper functions. + * + * @attention Helper functions are mostly RealView (ARM CC) specific. + * + * Holds the functions for SIQ, YIELD and FastCall for switching to the secure world. + * + * + */ + +#ifndef MCIFCFUNC_H_ +#define MCIFCFUNC_H_ + +#include "mcifc.h" +/** + * Execute a secure monitor call (SMC). + * + * @param mode SMC mode affects the way SMC is handled + * + * @attention This function shall not be used directly. Use N_Siq() or Yield() instead. + */ +__smc(0) void smc(int32_t mode); + +/** + * N-SIQ switch from NWd to SWd. + * Execution will continue in the SWd. The notification queue will be drained by the MC4 and MC4 system schedules its services. + */ +inline void N_Siq(void) { smc(MC_SMC_N_SIQ); } + +/** + * Yield switch from NWd to SWd. + * Execution will continue in the SWd without scheduling MC4 services. + */ +inline void Yield(void) { smc(MC_SMC_N_YIELD); } + +/** Wrapper structure for parameter passing in registers. + * This structure is used as a "wrapper" return value for functions that + * return data in the registers r0 to r3. With the RealView compiler such + * function are declare as: _value_in_regs reg_r0_r1_r2_r3_t foo() + + */ +typedef struct { + uint32_t r0; + uint32_t r1; + uint32_t r2; + uint32_t r3; +} reg_r0_r1_r2_r3_t; + +/** Parameterized SMC for FastCalls. + * @attention This function shall not be used directly. + */ +__smc(0) __value_in_regs reg_r0_r1_r2_r3_t smcFc( + uint32_t r0, + uint32_t r1, + uint32_t r2, + uint32_t r3 +); + +/** FastCall helper function. + * @attention This function shall not be used directly. + */ +inline static __value_in_regs reg_r0_r1_r2_r3_t fastCall( + uint32_t r0, + uint32_t r1, + uint32_t r2, + uint32_t r3 +) { + return smcFc(r0,r1,r2,r3); +} + +/** + * Initialize the MobiCore. + * The FcMc4init FastCall shall be used to set up the MCI. The function passes the message buffers used in the MCI to the MC4 system. + * As long as the buffers are not set up the MC4 message passing mechanisms (notifications, MCP commands) are not available. + * NQ buffer and MCP buffer as well as length calculations are described in the "MobiCore4 Driver Interface Specification". + *
The fastCallInit() will not check the parameters for validity. Instead the MC4 will perform a check on first usage of the parameters. + * + * @image html DoxyMciBuffer.png "MCI buffer" + * @image latex DoxyMciBuffer.png "MCI buffer" width=12cm + * + * @param base Physical start address of the MCI buffer. Must be 4kB aligned. + * @param nqOffset Offset in bytes to the beginning of the NQ buffer. + * @param nqLength Length of the NQ buffer in bytes. + * @param mcpOffset Offset in bytes to the beginning of the MCP buffer. + * @param mcpLength Length of the MCP buffer in bytes + * + */ +inline static uint32_t fastCallInit( + uint8_t *base, + uint32_t nqOffset, + uint32_t nqLength, + uint32_t mcpOffset, + uint32_t mcpLength +) { + + reg_r0_r1_r2_r3_t ret; + + ret = fastCall( + MC_FC_INIT, + (uint32_t)base, + ((nqOffset << 16) | (nqLength & 0xFFFF)), + ((mcpOffset << 16) | (mcpLength & 0xFFFF)) ); + + + return ret.r1; +} + + +/** Get status information about MobiCore. + * The FcMcGetInfo FastCall provides information about the current state of the MobiCore. + * In certain states extended information is provided. + * + * @param extInfoId Extended info word to be obtained. + * @param mc4state Current state of the MobiCore. + * @param extInfo Extended information depending on state. + */ +inline static uint32_t fastCallGetInfo( + uint32_t extInfoId, + uint32_t *mc4state, + uint32_t *extInfo +) { + reg_r0_r1_r2_r3_t ret; + + ret = fastCall(MC_FC_INFO,extInfoId,0,0); + + if (MC_FC_RET_OK == ret.r1) + { + *mc4state = ret.r2; + *extInfo = ret.r3; + } + + return ret.r1; +} + +/** + * Power management. + * The power management FastCall is platform specific. + * + * @param param0 platform specific parameter. + * @param param1 platform specific parameter. + * @param param2 platform specific parameter. + */ +inline static uint32_t fastCallPower( + uint32_t param0, + uint32_t param1, + uint32_t param2 +) { + + reg_r0_r1_r2_r3_t ret; + + ret = fastCall( + MC_FC_POWER, + param0, + param1, + param2 ); + + return ret.r1; +} + +#endif /* MCIFCFUNC_H_ */ +/** + * @}*/ diff --git a/mobicore/common/MobiCore/inc/Mci/mcimcp.h b/mobicore/common/MobiCore/inc/Mci/mcimcp.h new file mode 100644 index 0000000000000000000000000000000000000000..1dc30e2c6ac32c75b99433c0dbda03c9f1d31bd8 --- /dev/null +++ b/mobicore/common/MobiCore/inc/Mci/mcimcp.h @@ -0,0 +1,432 @@ +/* + * Copyright (c) 2013 TRUSTONIC LIMITED + * All rights reserved + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. The name of the author may not be used to endorse or promote + * products derived from this software without specific prior + * written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS + * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * + * @addtogroup MCP + * @{ + * The MCP defines commands and responses which are used to control the MobiCore system. + * MCP information is exchanged in a world share memory buffer which has been established prior between NWd + * and SWd using the FastCall interface. The buffer needs to be provided by the MobiCore driver and is utilized + * to send MCP commands to the MobiCore as well as receiving responses from the MobiCore. + * The command of the normal world will be overwritten with the response from the secure side. + * + * @file + * MCP command interface definitions. + * + */ + +#ifndef MCP_H_ +#define MCP_H_ + + +#include "mcUuid.h" +#include "mcLoadFormat.h" +#include "mcVersionInfo.h" + + +/** MobiCore Return Code Defines. + * List of the possible MobiCore return codes. + */ +typedef enum { + MC_MCP_RET_OK = 0, /**< Memory has successfully been mapped. */ + MC_MCP_RET_ERR_INVALID_SESSION = 1, /**< The session ID is invalid. */ + MC_MCP_RET_ERR_UNKNOWN_UUID = 2, /**< The UUID of the Trustlet is unknown. */ + MC_MCP_RET_ERR_UNKNOWN_DRIVER_ID = 3, /**< The ID of the driver is unknown. */ + MC_MCP_RET_ERR_NO_MORE_SESSIONS = 4, /**< No more session are allowed. */ + MC_MCP_RET_ERR_CONTAINER_INVALID = 5, /**< The container is invalid. */ + MC_MCP_RET_ERR_TRUSTLET_INVALID = 6, /**< The Trustlet is invalid. */ + MC_MCP_RET_ERR_ALREADY_MAPPED = 7, /**< The memory block has already been mapped before. */ + MC_MCP_RET_ERR_INVALID_PARAM = 8, /**< Alignment or length error in the command parameters. */ + MC_MCP_RET_ERR_OUT_OF_RESOURCES = 9, /**< No space left in the virtual address space of the session. */ + MC_MCP_RET_ERR_INVALID_WSM = 10, /**< WSM type unknown or broken WSM */ + MC_MCP_RET_ERR_UNKNOWN = 11, /**< unknown error. */ + MC_MCP_RET_ERR_INVALID_MAPPING_LENGTH = 12, /**< Lenght of map invalid */ + MC_MCP_RET_ERR_MAPPING_TARGET = 13, /**< Map can only be applied to Trustlet session */ + MC_MCP_RET_ERR_OUT_OF_CRYPTO_RESSOURCES = 14, /**< Couldn't open crypto session. */ + MC_MCP_RET_ERR_SIGNATURE_VERIFICATION_FAILED = 15, /**< System Trustlet signature verification failed. */ + MC_MCP_RET_ERR_WRONG_PUBLIC_KEY = 16, /**< System Trustlet public key is wrong. */ + MC_MCP_RET_ERR_CONTAINER_TYPE_MISMATCH = 17, /**< Wrong containter type(s). */ + MC_MCP_RET_ERR_CONTAINER_LOCKED = 18, /**< Container is locked (or not activated). */ + MC_MCP_RET_ERR_SP_NO_CHILD = 19, /**< SPID is not registered with root container. */ + MC_MCP_RET_ERR_TL_NO_CHILD = 20, /**< UUID is not registered with sp container. */ + MC_MCP_RET_ERR_UNWRAP_ROOT_FAILED = 21, /**< Unwrapping of root container failed. */ + MC_MCP_RET_ERR_UNWRAP_SP_FAILED = 22, /**< Unwrapping of service provider container failed. */ + MC_MCP_RET_ERR_UNWRAP_TRUSTLET_FAILED = 23, /**< Unwrapping of Trustlet container failed. */ + MC_MCP_RET_ERR_CONTAINER_VERSION_MISMATCH = 24, /**< Container version mismatch. */ + MC_MCP_RET_ERR_SP_TL_DECRYPTION_FAILED = 25, /**< Decryption of service provider trustlet failed. */ + MC_MCP_RET_ERR_SP_TL_HASH_CHECK_FAILED = 26, /**< Hash check of service provider trustlet failed. */ + MC_MCP_RET_ERR_LAUNCH_TASK_FAILED = 27, /**< Activation/starting of task failed. */ + MC_MCP_RET_ERR_CLOSE_TASK_FAILED = 28, /**< Closing of task not yet possible, try again later. */ + + // used for command verification + MC_MCP_RET_ERR_UNKNOWN_COMMAND = 50, /**< The command is unknown. */ + MC_MCP_RET_ERR_INVALID_DATA = 51 /**< The command data is invalid. */ +} mcpResult_t; + +/** Possible MCP Command IDs + * Command ID must be between 0 and 0x7FFFFFFF. + */ +typedef enum { + MC_MCP_CMD_ID_INVALID = 0x00000000, /**< Invalid command ID. */ + // Session commands + MC_MCP_CMD_OPEN_SESSION = 0x00000001, /**< Open a session to a service. */ + MC_MCP_CMD_CLOSE_SESSION = 0x00000003, /**< Close an existing service session. */ + MC_MCP_CMD_MAP = 0x00000004, /**< Map a block of WSM to a session. */ + MC_MCP_CMD_UNMAP = 0x00000005, /**< Unmap a block of WSM from a session. */ + MC_MCP_CMD_SUSPEND = 0x00000006, /**< Prepare MobiCore for suspend. */ + MC_MCP_CMD_RESUME = 0x00000007, /**< Resume MobiCore from suspension. */ + // obsolete: MC_MCP_CMD_DONATE_RAM = 0x00000008, + MC_MCP_CMD_GET_MOBICORE_VERSION = 0x00000009, /**< Get MobiCore version information. */ + MC_MCP_CMD_CLOSE_MCP = 0x0000000A, /**< Close MCP and unmap MCI. */ + MC_MCP_CMD_LOAD_TOKEN = 0x0000000B, /**< Load token for device attestation */ + MC_MCP_CMD_CHECK_LOAD_TA = 0x0000000C, /**< Check that TA can be loaded */ +} mcpCmdId_t; + + +#define FLAG_RESPONSE (1U << 31) /**< Flag to indicate that this is the response to a MCP command. */ + + +/** Types of WSM known to the MobiCore. + */ +typedef uint32_t wsmType_t; + +#define WSM_TYPE_MASK 0xFF +#define WSM_INVALID 0 /**< Invalid memory type */ +#define WSM_CONTIGUOUS 1 /**< Reference to WSM points to a contiguous region of pages. */ +#define WSM_L2 2 /**< Reference to WSM points to an L2 table describing the memory region to share */ +#define WSM_WSM_UNCACHED 0x100 /**< Bitflag indicating that WSM should be uncached */ +#define WSM_L2_UNCACHED 0x100 /**< Bitflag indicating that L2 table should be uncached */ + + +/** Command header. + * It just contains the command ID. Only values specified in mcpCmdId_t are allowed as command IDs. + * If the command ID is unspecified the MobiCore returns an empty response with the result set to MC_MCP_RET_ERR_UNKNOWN_COMMAND . + */ +typedef struct { + mcpCmdId_t cmdId; /**< Command ID of the command */ +} commandHeader_t, *commandHeader_ptr; + +/** Response header. + * MobiCore will reply to every MCP command with an MCP response. Like the MCP command the response consists of a + * header followed by response data. The response is written to the same memory location as the MCP command. + */ +typedef struct { + uint32_t rspId; /**< Command ID | FLAG_RESPONSE. */ + mcpResult_t result; /**< Result informs about the execution result of the command associated with the response. */ +} responseHeader_t, *responseHeader_ptr; + + + +/** @defgroup CMD MCP Commands + * @{ */ + +/** @defgroup ASMCMD Administrative Commands + * @{ */ + +/** @defgroup MCPGETMOBICOREVERSION GET_MOBICORE_VERSION + * Get MobiCore version info. + * + * @{ */ + +/** Get MobiCore Version Command. */ +typedef struct { + commandHeader_t cmdHeader; /** Command header. */ +} mcpCmdGetMobiCoreVersion_t, *mcpCmdGetMobiCoreVersion_ptr; + +/** Get MobiCore Version Command Response. */ +typedef struct { + responseHeader_t rspHeader; /** Response header. */ + mcVersionInfo_t versionInfo; /** MobiCore version info. */ +} mcpRspGetMobiCoreVersion_t, *mcpRspGetMobiCoreVersion_ptr; + +/** @} */// End MCPGETMOBICOREVERSION + +/** @} */// End ASMCMD + + +/** @defgroup POWERCMD Power Management Commands + * @{ */ + +/** @defgroup MCPSUSPEND SUSPEND + * Prepare MobiCore suspension. + * This command allows MobiCore and MobiCore drivers to release or clean resources and save device state. + * + * @{ */ + +/** Suspend Command */ +typedef struct { + commandHeader_t cmdHeader; /**< Command header. */ +} mcpCmdSuspend_t, *mcpCmdSuspend_ptr; + +/** Suspend Command Response */ +typedef struct { + responseHeader_t rspHeader; /**< Response header. */ +} mcpRspSuspend_t, *mcpRspSuspend_ptr; +/** @} */// End MCPSUSPEND + + +/** @defgroup MCPRESUME RESUME + * Resume MobiCore from suspension. + * This command allows MobiCore and MobiCore drivers to reinitialize hardware affected by suspension. + * + * @{ */ + +/** Resume Command */ +typedef struct { + commandHeader_t cmdHeader; /**< Command header. */ +} mcpCmdResume_t, *mcpCmdResume_ptr; + +/** Resume Command Response */ +typedef struct { + responseHeader_t rspHeader; /**< Response header. */ +} mcpRspResume_t, *mcpRspResume_ptr; + +/** @} */// End MCPRESUME + +/** @} */// End POWERCMD + + + +/** @defgroup SESSCMD Session Management Commands + * @{ */ + +/** @defgroup MCPOPEN OPEN + * Load and open a session to a Trustlet. + * The OPEN command loads Trustlet data to the MobiCore context and opens a session to the Trustlet. + * If wsmTypeLoadData is WSM_INVALID MobiCore tries to start a pre-installed Trustlet + * associated with the uuid passed. + * The uuid passed must match the uuid contained in the load data (if available). + * On success, MobiCore returns the session ID which can be used for further communication. + * @{ */ + +/** Open Command */ +typedef struct { + commandHeader_t cmdHeader; /**< Command header. */ + mcUuid_t uuid; /**< Byte array containing the service UUID. */ + uint64_t adrTciBuffer; /**< Physical address of the TCI */ + uint64_t adrLoadData; /**< Physical address of the data to load. */ + uint32_t ofsTciBuffer; /**< Offset to the data. */ + uint32_t lenTciBuffer; /**< Length of the TCI. */ + wsmType_t wsmTypeTci; /**< Type of WSM used for the TCI */ + wsmType_t wsmTypeLoadData; /**< Type of the memory containing the data to load. */ + uint32_t ofsLoadData; /**< Offset to the data. */ + uint32_t lenLoadData; /**< Length of the data to load. */ + mclfHeader_t tlHeader; /**< Service header. */ +} mcpCmdOpen_t, *mcpCmdOpen_ptr; + +/** Open Command Response */ +typedef struct { + responseHeader_t rspHeader; /**< Response header. */ + uint32_t sessionId; /**< Session ID used for further communication. */ +} mcpRspOpen_t, *mcpRspOpen_ptr; + +/** TA Load Check Command */ +typedef struct { + commandHeader_t cmdHeader; /**< Command header. */ + mcUuid_t uuid; /**< Byte array containing the service UUID. */ + uint64_t adrLoadData; /**< Physical address of the data to load. */ + wsmType_t wsmTypeLoadData; /**< Type of the memory containing the data to load. */ + uint32_t ofsLoadData; /**< Offset to the data. */ + uint32_t lenLoadData; /**< Length of the data to load. */ + mclfHeader_t tlHeader; /**< Service header. */ +} mcpCmdCheckLoad_t, *mcpCmdCheckLoad_ptr; + +/** TA Load Check Response */ +typedef struct { + responseHeader_t rspHeader; /**< Response header. */ +} mcpRspCheckLoad_t, *mcpRspCheckLoad_ptr; + + +/** @} */// End MCPOPEN + + +/** @defgroup MCPCLOSE CLOSE + * Close an existing session to a Trustlet. + * The CLOSE command terminates a session and frees all resources in the MobiCore system which + * are currently occupied by the session. Before closing the session, the MobiCore runtime + * management waits until all pending operations, like calls to drivers, invoked by the Trustlet + * have been terminated. + * Mapped memory will automatically be unmapped from the MobiCore context. The NWd is responsible for + * processing the freed memory according to the Rich-OS needs. + * + * @{ */ + +/** Close Command */ +typedef struct { + commandHeader_t cmdHeader; /**< Command header. */ + uint32_t sessionId; /**< Session ID. */ +} mcpCmdClose_t, *mcpCmdClose_ptr; + +/** Close Command Response */ +typedef struct { + responseHeader_t rspHeader; /**< Response header. */ +} mcpRspClose_t, *mcpRspClose_ptr; + +/** @} */// End MCPCLOSE + + +/** @defgroup MCPMAP MAP + * Map a portion of memory to a session. + * The MAP command provides a block of memory to the context of a service. + * The memory then becomes world-shared memory (WSM). + * The WSM can either be normal anonymous memory from malloc() or be a + * block of page aligned, contiguous memory. + * The only allowed memory type here is WSM_L2. + * @{ */ + +/** Map Command */ +typedef struct { + commandHeader_t cmdHeader; /**< Command header. */ + uint32_t sessionId; /**< Session ID of a valid session */ + wsmType_t wsmType; /**< Type of WSM used of the memory*/ + uint32_t ofsBuffer; /**< Offset to the payload. */ + uint64_t adrBuffer; /**< Physical address of the memory */ + uint32_t lenBuffer; /**< Length of the buffer. */ +} mcpCmdMap_t, *mcpCmdMap_ptr; + +#define MCP_MAP_MAX 0x100000 /**< Maximum allowed length for MCP map. */ + +/** Map Command Response */ +typedef struct { + responseHeader_t rspHeader; /**< Response header. */ + uint32_t secureVirtualAdr; /**< Virtual address in the context of the service the WSM is mapped to, already includes a possible offset! */ +} mcpRspMap_t, *mcpRspMap_ptr; + +/** @} *///End MCPMAP + + +/** @defgroup MCPUNMAP UNMAP + * Unmap a portion of world-shared memory from a session. + * The UNMAP command is used to unmap a previously mapped block of + * world shared memory from the context of a session. + * + * Attention: The memory block will be immediately unmapped from the specified session. + * If the service is still accessing the memory, the service will trigger a segmentation fault. + * @{ */ + +/** Unmap Command */ +typedef struct { + commandHeader_t cmdHeader; /**< Command header. */ + uint32_t sessionId; /**< Session ID of a valid session */ + wsmType_t wsmType; /**< Type of WSM used of the memory*/ + uint32_t secureVirtualAdr; /**< Virtual address in the context of the service the WSM has been mapped to, already includes a possible offset! */ + uint32_t lenVirtualBuffer; /**< Length of the virtual buffer. */ +} mcpCmdUnmap_t, *mcpCmdUnmap_ptr; + +/** Unmap Command Response */ +typedef struct { + responseHeader_t rspHeader; /**< Response header. */ +} mcpRspUnmap_t, *mcpRspUnmap_ptr; + +/** @} */// End MCPUNMAP + +/** @} */// End SESSCMD + +/** @defgroup MCPLOADTOKEN + * Load a token from the normal world and share it with MC_FLAG_SCHEDULE_IDLE, MobiCore should be scheduled by the NWd */ + mcSleepMod_t sleepMode; /**< */ + uint32_t RFU2; /**< Reserved for future use: Must not be interpreted */ + uint32_t RFU3; /**< Reserved for future use: Must not be interpreted */ +} mcFlags_t, *mcFlags_ptr; + +#define MC_FLAG_SCHEDULE_IDLE 0 /**< MobiCore is idle. No scheduling required. */ +#define MC_FLAG_SCHEDULE_NON_IDLE 1 /**< MobiCore is non idle, scheduling is required. */ + + + +/** MCP buffer structure */ +typedef struct { + mcFlags_t mcFlags; /**< MobiCore Flags */ + mcpMessage_t mcpMessage; /**< MCP message buffer */ +} mcpBuffer_t, *mcpBuffer_ptr; + +/** @} */ +#endif /* MCP_H_ */ diff --git a/mobicore/common/MobiCore/inc/Mci/mcinq.h b/mobicore/common/MobiCore/inc/Mci/mcinq.h new file mode 100644 index 0000000000000000000000000000000000000000..4036cab2165fb1e7b80563ca136c4c01dbc0756f --- /dev/null +++ b/mobicore/common/MobiCore/inc/Mci/mcinq.h @@ -0,0 +1,113 @@ +/* + * Copyright (c) 2013 TRUSTONIC LIMITED + * All rights reserved + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. The name of the author may not be used to endorse or promote + * products derived from this software without specific prior + * written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS + * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * + * @addtogroup NQ + * @{ + * Notifications inform the MobiCore runtime environment that information is pending in a WSM buffer. + * The Trustlet Connector (TLC) and the corresponding trustlet also utilize this buffer to notify + * each other about new data within the Trustlet Connector Interface (TCI). + * + * The buffer is set up as a queue, which means that more than one notification can be written to the buffer + * before the switch to the other world is performed. Each side therefore facilitates an incoming and an + * outgoing queue for communication with the other side. + * + * Notifications hold the session ID, which is used to reference the communication partner in the other world. + * So if, e.g., the TLC in the normal world wants to notify his trustlet about new data in the TLC buffer + * + * @file + * Notification queue declarations. + * + */ + +#ifndef NQ_H_ +#define NQ_H_ + +/** \name NQ Size Defines + * Minimum and maximum count of elements in the notification queue. + * @{ */ +#define MIN_NQ_ELEM 1 /**< Minimum notification queue elements. */ +#define MAX_NQ_ELEM 64 /**< Maximum notification queue elements. */ +/** @} */ + +/** \name NQ Length Defines + * Minimum and maximum notification queue length. + * @{ */ +#define MIN_NQ_LEN (MIN_NQ_ELEM * sizeof(notification_t)) /**< Minimum notification length (in bytes). */ +#define MAX_NQ_LEN (MAX_NQ_ELEM * sizeof(notification_t)) /**< Maximum notification length (in bytes). */ +/** @} */ + +/** \name Session ID Defines + * Standard Session IDs. + * @{ */ +#define SID_MCP 0 /**< MCP session ID is used when directly communicating with the MobiCore (e.g. for starting and stopping of trustlets). */ +#define SID_INVALID 0xffffffff /**< Invalid session id is returned in case of an error. */ +/** @} */ + +/** Notification data structure. */ +typedef struct{ + uint32_t sessionId; /**< Session ID. */ + int32_t payload; /**< Additional notification information. */ +} notification_t; + +/** Notification payload codes. + * 0 indicated a plain simple notification, + * a positive value is a termination reason from the task, + * a negative value is a termination reason from MobiCore. + * Possible negative values are given below. + */ +typedef enum { + ERR_INVALID_EXIT_CODE = -1, /**< task terminated, but exit code is invalid */ + ERR_SESSION_CLOSE = -2, /**< task terminated due to session end, no exit code available */ + ERR_INVALID_OPERATION = -3, /**< task terminated due to invalid operation */ + ERR_INVALID_SID = -4, /**< session ID is unknown */ + ERR_SID_NOT_ACTIVE = -5 /**< session is not active */ +} notificationPayload_t; + +/** Declaration of the notification queue header. + * layout as specified in the data structure specification. + */ +typedef struct { + uint32_t writeCnt; /**< Write counter. */ + uint32_t readCnt; /**< Read counter. */ + uint32_t queueSize; /**< Queue size. */ +} notificationQueueHeader_t; + +/** Queue struct which defines a queue object. + * The queue struct is accessed by the queue type of + * function. elementCnt must be a power of two and the power needs + * to be smaller than power of uint32_t (obviously 32). + */ +typedef struct { + notificationQueueHeader_t hdr; /**< Queue header. */ + notification_t notification[MIN_NQ_ELEM]; /**< Notification elements. */ +} notificationQueue_t; + +#endif /** NQ_H_ */ + +/** @} */ diff --git a/mobicore/common/MobiCore/inc/Mci/version.h b/mobicore/common/MobiCore/inc/Mci/version.h new file mode 100644 index 0000000000000000000000000000000000000000..013094193cfa5783dad34be9cec4a302a33467be --- /dev/null +++ b/mobicore/common/MobiCore/inc/Mci/version.h @@ -0,0 +1,37 @@ +/* + * Copyright (c) 2013 TRUSTONIC LIMITED + * All rights reserved + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. The name of the author may not be used to endorse or promote + * products derived from this software without specific prior + * written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS + * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#ifndef MCI_VERSION_H_ +#define MCI_VERSION_H_ + +#define MCI_VERSION_MAJOR 0 +#define MCI_VERSION_MINOR 6 + +#endif /** MCI_VERSION_H_ */ diff --git a/mobicore/common/MobiCore/inc/TlCm/2.0/cmp.h b/mobicore/common/MobiCore/inc/TlCm/2.0/cmp.h new file mode 100644 index 0000000000000000000000000000000000000000..94fa4e250d65ad9e73b6e0b619c09210ea78e9bf --- /dev/null +++ b/mobicore/common/MobiCore/inc/TlCm/2.0/cmp.h @@ -0,0 +1,1999 @@ +/** @addtogroup CMP_2_0 + * Content Management Protocol 2.0 Definitions. + * + * The content management protocol (CMP) is based on the trustlet control + * interface (TCI) and defines commands/responses with the content management + * trustlet (TlCm). + * + * @{ + * + * @file + * CMP 2.0 global definitions. + * Various components need access to (sub-)structures defined and used by CMP + * 2.0. These common definitions are made available through this header file. + * + * Copyright © Trustonic Limited 2013. + * + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * 3. Neither the name of the Trustonic Limited nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef CMP_H_ +#define CMP_H_ + +#include "TlCm/cmpCommon.h" + +/** Key size of encryption algorithm used for secure messaging. */ +#define CMP_MSG_KEY_SIZE 32 + +/** @defgroup MC_CMP_2_0_CMD_BEGIN_SOC_AUTHENTICATION \ + MC_CMP_2_0_CMD_BEGIN_SOC_AUTHENTICATION + * @{ */ + +/** @defgroup MC_CMP_2_0_CMD_BEGIN_SOC_AUTHENTICATION_CMD Command_2_0 + * @{ */ + +/** BeginSocAuthentication non signed command. */ +typedef struct { + /** Command header. */ + cmpCommandHeader_t cmdHeader; +} cmpBeginSocAuthenticationCmd_t; + +/** BeginSocAuthentication command. */ +typedef struct { + /** Command. */ + cmpBeginSocAuthenticationCmd_t cmd; + /** AuthToken container secure object. */ + mcSoAuthTokenCont_t soAuthTokenCont; +} cmpCmdBeginSocAuthentication_t; + +/** @} */ + +/** @defgroup MC_CMP_2_0_CMD_BEGIN_SOC_AUTHENTICATION_RSP Response_2_0 + * @{ */ + +/** BeginSocAuthentication signed response. */ +typedef struct { + /** Response header. */ + cmpResponseHeader_t rspHeader; + /** Suid. */ + mcSuid_t suid; + /** SWd authentication random number. */ + cmpRnd8_t rnd1; +} cmpBeginSocAuthenticationRspSdata_t; + +/** BeginSocAuthentication signed response and signature. */ +typedef struct { + /** Signed response. */ + cmpBeginSocAuthenticationRspSdata_t sdata; + /** Signature. */ + cmpMac_t mac; +} cmpBeginSocAuthenticationRsp_t; + +/** BeginSocAuthentication response. */ +typedef struct { + /** Response. */ + cmpBeginSocAuthenticationRsp_t rsp; +} cmpRspBeginSocAuthentication_t; + +/** @} */ + +/** @} */ + +/** @defgroup MC_CMP_2_0_CMD_BEGIN_ROOT_AUTHENTICATION \ + MC_CMP_2_0_CMD_BEGIN_ROOT_AUTHENTICATION + * @{ */ + +/** @defgroup MC_CMP_2_0_CMD_BEGIN_ROOT_AUTHENTICATION_CMD Command_2_0 + * @{ */ + +/** BeginRootAuthentication non signed command. */ +typedef struct { + /** Command header. */ + cmpCommandHeader_t cmdHeader; +} cmpBeginRootAuthenticationCmd_t; + +/** BeginRootAuthentication command. */ +typedef struct { + /** Command. */ + cmpBeginRootAuthenticationCmd_t cmd; + /** Root container secure object. */ + mcSoRootCont_t soRootCont; +} cmpCmdBeginRootAuthentication_t; + +/** @} */ + +/** @defgroup MC_CMP_2_0_CMD_BEGIN_ROOT_AUTHENTICATION_RSP Response_2_0 + * @{ */ + +/** BeginRootAuthentication signed response. */ +typedef struct { + /** Response header. */ + cmpResponseHeader_t rspHeader; + /** Suid. */ + mcSuid_t suid; + /** SWd authentication random number. */ + cmpRnd8_t rnd1; +} cmpBeginRootAuthenticationRspSdata_t; + +/** BeginRootAuthentication signed response and signature. */ +typedef struct { + /** Signed response. */ + cmpBeginRootAuthenticationRspSdata_t sdata; + /** Signature. */ + cmpMac_t mac; +} cmpBeginRootAuthenticationRsp_t; + +/** BeginRootAuthentication response. */ +typedef struct { + /** Response. */ + cmpBeginRootAuthenticationRsp_t rsp; +} cmpRspBeginRootAuthentication_t; + +/** @} */ + +/** @} */ + +/** @defgroup MC_CMP_2_0_CMD_BEGIN_SP_AUTHENTICATION \ + MC_CMP_2_0_CMD_BEGIN_SP_AUTHENTICATION + * @{ */ + +/** @defgroup MC_CMP_2_0_CMD_BEGIN_SP_AUTHENTICATION_CMD Command_2_0 + * @{ */ + +/** BeginSpAuthentication non signed command. */ +typedef struct { + /** Command header. */ + cmpCommandHeader_t cmdHeader; + /** Spid. */ + mcSpid_t spid; +} cmpBeginSpAuthenticationCmdSdata_t; + +/** BeginSpAuthentication non signed command and no signature. */ +typedef struct { + /** Non signed command. */ + cmpBeginSpAuthenticationCmdSdata_t sdata; +} cmpBeginSpAuthenticationCmd_t; + +/** BeginSpAuthentication command. */ +typedef struct { + /** Command. */ + cmpBeginSpAuthenticationCmd_t cmd; + /** Root container secure object. */ + mcSoRootCont_t soRootCont; + /** Sp container secure object. */ + mcSoSpCont_t soSpCont; +} cmpCmdBeginSpAuthentication_t; + +/** @} */ + +/** @defgroup MC_CMP_2_0_CMD_BEGIN_SP_AUTHENTICATION_RSP Response_2_0 + * @{ */ + +/** BeginSpAuthentication signed response. */ +typedef struct { + /** Response header. */ + cmpResponseHeader_t rspHeader; + /** Suid. */ + mcSuid_t suid; + /** Spid. */ + mcSpid_t spid; + /** SWd authentication random number. */ + cmpRnd8_t rnd1; +} cmpBeginSpAuthenticationRspSdata_t; + +/** BeginSpAuthentication signed response and signature. */ +typedef struct { + /** Signed response. */ + cmpBeginSpAuthenticationRspSdata_t sdata; + /** Signature. */ + cmpMac_t mac; +} cmpBeginSpAuthenticationRsp_t; + +/** BeginSpAuthentication response. */ +typedef struct { + /** Response. */ + cmpBeginSpAuthenticationRsp_t rsp; +} cmpRspBeginSpAuthentication_t; + +/** @} */ + +/** @} */ + +/** @defgroup MC_CMP_2_0_CMD_AUTHENTICATE MC_CMP_2_0_CMD_AUTHENTICATE + * @{ */ + +/** @defgroup MC_CMP_2_0_CMD_AUTHENTICATE_CMD Command_2_0 + * @{ */ + +/** Authenticate encrypted data command. */ +typedef struct { + /** Suid. */ + mcSuid_t suid; + /** EntityId. */ + uint32_t entityId; + /** NWd authentication random number. */ + cmpRnd8_t rnd2; + /** SWd authentication random number. */ + cmpRnd8_t rnd1; + /** NWd authentication random seed. */ + cmpRnd32_t k2; +} cmpAuthMsgEdata_t; + +/** Authenticate encrypted and padded data command. */ +typedef struct { + /** Encrypted data. */ + cmpAuthMsgEdata_t edata; + /** Padding. */ + uint8_t padding[CMP_ED_PADDING(sizeof(cmpAuthMsgEdata_t))]; +} cmpAuthCmdEd_t; + +/** Authenticate signed command. */ +typedef struct { + /** Command header. */ + cmpCommandHeader_t cmdHeader; + /** Encrypted and padded data. */ + cmpAuthCmdEd_t ed; +} cmpAuthCmdSdata_t; + +/** Authenticate signed command and signature. */ +typedef struct { + /** Signed command. */ + cmpAuthCmdSdata_t sdata; + /** Signature. */ + cmpMac_t mac; +} cmpAuthenticateCmd_t; + +/** Authenticate command. */ +typedef struct { + /** Command. */ + cmpAuthenticateCmd_t cmd; +} cmpCmdAuthenticate_t; + +/** @} */ + +/** @defgroup MC_CMP_2_0_CMD_AUTHENTICATE_RSP Response_2_0 + * @{ */ + +/** Authenticate encrypted data response. */ +typedef struct { + /** Suid. */ + mcSuid_t suid; + /** EntityId. */ + uint32_t entityId; + /** SWd authentication random number. */ + cmpRnd8_t rnd1; + /** NWd authentication random number. */ + cmpRnd8_t rnd2; + /** SWd authentication random seed. */ + cmpRnd32_t k1; +} cmpAuthRspEdata_t; + +/** Authenticate encrypted and padded data response. */ +typedef struct { + /** Encrypted data. */ + cmpAuthRspEdata_t edata; + /** Padding. */ + uint8_t padding[CMP_ED_PADDING(sizeof(cmpAuthRspEdata_t))]; +} cmpAuthRspEd_t; + +/** Authenticate signed response. */ +typedef struct { + /** Response header. */ + cmpResponseHeader_t rspHeader; + /** Encrypted and padded data. */ + cmpAuthRspEd_t ed; +} cmpAuthRspSdata_t; + +/** Authenticate signed response and signature. */ +typedef struct { + /** Signed response. */ + cmpAuthRspSdata_t sdata; + /** Signature. */ + cmpMac_t mac; +} cmpAuthenticateRsp_t; + +/** Authenticate response. */ +typedef struct { + /** Response. */ + cmpAuthenticateRsp_t rsp; +} cmpRspAuthenticate_t; + +/** @} */ + +/** @} */ + +/** @defgroup MC_CMP_2_0_CMD_AUTHENTICATE_TERMINATE \ + MC_CMP_2_0_CMD_AUTHENTICATE_TERMINATE + * @{ */ + +/** @defgroup MC_CMP_2_0_CMD_AUTHENTICATE_TERMINATE_CMD Command_2_0 + * @{ */ + +/** AuthenticateTerminate signed command. */ +typedef struct { + /** Command header. */ + cmpCommandHeader_t cmdHeader; +} cmpAuthenticateTerminateCmdSdata_t; + +/** AuthenticateTerminate signed command and signature. */ +typedef struct { + /** Signed command. */ + cmpAuthenticateTerminateCmdSdata_t sdata; + /** Signature. */ + cmpMac_t mac; +} cmpAuthenticateTerminateCmd_t; + +/** AuthenticateTerminate command. */ +typedef struct { + /** Command. */ + cmpAuthenticateTerminateCmd_t cmd; +} cmpCmdAuthenticateTerminate_t; + +/** @} */ + +/** @defgroup MC_CMP_2_0_CMD_AUTHENTICATE_TERMINATE_RSP Response_2_0 + * @{ */ + +/** AuthenticateTerminate signed response. */ +typedef struct { + /** Response header. */ + cmpResponseHeader_t rspHeader; +} cmpAuthenticateTerminateRspSdata_t; + +/** AuthenticateTerminate signed response and signature. */ +typedef struct { + /** Signed response. */ + cmpAuthenticateTerminateRspSdata_t sdata; + /** Signature. */ + cmpMac_t mac; +} cmpTerminateAutenticateRsp_t; + +/** AuthenticateTerminate response. */ +typedef struct { + /** Response. */ + cmpTerminateAutenticateRsp_t rsp; +} cmpRspAuthenticateTerminate_t; + +/** @} */ + +/** @} */ + +/** @defgroup MC_CMP_2_0_CMD_ROOT_CONT_REGISTER_ACTIVATE \ + MC_CMP_2_0_CMD_ROOT_CONT_REGISTER_ACTIVATE + * @{ */ + +/** @defgroup MC_CMP_2_0_CMD_ROOT_CONT_REGISTER_ACTIVATE_CMD Command_2_0 + * @{ */ + +/** RootContRegisterActivate encrypted data command. */ +typedef struct { + /** Root authentication key. */ + mcSymmetricKey_t kRootAuth; +} cmpRootRegActMsgEdata_t; + +/** RootContRegisterActivate encrypted and padded data command. */ +typedef struct { + /** Encrypted data. */ + cmpRootRegActMsgEdata_t edata; + /** Padding. */ + uint8_t padding[CMP_ED_PADDING(sizeof(cmpRootRegActMsgEdata_t))]; +} cmpRootRegActCmdEd_t; + +/** RootContRegisterActivate signed command. */ +typedef struct { + /** Command header. */ + cmpCommandHeader_t cmdHeader; + /** Rootid. */ + mcRootid_t rootid; + /** Encrypted and padded data. */ + cmpRootRegActCmdEd_t ed; +} cmpRootRegActCmdSdata_t; + +/** RootContRegisterActivate signed command and signature. */ +typedef struct { + /** Signed command. */ + cmpRootRegActCmdSdata_t sdata; + /** Signature. */ + cmpMac_t mac; +} cmpRootContRegisterActivateCmd_t; + +/** RootContRegisterActivate command. */ +typedef struct { + /** Command. */ + cmpRootContRegisterActivateCmd_t cmd; +} cmpCmdRootContRegisterActivate_t; + +/** @} */ + +/** @defgroup MC_CMP_2_0_CMD_ROOT_CONT_REGISTER_ACTIVATE_RSP Response_2_0 + * @{ */ + +/** RootContRegisterActivate encrypted data response. */ +typedef struct { + /** Root container secure object. */ + mcSoRootCont_t soRootCont; +} cmpRootRegActRspEdata_t; + +/** RootContRegisterActivate encrypted and padded data response. */ +typedef struct { + /** Encrypted data. */ + cmpRootRegActRspEdata_t edata; + /** Padding. */ + uint8_t padding[CMP_ED_PADDING(sizeof(cmpRootRegActRspEdata_t))]; +} cmpRootRegActRspEd_t; + +/** RootContRegisterActivate signed response. */ +typedef struct { + /** Response header. */ + cmpResponseHeader_t rspHeader; + /** Encrypted and padded data. */ + cmpRootRegActRspEd_t ed; +} cmpRootRegActRspSdata_t; + +/** RootContRegisterActivate signed response and signature. */ +typedef struct { + /** Signed response. */ + cmpRootRegActRspSdata_t sdata; + /** Signature. */ + cmpMac_t mac; +} cmpRootContRegisterActivateRsp_t; + +/** RooContRegisterActivate response. */ +typedef struct { + /** Response. */ + cmpRootContRegisterActivateRsp_t rsp; + /** Root container secure object. */ + mcSoRootCont_t soRootCont; +} cmpRspRootContRegisterActivate_t; + +/** @} */ + +/** @} */ + +/** @defgroup MC_CMP_2_0_CMD_ROOT_CONT_UNREGISTER \ + MC_CMP_2_0_CMD_ROOT_CONT_UNREGISTER + * @{ */ + +/** @defgroup MC_CMP_2_0_CMD_ROOT_CONT_UNREGISTER_CMD Command_2_0 + * @{ */ + +/** RootContUnregister encrypted data command. */ +typedef struct { + /** Suid. */ + mcSuid_t suid; + /** AuthToken container secure object. */ + mcSoAuthTokenCont_t soAuthTokenCont; +} cmpRootUnregMsgEdata_t; + +/** RootContUnregister encrypted and padded data command. */ +typedef struct { + /** Encrypted data. */ + cmpRootUnregMsgEdata_t edata; + /** Padding. */ + uint8_t padding[CMP_ED_PADDING(sizeof(cmpRootUnregMsgEdata_t))]; +} cmpRootUnregCmdEd_t; + +/** RootContUnregister signed command. */ +typedef struct { + /** Command header. */ + cmpCommandHeader_t cmdHeader; + /** Encrypted and padded data. */ + cmpRootUnregCmdEd_t ed; +} cmpRootUnregCmdSdata_t; + +/** RootContUnregister signed command and signature. */ +typedef struct { + /** Signed command. */ + cmpRootUnregCmdSdata_t sdata; + /** Signature. */ + cmpMac_t mac; +} cmpRootContUnregisterCmd_t; + +/** RootContUnregister command. */ +typedef struct { + /** Command. */ + cmpRootContUnregisterCmd_t cmd; +} cmpCmdRootContUnregister_t; + +/** @} */ + +/** @defgroup MC_CMP_2_0_CMD_ROOT_CONT_UNREGISTER_RSP Response_2_0 + * @{ */ + +/** RootContUnregister encrypted data response. */ +typedef struct { + /** Suid. */ + mcSuid_t suid; +} cmpRootUnregRspEdata_t; + +/** RootContUnregister encrypted and padded data response. */ +typedef struct { + /** Encrypted data. */ + cmpRootUnregRspEdata_t edata; + /** Padding. */ + uint8_t padding[CMP_ED_PADDING(sizeof(cmpRootUnregRspEdata_t))]; +} cmpRootUnregRspEd_t; + +/** RootContUnregister signed response. */ +typedef struct { + /** Response header. */ + cmpResponseHeader_t rspHeader; + /** Encrypted and padded data. */ + cmpRootUnregRspEd_t ed; +} cmpRootUnregRspSdata_t; + +/** RootContUnregister signed response and signature. */ +typedef struct { + /** Signed response. */ + cmpRootUnregRspSdata_t sdata; + /** Signature. */ + cmpMac_t mac; +} cmpRootContUnregisterRsp_t; + +/** RootContUnregister response. */ +typedef struct { + /** Response. */ + cmpRootContUnregisterRsp_t rsp; + /** AuthToken container secure object. */ + mcSoAuthTokenCont_t soAuthTokenCont; +} cmpRspRootContUnregister_t; + +/** @} */ + +/** @} */ + +/** @defgroup MC_CMP_2_0_CMD_ROOT_CONT_LOCK_BY_ROOT \ + MC_CMP_2_0_CMD_ROOT_CONT_LOCK_BY_ROOT + * @{ */ + +/** @defgroup MC_CMP_2_0_CMD_ROOT_CONT_LOCK_BY_ROOT_CMD Command_2_0 + * @{ */ + +/** RootContLockByRoot signed command. */ +typedef struct { + /** Command header. */ + cmpCommandHeader_t cmdHeader; +} cmpRootLockByRootCmdSdata_t; + +/** RootContLockByRoot signed command and signature. */ +typedef struct { + /** Signed command. */ + cmpRootLockByRootCmdSdata_t sdata; + /** Signature. */ + cmpMac_t mac; +} cmpRootContLockByRootCmd_t; + +/** RootContLockByRoot command. */ +typedef struct { + /** Command. */ + cmpRootContLockByRootCmd_t cmd; +} cmpCmdRootContLockByRoot_t; + +/** @} */ + +/** @defgroup MC_CMP_2_0_CMD_ROOT_CONT_LOCK_BY_ROOT_RSP Response_2_0 + * @{ */ + +/** RootContLockByRoot encrypted data response. */ +typedef struct { + /** Root container secure object. */ + mcSoRootCont_t soRootCont; +} cmpRootLockByRootRspEdata_t; + +/** RootContLockByRoot encrypted and padded data response. */ +typedef struct { + /** Encrypted data. */ + cmpRootLockByRootRspEdata_t edata; + /** Padding. */ + uint8_t padding[CMP_ED_PADDING(sizeof(cmpRootLockByRootRspEdata_t))]; +} cmpRootLockByRootRspEd_t; + +/** RootContLockByRoot signed response. */ +typedef struct { + /** Response header. */ + cmpResponseHeader_t rspHeader; + /** Encrypted and padded data. */ + cmpRootLockByRootRspEd_t ed; +} cmpRootLockByRootRspSdata_t; + +/** RootContLockByRoot signed response and signature. */ +typedef struct { + /** Signed response. */ + cmpRootLockByRootRspSdata_t sdata; + /** Signature. */ + cmpMac_t mac; +} cmpRootContLockByRootRsp_t; + +/** RootContLockByRoot response. */ +typedef struct { + /** Response. */ + cmpRootContLockByRootRsp_t rsp; + /** Root container secure object. */ + mcSoRootCont_t soRootCont; +} cmpRspRootContLockByRoot_t; + +/** @} */ + +/** @} */ + +/** @defgroup MC_CMP_2_0_CMD_ROOT_CONT_UNLOCK_BY_ROOT \ + MC_CMP_2_0_CMD_ROOT_CONT_UNLOCK_BY_ROOT + * @{ */ + +/** @defgroup MC_CMP_2_0_CMD_ROOT_CONT_UNLOCK_BY_ROOT_CMD Command_2_0 + * @{ */ + +/** RootContUnlockByRoot signed command. */ +typedef struct { + /** Command header. */ + cmpCommandHeader_t cmdHeader; +} cmpRootUnlockByRootCmdSdata_t; + +/** RootContUnlockByRoot signed command and signature. */ +typedef struct { + /** Signed command. */ + cmpRootUnlockByRootCmdSdata_t sdata; + /** Signature. */ + cmpMac_t mac; +} cmpRootContUnlockByRootCmd_t; + +/** RootContUnlockByRoot command. */ +typedef struct { + /** Command. */ + cmpRootContUnlockByRootCmd_t cmd; +} cmpCmdRootContUnlockByRoot_t; + +/** @} */ + +/** @defgroup MC_CMP_2_0_CMD_ROOT_CONT_UNLOCK_BY_ROOT_RSP Response_2_0 + * @{ */ + +/** RootContUnlockByRoot encrypted data response. */ +typedef struct { + /** Root container secure object. */ + mcSoRootCont_t soRootCont; +} cmpRootUnlockByRootRspEdata_t; + +/** RootContUnlockByRoot encrypted and padded data response. */ +typedef struct { + /** Encrypted data. */ + cmpRootUnlockByRootRspEdata_t edata; + /** Padding. */ + uint8_t padding[CMP_ED_PADDING(sizeof(cmpRootUnlockByRootRspEdata_t))]; +} cmpRootUnlockByRootRspEd_t; + +/** RootContUnlockByRoot signed response. */ +typedef struct { + /** Response header. */ + cmpResponseHeader_t rspHeader; + /** Encrypted and padded data. */ + cmpRootUnlockByRootRspEd_t ed; +} cmpRootUnlockByRootRspSdata_t; + +/** RootContUnlockByRoot signed response and signature. */ +typedef struct { + /** Signed response. */ + cmpRootUnlockByRootRspSdata_t sdata; + /** Signature. */ + cmpMac_t mac; +} cmpRootContUnlockByRootRsp_t; + +/** RootContUnlockByRoot response. */ +typedef struct { + /** Response. */ + cmpRootContUnlockByRootRsp_t rsp; + /** Root container secure object. */ + mcSoRootCont_t soRootCont; +} cmpRspRootContUnlockByRoot_t; + +/** @} */ + +/** @} */ + +/** @defgroup MC_CMP_2_0_CMD_SP_CONT_REGISTER_ACTIVATE \ + MC_CMP_2_0_CMD_SP_CONT_REGISTER_ACTIVATE + * @{ */ + +/** @defgroup MC_CMP_2_0_CMD_SP_CONT_REGISTER_ACTIVATE_CMD Command_2_0 + * @{ */ + +/** SpContRegisterActivate encrypted data command. */ +typedef struct { + /** Sp authentication key. */ + mcSymmetricKey_t kSpAuth; +} cmpSpRegActMsgEdata_t; + +/** SpContRegisterActivate encrypted and padded data command. */ +typedef struct { + /** Encrypted data. */ + cmpSpRegActMsgEdata_t edata; + /** Padding. */ + uint8_t padding[CMP_ED_PADDING(sizeof(cmpSpRegActMsgEdata_t))]; +} cmpSpRegActCmdEd_t; + +/** SpContRegisterActivate signed command. */ +typedef struct { + /** Command header. */ + cmpCommandHeader_t cmdHeader; + mcSpid_t spid; + /** Encrypted and padded data. */ + cmpSpRegActCmdEd_t ed; +} cmpSpRegActCmdSdata_t; + +/** SpContRegisterActivate signed command and signature. */ +typedef struct { + /** Signed command. */ + cmpSpRegActCmdSdata_t sdata; + /** Signature. */ + cmpMac_t mac; +} cmpSpContRegisterActivateCmd_t; + +/** SpContRegisterActivate command. */ +typedef struct { + /** Command. */ + cmpSpContRegisterActivateCmd_t cmd; +} cmpCmdSpContRegisterActivate_t; + +/** @} */ + +/** @defgroup MC_CMP_2_0_CMD_SP_CONT_REGISTER_ACTIVATE_RSP Response_2_0 + * @{ */ + +/** SpContRegisterActivate encrypted data response. */ +typedef struct { + /** Root container secure object. */ + mcSoRootCont_t soRootCont; + /** Sp container secure object. */ + mcSoSpCont_t soSpCont; +} cmpSpRegActRspEdata_t; + +/** SpContRegisterActivate encrypted and padded data response. */ +typedef struct { + /** Encrypted data. */ + cmpSpRegActRspEdata_t edata; + /** Padding. */ + uint8_t padding[CMP_ED_PADDING(sizeof(cmpSpRegActRspEdata_t))]; +} cmpSpRegActRspEd_t; + +/** SpContRegisterActivate signed response. */ +typedef struct { + /** Response header. */ + cmpResponseHeader_t rspHeader; + /** Encrypted and padded data. */ + cmpSpRegActRspEd_t ed; +} cmpSpRegActRspSdata_t; + +/** SpContRegisterActivate signed response and signature. */ +typedef struct { + /** Signed response. */ + cmpSpRegActRspSdata_t sdata; + /** Signature. */ + cmpMac_t mac; +} cmpSpContRegisterActivateRsp_t; + +/** SpContRegisterActivate response. */ +typedef struct { + /** Response. */ + cmpSpContRegisterActivateRsp_t rsp; + /** Root container secure object. */ + mcSoRootCont_t soRootCont; + /** Sp container secure object. */ + mcSoSpCont_t soSpCont; +} cmpRspSpContRegisterActivate_t; + +/** @} */ + +/** @} */ + +/** @defgroup MC_CMP_2_0_CMD_SP_CONT_UNREGISTER \ + MC_CMP_2_0_CMD_SP_CONT_UNREGISTER + * @{ */ + +/** @defgroup MC_CMP_2_0_CMD_SP_CONT_UNREGISTER_CMD Command_2_0 + * @{ */ + +/** SpContUnregister signed response. */ +typedef struct { + /** Command header. */ + cmpCommandHeader_t cmdHeader; + /** Spid. */ + mcSpid_t spid; +} cmpSpContUnregCmdSdata_t; + +/** SpContUnregister signed command and signature. */ +typedef struct { + /** Signed command. */ + cmpSpContUnregCmdSdata_t sdata; + /** Signature. */ + cmpMac_t mac; +} cmpSpContUnregisterCmd_t; + +/** SpContUnregister command. */ +typedef struct { + /** Command. */ + cmpSpContUnregisterCmd_t cmd; +} cmpCmdSpContUnregister_t; + +/** @} */ + +/** @defgroup MC_CMP_2_0_CMD_SP_CONT_UNREGISTER_RSP Response_2_0 + * @{ */ + +/** SpContUnregister encrypted data response. */ +typedef struct { + /** Root container secure object. */ + mcSoRootCont_t soRootCont; +} cmpSpUnregRspEdata_t; + +/** SpContUnregister encrypted and padded data response. */ +typedef struct { + /** Encrypted data. */ + cmpSpUnregRspEdata_t edata; + /** Padding. */ + uint8_t padding[CMP_ED_PADDING(sizeof(cmpSpUnregRspEdata_t))]; +} cmpSpUnregRspEd_t; + +/** SpContUnregister signed response. */ +typedef struct { + /** Response header. */ + cmpResponseHeader_t rspHeader; + /** Encrypted and padded data. */ + cmpSpUnregRspEd_t ed; +} cmpSpContUnregRspSdata_t; + +/** SpContUnregister signed response and signature. */ +typedef struct { + /** Signed response. */ + cmpSpContUnregRspSdata_t sdata; + /** Signature. */ + cmpMac_t mac; +} cmpSpContUnregisterRsp_t; + +/** SpContUnregister response. */ +typedef struct { + /** Response. */ + cmpSpContUnregisterRsp_t rsp; + /** Root container secure object. */ + mcSoRootCont_t soRootCont; +} cmpRspSpContUnregister_t; + +/** @} */ + +/** @} */ + +/** @defgroup MC_CMP_2_0_CMD_SP_CONT_REGISTER \ + MC_CMP_2_0_CMD_SP_CONT_REGISTER + * @{ */ + +/** @defgroup MC_CMP_2_0_CMD_SP_CONT_REGISTER_CMD Command_2_0 + * @{ */ + +/** SpContRegister encrypted data command. */ +typedef struct { + /** Sp authentication key. */ + mcSymmetricKey_t kSpAuth; +} cmpSpRegisterMsgEdata_t; + +/** SpContRegister encrypted and padded data command. */ +typedef struct { + /** Encrypted data. */ + cmpSpRegisterMsgEdata_t edata; + /** Padding. */ + uint8_t padding[CMP_ED_PADDING(sizeof(cmpSpRegisterMsgEdata_t))]; +} cmpSpRegisterCmdEd_t; + +/** SpContRegister signed command. */ +typedef struct { + /** Command header. */ + cmpCommandHeader_t cmdHeader; + /** Spid. */ + mcSpid_t spid; + /** Encrypted and padded data. */ + cmpSpRegisterCmdEd_t ed; +} cmpSpRegisterCmdSdata_t; + +/** SpContRegister signed command and signature. */ +typedef struct { + /** Signed command. */ + cmpSpRegisterCmdSdata_t sdata; + /** Signature. */ + cmpMac_t mac; +} cmpSpContRegisterCmd_t; + +/** SpContRegister command. */ +typedef struct { + /** Command. */ + cmpSpContRegisterCmd_t cmd; +} cmpCmdSpContRegister_t; + +/** @} */ + +/** @defgroup MC_CMP_2_0_CMD_SP_CONT_REGISTER_RSP Response_2_0 + * @{ */ + +/** SpContRegister encrypted data response. */ +typedef struct { + /** Root container secure object. */ + mcSoRootCont_t soRootCont; + /** Sp container secure object. */ + mcSoSpCont_t soSpCont; +} cmpSpRegisterRspEdata_t; + +/** SpContRegister encrypted and padded data response. */ +typedef struct { + /** Encrypted data. */ + cmpSpRegisterRspEdata_t edata; + /** Padding. */ + uint8_t padding[CMP_ED_PADDING(sizeof(cmpSpRegisterRspEdata_t))]; +} cmpSpRegisterRspEd_t; + +/** SpContRegister signed response. */ +typedef struct { + /** Response header. */ + cmpResponseHeader_t rspHeader; + /** Encrypted and padded data. */ + cmpSpRegisterRspEd_t ed; +} cmpSpRegisterRspSdata_t; + +/** SpContRegister signed response and signature. */ +typedef struct { + cmpSpRegisterRspSdata_t sdata; + /** Signature. */ + cmpMac_t mac; +} cmpSpContRegisterRsp_t; + +/** SpContRegister response. */ +typedef struct { + /** Response. */ + cmpSpContRegisterRsp_t rsp; + /** Root container secure object. */ + mcSoRootCont_t soRootCont; + /** Sp container secure object. */ + mcSoSpCont_t soSpCont; +} cmpRspSpContRegister_t; + +/** @} */ + +/** @} */ + +/** @defgroup MC_CMP_2_0_CMD_SP_CONT_LOCK_BY_ROOT \ + MC_CMP_2_0_CMD_SP_CONT_LOCK_BY_ROOT + * @{ */ + +/** @defgroup MC_CMP_2_0_CMD_SP_CONT_LOCK_BY_ROOT_CMD Command_2_0 + * @{ */ + +/** SpContLockByRoot signed command. */ +typedef struct { + /** Command header. */ + cmpCommandHeader_t cmdHeader; + /** Spid. */ + mcSpid_t spid; +} cmpSpLockByRootCmdSdata_t; + +/** SpContLockByRoot signed command and signature. */ +typedef struct { + /** Signed command. */ + cmpSpLockByRootCmdSdata_t sdata; + /** Signature. */ + cmpMac_t mac; +} cmpSpContLockByRootCmd_t; + +/** SpContLockByRoot command. */ +typedef struct { + /** Command. */ + cmpSpContLockByRootCmd_t cmd; + /** Sp container secure object. */ + mcSoSpCont_t soSpCont; +} cmpCmdSpContLockByRoot_t; + +/** @} */ + +/** @defgroup MC_CMP_2_0_CMD_SP_CONT_LOCK_BY_ROOT_RSP Response_2_0 + * @{ */ + +/** SpContLockByRoot encrypted data response. */ +typedef struct { + /** Sp container secure object. */ + mcSoSpCont_t soSpCont; +} cmpSpLockByRootRspEdata_t; + +/** SpContLockByRoot encrypted and padded data response. */ +typedef struct { + /** Encrypted data. */ + cmpSpLockByRootRspEdata_t edata; + /** Padding. */ + uint8_t padding[CMP_ED_PADDING(sizeof(cmpSpLockByRootRspEdata_t))]; +} cmpSpLockByRootRspEd_t; + +/** SpContLockByRoot signed response. */ +typedef struct { + /** Response header. */ + cmpResponseHeader_t rspHeader; + /** Encrypted and padded data. */ + cmpSpLockByRootRspEd_t ed; +} cmpSpLockByRootRspSdata_t; + +/** SpContLockByRoot signed response and signature. */ +typedef struct { + /** Signed response. */ + cmpSpLockByRootRspSdata_t sdata; + /** Signature. */ + cmpMac_t mac; +} cmpSpContLockByRootRsp_t; + +/** SpContLockByRoot response. */ +typedef struct { + /** Response. */ + cmpSpContLockByRootRsp_t rsp; + /** Sp container secure object. */ + mcSoSpCont_t soSpCont; +} cmpRspSpContLockByRoot_t; + +/** @} */ + +/** @} */ + +/** @defgroup MC_CMP_2_0_CMD_SP_CONT_UNLOCK_BY_ROOT \ + MC_CMP_2_0_CMD_SP_CONT_UNLOCK_BY_ROOT + * @{ */ + +/** @defgroup MC_CMP_2_0_CMD_SP_CONT_UNLOCK_BY_ROOT_CMD Command_2_0 + * @{ */ + +/** SpContUnlockByRoot signed command. */ +typedef struct { + /** Command header. */ + cmpCommandHeader_t cmdHeader; + /** Spid. */ + mcSpid_t spid; +} cmpSpUnlockByRootCmdSdata_t; + +/** SpContUnlockByRoot signed command and signature. */ +typedef struct { + /** Signed command. */ + cmpSpUnlockByRootCmdSdata_t sdata; + /** Signature. */ + cmpMac_t mac; +} cmpSpContUnlockByRootCmd_t; + +/** SpContUnlockByRoot command. */ +typedef struct { + /** Command. */ + cmpSpContUnlockByRootCmd_t cmd; + /** Sp container secure object. */ + mcSoSpCont_t soSpCont; +} cmpCmdSpContUnlockByRoot_t; + +/** @} */ + +/** @defgroup MC_CMP_2_0_CMD_SP_CONT_UNLOCK_BY_ROOT_RSP Response_2_0 + * @{ */ + +/** SpContUnlockByRoot encrypted data response. */ +typedef struct { + /** Sp container secure object. */ + mcSoSpCont_t soSpCont; +} cmpSpUnlockByRootRspEdata_t; + +/** SpContUnlockByRoot encrypted and padded data response. */ +typedef struct { + /** Encrypted data. */ + cmpSpUnlockByRootRspEdata_t edata; + /** Padding. */ + uint8_t padding[CMP_ED_PADDING(sizeof(cmpSpUnlockByRootRspEdata_t))]; +} cmpSpUnlockByRootRspEd_t; + +/** SpContUnlockByRoot signed response. */ +typedef struct { + /** Response header. */ + cmpResponseHeader_t rspHeader; + /** Encrypted and padded data. */ + cmpSpUnlockByRootRspEd_t ed; +} cmpSpUnlockByRootRspSdata_t; + +/** SpContUnlockByRoot signed response and signature. */ +typedef struct { + /** Signed response. */ + cmpSpUnlockByRootRspSdata_t sdata; + /** Signature. */ + cmpMac_t mac; +} cmpSpContUnlockByRootRsp_t; + +/** SpContUnlockByRoot response. */ +typedef struct { + /** Response. */ + cmpSpContUnlockByRootRsp_t rsp; + /** Sp container secure object. */ + mcSoSpCont_t soSpCont; +} cmpRspSpContUnlockByRoot_t; + +/** @} */ + +/** @} */ + +/** @defgroup MC_CMP_2_0_CMD_SP_CONT_ACTIVATE \ + MC_CMP_2_0_CMD_SP_CONT_ACTIVATE + * @{ */ + +/** @defgroup MC_CMP_2_0_CMD_SP_CONT_ACTIVATE_CMD Command_2_0 + * @{ */ + +/** SpContActivate encrypted data command. */ +typedef struct { + /** Sp authentication key. */ + mcSymmetricKey_t kSpAuth; +} cmpSpActivateMsgEdata_t; + +/** SpContActivate encrypted and padded data command. */ +typedef struct { + /** Encrypted data. */ + cmpSpActivateMsgEdata_t edata; + /** Padding. */ + uint8_t padding[CMP_ED_PADDING(sizeof(cmpSpActivateMsgEdata_t))]; +} cmpSpActivateCmdEd_t; + +/** SpContActivate signed command. */ +typedef struct { + /** Command header. */ + cmpCommandHeader_t cmdHeader; + /** Spid. */ + mcSpid_t spid; + /** Encrypted and padded data. */ + cmpSpActivateCmdEd_t ed; +} cmpSpActivateCmdSdata_t; + +/** SpContActivate signed command and signature. */ +typedef struct { + /** Signed command. */ + cmpSpActivateCmdSdata_t sdata; + /** Signature. */ + cmpMac_t mac; +} cmpSpContActivateCmd_t; + +/** SpContActivate command. */ +typedef struct { + /** Command. */ + cmpSpContActivateCmd_t cmd; +} cmpCmdSpContActivate_t; + +/** @} */ + +/** @defgroup MC_CMP_2_0_CMD_SP_CONT_ACTIVATE_RSP Response_2_0 + * @{ */ + +/** SpContActivate encrypted data response. */ +typedef struct { + /** Sp container secure object. */ + mcSoSpCont_t soSpCont; +} cmpSpActivateRspEdata_t; + +/** SpContActivate encrypted and padded data response. */ +typedef struct { + /** Encrypted data. */ + cmpSpActivateRspEdata_t edata; + /** Padding. */ + uint8_t padding[CMP_ED_PADDING(sizeof(cmpSpActivateRspEdata_t))]; +} cmpSpActivateRspEd_t; + +/** SpContActivate signed response. */ +typedef struct { + /** Response header. */ + cmpResponseHeader_t rspHeader; + /** Encrypted and padded data. */ + cmpSpActivateRspEd_t ed; +} cmpSpActivateRspSdata_t; + +/** SpContActivate signed response and signature. */ +typedef struct { + /** Signed response. */ + cmpSpActivateRspSdata_t sdata; + /** Signature. */ + cmpMac_t mac; +} cmpSpContActivateRsp_t; + +/** SpContActivate response. */ +typedef struct { + /** Response. */ + cmpSpContActivateRsp_t rsp; + /** Sp container secure object. */ + mcSoSpCont_t soSpCont; +} cmpRspSpContActivate_t; + +/** @} */ + +/** @} */ + +/** @defgroup MC_CMP_2_0_CMD_SP_CONT_LOCK_BY_SP \ + MC_CMP_2_0_CMD_SP_CONT_LOCK_BY_SP + * @{ */ + +/** @defgroup MC_CMP_2_0_CMD_SP_CONT_LOCK_BY_SP_CMD Command_2_0 + * @{ */ + +/** SpContLockBySp signed command. */ +typedef struct { + /** Command header. */ + cmpCommandHeader_t cmdHeader; + /** Spid. */ + mcSpid_t spid; +} cmpSpLockBySpCmdSdata_t; + +/** SpContLockBySp signed command and signature. */ +typedef struct { + /** Signed command. */ + cmpSpLockBySpCmdSdata_t sdata; + /** Signature. */ + cmpMac_t mac; +} cmpSpContLockBySpCmd_t; + +/** SpContLockBySp command. */ +typedef struct { + /** Command. */ + cmpSpContLockBySpCmd_t cmd; +} cmpCmdSpContLockBySp_t; + +/** @} */ + +/** @defgroup MC_CMP_2_0_CMD_SP_CONT_LOCK_BY_SP_RSP Response_2_0 + * @{ */ + +/** SpContLockBySp encrypted data response. */ +typedef struct { + /** Sp container secure object. */ + mcSoSpCont_t soSpCont; +} cmpSpLockBySpRspEdata_t; + +/** SpContLockBySp encrypted and padded data command. */ +typedef struct { + /** Encrypted data. */ + cmpSpLockBySpRspEdata_t edata; + /** Padding. */ + uint8_t padding[CMP_ED_PADDING(sizeof(cmpSpLockBySpRspEdata_t))]; +} cmpSpLockBySpRspEd_t; + +/** SpContLockBySp signed response. */ +typedef struct { + /** Response header. */ + cmpResponseHeader_t rspHeader; + /** Encrypted and padded data. */ + cmpSpLockBySpRspEd_t ed; +} cmpSpLockBySpRspSdata_t; + +/** SpContLockBySp signed response and signature. */ +typedef struct { + /** Signed response. */ + cmpSpLockBySpRspSdata_t sdata; + /** Signature. */ + cmpMac_t mac; +} cmpSpContLockBySpRsp_t; + +/** SpContLockBySp response. */ +typedef struct { + /** Response. */ + cmpSpContLockBySpRsp_t rsp; + /** Sp container secure object. */ + mcSoSpCont_t soSpCont; +} cmpRspSpContLockBySp_t; + +/** @} */ + +/** @} */ + +/** @defgroup MC_CMP_2_0_CMD_SP_CONT_UNLOCK_BY_SP \ + MC_CMP_2_0_CMD_SP_CONT_UNLOCK_BY_SP + * @{ */ + +/** @defgroup MC_CMP_2_0_CMD_SP_CONT_UNLOCK_BY_SP_CMD Command_2_0 + * @{ */ + +/** SpContUnlockBySp signed command. */ +typedef struct { + /** Command header. */ + cmpCommandHeader_t cmdHeader; + /** Spid. */ + mcSpid_t spid; +} cmpSpUnlockBySpCmdSdata_t; + +/** SpContUnlockBySp signed command and signature. */ +typedef struct { + /** Signed command. */ + cmpSpUnlockBySpCmdSdata_t sdata; + /** Signature. */ + cmpMac_t mac; +} cmpSpContUnlockBySpCmd_t; + +/** SpContUnlockBySp command. */ +typedef struct { + /** Command. */ + cmpSpContUnlockBySpCmd_t cmd; +} cmpCmdSpContUnlockBySp_t; + +/** @} */ + +/** @defgroup MC_CMP_2_0_CMD_SP_CONT_UNLOCK_BY_SP_RSP Response_2_0 + * @{ */ + +/** SpContUnlockBySp encrypted data response. */ +typedef struct { + /** Sp container secure object. */ + mcSoSpCont_t soSpCont; +} cmpSpUnlockBySpRspEdata_t; + +/** SpContUnlockBySp encrypted and padded data command. */ +typedef struct { + /** Encrypted data. */ + cmpSpUnlockBySpRspEdata_t edata; + /** Padding. */ + uint8_t padding[CMP_ED_PADDING(sizeof(cmpSpUnlockBySpRspEdata_t))]; +} cmpSpUnlockBySpRspEd_t; + +/** SpContUnlockBySp signed response. */ +typedef struct { + /** Response header. */ + cmpResponseHeader_t rspHeader; + /** Encrypted and padded data. */ + cmpSpUnlockBySpRspEd_t ed; +} cmpSpUnlockBySpRspSdata_t; + +/** SpContUnlockBySp signed response and signature. */ +typedef struct { + /** Signed response. */ + cmpSpUnlockBySpRspSdata_t sdata; + /** Signature. */ + cmpMac_t mac; +} cmpSpContUnlockBySpRsp_t; + +/** SpContUnlockBySp response. */ +typedef struct { + /** Response. */ + cmpSpContUnlockBySpRsp_t rsp; + /** Sp container secure object. */ + mcSoSpCont_t soSpCont; +} cmpRspSpContUnlockBySp_t; + +/** @} */ + +/** @} */ + +/** @defgroup MC_CMP_2_0_CMD_TLT_CONT_REGISTER_ACTIVATE \ + MC_CMP_2_0_CMD_TLT_CONT_REGISTER_ACTIVATE + * @{ */ + +/** @defgroup MC_CMP_2_0_CMD_TLT_CONT_REGISTER_ACTIVATE_CMD Command_2_0 + * @{ */ + +/** TltContRegisterActivate encrypted data command. */ +typedef struct { + /** Tlt authentication key. */ + mcSymmetricKey_t kSpTltEnc; +} cmpTltRegActMsgEdata_t; + +/** TltContRegisterActivate encrypted and padded data command. */ +typedef struct { + /** Encrypted data. */ + cmpTltRegActMsgEdata_t edata; + /** Padding. */ + uint8_t padding[CMP_ED_PADDING(sizeof(cmpTltRegActMsgEdata_t))]; +} cmpTltRegActCmdEd_t; + +/** TltContRegisterActivate signed command. */ +typedef struct { + /** Command header. */ + cmpCommandHeader_t cmdHeader; + /** Spid. */ + mcSpid_t spid; + /** Uuid. */ + mcUuid_t uuid; + /** Encrypted and padded data. */ + cmpTltRegActCmdEd_t ed; +} cmpTltRegActCmdSdata_t; + +/** TltContRegisterActivate signed command and signature. */ +typedef struct { + /** Signed command. */ + cmpTltRegActCmdSdata_t sdata; + /** Signature. */ + cmpMac_t mac; +} cmpTltContRegisterActivateCmd_t; + +/** TltContRegisterActivate command. */ +typedef struct { + /** Command. */ + cmpTltContRegisterActivateCmd_t cmd; +} cmpCmdTltContRegisterActivate_t; + +/** @} */ + +/** @defgroup MC_CMP_2_0_CMD_TLT_CONT_REGISTER_ACTIVATE_RSP Response_2_0 + * @{ */ + +/** TltContRegisterActivate encrypted data response. */ +typedef struct { + /** Sp container secure object. */ + mcSoSpCont_t soSpCont; + /** Tlt container secure object. */ + mcSoTltCont_2_0_t soTltCont; +} cmpTltRegActRspEdata_t; + +/** TltContRegisterActivate encrypted and padded data response. */ +typedef struct { + /** Encrypted data. */ + cmpTltRegActRspEdata_t edata; + /** Padding. */ + uint8_t padding[CMP_ED_PADDING(sizeof(cmpTltRegActRspEdata_t))]; +} cmpTltRegActRspEd_t; + +/** TltContRegisterActivate signed response. */ +typedef struct { + /** Response header. */ + cmpResponseHeader_t rspHeader; + /** Encrypted and padded data. */ + cmpTltRegActRspEd_t ed; +} cmpTltRegActRspSdata_t; + +/** TltContRegisterActivate signed response and signature. */ +typedef struct { + /** Signed response. */ + cmpTltRegActRspSdata_t sdata; + /** Signature. */ + cmpMac_t mac; +} cmpTltContRegisterActivateRsp_t; + +/** TltContRegisterActivate response. */ +typedef struct { + /** Response. */ + cmpTltContRegisterActivateRsp_t rsp; + /** Sp container secure object. */ + mcSoSpCont_t soSpCont; + /** Tlt container secure object. */ + mcSoTltCont_2_0_t soTltCont; +} cmpRspTltContRegisterActivate_t; + +/** @} */ + +/** @} */ + +/** @defgroup MC_CMP_2_0_CMD_TLT_CONT_UNREGISTER \ + MC_CMP_2_0_CMD_TLT_CONT_UNREGISTER + * @{ */ + +/** @defgroup MC_CMP_2_0_CMD_TLT_CONT_UNREGISTER_CMD Command_2_0 + * @{ */ + +/** TltContUnregister signed command. */ +typedef struct { + /** Command header. */ + cmpCommandHeader_t cmdHeader; + /** Spid. */ + mcSpid_t spid; + /** Uuid. */ + mcUuid_t uuid; +} cmpTltUnregCmdSdata_t; + +/** TltContUnregister signed command and signature. */ +typedef struct { + /** Signed command. */ + cmpTltUnregCmdSdata_t sdata; + /** Signature. */ + cmpMac_t mac; +} cmpTltContUnregisterCmd_t; + +/** TltContUnregister command. */ +typedef struct { + /** Command. */ + cmpTltContUnregisterCmd_t cmd; +} cmpCmdTltContUnregister_t; + +/** @} */ + +/** @defgroup MC_CMP_2_0_CMD_TLT_CONT_UNREGISTER_RSP Response_2_0 + * @{ */ + +/** TltContUnregister encrypted data response. */ +typedef struct { + /** Sp container secure object. */ + mcSoSpCont_t soSpCont; +} cmpTltUnregRspEdata_t; + +/** TltContUnregister encrypted and padded data response. */ +typedef struct { + /** Encrypted data. */ + cmpTltUnregRspEdata_t edata; + /** Padding. */ + uint8_t padding[CMP_ED_PADDING(sizeof(cmpTltUnregRspEdata_t))]; +} cmpTltUnregRspEd_t; + +/** TltContUnregister signed command. */ +typedef struct { + /** Response header. */ + cmpResponseHeader_t rspHeader; + /** Encrypted and padded data. */ + cmpTltUnregRspEd_t ed; +} cmpTltUnregRspSdata_t; + +/** TltContUnregister signed command and signature. */ +typedef struct { + /** Signed response. */ + cmpTltUnregRspSdata_t sdata; + /** Signature. */ + cmpMac_t mac; +} cmpTltContUnregisterRsp_t; + +/** TltContUnregister response. */ +typedef struct { + /** Response. */ + cmpTltContUnregisterRsp_t rsp; + /** Sp container secure object. */ + mcSoSpCont_t soSpCont; +} cmpRspTltContUnregister_t; + +/** @} */ + +/** @} */ + +/** @defgroup MC_CMP_2_0_CMD_TLT_CONT_REGISTER \ + MC_CMP_2_0_CMD_TLT_CONT_REGISTER + * @{ */ + +/** @defgroup MC_CMP_2_0_CMD_TLT_CONT_REGISTER_CMD Command_2_0 + * @{ */ + +/** TltContRegister encrypted data command. */ +typedef struct { + /** Tlt authentication key. */ + mcSymmetricKey_t kSpTltEnc; +} cmpTltRegMsgEdata_t; + +/** TltContRegister encrypted and padded data command. */ +typedef struct { + /** Encrypted data. */ + cmpTltRegMsgEdata_t edata; + /** Padding. */ + uint8_t padding[CMP_ED_PADDING(sizeof(cmpTltRegMsgEdata_t))]; +} cmpTltRegCmdEd_t; + +/** TltContRegister signed command. */ +typedef struct { + /** Command header. */ + cmpCommandHeader_t cmdHeader; + /** Spid. */ + mcSpid_t spid; + /** Uuid. */ + mcUuid_t uuid; + /** Encrypted and padded data. */ + cmpTltRegCmdEd_t ed; +} cmpTltRegCmdSdata_t; + +/** TltContRegister signed command and signature. */ +typedef struct { + /** Signed command. */ + cmpTltRegCmdSdata_t sdata; + /** Signature. */ + cmpMac_t mac; +} cmpTltContRegisterCmd_t; + +/** TltContRegister command. */ +typedef struct { + /** Command. */ + cmpTltContRegisterCmd_t cmd; +} cmpCmdTltContRegister_t; + +/** @} */ + +/** @defgroup MC_CMP_2_0_CMD_TLT_CONT_REGISTER_RSP Response_2_0 + * @{ */ + +/** TltContRegister encrypted data response. */ +typedef struct { + /** Sp container secure object. */ + mcSoSpCont_t soSpCont; + /** Tlt container secure object. */ + mcSoTltCont_2_0_t soTltCont; +} cmpTltRegRspEdata_t; + +/** TltContRegister encrypted and padded data response. */ +typedef struct { + /** Encrypted data. */ + cmpTltRegRspEdata_t edata; + /** Padding. */ + uint8_t padding[CMP_ED_PADDING(sizeof(cmpTltRegRspEdata_t))]; +} cmpTltRegRspEd_t; + +/** TltContRegister signed response. */ +typedef struct { + /** Response header. */ + cmpResponseHeader_t rspHeader; + /** Encrypted and padded data. */ + cmpTltRegRspEd_t ed; +} cmpTltRegRspSdata_t; + +/** TltContRegister signed response and signature. */ +typedef struct { + /** Signed response. */ + cmpTltRegRspSdata_t sdata; + /** Signature. */ + cmpMac_t mac; +} cmpTltContRegisterRsp_t; + +/** TltContRegister response. */ +typedef struct { + /** Response. */ + cmpTltContRegisterRsp_t rsp; + /** Sp container secure object. */ + mcSoSpCont_t soSpCont; + /** Tlt container secure object. */ + mcSoTltCont_2_0_t soTltCont; +} cmpRspTltContRegister_t; + +/** @} */ + +/** @} */ + +/** @defgroup MC_CMP_2_0_CMD_TLT_CONT_ACTIVATE \ + MC_CMP_2_0_CMD_TLT_CONT_ACTIVATE + * @{ */ + +/** @defgroup MC_CMP_2_0_CMD_TLT_CONT_ACTIVATE_CMD Command_2_0 + * @{ */ + +/** TltContActivate signed command. */ +typedef struct { + /** Command header. */ + cmpCommandHeader_t cmdHeader; + /** Spid. */ + mcSpid_t spid; + /** Uuid. */ + mcUuid_t uuid; +} cmpTltActCmdSdata_t; + +/** TltContActivate signed command and signature. */ +typedef struct { + /** Signed command. */ + cmpTltActCmdSdata_t sdata; + /** Signature. */ + cmpMac_t mac; +} cmpTltContActivateCmd_t; + +/** TltContActivate command. */ +typedef struct { + /** Command. */ + cmpTltContActivateCmd_t cmd; + /** Tlt container secure object. */ + mcSoTltCont_2_0_t soTltCont; +} cmpCmdTltContActivate_t; + +/** @} */ + +/** @defgroup MC_CMP_2_0_CMD_TLT_CONT_ACTIVATE_RSP Response_2_0 + * @{ */ + +/** TltContActivate encrypted data response. */ +typedef struct { + /** Tlt container secure object. */ + mcSoTltCont_2_0_t soTltCont; +} cmpTltActRspEdata_t; + +/** TltContActivate encrypted and padded data response. */ +typedef struct { + /** Encrypted data. */ + cmpTltActRspEdata_t edata; + /** Padding. */ + uint8_t padding[CMP_ED_PADDING(sizeof(cmpTltActRspEdata_t))]; +} cmpTltActRspEd_t; + +/** TltContActivate signed response. */ +typedef struct { + /** Response header. */ + cmpResponseHeader_t rspHeader; + /** Encrypted and padded data. */ + cmpTltActRspEd_t ed; +} cmpTltActRspSdata_t; + +/** TltContActivate signed response and signature. */ +typedef struct { + /** Signed response. */ + cmpTltActRspSdata_t sdata; + /** Signature. */ + cmpMac_t mac; +} cmpTltContActivateRsp_t; + +/** TltContActivate response. */ +typedef struct { + /** Response. */ + cmpTltContActivateRsp_t rsp; + /** Tlt container secure object. */ + mcSoTltCont_2_0_t soTltCont; +} cmpRspTltContActivate_t; + +/** @} */ + +/** @} */ + +/** @defgroup MC_CMP_2_0_CMD_TLT_CONT_LOCK_BY_SP \ + MC_CMP_2_0_CMD_TLT_CONT_LOCK_BY_SP + * @{ */ + +/** @defgroup MC_CMP_2_0_CMD_TLT_CONT_LOCK_BY_SP_CMD Command_2_0 + * @{ */ + +/** TltContLockBySp signed command. */ +typedef struct { + /** Command header. */ + cmpCommandHeader_t cmdHeader; + /** Spid. */ + mcSpid_t spid; + /** Uuid. */ + mcUuid_t uuid; +} cmpTltLockBySpCmdSdata_t; + +/** TltContLockBySp signed command and signature. */ +typedef struct { + /** Signed command. */ + cmpTltLockBySpCmdSdata_t sdata; + /** Signature. */ + cmpMac_t mac; +} cmpTltContLockBySpCmd_t; + +/** TltContLockBySp command. */ +typedef struct { + /** Command. */ + cmpTltContLockBySpCmd_t cmd; + /** Tlt container secure object. */ + mcSoTltCont_2_0_t soTltCont; +} cmpCmdTltContLockBySp_t; + +/** @} */ + +/** @defgroup MC_CMP_2_0_CMD_TLT_CONT_LOCK_BY_SP_RSP Response_2_0 + * @{ */ + +/** TltContLockBySp encrypted data response. */ +typedef struct { + /** Tlt container secure object. */ + mcSoTltCont_2_0_t soTltCont; +} cmpTltLockBySpRspEdata_t; + +/** TltContLockBySp encrypted and padded data response. */ +typedef struct { + /** Encrypted data. */ + cmpTltLockBySpRspEdata_t edata; + /** Padding. */ + uint8_t padding[CMP_ED_PADDING(sizeof(cmpTltLockBySpRspEdata_t))]; +} cmpTltLockBySpRspEd_t; + +/** TltContLockBySp signed response. */ +typedef struct { + /** Response header. */ + cmpResponseHeader_t rspHeader; + /** Encrypted and padded data. */ + cmpTltLockBySpRspEd_t ed; +} cmpTltLockBySpRspSdata_t; + +/** TltContLockBySp signed response and signature. */ +typedef struct { + /** Signed response. */ + cmpTltLockBySpRspSdata_t sdata; + /** Signature. */ + cmpMac_t mac; +} cmpTltContLockBySpRsp_t; + +/** TltContLockBySp response. */ +typedef struct { + /** Response. */ + cmpTltContLockBySpRsp_t rsp; + /** Tlt container secure object. */ + mcSoTltCont_2_0_t soTltCont; +} cmpRspTltContLockBySp_t; + +/** @} */ + +/** @} */ + +/** @defgroup MC_CMP_2_0_CMD_TLT_CONT_UNLOCK_BY_SP \ + MC_CMP_2_0_CMD_TLT_CONT_UNLOCK_BY_SP + * @{ */ + +/** @defgroup MC_CMP_2_0_CMD_TLT_CONT_UNLOCK_BY_SP_CMD Command_2_0 + * @{ */ + +/** TltContUnlockBySp signed command. */ +typedef struct { + /** Command header. */ + cmpCommandHeader_t cmdHeader; + /** Spid. */ + mcSpid_t spid; + /** Uuid. */ + mcUuid_t uuid; +} cmpTltUnlockBySpCmdSdata_t; + +/** TltContUnlockBySp signed command and signature. */ +typedef struct { + /** Signed command. */ + cmpTltUnlockBySpCmdSdata_t sdata; + /** Signature. */ + cmpMac_t mac; +} cmpTltContUnlockBySpCmd_t; + +/** TltContUnlockBySp command. */ +typedef struct { + /** Command. */ + cmpTltContUnlockBySpCmd_t cmd; + /** Tlt container secure object. */ + mcSoTltCont_2_0_t soTltCont; +} cmpCmdTltContUnlockBySp_t; + +/** @} */ + +/** @defgroup MC_CMP_2_0_CMD_TLT_CONT_UNLOCK_BY_SP_RSP Response_2_0 + * @{ */ + +/** TltContUnlockBySp encrypted data response. */ +typedef struct { + /** Tlt container secure object. */ + mcSoTltCont_2_0_t soTltCont; +} cmpTltUnlockBySpRspEdata_t; + +/** TltContUnlockBySp encrypted and padded data response. */ +typedef struct { + /** Encrypted data. */ + cmpTltUnlockBySpRspEdata_t edata; + /** Padding. */ + uint8_t padding[CMP_ED_PADDING(sizeof(cmpTltUnlockBySpRspEdata_t))]; +} cmpTltUnlockBySpRspEd_t; + +/** TltContUnlockBySp signed response. */ +typedef struct { + /** Response header. */ + cmpResponseHeader_t rspHeader; + /** Encrypted and padded data. */ + cmpTltUnlockBySpRspEd_t ed; +} cmpTltUnlockBySpRspSdata_t; + +/** TltContUnlockBySp signed response and signature. */ +typedef struct { + /** Signed response. */ + cmpTltUnlockBySpRspSdata_t sdata; + /** Signature. */ + cmpMac_t mac; +} cmpTltContUnlockBySpRsp_t; + +/** TltContUnlockBySp response. */ +typedef struct { + /** Response. */ + cmpTltContUnlockBySpRsp_t rsp; + /** Tlt container secure object. */ + mcSoTltCont_2_0_t soTltCont; +} cmpRspTltContUnlockBySp_t; + +/** @} */ + +/** @} */ + +/** @defgroup MC_CMP_2_0_CMD_TLT_CONT_PERSONALIZE \ + MC_CMP_2_0_CMD_TLT_CONT_PERSONALIZE + * @{ */ + +/** @defgroup MC_CMP_2_0_CMD_TLT_CONT_PERSONALIZE_CMD Command_2_0 + * @{ */ + +/** TltContPersonalize encrypted data command. */ +typedef struct { + /** Pid. */ + mcPid_t pid; + /** Data. */ + mcCoDataCont_t persoData; +} cmpTltContPersonalizeCmdEdata_t; + +/** TltContPersonalize encrypted and padded data command. */ +typedef struct { + /** Encrypted data. */ + cmpTltContPersonalizeCmdEdata_t edata; + /** Padding. */ + uint8_t padding[CMP_ED_PADDING(sizeof(cmpTltContPersonalizeCmdEdata_t))]; +} cmpTltContPersonalizeCmdEd_t; + +/** TltContPersonalize signed command. */ +typedef struct { + /** Command header. */ + cmpCommandHeader_t cmdHeader; + /** Spid. */ + mcSpid_t spid; + /** Uuid. */ + mcUuid_t uuid; + /** Encrypted and padded data size. */ + uint32_t edLen; + /** Encrypted and padded data. */ + cmpTltContPersonalizeCmdEd_t ed; +} cmpTltContPersonalizeCmdSdata_t; + +/** TltContPersonalize signed command and signature. */ +typedef struct { + /** Signed command. */ + cmpTltContPersonalizeCmdSdata_t sdata; + /** Signature. */ + cmpMac_t mac; +} cmpTltContPersonalizeCmd_t; + +/** TltContPersonalize command. */ +typedef struct { + /** Command. */ + cmpTltContPersonalizeCmd_t cmd; + /** Tlt container secure object. */ + mcSoTltCont_2_0_t soTltCont; +} cmpCmdTltContPersonalize_t; + +/** @} */ + +/** @defgroup MC_CMP_2_0_CMD_TLT_CONT_PERSONLIZE_RSP Response_2_0 + * @{ */ + +/** TltContPersonalize encrypted data response. */ +typedef struct { + /** Data container secure object. */ + mcSoDataCont_t soDataCont; +} cmpTltContPersonalizeRspEdata_t; + +/** TltContPersonalize encrypted and padded data response. */ +typedef struct { + /** Encrypted data. */ + cmpTltContPersonalizeRspEdata_t edata; + /** Padding. */ + uint8_t padding[CMP_ED_PADDING(sizeof(cmpTltContPersonalizeRspEdata_t))]; +} cmpTltContPersonalizeRspEd_t; + +/** TltContPersonalize signed response. */ +typedef struct { + /** Response header. */ + cmpResponseHeader_t rspHeader; + /** Encrypted and padded data size. */ + uint32_t edLen; + /** Encrypted and padded data. */ + cmpTltContPersonalizeRspEd_t ed; +} cmpTltContPersonalizeRspSdata_t; + +/** TltContPersonalize signed response and signature. */ +typedef struct { + /** Signed response. */ + cmpTltContPersonalizeRspSdata_t sdata; + cmpMac_t mac; +} cmpTltContPersonalizeRsp_t; + +/** TltContPersonalize response. */ +typedef struct { + /** Response. */ + cmpTltContPersonalizeRsp_t rsp; + /** Data container secure object. */ + mcSoDataCont_t soDataCont; +} cmpRspTltContPersonalize_t; + +/** @} */ + +/** @} */ + +#endif // CMP_H_ + +/** @} */ diff --git a/mobicore/common/MobiCore/inc/TlCm/2.0/tlCmApi.h b/mobicore/common/MobiCore/inc/TlCm/2.0/tlCmApi.h new file mode 100644 index 0000000000000000000000000000000000000000..19483b66386c54edf7d2d2bd6ead4bec5d338f25 --- /dev/null +++ b/mobicore/common/MobiCore/inc/TlCm/2.0/tlCmApi.h @@ -0,0 +1,173 @@ +/** @addtogroup CMP_2_0 + * @{ + * @file + * Interface to content management trustlet (TlCm) definitions. + * + * The TlCm is responsible for implementing content management protocol (CMP) + * 2.0 commands and generating approriate CMP 2.0 responses in the trustlet + * control interface (TCI). + * + * Copyright © Trustonic Limited 2013. + * + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * 3. Neither the name of the Trustonic Limited nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef TL_CM_API_H_ +#define TL_CM_API_H_ + +#include "TlCm/tlCmApiCommon.h" +#include "TlCm/2.0/cmp.h" + +/** TCI CMP 2.0 messages. */ +typedef union { + /** Command header. */ + cmpCommandHeader_t commandHeader; + /** Response header. */ + cmpResponseHeader_t responseHeader; + + /** System command GetVersion. */ + cmpCmdGetVersion_t cmpCmdGetVersion; + /** System response GetVersion. */ + cmpRspGetVersion_t cmpRspGetVersion; + /** System command GetSuid. */ + cmpCmdGetSuid_t cmpCmdGetSuid; + /** System response GetSuid. */ + cmpRspGetSuid_t cmpRspGetSuid; + /** System command GenAuthToken. */ + cmpCmdGenAuthToken_t cmpCmdGenAuthToken; + /** System response GenAuthToken. */ + cmpRspGenAuthToken_t cmpRspGenAuthToken; + + /** Authentication command BeginSocAuthentication. */ + cmpCmdBeginSocAuthentication_t cmpCmdBeginSocAuthentication; + /** Authentication response BeginSocAuthentication. */ + cmpRspBeginSocAuthentication_t cmpRspBeginSocAuthentication; + /** Authentication command BeginRootAuthentication. */ + cmpCmdBeginRootAuthentication_t cmpCmdBeginRootAuthentication; + /** Authentication response BeginRootAuthentication. */ + cmpRspBeginRootAuthentication_t cmpRspBeginRootAuthentication; + /** Authentication command BeginSpAuthentication. */ + cmpCmdBeginSpAuthentication_t cmpCmdBeginSpAuthentication; + /** Authentication response BeginSpAuthentication. */ + cmpRspBeginSpAuthentication_t cmpRspBeginSpAuthentication; + /** Authentication command Authenticate. */ + cmpCmdAuthenticate_t cmpCmdAuthenticate; + /** Authentication response Authenticate. */ + cmpRspAuthenticate_t cmpRspAuthenticate; + /** Authentication command AuthenticateTerminate. */ + cmpCmdAuthenticateTerminate_t cmpCmdAuthenticateTerminate; + /** Authentication response AuthenticateTerminate. */ + cmpRspAuthenticateTerminate_t cmpRspAuthenticateTerminate; + + /** SoC administrative command RootContRegisterActivate. */ + cmpCmdRootContRegisterActivate_t cmpCmdRootContRegisterActivate; + /** SoC administrative response RootContRegisterActivate. */ + cmpRspRootContRegisterActivate_t cmpRspRootContRegisterActivate; + + /** Root administrative command RootContUnregister. */ + cmpCmdRootContUnregister_t cmpCmdRootContUnregister; + /** Root administrative response RootContUnregister. */ + cmpRspRootContUnregister_t cmpRspRootContUnregister; + /** Root administrative command RootContLockByRoot. */ + cmpCmdRootContLockByRoot_t cmpCmdRootContLockByRoot; + /** Root administrative response RootContLockByRoot. */ + cmpRspRootContLockByRoot_t cmpRspRootContLockByRoot; + /** Root administrative command RootContUnlockByRoot. */ + cmpCmdRootContUnlockByRoot_t cmpCmdRootContUnlockByRoot; + /** Root administrative command RootContUnlockByRoot. */ + cmpRspRootContUnlockByRoot_t cmpRspRootContUnlockByRoot; + /** Root administrative command SpContRegisterActivate. */ + cmpCmdSpContRegisterActivate_t cmpCmdSpContRegisterActivate; + /** Root administrative response SpContRegisterActivate. */ + cmpRspSpContRegisterActivate_t cmpRspSpContRegisterActivate; + /** Root administrative command SpContUnregister. */ + cmpCmdSpContUnregister_t cmpCmdSpContUnregister; + /** Root administrative response SpContUnregister. */ + cmpRspSpContUnregister_t cmpRspSpContUnregister; + /** Root administrative command SpContRegister. */ + cmpCmdSpContRegister_t cmpCmdSpContRegister; + /** Root administrative response SpContRegister. */ + cmpRspSpContRegister_t cmpRspSpContRegister; + /** Root administrative command SpContLockByRoot. */ + cmpCmdSpContLockByRoot_t cmpCmdSpContLockByRoot; + /** Root administrative response SpContLockByRoot. */ + cmpRspSpContLockByRoot_t cmpRspSpContLockByRoot; + /** Root administrative command SpContUnlockByRoot. */ + cmpCmdSpContUnlockByRoot_t cmpCmdSpContUnlockByRoot; + /** Root administrative response SpContUnlockByRoot. */ + cmpRspSpContUnlockByRoot_t cmpRspSpContUnlockByRoot; + + /** Sp administrative command SpContActivate. */ + cmpCmdSpContActivate_t cmpCmdSpContActivate; + /** Sp administrative response SpContActivate. */ + cmpRspSpContActivate_t cmpRspSpContActivate; + /** Sp administrative command SpContLockBySp. */ + cmpCmdSpContLockBySp_t cmpCmdSpContLockBySp; + /** Sp administrative response SpContLockBySp. */ + cmpRspSpContLockBySp_t cmpRspSpContLockBySp; + /** Sp administrative command SpContUnlockBySp. */ + cmpCmdSpContUnlockBySp_t cmpCmdSpContUnlockBySp; + /** Sp administrative command SpContUnlockBySp. */ + cmpRspSpContUnlockBySp_t cmpRspSpContUnlockBySp; + /** Sp administrative command TltContRegisterActivate. */ + cmpCmdTltContRegisterActivate_t cmpCmdTltContRegisterActivate; + /** Sp administrative response TltContRegisterActivate. */ + cmpRspTltContRegisterActivate_t cmpRspTltContRegisterActivate; + /** Sp administrative command TltContUnregister. */ + cmpCmdTltContUnregister_t cmpCmdTltContUnregister; + /** Sp administrative response TltContUnregister. */ + cmpRspTltContUnregister_t cmpRspTltContUnregister; + /** Sp administrative command TltContRegister. */ + cmpCmdTltContRegister_t cmpCmdTltContRegister; + /** Sp administrative response TltContRegister. */ + cmpRspTltContRegister_t cmpRspTltContRegister; + /** Sp administrative command TltContActivate. */ + cmpCmdTltContActivate_t cmpCmdTltContActivate; + /** Sp administrative response TltContActivate. */ + cmpRspTltContActivate_t cmpRspTltContActivate; + /** Sp administrative command TltContLockBySp. */ + cmpCmdTltContLockBySp_t cmpCmdTltContLockBySp; + /** Sp administrative response TltContLockBySp. */ + cmpRspTltContLockBySp_t cmpRspTltContLockBySp; + /** Sp administrative command TltContUnlockBySp. */ + cmpCmdTltContUnlockBySp_t cmpCmdTltContUnlockBySp; + /** Sp administrative response TltContUnlockBySp. */ + cmpRspTltContUnlockBySp_t cmpRspTltContUnlockBySp; + /** Sp administrative command TltContPersonalize. */ + cmpCmdTltContPersonalize_t cmpCmdTltContPersonalize; + /** Sp administrative response TltContPersonalize. */ + cmpRspTltContPersonalize_t cmpRspTltContPersonalize; +} cmpMessage_t; + +/** TCI CMP 2.0. */ +typedef struct { + /** TCI CMP 2.0 messages. */ + cmpMessage_t msg; +} cmp_t; + +#endif // TL_CM_API_H_ + +/** @} */ diff --git a/mobicore/common/MobiCore/inc/TlCm/3.0/cmp.h b/mobicore/common/MobiCore/inc/TlCm/3.0/cmp.h new file mode 100644 index 0000000000000000000000000000000000000000..ef2ba56f904ab595afa95c86e2653b21590087dc --- /dev/null +++ b/mobicore/common/MobiCore/inc/TlCm/3.0/cmp.h @@ -0,0 +1,965 @@ +/** @addtogroup CMP + * Content Management Protocol Definitions. + * + * The content management protocol (CMP) is based on the trustlet control + * interface (TCI) and CMP mapped interfaces. It defines commands/responses + * with the content management trustlet (TlCm). + * + * @{ + * + * @file + * CMP TCI global definitions. + * Various components need access to (sub-)structures defined and used by CMP; + * these common definitions are made available through this header file. + * + * Copyright © Trustonic Limited 2013. + * + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * 3. Neither the name of the Trustonic Limited nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef CMP_H_ +#define CMP_H_ + +#include "TlCm/cmpCommon.h" + +/** Info of the whole mapped memory with NWd. */ +typedef struct { + /** Address of the mapped memory. */ + void* addr; + /** Size of the mapped memory. */ + uint32_t len; +} cmpMapInfo_t; + +/** Info of the mapped element from a CMP message with NWd. */ +typedef struct { + /** Offset of the mapped element in the mapped memory. */ + uint32_t offset; + /** Size of the mapped element. */ + uint32_t len; +} cmpMapOffsetInfo_t; + +/** TCI CMP command header. */ +typedef struct { + /** CMP version. */ + cmpVersionId_t version; + /** Command id. */ + cmpCommandId_t commandId; + /** Info of the whole mapped memory with NWd. */ + cmpMapInfo_t mapInfo; + /** Info of the mapped CMP command with NWd. */ + cmpMapOffsetInfo_t cmpCmdMapOffsetInfo; +} cmpCommandHeaderTci_t; + +/** TCI CMP response header. */ +typedef struct { + /** CMP version. */ + cmpVersionId_t version; + /** Response id (must be command id | RSP_ID_MASK ). */ + cmpResponseId_t responseId; + /** Required lenght (return 0 if lenght is enough) of the mapped memory + * with NWd. */ + uint32_t len; +} cmpResponseHeaderTci_t; + +/** @defgroup MC_CMP_CMD_GET_VERSION_TCI \ + MC_CMP_CMD_GET_VERSION_TCI + * @{ */ + +/** @defgroup MC_CMP_CMD_GET_VERSION_TCI_CMD Command + * @{ */ + +/** GetVersion TCI command. */ +typedef struct { + /** Command header. */ + cmpCommandHeaderTci_t cmdHeader; +} cmpCmdGetVersionTci_t; + +/** @} */ + +/** @defgroup MC_CMP_CMD_GET_VERSION_TCI_RSP Response + * @{ */ + +/** GetVersion TCI response. */ +typedef struct { + /** Response header. */ + cmpResponseHeaderTci_t rspHeader; + /** Offset of the mapped CMP response with NWd. */ + cmpMapOffsetInfo_t cmpRspMapOffsetInfo; +} cmpRspGetVersionTci_t; + +/** @} */ + +/** @} */ + +/** @defgroup MC_CMP_CMD_GET_SUID_TCI \ + MC_CMP_CMD_GET_SUID_TCI + * @{ */ + +/** @defgroup MC_CMP_CMD_GET_VERSION_TCI_CMD Command + * @{ */ + +/** GetSuid TCI command. */ +typedef struct { + /** Command header. */ + cmpCommandHeaderTci_t cmdHeader; +} cmpCmdGetSuidTci_t; + +/** @} */ + +/** @defgroup MC_CMP_CMD_GET_VERSION_TCI_RSP Response + * @{ */ + +/** GetSuid TCI response. */ +typedef struct { + /** Response header. */ + cmpResponseHeaderTci_t rspHeader; + /** Offset of the mapped CMP response with NWd. */ + cmpMapOffsetInfo_t cmpRspMapOffsetInfo; +} cmpRspGetSuidTci_t; + +/** @} */ + +/** @} */ + +/** @defgroup MC_CMP_CMD_GENERATE_AUTH_TOKEN_TCI \ + MC_CMP_CMD_GENERATE_AUTH_TOKEN_TCI + * @{ */ + +/** @defgroup MC_CMP_CMD_GENERATE_AUTH_TOKEN_TCI_CMD Command + * @{ */ + +/** GenAuthToken TCI command. */ +typedef struct { + /** Command header. */ + cmpCommandHeaderTci_t cmdHeader; +} cmpCmdGenAuthTokenTci_t; + +/** @} */ + +/** @defgroup MC_CMP_CMD_GENERATE_AUTH_TOKEN_TCI_RSP Response + * @{ */ + +/** GenAuthToken TCI response. */ +typedef struct { + /** Response header. */ + cmpResponseHeaderTci_t rspHeaderTci; + /** Offset of the mapped CMP response with NWd. */ + cmpMapOffsetInfo_t cmpRspMapOffsetInfo; + /** Offset of the mapped AuthTokenCont with NWd. */ + cmpMapOffsetInfo_t cmpAuthTokenContMapOffsetInfo; +} cmpRspGenAuthTokenTci_t; + +/** @} */ + +/** @} */ + +/** @defgroup MC_CMP_CMD_BEGIN_SOC_AUTHENTICATION_TCI \ + MC_CMP_CMD_BEGIN_SOC_AUTHENTICATION_TCI + * @{ */ + +/** @defgroup MC_CMP_CMD_BEGIN_SOC_AUTHENTICATION_TCI_CMD Command + * @{ */ + +/** BeginSocAuthentication TCI command. */ +typedef struct { + /** Command header. */ + cmpCommandHeaderTci_t cmdHeader; + /** Offset of the mapped AuthTokenCont with NWd. */ + cmpMapOffsetInfo_t cmpAuthTokenContMapOffsetInfo; +} cmpCmdBeginSocAuthenticationTci_t; + +/** @} */ + +/** @defgroup MC_CMP_CMD_BEGIN_SOC_AUTHENTICATION_TCI_RSP Response + * @{ */ + +/** BeginSocAuthentication TCI response. */ +typedef struct { + /** Response header. */ + cmpResponseHeaderTci_t rspHeader; + /** Offset of the mapped CMP response with NWd. */ + cmpMapOffsetInfo_t cmpRspMapOffsetInfo; +} cmpRspBeginSocAuthenticationTci_t; + +/** @} */ + +/** @} */ + +/** @defgroup MC_CMP_CMD_BEGIN_ROOT_AUTHENTICATION_TCI \ + MC_CMP_CMD_BEGIN_ROOT_AUTHENTICATION_TCI + * @{ */ + +/** @defgroup MC_CMP_CMD_BEGIN_ROOT_AUTHENTICATION_TCI_CMD Command + * @{ */ + +/** BeginRootAuthentication TCI command. */ +typedef struct { + /** Command header. */ + cmpCommandHeaderTci_t cmdHeader; + /** Offset of the mapped RootCont with NWd. */ + cmpMapOffsetInfo_t cmpRootContMapOffsetInfo; +} cmpCmdBeginRootAuthenticationTci_t; + +/** @} */ + +/** @defgroup MC_CMP_CMD_BEGIN_ROOT_AUTHENTICATION_TCI_RSP Response + * @{ */ + +/** BeginRootAuthentication TCI response. */ +typedef struct { + /** Response header. */ + cmpResponseHeaderTci_t rspHeader; + /** Offset of the mapped CMP response with NWd. */ + cmpMapOffsetInfo_t cmpRspMapOffsetInfo; +} cmpRspBeginRootAuthenticationTci_t; + +/** @} */ + +/** @} */ + +/** @defgroup MC_CMP_CMD_BEGIN_SP_AUTHENTICATION_TCI \ + MC_CMP_CMD_BEGIN_SP_AUTHENTICATION_TCI + * @{ */ + +/** @defgroup MC_CMP_CMD_BEGIN_SP_AUTHENTICATION_TCI_CMD Command + * @{ */ + +/** BeginSpAuthentication TCI command. */ +typedef struct { + /** Command header. */ + cmpCommandHeaderTci_t cmdHeader; + /** Offset of the mapped RootCont with NWd. */ + cmpMapOffsetInfo_t cmpRootContMapOffsetInfo; + /** Offset of the mapped SpCont with NWd. */ + cmpMapOffsetInfo_t cmpSpContMapOffsetInfo; +} cmpCmdBeginSpAuthenticationTci_t; + +/** @} */ + +/** @defgroup MC_CMP_CMD_BEGIN_SP_AUTHENTICATION_TCI_RSP Response + * @{ */ + +/** BeginSpAuthentication TCI response. */ +typedef struct { + /** Response header. */ + cmpResponseHeaderTci_t rspHeader; + /** Offset of the mapped CMP response with NWd. */ + cmpMapOffsetInfo_t cmpRspMapOffsetInfo; +} cmpRspBeginSpAuthenticationTci_t; + +/** @} */ + +/** @} */ + +/** @defgroup MC_CMP_CMD_AUTHENTICATE_TCI \ + MC_CMP_CMD_AUTHENTICATE_TCI + * @{ */ + +/** @defgroup MC_CMP_CMD_AUTHENTICATE_TCI_CMD Command + * @{ */ + +/** Authenticate TCI command. */ +typedef struct { + /** Command header. */ + cmpCommandHeaderTci_t cmdHeader; +} cmpCmdAuthenticateTci_t; + +/** @} */ + +/** @defgroup MC_CMP_CMD_AUTHENTICATE_TCI_RSP Response + * @{ */ + +/** Authenticate TCI response. */ +typedef struct { + /** Response header. */ + cmpResponseHeaderTci_t rspHeader; + /** Offset of the mapped CMP response with NWd. */ + cmpMapOffsetInfo_t cmpRspMapOffsetInfo; +} cmpRspAuthenticateTci_t; + +/** @} */ + +/** @} */ + +/** @defgroup MC_CMP_CMD_AUTHENTICATE_TERMINATE_TCI \ + MC_CMP_CMD_AUTHENTICATE_TERMINATE_TCI + * @{ */ + +/** @defgroup MC_CMP_CMD_AUTHENTICATE_TERMINATE_TCI_CMD Command + * @{ */ + +/** AuthenticateTerminate TCI command. */ +typedef struct { + /** Command header. */ + cmpCommandHeaderTci_t cmdHeader; +} cmpCmdAuthenticateTerminateTci_t; + +/** @} */ + +/** @defgroup MC_CMP_CMD_AUTHENTICATE_TERMINATE_TCI_RSP Response + * @{ */ + +/** AuthenticateTerminate TCI response. */ +typedef struct { + /** Response header. */ + cmpResponseHeaderTci_t rspHeader; + /** Offset of the mapped CMP response with NWd. */ + cmpMapOffsetInfo_t cmpRspMapOffsetInfo; +} cmpRspAuthenticateTerminateTci_t; + +/** @} */ + +/** @} */ + +/** @defgroup MC_CMP_CMD_ROOT_CONT_REGISTER_ACTIVATE_TCI \ + MC_CMP_CMD_ROOT_CONT_REGISTER_ACTIVATE_TCI + * @{ */ + +/** @defgroup MC_CMP_CMD_ROOT_CONT_REGISTER_ACTIVATE_TCI_CMD Command + * @{ */ + +/** RootContRegisterActivate TCI command. */ +typedef struct { + /** Command header. */ + cmpCommandHeaderTci_t cmdHeader; +} cmpCmdRootContRegisterActivateTci_t; + +/** @} */ + +/** @defgroup MC_CMP_CMD_ROOT_CONT_REGISTER_ACTIVATE_TCI_RSP Response + * @{ */ + +/** RootContRegisterActivate TCI response. */ +typedef struct { + /** Response header. */ + cmpResponseHeaderTci_t rspHeader; + /** Offset of the mapped CMP response with NWd. */ + cmpMapOffsetInfo_t cmpRspMapOffsetInfo; + /** Offset of the mapped RootCont with NWd. */ + cmpMapOffsetInfo_t cmpRootContMapOffsetInfo; +} cmpRspRootContRegisterActivateTci_t; + +/** @} */ + +/** @} */ + +/** @defgroup MC_CMP_CMD_ROOT_CONT_UNREGISTER_TCI \ + MC_CMP_CMD_ROOT_CONT_UNREGISTER_TCI + * @{ */ + +/** @defgroup MC_CMP_CMD_ROOT_CONT_UNREGISTER_TCI_CMD Command + * @{ */ + +/** RootContUnregister TCI command. */ +typedef struct { + /** Command header. */ + cmpCommandHeaderTci_t cmdHeader; +} cmpCmdRootContUnregisterTci_t; + +/** @} */ + +/** @defgroup MC_CMP_CMD_ROOT_CONT_UNREGISTER_TCI_RSP Response + * @{ */ + +/** RootContUnregister TCI response. */ +typedef struct { + /** Response header. */ + cmpResponseHeaderTci_t rspHeader; + /** Offset of the mapped CMP response with NWd. */ + cmpMapOffsetInfo_t cmpRspMapOffsetInfo; +} cmpRspRootContUnregisterTci_t; + +/** @} */ + +/** @} */ + +/** @defgroup MC_CMP_CMD_ROOT_CONT_LOCK_BY_ROOT_TCI \ + MC_CMP_CMD_ROOT_CONT_LOCK_BY_ROOT_TCI + * @{ */ + +/** @defgroup MC_CMP_CMD_ROOT_CONT_LOCK_BY_ROOT_TCI_CMD Command + * @{ */ + +/** RootContLockByRoot TCI command. */ +typedef struct { + /** Command header. */ + cmpCommandHeaderTci_t cmdHeader; +} cmpCmdRootContLockByRootTci_t; + +/** @} */ + +/** @defgroup MC_CMP_CMD_ROOT_CONT_LOCK_BY_ROOT_TCI_RSP Response + * @{ */ + +/** RootContLockByRoot TCI response. */ +typedef struct { + /** Response header. */ + cmpResponseHeaderTci_t rspHeader; + /** Offset of the mapped CMP response with NWd. */ + cmpMapOffsetInfo_t cmpRspMapOffsetInfo; + /** Offset of the mapped RootCont with NWd. */ + cmpMapOffsetInfo_t cmpRootContMapOffsetInfo; +} cmpRspRootContLockByRootTci_t; + +/** @} */ + +/** @} */ + +/** @defgroup MC_CMP_CMD_ROOT_CONT_UNLOCK_BY_ROOT_TCI \ + MC_CMP_CMD_ROOT_CONT_UNLOCK_BY_ROOT_TCI + * @{ */ + +/** @defgroup MC_CMP_CMD_ROOT_CONT_UNLOCK_BY_ROOT_TCI_CMD Command + * @{ */ + +/** RootContUnlockByRoot TCI command. */ +typedef struct { + /** Command header. */ + cmpCommandHeaderTci_t cmdHeader; +} cmpCmdRootContUnlockByRootTci_t; + +/** @} */ + +/** @defgroup MC_CMP_CMD_ROOT_CONT_UNLOCK_BY_ROOT_TCI_RSP Response + * @{ */ + +/** RootContUnlockByRoot TCI response. */ +typedef struct { + /** Response header. */ + cmpResponseHeaderTci_t rspHeader; + /** Offset of the mapped CMP response with NWd. */ + cmpMapOffsetInfo_t cmpRspMapOffsetInfo; + /** Offset of the mapped RootCont with NWd. */ + cmpMapOffsetInfo_t cmpRootContMapOffsetInfo; +} cmpRspRootContUnlockByRootTci_t; + +/** @} */ + +/** @} */ + +/** @defgroup MC_CMP_CMD_SP_CONT_REGISTER_ACTIVATE_TCI \ + MC_CMP_CMD_SP_CONT_REGISTER_ACTIVATE_TCI + * @{ */ + +/** @defgroup MC_CMP_CMD_SP_CONT_REGISTER_ACTIVATE_TCI_CMD Command + * @{ */ + +/** SpContRegisterActivate TCI command. */ +typedef struct { + /** Command header. */ + cmpCommandHeaderTci_t cmdHeader; +} cmpCmdSpContRegisterActivateTci_t; + +/** @} */ + +/** @defgroup MC_CMP_CMD_SP_CONT_REGISTER_ACTIVATE_TCI_RSP Response + * @{ */ + +/** SpContRegisterActivate TCI response. */ +typedef struct { + /** Response header. */ + cmpResponseHeaderTci_t rspHeader; + /** Offset of the mapped CMP response with NWd. */ + cmpMapOffsetInfo_t cmpRspMapOffsetInfo; + /** Offset of the mapped RootCont with NWd. */ + cmpMapOffsetInfo_t cmpRootContMapOffsetInfo; + /** Offset of the mapped SpCont with NWd. */ + cmpMapOffsetInfo_t cmpSpContMapOffsetInfo; +} cmpRspSpContRegisterActivateTci_t; + +/** @} */ + +/** @} */ + +/** @defgroup MC_CMP_CMD_SP_CONT_UNREGISTER_TCI \ + MC_CMP_CMD_SP_CONT_UNREGISTER_TCI + * @{ */ + +/** @defgroup MC_CMP_CMD_SP_CONT_UNREGISTER_TCI_CMD Command + * @{ */ + +/** SpContUnregister TCI command. */ +typedef struct { + /** Command header. */ + cmpCommandHeaderTci_t cmdHeader; +} cmpCmdSpContUnregisterTci_t; + +/** @} */ + +/** @defgroup MC_CMP_CMD_SP_CONT_UNREGISTER_TCI_RSP Response + * @{ */ + +/** SpContUnregister TCI response. */ +typedef struct { + /** Response header. */ + cmpResponseHeaderTci_t rspHeader; + /** Offset of the mapped CMP response with NWd. */ + cmpMapOffsetInfo_t cmpRspMapOffsetInfo; + /** Offset of the mapped RootCont with NWd. */ + cmpMapOffsetInfo_t cmpRootContMapOffsetInfo; +} cmpRspSpContUnregisterTci_t; + +/** @} */ + +/** @} */ + +/** @defgroup MC_CMP_CMD_SP_CONT_REGISTER_TCI \ + MC_CMP_CMD_SP_CONT_REGISTER_TCI + * @{ */ + +/** @defgroup MC_CMP_CMD_SP_CONT_REGISTER_TCI_CMD Command + * @{ */ + +/** SpContRegister TCI command. */ +typedef struct { + /** Command header. */ + cmpCommandHeaderTci_t cmdHeader; +} cmpCmdSpContRegisterTci_t; + +/** @} */ + +/** @defgroup MC_CMP_CMD_SP_CONT_REGISTER_TCI_RSP Response + * @{ */ + +/** SpContRegister TCI response. */ +typedef struct { + /** Response header. */ + cmpResponseHeaderTci_t rspHeader; + /** Offset of the mapped CMP response with NWd. */ + cmpMapOffsetInfo_t cmpRspMapOffsetInfo; + /** Offset of the mapped RootCont with NWd. */ + cmpMapOffsetInfo_t cmpRootContMapOffsetInfo; + /** Offset of the mapped SpCont with NWd. */ + cmpMapOffsetInfo_t cmpSpContMapOffsetInfo; +} cmpRspSpContRegisterTci_t; + +/** @} */ + +/** @} */ + +/** @defgroup MC_CMP_CMD_SP_CONT_LOCK_BY_ROOT_TCI \ + MC_CMP_CMD_SP_CONT_LOCK_BY_ROOT_TCI + * @{ */ + +/** @defgroup MC_CMP_CMD_SP_CONT_LOCK_BY_ROOT_TCI_CMD Command + * @{ */ + +/** SpContLockByRoot TCI command. */ +typedef struct { + /** Command header. */ + cmpCommandHeaderTci_t cmdHeader; + /** Offset of the mapped SpCont with NWd. */ + cmpMapOffsetInfo_t cmpSpContMapOffsetInfo; +} cmpCmdSpContLockByRootTci_t; + +/** @} */ + +/** @defgroup MC_CMP_CMD_SP_CONT_LOCK_BY_ROOT_TCI_RSP Response + * @{ */ + +/** SpContLockByRoot TCI response. */ +typedef struct { + /** Response header. */ + cmpResponseHeaderTci_t rspHeader; + /** Offset of the mapped CMP response with NWd. */ + cmpMapOffsetInfo_t cmpRspMapOffsetInfo; + /** Offset of the mapped SpCont with NWd. */ + cmpMapOffsetInfo_t cmpSpContMapOffsetInfo; +} cmpRspSpContLockByRootTci_t; + +/** @} */ + +/** @} */ + +/** @defgroup MC_CMP_CMD_SP_CONT_UNLOCK_BY_ROOT_TCI \ + MC_CMP_CMD_SP_CONT_UNLOCK_BY_ROOT_TCI + * @{ */ + +/** @defgroup MC_CMP_CMD_SP_CONT_UNLOCK_BY_ROOT_TCI_CMD Command + * @{ */ + +/** SpContUnlockByRoot TCI command. */ +typedef struct { + /** Command header. */ + cmpCommandHeaderTci_t cmdHeader; + /** Offset of the mapped SpCont with NWd. */ + cmpMapOffsetInfo_t cmpSpContMapOffsetInfo; +} cmpCmdSpContUnlockByRootTci_t; + +/** @} */ + +/** @defgroup MC_CMP_CMD_SP_CONT_UNLOCK_BY_ROOT_TCI_RSP Response + * @{ */ + +/** SpContUnlockByRoot TCI response. */ +typedef struct { + /** Response header. */ + cmpResponseHeaderTci_t rspHeader; + /** Offset of the mapped CMP response with NWd. */ + cmpMapOffsetInfo_t cmpRspMapOffsetInfo; + /** Offset of the mapped SpCont with NWd. */ + cmpMapOffsetInfo_t cmpSpContMapOffsetInfo; +} cmpRspSpContUnlockByRootTci_t; + +/** @} */ + +/** @} */ + +/** @defgroup MC_CMP_CMD_SP_CONT_ACTIVATE_TCI \ + MC_CMP_CMD_SP_CONT_ACTIVATE_TCI + * @{ */ + +/** @defgroup MC_CMP_CMD_SP_CONT_ACTIVATE_TCI_CMD Command + * @{ */ + +/** SpContActivate TCI command. */ +typedef struct { + /** Command header. */ + cmpCommandHeaderTci_t cmdHeader; +} cmpCmdSpContActivateTci_t; + +/** @} */ + +/** @defgroup MC_CMP_CMD_SP_CONT_ACTIVATE_TCI_RSP Response + * @{ */ + +/** SpContActivate TCI response. */ +typedef struct { + /** Response header. */ + cmpResponseHeaderTci_t rspHeader; + /** Offset of the mapped CMP response with NWd. */ + cmpMapOffsetInfo_t cmpRspMapOffsetInfo; + /** Offset of the mapped SpCont with NWd. */ + cmpMapOffsetInfo_t cmpSpContMapOffsetInfo; +} cmpRspSpContActivateTci_t; + +/** @} */ + +/** @} */ + +/** @defgroup MC_CMP_CMD_SP_CONT_LOCK_BY_SP_TCI \ + MC_CMP_CMD_SP_CONT_LOCK_BY_SP_TCI + * @{ */ + +/** @defgroup MC_CMP_CMD_SP_CONT_LOCK_BY_SP_TCI_CMD Command + * @{ */ + +/** SpContLockBySp TCI command. */ +typedef struct { + /** Command header. */ + cmpCommandHeaderTci_t cmdHeader; +} cmpCmdSpContLockBySpTci_t; + +/** @} */ + +/** @defgroup MC_CMP_CMD_SP_CONT_LOCK_BY_SP_TCI_RSP Response + * @{ */ + +/** SpContLockBySp TCI response. */ +typedef struct { + /** Response header. */ + cmpResponseHeaderTci_t rspHeader; + /** Offset of the mapped CMP response with NWd. */ + cmpMapOffsetInfo_t cmpRspMapOffsetInfo; + /** Offset of the mapped SpCont with NWd. */ + cmpMapOffsetInfo_t cmpSpContMapOffsetInfo; +} cmpRspSpContLockBySpTci_t; + +/** @} */ + +/** @} */ + +/** @defgroup MC_CMP_CMD_SP_CONT_UNLOCK_BY_SP_TCI \ + MC_CMP_CMD_SP_CONT_UNLOCK_BY_SP_TCI + * @{ */ + +/** @defgroup MC_CMP_CMD_SP_CONT_UNLOCK_BY_SP_TCI_CMD Command + * @{ */ + +/** SpContUnlockBySp TCI command. */ +typedef struct { + /** Command header. */ + cmpCommandHeaderTci_t cmdHeader; +} cmpCmdSpContUnlockBySpTci_t; + +/** @} */ + +/** @defgroup MC_CMP_CMD_SP_CONT_UNLOCK_BY_SP_TCI_RSP Response + * @{ */ + +/** SpContUnlockBySp TCI response. */ +typedef struct { + /** Response header. */ + cmpResponseHeaderTci_t rspHeader; + /** Offset of the mapped CMP response with NWd. */ + cmpMapOffsetInfo_t cmpRspMapOffsetInfo; + /** Offset of the mapped SpCont with NWd. */ + cmpMapOffsetInfo_t cmpSpContMapOffsetInfo; +} cmpRspSpContUnlockBySpTci_t; + +/** @} */ + +/** @} */ + +/** @defgroup MC_CMP_CMD_TLT_CONT_REGISTER_ACTIVATE_TCI \ + MC_CMP_CMD_TLT_CONT_REGISTER_ACTIVATE_TCI + * @{ */ + +/** @defgroup MC_CMP_CMD_TLT_CONT_REGISTER_ACTIVATE_TCI_CMD Command + * @{ */ + +/** TltContRegisterActivate TCI command. */ +typedef struct { + /** Command header. */ + cmpCommandHeaderTci_t cmdHeader; +} cmpCmdTltContRegisterActivateTci_t; + +/** @} */ + +/** @defgroup MC_CMP_CMD_TLT_CONT_REGISTER_ACTIVATE_TCI_RSP Response + * @{ */ + +/** TltContRegisterActivate TCI response. */ +typedef struct { + /** Response header. */ + cmpResponseHeaderTci_t rspHeader; + /** Offset of the mapped CMP response with NWd. */ + cmpMapOffsetInfo_t cmpRspMapOffsetInfo; + /** Offset of the mapped SpCont with NWd. */ + cmpMapOffsetInfo_t cmpSpContMapOffsetInfo; + /** Offset of the mapped TltCont with NWd. */ + cmpMapOffsetInfo_t cmpTltContMapOffsetInfo; +} cmpRspTltContRegisterActivateTci_t; + +/** @} */ + +/** @} */ + +/** @defgroup MC_CMP_CMD_TLT_CONT_UNREGISTER_TCI \ + MC_CMP_CMD_TLT_CONT_UNREGISTER_TCI + * @{ */ + +/** @defgroup MC_CMP_CMD_TLT_CONT_UNREGISTER_TCI_CMD Command + * @{ */ + +/** TltContUnregister TCI command. */ +typedef struct { + /** Command header. */ + cmpCommandHeaderTci_t cmdHeader; +} cmpCmdTltContUnregisterTci_t; + +/** @} */ + +/** @defgroup MC_CMP_CMD_TLT_CONT_UNREGISTER_TCI_RSP Response + * @{ */ + +/** TltContUnregister TCI response. */ +typedef struct { + /** Response header. */ + cmpResponseHeaderTci_t rspHeader; + /** Offset of the mapped CMP response with NWd. */ + cmpMapOffsetInfo_t cmpRspMapOffsetInfo; + /** Offset of the mapped SpCont with NWd. */ + cmpMapOffsetInfo_t cmpSpContMapOffsetInfo; +} cmpRspTltContUnregisterTci_t; + +/** @} */ + +/** @} */ + +/** @defgroup MC_CMP_CMD_TLT_CONT_REGISTER_TCI \ + MC_CMP_CMD_TLT_CONT_REGISTER_TCI + * @{ */ + +/** @defgroup MC_CMP_CMD_TLT_CONT_REGISTER_TCI_CMD Command + * @{ */ + +/** TltContRegister TCI command. */ +typedef struct { + /** Command header. */ + cmpCommandHeaderTci_t cmdHeader; +} cmpCmdTltContRegisterTci_t; + +/** @} */ + +/** @defgroup MC_CMP_CMD_TLT_CONT_REGISTER_TCI_RSP Response + * @{ */ + +/** TltContRegister TCI response. */ +typedef struct { + /** Response header. */ + cmpResponseHeaderTci_t rspHeader; + /** Offset of the mapped CMP response with NWd. */ + cmpMapOffsetInfo_t cmpRspMapOffsetInfo; + /** Offset of the mapped SpCont with NWd. */ + cmpMapOffsetInfo_t cmpSpContMapOffsetInfo; + /** Offset of the mapped TltCont with NWd. */ + cmpMapOffsetInfo_t cmpTltContMapOffsetInfo; +} cmpRspTltContRegisterTci_t; + +/** @} */ + +/** @} */ + +/** @defgroup MC_CMP_CMD_TLT_CONT_ACTIVATE_TCI \ + MC_CMP_CMD_TLT_CONT_ACTIVATE_TCI + * @{ */ + +/** @defgroup MC_CMP_CMD_TLT_CONT_ACTIVATE_TCI_CMD Command + * @{ */ + +/** TltContActivate TCI command. */ +typedef struct { + /** Command header. */ + cmpCommandHeaderTci_t cmdHeader; + /** Offset of the mapped TltCont with NWd. */ + cmpMapOffsetInfo_t cmpTltContMapOffsetInfo; +} cmpCmdTltContActivateTci_t; + +/** @} */ + +/** @defgroup MC_CMP_CMD_TLT_CONT_ACTIVATE_TCI_RSP Response + * @{ */ + +/** TltContActivate TCI response. */ +typedef struct { + /** Response header. */ + cmpResponseHeaderTci_t rspHeader; + /** Offset of the mapped CMP response with NWd. */ + cmpMapOffsetInfo_t cmpRspMapOffsetInfo; + /** Offset of the mapped TltCont with NWd. */ + cmpMapOffsetInfo_t cmpTltContMapOffsetInfo; +} cmpRspTltContActivateTci_t; + +/** @} */ + +/** @} */ + +/** @defgroup MC_CMP_CMD_TLT_CONT_LOCK_BY_SP_TCI \ + MC_CMP_CMD_TLT_CONT_LOCK_BY_SP_TCI + * @{ */ + +/** @defgroup MC_CMP_CMD_TLT_CONT_LOCK_BY_SP_TCI_CMD Command + * @{ */ + +/** TltContLockBySp TCI command. */ +typedef struct { + /** Command header. */ + cmpCommandHeaderTci_t cmdHeader; + /** Offset of the mapped TltCont with NWd. */ + cmpMapOffsetInfo_t cmpTltContMapOffsetInfo; +} cmpCmdTltContLockBySpTci_t; + +/** @} */ + +/** @defgroup MC_CMP_CMD_TLT_CONT_LOCK_BY_SP_TCI_RSP Response + * @{ */ + +/** TltContLockBySp TCI response. */ +typedef struct { + /** Response header. */ + cmpResponseHeaderTci_t rspHeader; + /** Offset of the mapped CMP response with NWd. */ + cmpMapOffsetInfo_t cmpRspMapOffsetInfo; + /** Offset of the mapped TltCont with NWd. */ + cmpMapOffsetInfo_t cmpTltContMapOffsetInfo; +} cmpRspTltContLockBySpTci_t; + +/** @} */ + +/** @} */ + +/** @defgroup MC_CMP_CMD_TLT_CONT_UNLOCK_BY_SP_TCI \ + MC_CMP_CMD_TLT_CONT_UNLOCK_BY_SP_TCI + * @{ */ + +/** @defgroup MC_CMP_CMD_TLT_CONT_UNLOCK_BY_SP_TCI_CMD Command + * @{ */ + +/** TltContUnlockBySp TCI command. */ +typedef struct { + /** Command header. */ + cmpCommandHeaderTci_t cmdHeader; + /** Offset of the mapped TltCont with NWd. */ + cmpMapOffsetInfo_t cmpTltContMapOffsetInfo; +} cmpCmdTltContUnlockBySpTci_t; + +/** @} */ + +/** @defgroup MC_CMP_CMD_TLT_CONT_UNLOCK_BY_SP_TCI_RSP Response + * @{ */ + +/** TltContUnlockBySp TCI response. */ +typedef struct { + /** Response header. */ + cmpResponseHeaderTci_t rspHeader; + /** Offset of the mapped CMP response with NWd. */ + cmpMapOffsetInfo_t cmpRspMapOffsetInfo; + /** Offset of the mapped TltCont with NWd. */ + cmpMapOffsetInfo_t cmpTltContMapOffsetInfo; +} cmpRspTltContUnlockBySpTci_t; + +/** @} */ + +/** @} */ + +/** @defgroup MC_CMP_CMD_TLT_CONT_PERSONALIZE_TCI \ + MC_CMP_CMD_TLT_CONT_PERSONALIZE_TCI + * @{ */ + +/** @defgroup MC_CMP_CMD_TLT_CONT_PERSONALIZE_TCI_CMD Command + * @{ */ + +/** TltContPersonalize TCI command. */ +typedef struct { + /** Command header. */ + cmpCommandHeaderTci_t cmdHeader; + /** Offset of the mapped TltCont with NWd. */ + cmpMapOffsetInfo_t cmpTltContMapOffsetInfo; +} cmpCmdTltContPersonalizeTci_t; + +/** @} */ + +/** @defgroup MC_CMP_CMD_TLT_CONT_PERSONALIZE_TCI_RSP Response + * @{ */ + +/** TltContPersonalize TCI response. */ +typedef struct { + /** Response header. */ + cmpResponseHeaderTci_t rspHeader; + /** Offset of the mapped CMP response with NWd. */ + cmpMapOffsetInfo_t cmpRspMapOffsetInfo; + /** Offset of the mapped PersonalizeData with NWd. */ + cmpMapOffsetInfo_t cmpTltContPersoMapOffsetInfo; +} cmpRspTltContPersonalizeTci_t; + +/** @} */ + +/** @} */ + +#endif // CMP_H_ + +/** @} */ diff --git a/mobicore/common/MobiCore/inc/TlCm/3.0/cmpMap.h b/mobicore/common/MobiCore/inc/TlCm/3.0/cmpMap.h new file mode 100644 index 0000000000000000000000000000000000000000..0727407e45544e5b293edbdf84e949694ede3ded --- /dev/null +++ b/mobicore/common/MobiCore/inc/TlCm/3.0/cmpMap.h @@ -0,0 +1,2128 @@ +/** @addtogroup CMP + * Content Management Protocol Definitions. + * + * The content management protocol (CMP) is based on the trustlet control + * interface (TCI) and CMP mapped interfaces. It defines commands/responses with + * the content management trustlet (TlCm). + * + * @{ + * + * @file + * CMP mapped global definitions. + * Various components need access to (sub-)structures defined and used by CMP; + * these common definitions are made available through this header file. + * + * Copyright © Trustonic Limited 2013. + * + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * 3. Neither the name of the Trustonic Limited nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef CMP_MAP_H_ +#define CMP_MAP_H_ + +#include "TlCm/3.0/cmp.h" + +/** Map CMP GetVersion message. */ +typedef union { + /** Map CMP command. */ + cmpCmdGetVersion_t cmpCmdGetVersion; + /** Map CMP response. */ + cmpRspGetVersion_t cmpRspGetVersion; +} cmpMapGetVersion_t; + +/** Map CMP GetSuid message. */ +typedef union { + /** Map CMP command. */ + cmpCmdGetSuid_t cmpCmdGetSuid; + /** Map CMP response. */ + cmpRspGetSuid_t cmpRspGetSuid; +} cmpMapGetSuid_t; + +/** Map CMP GenAuthToken message. */ +typedef union { + /** Map CMP command. */ + cmpCmdGenAuthToken_t cmpCmdGenAuthToken; + /** Map CMP response. */ + cmpRspGenAuthToken_t cmpRspGenAuthToken; +} cmpMapGenAuthToken_t; + +/** Map CMP command header. */ +typedef struct { + /** Command id. */ + cmpCommandId_t commandId; + /** Size of command. */ + uint32_t len; + /** Reserved. */ + uint32_t reserved; +} cmpCommandHeaderMap_t; + +/** Map CMP response header. */ +typedef struct { + /** Return id. */ + cmpResponseId_t responseId; + /** Return code. */ + cmpReturnCode_t returnCode; + /** Size of response. */ + uint32_t len; + /** Reserved. */ + uint32_t reserved; +} cmpResponseHeaderMap_t; + +/** Map CMP message header. */ +typedef union { + /** Map CMP command. */ + cmpCommandHeaderMap_t cmdHeader; + /** Map CMP response. */ + cmpResponseHeaderMap_t rspHeader; +} cmpMapHeader_t; + +/** CMP error signed response. */ +typedef struct { + /** Response header. */ + cmpResponseHeaderMap_t rspHeader; + /** Signature. */ + cmpMac_t mac; +} cmpErrorRsp_t; + +/** Map CMP error response. */ +typedef struct { + /** Response. */ + cmpErrorRsp_t rsp; +} cmpMapError_t; + +/** @defgroup MC_CMP_CMD_BEGIN_SOC_AUTHENTICATION \ + MC_CMP_CMD_BEGIN_SOC_AUTHENTICATION + * @{ */ + +/** @defgroup MC_CMP_CMD_BEGIN_SOC_AUTHENTICATION_CMD Command + * @{ */ + +/** BeginSocAuthentication non signed command. */ +typedef struct { + /** Command header. */ + cmpCommandHeaderMap_t cmdHeader; +} cmpBeginSocAuthenticationCmd_t; + +/** BeginSocAuthentication command. */ +typedef struct { + /** Command. */ + cmpBeginSocAuthenticationCmd_t cmd; +} cmpCmdBeginSocAuthentication_t; + +/** @} */ + +/** @defgroup MC_CMP_CMD_BEGIN_SOC_AUTHENTICATION_RSP Response + * @{ */ + +/** BeginSocAuthentication signed response. */ +typedef struct { + /** Response header. */ + cmpResponseHeaderMap_t rspHeader; + /** Suid. */ + mcSuid_t suid; + /** SWd authentication random number. */ + cmpRnd8_t rnd1; +} cmpBeginSocAuthenticationRspSdata_t; + +/** BeginSocAuthentication signed response and signature. */ +typedef struct { + /** Signed response. */ + cmpBeginSocAuthenticationRspSdata_t sdata; + /** Signature. */ + cmpMac_t mac; +} cmpBeginSocAuthenticationRsp_t; + +/** BeginSocAuthentication response. */ +typedef struct { + /** Response. */ + cmpBeginSocAuthenticationRsp_t rsp; +} cmpRspBeginSocAuthentication_t; + +/** @} */ + +/** Map CMP BeginSocAuthentication message. */ +typedef union { + /** Map CMP command. */ + cmpCmdBeginSocAuthentication_t cmpCmdBeginSocAuthentication; + /** Map CMP response. */ + cmpRspBeginSocAuthentication_t cmpRspBeginSocAuthentication; +} cmpMapBeginSocAuthentication_t; + +/** @} */ + +/** @defgroup MC_CMP_CMD_BEGIN_ROOT_AUTHENTICATION \ + MC_CMP_CMD_BEGIN_ROOT_AUTHENTICATION + * @{ */ + +/** @defgroup MC_CMP_CMD_BEGIN_ROOT_AUTHENTICATION_CMD Command + * @{ */ + +/** BeginRootAuthentication non signed command. */ +typedef struct { + /** Command header. */ + cmpCommandHeaderMap_t cmdHeader; +} cmpBeginRootAuthenticationCmd_t; + +/** BeginRootAuthentication command. */ +typedef struct { + /** Command. */ + cmpBeginRootAuthenticationCmd_t cmd; +} cmpCmdBeginRootAuthentication_t; + +/** @} */ + +/** @defgroup MC_CMP_CMD_BEGIN_ROOT_AUTHENTICATION_RSP Response + * @{ */ + +/** BeginRootAuthentication signed response. */ +typedef struct { + /** Response header. */ + cmpResponseHeaderMap_t rspHeader; + /** Suid. */ + mcSuid_t suid; + /** SWd authentication random number. */ + cmpRnd8_t rnd1; +} cmpBeginRootAuthenticationRspSdata_t; + +/** BeginRootAuthentication signed response and signature. */ +typedef struct { + /** Signed response. */ + cmpBeginRootAuthenticationRspSdata_t sdata; + /** Signature. */ + cmpMac_t mac; +} cmpBeginRootAuthenticationRsp_t; + +/** BeginRootAuthentication response. */ +typedef struct { + /** Response. */ + cmpBeginRootAuthenticationRsp_t rsp; +} cmpRspBeginRootAuthentication_t; + +/** @} */ + +/** Map CMP BeginRootAuthentication message. */ +typedef union { + /** Map CMP command. */ + cmpCmdBeginRootAuthentication_t cmpCmdBeginRootAuthentication; + /** Map CMP response. */ + cmpRspBeginRootAuthentication_t cmpRspBeginRootAuthentication; +} cmpMapBeginRootAuthentication_t; + +/** @} */ + +/** @defgroup MC_CMP_CMD_BEGIN_SP_AUTHENTICATION \ + MC_CMP_CMD_BEGIN_SP_AUTHENTICATION + * @{ */ + +/** @defgroup MC_CMP_CMD_BEGIN_SP_AUTHENTICATION_CMD Command + * @{ */ + +/** BeginSpAuthentication non signed command. */ +typedef struct { + /** Command header. */ + cmpCommandHeaderMap_t cmdHeader; + /** Spid. */ + mcSpid_t spid; +} cmpBeginSpAuthenticationCmd_t; + +/** BeginSpAuthentication command. */ +typedef struct { + /** Command. */ + cmpBeginSpAuthenticationCmd_t cmd; +} cmpCmdBeginSpAuthentication_t; + +/** @} */ + +/** @defgroup MC_CMP_CMD_BEGIN_SP_AUTHENTICATION_RSP Response + * @{ */ + +/** BeginSpAuthentication signed response. */ +typedef struct { + /** Response header. */ + cmpResponseHeaderMap_t rspHeader; + /** Suid. */ + mcSuid_t suid; + /** Spid. */ + mcSpid_t spid; + /** SWd authentication random number. */ + cmpRnd8_t rnd1; +} cmpBeginSpAuthenticationRspSdata_t; + +/** BeginSpAuthentication signed response and signature. */ +typedef struct { + /** Signed response. */ + cmpBeginSpAuthenticationRspSdata_t sdata; + /** Signature. */ + cmpMac_t mac; +} cmpBeginSpAuthenticationRsp_t; + +/** BeginSpAuthentication response. */ +typedef struct { + /** Response. */ + cmpBeginSpAuthenticationRsp_t rsp; +} cmpRspBeginSpAuthentication_t; + +/** @} */ + +/** Map CMP BeginSpAuthentication message. */ +typedef union { + /** Map CMP command. */ + cmpCmdBeginSpAuthentication_t cmpCmdBeginSpAuthentication; + /** Map CMP response. */ + cmpRspBeginSpAuthentication_t cmpRspBeginSpAuthentication; +} cmpMapBeginSpAuthentication_t; + +/** @} */ + +/** @defgroup MC_CMP_CMD_AUTHENTICATE MC_CMP_CMD_AUTHENTICATE + * @{ */ + +/** @defgroup MC_CMP_CMD_AUTHENTICATE_CMD Command + * @{ */ + +/** Authenticate encrypted data command. */ +typedef struct { + /** NWd authentication random number. */ + cmpRnd8_t rnd2; + /** Suid. */ + mcSuid_t suid; + /** EntityId. */ + uint32_t entityId; + /** SWd authentication random number. */ + cmpRnd8_t rnd1; + /** NWd authentication random seed. */ + cmpRnd32_t k2; +} cmpAuthMsgEdata_t; + +/** Authenticate encrypted and padded data command. */ +typedef struct { + /** Encrypted data. */ + cmpAuthMsgEdata_t edata; + /** Padding. */ + uint8_t padding[CMP_ED_PADDING(sizeof(cmpAuthMsgEdata_t))]; +} cmpAuthCmdEd_t; + +/** Authenticate signed command. */ +typedef struct { + /** Command header. */ + cmpCommandHeaderMap_t cmdHeader; + /** Encrypted and padded data size. */ + uint32_t edLen; + /** Encrypted and padded data. */ + cmpAuthCmdEd_t ed; +} cmpAuthCmdSdata_t; + +/** Authenticate signed command and signature. */ +typedef struct { + /** Signed command. */ + cmpAuthCmdSdata_t sdata; + /** Signature. */ + cmpMac_t mac; +} cmpAuthenticateCmd_t; + +/** Authenticate command. */ +typedef struct { + /** Command. */ + cmpAuthenticateCmd_t cmd; +} cmpCmdAuthenticate_t; + +/** @} */ + +/** @defgroup MC_CMP_CMD_AUTHENTICATE_RSP Response + * @{ */ + +/** Authenticate encrypted data response. */ +typedef struct { + /** NWd authentication random number. */ + cmpRnd8_t rnd2; + /** Suid. */ + mcSuid_t suid; + /** EntityId. */ + uint32_t entityId; + /** SWd authentication random number. */ + cmpRnd8_t rnd1; + /** SWd authentication random seed. */ + cmpRnd32_t k1; +} cmpAuthRspEdata_t; + +/** Authenticate encrypted and padded data response. */ +typedef struct { + /** Encrypted data. */ + cmpAuthRspEdata_t edata; + /** Padding. */ + uint8_t padding[CMP_ED_PADDING(sizeof(cmpAuthRspEdata_t))]; +} cmpAuthRspEd_t; + +/** Authenticate signed response. */ +typedef struct { + /** Response header. */ + cmpResponseHeaderMap_t rspHeader; + /** Encrypted and padded data size. */ + uint32_t edLen; + /** Encrypted and padded data. */ + cmpAuthRspEd_t ed; +} cmpAuthRspSdata_t; + +/** Authenticate signed response and signature. */ +typedef struct { + /** Signed response. */ + cmpAuthRspSdata_t sdata; + /** Signature. */ + cmpMac_t mac; +} cmpAuthenticateRsp_t; + +/** Authenticate response. */ +typedef struct { + /** Response. */ + cmpAuthenticateRsp_t rsp; +} cmpRspAuthenticate_t; + +/** @} */ + +/** Map CMP Authenticate message. */ +typedef union { + /** Map CMP command. */ + cmpCmdAuthenticate_t cmpCmdAuthenticate; + /** Map CMP response. */ + cmpRspAuthenticate_t cmpRspAuthenticate; +} cmpMapAuthenticate_t; + +/** @} */ + +/** @defgroup MC_CMP_CMD_AUTHENTICATE_TERMINATE \ + MC_CMP_CMD_AUTHENTICATE_TERMINATE + * @{ */ + +/** @defgroup MC_CMP_CMD_AUTHENTICATE_TERMINATE_CMD Command + * @{ */ + +/** AuthenticateTerminate signed command. */ +typedef struct { + /** Command header. */ + cmpCommandHeaderMap_t cmdHeader; +} cmpAuthenticateTerminateCmdSdata_t; + +/** AuthenticateTerminate signed command and signature. */ +typedef struct { + /** Signed command. */ + cmpAuthenticateTerminateCmdSdata_t sdata; + /** Signature. */ + cmpMac_t mac; +} cmpAuthenticateTerminateCmd_t; + +/** AuthenticateTerminate command. */ +typedef struct { + /** Command. */ + cmpAuthenticateTerminateCmd_t cmd; +} cmpCmdAuthenticateTerminate_t; + +/** @} */ + +/** @defgroup MC_CMP_CMD_AUTHENTICATE_TERMINATE_RSP Response + * @{ */ + +/** AuthenticateTerminate signed response. */ +typedef struct { + /** Response header. */ + cmpResponseHeaderMap_t rspHeader; +} cmpAuthenticateTerminateRspSdata_t; + +/** AuthenticateTerminate signed response and signature. */ +typedef struct { + /** Signed response. */ + cmpAuthenticateTerminateRspSdata_t sdata; + /** Signature. */ + cmpMac_t mac; +} cmpAutenticateTerminateRsp_t; + +/** AuthenticateTerminate response. */ +typedef struct { + /** Response. */ + cmpAutenticateTerminateRsp_t rsp; +} cmpRspAuthenticateTerminate_t; + +/** @} */ + +/** Map CMP AuthenticateTerminate message. */ +typedef union { + /** Map CMP command. */ + cmpCmdAuthenticateTerminate_t cmpCmdAuthenticateTerminate; + /** Map CMP response. */ + cmpRspAuthenticateTerminate_t cmpRspAuthenticateTerminate; +} cmpMapAuthenticateTerminate_t; + +/** @} */ + +/** @defgroup MC_CMP_CMD_ROOT_CONT_REGISTER_ACTIVATE \ + MC_CMP_CMD_ROOT_CONT_REGISTER_ACTIVATE + * @{ */ + +/** @defgroup MC_CMP_CMD_ROOT_CONT_REGISTER_ACTIVATE_CMD Command + * @{ */ + +/** RootContRegisterActivate encrypted data command. */ +typedef struct { + /** Root authentication key. */ + mcSymmetricKey_t kRootAuth; +} cmpRootRegActMsgEdata_t; + +/** RootContRegisterActivate encrypted and padded data command. */ +typedef struct { + /** Encrypted data. */ + cmpRootRegActMsgEdata_t edata; + /** Padding. */ + uint8_t padding[CMP_ED_PADDING(sizeof(cmpRootRegActMsgEdata_t))]; +} cmpRootRegActCmdEd_t; + +/** RootContRegisterActivate signed command. */ +typedef struct { + /** Command header. */ + cmpCommandHeaderMap_t cmdHeader; + /** Rootid. */ + mcRootid_t rootid; + /** Encrypted and padded data size. */ + uint32_t edLen; + /** Encrypted and padded data. */ + cmpRootRegActCmdEd_t ed; +} cmpRootRegActCmdSdata_t; + +/** RootContRegisterActivate signed command and signature. */ +typedef struct { + /** Signed command. */ + cmpRootRegActCmdSdata_t sdata; + /** Signature. */ + cmpMac_t mac; +} cmpRootContRegisterActivateCmd_t; + +/** RootContRegisterActivate command. */ +typedef struct { + /** Command. */ + cmpRootContRegisterActivateCmd_t cmd; +} cmpCmdRootContRegisterActivate_t; + +/** @} */ + +/** @defgroup MC_CMP_CMD_ROOT_CONT_REGISTER_ACTIVATE_RSP Response + * @{ */ + +/** RootContRegisterActivate signed response. */ +typedef struct { + /** Response header. */ + cmpResponseHeaderMap_t rspHeader; + /** Root container secure object size. */ + uint32_t soRootContLen; + /** Root container secure object. */ + mcSoRootCont_t soRootCont; +} cmpRootRegActRspSdata_t; + +/** RootContRegisterActivate signed response and signature. */ +typedef struct { + /** Signed response. */ + cmpRootRegActRspSdata_t sdata; + /** Signature. */ + cmpMac_t mac; +} cmpRootContRegisterActivateRsp_t; + +/** RooContRegisterActivate response. */ +typedef struct { + /** Response. */ + cmpRootContRegisterActivateRsp_t rsp; +} cmpRspRootContRegisterActivate_t; + +/** @} */ + +/** Map CMP RootContRegisterActivate message. */ +typedef union { + /** Map CMP command. */ + cmpCmdRootContRegisterActivate_t cmpCmdRootContRegisterActivate; + /** Map CMP response. */ + cmpRspRootContRegisterActivate_t cmpRspRootContRegisterActivate; +} cmpMapRootContRegisterActivate_t; + +/** @} */ + +/** @defgroup MC_CMP_CMD_ROOT_CONT_UNREGISTER \ + MC_CMP_CMD_ROOT_CONT_UNREGISTER + * @{ */ + +/** @defgroup MC_CMP_CMD_ROOT_CONT_UNREGISTER_CMD Command + * @{ */ + +/** RootContUnregister encrypted data command. */ +typedef struct { + /** Suid. */ + mcSuid_t suid; +} cmpRootUnregMsgEdata_t; + +/** RootContUnregister encrypted and padded data command. */ +typedef struct { + /** Encrypted data. */ + cmpRootUnregMsgEdata_t edata; + /** Padding. */ + uint8_t padding[CMP_ED_PADDING(sizeof(cmpRootUnregMsgEdata_t))]; +} cmpRootUnregCmdEd_t; + +/** RootContUnregister signed command. */ +typedef struct { + /** Command header. */ + cmpCommandHeaderMap_t cmdHeader; + /** Encrypted and padded data size. */ + uint32_t edLen; + /** Encrypted and padded data. */ + cmpRootUnregCmdEd_t ed; +} cmpRootUnregCmdSdata_t; + +/** RootContUnregister signed command and signature. */ +typedef struct { + /** Signed command. */ + cmpRootUnregCmdSdata_t sdata; + /** Signature. */ + cmpMac_t mac; +} cmpRootContUnregisterCmd_t; + +/** RootContUnregister command. */ +typedef struct { + /** Command. */ + cmpRootContUnregisterCmd_t cmd; +} cmpCmdRootContUnregister_t; + +/** @} */ + +/** @defgroup MC_CMP_CMD_ROOT_CONT_UNREGISTER_RSP Response + * @{ */ + +/** RootContUnregister encrypted data response. */ +typedef struct { + /** Suid. */ + mcSuid_t suid; +} cmpRootUnregRspEdata_t; + +/** RootContUnregister encrypted and padded data response. */ +typedef struct { + /** Encrypted data. */ + cmpRootUnregRspEdata_t edata; + /** Padding. */ + uint8_t padding[CMP_ED_PADDING(sizeof(cmpRootUnregRspEdata_t))]; +} cmpRootUnregRspEd_t; + +/** RootContUnregister signed response. */ +typedef struct { + /** Response header. */ + cmpResponseHeaderMap_t rspHeader; + /** Encrypted and padded data size. */ + uint32_t edLen; + /** Encrypted and padded data. */ + cmpRootUnregRspEd_t ed; +} cmpRootUnregRspSdata_t; + +/** RootContUnregister signed response and signature. */ +typedef struct { + /** Signed response. */ + cmpRootUnregRspSdata_t sdata; + /** Signature. */ + cmpMac_t mac; +} cmpRootContUnregisterRsp_t; + +/** RootContUnregister response. */ +typedef struct { + /** Response. */ + cmpRootContUnregisterRsp_t rsp; +} cmpRspRootContUnregister_t; + +/** @} */ + +/** Map CMP RootContUnregister message. */ +typedef union { + /** Map CMP command. */ + cmpCmdRootContUnregister_t cmpCmdRootContUnregister; + /** Map CMP response. */ + cmpRspRootContUnregister_t cmpRspRootContUnregister; +} cmpMapRootContUnregister_t; + +/** @} */ + +/** @defgroup MC_CMP_CMD_ROOT_CONT_LOCK_BY_ROOT \ + MC_CMP_CMD_ROOT_CONT_LOCK_BY_ROOT + * @{ */ + +/** @defgroup MC_CMP_CMD_ROOT_CONT_LOCK_BY_ROOT_CMD Command + * @{ */ + +/** RootContLockByRoot signed command. */ +typedef struct { + /** Command header. */ + cmpCommandHeaderMap_t cmdHeader; +} cmpRootLockByRootCmdSdata_t; + +/** RootContLockByRoot signed command and signature. */ +typedef struct { + /** Signed command. */ + cmpRootLockByRootCmdSdata_t sdata; + /** Signature. */ + cmpMac_t mac; +} cmpRootContLockByRootCmd_t; + +/** RootContLockByRoot command. */ +typedef struct { + /** Command. */ + cmpRootContLockByRootCmd_t cmd; +} cmpCmdRootContLockByRoot_t; + +/** @} */ + +/** @defgroup MC_CMP_CMD_ROOT_CONT_LOCK_BY_ROOT_RSP Response + * @{ */ + +/** RootContLockByRoot signed response. */ +typedef struct { + /** Response header. */ + cmpResponseHeaderMap_t rspHeader; + /** Root container secure object size. */ + uint32_t soRootContLen; + /** Root container secure object. */ + mcSoRootCont_t soRootCont; +} cmpRootLockByRootRspSdata_t; + +/** RootContLockByRoot signed response and signature. */ +typedef struct { + /** Signed response. */ + cmpRootLockByRootRspSdata_t sdata; + /** Signature. */ + cmpMac_t mac; +} cmpRootContLockByRootRsp_t; + +/** RootContLockByRoot response. */ +typedef struct { + cmpRootContLockByRootRsp_t rsp; +} cmpRspRootContLockByRoot_t; + +/** @} */ + +/** Map CMP RootContLockByRoot message. */ +typedef union { + /** Map CMP command. */ + cmpCmdRootContLockByRoot_t cmpCmdRootContLockByRoot; + /** Map CMP response. */ + cmpRspRootContLockByRoot_t cmpRspRootContLockByRoot; +} cmpMapRootContLockByRoot_t; + +/** @} */ + +/** @defgroup MC_CMP_CMD_ROOT_CONT_UNLOCK_BY_ROOT \ + MC_CMP_CMD_ROOT_CONT_UNLOCK_BY_ROOT + * @{ */ + +/** @defgroup MC_CMP_CMD_ROOT_CONT_UNLOCK_BY_ROOT_CMD Command + * @{ */ + +/** RootContUnlockByRoot signed command. */ +typedef struct { + /** Command header. */ + cmpCommandHeaderMap_t cmdHeader; +} cmpRootUnlockByRootCmdSdata_t; + +/** RootContUnlockByRoot signed command and signature. */ +typedef struct { + /** Signed command. */ + cmpRootUnlockByRootCmdSdata_t sdata; + /** Signature. */ + cmpMac_t mac; +} cmpRootContUnlockByRootCmd_t; + +/** RootContUnlockByRoot command. */ +typedef struct { + /** Command. */ + cmpRootContUnlockByRootCmd_t cmd; +} cmpCmdRootContUnlockByRoot_t; + +/** @} */ + +/** @defgroup MC_CMP_CMD_ROOT_CONT_UNLOCK_BY_ROOT_RSP Response + * @{ */ + +/** RootContUnlockByRoot signed response. */ +typedef struct { + /** Response header. */ + cmpResponseHeaderMap_t rspHeader; + /** Root container secure object size. */ + uint32_t soRootContLen; + /** Root container secure object. */ + mcSoRootCont_t soRootCont; +} cmpRootUnlockByRootRspSdata_t; + +/** RootContUnlockByRoot signed response and signature. */ +typedef struct { + /** Signed response. */ + cmpRootUnlockByRootRspSdata_t sdata; + /** Signature. */ + cmpMac_t mac; +} cmpRootContUnlockByRootRsp_t; + +/** RootContUnlockByRoot response. */ +typedef struct { + /** Response. */ + cmpRootContUnlockByRootRsp_t rsp; +} cmpRspRootContUnlockByRoot_t; + +/** @} */ + +/** Map CMP RootContUnlockByRoot message. */ +typedef union { + /** Map CMP command. */ + cmpCmdRootContUnlockByRoot_t cmpCmdRootContUnlockByRoot; + /** Map CMP response. */ + cmpRspRootContUnlockByRoot_t cmpRspRootContUnlockByRoot; +} cmpMapRootContUnlockByRoot_t; + +/** @} */ + +/** @defgroup MC_CMP_CMD_SP_CONT_REGISTER_ACTIVATE \ + MC_CMP_CMD_SP_CONT_REGISTER_ACTIVATE + * @{ */ + +/** @defgroup MC_CMP_CMD_SP_CONT_REGISTER_ACTIVATE_CMD Command + * @{ */ + +/** SpContRegisterActivate encrypted data command. */ +typedef struct { + /** Sp authentication key. */ + mcSymmetricKey_t kSpAuth; +} cmpSpRegActMsgEdata_t; + +/** SpContRegisterActivate encrypted and padded data command. */ +typedef struct { + /** Encrypted data. */ + cmpSpRegActMsgEdata_t edata; + /** Padding. */ + uint8_t padding[CMP_ED_PADDING(sizeof(cmpSpRegActMsgEdata_t))]; +} cmpSpRegActCmdEd_t; + +/** SpContRegisterActivate signed command. */ +typedef struct { + /** Command header. */ + cmpCommandHeaderMap_t cmdHeader; + /** Spid. */ + mcSpid_t spid; + /** Encrypted and padded data size. */ + uint32_t edLen; + /** Encrypted and padded data. */ + cmpSpRegActCmdEd_t ed; +} cmpSpRegActCmdSdata_t; + +/** SpContRegisterActivate signed command and signature. */ +typedef struct { + /** Signed command. */ + cmpSpRegActCmdSdata_t sdata; + /** Signature. */ + cmpMac_t mac; +} cmpSpContRegisterActivateCmd_t; + +/** SpContRegisterActivate command. */ +typedef struct { + /** Command. */ + cmpSpContRegisterActivateCmd_t cmd; +} cmpCmdSpContRegisterActivate_t; + +/** @} */ + +/** @defgroup MC_CMP_CMD_SP_CONT_REGISTER_ACTIVATE_RSP Response + * @{ */ + +/** SpContRegisterActivate signed response. */ +typedef struct { + /** Response header. */ + cmpResponseHeaderMap_t rspHeader; + /** Root container secure object size. */ + uint32_t soRootContLen; + /** Root container secure object. */ + mcSoRootCont_t soRootCont; + /** Sp container secure object size. */ + uint32_t soSpContLen; + /** Sp container secure object. */ + mcSoSpCont_t soSpCont; +} cmpSpRegActRspSdata_t; + +/** SpContRegisterActivate signed response and signature. */ +typedef struct { + /** Signed response. */ + cmpSpRegActRspSdata_t sdata; + /** Signature. */ + cmpMac_t mac; +} cmpSpContRegisterActivateRsp_t; + +/** SpContRegisterActivate response. */ +typedef struct { + /** Response. */ + cmpSpContRegisterActivateRsp_t rsp; +} cmpRspSpContRegisterActivate_t; + +/** @} */ + +/** Map CMP SpContRegisterActivate message. */ +typedef union { + /** Map CMP command. */ + cmpCmdSpContRegisterActivate_t cmpCmdSpContRegisterActivate; + /** Map CMP response. */ + cmpRspSpContRegisterActivate_t cmpRspSpContRegisterActivate; +} cmpMapSpContRegisterActivate_t; + +/** @} */ + +/** @defgroup MC_CMP_CMD_SP_CONT_UNREGISTER \ + MC_CMP_CMD_SP_CONT_UNREGISTER + * @{ */ + +/** @defgroup MC_CMP_CMD_SP_CONT_UNREGISTER_CMD Command + * @{ */ + +/** SpContUnregister signed command. */ +typedef struct { + /** Command header. */ + cmpCommandHeaderMap_t cmdHeader; + /** Spid. */ + mcSpid_t spid; +} cmpSpContUnregCmdSdata_t; + +/** SpContUnregister signed command and signature. */ +typedef struct { + /** Signed command. */ + cmpSpContUnregCmdSdata_t sdata; + /** Signature. */ + cmpMac_t mac; +} cmpSpContUnregisterCmd_t; + +/** SpContUnregister command. */ +typedef struct { + /** Command. */ + cmpSpContUnregisterCmd_t cmd; +} cmpCmdSpContUnregister_t; + +/** @} */ + +/** @defgroup MC_CMP_CMD_SP_CONT_UNREGISTER_RSP Response + * @{ */ + +/** SpContUnregister signed response. */ +typedef struct { + /** Response header. */ + cmpResponseHeaderMap_t rspHeader; + /** Root container secure object size. */ + uint32_t soRootContLen; + /** Root container secure object. */ + mcSoRootCont_t soRootCont; +} cmpSpContUnregRspSdata_t; + +/** SpContUnregister signed response and signature. */ +typedef struct { + /** Signed response. */ + cmpSpContUnregRspSdata_t sdata; + /** Signature. */ + cmpMac_t mac; +} cmpSpContUnregisterRsp_t; + +/** SpContUnregister response. */ +typedef struct { + /** Response. */ + cmpSpContUnregisterRsp_t rsp; +} cmpRspSpContUnregister_t; + +/** @} */ + +/** Map CMP SpContUnregister message. */ +typedef union { + /** Map CMP command. */ + cmpCmdSpContUnregister_t cmpCmdSpContUnregister; + /** Map CMP response. */ + cmpRspSpContUnregister_t cmpRspSpContUnregister; +} cmpMapSpContUnregister_t; + +/** @} */ + +/** @defgroup MC_CMP_CMD_SP_CONT_REGISTER \ + MC_CMP_CMD_SP_CONT_REGISTER + * @{ */ + +/** @defgroup MC_CMP_CMD_SP_CONT_REGISTER_CMD Command + * @{ */ + +/** SpContRegister encrypted data command. */ +typedef struct { + /** Sp authentication key. */ + mcSymmetricKey_t kSpAuth; +} cmpSpRegisterMsgEdata_t; + +/** SpContRegister encrypted and padded data command. */ +typedef struct { + /** Encrypted data. */ + cmpSpRegisterMsgEdata_t edata; + /** Padding. */ + uint8_t padding[CMP_ED_PADDING(sizeof(cmpSpRegisterMsgEdata_t))]; +} cmpSpRegisterCmdEd_t; + +/** SpContRegister signed command. */ +typedef struct { + /** Command header. */ + cmpCommandHeaderMap_t cmdHeader; + /** Spid. */ + mcSpid_t spid; + /** Encrypted and padded data size. */ + uint32_t edLen; + /** Encrypted and padded data. */ + cmpSpRegisterCmdEd_t ed; +} cmpSpRegisterCmdSdata_t; + +/** SpContRegister signed command and signature. */ +typedef struct { + /** Signed command. */ + cmpSpRegisterCmdSdata_t sdata; + /** Signature. */ + cmpMac_t mac; +} cmpSpContRegisterCmd_t; + +/** SpContRegister command. */ +typedef struct { + /** Command. */ + cmpSpContRegisterCmd_t cmd; +} cmpCmdSpContRegister_t; + +/** @} */ + +/** @defgroup MC_CMP_CMD_SP_CONT_REGISTER_RSP Response + * @{ */ + +/** SpContRegister signed response. */ +typedef struct { + /** Response header. */ + cmpResponseHeaderMap_t rspHeader; + /** Root container secure object size. */ + uint32_t soRootContLen; + /** Root container secure object. */ + mcSoRootCont_t soRootCont; + /** Sp container secure object size. */ + uint32_t soSpContLen; + /** Sp container secure object. */ + mcSoSpCont_t soSpCont; +} cmpSpRegisterRspSdata_t; + +/** SpContRegister signed response and signature. */ +typedef struct { + /** Signed response. */ + cmpSpRegisterRspSdata_t sdata; + /** Signature. */ + cmpMac_t mac; +} cmpSpContRegisterRsp_t; + +/** SpContRegister response. */ +typedef struct { + /** Response. */ + cmpSpContRegisterRsp_t rsp; +} cmpRspSpContRegister_t; + +/** @} */ + +/** Map CMP SpContRegister message. */ +typedef union { + /** Map CMP command. */ + cmpCmdSpContRegister_t cmpCmdSpContRegister; + /** Map CMP response. */ + cmpRspSpContRegister_t cmpRspSpContRegister; +} cmpMapSpContRegister_t; + +/** @} */ + +/** @defgroup MC_CMP_CMD_SP_CONT_LOCK_BY_ROOT \ + MC_CMP_CMD_SP_CONT_LOCK_BY_ROOT + * @{ */ + +/** @defgroup MC_CMP_CMD_SP_CONT_LOCK_BY_ROOT_CMD Command + * @{ */ + +/** SpContLockByRoot signed command. */ +typedef struct { + /** Command header. */ + cmpCommandHeaderMap_t cmdHeader; + /** Spid. */ + mcSpid_t spid; +} cmpSpLockByRootCmdSdata_t; + +/** SpContLockByRoot signed command and signature. */ +typedef struct { + /** Signed command. */ + cmpSpLockByRootCmdSdata_t sdata; + /** Signature. */ + cmpMac_t mac; +} cmpSpContLockByRootCmd_t; + +/** SpContLockByRoot command. */ +typedef struct { + /** Command. */ + cmpSpContLockByRootCmd_t cmd; +} cmpCmdSpContLockByRoot_t; + +/** @} */ + +/** @defgroup MC_CMP_CMD_SP_CONT_LOCK_BY_ROOT_RSP Response + * @{ */ + +/** SpContLockByRoot signed response. */ +typedef struct { + /** Response header. */ + cmpResponseHeaderMap_t rspHeader; + /** Sp container secure object size. */ + uint32_t soSpContLen; + /** Sp container secure object. */ + mcSoSpCont_t soSpCont; +} cmpSpLockByRootRspSdata_t; + +/** SpContLockByRoot signed response and signature. */ +typedef struct { + /** Signed response. */ + cmpSpLockByRootRspSdata_t sdata; + /** Signature. */ + cmpMac_t mac; +} cmpSpContLockByRootRsp_t; + +/** SpContLockByRoot response. */ +typedef struct { + /** Response. */ + cmpSpContLockByRootRsp_t rsp; +} cmpRspSpContLockByRoot_t; + +/** @} */ + +/** Map CMP SpContLockByRoot message. */ +typedef union { + /** Map CMP command. */ + cmpCmdSpContLockByRoot_t cmpCmdSpContLockByRoot; + /** Map CMP response. */ + cmpRspSpContLockByRoot_t cmpRspSpContLockByRoot; +} cmpMapSpContLockByRoot_t; + +/** @} */ + +/** @defgroup MC_CMP_CMD_SP_CONT_UNLOCK_BY_ROOT \ + MC_CMP_CMD_SP_CONT_UNLOCK_BY_ROOT + * @{ */ + +/** @defgroup MC_CMP_CMD_SP_CONT_UNLOCK_BY_ROOT_CMD Command + * @{ */ + +/** SpContUnlockByRoot signed command. */ +typedef struct { + /** Command header. */ + cmpCommandHeaderMap_t cmdHeader; + /** Spid. */ + mcSpid_t spid; +} cmpSpUnlockByRootCmdSdata_t; + +/** SpContUnlockByRoot signed command and signature. */ +typedef struct { + /** Signed command. */ + cmpSpUnlockByRootCmdSdata_t sdata; + /** Signature. */ + cmpMac_t mac; +} cmpSpContUnlockByRootCmd_t; + +/** SpContUnlockByRoot command. */ +typedef struct { + /** Command. */ + cmpSpContUnlockByRootCmd_t cmd; +} cmpCmdSpContUnlockByRoot_t; + +/** @} */ + +/** @defgroup MC_CMP_CMD_SP_CONT_UNLOCK_BY_ROOT_RSP Response + * @{ */ + +/** SpContUnlockByRoot signed response. */ +typedef struct { + /** Response header. */ + cmpResponseHeaderMap_t rspHeader; + /** Sp container secure object size. */ + uint32_t soSpContLen; + /** Sp container secure object. */ + mcSoSpCont_t soSpCont; +} cmpSpUnlockByRootRspSdata_t; + +/** SpContUnlockByRoot signed response and signature. */ +typedef struct { + /** Signed response. */ + cmpSpUnlockByRootRspSdata_t sdata; + /** Signature. */ + cmpMac_t mac; +} cmpSpContUnlockByRootRsp_t; + +/** SpContUnlockByRoot response. */ +typedef struct { + /** Response. */ + cmpSpContUnlockByRootRsp_t rsp; +} cmpRspSpContUnlockByRoot_t; + +/** @} */ + +/** Map CMP SpContUnlockByRoot message. */ +typedef union { + /** Map CMP command. */ + cmpCmdSpContUnlockByRoot_t cmpCmdSpContUnlockByRoot; + /** Map CMP response. */ + cmpRspSpContUnlockByRoot_t cmpRspSpContUnlockByRoot; +} cmpMapSpContUnlockByRoot_t; + +/** @} */ + +/** @defgroup MC_CMP_CMD_SP_CONT_ACTIVATE \ + MC_CMP_CMD_SP_CONT_ACTIVATE + * @{ */ + +/** @defgroup MC_CMP_CMD_SP_CONT_ACTIVATE_CMD Command + * @{ */ + +/** SpContActivate encrypted data command. */ +typedef struct { + /** Sp authentication key. */ + mcSymmetricKey_t kSpAuth; +} cmpSpActivateMsgEdata_t; + +/** SpContActivate encrypted and padded data command. */ +typedef struct { + /** Encrypted data. */ + cmpSpActivateMsgEdata_t edata; + /** Padding. */ + uint8_t padding[CMP_ED_PADDING(sizeof(cmpSpActivateMsgEdata_t))]; +} cmpSpActivateCmdEd_t; + +/** SpContActivate signed command. */ +typedef struct { + /** Command header. */ + cmpCommandHeaderMap_t cmdHeader; + /** Spid. */ + mcSpid_t spid; + /** Encrypted and padded data size. */ + uint32_t edLen; + /** Encrypted and padded data. */ + cmpSpActivateCmdEd_t ed; +} cmpSpActivateCmdSdata_t; + +/** SpContActivate signed command and signature. */ +typedef struct { + /** Signed command. */ + cmpSpActivateCmdSdata_t sdata; + /** Signature. */ + cmpMac_t mac; +} cmpSpContActivateCmd_t; + +/** SpContActivate command. */ +typedef struct { + /** Command. */ + cmpSpContActivateCmd_t cmd; +} cmpCmdSpContActivate_t; + +/** @} */ + +/** @defgroup MC_CMP_CMD_SP_CONT_ACTIVATE_RSP Response + * @{ */ + +/** SpContActivate signed response. */ +typedef struct { + /** Response header. */ + cmpResponseHeaderMap_t rspHeader; + /** Sp container secure object size. */ + uint32_t soSpContLen; + /** Sp container secure object. */ + mcSoSpCont_t soSpCont; +} cmpSpActivateRspSdata_t; + +/** SpContActivate signed response and signature. */ +typedef struct { + /** Signed response. */ + cmpSpActivateRspSdata_t sdata; + /** Signature. */ + cmpMac_t mac; +} cmpSpContActivateRsp_t; + +/** SpContActivate response. */ +typedef struct { + /** Response. */ + cmpSpContActivateRsp_t rsp; +} cmpRspSpContActivate_t; + +/** @} */ + +/** Map CMP SpContActivate message. */ +typedef union { + /** Map CMP command. */ + cmpCmdSpContActivate_t cmpCmdSpContActivate; + /** Map CMP response. */ + cmpRspSpContActivate_t cmpRspSpContActivate; +} cmpMapSpContActivate_t; + +/** @} */ + +/** @defgroup MC_CMP_CMD_SP_CONT_LOCK_BY_SP \ + MC_CMP_CMD_SP_CONT_LOCK_BY_SP + * @{ */ + +/** @defgroup MC_CMP_CMD_SP_CONT_LOCK_BY_SP_CMD Command + * @{ */ + +/** SpContLockBySp signed command. */ +typedef struct { + /** Command header. */ + cmpCommandHeaderMap_t cmdHeader; + /** Spid. */ + mcSpid_t spid; +} cmpSpLockBySpCmdSdata_t; + +/** SpContLockBySp signed command and signature. */ +typedef struct { + /** Signed command. */ + cmpSpLockBySpCmdSdata_t sdata; + /** Signature. */ + cmpMac_t mac; +} cmpSpContLockBySpCmd_t; + +/** SpContLockBySp command. */ +typedef struct { + /** Command. */ + cmpSpContLockBySpCmd_t cmd; +} cmpCmdSpContLockBySp_t; + +/** @} */ + +/** @defgroup MC_CMP_CMD_SP_CONT_LOCK_BY_SP_RSP Response + * @{ */ + +/** SpContLockBySp signed response. */ +typedef struct { + /** Response header. */ + cmpResponseHeaderMap_t rspHeader; + /** Sp container secure object size. */ + uint32_t soSpContLen; + /** Sp container secure object. */ + mcSoSpCont_t soSpCont; +} cmpSpLockBySpRspSdata_t; + +/** SpContLockBySp signed response and signature. */ +typedef struct { + /** Signed response. */ + cmpSpLockBySpRspSdata_t sdata; + /** Signature. */ + cmpMac_t mac; +} cmpSpContLockBySpRsp_t; + +/** SpContLockBySp response. */ +typedef struct { + /** Response. */ + cmpSpContLockBySpRsp_t rsp; +} cmpRspSpContLockBySp_t; + +/** @} */ + +/** Map CMP SpContLockBySp message. */ +typedef union { + /** Map CMP command. */ + cmpCmdSpContLockBySp_t cmpCmdSpContLockBySp; + /** Map CMP response. */ + cmpRspSpContLockBySp_t cmpRspSpContLockBySp; +} cmpMapSpContLockBySp_t; + +/** @} */ + +/** @defgroup MC_CMP_CMD_SP_CONT_UNLOCK_BY_SP \ + MC_CMP_CMD_SP_CONT_UNLOCK_BY_SP + * @{ */ + +/** @defgroup MC_CMP_CMD_SP_CONT_UNLOCK_BY_SP_CMD Command + * @{ */ + +/** SpContUnlockBySp signed command. */ +typedef struct { + /** Command header. */ + cmpCommandHeaderMap_t cmdHeader; + /** Spid. */ + mcSpid_t spid; +} cmpSpUnlockBySpCmdSdata_t; + +/** SpContUnlockBySp signed command and signature. */ +typedef struct { + /** Signed command. */ + cmpSpUnlockBySpCmdSdata_t sdata; + /** Signature. */ + cmpMac_t mac; +} cmpSpContUnlockBySpCmd_t; + +/** SpContUnlockBySp command. */ +typedef struct { + /** Command. */ + cmpSpContUnlockBySpCmd_t cmd; +} cmpCmdSpContUnlockBySp_t; + +/** @} */ + +/** @defgroup MC_CMP_CMD_SP_CONT_UNLOCK_BY_SP_RSP Response + * @{ */ + +/** SpContUnlockBySp signed response. */ +typedef struct { + /** Response header. */ + cmpResponseHeaderMap_t rspHeader; + /** Sp container secure object size. */ + uint32_t soSpContLen; + /** Sp container secure object. */ + mcSoSpCont_t soSpCont; +} cmpSpUnlockBySpRspSdata_t; + +/** SpContUnlockBySp signed response and signature. */ +typedef struct { + /** Signed response. */ + cmpSpUnlockBySpRspSdata_t sdata; + /** Signature. */ + cmpMac_t mac; +} cmpSpContUnlockBySpRsp_t; + +/** SpContUnlockBySp response. */ +typedef struct { + /** Response. */ + cmpSpContUnlockBySpRsp_t rsp; +} cmpRspSpContUnlockBySp_t; + +/** @} */ + +/** Map CMP SpContUnlockBySp message. */ +typedef union { + /** Map CMP command. */ + cmpCmdSpContUnlockBySp_t cmpCmdSpContUnlockBySp; + /** Map CMP response. */ + cmpRspSpContUnlockBySp_t cmpRspSpContUnlockBySp; +} cmpMapSpContUnlockBySp_t; + +/** @} */ + +/** @defgroup MC_CMP_CMD_TLT_CONT_REGISTER_ACTIVATE \ + MC_CMP_CMD_TLT_CONT_REGISTER_ACTIVATE + * @{ */ + +/** @defgroup MC_CMP_CMD_TLT_CONT_REGISTER_ACTIVATE_CMD Command + * @{ */ + +/** TltContRegisterActivate encrypted data command. */ +typedef struct { + /** Tlt authentication key. */ + mcSymmetricKey_t kSpTltEnc; +} cmpTltRegActMsgEdata_t; + +/** TltContRegisterActivate encrypted and padded data command. */ +typedef struct { + /** Encrypted data. */ + cmpTltRegActMsgEdata_t edata; + /** Padding. */ + uint8_t padding[CMP_ED_PADDING(sizeof(cmpTltRegActMsgEdata_t))]; +} cmpTltRegActCmdEd_t; + +/** TltContRegisterActivate signed command. */ +typedef struct { + /** Command header. */ + cmpCommandHeaderMap_t cmdHeader; + /** Spid. */ + mcSpid_t spid; + /** Uuid. */ + mcUuid_t uuid; + /** Trustlet public key hash. */ + mcSha256_t skSpTltEnc; + /** Minimum trustlet version supported. */ + mcContVersion_t tltVersion; + /** Encrypted and padded data size. */ + uint32_t edLen; + /** Encrypted and padded data. */ + cmpTltRegActCmdEd_t ed; +} cmpTltRegActCmdSdata_t; + +/** TltContRegisterActivate signed command and signature. */ +typedef struct { + /** Signed command. */ + cmpTltRegActCmdSdata_t sdata; + /** Signature. */ + cmpMac_t mac; +} cmpTltContRegisterActivateCmd_t; + +/** TltContRegisterActivate command. */ +typedef struct { + /** Command. */ + cmpTltContRegisterActivateCmd_t cmd; +} cmpCmdTltContRegisterActivate_t; + +/** @} */ + +/** @defgroup MC_CMP_CMD_TLT_CONT_REGISTER_ACTIVATE_RSP Response + * @{ */ + +/** TltContRegisterActivate signed response. */ +typedef struct { + /** Response header. */ + cmpResponseHeaderMap_t rspHeader; + /** Sp container secure object size. */ + uint32_t soSpContLen; + /** Sp container secure object. */ + mcSoSpCont_t soSpCont; + /* TltCont mapping info is in TCI cmpRspTltContRegisterActivateTci */ + uint32_t soTltContLen; + mcSoTltCont_2_1_t soTltCont; +} cmpTltRegActRspSdata_t; + +/** TltContRegisterActivate signed response and signature. */ +typedef struct { + /** Signed response. */ + cmpTltRegActRspSdata_t sdata; + /** Signature. */ + cmpMac_t mac; +} cmpTltContRegisterActivateRsp_t; + +/** TltContRegisterActivate response. */ +typedef struct { + cmpTltContRegisterActivateRsp_t rsp; +} cmpRspTltContRegisterActivate_t; + +/** @} */ + +/** Map CMP TltContRegisterActivate message. */ +typedef union { + /** Map CMP command. */ + cmpCmdTltContRegisterActivate_t cmpCmdTltContRegisterActivate; + /** Map CMP response. */ + cmpRspTltContRegisterActivate_t cmpRspTltContRegisterActivate; +} cmpMapTltContRegisterActivate_t; + +/** @} */ + +/** @defgroup MC_CMP_CMD_TLT_CONT_UNREGISTER \ + MC_CMP_CMD_TLT_CONT_UNREGISTER + * @{ */ + +/** @defgroup MC_CMP_CMD_TLT_CONT_UNREGISTER_CMD Command + * @{ */ + +/** TltContUnregister signed command. */ +typedef struct { + /** Command header. */ + cmpCommandHeaderMap_t cmdHeader; + /** Spid. */ + mcSpid_t spid; + /** Uuid. */ + mcUuid_t uuid; +} cmpTltUnregCmdSdata_t; + +/** TltContUnregister signed command and signature. */ +typedef struct { + /** Signed command. */ + cmpTltUnregCmdSdata_t sdata; + /** Signature. */ + cmpMac_t mac; +} cmpTltContUnregisterCmd_t; + +/** TltContUnregister command. */ +typedef struct { + /** Command. */ + cmpTltContUnregisterCmd_t cmd; +} cmpCmdTltContUnregister_t; + +/** @} */ + +/** @defgroup MC_CMP_CMD_TLT_CONT_UNREGISTER_RSP Response + * @{ */ + +/** TltContUnregister signed response. */ +typedef struct { + /** Response header. */ + cmpResponseHeaderMap_t rspHeader; + /** Sp container secure object size. */ + uint32_t soSpContLen; + /** Sp container secure object. */ + mcSoSpCont_t soSpCont; +} cmpTltUnregRspSdata_t; + +/** TltContUnregister signed response and signature. */ +typedef struct { + /** Signed response. */ + cmpTltUnregRspSdata_t sdata; + /** Signature. */ + cmpMac_t mac; +} cmpTltContUnregisterRsp_t; + +/** TltContUnregister response. */ +typedef struct { + /** Response. */ + cmpTltContUnregisterRsp_t rsp; +} cmpRspTltContUnregister_t; + +/** @} */ + +/** Map CMP TltContUnregister message. */ +typedef union { + /** Map CMP command. */ + cmpCmdTltContUnregister_t cmpCmdTltContUnregister; + /** Map CMP response. */ + cmpRspTltContUnregister_t cmpRspTltContUnregister; +} cmpMapTltContUnregister_t; + +/** @} */ + +/** @defgroup MC_CMP_CMD_TLT_CONT_REGISTER \ + MC_CMP_CMD_TLT_CONT_REGISTER + * @{ */ + +/** @defgroup MC_CMP_CMD_TLT_CONT_REGISTER_CMD Command + * @{ */ + +/** TltContRegister encrypted data command. */ +typedef struct { + /** Tlt authentication key. */ + mcSymmetricKey_t kSpTltEnc; +} cmpTltRegMsgEdata_t; + +/** TltContRegister encrypted and padded data command. */ +typedef struct { + /** Encrypted data. */ + cmpTltRegMsgEdata_t edata; + /** Padding. */ + uint8_t padding[CMP_ED_PADDING(sizeof(cmpTltRegMsgEdata_t))]; +} cmpTltRegCmdEd_t; + +/** TltContRegister signed command. */ +typedef struct { + /** Command header. */ + cmpCommandHeaderMap_t cmdHeader; + /** Spid. */ + mcSpid_t spid; + /** Uuid. */ + mcUuid_t uuid; + /** Trustlet public key hash. */ + mcSha256_t skSpTltEnc; + /** Minimum trustlet version supported. */ + mcContVersion_t tltVersion; + /** Encrypted and padded data size. */ + uint32_t edLen; + /** Encrypted and padded data. */ + cmpTltRegCmdEd_t ed; +} cmpTltRegCmdSdata_t; + +/** TltContRegister signed command and signature. */ +typedef struct { + /** Signed command. */ + cmpTltRegCmdSdata_t sdata; + /** Signature. */ + cmpMac_t mac; +} cmpTltContRegisterCmd_t; + +/** TltContRegister command. */ +typedef struct { + /** Command. */ + cmpTltContRegisterCmd_t cmd; +} cmpCmdTltContRegister_t; + +/** @} */ + +/** @defgroup MC_CMP_CMD_TLT_CONT_REGISTER_RSP Response + * @{ */ + +/** TltContRegister signed response. */ +typedef struct { + /** Response header. */ + cmpResponseHeaderMap_t rspHeader; + /** Sp container secure object size. */ + uint32_t soSpContLen; + /** Sp container secure object. */ + mcSoSpCont_t soSpCont; + /** Tlt container secure object size. */ + uint32_t soTltContLen; + /** Tlt container secure object. */ + mcSoTltCont_2_1_t soTltCont; +} cmpTltRegRspSdata_t; + +/** TltContRegister signed response and signature. */ +typedef struct { + /** Signed response. */ + cmpTltRegRspSdata_t sdata; + /** Signature. */ + cmpMac_t mac; +} cmpTltContRegisterRsp_t; + +/** TltContRegister response. */ +typedef struct { + /** Response. */ + cmpTltContRegisterRsp_t rsp; +} cmpRspTltContRegister_t; + +/** @} */ + +/** Map CMP TltContRegister message. */ +typedef union { + /** Map CMP command. */ + cmpCmdTltContRegister_t cmpCmdTltContRegister; + /** Map CMP response. */ + cmpRspTltContRegister_t cmpRspTltContRegister; +} cmpMapTltContRegister_t; + +/** @} */ + +/** @defgroup MC_CMP_CMD_TLT_CONT_ACTIVATE \ + MC_CMP_CMD_TLT_CONT_ACTIVATE + * @{ */ + +/** @defgroup MC_CMP_CMD_TLT_CONT_ACTIVATE_CMD Command + * @{ */ + +/** TltContActivate signed command. */ +typedef struct { + /** Command header. */ + cmpCommandHeaderMap_t cmdHeader; + /** Spid. */ + mcSpid_t spid; + /** Uuid. */ + mcUuid_t uuid; +} cmpTltActCmdSdata_t; + +/** TltContActivate signed command and signature. */ +typedef struct { + /** Signed command. */ + cmpTltActCmdSdata_t sdata; + /** Signature. */ + cmpMac_t mac; +} cmpTltContActivateCmd_t; + +/** TltContActivate command. */ +typedef struct { + /** Command. */ + cmpTltContActivateCmd_t cmd; +} cmpCmdTltContActivate_t; + +/** @} */ + +/** @defgroup MC_CMP_CMD_TLT_CONT_ACTIVATE_RSP Response + * @{ */ + +/** TltContActivate signed response. */ +typedef struct { + /** Response header. */ + cmpResponseHeaderMap_t rspHeader; + /** Tlt container secure object size. */ + uint32_t soTltContLen; + /** Tlt container secure object. */ + mcSoTltCont_2_1_t soTltCont; +} cmpTltActRspSdata_t; + +/** TltContActivate signed response and signature. */ +typedef struct { + /** Signed response. */ + cmpTltActRspSdata_t sdata; + /** Signature. */ + cmpMac_t mac; +} cmpTltContActivateRsp_t; + +/** TltContActivate response. */ +typedef struct { + /** Response. */ + cmpTltContActivateRsp_t rsp; +} cmpRspTltContActivate_t; + +/** @} */ + +/** Map CMP TltContActivate message. */ +typedef union { + /** Map CMP command. */ + cmpCmdTltContActivate_t cmpCmdTltContActivate; + /** Map CMP response. */ + cmpRspTltContActivate_t cmpRspTltContActivate; +} cmpMapTltContActivate_t; + +/** @} */ + +/** @defgroup MC_CMP_CMD_TLT_CONT_LOCK_BY_SP \ + MC_CMP_CMD_TLT_CONT_LOCK_BY_SP + * @{ */ + +/** @defgroup MC_CMP_CMD_TLT_CONT_LOCK_BY_SP_CMD Command + * @{ */ + +/** TltContLockBySp signed command. */ +typedef struct { + /** Command header. */ + cmpCommandHeaderMap_t cmdHeader; + /** Spid. */ + mcSpid_t spid; + /** Uuid. */ + mcUuid_t uuid; +} cmpTltLockBySpCmdSdata_t; + +/** TltContLockBySp signed command and signature. */ +typedef struct { + /** Signed command. */ + cmpTltLockBySpCmdSdata_t sdata; + /** Signature. */ + cmpMac_t mac; +} cmpTltContLockBySpCmd_t; + +/** TltContLockBySp command. */ +typedef struct { + /** Command. */ + cmpTltContLockBySpCmd_t cmd; +} cmpCmdTltContLockBySp_t; + +/** @} */ + +/** @defgroup MC_CMP_CMD_TLT_CONT_LOCK_BY_SP_RSP Response + * @{ */ + +/** TltContLockBySp signed response. */ +typedef struct { + /** Response header. */ + cmpResponseHeaderMap_t rspHeader; + /** Tlt container secure object size. */ + uint32_t soTltContLen; + /** Tlt container secure object. */ + mcSoTltCont_2_1_t soTltCont; +} cmpTltLockBySpRspSdata_t; + +/** TltContLockBySp signed response and signature. */ +typedef struct { + /** Signed response. */ + cmpTltLockBySpRspSdata_t sdata; + /** Signature. */ + cmpMac_t mac; +} cmpTltContLockBySpRsp_t; + +/** TltContLockBySp response. */ +typedef struct { + /** Response. */ + cmpTltContLockBySpRsp_t rsp; +} cmpRspTltContLockBySp_t; + +/** @} */ + +/** Map CMP TltContLockBySp message. */ +typedef union { + /** Map CMP command. */ + cmpCmdTltContLockBySp_t cmpCmdTltContLockBySp; + /** Map CMP response. */ + cmpRspTltContLockBySp_t cmpRspTltContLockBySp; +} cmpMapTltContLockBySp_t; + +/** @} */ + +/** @defgroup MC_CMP_CMD_TLT_CONT_UNLOCK_BY_SP \ + MC_CMP_CMD_TLT_CONT_UNLOCK_BY_SP + * @{ */ + +/** @defgroup MC_CMP_CMD_TLT_CONT_UNLOCK_BY_SP_CMD Command + * @{ */ + +/** TltContLockBySp signed command. */ +typedef struct { + /** Command header. */ + cmpCommandHeaderMap_t cmdHeader; + /** Spid. */ + mcSpid_t spid; + /** Uuid. */ + mcUuid_t uuid; +} cmpTltUnlockBySpCmdSdata_t; + +/** TltContLockBySp signed command and signature. */ +typedef struct { + /** Signed command. */ + cmpTltUnlockBySpCmdSdata_t sdata; + /** Signature. */ + cmpMac_t mac; +} cmpTltContUnlockBySpCmd_t; + +/** TltContUnlockBySp command. */ +typedef struct { + /** Command. */ + cmpTltContUnlockBySpCmd_t cmd; +} cmpCmdTltContUnlockBySp_t; + +/** @} */ + +/** @defgroup MC_CMP_CMD_TLT_CONT_UNLOCK_BY_SP_RSP Response + * @{ */ + +/** TltContUnlockBySp signed response. */ +typedef struct { + /** Response header. */ + cmpResponseHeaderMap_t rspHeader; + /** Tlt container secure object size. */ + uint32_t soTltContLen; + /** Tlt container secure object. */ + mcSoTltCont_2_1_t soTltCont; +} cmpTltUnlockBySpRspSdata_t; + +/** TltContUnlockBySp signed response and signature. */ +typedef struct { + /** Signed response. */ + cmpTltUnlockBySpRspSdata_t sdata; + /** Signature. */ + cmpMac_t mac; +} cmpTltContUnlockBySpRsp_t; + +/** TltContUnlockBySp response. */ +typedef struct { + /** Response. */ + cmpTltContUnlockBySpRsp_t rsp; +} cmpRspTltContUnlockBySp_t; + +/** @} */ + +/** Map CMP TltContUnlockBySp message. */ +typedef union { + /** Map CMP command. */ + cmpCmdTltContUnlockBySp_t cmpCmdTltContUnlockBySp; + /** Map CMP response. */ + cmpRspTltContUnlockBySp_t cmpRspTltContUnlockBySp; +} cmpMapTltContUnlockBySp_t; + +/** @} */ + +/** @defgroup MC_CMP_CMD_TLT_CONT_PERSONALIZE \ + MC_CMP_CMD_TLT_CONT_PERSONALIZE + * @{ */ + +/** @defgroup MC_CMP_CMD_TLT_CONT_PERSONALIZE_CMD Command + * @{ */ + +/** TltContPersonalize encrypted data command. */ +typedef struct { + /** Data. */ + mcCoDataCont_t dataCont; +} cmpTltContPersonalizeCmdEdata_t; + +/** TltContPersonalize encrypted and padded data command. */ +typedef struct { + /** Encrypted data. */ + cmpTltContPersonalizeCmdEdata_t edata; + /** Padding. */ + uint8_t padding[CMP_ED_PADDING(sizeof(cmpTltContPersonalizeCmdEdata_t))]; +} cmpTltContPersonalizeCmdEd_t; + +/** TltContPersonalize signed command. */ +typedef struct { + /** Command header. */ + cmpCommandHeaderMap_t cmdHeader; + /** Spid. */ + mcSpid_t spid; + /** Uuid. */ + mcUuid_t uuid; + /** Pid. */ + mcPid_t pid; + /** Encrypted and padded data size. */ + uint32_t edLen; + /** Encrypted and padded data. */ + cmpTltContPersonalizeCmdEd_t ed; +} cmpTltContPersonalizeCmdSdata_t; + +/** TltContPersonalize signed command and signature. */ +typedef struct { + /** Signed command. */ + cmpTltContPersonalizeCmdSdata_t sdata; + /** Signature. */ + cmpMac_t mac; +} cmpTltContPersonalizeCmd_t; + +/** TltContPersonalize command. */ +typedef struct { + cmpTltContPersonalizeCmd_t cmd; +} cmpCmdTltContPersonalize_t; + +/** @} */ + +/** @defgroup MC_CMP_CMD_TLT_CONT_PERSONALIZE_RSP Response + * @{ */ + +/** TltContPersonalize signed response. */ +typedef struct { + /** Response header. */ + cmpResponseHeaderMap_t rspHeader; + /** Data container secure object size. */ + uint32_t soDataContLen; + /** Data container secure object. */ + mcSoDataCont_t soDataCont; +} cmpTltContPersonalizeRspSdata_t; + +/** TltContPersonalize signed response and signature. */ +typedef struct { + /** Signed response. */ + cmpTltContPersonalizeRspSdata_t sdata; + /** Signature. */ + cmpMac_t mac; +} cmpTltContPersonalizeRsp_t; + +/** TltContPersonalize response. */ +typedef struct { + /** Response. */ + cmpTltContPersonalizeRsp_t rsp; +} cmpRspTltContPersonalize_t; + +/** @} */ + +/** Map CMP TltContPersonalize message. */ +typedef union { + /** Map CMP command. */ + cmpCmdTltContPersonalize_t cmpCmdTltContPersonalize; + /** Map CMP response. */ + cmpRspTltContPersonalize_t cmpRspTltContPersonalize; +} cmpMapTltContPersonalize_t; + +/** @} */ + +/** Map CMP messages. */ +typedef union { + /** Backward compatible command header. */ + cmpCommandHeader_t commandHeader; + /** Backward compatible response header. */ + cmpResponseHeader_t responseHeader; + + /** Backward compatible system command GetVersion. */ + cmpCmdGetVersion_t cmpCmdGetVersion; + /** Backward compatible system response GetVersion. */ + cmpRspGetVersion_t cmpRspGetVersion; + /** Backward compatible system command GetSuid. */ + cmpCmdGetSuid_t cmpCmdGetSuid; + /** Backward compatible system response GetSuid. */ + cmpRspGetSuid_t cmpRspGetSuid; + /** Backward compatible system command GenAuthToken. */ + cmpCmdGenAuthToken_t cmpCmdGenAuthToken; + /** Backward compatible system response GenAuthToken. */ + cmpRspGenAuthToken_t cmpRspGenAuthToken; + + /** Command header. */ + cmpCommandHeaderMap_t cmdHeader; + /** Response header. */ + cmpResponseHeaderMap_t rspHeader; + + /** Error signed response. */ + cmpMapError_t cmpMapError; + + /** Authentication command BeginSocAuthentication. */ + cmpCmdBeginSocAuthentication_t cmpCmdBeginSocAuthentication; + /** Authentication response BeginSocAuthentication. */ + cmpRspBeginSocAuthentication_t cmpRspBeginSocAuthentication; + /** Authentication command BeginRootAuthentication. */ + cmpCmdBeginRootAuthentication_t cmpCmdBeginRootAuthentication; + /** Authentication response BeginRootAuthentication. */ + cmpRspBeginRootAuthentication_t cmpRspBeginRootAuthentication; + /** Authentication command BeginSpAuthentication. */ + cmpCmdBeginSpAuthentication_t cmpCmdBeginSpAuthentication; + /** Authentication response BeginSpAuthentication. */ + cmpRspBeginSpAuthentication_t cmpRspBeginSpAuthentication; + /** Authentication command Authenticate. */ + cmpCmdAuthenticate_t cmpCmdAuthenticate; + /** Authentication response Authenticate. */ + cmpRspAuthenticate_t cmpRspAuthenticate; + /** Authentication command AuthenticateTerminate. */ + cmpCmdAuthenticateTerminate_t cmpCmdAuthenticateTerminate; + /** Authentication response AuthenticateTerminate. */ + cmpRspAuthenticateTerminate_t cmpRspAuthenticateTerminate; + + /** SoC administrative command RootContRegisterActivate. */ + cmpCmdRootContRegisterActivate_t cmpCmdRootContRegisterActivate; + /** SoC administrative response RootContRegisterActivate. */ + cmpRspRootContRegisterActivate_t cmpRspRootContRegisterActivate; + + /** Root administrative command RootContUnregister. */ + cmpCmdRootContUnregister_t cmpCmdRootContUnregister; + /** Root administrative response RootContUnregister. */ + cmpRspRootContUnregister_t cmpRspRootContUnregister; + /** Root administrative command RootContLockByRoot. */ + cmpCmdRootContLockByRoot_t cmpCmdRootContLockByRoot; + /** Root administrative response RootContLockByRoot. */ + cmpRspRootContLockByRoot_t cmpRspRootContLockByRoot; + /** Root administrative command RootContUnlockByRoot. */ + cmpCmdRootContUnlockByRoot_t cmpCmdRootContUnlockByRoot; + /** Root administrative response RootContUnlockByRoot. */ + cmpRspRootContUnlockByRoot_t cmpRspRootContUnlockByRoot; + /** Root administrative command SpContRegisterActivate. */ + cmpCmdSpContRegisterActivate_t cmpCmdSpContRegisterActivate; + /** Root administrative response SpContRegisterActivate. */ + cmpRspSpContRegisterActivate_t cmpRspSpContRegisterActivate; + /** Root administrative command SpContUnregister. */ + cmpCmdSpContUnregister_t cmpCmdSpContUnregister; + /** Root administrative response SpContUnregister. */ + cmpRspSpContUnregister_t cmpRspSpContUnregister; + /** Root administrative command SpContRegister. */ + cmpCmdSpContRegister_t cmpCmdSpContRegister; + /** Root administrative response SpContRegister. */ + cmpRspSpContRegister_t cmpRspSpContRegister; + /** Root administrative command SpContLockByRoot. */ + cmpCmdSpContLockByRoot_t cmpCmdSpContLockByRoot; + /** Root administrative response SpContLockByRoot. */ + cmpRspSpContLockByRoot_t cmpRspSpContLockByRoot; + /** Root administrative command SpContUnlockByRoot. */ + cmpCmdSpContUnlockByRoot_t cmpCmdSpContUnlockByRoot; + /** Root administrative response SpContUnlockByRoot. */ + cmpRspSpContUnlockByRoot_t cmpRspSpContUnlockByRoot; + + /** Sp administrative command SpContActivate. */ + cmpCmdSpContActivate_t cmpCmdSpContActivate; + /** Sp administrative response SpContActivate. */ + cmpRspSpContActivate_t cmpRspSpContActivate; + /** Sp administrative command SpContLockBySp. */ + cmpCmdSpContLockBySp_t cmpCmdSpContLockBySp; + /** Sp administrative response SpContLockBySp. */ + cmpRspSpContLockBySp_t cmpRspSpContLockBySp; + /** Sp administrative command SpContUnlockBySp. */ + cmpCmdSpContUnlockBySp_t cmpCmdSpContUnlockBySp; + /** Sp administrative response SpContUnlockBySp. */ + cmpRspSpContUnlockBySp_t cmpRspSpContUnlockBySp; + /** Sp administrative command TltContRegisterActivate. */ + cmpCmdTltContRegisterActivate_t cmpCmdTltContRegisterActivate; + /** Sp administrative response TltContRegisterActivate. */ + cmpRspTltContRegisterActivate_t cmpRspTltContRegisterActivate; + /** Sp administrative command TltContUnregister. */ + cmpCmdTltContUnregister_t cmpCmdTltContUnregister; + /** Sp administrative response TltContUnregister. */ + cmpRspTltContUnregister_t cmpRspTltContUnregister; + /** Sp administrative command TltContRegister. */ + cmpCmdTltContRegister_t cmpCmdTltContRegister; + /** Sp administrative response TltContRegister. */ + cmpRspTltContRegister_t cmpRspTltContRegister; + /** Sp administrative command TltContActivate. */ + cmpCmdTltContActivate_t cmpCmdTltContActivate; + /** Sp administrative response TltContActivate. */ + cmpRspTltContActivate_t cmpRspTltContActivate; + /** Sp administrative command TltContLockBySp. */ + cmpCmdTltContLockBySp_t cmpCmdTltContLockBySp; + /** Sp administrative response TltContLockBySp. */ + cmpRspTltContLockBySp_t cmpRspTltContLockBySp; + /** Sp administrative command TltContUnlockBySp. */ + cmpCmdTltContUnlockBySp_t cmpCmdTltContUnlockBySp; + /** Sp administrative response TltContUnlockBySp. */ + cmpRspTltContUnlockBySp_t cmpRspTltContUnlockBySp; + /** Sp administrative command TltContPersonalize. */ + cmpCmdTltContPersonalize_t cmpCmdTltContPersonalize; + /** Sp administrative response TltContPersonalize. */ + cmpRspTltContPersonalize_t cmpRspTltContPersonalize; +} cmpMap_t; + +#endif // CMP_MAP_H_ + +/** @} */ diff --git a/mobicore/common/MobiCore/inc/TlCm/3.0/tlCmApi.h b/mobicore/common/MobiCore/inc/TlCm/3.0/tlCmApi.h new file mode 100644 index 0000000000000000000000000000000000000000..9325e1cce89fa6902f6c6cd0cf69ff118e0060d8 --- /dev/null +++ b/mobicore/common/MobiCore/inc/TlCm/3.0/tlCmApi.h @@ -0,0 +1,174 @@ +/** @addtogroup CMP + * @{ + * @file + * Interface to content management trustlet (TlCm) definitions. + * + * The TlCm is responsible for implementing content management protocol (CMP) + * commands and generating approriate CMP responses in the trustlet control + * interface (TCI). + * + * Copyright © Trustonic Limited 2013. + * + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * 3. Neither the name of the Trustonic Limited nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef TL_CM_API_H_ +#define TL_CM_API_H_ + +#include "TlCm/tlCmApiCommon.h" +#include "TlCm/3.0/cmp.h" +#include "TlCm/3.0/cmpMap.h" + +/** TCI CMP messages. */ +typedef union { + /** Command header. */ + cmpCommandHeaderTci_t commandHeader; + /** Response header. */ + cmpResponseHeaderTci_t responseHeader; + + /** System command GetVersion. */ + cmpCmdGetVersionTci_t cmpCmdGetVersionTci; + /** System response GetVersion. */ + cmpRspGetVersionTci_t cmpRspGetVersionTci; + /** System command GetSuid. */ + cmpCmdGetSuidTci_t cmpCmdGetSuidTci; + /** System response GetSuid. */ + cmpRspGetSuidTci_t cmpRspGetSuidTci; + /** System command GenAuthToken. */ + cmpCmdGenAuthTokenTci_t cmpCmdGenAuthTokenTci; + /** System response GenAuthToken. */ + cmpRspGenAuthTokenTci_t cmpRspGenAuthTokenTci; + + /** Authentication command BeginSocAuthentication. */ + cmpCmdBeginSocAuthenticationTci_t cmpCmdBeginSocAuthenticationTci; + /** Authentication response BeginSocAuthentication. */ + cmpRspBeginSocAuthenticationTci_t cmpRspBeginSocAuthenticationTci; + /** Authentication command BeginRootAuthentication. */ + cmpCmdBeginRootAuthenticationTci_t cmpCmdBeginRootAuthenticationTci; + /** Authentication response BeginRootAuthentication. */ + cmpRspBeginRootAuthenticationTci_t cmpRspBeginRootAuthenticationTci; + /** Authentication command BeginSpAuthentication. */ + cmpCmdBeginSpAuthenticationTci_t cmpCmdBeginSpAuthenticationTci; + /** Authentication response BeginSpAuthentication. */ + cmpRspBeginSpAuthenticationTci_t cmpRspBeginSpAuthenticationTci; + /** Authentication command Authenticate. */ + cmpCmdAuthenticateTci_t cmpCmdAuthenticateTci; + /** Authentication response Authenticate. */ + cmpRspAuthenticateTci_t cmpRspAuthenticateTci; + /** Authentication command AuthenticateTerminate. */ + cmpCmdAuthenticateTerminateTci_t cmpCmdAuthenticateTerminateTci; + /** Authentication response AuthenticateTerminate. */ + cmpRspAuthenticateTerminateTci_t cmpRspAuthenticateTerminateTci; + + /** SoC administrative command RootContRegisterActivate. */ + cmpCmdRootContRegisterActivateTci_t cmpCmdRootContRegisterActivateTci; + /** SoC administrative response RootContRegisterActivate. */ + cmpRspRootContRegisterActivateTci_t cmpRspRootContRegisterActivateTci; + + /** Root administrative command RootContUnregister. */ + cmpCmdRootContUnregisterTci_t cmpCmdRootContUnregisterTci; + /** Root administrative response RootContUnregister. */ + cmpRspRootContUnregisterTci_t cmpRspRootContUnregisterTci; + /** Root administrative command RootContLockByRoot. */ + cmpCmdRootContLockByRootTci_t cmpCmdRootContLockByRootTci; + /** Root administrative response RootContLockByRoot. */ + cmpRspRootContLockByRootTci_t cmpRspRootContLockByRootTci; + /** Root administrative command RootContUnlockByRoot. */ + cmpCmdRootContUnlockByRootTci_t cmpCmdRootContUnlockByRootTci; + /** Root administrative command RootContUnlockByRoot. */ + cmpRspRootContUnlockByRootTci_t cmpRspRootContUnlockByRootTci; + /** Root administrative command SpContRegisterActivate. */ + cmpCmdSpContRegisterActivateTci_t cmpCmdSpContRegisterActivateTci; + /** Root administrative response SpContRegisterActivate. */ + cmpRspSpContRegisterActivateTci_t cmpRspSpContRegisterActivateTci; + /** Root administrative command SpContUnregister. */ + cmpCmdSpContUnregisterTci_t cmpCmdSpContUnregisterTci; + /** Root administrative response SpContUnregister. */ + cmpRspSpContUnregisterTci_t cmpRspSpContUnregisterTci; + /** Root administrative command SpContRegister. */ + cmpCmdSpContRegisterTci_t cmpCmdSpContRegisterTci; + /** Root administrative response SpContRegister. */ + cmpRspSpContRegisterTci_t cmpRspSpContRegisterTci; + /** Root administrative command SpContLockByRoot. */ + cmpCmdSpContLockByRootTci_t cmpCmdSpContLockByRootTci; + /** Root administrative response SpContLockByRoot. */ + cmpRspSpContLockByRootTci_t cmpRspSpContLockByRootTci; + /** Root administrative command SpContUnlockByRoot. */ + cmpCmdSpContUnlockByRootTci_t cmpCmdSpContUnlockByRootTci; + /** Root administrative response SpContUnlockByRoot. */ + cmpRspSpContUnlockByRootTci_t cmpRspSpContUnlockByRootTci; + + /** Sp administrative command SpContActivate. */ + cmpCmdSpContActivateTci_t cmpCmdSpContActivateTci; + /** Sp administrative response SpContActivate. */ + cmpRspSpContActivateTci_t cmpRspSpContActivateTci; + /** Sp administrative command SpContLockBySp. */ + cmpCmdSpContLockBySpTci_t cmpCmdSpContLockBySpTci; + /** Sp administrative response SpContLockBySp. */ + cmpRspSpContLockBySpTci_t cmpRspSpContLockBySpTci; + /** Sp administrative command SpContUnlockBySp. */ + cmpCmdSpContUnlockBySpTci_t cmpCmdSpContUnlockBySpTci; + /** Sp administrative command SpContUnlockBySp. */ + cmpRspSpContUnlockBySpTci_t cmpRspSpContUnlockBySpTci; + /** Sp administrative command TltContRegisterActivate. */ + cmpCmdTltContRegisterActivateTci_t cmpCmdTltContRegisterActivateTci; + /** Sp administrative response TltContRegisterActivate. */ + cmpRspTltContRegisterActivateTci_t cmpRspTltContRegisterActivateTci; + /** Sp administrative command TltContUnregister. */ + cmpCmdTltContUnregisterTci_t cmpCmdTltContUnregisterTci; + /** Sp administrative response TltContUnregister. */ + cmpRspTltContUnregisterTci_t cmpRspTltContUnregisterTci; + /** Sp administrative command TltContRegister. */ + cmpCmdTltContRegisterTci_t cmpCmdTltContRegisterTci; + /** Sp administrative command TltContRegister. */ + cmpRspTltContRegisterTci_t cmpRspTltContRegisterTci; + /** Sp administrative command TltContActivate. */ + cmpCmdTltContActivateTci_t cmpCmdTltContActivateTci; + /** Sp administrative command TltContActivate. */ + cmpRspTltContActivateTci_t cmpRspTltContActivateTci; + /** Sp administrative command TltContLockBySp. */ + cmpCmdTltContLockBySpTci_t cmpCmdTltContLockBySpTci; + /** Sp administrative response TltContLockBySp. */ + cmpRspTltContLockBySpTci_t cmpRspTltContLockBySpTci; + /** Sp administrative command TltContUnlockBySp. */ + cmpCmdTltContUnlockBySpTci_t cmpCmdTltContUnlockBySpTci; + /** Sp administrative response TltContUnlockBySp. */ + cmpRspTltContUnlockBySpTci_t cmpRspTltContUnlockBySpTci; + /** Sp administrative command TltContPersonalize. */ + cmpCmdTltContPersonalizeTci_t cmpCmdTltContPersonalizeTci; + /** Sp administrative response TltContPersonalize. */ + cmpRspTltContPersonalizeTci_t cmpRspTltContPersonalizeTci; +} cmpMessage_t; + +/** TCI CMP. */ +typedef struct { + /** TCI CMP messages. */ + cmpMessage_t msg; +} cmp_t; + +#endif // TL_CM_API_H_ + +/** @} */ diff --git a/mobicore/common/MobiCore/inc/TlCm/cmpCommon.h b/mobicore/common/MobiCore/inc/TlCm/cmpCommon.h new file mode 100644 index 0000000000000000000000000000000000000000..006a1c2ce086e87ed49205210690426819ead5af --- /dev/null +++ b/mobicore/common/MobiCore/inc/TlCm/cmpCommon.h @@ -0,0 +1,256 @@ +/** @addtogroup CMP_COMMON + * Common definitions of content management protocols (CMP) supported by the + * content management trustlet (TlCm). + * + * @{ + * + * @file + * Common CMP global definitions. + * Various components need access to (sub-)structures defined and used by CMP. + * These common definitions are made available through this header file. + * + * Copyright © Trustonic Limited 2013. + * + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * 3. Neither the name of the Trustonic Limited nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef CMP_COMMON_H_ +#define CMP_COMMON_H_ + +#include "mcContainer.h" +#include "mcUuid.h" +#include "mcVersionInfo.h" +#include "version.h" + +/** Minimum TCI CMP 2.0 size. */ +#define CMP_SIZE 4388 + +/** Default CMP MAP size. */ +#define CMP_MAP_SIZE 2412 + +/** CMP version id. */ +typedef uint32_t cmpVersionId_t; +/** CMP command id. */ +typedef uint32_t cmpCommandId_t; +/** CMP response id. */ +typedef uint32_t cmpResponseId_t; +/** CMP return code. */ +typedef uint32_t cmpReturnCode_t; + +/** Responses have bit 31 set */ +#define RSP_ID_MASK (1U << 31) +#define RSP_ID(cmdId) (((uint32_t)(cmdId)) | RSP_ID_MASK) +#define IS_CMD(cmdId) ((((uint32_t)(cmdId)) & RSP_ID_MASK) == 0) +#define IS_RSP(cmdId) ((((uint32_t)(cmdId)) & RSP_ID_MASK) == RSP_ID_MASK) + +/** CMP command header. */ +typedef struct { + /** Command id. */ + cmpCommandId_t commandId; +} cmpCommandHeader_t; + +/** CMP response header. */ +typedef struct { + /** Response id (must be command id | RSP_ID_MASK ). */ + cmpResponseId_t responseId; + /** Return code. */ + cmpReturnCode_t returnCode; +} cmpResponseHeader_t; + +/** Total number of bytes used for HMAC-SHA256 message authentication code. */ +#define CMP_MAC_SIZE 32 + +/** Message authentication code. */ +typedef struct { + /** MAC value. */ + uint8_t mac[CMP_MAC_SIZE]; +} cmpMac_t; + +/** 64-bit random number. */ +typedef struct { + /** Random number value. */ + uint8_t data[8]; +} cmpRnd8_t; + +/** 256-bit random number. */ +typedef struct { + /** Random number value. */ + uint8_t data[32]; +} cmpRnd32_t; + +/** @defgroup MC_CMP_CMD_GET_VERSION MC_CMP_CMD_GET_VERSION + * @{ */ + +/** Version tags. */ +typedef enum { + /** Version tag deprecated. */ + CMP_VERSION_TAG1 = 0x00000001, + /** Version tag. */ + CMP_VERSION_TAG2 = 0x00000002, +} cmpVersionTag_t; + +/** Version data info for deprecated version tag. */ +typedef struct { + /** Version data value. */ + cmpVersionId_t number; +} cmpVersionData1_t; + +/** Version data info. */ +typedef struct { + /** Version data value. */ + mcVersionInfo_t versionInfo; +} cmpVersionData2_t; + +/** Version data infos. */ +typedef union { + /** Version data info deprecated. */ + cmpVersionData1_t versionData1; + /** Version data info. */ + cmpVersionData2_t versionData2; +} cmpVersionData_t; + +/** @defgroup MC_CMP_CMD_GET_VERSION_CMD Command + * @{ */ + +/** GetVersion command. */ +typedef struct { + /** Command header. */ + cmpCommandHeader_t cmdHeader; +} cmpCmdGetVersion_t; + +/** @} */ + +/** @defgroup MC_CMP_CMD_GET_VERSION_RSP Response + * @{ */ + +/** GetVersion response. */ +typedef struct { + /** Response header. */ + cmpResponseHeader_t rspHeader; + /** Version tag. */ + cmpVersionTag_t tag; + /** Version data info. */ + cmpVersionData_t data; +} cmpRspGetVersion_t; + +/** @} */ + +/** @} */ + +/** @defgroup MC_CMP_CMD_GET_SUID MC_CMP_CMD_GET_SUID + * @{ */ + +/** @defgroup MC_CMP_CMD_GET_SUID_CMD Command + * @{ */ + +/** GetSuid command. */ +typedef struct { + /** Command header. */ + cmpCommandHeader_t cmdHeader; +} cmpCmdGetSuid_t; + +/** @} */ + +/** @defgroup MC_CMP_CMD_GET_SUID_RSP Response + * @{ */ + +/** GetSuid response. */ +typedef struct { + /** Response header. */ + cmpResponseHeader_t rspHeader; + /** Suid. */ + mcSuid_t suid; +} cmpRspGetSuid_t; + +/** @} */ + +/** @} */ + +/** @defgroup MC_CMP_CMD_GENERATE_AUTH_TOKEN MC_CMP_CMD_GENERATE_AUTH_TOKEN + * @{ */ + +/** Block size of the encryption algorithm used for secure messaging. */ +#define CMP_MSG_CRYPTO_BLOCK_SIZE 16 + +/** Total number of padding bytes required to encrypt data of given size. */ +#define CMP_ED_PADDING(netsize) \ + (CMP_MSG_CRYPTO_BLOCK_SIZE - (netsize) % CMP_MSG_CRYPTO_BLOCK_SIZE) + +/** Total number of bytes used for PSS signature in GENERATE AUTH TOKEN command. */ +#define CMP_GEN_AUTH_TOKEN_PSS_SIZE 256 + +/** @defgroup MC_CMP_CMD_GENERATE_AUTH_TOKEN_CMD Command + * @{ */ + +typedef struct { + /** Command header. */ + cmpCommandHeader_t cmdHeader; + /** Suid. */ + mcSuid_t suid; + /** Authentication key. */ + mcSymmetricKey_t kSocAuth; + /** Key id. */ + uint32_t kid; +} cmpGenAuthTokenCmdSdata_t; + +typedef struct { + /** Signed data. */ + cmpGenAuthTokenCmdSdata_t sdata; + /** Signature. */ + uint8_t pssSignature[CMP_GEN_AUTH_TOKEN_PSS_SIZE]; +} cmpGenAuthTokenCmd_t; + +/** GenAuthToken command. */ +typedef struct { + /** Command. */ + cmpGenAuthTokenCmd_t cmd; +} cmpCmdGenAuthToken_t; + +/** @} */ + +/** @defgroup MC_CMP_CMD_GENERATE_AUTH_TOKEN_RSP Response + * @{ */ + +typedef struct { + /** Response header. */ + cmpResponseHeader_t rspHeader; +} cmpGenAuthTokenRsp_t; + +/** GenAuthToken response. */ +typedef struct { + /** Response. */ + cmpGenAuthTokenRsp_t rsp; + /** AuthToken container. */ + mcSoAuthTokenCont_t soAuthCont; +} cmpRspGenAuthToken_t; + +/** @} */ + +/** @} */ + +#endif // CMP_COMMON_H_ + +/** @} */ diff --git a/mobicore/common/MobiCore/inc/TlCm/tlCmApiCommon.h b/mobicore/common/MobiCore/inc/TlCm/tlCmApiCommon.h new file mode 100644 index 0000000000000000000000000000000000000000..1158c576fdf600216f3349b508a9b221d7c4ff65 --- /dev/null +++ b/mobicore/common/MobiCore/inc/TlCm/tlCmApiCommon.h @@ -0,0 +1,84 @@ +/** @addtogroup CMP_COMMON + * @{ + * @file + * Common interface definitions to content management trustlet (TlCm). + * + * The TlCm is responsible for implementing content management protocol (CMP) + * commands and generating approriate CMP responses. + * + * Copyright © Trustonic Limited 2013. + * + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * 3. Neither the name of the Trustonic Limited nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef TL_CM_API_COMMON_H_ +#define TL_CM_API_COMMON_H_ + +#include "tlCmError.h" + +/** TlCm command ids supported. + * @note All command ids must be in range 0 to 0x1D. + */ +//lint -esym(756, cmpCommands_t) cmpCommands_t type by itself not used. +typedef enum cmpCommands_t { + MC_CMP_CMD_AUTHENTICATE = 0, + MC_CMP_CMD_BEGIN_ROOT_AUTHENTICATION = 1, + MC_CMP_CMD_BEGIN_SOC_AUTHENTICATION = 2, + MC_CMP_CMD_BEGIN_SP_AUTHENTICATION = 3, + MC_CMP_CMD_GENERATE_AUTH_TOKEN = 4, + MC_CMP_CMD_GET_VERSION = 5, + //MC_CMP_CMD_ROOT_CONT_ACTIVATE = 6, + MC_CMP_CMD_ROOT_CONT_LOCK_BY_ROOT = 7, + //MC_CMP_CMD_ROOT_CONT_REGISTER = 8, + MC_CMP_CMD_ROOT_CONT_REGISTER_ACTIVATE = 9, + MC_CMP_CMD_ROOT_CONT_UNLOCK_BY_ROOT = 10, + MC_CMP_CMD_ROOT_CONT_UNREGISTER = 11, + MC_CMP_CMD_SP_CONT_ACTIVATE = 12, + MC_CMP_CMD_SP_CONT_LOCK_BY_ROOT = 13, + MC_CMP_CMD_SP_CONT_LOCK_BY_SP = 14, + MC_CMP_CMD_SP_CONT_REGISTER = 15, + MC_CMP_CMD_SP_CONT_REGISTER_ACTIVATE = 16, + MC_CMP_CMD_SP_CONT_UNLOCK_BY_ROOT = 17, + MC_CMP_CMD_SP_CONT_UNLOCK_BY_SP = 18, + MC_CMP_CMD_SP_CONT_UNREGISTER = 19, + MC_CMP_CMD_TLT_CONT_ACTIVATE = 20, + MC_CMP_CMD_TLT_CONT_LOCK_BY_SP = 21, + MC_CMP_CMD_TLT_CONT_PERSONALIZE = 22, + MC_CMP_CMD_TLT_CONT_REGISTER = 23, + MC_CMP_CMD_TLT_CONT_REGISTER_ACTIVATE = 24, + MC_CMP_CMD_TLT_CONT_UNLOCK_BY_SP = 25, + MC_CMP_CMD_TLT_CONT_UNREGISTER = 26, + MC_CMP_CMD_GET_SUID = 27, + MC_CMP_CMD_AUTHENTICATE_TERMINATE = 28, + MC_CMP_CMD_LAST_ = MC_CMP_CMD_AUTHENTICATE_TERMINATE, +} cmpCommands_t; + +/** TlCm exit code: TlCm exited with error. */ +#define EXIT_ERROR ((uint32_t)(-1)) + +#endif // TL_CM_API_COMMON_H_ + +/** @} */ diff --git a/mobicore/common/MobiCore/inc/TlCm/tlCmError.h b/mobicore/common/MobiCore/inc/TlCm/tlCmError.h new file mode 100644 index 0000000000000000000000000000000000000000..6d08dcb6ecf501924e501632e4037df391faaf7e --- /dev/null +++ b/mobicore/common/MobiCore/inc/TlCm/tlCmError.h @@ -0,0 +1,85 @@ +/** @addtogroup CMP_COMMON + * @{ + * + * @file + * Content management trustlet (TlCm) error return code definitions. + * Definition of all possible TlCm error return codes. + * + * Copyright © Trustonic Limited 2013. + * + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * 3. Neither the name of the Trustonic Limited nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef TL_CM_ERROR_H_ +#define TL_CM_ERROR_H_ + +/** No error. */ +#define SUCCESSFUL 0x00000000 + +/** Error unknown command. */ +#define RET_ERR_EXT_UNKNOWN_COMMAND 0xE0000000 +/** Error security status not satified. */ +#define RET_ERR_EXT_SECURITY_STATUS_NOT_SATISFIED 0xE0000010 +/** Error secure messaging failed. */ +#define RET_ERR_EXT_SECURE_MESSAGING_FAILED 0xE0000020 +/** Error incorrect parameters. */ +#define RET_ERR_EXT_INCORRECT_PARAMETERS 0xE0000030 +/** Error referenced data invalid. */ +#define RET_ERR_EXT_REFERENCED_DATA_INVALID 0xE0000040 +/** Error referenced data not found. */ +#define RET_ERR_EXT_REFERENCED_DATA_NOT_FOUND 0xE0000050 +/** Error method blocked. */ +#define RET_ERR_EXT_METHOD_BLOCKED 0xE0000060 +/** Error conditions of use not satified. */ +#define RET_ERR_EXT_CONDITIONS_OF_USE_NOT_SATISFIED 0xE0000070 +/** Error container already registred error. */ +#define RET_ERR_EXT_ALREADY_REGISTERED 0xE0000090 +/** Error container already activated. */ +#define RET_ERR_EXT_ALREADY_ACTIVATED 0xE00000A0 +/** Error container not registred. */ +#define RET_ERR_EXT_NOT_REGISTERED 0xE00000B0 +/** Error container not activated. */ +#define RET_ERR_EXT_NOT_ACTIVATED 0xE00000C0 +/** Error container full. */ +#define RET_ERR_EXT_CONTAINER_FULL 0xE00000D0 +/** Error container not locked. */ +#define RET_ERR_EXT_NOT_LOCKED 0xE00000E0 +/** Error container locked. */ +#define RET_ERR_EXT_LOCKED 0xE00000F0 +/** Error container already locked. */ +#define RET_ERR_EXT_ALREADY_LOCKED 0xE0000100 + +/** Internal error. */ +#define RET_ERR_EXT_INTERNAL_ERROR 0xE0001000 +/** Mapped allocation size error. */ +#define RET_ERR_EXT_SIZE 0xE0002000 + +/** Unspecified error. */ +#define RET_ERR_EXT_UNSPECIFIED 0xEEEEEEEE + +#endif // TL_CM_ERROR_H_ + +/** @} */ diff --git a/mobicore/common/MobiCore/inc/TlCm/tlCmUuid.h b/mobicore/common/MobiCore/inc/TlCm/tlCmUuid.h new file mode 100644 index 0000000000000000000000000000000000000000..dabb9c7395788b9e7029f1dd6e99b5eb4ba67c3d --- /dev/null +++ b/mobicore/common/MobiCore/inc/TlCm/tlCmUuid.h @@ -0,0 +1,42 @@ +/** @addtogroup CMP_COMMON + * @{ + * @file + * Content management trustlet (TlCm) Uuid definition. + * + * Copyright © Trustonic Limited 2013. + * + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * 3. Neither the name of the Trustonic Limited nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef TL_CM_UUID_H +#define TL_CM_UUID_H + +/** Uuid of TlCm. */ +#define TL_CM_UUID { { 7, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } } + +#endif // TL_CM_UUID_H + +/** @} */ diff --git a/mobicore/common/MobiCore/inc/TlCm/version.h b/mobicore/common/MobiCore/inc/TlCm/version.h new file mode 100644 index 0000000000000000000000000000000000000000..a51c19ef4078ac1b86c9accfe86fe3f11c572446 --- /dev/null +++ b/mobicore/common/MobiCore/inc/TlCm/version.h @@ -0,0 +1,44 @@ +/** @addtogroup CMP_COMMON + * @{ + * @file + * Content management trustlet (TlCm) version definition. + * + * Copyright © Trustonic Limited 2013. + * + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * 3. Neither the name of the Trustonic Limited nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef CMP_VERSION_H_ +#define CMP_VERSION_H_ + +/** Latest supported CMP major version number. */ +#define CMP_VERSION_MAJOR 3 +/** Latest supported CMP minor version number. */ +#define CMP_VERSION_MINOR 0 + +#endif // CMP_VERSION_H_ + +/** @} */ diff --git a/mobicore/common/MobiCore/inc/mcContainer.h b/mobicore/common/MobiCore/inc/mcContainer.h new file mode 100644 index 0000000000000000000000000000000000000000..c94e807881e33212a6b2a40914d85d3bff7280ac --- /dev/null +++ b/mobicore/common/MobiCore/inc/mcContainer.h @@ -0,0 +1,307 @@ +/** @addtogroup MC_CONTAINER mcContainer - Containers for MobiCore Content Management. + * @ingroup MC_DATA_TYPES + * @{ + * + * Copyright (c) 2013 TRUSTONIC LIMITED + * All rights reserved + * + * The present software is the confidential and proprietary information of + * TRUSTONIC LIMITED. You shall not disclose the present software and shall + * use it only in accordance with the terms of the license agreement you + * entered into with TRUSTONIC LIMITED. This software may be subject to + * export or import laws in certain countries. + */ + +#ifndef MC_CONTAINER_H_ +#define MC_CONTAINER_H_ + +#include + +#include "mcRootid.h" +#include "mcSpid.h" +#include "mcUuid.h" +#include "mcSo.h" +#include "mcSuid.h" + +/** Support for trustlet container 2.1 */ +#define CONTAINER_FORMAT_TL21 1 + +#define CONTAINER_VERSION_MAJOR 2 +/** Support for the old format */ +#ifdef CONTAINER_FORMAT_TL21 +#define CONTAINER_VERSION_MINOR 1 +#else +#define CONTAINER_VERSION_MINOR 0 +#endif + +#define MC_CONT_SYMMETRIC_KEY_SIZE 32 +#define MC_CONT_PUBLIC_KEY_SIZE 320 +#define MC_CONT_CHILDREN_COUNT 16 +#define MC_DATA_CONT_MAX_DATA_SIZE 2048 +#define MC_TLT_CODE_HASH_SIZE 32 + +#define MC_BYTES_TO_WORDS(bytes) ( (bytes) / sizeof(uint32_t) ) +#define MC_ENUM_32BIT_SPACER ((int32_t)-1) + +typedef uint32_t mcContVersion_t; + +/** Personalization Data ID. */ +typedef struct { + uint32_t data; +} mcPid_t; + +typedef struct { + uint32_t keydata[MC_BYTES_TO_WORDS(MC_CONT_SYMMETRIC_KEY_SIZE)]; +} mcSymmetricKey_t; + +typedef struct { + uint32_t keydata[MC_BYTES_TO_WORDS(MC_CONT_PUBLIC_KEY_SIZE)]; +} mcPublicKey_t; + +typedef mcSpid_t spChild_t[MC_CONT_CHILDREN_COUNT]; + +typedef mcUuid_t mcUuidChild_t[MC_CONT_CHILDREN_COUNT]; + +/** Content management container states. */ +typedef enum { + /** Container state unregistered. */ + MC_CONT_STATE_UNREGISTERED = 0, + /** Container is registered. */ + MC_CONT_STATE_REGISTERED = 1, + /** Container is activated. */ + MC_CONT_STATE_ACTIVATED = 2, + /** Container is locked by root. */ + MC_CONT_STATE_ROOT_LOCKED = 3, + /** Container is locked by service provider. */ + MC_CONT_STATE_SP_LOCKED = 4, + /** Container is locked by root and service provider. */ + MC_CONT_STATE_ROOT_SP_LOCKED = 5, + /** Dummy: ensure that enum is 32 bits wide. */ + MC_CONT_ATTRIB_SPACER = MC_ENUM_32BIT_SPACER +} mcContainerState_t; + +/** Content management container attributes. */ +typedef struct { + mcContainerState_t state; +} mcContainerAttribs_t; + +/** Container types. */ +typedef enum { + /** SOC container. */ + CONT_TYPE_SOC = 0, + /** Root container. */ + CONT_TYPE_ROOT, + /** Service provider container. */ + CONT_TYPE_SP, + /** Trustlet container. */ + CONT_TYPE_TLCON, + /** Service provider data. */ + CONT_TYPE_SPDATA, + /** Trustlet data. */ + CONT_TYPE_TLDATA +} contType_t; + +/** SHA256 checksum. */ +typedef struct { + uint8_t data[32]; +} mcSha256_t; + +/** @defgroup MC_CONTAINER_CRYPTO_OBJECTS Container secrets. + * Data that is stored encrypted within the container. + * @{ */ + +/** SoC secret */ +typedef struct { + mcSymmetricKey_t kSocAuth; +} mcCoSocCont_t; + +/** */ +typedef struct { + mcSymmetricKey_t kRootAuth; +} mcCoRootCont_t; + +/** */ +typedef struct { + mcSymmetricKey_t kSpAuth; +} mcCoSpCont_t; + +/** */ +typedef struct { + mcSymmetricKey_t kTl; +} mcCoTltCont_t; + +/** */ +typedef struct { + uint8_t data[MC_DATA_CONT_MAX_DATA_SIZE]; +} mcCoDataCont_t; + +/** */ +typedef union { + mcSpid_t spid; + mcUuid_t uuid; +} mcCid_t; + +/** @} */ + +/** @defgroup MC_CONTAINER_CONTAINER_OBJECTS Container definitions. + * Container type definitions. + * @{ */ + +/** SoC Container */ +typedef struct { + contType_t type; + mcContVersion_t version; + mcContainerAttribs_t attribs; + mcSuid_t suid; + // Secrets. + mcCoSocCont_t co; +} mcSocCont_t; + +/** */ +typedef struct { + contType_t type; + mcContVersion_t version; + mcContainerAttribs_t attribs; + mcSuid_t suid; + mcRootid_t rootid; + spChild_t children; + // Secrets. + mcCoRootCont_t co; +} mcRootCont_t; + +/** */ +typedef struct { + contType_t type; + mcContVersion_t version; + mcContainerAttribs_t attribs; + mcSpid_t spid; + mcUuidChild_t children; + // Secrets. + mcCoSpCont_t co; +} mcSpCont_t; + +/** */ +typedef struct { + contType_t type; + mcContVersion_t version; + mcContainerAttribs_t attribs; + mcSpid_t parent; + mcUuid_t uuid; + // Secrets. + mcCoTltCont_t co; +} mcTltContCommon_t; + +/** */ +typedef struct { + mcTltContCommon_t common; +} mcTltCont_2_0_t; + +/** */ +typedef struct { + mcTltContCommon_t common; + mcSha256_t skSpTltEnc; + mcContVersion_t tltVersion; +} mcTltCont_2_1_t; + +/** */ +typedef struct { + contType_t type; + mcContVersion_t version; + mcUuid_t uuid; + mcPid_t pid; + // Secrets. + mcCoDataCont_t co; +} mcDataCont_t; + +/** @} */ + +/** Helper for finding maximum value */ +#define MC_MAX(x, y) (((x)<(y))?(y):(x)) + +/** Calculates the total size of the secure object hash and padding for a given + * container. + * @param contTotalSize Total size of the container (sum of plain and encrypted + * parts). + * @param contCoSize Size/length of the encrypted container part ("crypto + * object"). + * @return Total size of hash and padding for given container. + */ +#define SO_CONT_HASH_AND_PAD_SIZE(contTotalSize, contCoSize) \ + MC_MAX( MC_SO_SIZE_F21((contTotalSize) - (contCoSize), (contCoSize)) \ + - sizeof(mcSoHeader_t) - (contTotalSize), \ + MC_SO_SIZE((contTotalSize) - (contCoSize), (contCoSize)) \ + - sizeof(mcSoHeader_t) - (contTotalSize) ) + +/** @defgroup MC_CONTAINER_SECURE_OBJECTS Containers in secure objects. + * Secure objects wrapping different containers. + * @{ */ + +/** Authentication token */ +typedef struct { + mcSoHeader_t soHeader; + mcSocCont_t coSoc; + uint8_t hashAndPad[SO_CONT_HASH_AND_PAD_SIZE(sizeof(mcSocCont_t), sizeof(mcCoSocCont_t))]; +} mcSoAuthTokenCont_t; + +/** Root container */ +typedef struct { + mcSoHeader_t soHeader; + mcRootCont_t cont; + uint8_t hashAndPad[SO_CONT_HASH_AND_PAD_SIZE(sizeof(mcRootCont_t), sizeof(mcCoRootCont_t))]; +} mcSoRootCont_t; + +/** */ +typedef struct { + mcSoHeader_t soHeader; + mcSpCont_t cont; + uint8_t hashAndPad[SO_CONT_HASH_AND_PAD_SIZE(sizeof(mcSpCont_t), sizeof(mcCoSpCont_t))]; +} mcSoSpCont_t; + +/** */ +typedef struct { + mcSoHeader_t soHeader; + mcTltCont_2_0_t cont; + uint8_t hashAndPad[SO_CONT_HASH_AND_PAD_SIZE(sizeof(mcTltCont_2_0_t), sizeof(mcCoTltCont_t))]; +} mcSoTltCont_2_0_t; + +typedef struct { + mcSoHeader_t soHeader; + mcTltCont_2_1_t cont; + uint8_t hashAndPad[SO_CONT_HASH_AND_PAD_SIZE(sizeof(mcTltCont_2_1_t), sizeof(mcCoTltCont_t))]; +} mcSoTltCont_2_1_t; + +#ifdef CONTAINER_FORMAT_TL21 +typedef mcSoTltCont_2_0_t mcSoTltCont_t; +#else +typedef mcTltContCommon_t mcTltCont_t; + +typedef struct { + mcSoHeader_t soHeader; + mcTltCont_t cont; + uint8_t hashAndPad[SO_CONT_HASH_AND_PAD_SIZE(sizeof(mcTltCont_t), sizeof(mcCoTltCont_t))]; +} mcSoTltCont_t ; +#endif + +/** */ +typedef struct { + mcSoHeader_t soHeader; + mcDataCont_t cont; + uint8_t hashAndPad[SO_CONT_HASH_AND_PAD_SIZE(sizeof(mcDataCont_t), sizeof(mcCoDataCont_t))]; +} mcSoDataCont_t; + +/** Trustlet Blob length info */ +typedef struct { + uint32_t magic; /**< New blob format magic number*/ + uint32_t rootContBlobSize; /**< Root container blob size */ + uint32_t spContBlobSize; /**< SP container blob size */ + uint32_t tlContBlobSize; /**< Tl container blob size */ + uint32_t reserved[4]; /**< Reserved for further Use */ +} mcBlobLenInfo_t, *mcBlobLenInfo_ptr; + +#define MC_TLBLOBLEN_MAGIC 0x7672746C + +/** @} */ + +#endif // MC_CONTAINER_H_ + +/** @} */ diff --git a/mobicore/common/MobiCore/inc/mcDriverId.h b/mobicore/common/MobiCore/inc/mcDriverId.h new file mode 100644 index 0000000000000000000000000000000000000000..df9aa88d13619739e19b6478e327db26e08baf4c --- /dev/null +++ b/mobicore/common/MobiCore/inc/mcDriverId.h @@ -0,0 +1,49 @@ +/** + * @file + * Driver ID definition. + * + * Copyright (c) 2013 TRUSTONIC LIMITED + * All rights reserved + * + * The present software is the confidential and proprietary information of + * TRUSTONIC LIMITED. You shall not disclose the present software and shall + * use it only in accordance with the terms of the license agreement you + * entered into with TRUSTONIC LIMITED. This software may be subject to + * export or import laws in certain countries. + */ + +#ifndef RTMDRVID_H_ +#define RTMDRVID_H_ + +#define MC_DRV_VENDOR_ID_SHIFT (16) +#define MC_DRV_VENDOR_ID_MASK (0xFFFF << MC_DRV_VENDOR_ID_SHIFT) +#define MC_DRV_NUMBER_MASK (0x0000FFFF) + +/** MobiCore vendor IDs. */ +typedef enum { + MC_DRV_VENDOR_ID_GD = 0 << MC_DRV_VENDOR_ID_SHIFT, +} mcDrvVendorId_t; + +/** MobiCore GD driver numbers. */ +typedef enum { + MC_DRV_NUMBER_INVALID = 0, + MC_DRV_NUMBER_CRYPTO = 1, + /** Last GD driver number reserved for pre-installed drivers. + * GD driver numbers up to this constant may not be used for loadable drivers. */ + MC_DRV_NUMBER_LAST_PRE_INSTALLED = 100, + TB_DRV_NUMBER_TUI = 0x101, + TB_DRV_NUMBER_TPLAY = 0x600, +} mcDrvNumber_t; + +/** MobiCore driver IDs for Trustlets. */ +typedef enum { + MC_DRV_ID_INVALID = MC_DRV_VENDOR_ID_GD | MC_DRV_NUMBER_INVALID, + MC_DRV_ID_CRYPTO = MC_DRV_VENDOR_ID_GD | MC_DRV_NUMBER_CRYPTO, + /** Last GD driver ID reserved for pre-installed drivers. + * GD driver IDs up to this constant may not be used for loadable drivers. */ + MC_DRV_ID_LAST_PRE_INSTALLED = MC_DRV_VENDOR_ID_GD | MC_DRV_NUMBER_LAST_PRE_INSTALLED, + TB_DRV_ID_TUI = MC_DRV_VENDOR_ID_GD | TB_DRV_NUMBER_TUI, + TB_DRV_ID_TPLAY = MC_DRV_VENDOR_ID_GD | TB_DRV_NUMBER_TPLAY, +} mcDriverId_t; + +#endif /* RTMDRVID_H_ */ diff --git a/mobicore/common/MobiCore/inc/mcLoadFormat.h b/mobicore/common/MobiCore/inc/mcLoadFormat.h new file mode 100644 index 0000000000000000000000000000000000000000..028dbb55215386445aa70e0eaabf17b26dabc2ec --- /dev/null +++ b/mobicore/common/MobiCore/inc/mcLoadFormat.h @@ -0,0 +1,213 @@ +/** + * @defgroup MCLF MobiCore Load Format + * + * @defgroup MCLF_VER MCLF Versions + * @ingroup MCLF + * + * @addtogroup MCLF + * @{ + * + * MobiCore Load Format declarations. + * + * Holds the definitions for the layout of MobiCore Trustlet Blob. + * + * Copyright (c) 2013 TRUSTONIC LIMITED + * All rights reserved + * + * The present software is the confidential and proprietary information of + * TRUSTONIC LIMITED. You shall not disclose the present software and shall + * use it only in accordance with the terms of the license agreement you + * entered into with TRUSTONIC LIMITED. This software may be subject to + * export or import laws in certain countries. + */ +#ifndef MCLOADFORMAT_H_ +#define MCLOADFORMAT_H_ + +#include "mcUuid.h" +#include "mcSuid.h" +#include "mcDriverId.h" + +#define MCLF_VERSION_MAJOR 2 +#define MCLF_VERSION_MINOR 4 +#define MCLF_VERSION_MINOR_CURRENT 3 + +#define MC_SERVICE_HEADER_MAGIC_BE ((uint32_t)('M'|('C'<<8)|('L'<<16)|('F'<<24))) /**< "MCLF" in big endian integer representation */ +#define MC_SERVICE_HEADER_MAGIC_LE ((uint32_t)(('M'<<24)|('C'<<16)|('L'<<8)|'F')) /**< "MCLF" in little endian integer representation */ +#define MC_SERVICE_HEADER_MAGIC_STR "MCLF" /**< "MCLF" as string */ + +/** @name MCLF flags */ +/*@{*/ +#define MC_SERVICE_HEADER_FLAGS_PERMANENT (1U << 0) /**< Loaded service cannot be unloaded from MobiCore. */ +#define MC_SERVICE_HEADER_FLAGS_NO_CONTROL_INTERFACE (1U << 1) /**< Service has no WSM control interface. */ +#define MC_SERVICE_HEADER_FLAGS_DEBUGGABLE (1U << 2) /**< Service can be debugged. */ +/*@}*/ + +#if !defined(ADDR_T_DEFINED) +#define ADDR_T_DEFINED +typedef void* addr_t; /**< an address, can be physical or virtual */ +#endif // !defined(ADDR_T_DEFINED) + +/** Service type. + * The service type defines the type of executable. + */ +typedef enum { + SERVICE_TYPE_ILLEGAL = 0, /**< Service type is invalid. */ + SERVICE_TYPE_DRIVER = 1, /**< Service is a driver. */ + SERVICE_TYPE_SP_TRUSTLET = 2, /**< Service is a Trustlet. */ + SERVICE_TYPE_SYSTEM_TRUSTLET = 3, /**< Service is a system Trustlet. */ +// SERVICE_TYPE_SP_TA = 4, /**< Service is a Trusted Application for t-base 300. */ +} serviceType_t; + +/** + * Memory types. + */ +typedef enum { + MCLF_MEM_TYPE_INTERNAL_PREFERRED = 0, /**< If available use internal memory; otherwise external memory. */ + MCLF_MEM_TYPE_INTERNAL = 1, /**< Internal memory must be used for executing the service. */ + MCLF_MEM_TYPE_EXTERNAL = 2, /**< External memory must be used for executing the service. */ +} memType_t; + +/** + * Descriptor for a memory segment. + */ +typedef struct { + addr_t start; /**< Virtual start address. */ + uint32_t len; /**< Length of the segment in bytes. */ +} segmentDescriptor_t, *segmentDescriptor_ptr; + +/** + * MCLF intro for data structure identification. + * Must be the first element of a valid MCLF file. + */ +typedef struct { + uint32_t magic; /**< Header magic value ASCII "MCLF". */ + uint32_t version; /**< Version of the MCLF header structure. */ +} mclfIntro_t, *mclfIntro_ptr; + +/** @} */ + + +// Version 2 ///////////////////////////////////////////////////////////////////////////////////////////////////////// +/** + * @defgroup MCLF_VER_V2 MCLF Version 32 + * @ingroup MCLF_VER + * + * @addtogroup MCLF_VER_V2 + * @{ + */ + +/** + * Version 2.1/2.2 MCLF header. + */ +typedef struct { + mclfIntro_t intro; /**< MCLF header start with the mandatory intro. */ + uint32_t flags; /**< Service flags. */ + memType_t memType; /**< Type of memory the service must be executed from. */ + serviceType_t serviceType; /**< Type of service. */ + + uint32_t numInstances; /**< Number of instances which can be run simultaneously. */ + mcUuid_t uuid; /**< Loadable service unique identifier (UUID). */ + mcDriverId_t driverId; /**< If the serviceType is SERVICE_TYPE_DRIVER the Driver ID is used. */ + uint32_t numThreads; /**< + *
+                                              * 
Number of threads (N) in a service depending on service type.
+ * + * SERVICE_TYPE_SP_TRUSTLET: N = 1 + * SERVICE_TYPE_SYSTEM_TRUSTLET: N = 1 + * SERVICE_TYPE_DRIVER: N >= 1 + *
+ */ + segmentDescriptor_t text; /**< Virtual text segment. */ + segmentDescriptor_t data; /**< Virtual data segment. */ + uint32_t bssLen; /**< Length of the BSS segment in bytes. MUST be at least 8 byte. */ + addr_t entry; /**< Virtual start address of service code. */ + uint32_t serviceVersion; /**< Version of the interface the driver exports. */ + +// These should be put on next MCLF update: +// mcSuid_t permittedSuid; /**< Starting 2.3: If nonzero, suid which is allowed to execute binary */ +// uint32_t permittedHwCf; /**< Starting 2.3: If nonzero, hw configuration which is allowed to execute binary */ + +} mclfHeaderV2_t, *mclfHeaderV2_ptr; +/** @} */ + + +/** + * Version 2.3 MCLF header. + */ +typedef struct { + mclfHeaderV2_t mclfHeaderV2; + mcSuid_t permittedSuid; /**< Starting 2.3: If nonzero, suid which is allowed to execute binary */ + uint32_t permittedHwCfg; /**< Starting 2.3: If nonzero, hw configuration which is allowed to execute binary */ +} mclfHeaderV23_t, *mclfHeaderV23_ptr; +/** @} */ + + +/** + * Version 2.4 MCLF header. + */ +typedef struct { + mclfHeaderV23_t mclfHeaderV2; + uint32_t gp_level; /**0x20002?(MCLF_HEADER_SIZE_V23):sizeof(mclfHeader_t)) + +// This is only minimum size, so nothing below this makes sense. +#define MCLF_BINARY_MIN_SIZE(version) (MCLF_HEADER_SIZE_V23+sizeof(mclfTextHeader_t)) + +#endif /* MCLOADFORMAT_H_ */ + +/** @} */ diff --git a/mobicore/common/MobiCore/inc/mcRootid.h b/mobicore/common/MobiCore/inc/mcRootid.h new file mode 100644 index 0000000000000000000000000000000000000000..b60bb56f717b3e314708eacdad436a8f9ec6cf9d --- /dev/null +++ b/mobicore/common/MobiCore/inc/mcRootid.h @@ -0,0 +1,36 @@ +/** + * @addtogroup MC_ROOTID mcRootid - Root container id. + * + * Global definition of root ID. + * + * Copyright (c) 2013 TRUSTONIC LIMITED + * All rights reserved + * + * The present software is the confidential and proprietary information of + * TRUSTONIC LIMITED. You shall not disclose the present software and shall + * use it only in accordance with the terms of the license agreement you + * entered into with TRUSTONIC LIMITED. This software may be subject to + * export or import laws in certain countries. + * + * @ingroup MC_DATA_TYPES + * @{ + */ + +#ifndef MC_ROOTID_H_ +#define MC_ROOTID_H_ + +/** Root Identifier type. */ +typedef uint32_t mcRootid_t; + +/** Reserved root id value 1. */ +static const mcRootid_t MC_ROOTID_RESERVED1 = 0; + +/** Reserved root id value 2. */ +static const mcRootid_t MC_ROOTID_RESERVED2 = 0xFFFFFFFF; + +/** Root id for system applications. */ +static const mcRootid_t MC_ROOTID_SYSTEM = 0xFFFFFFFE; + +#endif // MC_ROOTID_H_ + +/** @} */ diff --git a/mobicore/common/MobiCore/inc/mcSo.h b/mobicore/common/MobiCore/inc/mcSo.h new file mode 100644 index 0000000000000000000000000000000000000000..848d6d46198af8faf7bf2320c7e30fb972f0d257 --- /dev/null +++ b/mobicore/common/MobiCore/inc/mcSo.h @@ -0,0 +1,234 @@ +/** + * @defgroup MC_DATA_TYPES MobiCore generic data types + * + * @addtogroup MC_SO mcSo - Secure objects definitions. + * + * Copyright (c) 2013 TRUSTONIC LIMITED + * All rights reserved + * + * The present software is the confidential and proprietary information of + * TRUSTONIC LIMITED. You shall not disclose the present software and shall + * use it only in accordance with the terms of the license agreement you + * entered into with TRUSTONIC LIMITED. This software may be subject to + * export or import laws in certain countries. + * + * @ingroup MC_DATA_TYPES + * @{ + * + */ + +#ifndef MC_SO_H_ +#define MC_SO_H_ + +#include "mcUuid.h" +#include "mcSpid.h" +#include "mcRootid.h" + +#define SO_USE_VERSION_22 1 + +#define SO_VERSION_MAJOR 2 +#define SO_VERSION_MINOR 2 + +#define MC_ENUM_32BIT_SPACER ((int32_t)-1) + +/** Secure object type. */ +typedef enum { + /** Regular secure object. */ + MC_SO_TYPE_REGULAR = 0x00000001, + /** Dummy to ensure that enum is 32 bit wide. */ + MC_SO_TYPE_DUMMY = MC_ENUM_32BIT_SPACER, +} mcSoType_t; + + +/** Secure object context. + * A context defines which key to use to encrypt/decrypt a secure object. + */ +typedef enum { + /** Trustlet context. */ + MC_SO_CONTEXT_TLT = 0x00000001, + /** Service provider context. */ + MC_SO_CONTEXT_SP = 0x00000002, + /** Device context. */ + MC_SO_CONTEXT_DEVICE = 0x00000003, + /** Dummy to ensure that enum is 32 bit wide. */ + MC_SO_CONTEXT_DUMMY = MC_ENUM_32BIT_SPACER, +} mcSoContext_t; + +/** Secure object lifetime. + * A lifetime defines how long a secure object is valid. + */ +typedef enum { + /** SO does not expire. */ + MC_SO_LIFETIME_PERMANENT = 0x00000000, + /** SO expires on reboot (coldboot). */ + MC_SO_LIFETIME_POWERCYCLE = 0x00000001, + /** SO expires when Trustlet is closed. */ + MC_SO_LIFETIME_SESSION = 0x00000002, + /** Dummy to ensure that enum is 32 bit wide. */ + MC_SO_LIFETIME_DUMMY = MC_ENUM_32BIT_SPACER, +} mcSoLifeTime_t; + +/** Service provider Trustlet id. + * The combination of service provider id and Trustlet UUID forms a unique + * Trustlet identifier. + */ +typedef struct { + /** Service provider id. */ + mcSpid_t spid; + /** Trustlet UUID. */ + mcUuid_t uuid; +} tlApiSpTrustletId_t; + +/** Service provider Trustlet id with specific RootId. + */ +typedef struct { + /** Service provider id. */ + mcSpid_t spid; + /** Trustlet UUID. */ + mcUuid_t uuid; + /** Trustlet RootId. */ + mcRootid_t rootid; +} tlApiSpTrustletIdEx_t; + +/** Secure object header v2.2. + * A secure object header introduces a secure object. + * Layout of a secure object: + *
+ * 
+ *
+ *     +--------+------------------+------------------+--------+--------+
+ *     | Header |   plain-data     |  encrypted-data  |  hash  | random |
+ *     +--------+------------------+------------------+--------+--------+
+ *
+ *     /--------/---- plainLen ----/-- encryptedLen --/-- 32 --/-- 16 --/
+ *
+ *     /----------------- toBeHashedLen --------------/
+ *
+ *                                 /-- toBeEncryptedLen --/
+ *
+ *     /--------------------------- totalSoSize ------------------------/
+ *
+ * 
+ * 
+ */ + +/** Secure object header v2.1. + * A secure object header introduces a secure object. + * Layout of a secure object: + *
+ * 
+ *
+ *     +--------+------------------+------------------+--------+--------+---------+
+ *     | Header |   plain-data     |  encrypted-data  |  hash  | random | padding |
+ *     +--------+------------------+------------------+--------+--------+---------+
+ *
+ *     /--------/---- plainLen ----/-- encryptedLen --/-- 24 --/--- 9 --/- 0..15 -/
+ *
+ *     /----------------- toBeHashedLen --------------/
+ *
+ *                                 /-- toBeEncryptedLen --/
+ *
+ *     /--------------------------- totalSoSize ----------------------------------/
+ *
+ * 
+ * 
+ */ + +/** Secure object header v2.0. + * A secure object header introduces a secure object. + * Layout of a secure object: + *
+ * 
+ *
+ *     +--------+------------------+------------------+--------+---------+
+ *     | Header |   plain-data     |  encrypted-data  |  hash  | padding |
+ *     +--------+------------------+------------------+--------+---------+
+ *
+ *     /--------/---- plainLen ----/-- encryptedLen --/-- 32 --/- 1..16 -/
+ *
+ *     /----------------- toBeHashedLen --------------/
+ *
+ *                                 /---------- toBeEncryptedLen ---------/
+ *
+ *     /--------------------------- totalSoSize -------------------------/
+ *
+ * 
+ * 
+ */ +typedef struct { + /** Type of secure object. */ + uint32_t type; + /** Secure object version. */ + uint32_t version; + /** Secure object context. */ + mcSoContext_t context; + /** Secure object lifetime. */ + mcSoLifeTime_t lifetime; + /** Producer Trustlet id. */ + tlApiSpTrustletId_t producer; + /** Length of unencrypted user data (after the header). */ + uint32_t plainLen; + /** Length of encrypted user data (after unencrypted data, excl. checksum + * and excl. padding bytes). */ + uint32_t encryptedLen; +} mcSoHeader_t; + +/** Maximum size of the payload (plain length + encrypted length) of a secure object. */ +#define MC_SO_PAYLOAD_MAX_SIZE 1000000 + +/** Block size of encryption algorithm used for secure objects. */ +#define MC_SO_ENCRYPT_BLOCK_SIZE 16 + +/** Maximum number of ISO padding bytes. */ +#define MC_SO_MAX_PADDING_SIZE (MC_SO_ENCRYPT_BLOCK_SIZE) + +/** Size of hash used for secure objects v2. */ +#define MC_SO_HASH_SIZE 32 + +/** Size of hash used for secure object v2.1. */ +#define MC_SO21_HASH_SIZE 24 +/** Size of random used for secure objects v2.1. */ +#define MC_SO21_RND_SIZE 9 + +/** Size of hash used for secure object v2.2. */ +#define MC_SO22_HASH_SIZE 32 +/** Size of random used for secure objects v2.2. */ +#define MC_SO22_RND_SIZE 16 + +/** Hash size for current generated wrapping */ +#define MC_SO2X_HASH_SIZE MC_SO22_HASH_SIZE +/** Random size for current generated wrapping */ +#define MC_SO2X_RND_SIZE MC_SO22_RND_SIZE + +#define MC_SO_ENCRYPT_PADDED_SIZE_F21(netsize) ( (netsize) + \ + MC_SO_MAX_PADDING_SIZE - (netsize) % MC_SO_MAX_PADDING_SIZE ) + +#if SO_USE_VERSION_22 + // No encryption padding at all. +#else + /** Calculates gross size of cryptogram within secure object including ISO padding bytes. */ + #define MC_SO_ENCRYPT_PADDED_SIZE(netsize) MC_SO_ENCRYPT_PADDED_SIZE_F21(netsize) +#endif + + +/** Calculates the total size of a secure object. + * @param plainLen Length of plain text part within secure object. + * @param encryptedLen Length of encrypted part within secure object (excl. + * hash, padding). + * @return Total (gross) size of the secure object or 0 if given parameters are + * illegal or would lead to a secure object of invalid size. + */ +#define MC_SO_SIZE_F22(plainLen, encryptedLen) ( \ + ((plainLen) + (encryptedLen) < (encryptedLen) || (plainLen) + (encryptedLen) > MC_SO_PAYLOAD_MAX_SIZE) ? 0 : \ + sizeof(mcSoHeader_t) + (plainLen) + (encryptedLen) +MC_SO22_HASH_SIZE +MC_SO22_RND_SIZE \ + ) +#define MC_SO_SIZE_F21(plainLen, encryptedLen) ( \ + ((plainLen) + (encryptedLen) < (encryptedLen) || (plainLen) + (encryptedLen) > MC_SO_PAYLOAD_MAX_SIZE) ? 0 : \ + sizeof(mcSoHeader_t) +(plainLen) +MC_SO_ENCRYPT_PADDED_SIZE_F21((encryptedLen) +MC_SO_HASH_SIZE) \ +) + +#define MC_SO_SIZE(plainLen, encryptedLen) MC_SO_SIZE_F22(plainLen, encryptedLen) + +#endif // MC_SO_H_ + +/** @} */ diff --git a/mobicore/common/MobiCore/inc/mcSpid.h b/mobicore/common/MobiCore/inc/mcSpid.h new file mode 100644 index 0000000000000000000000000000000000000000..2714d1e0fe1ab3222aacfe0b786110e68b636100 --- /dev/null +++ b/mobicore/common/MobiCore/inc/mcSpid.h @@ -0,0 +1,38 @@ +/** + * @addtogroup MC_SPID mcSpid - service provider ID. + * + * Copyright (c) 2013 TRUSTONIC LIMITED + * All rights reserved + * + * The present software is the confidential and proprietary information of + * TRUSTONIC LIMITED. You shall not disclose the present software and shall + * use it only in accordance with the terms of the license agreement you + * entered into with TRUSTONIC LIMITED. This software may be subject to + * export or import laws in certain countries. + * + * @ingroup MC_DATA_TYPES + * @{ + */ + +#ifndef MC_SPID_H_ +#define MC_SPID_H_ + +/** Service provider Identifier type. */ +typedef uint32_t mcSpid_t; + +/** SPID value used as free marker in root containers. */ +static const mcSpid_t MC_SPID_FREE = 0xFFFFFFFF; + +/** Reserved SPID value. */ +static const mcSpid_t MC_SPID_RESERVED = 0; + +/** SPID for system applications. */ +static const mcSpid_t MC_SPID_SYSTEM = 0xFFFFFFFE; + +/** SPID reserved for tests only */ +static const mcSpid_t MC_SPID_RESERVED_TEST = 0xFFFFFFFD; +static const mcSpid_t MC_SPID_TRUSTONIC_TEST = 0x4; + +#endif // MC_SPID_H_ + +/** @} */ diff --git a/mobicore/common/MobiCore/inc/mcSuid.h b/mobicore/common/MobiCore/inc/mcSuid.h new file mode 100644 index 0000000000000000000000000000000000000000..a80cfc56713e52a18d83232f381354f2f669722f --- /dev/null +++ b/mobicore/common/MobiCore/inc/mcSuid.h @@ -0,0 +1,36 @@ +/** + * @addtogroup MC_SUID mcSuid - SoC unique ID. + * + * Copyright (c) 2013 TRUSTONIC LIMITED + * All rights reserved + * + * The present software is the confidential and proprietary information of + * TRUSTONIC LIMITED. You shall not disclose the present software and shall + * use it only in accordance with the terms of the license agreement you + * entered into with TRUSTONIC LIMITED. This software may be subject to + * export or import laws in certain countries. + * + * @ingroup MC_DATA_TYPES + * @{ + */ + +#ifndef MC_SUID_H_ +#define MC_SUID_H_ + +/** Length of SUID. */ +#define MC_SUID_LEN 16 + +/** Platform specific device identifier (serial number of the chip). */ +typedef struct { + uint8_t data[MC_SUID_LEN - sizeof(uint32_t)]; +} suidData_t; + +/** Soc unique identifier type. */ +typedef struct { + uint32_t sipId; /**< Silicon Provider ID to be set during build. */ + suidData_t suidData; +} mcSuid_t; + +#endif // MC_SUID_H_ + +/** @} */ diff --git a/mobicore/common/MobiCore/inc/mcUuid.h b/mobicore/common/MobiCore/inc/mcUuid.h new file mode 100644 index 0000000000000000000000000000000000000000..16ebb8562c85850a25bfc59a1b209f5c3e5308ca --- /dev/null +++ b/mobicore/common/MobiCore/inc/mcUuid.h @@ -0,0 +1,57 @@ +/** + * @addtogroup MC_UUID mcUuid - Universally Unique Identifier. + * + * Copyright (c) 2013 TRUSTONIC LIMITED + * All rights reserved + * + * The present software is the confidential and proprietary information of + * TRUSTONIC LIMITED. You shall not disclose the present software and shall + * use it only in accordance with the terms of the license agreement you + * entered into with TRUSTONIC LIMITED. This software may be subject to + * export or import laws in certain countries. + * + * @ingroup MC_DATA_TYPES + * @{ + */ + +#ifndef MC_UUID_H_ +#define MC_UUID_H_ + +#define UUID_TYPE + +#define UUID_LENGTH 16 +/** Universally Unique Identifier (UUID) according to ISO/IEC 11578. */ +typedef struct { + uint8_t value[UUID_LENGTH]; /**< Value of the UUID. */ +} mcUuid_t, *mcUuid_ptr; + +/** UUID value used as free marker in service provider containers. */ +#define MC_UUID_FREE_DEFINE \ + { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, \ + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF } + +static const mcUuid_t MC_UUID_FREE = { + MC_UUID_FREE_DEFINE +}; + +/** Reserved UUID. */ +#define MC_UUID_RESERVED_DEFINE \ + { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } + +static const mcUuid_t MC_UUID_RESERVED = { + MC_UUID_RESERVED_DEFINE +}; + +/** UUID for system applications. */ +#define MC_UUID_SYSTEM_DEFINE \ + { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, \ + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFE } + +static const mcUuid_t MC_UUID_SYSTEM = { + MC_UUID_SYSTEM_DEFINE +}; + +#endif // MC_UUID_H_ + +/** @} */ diff --git a/mobicore/common/MobiCore/inc/mcVersionHelper.h b/mobicore/common/MobiCore/inc/mcVersionHelper.h new file mode 100644 index 0000000000000000000000000000000000000000..a5af69fa5eb4fcbb05539837677b8b3b4eb6f019 --- /dev/null +++ b/mobicore/common/MobiCore/inc/mcVersionHelper.h @@ -0,0 +1,213 @@ +/** @addtogroup MC_RTM + * @{ + * MobiCore Version Helper Macros + * + * Copyright (c) 2013 TRUSTONIC LIMITED + * All rights reserved + * + * The present software is the confidential and proprietary information of + * TRUSTONIC LIMITED. You shall not disclose the present software and shall + * use it only in accordance with the terms of the license agreement you + * entered into with TRUSTONIC LIMITED. This software may be subject to + * export or import laws in certain countries. + */ +#include + +//lint -emacro(*,MC_CHECK_VERSION) Disable all warnings for this macro. +//lint -emacro(*,MC_MAKE_VERSION) Disable all warnings for this macro. +//lint -emacro(*,MC_GET_MAJOR_VERSION) Disable all warnings for this macro. +//lint -emacro(*,MC_GET_MINOR_VERSION) Disable all warnings for this macro. +//lint -emacro(*,MC_GET_MINOR_VERSION) Disable all warnings for this macro. +//lint -emacro(*,ASSERT_VERSION_IMPLEMENTATION) Disable all warnings for this macro. +//lint -esym(*,Actual_*) Disable all warnings for these functions. + +/** Create a version number given major and minor numbers. */ +#define MC_MAKE_VERSION(major,minor) \ + ( (((major) & 0xffff) << 16) |\ + ((minor) & 0xffff)) + +/** Get major version number from complete version. */ +#define MC_GET_MAJOR_VERSION(version) ((version) >> 16) + +/** Get minor version number from complete version. */ +#define MC_GET_MINOR_VERSION(version) ((version) & 0xffff) + +// Asserts expression at compile-time (to be used outside a function body). +#define ASSERT_VERSION_IMPLEMENTATION(comp, versionpart, requiredV, actualV, expression) \ + extern int Actual_##comp##_##versionpart##_VERSION_##actualV##_does_not_match_required_version_##requiredV[(expression) ? 0:-1] + +#define ASSERT_VERSION_EVALUATOR(comp, versionpart, requiredV, actualV, expression) \ + ASSERT_VERSION_IMPLEMENTATION(comp, versionpart, requiredV, actualV, expression) + +#define ASSERT_VERSION(required, comparator, comp, versionpart) \ + ASSERT_VERSION_EVALUATOR(comp, versionpart, required, comp ##_VERSION_## versionpart, required comparator comp ##_VERSION_## versionpart) + +/** Checks at compile-time that an interface version provided by component + * 'comp' is identical to the required version of a component using this interface. + * Note! This check is useful for components that IMPLEMENT a particular + * interface to be alerted of changes to the interface which are likely to + * require adaptations in the implementation. */ +#define MC_CHECK_VERSION_EQUALS(comp, major, minor) \ + ASSERT_VERSION(major, ==, comp, MAJOR); \ + ASSERT_VERSION(minor, ==, comp, MINOR); + +/** Checks at compile-time that an interface version provided by component 'comp' meets the + * required version of a component using this interface. */ +#define MC_CHECK_VERSION_STATIC(comp, majorRequired, minorRequired) \ + ASSERT_VERSION(majorRequired, ==, comp, MAJOR); \ + ASSERT_VERSION(minorRequired, <=, comp, MINOR); + +/** Version check helper macro for an interface consumer against an interface + * provider. + * @param comp Name of Interface to check. + * @param majorRequired Required major version of interface provider. + * @param minorRequired Required minor version of interface provider. + * Performs a compile-time interface version check that comp_VERSION_MAJOR + * equals majorRequired and that comp_VERSION_MINOR is at least minorRequired. + * On success, compilation goes through. + * On error, compilation breaks, telling the component that did not match in the + * error message. + * + * Additionally, a function is created: + * + * checkVersionOk##component(uint32_t version, char** errmsg) + * + * Compares version against majorRequired and minorRequired. + * Additionally, it creates a message string that can be printed out using printf("%s", errmsg). + * It returns either only the actual version, or on mismatch, actual and required version. + * + * @param version[in] component version as returned by layer-specific getVersion. + * @param errmsg[out] a message string that contains a log. + * + */ +#if !defined(NDEBUG) +#if !defined(TRUSTLET) +#define MC_CHECK_VERSION(comp, majorRequired, minorRequired) \ + MC_CHECK_VERSION_STATIC(comp, majorRequired, minorRequired) \ + static uint32_t checkVersionOk##comp(uint32_t version, char** errmsg) { \ + static char msgBuf[100]; \ + uint32_t major = MC_GET_MAJOR_VERSION(version); \ + uint32_t minor = MC_GET_MINOR_VERSION(version); \ + uint32_t ret = 0; \ + *errmsg = msgBuf; \ + if ((major == majorRequired) && (minor >= minorRequired)) { \ + snprintf(msgBuf, sizeof(msgBuf), \ + #comp " version is %u.%u", major, minor); \ + ret = 1; \ + } else { \ + snprintf(msgBuf, sizeof(msgBuf), \ + #comp " version error. Got: %u.%u, want >= %u.%u", major, minor, majorRequired, minorRequired); \ + } \ + msgBuf[sizeof(msgBuf) - 1] = '\0'; \ + return ret; \ + } +#else /* TRUSTLET */ +#define MC_CHECK_VERSION(comp, majorRequired, minorRequired) \ + MC_CHECK_VERSION_STATIC(comp, majorRequired, minorRequired) \ + static uint32_t checkVersionOk##comp(uint32_t version, char** errmsg) { \ + uint32_t major = MC_GET_MAJOR_VERSION(version); \ + uint32_t minor = MC_GET_MINOR_VERSION(version); \ + *errmsg = NULL; \ + if ((major == majorRequired) && (minor >= minorRequired)) { \ + tlDbgPrintf(#comp " version is %u.%u", major, minor); \ + return 1; \ + } else { \ + tlDbgPrintf( \ + #comp " version error. Got: %u.%u, want >= %u.%u", major, minor, majorRequired, minorRequired); \ + } \ + return 0; \ + } +#endif /* TRUSTLET */ +#else +#define MC_CHECK_VERSION(comp, majorRequired, minorRequired) \ + MC_CHECK_VERSION_STATIC(comp, majorRequired, minorRequired) \ + static uint32_t checkVersionOk##comp(uint32_t version, char** errmsg) { \ + uint32_t major = MC_GET_MAJOR_VERSION(version); \ + uint32_t minor = MC_GET_MINOR_VERSION(version); \ + *errmsg = NULL; \ + if ((major == majorRequired) && (minor >= minorRequired)) { \ + return 1; \ + }; \ + return 0; \ + } +#endif + +/** Version check helper macro for version checks of a data object version + * against an data object consumer. + * + * @param comp Name of Interface to check. + * @param majorRequired Major data object version supported by component. + * @param minorRequired Minor data object version supported by component. + * Performs a compile-time interface version check that comp_VERSION_MAJOR + * equals majorRequired and that comp_VERSION_MINOR is at least minorRequired. + * On success, compilation goes through. + * On error, compilation breaks, telling the component that did not match in the + * error message. + * + * Additionally, the following function is created: + * + * checkVersionOkDataObject##component(uint32_t version, char** errmsg) + * + * This function checks that the data object version is compatible with the + * interface version; that is, the major version of the data object must match + * exactly and the minor version of the data object MUST BE LESS OR EQUAL to the + * required interface version. + * Additionally, it creates a message string that can be printed out using printf("%s", errmsg). + * It returns either only the actual version, or on mismatch, actual and + * provided version. + * + * @param version[in] Data object version of data object. + * @param errmsg[out] a message string that contains a log. + * + */ +#if !defined(NDEBUG) +#if !defined(TRUSTLET) +#define MC_CHECK_DATA_OBJECT_VERSION(comp, majorRequired, minorRequired) \ + MC_CHECK_VERSION_STATIC(comp, majorRequired, minorRequired) \ + static uint32_t checkVersionOkDataObject##comp(uint32_t version, char** errmsg) { \ + static char msgBuf[100]; \ + uint32_t major = MC_GET_MAJOR_VERSION(version); \ + uint32_t minor = MC_GET_MINOR_VERSION(version); \ + uint32_t ret = 0; \ + *errmsg = msgBuf; \ + if ((major == majorRequired) && (minor <= minorRequired)) { \ + snprintf(msgBuf, sizeof(msgBuf), \ + #comp " version is %u.%u", major, minor); \ + ret = 1; \ + } else { \ + snprintf(msgBuf, sizeof(msgBuf), \ + #comp " version error. Got: %u.%u, want <= %u.%u", major, minor, majorRequired, minorRequired); \ + } \ + msgBuf[sizeof(msgBuf) - 1] = '\0'; \ + return ret; \ + } +#else /* TRUSTLET */ +#define MC_CHECK_DATA_OBJECT_VERSION(comp, majorRequired, minorRequired) \ + MC_CHECK_VERSION_STATIC(comp, majorRequired, minorRequired) \ + static uint32_t checkVersionOkDataObject##comp(uint32_t version, char** errmsg) { \ + uint32_t major = MC_GET_MAJOR_VERSION(version); \ + uint32_t minor = MC_GET_MINOR_VERSION(version); \ + *errmsg = NULL; \ + if ((major == majorRequired) && (minor <= minorRequired)) { \ + tlDbgPrintf(#comp " version is %u.%u", major, minor); \ + return 1; \ + } else { \ + tlDbgPrintf( \ + #comp " version error. Got: %u.%u, want <= %u.%u", major, minor, majorRequired, minorRequired); \ + } \ + return 0; \ + } +#endif /* TRUSTLET */ +#else +#define MC_CHECK_DATA_OBJECT_VERSION(comp, majorRequired, minorRequired) \ + MC_CHECK_VERSION_STATIC(comp, majorRequired, minorRequired) \ + static uint32_t checkVersionOkDataObject##comp(uint32_t version, char** errmsg) { \ + uint32_t major = MC_GET_MAJOR_VERSION(version); \ + uint32_t minor = MC_GET_MINOR_VERSION(version); \ + *errmsg = NULL; \ + if ((major == majorRequired) && (minor <= minorRequired)) { \ + return 1; \ + }; \ + return 0; \ + } +#endif diff --git a/mobicore/common/MobiCore/inc/mcVersionInfo.h b/mobicore/common/MobiCore/inc/mcVersionInfo.h new file mode 100644 index 0000000000000000000000000000000000000000..f93115a32dada9336702dae0f9936e8f9b110dca --- /dev/null +++ b/mobicore/common/MobiCore/inc/mcVersionInfo.h @@ -0,0 +1,35 @@ +/** @addtogroup MC_RTM + * @{ + * MobiCore Version Information + * + * Copyright (c) 2013 TRUSTONIC LIMITED + * All rights reserved + * + * The present software is the confidential and proprietary information of + * TRUSTONIC LIMITED. You shall not disclose the present software and shall + * use it only in accordance with the terms of the license agreement you + * entered into with TRUSTONIC LIMITED. This software may be subject to + * export or import laws in certain countries. + */ + +#ifndef MCVERSIONINFO_H_ +#define MCVERSIONINFO_H_ + +/** Length of MobiCore product ID string. */ +#define MC_PRODUCT_ID_LEN 64 + +/** Global MobiCore Version Information. + */ +typedef struct { + char productId[MC_PRODUCT_ID_LEN]; /** < Product ID of Mobicore; zero-terminated */ + uint32_t versionMci; /** < Version of Mobicore Control Interface */ + uint32_t versionSo; /** < Version of Secure Objects */ + uint32_t versionMclf; /** < Version of MobiCore Load Format */ + uint32_t versionContainer; /** < Version of MobiCore Container Format */ + uint32_t versionMcConfig; /** < Version of MobiCore Configuration Block Format */ + uint32_t versionTlApi; /** < Version of MobiCore Trustlet API Implementation */ + uint32_t versionDrApi; /** < Version of MobiCore Driver API Implementation */ + uint32_t versionCmp; /** < Version of Content Management Protocol */ +} mcVersionInfo_t; + +#endif /** MCVERSIONINFO_H_ */ diff --git a/mobicore/common/curl/Android.mk b/mobicore/common/curl/Android.mk new file mode 100644 index 0000000000000000000000000000000000000000..003e7d13f6de9ac8258426753a8d317e83490092 --- /dev/null +++ b/mobicore/common/curl/Android.mk @@ -0,0 +1,91 @@ +# Google Android makefile for curl and libcurl +# +# Place the curl source (including this makefile) into external/curl/ in the +# Android source tree. Then build them with 'make curl' or just 'make libcurl' +# from the Android root. Tested with Android versions 1.5, 2.1-2.3 +# +# Note: you must first create a curl_config.h file by running configure in the +# Android environment. The only way I've found to do this is tricky. Perform a +# normal Android build with libcurl in the source tree, providing the target +# "showcommands" to make. The build will eventually fail (because curl_config.h +# doesn't exist yet), but the compiler commands used to build curl will be +# shown. Now, from the external/curl/ directory, run curl's normal configure +# command with flags that match what Android itself uses. This will mean +# putting the compiler directory into the PATH, putting the -I, -isystem and +# -D options into CPPFLAGS, putting the -W, -m, -f, -O and -nostdlib options +# into CFLAGS, and putting the -Wl, -L and -l options into LIBS, along with the +# path to the files libgcc.a, crtbegin_dynamic.o, and ccrtend_android.o. +# Remember that the paths must be absolute since you will not be running +# configure from the same directory as the Android make. The normal +# cross-compiler options must also be set. Note that the -c, -o, -MD and +# similar flags must not be set. +# +# To see all the LIBS options, you'll need to do the "showcommands" trick on an +# executable that's already buildable and watch what flags Android uses to link +# it (dhcpcd is a good choice to watch). You'll also want to add -L options to +# LIBS that point to the out/.../obj/lib/ and out/.../obj/system/lib/ +# directories so that additional libraries can be found and used by curl. +# +# The end result will be a configure command that looks something like this +# (the environment variable A is set to the Android root path which makes the +# command shorter): +# +# A=`realpath ../..` && \ +# PATH="$A/prebuilt/linux-x86/toolchain/arm-eabi-X/bin:$PATH" \ +# ./configure --host=arm-linux CC=arm-eabi-gcc \ +# CPPFLAGS="-I $A/system/core/include ..." \ +# CFLAGS="-nostdlib -fno-exceptions -Wno-multichar ..." \ +# LIBS="$A/prebuilt/linux-x86/toolchain/arm-eabi-X/lib/gcc/arm-eabi/X\ +# /interwork/libgcc.a ..." +# +# Finally, copy the file COPYING to NOTICE so that the curl license gets put +# into the right place (but see the note about this below). +# +# Dan Fandrich +# November 2011 + +LOCAL_PATH:= $(call my-dir) + +common_CFLAGS := -Wpointer-arith -Wwrite-strings -Wunused -Winline -Wnested-externs -Wmissing-declarations -Wmissing-prototypes -Wno-long-long -Wfloat-equal -Wno-multichar -Wsign-compare -Wno-format-nonliteral -Wendif-labels -Wstrict-prototypes -Wdeclaration-after-statement -Wno-system-headers -DHAVE_CONFIG_H + +######################### +# Build the libcurl library + +include $(CLEAR_VARS) +include $(LOCAL_PATH)/lib/Makefile.inc +CURL_HEADERS := \ + curlbuild.h \ + curl.h \ + curlrules.h \ + curlver.h \ + easy.h \ + mprintf.h \ + multi.h \ + stdcheaders.h \ + typecheck-gcc.h + +LOCAL_SRC_FILES := $(addprefix lib/,$(CSOURCES)) +LOCAL_C_INCLUDES += $(LOCAL_PATH)/include/ +LOCAL_C_INCLUDES += external/openssl/include +LOCAL_C_INCLUDES += external/zlib +LOCAL_CFLAGS += $(common_CFLAGS) +LOCAL_SHARED_LIBRARIES := libz libssl libcrypto + +LOCAL_COPY_HEADERS_TO := libcurl/curl +LOCAL_COPY_HEADERS := $(addprefix include/curl/,$(CURL_HEADERS)) + +LOCAL_MODULE:= libcurl +LOCAL_MODULE_TAGS := optional + +# Copy the licence to a place where Android will find it. +# Actually, this doesn't quite work because the build system searches +# for NOTICE files before it gets to this point, so it will only be seen +# on subsequent builds. +#ALL_PREBUILT += $(LOCAL_PATH)/NOTICE +#$(LOCAL_PATH)/NOTICE: $(LOCAL_PATH)/COPYING | $(ACP) +# $(copy-file-to-target) + +LOCAL_PRELINK_MODULE := false +include $(BUILD_SHARED_LIBRARY) + + diff --git a/mobicore/common/curl/CHANGES b/mobicore/common/curl/CHANGES new file mode 100644 index 0000000000000000000000000000000000000000..1b8e3ece5750826cf0bb11316897a1d05eccf1cc --- /dev/null +++ b/mobicore/common/curl/CHANGES @@ -0,0 +1,4713 @@ + _ _ ____ _ + ___| | | | _ \| | + / __| | | | |_) | | + | (__| |_| | _ <| |___ + \___|\___/|_| \_\_____| + + Changelog + +Daniel Stenberg (15 Dec 2010) +- RELEASE-NOTES: synced with a865bd9fbaaa43e5c + +- IsPipeliningPossible: only for HTTP + + The function that checks if pipelining is possible now requires the HTTP + bit to be set so that it doesn't mistakenly tries to do it for other + protocols. + + Bug: http://curl.haxx.se/mail/lib-2010-12/0152.html + Reported by: Dmitri Shubin + +- multi_runsingle: don't timeout completed handles + + The generic timeout code must not check easy handles that are already + completed. Going to completed (again) within there risked decreasing the + number of alive handles again and thus it could go negative. + + This regression bug was added in 7.21.2 in commit ca10e28f06f1 + +- symbols-in-versions: CURLOPT_KEYPASSWD fixed + + It was added in 7.17.0 and is not deprecated + +- RELEASE-NOTES: synced with c28443c551825 + +Dan Fandrich (8 Dec 2010) +- Mention that using other libraries can affect app licensing + +Yang Tse (7 Dec 2010) +- easy: fix compiler warning: end-of-loop code not reached + +Daniel Stenberg (6 Dec 2010) +- disconnect: pass on the dead_connection argument + + Cleanup fix after Kamil's commit 5c7c9a768d0093 + +Yang Tse (6 Dec 2010) +- sws: fix compier warning: external definition with no prior declaration + +Daniel Stenberg (6 Dec 2010) +- [Heinrich Ko brought this change] + + ossl_connect_common: detect connection re-use + + ossl_connect_common() now checks whether or not 'struct + connectdata->state' is equal 'ssl_connection_complete' and if so, will + return CURLE_OK with 'done' set to 'TRUE'. This check prevents + ossl_connect_common() from creating a new ssl connection on an existing + ssl session which causes openssl to fail when it tries to parse an + encrypted TLS packet since the cipher data was effectively thrown away + when the new ssl connection was created. + + Bug: http://curl.haxx.se/mail/lib-2010-11/0169.html + +Kamil Dudka (6 Dec 2010) +- url: provide dead_connection flag in Curl_handler::disconnect + + It helps to prevent a hangup with some FTP servers in case idle session + timeout has exceeded. But it may be useful also for other protocols + that send any quit message on disconnect. Currently used by FTP, POP3, + IMAP and SMTP. + +Yang Tse (6 Dec 2010) +- ssh: fix a download resume point calculation + +Daniel Stenberg (5 Dec 2010) +- Curl_wait_for_resolv: correct timeout + + When looping in this function and checking for the timeout being + expired, it was not updating the reference time when calculating the + timediff since previous round which made it think each subsequent loop + to have taken longer than it actually did. + + I also modified the function to use the generic Curl_timeleft() function + instead of the custom logic. + + Bug: http://curl.haxx.se/bug/view.cgi?id=3112579 + +- Curl_send/recv_plain: return errno on failure + + When send() and recv() fail, we now store the errno value to allow the + app to access it. + + Bug: http://curl.haxx.se/bug/view.cgi?id=3128121 + Reported by: Yuri + +Guenter Knauf (5 Dec 2010) +- Updated OpenSSL version. + +Yang Tse (4 Dec 2010) +- fix compiler warning: conversion may lose significant bits + +- fix compiler warning: assignment within conditional expression + +- fix getinfo CURLINFO_LOCAL* for reused connections (take 2) follow-up + + - Show address string from proper buffer in case of connection failure. + + - Try next address when inet_ntop() fails. + +Daniel Stenberg (3 Dec 2010) +- version-check: added brief documentation + + and the traditional source header + +Yang Tse (3 Dec 2010) +- build: provide SIZEOF_SIZE_T DOS definition + +- build: lib/config.dos renamed to lib/config-dos.h + +- build: provide SIZEOF_SIZE_T VMS definition + +- build: move config-vms.h from subdir 'packages/vms' into 'lib' + +- build: provide SIZEOF_SIZE_T definition for non-configure builds + +- build: provide SIZEOF_SIZE_T netware definition + +- configure: undo using autobuilds to temporarily verify strict aliasing warnings. + +- fix compiler warning: rounding, sign extension, or loss of accuracy may result + +- fix compiler warning: statement is not reachable + +- fix compiler warning: conversion may lose significant bits + +- connect: fix compiler warning: unused variable + +- fix getinfo CURLINFO_LOCAL* for reused connections (take 2) + +- fix getinfo CURLINFO_LOCAL* for reused connections follow-up + + Reinstate IPV6 build variable that got removed. + +- fix getinfo CURLINFO_LOCAL* for reused connections + + Failed to commit this file changes along with the others. + +- fix getinfo CURLINFO_LOCAL* for reused connections + +- atoi: remove atoi usage + +- multi: fix compiler warning: conversion may lose significant bits follow-up + +- ftp: fix 'bool' data type implementation dependant usage + +- multi: fix compiler warning: conversion may lose significant bits + +- multi: fix compiler warning: enumerated type mixed with another type + +- hostip: edit comment + +- xattr: fix compiler warning: enumerated type mixed with another type + +- s/isspace/ISSPACE + +- symbol-scan: use configure script knowledge about how to run the C preprocessor + +- ignore file generated by configure + +- curl_multi_info_read: fix compiler warning: conversion may lose significant bits + +- inet_pton: fix compiler warning + + warning C4146: unary minus operator applied to unsigned type, result still unsigned + +- Curl_getaddrinfo_ex: sanitize function results follow-up. + +- Curl_getaddrinfo_ex: sanitize function results. + + Ensure that spurious results from system's getaddrinfo() ares not propagated + by Curl_getaddrinfo_ex() into the library. + + Also ensure that the ai_addrlen member of Curl_getaddrinfo_ex()'s output linked + list of Curl_addrinfo structures has appropriate family-specific address size. + +Kamil Dudka (22 Nov 2010) +- openldap: use remote port in URL passed to ldap_init_fd() + + ... not the proxy port. It makes no difference unless a proxy is used. + +Yang Tse (20 Nov 2010) +- gtls: define and use gtls_EAGAIN, gtls_EINTR and gtls_EIO. + + Winsock builds clobber some errno.h defines in setup_once. + +Dan Fandrich (19 Nov 2010) +- Added a couple examples that were missing from the tar ball + +- Check for errors while preprocessing curl.h in test 1119 + + This showed a problem when running the test out-of-tree, so + an include path is now being added to pick up the generated + curlbuild.h file. + +- Use the 3-argument open for compatibility with older perls + +- [Matthias Bolte brought this change] + + Detect socket errors in GnuTLS on Windows + + On Windows, translate WSAGetLastError() to errno values as GNU + TLS does it internally, too. This is necessary because send() and + recv() on Windows don't set errno when they fail but GNU TLS + expects a proper errno value. + + Bug: http://curl.haxx.se/bug/view.cgi?id=3110991 + +Yang Tse (19 Nov 2010) +- test servers: fix strict aliasing compiler warnings + +- configure: use autobuilds to temporarily verify strict aliasing warnings. + + Temporarily, When cross-compiling with gcc 3.0 or later, enable strict aliasing + rules and warnings. Given that cross-compiled targets autobuilds do not run the + +Julien Chaffraix (17 Nov 2010) +- configure: Prevent link errors with --librtmp. + + If --librtmp was specified but pkg-config could not find the librtmp + file, we would have undefined symbols when linking curl. + + We prevent this error by disabling this case as suggested on the mailing + list. + +Daniel Stenberg (15 Nov 2010) +- RELEASE-NOTES: synced with cbf4961bf3e4 + +- gnutls->handshake: improved timeout handling + + When no timeout is set, we call the socket_ready function with a timeout + value of 0 during handshake, which makes it loop too much/fast in this + function. It also made this function return CURLE_OPERATION_TIMEDOUT + wrongly on a slow handshake. + + However, the particular bug report that highlighted this problem is not + solved by this fix, as this fix only makes the more proper error get + reported instead. + + Bug: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=594150 + Reported by: Johannes Ernst + +Julien Chaffraix (13 Nov 2010) +- urldata: Capitalize enum protect_level values. + + This makes it easier to spot the enum values from the variables. + Removed some unneeded DEBUGASSERT added in the previous commit. + +- security: tighten enum protection_level usage. + + While changing Curl_sec_read_msg to accept an enum protection_level + instead of an int, I went ahead and fixed the usage of the associated + fields. + + Some code was assuming that prot_clear == 0. Fixed those to use the + proper value. Added assertions prior to any code that would set the + protection level. + +Yang Tse (13 Nov 2010) +- configure: fix autoconf 2.68 warning: no AC_LANG_SOURCE call detected in body + +Daniel Stenberg (12 Nov 2010) +- curl.1: "a file", not an + +- version-check.pl: display version number for symbols + + This script is the start of a helper tool that scans a source code and + outputs the most recent libcurl version it finds symbols for. Meaning + that if there's no conditions in the code, that's the earliest libcurl + version the scanned code requires. + + It is not added to the Makefile.am yet as it is still a bit crude, but + I'm committing it to keep it and allow us to work on it. + +- [Adam Light brought this change] + + Makefile.vc6: fixed the xattr.c compile + +Julien Chaffraix (12 Nov 2010) +- krb5: Use GSS_ERROR to check for error. + + This is the advised way of checking for errors in the GSS-API RFC. + Also added some '\n' to the error message so that they are not mixed + with other outputs. + +- security: Pass the right parameter to init. + + init is expecting app_data. Passing it the struct connecdata would make + us crash later. + +Daniel Stenberg (11 Nov 2010) +- HTTP Auth: Add CURLAUTH_ONLY + + This is a meta symbol. OR this value together with a single specific + auth value to force libcurl to probe for un-restricted auth and if not, + only that single auth algorithm is acceptable. + + For example you can use CURLAUTH_DIGEST|CURLAUTH_ONLY to make libcurl + first probe for what method to use, but yet only consider Digest to be + acceptable. + + Using _only_ CURLAUTH_DIGEST without the CURLAUTH_ONLY field, will make + libcurl explicitly use Digest right away and not do any probing. + +- ip_version: moved to connection struct + + The IP version choice was previously only in the UserDefined struct + within the SessionHandle, but since we sometimes alter that option + during a request we need to have it on a per-connection basis. + + I also moved more "init conn" code into the allocate_conn() function + which is designed for that purpose more or less. + +Yang Tse (11 Nov 2010) +- buildconf: MAC OS X requires libtool version 1.5.26 or newer + + MAC OS X requires libtool version 1.5.26 or newer, otherwise + configure will mishandle *.dSYM directories when it runs. + +- configure: remove temporary autobuilds exercising of xattr function tests + +- configure: use autobuilds to temporarily exercise xattr function tests + +- xattr: portability fix + +- curl-functions: provide xattr function tests that also check number of arguments + +Daniel Stenberg (10 Nov 2010) +- test1120: verify FTP response 421 + + curl mustn't try to use the control connection after the 421 is received + +- ftpserver.pl: spellfix comment + +- [Rutger Hofman brought this change] + + TFTP: resend the correct data + + I found a bug in tftp_tx() in tftp.c. If a data resend is done after + reception of an ACK/OACK, the call to sendto is wrong. + +- [Stefan Tomanek brought this change] + + write extended attributes by using fsetxattr + + Instead of reopening the downloaded file, fsetxattr uses the (already + open) file descriptor to attach extended attributes. This makes the + procedure more robust against errors caused by moved or deleted files. + +Dan Fandrich (9 Nov 2010) +- Check for getinfo errors before setting attributes + +Kamil Dudka (9 Nov 2010) +- ftp: treat server's response 421 as CURLE_OPERATION_TIMEDOUT + + Bug: https://bugzilla.redhat.com/650255 + Reported by: Simon H. + +Daniel Stenberg (9 Nov 2010) +- symbols-in-version: add CURL_SOCKET_BAD + + I also documented the filtering logic in the symbol-scan.pl function to + clarify why not all CURL_* symbols are included. + +Yang Tse (9 Nov 2010) +- serial number bump + +Kamil Dudka (8 Nov 2010) +- ftp: close connection as soon as ABOR has been sent + + ... and do not send ABOR unless really necessary. + + Bug: https://bugzilla.redhat.com/649347 + Reported by: Simon H. + +Daniel Stenberg (8 Nov 2010) +- RELEASE-NOTES: synced with fc6c4c10f9faab08 + + I also recounted and updated the command line and libcurl options. + +- help: indent the --xattr option like the others + +- curl.1: --resolve documented + +- CURLOPT_RESOLVE: documented + +- CURLOPT_USE_SSL: move from FTP options to connection options + +- xattr-check: correct the comment as well + +- xattr: use const char * for const strings + +- setxattr: fix the checks + + My copy and paste job was a little too much copy and I missed to adjust + it properly to sys/xattr.h all over and this is a fix to cure that. + +- CURLOPT_RESOLVE: added + + CURLOPT_RESOLVE is a new option that sends along a curl_slist with + name:port:address sets that will populate the DNS cache with entries so + that request can be "fooled" to use another host than what otherwise + would've been used. Previously we've encouraged the use of Host: for + that when dealing with HTTP, but this new feature has the added bonus + that it allows the name from the URL to be used for TLS SNI and server + certificate name checks as well. + + This is a first change. Surely more will follow to make it decent. + +Yang Tse (8 Nov 2010) +- fix compiler warning + +Dan Fandrich (7 Nov 2010) +- Added os-specific.c and xattr.c to the Symbian build files + +Yang Tse (7 Nov 2010) +- xattr: fix VisualStudio builds + +- fix snapshot generation + +Daniel Stenberg (5 Nov 2010) +- --libcurl: simplify output + + Removed the code that was needed for libcurl before 7.19.0 which now is + more than two years old. + + Simplified the top comment and corrected the URL. + +- [Alfred Gebert brought this change] + + LDAP: detect non-binary attributes properly + + If the query result has a binary attribute, the binary attribute is + base64 encoded. But all following non binary attributes are also base64 + encoded which is wrong. + + This is a test (LDAP server is public). + + curl + ldap://x500.bund.de:389/o=Bund,c=DE?userCertificate,certificateSerialNumber?sub + ?cn=*Woehleke* + +- xattr: add configure check and #ifdefs + + setxattr is a glibc call to set extended attributes, so configure now + checks for it and the code is adapted to only build when the + functionality is present. + +- [Stefan Tomanek brought this change] + + save metadata to extended file attributes + + It is often convinient to track back the source of a once downloaded + file; this patch makes curl store the source URL and other metadata + alongside the retrieved file by using the extended attributes (if + supported by the file system and enabled by --xattr). + +- test: remove test 580 + + Test 580 is removed again for two reasons: + + 1) Some compilers aren't satisfied by just a data variable called 'test' + when first.o wants a function called 'test'. The Solaris compiler says + "ld: warning: symbol `test' has differing types:" while the AIX compiler + downright rejects it. + + 2) Test case 1119 that was added after this test is way more complete + and cover everything test 580 does and more without introducing the same + problems. + +- Revert: use Host: name for SNI and cert name checks + + This reverts commit b0fd03f5b8d4520dd232a9d13567d16bd0ad8951, + 4b2fbe1e97891f, afecd1aa13b4f, 68cde058f66b3 + +- TODO-RELEASE: "TLS SNI use Host:" is done + + 262 - Manual setting of TLS Server Name Indication - use Host: + +- RELEASE-NOTES: synced with 7b823badbcab9d330 + +- curl.1: added a few missing exit codes + +- certcheck: use the custom Host: name for checks + + If you use a custom Host: name in a request to a SSL server, libcurl + will now use that given name when it verifies the server certificate to + be correct rather than using the host name used in the actual URL. + +- SNI: simplify the custom host name use + + The redirect check is already done at the position where the customhost + field is assigned so there's no point in doing that a second time. + +- host: get the custom Host: name more genericly + + When given a custom host name in a Host: header, we can use it for + several different purposes other than just cookies, so we rename it and + use it for SSL SNI etc. + +- [Hongli Lai (Phusion) brought this change] + + SNI: set name to custom Host header + + OpenSSL SNI host name should be set to the custom Host header, if the + user provided one. + +- fopen.c: re-indented, fixed previous mistake + + I've made the code intended using curl-style now to look more like other + examples. + + My previous "fix" was a bit too invasive but is now fixed again. + +- multi use: call multi_perform even on select() timeouts + +- example: add smtp-multi.c + + An example application source code sending SMTP mail with the multi + interface. It is based on the code Alona Rossen provided, which in turn + is based on existing example/test code, and I converted it even more + into a decent example with a fair multi API use, put the info required + to edit at the top and I added some comments. + +- CURLOPT_NOSIGNAL: add blurb about SIGPIPE + +Dan Fandrich (3 Nov 2010) +- Allow building test 580 out of tree + +Daniel Stenberg (3 Nov 2010) +- dist: add symbol-scan.pl to the tarball + +- test1119: verify symbols-in-versions + +- runtests: allow tests written as perl scripts + + If a command is set type="perl", it can now specify a perl program that will + be run instead of an ordinary curl or built tool. + + A perl test automatically disables memory and valgrind debugging. + +- symbol-scan: verifies symbols-in-versions + + This new script scans for all enums and #defines used by the curl/curl.h + and curl/multi.h headers. Then it reads all symbols mentioned in + symbols-in-vesions and make sure that there's no entries missing in + there. It then proceeds to verify that the entries that + symbols-in-vesions mentions but aren't found in the sources are truly + documented as removed. + + This script is used in the new test case 1119 + +- symbols-in-versions: added 119 missing symbols + + I've developed a script I call symbol-scan.pl that scans the curl.h and + multi.h header files and compare the symbols it finds in there with the + symbols symbols-in-versions documents and outputs a report on the + differences. Using this I've dug through the history to fill up + symbols-in-versions with all the symbols my script found mismatches for. + + I will commit symbol-scan.pl separatly and think of a way to put it to + use in the build/tests so that we from now on will get this in-sync + check automatically. + +Dan Fandrich (2 Nov 2010) +- Added mk580.pl to the tar ball + +Daniel Stenberg (2 Nov 2010) +- symbols-in-versions: added missing symbols + +- ignore: lib580.c is generated by mk580.pl + +- test: added test 580 - verifies symbols-in-versions + + The new perl script mk580.pl generates a C table in a fresh source file + named lib580.c and if that compiles fine we know that the file + docs/libcurl/symbols-in-versions at least doesn't include any symbols + that are misspelled. + + An additional feature would be to somehow scan curl/curl.h and compare + with symbols-in-versions to see if there are symbols missing. + +- spellfix: CURLOPT_TFTP_BLKSIZE it is + +Kamil Dudka (29 Oct 2010) +- ftp: prevent server from hanging on closed data connection + + Some FTP servers (e.g. Pure-ftpd) end up hanging if we close the data + connection before transferring all the requested data. If we send ABOR + in that case, it prevents the server from hanging. + + Bug: https://bugzilla.redhat.com/643656 + Reported by: Pasi Karkkainen, Patrick Monnerat + +Dan Fandrich (28 Oct 2010) +- Removed a leftover mention of FTP in an error message + +- Removed the native Makefile.riscos files + + These haven't worked in at least 8 years due to missing source + files, and most active RiscOS developers these days apparently + cross-compile anyway. + + Signed-off-by: James Bursa + +- Lightened the stack in wc_statemach to permit deeper recursion + + Also, added a few hints to help compilers to perform tail call + recursion optimization. + +Daniel Stenberg (20 Oct 2010) +- SSH: use libssh2_session_handshake() + + In libssh2 1.2.8, libssh2_session_handshake() replaces + libssh2_session_startup() to fix the previous portability problem with + the socket type that was too small for win64 and thus easily could cause + crashes and more. + +- SSH: avoid using the libssh2_ prefix + + It is a bad idea to use the public prefix used by another library and + now we realize that libssh2 introduces a symbol in the upcoming version + 1.2.8 that conflicts with our static function named libssh2_free. + +- formdata: provide error message + + When failing to build form post due to an error, the code now does a + proper failf(). Previously libcurl would report an error like "failed + creating formpost data" when a file wasn't possible to open which was + not easy for users to figure out. + + I also lower cased a function name to be named more curl-style and + removed some unnecessary code. + +- URL-parsing: consider ? a divider + + The URL parser got a little stricter as it now considers a ? to be a + host name divider so that the slightly sloppier URLs work too. The + problem that made me do this change was the reported problem with an URL + like: www.example.com?email=name@example.com This form of URL is not + really a legal URL (due to the missing slash after the host name) but is + widely accepted by all major browsers and libcurl also already accepted + it, it was just the '@' letter that triggered the problem now. + + The side-effect of this change is that now libcurl no longer accepts the + ? letter as part of user-name or password when given in the URL, which + it used to accept (and is tested in test 191). That letter is however + mentioned in RFC3986 to be required to be percent encoded since it is + used as a divider. + + Bug: http://curl.haxx.se/bug/view.cgi?id=3090268 + +- curl_easy_setopt.3: spellfix + +- curl_easy_setopt.3: CURLOPT_USE_SSL is not just for FTP + + It is for FTP, SMTP, POP3, IMAP at least. + +- krb4.h: removed unused prototypes + +- krb4: make a few functions static + +- TODO-RELEASE: cleanup for 7.21.3 works + + "SFTP resume with 4GB file does not work" is now removed as I'm sure + this is really a libssh2 bug and not a libcurl bug. + + 7.21.2 is released already + +- RELEASE-NOTES: sync with 09a2d93a0f17ca + +- http_chunks: remove debug output + + Accidentally left in there during my previous debugging of this + +- Curl_setopt: disallow CURLOPT_USE_SSL without SSL support + + In order to avoid for example the pingpong protocols to issue STARTTLS + (or equivalent) even though there's no SSL support built-in. + + Reported by: Sune Ahlgren + Bug: http://curl.haxx.se/mail/archive-2010-10/0045.html + +- options: check for features for some options + + Some options, such as the automatic decompression and some SSL related + ones now will bail out if the underlying libcurl doesn't have support + for the particular feature needed. + +Dan Fandrich (14 Oct 2010) +- Fixed the IPv6 host address in test1203 + + Reported by: Christian Weisgerber + Bug: http://curl.haxx.se/bug/view.cgi?id=3087479 + +Daniel Stenberg (14 Oct 2010) +- curl_easy_setopt.3: clarify CURLOPT_CRLF + + The option takes a parameter that should be 1 or 0 to enable or disable + the feature. + + URL: http://curl.haxx.se/bug/view.cgi?id=3086428 + +Guenter Knauf (14 Oct 2010) +- Some more small Watcom makefile fixes. + +- Added --noconfigure switch to testcurl.pl. + +- Modified Watcom makefiles to work on Linux too. + +- Added MingW32 rtmp target; changed Watcom targets. + + Modified Watcom targets to avoid backslashs so that they can + work on Linux too. + +Daniel Stenberg (13 Oct 2010) +- gitignore: ignore Makefile.vc10.dist made by maketgz + +- curlver.h: start over at 7.21.3 + +- RELEASE-NOTES: start over towards 7.21.3 + +- THANKS: added contributors from 7.21.2 + +Version 7.21.2 (12 Oct 2010) + +Daniel Stenberg (12 Oct 2010) +- RELEASE-NOTES: synced with ecd624b8e774a85 + +- [Julien Chaffraix brought this change] + + CMake: Build fix. + + Do not match the trailing '\n' in the regular expression as this would + make us dump a ) parenthesis on a new line. + + This fixes the following error: + + would get transformed into: + + ) + + Bug: http://curl.haxx.se/mail/lib-2010-10/0065.html + Reported by: Dimitre Dimitrov + +- header_callback: strip off file path separated with backslashes + + If the filename contains a backslash, only use filename portion. The + idea is that even systems that don't handle backslashes as path + separators probably want that path removed for convenience. + + This flaw is considered a security problem, see the curl security + vulnerability http://curl.haxx.se/docs/adv_20101013.html + +Dan Fandrich (12 Oct 2010) +- Get the curl source files for Amiga from Makefile.inc + + This is similar to how it's done in the lib directory. + The Amiga build appears to have been broken for a year because + of a missing homedir.c + +- Added section on server-supplied names to security considerations + +Guenter Knauf (12 Oct 2010) +- Fixed Watcom makefile. + +- Added build bits for librtmp / libssh2 to Watcom makefiles. + +- Added build bits for librtmp to NetWare makefiles. + +Daniel Stenberg (12 Oct 2010) +- SFTP: more ignoring negative file sizes + + As the change in 5f0ae7a0626cbe709 added a precaution against negative + file sizes that for some reason managed to get returned, this change now + introduces the same check at the second place in the code where the file + size from the libssh2 stat call is used. + + This check might not be suitable for a 32 bit curl_off_t, but libssh2.h + assumes long long to work and to be 64 bit so I believe such a small + curl_off_t will be very unlikely to occur in the wild. + +- SMTP: debug output for no known auth mechanisms supported + + ... and some minor source code whitespace edits + +- test: urlglob error messages have no extra newline anymore + +Guenter Knauf (11 Oct 2010) +- Added build bits for librtmp to MingW32 makefiles. + +Daniel Stenberg (8 Oct 2010) +- RELEASE-NOTES: synced with 61f4cdb73ae4 + +- globbing: fix crash on unballanced open brace + + Having an open brace without a closing brace caused a segfault. + + Having a closing brace too many caused a silent error to occur, which + caused curl to bail out and return an error code but no error message + was shown. It does now! + + All error message outputs no longer wrongly get _two_ newlines written + after the error message. + + Reported by: Vlad Ureche + Bug: http://curl.haxx.se/bug/view.cgi?id=3083942 + +- [Dan Locks brought this change] + + libcurl.m4: AC_PATH_PROG fixes + + The invocation of autoconf's AC_PATH_PROG( ) is not quite right for + finding curl-config. This fix corrects the negative case (where + curl-config is not found). + +- FAQ: added "How do I submit my patch?" + +- examples: use example.com in example URLs + +- TODO-RELEASE: libidn problem not repeatable + + "261 - configure and libidn" is removed from the list since Julien + Chaffraix tried to repeat it but failed and the reporter did not return + to provide further details. + + Reported by: Lyndon Hill + Bug: http://curl.haxx.se/mail/lib-2010-07/0029.html + +- libcurl.m4: mention argument is PREFIX + + The macro provides a --with-libcurl option that expects a PREFIX to be + specified and not actually a "directory" in which libcurl will be found. + This now spells that out more clearly. + + Reported by: Dan Locks + Bug: http://curl.haxx.se/bug/view.cgi?id=3079891 + +Guenter Knauf (3 Oct 2010) +- Some NetWare makefile tweaks. + + Renamed SDK_* to NDK_*; made NDK_* defines overwriteable from + environment; removed now obsolete YACC macro; + moved some curl_config.h defines to IPv6 section since they + are only needed when IPv6 is enabled - this makes libcurl compile + with older NDKs too which were not IPv6-aware. + +Daniel Stenberg (2 Oct 2010) +- TODO-RELEASE: 416 error fixed + + "3076808 Requests fail silently following a 416 error" done + +Julien Chaffraix (2 Oct 2010) +- krb5-gssapi: Removed a memory leak in krb5_auth. + + We forgot to release the buffer passed to gss_init_sec_context. + + The previous logic was difficult to read as we were reusing the same + variable (gssbuf) for both input buffer and output buffer. Splitted the + logic in 2 variables to better underline who needs to be released. + Also made the code break at 80 lines. + +- krb5-gssapi: Made the function always return a value. + + kr5_auth missed a final 'return' statement. This is not an error in + gcc but can lead to potential bugs. + +- krb5-gssapi: Delete the GSS-API context. + + This fixes a memory leak related to the GSS-API code. + + Added a krb5_init and krb5_end functions. Also removed a work-around + the lack of proper initialization of the GSS-API context. + +Daniel Stenberg (2 Oct 2010) +- HTTP: remove special case for 416 + + It was pointed out that the special case libcurl did for 416 was + incorrect and wrong. 416 is not really different to other errors so the + response body must be handled like for other errors/http responses. + + Reported by: Chris Smowton + Bug: http://curl.haxx.se/bug/view.cgi?id=3076808 + +- [Dan Fandrich brought this change] + + sws: Added writedelay HTTP server command + + This delays between write operations, hopefully making it easier + to spot problems where libcurl doesn't flush the socket properly + before waiting for the next response. + +- TODO-RELEASE: no bug in ftp_nextconnect + + The issue named "266 - Bug in ftp_nextconnect?" was deemed to not be a + bug and instead resulted in clarified docs. + +- curl_easy_setopt.3: CURLOPT_DIRLISTONLY implies dir list + + Make it explicit that setting CURLOPT_DIRLISTONLY to 1 will make libcurl + to list the directory. + +- RELEASE-NOTES: synced up to 588402585bae + +- TODO-RELEASE: move new features to next release + +- README.ares: we know require c-ares 1.6.0 + +- SFTP: avoid downloading negative sizes! + + It is still not clarified exactly why this happens, but libssh2 + sometimes report a negative file size for the remote SFTP file and that + deeply confuses libcurl (or crashes it) so this precaution is added to + avoid badness. + + Reported by: Ernest Beinrohr + Bug: http://curl.haxx.se/bug/view.cgi?id=3076430 + +- TODO-RELEASE: drop curl_easy_setoptv + + I haven't read any really convincing arguments for adding it + +- [Dirk Manske brought this change] + + multi & hiper examples: updates and cleanups + + all multi and hiper examples: + + * don't loop curl_multi_perform calls, that was <7.20.0 style, currently + the exported multi functions will not return CURLM_CALL_MULTI_PERFORM + + all hiper examples: + * renamed check_run_count to check_multi_info + * don't compare current running handle count with previous value, this + was the wrong way to check for finished requests, simply call + curl_multi_info_read + * it's also safe to call curl_multi_remove_handle inside the + curl_multi_info_read loop. + + ghiper.c: + * replaced curl_multi_socket (that function is marked as obsolete) calls + with curl_multi_socket_action calls (as in hiperfifo.c and + evhiperfifo.c) + + ghiper.c and evhiperfifo.c: + * be smart as hiperfifo.c, don't do uncessary curl_multi_* calls in + new_conn and main + +- TODO-RELEASE: one fixed, one postponed, one added + + As we're already in feature freeze, I pushed the feature onwards. + +Dan Fandrich (29 Sep 2010) +- Renamed test1204 to test1117 to move it into the normal range + +Patrick Monnerat (29 Sep 2010) +- Add gopher protocol definition to ILE/RPG binding. + OS400 compile script in test dir updated for chkhostname. + +Julien Chaffraix (28 Sep 2010) +- krb5-gssapi: Remove several memory leaks. + + Remove a leak seen on Kerberos/MIT (gss_OID is copied internally and + we were leaking it). Now we just pass NULL as advised in RFC2744. + + |tmp| was never set back to buf->data. + + Cleaned up Curl_sec_end to take into account failure in Curl_sec_login + (where conn->mech would be NULL but not conn->app_data or + conn->in_buffer->data). + +- security.c: Remove Curl_sec_fflush_fd. + + The current implementation would make us send wrong data on a closed + socket. We don't buffer our data so the method can be safely removed. + +- security.c: We should always register the socket handler. + + Following a change in the way socket handler are registered, the custom + recv and send method were conditionaly registered. + We need to register them everytime to handle the ftp security + extensions. + + Re-added the clear text handling in sec_recv. + +- security.c: Fix Curl_sec_login after rewrite. + + Curl_sec_login was returning the opposite result that the code in ftp.c + was expecting. Simplified the return code (using a CURLcode) so to see + more clearly what is going on. + +- security.c: Readd the '\n' to the infof() calls. + + They are not automatically added and make the output of the verbose + mode a lot more readable. + +- security.c: Fix typo (PSBZ -> PBSZ) + +- security.c: Fix ftp_send_command. + + My use of va_args was completely wrong. Fixed the usage so that + we send the right commands! + +Daniel Stenberg (28 Sep 2010) +- curl_easy_escape: don't escape "unreserved" characters + + According to RFC3986 section 2.3 the letters -, ., _ and ~ should not be + percent-encoded. + + Reported by: Miguel Diaz + Bug: http://curl.haxx.se/mail/lib-2010-09/0227.html + +- multi: don't expire timeouts at disonnect or done + + The functions Curl_disconnect() and Curl_done() are both used within the + scope of a single request so they cannot be allowed to use + Curl_expire(... 0) to kill all timeouts as there are some timeouts that + are set before a request that are supposed to remain until the request + is done. + + The timeouts are now instead cleared at curl_easy_cleanup() and when the + multi state machine changes a handle to the complete state. + +Dan Fandrich (27 Sep 2010) +- Changed the TPF make file to get source files from Makefile.inc + + Patch was fixed and validated by David McCreedy. + +- Added test case 1204 to test HTTP range failure + + This is an attempt to reproduce bug #3076808 + +Daniel Stenberg (27 Sep 2010) +- [Dirk Manske brought this change] + + multi_runsingle: set timeout error messages + + With the latest changes to fix the timeout handling with multi interface + we lost the timeout error messages. This patch brings them back. + +- TODO-RELEASE: updated list of issues to work on + +- parsedate: allow time specified without seconds + + The date format in RFC822 allows that the seconds part of HH:MM:SS is + left out, but this function didn't allow it. This change also includes a + modified test case that makes sure that this now works. + + Reported by: Matt Ford + Bug: http://curl.haxx.se/bug/view.cgi?id=3076529 + +- TFTP: re-indented the source code + + Just made sure that the good old curl indentation style is used all over + this file. + +- [Tim Newsome brought this change] + + TFTP: Work around tftpd-hpa upload bug + + tftpd-hpa has a bug where it will send an incorrect ack when the block + counter wraps and tftp options have been sent. Work around that by + accepting an ack for 65535 when we're expecting one for 0. + +- Revert "security.c: buffer_read various fixes." + + This reverts commit fbb38de415b7bb7d743e53a7b4b887ffb12b3e5b. + +- security.c: removed superfluous parentheses + + And also removed the FIXME where memory was zeroed just before freed, + and some other minor whitespace changes. + +- [Julien Chaffraix brought this change] + + security.c: Update the #include statements after the rewrite. + +- [Julien Chaffraix brought this change] + + security.c: sec_write tweaks + + - |fd| is now a curl_socket_t and |len| a size_t to avoid conversions. + - Added 2 FIXMEs about the 2 unsigned -> signed conversions. + - Included 2 minor changes to Curl_sec_end. + +- [Julien Chaffraix brought this change] + + security.c: _sec_send tweaks + + - Renamed the method to sec_send now that we + renamed sec_send to do_sec_send. + - Some more variable renaming. + +- [Julien Chaffraix brought this change] + + security.c: sec_read tweaks + + - Renamed the function to sec_recv. + - Renamed the parameters and variable to match the rest of the code. + +- [Julien Chaffraix brought this change] + + security.c: Curl_sec_fflush_fd tweaks + + - Use an early return as it makes the code more readable. + - Added a FIXME about a conversion. + +- [Julien Chaffraix brought this change] + + security.c: sec_send tweaks + + - Renamed it to do_sec_send as it is the function doing the actual + transfer. + - Do not return any values as no one was checking it and it never + reported a failure (added a FIXME about checking for errors). + - Renamed the variables to make their use more specific. + - Removed some casts (int -> curl_socket_t, ...) + - Avoid doing the htnl <-> nthl twice by caching the 2 results. + +- [Julien Chaffraix brought this change] + + security.c: Curl_sec_read_msg tweaks + + - Renamed the variables name to better match their intend. + - Unified the |decoded_len| checks. + - Added some FIXMEs to flag some improvement that did not go in this + change. + +- [Julien Chaffraix brought this change] + + security.c: Curl_sec_set_protection_level tweaking + + - Removed sec_prot_internal as it is now inlined in the function (this removed + a redundant check). + - Changed the prototype to return an error code. + - Updated the method to use the new ftp_send_command function. + - Added a level_to_char helper method to avoid relying on the compiler's + bound checks. This default to the maximum security we have in case of a + wrong input. + +- [Julien Chaffraix brought this change] + + security.c: factored the logic from Curl_sec_login into a dedicated method that better reflect its intent. + + Introduced a helper method ftp_send_command that synchronously send + an FTP query. + +- [Julien Chaffraix brought this change] + + security.c: Remove out_buffer as it was never written into. + +- [Julien Chaffraix brought this change] + + security.c: buffer_read various fixes. + + Tighten the type of the |data| parameter to avoid a cast. Also made + it const as we should not modify it. + + Added a DEBUGASSERT on the size to be written while changing it. + +- [Julien Chaffraix brought this change] + + security.c: Made block_write return a CURLcode. + + While doing so, renamed it to socket_write to better match its + function. + +- [Julien Chaffraix brought this change] + + security.c: Made block_read and sec_get_data return CURLcode. + + To do so, made block_read call Curl_read_plain instead of read. + + While changing them renamed block_read to socket_read and sec_get_data + to read_data to better match their function. + + Also fixed a potential memory leak in block_read. + +- [Julien Chaffraix brought this change] + + Security.c: Fix headers guard to match the rest of the code. + +- [Julien Chaffraix brought this change] + + configure: Fix the LDAPS disable message + + ... for example when LDAP is not compiled. + + Fixed the logic to match the rest of the options' message that is we + update the default message only if the option is not disabled after the + different checks. + + Reported by: Guenter Knauf + +- RELEASE-NOTES: sync with 8665d4e5 and c-ares >= 1.6.0 note + +- parse_remote_port: ignore colons without port number + + Obviously, browsers ignore a colon without a following port number. Both + Firefox and Chrome just removes the colon for such URLs. This change + does not remove the colon for URLs sent over a HTTP proxy, so we should + consider doing that change as well. + + Reported by: github user 'kreshano' + +- RELEASE-NOTES: in sync with 19f45eaa799 + +- duphandle: use ares_dup() + + curl_easy_duphandle() was not properly duping the ares channel. The + ares_dup() function was introduced in c-ares 1.6.0 so by starting to use + this function we also raise the bar and require c-ares >= 1.6.0 + (released Dec 9, 2008) for such builds. + + Reported by: Ning Dong + Bug: http://curl.haxx.se/mail/lib-2010-08/0318.html + +- [Hendrik Visage brought this change] + + MacOSX-Framework: updates for Snowleopard + + 1) PPC64 appears to be an 10.5 only supported architecture, so I + forced 10.5 for 64bit if there is a need for PPC64, else 64bit only + does x86_64 + + 2) proper "make clean" after every ./configure. fixes a bug where + subsequent runs the 32bit do not get compiled + + 3) Added a version numbering curl-$VERSION} rather than the "stock standard" A + +- RELEASE-NOTES: synced with 5fcc4332d62fe + + Removed the duplicate entry of Kamil in the credits. + +- configure: don't enable RTMP if the lib detect fails + + librtmp is often statically linked and using sub dependencies like + OpenSSL, so we need to make sure we can actually link with it properly + before enabling it. Otherwise we easily end up trying to link with a + RTMP lib that fails. + +- TODO: added 8.4 non-gcrypt under GnuTLS + + We must not assume gcrypt just because of GnuTLS + +- configure: check for gcrypt if using GnuTLS + + 1 - libcurl assumes that there are gcrypt functions available when + GnuTLS is. + + 2 - GnuTLS can be built to use libnettle instead as crypto library, + which breaks assumption (1) + + This change makes configure make sure that if GnuTLS is requested and + detected, it also makes sure that gcrypt is present or it errors + out. This is mostly a way to make the user more aware of this flaw, the + correct fix would be to detect which crypto layer that is in use and + adapt our code to use that instead of blindly assuming gcrypt. + + Reported by: Michal Gorny + Bug: http://curl.haxx.se/bug/view.cgi?id=3071038 + +- RELEASE-NOTES: sync from d2a7fd2fe65b to HEAD + +- FTP: fix bad check of Curl_timeleft() return code + + When it returns 0 it means no timeout. Only a negative value means that + we're out of time. + +- LDAP: moved variable declaration to avoid compiler warn + + If built without HTTP or proxy support it would cause a compiler warning + due to the unused variable. I moved the declaration of it into the only + scope it is used. + +Tor Arntsen (18 Sep 2010) +- LDAP: Use FALSE instead of bool_false when setting bits.close + + bool_false is the internal name used in the setup_once.h definition + we fall back to for non-C99 non-stdbool systems, it's not the actual + name to use in assignments (we use bool_false, bool_true there to + avoid global namespace problems, see comment in setup_once.h). + The correct C99 value to use is 'false', but let's use FALSE as + used elsewhere when assigning to bits.close. FALSE is set equal + to 'false' in setup_once.h when possible. + + This fixes a build problem on C99 targets. + +- LDAP: Add missing declaration for 'result' + +Daniel Stenberg (18 Sep 2010) +- [Mauro Iorio brought this change] + + LDAP: Support for tunnelling queries through HTTP proxy + + As of curl-7.21.1 tunnelling ldap queries through HTTP Proxies is not + supported. Actually if --proxytunnel command-line option (or equivalent + CURLOPT_HTTPPROXYTUNNEL) is used for ldap queries like + ldap://ldap.my.server.com/... You are unable to successfully execute the + query. In facts ldap_*_bind is executed directly against the ldap server + and proxy is totally ignored. This is true for both openLDAP and + Microsoft LDAP API. + + Step to reproduce the error: + Just launch "curl --proxytunnel --proxy 192.168.1.1:8080 + ldap://ldap.my.server.com/dc=... " + + This fix adds an invocation to Curl_proxyCONNECT against the provided + proxy address and on successful "CONNECT" it tunnels ldap query to the + final ldap server through the HTTP proxy. As far as I know Microsoft + LDAP APIs don't permit tunnelling in any way so the patch provided is + for OpenLDAP only. The patch has been developed against OpenLDAP 2.4.23 + and has been tested with Microsoft ISA Server 2006 and works properly + with basic, digest and NTLM authentication. + +- timeout: use the correct start value as offset + + Rodric provide an awesome recipe that proved libcurl didn't timeout at + the requested time - it instead often timed out at [connect time] + + [timeout time] instead of the documented and intended [timeout time] + only. This bug was due to the code using the wrong base offset when + comparing against "now". I could also take the oppurtinity to simplify + the code by properly using of the generic help function for this: + Curl_timeleft. + + Reported by: Rodric Glaser + Bug: http://curl.haxx.se/bug/view.cgi?id=3061535 + +- Curl_timeleft: avoid returning "no timeout" by mistake + + As this function uses return code 0 to mean that there is no timeout, it + needs to check that it doesn't return a time left value that is exactly + zero. It could lead to libcurl doing an extra 1000 ms select() call and + thus not timing out as accurately as it should. + + I fell over this bug when working on the bug 3061535 but this fix does + not correct that problem alone, although this is a problem that needs to + be fixed. + + Reported by: Rodric Glaser + Bug: http://curl.haxx.se/bug/view.cgi?id=3061535 + +- whitespace: unified source + + if ( => if( + while ( => while( + + and some other changes in the similar spirit, trying to make the + whole file use the same style + +- remote-header-name: don't output filename when NULL + +- [James Bursa brought this change] + + TheArtOfHttpScripting: use long options + +- [James Bursa brought this change] + + getinmemory: make the example easier to follow + + 1. Remove the comment warning that it's "not been verified to work". It + works with no problems in my testing. + + 2. Remove 2 unnecessary includes. + + 3. Remove the myrealloc(). Initialize chunk.memory with malloc() instead + of NULL. The comments for these two parts contradicted each other. + + 4. Handle out of memory from realloc() instead of continuing. + + 5. Print a brief status message at the end. + +- multi: don't do extra expire calls for the connection + + The timeout is set for the connect phase already at the start of the + request so we should not add a new one, and we MUST not set expire to 0 + as that will remove any other potentially existing timeouts. + +- [Peter Pentchev brought this change] + + Fix a bashism: test a = b is more portable than ==. + +- glob_word: remove a check that is always false + +- inflate_stream: remove redundant check that is always true + +- digest: make it clear the condition is always true + +- ssluse: removed redundant check that is always true + +Dan Fandrich (11 Sep 2010) +- Link curl and the test apps with -lrt explicitly when necessary + + When curl calls a function from that library then it needs to + explicitly link to the library instead of piggybacking on + libcurl's own dependency. Without this, GNU ld with the + --no-add-needed flag fails when linking (which Fedora now does + by default). + + Reported by: Quanah Gibson-Mount + Bug: http://curl.haxx.se/mail/lib-2010-09/0085.html + +- Mention the Debian Popularity Contest + +Tor Arntsen (9 Sep 2010) +- test565: Don't hardcode IP:PORT + + Use %HOSTIP:%HTTPPORT instead of 127.0.0.1:8990 so that + verification works if the baseport change option is used + when executing runtests.pl. + +Daniel Stenberg (9 Sep 2010) +- curl.1: updated protocols and polished language + +- FAQ: CURL_STATICLIB for visual studio users + + Clarified as it isn't used with a -D option for them. + + Reported by: Artfunkel + Bug: http://curl.haxx.se/bug/view.cgi?id=3060381 + +- FAQ: updated and added host with custom IP question + + Added "3.19 How do I get HTTP from a host using a specific IP address?" + and updated some stuff about certs etc. + +- chunky parser: only rewind if needed + + The code reading chunked encoding attempts to rewind the code if it had + read more data than the chunky parser consumes. The rewinding can fail + and it will then cause an error. This change now makes the rewinding + only happen if pipelining is in use - as that's the only time it really + needs to be done. + + Bug: http://curl.haxx.se/mail/lib-2010-08/0297.html + Reported by: Ron Parker + +Kamil Dudka (6 Sep 2010) +- rtsp: avoid SIGSEGV on malformed header + +- rtsp: avoid SIGSEGV on malformed header + +Daniel Stenberg (6 Sep 2010) +- warning: fix conversion to 'int' from 'size_t' + +- portabilty: use proper variable type to hold sockets + + Curl_getconnectinfo() is changed to return a proper curl_socket_t for + the last socket so that it'll work more portably (and cause less + compiler warnings). + +Guenter Knauf (3 Sep 2010) +- Trial to fix another compiler warning with braces. + +Dan Fandrich (2 Sep 2010) +- Use checkprefix() to compare protocol-specific strings + + Otherwise, there could be problems running in certain locales. + +Guenter Knauf (2 Sep 2010) +- Moved S_ISREG define to setup as suggested by Dan. + +- Use own typedef as workaround for broken sspi.h header (f.e. Watcom). + +- Added some hacks in order to build with VC from git. + + Adam Light posted this patch to the list which enables builds from + git with VC versions other than vc6; also he added a vc10 target. + +- Added S_ISREG define for Win32. + +Daniel Stenberg (1 Sep 2010) +- multi: fixes for timing out handles + + Add a timeout check for handles in the state machine so that they will + timeout in all states disregarding what actions that may or may not + happen. + + Fixed a bug in socket_action introduced recently when looping over timed + out handles: it wouldn't assign the 'data' variable and thus it wouldn't + properly take care of handles. + + In the update_timer function, the code now checks if the timeout has + been removed and then it tells the application. Previously it would + always let the remaining timeout(s) just linger to expire later on. + +- threaded resolver: no more expire 0 calls + + Curl_expire() set to 0 expires ALL timeouts so it should only be called + if we truly and really want to remove all timeouts for the handle. + +- resolve_server: simplify code + + Make use of the helper function Curl_timeleft() instead of duplicating + code. + +- multi: make sure the next timeout is used when one expires + + Each easy handle has a list of timeouts, so as soon as the main timeout + for a handle expires, we must make sure to get the next entry from the + list and re-add the handle to the splay tree. + + This was attempted previously but was done poorly in my commit + 232ad6549a68450. + +Dan Fandrich (30 Aug 2010) +- Added proxy keyword to allow skipping test in proxyless configs + +Daniel Stenberg (29 Aug 2010) +- multi: set timeouts when transfer begins + + When a new transfer is about to start we now set the proper timeouts to + expire for the multi interface if they are set for the handle. This is a + follow-up bugfix to make sure that easy handles timeout properly when + the times expire and the multi interface is used. This also improves + curl_multi_timeout(). + +- CURLOPT_DIRLISTONLY: don't use with CURLOPT_WILDCARDMATCH + +- FAQ: update list of supported protocols + +- [Fabian Keil brought this change] + + In the m4 detection line, factor out the 2>dev/null + +- [Fabian Keil brought this change] + + If m4 doesn't support --version, try if gm4 does. + +- [Fabian Keil brought this change] + + If the m4 version isn't recognized at all, just say so + + 'm4 version found. You need a GNU m4 installed!' is a bit confusing. + +- HISTORY: mention the gopher story + +Dan Fandrich (25 Aug 2010) +- Tweaked some test data files + + Fixed some issues that caused xmllint failures, added features + and keywords, fixed some quotes and removed some sections + that unnecessarily limited test checking. + +- Added new source files to Symbian and TPF makefiles + +Daniel Stenberg (25 Aug 2010) +- RELEASE-NOTES: sync from b980c9a02 to HEAD + +- Makefile: add gopher.c file to build + + As the VC and RISCOS makefiles don't use the .inc file + +- runtests: fix uninitialized variable warning + +- gopher tests: revert parts of gopher in the pingpong server + + Introduced in the initial gopher commits, there was added logic to do + GOPHER test serving in the pingpong server but as it resembles HTTP much + more than FTP or SMTP, the gopher testing has been moved over to instead + use the sws (HTTP) server. This change simply removes unused code. + +- gopher tests: use sws and adjusted to more standard style + +- sws: added basic gopher support + +- gopher: enable the header callback/verbosity + +- gopher: fix test case line endings + + Patches over email very easily lose CRLF line endings in files otherwise + LF-only so I had to put them back where needed. + +- gopher: fix memory leak and busyloop + + The fix for the busyloop really only is a temporary work-around. It + causes a BLOCKING behavior which is a NO-NO. This function should rather + be split up in a do and a doing piece where the pieces that aren't + possible to send now will be sent in the doing function repeatedly until + the entire request is sent. + +- [Cameron Kaiser brought this change] + + Gopher using Curl_write; test suite (4 tests) + +- [Cameron Kaiser brought this change] + + Remove url.c test + +- [Cameron Kaiser brought this change] + + Forgot gopher.h in Makefile.inc + +- [Cameron Kaiser brought this change] + + Gopher protocol support (initial release) + +- http: handle trailer headers in all chunked responses + + HTTP allows that a server sends trailing headers after all the chunks + have been sent WITHOUT signalling their presence in the first response + headers. The "Trailer:" header is only a SHOULD there and as we need to + handle the situation even without that header I made libcurl ignore + Trailer: completely. + + Test case 1116 was added to verify this and to make sure we handle more + than one trailer header properly. + + Reported by: Patrick McManus + Bug: http://curl.haxx.se/bug/view.cgi?id=3052450 + +- TODO: we now support RTMP + +- TODO: done "NTLM with other crypto functions" + + Since NTLM was made to work with the NSS API as well, the primary SSL + alternatives will be built with NTLM support in libcurl. + +- TODO: fixed "Make curl_multi_info_read faster" + + It is really fast now + +Dan Fandrich (24 Aug 2010) +- Fixed a NULL pointer dereference in form posting + + It was introduced in commit eeb2cb05 along with the -F type= + change. Also fixed a typo in the name of the magic filename= + parameter. Tweaked tests 39 and 173 to better test this path. + +Daniel Stenberg (24 Aug 2010) +- [Ben Greear brought this change] + + multi: Fix compile warning on 64-bit systems + +Dan Fandrich (23 Aug 2010) +- Mention PolarSSL in tutorial & add some URLs to INSTALL + +Daniel Stenberg (23 Aug 2010) +- RESUME_FROM: clarify what ftp uploads do + + The numerical value passed to CURLOPT_RESUME_FROM for FTP uploads is + interpreted and used as position where to resume the _reading_ of the + local file and it will "blindly" append that data on the remote + file. This was certainly not clear in the docs previously. + + Reported by: catalin + Bug: http://curl.haxx.se/bug/view.cgi?id=3048174 + +- [Dirk Manske brought this change] + + Curl_is_connected: use correct errno + + The correctly extracted errno contents were mistakenly overwritten by a newer + value that wasn't the correct error value. + + Bug: http://curl.haxx.se/mail/lib-2010-08/0242.html + +- cmdline: make -F type= accept ;charset= + + The -F option allows some custom parameters within the given string, and + those strings are separated with semicolons. You can for example specify + "name=daniel;type=text/plain" to set content-type for the + field. However, the use of semicolons like that made it not work fine if + you specified one within the content-type, like for: + "name=daniel;type=text/plain;charset=UTF-8" + ... as the second one would be seen as a separator and "charset" is no + parameter curl knows anything about so it was just silently discarded. + + The new logic now checks if the semicolon and following keyword looks + like a parameter it knows about and if it isn't it is assumed to be + meant to be used within the content-type string itself. + + I modified test case 186 to verify that this works as intended. + + Reported by: Larry Stone + Bug: http://curl.haxx.se/bug/view.cgi?id=3048988 + +Guenter Knauf (20 Aug 2010) +- Added mk-ca-bundle.vbs script. + + The script works exactly same as the Perl one except for one thing: + when the text descriptions generated with openssl are included then + the md5 fingerprints are missing; seems openssl has either a bug or + a feature which prints the md5 fingerprint output to stdout instead + of writing them to specified file; this script could here do the same + as what the Perl scripr does (redirect stdout into file) but this + makes the script take up double the time because it needs to launch + cmd.exe 140 times (fo each openssl call). So I think for now we just + ommit the md5 fingerprints, and see if openssl will be fixed. + +- Trial to fix win32 autobuilds. + + It seems that its time to look at some better ideas for the win32 + non-configure builds; probably a prebuild target which copies + config-win32.h to curl_config.h and appends also then feature + defines like USE_ARES. + +Dan Fandrich (19 Aug 2010) +- Use the S_ISREG macro to determine what is a regular file + +Kamil Dudka (19 Aug 2010) +- AC_INIT: avoid a warning with autoconf 2.66 + + It was complaining about the '=>' operator, introduced in e3fc0d5. + +Dan Fandrich (18 Aug 2010) +- Fixed a memory leak during OOM in the multi timeout code + +- Removed a C99ism & made an array const + +Daniel Stenberg (19 Aug 2010) +- [Julien Chaffraix brought this change] + + test: added test 579 to verify progress callback for chunked post + + The 66 bytes checked are those 38 bytes with the chunked encoding + headers added: 8+8+10+35+5 = 66 + + The three-letter words become 8 bytes on the wire because they are sent + like: "3\r\none\r\n" + + ... and there's the trailing 5 bytes write after the four lines since + the final chunk is sent (which is "0\r\n\r\n"). + +- multi: avoid sending multiple complete messages + + I fell over this bug report that mentioned that libcurl could wrongly + send more than one complete messages at the end of a transfer. Reading + the code confirmed this, so I've added a new multi state to make it not + happen. The mentioned bug report was made by Brad Jorsch but is (oddly + enough) filed in Debian's bug tracker for the "wmweather+" tool. + + Bug: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=593390 + +- FAQ: update the list of supported protocols + +- FAQ: added blurb about ECCN + + "1.13 curl's ECCN number" is a new section mostly made up from + Alessandro Vesely's very informative ML post on the subject: + http://curl.haxx.se/mail/lib-2008-03/0251.html + +Guenter Knauf (18 Aug 2010) +- It is sufficient to pipe stderr to NUL to get rid of the nasty messages. + +- Added SSPI build to Watcom makefile. + +Daniel Stenberg (16 Aug 2010) +- [Julien Chaffraix brought this change] + + progress: callback for POSTs less than MAX_INITIAL_POST_SIZE + + Add a call to Curl_pgrsSetUploadSize in this case valided by a test + case. + + Reported by: Никита Дорохин. + Bug: http://curl.haxx.se/mail/lib-2010-04/0173.html + +Dan Fandrich (16 Aug 2010) +- Make the LD_PRELOAD path absolute in the tests that use it + + In some situations, libtool will change directories and perform + a link step before executing the libtest test app. Since + LD_PRELOAD is in effect for this entire process, the path to the + binary must be absolute so it will be valid no matter in which + directory the app is running. + +Daniel Stenberg (16 Aug 2010) +- negotiation: Wrong proxy authorization + + There's an error in http_negotiation.c where a mistake is using only + userpwd even for proxy requests. Ludek provided a patch, but I decided + to write the fix slightly different using his patch as inspiration. + + Reported by: Ludek Finstrle + Bug: http://curl.haxx.se/bug/view.cgi?id=3046066 + +Dan Fandrich (16 Aug 2010) +- Clear stdout and stderr files on each test run + + This allows a test to be run several times in the same test + session even when the -k option is given. + +Guenter Knauf (15 Aug 2010) +- Syncroniszed vclean target; fixed some comments. + +Daniel Stenberg (15 Aug 2010) +- THANKS: added contributors from 7.21.1 + +- multi: two fixes done + +- multi: use timeouts properly for MAX_RECV/SEND_SPEED + + When detecting that the send or recv speed, the multi interface changes + state to TOOFAST and previously there was no timeout set that would + force a recheck but it would rely on the application to somehow call + libcurl anyway. This now sets a timeout for a suitable future time to + check again if the average transfer speed is then below the threshold + again. + +- multi: support timeouts + + Curl_expire() is now expanded to hold a list of timeouts for each easy + handle. Only the closest in time will be the one used as the primary + timeout for the handle and will be used for the splay tree (which sorts + and lists all handles within the multi handle). + + When the main timeout has triggered/expired, the next timeout in time + that is kept in the list will be moved to the main timeout position and + used as the key to splay with. This way, all timeouts that are set with + Curl_expire() internally will end up as a proper timeout. Previously any + Curl_expire() that set a _later_ timeout than what was already set was + just silently ignored and thus missed. + + Setting Curl_expire() with timeout 0 (zero) will cancel all previously + added timeouts. + + Corrects known bug #62. + +- Curl_llist_insert_next: allow insertion first in the list + + When we specify the "insert after" entry as NULL, this function now + inserts the new entry first in the list. + +- multi: make curl_multi_info_read perform O(1) + + Instead of looping over all attached easy handles, this now keeps a list + of messages in the multi handle. It allows curl_multi_info_read() to + perform O(1) no matter how many easy handles that are handled. This is + of importance since this function may be polled very frequently by apps + using the multi interface. + +Kamil Dudka (15 Aug 2010) +- curl -T: ignore file size of special files + + original bug report at https://bugzilla.redhat.com/622520 + +Dan Fandrich (13 Aug 2010) +- Reset environment variables before starting servers + + Otherwise, variables from tests could affect the servers + themselves. + +Kamil Dudka (12 Aug 2010) +- typecheck-gcc: work around gcc upstream bug #32061 + + original bug report at https://bugzilla.redhat.com/617757 + +Daniel Stenberg (11 Aug 2010) +- release cycle loop: start over toward 7.21.2 + +Version 7.21.1 (11 Aug 2010) + +Daniel Stenberg (11 Aug 2010) +- RELEASE-NOTES: mention the runtests fix as well + +- runtests: clear old setenv remainders before test + + Due to the layout of the singletest function there are situations where + it returns before it clears the environment variables that were + especially set for the single specific test case. That could lead to + subsequent tests getting executed with environment variables sticking + around from a previous test which could lead to badness. + + This change makes sure to clear all custom variables that may be laying + around from a previous round, before running a test case. + + Reported by: Kamil Dudka + Bug: http://curl.haxx.se/mail/lib-2010-08/0141.html + +Guenter Knauf (11 Aug 2010) +- Added OpenSSL builds to Watcom makefiles. + +Yang Tse (11 Aug 2010) +- configure: werror related adjustments + +Daniel Stenberg (11 Aug 2010) +- FAQ: s/libcurl.so.3/libcurl.so.X + +Dan Fandrich (10 Aug 2010) +- KNOWN_BUG #59 is fixed. Clarify support of IPv6 zone IDs. + +- Fixed typo in Android configure command + +Daniel Stenberg (11 Aug 2010) +- HISTORY: added stuff from recent years + +- warning: silence the compiler + + warning: conversion to 'long int' from 'time_t' may alter its value + + ... on win64 when time_t is 64bit and long is 32bit. + +- RELEASE-NOTES: synced, 3 additional bugfixes + +- multi_socket_action: clarify how to kickstart it + + The callbacks are called when curl_multi_socket_action() is called, not + when handles are added. This is now mentioned in the "TYPICAL USAGE" + section. + +- callbacks: acknowledge progress callback error returns + + When the progress callback is called during the TCP connection, an error + return would accidentally not abort the operation as intended but would + instead be counted as a failure to connect to that particular IP and + libcurl would just continue to try the next. I made singleipconnect() + and trynextip() return CURLcode properly. + + Added bonus: it corrected the error code for bad --interface usages, + like tested in test 1084 and test 1085. + + Reported by: Adam Light + Bug: http://curl.haxx.se/mail/lib-2010-08/0105.html + +Guenter Knauf (10 Aug 2010) +- More Watcom makefile fixes ... + + Final fix (hopefully!) for dll wlink loader; + prefer faster internal rm if available. + +- Fixed my wrong edit. + +- More Watcom makefile fixes. + + Added the -br switch to dynamic builds which fixes the issue I saw + with curl's --version output. Added debug info and symfile for debug + builds to linker opts. Added DLL loader for wlink back, but this time + dependend on wlink version. + Patch posted to the list by malak.jiri AT gmail.com. + +- Changed test for -u switch in order to enable other wmake switches. + + The var %MAKEFLAGS is only set in 3 cases: if set as environment + var or as macro definition from commandline, and either with the + -u or -ms switch. Since all these cases are unlikely for the average + user it should be safe to only test if %MAKEFLAGS is defined; this + has the benefit that now all other switches can be used again in + addition to the -u which was formerly not possible. + +Daniel Stenberg (10 Aug 2010) +- llist: hide Curl_llist_init + + Curl_llist_init is never used outside of llist.c and thus it should be + static. I also removed the protos for Curl_llist_insert_prev and + Curl_llist_remove_next which are functions we removed from llist.c ages + ago. + +Guenter Knauf (10 Aug 2010) +- Added msys Perl since git for Win32 comes with own Perl which identifies as msys. + +- Updated lib dependency versions. + +- Make testcurl.pl Watcom-aware. + +Daniel Stenberg (10 Aug 2010) +- parse_remote_port: fix ;type= URL suffix over HTTP proxy + + Test 563 is enabled now and verifies that the combo FTP type=A URL, + CURLOPT_PORT set and proxy work fine. As a bonus I managed to remove the + somewhat odd FTP check in parse_remote_port() and instead converted it + to a better and more generic 'slash_removed' struct field. Checking the + ->protocol field isn't right since when an FTP:// URL is sent over a + HTTP proxy, the protocol is HTTP but the URL was handled by the FTP code + and thus slash_removed is set TRUE for this case. + +- indent: white space fixes only + +Yang Tse (9 Aug 2010) +- build: fix previous push + +- build: don't build libhostname unless shared libcurl is built + +- build: libhostname and chkhostname linkage adjustments followup + +Daniel Stenberg (8 Aug 2010) +- typo: remove duplicate semicolon + +- multi: avoid a malloc() when a transfer is complete + + The struct used for storing the message for a completed transfer is now + no longer allocated separatly but is kept within the main struct kept + for each easy handle so that we avoid one malloc (and the subsequent + free). + +Yang Tse (8 Aug 2010) +- build: libhostname linkage adjustments followup + +Guenter Knauf (7 Aug 2010) +- Fix to overwrite libcurl name. + +Yang Tse (7 Aug 2010) +- build: chkhostname build adjustments followup + +U-D5B1PQ1J\Administrador (7 Aug 2010) +- build: allow NTLM tests to run on more build configurations + +Daniel Stenberg (7 Aug 2010) +- curl_easy_setopt.3: rename stream to userdata + + In some places where the name 'stream' has been used for naming a + function argument that is in fact settable with a setopt() option we now + call that argument 'userdata' to make it more obvious that it is in fact + possible to set by the application. + + Suggested by: Jeff Pohlmeyer + +Guenter Knauf (7 Aug 2010) +- Block created curlbuild.h for NetWare to avoid usage from other platforms. + +Daniel Stenberg (7 Aug 2010) +- RELEASE-NOTES: synced with recent changes + +Yang Tse (6 Aug 2010) +- build: ensure that libhostname doesn't get installed + +Daniel Stenberg (6 Aug 2010) +- multi_socket: set timeout for 100-continue + + When libcurl internally decided to wait for a 100-continue header, there + was no call to the timeout function so there was no timeout callback + called when the multi_socket API was used and thus applications became + either completely wrong or at least ineffecient depending on how they + handled the situation. We now set a timeout to get triggered. + + Reported by: Ben Darnell + Bug: http://curl.haxx.se/bug/view.cgi?id=3039744 + +Guenter Knauf (6 Aug 2010) +- Some more Watcom makefile massage ... + + For now removed the .autodepend directive until I've figured out + which of my changes broke it again. + +Yang Tse (5 Aug 2010) +- build: fix libssh2_scp_send64() availability + +- build: remove unneeded cast to (void *) + +- build: remove unused file + +Daniel Stenberg (4 Aug 2010) +- SCP: send large files properly with new enough libssh2 + + libssh2 1.2.6 and later handle >32bit file sizes properly even on 32bit + architectures and we make sure to use that ability. + + Reported by: Mikael Johansson + Bug: http://curl.haxx.se/mail/lib-2010-08/0052.html + +Yang Tse (3 Aug 2010) +- build: add missing new files to non-configure target build files + +- md4: replace bcopy usage with memcpy + +Daniel Stenberg (3 Aug 2010) +- RELEASE-NOTES: synced with recent changes + +- TODO-RELEASE: clear, file not really used ATM + +- typecheck-gcc: add checks for recently added options + + I added all OBJECTPOINT curl_easy_setopt() options from 178 to 202. Left + to add: the five FUNCTIONPOINT (callbacks) options added since: + + SSH_KEYFUNCTION + INTERLEAVEFUNCTION + CHUNK_BGN_FUNCTION + CHUNK_END_FUNCTION + FNMATCH_FUNCTION + +- .gitignore: ignore all built examples + +- example: fix code to build warning-free + +- Curl_connected_proxy: skip the bits.tcpconnect check + + Simply because the TCP might be connected already we cannot skip the + proxy connect procedure. We need to be careful to not overload more + meaning to the bits.tcpconnect field like this. + + With this fix, SOCKS proxies work again when the multi interface is + used. I believe this regression was added with commit 4b351d018e, + released as 7.20.1. + + Left todo: add a test case that verifies this functionality that + prevents us from breaking it again in the future! + + Reported by: Robin Cornelius + Bug: http://curl.haxx.se/bug/view.cgi?id=3033966 + +- sethostname: provide local prototype for gethostname + + This is only to avoid warnings on some systems. + +- build: add typecast to avoid warning + + There is an implicit conversion from "unsigned long" to "long"; + rounding, sign extension, or loss of accuracy may result. + +Guenter Knauf (2 Aug 2010) +- Rename CURL_SOURCES macro; revert previous rename of curl_SOURCES macro. + +- Removed ugly dependency lists since wmake knows the .autodepend directive. + +- Use suffix search path for sources in lib folder. + +- Changed src/Makefile.Watcom to use CURL_SOURCES from src/Makefile.inc. + +- Renamed curl_SOURCES to CURL_ALLFILES to overcome wmake's case-insensitivity. + +- Removed wlink from DLL loader list because it doesnt work with Watcom < 1.8. + +- Moved the LDAP API defines from Makefile.Watcom to config-win32.h. + + These defines are only needed for older Watcom versions (< 1280). + +Daniel Stenberg (2 Aug 2010) +- retry: consider retrying even if -f is used + + The --retry logic does retry HTTP when some specific response codes are + returned, but because the -f option sets the CURLOPT_FAILONERROR to + libcurl, the return codes are different for such situations and then the + curl tool failed to consider it for retrying. + + Reported by: Mike Power + Bug: http://curl.haxx.se/bug/view.cgi?id=3037362 + +- multi: fix FTPS connecting the data connection with OpenSSL + + Commit 496002ea1cd76af7f (released in 7.20.1) broke FTPS when using the + multi interface and OpenSSL was used. The condition for the non-blocking + connect was incorrect. + + Reported by: Georg Lippitsch + Bug: http://curl.haxx.se/mail/lib-2010-07/0270.html + +Guenter Knauf (1 Aug 2010) +- Fixed curlbuild.h rule. + +- Added rule to create curlbuild.h if not present (for builds from git). + +- Added dependend libs for curl static linking. + +- Fixed curl.exe static linking. + +Daniel Stenberg (30 Jul 2010) +- warning: silence a win64 compiler warning + + conversion from 'size_t' to 'curl_socklen_t', possible loss of data + + Reported by: Adam Light + +- KNOWN_BUG: The SOCKET type in Win64 is 64 bits + + The SOCKET type in Win64 is 64 bits large (and thus so is curl_socket_t + on that platform), and long is only 32 bits. It makes it impossible for + curl_easy_getinfo() to return a socket properly with the + CURLINFO_LASTSOCKET option as for all other operating systems. + +- smtp_connect: always provide host name buffer + + Previously the host name buffer was only used if gethostname() exists, + but since we converted that into a curl private function that function + always exists and will be used so the buffer needs to exist for all + cases/systems. + +- sethostname: avoid including unistd.h to duck for warnings + +- sethostname: ISO C does not allow extra `;' outside of a function + +- [Kamil Dudka brought this change] + + NTLM tests: boost coverage by forcing the hostname + + A shared library tests/libtest/.libs/lihostname.so is preloaded in NTLM + test-cases to override the system implementation of gethostname(). It + makes it possible to test the NTLM authentication for exact match, and + this way test the implementation of MD4 and DES. + + If LD_PRELOAD doesn't work, a debug build willl also workk as debug + builds are now made to prefer a specific environment variable and will + then return that content as host name instead of the actual one. + + Kamil wrote the bulk of this, Daniel Stenberg polished it. + +Guenter Knauf (29 Jul 2010) +- Added a comment with an alternate idea to avoid the backslash line contination character. + +- Changed comparison to match size_t var type. + +- Removed unused vars to avoid compiler warnings. + +- Make Watcom makefiles use Makefile.inc to reduce future maintainance. + + lib/Makefile.Watcom works fine already, for src/Makefile.Watcom we + need first to tweak src/Makefile.inc a bit - therefore the handtweaked + list still exists for now. + +- Watcom makefiles overhaul. + + - make both libcurl and curl makefiles use register calling convention + (previously libcurl had stack calling convention). + - added include paths to the Watcom headers so its no longer required + to set the environment vars for this. + - added -wcd=201 to supress compiler warning about unreachable code. + - use macros for all tools, and removed dependency on GNU tools like rm. + - make ipv6 and debug builds controlable via env vars and so make them + optional instead of default. + - commented WINLDAPAPI and WINBERAPI since they broke with OW 1.8, and + it seems they're not needed (anymore?). + - added rule for hugehelp.c.cvs so that it will be created when not + already exist - this is required for building from a release tarball + since there we have no hugehelp.c.cvs, thus compilation broke. + - removed C_ARG creation from lib/Makefile.Watcom and use CFLAGS + directly as done too in src/Makefile.Watcom - this has the benefit + that we will see all active cflags and defines during compile. + - added LINK-ARG to src/Makefile.Watcom in order to better control + linker input. + - a couple of other minor makefile tweaks here and there ... + - added largefile support for Watcom builds to config-win32.h. Not yet + tested if it really works, but should since Win32 supports it. + - added loaddll stuff to speed up builds if supported. + +- some cosmetic changes. + +Dan Fandrich (26 Jul 2010) +- Added md4.c to the Watcom makefile + +- Added PolarSSL to the docs + +Daniel Stenberg (25 Jul 2010) +- curl-config: --built-shared returns shared info + + The curl-config now features a --built-shared command line option that + will output 'yes' or 'no' depending if the build process was asked to + build shared library/libraries or not. + + It is primarily made to offer more details to the test suite to know + what kind of stunts it can expect to work. + +- add_buffer_send: fix compiler warning + + Win64's 32 bit long but 64 bit size_t caused a warning that we avoid + with a typecast. A small whitespace indent fix was also applied. + + Reported by: Adam Light + +Guenter Knauf (22 Jul 2010) +- Updated library versions. + +- Fixed script version which was still based on CVS Revision tag. + +Dan Fandrich (21 Jul 2010) +- FAQ: Why doesn't cURL error out when the cable is unplugged? + + This one was long overdue to be mentioned in the FAQ. Also, mention the + new ftp wildcard downloading feature. + +Daniel Stenberg (21 Jul 2010) +- [Ben Greear brought this change] + + ssh: Fix compile error on 64-bit systems. + + Signed-off-by: Ben Greear + +- [Ben Greear brought this change] + + build: Enable configure --enable-werror + + This passes -Werror to gcc when building curl and libcurl, + allowing easy dection of compile warnings. + + Signed-off-by: Ben Greear + +- [Ben Greear brought this change] + + pingpong: Fix indentation (whitespace change only) + + Signed-off-by: Ben Greear + +- [Jan Van Boghout brought this change] + + CUSTOMREQUEST: shouldn't be disabled when HTTP is disabled + + ... since FTP is using it as well, and potentially other protocols! + + Also, an #endif CURL_DISABLE_HTTP was incorrectly marked, as it seems to + end the proxy block instead. + +- [Jan Van Boghout brought this change] + + pingpong: response_time is milliseconds + + Fixed the comment/document for the response_time struct member. + +- [Jan Van Boghout brought this change] + + ftp: response timeout bug in "quote" sending + + The FTP implementation was missing a timestamp reset point, making the + waiting for responses after sending a post-transfer "QUOTE" command not + working as supposedly. This bug was introduced in 7.20.0 + +- [Jeff Pohlmeyer brought this change] + + remote-header-name: chop filename at next semicolon + + The --remote-header-name option for the command-line tool assumes that + everything beyond the filename= field is part of the filename, but that + might not always be the case, for example: + + Content-Disposition: attachment; filename=file.txt; modification-date=... + + This fix chops the filename off at the next semicolon, if there is one. + +- --retry: access violation with URL part sets continued + + When getting multiple URLs, curl didn't properly reset the byte counter + after a successful transfer so if the subsequent transfer failed it + would wrongly use the previous byte counter and behave badly (segfault) + because of that. The code assumes that the byte counter and the 'stream' + pointer is well in synch. + + Reported by: Jon Sargeant + Bug: http://curl.haxx.se/bug/view.cgi?id=3028241 + +- releasnote: synch up with commit f3b77e5611d + +- [Constantine Sapuntzakis brought this change] + + examples: add curl_multi_timeout + + Make the multi-interface using examples use curl_multi_timeout to + properly educate users how to do things. + +- configure: document the STATICLIB variable + +- [Constantine Sapuntzakis brought this change] + + multi: fix condition that remove timers before trigger + + curl_multi perform has two phases: run through every easy handle calling + multi_runsingle and remove expired timers (timer removal). + + If a small timer (e.g. 1-10ms) is set during multi_runsingle, then it's + possible that the timer has passed by when the timer removal runs. The + timer which was just added is then removed. This will potentially cause + the timer list to be empty and cause the next call to curl_multi_timeout + to return -1. Ideally, curl_multi_timeout should return 0 in this case. + + One way to fix this is to move the struct timeval now = Curl_tvnow(); to + the top of curl_multi_perform. The change does that. + +- [Constantine Sapuntzakis brought this change] + + threaded resolver: fix timeout issue + + Reset old timer first so we can set a new one further in the future. + +- configure: allow environments variable to override internals + + configure checks for grep, egrep, sed and ar and set the variables GREP, + EGREP, SED and AR accordingly. We now let already set variables override + the internal choices to let users make decisions when they know the + right choice already. This is a regression as our configure script used + to allow this back before commit 0b57c475 (up to 7.18.2). + + Reported by: "kdekker" + Bug: http://curl.haxx.se/bug/view.cgi?id=3028318 + +Dan Fandrich (9 Jul 2010) +- Improved the Android build instructions + +Daniel Stenberg (7 Jul 2010) +- [Tor Arntsen brought this change] + + upload: Avoid infinite loop when checking for auth bits + + The test would loop forever if authtype bit 0 wasn't set. + +- upload: warn users trying to upload from stdin with anyauth + + Since uploading from stdin is very likely to not work with anyauth and + its multi-phase probing for what authentication to actually use, alert + the user about it. Multi-phase negotiate almost certainly will involve + sending data and thus libcurl will need to rewind the stream to send + again, and it cannot do that with stdin. + +- http: don't enable chunked during authentication negotiations + + As mentioned in bug report #2956968, the HTTP code wouldn't send the + first empty chunk during the auth negotiation phase of the HTTP request + sending, so the server would wait for data to come and libcurl would + wait for data to arrive... I've made the code not enable chunked + encoding until the auth negotiation is done and thus this scenario + doesn't occur anymore. + + Reported by: Sidney San Martn + Bug: http://curl.haxx.se/bug/view.cgi?id=2956968 + +- --libcurl: list the tricky options instead of using [REMARK] + + I think the [REMARK] and commented function calls cluttered the code a + bit too much and made the generated code ugly to read. Now we instead + track the remarks one specially and just lists them at the end of the + generated code more as additional information. + +- curl: avoid setting libcurl options to its default + + it makes the --libcurl output easier to follow. + +- --libcurl: hide setopt() calls setting default options + + And additionally, don't show function or object pointers actual value + since they make no sense to anyone. Show 'functionpointer' and + 'objectpointer' instead. + +- --libcurl: use *_LARGE options with typecasted constants + + In the generated code --libcurl makes, all calls to curl_easy_setopt() + that use *_LARGE options now have the value typecasted to curl_off_t, so + that it works correctly for 32bit systems with 64bit curl_off_t type. + +- multi: CURLINFO_LASTSOCKET doesn't work after remove_handle + + When curl_multi_remove_handle() is called and an easy handle is returned + to the connection cache held in the multi handle, then we cannot allow + CURLINFO_LASTSOCKET to extract it since that will more or less encourage + that the user uses the socket while it can get used by libcurl again. + + Without this fix, we'd get a segfault in Curl_getconnectinfo() trying to + dereference the NULL pointer in 'data->state.connc'. + + Bug: http://curl.haxx.se/bug/view.cgi?id=3023840 + +- [Pierre Joye brought this change] + + build: add enable IPV6 option for the VC makefiles + +- FAQ: the threaded resolver works universally now + +Kamil Dudka (30 Jun 2010) +- http_ntlm: add support for NSS + + When configured with '--without-ssl --with-nss', NTLM authentication + now uses NSS crypto library for MD5 and DES. For MD4 we have a local + implementation in that case. More details are available at + https://bugzilla.redhat.com/603783 + + In order to get it working, curl_global_init() must be called with + CURL_GLOBAL_SSL or CURL_GLOBAL_ALL. That's necessary because NSS needs + to be initialized globally and we do so only when the NSS library is + actually required by protocol. The mentioned call of curl_global_init() + is responsible for creating of the initialization mutex. + + There was also slightly changed the NSS initialization scenario, in + particular, loading of the NSS PEM module. It used to be loaded always + right after the NSS library was initialized. Now the library is + initialized as soon as any SSL or NTLM is required, while the PEM module + is prevented from being loaded until the SSL is actually required. + +Daniel Stenberg (29 Jun 2010) +- glob: backslash escaping bug + + curl didn't properly handle escaping characters in a URL with the use of + backslash. It did an attempt, but that failed as reported in bug + 3022551. The described example was using the URL + "http://example.com?{AB,C\,D}". + + I've now removed the special-handling of letters following the backslash + and I also removed the bad extra check that triggered this particular + bug. + + Bug: http://curl.haxx.se/bug/view.cgi?id=3022551 + Reported by: Jon Sargeant + +- release-notes: sync up with recent commits + +- CONTRIBUTE: the git commit message line length is 72 columns + +- [Pavel Raiskup brought this change] + + ftp wildcard: FTP LIST parser FIX + + There was a problem when a UNIX-like server returned information + about directory size (total NNNNNN) at the first line of + response. + +- [Pavel Raiskup brought this change] + + examples: new FTP wildcard showcase + +- multi_socket: re-use of same socket without notifying app + + When a hostname resolves to multiple IP addresses and the first one + tried doesn't work, the socket for the second attempt may get dropped on + the floor, causing the request to eventually time out. The issue is that + when using kqueue (as on mac and bsd platforms) instead of select, the + kernel removes the first fd from kqueue when it is closed (in trynextip, + connect.c:503). Trynextip() then goes on to open a new socket, which + gets assigned the same number as the one it just closed. Later in + multi.c, socket_cb is not called because the fd is already in + multi->sockhash, so the new socket is never added to kqueue. + + The correct fix is to ensure that socket_cb is called to remove the fd + when trynextip() closes the socket, and again to re-add it after + singleipsocket(). I'm not sure how to cleanly do that, but the attached + patch works around the problem in an admittedly kludgy way by delaying + the close to ensure that the newly-opened socket gets a different fd. + + Daniel's added comment: I didn't spot a way to easily do a nicer fix so + I've proceeded with Ben's patch. + + Bug: http://curl.haxx.se/bug/view.cgi?id=3017819 + Patch by: Ben Darnell + +Kamil Dudka (24 Jun 2010) +- [Pavel Raiskup brought this change] + + ftp-wildcard: avoid tight loop when used without any pattern + + It was broken for URLs like "ftp://example.com/". + +Daniel Stenberg (21 Jun 2010) +- maketgz: produce CHANGES automatically with the 1000 most recent commits + + It passes the git log output through 'log2changes.pl' to produce + the lot. + +- ignore: CHANGES.dist gets generated by maketgz + +- CHANGES: move all contents from CHANGES to CHANGES.0 + + CHANGES is no longer used for manually edited content. It is to + be generated automatically by maketgz when we make release + tarballs. + +- log2changes: correct command line, fix tag usage, change Version output + + --decorate=full is needed with my git 1.7.1 to get the necessary + output so that the previous edit would work to extract the + Version stuff. + + ... but I had to edit how the refs/tags was extracted since it + had a little flaw that made it miss the 7.20.1 output. + + Finally, I changed so that Version is outputted even more similar + to how CHANGES does it. + +Dan Fandrich (21 Jun 2010) +- Make the output of log2changes.pl even more closely match CHANGES + + Add the ASCII art header, and list version commits by decoding + the ref tag names, when available (using the git log --decorate + option). + +Daniel Stenberg (19 Jun 2010) +- log2changes: first version of the git log to CHANGES conversion script + + $ git log --pretty=fuller --no-color --date=short | ./log2changes.pl + + Of course, limiting the log output with a range like with + "[tag]..HEAD" appended can be very useful too. + +- sendrecv: treat all negative values from send/recv as errors + + For example the libssh2 based functions return other negative + values than -1 to signal errors and it is important that we catch + them properly. Right before this, various failures from libssh2 + were treated as negative download amounts which caused havoc. + +- multi: prevent NULL pointer dereference + + My additional call to Curl_pgrsUpdate() would sometimes get + called even though there's no connection (left) so a NULL pointer + would get passed, causing a segfault. + +- smtp: fixed a few uses of size_t that seemed to believe it was signed + + Reported-by: Steven M. Schweda + +Dan Fandrich (17 Jun 2010) +- Fixed an OOM memory leak in the FTP wildcard code + +Kamil Dudka (17 Jun 2010) +- test575: do not fail with threaded DNS resolver + +Daniel Stenberg (17 Jun 2010) +- [Krister Johansen brought this change] + + multi: unmark handle as used when no longer head of pipeline + +- multi: call the progress function only once and allow abort + + 1) no need to call the progress function twice when in the + CURLM_STATE_TOOFAST state. + + 2) Make sure that the progress callback's return code is + acknowledged when used + +- multi: call the progress callback in all states + + As long as no error is reported, the progress function can get + called. This may be a little TOO often so we should keep an eye + on this and possibly make this conditional somehow. + +- configure: spell --disable-threaded-resolver correctly + + Previously we only accepted the option when named + --disable-threaded-resover, which wasn't quite intended. + + Reported by: Helwing Lutz + +- release: start on 7.21.1, bump contributor count + +- version: start working on the 7.21.1-dev version + +- THANKS: added contributors from the 7.21.0 release + +Version 7.21.0 (16 Jun 2010) + +Daniel Stenberg (16 Jun 2010) +- release: 7.21.0 + +Yang Tse (10 Jun 2010) +- remove unused 'tmpdata' and 'backup' ftp_parselist_data struct members + +- replace isprint() with ISPRINT() + +- ensure that Curl_wildcard_dtor() leaves WildcardData struct zero initialized + +Patrick Monnerat (9 Jun 2010) +- ILE/RPG binding updated to current curl.h definitions. + +Yang Tse (9 Jun 2010) +- code simplification + +- add Curl_ prefix to conform with cURL naming standards + +- Merge branch 'master' of git@github.com:bagder/curl + +- fix compiler warning using curl_socket_t to store socket descriptor + +Daniel Stenberg (8 Jun 2010) +- inet_pton: warnings: use size_t to store pointer deltas + +Yang Tse (8 Jun 2010) +- avoid redundant work when reusing same connection + +- fix function result checking + +Daniel Stenberg (8 Jun 2010) +- transfer: warning: implicit conversion + + There is an implicit conversion from "unsigned long" to "long"; + rounding, sign extension, or loss of accuracy may result. + + Fixed by an added typecast. + +- TFTP: fix compiler warning + + Curl_fillreadbuffer()'s second argument takes an int, so + typecasting to another is a bad idea. + +- TFTP: fix warning for sendto() usage on non-POSIX systems + + Older unixes want an 'int' instead of 'size_t' as the 3rd + argumment so before this change it would cause warnings such as: + + There is an implicit conversion from "unsigned long" to "int"; + rounding, sign extension, or loss of accuracy may result. + +Dan Fandrich (7 Jun 2010) +- Include Makefile.inc to get the list of source files for Amiga + + Signed-off-by: Diego Casorran + +Yang Tse (7 Jun 2010) +- Curl_updateconninfo() error handling fix + +Daniel Stenberg (5 Jun 2010) +- [Constantine Sapuntzakis brought this change] + + OpenSSL: fix spurious SSL connection aborts + + Was seeing spurious SSL connection aborts using libcurl and + OpenSSL. I tracked it down to uncleared error state on the + OpenSSL error stack - patch attached deals with that. + + Rough idea of problem: + + Code that uses libcurl calls some library that uses OpenSSL but + don't clear the OpenSSL error stack after an error. + + ssluse.c calls SSL_read which eventually gets an EWOULDBLOCK from + the OS. Returns -1 to indicate an error + + ssluse.c calls SSL_get_error. First thing, SSL_get_error calls + ERR_get_error to check the OpenSSL error stack, finds an old + error and returns SSL_ERROR_SSL instead of SSL_ERROR_WANT_READ or + SSL_ERROR_WANT_WRITE. + + ssluse.c returns an error and aborts the connection + + Solution: + + Clear the openssl error stack before calling SSL_* operation if + we're going to call SSL_get_error afterwards. + + Notes: + + This is much more likely to happen with multi because it's easier + to intersperse other calls to the OpenSSL library in the same + thread. + +Yang Tse (5 Jun 2010) +- replace socklen_t with curl_socklen_t + +Daniel Stenberg (5 Jun 2010) +- [Frank Meier brought this change] + + getinfo: added *_PRIMARY_PORT, *_LOCAL_IP and *_LOCAL_PORT + +- RELEASE-NOTES: add contributors not mentioned + +Yang Tse (4 Jun 2010) +- Enable OpenLDAP support for cygwin builds. + + Enable OpenLDAP support for cygwin builds. This support was disabled back + in 2008 due to incompatibilities between OpenSSL and OpenLDAP headers. + cygwin's OpenSSL 0.9.8l and OpenLDAP 2.3.43 versions on cygwin 1.5.25 + allow building an OpenLDAP enabled libcurl supporting back to Windows 95. + + Remove non-functional CURL_LDAP_HYBRID code and references. + +Kamil Dudka (2 Jun 2010) +- ftplistparser.c: oops, fix typo in the last commit + +- ftplistparser.c: avoid some invalid dereferences + +- lib: eliminate some dead code + +Daniel Stenberg (2 Jun 2010) +- SSH: corrected the inability to respect the timeout + + Jason McDonald posted bug report #3006786 when he found that the + SFTP code didn't timeout properly in several places in the code + even if a timeout was set properly. + + Based on his suggested patch, I wrote a different implementation + that I think addressed the issue better and also uses the connect + timeout for the initial part of the SSH/SFTP done during the + "protocol connect" phase. + + (http://curl.haxx.se/bug/view.cgi?id=3006786) + +Yang Tse (2 Jun 2010) +- mention last changes + +- add missing new files to non-configure target build files + +- include libcurl standard internal headers + +Daniel Stenberg (2 Jun 2010) +- TODO: add multi interface improvement remove ldap select + +Yang Tse (2 Jun 2010) +- make setup.h first included file + +- fix spnego memory leak + +- openldap header inclusions fix + +Daniel Stenberg (1 Jun 2010) +- multi_socket: handles timer inaccuracy better for timeouts + + Igor Novoseltsev reported a problem with the multi socket API and + using timeouts and timers. It boiled down to a problem with + libcurl's use of GetTickCount() interally to figure out the + current time, while Igor's own application code used another + function call. + + It made his app call the socket API timeout function a bit + _before_ libcurl would consider the timeout to trigger, and that + could easily lead to timeouts or stalls in the app. It seems + GetTickCount() in general often has no better resolution than + 16ms and switching to the alternative function + QueryPerformanceCounter has its share of problems: + http://www.virtualdub.org/blog/pivot/entry.php?id=106 + + We address this problem by simply having libcurl treat timers + that already has occured or will occur within 40ms subject for + treatment. I'm confident that there are other implementations and + operating systems with similarly in accurate timer functions so + it makes sense to have applied generically and I don't believe we + sacrifice much by adding a 40ms inaccuracy on these timeouts. + +Yang Tse (1 Jun 2010) +- fix ldaps option issue + +- fix ldap related compilation issues + +- fix compiler warning: enumerated type mixed with another type + +- fix compiler warning: enumerated type mixed with another type + +Patrick Monnerat (31 May 2010) +- smtp_authenticate: avoid compiler warnings + +Yang Tse (31 May 2010) +- fix compiler warning: enumerated type mixed with another type + +- fix compiler warning: enumerated type mixed with another type + +- fix compiler warning: enumerated type mixed with another type + +- fix compiler warning: external declaration in primary source file + +- fix compiler warning: variable was set but never used + +- fix compiler warning: enumerated type mixed with another type + +- fix compiler warning: external declaration in primary source file + +- update year in copyright notice + +Kamil Dudka (29 May 2010) +- strtoofft: rename CURL_LLONG_MIN -> CURL_OFF_T_MIN + + ... and CURL_LLONG_MAX -> CURL_OFF_T_MAX + +- CURL_LLONG_MAX: avoid constant overflow + + ... when (CURL_SIZEOF_CURL_OFF_T == 4) + +Daniel Stenberg (28 May 2010) +- [Howard Chu brought this change] + + LDAPS: list availability depending on SSL's presence + +- [Howard Chu brought this change] + + LDAP: make it build without SSL if no such support is available + + of course it also goes for the case where SSL is explicitly + disabled + +- TODO: removed fixed items + + These two items are now actually implemented: + + 11.1 Content-Disposition + 11.5 ftp wildcard download + +Kamil Dudka (28 May 2010) +- lib: eliminate 'statement not reached' warnings + +Daniel Stenberg (28 May 2010) +- test1115: verify that unexpected 1xx responses work fine + +Kamil Dudka (28 May 2010) +- lib577: avoid redefinition of ERROR + +- test313: a new test for CRL support + +- tests/certs: re-generated because of lost pass-phrase + +- tests/certs/scripts: generate also CRL + + ... and make it possible to do so without any user interaction + +Daniel Stenberg (27 May 2010) +- [Howard Chu brought this change] + + openldap: fix compiler warnings + +- indent: some whitespace edits + +Kamil Dudka (27 May 2010) +- wildcard.c: add missing include of "setup.h" + +- [Tor Arntsen brought this change] + + lib573: do not compare double for exact match + +- [Pavel Raiskup brought this change] + + wildcard.c: add missing include of "curl_memory.h" + +- [Tor Arntsen brought this change] + + setup_once: use enum type for 'bool' on non-C99 platforms + + An enum will catch non-bool assignments to bool on platforms with + a strict compiler, e.g MIPSPro. + + Signed-off-by: Kamil Dudka + +- url.c: avoid implied cast to bool + +- [Tor Arntsen brought this change] + + curl_fnmatch: remove use of register keyword + + Using the 'register' keyword rarely improves anything with modern + compilers and architectures. + +Daniel Stenberg (26 May 2010) +- [Julien Chaffraix brought this change] + + RTMP: Fix compiler warnings + +- [Julien Chaffraix brought this change] + + OOM fixes in http_negociate.c and lib/splay.c + + Fix 2 OOM errors: a missing NULL-check in lib/http_negociate.c + and a potential NULL dereferencing in lib/splay.c + +- [Howard Chu brought this change] + + LDAP: properly implemented as a curl_handler + + makes the LDAP code much cleaner, nicer and in general being a + better libcurl citizen. If a new enough OpenLDAP version is + detect, the new and shiny lib/openldap.c code is then used + instead of the old cruft + + Code by Howard, minor cleanups by Daniel. + +- [Tor Arntsen brought this change] + + curl_fnmatch: Use int not bool when function returns int + + bool in curl internals is unsigned char and should not be used + to receive return value from functions returning int - this fails + when using IBM VisualAge and Tru64 compilers. + +- TFTP: send legal timeout value + + Eric Mertens posted bug #3003705: when we made TFTP use the + correct timeout option when sent to the server (fixed May 18th + 2010) it became obvious that libcurl used invalid timeout values + (300 by default while the RFC allows nothing above 255). While of + course it is obvious that as TFTP has worked thus far without + being able to set timeout at all, just removing the setting + wouldn't make any difference in behavior. I decided to still keep + it (but fix the problem) as it now actually allows for easier + (future) customization of the timeout. + + (http://curl.haxx.se/bug/view.cgi?id=3003705) + +- TFTP: don't ack if wrong block num is received + + If an unexpected block number was received, break out of the + switch loop. + +- TFTP: block id wrap bug fix + + In a normal expression, doing [unsigned short] + 1 will not wrap + at 16 bits so the comparisons and outputs were done wrong. I + added a macro do make sure it gets done right. + + Douglas Kilpatrick filed bug report #3004787 about it: + http://curl.haxx.se/bug/view.cgi?id=3004787 + +- [Ben Greear brought this change] + + Fix build warnings. + + Signed-off-by: Ben Greear + +- [Ben Greear brought this change] + + setopt: Fix setting of set.is_fwrite_set + + Signed-off-by: Ben Greear + +- [Tanguy Fautre brought this change] + + build: allow curl to build with Microsoft VC10 + + By undefing a bunch of E* defines that VC10 has started to define + but that we redefine internally to their WSA* alternatives when + building for Windows. + +Kamil Dudka (20 May 2010) +- [Tor Arntsen brought this change] + + Test 573: Use correct type for CURLINFO_CONNECT_TIME + + curl_easy_getinfo() called with a pointer to long instead of double + would sigbus on RISC processors (e.g. MIPS) due to wrong alignment + of pointer address. + +- [Tor Arntsen brought this change] + + lib: Fix AIX build failure + +Dan Fandrich (19 May 2010) +- Fixed some memory leaks in the POP3 torture tests + +- Fixed a memory leak in the SMTP torture tests + +Daniel Stenberg (18 May 2010) +- TFTP: send timeout option correctly + + Eric Mertens posted bug report #3003005 pointing out that the + libcurl TFTP code was not sending the timeout option properly to + the server, and suggested a fix. + + (http://curl.haxx.se/bug/view.cgi?id=3003005) + +Kamil Dudka (16 May 2010) +- [Tor Arntsen brought this change] + + lib: Change some CRLF line endings to LF + + An update had added a couple of lines with DOS line endings, + and some compilers will choke on that (e.g. the Tru64 compiler). + +- ftp wildcard: a new option CURLOPT_FNMATCH_DATA + +Daniel Stenberg (15 May 2010) +- [Howard Chu brought this change] + + RMTP: the version code is now rtmp aware + +- [Howard Chu brought this change] + + RTMP: fix wrong #ifdef + +- [Pavel Raiskup brought this change] + + ftp wildcard: fix int32_t and size/group mixups + +Dan Fandrich (14 May 2010) +- Fixed test 577 to work when --enable-hidden-symbols is configured + +Daniel Stenberg (14 May 2010) +- OpenSSL: multi interface handshake could hang + + John-Mark Bell filed bug #3000052 that identified a problem (with + an associated patch) with the OpenSSL handshake state machine + when the multi interface is used: + + Performing an https request using a curl multi handle and using + select or epoll to wait for events results in a hang. It appears + that the cause is the fix for bug #2958179, which makes + ossl_connect_common unconditionally return from the step 2 loop + when fetching from a multi handle. + + When ossl_connect_step2 has completed, it updates + connssl->connecting_state to ssl_connect_3. ossl_connect_common + will then return to the caller, as a multi handle is in + use. Eventually, the client code will call curl_multi_fdset to + obtain an updated fdset to select or epoll on. For https + requests, curl_multi_fdset will cause https_getsock to be called. + https_getsock will only return a socket handle if the + connecting_state is ssl_connect_2_reading or + ssl_connect_2_writing. Therefore, the client will never obtain a + valid fdset, and thus not drive the multi handle, resulting in a + hang. + + (http://curl.haxx.se/bug/view.cgi?id=3000052) + +- changelog: add link to bug report + +Dan Fandrich (14 May 2010) +- Added directories.pm to the source tar ball + +Daniel Stenberg (14 May 2010) +- follow redirect: ignore response-body on redirect even if compressed + + Sebastian V reported bug #3000056 identifying a problem with + redirect following. It showed that when curl followed redirects + it didn't properly ignore the response body of the 30X response + if that response was using compressed Content-Encoding! + + (http://curl.haxx.se/bug/view.cgi?id=3000056) + +- version: we're now going for 7.21.0 + +- [Hoi-Ho Chan brought this change] + + Remove support for BSD version of PolarSSL + + "The BSD version of PolarSSL was made for migratory purposes only and is not + maintained. The GPL version of PolarSSL is actually the only actively + developed version, so I would be very reluctant to use the BSD version." / + Paul Bakker, PolarSSL hacker. + + Signed-off-by: Hoi-Ho Chan + +Dan Fandrich (12 May 2010) +- Added Polar SSL and RTMP files to the non-autoconf build files + + I didn't bother with a few that have little hope of running the required + dependent libraries. + +- Added the new ftp source files to the non-autoconf build files + +- Copy the license file so it's seen by the Android build system + +Daniel Stenberg (13 May 2010) +- updated with symbols added in recent commits for 7.21.0 + +- changelogs: mention RTMP and the FTP wildcard support + +- ftp wildcards: mention they're added in 7.21.0 + +- style: minor whitespace change + +- syntax: cleanups + +- [Pavel Raiskup brought this change] + + FTP: WILDCARDMATCH/CHUNKING/FNMATCH added + +- [Howard Chu brought this change] + + RTMP: initial support added, powered by librtmp + + librtmp is found at http://rtmpdump.mplayerhq.hu/ + +- [Howard Chu brought this change] + + sendrecv: make them two pairs of send/recv to properly deal with FTPS + + FTP(S) use two connections that can be set to different recv and + send functions independently, so by introducing recv+send pairs + in the same manner we already have sockets/connections we can + work with FTPS fine. + + This commit fixes the FTPS regression introduced in change d64bd82. + +Kamil Dudka (11 May 2010) +- changelog: fixed CRL support in libcurl-NSS + +- nss: make it possible to read ASCII and DER CRL + +- nss: add CRL to cache instead of read-only NSS db + +Daniel Stenberg (10 May 2010) +- git: how to write a fine commit message + +- findtool: file name as a full path requires a slash + + Kalle Vahlman's patch applied a while ago broke how the findtool + function searches for tools, as it would always check if "$file" + was present first, which thus made the bad assumption that a file + in the current directory would be a match. + + I noticed when it found 'libtool' in the current directory but + libtoolize is not there, which confused the script. + +Hacki (8 May 2010) +- moved vars into conditional since seems that winsock implementation doesnt use them. + +Daniel Stenberg (7 May 2010) +- multi interface: missed storing connection time + + Dirk Manske reported a regression. When connecting with the multi + interface, there were situations where libcurl wouldn't store + connect time correctly as it used to (and is documented to) do. + + Using his fine sample program we could repeat it, and I wrote up + test case 573 using that code. The problem does not easily show + itself using the local test suite though. + + The fix, also as suggested by Dirk, is a bit on the ugly side as + it adds yet another call to Curl_verboseconnect() and setting the + TIMER_CONNECT time. That situation is subject for some closer + inspection in the future. + +- verboseconnect: so the verbose checking within the function + + As the function is used more than once and libcurl can be built + without it, do the conditional check within the verboseconnect() + function itself. + +- changelogs: split the I/O handling + +- [Howard Chu brought this change] + + sendrecv: split the I/O handling into private handler + + Howard Chu brought the bulk work of this patch that properly + moves out the sending and recving of data to the parts of the + code that are properly responsible for the various ways of doing + so. + + Daniel Stenberg assisted with polishing a few bits and fixed some + minor flaws in the original patch. + + Another upside of this patch is that we now abuse CURLcodes less + with the "magic" -1 return codes and instead use CURLE_AGAIN more + consistently. + +- changelog: PolarSSL + +- [Hoi-Ho Chan brought this change] + + PolarSSL: initial support added + + This is Hoi-Ho Chan's patch with some minor fixes by me. There + are some potential issues in this, but none worse than we can + sort out on the list and over time. + +- TODO: we've done PRET already, consider HOST for the future + + ... and GnuTLS connects are non-blocking, TFTP is better + integrated as a "real" protocol and RTSP is supported. + +- TODO: GnuTLS connects are now non-blocking + + Since commit c288860 by Jerome Vouillon + +- INTERNALS: tftp is decent now, ldap is not + + It's not quite fair to list TFTP is a "crappy" member of the + libcurl family so I removed its mentioning. + +- changelog: mention Ben Greear's telnet work + +- [Ben Greear brought this change] + + telnet: Allow programatic use of telnet. + + The main change is to allow input from user-specified methods, + when they are specified with CURLOPT_READFUNCTION. + All calls to fflush(stdout) in telnet.c were removed, which makes + using 'curl telnet://foo.com' painful since prompts and other data + are not always returned to the user promptly. Use + 'curl --no-buffer telnet://foo.com' instead. In general, + the user should have their CURLOPT_WRITEFUNCTION do a fflush + for interactive use. + + Also fix assumption that reading from stdin never returns < 0. + Old code could crash in that case. + + Call progress functions in telnet main loop. + + Signed-off-by: Ben Greear + +- test: enable valgrind for 604, seems to work + +Kamil Dudka (28 Apr 2010) +- [Paul Howarth brought this change] + + add 1s post-command delay to tests 513 and 514 + + addressing http://curl.haxx.se/mail/lib-2009-12/0031.html + +Daniel Stenberg (26 Apr 2010) +- [Kalle Vahlman brought this change] + + Allow tools to be defined with full path in buildconf + + This is required in Scratchbox where + LIBTOOL=/targets/links/arch_tools/bin/libtool + is set in the environment. + +- progress callback: can be called more than once per sec + +- SSH: init and cleanup libssh2 in global_init/cleanup + + The necessary libssh2 functions require libssh2 1.2.5 or later. + +- new configure option --enable-threaded-resolver + +- configure: check for libssh2_init and libssh2_exit + +Kamil Dudka (24 Apr 2010) +- nss: fix SSL handshake timeout underflow + +Guenter Knauf (24 Apr 2010) +- encourage users to take latest lib dependencies. + +Daniel Stenberg (24 Apr 2010) +- socks5: please static code analyzer + + Make sure we don't call memcpy() if the argument is NULL even + though we also passed a zero length then, as the clang analyzer + whined and we want to limit warnings (even false positives) when + they're this easy to fix. + + The change of (char) to (unsigned char) will fix long user names + and passwords on systems that have the char type signed by + default. + +- gzip: Value stored to 'data' is never read + +- RELEASE-NOTES: update top numbers + +- changelog: added the --proto and -proto-redir options + +- [Alex Bligh brought this change] + + curl: added --proto and --proto-redir + + --proto tells curl to use the listed protocols for its initial + retrieval + + --proto-redir tells curl to use the listed protocols after a + redirect + +Kamil Dudka (24 Apr 2010) +- test536: do not fail with threaded DNS resolver + + Also tweaked comments in certain examples using curl_multi_fdset(). + +Daniel Stenberg (21 Apr 2010) +- curl: -O crash on windows + + The -O option caused curl to crash on windows and DOS due to the + tool writing out of boundary memory. + +Yang Tse (20 Apr 2010) +- hmac.c related compilation adjustment + +- hmac.c related compilation adjustment + +monnerat (20 Apr 2010) +- Add compilation directives for hmac in Watcom,riscos and vc6 platform-specific makefiles. + +Yang Tse (20 Apr 2010) +- [Ruslan Gazizov brought this change] + + replaced wsock32.lib usage with ws2_32.lib in MSVC makefiles + +monnerat (19 Apr 2010) +- Merge branch 'master' of github.com:bagder/curl + +- Remove null-effect leftover code. + +Daniel Stenberg (19 Apr 2010) +- changelog: -J/--remote-header-name strips CRLF + +- parse_filename: strip trailing CRs and LFs + + The feature that uses the file name given in a + Content-disposition: header didn't properly skip trailing + carriage returns and linefeed characters from the end of the file + name when it was given without quotes. + +- Curl_HMAC_MD5: fix the array init to not warn with picky compilers + +monnerat (19 Apr 2010) +- Fix GnuTLS compilation problem in md5.c + +- Fix compilation problem: declare Curl_HMAC_MD5 as extern in include file. + +- Merge branch 'master' of github.com:bagder/curl + +- Implement SMTP authentication + +Daniel Stenberg (17 Apr 2010) +- parseconfig: Value stored to 'line' is never read + + Make the function call with (void) as we don't care about the + return code. + +- parsedate: Value stored to 'found' is never read + +- check_gzip_header: Value stored to 'data' is never read + +- dprintf_formatf: Value stored to 'left' is never read + +- curl_version: remove superfluous assignments + +- FTP PORT: Value stored to 'rc' is never read + +- Curl_setup_transfer: no longer returns anything + + This function could only return CURLE_OK and by changing it to + a void instead, we can simplify code all over. + +- PASV response: Value stored to 'rc' is never read + +- Curl_perform: Value stored to 'res2' is never read + +- sftp range: remove unnecessary check for NULL pointer + +- ftp_range: remove unnecessary check for NULL pointer + +- file_range: remove unnecessary check for NULL pointer + +- SOCKS4: Value stored to 'rc' is never read + +- FTP PASV: Value stored to 'rc' is never read + +- ftp_range: Value stored to 'totalsize' is never read + + Simplified the code by removing a local variable completely. + +- SOCKS5: when name resolves fail return immediately + + This makes the code flow more obvious and reacts on the return + code properly, even if the code acted the same way before. + +- POP3: when USER command fails, don't even try PASS + +- tftp_rx: Value stored to 'sbytes' is never read + +- file_range: Value stored to 'totalsize' is never read + +- changelog: GnuTLS: SSL handshake phase is non-blocking + +- [Jerome Vouillon brought this change] + + GnuTLS: make the connection phase non-blocking + + When multi interface is used, the SSL handshake is no longer + blocking when GnuTLS is used. + +- krb5_auth: fix my previous change to compile + +unknown (16 Apr 2010) +- OS400 version V5R2M0 not supported anymore by IBM: default target release changed to V5R3M0. + +Daniel Stenberg (16 Apr 2010) +- changelog: GnuTLS fix, no reverse loopkups and fixed GSS detection + +- SSL_RECV: EOF is not an error here + + The recent overhaul of the SSL recv function made this treat a + zero returned from gnutls_record_recv() as an error, and this + caused our HTTPS test cases to fail. We leave it to upper layer + code to detect if an EOF is a problem or not. + +- [Paul Howarth brought this change] + + configure: GSSAPI detection on ancient Linux distros + + On some ancient distributions such as RHEL-3, needs + to be processed after , but does not include it itself. + This patch checks for first and then includes it + in the test for , resolving the problem. + + Without the patch, is "present but cannot be + compiled". + +- resolvers: no more using AI_CANONNAME + + No resolver anymore needs to use AI_CANONNAME and do reverse + lookups. We should work hard to avoid having code that relies on + it. + +- KRB5: use given host name instead of reverse lookup'ed name + + This code would previously use dns_entry->addr->ai_canonname + instead of the given host name, which caused us grief and + problems since not all our resolver options do the reverse lookup + and I would also guess that it caused problems with KRB5/GSS with + virtual name-based hosts. Now the host name from the URL is used. + +Dan Fandrich (15 Apr 2010) +- Remove redundant conditional + +- Eliminated an unlikely race condition in some tests. + + Based on a patch from the FreeBSD ports by Peter Pentchev. + +Daniel Stenberg (15 Apr 2010) +- changelog: prevent needless reverse name lookups + +- Curl_ipv4_resolve_r: only set AI_CANONNAME when needed + + As reported in bug report #2987196, the code for ipv6 already did + the setting of this bit correctly so we copied that logic into + the Curl_ipv4_resolve_r() function as well. KRB code is the only + code we know that might need the cannonical name so only resolve + it for such requests! + +- IGNORE: files generated by maketgz + +- bumped to start the journey towards 7.20.2 + +- added contributors from the 7.20.1 RELEASE-NOTES + +- ignore files generated by 'maketgz' + +Version 7.20.1 (14 Apr 2010) + +Daniel Stenberg (14 Apr 2010) +- 7.20.1: 14 April 2010 + +Guenter Knauf (13 Apr 2010) +- Use correct directory for c-ares git pull + Signed-off-by: Tor Arntsen + +Yang Tse (13 Apr 2010) +- fix compiler warning: variable might be clobbered by longjmp or vfork + +Guenter Knauf (13 Apr 2010) +- added last git commit output for c-ares too. + +- changed the git update block to take care of c-ares repo if detected. + +- updated timestamp of the script. + +- removed obsolete var in gitpull() function + no need to create a var - lets just return the status var itself. + +- added a cast to silent compiler warning with 64bit systems. + +- fixed a path typo in src/Makefile.netware. + +Daniel Stenberg (12 Apr 2010) +- Added text for How To Make a Patch with git + +- update the section on timeouts + + The section that describes how to work with timeouts was + misleading and could easily trick users to use the wrong API. + +- update URL and cut out wrong info on ipv6 + + c-ares has had its own URL for a while and we should point + people to that. It also works with IPv6 since a long time. + +- refer to CURLMOPT_TIMERFUNCTION for multi_socket users + + curl_multi_timeout(3) is simply the wrong function to use + if you're using the multi_socket API and this document now + states this pretty clearly to help guiding users. + +- s/CVS/git + +- modified to use the git file, not cvs + + I've done this blindly, and the last piece that works with ares + should possibly be done differently now that c-ares isn't a + subtree within the curl tree anymore... + +- mention missing test servers for + +- FTP quote commands prefixed with '*' now can fail without aborting + + Prefixing the FTP quote commands with an asterisk really only + worked for the postquote actions. This is now fixed and test case + 227 has been extended to verify. + +Kamil Dudka (7 Apr 2010) +- qssl: reflect recent code changes in SSL interface + + Reported by Guenter Knauf. + +- nss: handle client certificate related errors + +- [Ben Greear brought this change] + + ssl: Fix build when SSL isn't enabled + + Signed-off-by: Ben Greear + +- refactorize interface of Curl_ssl_recv/Curl_ssl_send + +- simplify code of Curl_resolv_timeout() + +- eliminate a race condition in Curl_resolv_timeout() + +Daniel Stenberg (2 Apr 2010) +- [Ben Greear brought this change] + + fixed compiler warnings + +- updated contributor count + +- add contributors from the 7.20.0 release notes + +- fix SFTP download hang + + Matt Wixson found and fixed a bug in the SCP/SFTP area where the + code treated a 0 return code from libssh2 to be the same as + EAGAIN while in reality it isn't. The problem caused a hang in + SFTP transfers from a MessageWay server. + +Dan Fandrich (31 Mar 2010) +- Fixed misleading test message + +Daniel Stenberg (31 Mar 2010) +- update the generic copyright year range + +- removed README.cmake due to the improved situation + +Guenter Knauf (31 Mar 2010) +- fix compiler warning with a cast. + +- make folks use latest available dependent libraries. + +Dan Fandrich (30 Mar 2010) +- Call curl_global_cleanup() in test 560 to avoid a memory leak + +- Allow test 538 to run even when proxy support is disabled + +Daniel Stenberg (29 Mar 2010) +- use (s)size_t for string lengths to fix compiler warns + +- use size_t to hold string length + + using int is not fine on 64bit systems + +- [Ben Greear brought this change] + + Fix compile warnings in ssh.c + + strlen() returns size_t, but ssh libraries are wanting 'unsigned int'. Add + explicit casts and use _ex versions of the ssh library calls. + + Signed-off-by: Ben Greear + +- [Ben Greear brought this change] + + fix smtp compile warning + + Use ssize_t instead of int for the Curl_smtp_escape_eob nread + argument. + + Signed-off-by: Ben Greear + +- Ben's POP3 change + +- [Ben Greear brought this change] + + pop3: Get message listing if no mailbox in URL + + If you pass a URL to pop3 that does not contain a message ID as + part of the URL, it will currently ask for 'INBOX' which just + causes the pop3 server to return an error. + + The change makes libcurl treat en empty message ID as a request + for LIST (list of pop3 message IDs). User's code could then + parse this and download individual messages as desired. + +- [Ben Greear brought this change] + + Allow running ./tests/testcurl.pl from within git repo. + + My first instinct was to run the test script within the checked out + repository. This small change to the script allows that to work as + expected. + + Signed-off-by: Ben Greear + +- minor language fix + +- [Ben Greear brought this change] + + allow user+password in the URL for all protocols + + Ben Greear brought a patch that from now on allows all protocols + to specify name and user within the URL, in the same manner HTTP + and FTP have been allowed to in the past - although far from all + of the libcurl supported protocols actually have that feature in + their URL definition spec. + +- ignore pid files and stunnel.conf + + all used while running tests + +- make sure git pull is actually done! + +- changelogged: smoother rate limiting + +- [Ben Greear brought this change] + + Make rate-limitation logic smoother + + This gives a smoother rate limitation performance by using + sub-second pauses and also taking the buffer sizes into + account. + +- remove all .cvsignore files + +- PROT_CLOSEACTION should not include TFTP + + TFTP is not a protocol that uses close actions so it should + not be set in that bitmask! + +- [Tor Arntsen brought this change] + + Avoid double newline for the 'last commits' log in testcurl.pl + + The backtick command which extracts 'git log' lines come with a + newline, so chomp the newline before calling logit(), as the logit + function adds a newline by itself. + +- [Tor Arntsen brought this change] + + Change to version-independent git option for 'git log --oneline' + + 'git log --oneline' is a relatively recent Git function. It is + documented to be the same as 'git log --pretty=oneline --abbrev-commit', + so use that instead. It works all the way back to Git 1.5.0. + +- show 5 commits even if no git pull was made + +- don't touch ares/aclocal.m4 and show recent git commits + + since c-ares no longer embedded, we must not touch such files + anymore + + we show the 5 last git commits if git was proven in use, to help + us see exactly what's being tested + +- use CURL_SIZEOF_LONG instead of SIZEOF_LONG + + That's the symbol we have or generate in include/curl/curlbuild.h + +- s/CVS/DEV in the version string from the git repo + +Bill Hoffman (24 Mar 2010) +- Merge branch 'master' of github.com:bagder/curl + +- Add .gitattributes files to turn off CRLF translation for some files + +Daniel Stenberg (24 Mar 2010) +- provide a version number as today's date + + It should at least help visualize which autobuilds that are + using this script. + +- testcurl now uses git instead of CVS + +Bill Hoffman (24 Mar 2010) +- Merge branch 'master' of github.com:bagder/curl + +- Enable LDAP by default since it is now disabled when ldap.h is not found, + +- CMake fixes for Linux. + + Make sure is included if around when testing/using + socklen_t. Also, disable LDAP if LDAP_H is not found on the system. + +Daniel Stenberg (24 Mar 2010) +- [Bob Richmond brought this change] + + fix: timeout after last data chunk was handled + + Bob Richmond: There's an annoying situation where libcurl will + read new HTTP response data from a socket, then check if it's a + timeout if one is set. If the last packet received constitutes + the end of the response body, libcurl still treats it as a + timeout condition and reports a message like: + + "Operation timed out after 3000 milliseconds with 876 out of 876 + bytes received" + + It should only a timeout if the timer lapsed and we DIDN'T + receive the end of the response body yet. + +- avoid compiler warning without USE_ALARM_TIMEOUT + +Bill Hoffman (24 Mar 2010) +- Fix curl CMake build. + + This commit fixes the cmake build of curl, and cleans up the + cmake code a little. It removes some commented out code and + some trailing whitespace. To get curl to build the binary + tree include/curl directory needed to be added to the include + path. Also, SIZEOF_SHORT needed to be added. A check for the + lack of defines of SIZEOF_* for warnless.c was added. + +Daniel Stenberg (24 Mar 2010) +- [Chris Conroy brought this change] + + remove debug printfs + +- RTSP GET_PARAMETER fix + + Christopher Conroy fixed a problem with RTSP and GET_PARAMETER + reported to us by Massimo Callegari. There's a new test case 572 + that verifies this now. + +- remove trace of CVS + +- [Chris Conroy brought this change] + + Fix RTSP GET_PARAMETER empty and non-empty operation. + + Test coverage included. Thanks to Massimo Callegari for the bug report + +- s/CVS/DEV/ in the version string for repo versions + +- scrapped all left-over TODOs + + In order to get back on track, I've removed all the plans for + stuff I had in the queue. I will instead focus on fixing bugs and + relying on that people who truly want things added will come back + on the mailing list and nag and provide patches. + + 7.20.1 should be possible to release in April 2010 + +- restore executable bits on some files + +- remove the CVSish $Id$ lines + +- The 'ares' subtree has been removed from the source repository + +- s/CVS/git + +- update to current state + +- remove the ares subtree + + c-ares is now hosted entirely separate from the curl project + see http://c-ares.haxx.se/ for all details concerning c-ares, + its source repository and more. + +- mark connection as connected + + Kenny To filed the bug report #2963679 with patch to fix a + problem he experienced with doing multi interface HTTP POST over + a proxy using PROXYTUNNEL. He found a case where it would connect + fine but bits.tcpconnect was not set correct so libcurl didn't + work properly. + + (http://curl.haxx.se/bug/view.cgi?id=2963679) + +- enabled valgrind + + I ran it now successfully and it helped to pinpoint a libssh2 + memory leak! + +Dan Fandrich (23 Mar 2010) +- Updated Symbian notes + +Daniel Stenberg (23 Mar 2010) +- chunked-encoding with Content-Length: header problem + + Akos Pasztory filed debian bug report #572276 + http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=572276 + mentioning a problem with a resource that returns chunked-encoded + _and_ with a Content-Length and libcurl failed to properly ignore + the latter information. + +- delayed easy handle kill caused double Curl_close() call + + Hauke Duden provided an example program that made the multi + interface crash. His example simply used the multi interface and + did first one FTP transfer and after completion it used a second + easy handle and did another FTP transfer on the same FTP server. + + This triggered a bug in the "delayed easy handle kill" system + that curl uses: when an FTP connection is left alive it must keep + an easy handle around internally - only for the purpose of having + an easy handle when it later disconnects it. The code assumed + that when the easy handle was removed and an internal reference + was made, that version could be killed later on when a new easy + handle came using the same connection. This was wrong as Hauke's + example showed that the removed handle wasn't killed for real + until later. This caused a double close attempt => segfault. + +- ignore more files generated when tests run in the source tree + +- Thomas Lopatic fixed the alarm()-based DNS timeout + +- [Thomas Lopatic brought this change] + + fix the alarm()-based DNS timeout + + Looking at the code of Curl_resolv_timeout() in hostip.c, I think + that in case of a timeout, the signal handler for SIGALRM never + gets removed. I think that in my case it gets executed at some + point later on when execution has long left Curl_resolv_timeout() + or even the cURL library. + + The code that is jumped to with siglongjmp() simply sets the + error message to "name lookup timed out" and then returns with + CURLRESOLV_ERROR. I guess that instead of simply returning + without cleaning up, the code should have a goto that jumps to + the spot right after the call to Curl_resolv(). + +- [Daniel Johnson brought this change] + + Fix warnings for clang + +- Merge branch 'master' of github.com:bagder/curl + +Kamil Dudka (22 Mar 2010) +- [douglas steinwand brought this change] + + Fix insufficient initialization in Curl_clone_ssl_config() + + which could have caused a double free when reusing curl handle. + +Daniel Stenberg (22 Mar 2010) +- we never used this file anyway + +- s/CVS/git + +- various changes of CVS to git + +- remove references to CVS in the code and use DEV instead + +- Ben Greear's two fixes explained + +- [Ben Greear brought this change] + + Fix tftp return codes and tsize upload handling + + Error codes were not properly returned to the main curl code (and on to apps + using libcurl). + + tftp was crapping out when tsize == 0 on upload, but I see no reason to fail + to upload just because the remote file is zero-length. Ignore tsize option on + upload. + +- more files to ignore + +- provide an initial set of .gitignore files + +Kamil Dudka (19 Mar 2010) +- - Improved Curl_read() to not ignore the error returned from Curl_ssl_recv(). + +Daniel Stenberg (18 Mar 2010) +- fix warning about conversions between curl_off_t and long + +Yang Tse (18 Mar 2010) +- another shot at the ftp_init() icc 9.1 optimizer issue + +- replaced intel compiler option -no-ansi-alias with -fno-strict-aliasing + +- update outdated serial number + +Dan Fandrich (16 Mar 2010) +- Factored out some code into a few independent functions + +Daniel Stenberg (15 Mar 2010) +- - Constantine Sapuntzakis brought a patch: + + The problem mentioned on Dec 10 2009 + (http://curl.haxx.se/bug/view.cgi?id=2905220) was only partially fixed. + Partially because an easy handle can be associated with many connections in + the cache (e.g. if there is a redirect during the lifetime of the easy + handle). The previous patch only cleaned up the first one. The new fix now + removes the easy handle from all connections, not just the first one. + +Yang Tse (11 Mar 2010) +- fix compiler warning + +Dan Fandrich (11 Mar 2010) +- SSL should now be working out-of-the-box on Symbian S60. + +- Enable Symbian zlib support by default. + +- Allow compilation even when OpenSSL has been configured without MD4 support. + +- A few Symbian build changes + +Yang Tse (9 Mar 2010) +- watt32 compilation fix + +Daniel Stenberg (6 Mar 2010) +- - Ben Greear brought a patch that fixed the rate limiting logic for TFTP when + the easy interface was used. + +- indent fix by Ben Greear, I removed some braces for single-line conditional + expressions + +Yang Tse (6 Mar 2010) +- Added another VS10 version string + +- fix line break + +- removed usage of 's6_addr', fixing compilation issue triggered with no + longer using 'in6_addr' but only our 'ares_in6_addr' struct + +Daniel Stenberg (5 Mar 2010) +- Daniel Johnson provided fixes for building with the clang compiler + +Yang Tse (5 Mar 2010) +- Added IPv6 name servers support + +Gisle Vanem (5 Mar 2010) +- Ops!. Readded ares_nowarn.h. + +- Added ares_nowarn.c. + +Yang Tse (5 Mar 2010) +- Constantine Sapuntzakis detected and fixed a double free in builds done + with threaded resolver enabled (Windows default configuration) that would + get triggered when a curl handle is closed while doing DNS resolution. + +- Added SIZEOF_INT and SIZEOF_SHORT definitions for VMS configuration file + +Daniel Stenberg (4 Mar 2010) +- Julien Chaffraix clarified CURLOPT_HEADERFUNCTION and made + CURLOPT_HEADERFUNCTION and CURLOPT_WRITEFUNCTION more consistent + +- - [Daniel Johnson] I've been trying to build libcurl with clang on Darwin and + ran into some issues with the GSSAPI tests in configure.ac. The tests first + try to determine the include dirs and libs and set CPPFLAGS and LIBS + accordingly. It then checks for the headers and finally sets LIBS a second + time, causing the libs to be included twice. The first setting of LIBS seems + redundant and should be left out, since the first part is otherwise just + about finding headers. + + My second issue is that 'krb5-config --libs gssapi' on Darwin is less than + useless and returns junk that, while it happens to work with gcc, causes + clang to choke. For example, --libs returns $CFLAGS along with the libs, + which is really retarded. Simply setting 'LIBS="$LIBS -lgssapi_krb5 + -lresolv"' on Darwin is sufficient. + +- - Based on patch provided by Jacob Moshenko, the transfer logic now properly + makes sure that when using sub-second timeouts, there's no final bad 1000ms + wait. Previously, a sub-second timeout would often make the elapsed time end + up the time rounded up to the nearest second (e.g. 1s for 200ms timeout) + +- update the generic copyright year range to include 2010 + +- - Andrei Benea filed bug report #2956698 and pointed out that the + CURLOPT_CERTINFO feature leaked memory due to a missing OpenSSL function + call. He provided the patch to fix it too. + + http://curl.haxx.se/bug/view.cgi?id=2956698 + +- - Markus Duft pointed out in bug #2961796 that even though Interix has a + poll() function it doesn't quite work the way we want it so we must disable + it, and he also provided a patch for it. + + http://curl.haxx.se/bug/view.cgi?id=2961796 + +- - Made the pingpong timeout code properly deal with the response timeout AND + the global timeout if set. Also, as was reported in the bug report #2956437 + by Ryan Chan, the time stamp to use as basis for the per command timeout was + not set properly in the DONE phase for FTP (and not for SMTP) so I fixed + that just now. This was a regression compared to 7.19.7 due to the + conversion of FTP code over to the generic pingpong concepts. + + http://curl.haxx.se/bug/view.cgi?id=2956437 + +- remove assignment never used + +- - Ben Greear provided an update for TFTP that fixes upload. + +- SSL, not SSH, SSL + +- - Wesley Miaw reported bug #2958179 which identified a case of looping during + OpenSSL based SSL handshaking even though the multi interface was used and + there was no good reason for it. + + http://curl.haxx.se/bug/view.cgi?id=2958179 + +Yang Tse (28 Feb 2010) +- Added SIZEOF_INT and SIZEOF_SHORT definitions for non-configure systems + +- Added ares_nowarn.* to VC6 project file + +Daniel Stenberg (26 Feb 2010) +- spellchecked by Stphane Fillod + +- - Pat Ray in bug #2958474 pointed out an off-by-one case when receiving a + chunked-encoding trailer. + + http://curl.haxx.se/bug/view.cgi?id=2958474 + +Dan Fandrich (26 Feb 2010) +- Fixed a couple of out of memory leaks and a segfault in the IMAP code. + +Yang Tse (26 Feb 2010) +- fix sizeof short + +- Added SIZEOF_INT and SIZEOF_SHORT definitions for non-configure systems + +- Added SIZEOF_INT definition + +- fix compiler warning + +- fix compiler warning + +- fix compiler warning + +Dan Fandrich (25 Feb 2010) +- Fixed a couple of out of memory leaks and a segfault in the SMTP code. + +Yang Tse (25 Feb 2010) +- fix file name + +- Fixed bug report #2958074 indicating + (http://curl.haxx.se/bug/view.cgi?id=2958074) that curl on Windows with + option --trace-time did not use local time when timestamping trace lines. + This could also happen on other systems depending on time souurce. + +- enable 802 and 803 + +- fix compiler warning + +- fix compiler warning + +- fix compiler warning + +- fix socket data type + +- fix socket data type and logging format in debug tracking socket functions + +- convert Curl_ultous() and Curl_ultouc() functions to curlx_ultous() and + curlx_ultouc(), exposing them through curlx.h to allow proper code reuse + later in our test harness. + +- updated sources + +Patrick Monnerat (22 Feb 2010) +- _ Adjusted RFC821 HELO fallback and enabled test804 + +- - Proper handling of STARTTLS on SMTP, taking CURLUSESSL_TRY into account. + - SMTP falls back to RFC821 HELO when EHLO fails (and SSL is not required). + - Use of true local host name (i.e.: via gethostname()) when available, as default argument to SMTP HELO/EHLO. + - Test case 804 for HELO fallback. + +Yang Tse (22 Feb 2010) +- add header inclusion + +- fix compiler warning + +- fix compiler warning + +Daniel Stenberg (21 Feb 2010) +- clarify more details on section "2.1 More non-blocking" + +- TFTP transfers are not blocking since 7.20.0 + +- - Fixed the SMTP compliance by making sure RCPT TO addresses are specified + properly in angle brackets. Recipients provided with CURLOPT_MAIL_RCPT now + get angle bracket wrapping automatically by libcurl unless the recipient + starts with an angle bracket as then the app is assumed to deal with that + properly on its own. + +- - I made the SMTP code expect a 250 response back from the server after the + full DATA has been sent, and I modified the test SMTP server to also send + that response. As usual, the DONE operation that is made after a completed + transfer is still not doable in a non-blocking way so this waiting for 250 + is unfortunately made blockingly. + +- corected a comment and wrapped a few longish lines + +Yang Tse (20 Feb 2010) +- fix compiler warning + +- fix compiler warning + +- fix compiler warning + +- fix compiler warning + +- fix compiler warning + +Daniel Stenberg (17 Feb 2010) +- ares_reinit() + + - To allow an app to force a re-read of /etc/resolv.conf etc, pretty much + like the res_init() resolver function offers + +- use curl standard indentation and line lengths + +Yang Tse (16 Feb 2010) +- replaced tabs with spaces + +- fix Content-Length validation + +Daniel Stenberg (15 Feb 2010) +- use (void) in front of fwrite() calls that ignore the return code + +Yang Tse (15 Feb 2010) +- fix compiler warning: conversion from "long" to "size_t" may lose sign + +- fix compiler warning: conversion from "long" to "size_t" may lose sign + +Daniel Stenberg (15 Feb 2010) +- -w speed_download and speed_upload are measured in bytes per second + +- 75. NTLM authentication involving unicode user name or password. + http://curl.haxx.se/mail/lib-2009-10/0024.html + http://curl.haxx.se/bug/view.cgi?id=2944325 + +Yang Tse (14 Feb 2010) +- removed trailing whitespace + +- fix compiler warning + +- Overhauled test suite getpart() function. Fixing potential out of bounds + stack and memory overwrites triggered with huge test case definitions. + +Daniel Stenberg (13 Feb 2010) +- - Martin Hager reported and fixed a problem with a missing quote in libcurl.m4 + + (http://curl.haxx.se/bug/view.cgi?id=2951319) + +Gunter Knauf (13 Feb 2010) +- used allways #ifdef / #ifndef; + moved gethostbyname_thread() to #else case to avoid 'not used' compiler warning. + +- replaced tabs by spaces, removed trailing tabs/spaces. + +Daniel Stenberg (13 Feb 2010) +- - Tom Donovan fixed the CURL_FORMAT_* defines when building with cmake. + +- - Jack Zhang reported a problem with SMTP: we wrongly used multiple addresses + in the same RCPT TO line, when they should be sent in separate single + commands. I updated test case 802 to verify this. + + - I also fixed a bad use of my_setopt_str() of CURLOPT_MAIL_RCPT in the curl + tool which made it try to output it as string for the --libcurl feature + which could lead to crashes. + +- CURLOPT_MAIL_RCPT is *not* a string so we must not try to printf() it + +- free --mail-from strings properly + +Patrick Monnerat (11 Feb 2010) +- _ Make it compilable again on OS400. + _ Upgrade OS400 EBCDIC wrappers for new options. + _ Upgrade ILE/RPG bindings to current state. + +Yang Tse (11 Feb 2010) +- mention last changes + +- Steven M. Schweda updated VMS readme file + +- Steven M. Schweda removed batch_compile.com and defines.com + +- Steven M. Schweda fixed: + + VMS builder bad behavior when used in a batch job. + + Various ".LIS" and ".MAP" files created without being requested + by a "LIST" command-line option, and in the wrong place, too. + + Some minor typographical changes. + +Dan Fandrich (10 Feb 2010) +- Mention the minimum size of CURL_MAX_WRITE_SIZE + +Yang Tse (10 Feb 2010) +- - remove extra "\r\n" from doc404_RTSP + + - avoid memory alignment issue when setting RTSP packet length + +Dan Fandrich (9 Feb 2010) +- Removed some erroneous "compressed" key words + +Daniel Stenberg (9 Feb 2010) +- start working on 7.20.1 + +Version 7.20.0 (9 Feb 2010) + +Daniel Stenberg (9 Feb 2010) +- spell and 7.20.0 + +- - When downloading compressed content over HTTP and the app as asked libcurl + to automatically uncompress it with the CURLOPT_ENCODING option, libcurl + could wrongly provide the callback with more data than what the maximum + documented amount. An application could thus get tricked into badness if the + maximum limit was trusted to be enforced by libcurl itself (as it is + documented). + + This is further detailed and explained in the libcurl security advisory + 20100209 at + + http://curl.haxx.se/docs/adv_20100209.html + +- set VERSIONINFO accordingly for the 7.20.0 release + +Yang Tse (6 Feb 2010) +- warning fix + +- OOM handling fix + +- OOM handling fix + +- fix compiler warning + +- fix compiler warning + +- fix compiler warning + +- Addes OOM handling for curl_easy_setopt() calls in test + +- - avoid OpenSSL 0.9.8 ENGINE_by_id memory leak + + - cleanup parenthesis usage in return statements + +- - attempt to workaround icc 9.1 optimizer issue + +- fix printf-style format strings + +- Validate server port argument + +- Fix variable initialization + +- Modified test case 557 to additionally verify libcurl's internal curl_m*printf() + functions formatting functionality when handling signed and unsigned shorts. + +- Added size check for 'short' data type + +- Fix compiler warning: unused variable + +- added an additional second to allow test to pass on heavily loaded servers + +Dan Fandrich (3 Feb 2010) +- Changed the Watcom makefiles to make them easier to keep in sync with + Makefile.inc since that can't be included directly. + +Daniel Stenberg (3 Feb 2010) +- more symbols added in 7.20.0 + +Yang Tse (3 Feb 2010) +- Fix OOM handling + +- Fix progressmode Configurable struct member data type. Changed to + 'int' which fits better with existing CURL_PROGRESS_* definitions. + +- Fix portability issue related with unaligned memory access + +- Fix compiler warnings: conversion from 'const int ' to 'unsigned char ', possible loss of data + +- cookies with same path length might get sorted in different order when + using different qsort implementations. In order to make this test give + same results on different systems, paths now have different lengths. + +- added an additional second to allow test to pass on heavily loaded servers + +- Fix compiler warning: conditional expression is constant + +- Fix compiler warning: local variable may be used without having been initialized. + +- Fix compiler warnings: conversion from 'const int ' to 'unsigned char ', possible loss of data + +- Fix compiler warnings: + + (1) conversion from 'const int ' to 'unsigned char ', possible loss of data + (2) conditional expression is constant + +- mention a couple of changes back from November + +- mention run time statistics options + +- - Symbol CURL_FORMAT_OFF_T now obsoleted, will be removed in a future release, + symbol will not be available when building with CURL_NO_OLDIES defined. Use + of CURL_FORMAT_CURL_OFF_T is preferred since 7.19.0 + +- avoid possibility of using obsoleted stuff + +- remove setup.h inclusion which is already done from test.h inclusion + +Kamil Dudka (2 Feb 2010) +- mention SOCKS related problems in the curl(1) man page + +Yang Tse (2 Feb 2010) +- Fix compiler warning: variable was set but never used + + Simplify preprocessor symbol checking + +Daniel Stenberg (2 Feb 2010) +- Julien Chaffraix pointed out a comment mistake, and I re-indented the code + slightly while editing + +Yang Tse (2 Feb 2010) +- include headers + +- Conroy added a check to the coded message size since the docs stipulate + that each call will contain a full protocol packet. + +- Conroy's fix to make the code match with the RTP documentation regarding + writing out the whole header. The docs say it writes the whole header, + but the code (before this patch) did not write out the leading $. + +Daniel Stenberg (1 Feb 2010) +- We introduce a loop in lib/multi.c around all calls to multi_runsingle() and + simply check for CURLM_CALL_MULTI_PERFORM internally. This has the added + benefit that this goes in line with my long-term wishes to get rid of the + CURLM_CALL_MULTI_PERFORM all together from the public API. + +Yang Tse (1 Feb 2010) +- update rtsp server header field from SWS to RTSPD + +- Test suite support for RTSP + +- Make Curl_pop3_write() additionally truncate trailing POP3_EOB from received + string buffer, otherwise Curl_client_write() call with zero size would write + to the end of string buffer including matched POP3_EOB. + +- WIN32 fix, _beginthreadex() may return either 0 or -1L upon failure + +- fix errno usage for WIN32 builds + +- fix printf-style format strings + +- Chris Conroy fixed test #568 issues with carriage returns + +- RTSP followup fix. Both the pipelined and non-pipelined case need to + check for (excess > 0 && !k->ignorebody). + +Daniel Stenberg (28 Jan 2010) +- - Tommie Gannert pointed out a silly bug in ares_process_fd() since it didn't + check for broken connections like ares_process() did. Based on that, I + merged the two functions into a single generic one with two front-ends. + +Yang Tse (28 Jan 2010) +- fix printf-style format strings + +- Use 'size_t' for GETNAMEINFO_TYPE_ARG2 definition for VMS. + + http://curl.haxx.se/mail/lib-2009-12/0293.html + +- portability fix + +- fix printf-style format strings + +- Known bug #64 fixed by Constantine Sapuntzakis and Joshua Kwan in 7.20.0 + +- Chris Conroy provided first RTSP tests + +- RTSP tests disabled until test harness RTSP support is updated + +- Chris Conroy's RTSP followup fixes + +- mention asynchronous DNS lookups enhancements + +- Restore normal operation: + + c-ares is only enabled when specifically requested. + + Consequently, c-ares default setting is disabled. + +- fix c-ares assumed check being skipped + +- fix compiler warning + +- fix LDFLAGS preservation in CURL_CHECK_LIB_ARES + +Daniel Stenberg (26 Jan 2010) +- no need to take precautiono for how things were before 7.16.0 since that + is now a very long time ago + +- - Mike Crowe made libcurl return CURLE_COULDNT_RESOLVE_PROXY when it is the + proxy that cannot be resolved when using c-ares. This matches the behaviour + when not using c-ares. + +Dan Fandrich (26 Jan 2010) +- Added curl_threads.c to a few more non-configure build files + +Yang Tse (26 Jan 2010) +- minor fixes for --enable-ares configure option + +Daniel Stenberg (26 Jan 2010) +- Andre Guibert de Bruet improved the libssh2 error code translation + +Yang Tse (26 Jan 2010) +- resolver selection for non-configure Windows builds, default is threaded DNS + +- add curl_threads.c to non-configure target build files + +- onstantine Sapuntzakis threaded resolver enhancements + +- Constantine Sapuntzakis threaded resolver enhancements + +- Constantine Sapuntzakis provided initial thread abstraction layer + +- make Curl_handler_*_proxy definition static + +Dan Fandrich (25 Jan 2010) +- Updated minimum library sizes + +Yang Tse (25 Jan 2010) +- fix compiler warning + +Daniel Stenberg (24 Jan 2010) +- Julien Chaffraix corrected bad #elif lines to silence warnings + +Yang Tse (24 Jan 2010) +- HAVE_GETADDRINFO_THREADSAFE definition for non-configure win32 builds + +Bjorn Stenberg (23 Jan 2010) +- Mention -J change + +- Added -J/--remote-header-name. + +Daniel Stenberg (23 Jan 2010) +- "remove progress meter from libcurl" at next API break + +Yang Tse (23 Jan 2010) +- add inclusion of curl_memory.h + +- adjust preprocessor symbol definition check relative to resolver specialty + +- PKTSIZE might have been already defined in arpa/tftp.h + +Dan Fandrich (23 Jan 2010) +- Include "curl_memory.h" to get the strdup replacement when necessary + +Daniel Stenberg (22 Jan 2010) +- wrap long lines and do some indent policing + +Yang Tse (22 Jan 2010) +- Definitions of resolver specialty compile-time defines CURLRES_* moved + from hostip.h to setup.h in order to allow proper inclusion in any file. + + This represents no functional change at all in which resolver is used, + everything still works as usual, internally and externally there is no + difference in behavior. + +- adjust rtsp protocol support in curl-config and libcurl.pc when http is disabled + +- deal with the possibility that CURL_DISABLE_RTSP may already be defined + +- fix compiler warning: statement is unreachable + +- fix compilation when http is disabled + +- disabling of rtsp when http isn't enabled required here for non-configure systems + +Daniel Stenberg (22 Jan 2010) +- wrap long lines, remove (very old) attribution from code + +- cleanups by Julien Chaffraix + +- alphabetically sort the list of supported protocols + +- In spite claiming to tbe disabled by default, RTSP is enabled and it now + also says so. I also made the list of protocols get sorted. + +- expanded to provide info about the newer protocols too + +- s/RTPFUNCTION/INTERLEAVEFUNCTION/ + s/RTPDATA/INTERLEAVEDATA/ + +- keep lines shorter than 80 columns, and reduce/remove the use of the word + 'note' in most description as it is mostly useless. + +Yang Tse (22 Jan 2010) +- Julien Chaffraix adjusted " section" line length + +- Constantine Sapuntzakis refactoring of async callbacks, allowing + removal of Curl_addrinfo_copy(), Curl_addrinfo6_callback(), and + Curl_addrinfo4_callback() + +Dan Fandrich (21 Jan 2010) +- Added rtsp.c to the non-configure target build files + +Yang Tse (21 Jan 2010) +- fix compiler warning + +- make tftp_translate_code() static, it is only used from within tftp.c + +- fix warning triggered when debugging on cygwin + +- allow exporting of exe_ext() sub + +- improve displaylogcontent() sub fixing a warning + +Daniel Stenberg (21 Jan 2010) +- remove typedef we ended up not using + +- Chris Conroy brought support for RTSP transfers, and with it comes 8(!) new + libcurl options for controlling what to get and how to receive posssibly + interleaved RTP data. Initial commit. + +- Julien Chaffraix fixed line lengths + +- Julien Chaffraix removed an old obsolete typedef + +- Yun Fu pointed out a flaw in the loop that checks handles, and I indented + the code more curl-style + +- "5.3 Sort outgoing cookies" removed, we now sort them + +Yang Tse (20 Jan 2010) +- SIGTERM is the signal to trap here, SIGKILL can't be caught. + +- Use killsockfilters() to kill sockfilter processes, this ensures that when + killing a sockfilter process the actual PID from the pid file is used and + not the one returned by open2() which might be different. + +- Allow killsockfilters() to take a 5th optional parameter that when provided + indicates that only one of the two possible sockfilter processes should be + killed. Valid values for this parameter are 'main' and 'data'. + +- Use delete() to unset environment variables instead of assigning undef which + generates warning 'Use of uninitialized value in scalar assignment' with perl + versions older than 5.10 + +- Adjust valgrind logs file name detection. + + Adjust environment vars setting and restoring from test definition. + + Avoid using strftime in torture sub. + +Daniel Stenberg (20 Jan 2010) +- modified test case 8 to also make sure that we deal with cookies using + identical names but different paths properly + +- - As was pointed out on the http-state mailing list, the order of cookies in a + HTTP Cookie: header _needs_ to be sorted on the path length in the cases + where two cookies using the same name are set more than once using + (overlapping) paths. Realizing this, identically named cookies must be + sorted correctly. But detecting only identically named cookies and take care + of them individually is harder than just to blindly and unconditionally sort + all cookies based on their path lengths. All major browsers also already do + this, so this makes our behavior one step closer to them in the cookie area. + + Test case 8 was the only one that broke due to this change and I updated it + accordingly. + +- oops, I forgot to cvs add this before my previous commit (Dan Fandrich + pointed it out to me) + +- - David McCreedy brought a fix and a new test case (129) to make libcurl work + again when downloading files over FTP using ASCII and it turns out that the + final size of the file is not the same as the initial size the server + reported. This is very common since servers don't take the newline + conversions into account. + +- "260 - IMAP, POP3 and SMTP support" done! + +- avoid "Use of uninitialized value $l in concatenation" + +Yang Tse (19 Jan 2010) +- Fail harder when curl coredumps trying to verify http and ftp servers. + + Add some debug messages to see what's going on with valgrind logs. + +- prevent %runcert hash growth when clearing items + +- update copyright year notice + +- Constantine Sapuntzakis enhancements to make memory tracking log file writing + of messages atomic, on systems where an fwrite of a memory buffer is atomic. + +Dan Fandrich (18 Jan 2010) +- Added PEM certificate keyword + +Yang Tse (18 Jan 2010) +- fix warnings + +- Stop ssl running server when cert file currently used by server is + different than the one specified in test definition for same server + +- fix warnings + +- - Remove QD restarting of https servers. Proper fixing required. + This will make tests 310 311 and 312 fail while fixing. + + - Remove some debug messages + +- make verifyhttp use different file names depending on server characteristics + +- add serverfactors() sub which returns server characterization factors + +- fix warnings + +- fix warnings + +- fix warnings + +- add some debug messages + +- use servername_id() from serverhelp.pm + +- refactored stopping of test harness servers + +- Store now this file in CVS with unix line endings. + + maketgz already converts this file to DOS style with an awk filter. + +- Declaration of $sshdlog is done in sshhelp.pm + +- Start using the centralized pidfile and logfile name generation + subroutines for ssh and socks test suite servers. + +Dan Fandrich (15 Jan 2010) +- Added the new protocol source files to the non-autoconf build files + +Yang Tse (14 Jan 2010) +- Squeeze slack time when killing more than one server from + the section of test harness definition files. + +Kamil Dudka (14 Jan 2010) +- - Suppressed side effect of OpenSSL configure checks, which prevented NSS from + being properly detected under certain circumstances. It had been caused by + strange behavior of pkg-config when handling PKG_CONFIG_LIBDIR. pkg-config + distinguishes among empty and non-existent environment variable in that case. + +Yang Tse (13 Jan 2010) +- Give the test a bit mote time to run so it passes on slow machines + +Kamil Dudka (13 Jan 2010) +- remove trailing spaces from configure.ac + +Yang Tse (12 Jan 2010) +- Added test case #1112 which does an FTPS download with strict timeout + and slow data transfer in a similar way as test case #1086 does for FTP. + + This also exercises section for the FTPS server. + +- Make runtests.pl actually support any (valid) server specification + for the section of test harness definition files. + +- Fix tftp and sftp supported protocols in servername_str() + +- Make sockfilter kill messages look alike server ones diff --git a/mobicore/common/curl/CMake/CMakeConfigurableFile.in b/mobicore/common/curl/CMake/CMakeConfigurableFile.in new file mode 100644 index 0000000000000000000000000000000000000000..4cf74a12bb73e1612ea24dda85902e718268b9d0 --- /dev/null +++ b/mobicore/common/curl/CMake/CMakeConfigurableFile.in @@ -0,0 +1,2 @@ +@CMAKE_CONFIGURABLE_FILE_CONTENT@ + diff --git a/mobicore/common/curl/CMake/CheckTypeSize.c.in b/mobicore/common/curl/CMake/CheckTypeSize.c.in new file mode 100644 index 0000000000000000000000000000000000000000..8ff07bfd1d13fc1521dbdc7a340caf1b693d6ecb --- /dev/null +++ b/mobicore/common/curl/CMake/CheckTypeSize.c.in @@ -0,0 +1,44 @@ +#cmakedefine CHECK_TYPE_SIZE_TYPE @CHECK_TYPE_SIZE_TYPE@ +#ifdef CHECK_TYPE_SIZE_TYPE + +@CHECK_TYPE_SIZE_PREINCLUDE@ +#ifdef HAVE_SYS_TYPES_H +# include +#endif /* HAVE_SYS_TYPES_H */ + +#ifdef HAVE_SYS_SOCKET_H +# include +#endif + +#ifdef _WIN32 +# include +# include +#endif + + +#ifdef HAVE_STDINT_H +# include +#endif /* HAVE_STDINT_H */ + +#ifdef HAVE_STDDEF_H +# include +#endif /* HAVE_STDDEF_H */ + +@CHECK_TYPE_SIZE_PREMAIN@ + +#ifdef __CLASSIC_C__ +int main(){ + int ac; + char*av[]; +#else +int main(int ac, char*av[]){ +#endif + if(ac > 1000){return *av[0];} + return sizeof(CHECK_TYPE_SIZE_TYPE); +} + +#else /* CHECK_TYPE_SIZE_TYPE */ + +# error "CHECK_TYPE_SIZE_TYPE has to specify the type" + +#endif /* CHECK_TYPE_SIZE_TYPE */ diff --git a/mobicore/common/curl/CMake/CheckTypeSize.cmake b/mobicore/common/curl/CMake/CheckTypeSize.cmake new file mode 100644 index 0000000000000000000000000000000000000000..2c2ceab974d47a947d04e303b438a82d9256e75a --- /dev/null +++ b/mobicore/common/curl/CMake/CheckTypeSize.cmake @@ -0,0 +1,57 @@ +# - Check sizeof a type +# CHECK_TYPE_SIZE(TYPE VARIABLE) +# Check if the type exists and determine size of type. if the type +# exists, the size will be stored to the variable. +# +# VARIABLE - variable to store size if the type exists. +# HAVE_${VARIABLE} - does the variable exists or not + +macro(CHECK_TYPE_SIZE TYPE VARIABLE) + set(CMAKE_ALLOW_UNKNOWN_VARIABLE_READ_ACCESS 1) + if(NOT DEFINED ${VARIABLE}) + if("HAVE_${VARIABLE}" MATCHES "^HAVE_${VARIABLE}$") + set(CHECK_TYPE_SIZE_TYPE "${TYPE}") + set(MACRO_CHECK_TYPE_SIZE_FLAGS + "${CMAKE_REQUIRED_FLAGS}") + foreach(def HAVE_SYS_TYPES_H + HAVE_STDINT_H HAVE_STDDEF_H HAVE_SYS_SOCKET_H) + if("${def}") + set(MACRO_CHECK_TYPE_SIZE_FLAGS + "${MACRO_CHECK_TYPE_SIZE_FLAGS} -D${def}") + endif("${def}") + endforeach(def) + set(CHECK_TYPE_SIZE_PREMAIN) + foreach(def ${CMAKE_EXTRA_INCLUDE_FILES}) + set(CHECK_TYPE_SIZE_PREMAIN "${CHECK_TYPE_SIZE_PREMAIN}#include \"${def}\"\n") + endforeach(def) + configure_file( + "${CMAKE_CURRENT_SOURCE_DIR}/CMake/CheckTypeSize.c.in" + "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/CheckTypeSize.c" + IMMEDIATE @ONLY) + file(READ + "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/CheckTypeSize.c" + CHECK_TYPE_SIZE_FILE_CONTENT) + message(STATUS "Check size of ${TYPE}") + if(CMAKE_REQUIRED_LIBRARIES) + set(CHECK_TYPE_SIZE_ADD_LIBRARIES + "-DLINK_LIBRARIES:STRING=${CMAKE_REQUIRED_LIBRARIES}") + endif(CMAKE_REQUIRED_LIBRARIES) + try_run(${VARIABLE} HAVE_${VARIABLE} + ${CMAKE_BINARY_DIR} + "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/CheckTypeSize.c" + CMAKE_FLAGS -DCOMPILE_DEFINITIONS:STRING=${MACRO_CHECK_TYPE_SIZE_FLAGS} + "${CHECK_TYPE_SIZE_ADD_LIBRARIES}" + OUTPUT_VARIABLE OUTPUT) + if(HAVE_${VARIABLE}) + message(STATUS "Check size of ${TYPE} - done") + file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log + "Determining size of ${TYPE} passed with the following output:\n${OUTPUT}\n\n") + else(HAVE_${VARIABLE}) + message(STATUS "Check size of ${TYPE} - failed") + file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log + "Determining size of ${TYPE} failed with the following output:\n${OUTPUT}\nCheckTypeSize.c:\n${CHECK_TYPE_SIZE_FILE_CONTENT}\n\n") + endif(HAVE_${VARIABLE}) + endif("HAVE_${VARIABLE}" MATCHES "^HAVE_${VARIABLE}$") + endif(NOT DEFINED ${VARIABLE}) + set(CMAKE_ALLOW_UNKNOWN_VARIABLE_READ_ACCESS ) +endmacro(CHECK_TYPE_SIZE) diff --git a/mobicore/common/curl/CMake/CurlCheckCSourceCompiles.cmake b/mobicore/common/curl/CMake/CurlCheckCSourceCompiles.cmake new file mode 100644 index 0000000000000000000000000000000000000000..b63276809561d7e8de29df7e7338832c70b7d6ba --- /dev/null +++ b/mobicore/common/curl/CMake/CurlCheckCSourceCompiles.cmake @@ -0,0 +1,75 @@ +# - Check if the source code provided in the SOURCE argument compiles. +# CURL_CHECK_C_SOURCE_COMPILES(SOURCE VAR) +# - macro which checks if the source code compiles +# SOURCE - source code to try to compile +# VAR - variable to store whether the source code compiled +# +# The following variables may be set before calling this macro to +# modify the way the check is run: +# +# CMAKE_REQUIRED_FLAGS = string of compile command line flags +# CMAKE_REQUIRED_DEFINITIONS = list of macros to define (-DFOO=bar) +# CMAKE_REQUIRED_INCLUDES = list of include directories +# CMAKE_REQUIRED_LIBRARIES = list of libraries to link + +macro(CURL_CHECK_C_SOURCE_COMPILES SOURCE VAR) + if("${VAR}" MATCHES "^${VAR}$" OR "${VAR}" MATCHES "UNKNOWN") + set(message "${VAR}") + # If the number of arguments is greater than 2 (SOURCE VAR) + if(${ARGC} GREATER 2) + # then add the third argument as a message + set(message "${ARGV2} (${VAR})") + endif(${ARGC} GREATER 2) + set(MACRO_CHECK_FUNCTION_DEFINITIONS + "-D${VAR} ${CMAKE_REQUIRED_FLAGS}") + if(CMAKE_REQUIRED_LIBRARIES) + set(CURL_CHECK_C_SOURCE_COMPILES_ADD_LIBRARIES + "-DLINK_LIBRARIES:STRING=${CMAKE_REQUIRED_LIBRARIES}") + else(CMAKE_REQUIRED_LIBRARIES) + set(CURL_CHECK_C_SOURCE_COMPILES_ADD_LIBRARIES) + endif(CMAKE_REQUIRED_LIBRARIES) + if(CMAKE_REQUIRED_INCLUDES) + set(CURL_CHECK_C_SOURCE_COMPILES_ADD_INCLUDES + "-DINCLUDE_DIRECTORIES:STRING=${CMAKE_REQUIRED_INCLUDES}") + else(CMAKE_REQUIRED_INCLUDES) + set(CURL_CHECK_C_SOURCE_COMPILES_ADD_INCLUDES) + endif(CMAKE_REQUIRED_INCLUDES) + set(src "") + foreach(def ${EXTRA_DEFINES}) + set(src "${src}#define ${def} 1\n") + endforeach(def) + foreach(inc ${HEADER_INCLUDES}) + set(src "${src}#include <${inc}>\n") + endforeach(inc) + + set(src "${src}\nint main() { ${SOURCE} ; return 0; }") + set(CMAKE_CONFIGURABLE_FILE_CONTENT "${src}") + configure_file(${CMAKE_CURRENT_SOURCE_DIR}/CMake/CMakeConfigurableFile.in + "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/src.c" + IMMEDIATE) + message(STATUS "Performing Test ${message}") + try_compile(${VAR} + ${CMAKE_BINARY_DIR} + ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/src.c + COMPILE_DEFINITIONS ${CMAKE_REQUIRED_DEFINITIONS} + CMAKE_FLAGS -DCOMPILE_DEFINITIONS:STRING=${MACRO_CHECK_FUNCTION_DEFINITIONS} + "${CURL_CHECK_C_SOURCE_COMPILES_ADD_LIBRARIES}" + "${CURL_CHECK_C_SOURCE_COMPILES_ADD_INCLUDES}" + OUTPUT_VARIABLE OUTPUT) + if(${VAR}) + set(${VAR} 1 CACHE INTERNAL "Test ${message}") + message(STATUS "Performing Test ${message} - Success") + file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log + "Performing C SOURCE FILE Test ${message} succeded with the following output:\n" + "${OUTPUT}\n" + "Source file was:\n${src}\n") + else(${VAR}) + message(STATUS "Performing Test ${message} - Failed") + set(${VAR} "" CACHE INTERNAL "Test ${message}") + file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log + "Performing C SOURCE FILE Test ${message} failed with the following output:\n" + "${OUTPUT}\n" + "Source file was:\n${src}\n") + endif(${VAR}) + endif("${VAR}" MATCHES "^${VAR}$" OR "${VAR}" MATCHES "UNKNOWN") +endmacro(CURL_CHECK_C_SOURCE_COMPILES) diff --git a/mobicore/common/curl/CMake/CurlCheckCSourceRuns.cmake b/mobicore/common/curl/CMake/CurlCheckCSourceRuns.cmake new file mode 100644 index 0000000000000000000000000000000000000000..6b14af80dd304b078d32df36b868f0aed00e90cb --- /dev/null +++ b/mobicore/common/curl/CMake/CurlCheckCSourceRuns.cmake @@ -0,0 +1,83 @@ +# - Check if the source code provided in the SOURCE argument compiles and runs. +# CURL_CHECK_C_SOURCE_RUNS(SOURCE VAR) +# - macro which checks if the source code runs +# SOURCE - source code to try to compile +# VAR - variable to store size if the type exists. +# +# The following variables may be set before calling this macro to +# modify the way the check is run: +# +# CMAKE_REQUIRED_FLAGS = string of compile command line flags +# CMAKE_REQUIRED_DEFINITIONS = list of macros to define (-DFOO=bar) +# CMAKE_REQUIRED_INCLUDES = list of include directories +# CMAKE_REQUIRED_LIBRARIES = list of libraries to link + +macro(CURL_CHECK_C_SOURCE_RUNS SOURCE VAR) + if("${VAR}" MATCHES "^${VAR}$" OR "${VAR}" MATCHES "UNKNOWN") + set(message "${VAR}") + # If the number of arguments is greater than 2 (SOURCE VAR) + if(${ARGC} GREATER 2) + # then add the third argument as a message + set(message "${ARGV2} (${VAR})") + endif(${ARGC} GREATER 2) + set(MACRO_CHECK_FUNCTION_DEFINITIONS + "-D${VAR} ${CMAKE_REQUIRED_FLAGS}") + if(CMAKE_REQUIRED_LIBRARIES) + set(CURL_CHECK_C_SOURCE_COMPILES_ADD_LIBRARIES + "-DLINK_LIBRARIES:STRING=${CMAKE_REQUIRED_LIBRARIES}") + else(CMAKE_REQUIRED_LIBRARIES) + set(CURL_CHECK_C_SOURCE_COMPILES_ADD_LIBRARIES) + endif(CMAKE_REQUIRED_LIBRARIES) + if(CMAKE_REQUIRED_INCLUDES) + set(CURL_CHECK_C_SOURCE_COMPILES_ADD_INCLUDES + "-DINCLUDE_DIRECTORIES:STRING=${CMAKE_REQUIRED_INCLUDES}") + else(CMAKE_REQUIRED_INCLUDES) + set(CURL_CHECK_C_SOURCE_COMPILES_ADD_INCLUDES) + endif(CMAKE_REQUIRED_INCLUDES) + set(src "") + foreach(def ${EXTRA_DEFINES}) + set(src "${src}#define ${def} 1\n") + endforeach(def) + foreach(inc ${HEADER_INCLUDES}) + set(src "${src}#include <${inc}>\n") + endforeach(inc) + + set(src "${src}\nint main() { ${SOURCE} ; return 0; }") + set(CMAKE_CONFIGURABLE_FILE_CONTENT "${src}") + configure_file(${CMAKE_CURRENT_SOURCE_DIR}/CMake/CMakeConfigurableFile.in + "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/src.c" + IMMEDIATE) + message(STATUS "Performing Test ${message}") + try_run(${VAR} ${VAR}_COMPILED + ${CMAKE_BINARY_DIR} + ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/src.c + COMPILE_DEFINITIONS ${CMAKE_REQUIRED_DEFINITIONS} + CMAKE_FLAGS -DCOMPILE_DEFINITIONS:STRING=${MACRO_CHECK_FUNCTION_DEFINITIONS} + "${CURL_CHECK_C_SOURCE_COMPILES_ADD_LIBRARIES}" + "${CURL_CHECK_C_SOURCE_COMPILES_ADD_INCLUDES}" + OUTPUT_VARIABLE OUTPUT) + # if it did not compile make the return value fail code of 1 + if(NOT ${VAR}_COMPILED) + set(${VAR} 1) + endif(NOT ${VAR}_COMPILED) + # if the return value was 0 then it worked + set(result_var ${${VAR}}) + if("${result_var}" EQUAL 0) + set(${VAR} 1 CACHE INTERNAL "Test ${message}") + message(STATUS "Performing Test ${message} - Success") + file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log + "Performing C SOURCE FILE Test ${message} succeded with the following output:\n" + "${OUTPUT}\n" + "Return value: ${${VAR}}\n" + "Source file was:\n${src}\n") + else("${result_var}" EQUAL 0) + message(STATUS "Performing Test ${message} - Failed") + set(${VAR} "" CACHE INTERNAL "Test ${message}") + file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log + "Performing C SOURCE FILE Test ${message} failed with the following output:\n" + "${OUTPUT}\n" + "Return value: ${result_var}\n" + "Source file was:\n${src}\n") + endif("${result_var}" EQUAL 0) + endif("${VAR}" MATCHES "^${VAR}$" OR "${VAR}" MATCHES "UNKNOWN") +endmacro(CURL_CHECK_C_SOURCE_RUNS) diff --git a/mobicore/common/curl/CMake/CurlTests.c b/mobicore/common/curl/CMake/CurlTests.c new file mode 100644 index 0000000000000000000000000000000000000000..09434589c4b47548cc7f15baa82a2a7fa868bcc0 --- /dev/null +++ b/mobicore/common/curl/CMake/CurlTests.c @@ -0,0 +1,690 @@ +#ifdef TIME_WITH_SYS_TIME +/* Time with sys/time test */ + +#include +#include +#include + +int +main () +{ +if ((struct tm *) 0) +return 0; + ; + return 0; +} + +#endif + +#ifdef HAVE_FCNTL_O_NONBLOCK + +/* headers for FCNTL_O_NONBLOCK test */ +#include +#include +#include +/* */ +#if defined(sun) || defined(__sun__) || \ + defined(__SUNPRO_C) || defined(__SUNPRO_CC) +# if defined(__SVR4) || defined(__srv4__) +# define PLATFORM_SOLARIS +# else +# define PLATFORM_SUNOS4 +# endif +#endif +#if (defined(_AIX) || defined(__xlC__)) && !defined(_AIX41) +# define PLATFORM_AIX_V3 +#endif +/* */ +#if defined(PLATFORM_SUNOS4) || defined(PLATFORM_AIX_V3) || defined(__BEOS__) +#error "O_NONBLOCK does not work on this platform" +#endif + +int +main () +{ + /* O_NONBLOCK source test */ + int flags = 0; + if(0 != fcntl(0, F_SETFL, flags | O_NONBLOCK)) + return 1; + return 0; +} +#endif + +#ifdef HAVE_GETHOSTBYADDR_R_5 +#include +#include +int +main () +{ + +char * address; +int length; +int type; +struct hostent h; +struct hostent_data hdata; +int rc; +#ifndef gethostbyaddr_r + (void)gethostbyaddr_r; +#endif +rc = gethostbyaddr_r(address, length, type, &h, &hdata); + ; + return 0; +} +#endif +#ifdef HAVE_GETHOSTBYADDR_R_5_REENTRANT +#define _REENTRANT +#include +#include +int +main () +{ + +char * address; +int length;q +int type; +struct hostent h; +struct hostent_data hdata; +int rc; +#ifndef gethostbyaddr_r + (void)gethostbyaddr_r; +#endif +rc = gethostbyaddr_r(address, length, type, &h, &hdata); + ; + return 0; +} +#endif +#ifdef HAVE_GETHOSTBYADDR_R_7 +#include +#include +int +main () +{ + +char * address; +int length; +int type; +struct hostent h; +char buffer[8192]; +int h_errnop; +struct hostent * hp; + +#ifndef gethostbyaddr_r + (void)gethostbyaddr_r; +#endif +hp = gethostbyaddr_r(address, length, type, &h, + buffer, 8192, &h_errnop); + ; + return 0; +} +#endif +#ifdef HAVE_GETHOSTBYADDR_R_7_REENTRANT +#define _REENTRANT +#include +#include +int +main () +{ + +char * address; +int length; +int type; +struct hostent h; +char buffer[8192]; +int h_errnop; +struct hostent * hp; + +#ifndef gethostbyaddr_r + (void)gethostbyaddr_r; +#endif +hp = gethostbyaddr_r(address, length, type, &h, + buffer, 8192, &h_errnop); + ; + return 0; +} +#endif +#ifdef HAVE_GETHOSTBYADDR_R_8 +#include +#include +int +main () +{ + +char * address; +int length; +int type; +struct hostent h; +char buffer[8192]; +int h_errnop; +struct hostent * hp; +int rc; + +#ifndef gethostbyaddr_r + (void)gethostbyaddr_r; +#endif +rc = gethostbyaddr_r(address, length, type, &h, + buffer, 8192, &hp, &h_errnop); + ; + return 0; +} +#endif +#ifdef HAVE_GETHOSTBYADDR_R_8_REENTRANT +#define _REENTRANT +#include +#include +int +main () +{ + +char * address; +int length; +int type; +struct hostent h; +char buffer[8192]; +int h_errnop; +struct hostent * hp; +int rc; + +#ifndef gethostbyaddr_r + (void)gethostbyaddr_r; +#endif +rc = gethostbyaddr_r(address, length, type, &h, + buffer, 8192, &hp, &h_errnop); + ; + return 0; +} +#endif +#ifdef HAVE_GETHOSTBYNAME_R_3 +#include +#include +#include +#undef NULL +#define NULL (void *)0 + +int +main () +{ + +struct hostent_data data; +#ifndef gethostbyname_r + (void)gethostbyname_r; +#endif +gethostbyname_r(NULL, NULL, NULL); + ; + return 0; +} +#endif +#ifdef HAVE_GETHOSTBYNAME_R_3_REENTRANT +#define _REENTRANT +#include +#include +#include +#undef NULL +#define NULL (void *)0 + +int +main () +{ + +struct hostent_data data; +#ifndef gethostbyname_r + (void)gethostbyname_r; +#endif +gethostbyname_r(NULL, NULL, NULL); + ; + return 0; +} +#endif +#ifdef HAVE_GETHOSTBYNAME_R_5 +#include +#include +#include +#undef NULL +#define NULL (void *)0 + +int +main () +{ +#ifndef gethostbyname_r + (void)gethostbyname_r; +#endif +gethostbyname_r(NULL, NULL, NULL, 0, NULL); + ; + return 0; +} +#endif +#ifdef HAVE_GETHOSTBYNAME_R_5_REENTRANT +#define _REENTRANT +#include +#include +#undef NULL +#define NULL (void *)0 + +int +main () +{ + +#ifndef gethostbyname_r + (void)gethostbyname_r; +#endif +gethostbyname_r(NULL, NULL, NULL, 0, NULL); + ; + return 0; +} +#endif +#ifdef HAVE_GETHOSTBYNAME_R_6 +#include +#include +#undef NULL +#define NULL (void *)0 + +int +main () +{ + +#ifndef gethostbyname_r + (void)gethostbyname_r; +#endif +gethostbyname_r(NULL, NULL, NULL, 0, NULL, NULL); + ; + return 0; +} +#endif +#ifdef HAVE_GETHOSTBYNAME_R_6_REENTRANT +#define _REENTRANT +#include +#include +#undef NULL +#define NULL (void *)0 + +int +main () +{ + +#ifndef gethostbyname_r + (void)gethostbyname_r; +#endif +gethostbyname_r(NULL, NULL, NULL, 0, NULL, NULL); + ; + return 0; +} +#endif +#ifdef HAVE_SOCKLEN_T +#ifdef _WIN32 +#include +#else +#include +#include +#endif +int +main () +{ +if ((socklen_t *) 0) + return 0; +if (sizeof (socklen_t)) + return 0; + ; + return 0; +} +#endif +#ifdef HAVE_IN_ADDR_T +#include +#include +#include + +int +main () +{ +if ((in_addr_t *) 0) + return 0; +if (sizeof (in_addr_t)) + return 0; + ; + return 0; +} +#endif + +#ifdef HAVE_BOOL_T +#ifdef HAVE_SYS_TYPES_H +#include +#endif +#ifdef HAVE_STDBOOL_H +#include +#endif +int +main () +{ +if (sizeof (bool *) ) + return 0; + ; + return 0; +} +#endif + +#ifdef STDC_HEADERS +#include +#include +#include +#include +int main() { return 0; } +#endif +#ifdef RETSIGTYPE_TEST +#include +#include +#ifdef signal +# undef signal +#endif +#ifdef __cplusplus +extern "C" void (*signal (int, void (*)(int)))(int); +#else +void (*signal ()) (); +#endif + +int +main () +{ + return 0; +} +#endif +#ifdef HAVE_INET_NTOA_R_DECL +#include + +typedef void (*func_type)(); + +int main() +{ +#ifndef inet_ntoa_r + func_type func; + func = (func_type)inet_ntoa_r; +#endif + return 0; +} +#endif +#ifdef HAVE_INET_NTOA_R_DECL_REENTRANT +#define _REENTRANT +#include + +typedef void (*func_type)(); + +int main() +{ +#ifndef inet_ntoa_r + func_type func; + func = (func_type)&inet_ntoa_r; +#endif + return 0; +} +#endif +#ifdef HAVE_GETADDRINFO +#include +#include +#include + +int main(void) { + struct addrinfo hints, *ai; + int error; + + memset(&hints, 0, sizeof(hints)); + hints.ai_family = AF_UNSPEC; + hints.ai_socktype = SOCK_STREAM; +#ifndef getaddrinfo + (void)getaddrinfo; +#endif + error = getaddrinfo("127.0.0.1", "8080", &hints, &ai); + if (error) { + return 1; + } + return 0; +} +#endif +#ifdef HAVE_FILE_OFFSET_BITS +#ifdef _FILE_OFFSET_BITS +#undef _FILE_OFFSET_BITS +#endif +#define _FILE_OFFSET_BITS 64 +#include + /* Check that off_t can represent 2**63 - 1 correctly. + We can't simply define LARGE_OFF_T to be 9223372036854775807, + since some C++ compilers masquerading as C compilers + incorrectly reject 9223372036854775807. */ +#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62)) + int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 + && LARGE_OFF_T % 2147483647 == 1) + ? 1 : -1]; +int main () { ; return 0; } +#endif +#ifdef HAVE_IOCTLSOCKET +/* includes start */ +#ifdef HAVE_WINDOWS_H +# ifndef WIN32_LEAN_AND_MEAN +# define WIN32_LEAN_AND_MEAN +# endif +# include +# ifdef HAVE_WINSOCK2_H +# include +# else +# ifdef HAVE_WINSOCK_H +# include +# endif +# endif +#endif + +int +main () +{ + +/* ioctlsocket source code */ + int socket; + unsigned long flags = ioctlsocket(socket, FIONBIO, &flags); + + ; + return 0; +} + +#endif +#ifdef HAVE_IOCTLSOCKET_CAMEL +/* includes start */ +#ifdef HAVE_WINDOWS_H +# ifndef WIN32_LEAN_AND_MEAN +# define WIN32_LEAN_AND_MEAN +# endif +# include +# ifdef HAVE_WINSOCK2_H +# include +# else +# ifdef HAVE_WINSOCK_H +# include +# endif +# endif +#endif + +int +main () +{ + +/* IoctlSocket source code */ + if(0 != IoctlSocket(0, 0, 0)) + return 1; + ; + return 0; +} +#endif +#ifdef HAVE_IOCTLSOCKET_CAMEL_FIONBIO +/* includes start */ +#ifdef HAVE_WINDOWS_H +# ifndef WIN32_LEAN_AND_MEAN +# define WIN32_LEAN_AND_MEAN +# endif +# include +# ifdef HAVE_WINSOCK2_H +# include +# else +# ifdef HAVE_WINSOCK_H +# include +# endif +# endif +#endif + +int +main () +{ + +/* IoctlSocket source code */ + long flags = 0; + if(0 != ioctlsocket(0, FIONBIO, &flags)) + return 1; + ; + return 0; +} +#endif +#ifdef HAVE_IOCTLSOCKET_FIONBIO +/* includes start */ +#ifdef HAVE_WINDOWS_H +# ifndef WIN32_LEAN_AND_MEAN +# define WIN32_LEAN_AND_MEAN +# endif +# include +# ifdef HAVE_WINSOCK2_H +# include +# else +# ifdef HAVE_WINSOCK_H +# include +# endif +# endif +#endif + +int +main () +{ + + int flags = 0; + if(0 != ioctlsocket(0, FIONBIO, &flags)) + return 1; + + ; + return 0; +} +#endif +#ifdef HAVE_IOCTL_FIONBIO +/* headers for FIONBIO test */ +/* includes start */ +#ifdef HAVE_SYS_TYPES_H +# include +#endif +#ifdef HAVE_UNISTD_H +# include +#endif +#ifdef HAVE_SYS_SOCKET_H +# include +#endif +#ifdef HAVE_SYS_IOCTL_H +# include +#endif +#ifdef HAVE_STROPTS_H +# include +#endif + +int +main () +{ + + int flags = 0; + if(0 != ioctl(0, FIONBIO, &flags)) + return 1; + + ; + return 0; +} +#endif +#ifdef HAVE_IOCTL_SIOCGIFADDR +/* headers for FIONBIO test */ +/* includes start */ +#ifdef HAVE_SYS_TYPES_H +# include +#endif +#ifdef HAVE_UNISTD_H +# include +#endif +#ifdef HAVE_SYS_SOCKET_H +# include +#endif +#ifdef HAVE_SYS_IOCTL_H +# include +#endif +#ifdef HAVE_STROPTS_H +# include +#endif +#include + +int +main () +{ + struct ifreq ifr; + if(0 != ioctl(0, SIOCGIFADDR, &ifr)) + return 1; + + ; + return 0; +} +#endif +#ifdef HAVE_SETSOCKOPT_SO_NONBLOCK +/* includes start */ +#ifdef HAVE_WINDOWS_H +# ifndef WIN32_LEAN_AND_MEAN +# define WIN32_LEAN_AND_MEAN +# endif +# include +# ifdef HAVE_WINSOCK2_H +# include +# else +# ifdef HAVE_WINSOCK_H +# include +# endif +# endif +#endif +/* includes start */ +#ifdef HAVE_SYS_TYPES_H +# include +#endif +#ifdef HAVE_SYS_SOCKET_H +# include +#endif +/* includes end */ + +int +main () +{ + if(0 != setsockopt(0, SOL_SOCKET, SO_NONBLOCK, 0, 0)) + return 1; + ; + return 0; +} +#endif +#ifdef HAVE_GLIBC_STRERROR_R +#include +#include +int +main () { + char buffer[1024]; /* big enough to play with */ + char *string = + strerror_r(EACCES, buffer, sizeof(buffer)); + /* this should've returned a string */ + if(!string || !string[0]) + return 99; + return 0; +} +#endif +#ifdef HAVE_POSIX_STRERROR_R +#include +#include +int +main () { + char buffer[1024]; /* big enough to play with */ + int error = + strerror_r(EACCES, buffer, sizeof(buffer)); + /* This should've returned zero, and written an error string in the + buffer.*/ + if(!buffer[0] || error) + return 99; + return 0; +} +#endif diff --git a/mobicore/common/curl/CMake/FindOpenSSL.cmake b/mobicore/common/curl/CMake/FindOpenSSL.cmake new file mode 100644 index 0000000000000000000000000000000000000000..63a9d60625c8b4be5dc3b7823e643451f9fa6a49 --- /dev/null +++ b/mobicore/common/curl/CMake/FindOpenSSL.cmake @@ -0,0 +1,19 @@ +# Extension of the standard FindOpenSSL.cmake +# Adds OPENSSL_INCLUDE_DIRS and libeay32 +include("${CMAKE_ROOT}/Modules/FindOpenSSL.cmake") + +# Bill Hoffman told that libeay32 is necessary for him: +find_library(SSL_LIBEAY NAMES libeay32) + +if(OPENSSL_FOUND) + if(SSL_LIBEAY) + list(APPEND OPENSSL_LIBRARIES ${SSL_LIBEAY}) + else() + set(OPENSSL_FOUND FALSE) + endif() +endif() + + +if(OPENSSL_FOUND) + set(OPENSSL_INCLUDE_DIRS ${OPENSSL_INCLUDE_DIR}) +endif() diff --git a/mobicore/common/curl/CMake/FindZLIB.cmake b/mobicore/common/curl/CMake/FindZLIB.cmake new file mode 100644 index 0000000000000000000000000000000000000000..87f1d4fe894fe40f8c5841abbc6c20bf7b5c0e3e --- /dev/null +++ b/mobicore/common/curl/CMake/FindZLIB.cmake @@ -0,0 +1,8 @@ +# Locate zlib +include("${CMAKE_ROOT}/Modules/FindZLIB.cmake") + +find_library(ZLIB_LIBRARY_DEBUG NAMES zd zlibd zdlld zlib1d ) + +if(ZLIB_FOUND AND ZLIB_LIBRARY_DEBUG) + set( ZLIB_LIBRARIES optimized "${ZLIB_LIBRARY}" debug ${ZLIB_LIBRARY_DEBUG}) +endif() diff --git a/mobicore/common/curl/CMake/OtherTests.cmake b/mobicore/common/curl/CMake/OtherTests.cmake new file mode 100644 index 0000000000000000000000000000000000000000..89d0048445d79ff899974af7543d9f8286bfb98f --- /dev/null +++ b/mobicore/common/curl/CMake/OtherTests.cmake @@ -0,0 +1,250 @@ +include(CurlCheckCSourceCompiles) +set(EXTRA_DEFINES "__unused1\n#undef inline\n#define __unused2") +set(HEADER_INCLUDES) +set(headers_hack) + +macro(add_header_include check header) + if(${check}) + set(headers_hack + "${headers_hack}\n#include <${header}>") + #SET(HEADER_INCLUDES + # ${HEADER_INCLUDES} + # "${header}") + endif(${check}) +endmacro(add_header_include) + +set(signature_call_conv) +if(HAVE_WINDOWS_H) + add_header_include(HAVE_WINDOWS_H "windows.h") + add_header_include(HAVE_WINSOCK2_H "winsock2.h") + add_header_include(HAVE_WINSOCK_H "winsock.h") + set(EXTRA_DEFINES ${EXTRA_DEFINES} + "__unused7\n#ifndef WIN32_LEAN_AND_MEAN\n#define WIN32_LEAN_AND_MEAN\n#endif\n#define __unused3") + set(signature_call_conv "PASCAL") +else(HAVE_WINDOWS_H) + add_header_include(HAVE_SYS_TYPES_H "sys/types.h") + add_header_include(HAVE_SYS_SOCKET_H "sys/socket.h") +endif(HAVE_WINDOWS_H) + +set(EXTRA_DEFINES_BACKUP "${EXTRA_DEFINES}") +set(EXTRA_DEFINES "${EXTRA_DEFINES_BACKUP}\n${headers_hack}\n${extern_line}\n#define __unused5") +curl_check_c_source_compiles("recv(0, 0, 0, 0)" curl_cv_recv) +if(curl_cv_recv) + # AC_CACHE_CHECK([types of arguments and return type for recv], + #[curl_cv_func_recv_args], [ + #SET(curl_cv_func_recv_args "unknown") + #for recv_retv in 'int' 'ssize_t'; do + if(NOT DEFINED curl_cv_func_recv_args OR "${curl_cv_func_recv_args}" STREQUAL "unknown") + foreach(recv_retv "int" "ssize_t" ) + foreach(recv_arg1 "int" "ssize_t" "SOCKET") + foreach(recv_arg2 "void *" "char *") + foreach(recv_arg3 "size_t" "int" "socklen_t" "unsigned int") + foreach(recv_arg4 "int" "unsigned int") + if(NOT curl_cv_func_recv_done) + set(curl_cv_func_recv_test "UNKNOWN") + set(extern_line "extern ${recv_retv} ${signature_call_conv} recv(${recv_arg1}, ${recv_arg2}, ${recv_arg3}, ${recv_arg4})\;") + set(EXTRA_DEFINES "${EXTRA_DEFINES_BACKUP}\n${headers_hack}\n${extern_line}\n#define __unused5") + curl_check_c_source_compiles(" + ${recv_arg1} s=0; + ${recv_arg2} buf=0; + ${recv_arg3} len=0; + ${recv_arg4} flags=0; + ${recv_retv} res = recv(s, buf, len, flags)" + curl_cv_func_recv_test + "${recv_retv} recv(${recv_arg1}, ${recv_arg2}, ${recv_arg3}, ${recv_arg4})") + if(curl_cv_func_recv_test) + set(curl_cv_func_recv_args + "${recv_arg1},${recv_arg2},${recv_arg3},${recv_arg4},${recv_retv}") + set(RECV_TYPE_ARG1 "${recv_arg1}") + set(RECV_TYPE_ARG2 "${recv_arg2}") + set(RECV_TYPE_ARG3 "${recv_arg3}") + set(RECV_TYPE_ARG4 "${recv_arg4}") + set(RECV_TYPE_RETV "${recv_retv}") + set(HAVE_RECV 1) + set(curl_cv_func_recv_done 1) + endif(curl_cv_func_recv_test) + endif(NOT curl_cv_func_recv_done) + endforeach(recv_arg4) + endforeach(recv_arg3) + endforeach(recv_arg2) + endforeach(recv_arg1) + endforeach(recv_retv) + else(NOT DEFINED curl_cv_func_recv_args OR "${curl_cv_func_recv_args}" STREQUAL "unknown") + string(REGEX REPLACE "^([^,]*),[^,]*,[^,]*,[^,]*,[^,]*$" "\\1" RECV_TYPE_ARG1 "${curl_cv_func_recv_args}") + string(REGEX REPLACE "^[^,]*,([^,]*),[^,]*,[^,]*,[^,]*$" "\\1" RECV_TYPE_ARG2 "${curl_cv_func_recv_args}") + string(REGEX REPLACE "^[^,]*,[^,]*,([^,]*),[^,]*,[^,]*$" "\\1" RECV_TYPE_ARG3 "${curl_cv_func_recv_args}") + string(REGEX REPLACE "^[^,]*,[^,]*,[^,]*,([^,]*),[^,]*$" "\\1" RECV_TYPE_ARG4 "${curl_cv_func_recv_args}") + string(REGEX REPLACE "^[^,]*,[^,]*,[^,]*,[^,]*,([^,]*)$" "\\1" RECV_TYPE_RETV "${curl_cv_func_recv_args}") + #MESSAGE("RECV_TYPE_ARG1 ${RECV_TYPE_ARG1}") + #MESSAGE("RECV_TYPE_ARG2 ${RECV_TYPE_ARG2}") + #MESSAGE("RECV_TYPE_ARG3 ${RECV_TYPE_ARG3}") + #MESSAGE("RECV_TYPE_ARG4 ${RECV_TYPE_ARG4}") + #MESSAGE("RECV_TYPE_RETV ${RECV_TYPE_RETV}") + endif(NOT DEFINED curl_cv_func_recv_args OR "${curl_cv_func_recv_args}" STREQUAL "unknown") + + if("${curl_cv_func_recv_args}" STREQUAL "unknown") + message(FATAL_ERROR "Cannot find proper types to use for recv args") + endif("${curl_cv_func_recv_args}" STREQUAL "unknown") +else(curl_cv_recv) + message(FATAL_ERROR "Unable to link function recv") +endif(curl_cv_recv) +set(curl_cv_func_recv_args "${curl_cv_func_recv_args}" CACHE INTERNAL "Arguments for recv") +set(HAVE_RECV 1) + +curl_check_c_source_compiles("send(0, 0, 0, 0)" curl_cv_send) +if(curl_cv_send) + # AC_CACHE_CHECK([types of arguments and return type for send], + #[curl_cv_func_send_args], [ + #SET(curl_cv_func_send_args "unknown") + #for send_retv in 'int' 'ssize_t'; do + if(NOT DEFINED curl_cv_func_send_args OR "${curl_cv_func_send_args}" STREQUAL "unknown") + foreach(send_retv "int" "ssize_t" ) + foreach(send_arg1 "int" "ssize_t" "SOCKET") + foreach(send_arg2 "const void *" "void *" "char *" "const char *") + foreach(send_arg3 "size_t" "int" "socklen_t" "unsigned int") + foreach(send_arg4 "int" "unsigned int") + if(NOT curl_cv_func_send_done) + set(curl_cv_func_send_test "UNKNOWN") + set(extern_line "extern ${send_retv} ${signature_call_conv} send(${send_arg1}, ${send_arg2}, ${send_arg3}, ${send_arg4})\;") + set(EXTRA_DEFINES "${EXTRA_DEFINES_BACKUP}\n${headers_hack}\n${extern_line}\n#define __unused5") + curl_check_c_source_compiles(" + ${send_arg1} s=0; + ${send_arg2} buf=0; + ${send_arg3} len=0; + ${send_arg4} flags=0; + ${send_retv} res = send(s, buf, len, flags)" + curl_cv_func_send_test + "${send_retv} send(${send_arg1}, ${send_arg2}, ${send_arg3}, ${send_arg4})") + if(curl_cv_func_send_test) + #MESSAGE("Found arguments: ${curl_cv_func_send_test}") + string(REGEX REPLACE "(const) .*" "\\1" send_qual_arg2 "${send_arg2}") + string(REGEX REPLACE "const (.*)" "\\1" send_arg2 "${send_arg2}") + set(curl_cv_func_send_args + "${send_arg1},${send_arg2},${send_arg3},${send_arg4},${send_retv},${send_qual_arg2}") + set(SEND_TYPE_ARG1 "${send_arg1}") + set(SEND_TYPE_ARG2 "${send_arg2}") + set(SEND_TYPE_ARG3 "${send_arg3}") + set(SEND_TYPE_ARG4 "${send_arg4}") + set(SEND_TYPE_RETV "${send_retv}") + set(HAVE_SEND 1) + set(curl_cv_func_send_done 1) + endif(curl_cv_func_send_test) + endif(NOT curl_cv_func_send_done) + endforeach(send_arg4) + endforeach(send_arg3) + endforeach(send_arg2) + endforeach(send_arg1) + endforeach(send_retv) + else(NOT DEFINED curl_cv_func_send_args OR "${curl_cv_func_send_args}" STREQUAL "unknown") + string(REGEX REPLACE "^([^,]*),[^,]*,[^,]*,[^,]*,[^,]*,[^,]*$" "\\1" SEND_TYPE_ARG1 "${curl_cv_func_send_args}") + string(REGEX REPLACE "^[^,]*,([^,]*),[^,]*,[^,]*,[^,]*,[^,]*$" "\\1" SEND_TYPE_ARG2 "${curl_cv_func_send_args}") + string(REGEX REPLACE "^[^,]*,[^,]*,([^,]*),[^,]*,[^,]*,[^,]*$" "\\1" SEND_TYPE_ARG3 "${curl_cv_func_send_args}") + string(REGEX REPLACE "^[^,]*,[^,]*,[^,]*,([^,]*),[^,]*,[^,]*$" "\\1" SEND_TYPE_ARG4 "${curl_cv_func_send_args}") + string(REGEX REPLACE "^[^,]*,[^,]*,[^,]*,[^,]*,([^,]*),[^,]*$" "\\1" SEND_TYPE_RETV "${curl_cv_func_send_args}") + string(REGEX REPLACE "^[^,]*,[^,]*,[^,]*,[^,]*,[^,]*,([^,]*)$" "\\1" SEND_QUAL_ARG2 "${curl_cv_func_send_args}") + #MESSAGE("SEND_TYPE_ARG1 ${SEND_TYPE_ARG1}") + #MESSAGE("SEND_TYPE_ARG2 ${SEND_TYPE_ARG2}") + #MESSAGE("SEND_TYPE_ARG3 ${SEND_TYPE_ARG3}") + #MESSAGE("SEND_TYPE_ARG4 ${SEND_TYPE_ARG4}") + #MESSAGE("SEND_TYPE_RETV ${SEND_TYPE_RETV}") + #MESSAGE("SEND_QUAL_ARG2 ${SEND_QUAL_ARG2}") + endif(NOT DEFINED curl_cv_func_send_args OR "${curl_cv_func_send_args}" STREQUAL "unknown") + + if("${curl_cv_func_send_args}" STREQUAL "unknown") + message(FATAL_ERROR "Cannot find proper types to use for send args") + endif("${curl_cv_func_send_args}" STREQUAL "unknown") + set(SEND_QUAL_ARG2 "const") +else(curl_cv_send) + message(FATAL_ERROR "Unable to link function send") +endif(curl_cv_send) +set(curl_cv_func_send_args "${curl_cv_func_send_args}" CACHE INTERNAL "Arguments for send") +set(HAVE_SEND 1) + +set(EXTRA_DEFINES "${EXTRA_DEFINES}\n${headers_hack}\n#define __unused5") +curl_check_c_source_compiles("int flag = MSG_NOSIGNAL" HAVE_MSG_NOSIGNAL) + +set(EXTRA_DEFINES "__unused1\n#undef inline\n#define __unused2") +set(HEADER_INCLUDES) +set(headers_hack) + +macro(add_header_include check header) + if(${check}) + set(headers_hack + "${headers_hack}\n#include <${header}>") + #SET(HEADER_INCLUDES + # ${HEADER_INCLUDES} + # "${header}") + endif(${check}) +endmacro(add_header_include header) + +if(HAVE_WINDOWS_H) + set(EXTRA_DEFINES ${EXTRA_DEFINES} + "__unused7\n#ifndef WIN32_LEAN_AND_MEAN\n#define WIN32_LEAN_AND_MEAN\n#endif\n#define __unused3") + add_header_include(HAVE_WINDOWS_H "windows.h") + add_header_include(HAVE_WINSOCK2_H "winsock2.h") + add_header_include(HAVE_WINSOCK_H "winsock.h") +else(HAVE_WINDOWS_H) + add_header_include(HAVE_SYS_TYPES_H "sys/types.h") + add_header_include(HAVE_SYS_TIME_H "sys/time.h") + add_header_include(TIME_WITH_SYS_TIME "time.h") + add_header_include(HAVE_TIME_H "time.h") +endif(HAVE_WINDOWS_H) +set(EXTRA_DEFINES "${EXTRA_DEFINES}\n${headers_hack}\n#define __unused5") +curl_check_c_source_compiles("struct timeval ts;\nts.tv_sec = 0;\nts.tv_usec = 0" HAVE_STRUCT_TIMEVAL) + + +include(CurlCheckCSourceRuns) +set(EXTRA_DEFINES) +set(HEADER_INCLUDES) +if(HAVE_SYS_POLL_H) + set(HEADER_INCLUDES "sys/poll.h") +endif(HAVE_SYS_POLL_H) +curl_check_c_source_runs("return poll((void *)0, 0, 10 /*ms*/)" HAVE_POLL_FINE) + +set(HAVE_SIG_ATOMIC_T 1) +set(EXTRA_DEFINES) +set(HEADER_INCLUDES) +if(HAVE_SIGNAL_H) + set(HEADER_INCLUDES "signal.h") + set(CMAKE_EXTRA_INCLUDE_FILES "signal.h") +endif(HAVE_SIGNAL_H) +check_type_size("sig_atomic_t" SIZEOF_SIG_ATOMIC_T) +if(HAVE_SIZEOF_SIG_ATOMIC_T) + curl_check_c_source_compiles("static volatile sig_atomic_t dummy = 0" HAVE_SIG_ATOMIC_T_NOT_VOLATILE) + if(NOT HAVE_SIG_ATOMIC_T_NOT_VOLATILE) + set(HAVE_SIG_ATOMIC_T_VOLATILE 1) + endif(NOT HAVE_SIG_ATOMIC_T_NOT_VOLATILE) +endif(HAVE_SIZEOF_SIG_ATOMIC_T) + +set(CHECK_TYPE_SIZE_PREINCLUDE + "#undef inline") + +if(HAVE_WINDOWS_H) + set(CHECK_TYPE_SIZE_PREINCLUDE "${CHECK_TYPE_SIZE_PREINCLUDE} + #ifndef WIN32_LEAN_AND_MEAN + #define WIN32_LEAN_AND_MEAN + #endif + #include ") + if(HAVE_WINSOCK2_H) + set(CHECK_TYPE_SIZE_PREINCLUDE "${CHECK_TYPE_SIZE_PREINCLUDE}\n#include ") + endif(HAVE_WINSOCK2_H) +else(HAVE_WINDOWS_H) + if(HAVE_SYS_SOCKET_H) + set(CMAKE_EXTRA_INCLUDE_FILES ${CMAKE_EXTRA_INCLUDE_FILES} + "sys/socket.h") + endif(HAVE_SYS_SOCKET_H) + if(HAVE_NETINET_IN_H) + set(CMAKE_EXTRA_INCLUDE_FILES ${CMAKE_EXTRA_INCLUDE_FILES} + "netinet/in.h") + endif(HAVE_NETINET_IN_H) + if(HAVE_ARPA_INET_H) + set(CMAKE_EXTRA_INCLUDE_FILES ${CMAKE_EXTRA_INCLUDE_FILES} + "arpa/inet.h") + endif(HAVE_ARPA_INET_H) +endif(HAVE_WINDOWS_H) + +check_type_size("struct sockaddr_storage" SIZEOF_STRUCT_SOCKADDR_STORAGE) +if(HAVE_SIZEOF_STRUCT_SOCKADDR_STORAGE) + set(HAVE_STRUCT_SOCKADDR_STORAGE 1) +endif(HAVE_SIZEOF_STRUCT_SOCKADDR_STORAGE) + diff --git a/mobicore/common/curl/CMake/Platforms/WindowsCache.cmake b/mobicore/common/curl/CMake/Platforms/WindowsCache.cmake new file mode 100644 index 0000000000000000000000000000000000000000..49161f86d06bb3f6656cc029c540504ae8ff53ac --- /dev/null +++ b/mobicore/common/curl/CMake/Platforms/WindowsCache.cmake @@ -0,0 +1,121 @@ +if(NOT UNIX) + if(WIN32) + set(HAVE_LIBDL 0) + set(HAVE_LIBUCB 0) + set(HAVE_LIBSOCKET 0) + set(NOT_NEED_LIBNSL 0) + set(HAVE_LIBNSL 0) + set(HAVE_LIBZ 0) + set(HAVE_LIBCRYPTO 0) + + set(HAVE_DLOPEN 0) + + set(HAVE_ALLOCA_H 0) + set(HAVE_ARPA_INET_H 0) + set(HAVE_DLFCN_H 0) + set(HAVE_FCNTL_H 1) + set(HAVE_FEATURES_H 0) + set(HAVE_INTTYPES_H 0) + set(HAVE_IO_H 1) + set(HAVE_MALLOC_H 1) + set(HAVE_MEMORY_H 1) + set(HAVE_NETDB_H 0) + set(HAVE_NETINET_IF_ETHER_H 0) + set(HAVE_NETINET_IN_H 0) + set(HAVE_NET_IF_H 0) + set(HAVE_PROCESS_H 1) + set(HAVE_PWD_H 0) + set(HAVE_SETJMP_H 1) + set(HAVE_SGTTY_H 0) + set(HAVE_SIGNAL_H 1) + set(HAVE_SOCKIO_H 0) + set(HAVE_STDINT_H 0) + set(HAVE_STDLIB_H 1) + set(HAVE_STRINGS_H 0) + set(HAVE_STRING_H 1) + set(HAVE_SYS_PARAM_H 0) + set(HAVE_SYS_POLL_H 0) + set(HAVE_SYS_SELECT_H 0) + set(HAVE_SYS_SOCKET_H 0) + set(HAVE_SYS_SOCKIO_H 0) + set(HAVE_SYS_STAT_H 1) + set(HAVE_SYS_TIME_H 0) + set(HAVE_SYS_TYPES_H 1) + set(HAVE_SYS_UTIME_H 1) + set(HAVE_TERMIOS_H 0) + set(HAVE_TERMIO_H 0) + set(HAVE_TIME_H 1) + set(HAVE_UNISTD_H 0) + set(HAVE_UTIME_H 0) + set(HAVE_X509_H 0) + set(HAVE_ZLIB_H 0) + + set(HAVE_SIZEOF_LONG_DOUBLE 1) + set(SIZEOF_LONG_DOUBLE 8) + + set(HAVE_SOCKET 1) + set(HAVE_POLL 0) + set(HAVE_SELECT 1) + set(HAVE_STRDUP 1) + set(HAVE_STRSTR 1) + set(HAVE_STRTOK_R 0) + set(HAVE_STRFTIME 1) + set(HAVE_UNAME 0) + set(HAVE_STRCASECMP 0) + set(HAVE_STRICMP 1) + set(HAVE_STRCMPI 1) + set(HAVE_GETHOSTBYADDR 1) + set(HAVE_GETTIMEOFDAY 0) + set(HAVE_INET_ADDR 1) + set(HAVE_INET_NTOA 1) + set(HAVE_INET_NTOA_R 0) + set(HAVE_TCGETATTR 0) + set(HAVE_TCSETATTR 0) + set(HAVE_PERROR 1) + set(HAVE_CLOSESOCKET 1) + set(HAVE_SETVBUF 0) + set(HAVE_SIGSETJMP 0) + set(HAVE_GETPASS_R 0) + set(HAVE_STRLCAT 0) + set(HAVE_GETPWUID 0) + set(HAVE_GETEUID 0) + set(HAVE_UTIME 1) + set(HAVE_RAND_EGD 0) + set(HAVE_RAND_SCREEN 0) + set(HAVE_RAND_STATUS 0) + set(HAVE_GMTIME_R 0) + set(HAVE_LOCALTIME_R 0) + set(HAVE_GETHOSTBYADDR_R 0) + set(HAVE_GETHOSTBYNAME_R 0) + set(HAVE_SIGNAL_FUNC 1) + set(HAVE_SIGNAL_MACRO 0) + + set(HAVE_GETHOSTBYADDR_R_5 0) + set(HAVE_GETHOSTBYADDR_R_5_REENTRANT 0) + set(HAVE_GETHOSTBYADDR_R_7 0) + set(HAVE_GETHOSTBYADDR_R_7_REENTRANT 0) + set(HAVE_GETHOSTBYADDR_R_8 0) + set(HAVE_GETHOSTBYADDR_R_8_REENTRANT 0) + set(HAVE_GETHOSTBYNAME_R_3 0) + set(HAVE_GETHOSTBYNAME_R_3_REENTRANT 0) + set(HAVE_GETHOSTBYNAME_R_5 0) + set(HAVE_GETHOSTBYNAME_R_5_REENTRANT 0) + set(HAVE_GETHOSTBYNAME_R_6 0) + set(HAVE_GETHOSTBYNAME_R_6_REENTRANT 0) + + set(TIME_WITH_SYS_TIME 0) + set(HAVE_O_NONBLOCK 0) + set(HAVE_IN_ADDR_T 0) + set(HAVE_INET_NTOA_R_DECL 0) + set(HAVE_INET_NTOA_R_DECL_REENTRANT 0) + set(HAVE_GETADDRINFO 0) + set(STDC_HEADERS 1) + set(RETSIGTYPE_TEST 1) + + set(HAVE_SIGACTION 0) + set(HAVE_MACRO_SIGSETJMP 0) + else(WIN32) + message("This file should be included on Windows platform only") + endif(WIN32) +endif(NOT UNIX) + diff --git a/mobicore/common/curl/CMake/Utilities.cmake b/mobicore/common/curl/CMake/Utilities.cmake new file mode 100644 index 0000000000000000000000000000000000000000..37cdfe3bf65c22e003cef0da0c120e10f6fc1450 --- /dev/null +++ b/mobicore/common/curl/CMake/Utilities.cmake @@ -0,0 +1,31 @@ +# File containing various utilities + +# Converts a CMake list to a string containing elements separated by spaces +function(TO_LIST_SPACES _LIST_NAME OUTPUT_VAR) + set(NEW_LIST_SPACE) + foreach(ITEM ${${_LIST_NAME}}) + set(NEW_LIST_SPACE "${NEW_LIST_SPACE} ${ITEM}") + endforeach() + string(STRIP ${NEW_LIST_SPACE} NEW_LIST_SPACE) + set(${OUTPUT_VAR} "${NEW_LIST_SPACE}" PARENT_SCOPE) +endfunction() + +# Appends a lis of item to a string which is a space-separated list, if they don't already exist. +function(LIST_SPACES_APPEND_ONCE LIST_NAME) + string(REPLACE " " ";" _LIST ${${LIST_NAME}}) + list(APPEND _LIST ${ARGN}) + list(REMOVE_DUPLICATES _LIST) + to_list_spaces(_LIST NEW_LIST_SPACE) + set(${LIST_NAME} "${NEW_LIST_SPACE}" PARENT_SCOPE) +endfunction() + +# Convinience function that does the same as LIST(FIND ...) but with a TRUE/FALSE return value. +# Ex: IN_STR_LIST(MY_LIST "Searched item" WAS_FOUND) +function(IN_STR_LIST LIST_NAME ITEM_SEARCHED RETVAL) + list(FIND ${LIST_NAME} ${ITEM_SEARCHED} FIND_POS) + if(${FIND_POS} EQUAL -1) + set(${RETVAL} FALSE PARENT_SCOPE) + else() + set(${RETVAL} TRUE PARENT_SCOPE) + endif() +endfunction() diff --git a/mobicore/common/curl/CMakeLists.txt b/mobicore/common/curl/CMakeLists.txt new file mode 100644 index 0000000000000000000000000000000000000000..244085b0218f2e097717efe55791769b4510c983 --- /dev/null +++ b/mobicore/common/curl/CMakeLists.txt @@ -0,0 +1,854 @@ +# cURL/libcurl CMake script +# by Tetetest and Sukender (Benoit Neil) + +# TODO: +# The output .so file lacks the soname number which we currently have within the lib/Makefile.am file +# Add full (4 or 5 libs) SSL support +# Add INSTALL target (EXTRA_DIST variables in Makefile.am may be moved to Makefile.inc so that CMake/CPack is aware of what's to include). +# Add CTests(?) +# Check on all possible platforms +# Test with as many configurations possible (With or without any option) +# Create scripts that help keeping the CMake build system up to date (to reduce maintenance). According to Tetetest: +# - lists of headers that 'configure' checks for; +# - curl-specific tests (the ones that are in m4/curl-*.m4 files); +# - (most obvious thing:) curl version numbers. +# Add documentation subproject +# +# To check: +# (From Daniel Stenberg) The cmake build selected to run gcc with -fPIC on my box while the plain configure script did not. +# (From Daniel Stenberg) The gcc command line use neither -g nor any -O options. As a developer, I also treasure our configure scripts's --enable-debug option that sets a long range of "picky" compiler options. +cmake_minimum_required(VERSION 2.6.2 FATAL_ERROR) +set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/CMake;${CMAKE_MODULE_PATH}") +include(Utilities) + +project( CURL C ) + + +file (READ ${CURL_SOURCE_DIR}/include/curl/curlver.h CURL_VERSION_H_CONTENTS) +string (REGEX MATCH "LIBCURL_VERSION_MAJOR[ \t]+([0-9]+)" + LIBCURL_VERSION_MJ ${CURL_VERSION_H_CONTENTS}) +string (REGEX MATCH "([0-9]+)" + LIBCURL_VERSION_MJ ${LIBCURL_VERSION_MJ}) +string (REGEX MATCH + "LIBCURL_VERSION_MINOR[ \t]+([0-9]+)" + LIBCURL_VERSION_MI ${CURL_VERSION_H_CONTENTS}) +string (REGEX MATCH "([0-9]+)" LIBCURL_VERSION_MI ${LIBCURL_VERSION_MI}) +string (REGEX MATCH + "LIBCURL_VERSION_PATCH[ \t]+([0-9]+)" + LIBCURL_VERSION_PT ${CURL_VERSION_H_CONTENTS}) +string (REGEX MATCH "([0-9]+)" LIBCURL_VERSION_PT ${LIBCURL_VERSION_PT}) +set (CURL_MAJOR_VERSION ${LIBCURL_VERSION_MJ}) +set (CURL_MINOR_VERSION ${LIBCURL_VERSION_MI}) +set (CURL_PATCH_VERSION ${LIBCURL_VERSION_PT}) + +include_regular_expression("^.*$") # Sukender: Is it necessary? + +# Setup package meta-data +# SET(PACKAGE "curl") +set(CURL_VERSION ${CURL_MAJOR_VERSION}.${CURL_MINOR_VERSION}.${CURL_PATCH_VERSION}) +message(STATUS "curl version=[${CURL_VERSION}]") +# SET(PACKAGE_TARNAME "curl") +# SET(PACKAGE_NAME "curl") +# SET(PACKAGE_VERSION "-") +# SET(PACKAGE_STRING "curl-") +# SET(PACKAGE_BUGREPORT "a suitable curl mailing list => http://curl.haxx.se/mail/") +set(OPERATING_SYSTEM "${CMAKE_SYSTEM_NAME}") +set(OS "\"${CMAKE_SYSTEM_NAME}\"") + +include_directories(${PROJECT_BINARY_DIR}/include/curl) +include_directories( ${CURL_SOURCE_DIR}/include ) + +if(WIN32) + set(NATIVE_WINDOWS ON) +endif() + +option(BUILD_CURL_EXE "Set to ON to build cURL executable." ON) +option(BUILD_CURL_TESTS "Set to ON to build cURL tests." ON) +option(CURL_STATICLIB "Set to ON to build libcurl with static linking." OFF) +option(CURL_USE_ARES "Set to ON to enable c-ares support" OFF) +# initialize CURL_LIBS +set(CURL_LIBS "") + +if(CURL_USE_ARES) + set(USE_ARES ${CURL_USE_ARES}) + find_package(CARES REQUIRED) + list(APPEND CURL_LIBS ${CARES_LIBRARY} ) + set(CURL_LIBS ${CURL_LIBS} ${CARES_LIBRARY}) +endif() + +option(BUILD_DASHBOARD_REPORTS "Set to ON to activate reporting of cURL builds here http://www.cdash.org/CDashPublic/index.php?project=CURL" OFF) +if(BUILD_DASHBOARD_REPORTS) + #INCLUDE(Dart) + include(CTest) +endif(BUILD_DASHBOARD_REPORTS) + +if(MSVC) + option(BUILD_RELEASE_DEBUG_DIRS "Set OFF to build each configuration to a separate directory" OFF) + mark_as_advanced(BUILD_RELEASE_DEBUG_DIRS) +endif() + +option(CURL_HIDDEN_SYMBOLS "Set to ON to hide libcurl internal symbols (=hide all symbols that aren't officially external)." ON) +mark_as_advanced(CURL_HIDDEN_SYMBOLS) + +# IF(WIN32) +# OPTION(CURL_WINDOWS_SSPI "Use windows libraries to allow NTLM authentication without openssl" ON) +# MARK_AS_ADVANCED(CURL_WINDOWS_SSPI) +# ENDIF() + +option(HTTP_ONLY "disables all protocols except HTTP (This overrides all CURL_DISABLE_* options)" OFF) +mark_as_advanced(HTTP_ONLY) +option(CURL_DISABLE_FTP "disables FTP" OFF) +mark_as_advanced(CURL_DISABLE_FTP) +option(CURL_DISABLE_LDAP "disables LDAP" OFF) +mark_as_advanced(CURL_DISABLE_LDAP) +option(CURL_DISABLE_TELNET "disables Telnet" OFF) +mark_as_advanced(CURL_DISABLE_TELNET) +option(CURL_DISABLE_DICT "disables DICT" OFF) +mark_as_advanced(CURL_DISABLE_DICT) +option(CURL_DISABLE_FILE "disables FILE" OFF) +mark_as_advanced(CURL_DISABLE_FILE) +option(CURL_DISABLE_TFTP "disables TFTP" OFF) +mark_as_advanced(CURL_DISABLE_TFTP) +option(CURL_DISABLE_HTTP "disables HTTP" OFF) +mark_as_advanced(CURL_DISABLE_HTTP) + +option(CURL_DISABLE_LDAPS "to disable LDAPS" OFF) +mark_as_advanced(CURL_DISABLE_LDAPS) +if(WIN32) + set(CURL_DEFAULT_DISABLE_LDAP OFF) + # some windows compilers do not have wldap32 + if( NOT HAVE_WLDAP32) + set(CURL_DISABLE_LDAP ON CACHE BOOL "" FORCE) + message(STATUS "wldap32 not found CURL_DISABLE_LDAP set ON") + option(CURL_LDAP_WIN "Use Windows LDAP implementation" OFF) + else() + option(CURL_LDAP_WIN "Use Windows LDAP implementation" ON) + endif() + mark_as_advanced(CURL_LDAP_WIN) +endif() + +if(HTTP_ONLY) + set(CURL_DISABLE_FTP ON) + set(CURL_DISABLE_LDAP ON) + set(CURL_DISABLE_TELNET ON) + set(CURL_DISABLE_DICT ON) + set(CURL_DISABLE_FILE ON) + set(CURL_DISABLE_TFTP ON) +endif() + +option(CURL_DISABLE_COOKIES "to disable cookies support" OFF) +mark_as_advanced(CURL_DISABLE_COOKIES) + +option(CURL_DISABLE_CRYPTO_AUTH "to disable cryptographic authentication" OFF) +mark_as_advanced(CURL_DISABLE_CRYPTO_AUTH) +option(CURL_DISABLE_VERBOSE_STRINGS "to disable verbose strings" OFF) +mark_as_advanced(CURL_DISABLE_VERBOSE_STRINGS) +option(DISABLED_THREADSAFE "Set to explicitly specify we don't want to use thread-safe functions" OFF) +mark_as_advanced(DISABLED_THREADSAFE) +option(ENABLE_IPV6 "Define if you want to enable IPv6 support" OFF) +mark_as_advanced(ENABLE_IPV6) + +if(WIN32) + list_spaces_append_once(CMAKE_C_STANDARD_LIBRARIES wsock32.lib ws2_32.lib) # bufferoverflowu.lib + if(CURL_DISABLE_LDAP) + # Remove wldap32.lib from space-separated list + string(REPLACE " " ";" _LIST ${CMAKE_C_STANDARD_LIBRARIES}) + list(REMOVE_ITEM _LIST "wldap32.lib") + to_list_spaces(_LIST CMAKE_C_STANDARD_LIBRARIES) + else() + # Append wldap32.lib + list_spaces_append_once(CMAKE_C_STANDARD_LIBRARIES wldap32.lib) + endif() + set(CMAKE_C_STANDARD_LIBRARIES "${CMAKE_C_STANDARD_LIBRARIES}" CACHE STRING "" FORCE) +endif() + + +# We need ansi c-flags, especially on HP +set(CMAKE_C_FLAGS "${CMAKE_ANSI_CFLAGS} ${CMAKE_C_FLAGS}") +set(CMAKE_REQUIRED_FLAGS ${CMAKE_ANSI_CFLAGS}) + +# Disable warnings on Borland to avoid changing 3rd party code. +if(BORLAND) + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -w-") +endif(BORLAND) + +# If we are on AIX, do the _ALL_SOURCE magic +if(${CMAKE_SYSTEM_NAME} MATCHES AIX) + set(_ALL_SOURCE 1) +endif(${CMAKE_SYSTEM_NAME} MATCHES AIX) + +# Include all the necessary files for macros +include (CheckFunctionExists) +include (CheckIncludeFile) +include (CheckIncludeFiles) +include (CheckLibraryExists) +include (CheckSymbolExists) +# if crosscompiling is on, the CHECK_TYPE_SIZE macro coming with cmake uses +# TRY_COMPILE instead of TRY_RUN which makes crosscompiling easier, Alex +if(CMAKE_CROSSCOMPILING) + include ("${CMAKE_MODULE_PATH}/CheckTypeSize.cmake") +else(CMAKE_CROSSCOMPILING) + include (CheckTypeSize) +endif(CMAKE_CROSSCOMPILING) + +# On windows preload settings +if(WIN32) + include(${CMAKE_CURRENT_SOURCE_DIR}/CMake/Platforms/WindowsCache.cmake) +endif(WIN32) + +# This macro checks if the symbol exists in the library and if it +# does, it appends library to the list. +macro(CHECK_LIBRARY_EXISTS_CONCAT LIBRARY SYMBOL VARIABLE) + check_library_exists("${LIBRARY};${CURL_LIBS}" ${SYMBOL} "" + ${VARIABLE}) + if(${VARIABLE}) + set(CURL_LIBS ${CURL_LIBS} ${LIBRARY}) + endif(${VARIABLE}) +endmacro(CHECK_LIBRARY_EXISTS_CONCAT) + +# Check for all needed libraries +check_library_exists_concat("dl" dlopen HAVE_LIBDL) +check_library_exists_concat("socket" connect HAVE_LIBSOCKET) +check_library_exists("c" gethostbyname "" NOT_NEED_LIBNSL) + +# Yellowtab Zeta needs different libraries than BeOS 5. +if(BEOS) + set(NOT_NEED_LIBNSL 1) + check_library_exists_concat("bind" gethostbyname HAVE_LIBBIND) + check_library_exists_concat("bnetapi" closesocket HAVE_LIBBNETAPI) +endif(BEOS) + +if(NOT NOT_NEED_LIBNSL) + check_library_exists_concat("nsl" gethostbyname HAVE_LIBNSL) +endif(NOT NOT_NEED_LIBNSL) + +check_library_exists_concat("ws2_32" getch HAVE_LIBWS2_32) +check_library_exists_concat("winmm" getch HAVE_LIBWINMM) +check_library_exists("wldap32" cldap_open "" HAVE_WLDAP32) + +# IF(NOT CURL_SPECIAL_LIBZ) +# CHECK_LIBRARY_EXISTS_CONCAT("z" inflateEnd HAVE_LIBZ) +# ENDIF(NOT CURL_SPECIAL_LIBZ) + +option(CMAKE_USE_OPENSSL "Use OpenSSL code. Experimental" ON) +mark_as_advanced(CMAKE_USE_OPENSSL) +if(CMAKE_USE_OPENSSL) + if(WIN32) + find_package(OpenSSL) + if(OPENSSL_FOUND) + set(USE_SSLEAY TRUE) + set(USE_OPENSSL TRUE) + list(APPEND CURL_LIBS ${OPENSSL_LIBRARIES} ) + else() + set(CMAKE_USE_OPENSSL FALSE) + message(STATUS "OpenSSL NOT Found, disabling CMAKE_USE_OPENSSL") + endif() + else(WIN32) + check_library_exists_concat("crypto" CRYPTO_lock HAVE_LIBCRYPTO) + check_library_exists_concat("ssl" SSL_connect HAVE_LIBSSL) + endif(WIN32) +endif(CMAKE_USE_OPENSSL) + +# Check for idn +check_library_exists_concat("idn" idna_to_ascii_lz HAVE_LIBIDN) + +# Check for LDAP +check_library_exists_concat("ldap" ldap_init HAVE_LIBLDAP) +# if(NOT HAVE_LIBLDAP) +# SET(CURL_DISABLE_LDAP ON) +# endif(NOT HAVE_LIBLDAP) + +# Check for symbol dlopen (same as HAVE_LIBDL) +check_library_exists("${CURL_LIBS}" dlopen "" HAVE_DLOPEN) + +# For other tests to use the same libraries +set(CMAKE_REQUIRED_LIBRARIES ${CURL_LIBS}) + +option(CURL_ZLIB "Set to ON to enable building cURL with zlib support." ON) +set(HAVE_LIBZ OFF) +set(HAVE_ZLIB_H OFF) +set(HAVE_ZLIB OFF) +if(CURL_ZLIB) # AND CURL_CONFIG_HAS_BEEN_RUN_BEFORE + find_package(ZLIB QUIET) + if(ZLIB_FOUND) + set(HAVE_ZLIB_H ON) + set(HAVE_ZLIB ON) + set(HAVE_LIBZ ON) + endif() +endif() + +# If we have features.h, then do the _BSD_SOURCE magic +check_include_file("features.h" HAVE_FEATURES_H) + +# Check if header file exists and add it to the list. +macro(CHECK_INCLUDE_FILE_CONCAT FILE VARIABLE) + check_include_files("${CURL_INCLUDES};${FILE}" ${VARIABLE}) + if(${VARIABLE}) + set(CURL_INCLUDES ${CURL_INCLUDES} ${FILE}) + set(CURL_TEST_DEFINES "${CURL_TEST_DEFINES} -D${VARIABLE}") + endif(${VARIABLE}) +endmacro(CHECK_INCLUDE_FILE_CONCAT) + + +# Check for header files +if(NOT UNIX) + check_include_file_concat("ws2tcpip.h" HAVE_WS2TCPIP_H) + check_include_file_concat("winsock2.h" HAVE_WINSOCK2_H) +endif(NOT UNIX) +check_include_file_concat("stdio.h" HAVE_STDIO_H) +if(NOT UNIX) + check_include_file_concat("windows.h" HAVE_WINDOWS_H) + check_include_file_concat("winsock.h" HAVE_WINSOCK_H) +endif(NOT UNIX) + +check_include_file_concat("inttypes.h" HAVE_INTTYPES_H) +check_include_file_concat("sys/filio.h" HAVE_SYS_FILIO_H) +check_include_file_concat("sys/ioctl.h" HAVE_SYS_IOCTL_H) +check_include_file_concat("sys/param.h" HAVE_SYS_PARAM_H) +check_include_file_concat("sys/poll.h" HAVE_SYS_POLL_H) +check_include_file_concat("sys/resource.h" HAVE_SYS_RESOURCE_H) +check_include_file_concat("sys/select.h" HAVE_SYS_SELECT_H) +check_include_file_concat("sys/socket.h" HAVE_SYS_SOCKET_H) +check_include_file_concat("sys/sockio.h" HAVE_SYS_SOCKIO_H) +check_include_file_concat("sys/stat.h" HAVE_SYS_STAT_H) +check_include_file_concat("sys/time.h" HAVE_SYS_TIME_H) +check_include_file_concat("sys/types.h" HAVE_SYS_TYPES_H) +check_include_file_concat("sys/uio.h" HAVE_SYS_UIO_H) +check_include_file_concat("sys/un.h" HAVE_SYS_UN_H) +check_include_file_concat("sys/utime.h" HAVE_SYS_UTIME_H) +check_include_file_concat("alloca.h" HAVE_ALLOCA_H) +check_include_file_concat("arpa/inet.h" HAVE_ARPA_INET_H) +check_include_file_concat("arpa/tftp.h" HAVE_ARPA_TFTP_H) +check_include_file_concat("assert.h" HAVE_ASSERT_H) +check_include_file_concat("crypto.h" HAVE_CRYPTO_H) +check_include_file_concat("des.h" HAVE_DES_H) +check_include_file_concat("err.h" HAVE_ERR_H) +check_include_file_concat("errno.h" HAVE_ERRNO_H) +check_include_file_concat("fcntl.h" HAVE_FCNTL_H) +check_include_file_concat("gssapi/gssapi.h" HAVE_GSSAPI_GSSAPI_H) +check_include_file_concat("gssapi/gssapi_generic.h" HAVE_GSSAPI_GSSAPI_GENERIC_H) +check_include_file_concat("gssapi/gssapi_krb5.h" HAVE_GSSAPI_GSSAPI_KRB5_H) +check_include_file_concat("idn-free.h" HAVE_IDN_FREE_H) +check_include_file_concat("ifaddrs.h" HAVE_IFADDRS_H) +check_include_file_concat("io.h" HAVE_IO_H) +check_include_file_concat("krb.h" HAVE_KRB_H) +check_include_file_concat("libgen.h" HAVE_LIBGEN_H) +check_include_file_concat("libssh2.h" HAVE_LIBSSH2_H) +check_include_file_concat("limits.h" HAVE_LIMITS_H) +check_include_file_concat("locale.h" HAVE_LOCALE_H) +check_include_file_concat("net/if.h" HAVE_NET_IF_H) +check_include_file_concat("netdb.h" HAVE_NETDB_H) +check_include_file_concat("netinet/in.h" HAVE_NETINET_IN_H) +check_include_file_concat("netinet/tcp.h" HAVE_NETINET_TCP_H) +check_include_file_concat("openssl/crypto.h" HAVE_OPENSSL_CRYPTO_H) +check_include_file_concat("openssl/engine.h" HAVE_OPENSSL_ENGINE_H) +check_include_file_concat("openssl/err.h" HAVE_OPENSSL_ERR_H) +check_include_file_concat("openssl/pem.h" HAVE_OPENSSL_PEM_H) +check_include_file_concat("openssl/pkcs12.h" HAVE_OPENSSL_PKCS12_H) +check_include_file_concat("openssl/rsa.h" HAVE_OPENSSL_RSA_H) +check_include_file_concat("openssl/ssl.h" HAVE_OPENSSL_SSL_H) +check_include_file_concat("openssl/x509.h" HAVE_OPENSSL_X509_H) +check_include_file_concat("pem.h" HAVE_PEM_H) +check_include_file_concat("poll.h" HAVE_POLL_H) +check_include_file_concat("pwd.h" HAVE_PWD_H) +check_include_file_concat("rsa.h" HAVE_RSA_H) +check_include_file_concat("setjmp.h" HAVE_SETJMP_H) +check_include_file_concat("sgtty.h" HAVE_SGTTY_H) +check_include_file_concat("signal.h" HAVE_SIGNAL_H) +check_include_file_concat("ssl.h" HAVE_SSL_H) +check_include_file_concat("stdbool.h" HAVE_STDBOOL_H) +check_include_file_concat("stdint.h" HAVE_STDINT_H) +check_include_file_concat("stdio.h" HAVE_STDIO_H) +check_include_file_concat("stdlib.h" HAVE_STDLIB_H) +check_include_file_concat("string.h" HAVE_STRING_H) +check_include_file_concat("strings.h" HAVE_STRINGS_H) +check_include_file_concat("stropts.h" HAVE_STROPTS_H) +check_include_file_concat("termio.h" HAVE_TERMIO_H) +check_include_file_concat("termios.h" HAVE_TERMIOS_H) +check_include_file_concat("time.h" HAVE_TIME_H) +check_include_file_concat("tld.h" HAVE_TLD_H) +check_include_file_concat("unistd.h" HAVE_UNISTD_H) +check_include_file_concat("utime.h" HAVE_UTIME_H) +check_include_file_concat("x509.h" HAVE_X509_H) + +check_include_file_concat("process.h" HAVE_PROCESS_H) +check_include_file_concat("stddef.h" HAVE_STDDEF_H) +check_include_file_concat("dlfcn.h" HAVE_DLFCN_H) +check_include_file_concat("malloc.h" HAVE_MALLOC_H) +check_include_file_concat("memory.h" HAVE_MEMORY_H) +check_include_file_concat("ldap.h" HAVE_LDAP_H) +check_include_file_concat("netinet/if_ether.h" HAVE_NETINET_IF_ETHER_H) +check_include_file_concat("stdint.h" HAVE_STDINT_H) +check_include_file_concat("sockio.h" HAVE_SOCKIO_H) +check_include_file_concat("sys/utsname.h" HAVE_SYS_UTSNAME_H) +check_include_file_concat("idna.h" HAVE_IDNA_H) + +if(CMAKE_USE_OPENSSL) + check_include_file_concat("openssl/rand.h" HAVE_OPENSSL_RAND_H) +endif(CMAKE_USE_OPENSSL) + +if(NOT HAVE_LDAP_H) + message(STATUS "LDAP_H not found CURL_DISABLE_LDAP set ON") + set(CURL_DISABLE_LDAP ON CACHE BOOL "" FORCE) +endif() + + +check_type_size(size_t SIZEOF_SIZE_T) +check_type_size(ssize_t SIZEOF_SSIZE_T) +check_type_size("long long" SIZEOF_LONG_LONG) +check_type_size("long" SIZEOF_LONG) +check_type_size("short" SIZEOF_SHORT) +check_type_size("int" SIZEOF_INT) +check_type_size("__int64" SIZEOF___INT64) +check_type_size("long double" SIZEOF_LONG_DOUBLE) +check_type_size("time_t" SIZEOF_TIME_T) +if(NOT HAVE_SIZEOF_SSIZE_T) + if(SIZEOF_LONG EQUAL SIZEOF_SIZE_T) + set(ssize_t long) + endif(SIZEOF_LONG EQUAL SIZEOF_SIZE_T) + if(NOT ssize_t AND SIZEOF___INT64 EQUAL SIZEOF_SIZE_T) + set(ssize_t __int64) + endif(NOT ssize_t AND SIZEOF___INT64 EQUAL SIZEOF_SIZE_T) +endif(NOT HAVE_SIZEOF_SSIZE_T) + +# Different sizeofs, etc. + +# define CURL_SIZEOF_LONG 4 +# define CURL_TYPEOF_CURL_OFF_T long long +# define CURL_FORMAT_CURL_OFF_T "lld" +# define CURL_FORMAT_CURL_OFF_TU "llu" +# define CURL_FORMAT_OFF_T "%lld" +# define CURL_SIZEOF_CURL_OFF_T 8 +# define CURL_SUFFIX_CURL_OFF_T LL +# define CURL_SUFFIX_CURL_OFF_TU ULL + +set(CURL_SIZEOF_LONG ${SIZEOF_LONG}) + +if(SIZEOF_LONG EQUAL 8) + set(CURL_TYPEOF_CURL_OFF_T long) + set(CURL_SIZEOF_CURL_OFF_T 8) + set(CURL_FORMAT_CURL_OFF_T "ld") + set(CURL_FORMAT_CURL_OFF_TU "lu") + set(CURL_FORMAT_OFF_T "%ld") + set(CURL_SUFFIX_CURL_OFF_T L) + set(CURL_SUFFIX_CURL_OFF_TU LU) +endif(SIZEOF_LONG EQUAL 8) + +if(SIZEOF_LONG_LONG EQUAL 8) + set(CURL_TYPEOF_CURL_OFF_T "long long") + set(CURL_SIZEOF_CURL_OFF_T 8) + set(CURL_FORMAT_CURL_OFF_T "lld") + set(CURL_FORMAT_CURL_OFF_TU "llu") + set(CURL_FORMAT_OFF_T "%lld") + set(CURL_SUFFIX_CURL_OFF_T LL) + set(CURL_SUFFIX_CURL_OFF_TU LLU) +endif(SIZEOF_LONG_LONG EQUAL 8) + +if(NOT CURL_TYPEOF_CURL_OFF_T) + set(CURL_TYPEOF_CURL_OFF_T ${ssize_t}) + set(CURL_SIZEOF_CURL_OFF_T ${SIZEOF_SSIZE_T}) + # TODO: need adjustment here. + set(CURL_FORMAT_CURL_OFF_T "ld") + set(CURL_FORMAT_CURL_OFF_TU "lu") + set(CURL_FORMAT_OFF_T "%ld") + set(CURL_SUFFIX_CURL_OFF_T L) + set(CURL_SUFFIX_CURL_OFF_TU LU) +endif(NOT CURL_TYPEOF_CURL_OFF_T) + +if(HAVE_SIZEOF_LONG_LONG) + set(HAVE_LONGLONG 1) + set(HAVE_LL 1) +endif(HAVE_SIZEOF_LONG_LONG) + +find_file(RANDOM_FILE urandom /dev) +mark_as_advanced(RANDOM_FILE) + +# Check for some functions that are used +check_symbol_exists(basename "${CURL_INCLUDES}" HAVE_BASENAME) +check_symbol_exists(socket "${CURL_INCLUDES}" HAVE_SOCKET) +check_symbol_exists(poll "${CURL_INCLUDES}" HAVE_POLL) +check_symbol_exists(select "${CURL_INCLUDES}" HAVE_SELECT) +check_symbol_exists(strdup "${CURL_INCLUDES}" HAVE_STRDUP) +check_symbol_exists(strstr "${CURL_INCLUDES}" HAVE_STRSTR) +check_symbol_exists(strtok_r "${CURL_INCLUDES}" HAVE_STRTOK_R) +check_symbol_exists(strftime "${CURL_INCLUDES}" HAVE_STRFTIME) +check_symbol_exists(uname "${CURL_INCLUDES}" HAVE_UNAME) +check_symbol_exists(strcasecmp "${CURL_INCLUDES}" HAVE_STRCASECMP) +check_symbol_exists(stricmp "${CURL_INCLUDES}" HAVE_STRICMP) +check_symbol_exists(strcmpi "${CURL_INCLUDES}" HAVE_STRCMPI) +check_symbol_exists(strncmpi "${CURL_INCLUDES}" HAVE_STRNCMPI) +check_symbol_exists(alarm "${CURL_INCLUDES}" HAVE_ALARM) +if(NOT HAVE_STRNCMPI) + set(HAVE_STRCMPI) +endif(NOT HAVE_STRNCMPI) +check_symbol_exists(gethostbyaddr "${CURL_INCLUDES}" HAVE_GETHOSTBYADDR) +check_symbol_exists(gethostbyaddr_r "${CURL_INCLUDES}" HAVE_GETHOSTBYADDR_R) +check_symbol_exists(gettimeofday "${CURL_INCLUDES}" HAVE_GETTIMEOFDAY) +check_symbol_exists(inet_addr "${CURL_INCLUDES}" HAVE_INET_ADDR) +check_symbol_exists(inet_ntoa "${CURL_INCLUDES}" HAVE_INET_NTOA) +check_symbol_exists(inet_ntoa_r "${CURL_INCLUDES}" HAVE_INET_NTOA_R) +check_symbol_exists(tcsetattr "${CURL_INCLUDES}" HAVE_TCSETATTR) +check_symbol_exists(tcgetattr "${CURL_INCLUDES}" HAVE_TCGETATTR) +check_symbol_exists(perror "${CURL_INCLUDES}" HAVE_PERROR) +check_symbol_exists(closesocket "${CURL_INCLUDES}" HAVE_CLOSESOCKET) +check_symbol_exists(setvbuf "${CURL_INCLUDES}" HAVE_SETVBUF) +check_symbol_exists(sigsetjmp "${CURL_INCLUDES}" HAVE_SIGSETJMP) +check_symbol_exists(getpass_r "${CURL_INCLUDES}" HAVE_GETPASS_R) +check_symbol_exists(strlcat "${CURL_INCLUDES}" HAVE_STRLCAT) +check_symbol_exists(getpwuid "${CURL_INCLUDES}" HAVE_GETPWUID) +check_symbol_exists(geteuid "${CURL_INCLUDES}" HAVE_GETEUID) +check_symbol_exists(utime "${CURL_INCLUDES}" HAVE_UTIME) +if(CMAKE_USE_OPENSSL) + check_symbol_exists(RAND_status "${CURL_INCLUDES}" HAVE_RAND_STATUS) + check_symbol_exists(RAND_screen "${CURL_INCLUDES}" HAVE_RAND_SCREEN) + check_symbol_exists(RAND_egd "${CURL_INCLUDES}" HAVE_RAND_EGD) + check_symbol_exists(CRYPTO_cleanup_all_ex_data "${CURL_INCLUDES}" + HAVE_CRYPTO_CLEANUP_ALL_EX_DATA) + if(HAVE_LIBCRYPTO AND HAVE_LIBSSL) + set(USE_OPENSSL 1) + set(USE_SSLEAY 1) + endif(HAVE_LIBCRYPTO AND HAVE_LIBSSL) +endif(CMAKE_USE_OPENSSL) +check_symbol_exists(gmtime_r "${CURL_INCLUDES}" HAVE_GMTIME_R) +check_symbol_exists(localtime_r "${CURL_INCLUDES}" HAVE_LOCALTIME_R) + +check_symbol_exists(gethostbyname "${CURL_INCLUDES}" HAVE_GETHOSTBYNAME) +check_symbol_exists(gethostbyname_r "${CURL_INCLUDES}" HAVE_GETHOSTBYNAME_R) + +check_symbol_exists(signal "${CURL_INCLUDES}" HAVE_SIGNAL_FUNC) +check_symbol_exists(SIGALRM "${CURL_INCLUDES}" HAVE_SIGNAL_MACRO) +if(HAVE_SIGNAL_FUNC AND HAVE_SIGNAL_MACRO) + set(HAVE_SIGNAL 1) +endif(HAVE_SIGNAL_FUNC AND HAVE_SIGNAL_MACRO) +check_symbol_exists(uname "${CURL_INCLUDES}" HAVE_UNAME) +check_symbol_exists(strtoll "${CURL_INCLUDES}" HAVE_STRTOLL) +check_symbol_exists(_strtoi64 "${CURL_INCLUDES}" HAVE__STRTOI64) +check_symbol_exists(strerror_r "${CURL_INCLUDES}" HAVE_STRERROR_R) +check_symbol_exists(siginterrupt "${CURL_INCLUDES}" HAVE_SIGINTERRUPT) +check_symbol_exists(perror "${CURL_INCLUDES}" HAVE_PERROR) +check_symbol_exists(fork "${CURL_INCLUDES}" HAVE_FORK) +check_symbol_exists(freeaddrinfo "${CURL_INCLUDES}" HAVE_FREEADDRINFO) +check_symbol_exists(freeifaddrs "${CURL_INCLUDES}" HAVE_FREEIFADDRS) +check_symbol_exists(pipe "${CURL_INCLUDES}" HAVE_PIPE) +check_symbol_exists(ftruncate "${CURL_INCLUDES}" HAVE_FTRUNCATE) +check_symbol_exists(getprotobyname "${CURL_INCLUDES}" HAVE_GETPROTOBYNAME) +check_symbol_exists(getrlimit "${CURL_INCLUDES}" HAVE_GETRLIMIT) +check_symbol_exists(idn_free "${CURL_INCLUDES}" HAVE_IDN_FREE) +check_symbol_exists(idna_strerror "${CURL_INCLUDES}" HAVE_IDNA_STRERROR) +check_symbol_exists(tld_strerror "${CURL_INCLUDES}" HAVE_TLD_STRERROR) +check_symbol_exists(setlocale "${CURL_INCLUDES}" HAVE_SETLOCALE) +check_symbol_exists(setrlimit "${CURL_INCLUDES}" HAVE_SETRLIMIT) +check_symbol_exists(fcntl "${CURL_INCLUDES}" HAVE_FCNTL) +check_symbol_exists(ioctl "${CURL_INCLUDES}" HAVE_IOCTL) +check_symbol_exists(setsockopt "${CURL_INCLUDES}" HAVE_SETSOCKOPT) + +# symbol exists in win32, but function does not. +check_function_exists(inet_pton HAVE_INET_PTON) + +# sigaction and sigsetjmp are special. Use special mechanism for +# detecting those, but only if previous attempt failed. +if(HAVE_SIGNAL_H) + check_symbol_exists(sigaction "signal.h" HAVE_SIGACTION) +endif(HAVE_SIGNAL_H) + +if(NOT HAVE_SIGSETJMP) + if(HAVE_SETJMP_H) + check_symbol_exists(sigsetjmp "setjmp.h" HAVE_MACRO_SIGSETJMP) + if(HAVE_MACRO_SIGSETJMP) + set(HAVE_SIGSETJMP 1) + endif(HAVE_MACRO_SIGSETJMP) + endif(HAVE_SETJMP_H) +endif(NOT HAVE_SIGSETJMP) + +# If there is no stricmp(), do not allow LDAP to parse URLs +if(NOT HAVE_STRICMP) + set(HAVE_LDAP_URL_PARSE 1) +endif(NOT HAVE_STRICMP) + +# For other curl specific tests, use this macro. +macro(CURL_INTERNAL_TEST CURL_TEST) + if("${CURL_TEST}" MATCHES "^${CURL_TEST}$") + set(MACRO_CHECK_FUNCTION_DEFINITIONS + "-D${CURL_TEST} ${CURL_TEST_DEFINES} ${CMAKE_REQUIRED_FLAGS}") + if(CMAKE_REQUIRED_LIBRARIES) + set(CURL_TEST_ADD_LIBRARIES + "-DLINK_LIBRARIES:STRING=${CMAKE_REQUIRED_LIBRARIES}") + endif(CMAKE_REQUIRED_LIBRARIES) + + message(STATUS "Performing Curl Test ${CURL_TEST}") + try_compile(${CURL_TEST} + ${CMAKE_BINARY_DIR} + ${CMAKE_CURRENT_SOURCE_DIR}/CMake/CurlTests.c + CMAKE_FLAGS -DCOMPILE_DEFINITIONS:STRING=${MACRO_CHECK_FUNCTION_DEFINITIONS} + "${CURL_TEST_ADD_LIBRARIES}" + OUTPUT_VARIABLE OUTPUT) + if(${CURL_TEST}) + set(${CURL_TEST} 1 CACHE INTERNAL "Curl test ${FUNCTION}") + message(STATUS "Performing Curl Test ${CURL_TEST} - Success") + file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log + "Performing Curl Test ${CURL_TEST} passed with the following output:\n" + "${OUTPUT}\n") + else(${CURL_TEST}) + message(STATUS "Performing Curl Test ${CURL_TEST} - Failed") + set(${CURL_TEST} "" CACHE INTERNAL "Curl test ${FUNCTION}") + file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log + "Performing Curl Test ${CURL_TEST} failed with the following output:\n" + "${OUTPUT}\n") + endif(${CURL_TEST}) + endif("${CURL_TEST}" MATCHES "^${CURL_TEST}$") +endmacro(CURL_INTERNAL_TEST) + +macro(CURL_INTERNAL_TEST_RUN CURL_TEST) + if("${CURL_TEST}_COMPILE" MATCHES "^${CURL_TEST}_COMPILE$") + set(MACRO_CHECK_FUNCTION_DEFINITIONS + "-D${CURL_TEST} ${CMAKE_REQUIRED_FLAGS}") + if(CMAKE_REQUIRED_LIBRARIES) + set(CURL_TEST_ADD_LIBRARIES + "-DLINK_LIBRARIES:STRING=${CMAKE_REQUIRED_LIBRARIES}") + endif(CMAKE_REQUIRED_LIBRARIES) + + message(STATUS "Performing Curl Test ${CURL_TEST}") + try_run(${CURL_TEST} ${CURL_TEST}_COMPILE + ${CMAKE_BINARY_DIR} + ${CMAKE_CURRENT_SOURCE_DIR}/CMake/CurlTests.c + CMAKE_FLAGS -DCOMPILE_DEFINITIONS:STRING=${MACRO_CHECK_FUNCTION_DEFINITIONS} + "${CURL_TEST_ADD_LIBRARIES}" + OUTPUT_VARIABLE OUTPUT) + if(${CURL_TEST}_COMPILE AND NOT ${CURL_TEST}) + set(${CURL_TEST} 1 CACHE INTERNAL "Curl test ${FUNCTION}") + message(STATUS "Performing Curl Test ${CURL_TEST} - Success") + else(${CURL_TEST}_COMPILE AND NOT ${CURL_TEST}) + message(STATUS "Performing Curl Test ${CURL_TEST} - Failed") + set(${CURL_TEST} "" CACHE INTERNAL "Curl test ${FUNCTION}") + file(APPEND "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log" + "Performing Curl Test ${CURL_TEST} failed with the following output:\n" + "${OUTPUT}") + if(${CURL_TEST}_COMPILE) + file(APPEND + "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log" + "There was a problem running this test\n") + endif(${CURL_TEST}_COMPILE) + file(APPEND "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log" + "\n\n") + endif(${CURL_TEST}_COMPILE AND NOT ${CURL_TEST}) + endif("${CURL_TEST}_COMPILE" MATCHES "^${CURL_TEST}_COMPILE$") +endmacro(CURL_INTERNAL_TEST_RUN) + +# Do curl specific tests +foreach(CURL_TEST + HAVE_FCNTL_O_NONBLOCK + HAVE_IOCTLSOCKET + HAVE_IOCTLSOCKET_CAMEL + HAVE_IOCTLSOCKET_CAMEL_FIONBIO + HAVE_IOCTLSOCKET_FIONBIO + HAVE_IOCTL_FIONBIO + HAVE_IOCTL_SIOCGIFADDR + HAVE_SETSOCKOPT_SO_NONBLOCK + HAVE_SOCKADDR_IN6_SIN6_SCOPE_ID + TIME_WITH_SYS_TIME + HAVE_O_NONBLOCK + HAVE_GETHOSTBYADDR_R_5 + HAVE_GETHOSTBYADDR_R_7 + HAVE_GETHOSTBYADDR_R_8 + HAVE_GETHOSTBYADDR_R_5_REENTRANT + HAVE_GETHOSTBYADDR_R_7_REENTRANT + HAVE_GETHOSTBYADDR_R_8_REENTRANT + HAVE_GETHOSTBYNAME_R_3 + HAVE_GETHOSTBYNAME_R_5 + HAVE_GETHOSTBYNAME_R_6 + HAVE_GETHOSTBYNAME_R_3_REENTRANT + HAVE_GETHOSTBYNAME_R_5_REENTRANT + HAVE_GETHOSTBYNAME_R_6_REENTRANT + HAVE_SOCKLEN_T + HAVE_IN_ADDR_T + HAVE_BOOL_T + STDC_HEADERS + RETSIGTYPE_TEST + HAVE_INET_NTOA_R_DECL + HAVE_INET_NTOA_R_DECL_REENTRANT + HAVE_GETADDRINFO + HAVE_FILE_OFFSET_BITS + ) + curl_internal_test(${CURL_TEST}) +endforeach(CURL_TEST) +if(HAVE_FILE_OFFSET_BITS) + set(_FILE_OFFSET_BITS 64) +endif(HAVE_FILE_OFFSET_BITS) +foreach(CURL_TEST + HAVE_GLIBC_STRERROR_R + HAVE_POSIX_STRERROR_R + ) + curl_internal_test_run(${CURL_TEST}) +endforeach(CURL_TEST) + +# Check for reentrant +foreach(CURL_TEST + HAVE_GETHOSTBYADDR_R_5 + HAVE_GETHOSTBYADDR_R_7 + HAVE_GETHOSTBYADDR_R_8 + HAVE_GETHOSTBYNAME_R_3 + HAVE_GETHOSTBYNAME_R_5 + HAVE_GETHOSTBYNAME_R_6 + HAVE_INET_NTOA_R_DECL_REENTRANT) + if(NOT ${CURL_TEST}) + if(${CURL_TEST}_REENTRANT) + set(NEED_REENTRANT 1) + endif(${CURL_TEST}_REENTRANT) + endif(NOT ${CURL_TEST}) +endforeach(CURL_TEST) + +if(NEED_REENTRANT) + foreach(CURL_TEST + HAVE_GETHOSTBYADDR_R_5 + HAVE_GETHOSTBYADDR_R_7 + HAVE_GETHOSTBYADDR_R_8 + HAVE_GETHOSTBYNAME_R_3 + HAVE_GETHOSTBYNAME_R_5 + HAVE_GETHOSTBYNAME_R_6) + set(${CURL_TEST} 0) + if(${CURL_TEST}_REENTRANT) + set(${CURL_TEST} 1) + endif(${CURL_TEST}_REENTRANT) + endforeach(CURL_TEST) +endif(NEED_REENTRANT) + +if(HAVE_INET_NTOA_R_DECL_REENTRANT) + set(HAVE_INET_NTOA_R_DECL 1) + set(NEED_REENTRANT 1) +endif(HAVE_INET_NTOA_R_DECL_REENTRANT) + +# Some other minor tests + +if(NOT HAVE_IN_ADDR_T) + set(in_addr_t "unsigned long") +endif(NOT HAVE_IN_ADDR_T) + +# Fix libz / zlib.h + +if(NOT CURL_SPECIAL_LIBZ) + if(NOT HAVE_LIBZ) + set(HAVE_ZLIB_H 0) + endif(NOT HAVE_LIBZ) + + if(NOT HAVE_ZLIB_H) + set(HAVE_LIBZ 0) + endif(NOT HAVE_ZLIB_H) +endif(NOT CURL_SPECIAL_LIBZ) + +if(_FILE_OFFSET_BITS) + set(_FILE_OFFSET_BITS 64) +endif(_FILE_OFFSET_BITS) +set(CMAKE_REQUIRED_FLAGS "-D_FILE_OFFSET_BITS=64") +set(CMAKE_EXTRA_INCLUDE_FILES "${CMAKE_CURRENT_SOURCE_DIR}/curl/curl.h") +check_type_size("curl_off_t" SIZEOF_CURL_OFF_T) +set(CMAKE_EXTRA_INCLUDE_FILES) +set(CMAKE_REQUIRED_FLAGS) + + +# Check for nonblocking +set(HAVE_DISABLED_NONBLOCKING 1) +if(HAVE_FIONBIO OR + HAVE_IOCTLSOCKET OR + HAVE_IOCTLSOCKET_CASE OR + HAVE_O_NONBLOCK) + set(HAVE_DISABLED_NONBLOCKING) +endif(HAVE_FIONBIO OR + HAVE_IOCTLSOCKET OR + HAVE_IOCTLSOCKET_CASE OR + HAVE_O_NONBLOCK) + +if(RETSIGTYPE_TEST) + set(RETSIGTYPE void) +else(RETSIGTYPE_TEST) + set(RETSIGTYPE int) +endif(RETSIGTYPE_TEST) + +if(CMAKE_COMPILER_IS_GNUCC AND APPLE) + include(CheckCCompilerFlag) + check_c_compiler_flag(-Wno-long-double HAVE_C_FLAG_Wno_long_double) + if(HAVE_C_FLAG_Wno_long_double) + # The Mac version of GCC warns about use of long double. Disable it. + get_source_file_property(MPRINTF_COMPILE_FLAGS mprintf.c COMPILE_FLAGS) + if(MPRINTF_COMPILE_FLAGS) + set(MPRINTF_COMPILE_FLAGS "${MPRINTF_COMPILE_FLAGS} -Wno-long-double") + else(MPRINTF_COMPILE_FLAGS) + set(MPRINTF_COMPILE_FLAGS "-Wno-long-double") + endif(MPRINTF_COMPILE_FLAGS) + set_source_files_properties(mprintf.c PROPERTIES + COMPILE_FLAGS ${MPRINTF_COMPILE_FLAGS}) + endif(HAVE_C_FLAG_Wno_long_double) +endif(CMAKE_COMPILER_IS_GNUCC AND APPLE) + +if(HAVE_SOCKLEN_T) + set(CURL_TYPEOF_CURL_SOCKLEN_T "socklen_t") + check_type_size("socklen_t" CURL_SIZEOF_CURL_SOCKLEN_T) + if(NOT HAVE_CURL_SIZEOF_CURL_SOCKLEN_T) + message(FATAL_ERROR + "Check for sizeof socklen_t failed, see CMakeFiles/CMakerror.log") + endif() +else() + set(CURL_TYPEOF_CURL_SOCKLEN_T int) + set(CURL_SIZEOF_CURL_SOCKLEN_T ${SIZEOF_INT}) +endif() + +include(CMake/OtherTests.cmake) + +add_definitions(-DHAVE_CONFIG_H) + +# For windows, do not allow the compiler to use default target (Vista). +if(WIN32) + add_definitions(-D_WIN32_WINNT=0x0501) +endif(WIN32) + +if(MSVC) + add_definitions(-D_CRT_SECURE_NO_DEPRECATE -D_CRT_NONSTDC_NO_DEPRECATE) +endif(MSVC) + +# Sets up the dependencies (zlib, OpenSSL, etc.) of a cURL subproject according to options. +# TODO This is far to be complete! +function(SETUP_CURL_DEPENDENCIES TARGET_NAME) + if(CURL_ZLIB AND ZLIB_FOUND) + include_directories(${ZLIB_INCLUDE_DIR}) + endif() + if(CURL_ZLIB AND ZLIB_FOUND) + target_link_libraries(${TARGET_NAME} ${ZLIB_LIBRARIES}) + #ADD_DEFINITIONS( -DHAVE_ZLIB_H -DHAVE_ZLIB -DHAVE_LIBZ ) + endif() + + if(CMAKE_USE_OPENSSL AND OPENSSL_FOUND) + include_directories(${OPENSSL_INCLUDE_DIR}) + endif() + if(CMAKE_USE_OPENSSL AND CURL_CONFIG_HAS_BEEN_RUN_BEFORE) + target_link_libraries(${TARGET_NAME} ${OPENSSL_LIBRARIES}) + #ADD_DEFINITIONS( -DUSE_SSLEAY ) + endif() +endfunction() + +# Ugly (but functional) way to include "Makefile.inc" by transforming it (= regenerate it). +function(TRANSFORM_MAKEFILE_INC INPUT_FILE OUTPUT_FILE) + file(READ ${INPUT_FILE} MAKEFILE_INC_TEXT) + string(REPLACE "$(top_srcdir)" "\${CURL_SOURCE_DIR}" MAKEFILE_INC_TEXT ${MAKEFILE_INC_TEXT}) + string(REPLACE "$(top_builddir)" "\${CURL_BINARY_DIR}" MAKEFILE_INC_TEXT ${MAKEFILE_INC_TEXT}) + + string(REGEX REPLACE "\\\\\n" "!" MAKEFILE_INC_TEXT ${MAKEFILE_INC_TEXT}) + string(REGEX REPLACE "([a-zA-Z_][a-zA-Z0-9_]*)[\t ]*=[\t ]*([^\n]*)" "SET(\\1 \\2)" MAKEFILE_INC_TEXT ${MAKEFILE_INC_TEXT}) + string(REPLACE "!" "\n" MAKEFILE_INC_TEXT ${MAKEFILE_INC_TEXT}) + + string(REGEX REPLACE "\\$\\(([a-zA-Z_][a-zA-Z0-9_]*)\\)" "\${\\1}" MAKEFILE_INC_TEXT ${MAKEFILE_INC_TEXT}) # Replace $() with ${} + string(REGEX REPLACE "@([a-zA-Z_][a-zA-Z0-9_]*)@" "\${\\1}" MAKEFILE_INC_TEXT ${MAKEFILE_INC_TEXT}) # Replace @@ with ${}, even if that may not be read by CMake scripts. + file(WRITE ${OUTPUT_FILE} ${MAKEFILE_INC_TEXT}) + +endfunction() + +add_subdirectory(lib) +if(BUILD_CURL_EXE) + add_subdirectory(src) +endif() +if(BUILD_CURL_TESTS) + add_subdirectory(tests) +endif() + +# This needs to be run very last so other parts of the scripts can take advantage of this. +if(NOT CURL_CONFIG_HAS_BEEN_RUN_BEFORE) + set(CURL_CONFIG_HAS_BEEN_RUN_BEFORE 1 CACHE INTERNAL "Flag to track whether this is the first time running CMake or if CMake has been configured before") +endif() diff --git a/mobicore/common/curl/COPYING b/mobicore/common/curl/COPYING new file mode 100644 index 0000000000000000000000000000000000000000..163b299ae270287355c26204121748af3b583c49 --- /dev/null +++ b/mobicore/common/curl/COPYING @@ -0,0 +1,21 @@ +COPYRIGHT AND PERMISSION NOTICE + +Copyright (c) 1996 - 2010, Daniel Stenberg, . + +All rights reserved. + +Permission to use, copy, modify, and distribute this software for any purpose +with or without fee is hereby granted, provided that the above copyright +notice and this permission notice appear in all copies. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. IN +NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR +OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE +OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of a copyright holder shall not +be used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization of the copyright holder. diff --git a/mobicore/common/curl/MacOSX-Framework b/mobicore/common/curl/MacOSX-Framework new file mode 100644 index 0000000000000000000000000000000000000000..0c97acdc5923ba81ab64d436f27cdc5ea9f37245 --- /dev/null +++ b/mobicore/common/curl/MacOSX-Framework @@ -0,0 +1,132 @@ +#!/bin/bash +# This script performs all of the steps needed to build a +# universal binary libcurl.framework for Mac OS X 10.4 or greater. +# +# Hendrik Visage: +# Generalizations added since Snowleopard (10.6) do not include +# the 10.4u SDK. +# +# Also note: +# 10.5 is the *ONLY* SDK that support PPC64 :( -- 10.6 do not have ppc64 support +#If you need to have PPC64 support then change below to 1 +PPC64_NEEDED=0 + +# For me the default is to develop for the platform I am on, and if you +#desire compatibility with older versions then change USE_OLD to 1 :) +USE_OLD=0 + +VERSION=`/usr/bin/sed -ne 's/^#define LIBCURL_VERSION "\(.*\)"/\1/p' include/curl/curlver.h` +FRAMEWORK_VERSION=Versions/Release-$VERSION + +#I also wanted to "copy over" the system, and thus the reason I added the +# version to Versions/Release-7.20.1 etc. +# now a simple rsync -vaP libcurl.framework /Library/Frameworks will install it +# and setup the right paths to this version, leaving the system version +# "intact", so you can "fix" it later with the links to Versions/A/... + + +OLD_SDK=`ls /Developer/SDKs|head -1` +NEW_SDK=`ls -r /Developer/SDKs|head -1` + +if test "0"$USE_OLD -gt 0 +then + SDK32=$OLD_SDK +else + SDK32=$NEW_SDK +fi + +MACVER=`echo $SDK32|sed -e s/[a-zA-Z]//g -e s/.\$//` + +SDK32_DIR='/Developer/SDKs/'$SDK32 +MINVER32='-mmacosx-version-min='$MACVER +ARCHES32='-arch i386 -arch ppc' + + +if test $PPC64_NEEDED -gt 0 +then + SDK64=10.5 + ARCHES64='-arch x86_64 -arch ppc64' + SDK64=`ls /Developer/SDKs|grep 10.5|head -1` +else + ARCHES64='-arch x86_64' + #We "know" that 10.4 and earlier do not support 64bit + OLD_SDK64=`ls /Developer/SDKs|egrep -v "10.[0-4]"|head -1` + NEW_SDK64=`ls -r /Developer/SDKs|egrep -v "10.[0-4]"|head -1` + if test $USE_OLD -gt 0 + then + SDK64=$OLD_SDK64 + else + SDK64=$NEW_SDK64 + fi +fi + +SDK64_DIR='/Developer/SDKs/'$SDK64 +MACVER64=`echo $SDK64|sed -e s/[a-zA-Z]//g -e s/.\$//` + +MINVER64='-mmacosx-version-min='$MACVER64 + +if test ! -z $SDK32; then + echo "----Configuring libcurl for 32 bit universal framework..." + make clean + ./configure --disable-dependency-tracking --disable-static --with-gssapi \ + CFLAGS="-Os -isysroot $SDK32_DIR $ARCHES32 $MINVER32" \ + LDFLAGS="-Wl,-syslibroot,$SDK32_DIR $ARCHES32 $MINVER32 -Wl,-headerpad_max_install_names" \ + CC=$CC + + echo "----Building 32 bit libcurl..." + make + + echo "----Creating 32 bit framework..." + rm -r libcurl.framework + mkdir -p libcurl.framework/${FRAMEWORK_VERSION}/Resources + cp lib/.libs/libcurl.dylib libcurl.framework/${FRAMEWORK_VERSION}/libcurl + install_name_tool -id @executable_path/../Frameworks/libcurl.framework/${FRAMEWORK_VERSION}/libcurl libcurl.framework/${FRAMEWORK_VERSION}/libcurl + /usr/bin/sed -e "s/7\.12\.3/$VERSION/" lib/libcurl.plist >libcurl.framework/${FRAMEWORK_VERSION}/Resources/Info.plist + mkdir -p libcurl.framework/${FRAMEWORK_VERSION}/Headers/curl + cp include/curl/*.h libcurl.framework/${FRAMEWORK_VERSION}/Headers/curl + pushd libcurl.framework + ln -fs ${FRAMEWORK_VERSION}/libcurl libcurl + ln -fs ${FRAMEWORK_VERSION}/Resources Resources + ln -fs ${FRAMEWORK_VERSION}/Headers Headers + cd Versions + ln -fs ${FRAMEWORK_VERSION} Current + + echo TEsting for SDK64 + if test -d $SDK64_DIR; then + echo entering... + popd + make clean + echo "----Configuring libcurl for 64 bit universal framework..." + ./configure --disable-dependency-tracking --disable-static --with-gssapi \ + CFLAGS="-Os -isysroot $SDK64_DIR $ARCHES64 $MINVER64" \ + LDFLAGS="-Wl,-syslibroot,$SDK64_DIR $ARCHES64 $MINVER64 -Wl,-headerpad_max_install_names" \ + CC=$CC + + echo "----Building 64 bit libcurl..." + make + + echo "----Appending 64 bit framework to 32 bit framework..." + cp lib/.libs/libcurl.dylib libcurl.framework/${FRAMEWORK_VERSION}/libcurl64 + install_name_tool -id @executable_path/../Frameworks/libcurl.framework/${FRAMEWORK_VERSION}/libcurl libcurl.framework/${FRAMEWORK_VERSION}/libcurl64 + cp libcurl.framework/${FRAMEWORK_VERSION}/libcurl libcurl.framework/${FRAMEWORK_VERSION}/libcurl32 + pwd + lipo libcurl.framework/${FRAMEWORK_VERSION}/libcurl32 libcurl.framework/${FRAMEWORK_VERSION}/libcurl64 -create -output libcurl.framework/${FRAMEWORK_VERSION}/libcurl + rm libcurl.framework/${FRAMEWORK_VERSION}/libcurl32 libcurl.framework/${FRAMEWORK_VERSION}/libcurl64 + cp libcurl.framework/${FRAMEWORK_VERSION}/Headers/curl/curlbuild.h libcurl.framework/${FRAMEWORK_VERSION}/Headers/curl/curlbuild32.h + cp include/curl/curlbuild.h libcurl.framework/${FRAMEWORK_VERSION}/Headers/curl/curlbuild64.h + cat >libcurl.framework/${FRAMEWORK_VERSION}/Headers/curl/curlbuild.h <, et al. +# +# This software is licensed as described in the file COPYING, which +# you should have received as part of this distribution. The terms +# are also available at http://curl.haxx.se/docs/copyright.html. +# +# You may opt to use, copy, modify, merge, publish, distribute and/or sell +# copies of the Software, and permit persons to whom the Software is +# furnished to do so, under the terms of the COPYING file. +# +# This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY +# KIND, either express or implied. +# +########################################################################### + +VC=vc6 + +all: + ./configure + make + +ssl: + ./configure --with-ssl + make + +borland: + cd lib + make -f Makefile.b32 + cd ..\src + make -f Makefile.b32 + +borland-ssl: + cd lib + make -f Makefile.b32 WITH_SSL=1 + cd ..\src + make -f Makefile.b32 WITH_SSL=1 + +borland-ssl-zlib: + cd lib + make -f Makefile.b32 WITH_SSL=1 WITH_ZLIB=1 + cd ..\src + make -f Makefile.b32 WITH_SSL=1 WITH_ZLIB=1 + +borland-clean: + cd lib + make -f Makefile.b32 clean + cd ..\src + make -f Makefile.b32 clean + +watcom: .SYMBOLIC + cd lib && $(MAKE) -u -f Makefile.Watcom + cd src && $(MAKE) -u -f Makefile.Watcom + +watcom-clean: .SYMBOLIC + cd lib && $(MAKE) -u -f Makefile.Watcom clean + cd src && $(MAKE) -u -f Makefile.Watcom clean + +watcom-vclean: .SYMBOLIC + cd lib && $(MAKE) -u -f Makefile.Watcom vclean + cd src && $(MAKE) -u -f Makefile.Watcom vclean + +mingw32: + $(MAKE) -C lib -f Makefile.m32 + $(MAKE) -C src -f Makefile.m32 + +mingw32-zlib: + $(MAKE) -C lib -f Makefile.m32 ZLIB=1 + $(MAKE) -C src -f Makefile.m32 ZLIB=1 + +mingw32-ssl-zlib: + $(MAKE) -C lib -f Makefile.m32 SSL=1 ZLIB=1 + $(MAKE) -C src -f Makefile.m32 SSL=1 ZLIB=1 + +mingw32-ssh2-ssl-zlib: + $(MAKE) -C lib -f Makefile.m32 SSH2=1 SSL=1 ZLIB=1 + $(MAKE) -C src -f Makefile.m32 SSH2=1 SSL=1 ZLIB=1 + +mingw32-ssh2-ssl-sspi-zlib: + $(MAKE) -C lib -f Makefile.m32 SSH2=1 SSL=1 SSPI=1 ZLIB=1 + $(MAKE) -C src -f Makefile.m32 SSH2=1 SSL=1 SSPI=1 ZLIB=1 + +mingw32-rtmp-ssh2-ssl-sspi-zlib: + $(MAKE) -C lib -f Makefile.m32 RTMP=1 SSH2=1 SSL=1 SSPI=1 ZLIB=1 + $(MAKE) -C src -f Makefile.m32 RTMP=1 SSH2=1 SSL=1 SSPI=1 ZLIB=1 + +mingw32-clean: + $(MAKE) -C lib -f Makefile.m32 clean + $(MAKE) -C src -f Makefile.m32 clean + +vc-clean: $(VC) + cd lib + nmake -f Makefile.$(VC) clean + cd ..\src + nmake -f Makefile.$(VC) clean + +vc-all: $(VC) + cd lib + nmake -f Makefile.$(VC) cfg=release + nmake -f Makefile.$(VC) cfg=release-ssl + nmake -f Makefile.$(VC) cfg=release-zlib + nmake -f Makefile.$(VC) cfg=release-ssl-zlib + nmake -f Makefile.$(VC) cfg=release-ssl-dll + nmake -f Makefile.$(VC) cfg=release-zlib-dll + nmake -f Makefile.$(VC) cfg=release-ssl-dll-zlib-dll + nmake -f Makefile.$(VC) cfg=release-dll + nmake -f Makefile.$(VC) cfg=release-dll-ssl-dll + nmake -f Makefile.$(VC) cfg=release-dll-zlib-dll + nmake -f Makefile.$(VC) cfg=release-dll-ssl-dll-zlib-dll + nmake -f Makefile.$(VC) cfg=debug + nmake -f Makefile.$(VC) cfg=debug-ssl + nmake -f Makefile.$(VC) cfg=debug-zlib + nmake -f Makefile.$(VC) cfg=debug-ssl-zlib + nmake -f Makefile.$(VC) cfg=debug-ssl-dll + nmake -f Makefile.$(VC) cfg=debug-zlib-dll + nmake -f Makefile.$(VC) cfg=debug-ssl-dll-zlib-dll + nmake -f Makefile.$(VC) cfg=debug-dll + nmake -f Makefile.$(VC) cfg=debug-dll-ssl-dll + nmake -f Makefile.$(VC) cfg=debug-dll-zlib-dll + nmake -f Makefile.$(VC) cfg=debug-dll-ssl-dll-zlib-dll + +vc: $(VC) + cd lib + nmake /f Makefile.$(VC) cfg=release + cd ..\src + nmake /f Makefile.$(VC) + +vc-x64: $(VC) + cd lib + nmake /f Makefile.$(VC) MACHINE=x64 cfg=release + cd ..\src + nmake /f Makefile.$(VC) MACHINE=x64 cfg=release + +vc-zlib: $(VC) + cd lib + nmake /f Makefile.$(VC) cfg=release-zlib + cd ..\src + nmake /f Makefile.$(VC) cfg=release-zlib + +vc-ssl: $(VC) + cd lib + nmake /f Makefile.$(VC) cfg=release-ssl + cd ..\src + nmake /f Makefile.$(VC) cfg=release-ssl + +vc-ssl-zlib: $(VC) + cd lib + nmake /f Makefile.$(VC) cfg=release-ssl-zlib + cd ..\src + nmake /f Makefile.$(VC) cfg=release-ssl-zlib + +vc-x64-ssl-zlib: $(VC) + cd lib + nmake /f Makefile.$(VC) MACHINE=x64 cfg=release-ssl-zlib + cd ..\src + nmake /f Makefile.$(VC) MACHINE=x64 cfg=release-ssl-zlib + +vc-ssl-dll: $(VC) + cd lib + nmake /f Makefile.$(VC) cfg=release-ssl-dll + cd ..\src + nmake /f Makefile.$(VC) cfg=release-ssl-dll + +vc-dll-ssl-dll: $(VC) + cd lib + nmake /f Makefile.$(VC) cfg=release-dll-ssl-dll + cd ..\src + nmake /f Makefile.$(VC) cfg=release-dll-ssl-dll + +vc-dll: $(VC) + cd lib + nmake /f Makefile.$(VC) cfg=release-dll + cd ..\src + nmake /f Makefile.$(VC) cfg=release-dll + +vc-dll-zlib-dll: $(VC) + cd lib + nmake /f Makefile.$(VC) cfg=release-dll-zlib-dll + cd ..\src + nmake /f Makefile.$(VC) cfg=release-dll-zlib-dll + +vc-dll-ssl-dll-zlib-dll: $(VC) + cd lib + nmake /f Makefile.$(VC) cfg=release-dll-ssl-dll-zlib-dll + cd ..\src + nmake /f Makefile.$(VC) cfg=release-dll-ssl-dll-zlib-dll + +vc-ssl-dll-zlib-dll: $(VC) + cd lib + nmake /f Makefile.$(VC) cfg=release-ssl-dll-zlib-dll + cd ..\src + nmake /f Makefile.$(VC) cfg=release-ssl-dll-zlib-dll + +vc-zlib-dll: $(VC) + cd lib + nmake /f Makefile.$(VC) cfg=release-zlib-dll + cd ..\src + nmake /f Makefile.$(VC) cfg=release-zlib-dll + +vc-sspi: $(VC) + cd lib + nmake /f Makefile.$(VC) cfg=release WINDOWS_SSPI=1 + cd ..\src + nmake /f Makefile.$(VC) cfg=release WINDOWS_SSPI=1 + +djgpp: + $(MAKE) -C lib -f Makefile.dj + $(MAKE) -C src -f Makefile.dj + +cygwin: + ./configure + make + +cygwin-ssl: + ./configure --with-ssl + make + +amiga: + cd ./lib && make -f makefile.amiga + cd ./src && make -f makefile.amiga + +netware: + $(MAKE) -C lib -f Makefile.netware + $(MAKE) -C src -f Makefile.netware + +netware-ares: + $(MAKE) -C lib -f Makefile.netware WITH_ARES=1 + $(MAKE) -C src -f Makefile.netware WITH_ARES=1 + +netware-ssl: + $(MAKE) -C lib -f Makefile.netware WITH_SSL=1 + $(MAKE) -C src -f Makefile.netware WITH_SSL=1 + +netware-ssl-zlib: + $(MAKE) -C lib -f Makefile.netware WITH_SSL=1 WITH_ZLIB=1 + $(MAKE) -C src -f Makefile.netware WITH_SSL=1 WITH_ZLIB=1 + +netware-ssh2-ssl-zlib: + $(MAKE) -C lib -f Makefile.netware WITH_SSH2=1 WITH_SSL=1 WITH_ZLIB=1 + $(MAKE) -C src -f Makefile.netware WITH_SSH2=1 WITH_SSL=1 WITH_ZLIB=1 + +netware-zlib: + $(MAKE) -C lib -f Makefile.netware WITH_ZLIB=1 + $(MAKE) -C src -f Makefile.netware WITH_ZLIB=1 + +netware-clean: + $(MAKE) -C lib -f Makefile.netware clean + $(MAKE) -C src -f Makefile.netware clean + +netware-install: + $(MAKE) -C lib -f Makefile.netware install + $(MAKE) -C src -f Makefile.netware install + +unix: all + +unix-ssl: ssl + +linux: all + +linux-ssl: ssl + +# We don't need to do anything for vc6. +vc6: + +vc8: lib/Makefile.vc8 src/Makefile.vc8 + +lib/Makefile.vc8: lib/Makefile.vc6 + @echo "generate $@" + @sed -e "s#/GX /DWIN32 /YX#/EHsc /DWIN32#" -e "s#/GZ#/RTC1#" -e "s/ws2_32.lib/ws2_32.lib bufferoverflowu.lib/g" -e "s/VC6/VC8/g" lib/Makefile.vc6 > lib/Makefile.vc8 + +src/Makefile.vc8: src/Makefile.vc6 + @echo "generate $@" + @sed -e "s#/GX /DWIN32 /YX#/EHsc /DWIN32#" -e "s#/GZ#/RTC1#" -e "s/ws2_32.lib/ws2_32.lib bufferoverflowu.lib/g" -e "s/VC6/VC8/g" src/Makefile.vc6 > src/Makefile.vc8 + +# VC9 makefiles are for use with VS2008 +vc9: lib/Makefile.vc9 src/Makefile.vc9 + +lib/Makefile.vc9: lib/Makefile.vc6 + @echo "generate $@" + @sed -e "s#/GX /DWIN32 /YX#/EHsc /DWIN32#" -e "s#/GZ#/RTC1#" -e "s/ws2_32.lib/ws2_32.lib/g" -e "s/vc6/vc9/g" -e "s/VC6/VC9/g" lib/Makefile.vc6 > lib/Makefile.vc9 + +src/Makefile.vc9: src/Makefile.vc6 + @echo "generate $@" + @sed -e "s#/GX /DWIN32 /YX#/EHsc /DWIN32#" -e "s#/GZ#/RTC1#" -e "s/ws2_32.lib/ws2_32.lib/g" -e "s/vc6/vc9/g" -e "s/VC6/VC9/g" src/Makefile.vc6 > src/Makefile.vc9 + +# VC10 makefiles are for use with VS2010 +vc10: lib/Makefile.vc10 src/Makefile.vc10 + +lib/Makefile.vc10: lib/Makefile.vc6 + @echo "generate $@" + @sed -e "s#/GX /DWIN32 /YX#/EHsc /DWIN32#" -e "s#/GZ#/RTC1#" -e "s/ws2_32.lib/ws2_32.lib/g" -e "s/vc6/vc10/g" -e "s/VC6/VC10/g" lib/Makefile.vc6 > lib/Makefile.vc10 + +src/Makefile.vc10: src/Makefile.vc6 + @echo "generate $@" + @sed -e "s#/GX /DWIN32 /YX#/EHsc /DWIN32#" -e "s#/GZ#/RTC1#" -e "s/ws2_32.lib/ws2_32.lib/g" -e "s/vc6/vc10/g" -e "s/VC6/VC10/g" src/Makefile.vc6 > src/Makefile.vc10 + +ca-bundle: lib/mk-ca-bundle.pl + @echo "generate a fresh ca-bundle.crt" + @perl $< -b -l -u lib/ca-bundle.crt + +ca-firefox: lib/firefox-db2pem.sh + @echo "generate a fresh ca-bundle.crt" + ./lib/firefox-db2pem.sh lib/ca-bundle.crt diff --git a/mobicore/common/curl/Makefile.am b/mobicore/common/curl/Makefile.am new file mode 100644 index 0000000000000000000000000000000000000000..15836e9bc6a5190e89e0491cc08857f8db7f435a --- /dev/null +++ b/mobicore/common/curl/Makefile.am @@ -0,0 +1,153 @@ +#*************************************************************************** +# _ _ ____ _ +# Project ___| | | | _ \| | +# / __| | | | |_) | | +# | (__| |_| | _ <| |___ +# \___|\___/|_| \_\_____| +# +# Copyright (C) 1998 - 2009, Daniel Stenberg, , et al. +# +# This software is licensed as described in the file COPYING, which +# you should have received as part of this distribution. The terms +# are also available at http://curl.haxx.se/docs/copyright.html. +# +# You may opt to use, copy, modify, merge, publish, distribute and/or sell +# copies of the Software, and permit persons to whom the Software is +# furnished to do so, under the terms of the COPYING file. +# +# This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY +# KIND, either express or implied. +# +########################################################################### + +AUTOMAKE_OPTIONS = foreign + +ACLOCAL_AMFLAGS = -I m4 + +CMAKE_DIST = CMakeLists.txt CMake/CheckTypeSize.c.in CMake/CheckTypeSize.cmake \ +CMake/CMakeConfigurableFile.in CMake/CurlCheckCSourceCompiles.cmake \ +CMake/CurlCheckCSourceRuns.cmake CMake/CurlTests.c CMake/FindOpenSSL.cmake \ +CMake/FindZLIB.cmake CMake/OtherTests.cmake CMake/Platforms/WindowsCache.cmake \ +CMake/Utilities.cmake include/curl/curlbuild.h.cmake + +EXTRA_DIST = CHANGES COPYING maketgz Makefile.dist curl-config.in \ + curl-style.el sample.emacs RELEASE-NOTES buildconf \ + libcurl.pc.in vc6curl.dsw MacOSX-Framework Android.mk $(CMAKE_DIST) + +bin_SCRIPTS = curl-config + +SUBDIRS = lib src +DIST_SUBDIRS = $(SUBDIRS) tests include packages docs + +pkgconfigdir = $(libdir)/pkgconfig +pkgconfig_DATA = libcurl.pc + +dist-hook: + rm -rf $(top_builddir)/tests/log + find $(distdir) -name "*.dist" -exec rm {} \; + (distit=`find $(srcdir) -name "*.dist" | grep -v ./ares/`; \ + for file in $$distit; do \ + strip=`echo $$file | sed -e s/^$(srcdir)// -e s/\.dist//`; \ + cp $$file $(distdir)$$strip; \ + done) + +html: + cd docs; make html + +pdf: + cd docs; make pdf + +check: test examples + +if CROSSCOMPILING +test-full: test +test-torture: test + +test: + @echo "NOTICE: we can't run the tests when cross-compiling!" + +else + +test: + @(cd tests; $(MAKE) all quiet-test) + +test-full: + @(cd tests; $(MAKE) all full-test) + +test-torture: + @(cd tests; $(MAKE) all torture-test) + +endif + +examples: + @(cd docs/examples; $(MAKE) check) + +clean-local: + @(cd tests; $(MAKE) clean) + @(cd docs; $(MAKE) clean) + +# +# Build source and binary rpms. For rpm-3.0 and above, the ~/.rpmmacros +# must contain the following line: +# %_topdir /home/loic/local/rpm +# and that /home/loic/local/rpm contains the directory SOURCES, BUILD etc. +# +# cd /home/loic/local/rpm ; mkdir -p SOURCES BUILD RPMS/i386 SPECS SRPMS +# +# If additional configure flags are needed to build the package, add the +# following in ~/.rpmmacros +# %configure CFLAGS="%{optflags}" ./configure %{_target_platform} --prefix=%{_prefix} ${AM_CONFIGFLAGS} +# and run make rpm in the following way: +# AM_CONFIGFLAGS='--with-uri=/home/users/loic/local/RedHat-6.2' make rpm +# + +rpms: + $(MAKE) RPMDIST=curl rpm + $(MAKE) RPMDIST=curl-ssl rpm + +rpm: + RPM_TOPDIR=`rpm --showrc | $(PERL) -n -e 'print if(s/.*_topdir\s+(.*)/$$1/)'` ; \ + cp $(srcdir)/packages/Linux/RPM/$(RPMDIST).spec $$RPM_TOPDIR/SPECS ; \ + cp $(PACKAGE)-$(VERSION).tar.gz $$RPM_TOPDIR/SOURCES ; \ + rpm -ba --clean --rmsource $$RPM_TOPDIR/SPECS/$(RPMDIST).spec ; \ + mv $$RPM_TOPDIR/RPMS/i386/$(RPMDIST)-*.rpm . ; \ + mv $$RPM_TOPDIR/SRPMS/$(RPMDIST)-*.src.rpm . + +# +# Build a Solaris pkgadd format file +# run 'make pkgadd' once you've done './configure' and 'make' to make a Solaris pkgadd format +# file (which ends up back in this directory). +# The pkgadd file is in 'pkgtrans' format, so to install on Solaris, do +# pkgadd -d ./HAXXcurl-* +# + +# gak - libtool requires an absoulte directory, hence the pwd below... +pkgadd: + umask 022 ; \ + make install DESTDIR=`/bin/pwd`/packages/Solaris/root ; \ + cat COPYING > $(srcdir)/packages/Solaris/copyright ; \ + cd $(srcdir)/packages/Solaris && $(MAKE) package + +# +# Build a cygwin binary tarball installation file +# resulting .tar.bz2 file will end up at packages/Win32/cygwin +cygwinbin: + $(MAKE) -C packages/Win32/cygwin cygwinbin + +# We extend the standard install with a custom hook: +install-data-hook: + cd include && $(MAKE) install + cd docs && $(MAKE) install + +# We extend the standard uninstall with a custom hook: +uninstall-hook: + cd include && $(MAKE) uninstall + cd docs && $(MAKE) uninstall + +ca-bundle: lib/mk-ca-bundle.pl + @echo "generate a fresh ca-bundle.crt" + @perl $< -b -l -u lib/ca-bundle.crt + +ca-firefox: lib/firefox-db2pem.sh + @echo "generate a fresh ca-bundle.crt" + ./lib/firefox-db2pem.sh lib/ca-bundle.crt diff --git a/mobicore/common/curl/Makefile.in b/mobicore/common/curl/Makefile.in new file mode 100644 index 0000000000000000000000000000000000000000..661fe8d7685c532808c91fe033812ad5b2940223 --- /dev/null +++ b/mobicore/common/curl/Makefile.in @@ -0,0 +1,893 @@ +# Makefile.in generated by automake 1.9.6 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005 Free Software Foundation, Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + +#*************************************************************************** +# _ _ ____ _ +# Project ___| | | | _ \| | +# / __| | | | |_) | | +# | (__| |_| | _ <| |___ +# \___|\___/|_| \_\_____| +# +# Copyright (C) 1998 - 2009, Daniel Stenberg, , et al. +# +# This software is licensed as described in the file COPYING, which +# you should have received as part of this distribution. The terms +# are also available at http://curl.haxx.se/docs/copyright.html. +# +# You may opt to use, copy, modify, merge, publish, distribute and/or sell +# copies of the Software, and permit persons to whom the Software is +# furnished to do so, under the terms of the COPYING file. +# +# This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY +# KIND, either express or implied. +# +########################################################################### + + +srcdir = @srcdir@ +top_srcdir = @top_srcdir@ +VPATH = @srcdir@ +pkgdatadir = $(datadir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +top_builddir = . +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +INSTALL = @INSTALL@ +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +DIST_COMMON = README $(am__configure_deps) $(srcdir)/Makefile.am \ + $(srcdir)/Makefile.in $(srcdir)/curl-config.in \ + $(srcdir)/libcurl.pc.in $(top_srcdir)/configure COPYING \ + compile config.guess config.sub depcomp install-sh ltmain.sh \ + missing mkinstalldirs +subdir = . +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/m4/curl-compilers.m4 \ + $(top_srcdir)/m4/curl-confopts.m4 \ + $(top_srcdir)/m4/curl-functions.m4 \ + $(top_srcdir)/m4/curl-override.m4 \ + $(top_srcdir)/m4/curl-reentrant.m4 \ + $(top_srcdir)/m4/curl-system.m4 $(top_srcdir)/m4/libtool.m4 \ + $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ + $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ + $(top_srcdir)/acinclude.m4 $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \ + configure.lineno configure.status.lineno +mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs +CONFIG_HEADER = $(top_builddir)/lib/curl_config.h \ + $(top_builddir)/src/curl_config.h \ + $(top_builddir)/include/curl/curlbuild.h +CONFIG_CLEAN_FILES = curl-config libcurl.pc +am__installdirs = "$(DESTDIR)$(bindir)" "$(DESTDIR)$(pkgconfigdir)" +binSCRIPT_INSTALL = $(INSTALL_SCRIPT) +SCRIPTS = $(bin_SCRIPTS) +SOURCES = +DIST_SOURCES = +RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \ + html-recursive info-recursive install-data-recursive \ + install-exec-recursive install-info-recursive \ + install-recursive installcheck-recursive installdirs-recursive \ + pdf-recursive ps-recursive uninstall-info-recursive \ + uninstall-recursive +am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; +am__vpath_adj = case $$p in \ + $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ + *) f=$$p;; \ + esac; +am__strip_dir = `echo $$p | sed -e 's|^.*/||'`; +pkgconfigDATA_INSTALL = $(INSTALL_DATA) +DATA = $(pkgconfig_DATA) +ETAGS = etags +CTAGS = ctags +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +distdir = $(PACKAGE)-$(VERSION) +top_distdir = $(distdir) +am__remove_distdir = \ + { test ! -d $(distdir) \ + || { find $(distdir) -type d ! -perm -200 -exec chmod u+w {} ';' \ + && rm -fr $(distdir); }; } +DIST_ARCHIVES = $(distdir).tar.gz +GZIP_ENV = --best +distuninstallcheck_listfiles = find . -type f -print +distcleancheck_listfiles = find . -type f -print +ACLOCAL = @ACLOCAL@ +AMDEP_FALSE = @AMDEP_FALSE@ +AMDEP_TRUE = @AMDEP_TRUE@ +AMTAR = @AMTAR@ +AR = @AR@ +AS = @AS@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +BUILD_LIBHOSTNAME_FALSE = @BUILD_LIBHOSTNAME_FALSE@ +BUILD_LIBHOSTNAME_TRUE = @BUILD_LIBHOSTNAME_TRUE@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CONFIGURE_OPTIONS = @CONFIGURE_OPTIONS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CROSSCOMPILING_FALSE = @CROSSCOMPILING_FALSE@ +CROSSCOMPILING_TRUE = @CROSSCOMPILING_TRUE@ +CURLDEBUG_FALSE = @CURLDEBUG_FALSE@ +CURLDEBUG_TRUE = @CURLDEBUG_TRUE@ +CURL_CA_BUNDLE = @CURL_CA_BUNDLE@ +CURL_CFLAG_EXTRAS = @CURL_CFLAG_EXTRAS@ +CURL_DISABLE_DICT = @CURL_DISABLE_DICT@ +CURL_DISABLE_FILE = @CURL_DISABLE_FILE@ +CURL_DISABLE_FTP = @CURL_DISABLE_FTP@ +CURL_DISABLE_GOPHER = @CURL_DISABLE_GOPHER@ +CURL_DISABLE_HTTP = @CURL_DISABLE_HTTP@ +CURL_DISABLE_IMAP = @CURL_DISABLE_IMAP@ +CURL_DISABLE_LDAP = @CURL_DISABLE_LDAP@ +CURL_DISABLE_LDAPS = @CURL_DISABLE_LDAPS@ +CURL_DISABLE_POP3 = @CURL_DISABLE_POP3@ +CURL_DISABLE_PROXY = @CURL_DISABLE_PROXY@ +CURL_DISABLE_RTSP = @CURL_DISABLE_RTSP@ +CURL_DISABLE_SMTP = @CURL_DISABLE_SMTP@ +CURL_DISABLE_TELNET = @CURL_DISABLE_TELNET@ +CURL_DISABLE_TFTP = @CURL_DISABLE_TFTP@ +CURL_LIBS = @CURL_LIBS@ +CURL_NETWORK_LIBS = @CURL_NETWORK_LIBS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DLLTOOL = @DLLTOOL@ +DSYMUTIL = @DSYMUTIL@ +DUMPBIN = @DUMPBIN@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +ENABLE_SHARED = @ENABLE_SHARED@ +EXEEXT = @EXEEXT@ +FGREP = @FGREP@ +GREP = @GREP@ +HAVE_LDAP_SSL = @HAVE_LDAP_SSL@ +HAVE_LIBZ = @HAVE_LIBZ@ +HAVE_LIBZ_FALSE = @HAVE_LIBZ_FALSE@ +HAVE_LIBZ_TRUE = @HAVE_LIBZ_TRUE@ +HAVE_PK11_CREATEGENERICOBJECT = @HAVE_PK11_CREATEGENERICOBJECT@ +IDN_ENABLED = @IDN_ENABLED@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +IPV6_ENABLED = @IPV6_ENABLED@ +KRB4_ENABLED = @KRB4_ENABLED@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LIBCURL_LIBS = @LIBCURL_LIBS@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +MAINT = @MAINT@ +MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@ +MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@ +MAKEINFO = @MAKEINFO@ +MANOPT = @MANOPT@ +MIMPURE_FALSE = @MIMPURE_FALSE@ +MIMPURE_TRUE = @MIMPURE_TRUE@ +NM = @NM@ +NMEDIT = @NMEDIT@ +NO_UNDEFINED_FALSE = @NO_UNDEFINED_FALSE@ +NO_UNDEFINED_TRUE = @NO_UNDEFINED_TRUE@ +NROFF = @NROFF@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +OTOOL = @OTOOL@ +OTOOL64 = @OTOOL64@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH = @PATH@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PERL = @PERL@ +PKGADD_NAME = @PKGADD_NAME@ +PKGADD_PKG = @PKGADD_PKG@ +PKGADD_VENDOR = @PKGADD_VENDOR@ +PKGCONFIG = @PKGCONFIG@ +RANDOM_FILE = @RANDOM_FILE@ +RANLIB = @RANLIB@ +REQUIRE_LIB_DEPS = @REQUIRE_LIB_DEPS@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +SONAME_BUMP_FALSE = @SONAME_BUMP_FALSE@ +SONAME_BUMP_TRUE = @SONAME_BUMP_TRUE@ +SSL_ENABLED = @SSL_ENABLED@ +STATICLIB_FALSE = @STATICLIB_FALSE@ +STATICLIB_TRUE = @STATICLIB_TRUE@ +STRIP = @STRIP@ +SUPPORT_FEATURES = @SUPPORT_FEATURES@ +SUPPORT_PROTOCOLS = @SUPPORT_PROTOCOLS@ +TEST_SERVER_LIBS = @TEST_SERVER_LIBS@ +USE_ARES = @USE_ARES@ +USE_EMBEDDED_ARES_FALSE = @USE_EMBEDDED_ARES_FALSE@ +USE_EMBEDDED_ARES_TRUE = @USE_EMBEDDED_ARES_TRUE@ +USE_GNUTLS = @USE_GNUTLS@ +USE_LIBRTMP = @USE_LIBRTMP@ +USE_LIBSSH2 = @USE_LIBSSH2@ +USE_MANUAL_FALSE = @USE_MANUAL_FALSE@ +USE_MANUAL_TRUE = @USE_MANUAL_TRUE@ +USE_NSS = @USE_NSS@ +USE_OPENLDAP = @USE_OPENLDAP@ +USE_POLARSSL = @USE_POLARSSL@ +USE_SSLEAY = @USE_SSLEAY@ +USE_WINDOWS_SSPI = @USE_WINDOWS_SSPI@ +VERSION = @VERSION@ +VERSIONNUM = @VERSIONNUM@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ +am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ +am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +libext = @libext@ +localedir = @localedir@ +localstatedir = @localstatedir@ +lt_ECHO = @lt_ECHO@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +subdirs = @subdirs@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +AUTOMAKE_OPTIONS = foreign +ACLOCAL_AMFLAGS = -I m4 +CMAKE_DIST = CMakeLists.txt CMake/CheckTypeSize.c.in CMake/CheckTypeSize.cmake \ +CMake/CMakeConfigurableFile.in CMake/CurlCheckCSourceCompiles.cmake \ +CMake/CurlCheckCSourceRuns.cmake CMake/CurlTests.c CMake/FindOpenSSL.cmake \ +CMake/FindZLIB.cmake CMake/OtherTests.cmake CMake/Platforms/WindowsCache.cmake \ +CMake/Utilities.cmake include/curl/curlbuild.h.cmake + +EXTRA_DIST = CHANGES COPYING maketgz Makefile.dist curl-config.in \ + curl-style.el sample.emacs RELEASE-NOTES buildconf \ + libcurl.pc.in vc6curl.dsw MacOSX-Framework Android.mk $(CMAKE_DIST) + +bin_SCRIPTS = curl-config +SUBDIRS = lib src +DIST_SUBDIRS = $(SUBDIRS) tests include packages docs +pkgconfigdir = $(libdir)/pkgconfig +pkgconfig_DATA = libcurl.pc +all: all-recursive + +.SUFFIXES: +am--refresh: + @: +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + echo ' cd $(srcdir) && $(AUTOMAKE) --foreign '; \ + cd $(srcdir) && $(AUTOMAKE) --foreign \ + && exit 0; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign Makefile'; \ + cd $(top_srcdir) && \ + $(AUTOMAKE) --foreign Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + echo ' $(SHELL) ./config.status'; \ + $(SHELL) ./config.status;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + $(SHELL) ./config.status --recheck + +$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) + cd $(srcdir) && $(AUTOCONF) +$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) + cd $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS) +curl-config: $(top_builddir)/config.status $(srcdir)/curl-config.in + cd $(top_builddir) && $(SHELL) ./config.status $@ +libcurl.pc: $(top_builddir)/config.status $(srcdir)/libcurl.pc.in + cd $(top_builddir) && $(SHELL) ./config.status $@ +install-binSCRIPTS: $(bin_SCRIPTS) + @$(NORMAL_INSTALL) + test -z "$(bindir)" || $(mkdir_p) "$(DESTDIR)$(bindir)" + @list='$(bin_SCRIPTS)'; for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + if test -f $$d$$p; then \ + f=`echo "$$p" | sed 's|^.*/||;$(transform)'`; \ + echo " $(binSCRIPT_INSTALL) '$$d$$p' '$(DESTDIR)$(bindir)/$$f'"; \ + $(binSCRIPT_INSTALL) "$$d$$p" "$(DESTDIR)$(bindir)/$$f"; \ + else :; fi; \ + done + +uninstall-binSCRIPTS: + @$(NORMAL_UNINSTALL) + @list='$(bin_SCRIPTS)'; for p in $$list; do \ + f=`echo "$$p" | sed 's|^.*/||;$(transform)'`; \ + echo " rm -f '$(DESTDIR)$(bindir)/$$f'"; \ + rm -f "$(DESTDIR)$(bindir)/$$f"; \ + done + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +distclean-libtool: + -rm -f libtool +uninstall-info-am: +install-pkgconfigDATA: $(pkgconfig_DATA) + @$(NORMAL_INSTALL) + test -z "$(pkgconfigdir)" || $(mkdir_p) "$(DESTDIR)$(pkgconfigdir)" + @list='$(pkgconfig_DATA)'; for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + f=$(am__strip_dir) \ + echo " $(pkgconfigDATA_INSTALL) '$$d$$p' '$(DESTDIR)$(pkgconfigdir)/$$f'"; \ + $(pkgconfigDATA_INSTALL) "$$d$$p" "$(DESTDIR)$(pkgconfigdir)/$$f"; \ + done + +uninstall-pkgconfigDATA: + @$(NORMAL_UNINSTALL) + @list='$(pkgconfig_DATA)'; for p in $$list; do \ + f=$(am__strip_dir) \ + echo " rm -f '$(DESTDIR)$(pkgconfigdir)/$$f'"; \ + rm -f "$(DESTDIR)$(pkgconfigdir)/$$f"; \ + done + +# This directory's subdirectories are mostly independent; you can cd +# into them and run `make' without going through this Makefile. +# To change the values of `make' variables: instead of editing Makefiles, +# (1) if the variable is set in `config.status', edit `config.status' +# (which will cause the Makefiles to be regenerated when you run `make'); +# (2) otherwise, pass the desired values on the `make' command line. +$(RECURSIVE_TARGETS): + @failcom='exit 1'; \ + for f in x $$MAKEFLAGS; do \ + case $$f in \ + *=* | --[!k]*);; \ + *k*) failcom='fail=yes';; \ + esac; \ + done; \ + dot_seen=no; \ + target=`echo $@ | sed s/-recursive//`; \ + list='$(SUBDIRS)'; for subdir in $$list; do \ + echo "Making $$target in $$subdir"; \ + if test "$$subdir" = "."; then \ + dot_seen=yes; \ + local_target="$$target-am"; \ + else \ + local_target="$$target"; \ + fi; \ + (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ + || eval $$failcom; \ + done; \ + if test "$$dot_seen" = "no"; then \ + $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ + fi; test -z "$$fail" + +mostlyclean-recursive clean-recursive distclean-recursive \ +maintainer-clean-recursive: + @failcom='exit 1'; \ + for f in x $$MAKEFLAGS; do \ + case $$f in \ + *=* | --[!k]*);; \ + *k*) failcom='fail=yes';; \ + esac; \ + done; \ + dot_seen=no; \ + case "$@" in \ + distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ + *) list='$(SUBDIRS)' ;; \ + esac; \ + rev=''; for subdir in $$list; do \ + if test "$$subdir" = "."; then :; else \ + rev="$$subdir $$rev"; \ + fi; \ + done; \ + rev="$$rev ."; \ + target=`echo $@ | sed s/-recursive//`; \ + for subdir in $$rev; do \ + echo "Making $$target in $$subdir"; \ + if test "$$subdir" = "."; then \ + local_target="$$target-am"; \ + else \ + local_target="$$target"; \ + fi; \ + (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ + || eval $$failcom; \ + done && test -z "$$fail" +tags-recursive: + list='$(SUBDIRS)'; for subdir in $$list; do \ + test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \ + done +ctags-recursive: + list='$(SUBDIRS)'; for subdir in $$list; do \ + test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \ + done + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + mkid -fID $$unique +tags: TAGS + +TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ + include_option=--etags-include; \ + empty_fix=.; \ + else \ + include_option=--include; \ + empty_fix=; \ + fi; \ + list='$(SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + test ! -f $$subdir/TAGS || \ + tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \ + fi; \ + done; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$tags $$unique; \ + fi +ctags: CTAGS +CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + test -z "$(CTAGS_ARGS)$$tags$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$tags $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && cd $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) $$here + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(DISTFILES) + $(am__remove_distdir) + mkdir $(distdir) + $(mkdir_p) $(distdir)/. $(distdir)/CMake $(distdir)/CMake/Platforms $(distdir)/include/curl $(distdir)/m4 $(distdir)/packages/AIX/RPM $(distdir)/packages/EPM $(distdir)/packages/Linux/RPM + @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ + list='$(DISTFILES)'; for file in $$list; do \ + case $$file in \ + $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ + $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ + esac; \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test "$$dir" != "$$file" && test "$$dir" != "."; then \ + dir="/$$dir"; \ + $(mkdir_p) "$(distdir)$$dir"; \ + else \ + dir=''; \ + fi; \ + if test -d $$d/$$file; then \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ + fi; \ + cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ + else \ + test -f $(distdir)/$$file \ + || cp -p $$d/$$file $(distdir)/$$file \ + || exit 1; \ + fi; \ + done + list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + test -d "$(distdir)/$$subdir" \ + || $(mkdir_p) "$(distdir)/$$subdir" \ + || exit 1; \ + distdir=`$(am__cd) $(distdir) && pwd`; \ + top_distdir=`$(am__cd) $(top_distdir) && pwd`; \ + (cd $$subdir && \ + $(MAKE) $(AM_MAKEFLAGS) \ + top_distdir="$$top_distdir" \ + distdir="$$distdir/$$subdir" \ + distdir) \ + || exit 1; \ + fi; \ + done + $(MAKE) $(AM_MAKEFLAGS) \ + top_distdir="$(top_distdir)" distdir="$(distdir)" \ + dist-hook + -find "$(distdir)" -type d ! -perm -755 \ + -exec chmod u+rwx,go+rx {} \; -o \ + ! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \ + ! -type d ! -perm -400 -exec chmod a+r {} \; -o \ + ! -type d ! -perm -444 -exec $(SHELL) $(install_sh) -c -m a+r {} {} \; \ + || chmod -R a+r $(distdir) +dist-gzip: distdir + tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz + $(am__remove_distdir) + +dist-bzip2: distdir + tardir=$(distdir) && $(am__tar) | bzip2 -9 -c >$(distdir).tar.bz2 + $(am__remove_distdir) + +dist-tarZ: distdir + tardir=$(distdir) && $(am__tar) | compress -c >$(distdir).tar.Z + $(am__remove_distdir) + +dist-shar: distdir + shar $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).shar.gz + $(am__remove_distdir) + +dist-zip: distdir + -rm -f $(distdir).zip + zip -rq $(distdir).zip $(distdir) + $(am__remove_distdir) + +dist dist-all: distdir + tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz + $(am__remove_distdir) + +# This target untars the dist file and tries a VPATH configuration. Then +# it guarantees that the distribution is self-contained by making another +# tarfile. +distcheck: dist + case '$(DIST_ARCHIVES)' in \ + *.tar.gz*) \ + GZIP=$(GZIP_ENV) gunzip -c $(distdir).tar.gz | $(am__untar) ;;\ + *.tar.bz2*) \ + bunzip2 -c $(distdir).tar.bz2 | $(am__untar) ;;\ + *.tar.Z*) \ + uncompress -c $(distdir).tar.Z | $(am__untar) ;;\ + *.shar.gz*) \ + GZIP=$(GZIP_ENV) gunzip -c $(distdir).shar.gz | unshar ;;\ + *.zip*) \ + unzip $(distdir).zip ;;\ + esac + chmod -R a-w $(distdir); chmod a+w $(distdir) + mkdir $(distdir)/_build + mkdir $(distdir)/_inst + chmod a-w $(distdir) + dc_install_base=`$(am__cd) $(distdir)/_inst && pwd | sed -e 's,^[^:\\/]:[\\/],/,'` \ + && dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \ + && cd $(distdir)/_build \ + && ../configure --srcdir=.. --prefix="$$dc_install_base" \ + $(DISTCHECK_CONFIGURE_FLAGS) \ + && $(MAKE) $(AM_MAKEFLAGS) \ + && $(MAKE) $(AM_MAKEFLAGS) dvi \ + && $(MAKE) $(AM_MAKEFLAGS) check \ + && $(MAKE) $(AM_MAKEFLAGS) install \ + && $(MAKE) $(AM_MAKEFLAGS) installcheck \ + && $(MAKE) $(AM_MAKEFLAGS) uninstall \ + && $(MAKE) $(AM_MAKEFLAGS) distuninstallcheck_dir="$$dc_install_base" \ + distuninstallcheck \ + && chmod -R a-w "$$dc_install_base" \ + && ({ \ + (cd ../.. && umask 077 && mkdir "$$dc_destdir") \ + && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" install \ + && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" uninstall \ + && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" \ + distuninstallcheck_dir="$$dc_destdir" distuninstallcheck; \ + } || { rm -rf "$$dc_destdir"; exit 1; }) \ + && rm -rf "$$dc_destdir" \ + && $(MAKE) $(AM_MAKEFLAGS) dist \ + && rm -rf $(DIST_ARCHIVES) \ + && $(MAKE) $(AM_MAKEFLAGS) distcleancheck + $(am__remove_distdir) + @(echo "$(distdir) archives ready for distribution: "; \ + list='$(DIST_ARCHIVES)'; for i in $$list; do echo $$i; done) | \ + sed -e '1{h;s/./=/g;p;x;}' -e '$${p;x;}' +distuninstallcheck: + @cd $(distuninstallcheck_dir) \ + && test `$(distuninstallcheck_listfiles) | wc -l` -le 1 \ + || { echo "ERROR: files left after uninstall:" ; \ + if test -n "$(DESTDIR)"; then \ + echo " (check DESTDIR support)"; \ + fi ; \ + $(distuninstallcheck_listfiles) ; \ + exit 1; } >&2 +distcleancheck: distclean + @if test '$(srcdir)' = . ; then \ + echo "ERROR: distcleancheck can only run from a VPATH build" ; \ + exit 1 ; \ + fi + @test `$(distcleancheck_listfiles) | wc -l` -eq 0 \ + || { echo "ERROR: files left in build directory after distclean:" ; \ + $(distcleancheck_listfiles) ; \ + exit 1; } >&2 +check-am: all-am +check: check-recursive +all-am: Makefile $(SCRIPTS) $(DATA) +installdirs: installdirs-recursive +installdirs-am: + for dir in "$(DESTDIR)$(bindir)" "$(DESTDIR)$(pkgconfigdir)"; do \ + test -z "$$dir" || $(mkdir_p) "$$dir"; \ + done +install: install-recursive +install-exec: install-exec-recursive +install-data: install-data-recursive +uninstall: uninstall-recursive + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-recursive +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-recursive + +clean-am: clean-generic clean-libtool clean-local mostlyclean-am + +distclean: distclean-recursive + -rm -f $(am__CONFIG_DISTCLEAN_FILES) + -rm -f Makefile +distclean-am: clean-am distclean-generic distclean-libtool \ + distclean-tags + +dvi: dvi-recursive + +dvi-am: + +info: info-recursive + +info-am: + +install-data-am: install-pkgconfigDATA + @$(NORMAL_INSTALL) + $(MAKE) $(AM_MAKEFLAGS) install-data-hook + +install-exec-am: install-binSCRIPTS + +install-info: install-info-recursive + +install-man: + +installcheck-am: + +maintainer-clean: maintainer-clean-recursive + -rm -f $(am__CONFIG_DISTCLEAN_FILES) + -rm -rf $(top_srcdir)/autom4te.cache + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-recursive + +mostlyclean-am: mostlyclean-generic mostlyclean-libtool + +pdf-am: + +ps: ps-recursive + +ps-am: + +uninstall-am: uninstall-binSCRIPTS uninstall-info-am \ + uninstall-pkgconfigDATA + @$(NORMAL_INSTALL) + $(MAKE) $(AM_MAKEFLAGS) uninstall-hook + +uninstall-info: uninstall-info-recursive + +.PHONY: $(RECURSIVE_TARGETS) CTAGS GTAGS all all-am am--refresh check \ + check-am clean clean-generic clean-libtool clean-local \ + clean-recursive ctags ctags-recursive dist dist-all dist-bzip2 \ + dist-gzip dist-hook dist-shar dist-tarZ dist-zip distcheck \ + distclean distclean-generic distclean-libtool \ + distclean-recursive distclean-tags distcleancheck distdir \ + distuninstallcheck dvi dvi-am html html-am info info-am \ + install install-am install-binSCRIPTS install-data \ + install-data-am install-data-hook install-exec install-exec-am \ + install-info install-info-am install-man install-pkgconfigDATA \ + install-strip installcheck installcheck-am installdirs \ + installdirs-am maintainer-clean maintainer-clean-generic \ + maintainer-clean-recursive mostlyclean mostlyclean-generic \ + mostlyclean-libtool mostlyclean-recursive pdf pdf-am ps ps-am \ + tags tags-recursive uninstall uninstall-am \ + uninstall-binSCRIPTS uninstall-hook uninstall-info-am \ + uninstall-pkgconfigDATA + + +dist-hook: + rm -rf $(top_builddir)/tests/log + find $(distdir) -name "*.dist" -exec rm {} \; + (distit=`find $(srcdir) -name "*.dist" | grep -v ./ares/`; \ + for file in $$distit; do \ + strip=`echo $$file | sed -e s/^$(srcdir)// -e s/\.dist//`; \ + cp $$file $(distdir)$$strip; \ + done) + +html: + cd docs; make html + +pdf: + cd docs; make pdf + +check: test examples + +@CROSSCOMPILING_TRUE@test-full: test +@CROSSCOMPILING_TRUE@test-torture: test + +@CROSSCOMPILING_TRUE@test: +@CROSSCOMPILING_TRUE@ @echo "NOTICE: we can't run the tests when cross-compiling!" + +@CROSSCOMPILING_FALSE@test: +@CROSSCOMPILING_FALSE@ @(cd tests; $(MAKE) all quiet-test) + +@CROSSCOMPILING_FALSE@test-full: +@CROSSCOMPILING_FALSE@ @(cd tests; $(MAKE) all full-test) + +@CROSSCOMPILING_FALSE@test-torture: +@CROSSCOMPILING_FALSE@ @(cd tests; $(MAKE) all torture-test) + +examples: + @(cd docs/examples; $(MAKE) check) + +clean-local: + @(cd tests; $(MAKE) clean) + @(cd docs; $(MAKE) clean) + +# +# Build source and binary rpms. For rpm-3.0 and above, the ~/.rpmmacros +# must contain the following line: +# %_topdir /home/loic/local/rpm +# and that /home/loic/local/rpm contains the directory SOURCES, BUILD etc. +# +# cd /home/loic/local/rpm ; mkdir -p SOURCES BUILD RPMS/i386 SPECS SRPMS +# +# If additional configure flags are needed to build the package, add the +# following in ~/.rpmmacros +# %configure CFLAGS="%{optflags}" ./configure %{_target_platform} --prefix=%{_prefix} ${AM_CONFIGFLAGS} +# and run make rpm in the following way: +# AM_CONFIGFLAGS='--with-uri=/home/users/loic/local/RedHat-6.2' make rpm +# + +rpms: + $(MAKE) RPMDIST=curl rpm + $(MAKE) RPMDIST=curl-ssl rpm + +rpm: + RPM_TOPDIR=`rpm --showrc | $(PERL) -n -e 'print if(s/.*_topdir\s+(.*)/$$1/)'` ; \ + cp $(srcdir)/packages/Linux/RPM/$(RPMDIST).spec $$RPM_TOPDIR/SPECS ; \ + cp $(PACKAGE)-$(VERSION).tar.gz $$RPM_TOPDIR/SOURCES ; \ + rpm -ba --clean --rmsource $$RPM_TOPDIR/SPECS/$(RPMDIST).spec ; \ + mv $$RPM_TOPDIR/RPMS/i386/$(RPMDIST)-*.rpm . ; \ + mv $$RPM_TOPDIR/SRPMS/$(RPMDIST)-*.src.rpm . + +# +# Build a Solaris pkgadd format file +# run 'make pkgadd' once you've done './configure' and 'make' to make a Solaris pkgadd format +# file (which ends up back in this directory). +# The pkgadd file is in 'pkgtrans' format, so to install on Solaris, do +# pkgadd -d ./HAXXcurl-* +# + +# gak - libtool requires an absoulte directory, hence the pwd below... +pkgadd: + umask 022 ; \ + make install DESTDIR=`/bin/pwd`/packages/Solaris/root ; \ + cat COPYING > $(srcdir)/packages/Solaris/copyright ; \ + cd $(srcdir)/packages/Solaris && $(MAKE) package + +# +# Build a cygwin binary tarball installation file +# resulting .tar.bz2 file will end up at packages/Win32/cygwin +cygwinbin: + $(MAKE) -C packages/Win32/cygwin cygwinbin + +# We extend the standard install with a custom hook: +install-data-hook: + cd include && $(MAKE) install + cd docs && $(MAKE) install + +# We extend the standard uninstall with a custom hook: +uninstall-hook: + cd include && $(MAKE) uninstall + cd docs && $(MAKE) uninstall + +ca-bundle: lib/mk-ca-bundle.pl + @echo "generate a fresh ca-bundle.crt" + @perl $< -b -l -u lib/ca-bundle.crt + +ca-firefox: lib/firefox-db2pem.sh + @echo "generate a fresh ca-bundle.crt" + ./lib/firefox-db2pem.sh lib/ca-bundle.crt +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/mobicore/common/curl/NOTICE b/mobicore/common/curl/NOTICE new file mode 100644 index 0000000000000000000000000000000000000000..163b299ae270287355c26204121748af3b583c49 --- /dev/null +++ b/mobicore/common/curl/NOTICE @@ -0,0 +1,21 @@ +COPYRIGHT AND PERMISSION NOTICE + +Copyright (c) 1996 - 2010, Daniel Stenberg, . + +All rights reserved. + +Permission to use, copy, modify, and distribute this software for any purpose +with or without fee is hereby granted, provided that the above copyright +notice and this permission notice appear in all copies. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. IN +NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR +OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE +OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of a copyright holder shall not +be used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization of the copyright holder. diff --git a/mobicore/common/curl/README b/mobicore/common/curl/README new file mode 100644 index 0000000000000000000000000000000000000000..2ffacc32cc16be2a5b8679accc04a5c2f457f045 --- /dev/null +++ b/mobicore/common/curl/README @@ -0,0 +1,49 @@ + _ _ ____ _ + ___| | | | _ \| | + / __| | | | |_) | | + | (__| |_| | _ <| |___ + \___|\___/|_| \_\_____| + +README + + Curl is a command line tool for transferring data specified with URL + syntax. Find out how to use curl by reading the curl.1 man page or the + MANUAL document. Find out how to install Curl by reading the INSTALL + document. + + libcurl is the library curl is using to do its job. It is readily + available to be used by your software. Read the libcurl.3 man page to + learn how! + + You find answers to the most frequent questions we get in the FAQ document. + + Study the COPYING file for distribution terms and similar. If you distribute + curl binaries or other binaries that involve libcurl, you might enjoy the + LICENSE-MIXING document. + +CONTACT + + If you have problems, questions, ideas or suggestions, please contact us + by posting to a suitable mailing list. See http://curl.haxx.se/mail/ + + All contributors to the project are listed in the THANKS document. + +WEB SITE + + Visit the curl web site for the latest news and downloads: + + http://curl.haxx.se/ + +GIT + + To download the very latest source off the GIT server do this: + + git clone git://github.com/bagder/curl.git + + (you'll get a directory named curl created, filled with the source code) + +NOTICE + + Curl contains pieces of source code that is Copyright (c) 1998, 1999 + Kungliga Tekniska Hgskolan. This notice is included here to comply with the + distribution terms. diff --git a/mobicore/common/curl/RELEASE-NOTES b/mobicore/common/curl/RELEASE-NOTES new file mode 100644 index 0000000000000000000000000000000000000000..70ac0dc950a91ec9e620e2de2f2867ef1f16e445 --- /dev/null +++ b/mobicore/common/curl/RELEASE-NOTES @@ -0,0 +1,61 @@ +Curl and libcurl 7.21.3 + + Public curl releases: 119 + Command line options: 143 + curl_easy_setopt() options: 185 + Public functions in libcurl: 58 + Known libcurl bindings: 39 + Contributors: 827 + +This release includes the following changes: + + o Added --noconfigure switch to testcurl.pl + o Added --xattr option + o Added CURLOPT_RESOLVE and --resolve + o Added CURLAUTH_ONLY + o Added version-check.pl to the examples dir + +This release includes the following bugfixes: + + o check for libcurl features for some command line options + o Curl_setopt: disallow CURLOPT_USE_SSL without SSL support + o http_chunks: remove debug output + o URL-parsing: consider ? a divider + o SSH: avoid using the libssh2_ prefix + o SSH: use libssh2_session_handshake() to work on win64 + o ftp: prevent server from hanging on closed data connection when stopping + a transfer before the end of the full transfer (ranges) + o LDAP: detect non-binary attributes properly + o ftp: treat server's response 421 as CURLE_OPERATION_TIMEDOUT + o gnutls->handshake: improved timeout handling + o security: Pass the right parameter to init + o krb5: Use GSS_ERROR to check for error + o TFTP: resend the correct data + o configure: fix autoconf 2.68 warning: no AC_LANG_SOURCE call detected + o GnuTLS: now detects socket errors on Windows + o symbols-in-versions: updated en masse + o added a couple examples that were missing from the tar ball + o Curl_send/recv_plain: return errno on failure + o Curl_wait_for_resolv (for c-ares): correct timeout + o ossl_connect_common: detect connection re-use + o configure: Prevent link errors with --librtmp + o openldap: use remote port in URL passed to ldap_init_fd() + o url: provide dead_connection flag in Curl_handler::disconnect + o lots of compiler warning fixes + o ssh: fix a download resume point calculation + o fix getinfo CURLINFO_LOCAL* for reused connections + o multi: the returned running handles conuter could turn negative + o multi: only ever consider pipelining for connections doing HTTP(S) + +This release includes the following known bugs: + + o see docs/KNOWN_BUGS (http://curl.haxx.se/docs/knownbugs.html) + +This release would not have looked like this without help, code, reports and +advice from friends like these: + + Dan Fandrich, Guenter Knauf, Pat Ray, Hongli Lai, Kamil Dudka, + Stefan Tomanek, Alfred Gebert, Yang Tse, Julien Chaffraix, Adam Light, + Rutger Hofman, Matthias Bolte, Heinrich Ko, Dmitri Shubin + + Thanks! (and sorry if I forgot to mention someone) diff --git a/mobicore/common/curl/acinclude.m4 b/mobicore/common/curl/acinclude.m4 new file mode 100644 index 0000000000000000000000000000000000000000..9f790522aa41af20d859f40c68ec7c45dde7f53e --- /dev/null +++ b/mobicore/common/curl/acinclude.m4 @@ -0,0 +1,3289 @@ +#*************************************************************************** +# _ _ ____ _ +# Project ___| | | | _ \| | +# / __| | | | |_) | | +# | (__| |_| | _ <| |___ +# \___|\___/|_| \_\_____| +# +# Copyright (C) 1998 - 2010, Daniel Stenberg, , et al. +# +# This software is licensed as described in the file COPYING, which +# you should have received as part of this distribution. The terms +# are also available at http://curl.haxx.se/docs/copyright.html. +# +# You may opt to use, copy, modify, merge, publish, distribute and/or sell +# copies of the Software, and permit persons to whom the Software is +# furnished to do so, under the terms of the COPYING file. +# +# This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY +# KIND, either express or implied. +# +#*************************************************************************** + + +dnl CURL_CHECK_DEF (SYMBOL, [INCLUDES], [SILENT]) +dnl ------------------------------------------------- +dnl Use the C preprocessor to find out if the given object-style symbol +dnl is defined and get its expansion. This macro will not use default +dnl includes even if no INCLUDES argument is given. This macro will run +dnl silently when invoked with three arguments. If the expansion would +dnl result in a set of double-quoted strings the returned expansion will +dnl actually be a single double-quoted string concatenating all them. + +AC_DEFUN([CURL_CHECK_DEF], [ + AS_VAR_PUSHDEF([ac_HaveDef], [curl_cv_have_def_$1])dnl + AS_VAR_PUSHDEF([ac_Def], [curl_cv_def_$1])dnl + if test -z "$SED"; then + AC_MSG_ERROR([SED not set. Cannot continue without SED being set.]) + fi + if test -z "$GREP"; then + AC_MSG_ERROR([GREP not set. Cannot continue without GREP being set.]) + fi + ifelse($3,,[AC_MSG_CHECKING([for preprocessor definition of $1])]) + tmp_exp="" + AC_PREPROC_IFELSE([ + AC_LANG_SOURCE( +ifelse($2,,,[$2])[[ +#ifdef $1 +CURL_DEF_TOKEN $1 +#endif + ]]) + ],[ + tmp_exp=`eval "$ac_cpp conftest.$ac_ext" 2>/dev/null | \ + "$GREP" CURL_DEF_TOKEN 2>/dev/null | \ + "$SED" 's/.*CURL_DEF_TOKEN[[ ]]//' 2>/dev/null | \ + "$SED" 's/[["]][[ ]]*[["]]//g' 2>/dev/null` + if test -z "$tmp_exp" || test "$tmp_exp" = "$1"; then + tmp_exp="" + fi + ]) + if test -z "$tmp_exp"; then + AS_VAR_SET(ac_HaveDef, no) + ifelse($3,,[AC_MSG_RESULT([no])]) + else + AS_VAR_SET(ac_HaveDef, yes) + AS_VAR_SET(ac_Def, $tmp_exp) + ifelse($3,,[AC_MSG_RESULT([$tmp_exp])]) + fi + AS_VAR_POPDEF([ac_Def])dnl + AS_VAR_POPDEF([ac_HaveDef])dnl +]) + + +dnl CURL_CHECK_DEF_CC (SYMBOL, [INCLUDES], [SILENT]) +dnl ------------------------------------------------- +dnl Use the C compiler to find out only if the given symbol is defined +dnl or not, this can not find out its expansion. This macro will not use +dnl default includes even if no INCLUDES argument is given. This macro +dnl will run silently when invoked with three arguments. + +AC_DEFUN([CURL_CHECK_DEF_CC], [ + AS_VAR_PUSHDEF([ac_HaveDef], [curl_cv_have_def_$1])dnl + ifelse($3,,[AC_MSG_CHECKING([for compiler definition of $1])]) + AC_COMPILE_IFELSE([ + AC_LANG_SOURCE( +ifelse($2,,,[$2])[[ +int main (void) +{ +#ifdef $1 + return 0; +#else + force compilation error +#endif +} + ]]) + ],[ + tst_symbol_defined="yes" + ],[ + tst_symbol_defined="no" + ]) + if test "$tst_symbol_defined" = "yes"; then + AS_VAR_SET(ac_HaveDef, yes) + ifelse($3,,[AC_MSG_RESULT([yes])]) + else + AS_VAR_SET(ac_HaveDef, no) + ifelse($3,,[AC_MSG_RESULT([no])]) + fi + AS_VAR_POPDEF([ac_HaveDef])dnl +]) + + +dnl CURL_CHECK_LIB_XNET +dnl ------------------------------------------------- +dnl Verify if X/Open network library is required. + +AC_DEFUN([CURL_CHECK_LIB_XNET], [ + AC_MSG_CHECKING([if X/Open network library is required]) + tst_lib_xnet_required="no" + AC_COMPILE_IFELSE([ + AC_LANG_SOURCE([[ +int main (void) +{ +#if defined(__hpux) && defined(_XOPEN_SOURCE) && (_XOPEN_SOURCE >= 600) + return 0; +#elif defined(__hpux) && defined(_XOPEN_SOURCE_EXTENDED) + return 0; +#else + force compilation error +#endif +} + ]]) + ],[ + tst_lib_xnet_required="yes" + LIBS="$LIBS -lxnet" + ]) + AC_MSG_RESULT([$tst_lib_xnet_required]) +]) + + +dnl CURL_CHECK_AIX_ALL_SOURCE +dnl ------------------------------------------------- +dnl Provides a replacement of traditional AC_AIX with +dnl an uniform behaviour across all autoconf versions, +dnl and with our own placement rules. + +AC_DEFUN([CURL_CHECK_AIX_ALL_SOURCE], [ + AH_VERBATIM([_ALL_SOURCE], + [/* Define to 1 if OS is AIX. */ +#ifndef _ALL_SOURCE +# undef _ALL_SOURCE +#endif]) + AC_BEFORE([$0], [AC_SYS_LARGEFILE])dnl + AC_BEFORE([$0], [CURL_CONFIGURE_REENTRANT])dnl + AC_MSG_CHECKING([if OS is AIX (to define _ALL_SOURCE)]) + AC_EGREP_CPP([yes_this_is_aix],[ +#ifdef _AIX + yes_this_is_aix +#endif + ],[ + AC_MSG_RESULT([yes]) + AC_DEFINE(_ALL_SOURCE) + ],[ + AC_MSG_RESULT([no]) + ]) +]) + + +dnl CURL_CHECK_HEADER_WINDOWS +dnl ------------------------------------------------- +dnl Check for compilable and valid windows.h header + +AC_DEFUN([CURL_CHECK_HEADER_WINDOWS], [ + AC_CACHE_CHECK([for windows.h], [ac_cv_header_windows_h], [ + AC_COMPILE_IFELSE([ + AC_LANG_PROGRAM([[ +#undef inline +#ifndef WIN32_LEAN_AND_MEAN +#define WIN32_LEAN_AND_MEAN +#endif +#include + ]],[[ +#if defined(__CYGWIN__) || defined(__CEGCC__) + HAVE_WINDOWS_H shall not be defined. +#else + int dummy=2*WINVER; +#endif + ]]) + ],[ + ac_cv_header_windows_h="yes" + ],[ + ac_cv_header_windows_h="no" + ]) + ]) + case "$ac_cv_header_windows_h" in + yes) + AC_DEFINE_UNQUOTED(HAVE_WINDOWS_H, 1, + [Define to 1 if you have the windows.h header file.]) + AC_DEFINE_UNQUOTED(WIN32_LEAN_AND_MEAN, 1, + [Define to avoid automatic inclusion of winsock.h]) + ;; + esac +]) + + +dnl CURL_CHECK_NATIVE_WINDOWS +dnl ------------------------------------------------- +dnl Check if building a native Windows target + +AC_DEFUN([CURL_CHECK_NATIVE_WINDOWS], [ + AC_REQUIRE([CURL_CHECK_HEADER_WINDOWS])dnl + AC_CACHE_CHECK([whether build target is a native Windows one], [ac_cv_native_windows], [ + if test "$ac_cv_header_windows_h" = "no"; then + ac_cv_native_windows="no" + else + AC_COMPILE_IFELSE([ + AC_LANG_PROGRAM([[ + ]],[[ +#if defined(__MINGW32__) || defined(__MINGW32CE__) || \ + (defined(_MSC_VER) && (defined(_WIN32) || defined(_WIN64))) + int dummy=1; +#else + Not a native Windows build target. +#endif + ]]) + ],[ + ac_cv_native_windows="yes" + ],[ + ac_cv_native_windows="no" + ]) + fi + ]) + case "$ac_cv_native_windows" in + yes) + AC_DEFINE_UNQUOTED(NATIVE_WINDOWS, 1, + [Define to 1 if you are building a native Windows target.]) + ;; + esac +]) + + +dnl CURL_CHECK_HEADER_WINSOCK +dnl ------------------------------------------------- +dnl Check for compilable and valid winsock.h header + +AC_DEFUN([CURL_CHECK_HEADER_WINSOCK], [ + AC_REQUIRE([CURL_CHECK_HEADER_WINDOWS])dnl + AC_CACHE_CHECK([for winsock.h], [ac_cv_header_winsock_h], [ + AC_COMPILE_IFELSE([ + AC_LANG_PROGRAM([[ +#undef inline +#ifndef WIN32_LEAN_AND_MEAN +#define WIN32_LEAN_AND_MEAN +#endif +#include +#include + ]],[[ +#if defined(__CYGWIN__) || defined(__CEGCC__) + HAVE_WINSOCK_H shall not be defined. +#else + int dummy=WSACleanup(); +#endif + ]]) + ],[ + ac_cv_header_winsock_h="yes" + ],[ + ac_cv_header_winsock_h="no" + ]) + ]) + case "$ac_cv_header_winsock_h" in + yes) + AC_DEFINE_UNQUOTED(HAVE_WINSOCK_H, 1, + [Define to 1 if you have the winsock.h header file.]) + ;; + esac +]) + + +dnl CURL_CHECK_HEADER_WINSOCK2 +dnl ------------------------------------------------- +dnl Check for compilable and valid winsock2.h header + +AC_DEFUN([CURL_CHECK_HEADER_WINSOCK2], [ + AC_REQUIRE([CURL_CHECK_HEADER_WINDOWS])dnl + AC_CACHE_CHECK([for winsock2.h], [ac_cv_header_winsock2_h], [ + AC_COMPILE_IFELSE([ + AC_LANG_PROGRAM([[ +#undef inline +#ifndef WIN32_LEAN_AND_MEAN +#define WIN32_LEAN_AND_MEAN +#endif +#include +#include + ]],[[ +#if defined(__CYGWIN__) || defined(__CEGCC__) || defined(__MINGW32CE__) + HAVE_WINSOCK2_H shall not be defined. +#else + int dummy=2*IPPROTO_ESP; +#endif + ]]) + ],[ + ac_cv_header_winsock2_h="yes" + ],[ + ac_cv_header_winsock2_h="no" + ]) + ]) + case "$ac_cv_header_winsock2_h" in + yes) + AC_DEFINE_UNQUOTED(HAVE_WINSOCK2_H, 1, + [Define to 1 if you have the winsock2.h header file.]) + ;; + esac +]) + + +dnl CURL_CHECK_HEADER_WS2TCPIP +dnl ------------------------------------------------- +dnl Check for compilable and valid ws2tcpip.h header + +AC_DEFUN([CURL_CHECK_HEADER_WS2TCPIP], [ + AC_REQUIRE([CURL_CHECK_HEADER_WINSOCK2])dnl + AC_CACHE_CHECK([for ws2tcpip.h], [ac_cv_header_ws2tcpip_h], [ + AC_COMPILE_IFELSE([ + AC_LANG_PROGRAM([[ +#undef inline +#ifndef WIN32_LEAN_AND_MEAN +#define WIN32_LEAN_AND_MEAN +#endif +#include +#include +#include + ]],[[ +#if defined(__CYGWIN__) || defined(__CEGCC__) || defined(__MINGW32CE__) + HAVE_WS2TCPIP_H shall not be defined. +#else + int dummy=2*IP_PKTINFO; +#endif + ]]) + ],[ + ac_cv_header_ws2tcpip_h="yes" + ],[ + ac_cv_header_ws2tcpip_h="no" + ]) + ]) + case "$ac_cv_header_ws2tcpip_h" in + yes) + AC_DEFINE_UNQUOTED(HAVE_WS2TCPIP_H, 1, + [Define to 1 if you have the ws2tcpip.h header file.]) + ;; + esac +]) + + +dnl CURL_CHECK_HEADER_WINLDAP +dnl ------------------------------------------------- +dnl Check for compilable and valid winldap.h header + +AC_DEFUN([CURL_CHECK_HEADER_WINLDAP], [ + AC_REQUIRE([CURL_CHECK_HEADER_WINDOWS])dnl + AC_CACHE_CHECK([for winldap.h], [ac_cv_header_winldap_h], [ + AC_COMPILE_IFELSE([ + AC_LANG_PROGRAM([[ +#undef inline +#ifdef HAVE_WINDOWS_H +#ifndef WIN32_LEAN_AND_MEAN +#define WIN32_LEAN_AND_MEAN +#endif +#include +#endif +#include + ]],[[ +#if defined(__CYGWIN__) || defined(__CEGCC__) + HAVE_WINLDAP_H shall not be defined. +#else + LDAP *ldp = ldap_init("dummy", LDAP_PORT); + ULONG res = ldap_unbind(ldp); +#endif + ]]) + ],[ + ac_cv_header_winldap_h="yes" + ],[ + ac_cv_header_winldap_h="no" + ]) + ]) + case "$ac_cv_header_winldap_h" in + yes) + AC_DEFINE_UNQUOTED(HAVE_WINLDAP_H, 1, + [Define to 1 if you have the winldap.h header file.]) + ;; + esac +]) + + +dnl CURL_CHECK_HEADER_WINBER +dnl ------------------------------------------------- +dnl Check for compilable and valid winber.h header + +AC_DEFUN([CURL_CHECK_HEADER_WINBER], [ + AC_REQUIRE([CURL_CHECK_HEADER_WINLDAP])dnl + AC_CACHE_CHECK([for winber.h], [ac_cv_header_winber_h], [ + AC_COMPILE_IFELSE([ + AC_LANG_PROGRAM([[ +#undef inline +#ifdef HAVE_WINDOWS_H +#ifndef WIN32_LEAN_AND_MEAN +#define WIN32_LEAN_AND_MEAN +#endif +#include +#endif +#include +#include + ]],[[ +#if defined(__CYGWIN__) || defined(__CEGCC__) + HAVE_WINBER_H shall not be defined. +#else + BERVAL *bvp = NULL; + BerElement *bep = ber_init(bvp); + ber_free(bep, 1); +#endif + ]]) + ],[ + ac_cv_header_winber_h="yes" + ],[ + ac_cv_header_winber_h="no" + ]) + ]) + case "$ac_cv_header_winber_h" in + yes) + AC_DEFINE_UNQUOTED(HAVE_WINBER_H, 1, + [Define to 1 if you have the winber.h header file.]) + ;; + esac +]) + + +dnl CURL_CHECK_HEADER_LBER +dnl ------------------------------------------------- +dnl Check for compilable and valid lber.h header, +dnl and check if it is needed even with ldap.h + +AC_DEFUN([CURL_CHECK_HEADER_LBER], [ + AC_REQUIRE([CURL_CHECK_HEADER_WINDOWS])dnl + AC_CACHE_CHECK([for lber.h], [ac_cv_header_lber_h], [ + AC_COMPILE_IFELSE([ + AC_LANG_PROGRAM([[ +#undef inline +#ifdef HAVE_WINDOWS_H +#ifndef WIN32_LEAN_AND_MEAN +#define WIN32_LEAN_AND_MEAN +#endif +#include +#else +#ifdef HAVE_SYS_TYPES_H +#include +#endif +#endif +#ifndef NULL +#define NULL (void *)0 +#endif +#include + ]],[[ + BerValue *bvp = NULL; + BerElement *bep = ber_init(bvp); + ber_free(bep, 1); + ]]) + ],[ + ac_cv_header_lber_h="yes" + ],[ + ac_cv_header_lber_h="no" + ]) + ]) + if test "$ac_cv_header_lber_h" = "yes"; then + AC_DEFINE_UNQUOTED(HAVE_LBER_H, 1, + [Define to 1 if you have the lber.h header file.]) + # + AC_COMPILE_IFELSE([ + AC_LANG_PROGRAM([[ +#undef inline +#ifdef HAVE_WINDOWS_H +#ifndef WIN32_LEAN_AND_MEAN +#define WIN32_LEAN_AND_MEAN +#endif +#include +#else +#ifdef HAVE_SYS_TYPES_H +#include +#endif +#endif +#ifndef NULL +#define NULL (void *)0 +#endif +#ifndef LDAP_DEPRECATED +#define LDAP_DEPRECATED 1 +#endif +#include + ]],[[ + BerValue *bvp = NULL; + BerElement *bep = ber_init(bvp); + ber_free(bep, 1); + ]]) + ],[ + curl_cv_need_header_lber_h="no" + ],[ + curl_cv_need_header_lber_h="yes" + ]) + # + case "$curl_cv_need_header_lber_h" in + yes) + AC_DEFINE_UNQUOTED(NEED_LBER_H, 1, + [Define to 1 if you need the lber.h header file even with ldap.h]) + ;; + esac + fi +]) + + +dnl CURL_CHECK_HEADER_LDAP +dnl ------------------------------------------------- +dnl Check for compilable and valid ldap.h header + +AC_DEFUN([CURL_CHECK_HEADER_LDAP], [ + AC_REQUIRE([CURL_CHECK_HEADER_LBER])dnl + AC_CACHE_CHECK([for ldap.h], [ac_cv_header_ldap_h], [ + AC_COMPILE_IFELSE([ + AC_LANG_PROGRAM([[ +#undef inline +#ifdef HAVE_WINDOWS_H +#ifndef WIN32_LEAN_AND_MEAN +#define WIN32_LEAN_AND_MEAN +#endif +#include +#else +#ifdef HAVE_SYS_TYPES_H +#include +#endif +#endif +#ifndef LDAP_DEPRECATED +#define LDAP_DEPRECATED 1 +#endif +#ifdef NEED_LBER_H +#include +#endif +#include + ]],[[ + LDAP *ldp = ldap_init("dummy", LDAP_PORT); + int res = ldap_unbind(ldp); + ]]) + ],[ + ac_cv_header_ldap_h="yes" + ],[ + ac_cv_header_ldap_h="no" + ]) + ]) + case "$ac_cv_header_ldap_h" in + yes) + AC_DEFINE_UNQUOTED(HAVE_LDAP_H, 1, + [Define to 1 if you have the ldap.h header file.]) + ;; + esac +]) + + +dnl CURL_CHECK_HEADER_LDAP_SSL +dnl ------------------------------------------------- +dnl Check for compilable and valid ldap_ssl.h header + +AC_DEFUN([CURL_CHECK_HEADER_LDAP_SSL], [ + AC_REQUIRE([CURL_CHECK_HEADER_LDAP])dnl + AC_CACHE_CHECK([for ldap_ssl.h], [ac_cv_header_ldap_ssl_h], [ + AC_COMPILE_IFELSE([ + AC_LANG_PROGRAM([[ +#undef inline +#ifdef HAVE_WINDOWS_H +#ifndef WIN32_LEAN_AND_MEAN +#define WIN32_LEAN_AND_MEAN +#endif +#include +#else +#ifdef HAVE_SYS_TYPES_H +#include +#endif +#endif +#ifndef LDAP_DEPRECATED +#define LDAP_DEPRECATED 1 +#endif +#ifdef NEED_LBER_H +#include +#endif +#ifdef HAVE_LDAP_H +#include +#endif +#include + ]],[[ + LDAP *ldp = ldapssl_init("dummy", LDAPS_PORT, 1); + ]]) + ],[ + ac_cv_header_ldap_ssl_h="yes" + ],[ + ac_cv_header_ldap_ssl_h="no" + ]) + ]) + case "$ac_cv_header_ldap_ssl_h" in + yes) + AC_DEFINE_UNQUOTED(HAVE_LDAP_SSL_H, 1, + [Define to 1 if you have the ldap_ssl.h header file.]) + ;; + esac +]) + + +dnl CURL_CHECK_HEADER_LDAPSSL +dnl ------------------------------------------------- +dnl Check for compilable and valid ldapssl.h header + +AC_DEFUN([CURL_CHECK_HEADER_LDAPSSL], [ + AC_REQUIRE([CURL_CHECK_HEADER_LDAP])dnl + AC_CACHE_CHECK([for ldapssl.h], [ac_cv_header_ldapssl_h], [ + AC_COMPILE_IFELSE([ + AC_LANG_PROGRAM([[ +#undef inline +#ifdef HAVE_WINDOWS_H +#ifndef WIN32_LEAN_AND_MEAN +#define WIN32_LEAN_AND_MEAN +#endif +#include +#else +#ifdef HAVE_SYS_TYPES_H +#include +#endif +#endif +#ifndef NULL +#define NULL (void *)0 +#endif +#ifndef LDAP_DEPRECATED +#define LDAP_DEPRECATED 1 +#endif +#ifdef NEED_LBER_H +#include +#endif +#ifdef HAVE_LDAP_H +#include +#endif +#include + ]],[[ + char *cert_label = NULL; + LDAP *ldp = ldap_ssl_init("dummy", LDAPS_PORT, cert_label); + ]]) + ],[ + ac_cv_header_ldapssl_h="yes" + ],[ + ac_cv_header_ldapssl_h="no" + ]) + ]) + case "$ac_cv_header_ldapssl_h" in + yes) + AC_DEFINE_UNQUOTED(HAVE_LDAPSSL_H, 1, + [Define to 1 if you have the ldapssl.h header file.]) + ;; + esac +]) + + +dnl CURL_CHECK_LIBS_WINLDAP +dnl ------------------------------------------------- +dnl Check for libraries needed for WINLDAP support, +dnl and prepended to LIBS any needed libraries. +dnl This macro can take an optional parameter with a +dnl white space separated list of libraries to check +dnl before the WINLDAP default ones. + +AC_DEFUN([CURL_CHECK_LIBS_WINLDAP], [ + AC_REQUIRE([CURL_CHECK_HEADER_WINBER])dnl + # + AC_MSG_CHECKING([for WINLDAP libraries]) + # + u_libs="" + # + ifelse($1,,,[ + for x_lib in $1; do + case "$x_lib" in + -l*) + l_lib="$x_lib" + ;; + *) + l_lib="-l$x_lib" + ;; + esac + if test -z "$u_libs"; then + u_libs="$l_lib" + else + u_libs="$u_libs $l_lib" + fi + done + ]) + # + curl_cv_save_LIBS="$LIBS" + curl_cv_ldap_LIBS="unknown" + # + for x_nlibs in '' "$u_libs" \ + '-lwldap32' ; do + if test "$curl_cv_ldap_LIBS" = "unknown"; then + if test -z "$x_nlibs"; then + LIBS="$curl_cv_save_LIBS" + else + LIBS="$x_nlibs $curl_cv_save_LIBS" + fi + AC_LINK_IFELSE([ + AC_LANG_PROGRAM([[ +#undef inline +#ifdef HAVE_WINDOWS_H +#ifndef WIN32_LEAN_AND_MEAN +#define WIN32_LEAN_AND_MEAN +#endif +#include +#ifdef HAVE_WINLDAP_H +#include +#endif +#ifdef HAVE_WINBER_H +#include +#endif +#endif + ]],[[ + BERVAL *bvp = NULL; + BerElement *bep = ber_init(bvp); + LDAP *ldp = ldap_init("dummy", LDAP_PORT); + ULONG res = ldap_unbind(ldp); + ber_free(bep, 1); + ]]) + ],[ + curl_cv_ldap_LIBS="$x_nlibs" + ]) + fi + done + # + LIBS="$curl_cv_save_LIBS" + # + case X-"$curl_cv_ldap_LIBS" in + X-unknown) + AC_MSG_RESULT([cannot find WINLDAP libraries]) + ;; + X-) + AC_MSG_RESULT([no additional lib required]) + ;; + *) + if test -z "$curl_cv_save_LIBS"; then + LIBS="$curl_cv_ldap_LIBS" + else + LIBS="$curl_cv_ldap_LIBS $curl_cv_save_LIBS" + fi + AC_MSG_RESULT([$curl_cv_ldap_LIBS]) + ;; + esac + # +]) + + +dnl CURL_CHECK_LIBS_LDAP +dnl ------------------------------------------------- +dnl Check for libraries needed for LDAP support, +dnl and prepended to LIBS any needed libraries. +dnl This macro can take an optional parameter with a +dnl white space separated list of libraries to check +dnl before the default ones. + +AC_DEFUN([CURL_CHECK_LIBS_LDAP], [ + AC_REQUIRE([CURL_CHECK_HEADER_LDAP])dnl + # + AC_MSG_CHECKING([for LDAP libraries]) + # + u_libs="" + # + ifelse($1,,,[ + for x_lib in $1; do + case "$x_lib" in + -l*) + l_lib="$x_lib" + ;; + *) + l_lib="-l$x_lib" + ;; + esac + if test -z "$u_libs"; then + u_libs="$l_lib" + else + u_libs="$u_libs $l_lib" + fi + done + ]) + # + curl_cv_save_LIBS="$LIBS" + curl_cv_ldap_LIBS="unknown" + # + for x_nlibs in '' "$u_libs" \ + '-lldap' \ + '-llber -lldap' \ + '-lldap -llber' \ + '-lldapssl -lldapx -lldapsdk' \ + '-lldapsdk -lldapx -lldapssl' ; do + if test "$curl_cv_ldap_LIBS" = "unknown"; then + if test -z "$x_nlibs"; then + LIBS="$curl_cv_save_LIBS" + else + LIBS="$x_nlibs $curl_cv_save_LIBS" + fi + AC_LINK_IFELSE([ + AC_LANG_PROGRAM([[ +#undef inline +#ifdef HAVE_WINDOWS_H +#ifndef WIN32_LEAN_AND_MEAN +#define WIN32_LEAN_AND_MEAN +#endif +#include +#else +#ifdef HAVE_SYS_TYPES_H +#include +#endif +#endif +#ifndef NULL +#define NULL (void *)0 +#endif +#ifndef LDAP_DEPRECATED +#define LDAP_DEPRECATED 1 +#endif +#ifdef NEED_LBER_H +#include +#endif +#ifdef HAVE_LDAP_H +#include +#endif + ]],[[ + BerValue *bvp = NULL; + BerElement *bep = ber_init(bvp); + LDAP *ldp = ldap_init("dummy", LDAP_PORT); + int res = ldap_unbind(ldp); + ber_free(bep, 1); + ]]) + ],[ + curl_cv_ldap_LIBS="$x_nlibs" + ]) + fi + done + # + LIBS="$curl_cv_save_LIBS" + # + case X-"$curl_cv_ldap_LIBS" in + X-unknown) + AC_MSG_RESULT([cannot find LDAP libraries]) + ;; + X-) + AC_MSG_RESULT([no additional lib required]) + ;; + *) + if test -z "$curl_cv_save_LIBS"; then + LIBS="$curl_cv_ldap_LIBS" + else + LIBS="$curl_cv_ldap_LIBS $curl_cv_save_LIBS" + fi + AC_MSG_RESULT([$curl_cv_ldap_LIBS]) + ;; + esac + # +]) + + +dnl CURL_CHECK_HEADER_MALLOC +dnl ------------------------------------------------- +dnl Check for compilable and valid malloc.h header, +dnl and check if it is needed even with stdlib.h + +AC_DEFUN([CURL_CHECK_HEADER_MALLOC], [ + AC_CACHE_CHECK([for malloc.h], [ac_cv_header_malloc_h], [ + AC_COMPILE_IFELSE([ + AC_LANG_PROGRAM([[ +#include + ]],[[ + void *p = malloc(10); + void *q = calloc(10,10); + free(p); + free(q); + ]]) + ],[ + ac_cv_header_malloc_h="yes" + ],[ + ac_cv_header_malloc_h="no" + ]) + ]) + if test "$ac_cv_header_malloc_h" = "yes"; then + AC_DEFINE_UNQUOTED(HAVE_MALLOC_H, 1, + [Define to 1 if you have the malloc.h header file.]) + # + AC_COMPILE_IFELSE([ + AC_LANG_PROGRAM([[ +#include + ]],[[ + void *p = malloc(10); + void *q = calloc(10,10); + free(p); + free(q); + ]]) + ],[ + curl_cv_need_header_malloc_h="no" + ],[ + curl_cv_need_header_malloc_h="yes" + ]) + # + case "$curl_cv_need_header_malloc_h" in + yes) + AC_DEFINE_UNQUOTED(NEED_MALLOC_H, 1, + [Define to 1 if you need the malloc.h header file even with stdlib.h]) + ;; + esac + fi +]) + + +dnl CURL_CHECK_HEADER_MEMORY +dnl ------------------------------------------------- +dnl Check for compilable and valid memory.h header, +dnl and check if it is needed even with stdlib.h for +dnl memory related functions. + +AC_DEFUN([CURL_CHECK_HEADER_MEMORY], [ + AC_CACHE_CHECK([for memory.h], [ac_cv_header_memory_h], [ + AC_COMPILE_IFELSE([ + AC_LANG_PROGRAM([[ +#include + ]],[[ + void *p = malloc(10); + void *q = calloc(10,10); + free(p); + free(q); + ]]) + ],[ + ac_cv_header_memory_h="yes" + ],[ + ac_cv_header_memory_h="no" + ]) + ]) + if test "$ac_cv_header_memory_h" = "yes"; then + AC_DEFINE_UNQUOTED(HAVE_MEMORY_H, 1, + [Define to 1 if you have the memory.h header file.]) + # + AC_COMPILE_IFELSE([ + AC_LANG_PROGRAM([[ +#include + ]],[[ + void *p = malloc(10); + void *q = calloc(10,10); + free(p); + free(q); + ]]) + ],[ + curl_cv_need_header_memory_h="no" + ],[ + curl_cv_need_header_memory_h="yes" + ]) + # + case "$curl_cv_need_header_memory_h" in + yes) + AC_DEFINE_UNQUOTED(NEED_MEMORY_H, 1, + [Define to 1 if you need the memory.h header file even with stdlib.h]) + ;; + esac + fi +]) + + +dnl CURL_CHECK_FUNC_GETNAMEINFO +dnl ------------------------------------------------- +dnl Test if the getnameinfo function is available, +dnl and check the types of five of its arguments. +dnl If the function succeeds HAVE_GETNAMEINFO will be +dnl defined, defining the types of the arguments in +dnl GETNAMEINFO_TYPE_ARG1, GETNAMEINFO_TYPE_ARG2, +dnl GETNAMEINFO_TYPE_ARG46 and GETNAMEINFO_TYPE_ARG7, +dnl and also defining the type qualifier of first +dnl argument in GETNAMEINFO_QUAL_ARG1. + +AC_DEFUN([CURL_CHECK_FUNC_GETNAMEINFO], [ + AC_REQUIRE([CURL_CHECK_HEADER_WS2TCPIP])dnl + AC_CHECK_HEADERS(sys/types.h sys/socket.h netdb.h) + # + AC_MSG_CHECKING([for getnameinfo]) + AC_LINK_IFELSE([ + AC_LANG_FUNC_LINK_TRY([getnameinfo]) + ],[ + AC_MSG_RESULT([yes]) + curl_cv_getnameinfo="yes" + ],[ + AC_MSG_RESULT([no]) + curl_cv_getnameinfo="no" + ]) + # + if test "$curl_cv_getnameinfo" != "yes"; then + AC_MSG_CHECKING([deeper for getnameinfo]) + AC_LINK_IFELSE([ + AC_LANG_PROGRAM([[ + ]],[[ + getnameinfo(); + ]]) + ],[ + AC_MSG_RESULT([yes]) + curl_cv_getnameinfo="yes" + ],[ + AC_MSG_RESULT([but still no]) + curl_cv_getnameinfo="no" + ]) + fi + # + if test "$curl_cv_getnameinfo" != "yes"; then + AC_MSG_CHECKING([deeper and deeper for getnameinfo]) + AC_LINK_IFELSE([ + AC_LANG_PROGRAM([[ +#undef inline +#ifdef HAVE_WINDOWS_H +#ifndef WIN32_LEAN_AND_MEAN +#define WIN32_LEAN_AND_MEAN +#endif +#include +#ifdef HAVE_WINSOCK2_H +#include +#ifdef HAVE_WS2TCPIP_H +#include +#endif +#endif +#else +#ifdef HAVE_SYS_TYPES_H +#include +#endif +#ifdef HAVE_SYS_SOCKET_H +#include +#endif +#ifdef HAVE_NETDB_H +#include +#endif +#endif + ]],[[ + getnameinfo(0, 0, 0, 0, 0, 0, 0); + ]]) + ],[ + AC_MSG_RESULT([yes]) + curl_cv_getnameinfo="yes" + ],[ + AC_MSG_RESULT([but still no]) + curl_cv_getnameinfo="no" + ]) + fi + # + if test "$curl_cv_getnameinfo" = "yes"; then + AC_CACHE_CHECK([types of arguments for getnameinfo], + [curl_cv_func_getnameinfo_args], [ + curl_cv_func_getnameinfo_args="unknown" + for gni_arg1 in 'struct sockaddr *' 'const struct sockaddr *' 'void *'; do + for gni_arg2 in 'socklen_t' 'size_t' 'int'; do + for gni_arg46 in 'size_t' 'int' 'socklen_t' 'unsigned int' 'DWORD'; do + for gni_arg7 in 'int' 'unsigned int'; do + if test "$curl_cv_func_getnameinfo_args" = "unknown"; then + AC_COMPILE_IFELSE([ + AC_LANG_PROGRAM([[ +#undef inline +#ifdef HAVE_WINDOWS_H +#ifndef WIN32_LEAN_AND_MEAN +#define WIN32_LEAN_AND_MEAN +#endif +#if (!defined(_WIN32_WINNT)) || (_WIN32_WINNT < 0x0501) +#undef _WIN32_WINNT +#define _WIN32_WINNT 0x0501 +#endif +#include +#ifdef HAVE_WINSOCK2_H +#include +#ifdef HAVE_WS2TCPIP_H +#include +#endif +#endif +#define GNICALLCONV WSAAPI +#else +#ifdef HAVE_SYS_TYPES_H +#include +#endif +#ifdef HAVE_SYS_SOCKET_H +#include +#endif +#ifdef HAVE_NETDB_H +#include +#endif +#define GNICALLCONV +#endif + extern int GNICALLCONV getnameinfo($gni_arg1, $gni_arg2, + char *, $gni_arg46, + char *, $gni_arg46, + $gni_arg7); + ]],[[ + $gni_arg2 salen=0; + $gni_arg46 hostlen=0; + $gni_arg46 servlen=0; + $gni_arg7 flags=0; + int res = getnameinfo(0, salen, 0, hostlen, 0, servlen, flags); + ]]) + ],[ + curl_cv_func_getnameinfo_args="$gni_arg1,$gni_arg2,$gni_arg46,$gni_arg7" + ]) + fi + done + done + done + done + ]) # AC-CACHE-CHECK + if test "$curl_cv_func_getnameinfo_args" = "unknown"; then + AC_MSG_WARN([Cannot find proper types to use for getnameinfo args]) + AC_MSG_WARN([HAVE_GETNAMEINFO will not be defined]) + else + gni_prev_IFS=$IFS; IFS=',' + set dummy `echo "$curl_cv_func_getnameinfo_args" | sed 's/\*/\*/g'` + IFS=$gni_prev_IFS + shift + # + gni_qual_type_arg1=$[1] + # + AC_DEFINE_UNQUOTED(GETNAMEINFO_TYPE_ARG2, $[2], + [Define to the type of arg 2 for getnameinfo.]) + AC_DEFINE_UNQUOTED(GETNAMEINFO_TYPE_ARG46, $[3], + [Define to the type of args 4 and 6 for getnameinfo.]) + AC_DEFINE_UNQUOTED(GETNAMEINFO_TYPE_ARG7, $[4], + [Define to the type of arg 7 for getnameinfo.]) + # + prev_sh_opts=$- + # + case $prev_sh_opts in + *f*) + ;; + *) + set -f + ;; + esac + # + case "$gni_qual_type_arg1" in + const*) + gni_qual_arg1=const + gni_type_arg1=`echo $gni_qual_type_arg1 | sed 's/^const //'` + ;; + *) + gni_qual_arg1= + gni_type_arg1=$gni_qual_type_arg1 + ;; + esac + # + AC_DEFINE_UNQUOTED(GETNAMEINFO_QUAL_ARG1, $gni_qual_arg1, + [Define to the type qualifier of arg 1 for getnameinfo.]) + AC_DEFINE_UNQUOTED(GETNAMEINFO_TYPE_ARG1, $gni_type_arg1, + [Define to the type of arg 1 for getnameinfo.]) + # + case $prev_sh_opts in + *f*) + ;; + *) + set +f + ;; + esac + # + AC_DEFINE_UNQUOTED(HAVE_GETNAMEINFO, 1, + [Define to 1 if you have the getnameinfo function.]) + ac_cv_func_getnameinfo="yes" + fi + fi +]) + + +dnl TYPE_SOCKADDR_STORAGE +dnl ------------------------------------------------- +dnl Check for struct sockaddr_storage. Most IPv6-enabled +dnl hosts have it, but AIX 4.3 is one known exception. + +AC_DEFUN([TYPE_SOCKADDR_STORAGE], +[ + AC_CHECK_TYPE([struct sockaddr_storage], + AC_DEFINE(HAVE_STRUCT_SOCKADDR_STORAGE, 1, + [if struct sockaddr_storage is defined]), , + [ +#undef inline +#ifdef HAVE_WINDOWS_H +#ifndef WIN32_LEAN_AND_MEAN +#define WIN32_LEAN_AND_MEAN +#endif +#include +#ifdef HAVE_WINSOCK2_H +#include +#endif +#else +#ifdef HAVE_SYS_TYPES_H +#include +#endif +#ifdef HAVE_SYS_SOCKET_H +#include +#endif +#ifdef HAVE_NETINET_IN_H +#include +#endif +#ifdef HAVE_ARPA_INET_H +#include +#endif +#endif + ]) +]) + + +dnl CURL_CHECK_NI_WITHSCOPEID +dnl ------------------------------------------------- +dnl Check for working NI_WITHSCOPEID in getnameinfo() + +AC_DEFUN([CURL_CHECK_NI_WITHSCOPEID], [ + AC_REQUIRE([CURL_CHECK_FUNC_GETNAMEINFO])dnl + AC_REQUIRE([TYPE_SOCKADDR_STORAGE])dnl + AC_CHECK_HEADERS(stdio.h sys/types.h sys/socket.h \ + netdb.h netinet/in.h arpa/inet.h) + # + AC_CACHE_CHECK([for working NI_WITHSCOPEID], + [ac_cv_working_ni_withscopeid], [ + AC_RUN_IFELSE([ + AC_LANG_PROGRAM([[ +#ifdef HAVE_STDLIB_H +#include +#endif +#ifdef HAVE_STDIO_H +#include +#endif +#ifdef HAVE_SYS_TYPES_H +#include +#endif +#ifdef HAVE_SYS_SOCKET_H +#include +#endif +#ifdef HAVE_NETDB_H +#include +#endif +#ifdef HAVE_NETINET_IN_H +#include +#endif +#ifdef HAVE_ARPA_INET_H +#include +#endif + ]],[[ +#if defined(NI_WITHSCOPEID) && defined(HAVE_GETNAMEINFO) +#ifdef HAVE_STRUCT_SOCKADDR_STORAGE + struct sockaddr_storage sa; +#else + unsigned char sa[256]; +#endif + char hostbuf[NI_MAXHOST]; + int rc; + GETNAMEINFO_TYPE_ARG2 salen = (GETNAMEINFO_TYPE_ARG2)sizeof(sa); + GETNAMEINFO_TYPE_ARG46 hostlen = (GETNAMEINFO_TYPE_ARG46)sizeof(hostbuf); + GETNAMEINFO_TYPE_ARG7 flags = NI_NUMERICHOST | NI_NUMERICSERV | NI_WITHSCOPEID; + int fd = socket(AF_INET6, SOCK_STREAM, 0); + if(fd < 0) { + perror("socket()"); + return 1; /* Error creating socket */ + } + rc = getsockname(fd, (GETNAMEINFO_TYPE_ARG1)&sa, &salen); + if(rc) { + perror("getsockname()"); + return 2; /* Error retrieving socket name */ + } + rc = getnameinfo((GETNAMEINFO_TYPE_ARG1)&sa, salen, hostbuf, hostlen, NULL, 0, flags); + if(rc) { + printf("rc = %s\n", gai_strerror(rc)); + return 3; /* Error translating socket address */ + } + return 0; /* Ok, NI_WITHSCOPEID works */ +#else + return 4; /* Error, NI_WITHSCOPEID not defined or no getnameinfo() */ +#endif + ]]) # AC-LANG-PROGRAM + ],[ + # Exit code == 0. Program worked. + ac_cv_working_ni_withscopeid="yes" + ],[ + # Exit code != 0. Program failed. + ac_cv_working_ni_withscopeid="no" + ],[ + # Program is not run when cross-compiling. So we assume + # NI_WITHSCOPEID will work if we are able to compile it. + AC_COMPILE_IFELSE([ + AC_LANG_PROGRAM([[ +#include +#include +#include + ]],[[ + unsigned int dummy= NI_NUMERICHOST | NI_NUMERICSERV | NI_WITHSCOPEID; + ]]) + ],[ + ac_cv_working_ni_withscopeid="yes" + ],[ + ac_cv_working_ni_withscopeid="no" + ]) # AC-COMPILE-IFELSE + ]) # AC-RUN-IFELSE + ]) # AC-CACHE-CHECK + case "$ac_cv_working_ni_withscopeid" in + yes) + AC_DEFINE(HAVE_NI_WITHSCOPEID, 1, + [Define to 1 if NI_WITHSCOPEID exists and works.]) + ;; + esac +]) + + +dnl CURL_CHECK_FUNC_RECV +dnl ------------------------------------------------- +dnl Test if the socket recv() function is available, +dnl and check its return type and the types of its +dnl arguments. If the function succeeds HAVE_RECV +dnl will be defined, defining the types of the arguments +dnl in RECV_TYPE_ARG1, RECV_TYPE_ARG2, RECV_TYPE_ARG3 +dnl and RECV_TYPE_ARG4, defining the type of the function +dnl return value in RECV_TYPE_RETV. + +AC_DEFUN([CURL_CHECK_FUNC_RECV], [ + AC_REQUIRE([CURL_CHECK_HEADER_WINSOCK])dnl + AC_REQUIRE([CURL_CHECK_HEADER_WINSOCK2])dnl + AC_CHECK_HEADERS(sys/types.h sys/socket.h) + # + AC_MSG_CHECKING([for recv]) + AC_LINK_IFELSE([ + AC_LANG_PROGRAM([[ +#undef inline +#ifdef HAVE_WINDOWS_H +#ifndef WIN32_LEAN_AND_MEAN +#define WIN32_LEAN_AND_MEAN +#endif +#include +#ifdef HAVE_WINSOCK2_H +#include +#else +#ifdef HAVE_WINSOCK_H +#include +#endif +#endif +#else +#ifdef HAVE_SYS_TYPES_H +#include +#endif +#ifdef HAVE_SYS_SOCKET_H +#include +#endif +#endif + ]],[[ + recv(0, 0, 0, 0); + ]]) + ],[ + AC_MSG_RESULT([yes]) + curl_cv_recv="yes" + ],[ + AC_MSG_RESULT([no]) + curl_cv_recv="no" + ]) + # + if test "$curl_cv_recv" = "yes"; then + AC_CACHE_CHECK([types of args and return type for recv], + [curl_cv_func_recv_args], [ + curl_cv_func_recv_args="unknown" + for recv_retv in 'int' 'ssize_t'; do + for recv_arg1 in 'int' 'ssize_t' 'SOCKET'; do + for recv_arg2 in 'char *' 'void *'; do + for recv_arg3 in 'size_t' 'int' 'socklen_t' 'unsigned int'; do + for recv_arg4 in 'int' 'unsigned int'; do + if test "$curl_cv_func_recv_args" = "unknown"; then + AC_COMPILE_IFELSE([ + AC_LANG_PROGRAM([[ +#undef inline +#ifdef HAVE_WINDOWS_H +#ifndef WIN32_LEAN_AND_MEAN +#define WIN32_LEAN_AND_MEAN +#endif +#include +#ifdef HAVE_WINSOCK2_H +#include +#else +#ifdef HAVE_WINSOCK_H +#include +#endif +#endif +#define RECVCALLCONV PASCAL +#else +#ifdef HAVE_SYS_TYPES_H +#include +#endif +#ifdef HAVE_SYS_SOCKET_H +#include +#endif +#define RECVCALLCONV +#endif + extern $recv_retv RECVCALLCONV + recv($recv_arg1, $recv_arg2, $recv_arg3, $recv_arg4); + ]],[[ + $recv_arg1 s=0; + $recv_arg2 buf=0; + $recv_arg3 len=0; + $recv_arg4 flags=0; + $recv_retv res = recv(s, buf, len, flags); + ]]) + ],[ + curl_cv_func_recv_args="$recv_arg1,$recv_arg2,$recv_arg3,$recv_arg4,$recv_retv" + ]) + fi + done + done + done + done + done + ]) # AC-CACHE-CHECK + if test "$curl_cv_func_recv_args" = "unknown"; then + AC_MSG_ERROR([Cannot find proper types to use for recv args]) + else + recv_prev_IFS=$IFS; IFS=',' + set dummy `echo "$curl_cv_func_recv_args" | sed 's/\*/\*/g'` + IFS=$recv_prev_IFS + shift + # + AC_DEFINE_UNQUOTED(RECV_TYPE_ARG1, $[1], + [Define to the type of arg 1 for recv.]) + AC_DEFINE_UNQUOTED(RECV_TYPE_ARG2, $[2], + [Define to the type of arg 2 for recv.]) + AC_DEFINE_UNQUOTED(RECV_TYPE_ARG3, $[3], + [Define to the type of arg 3 for recv.]) + AC_DEFINE_UNQUOTED(RECV_TYPE_ARG4, $[4], + [Define to the type of arg 4 for recv.]) + AC_DEFINE_UNQUOTED(RECV_TYPE_RETV, $[5], + [Define to the function return type for recv.]) + # + AC_DEFINE_UNQUOTED(HAVE_RECV, 1, + [Define to 1 if you have the recv function.]) + ac_cv_func_recv="yes" + fi + else + AC_MSG_ERROR([Unable to link function recv]) + fi +]) + + +dnl CURL_CHECK_FUNC_SEND +dnl ------------------------------------------------- +dnl Test if the socket send() function is available, +dnl and check its return type and the types of its +dnl arguments. If the function succeeds HAVE_SEND +dnl will be defined, defining the types of the arguments +dnl in SEND_TYPE_ARG1, SEND_TYPE_ARG2, SEND_TYPE_ARG3 +dnl and SEND_TYPE_ARG4, defining the type of the function +dnl return value in SEND_TYPE_RETV, and also defining the +dnl type qualifier of second argument in SEND_QUAL_ARG2. + +AC_DEFUN([CURL_CHECK_FUNC_SEND], [ + AC_REQUIRE([CURL_CHECK_HEADER_WINSOCK])dnl + AC_REQUIRE([CURL_CHECK_HEADER_WINSOCK2])dnl + AC_CHECK_HEADERS(sys/types.h sys/socket.h) + # + AC_MSG_CHECKING([for send]) + AC_LINK_IFELSE([ + AC_LANG_PROGRAM([[ +#undef inline +#ifdef HAVE_WINDOWS_H +#ifndef WIN32_LEAN_AND_MEAN +#define WIN32_LEAN_AND_MEAN +#endif +#include +#ifdef HAVE_WINSOCK2_H +#include +#else +#ifdef HAVE_WINSOCK_H +#include +#endif +#endif +#else +#ifdef HAVE_SYS_TYPES_H +#include +#endif +#ifdef HAVE_SYS_SOCKET_H +#include +#endif +#endif + ]],[[ + send(0, 0, 0, 0); + ]]) + ],[ + AC_MSG_RESULT([yes]) + curl_cv_send="yes" + ],[ + AC_MSG_RESULT([no]) + curl_cv_send="no" + ]) + # + if test "$curl_cv_send" = "yes"; then + AC_CACHE_CHECK([types of args and return type for send], + [curl_cv_func_send_args], [ + curl_cv_func_send_args="unknown" + for send_retv in 'int' 'ssize_t'; do + for send_arg1 in 'int' 'ssize_t' 'SOCKET'; do + for send_arg2 in 'char *' 'void *' 'const char *' 'const void *'; do + for send_arg3 in 'size_t' 'int' 'socklen_t' 'unsigned int'; do + for send_arg4 in 'int' 'unsigned int'; do + if test "$curl_cv_func_send_args" = "unknown"; then + AC_COMPILE_IFELSE([ + AC_LANG_PROGRAM([[ +#undef inline +#ifdef HAVE_WINDOWS_H +#ifndef WIN32_LEAN_AND_MEAN +#define WIN32_LEAN_AND_MEAN +#endif +#include +#ifdef HAVE_WINSOCK2_H +#include +#else +#ifdef HAVE_WINSOCK_H +#include +#endif +#endif +#define SENDCALLCONV PASCAL +#else +#ifdef HAVE_SYS_TYPES_H +#include +#endif +#ifdef HAVE_SYS_SOCKET_H +#include +#endif +#define SENDCALLCONV +#endif + extern $send_retv SENDCALLCONV + send($send_arg1, $send_arg2, $send_arg3, $send_arg4); + ]],[[ + $send_arg1 s=0; + $send_arg3 len=0; + $send_arg4 flags=0; + $send_retv res = send(s, 0, len, flags); + ]]) + ],[ + curl_cv_func_send_args="$send_arg1,$send_arg2,$send_arg3,$send_arg4,$send_retv" + ]) + fi + done + done + done + done + done + ]) # AC-CACHE-CHECK + if test "$curl_cv_func_send_args" = "unknown"; then + AC_MSG_ERROR([Cannot find proper types to use for send args]) + else + send_prev_IFS=$IFS; IFS=',' + set dummy `echo "$curl_cv_func_send_args" | sed 's/\*/\*/g'` + IFS=$send_prev_IFS + shift + # + send_qual_type_arg2=$[2] + # + AC_DEFINE_UNQUOTED(SEND_TYPE_ARG1, $[1], + [Define to the type of arg 1 for send.]) + AC_DEFINE_UNQUOTED(SEND_TYPE_ARG3, $[3], + [Define to the type of arg 3 for send.]) + AC_DEFINE_UNQUOTED(SEND_TYPE_ARG4, $[4], + [Define to the type of arg 4 for send.]) + AC_DEFINE_UNQUOTED(SEND_TYPE_RETV, $[5], + [Define to the function return type for send.]) + # + prev_sh_opts=$- + # + case $prev_sh_opts in + *f*) + ;; + *) + set -f + ;; + esac + # + case "$send_qual_type_arg2" in + const*) + send_qual_arg2=const + send_type_arg2=`echo $send_qual_type_arg2 | sed 's/^const //'` + ;; + *) + send_qual_arg2= + send_type_arg2=$send_qual_type_arg2 + ;; + esac + # + AC_DEFINE_UNQUOTED(SEND_QUAL_ARG2, $send_qual_arg2, + [Define to the type qualifier of arg 2 for send.]) + AC_DEFINE_UNQUOTED(SEND_TYPE_ARG2, $send_type_arg2, + [Define to the type of arg 2 for send.]) + # + case $prev_sh_opts in + *f*) + ;; + *) + set +f + ;; + esac + # + AC_DEFINE_UNQUOTED(HAVE_SEND, 1, + [Define to 1 if you have the send function.]) + ac_cv_func_send="yes" + fi + else + AC_MSG_ERROR([Unable to link function send]) + fi +]) + + +dnl CURL_CHECK_FUNC_RECVFROM +dnl ------------------------------------------------- +dnl Test if the socket recvfrom() function is available, +dnl and check its return type and the types of its +dnl arguments. If the function succeeds HAVE_RECVFROM +dnl will be defined, defining the types of the arguments +dnl in RECVFROM_TYPE_ARG1, RECVFROM_TYPE_ARG2, and so on +dnl to RECVFROM_TYPE_ARG6, defining also the type of the +dnl function return value in RECVFROM_TYPE_RETV. +dnl Notice that the types returned for pointer arguments +dnl will actually be the type pointed by the pointer. + +AC_DEFUN([CURL_CHECK_FUNC_RECVFROM], [ + AC_REQUIRE([CURL_CHECK_HEADER_WINSOCK])dnl + AC_REQUIRE([CURL_CHECK_HEADER_WINSOCK2])dnl + AC_CHECK_HEADERS(sys/types.h sys/socket.h) + # + AC_MSG_CHECKING([for recvfrom]) + AC_LINK_IFELSE([ + AC_LANG_PROGRAM([[ +#undef inline +#ifdef HAVE_WINDOWS_H +#ifndef WIN32_LEAN_AND_MEAN +#define WIN32_LEAN_AND_MEAN +#endif +#include +#ifdef HAVE_WINSOCK2_H +#include +#else +#ifdef HAVE_WINSOCK_H +#include +#endif +#endif +#else +#ifdef HAVE_SYS_TYPES_H +#include +#endif +#ifdef HAVE_SYS_SOCKET_H +#include +#endif +#endif + ]],[[ + recvfrom(0, 0, 0, 0, 0, 0); + ]]) + ],[ + AC_MSG_RESULT([yes]) + curl_cv_recvfrom="yes" + ],[ + AC_MSG_RESULT([no]) + curl_cv_recvfrom="no" + ]) + # + if test "$curl_cv_recvfrom" = "yes"; then + AC_CACHE_CHECK([types of args and return type for recvfrom], + [curl_cv_func_recvfrom_args], [ + curl_cv_func_recvfrom_args="unknown" + for recvfrom_retv in 'int' 'ssize_t'; do + for recvfrom_arg1 in 'int' 'ssize_t' 'SOCKET'; do + for recvfrom_arg2 in 'char *' 'void *'; do + for recvfrom_arg3 in 'size_t' 'int' 'socklen_t' 'unsigned int'; do + for recvfrom_arg4 in 'int' 'unsigned int'; do + for recvfrom_arg5 in 'struct sockaddr *' 'void *'; do + for recvfrom_arg6 in 'socklen_t *' 'int *' 'unsigned int *' 'size_t *' 'void *'; do + if test "$curl_cv_func_recvfrom_args" = "unknown"; then + AC_COMPILE_IFELSE([ + AC_LANG_PROGRAM([[ +#undef inline +#ifdef HAVE_WINDOWS_H +#ifndef WIN32_LEAN_AND_MEAN +#define WIN32_LEAN_AND_MEAN +#endif +#include +#ifdef HAVE_WINSOCK2_H +#include +#else +#ifdef HAVE_WINSOCK_H +#include +#endif +#endif +#define RECVFROMCALLCONV PASCAL +#else +#ifdef HAVE_SYS_TYPES_H +#include +#endif +#ifdef HAVE_SYS_SOCKET_H +#include +#endif +#define RECVFROMCALLCONV +#endif + extern $recvfrom_retv RECVFROMCALLCONV + recvfrom($recvfrom_arg1, $recvfrom_arg2, + $recvfrom_arg3, $recvfrom_arg4, + $recvfrom_arg5, $recvfrom_arg6); + ]],[[ + $recvfrom_arg1 s=0; + $recvfrom_arg2 buf=0; + $recvfrom_arg3 len=0; + $recvfrom_arg4 flags=0; + $recvfrom_arg5 addr=0; + $recvfrom_arg6 addrlen=0; + $recvfrom_retv res=0; + res = recvfrom(s, buf, len, flags, addr, addrlen); + ]]) + ],[ + curl_cv_func_recvfrom_args="$recvfrom_arg1,$recvfrom_arg2,$recvfrom_arg3,$recvfrom_arg4,$recvfrom_arg5,$recvfrom_arg6,$recvfrom_retv" + ]) + fi + done + done + done + done + done + done + done + ]) # AC-CACHE-CHECK + # Nearly last minute change for this release starts here + AC_DEFINE_UNQUOTED(HAVE_RECVFROM, 1, + [Define to 1 if you have the recvfrom function.]) + ac_cv_func_recvfrom="yes" + # Nearly last minute change for this release ends here + if test "$curl_cv_func_recvfrom_args" = "unknown"; then + AC_MSG_WARN([Cannot find proper types to use for recvfrom args]) + else + recvfrom_prev_IFS=$IFS; IFS=',' + set dummy `echo "$curl_cv_func_recvfrom_args" | sed 's/\*/\*/g'` + IFS=$recvfrom_prev_IFS + shift + # + recvfrom_ptrt_arg2=$[2] + recvfrom_ptrt_arg5=$[5] + recvfrom_ptrt_arg6=$[6] + # + AC_DEFINE_UNQUOTED(RECVFROM_TYPE_ARG1, $[1], + [Define to the type of arg 1 for recvfrom.]) + AC_DEFINE_UNQUOTED(RECVFROM_TYPE_ARG3, $[3], + [Define to the type of arg 3 for recvfrom.]) + AC_DEFINE_UNQUOTED(RECVFROM_TYPE_ARG4, $[4], + [Define to the type of arg 4 for recvfrom.]) + AC_DEFINE_UNQUOTED(RECVFROM_TYPE_RETV, $[7], + [Define to the function return type for recvfrom.]) + # + prev_sh_opts=$- + # + case $prev_sh_opts in + *f*) + ;; + *) + set -f + ;; + esac + # + recvfrom_type_arg2=`echo $recvfrom_ptrt_arg2 | sed 's/ \*//'` + recvfrom_type_arg5=`echo $recvfrom_ptrt_arg5 | sed 's/ \*//'` + recvfrom_type_arg6=`echo $recvfrom_ptrt_arg6 | sed 's/ \*//'` + # + AC_DEFINE_UNQUOTED(RECVFROM_TYPE_ARG2, $recvfrom_type_arg2, + [Define to the type pointed by arg 2 for recvfrom.]) + AC_DEFINE_UNQUOTED(RECVFROM_TYPE_ARG5, $recvfrom_type_arg5, + [Define to the type pointed by arg 5 for recvfrom.]) + AC_DEFINE_UNQUOTED(RECVFROM_TYPE_ARG6, $recvfrom_type_arg6, + [Define to the type pointed by arg 6 for recvfrom.]) + # + if test "$recvfrom_type_arg2" = "void"; then + AC_DEFINE_UNQUOTED(RECVFROM_TYPE_ARG2_IS_VOID, 1, + [Define to 1 if the type pointed by arg 2 for recvfrom is void.]) + fi + if test "$recvfrom_type_arg5" = "void"; then + AC_DEFINE_UNQUOTED(RECVFROM_TYPE_ARG5_IS_VOID, 1, + [Define to 1 if the type pointed by arg 5 for recvfrom is void.]) + fi + if test "$recvfrom_type_arg6" = "void"; then + AC_DEFINE_UNQUOTED(RECVFROM_TYPE_ARG6_IS_VOID, 1, + [Define to 1 if the type pointed by arg 6 for recvfrom is void.]) + fi + # + case $prev_sh_opts in + *f*) + ;; + *) + set +f + ;; + esac + # + AC_DEFINE_UNQUOTED(HAVE_RECVFROM, 1, + [Define to 1 if you have the recvfrom function.]) + ac_cv_func_recvfrom="yes" + fi + else + AC_MSG_WARN([Unable to link function recvfrom]) + fi +]) + + +dnl CURL_CHECK_MSG_NOSIGNAL +dnl ------------------------------------------------- +dnl Check for MSG_NOSIGNAL + +AC_DEFUN([CURL_CHECK_MSG_NOSIGNAL], [ + AC_CHECK_HEADERS(sys/types.h sys/socket.h) + AC_CACHE_CHECK([for MSG_NOSIGNAL], [ac_cv_msg_nosignal], [ + AC_COMPILE_IFELSE([ + AC_LANG_PROGRAM([[ +#undef inline +#ifdef HAVE_WINDOWS_H +#ifndef WIN32_LEAN_AND_MEAN +#define WIN32_LEAN_AND_MEAN +#endif +#include +#ifdef HAVE_WINSOCK2_H +#include +#else +#ifdef HAVE_WINSOCK_H +#include +#endif +#endif +#else +#ifdef HAVE_SYS_TYPES_H +#include +#endif +#ifdef HAVE_SYS_SOCKET_H +#include +#endif +#endif + ]],[[ + int flag=MSG_NOSIGNAL; + ]]) + ],[ + ac_cv_msg_nosignal="yes" + ],[ + ac_cv_msg_nosignal="no" + ]) + ]) + case "$ac_cv_msg_nosignal" in + yes) + AC_DEFINE_UNQUOTED(HAVE_MSG_NOSIGNAL, 1, + [Define to 1 if you have the MSG_NOSIGNAL flag.]) + ;; + esac +]) + + +dnl CURL_CHECK_STRUCT_TIMEVAL +dnl ------------------------------------------------- +dnl Check for timeval struct + +AC_DEFUN([CURL_CHECK_STRUCT_TIMEVAL], [ + AC_REQUIRE([AC_HEADER_TIME])dnl + AC_REQUIRE([CURL_CHECK_HEADER_WINSOCK])dnl + AC_REQUIRE([CURL_CHECK_HEADER_WINSOCK2])dnl + AC_CHECK_HEADERS(sys/types.h sys/time.h time.h sys/socket.h) + AC_CACHE_CHECK([for struct timeval], [ac_cv_struct_timeval], [ + AC_COMPILE_IFELSE([ + AC_LANG_PROGRAM([[ +#undef inline +#ifdef HAVE_WINDOWS_H +#ifndef WIN32_LEAN_AND_MEAN +#define WIN32_LEAN_AND_MEAN +#endif +#include +#ifdef HAVE_WINSOCK2_H +#include +#else +#ifdef HAVE_WINSOCK_H +#include +#endif +#endif +#endif +#ifdef HAVE_SYS_TYPES_H +#include +#endif +#ifdef HAVE_SYS_TIME_H +#include +#ifdef TIME_WITH_SYS_TIME +#include +#endif +#else +#ifdef HAVE_TIME_H +#include +#endif +#endif +#ifdef HAVE_SYS_SOCKET_H +#include +#endif + ]],[[ + struct timeval ts; + ts.tv_sec = 0; + ts.tv_usec = 0; + ]]) + ],[ + ac_cv_struct_timeval="yes" + ],[ + ac_cv_struct_timeval="no" + ]) + ]) + case "$ac_cv_struct_timeval" in + yes) + AC_DEFINE_UNQUOTED(HAVE_STRUCT_TIMEVAL, 1, + [Define to 1 if you have the timeval struct.]) + ;; + esac +]) + + +dnl TYPE_SIG_ATOMIC_T +dnl ------------------------------------------------- +dnl Check if the sig_atomic_t type is available, and +dnl verify if it is already defined as volatile. + +AC_DEFUN([TYPE_SIG_ATOMIC_T], [ + AC_CHECK_HEADERS(signal.h) + AC_CHECK_TYPE([sig_atomic_t],[ + AC_DEFINE(HAVE_SIG_ATOMIC_T, 1, + [Define to 1 if sig_atomic_t is an available typedef.]) + ], ,[ +#ifdef HAVE_SIGNAL_H +#include +#endif + ]) + case "$ac_cv_type_sig_atomic_t" in + yes) + # + AC_MSG_CHECKING([if sig_atomic_t is already defined as volatile]) + AC_LINK_IFELSE([ + AC_LANG_PROGRAM([[ +#ifdef HAVE_SIGNAL_H +#include +#endif + ]],[[ + static volatile sig_atomic_t dummy = 0; + ]]) + ],[ + AC_MSG_RESULT([no]) + ac_cv_sig_atomic_t_volatile="no" + ],[ + AC_MSG_RESULT([yes]) + ac_cv_sig_atomic_t_volatile="yes" + ]) + # + if test "$ac_cv_sig_atomic_t_volatile" = "yes"; then + AC_DEFINE(HAVE_SIG_ATOMIC_T_VOLATILE, 1, + [Define to 1 if sig_atomic_t is already defined as volatile.]) + fi + ;; + esac +]) + + +dnl TYPE_IN_ADDR_T +dnl ------------------------------------------------- +dnl Check for in_addr_t: it is used to receive the return code of inet_addr() +dnl and a few other things. + +AC_DEFUN([TYPE_IN_ADDR_T], [ + AC_CHECK_TYPE([in_addr_t], ,[ + dnl in_addr_t not available + AC_CACHE_CHECK([for in_addr_t equivalent], + [curl_cv_in_addr_t_equiv], [ + curl_cv_in_addr_t_equiv="unknown" + for t in "unsigned long" int size_t unsigned long; do + if test "$curl_cv_in_addr_t_equiv" = "unknown"; then + AC_LINK_IFELSE([ + AC_LANG_PROGRAM([[ +#undef inline +#ifdef HAVE_WINDOWS_H +#ifndef WIN32_LEAN_AND_MEAN +#define WIN32_LEAN_AND_MEAN +#endif +#include +#ifdef HAVE_WINSOCK2_H +#include +#else +#ifdef HAVE_WINSOCK_H +#include +#endif +#endif +#else +#ifdef HAVE_SYS_TYPES_H +#include +#endif +#ifdef HAVE_SYS_SOCKET_H +#include +#endif +#ifdef HAVE_NETINET_IN_H +#include +#endif +#ifdef HAVE_ARPA_INET_H +#include +#endif +#endif + ]],[[ + $t data = inet_addr ("1.2.3.4"); + ]]) + ],[ + curl_cv_in_addr_t_equiv="$t" + ]) + fi + done + ]) + case "$curl_cv_in_addr_t_equiv" in + unknown) + AC_MSG_ERROR([Cannot find a type to use in place of in_addr_t]) + ;; + *) + AC_DEFINE_UNQUOTED(in_addr_t, $curl_cv_in_addr_t_equiv, + [Type to use in place of in_addr_t when system does not provide it.]) + ;; + esac + ],[ +#undef inline +#ifdef HAVE_WINDOWS_H +#ifndef WIN32_LEAN_AND_MEAN +#define WIN32_LEAN_AND_MEAN +#endif +#include +#ifdef HAVE_WINSOCK2_H +#include +#else +#ifdef HAVE_WINSOCK_H +#include +#endif +#endif +#else +#ifdef HAVE_SYS_TYPES_H +#include +#endif +#ifdef HAVE_SYS_SOCKET_H +#include +#endif +#ifdef HAVE_NETINET_IN_H +#include +#endif +#ifdef HAVE_ARPA_INET_H +#include +#endif +#endif + ]) +]) + + +dnl CURL_CHECK_FUNC_CLOCK_GETTIME_MONOTONIC +dnl ------------------------------------------------- +dnl Check if monotonic clock_gettime is available. + +AC_DEFUN([CURL_CHECK_FUNC_CLOCK_GETTIME_MONOTONIC], [ + AC_REQUIRE([AC_HEADER_TIME])dnl + AC_CHECK_HEADERS(sys/types.h sys/time.h time.h) + AC_MSG_CHECKING([for monotonic clock_gettime]) + AC_COMPILE_IFELSE([ + AC_LANG_PROGRAM([[ +#ifdef HAVE_SYS_TYPES_H +#include +#endif +#ifdef HAVE_SYS_TIME_H +#include +#ifdef TIME_WITH_SYS_TIME +#include +#endif +#else +#ifdef HAVE_TIME_H +#include +#endif +#endif + ]],[[ + struct timespec ts; + (void)clock_gettime(CLOCK_MONOTONIC, &ts); + ]]) + ],[ + AC_MSG_RESULT([yes]) + ac_cv_func_clock_gettime="yes" + ],[ + AC_MSG_RESULT([no]) + ac_cv_func_clock_gettime="no" + ]) + dnl Definition of HAVE_CLOCK_GETTIME_MONOTONIC is intentionally postponed + dnl until library linking and run-time checks for clock_gettime succeed. +]) + + +dnl CURL_CHECK_LIBS_CLOCK_GETTIME_MONOTONIC +dnl ------------------------------------------------- +dnl If monotonic clock_gettime is available then, +dnl check and prepended to LIBS any needed libraries. + +AC_DEFUN([CURL_CHECK_LIBS_CLOCK_GETTIME_MONOTONIC], [ + AC_REQUIRE([CURL_CHECK_FUNC_CLOCK_GETTIME_MONOTONIC])dnl + # + if test "$ac_cv_func_clock_gettime" = "yes"; then + # + AC_MSG_CHECKING([for clock_gettime in libraries]) + # + curl_cv_save_LIBS="$LIBS" + curl_cv_gclk_LIBS="unknown" + # + for x_xlibs in '' '-lrt' '-lposix4' ; do + if test "$curl_cv_gclk_LIBS" = "unknown"; then + if test -z "$x_xlibs"; then + LIBS="$curl_cv_save_LIBS" + else + LIBS="$x_xlibs $curl_cv_save_LIBS" + fi + AC_LINK_IFELSE([ + AC_LANG_PROGRAM([[ +#ifdef HAVE_SYS_TYPES_H +#include +#endif +#ifdef HAVE_SYS_TIME_H +#include +#ifdef TIME_WITH_SYS_TIME +#include +#endif +#else +#ifdef HAVE_TIME_H +#include +#endif +#endif + ]],[[ + struct timespec ts; + (void)clock_gettime(CLOCK_MONOTONIC, &ts); + ]]) + ],[ + curl_cv_gclk_LIBS="$x_xlibs" + ]) + fi + done + # + LIBS="$curl_cv_save_LIBS" + # + case X-"$curl_cv_gclk_LIBS" in + X-unknown) + AC_MSG_RESULT([cannot find clock_gettime]) + AC_MSG_WARN([HAVE_CLOCK_GETTIME_MONOTONIC will not be defined]) + ac_cv_func_clock_gettime="no" + ;; + X-) + AC_MSG_RESULT([no additional lib required]) + ac_cv_func_clock_gettime="yes" + ;; + *) + if test -z "$curl_cv_save_LIBS"; then + LIBS="$curl_cv_gclk_LIBS" + else + LIBS="$curl_cv_gclk_LIBS $curl_cv_save_LIBS" + fi + CURL_LIBS="$CURL_LIBS $curl_cv_gclk_LIBS" + AC_MSG_RESULT([$curl_cv_gclk_LIBS]) + ac_cv_func_clock_gettime="yes" + ;; + esac + # + dnl only do runtime verification when not cross-compiling + if test "x$cross_compiling" != "xyes" && + test "$ac_cv_func_clock_gettime" = "yes"; then + AC_MSG_CHECKING([if monotonic clock_gettime works]) + AC_RUN_IFELSE([ + AC_LANG_PROGRAM([[ +#ifdef HAVE_STDLIB_H +#include +#endif +#ifdef HAVE_SYS_TYPES_H +#include +#endif +#ifdef HAVE_SYS_TIME_H +#include +#ifdef TIME_WITH_SYS_TIME +#include +#endif +#else +#ifdef HAVE_TIME_H +#include +#endif +#endif + ]],[[ + struct timespec ts; + if (0 == clock_gettime(CLOCK_MONOTONIC, &ts)) + exit(0); + else + exit(1); + ]]) + ],[ + AC_MSG_RESULT([yes]) + ],[ + AC_MSG_RESULT([no]) + AC_MSG_WARN([HAVE_CLOCK_GETTIME_MONOTONIC will not be defined]) + ac_cv_func_clock_gettime="no" + LIBS="$curl_cv_save_LIBS" + ]) + fi + # + case "$ac_cv_func_clock_gettime" in + yes) + AC_DEFINE_UNQUOTED(HAVE_CLOCK_GETTIME_MONOTONIC, 1, + [Define to 1 if you have the clock_gettime function and monotonic timer.]) + ;; + esac + # + fi + # +]) + + +dnl CURL_CHECK_LIBS_CONNECT +dnl ------------------------------------------------- +dnl Verify if network connect function is already available +dnl using current libraries or if another one is required. + +AC_DEFUN([CURL_CHECK_LIBS_CONNECT], [ + AC_REQUIRE([CURL_INCLUDES_WINSOCK2])dnl + AC_MSG_CHECKING([for connect in libraries]) + tst_connect_save_LIBS="$LIBS" + tst_connect_need_LIBS="unknown" + for tst_lib in '' '-lsocket' ; do + if test "$tst_connect_need_LIBS" = "unknown"; then + LIBS="$tst_lib $tst_connect_save_LIBS" + AC_LINK_IFELSE([ + AC_LANG_PROGRAM([[ + $curl_includes_winsock2 + #ifndef HAVE_WINDOWS_H + int connect(int, void*, int); + #endif + ]],[[ + if(0 != connect(0, 0, 0)) + return 1; + ]]) + ],[ + tst_connect_need_LIBS="$tst_lib" + ]) + fi + done + LIBS="$tst_connect_save_LIBS" + # + case X-"$tst_connect_need_LIBS" in + X-unknown) + AC_MSG_RESULT([cannot find connect]) + AC_MSG_ERROR([cannot find connect function in libraries.]) + ;; + X-) + AC_MSG_RESULT([yes]) + ;; + *) + AC_MSG_RESULT([$tst_connect_need_LIBS]) + LIBS="$tst_connect_need_LIBS $tst_connect_save_LIBS" + ;; + esac +]) + + +dnl CURL_DEFINE_UNQUOTED (VARIABLE, [VALUE]) +dnl ------------------------------------------------- +dnl Like AC_DEFINE_UNQUOTED this macro will define a C preprocessor +dnl symbol that can be further used in custom template configuration +dnl files. This macro, unlike AC_DEFINE_UNQUOTED, does not use a third +dnl argument for the description. Symbol definitions done with this +dnl macro are intended to be exclusively used in handcrafted *.h.in +dnl template files. Contrary to what AC_DEFINE_UNQUOTED does, this one +dnl prevents autoheader generation and insertion of symbol template +dnl stub and definition into the first configuration header file. Do +dnl not use this macro as a replacement for AC_DEFINE_UNQUOTED, each +dnl one serves different functional needs. + +AC_DEFUN([CURL_DEFINE_UNQUOTED], [ +cat >>confdefs.h <<_EOF +[@%:@define] $1 ifelse($#, 2, [$2], 1) +_EOF +]) + + +dnl CURL_CONFIGURE_LONG +dnl ------------------------------------------------- +dnl Find out the size of long as reported by sizeof() and define +dnl CURL_SIZEOF_LONG as appropriate to be used in template file +dnl include/curl/curlbuild.h.in to properly configure the library. +dnl The size of long is a build time characteristic and as such +dnl must be recorded in curlbuild.h + +AC_DEFUN([CURL_CONFIGURE_LONG], [ + if test -z "$ac_cv_sizeof_long" || + test "$ac_cv_sizeof_long" -eq "0"; then + AC_MSG_ERROR([cannot find out size of long.]) + fi + CURL_DEFINE_UNQUOTED([CURL_SIZEOF_LONG], [$ac_cv_sizeof_long]) +]) + + +dnl CURL_CONFIGURE_CURL_SOCKLEN_T +dnl ------------------------------------------------- +dnl Find out suitable curl_socklen_t data type definition and size, making +dnl appropriate definitions for template file include/curl/curlbuild.h.in +dnl to properly configure and use the library. +dnl +dnl The need for the curl_socklen_t definition arises mainly to properly +dnl interface HP-UX systems which on one hand have a typedef'ed socklen_t +dnl data type which is 32 or 64-Bit wide depending on the data model being +dnl used, and that on the other hand is only actually used when interfacing +dnl the X/Open sockets provided in the xnet library. + +AC_DEFUN([CURL_CONFIGURE_CURL_SOCKLEN_T], [ + AC_REQUIRE([CURL_INCLUDES_WS2TCPIP])dnl + AC_REQUIRE([CURL_INCLUDES_SYS_SOCKET])dnl + AC_REQUIRE([CURL_PREPROCESS_CALLCONV])dnl + # + AC_MSG_CHECKING([for curl_socklen_t data type]) + curl_typeof_curl_socklen_t="unknown" + for arg1 in int SOCKET; do + for arg2 in 'struct sockaddr' void; do + for t in socklen_t int size_t 'unsigned int' long 'unsigned long' void; do + if test "$curl_typeof_curl_socklen_t" = "unknown"; then + AC_COMPILE_IFELSE([ + AC_LANG_PROGRAM([[ + $curl_includes_ws2tcpip + $curl_includes_sys_socket + $curl_preprocess_callconv + extern int FUNCALLCONV getpeername($arg1, $arg2 *, $t *); + ]],[[ + $t *lenptr = 0; + if(0 != getpeername(0, 0, lenptr)) + return 1; + ]]) + ],[ + curl_typeof_curl_socklen_t="$t" + ]) + fi + done + done + done + for t in socklen_t int; do + if test "$curl_typeof_curl_socklen_t" = "void"; then + AC_COMPILE_IFELSE([ + AC_LANG_PROGRAM([[ + $curl_includes_sys_socket + typedef $t curl_socklen_t; + ]],[[ + curl_socklen_t dummy; + ]]) + ],[ + curl_typeof_curl_socklen_t="$t" + ]) + fi + done + AC_MSG_RESULT([$curl_typeof_curl_socklen_t]) + if test "$curl_typeof_curl_socklen_t" = "void" || + test "$curl_typeof_curl_socklen_t" = "unknown"; then + AC_MSG_ERROR([cannot find data type for curl_socklen_t.]) + fi + # + AC_MSG_CHECKING([size of curl_socklen_t]) + curl_sizeof_curl_socklen_t="unknown" + curl_pull_headers_socklen_t="unknown" + if test "$ac_cv_header_ws2tcpip_h" = "yes"; then + tst_pull_header_checks='none ws2tcpip' + tst_size_checks='4' + else + tst_pull_header_checks='none systypes syssocket' + tst_size_checks='4 8 2' + fi + for tst_size in $tst_size_checks; do + for tst_pull_headers in $tst_pull_header_checks; do + if test "$curl_sizeof_curl_socklen_t" = "unknown"; then + case $tst_pull_headers in + ws2tcpip) + tmp_includes="$curl_includes_ws2tcpip" + ;; + systypes) + tmp_includes="$curl_includes_sys_types" + ;; + syssocket) + tmp_includes="$curl_includes_sys_socket" + ;; + *) + tmp_includes="" + ;; + esac + AC_COMPILE_IFELSE([ + AC_LANG_PROGRAM([[ + $tmp_includes + typedef $curl_typeof_curl_socklen_t curl_socklen_t; + typedef char dummy_arr[sizeof(curl_socklen_t) == $tst_size ? 1 : -1]; + ]],[[ + curl_socklen_t dummy; + ]]) + ],[ + curl_sizeof_curl_socklen_t="$tst_size" + curl_pull_headers_socklen_t="$tst_pull_headers" + ]) + fi + done + done + AC_MSG_RESULT([$curl_sizeof_curl_socklen_t]) + if test "$curl_sizeof_curl_socklen_t" = "unknown"; then + AC_MSG_ERROR([cannot find out size of curl_socklen_t.]) + fi + # + case $curl_pull_headers_socklen_t in + ws2tcpip) + CURL_DEFINE_UNQUOTED([CURL_PULL_WS2TCPIP_H]) + ;; + systypes) + CURL_DEFINE_UNQUOTED([CURL_PULL_SYS_TYPES_H]) + ;; + syssocket) + CURL_DEFINE_UNQUOTED([CURL_PULL_SYS_TYPES_H]) + CURL_DEFINE_UNQUOTED([CURL_PULL_SYS_SOCKET_H]) + ;; + esac + CURL_DEFINE_UNQUOTED([CURL_TYPEOF_CURL_SOCKLEN_T], [$curl_typeof_curl_socklen_t]) + CURL_DEFINE_UNQUOTED([CURL_SIZEOF_CURL_SOCKLEN_T], [$curl_sizeof_curl_socklen_t]) +]) + + +dnl CURL_CHECK_FUNC_SELECT +dnl ------------------------------------------------- +dnl Test if the socket select() function is available, +dnl and check its return type and the types of its +dnl arguments. If the function succeeds HAVE_SELECT +dnl will be defined, defining the types of the +dnl arguments in SELECT_TYPE_ARG1, SELECT_TYPE_ARG234 +dnl and SELECT_TYPE_ARG5, defining the type of the +dnl function return value in SELECT_TYPE_RETV, and +dnl also defining the type qualifier of fifth argument +dnl in SELECT_QUAL_ARG5. + +AC_DEFUN([CURL_CHECK_FUNC_SELECT], [ + AC_REQUIRE([CURL_CHECK_STRUCT_TIMEVAL])dnl + AC_CHECK_HEADERS(sys/select.h sys/socket.h) + # + AC_MSG_CHECKING([for select]) + AC_LINK_IFELSE([ + AC_LANG_PROGRAM([[ +#undef inline +#ifdef HAVE_WINDOWS_H +#ifndef WIN32_LEAN_AND_MEAN +#define WIN32_LEAN_AND_MEAN +#endif +#include +#ifdef HAVE_WINSOCK2_H +#include +#else +#ifdef HAVE_WINSOCK_H +#include +#endif +#endif +#endif +#ifdef HAVE_SYS_TYPES_H +#include +#endif +#ifdef HAVE_SYS_TIME_H +#include +#ifdef TIME_WITH_SYS_TIME +#include +#endif +#else +#ifdef HAVE_TIME_H +#include +#endif +#endif +#ifndef HAVE_WINDOWS_H +#ifdef HAVE_SYS_SELECT_H +#include +#endif +#ifdef HAVE_SYS_SOCKET_H +#include +#endif +#endif + ]],[[ + select(0, 0, 0, 0, 0); + ]]) + ],[ + AC_MSG_RESULT([yes]) + curl_cv_select="yes" + ],[ + AC_MSG_RESULT([no]) + curl_cv_select="no" + ]) + # + if test "$curl_cv_select" = "yes"; then + AC_CACHE_CHECK([types of args and return type for select], + [curl_cv_func_select_args], [ + curl_cv_func_select_args="unknown" + for sel_retv in 'int' 'ssize_t'; do + for sel_arg1 in 'int' 'ssize_t' 'size_t' 'unsigned long int' 'unsigned int'; do + for sel_arg234 in 'fd_set *' 'int *' 'void *'; do + for sel_arg5 in 'struct timeval *' 'const struct timeval *'; do + if test "$curl_cv_func_select_args" = "unknown"; then + AC_COMPILE_IFELSE([ + AC_LANG_PROGRAM([[ +#undef inline +#ifdef HAVE_WINDOWS_H +#ifndef WIN32_LEAN_AND_MEAN +#define WIN32_LEAN_AND_MEAN +#endif +#include +#ifdef HAVE_WINSOCK2_H +#include +#else +#ifdef HAVE_WINSOCK_H +#include +#endif +#endif +#define SELECTCALLCONV PASCAL +#endif +#ifdef HAVE_SYS_TYPES_H +#include +#endif +#ifdef HAVE_SYS_TIME_H +#include +#ifdef TIME_WITH_SYS_TIME +#include +#endif +#else +#ifdef HAVE_TIME_H +#include +#endif +#endif +#ifndef HAVE_WINDOWS_H +#ifdef HAVE_SYS_SELECT_H +#include +#endif +#ifdef HAVE_SYS_SOCKET_H +#include +#endif +#define SELECTCALLCONV +#endif +#ifndef HAVE_STRUCT_TIMEVAL + struct timeval { + long tv_sec; + long tv_usec; + }; +#endif + extern $sel_retv SELECTCALLCONV select($sel_arg1, + $sel_arg234, + $sel_arg234, + $sel_arg234, + $sel_arg5); + ]],[[ + $sel_arg1 nfds=0; + $sel_arg234 rfds=0; + $sel_arg234 wfds=0; + $sel_arg234 efds=0; + $sel_retv res = select(nfds, rfds, wfds, efds, 0); + ]]) + ],[ + curl_cv_func_select_args="$sel_arg1,$sel_arg234,$sel_arg5,$sel_retv" + ]) + fi + done + done + done + done + ]) # AC-CACHE-CHECK + if test "$curl_cv_func_select_args" = "unknown"; then + AC_MSG_WARN([Cannot find proper types to use for select args]) + AC_MSG_WARN([HAVE_SELECT will not be defined]) + else + select_prev_IFS=$IFS; IFS=',' + set dummy `echo "$curl_cv_func_select_args" | sed 's/\*/\*/g'` + IFS=$select_prev_IFS + shift + # + sel_qual_type_arg5=$[3] + # + AC_DEFINE_UNQUOTED(SELECT_TYPE_ARG1, $[1], + [Define to the type of arg 1 for select.]) + AC_DEFINE_UNQUOTED(SELECT_TYPE_ARG234, $[2], + [Define to the type of args 2, 3 and 4 for select.]) + AC_DEFINE_UNQUOTED(SELECT_TYPE_RETV, $[4], + [Define to the function return type for select.]) + # + prev_sh_opts=$- + # + case $prev_sh_opts in + *f*) + ;; + *) + set -f + ;; + esac + # + case "$sel_qual_type_arg5" in + const*) + sel_qual_arg5=const + sel_type_arg5=`echo $sel_qual_type_arg5 | sed 's/^const //'` + ;; + *) + sel_qual_arg5= + sel_type_arg5=$sel_qual_type_arg5 + ;; + esac + # + AC_DEFINE_UNQUOTED(SELECT_QUAL_ARG5, $sel_qual_arg5, + [Define to the type qualifier of arg 5 for select.]) + AC_DEFINE_UNQUOTED(SELECT_TYPE_ARG5, $sel_type_arg5, + [Define to the type of arg 5 for select.]) + # + case $prev_sh_opts in + *f*) + ;; + *) + set +f + ;; + esac + # + AC_DEFINE_UNQUOTED(HAVE_SELECT, 1, + [Define to 1 if you have the select function.]) + ac_cv_func_select="yes" + fi + fi +]) + + +# This is only a temporary fix. This macro is here to replace the broken one +# delivered by the automake project (including the 1.9.6 release). As soon as +# they ship a working version we SHOULD remove this work-around. + +AC_DEFUN([AM_MISSING_HAS_RUN], +[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl +test x"${MISSING+set}" = xset || MISSING="\${SHELL} \"$am_aux_dir/missing\"" +# Use eval to expand $SHELL +if eval "$MISSING --run true"; then + am_missing_run="$MISSING --run " +else + am_missing_run= + AC_MSG_WARN([`missing' script is too old or missing]) +fi +]) + + +dnl CURL_VERIFY_RUNTIMELIBS +dnl ------------------------------------------------- +dnl Verify that the shared libs found so far can be used when running +dnl programs, since otherwise the situation will create odd configure errors +dnl that are misleading people. +dnl +dnl Make sure this test is run BEFORE the first test in the script that +dnl runs anything, which at the time of this writing is the AC_CHECK_SIZEOF +dnl macro. It must also run AFTER all lib-checking macros are complete. + +AC_DEFUN([CURL_VERIFY_RUNTIMELIBS], [ + + dnl this test is of course not sensible if we are cross-compiling! + if test "x$cross_compiling" != xyes; then + + dnl just run a program to verify that the libs checked for previous to this + dnl point also is available run-time! + AC_MSG_CHECKING([run-time libs availability]) + AC_TRY_RUN([ +main() +{ + return 0; +} +], + AC_MSG_RESULT([fine]), + AC_MSG_RESULT([failed]) + AC_MSG_ERROR([one or more libs available at link-time are not available run-time. Libs used at link-time: $LIBS]) + ) + + dnl if this test fails, configure has already stopped + fi +]) + + +dnl CURL_CHECK_VARIADIC_MACROS +dnl ------------------------------------------------- +dnl Check compiler support of variadic macros + +AC_DEFUN([CURL_CHECK_VARIADIC_MACROS], [ + AC_CACHE_CHECK([for compiler support of C99 variadic macro style], + [curl_cv_variadic_macros_c99], [ + AC_COMPILE_IFELSE([ + AC_LANG_PROGRAM([[ +#define c99_vmacro3(first, ...) fun3(first, __VA_ARGS__) +#define c99_vmacro2(first, ...) fun2(first, __VA_ARGS__) + int fun3(int arg1, int arg2, int arg3); + int fun2(int arg1, int arg2); + int fun3(int arg1, int arg2, int arg3) + { return arg1 + arg2 + arg3; } + int fun2(int arg1, int arg2) + { return arg1 + arg2; } + ]],[[ + int res3 = c99_vmacro3(1, 2, 3); + int res2 = c99_vmacro2(1, 2); + ]]) + ],[ + curl_cv_variadic_macros_c99="yes" + ],[ + curl_cv_variadic_macros_c99="no" + ]) + ]) + case "$curl_cv_variadic_macros_c99" in + yes) + AC_DEFINE_UNQUOTED(HAVE_VARIADIC_MACROS_C99, 1, + [Define to 1 if compiler supports C99 variadic macro style.]) + ;; + esac + AC_CACHE_CHECK([for compiler support of old gcc variadic macro style], + [curl_cv_variadic_macros_gcc], [ + AC_COMPILE_IFELSE([ + AC_LANG_PROGRAM([[ +#define gcc_vmacro3(first, args...) fun3(first, args) +#define gcc_vmacro2(first, args...) fun2(first, args) + int fun3(int arg1, int arg2, int arg3); + int fun2(int arg1, int arg2); + int fun3(int arg1, int arg2, int arg3) + { return arg1 + arg2 + arg3; } + int fun2(int arg1, int arg2) + { return arg1 + arg2; } + ]],[[ + int res3 = gcc_vmacro3(1, 2, 3); + int res2 = gcc_vmacro2(1, 2); + ]]) + ],[ + curl_cv_variadic_macros_gcc="yes" + ],[ + curl_cv_variadic_macros_gcc="no" + ]) + ]) + case "$curl_cv_variadic_macros_gcc" in + yes) + AC_DEFINE_UNQUOTED(HAVE_VARIADIC_MACROS_GCC, 1, + [Define to 1 if compiler supports old gcc variadic macro style.]) + ;; + esac +]) + + +dnl CURL_CHECK_CA_BUNDLE +dnl ------------------------------------------------- +dnl Check if a default ca-bundle should be used +dnl +dnl regarding the paths this will scan: +dnl /etc/ssl/certs/ca-certificates.crt Debian systems +dnl /etc/pki/tls/certs/ca-bundle.crt Redhat and Mandriva +dnl /usr/share/ssl/certs/ca-bundle.crt old(er) Redhat +dnl /usr/local/share/certs/ca-root.crt FreeBSD +dnl /etc/ssl/cert.pem OpenBSD +dnl /etc/ssl/certs/ (ca path) SUSE + +AC_DEFUN([CURL_CHECK_CA_BUNDLE], [ + + AC_MSG_CHECKING([default CA cert bundle/path]) + + AC_ARG_WITH(ca-bundle, +AC_HELP_STRING([--with-ca-bundle=FILE], [File name to use as CA bundle]) +AC_HELP_STRING([--without-ca-bundle], [Don't use a default CA bundle]), + [ + want_ca="$withval" + if test "x$want_ca" = "xyes"; then + AC_MSG_ERROR([--with-ca-bundle=FILE requires a path to the CA bundle]) + fi + ], + [ want_ca="unset" ]) + AC_ARG_WITH(ca-path, +AC_HELP_STRING([--with-ca-path=DIRECTORY], [Directory to use as CA path]) +AC_HELP_STRING([--without-ca-path], [Don't use a default CA path]), + [ + want_capath="$withval" + if test "x$want_capath" = "xyes"; then + AC_MSG_ERROR([--with-ca-path=DIRECTORY requires a path to the CA path directory]) + fi + ], + [ want_capath="unset"]) + + if test "x$want_ca" != "xno" -a "x$want_ca" != "xunset" -a \ + "x$want_capath" != "xno" -a "x$want_capath" != "xunset"; then + dnl both given + AC_MSG_ERROR([Can't specify both --with-ca-bundle and --with-ca-path.]) + elif test "x$want_ca" != "xno" -a "x$want_ca" != "xunset"; then + dnl --with-ca-bundle given + ca="$want_ca" + capath="no" + elif test "x$want_capath" != "xno" -a "x$want_capath" != "xunset"; then + dnl --with-ca-path given + if test "x$OPENSSL_ENABLED" != "x1"; then + AC_MSG_ERROR([--with-ca-path only works with openSSL]) + fi + capath="$want_capath" + ca="no" + else + dnl neither of --with-ca-* given + dnl first try autodetecting a CA bundle , then a CA path + dnl both autodetections can be skipped by --without-ca-* + ca="no" + capath="no" + if test "x$want_ca" = "xunset"; then + dnl the path we previously would have installed the curl ca bundle + dnl to, and thus we now check for an already existing cert in that place + dnl in case we find no other + if test "x$prefix" != xNONE; then + cac="${prefix}/share/curl/curl-ca-bundle.crt" + else + cac="$ac_default_prefix/share/curl/curl-ca-bundle.crt" + fi + + for a in /etc/ssl/certs/ca-certificates.crt \ + /etc/pki/tls/certs/ca-bundle.crt \ + /usr/share/ssl/certs/ca-bundle.crt \ + /usr/local/share/certs/ca-root.crt \ + /etc/ssl/cert.pem \ + "$cac"; do + if test -f "$a"; then + ca="$a" + break + fi + done + fi + if test "x$want_capath" = "xunset" -a "x$ca" = "xno" -a \ + "x$OPENSSL_ENABLED" = "x1"; then + for a in /etc/ssl/certs/; do + if test -d "$a" && ls "$a"/[[0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f]].0 >/dev/null 2>/dev/null; then + capath="$a" + break + fi + done + fi + fi + + + + if test "x$ca" != "xno"; then + CURL_CA_BUNDLE='"'$ca'"' + AC_DEFINE_UNQUOTED(CURL_CA_BUNDLE, "$ca", [Location of default ca bundle]) + AC_SUBST(CURL_CA_BUNDLE) + AC_MSG_RESULT([$ca]) + elif test "x$capath" != "xno"; then + CURL_CA_PATH="\"$capath\"" + AC_DEFINE_UNQUOTED(CURL_CA_PATH, "$capath", [Location of default ca path]) + AC_MSG_RESULT([$capath (capath)]) + else + AC_MSG_RESULT([no]) + fi +]) + + +dnl DO_CURL_OFF_T_CHECK (TYPE, SIZE) +dnl ------------------------------------------------- +dnl Internal macro for CURL_CONFIGURE_CURL_OFF_T + +AC_DEFUN([DO_CURL_OFF_T_CHECK], [ + AC_REQUIRE([CURL_INCLUDES_INTTYPES])dnl + if test "$curl_typeof_curl_off_t" = "unknown" && test ! -z "$1"; then + tmp_includes="" + tmp_source="" + tmp_fmt="" + case AS_TR_SH([$1]) in + int64_t) + tmp_includes="$curl_includes_inttypes" + tmp_source="char f@<:@@:>@ = PRId64;" + tmp_fmt="PRId64" + ;; + int32_t) + tmp_includes="$curl_includes_inttypes" + tmp_source="char f@<:@@:>@ = PRId32;" + tmp_fmt="PRId32" + ;; + int16_t) + tmp_includes="$curl_includes_inttypes" + tmp_source="char f@<:@@:>@ = PRId16;" + tmp_fmt="PRId16" + ;; + esac + AC_COMPILE_IFELSE([ + AC_LANG_PROGRAM([[ + $tmp_includes + typedef $1 curl_off_t; + typedef char dummy_arr[sizeof(curl_off_t) == $2 ? 1 : -1]; + ]],[[ + $tmp_source + curl_off_t dummy; + ]]) + ],[ + if test -z "$tmp_fmt"; then + curl_typeof_curl_off_t="$1" + curl_sizeof_curl_off_t="$2" + else + CURL_CHECK_DEF([$tmp_fmt], [$curl_includes_inttypes], [silent]) + AS_VAR_PUSHDEF([tmp_HaveFmtDef], [curl_cv_have_def_$tmp_fmt])dnl + AS_VAR_PUSHDEF([tmp_FmtDef], [curl_cv_def_$tmp_fmt])dnl + if test AS_VAR_GET(tmp_HaveFmtDef) = "yes"; then + curl_format_curl_off_t=AS_VAR_GET(tmp_FmtDef) + curl_typeof_curl_off_t="$1" + curl_sizeof_curl_off_t="$2" + fi + AS_VAR_POPDEF([tmp_FmtDef])dnl + AS_VAR_POPDEF([tmp_HaveFmtDef])dnl + fi + ]) + fi +]) + + +dnl DO_CURL_OFF_T_SUFFIX_CHECK (TYPE) +dnl ------------------------------------------------- +dnl Internal macro for CURL_CONFIGURE_CURL_OFF_T + +AC_DEFUN([DO_CURL_OFF_T_SUFFIX_CHECK], [ + AC_REQUIRE([CURL_INCLUDES_INTTYPES])dnl + AC_MSG_CHECKING([constant suffix string for curl_off_t]) + # + curl_suffix_curl_off_t="unknown" + curl_suffix_curl_off_tu="unknown" + # + case AS_TR_SH([$1]) in + long_long | __longlong | __longlong_t) + tst_suffixes="LL::" + ;; + long) + tst_suffixes="L::" + ;; + int) + tst_suffixes="::" + ;; + __int64 | int64_t) + tst_suffixes="LL:i64::" + ;; + __int32 | int32_t) + tst_suffixes="L:i32::" + ;; + __int16 | int16_t) + tst_suffixes="L:i16::" + ;; + *) + AC_MSG_ERROR([unexpected data type $1]) + ;; + esac + # + old_IFS=$IFS; IFS=':' + for tmp_ssuf in $tst_suffixes ; do + IFS=$old_IFS + if test "x$curl_suffix_curl_off_t" = "xunknown"; then + case $tmp_ssuf in + i64 | i32 | i16) + tmp_usuf="u$tmp_ssuf" + ;; + LL | L) + tmp_usuf="U$tmp_ssuf" + ;; + *) + tmp_usuf="" + ;; + esac + AC_COMPILE_IFELSE([ + AC_LANG_PROGRAM([[ + $curl_includes_inttypes + typedef $1 new_t; + ]],[[ + new_t s1; + new_t s2; + s1 = -10$tmp_ssuf ; + s2 = 20$tmp_ssuf ; + if(s1 > s2) + return 1; + ]]) + ],[ + curl_suffix_curl_off_t="$tmp_ssuf" + curl_suffix_curl_off_tu="$tmp_usuf" + ]) + fi + done + IFS=$old_IFS + # + if test "x$curl_suffix_curl_off_t" = "xunknown"; then + AC_MSG_ERROR([cannot find constant suffix string for curl_off_t.]) + else + AC_MSG_RESULT([$curl_suffix_curl_off_t]) + AC_MSG_CHECKING([constant suffix string for unsigned curl_off_t]) + AC_MSG_RESULT([$curl_suffix_curl_off_tu]) + fi + # +]) + + +dnl CURL_CONFIGURE_CURL_OFF_T +dnl ------------------------------------------------- +dnl Find out suitable curl_off_t data type definition and associated +dnl items, and make the appropriate definitions used in template file +dnl include/curl/curlbuild.h.in to properly configure the library. + +AC_DEFUN([CURL_CONFIGURE_CURL_OFF_T], [ + AC_REQUIRE([CURL_INCLUDES_INTTYPES])dnl + # + AC_BEFORE([$0],[AC_SYS_LARGEFILE])dnl + AC_BEFORE([$0],[CURL_CONFIGURE_REENTRANT])dnl + AC_BEFORE([$0],[CURL_CHECK_AIX_ALL_SOURCE])dnl + # + if test -z "$SED"; then + AC_MSG_ERROR([SED not set. Cannot continue without SED being set.]) + fi + # + AC_CHECK_SIZEOF(long) + AC_CHECK_SIZEOF(void*) + # + if test -z "$ac_cv_sizeof_long" || + test "$ac_cv_sizeof_long" -eq "0"; then + AC_MSG_ERROR([cannot find out size of long.]) + fi + if test -z "$ac_cv_sizeof_voidp" || + test "$ac_cv_sizeof_voidp" -eq "0"; then + AC_MSG_ERROR([cannot find out size of void*.]) + fi + # + x_LP64_long="" + x_LP32_long="" + x_LP16_long="" + # + if test "$ac_cv_sizeof_long" -eq "8" && + test "$ac_cv_sizeof_voidp" -ge "8"; then + x_LP64_long="long" + elif test "$ac_cv_sizeof_long" -eq "4" && + test "$ac_cv_sizeof_voidp" -ge "4"; then + x_LP32_long="long" + elif test "$ac_cv_sizeof_long" -eq "2" && + test "$ac_cv_sizeof_voidp" -ge "2"; then + x_LP16_long="long" + fi + # + dnl DO_CURL_OFF_T_CHECK results are stored in next 3 vars + # + curl_typeof_curl_off_t="unknown" + curl_sizeof_curl_off_t="unknown" + curl_format_curl_off_t="unknown" + curl_format_curl_off_tu="unknown" + # + if test "$curl_typeof_curl_off_t" = "unknown"; then + AC_MSG_CHECKING([for 64-bit curl_off_t data type]) + for t8 in \ + "$x_LP64_long" \ + 'int64_t' \ + '__int64' \ + 'long long' \ + '__longlong' \ + '__longlong_t' ; do + DO_CURL_OFF_T_CHECK([$t8], [8]) + done + AC_MSG_RESULT([$curl_typeof_curl_off_t]) + fi + if test "$curl_typeof_curl_off_t" = "unknown"; then + AC_MSG_CHECKING([for 32-bit curl_off_t data type]) + for t4 in \ + "$x_LP32_long" \ + 'int32_t' \ + '__int32' \ + 'int' ; do + DO_CURL_OFF_T_CHECK([$t4], [4]) + done + AC_MSG_RESULT([$curl_typeof_curl_off_t]) + fi + if test "$curl_typeof_curl_off_t" = "unknown"; then + AC_MSG_CHECKING([for 16-bit curl_off_t data type]) + for t2 in \ + "$x_LP16_long" \ + 'int16_t' \ + '__int16' \ + 'int' ; do + DO_CURL_OFF_T_CHECK([$t2], [2]) + done + AC_MSG_RESULT([$curl_typeof_curl_off_t]) + fi + if test "$curl_typeof_curl_off_t" = "unknown"; then + AC_MSG_ERROR([cannot find data type for curl_off_t.]) + fi + # + AC_MSG_CHECKING([size of curl_off_t]) + AC_MSG_RESULT([$curl_sizeof_curl_off_t]) + # + AC_MSG_CHECKING([formatting string directive for curl_off_t]) + if test "$curl_format_curl_off_t" != "unknown"; then + x_pull_headers="yes" + curl_format_curl_off_t=`echo "$curl_format_curl_off_t" | "$SED" 's/[["]]//g'` + curl_format_curl_off_tu=`echo "$curl_format_curl_off_t" | "$SED" 's/i$/u/'` + curl_format_curl_off_tu=`echo "$curl_format_curl_off_tu" | "$SED" 's/d$/u/'` + curl_format_curl_off_tu=`echo "$curl_format_curl_off_tu" | "$SED" 's/D$/U/'` + else + x_pull_headers="no" + case AS_TR_SH([$curl_typeof_curl_off_t]) in + long_long | __longlong | __longlong_t) + curl_format_curl_off_t="lld" + curl_format_curl_off_tu="llu" + ;; + long) + curl_format_curl_off_t="ld" + curl_format_curl_off_tu="lu" + ;; + int) + curl_format_curl_off_t="d" + curl_format_curl_off_tu="u" + ;; + __int64) + curl_format_curl_off_t="I64d" + curl_format_curl_off_tu="I64u" + ;; + __int32) + curl_format_curl_off_t="I32d" + curl_format_curl_off_tu="I32u" + ;; + __int16) + curl_format_curl_off_t="I16d" + curl_format_curl_off_tu="I16u" + ;; + *) + AC_MSG_ERROR([cannot find print format string for curl_off_t.]) + ;; + esac + fi + AC_MSG_RESULT(["$curl_format_curl_off_t"]) + # + AC_MSG_CHECKING([formatting string directive for unsigned curl_off_t]) + AC_MSG_RESULT(["$curl_format_curl_off_tu"]) + # + DO_CURL_OFF_T_SUFFIX_CHECK([$curl_typeof_curl_off_t]) + # + if test "$x_pull_headers" = "yes"; then + if test "x$ac_cv_header_sys_types_h" = "xyes"; then + CURL_DEFINE_UNQUOTED([CURL_PULL_SYS_TYPES_H]) + fi + if test "x$ac_cv_header_stdint_h" = "xyes"; then + CURL_DEFINE_UNQUOTED([CURL_PULL_STDINT_H]) + fi + if test "x$ac_cv_header_inttypes_h" = "xyes"; then + CURL_DEFINE_UNQUOTED([CURL_PULL_INTTYPES_H]) + fi + fi + # + CURL_DEFINE_UNQUOTED([CURL_TYPEOF_CURL_OFF_T], [$curl_typeof_curl_off_t]) + CURL_DEFINE_UNQUOTED([CURL_FORMAT_CURL_OFF_T], ["$curl_format_curl_off_t"]) + CURL_DEFINE_UNQUOTED([CURL_FORMAT_CURL_OFF_TU], ["$curl_format_curl_off_tu"]) + CURL_DEFINE_UNQUOTED([CURL_FORMAT_OFF_T], ["%$curl_format_curl_off_t"]) + CURL_DEFINE_UNQUOTED([CURL_SIZEOF_CURL_OFF_T], [$curl_sizeof_curl_off_t]) + CURL_DEFINE_UNQUOTED([CURL_SUFFIX_CURL_OFF_T], [$curl_suffix_curl_off_t]) + CURL_DEFINE_UNQUOTED([CURL_SUFFIX_CURL_OFF_TU], [$curl_suffix_curl_off_tu]) + # +]) + + +dnl CURL_CHECK_WIN32_LARGEFILE +dnl ------------------------------------------------- +dnl Check if curl's WIN32 large file will be used + +AC_DEFUN([CURL_CHECK_WIN32_LARGEFILE], [ + AC_REQUIRE([CURL_CHECK_HEADER_WINDOWS])dnl + AC_MSG_CHECKING([whether build target supports WIN32 file API]) + curl_win32_file_api="no" + if test "$ac_cv_header_windows_h" = "yes"; then + if test x"$enable_largefile" != "xno"; then + AC_COMPILE_IFELSE([ + AC_LANG_PROGRAM([[ + ]],[[ +#if !defined(_WIN32_WCE) && \ + (defined(__MINGW32__) || \ + (defined(_MSC_VER) && (defined(_WIN32) || defined(_WIN64)))) + int dummy=1; +#else + WIN32 large file API not supported. +#endif + ]]) + ],[ + curl_win32_file_api="win32_large_files" + ]) + fi + if test "$curl_win32_file_api" = "no"; then + AC_COMPILE_IFELSE([ + AC_LANG_PROGRAM([[ + ]],[[ +#if defined(_WIN32_WCE) || defined(__MINGW32__) || defined(_MSC_VER) + int dummy=1; +#else + WIN32 small file API not supported. +#endif + ]]) + ],[ + curl_win32_file_api="win32_small_files" + ]) + fi + fi + case "$curl_win32_file_api" in + win32_large_files) + AC_MSG_RESULT([yes (large file enabled)]) + AC_DEFINE_UNQUOTED(USE_WIN32_LARGE_FILES, 1, + [Define to 1 if you are building a Windows target with large file support.]) + ;; + win32_small_files) + AC_MSG_RESULT([yes (large file disabled)]) + AC_DEFINE_UNQUOTED(USE_WIN32_LARGE_FILES, 1, + [Define to 1 if you are building a Windows target without large file support.]) + ;; + *) + AC_MSG_RESULT([no]) + ;; + esac +]) + +dnl CURL_EXPORT_PCDIR ($pcdir) +dnl ------------------------ +dnl if $pcdir is not empty, set PKG_CONFIG_LIBDIR to $pcdir and export +dnl +dnl we need this macro since pkg-config distinguishes among empty and unset +dnl variable while checking PKG_CONFIG_LIBDIR +dnl + +AC_DEFUN([CURL_EXPORT_PCDIR], [ + if test -n "$1"; then + PKG_CONFIG_LIBDIR="$1" + export PKG_CONFIG_LIBDIR + fi +]) + +dnl CURL_CHECK_PKGCONFIG ($module, [$pcdir]) +dnl ------------------------ +dnl search for the pkg-config tool (if not cross-compiling). Set the PKGCONFIG +dnl variable to hold the path to it, or 'no' if not found/present. +dnl +dnl If pkg-config is present, check that it has info about the $module or +dnl return "no" anyway! +dnl +dnl Optionally PKG_CONFIG_LIBDIR may be given as $pcdir. +dnl + +AC_DEFUN([CURL_CHECK_PKGCONFIG], [ + + PKGCONFIG="no" + + if test x$cross_compiling = xyes; then + dnl see if there's a pkg-specific for this host setup + AC_PATH_PROG( PKGCONFIG, ${host}-pkg-config, no, + $PATH:/usr/bin:/usr/local/bin) + fi + + if test x$PKGCONFIG = xno; then + AC_PATH_PROG( PKGCONFIG, pkg-config, no, $PATH:/usr/bin:/usr/local/bin) + fi + + if test x$PKGCONFIG != xno; then + AC_MSG_CHECKING([for $1 options with pkg-config]) + dnl ask pkg-config about $1 + itexists=`CURL_EXPORT_PCDIR([$2]) dnl + $PKGCONFIG --exists $1 >/dev/null 2>&1 && echo 1` + + if test -z "$itexists"; then + dnl pkg-config does not have info about the given module! set the + dnl variable to 'no' + PKGCONFIG="no" + AC_MSG_RESULT([no]) + else + AC_MSG_RESULT([found]) + fi + fi +]) + + +dnl CURL_GENERATE_CONFIGUREHELP_PM +dnl ------------------------------------------------- +dnl Generate test harness configurehelp.pm module, defining and +dnl initializing some perl variables with values which are known +dnl when the configure script runs. For portability reasons, test +dnl harness needs information on how to run the C preprocessor. + +AC_DEFUN([CURL_GENERATE_CONFIGUREHELP_PM], [ + AC_REQUIRE([AC_PROG_CPP])dnl + tmp_cpp=`eval echo "$ac_cpp" 2>/dev/null` + if test -z "$tmp_cpp"; then + tmp_cpp='cpp' + fi + cat >./tests/configurehelp.pm <<_EOF +[@%:@] This is a generated file. Do not edit. + +package configurehelp; + +use strict; +use warnings; +use Exporter; + +use vars qw( + @ISA + @EXPORT_OK + \$Cpreprocessor + ); + +@ISA = qw(Exporter); + +@EXPORT_OK = qw( + \$Cpreprocessor + ); + +\$Cpreprocessor = '$tmp_cpp'; + +1; +_EOF +]) diff --git a/mobicore/common/curl/aclocal.m4 b/mobicore/common/curl/aclocal.m4 new file mode 100644 index 0000000000000000000000000000000000000000..e05a1919ce9bbe12a9261698c3011aba2cd02209 --- /dev/null +++ b/mobicore/common/curl/aclocal.m4 @@ -0,0 +1,903 @@ +# generated automatically by aclocal 1.9.6 -*- Autoconf -*- + +# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, +# 2005 Free Software Foundation, Inc. +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +# Copyright (C) 2002, 2003, 2005 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# AM_AUTOMAKE_VERSION(VERSION) +# ---------------------------- +# Automake X.Y traces this macro to ensure aclocal.m4 has been +# generated from the m4 files accompanying Automake X.Y. +AC_DEFUN([AM_AUTOMAKE_VERSION], [am__api_version="1.9"]) + +# AM_SET_CURRENT_AUTOMAKE_VERSION +# ------------------------------- +# Call AM_AUTOMAKE_VERSION so it can be traced. +# This function is AC_REQUIREd by AC_INIT_AUTOMAKE. +AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION], + [AM_AUTOMAKE_VERSION([1.9.6])]) + +# AM_AUX_DIR_EXPAND -*- Autoconf -*- + +# Copyright (C) 2001, 2003, 2005 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets +# $ac_aux_dir to `$srcdir/foo'. In other projects, it is set to +# `$srcdir', `$srcdir/..', or `$srcdir/../..'. +# +# Of course, Automake must honor this variable whenever it calls a +# tool from the auxiliary directory. The problem is that $srcdir (and +# therefore $ac_aux_dir as well) can be either absolute or relative, +# depending on how configure is run. This is pretty annoying, since +# it makes $ac_aux_dir quite unusable in subdirectories: in the top +# source directory, any form will work fine, but in subdirectories a +# relative path needs to be adjusted first. +# +# $ac_aux_dir/missing +# fails when called from a subdirectory if $ac_aux_dir is relative +# $top_srcdir/$ac_aux_dir/missing +# fails if $ac_aux_dir is absolute, +# fails when called from a subdirectory in a VPATH build with +# a relative $ac_aux_dir +# +# The reason of the latter failure is that $top_srcdir and $ac_aux_dir +# are both prefixed by $srcdir. In an in-source build this is usually +# harmless because $srcdir is `.', but things will broke when you +# start a VPATH build or use an absolute $srcdir. +# +# So we could use something similar to $top_srcdir/$ac_aux_dir/missing, +# iff we strip the leading $srcdir from $ac_aux_dir. That would be: +# am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"` +# and then we would define $MISSING as +# MISSING="\${SHELL} $am_aux_dir/missing" +# This will work as long as MISSING is not called from configure, because +# unfortunately $(top_srcdir) has no meaning in configure. +# However there are other variables, like CC, which are often used in +# configure, and could therefore not use this "fixed" $ac_aux_dir. +# +# Another solution, used here, is to always expand $ac_aux_dir to an +# absolute PATH. The drawback is that using absolute paths prevent a +# configured tree to be moved without reconfiguration. + +AC_DEFUN([AM_AUX_DIR_EXPAND], +[dnl Rely on autoconf to set up CDPATH properly. +AC_PREREQ([2.50])dnl +# expand $ac_aux_dir to an absolute path +am_aux_dir=`cd $ac_aux_dir && pwd` +]) + +# AM_CONDITIONAL -*- Autoconf -*- + +# Copyright (C) 1997, 2000, 2001, 2003, 2004, 2005 +# Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# serial 7 + +# AM_CONDITIONAL(NAME, SHELL-CONDITION) +# ------------------------------------- +# Define a conditional. +AC_DEFUN([AM_CONDITIONAL], +[AC_PREREQ(2.52)dnl + ifelse([$1], [TRUE], [AC_FATAL([$0: invalid condition: $1])], + [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl +AC_SUBST([$1_TRUE]) +AC_SUBST([$1_FALSE]) +if $2; then + $1_TRUE= + $1_FALSE='#' +else + $1_TRUE='#' + $1_FALSE= +fi +AC_CONFIG_COMMANDS_PRE( +[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then + AC_MSG_ERROR([[conditional "$1" was never defined. +Usually this means the macro was only invoked conditionally.]]) +fi])]) + + +# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005 +# Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# serial 8 + +# There are a few dirty hacks below to avoid letting `AC_PROG_CC' be +# written in clear, in which case automake, when reading aclocal.m4, +# will think it sees a *use*, and therefore will trigger all it's +# C support machinery. Also note that it means that autoscan, seeing +# CC etc. in the Makefile, will ask for an AC_PROG_CC use... + + +# _AM_DEPENDENCIES(NAME) +# ---------------------- +# See how the compiler implements dependency checking. +# NAME is "CC", "CXX", "GCJ", or "OBJC". +# We try a few techniques and use that to set a single cache variable. +# +# We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was +# modified to invoke _AM_DEPENDENCIES(CC); we would have a circular +# dependency, and given that the user is not expected to run this macro, +# just rely on AC_PROG_CC. +AC_DEFUN([_AM_DEPENDENCIES], +[AC_REQUIRE([AM_SET_DEPDIR])dnl +AC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl +AC_REQUIRE([AM_MAKE_INCLUDE])dnl +AC_REQUIRE([AM_DEP_TRACK])dnl + +ifelse([$1], CC, [depcc="$CC" am_compiler_list=], + [$1], CXX, [depcc="$CXX" am_compiler_list=], + [$1], OBJC, [depcc="$OBJC" am_compiler_list='gcc3 gcc'], + [$1], GCJ, [depcc="$GCJ" am_compiler_list='gcc3 gcc'], + [depcc="$$1" am_compiler_list=]) + +AC_CACHE_CHECK([dependency style of $depcc], + [am_cv_$1_dependencies_compiler_type], +[if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then + # We make a subdir and do the tests there. Otherwise we can end up + # making bogus files that we don't know about and never remove. For + # instance it was reported that on HP-UX the gcc test will end up + # making a dummy file named `D' -- because `-MD' means `put the output + # in D'. + mkdir conftest.dir + # Copy depcomp to subdir because otherwise we won't find it if we're + # using a relative directory. + cp "$am_depcomp" conftest.dir + cd conftest.dir + # We will build objects and dependencies in a subdirectory because + # it helps to detect inapplicable dependency modes. For instance + # both Tru64's cc and ICC support -MD to output dependencies as a + # side effect of compilation, but ICC will put the dependencies in + # the current directory while Tru64 will put them in the object + # directory. + mkdir sub + + am_cv_$1_dependencies_compiler_type=none + if test "$am_compiler_list" = ""; then + am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp` + fi + for depmode in $am_compiler_list; do + # Setup a source with many dependencies, because some compilers + # like to wrap large dependency lists on column 80 (with \), and + # we should not choose a depcomp mode which is confused by this. + # + # We need to recreate these files for each test, as the compiler may + # overwrite some of them when testing with obscure command lines. + # This happens at least with the AIX C compiler. + : > sub/conftest.c + for i in 1 2 3 4 5 6; do + echo '#include "conftst'$i'.h"' >> sub/conftest.c + # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with + # Solaris 8's {/usr,}/bin/sh. + touch sub/conftst$i.h + done + echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf + + case $depmode in + nosideeffect) + # after this tag, mechanisms are not by side-effect, so they'll + # only be used when explicitly requested + if test "x$enable_dependency_tracking" = xyes; then + continue + else + break + fi + ;; + none) break ;; + esac + # We check with `-c' and `-o' for the sake of the "dashmstdout" + # mode. It turns out that the SunPro C++ compiler does not properly + # handle `-M -o', and we need to detect this. + if depmode=$depmode \ + source=sub/conftest.c object=sub/conftest.${OBJEXT-o} \ + depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ + $SHELL ./depcomp $depcc -c -o sub/conftest.${OBJEXT-o} sub/conftest.c \ + >/dev/null 2>conftest.err && + grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && + grep sub/conftest.${OBJEXT-o} sub/conftest.Po > /dev/null 2>&1 && + ${MAKE-make} -s -f confmf > /dev/null 2>&1; then + # icc doesn't choke on unknown options, it will just issue warnings + # or remarks (even with -Werror). So we grep stderr for any message + # that says an option was ignored or not supported. + # When given -MP, icc 7.0 and 7.1 complain thusly: + # icc: Command line warning: ignoring option '-M'; no argument required + # The diagnosis changed in icc 8.0: + # icc: Command line remark: option '-MP' not supported + if (grep 'ignoring option' conftest.err || + grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else + am_cv_$1_dependencies_compiler_type=$depmode + break + fi + fi + done + + cd .. + rm -rf conftest.dir +else + am_cv_$1_dependencies_compiler_type=none +fi +]) +AC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type]) +AM_CONDITIONAL([am__fastdep$1], [ + test "x$enable_dependency_tracking" != xno \ + && test "$am_cv_$1_dependencies_compiler_type" = gcc3]) +]) + + +# AM_SET_DEPDIR +# ------------- +# Choose a directory name for dependency files. +# This macro is AC_REQUIREd in _AM_DEPENDENCIES +AC_DEFUN([AM_SET_DEPDIR], +[AC_REQUIRE([AM_SET_LEADING_DOT])dnl +AC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl +]) + + +# AM_DEP_TRACK +# ------------ +AC_DEFUN([AM_DEP_TRACK], +[AC_ARG_ENABLE(dependency-tracking, +[ --disable-dependency-tracking speeds up one-time build + --enable-dependency-tracking do not reject slow dependency extractors]) +if test "x$enable_dependency_tracking" != xno; then + am_depcomp="$ac_aux_dir/depcomp" + AMDEPBACKSLASH='\' +fi +AM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno]) +AC_SUBST([AMDEPBACKSLASH]) +]) + +# Generate code to set up dependency tracking. -*- Autoconf -*- + +# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005 +# Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +#serial 3 + +# _AM_OUTPUT_DEPENDENCY_COMMANDS +# ------------------------------ +AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS], +[for mf in $CONFIG_FILES; do + # Strip MF so we end up with the name of the file. + mf=`echo "$mf" | sed -e 's/:.*$//'` + # Check whether this is an Automake generated Makefile or not. + # We used to match only the files named `Makefile.in', but + # some people rename them; so instead we look at the file content. + # Grep'ing the first line is not enough: some people post-process + # each Makefile.in and add a new line on top of each file to say so. + # So let's grep whole file. + if grep '^#.*generated by automake' $mf > /dev/null 2>&1; then + dirpart=`AS_DIRNAME("$mf")` + else + continue + fi + # Extract the definition of DEPDIR, am__include, and am__quote + # from the Makefile without running `make'. + DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"` + test -z "$DEPDIR" && continue + am__include=`sed -n 's/^am__include = //p' < "$mf"` + test -z "am__include" && continue + am__quote=`sed -n 's/^am__quote = //p' < "$mf"` + # When using ansi2knr, U may be empty or an underscore; expand it + U=`sed -n 's/^U = //p' < "$mf"` + # Find all dependency output files, they are included files with + # $(DEPDIR) in their names. We invoke sed twice because it is the + # simplest approach to changing $(DEPDIR) to its actual value in the + # expansion. + for file in `sed -n " + s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \ + sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do + # Make sure the directory exists. + test -f "$dirpart/$file" && continue + fdir=`AS_DIRNAME(["$file"])` + AS_MKDIR_P([$dirpart/$fdir]) + # echo "creating $dirpart/$file" + echo '# dummy' > "$dirpart/$file" + done +done +])# _AM_OUTPUT_DEPENDENCY_COMMANDS + + +# AM_OUTPUT_DEPENDENCY_COMMANDS +# ----------------------------- +# This macro should only be invoked once -- use via AC_REQUIRE. +# +# This code is only required when automatic dependency tracking +# is enabled. FIXME. This creates each `.P' file that we will +# need in order to bootstrap the dependency handling code. +AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS], +[AC_CONFIG_COMMANDS([depfiles], + [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS], + [AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"]) +]) + +# Copyright (C) 1996, 1997, 2000, 2001, 2003, 2005 +# Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# serial 8 + +# AM_CONFIG_HEADER is obsolete. It has been replaced by AC_CONFIG_HEADERS. +AU_DEFUN([AM_CONFIG_HEADER], [AC_CONFIG_HEADERS($@)]) + +# Do all the work for Automake. -*- Autoconf -*- + +# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 +# Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# serial 12 + +# This macro actually does too much. Some checks are only needed if +# your package does certain things. But this isn't really a big deal. + +# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE]) +# AM_INIT_AUTOMAKE([OPTIONS]) +# ----------------------------------------------- +# The call with PACKAGE and VERSION arguments is the old style +# call (pre autoconf-2.50), which is being phased out. PACKAGE +# and VERSION should now be passed to AC_INIT and removed from +# the call to AM_INIT_AUTOMAKE. +# We support both call styles for the transition. After +# the next Automake release, Autoconf can make the AC_INIT +# arguments mandatory, and then we can depend on a new Autoconf +# release and drop the old call support. +AC_DEFUN([AM_INIT_AUTOMAKE], +[AC_PREREQ([2.58])dnl +dnl Autoconf wants to disallow AM_ names. We explicitly allow +dnl the ones we care about. +m4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl +AC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl +AC_REQUIRE([AC_PROG_INSTALL])dnl +# test to see if srcdir already configured +if test "`cd $srcdir && pwd`" != "`pwd`" && + test -f $srcdir/config.status; then + AC_MSG_ERROR([source directory already configured; run "make distclean" there first]) +fi + +# test whether we have cygpath +if test -z "$CYGPATH_W"; then + if (cygpath --version) >/dev/null 2>/dev/null; then + CYGPATH_W='cygpath -w' + else + CYGPATH_W=echo + fi +fi +AC_SUBST([CYGPATH_W]) + +# Define the identity of the package. +dnl Distinguish between old-style and new-style calls. +m4_ifval([$2], +[m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl + AC_SUBST([PACKAGE], [$1])dnl + AC_SUBST([VERSION], [$2])], +[_AM_SET_OPTIONS([$1])dnl + AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl + AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl + +_AM_IF_OPTION([no-define],, +[AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package]) + AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package])])dnl + +# Some tools Automake needs. +AC_REQUIRE([AM_SANITY_CHECK])dnl +AC_REQUIRE([AC_ARG_PROGRAM])dnl +AM_MISSING_PROG(ACLOCAL, aclocal-${am__api_version}) +AM_MISSING_PROG(AUTOCONF, autoconf) +AM_MISSING_PROG(AUTOMAKE, automake-${am__api_version}) +AM_MISSING_PROG(AUTOHEADER, autoheader) +AM_MISSING_PROG(MAKEINFO, makeinfo) +AM_PROG_INSTALL_SH +AM_PROG_INSTALL_STRIP +AC_REQUIRE([AM_PROG_MKDIR_P])dnl +# We need awk for the "check" target. The system "awk" is bad on +# some platforms. +AC_REQUIRE([AC_PROG_AWK])dnl +AC_REQUIRE([AC_PROG_MAKE_SET])dnl +AC_REQUIRE([AM_SET_LEADING_DOT])dnl +_AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])], + [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])], + [_AM_PROG_TAR([v7])])]) +_AM_IF_OPTION([no-dependencies],, +[AC_PROVIDE_IFELSE([AC_PROG_CC], + [_AM_DEPENDENCIES(CC)], + [define([AC_PROG_CC], + defn([AC_PROG_CC])[_AM_DEPENDENCIES(CC)])])dnl +AC_PROVIDE_IFELSE([AC_PROG_CXX], + [_AM_DEPENDENCIES(CXX)], + [define([AC_PROG_CXX], + defn([AC_PROG_CXX])[_AM_DEPENDENCIES(CXX)])])dnl +]) +]) + + +# When config.status generates a header, we must update the stamp-h file. +# This file resides in the same directory as the config header +# that is generated. The stamp files are numbered to have different names. + +# Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the +# loop where config.status creates the headers, so we can generate +# our stamp files there. +AC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK], +[# Compute $1's index in $config_headers. +_am_stamp_count=1 +for _am_header in $config_headers :; do + case $_am_header in + $1 | $1:* ) + break ;; + * ) + _am_stamp_count=`expr $_am_stamp_count + 1` ;; + esac +done +echo "timestamp for $1" >`AS_DIRNAME([$1])`/stamp-h[]$_am_stamp_count]) + +# Copyright (C) 2001, 2003, 2005 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# AM_PROG_INSTALL_SH +# ------------------ +# Define $install_sh. +AC_DEFUN([AM_PROG_INSTALL_SH], +[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl +install_sh=${install_sh-"$am_aux_dir/install-sh"} +AC_SUBST(install_sh)]) + +# Copyright (C) 2003, 2005 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# serial 2 + +# Check whether the underlying file-system supports filenames +# with a leading dot. For instance MS-DOS doesn't. +AC_DEFUN([AM_SET_LEADING_DOT], +[rm -rf .tst 2>/dev/null +mkdir .tst 2>/dev/null +if test -d .tst; then + am__leading_dot=. +else + am__leading_dot=_ +fi +rmdir .tst 2>/dev/null +AC_SUBST([am__leading_dot])]) + +# Add --enable-maintainer-mode option to configure. -*- Autoconf -*- +# From Jim Meyering + +# Copyright (C) 1996, 1998, 2000, 2001, 2002, 2003, 2004, 2005 +# Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# serial 4 + +AC_DEFUN([AM_MAINTAINER_MODE], +[AC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles]) + dnl maintainer-mode is disabled by default + AC_ARG_ENABLE(maintainer-mode, +[ --enable-maintainer-mode enable make rules and dependencies not useful + (and sometimes confusing) to the casual installer], + USE_MAINTAINER_MODE=$enableval, + USE_MAINTAINER_MODE=no) + AC_MSG_RESULT([$USE_MAINTAINER_MODE]) + AM_CONDITIONAL(MAINTAINER_MODE, [test $USE_MAINTAINER_MODE = yes]) + MAINT=$MAINTAINER_MODE_TRUE + AC_SUBST(MAINT)dnl +] +) + +AU_DEFUN([jm_MAINTAINER_MODE], [AM_MAINTAINER_MODE]) + +# Check to see how 'make' treats includes. -*- Autoconf -*- + +# Copyright (C) 2001, 2002, 2003, 2005 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# serial 3 + +# AM_MAKE_INCLUDE() +# ----------------- +# Check to see how make treats includes. +AC_DEFUN([AM_MAKE_INCLUDE], +[am_make=${MAKE-make} +cat > confinc << 'END' +am__doit: + @echo done +.PHONY: am__doit +END +# If we don't find an include directive, just comment out the code. +AC_MSG_CHECKING([for style of include used by $am_make]) +am__include="#" +am__quote= +_am_result=none +# First try GNU make style include. +echo "include confinc" > confmf +# We grep out `Entering directory' and `Leaving directory' +# messages which can occur if `w' ends up in MAKEFLAGS. +# In particular we don't look at `^make:' because GNU make might +# be invoked under some other name (usually "gmake"), in which +# case it prints its new name instead of `make'. +if test "`$am_make -s -f confmf 2> /dev/null | grep -v 'ing directory'`" = "done"; then + am__include=include + am__quote= + _am_result=GNU +fi +# Now try BSD make style include. +if test "$am__include" = "#"; then + echo '.include "confinc"' > confmf + if test "`$am_make -s -f confmf 2> /dev/null`" = "done"; then + am__include=.include + am__quote="\"" + _am_result=BSD + fi +fi +AC_SUBST([am__include]) +AC_SUBST([am__quote]) +AC_MSG_RESULT([$_am_result]) +rm -f confinc confmf +]) + +# Fake the existence of programs that GNU maintainers use. -*- Autoconf -*- + +# Copyright (C) 1997, 1999, 2000, 2001, 2003, 2005 +# Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# serial 4 + +# AM_MISSING_PROG(NAME, PROGRAM) +# ------------------------------ +AC_DEFUN([AM_MISSING_PROG], +[AC_REQUIRE([AM_MISSING_HAS_RUN]) +$1=${$1-"${am_missing_run}$2"} +AC_SUBST($1)]) + + +# AM_MISSING_HAS_RUN +# ------------------ +# Define MISSING if not defined so far and test if it supports --run. +# If it does, set am_missing_run to use it, otherwise, to nothing. +AC_DEFUN([AM_MISSING_HAS_RUN], +[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl +test x"${MISSING+set}" = xset || MISSING="\${SHELL} $am_aux_dir/missing" +# Use eval to expand $SHELL +if eval "$MISSING --run true"; then + am_missing_run="$MISSING --run " +else + am_missing_run= + AC_MSG_WARN([`missing' script is too old or missing]) +fi +]) + +# Copyright (C) 2003, 2004, 2005 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# AM_PROG_MKDIR_P +# --------------- +# Check whether `mkdir -p' is supported, fallback to mkinstalldirs otherwise. +# +# Automake 1.8 used `mkdir -m 0755 -p --' to ensure that directories +# created by `make install' are always world readable, even if the +# installer happens to have an overly restrictive umask (e.g. 077). +# This was a mistake. There are at least two reasons why we must not +# use `-m 0755': +# - it causes special bits like SGID to be ignored, +# - it may be too restrictive (some setups expect 775 directories). +# +# Do not use -m 0755 and let people choose whatever they expect by +# setting umask. +# +# We cannot accept any implementation of `mkdir' that recognizes `-p'. +# Some implementations (such as Solaris 8's) are not thread-safe: if a +# parallel make tries to run `mkdir -p a/b' and `mkdir -p a/c' +# concurrently, both version can detect that a/ is missing, but only +# one can create it and the other will error out. Consequently we +# restrict ourselves to GNU make (using the --version option ensures +# this.) +AC_DEFUN([AM_PROG_MKDIR_P], +[if mkdir -p --version . >/dev/null 2>&1 && test ! -d ./--version; then + # We used to keeping the `.' as first argument, in order to + # allow $(mkdir_p) to be used without argument. As in + # $(mkdir_p) $(somedir) + # where $(somedir) is conditionally defined. However this is wrong + # for two reasons: + # 1. if the package is installed by a user who cannot write `.' + # make install will fail, + # 2. the above comment should most certainly read + # $(mkdir_p) $(DESTDIR)$(somedir) + # so it does not work when $(somedir) is undefined and + # $(DESTDIR) is not. + # To support the latter case, we have to write + # test -z "$(somedir)" || $(mkdir_p) $(DESTDIR)$(somedir), + # so the `.' trick is pointless. + mkdir_p='mkdir -p --' +else + # On NextStep and OpenStep, the `mkdir' command does not + # recognize any option. It will interpret all options as + # directories to create, and then abort because `.' already + # exists. + for d in ./-p ./--version; + do + test -d $d && rmdir $d + done + # $(mkinstalldirs) is defined by Automake if mkinstalldirs exists. + if test -f "$ac_aux_dir/mkinstalldirs"; then + mkdir_p='$(mkinstalldirs)' + else + mkdir_p='$(install_sh) -d' + fi +fi +AC_SUBST([mkdir_p])]) + +# Helper functions for option handling. -*- Autoconf -*- + +# Copyright (C) 2001, 2002, 2003, 2005 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# serial 3 + +# _AM_MANGLE_OPTION(NAME) +# ----------------------- +AC_DEFUN([_AM_MANGLE_OPTION], +[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])]) + +# _AM_SET_OPTION(NAME) +# ------------------------------ +# Set option NAME. Presently that only means defining a flag for this option. +AC_DEFUN([_AM_SET_OPTION], +[m4_define(_AM_MANGLE_OPTION([$1]), 1)]) + +# _AM_SET_OPTIONS(OPTIONS) +# ---------------------------------- +# OPTIONS is a space-separated list of Automake options. +AC_DEFUN([_AM_SET_OPTIONS], +[AC_FOREACH([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])]) + +# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET]) +# ------------------------------------------- +# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise. +AC_DEFUN([_AM_IF_OPTION], +[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])]) + +# Check to make sure that the build environment is sane. -*- Autoconf -*- + +# Copyright (C) 1996, 1997, 2000, 2001, 2003, 2005 +# Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# serial 4 + +# AM_SANITY_CHECK +# --------------- +AC_DEFUN([AM_SANITY_CHECK], +[AC_MSG_CHECKING([whether build environment is sane]) +# Just in case +sleep 1 +echo timestamp > conftest.file +# Do `set' in a subshell so we don't clobber the current shell's +# arguments. Must try -L first in case configure is actually a +# symlink; some systems play weird games with the mod time of symlinks +# (eg FreeBSD returns the mod time of the symlink's containing +# directory). +if ( + set X `ls -Lt $srcdir/configure conftest.file 2> /dev/null` + if test "$[*]" = "X"; then + # -L didn't work. + set X `ls -t $srcdir/configure conftest.file` + fi + rm -f conftest.file + if test "$[*]" != "X $srcdir/configure conftest.file" \ + && test "$[*]" != "X conftest.file $srcdir/configure"; then + + # If neither matched, then we have a broken ls. This can happen + # if, for instance, CONFIG_SHELL is bash and it inherits a + # broken ls alias from the environment. This has actually + # happened. Such a system could not be considered "sane". + AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken +alias in your environment]) + fi + + test "$[2]" = conftest.file + ) +then + # Ok. + : +else + AC_MSG_ERROR([newly created file is older than distributed files! +Check your system clock]) +fi +AC_MSG_RESULT(yes)]) + +# Copyright (C) 2001, 2003, 2005 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# AM_PROG_INSTALL_STRIP +# --------------------- +# One issue with vendor `install' (even GNU) is that you can't +# specify the program used to strip binaries. This is especially +# annoying in cross-compiling environments, where the build's strip +# is unlikely to handle the host's binaries. +# Fortunately install-sh will honor a STRIPPROG variable, so we +# always use install-sh in `make install-strip', and initialize +# STRIPPROG with the value of the STRIP variable (set by the user). +AC_DEFUN([AM_PROG_INSTALL_STRIP], +[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl +# Installed binaries are usually stripped using `strip' when the user +# run `make install-strip'. However `strip' might not be the right +# tool to use in cross-compilation environments, therefore Automake +# will honor the `STRIP' environment variable to overrule this program. +dnl Don't test for $cross_compiling = yes, because it might be `maybe'. +if test "$cross_compiling" != no; then + AC_CHECK_TOOL([STRIP], [strip], :) +fi +INSTALL_STRIP_PROGRAM="\${SHELL} \$(install_sh) -c -s" +AC_SUBST([INSTALL_STRIP_PROGRAM])]) + +# Check how to create a tarball. -*- Autoconf -*- + +# Copyright (C) 2004, 2005 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# serial 2 + +# _AM_PROG_TAR(FORMAT) +# -------------------- +# Check how to create a tarball in format FORMAT. +# FORMAT should be one of `v7', `ustar', or `pax'. +# +# Substitute a variable $(am__tar) that is a command +# writing to stdout a FORMAT-tarball containing the directory +# $tardir. +# tardir=directory && $(am__tar) > result.tar +# +# Substitute a variable $(am__untar) that extract such +# a tarball read from stdin. +# $(am__untar) < result.tar +AC_DEFUN([_AM_PROG_TAR], +[# Always define AMTAR for backward compatibility. +AM_MISSING_PROG([AMTAR], [tar]) +m4_if([$1], [v7], + [am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -'], + [m4_case([$1], [ustar],, [pax],, + [m4_fatal([Unknown tar format])]) +AC_MSG_CHECKING([how to create a $1 tar archive]) +# Loop over all known methods to create a tar archive until one works. +_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none' +_am_tools=${am_cv_prog_tar_$1-$_am_tools} +# Do not fold the above two line into one, because Tru64 sh and +# Solaris sh will not grok spaces in the rhs of `-'. +for _am_tool in $_am_tools +do + case $_am_tool in + gnutar) + for _am_tar in tar gnutar gtar; + do + AM_RUN_LOG([$_am_tar --version]) && break + done + am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"' + am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"' + am__untar="$_am_tar -xf -" + ;; + plaintar) + # Must skip GNU tar: if it does not support --format= it doesn't create + # ustar tarball either. + (tar --version) >/dev/null 2>&1 && continue + am__tar='tar chf - "$$tardir"' + am__tar_='tar chf - "$tardir"' + am__untar='tar xf -' + ;; + pax) + am__tar='pax -L -x $1 -w "$$tardir"' + am__tar_='pax -L -x $1 -w "$tardir"' + am__untar='pax -r' + ;; + cpio) + am__tar='find "$$tardir" -print | cpio -o -H $1 -L' + am__tar_='find "$tardir" -print | cpio -o -H $1 -L' + am__untar='cpio -i -H $1 -d' + ;; + none) + am__tar=false + am__tar_=false + am__untar=false + ;; + esac + + # If the value was cached, stop now. We just wanted to have am__tar + # and am__untar set. + test -n "${am_cv_prog_tar_$1}" && break + + # tar/untar a dummy directory, and stop if the command works + rm -rf conftest.dir + mkdir conftest.dir + echo GrepMe > conftest.dir/file + AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar]) + rm -rf conftest.dir + if test -s conftest.tar; then + AM_RUN_LOG([$am__untar /dev/null 2>&1 && break + fi +done +rm -rf conftest.dir + +AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool]) +AC_MSG_RESULT([$am_cv_prog_tar_$1])]) +AC_SUBST([am__tar]) +AC_SUBST([am__untar]) +]) # _AM_PROG_TAR + +m4_include([m4/curl-compilers.m4]) +m4_include([m4/curl-confopts.m4]) +m4_include([m4/curl-functions.m4]) +m4_include([m4/curl-override.m4]) +m4_include([m4/curl-reentrant.m4]) +m4_include([m4/curl-system.m4]) +m4_include([m4/libtool.m4]) +m4_include([m4/ltoptions.m4]) +m4_include([m4/ltsugar.m4]) +m4_include([m4/ltversion.m4]) +m4_include([m4/lt~obsolete.m4]) +m4_include([acinclude.m4]) diff --git a/mobicore/common/curl/buildconf b/mobicore/common/curl/buildconf new file mode 100644 index 0000000000000000000000000000000000000000..f77ed7665e4a7a7efa519f0dd6fe0d2d2461bdea --- /dev/null +++ b/mobicore/common/curl/buildconf @@ -0,0 +1,418 @@ +#!/bin/sh +#*************************************************************************** +# _ _ ____ _ +# Project ___| | | | _ \| | +# / __| | | | |_) | | +# | (__| |_| | _ <| |___ +# \___|\___/|_| \_\_____| +# +# Copyright (C) 1998 - 2010, Daniel Stenberg, , et al. +# +# This software is licensed as described in the file COPYING, which +# you should have received as part of this distribution. The terms +# are also available at http://curl.haxx.se/docs/copyright.html. +# +# You may opt to use, copy, modify, merge, publish, distribute and/or sell +# copies of the Software, and permit persons to whom the Software is +# furnished to do so, under the terms of the COPYING file. +# +# This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY +# KIND, either express or implied. +# +########################################################################### + +die(){ + echo "$@" + exit +} + +#-------------------------------------------------------------------------- +# findtool works as 'which' but we use a different name to make it more +# obvious we aren't using 'which'! ;-) +# +findtool(){ + file="$1" + + if { echo $file | grep "/" >/dev/null 2>&1; } then + # we only check for the explicit file name if the file is given + # including a slash. Use ./ for current dir. Previously this would + # otherwise always cause findtool to search the local dir first, which + # is wrong. + if test -f "$file"; then + echo "$file" + return + fi + fi + + old_IFS=$IFS; IFS=':' + for path in $PATH + do + IFS=$old_IFS + # echo "checks for $file in $path" >&2 + if test -f "$path/$file"; then + echo "$path/$file" + return + fi + done + IFS=$old_IFS +} + +#-------------------------------------------------------------------------- +# removethis() removes all files and subdirectories with the given name, +# inside and below the current subdirectory at invocation time. +# +removethis(){ + if test "$#" = "1"; then + find . -depth -name $1 -print > buildconf.tmp.$$ + while read fdname + do + if test -f "$fdname"; then + rm -f "$fdname" + elif test -d "$fdname"; then + rm -f -r "$fdname" + fi + done < buildconf.tmp.$$ + rm -f buildconf.tmp.$$ + fi +} + +#-------------------------------------------------------------------------- +# Ensure that buildconf runs from the subdirectory where configure.ac lives +# +if test ! -f configure.ac || + test ! -f src/main.c || + test ! -f lib/urldata.h || + test ! -f include/curl/curl.h; then + echo "Can not run buildconf from outside of curl's source subdirectory!" + echo "Change to the subdirectory where buildconf is found, and try again." + exit 1 +fi + +#-------------------------------------------------------------------------- +# autoconf 2.57 or newer +# +need_autoconf="2.57" +ac_version=`${AUTOCONF:-autoconf} --version 2>/dev/null|head -n 1| sed -e 's/^[^0-9]*//' -e 's/[a-z]* *$//'` +if test -z "$ac_version"; then + echo "buildconf: autoconf not found." + echo " You need autoconf version $need_autoconf or newer installed." + exit 1 +fi +old_IFS=$IFS; IFS='.'; set $ac_version; IFS=$old_IFS +if test "$1" = "2" -a "$2" -lt "57" || test "$1" -lt "2"; then + echo "buildconf: autoconf version $ac_version found." + echo " You need autoconf version $need_autoconf or newer installed." + echo " If you have a sufficient autoconf installed, but it" + echo " is not named 'autoconf', then try setting the" + echo " AUTOCONF environment variable." + exit 1 +fi + +echo "buildconf: autoconf version $ac_version (ok)" + +am4te_version=`${AUTOM4TE:-autom4te} --version 2>/dev/null|head -n 1| sed -e 's/autom4te\(.*\)/\1/' -e 's/^[^0-9]*//' -e 's/[a-z]* *$//'` +if test -z "$am4te_version"; then + echo "buildconf: autom4te not found. Weird autoconf installation!" + exit 1 +fi +if test "$am4te_version" = "$ac_version"; then + echo "buildconf: autom4te version $am4te_version (ok)" +else + echo "buildconf: autom4te version $am4te_version (ERROR: does not match autoconf version)" + exit 1 +fi + +#-------------------------------------------------------------------------- +# autoheader 2.50 or newer +# +ah_version=`${AUTOHEADER:-autoheader} --version 2>/dev/null|head -n 1| sed -e 's/^[^0-9]*//' -e 's/[a-z]* *$//'` +if test -z "$ah_version"; then + echo "buildconf: autoheader not found." + echo " You need autoheader version 2.50 or newer installed." + exit 1 +fi +old_IFS=$IFS; IFS='.'; set $ah_version; IFS=$old_IFS +if test "$1" = "2" -a "$2" -lt "50" || test "$1" -lt "2"; then + echo "buildconf: autoheader version $ah_version found." + echo " You need autoheader version 2.50 or newer installed." + echo " If you have a sufficient autoheader installed, but it" + echo " is not named 'autoheader', then try setting the" + echo " AUTOHEADER environment variable." + exit 1 +fi + +echo "buildconf: autoheader version $ah_version (ok)" + +#-------------------------------------------------------------------------- +# automake 1.7 or newer +# +need_automake="1.7" +am_version=`${AUTOMAKE:-automake} --version 2>/dev/null|head -n 1| sed -e 's/^.* \([0-9]\)/\1/' -e 's/[a-z]* *$//' -e 's/\(.*\)\(-p.*\)/\1/'` +if test -z "$am_version"; then + echo "buildconf: automake not found." + echo " You need automake version $need_automake or newer installed." + exit 1 +fi +old_IFS=$IFS; IFS='.'; set $am_version; IFS=$old_IFS +if test "$1" = "1" -a "$2" -lt "7" || test "$1" -lt "1"; then + echo "buildconf: automake version $am_version found." + echo " You need automake version $need_automake or newer installed." + echo " If you have a sufficient automake installed, but it" + echo " is not named 'automake', then try setting the" + echo " AUTOMAKE environment variable." + exit 1 +fi + +echo "buildconf: automake version $am_version (ok)" + +acloc_version=`${ACLOCAL:-aclocal} --version 2>/dev/null|head -n 1| sed -e 's/^.* \([0-9]\)/\1/' -e 's/[a-z]* *$//' -e 's/\(.*\)\(-p.*\)/\1/'` +if test -z "$acloc_version"; then + echo "buildconf: aclocal not found. Weird automake installation!" + exit 1 +fi +if test "$acloc_version" = "$am_version"; then + echo "buildconf: aclocal version $acloc_version (ok)" +else + echo "buildconf: aclocal version $acloc_version (ERROR: does not match automake version)" + exit 1 +fi + +#-------------------------------------------------------------------------- +# libtool check +# +LIBTOOL_WANTED_MAJOR=1 +LIBTOOL_WANTED_MINOR=4 +LIBTOOL_WANTED_PATCH=2 +LIBTOOL_WANTED_VERSION=1.4.2 + +# this approach that tries 'glibtool' first is some kind of work-around for +# some BSD-systems I believe that use to provide the GNU libtool named +# glibtool, with 'libtool' being something completely different. +libtool=`findtool glibtool 2>/dev/null` +if test ! -x "$libtool"; then + libtool=`findtool ${LIBTOOL:-libtool}` +fi + +if test -z "$LIBTOOLIZE"; then + # set the LIBTOOLIZE here so that glibtoolize is used if glibtool was found + # $libtool is already the full path + libtoolize="${libtool}ize" +else + libtoolize=`findtool $LIBTOOLIZE` +fi + +lt_pver=`$libtool --version 2>/dev/null|head -n 1` +lt_qver=`echo $lt_pver|sed -e "s/([^)]*)//g" -e "s/^[^0-9]*//g"` +lt_version=`echo $lt_qver|sed -e "s/[- ].*//" -e "s/\([a-z]*\)$//"` +if test -z "$lt_version"; then + echo "buildconf: libtool not found." + echo " You need libtool version $LIBTOOL_WANTED_VERSION or newer installed" + exit 1 +fi +old_IFS=$IFS; IFS='.'; set $lt_version; IFS=$old_IFS +lt_major=$1 +lt_minor=$2 +lt_patch=$3 +lt_status="good" + +if test "$lt_major" = "$LIBTOOL_WANTED_MAJOR"; then + if test "$lt_minor" -lt "$LIBTOOL_WANTED_MINOR"; then + lt_status="bad" + elif test -n "$LIBTOOL_WANTED_PATCH"; then + if test "$lt_minor" -gt "$LIBTOOL_WANTED_MINOR"; then + lt_status="good" + elif test -n "$lt_patch"; then + if test "$lt_patch" -lt "$LIBTOOL_WANTED_PATCH"; then + lt_status="bad" + fi + else + lt_status="bad" + fi + fi +fi +if test $lt_status != "good"; then + echo "buildconf: libtool version $lt_version found." + echo " You need libtool version $LIBTOOL_WANTED_VERSION or newer installed" + exit 1 +fi + +echo "buildconf: libtool version $lt_version (ok)" + +if test -f "$libtoolize"; then + echo "buildconf: libtoolize found" +else + echo "buildconf: libtoolize not found. Weird libtool installation!" + exit 1 +fi + +#-------------------------------------------------------------------------- +# m4 check +# +m4=`(${M4:-m4} --version || ${M4:-gm4} --version) 2>/dev/null | head -n 1`; +m4_version=`echo $m4 | sed -e 's/^.* \([0-9]\)/\1/' -e 's/[a-z]* *$//'` + +if { echo $m4 | grep "GNU" >/dev/null 2>&1; } then + echo "buildconf: GNU m4 version $m4_version (ok)" +else + if test -z "$m4"; then + echo "buildconf: m4 version not recognized. You need a GNU m4 installed!" + else + echo "buildconf: m4 version $m4 found. You need a GNU m4 installed!" + fi + exit 1 +fi + +#-------------------------------------------------------------------------- +# perl check +# +PERL=`findtool ${PERL:-perl}` + +#-------------------------------------------------------------------------- +# Remove files generated on previous buildconf/configure run. +# +for fname in .deps \ + .libs \ + *.la \ + *.lo \ + *.a \ + *.o \ + Makefile \ + Makefile.in \ + aclocal.m4 \ + aclocal.m4.bak \ + ares_build.h \ + ares_config.h \ + ares_config.h.in \ + autom4te.cache \ + compile \ + config.guess \ + curl_config.h \ + curl_config.h.in \ + config.log \ + config.lt \ + config.status \ + config.sub \ + configure \ + configurehelp.pm \ + curl-config \ + curlbuild.h \ + depcomp \ + libcares.pc \ + libcurl.pc \ + libtool \ + libtool.m4 \ + ltmain.sh \ + ltoptions.m4 \ + ltsugar.m4 \ + ltversion.m4 \ + lt~obsolete.m4 \ + stamp-h1 \ + stamp-h2 \ + stamp-h3 ; do + removethis "$fname" +done + +#-------------------------------------------------------------------------- +# run the correct scripts now +# + +echo "buildconf: running libtoolize" +$libtoolize --copy --automake --force || die "The libtoolize command failed" + +if test ! -f m4/curl-functions.m4; then + echo "buildconf: cURL m4 macros not found" + exit 1 +fi + +echo "buildconf: running aclocal" +${ACLOCAL:-aclocal} -I m4 $ACLOCAL_FLAGS || die "The aclocal command line failed" + +if test -n "$PERL"; then + echo "buildconf: running aclocal hack to convert all mv to mv -f" + $PERL -i.bak -pe 's/\bmv +([^-\s])/mv -f $1/g' aclocal.m4 +else + echo "buildconf: perl not found" + exit 1 +fi + +echo "buildconf: running autoheader" +${AUTOHEADER:-autoheader} || die "The autoheader command failed" + +echo "buildconf: cp lib/curl_config.h.in src/curl_config.h.in" +cp lib/curl_config.h.in src/curl_config.h.in + +echo "buildconf: running autoconf" +${AUTOCONF:-autoconf} || die "The autoconf command failed" + +if test -d ares; then + cd ares + echo "buildconf: running in ares" + ./buildconf + cd .. +fi + +echo "buildconf: running automake" +${AUTOMAKE:-automake} -a -c || die "The automake command failed" + +#-------------------------------------------------------------------------- +# Depending on the libtool and automake versions being used, config.guess +# might not be installed in the subdirectory until automake has finished. +# So we can not attempt to use it until this very last buildconf stage. +# + +if test ! -f ./config.guess; then + echo "buildconf: config.guess not found" +else + buildhost=`./config.guess 2>/dev/null|head -n 1` + case $buildhost in + *-*-darwin*) + need_lt_major=1 + need_lt_minor=5 + need_lt_patch=26 + need_lt_check="yes" + ;; + *-*-hpux*) + need_lt_major=1 + need_lt_minor=5 + need_lt_patch=24 + need_lt_check="yes" + ;; + esac + if test ! -z "$need_lt_check"; then + if test -z "$lt_major"; then + lt_status="bad" + elif test "$lt_major" -gt "$need_lt_major"; then + lt_status="good" + elif test "$lt_major" -lt "$need_lt_major"; then + lt_status="bad" + elif test -z "$lt_minor"; then + lt_status="bad" + elif test "$lt_minor" -gt "$need_lt_minor"; then + lt_status="good" + elif test "$lt_minor" -lt "$need_lt_minor"; then + lt_status="bad" + elif test -z "$lt_patch"; then + lt_status="bad" + elif test "$lt_patch" -gt "$need_lt_patch"; then + lt_status="good" + elif test "$lt_patch" -lt "$need_lt_patch"; then + lt_status="bad" + else + lt_status="good" + fi + if test "$lt_status" != "good"; then + need_lt_version="$need_lt_major.$need_lt_minor.$need_lt_patch" + echo "buildconf: libtool version $lt_version found." + echo " $buildhost requires libtool $need_lt_version or newer installed." + rm -f configure + exit 1 + fi + fi +fi + +#-------------------------------------------------------------------------- +# Finished succesfully. +# + +echo "buildconf: OK" +exit 0 diff --git a/mobicore/common/curl/config.guess b/mobicore/common/curl/config.guess new file mode 100644 index 0000000000000000000000000000000000000000..c2246a4f7f4c78281ccfc4238a54cf7d83c4f421 --- /dev/null +++ b/mobicore/common/curl/config.guess @@ -0,0 +1,1502 @@ +#! /bin/sh +# Attempt to guess a canonical system name. +# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, +# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 +# Free Software Foundation, Inc. + +timestamp='2009-12-30' + +# This file is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA +# 02110-1301, USA. +# +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + + +# Originally written by Per Bothner. Please send patches (context +# diff format) to and include a ChangeLog +# entry. +# +# This script attempts to guess a canonical system name similar to +# config.sub. If it succeeds, it prints the system name on stdout, and +# exits with 0. Otherwise, it exits with 1. +# +# You can get the latest version of this script from: +# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD + +me=`echo "$0" | sed -e 's,.*/,,'` + +usage="\ +Usage: $0 [OPTION] + +Output the configuration name of the system \`$me' is run on. + +Operation modes: + -h, --help print this help, then exit + -t, --time-stamp print date of last modification, then exit + -v, --version print version number, then exit + +Report bugs and patches to ." + +version="\ +GNU config.guess ($timestamp) + +Originally written by Per Bothner. +Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, +2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free +Software Foundation, Inc. + +This is free software; see the source for copying conditions. There is NO +warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." + +help=" +Try \`$me --help' for more information." + +# Parse command line +while test $# -gt 0 ; do + case $1 in + --time-stamp | --time* | -t ) + echo "$timestamp" ; exit ;; + --version | -v ) + echo "$version" ; exit ;; + --help | --h* | -h ) + echo "$usage"; exit ;; + -- ) # Stop option processing + shift; break ;; + - ) # Use stdin as input. + break ;; + -* ) + echo "$me: invalid option $1$help" >&2 + exit 1 ;; + * ) + break ;; + esac +done + +if test $# != 0; then + echo "$me: too many arguments$help" >&2 + exit 1 +fi + +trap 'exit 1' 1 2 15 + +# CC_FOR_BUILD -- compiler used by this script. Note that the use of a +# compiler to aid in system detection is discouraged as it requires +# temporary files to be created and, as you can see below, it is a +# headache to deal with in a portable fashion. + +# Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still +# use `HOST_CC' if defined, but it is deprecated. + +# Portable tmp directory creation inspired by the Autoconf team. + +set_cc_for_build=' +trap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ; +trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ; +: ${TMPDIR=/tmp} ; + { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } || + { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } || + { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } || + { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ; +dummy=$tmp/dummy ; +tmpfiles="$dummy.c $dummy.o $dummy.rel $dummy" ; +case $CC_FOR_BUILD,$HOST_CC,$CC in + ,,) echo "int x;" > $dummy.c ; + for c in cc gcc c89 c99 ; do + if ($c -c -o $dummy.o $dummy.c) >/dev/null 2>&1 ; then + CC_FOR_BUILD="$c"; break ; + fi ; + done ; + if test x"$CC_FOR_BUILD" = x ; then + CC_FOR_BUILD=no_compiler_found ; + fi + ;; + ,,*) CC_FOR_BUILD=$CC ;; + ,*,*) CC_FOR_BUILD=$HOST_CC ;; +esac ; set_cc_for_build= ;' + +# This is needed to find uname on a Pyramid OSx when run in the BSD universe. +# (ghazi@noc.rutgers.edu 1994-08-24) +if (test -f /.attbin/uname) >/dev/null 2>&1 ; then + PATH=$PATH:/.attbin ; export PATH +fi + +UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown +UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown +UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown +UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown + +# Note: order is significant - the case branches are not exclusive. + +case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in + *:NetBSD:*:*) + # NetBSD (nbsd) targets should (where applicable) match one or + # more of the tupples: *-*-netbsdelf*, *-*-netbsdaout*, + # *-*-netbsdecoff* and *-*-netbsd*. For targets that recently + # switched to ELF, *-*-netbsd* would select the old + # object file format. This provides both forward + # compatibility and a consistent mechanism for selecting the + # object file format. + # + # Note: NetBSD doesn't particularly care about the vendor + # portion of the name. We always set it to "unknown". + sysctl="sysctl -n hw.machine_arch" + UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \ + /usr/sbin/$sysctl 2>/dev/null || echo unknown)` + case "${UNAME_MACHINE_ARCH}" in + armeb) machine=armeb-unknown ;; + arm*) machine=arm-unknown ;; + sh3el) machine=shl-unknown ;; + sh3eb) machine=sh-unknown ;; + sh5el) machine=sh5le-unknown ;; + *) machine=${UNAME_MACHINE_ARCH}-unknown ;; + esac + # The Operating System including object format, if it has switched + # to ELF recently, or will in the future. + case "${UNAME_MACHINE_ARCH}" in + arm*|i386|m68k|ns32k|sh3*|sparc|vax) + eval $set_cc_for_build + if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \ + | grep -q __ELF__ + then + # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout). + # Return netbsd for either. FIX? + os=netbsd + else + os=netbsdelf + fi + ;; + *) + os=netbsd + ;; + esac + # The OS release + # Debian GNU/NetBSD machines have a different userland, and + # thus, need a distinct triplet. However, they do not need + # kernel version information, so it can be replaced with a + # suitable tag, in the style of linux-gnu. + case "${UNAME_VERSION}" in + Debian*) + release='-gnu' + ;; + *) + release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` + ;; + esac + # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM: + # contains redundant information, the shorter form: + # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used. + echo "${machine}-${os}${release}" + exit ;; + *:OpenBSD:*:*) + UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'` + echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE} + exit ;; + *:ekkoBSD:*:*) + echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE} + exit ;; + *:SolidBSD:*:*) + echo ${UNAME_MACHINE}-unknown-solidbsd${UNAME_RELEASE} + exit ;; + macppc:MirBSD:*:*) + echo powerpc-unknown-mirbsd${UNAME_RELEASE} + exit ;; + *:MirBSD:*:*) + echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE} + exit ;; + alpha:OSF1:*:*) + case $UNAME_RELEASE in + *4.0) + UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'` + ;; + *5.*) + UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'` + ;; + esac + # According to Compaq, /usr/sbin/psrinfo has been available on + # OSF/1 and Tru64 systems produced since 1995. I hope that + # covers most systems running today. This code pipes the CPU + # types through head -n 1, so we only detect the type of CPU 0. + ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^ The alpha \(.*\) processor.*$/\1/p' | head -n 1` + case "$ALPHA_CPU_TYPE" in + "EV4 (21064)") + UNAME_MACHINE="alpha" ;; + "EV4.5 (21064)") + UNAME_MACHINE="alpha" ;; + "LCA4 (21066/21068)") + UNAME_MACHINE="alpha" ;; + "EV5 (21164)") + UNAME_MACHINE="alphaev5" ;; + "EV5.6 (21164A)") + UNAME_MACHINE="alphaev56" ;; + "EV5.6 (21164PC)") + UNAME_MACHINE="alphapca56" ;; + "EV5.7 (21164PC)") + UNAME_MACHINE="alphapca57" ;; + "EV6 (21264)") + UNAME_MACHINE="alphaev6" ;; + "EV6.7 (21264A)") + UNAME_MACHINE="alphaev67" ;; + "EV6.8CB (21264C)") + UNAME_MACHINE="alphaev68" ;; + "EV6.8AL (21264B)") + UNAME_MACHINE="alphaev68" ;; + "EV6.8CX (21264D)") + UNAME_MACHINE="alphaev68" ;; + "EV6.9A (21264/EV69A)") + UNAME_MACHINE="alphaev69" ;; + "EV7 (21364)") + UNAME_MACHINE="alphaev7" ;; + "EV7.9 (21364A)") + UNAME_MACHINE="alphaev79" ;; + esac + # A Pn.n version is a patched version. + # A Vn.n version is a released version. + # A Tn.n version is a released field test version. + # A Xn.n version is an unreleased experimental baselevel. + # 1.2 uses "1.2" for uname -r. + echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` + exit ;; + Alpha\ *:Windows_NT*:*) + # How do we know it's Interix rather than the generic POSIX subsystem? + # Should we change UNAME_MACHINE based on the output of uname instead + # of the specific Alpha model? + echo alpha-pc-interix + exit ;; + 21064:Windows_NT:50:3) + echo alpha-dec-winnt3.5 + exit ;; + Amiga*:UNIX_System_V:4.0:*) + echo m68k-unknown-sysv4 + exit ;; + *:[Aa]miga[Oo][Ss]:*:*) + echo ${UNAME_MACHINE}-unknown-amigaos + exit ;; + *:[Mm]orph[Oo][Ss]:*:*) + echo ${UNAME_MACHINE}-unknown-morphos + exit ;; + *:OS/390:*:*) + echo i370-ibm-openedition + exit ;; + *:z/VM:*:*) + echo s390-ibm-zvmoe + exit ;; + *:OS400:*:*) + echo powerpc-ibm-os400 + exit ;; + arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) + echo arm-acorn-riscix${UNAME_RELEASE} + exit ;; + arm:riscos:*:*|arm:RISCOS:*:*) + echo arm-unknown-riscos + exit ;; + SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*) + echo hppa1.1-hitachi-hiuxmpp + exit ;; + Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*) + # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE. + if test "`(/bin/universe) 2>/dev/null`" = att ; then + echo pyramid-pyramid-sysv3 + else + echo pyramid-pyramid-bsd + fi + exit ;; + NILE*:*:*:dcosx) + echo pyramid-pyramid-svr4 + exit ;; + DRS?6000:unix:4.0:6*) + echo sparc-icl-nx6 + exit ;; + DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*) + case `/usr/bin/uname -p` in + sparc) echo sparc-icl-nx7; exit ;; + esac ;; + s390x:SunOS:*:*) + echo ${UNAME_MACHINE}-ibm-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit ;; + sun4H:SunOS:5.*:*) + echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit ;; + sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*) + echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit ;; + i86pc:AuroraUX:5.*:* | i86xen:AuroraUX:5.*:*) + echo i386-pc-auroraux${UNAME_RELEASE} + exit ;; + i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*) + eval $set_cc_for_build + SUN_ARCH="i386" + # If there is a compiler, see if it is configured for 64-bit objects. + # Note that the Sun cc does not turn __LP64__ into 1 like gcc does. + # This test works for both compilers. + if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then + if (echo '#ifdef __amd64'; echo IS_64BIT_ARCH; echo '#endif') | \ + (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \ + grep IS_64BIT_ARCH >/dev/null + then + SUN_ARCH="x86_64" + fi + fi + echo ${SUN_ARCH}-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit ;; + sun4*:SunOS:6*:*) + # According to config.sub, this is the proper way to canonicalize + # SunOS6. Hard to guess exactly what SunOS6 will be like, but + # it's likely to be more like Solaris than SunOS4. + echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit ;; + sun4*:SunOS:*:*) + case "`/usr/bin/arch -k`" in + Series*|S4*) + UNAME_RELEASE=`uname -v` + ;; + esac + # Japanese Language versions have a version number like `4.1.3-JL'. + echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'` + exit ;; + sun3*:SunOS:*:*) + echo m68k-sun-sunos${UNAME_RELEASE} + exit ;; + sun*:*:4.2BSD:*) + UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null` + test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3 + case "`/bin/arch`" in + sun3) + echo m68k-sun-sunos${UNAME_RELEASE} + ;; + sun4) + echo sparc-sun-sunos${UNAME_RELEASE} + ;; + esac + exit ;; + aushp:SunOS:*:*) + echo sparc-auspex-sunos${UNAME_RELEASE} + exit ;; + # The situation for MiNT is a little confusing. The machine name + # can be virtually everything (everything which is not + # "atarist" or "atariste" at least should have a processor + # > m68000). The system name ranges from "MiNT" over "FreeMiNT" + # to the lowercase version "mint" (or "freemint"). Finally + # the system name "TOS" denotes a system which is actually not + # MiNT. But MiNT is downward compatible to TOS, so this should + # be no problem. + atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*) + echo m68k-atari-mint${UNAME_RELEASE} + exit ;; + atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*) + echo m68k-atari-mint${UNAME_RELEASE} + exit ;; + *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*) + echo m68k-atari-mint${UNAME_RELEASE} + exit ;; + milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*) + echo m68k-milan-mint${UNAME_RELEASE} + exit ;; + hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*) + echo m68k-hades-mint${UNAME_RELEASE} + exit ;; + *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*) + echo m68k-unknown-mint${UNAME_RELEASE} + exit ;; + m68k:machten:*:*) + echo m68k-apple-machten${UNAME_RELEASE} + exit ;; + powerpc:machten:*:*) + echo powerpc-apple-machten${UNAME_RELEASE} + exit ;; + RISC*:Mach:*:*) + echo mips-dec-mach_bsd4.3 + exit ;; + RISC*:ULTRIX:*:*) + echo mips-dec-ultrix${UNAME_RELEASE} + exit ;; + VAX*:ULTRIX*:*:*) + echo vax-dec-ultrix${UNAME_RELEASE} + exit ;; + 2020:CLIX:*:* | 2430:CLIX:*:*) + echo clipper-intergraph-clix${UNAME_RELEASE} + exit ;; + mips:*:*:UMIPS | mips:*:*:RISCos) + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c +#ifdef __cplusplus +#include /* for printf() prototype */ + int main (int argc, char *argv[]) { +#else + int main (argc, argv) int argc; char *argv[]; { +#endif + #if defined (host_mips) && defined (MIPSEB) + #if defined (SYSTYPE_SYSV) + printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0); + #endif + #if defined (SYSTYPE_SVR4) + printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0); + #endif + #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD) + printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0); + #endif + #endif + exit (-1); + } +EOF + $CC_FOR_BUILD -o $dummy $dummy.c && + dummyarg=`echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` && + SYSTEM_NAME=`$dummy $dummyarg` && + { echo "$SYSTEM_NAME"; exit; } + echo mips-mips-riscos${UNAME_RELEASE} + exit ;; + Motorola:PowerMAX_OS:*:*) + echo powerpc-motorola-powermax + exit ;; + Motorola:*:4.3:PL8-*) + echo powerpc-harris-powermax + exit ;; + Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*) + echo powerpc-harris-powermax + exit ;; + Night_Hawk:Power_UNIX:*:*) + echo powerpc-harris-powerunix + exit ;; + m88k:CX/UX:7*:*) + echo m88k-harris-cxux7 + exit ;; + m88k:*:4*:R4*) + echo m88k-motorola-sysv4 + exit ;; + m88k:*:3*:R3*) + echo m88k-motorola-sysv3 + exit ;; + AViiON:dgux:*:*) + # DG/UX returns AViiON for all architectures + UNAME_PROCESSOR=`/usr/bin/uname -p` + if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ] + then + if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \ + [ ${TARGET_BINARY_INTERFACE}x = x ] + then + echo m88k-dg-dgux${UNAME_RELEASE} + else + echo m88k-dg-dguxbcs${UNAME_RELEASE} + fi + else + echo i586-dg-dgux${UNAME_RELEASE} + fi + exit ;; + M88*:DolphinOS:*:*) # DolphinOS (SVR3) + echo m88k-dolphin-sysv3 + exit ;; + M88*:*:R3*:*) + # Delta 88k system running SVR3 + echo m88k-motorola-sysv3 + exit ;; + XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3) + echo m88k-tektronix-sysv3 + exit ;; + Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD) + echo m68k-tektronix-bsd + exit ;; + *:IRIX*:*:*) + echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'` + exit ;; + ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX. + echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id + exit ;; # Note that: echo "'`uname -s`'" gives 'AIX ' + i*86:AIX:*:*) + echo i386-ibm-aix + exit ;; + ia64:AIX:*:*) + if [ -x /usr/bin/oslevel ] ; then + IBM_REV=`/usr/bin/oslevel` + else + IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} + fi + echo ${UNAME_MACHINE}-ibm-aix${IBM_REV} + exit ;; + *:AIX:2:3) + if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + #include + + main() + { + if (!__power_pc()) + exit(1); + puts("powerpc-ibm-aix3.2.5"); + exit(0); + } +EOF + if $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` + then + echo "$SYSTEM_NAME" + else + echo rs6000-ibm-aix3.2.5 + fi + elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then + echo rs6000-ibm-aix3.2.4 + else + echo rs6000-ibm-aix3.2 + fi + exit ;; + *:AIX:*:[456]) + IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'` + if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then + IBM_ARCH=rs6000 + else + IBM_ARCH=powerpc + fi + if [ -x /usr/bin/oslevel ] ; then + IBM_REV=`/usr/bin/oslevel` + else + IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} + fi + echo ${IBM_ARCH}-ibm-aix${IBM_REV} + exit ;; + *:AIX:*:*) + echo rs6000-ibm-aix + exit ;; + ibmrt:4.4BSD:*|romp-ibm:BSD:*) + echo romp-ibm-bsd4.4 + exit ;; + ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and + echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to + exit ;; # report: romp-ibm BSD 4.3 + *:BOSX:*:*) + echo rs6000-bull-bosx + exit ;; + DPX/2?00:B.O.S.:*:*) + echo m68k-bull-sysv3 + exit ;; + 9000/[34]??:4.3bsd:1.*:*) + echo m68k-hp-bsd + exit ;; + hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*) + echo m68k-hp-bsd4.4 + exit ;; + 9000/[34678]??:HP-UX:*:*) + HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` + case "${UNAME_MACHINE}" in + 9000/31? ) HP_ARCH=m68000 ;; + 9000/[34]?? ) HP_ARCH=m68k ;; + 9000/[678][0-9][0-9]) + if [ -x /usr/bin/getconf ]; then + sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null` + sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null` + case "${sc_cpu_version}" in + 523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0 + 528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1 + 532) # CPU_PA_RISC2_0 + case "${sc_kernel_bits}" in + 32) HP_ARCH="hppa2.0n" ;; + 64) HP_ARCH="hppa2.0w" ;; + '') HP_ARCH="hppa2.0" ;; # HP-UX 10.20 + esac ;; + esac + fi + if [ "${HP_ARCH}" = "" ]; then + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + + #define _HPUX_SOURCE + #include + #include + + int main () + { + #if defined(_SC_KERNEL_BITS) + long bits = sysconf(_SC_KERNEL_BITS); + #endif + long cpu = sysconf (_SC_CPU_VERSION); + + switch (cpu) + { + case CPU_PA_RISC1_0: puts ("hppa1.0"); break; + case CPU_PA_RISC1_1: puts ("hppa1.1"); break; + case CPU_PA_RISC2_0: + #if defined(_SC_KERNEL_BITS) + switch (bits) + { + case 64: puts ("hppa2.0w"); break; + case 32: puts ("hppa2.0n"); break; + default: puts ("hppa2.0"); break; + } break; + #else /* !defined(_SC_KERNEL_BITS) */ + puts ("hppa2.0"); break; + #endif + default: puts ("hppa1.0"); break; + } + exit (0); + } +EOF + (CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy` + test -z "$HP_ARCH" && HP_ARCH=hppa + fi ;; + esac + if [ ${HP_ARCH} = "hppa2.0w" ] + then + eval $set_cc_for_build + + # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating + # 32-bit code. hppa64-hp-hpux* has the same kernel and a compiler + # generating 64-bit code. GNU and HP use different nomenclature: + # + # $ CC_FOR_BUILD=cc ./config.guess + # => hppa2.0w-hp-hpux11.23 + # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess + # => hppa64-hp-hpux11.23 + + if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | + grep -q __LP64__ + then + HP_ARCH="hppa2.0w" + else + HP_ARCH="hppa64" + fi + fi + echo ${HP_ARCH}-hp-hpux${HPUX_REV} + exit ;; + ia64:HP-UX:*:*) + HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` + echo ia64-hp-hpux${HPUX_REV} + exit ;; + 3050*:HI-UX:*:*) + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + #include + int + main () + { + long cpu = sysconf (_SC_CPU_VERSION); + /* The order matters, because CPU_IS_HP_MC68K erroneously returns + true for CPU_PA_RISC1_0. CPU_IS_PA_RISC returns correct + results, however. */ + if (CPU_IS_PA_RISC (cpu)) + { + switch (cpu) + { + case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break; + case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break; + case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break; + default: puts ("hppa-hitachi-hiuxwe2"); break; + } + } + else if (CPU_IS_HP_MC68K (cpu)) + puts ("m68k-hitachi-hiuxwe2"); + else puts ("unknown-hitachi-hiuxwe2"); + exit (0); + } +EOF + $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` && + { echo "$SYSTEM_NAME"; exit; } + echo unknown-hitachi-hiuxwe2 + exit ;; + 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* ) + echo hppa1.1-hp-bsd + exit ;; + 9000/8??:4.3bsd:*:*) + echo hppa1.0-hp-bsd + exit ;; + *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*) + echo hppa1.0-hp-mpeix + exit ;; + hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* ) + echo hppa1.1-hp-osf + exit ;; + hp8??:OSF1:*:*) + echo hppa1.0-hp-osf + exit ;; + i*86:OSF1:*:*) + if [ -x /usr/sbin/sysversion ] ; then + echo ${UNAME_MACHINE}-unknown-osf1mk + else + echo ${UNAME_MACHINE}-unknown-osf1 + fi + exit ;; + parisc*:Lites*:*:*) + echo hppa1.1-hp-lites + exit ;; + C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*) + echo c1-convex-bsd + exit ;; + C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*) + if getsysinfo -f scalar_acc + then echo c32-convex-bsd + else echo c2-convex-bsd + fi + exit ;; + C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*) + echo c34-convex-bsd + exit ;; + C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*) + echo c38-convex-bsd + exit ;; + C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*) + echo c4-convex-bsd + exit ;; + CRAY*Y-MP:*:*:*) + echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit ;; + CRAY*[A-Z]90:*:*:*) + echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \ + | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \ + -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \ + -e 's/\.[^.]*$/.X/' + exit ;; + CRAY*TS:*:*:*) + echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit ;; + CRAY*T3E:*:*:*) + echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit ;; + CRAY*SV1:*:*:*) + echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit ;; + *:UNICOS/mp:*:*) + echo craynv-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit ;; + F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*) + FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` + FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` + FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'` + echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" + exit ;; + 5000:UNIX_System_V:4.*:*) + FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` + FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'` + echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" + exit ;; + i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*) + echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE} + exit ;; + sparc*:BSD/OS:*:*) + echo sparc-unknown-bsdi${UNAME_RELEASE} + exit ;; + *:BSD/OS:*:*) + echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE} + exit ;; + *:FreeBSD:*:*) + case ${UNAME_MACHINE} in + pc98) + echo i386-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; + amd64) + echo x86_64-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; + *) + echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; + esac + exit ;; + i*:CYGWIN*:*) + echo ${UNAME_MACHINE}-pc-cygwin + exit ;; + *:MINGW*:*) + echo ${UNAME_MACHINE}-pc-mingw32 + exit ;; + i*:windows32*:*) + # uname -m includes "-pc" on this system. + echo ${UNAME_MACHINE}-mingw32 + exit ;; + i*:PW*:*) + echo ${UNAME_MACHINE}-pc-pw32 + exit ;; + *:Interix*:*) + case ${UNAME_MACHINE} in + x86) + echo i586-pc-interix${UNAME_RELEASE} + exit ;; + authenticamd | genuineintel | EM64T) + echo x86_64-unknown-interix${UNAME_RELEASE} + exit ;; + IA64) + echo ia64-unknown-interix${UNAME_RELEASE} + exit ;; + esac ;; + [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*) + echo i${UNAME_MACHINE}-pc-mks + exit ;; + 8664:Windows_NT:*) + echo x86_64-pc-mks + exit ;; + i*:Windows_NT*:* | Pentium*:Windows_NT*:*) + # How do we know it's Interix rather than the generic POSIX subsystem? + # It also conflicts with pre-2.0 versions of AT&T UWIN. Should we + # UNAME_MACHINE based on the output of uname instead of i386? + echo i586-pc-interix + exit ;; + i*:UWIN*:*) + echo ${UNAME_MACHINE}-pc-uwin + exit ;; + amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*) + echo x86_64-unknown-cygwin + exit ;; + p*:CYGWIN*:*) + echo powerpcle-unknown-cygwin + exit ;; + prep*:SunOS:5.*:*) + echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit ;; + *:GNU:*:*) + # the GNU system + echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'` + exit ;; + *:GNU/*:*:*) + # other systems with GNU libc and userland + echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-gnu + exit ;; + i*86:Minix:*:*) + echo ${UNAME_MACHINE}-pc-minix + exit ;; + alpha:Linux:*:*) + case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in + EV5) UNAME_MACHINE=alphaev5 ;; + EV56) UNAME_MACHINE=alphaev56 ;; + PCA56) UNAME_MACHINE=alphapca56 ;; + PCA57) UNAME_MACHINE=alphapca56 ;; + EV6) UNAME_MACHINE=alphaev6 ;; + EV67) UNAME_MACHINE=alphaev67 ;; + EV68*) UNAME_MACHINE=alphaev68 ;; + esac + objdump --private-headers /bin/sh | grep -q ld.so.1 + if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi + echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC} + exit ;; + arm*:Linux:*:*) + eval $set_cc_for_build + if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \ + | grep -q __ARM_EABI__ + then + echo ${UNAME_MACHINE}-unknown-linux-gnu + else + echo ${UNAME_MACHINE}-unknown-linux-gnueabi + fi + exit ;; + avr32*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; + cris:Linux:*:*) + echo cris-axis-linux-gnu + exit ;; + crisv32:Linux:*:*) + echo crisv32-axis-linux-gnu + exit ;; + frv:Linux:*:*) + echo frv-unknown-linux-gnu + exit ;; + i*86:Linux:*:*) + LIBC=gnu + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + #ifdef __dietlibc__ + LIBC=dietlibc + #endif +EOF + eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^LIBC'` + echo "${UNAME_MACHINE}-pc-linux-${LIBC}" + exit ;; + ia64:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; + m32r*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; + m68*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; + mips:Linux:*:* | mips64:Linux:*:*) + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + #undef CPU + #undef ${UNAME_MACHINE} + #undef ${UNAME_MACHINE}el + #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) + CPU=${UNAME_MACHINE}el + #else + #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) + CPU=${UNAME_MACHINE} + #else + CPU= + #endif + #endif +EOF + eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^CPU'` + test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; } + ;; + or32:Linux:*:*) + echo or32-unknown-linux-gnu + exit ;; + padre:Linux:*:*) + echo sparc-unknown-linux-gnu + exit ;; + parisc64:Linux:*:* | hppa64:Linux:*:*) + echo hppa64-unknown-linux-gnu + exit ;; + parisc:Linux:*:* | hppa:Linux:*:*) + # Look for CPU level + case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in + PA7*) echo hppa1.1-unknown-linux-gnu ;; + PA8*) echo hppa2.0-unknown-linux-gnu ;; + *) echo hppa-unknown-linux-gnu ;; + esac + exit ;; + ppc64:Linux:*:*) + echo powerpc64-unknown-linux-gnu + exit ;; + ppc:Linux:*:*) + echo powerpc-unknown-linux-gnu + exit ;; + s390:Linux:*:* | s390x:Linux:*:*) + echo ${UNAME_MACHINE}-ibm-linux + exit ;; + sh64*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; + sh*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; + sparc:Linux:*:* | sparc64:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; + vax:Linux:*:*) + echo ${UNAME_MACHINE}-dec-linux-gnu + exit ;; + x86_64:Linux:*:*) + echo x86_64-unknown-linux-gnu + exit ;; + xtensa*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; + i*86:DYNIX/ptx:4*:*) + # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. + # earlier versions are messed up and put the nodename in both + # sysname and nodename. + echo i386-sequent-sysv4 + exit ;; + i*86:UNIX_SV:4.2MP:2.*) + # Unixware is an offshoot of SVR4, but it has its own version + # number series starting with 2... + # I am not positive that other SVR4 systems won't match this, + # I just have to hope. -- rms. + # Use sysv4.2uw... so that sysv4* matches it. + echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION} + exit ;; + i*86:OS/2:*:*) + # If we were able to find `uname', then EMX Unix compatibility + # is probably installed. + echo ${UNAME_MACHINE}-pc-os2-emx + exit ;; + i*86:XTS-300:*:STOP) + echo ${UNAME_MACHINE}-unknown-stop + exit ;; + i*86:atheos:*:*) + echo ${UNAME_MACHINE}-unknown-atheos + exit ;; + i*86:syllable:*:*) + echo ${UNAME_MACHINE}-pc-syllable + exit ;; + i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.[02]*:*) + echo i386-unknown-lynxos${UNAME_RELEASE} + exit ;; + i*86:*DOS:*:*) + echo ${UNAME_MACHINE}-pc-msdosdjgpp + exit ;; + i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*) + UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'` + if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then + echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL} + else + echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL} + fi + exit ;; + i*86:*:5:[678]*) + # UnixWare 7.x, OpenUNIX and OpenServer 6. + case `/bin/uname -X | grep "^Machine"` in + *486*) UNAME_MACHINE=i486 ;; + *Pentium) UNAME_MACHINE=i586 ;; + *Pent*|*Celeron) UNAME_MACHINE=i686 ;; + esac + echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION} + exit ;; + i*86:*:3.2:*) + if test -f /usr/options/cb.name; then + UNAME_REL=`sed -n 's/.*Version //p' /dev/null >/dev/null ; then + UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')` + (/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486 + (/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \ + && UNAME_MACHINE=i586 + (/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \ + && UNAME_MACHINE=i686 + (/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \ + && UNAME_MACHINE=i686 + echo ${UNAME_MACHINE}-pc-sco$UNAME_REL + else + echo ${UNAME_MACHINE}-pc-sysv32 + fi + exit ;; + pc:*:*:*) + # Left here for compatibility: + # uname -m prints for DJGPP always 'pc', but it prints nothing about + # the processor, so we play safe by assuming i586. + # Note: whatever this is, it MUST be the same as what config.sub + # prints for the "djgpp" host, or else GDB configury will decide that + # this is a cross-build. + echo i586-pc-msdosdjgpp + exit ;; + Intel:Mach:3*:*) + echo i386-pc-mach3 + exit ;; + paragon:*:*:*) + echo i860-intel-osf1 + exit ;; + i860:*:4.*:*) # i860-SVR4 + if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then + echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4 + else # Add other i860-SVR4 vendors below as they are discovered. + echo i860-unknown-sysv${UNAME_RELEASE} # Unknown i860-SVR4 + fi + exit ;; + mini*:CTIX:SYS*5:*) + # "miniframe" + echo m68010-convergent-sysv + exit ;; + mc68k:UNIX:SYSTEM5:3.51m) + echo m68k-convergent-sysv + exit ;; + M680?0:D-NIX:5.3:*) + echo m68k-diab-dnix + exit ;; + M68*:*:R3V[5678]*:*) + test -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;; + 3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0 | S7501*:*:4.0:3.0) + OS_REL='' + test -r /etc/.relid \ + && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` + /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ + && { echo i486-ncr-sysv4.3${OS_REL}; exit; } + /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ + && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;; + 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*) + /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ + && { echo i486-ncr-sysv4; exit; } ;; + NCR*:*:4.2:* | MPRAS*:*:4.2:*) + OS_REL='.3' + test -r /etc/.relid \ + && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` + /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ + && { echo i486-ncr-sysv4.3${OS_REL}; exit; } + /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ + && { echo i586-ncr-sysv4.3${OS_REL}; exit; } + /bin/uname -p 2>/dev/null | /bin/grep pteron >/dev/null \ + && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;; + m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*) + echo m68k-unknown-lynxos${UNAME_RELEASE} + exit ;; + mc68030:UNIX_System_V:4.*:*) + echo m68k-atari-sysv4 + exit ;; + TSUNAMI:LynxOS:2.*:*) + echo sparc-unknown-lynxos${UNAME_RELEASE} + exit ;; + rs6000:LynxOS:2.*:*) + echo rs6000-unknown-lynxos${UNAME_RELEASE} + exit ;; + PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.[02]*:*) + echo powerpc-unknown-lynxos${UNAME_RELEASE} + exit ;; + SM[BE]S:UNIX_SV:*:*) + echo mips-dde-sysv${UNAME_RELEASE} + exit ;; + RM*:ReliantUNIX-*:*:*) + echo mips-sni-sysv4 + exit ;; + RM*:SINIX-*:*:*) + echo mips-sni-sysv4 + exit ;; + *:SINIX-*:*:*) + if uname -p 2>/dev/null >/dev/null ; then + UNAME_MACHINE=`(uname -p) 2>/dev/null` + echo ${UNAME_MACHINE}-sni-sysv4 + else + echo ns32k-sni-sysv + fi + exit ;; + PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort + # says + echo i586-unisys-sysv4 + exit ;; + *:UNIX_System_V:4*:FTX*) + # From Gerald Hewes . + # How about differentiating between stratus architectures? -djm + echo hppa1.1-stratus-sysv4 + exit ;; + *:*:*:FTX*) + # From seanf@swdc.stratus.com. + echo i860-stratus-sysv4 + exit ;; + i*86:VOS:*:*) + # From Paul.Green@stratus.com. + echo ${UNAME_MACHINE}-stratus-vos + exit ;; + *:VOS:*:*) + # From Paul.Green@stratus.com. + echo hppa1.1-stratus-vos + exit ;; + mc68*:A/UX:*:*) + echo m68k-apple-aux${UNAME_RELEASE} + exit ;; + news*:NEWS-OS:6*:*) + echo mips-sony-newsos6 + exit ;; + R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*) + if [ -d /usr/nec ]; then + echo mips-nec-sysv${UNAME_RELEASE} + else + echo mips-unknown-sysv${UNAME_RELEASE} + fi + exit ;; + BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only. + echo powerpc-be-beos + exit ;; + BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only. + echo powerpc-apple-beos + exit ;; + BePC:BeOS:*:*) # BeOS running on Intel PC compatible. + echo i586-pc-beos + exit ;; + BePC:Haiku:*:*) # Haiku running on Intel PC compatible. + echo i586-pc-haiku + exit ;; + SX-4:SUPER-UX:*:*) + echo sx4-nec-superux${UNAME_RELEASE} + exit ;; + SX-5:SUPER-UX:*:*) + echo sx5-nec-superux${UNAME_RELEASE} + exit ;; + SX-6:SUPER-UX:*:*) + echo sx6-nec-superux${UNAME_RELEASE} + exit ;; + SX-7:SUPER-UX:*:*) + echo sx7-nec-superux${UNAME_RELEASE} + exit ;; + SX-8:SUPER-UX:*:*) + echo sx8-nec-superux${UNAME_RELEASE} + exit ;; + SX-8R:SUPER-UX:*:*) + echo sx8r-nec-superux${UNAME_RELEASE} + exit ;; + Power*:Rhapsody:*:*) + echo powerpc-apple-rhapsody${UNAME_RELEASE} + exit ;; + *:Rhapsody:*:*) + echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE} + exit ;; + *:Darwin:*:*) + UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown + case $UNAME_PROCESSOR in + i386) + eval $set_cc_for_build + if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then + if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \ + (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \ + grep IS_64BIT_ARCH >/dev/null + then + UNAME_PROCESSOR="x86_64" + fi + fi ;; + unknown) UNAME_PROCESSOR=powerpc ;; + esac + echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE} + exit ;; + *:procnto*:*:* | *:QNX:[0123456789]*:*) + UNAME_PROCESSOR=`uname -p` + if test "$UNAME_PROCESSOR" = "x86"; then + UNAME_PROCESSOR=i386 + UNAME_MACHINE=pc + fi + echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE} + exit ;; + *:QNX:*:4*) + echo i386-pc-qnx + exit ;; + NSE-?:NONSTOP_KERNEL:*:*) + echo nse-tandem-nsk${UNAME_RELEASE} + exit ;; + NSR-?:NONSTOP_KERNEL:*:*) + echo nsr-tandem-nsk${UNAME_RELEASE} + exit ;; + *:NonStop-UX:*:*) + echo mips-compaq-nonstopux + exit ;; + BS2000:POSIX*:*:*) + echo bs2000-siemens-sysv + exit ;; + DS/*:UNIX_System_V:*:*) + echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE} + exit ;; + *:Plan9:*:*) + # "uname -m" is not consistent, so use $cputype instead. 386 + # is converted to i386 for consistency with other x86 + # operating systems. + if test "$cputype" = "386"; then + UNAME_MACHINE=i386 + else + UNAME_MACHINE="$cputype" + fi + echo ${UNAME_MACHINE}-unknown-plan9 + exit ;; + *:TOPS-10:*:*) + echo pdp10-unknown-tops10 + exit ;; + *:TENEX:*:*) + echo pdp10-unknown-tenex + exit ;; + KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*) + echo pdp10-dec-tops20 + exit ;; + XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*) + echo pdp10-xkl-tops20 + exit ;; + *:TOPS-20:*:*) + echo pdp10-unknown-tops20 + exit ;; + *:ITS:*:*) + echo pdp10-unknown-its + exit ;; + SEI:*:*:SEIUX) + echo mips-sei-seiux${UNAME_RELEASE} + exit ;; + *:DragonFly:*:*) + echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` + exit ;; + *:*VMS:*:*) + UNAME_MACHINE=`(uname -p) 2>/dev/null` + case "${UNAME_MACHINE}" in + A*) echo alpha-dec-vms ; exit ;; + I*) echo ia64-dec-vms ; exit ;; + V*) echo vax-dec-vms ; exit ;; + esac ;; + *:XENIX:*:SysV) + echo i386-pc-xenix + exit ;; + i*86:skyos:*:*) + echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE}` | sed -e 's/ .*$//' + exit ;; + i*86:rdos:*:*) + echo ${UNAME_MACHINE}-pc-rdos + exit ;; + i*86:AROS:*:*) + echo ${UNAME_MACHINE}-pc-aros + exit ;; +esac + +#echo '(No uname command or uname output not recognized.)' 1>&2 +#echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2 + +eval $set_cc_for_build +cat >$dummy.c < +# include +#endif +main () +{ +#if defined (sony) +#if defined (MIPSEB) + /* BFD wants "bsd" instead of "newsos". Perhaps BFD should be changed, + I don't know.... */ + printf ("mips-sony-bsd\n"); exit (0); +#else +#include + printf ("m68k-sony-newsos%s\n", +#ifdef NEWSOS4 + "4" +#else + "" +#endif + ); exit (0); +#endif +#endif + +#if defined (__arm) && defined (__acorn) && defined (__unix) + printf ("arm-acorn-riscix\n"); exit (0); +#endif + +#if defined (hp300) && !defined (hpux) + printf ("m68k-hp-bsd\n"); exit (0); +#endif + +#if defined (NeXT) +#if !defined (__ARCHITECTURE__) +#define __ARCHITECTURE__ "m68k" +#endif + int version; + version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`; + if (version < 4) + printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version); + else + printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version); + exit (0); +#endif + +#if defined (MULTIMAX) || defined (n16) +#if defined (UMAXV) + printf ("ns32k-encore-sysv\n"); exit (0); +#else +#if defined (CMU) + printf ("ns32k-encore-mach\n"); exit (0); +#else + printf ("ns32k-encore-bsd\n"); exit (0); +#endif +#endif +#endif + +#if defined (__386BSD__) + printf ("i386-pc-bsd\n"); exit (0); +#endif + +#if defined (sequent) +#if defined (i386) + printf ("i386-sequent-dynix\n"); exit (0); +#endif +#if defined (ns32000) + printf ("ns32k-sequent-dynix\n"); exit (0); +#endif +#endif + +#if defined (_SEQUENT_) + struct utsname un; + + uname(&un); + + if (strncmp(un.version, "V2", 2) == 0) { + printf ("i386-sequent-ptx2\n"); exit (0); + } + if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */ + printf ("i386-sequent-ptx1\n"); exit (0); + } + printf ("i386-sequent-ptx\n"); exit (0); + +#endif + +#if defined (vax) +# if !defined (ultrix) +# include +# if defined (BSD) +# if BSD == 43 + printf ("vax-dec-bsd4.3\n"); exit (0); +# else +# if BSD == 199006 + printf ("vax-dec-bsd4.3reno\n"); exit (0); +# else + printf ("vax-dec-bsd\n"); exit (0); +# endif +# endif +# else + printf ("vax-dec-bsd\n"); exit (0); +# endif +# else + printf ("vax-dec-ultrix\n"); exit (0); +# endif +#endif + +#if defined (alliant) && defined (i860) + printf ("i860-alliant-bsd\n"); exit (0); +#endif + + exit (1); +} +EOF + +$CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && SYSTEM_NAME=`$dummy` && + { echo "$SYSTEM_NAME"; exit; } + +# Apollos put the system type in the environment. + +test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit; } + +# Convex versions that predate uname can use getsysinfo(1) + +if [ -x /usr/convex/getsysinfo ] +then + case `getsysinfo -f cpu_type` in + c1*) + echo c1-convex-bsd + exit ;; + c2*) + if getsysinfo -f scalar_acc + then echo c32-convex-bsd + else echo c2-convex-bsd + fi + exit ;; + c34*) + echo c34-convex-bsd + exit ;; + c38*) + echo c38-convex-bsd + exit ;; + c4*) + echo c4-convex-bsd + exit ;; + esac +fi + +cat >&2 < in order to provide the needed +information to handle your system. + +config.guess timestamp = $timestamp + +uname -m = `(uname -m) 2>/dev/null || echo unknown` +uname -r = `(uname -r) 2>/dev/null || echo unknown` +uname -s = `(uname -s) 2>/dev/null || echo unknown` +uname -v = `(uname -v) 2>/dev/null || echo unknown` + +/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null` +/bin/uname -X = `(/bin/uname -X) 2>/dev/null` + +hostinfo = `(hostinfo) 2>/dev/null` +/bin/universe = `(/bin/universe) 2>/dev/null` +/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null` +/bin/arch = `(/bin/arch) 2>/dev/null` +/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null` +/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null` + +UNAME_MACHINE = ${UNAME_MACHINE} +UNAME_RELEASE = ${UNAME_RELEASE} +UNAME_SYSTEM = ${UNAME_SYSTEM} +UNAME_VERSION = ${UNAME_VERSION} +EOF + +exit 1 + +# Local variables: +# eval: (add-hook 'write-file-hooks 'time-stamp) +# time-stamp-start: "timestamp='" +# time-stamp-format: "%:y-%02m-%02d" +# time-stamp-end: "'" +# End: diff --git a/mobicore/common/curl/config.sub b/mobicore/common/curl/config.sub new file mode 100644 index 0000000000000000000000000000000000000000..c2d125724c0ed2d2c6da5308c54567649554e5f3 --- /dev/null +++ b/mobicore/common/curl/config.sub @@ -0,0 +1,1714 @@ +#! /bin/sh +# Configuration validation subroutine script. +# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, +# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 +# Free Software Foundation, Inc. + +timestamp='2010-01-22' + +# This file is (in principle) common to ALL GNU software. +# The presence of a machine in this file suggests that SOME GNU software +# can handle that machine. It does not imply ALL GNU software can. +# +# This file is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA +# 02110-1301, USA. +# +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + + +# Please send patches to . Submit a context +# diff and a properly formatted GNU ChangeLog entry. +# +# Configuration subroutine to validate and canonicalize a configuration type. +# Supply the specified configuration type as an argument. +# If it is invalid, we print an error message on stderr and exit with code 1. +# Otherwise, we print the canonical config type on stdout and succeed. + +# You can get the latest version of this script from: +# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD + +# This file is supposed to be the same for all GNU packages +# and recognize all the CPU types, system types and aliases +# that are meaningful with *any* GNU software. +# Each package is responsible for reporting which valid configurations +# it does not support. The user should be able to distinguish +# a failure to support a valid configuration from a meaningless +# configuration. + +# The goal of this file is to map all the various variations of a given +# machine specification into a single specification in the form: +# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM +# or in some cases, the newer four-part form: +# CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM +# It is wrong to echo any other type of specification. + +me=`echo "$0" | sed -e 's,.*/,,'` + +usage="\ +Usage: $0 [OPTION] CPU-MFR-OPSYS + $0 [OPTION] ALIAS + +Canonicalize a configuration name. + +Operation modes: + -h, --help print this help, then exit + -t, --time-stamp print date of last modification, then exit + -v, --version print version number, then exit + +Report bugs and patches to ." + +version="\ +GNU config.sub ($timestamp) + +Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, +2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free +Software Foundation, Inc. + +This is free software; see the source for copying conditions. There is NO +warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." + +help=" +Try \`$me --help' for more information." + +# Parse command line +while test $# -gt 0 ; do + case $1 in + --time-stamp | --time* | -t ) + echo "$timestamp" ; exit ;; + --version | -v ) + echo "$version" ; exit ;; + --help | --h* | -h ) + echo "$usage"; exit ;; + -- ) # Stop option processing + shift; break ;; + - ) # Use stdin as input. + break ;; + -* ) + echo "$me: invalid option $1$help" + exit 1 ;; + + *local*) + # First pass through any local machine types. + echo $1 + exit ;; + + * ) + break ;; + esac +done + +case $# in + 0) echo "$me: missing argument$help" >&2 + exit 1;; + 1) ;; + *) echo "$me: too many arguments$help" >&2 + exit 1;; +esac + +# Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any). +# Here we must recognize all the valid KERNEL-OS combinations. +maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'` +case $maybe_os in + nto-qnx* | linux-gnu* | linux-dietlibc | linux-newlib* | linux-uclibc* | \ + uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* | \ + kopensolaris*-gnu* | \ + storm-chaos* | os2-emx* | rtmk-nova*) + os=-$maybe_os + basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'` + ;; + *) + basic_machine=`echo $1 | sed 's/-[^-]*$//'` + if [ $basic_machine != $1 ] + then os=`echo $1 | sed 's/.*-/-/'` + else os=; fi + ;; +esac + +### Let's recognize common machines as not being operating systems so +### that things like config.sub decstation-3100 work. We also +### recognize some manufacturers as not being operating systems, so we +### can provide default operating systems below. +case $os in + -sun*os*) + # Prevent following clause from handling this invalid input. + ;; + -dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \ + -att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \ + -unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \ + -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\ + -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \ + -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \ + -apple | -axis | -knuth | -cray | -microblaze) + os= + basic_machine=$1 + ;; + -bluegene*) + os=-cnk + ;; + -sim | -cisco | -oki | -wec | -winbond) + os= + basic_machine=$1 + ;; + -scout) + ;; + -wrs) + os=-vxworks + basic_machine=$1 + ;; + -chorusos*) + os=-chorusos + basic_machine=$1 + ;; + -chorusrdb) + os=-chorusrdb + basic_machine=$1 + ;; + -hiux*) + os=-hiuxwe2 + ;; + -sco6) + os=-sco5v6 + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco5) + os=-sco3.2v5 + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco4) + os=-sco3.2v4 + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco3.2.[4-9]*) + os=`echo $os | sed -e 's/sco3.2./sco3.2v/'` + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco3.2v[4-9]*) + # Don't forget version if it is 3.2v4 or newer. + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco5v6*) + # Don't forget version if it is 3.2v4 or newer. + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco*) + os=-sco3.2v2 + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -udk*) + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -isc) + os=-isc2.2 + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -clix*) + basic_machine=clipper-intergraph + ;; + -isc*) + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -lynx*) + os=-lynxos + ;; + -ptx*) + basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'` + ;; + -windowsnt*) + os=`echo $os | sed -e 's/windowsnt/winnt/'` + ;; + -psos*) + os=-psos + ;; + -mint | -mint[0-9]*) + basic_machine=m68k-atari + os=-mint + ;; +esac + +# Decode aliases for certain CPU-COMPANY combinations. +case $basic_machine in + # Recognize the basic CPU types without company name. + # Some are omitted here because they have special meanings below. + 1750a | 580 \ + | a29k \ + | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \ + | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \ + | am33_2.0 \ + | arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr | avr32 \ + | bfin \ + | c4x | clipper \ + | d10v | d30v | dlx | dsp16xx \ + | fido | fr30 | frv \ + | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ + | i370 | i860 | i960 | ia64 \ + | ip2k | iq2000 \ + | lm32 \ + | m32c | m32r | m32rle | m68000 | m68k | m88k \ + | maxq | mb | microblaze | mcore | mep | metag \ + | mips | mipsbe | mipseb | mipsel | mipsle \ + | mips16 \ + | mips64 | mips64el \ + | mips64octeon | mips64octeonel \ + | mips64orion | mips64orionel \ + | mips64r5900 | mips64r5900el \ + | mips64vr | mips64vrel \ + | mips64vr4100 | mips64vr4100el \ + | mips64vr4300 | mips64vr4300el \ + | mips64vr5000 | mips64vr5000el \ + | mips64vr5900 | mips64vr5900el \ + | mipsisa32 | mipsisa32el \ + | mipsisa32r2 | mipsisa32r2el \ + | mipsisa64 | mipsisa64el \ + | mipsisa64r2 | mipsisa64r2el \ + | mipsisa64sb1 | mipsisa64sb1el \ + | mipsisa64sr71k | mipsisa64sr71kel \ + | mipstx39 | mipstx39el \ + | mn10200 | mn10300 \ + | moxie \ + | mt \ + | msp430 \ + | nios | nios2 \ + | ns16k | ns32k \ + | or32 \ + | pdp10 | pdp11 | pj | pjl \ + | powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \ + | pyramid \ + | rx \ + | score \ + | sh | sh[1234] | sh[24]a | sh[24]aeb | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \ + | sh64 | sh64le \ + | sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \ + | sparcv8 | sparcv9 | sparcv9b | sparcv9v \ + | spu | strongarm \ + | tahoe | thumb | tic4x | tic80 | tron \ + | ubicom32 \ + | v850 | v850e \ + | we32k \ + | x86 | xc16x | xscale | xscalee[bl] | xstormy16 | xtensa \ + | z8k | z80) + basic_machine=$basic_machine-unknown + ;; + m6811 | m68hc11 | m6812 | m68hc12 | picochip) + # Motorola 68HC11/12. + basic_machine=$basic_machine-unknown + os=-none + ;; + m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k) + ;; + ms1) + basic_machine=mt-unknown + ;; + + # We use `pc' rather than `unknown' + # because (1) that's what they normally are, and + # (2) the word "unknown" tends to confuse beginning users. + i*86 | x86_64) + basic_machine=$basic_machine-pc + ;; + # Object if more than one company name word. + *-*-*) + echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 + exit 1 + ;; + # Recognize the basic CPU types with company name. + 580-* \ + | a29k-* \ + | alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \ + | alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \ + | alphapca5[67]-* | alpha64pca5[67]-* | arc-* \ + | arm-* | armbe-* | armle-* | armeb-* | armv*-* \ + | avr-* | avr32-* \ + | bfin-* | bs2000-* \ + | c[123]* | c30-* | [cjt]90-* | c4x-* | c54x-* | c55x-* | c6x-* \ + | clipper-* | craynv-* | cydra-* \ + | d10v-* | d30v-* | dlx-* \ + | elxsi-* \ + | f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \ + | h8300-* | h8500-* \ + | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \ + | i*86-* | i860-* | i960-* | ia64-* \ + | ip2k-* | iq2000-* \ + | lm32-* \ + | m32c-* | m32r-* | m32rle-* \ + | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \ + | m88110-* | m88k-* | maxq-* | mcore-* | metag-* | microblaze-* \ + | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \ + | mips16-* \ + | mips64-* | mips64el-* \ + | mips64octeon-* | mips64octeonel-* \ + | mips64orion-* | mips64orionel-* \ + | mips64r5900-* | mips64r5900el-* \ + | mips64vr-* | mips64vrel-* \ + | mips64vr4100-* | mips64vr4100el-* \ + | mips64vr4300-* | mips64vr4300el-* \ + | mips64vr5000-* | mips64vr5000el-* \ + | mips64vr5900-* | mips64vr5900el-* \ + | mipsisa32-* | mipsisa32el-* \ + | mipsisa32r2-* | mipsisa32r2el-* \ + | mipsisa64-* | mipsisa64el-* \ + | mipsisa64r2-* | mipsisa64r2el-* \ + | mipsisa64sb1-* | mipsisa64sb1el-* \ + | mipsisa64sr71k-* | mipsisa64sr71kel-* \ + | mipstx39-* | mipstx39el-* \ + | mmix-* \ + | mt-* \ + | msp430-* \ + | nios-* | nios2-* \ + | none-* | np1-* | ns16k-* | ns32k-* \ + | orion-* \ + | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \ + | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \ + | pyramid-* \ + | romp-* | rs6000-* | rx-* \ + | sh-* | sh[1234]-* | sh[24]a-* | sh[24]aeb-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \ + | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \ + | sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \ + | sparclite-* \ + | sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | strongarm-* | sv1-* | sx?-* \ + | tahoe-* | thumb-* \ + | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \ + | tile-* | tilegx-* \ + | tron-* \ + | ubicom32-* \ + | v850-* | v850e-* | vax-* \ + | we32k-* \ + | x86-* | x86_64-* | xc16x-* | xps100-* | xscale-* | xscalee[bl]-* \ + | xstormy16-* | xtensa*-* \ + | ymp-* \ + | z8k-* | z80-*) + ;; + # Recognize the basic CPU types without company name, with glob match. + xtensa*) + basic_machine=$basic_machine-unknown + ;; + # Recognize the various machine names and aliases which stand + # for a CPU type and a company and sometimes even an OS. + 386bsd) + basic_machine=i386-unknown + os=-bsd + ;; + 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc) + basic_machine=m68000-att + ;; + 3b*) + basic_machine=we32k-att + ;; + a29khif) + basic_machine=a29k-amd + os=-udi + ;; + abacus) + basic_machine=abacus-unknown + ;; + adobe68k) + basic_machine=m68010-adobe + os=-scout + ;; + alliant | fx80) + basic_machine=fx80-alliant + ;; + altos | altos3068) + basic_machine=m68k-altos + ;; + am29k) + basic_machine=a29k-none + os=-bsd + ;; + amd64) + basic_machine=x86_64-pc + ;; + amd64-*) + basic_machine=x86_64-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + amdahl) + basic_machine=580-amdahl + os=-sysv + ;; + amiga | amiga-*) + basic_machine=m68k-unknown + ;; + amigaos | amigados) + basic_machine=m68k-unknown + os=-amigaos + ;; + amigaunix | amix) + basic_machine=m68k-unknown + os=-sysv4 + ;; + apollo68) + basic_machine=m68k-apollo + os=-sysv + ;; + apollo68bsd) + basic_machine=m68k-apollo + os=-bsd + ;; + aros) + basic_machine=i386-pc + os=-aros + ;; + aux) + basic_machine=m68k-apple + os=-aux + ;; + balance) + basic_machine=ns32k-sequent + os=-dynix + ;; + blackfin) + basic_machine=bfin-unknown + os=-linux + ;; + blackfin-*) + basic_machine=bfin-`echo $basic_machine | sed 's/^[^-]*-//'` + os=-linux + ;; + bluegene*) + basic_machine=powerpc-ibm + os=-cnk + ;; + c90) + basic_machine=c90-cray + os=-unicos + ;; + cegcc) + basic_machine=arm-unknown + os=-cegcc + ;; + convex-c1) + basic_machine=c1-convex + os=-bsd + ;; + convex-c2) + basic_machine=c2-convex + os=-bsd + ;; + convex-c32) + basic_machine=c32-convex + os=-bsd + ;; + convex-c34) + basic_machine=c34-convex + os=-bsd + ;; + convex-c38) + basic_machine=c38-convex + os=-bsd + ;; + cray | j90) + basic_machine=j90-cray + os=-unicos + ;; + craynv) + basic_machine=craynv-cray + os=-unicosmp + ;; + cr16) + basic_machine=cr16-unknown + os=-elf + ;; + crds | unos) + basic_machine=m68k-crds + ;; + crisv32 | crisv32-* | etraxfs*) + basic_machine=crisv32-axis + ;; + cris | cris-* | etrax*) + basic_machine=cris-axis + ;; + crx) + basic_machine=crx-unknown + os=-elf + ;; + da30 | da30-*) + basic_machine=m68k-da30 + ;; + decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn) + basic_machine=mips-dec + ;; + decsystem10* | dec10*) + basic_machine=pdp10-dec + os=-tops10 + ;; + decsystem20* | dec20*) + basic_machine=pdp10-dec + os=-tops20 + ;; + delta | 3300 | motorola-3300 | motorola-delta \ + | 3300-motorola | delta-motorola) + basic_machine=m68k-motorola + ;; + delta88) + basic_machine=m88k-motorola + os=-sysv3 + ;; + dicos) + basic_machine=i686-pc + os=-dicos + ;; + djgpp) + basic_machine=i586-pc + os=-msdosdjgpp + ;; + dpx20 | dpx20-*) + basic_machine=rs6000-bull + os=-bosx + ;; + dpx2* | dpx2*-bull) + basic_machine=m68k-bull + os=-sysv3 + ;; + ebmon29k) + basic_machine=a29k-amd + os=-ebmon + ;; + elxsi) + basic_machine=elxsi-elxsi + os=-bsd + ;; + encore | umax | mmax) + basic_machine=ns32k-encore + ;; + es1800 | OSE68k | ose68k | ose | OSE) + basic_machine=m68k-ericsson + os=-ose + ;; + fx2800) + basic_machine=i860-alliant + ;; + genix) + basic_machine=ns32k-ns + ;; + gmicro) + basic_machine=tron-gmicro + os=-sysv + ;; + go32) + basic_machine=i386-pc + os=-go32 + ;; + h3050r* | hiux*) + basic_machine=hppa1.1-hitachi + os=-hiuxwe2 + ;; + h8300hms) + basic_machine=h8300-hitachi + os=-hms + ;; + h8300xray) + basic_machine=h8300-hitachi + os=-xray + ;; + h8500hms) + basic_machine=h8500-hitachi + os=-hms + ;; + harris) + basic_machine=m88k-harris + os=-sysv3 + ;; + hp300-*) + basic_machine=m68k-hp + ;; + hp300bsd) + basic_machine=m68k-hp + os=-bsd + ;; + hp300hpux) + basic_machine=m68k-hp + os=-hpux + ;; + hp3k9[0-9][0-9] | hp9[0-9][0-9]) + basic_machine=hppa1.0-hp + ;; + hp9k2[0-9][0-9] | hp9k31[0-9]) + basic_machine=m68000-hp + ;; + hp9k3[2-9][0-9]) + basic_machine=m68k-hp + ;; + hp9k6[0-9][0-9] | hp6[0-9][0-9]) + basic_machine=hppa1.0-hp + ;; + hp9k7[0-79][0-9] | hp7[0-79][0-9]) + basic_machine=hppa1.1-hp + ;; + hp9k78[0-9] | hp78[0-9]) + # FIXME: really hppa2.0-hp + basic_machine=hppa1.1-hp + ;; + hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893) + # FIXME: really hppa2.0-hp + basic_machine=hppa1.1-hp + ;; + hp9k8[0-9][13679] | hp8[0-9][13679]) + basic_machine=hppa1.1-hp + ;; + hp9k8[0-9][0-9] | hp8[0-9][0-9]) + basic_machine=hppa1.0-hp + ;; + hppa-next) + os=-nextstep3 + ;; + hppaosf) + basic_machine=hppa1.1-hp + os=-osf + ;; + hppro) + basic_machine=hppa1.1-hp + os=-proelf + ;; + i370-ibm* | ibm*) + basic_machine=i370-ibm + ;; +# I'm not sure what "Sysv32" means. Should this be sysv3.2? + i*86v32) + basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` + os=-sysv32 + ;; + i*86v4*) + basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` + os=-sysv4 + ;; + i*86v) + basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` + os=-sysv + ;; + i*86sol2) + basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` + os=-solaris2 + ;; + i386mach) + basic_machine=i386-mach + os=-mach + ;; + i386-vsta | vsta) + basic_machine=i386-unknown + os=-vsta + ;; + iris | iris4d) + basic_machine=mips-sgi + case $os in + -irix*) + ;; + *) + os=-irix4 + ;; + esac + ;; + isi68 | isi) + basic_machine=m68k-isi + os=-sysv + ;; + m68knommu) + basic_machine=m68k-unknown + os=-linux + ;; + m68knommu-*) + basic_machine=m68k-`echo $basic_machine | sed 's/^[^-]*-//'` + os=-linux + ;; + m88k-omron*) + basic_machine=m88k-omron + ;; + magnum | m3230) + basic_machine=mips-mips + os=-sysv + ;; + merlin) + basic_machine=ns32k-utek + os=-sysv + ;; + microblaze) + basic_machine=microblaze-xilinx + ;; + mingw32) + basic_machine=i386-pc + os=-mingw32 + ;; + mingw32ce) + basic_machine=arm-unknown + os=-mingw32ce + ;; + miniframe) + basic_machine=m68000-convergent + ;; + *mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*) + basic_machine=m68k-atari + os=-mint + ;; + mips3*-*) + basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'` + ;; + mips3*) + basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown + ;; + monitor) + basic_machine=m68k-rom68k + os=-coff + ;; + morphos) + basic_machine=powerpc-unknown + os=-morphos + ;; + msdos) + basic_machine=i386-pc + os=-msdos + ;; + ms1-*) + basic_machine=`echo $basic_machine | sed -e 's/ms1-/mt-/'` + ;; + mvs) + basic_machine=i370-ibm + os=-mvs + ;; + ncr3000) + basic_machine=i486-ncr + os=-sysv4 + ;; + netbsd386) + basic_machine=i386-unknown + os=-netbsd + ;; + netwinder) + basic_machine=armv4l-rebel + os=-linux + ;; + news | news700 | news800 | news900) + basic_machine=m68k-sony + os=-newsos + ;; + news1000) + basic_machine=m68030-sony + os=-newsos + ;; + news-3600 | risc-news) + basic_machine=mips-sony + os=-newsos + ;; + necv70) + basic_machine=v70-nec + os=-sysv + ;; + next | m*-next ) + basic_machine=m68k-next + case $os in + -nextstep* ) + ;; + -ns2*) + os=-nextstep2 + ;; + *) + os=-nextstep3 + ;; + esac + ;; + nh3000) + basic_machine=m68k-harris + os=-cxux + ;; + nh[45]000) + basic_machine=m88k-harris + os=-cxux + ;; + nindy960) + basic_machine=i960-intel + os=-nindy + ;; + mon960) + basic_machine=i960-intel + os=-mon960 + ;; + nonstopux) + basic_machine=mips-compaq + os=-nonstopux + ;; + np1) + basic_machine=np1-gould + ;; + nsr-tandem) + basic_machine=nsr-tandem + ;; + op50n-* | op60c-*) + basic_machine=hppa1.1-oki + os=-proelf + ;; + openrisc | openrisc-*) + basic_machine=or32-unknown + ;; + os400) + basic_machine=powerpc-ibm + os=-os400 + ;; + OSE68000 | ose68000) + basic_machine=m68000-ericsson + os=-ose + ;; + os68k) + basic_machine=m68k-none + os=-os68k + ;; + pa-hitachi) + basic_machine=hppa1.1-hitachi + os=-hiuxwe2 + ;; + paragon) + basic_machine=i860-intel + os=-osf + ;; + parisc) + basic_machine=hppa-unknown + os=-linux + ;; + parisc-*) + basic_machine=hppa-`echo $basic_machine | sed 's/^[^-]*-//'` + os=-linux + ;; + pbd) + basic_machine=sparc-tti + ;; + pbb) + basic_machine=m68k-tti + ;; + pc532 | pc532-*) + basic_machine=ns32k-pc532 + ;; + pc98) + basic_machine=i386-pc + ;; + pc98-*) + basic_machine=i386-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + pentium | p5 | k5 | k6 | nexgen | viac3) + basic_machine=i586-pc + ;; + pentiumpro | p6 | 6x86 | athlon | athlon_*) + basic_machine=i686-pc + ;; + pentiumii | pentium2 | pentiumiii | pentium3) + basic_machine=i686-pc + ;; + pentium4) + basic_machine=i786-pc + ;; + pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*) + basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + pentiumpro-* | p6-* | 6x86-* | athlon-*) + basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*) + basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + pentium4-*) + basic_machine=i786-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + pn) + basic_machine=pn-gould + ;; + power) basic_machine=power-ibm + ;; + ppc) basic_machine=powerpc-unknown + ;; + ppc-*) basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + ppcle | powerpclittle | ppc-le | powerpc-little) + basic_machine=powerpcle-unknown + ;; + ppcle-* | powerpclittle-*) + basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + ppc64) basic_machine=powerpc64-unknown + ;; + ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + ppc64le | powerpc64little | ppc64-le | powerpc64-little) + basic_machine=powerpc64le-unknown + ;; + ppc64le-* | powerpc64little-*) + basic_machine=powerpc64le-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + ps2) + basic_machine=i386-ibm + ;; + pw32) + basic_machine=i586-unknown + os=-pw32 + ;; + rdos) + basic_machine=i386-pc + os=-rdos + ;; + rom68k) + basic_machine=m68k-rom68k + os=-coff + ;; + rm[46]00) + basic_machine=mips-siemens + ;; + rtpc | rtpc-*) + basic_machine=romp-ibm + ;; + s390 | s390-*) + basic_machine=s390-ibm + ;; + s390x | s390x-*) + basic_machine=s390x-ibm + ;; + sa29200) + basic_machine=a29k-amd + os=-udi + ;; + sb1) + basic_machine=mipsisa64sb1-unknown + ;; + sb1el) + basic_machine=mipsisa64sb1el-unknown + ;; + sde) + basic_machine=mipsisa32-sde + os=-elf + ;; + sei) + basic_machine=mips-sei + os=-seiux + ;; + sequent) + basic_machine=i386-sequent + ;; + sh) + basic_machine=sh-hitachi + os=-hms + ;; + sh5el) + basic_machine=sh5le-unknown + ;; + sh64) + basic_machine=sh64-unknown + ;; + sparclite-wrs | simso-wrs) + basic_machine=sparclite-wrs + os=-vxworks + ;; + sps7) + basic_machine=m68k-bull + os=-sysv2 + ;; + spur) + basic_machine=spur-unknown + ;; + st2000) + basic_machine=m68k-tandem + ;; + stratus) + basic_machine=i860-stratus + os=-sysv4 + ;; + sun2) + basic_machine=m68000-sun + ;; + sun2os3) + basic_machine=m68000-sun + os=-sunos3 + ;; + sun2os4) + basic_machine=m68000-sun + os=-sunos4 + ;; + sun3os3) + basic_machine=m68k-sun + os=-sunos3 + ;; + sun3os4) + basic_machine=m68k-sun + os=-sunos4 + ;; + sun4os3) + basic_machine=sparc-sun + os=-sunos3 + ;; + sun4os4) + basic_machine=sparc-sun + os=-sunos4 + ;; + sun4sol2) + basic_machine=sparc-sun + os=-solaris2 + ;; + sun3 | sun3-*) + basic_machine=m68k-sun + ;; + sun4) + basic_machine=sparc-sun + ;; + sun386 | sun386i | roadrunner) + basic_machine=i386-sun + ;; + sv1) + basic_machine=sv1-cray + os=-unicos + ;; + symmetry) + basic_machine=i386-sequent + os=-dynix + ;; + t3e) + basic_machine=alphaev5-cray + os=-unicos + ;; + t90) + basic_machine=t90-cray + os=-unicos + ;; + tic54x | c54x*) + basic_machine=tic54x-unknown + os=-coff + ;; + tic55x | c55x*) + basic_machine=tic55x-unknown + os=-coff + ;; + tic6x | c6x*) + basic_machine=tic6x-unknown + os=-coff + ;; + # This must be matched before tile*. + tilegx*) + basic_machine=tilegx-unknown + os=-linux-gnu + ;; + tile*) + basic_machine=tile-unknown + os=-linux-gnu + ;; + tx39) + basic_machine=mipstx39-unknown + ;; + tx39el) + basic_machine=mipstx39el-unknown + ;; + toad1) + basic_machine=pdp10-xkl + os=-tops20 + ;; + tower | tower-32) + basic_machine=m68k-ncr + ;; + tpf) + basic_machine=s390x-ibm + os=-tpf + ;; + udi29k) + basic_machine=a29k-amd + os=-udi + ;; + ultra3) + basic_machine=a29k-nyu + os=-sym1 + ;; + v810 | necv810) + basic_machine=v810-nec + os=-none + ;; + vaxv) + basic_machine=vax-dec + os=-sysv + ;; + vms) + basic_machine=vax-dec + os=-vms + ;; + vpp*|vx|vx-*) + basic_machine=f301-fujitsu + ;; + vxworks960) + basic_machine=i960-wrs + os=-vxworks + ;; + vxworks68) + basic_machine=m68k-wrs + os=-vxworks + ;; + vxworks29k) + basic_machine=a29k-wrs + os=-vxworks + ;; + w65*) + basic_machine=w65-wdc + os=-none + ;; + w89k-*) + basic_machine=hppa1.1-winbond + os=-proelf + ;; + xbox) + basic_machine=i686-pc + os=-mingw32 + ;; + xps | xps100) + basic_machine=xps100-honeywell + ;; + ymp) + basic_machine=ymp-cray + os=-unicos + ;; + z8k-*-coff) + basic_machine=z8k-unknown + os=-sim + ;; + z80-*-coff) + basic_machine=z80-unknown + os=-sim + ;; + none) + basic_machine=none-none + os=-none + ;; + +# Here we handle the default manufacturer of certain CPU types. It is in +# some cases the only manufacturer, in others, it is the most popular. + w89k) + basic_machine=hppa1.1-winbond + ;; + op50n) + basic_machine=hppa1.1-oki + ;; + op60c) + basic_machine=hppa1.1-oki + ;; + romp) + basic_machine=romp-ibm + ;; + mmix) + basic_machine=mmix-knuth + ;; + rs6000) + basic_machine=rs6000-ibm + ;; + vax) + basic_machine=vax-dec + ;; + pdp10) + # there are many clones, so DEC is not a safe bet + basic_machine=pdp10-unknown + ;; + pdp11) + basic_machine=pdp11-dec + ;; + we32k) + basic_machine=we32k-att + ;; + sh[1234] | sh[24]a | sh[24]aeb | sh[34]eb | sh[1234]le | sh[23]ele) + basic_machine=sh-unknown + ;; + sparc | sparcv8 | sparcv9 | sparcv9b | sparcv9v) + basic_machine=sparc-sun + ;; + cydra) + basic_machine=cydra-cydrome + ;; + orion) + basic_machine=orion-highlevel + ;; + orion105) + basic_machine=clipper-highlevel + ;; + mac | mpw | mac-mpw) + basic_machine=m68k-apple + ;; + pmac | pmac-mpw) + basic_machine=powerpc-apple + ;; + *-unknown) + # Make sure to match an already-canonicalized machine name. + ;; + *) + echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 + exit 1 + ;; +esac + +# Here we canonicalize certain aliases for manufacturers. +case $basic_machine in + *-digital*) + basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'` + ;; + *-commodore*) + basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'` + ;; + *) + ;; +esac + +# Decode manufacturer-specific aliases for certain operating systems. + +if [ x"$os" != x"" ] +then +case $os in + # First match some system type aliases + # that might get confused with valid system types. + # -solaris* is a basic system type, with this one exception. + -auroraux) + os=-auroraux + ;; + -solaris1 | -solaris1.*) + os=`echo $os | sed -e 's|solaris1|sunos4|'` + ;; + -solaris) + os=-solaris2 + ;; + -svr4*) + os=-sysv4 + ;; + -unixware*) + os=-sysv4.2uw + ;; + -gnu/linux*) + os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'` + ;; + # First accept the basic system types. + # The portable systems comes first. + # Each alternative MUST END IN A *, to match a version number. + # -sysv* is not here because it comes later, after sysvr4. + -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \ + | -*vms* | -sco* | -esix* | -isc* | -aix* | -cnk* | -sunos | -sunos[34]*\ + | -hpux* | -unos* | -osf* | -luna* | -dgux* | -auroraux* | -solaris* \ + | -sym* | -kopensolaris* \ + | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \ + | -aos* | -aros* \ + | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \ + | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \ + | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \ + | -openbsd* | -solidbsd* \ + | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \ + | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \ + | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \ + | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ + | -chorusos* | -chorusrdb* | -cegcc* \ + | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ + | -mingw32* | -linux-gnu* | -linux-newlib* | -linux-uclibc* \ + | -uxpv* | -beos* | -mpeix* | -udk* \ + | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \ + | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \ + | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \ + | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \ + | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \ + | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \ + | -skyos* | -haiku* | -rdos* | -toppers* | -drops* | -es*) + # Remember, each alternative MUST END IN *, to match a version number. + ;; + -qnx*) + case $basic_machine in + x86-* | i*86-*) + ;; + *) + os=-nto$os + ;; + esac + ;; + -nto-qnx*) + ;; + -nto*) + os=`echo $os | sed -e 's|nto|nto-qnx|'` + ;; + -sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \ + | -windows* | -osx | -abug | -netware* | -os9* | -beos* | -haiku* \ + | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*) + ;; + -mac*) + os=`echo $os | sed -e 's|mac|macos|'` + ;; + -linux-dietlibc) + os=-linux-dietlibc + ;; + -linux*) + os=`echo $os | sed -e 's|linux|linux-gnu|'` + ;; + -sunos5*) + os=`echo $os | sed -e 's|sunos5|solaris2|'` + ;; + -sunos6*) + os=`echo $os | sed -e 's|sunos6|solaris3|'` + ;; + -opened*) + os=-openedition + ;; + -os400*) + os=-os400 + ;; + -wince*) + os=-wince + ;; + -osfrose*) + os=-osfrose + ;; + -osf*) + os=-osf + ;; + -utek*) + os=-bsd + ;; + -dynix*) + os=-bsd + ;; + -acis*) + os=-aos + ;; + -atheos*) + os=-atheos + ;; + -syllable*) + os=-syllable + ;; + -386bsd) + os=-bsd + ;; + -ctix* | -uts*) + os=-sysv + ;; + -nova*) + os=-rtmk-nova + ;; + -ns2 ) + os=-nextstep2 + ;; + -nsk*) + os=-nsk + ;; + # Preserve the version number of sinix5. + -sinix5.*) + os=`echo $os | sed -e 's|sinix|sysv|'` + ;; + -sinix*) + os=-sysv4 + ;; + -tpf*) + os=-tpf + ;; + -triton*) + os=-sysv3 + ;; + -oss*) + os=-sysv3 + ;; + -svr4) + os=-sysv4 + ;; + -svr3) + os=-sysv3 + ;; + -sysvr4) + os=-sysv4 + ;; + # This must come after -sysvr4. + -sysv*) + ;; + -ose*) + os=-ose + ;; + -es1800*) + os=-ose + ;; + -xenix) + os=-xenix + ;; + -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) + os=-mint + ;; + -aros*) + os=-aros + ;; + -kaos*) + os=-kaos + ;; + -zvmoe) + os=-zvmoe + ;; + -dicos*) + os=-dicos + ;; + -nacl*) + ;; + -none) + ;; + *) + # Get rid of the `-' at the beginning of $os. + os=`echo $os | sed 's/[^-]*-//'` + echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2 + exit 1 + ;; +esac +else + +# Here we handle the default operating systems that come with various machines. +# The value should be what the vendor currently ships out the door with their +# machine or put another way, the most popular os provided with the machine. + +# Note that if you're going to try to match "-MANUFACTURER" here (say, +# "-sun"), then you have to tell the case statement up towards the top +# that MANUFACTURER isn't an operating system. Otherwise, code above +# will signal an error saying that MANUFACTURER isn't an operating +# system, and we'll never get to this point. + +case $basic_machine in + score-*) + os=-elf + ;; + spu-*) + os=-elf + ;; + *-acorn) + os=-riscix1.2 + ;; + arm*-rebel) + os=-linux + ;; + arm*-semi) + os=-aout + ;; + c4x-* | tic4x-*) + os=-coff + ;; + # This must come before the *-dec entry. + pdp10-*) + os=-tops20 + ;; + pdp11-*) + os=-none + ;; + *-dec | vax-*) + os=-ultrix4.2 + ;; + m68*-apollo) + os=-domain + ;; + i386-sun) + os=-sunos4.0.2 + ;; + m68000-sun) + os=-sunos3 + # This also exists in the configure program, but was not the + # default. + # os=-sunos4 + ;; + m68*-cisco) + os=-aout + ;; + mep-*) + os=-elf + ;; + mips*-cisco) + os=-elf + ;; + mips*-*) + os=-elf + ;; + or32-*) + os=-coff + ;; + *-tti) # must be before sparc entry or we get the wrong os. + os=-sysv3 + ;; + sparc-* | *-sun) + os=-sunos4.1.1 + ;; + *-be) + os=-beos + ;; + *-haiku) + os=-haiku + ;; + *-ibm) + os=-aix + ;; + *-knuth) + os=-mmixware + ;; + *-wec) + os=-proelf + ;; + *-winbond) + os=-proelf + ;; + *-oki) + os=-proelf + ;; + *-hp) + os=-hpux + ;; + *-hitachi) + os=-hiux + ;; + i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent) + os=-sysv + ;; + *-cbm) + os=-amigaos + ;; + *-dg) + os=-dgux + ;; + *-dolphin) + os=-sysv3 + ;; + m68k-ccur) + os=-rtu + ;; + m88k-omron*) + os=-luna + ;; + *-next ) + os=-nextstep + ;; + *-sequent) + os=-ptx + ;; + *-crds) + os=-unos + ;; + *-ns) + os=-genix + ;; + i370-*) + os=-mvs + ;; + *-next) + os=-nextstep3 + ;; + *-gould) + os=-sysv + ;; + *-highlevel) + os=-bsd + ;; + *-encore) + os=-bsd + ;; + *-sgi) + os=-irix + ;; + *-siemens) + os=-sysv4 + ;; + *-masscomp) + os=-rtu + ;; + f30[01]-fujitsu | f700-fujitsu) + os=-uxpv + ;; + *-rom68k) + os=-coff + ;; + *-*bug) + os=-coff + ;; + *-apple) + os=-macos + ;; + *-atari*) + os=-mint + ;; + *) + os=-none + ;; +esac +fi + +# Here we handle the case where we know the os, and the CPU type, but not the +# manufacturer. We pick the logical manufacturer. +vendor=unknown +case $basic_machine in + *-unknown) + case $os in + -riscix*) + vendor=acorn + ;; + -sunos*) + vendor=sun + ;; + -cnk*|-aix*) + vendor=ibm + ;; + -beos*) + vendor=be + ;; + -hpux*) + vendor=hp + ;; + -mpeix*) + vendor=hp + ;; + -hiux*) + vendor=hitachi + ;; + -unos*) + vendor=crds + ;; + -dgux*) + vendor=dg + ;; + -luna*) + vendor=omron + ;; + -genix*) + vendor=ns + ;; + -mvs* | -opened*) + vendor=ibm + ;; + -os400*) + vendor=ibm + ;; + -ptx*) + vendor=sequent + ;; + -tpf*) + vendor=ibm + ;; + -vxsim* | -vxworks* | -windiss*) + vendor=wrs + ;; + -aux*) + vendor=apple + ;; + -hms*) + vendor=hitachi + ;; + -mpw* | -macos*) + vendor=apple + ;; + -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) + vendor=atari + ;; + -vos*) + vendor=stratus + ;; + esac + basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"` + ;; +esac + +echo $basic_machine$os +exit + +# Local variables: +# eval: (add-hook 'write-file-hooks 'time-stamp) +# time-stamp-start: "timestamp='" +# time-stamp-format: "%:y-%02m-%02d" +# time-stamp-end: "'" +# End: diff --git a/mobicore/common/curl/configure b/mobicore/common/curl/configure new file mode 100644 index 0000000000000000000000000000000000000000..a730b0a1309b656fc28c3b282a0d35d76c1ffd9c --- /dev/null +++ b/mobicore/common/curl/configure @@ -0,0 +1,37624 @@ +#! /bin/sh +# Guess values for system-dependent variables and create Makefiles. +# Generated by GNU Autoconf 2.67 for curl -. +# +# Report bugs to . +# +# +# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, +# 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free Software +# Foundation, Inc. +# +# +# This configure script is free software; the Free Software Foundation +# gives unlimited permission to copy, distribute and modify it. +# +# Copyright (c) 1998 - 2010 Daniel Stenberg, +# This configure script may be copied, distributed and modified under the +# terms of the curl license; see COPYING for more details +## -------------------- ## +## M4sh Initialization. ## +## -------------------- ## + +# Be more Bourne compatible +DUALCASE=1; export DUALCASE # for MKS sh +if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : + emulate sh + NULLCMD=: + # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which + # is contrary to our usage. Disable this feature. + alias -g '${1+"$@"}'='"$@"' + setopt NO_GLOB_SUBST +else + case `(set -o) 2>/dev/null` in #( + *posix*) : + set -o posix ;; #( + *) : + ;; +esac +fi + + +as_nl=' +' +export as_nl +# Printing a long string crashes Solaris 7 /usr/bin/printf. +as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' +as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo +as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo +# Prefer a ksh shell builtin over an external printf program on Solaris, +# but without wasting forks for bash or zsh. +if test -z "$BASH_VERSION$ZSH_VERSION" \ + && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then + as_echo='print -r --' + as_echo_n='print -rn --' +elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then + as_echo='printf %s\n' + as_echo_n='printf %s' +else + if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then + as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' + as_echo_n='/usr/ucb/echo -n' + else + as_echo_body='eval expr "X$1" : "X\\(.*\\)"' + as_echo_n_body='eval + arg=$1; + case $arg in #( + *"$as_nl"*) + expr "X$arg" : "X\\(.*\\)$as_nl"; + arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; + esac; + expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" + ' + export as_echo_n_body + as_echo_n='sh -c $as_echo_n_body as_echo' + fi + export as_echo_body + as_echo='sh -c $as_echo_body as_echo' +fi + + + if test -z "$curl_cv_PATH_SEPARATOR"; then + if test -z "$PATH"; then + as_fn_error $? "PATH not set. Cannot continue without PATH being set." + fi + tst_dirs_col=0 + tst_save_IFS=$IFS; IFS=':' + for tst_dir in $PATH; do + IFS=$tst_save_IFS + test -d "$tst_dir" && tst_dirs_col=`expr $tst_dirs_col + 1` + done + IFS=$tst_save_IFS + tst_dirs_sem=0 + tst_save_IFS=$IFS; IFS=';' + for tst_dir in $PATH; do + IFS=$tst_save_IFS + test -d "$tst_dir" && tst_dirs_sem=`expr $tst_dirs_sem + 1` + done + IFS=$tst_save_IFS + if test $tst_dirs_sem -eq $tst_dirs_col; then + if test -z "$PATH_SEPARATOR"; then + as_fn_error $? "PATH_SEPARATOR not set. Cannot continue without it." + fi + else + if test $tst_dirs_sem -gt $tst_dirs_col; then + tst_auto_separator=';' + else + tst_auto_separator=':' + fi + if test -z "$PATH_SEPARATOR"; then + PATH_SEPARATOR="$tst_auto_separator" + fi + fi + curl_cv_PATH_SEPARATOR="$PATH_SEPARATOR" + fi + + + + + +# IFS +# We need space, tab and new line, in precisely that order. Quoting is +# there to prevent editors from complaining about space-tab. +# (If _AS_PATH_WALK were called with IFS unset, it would disable word +# splitting by setting IFS to empty value.) +IFS=" "" $as_nl" + +# Find who we are. Look in the path if we contain no directory separator. +case $0 in #(( + *[\\/]* ) as_myself=$0 ;; + *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break + done +IFS=$as_save_IFS + + ;; +esac +# We did not find ourselves, most probably we were run as `sh COMMAND' +# in which case we are not to be found in the path. +if test "x$as_myself" = x; then + as_myself=$0 +fi +if test ! -f "$as_myself"; then + $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 + exit 1 +fi + +# Unset variables that we do not need and which cause bugs (e.g. in +# pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1" +# suppresses any "Segmentation fault" message there. '((' could +# trigger a bug in pdksh 5.2.14. +for as_var in BASH_ENV ENV MAIL MAILPATH +do eval test x\${$as_var+set} = xset \ + && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : +done +PS1='$ ' +PS2='> ' +PS4='+ ' + +# NLS nuisances. +LC_ALL=C +export LC_ALL +LANGUAGE=C +export LANGUAGE + +# CDPATH. +(unset CDPATH) >/dev/null 2>&1 && unset CDPATH + +if test "x$CONFIG_SHELL" = x; then + as_bourne_compatible="if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then : + emulate sh + NULLCMD=: + # Pre-4.2 versions of Zsh do word splitting on \${1+\"\$@\"}, which + # is contrary to our usage. Disable this feature. + alias -g '\${1+\"\$@\"}'='\"\$@\"' + setopt NO_GLOB_SUBST +else + case \`(set -o) 2>/dev/null\` in #( + *posix*) : + set -o posix ;; #( + *) : + ;; +esac +fi +" + as_required="as_fn_return () { (exit \$1); } +as_fn_success () { as_fn_return 0; } +as_fn_failure () { as_fn_return 1; } +as_fn_ret_success () { return 0; } +as_fn_ret_failure () { return 1; } + +exitcode=0 +as_fn_success || { exitcode=1; echo as_fn_success failed.; } +as_fn_failure && { exitcode=1; echo as_fn_failure succeeded.; } +as_fn_ret_success || { exitcode=1; echo as_fn_ret_success failed.; } +as_fn_ret_failure && { exitcode=1; echo as_fn_ret_failure succeeded.; } +if ( set x; as_fn_ret_success y && test x = \"\$1\" ); then : + +else + exitcode=1; echo positional parameters were not saved. +fi +test x\$exitcode = x0 || exit 1" + as_suggested=" as_lineno_1=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_1a=\$LINENO + as_lineno_2=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_2a=\$LINENO + eval 'test \"x\$as_lineno_1'\$as_run'\" != \"x\$as_lineno_2'\$as_run'\" && + test \"x\`expr \$as_lineno_1'\$as_run' + 1\`\" = \"x\$as_lineno_2'\$as_run'\"' || exit 1 +test \$(( 1 + 1 )) = 2 || exit 1" + if (eval "$as_required") 2>/dev/null; then : + as_have_required=yes +else + as_have_required=no +fi + if test x$as_have_required = xyes && (eval "$as_suggested") 2>/dev/null; then : + +else + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +as_found=false +for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + as_found=: + case $as_dir in #( + /*) + for as_base in sh bash ksh sh5; do + # Try only shells that exist, to save several forks. + as_shell=$as_dir/$as_base + if { test -f "$as_shell" || test -f "$as_shell.exe"; } && + { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$as_shell"; } 2>/dev/null; then : + CONFIG_SHELL=$as_shell as_have_required=yes + if { $as_echo "$as_bourne_compatible""$as_suggested" | as_run=a "$as_shell"; } 2>/dev/null; then : + break 2 +fi +fi + done;; + esac + as_found=false +done +$as_found || { if { test -f "$SHELL" || test -f "$SHELL.exe"; } && + { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$SHELL"; } 2>/dev/null; then : + CONFIG_SHELL=$SHELL as_have_required=yes +fi; } +IFS=$as_save_IFS + + + if test "x$CONFIG_SHELL" != x; then : + # We cannot yet assume a decent shell, so we have to provide a + # neutralization value for shells without unset; and this also + # works around shells that cannot unset nonexistent variables. + BASH_ENV=/dev/null + ENV=/dev/null + (unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV + export CONFIG_SHELL + exec "$CONFIG_SHELL" "$as_myself" ${1+"$@"} +fi + + if test x$as_have_required = xno; then : + $as_echo "$0: This script requires a shell more modern than all" + $as_echo "$0: the shells that I found on your system." + if test x${ZSH_VERSION+set} = xset ; then + $as_echo "$0: In particular, zsh $ZSH_VERSION has bugs and should" + $as_echo "$0: be upgraded to zsh 4.3.4 or later." + else + $as_echo "$0: Please tell bug-autoconf@gnu.org and a suitable curl +$0: mailing list: http://curl.haxx.se/mail/ about your +$0: system, including any error possibly output before this +$0: message. Then install a modern shell, or manually run +$0: the script under such a shell if you do have one." + fi + exit 1 +fi +fi +fi +SHELL=${CONFIG_SHELL-/bin/sh} +export SHELL +# Unset more variables known to interfere with behavior of common tools. +CLICOLOR_FORCE= GREP_OPTIONS= +unset CLICOLOR_FORCE GREP_OPTIONS + +## --------------------- ## +## M4sh Shell Functions. ## +## --------------------- ## +# as_fn_unset VAR +# --------------- +# Portably unset VAR. +as_fn_unset () +{ + { eval $1=; unset $1;} +} +as_unset=as_fn_unset + +# as_fn_set_status STATUS +# ----------------------- +# Set $? to STATUS, without forking. +as_fn_set_status () +{ + return $1 +} # as_fn_set_status + +# as_fn_exit STATUS +# ----------------- +# Exit the shell with STATUS, even in a "trap 0" or "set -e" context. +as_fn_exit () +{ + set +e + as_fn_set_status $1 + exit $1 +} # as_fn_exit + +# as_fn_mkdir_p +# ------------- +# Create "$as_dir" as a directory, including parents if necessary. +as_fn_mkdir_p () +{ + + case $as_dir in #( + -*) as_dir=./$as_dir;; + esac + test -d "$as_dir" || eval $as_mkdir_p || { + as_dirs= + while :; do + case $as_dir in #( + *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( + *) as_qdir=$as_dir;; + esac + as_dirs="'$as_qdir' $as_dirs" + as_dir=`$as_dirname -- "$as_dir" || +$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$as_dir" : 'X\(//\)[^/]' \| \ + X"$as_dir" : 'X\(//\)$' \| \ + X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X"$as_dir" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + test -d "$as_dir" && break + done + test -z "$as_dirs" || eval "mkdir $as_dirs" + } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir" + + +} # as_fn_mkdir_p +# as_fn_append VAR VALUE +# ---------------------- +# Append the text in VALUE to the end of the definition contained in VAR. Take +# advantage of any shell optimizations that allow amortized linear growth over +# repeated appends, instead of the typical quadratic growth present in naive +# implementations. +if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then : + eval 'as_fn_append () + { + eval $1+=\$2 + }' +else + as_fn_append () + { + eval $1=\$$1\$2 + } +fi # as_fn_append + +# as_fn_arith ARG... +# ------------------ +# Perform arithmetic evaluation on the ARGs, and store the result in the +# global $as_val. Take advantage of shells that can avoid forks. The arguments +# must be portable across $(()) and expr. +if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then : + eval 'as_fn_arith () + { + as_val=$(( $* )) + }' +else + as_fn_arith () + { + as_val=`expr "$@" || test $? -eq 1` + } +fi # as_fn_arith + + +# as_fn_error STATUS ERROR [LINENO LOG_FD] +# ---------------------------------------- +# Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are +# provided, also output the error to LOG_FD, referencing LINENO. Then exit the +# script with STATUS, using 1 if that was 0. +as_fn_error () +{ + as_status=$1; test $as_status -eq 0 && as_status=1 + if test "$4"; then + as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 + fi + $as_echo "$as_me: error: $2" >&2 + as_fn_exit $as_status +} # as_fn_error + +if expr a : '\(a\)' >/dev/null 2>&1 && + test "X`expr 00001 : '.*\(...\)'`" = X001; then + as_expr=expr +else + as_expr=false +fi + +if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then + as_basename=basename +else + as_basename=false +fi + +if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then + as_dirname=dirname +else + as_dirname=false +fi + +as_me=`$as_basename -- "$0" || +$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ + X"$0" : 'X\(//\)$' \| \ + X"$0" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X/"$0" | + sed '/^.*\/\([^/][^/]*\)\/*$/{ + s//\1/ + q + } + /^X\/\(\/\/\)$/{ + s//\1/ + q + } + /^X\/\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + +# Avoid depending upon Character Ranges. +as_cr_letters='abcdefghijklmnopqrstuvwxyz' +as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' +as_cr_Letters=$as_cr_letters$as_cr_LETTERS +as_cr_digits='0123456789' +as_cr_alnum=$as_cr_Letters$as_cr_digits + + + as_lineno_1=$LINENO as_lineno_1a=$LINENO + as_lineno_2=$LINENO as_lineno_2a=$LINENO + eval 'test "x$as_lineno_1'$as_run'" != "x$as_lineno_2'$as_run'" && + test "x`expr $as_lineno_1'$as_run' + 1`" = "x$as_lineno_2'$as_run'"' || { + # Blame Lee E. McMahon (1931-1989) for sed's syntax. :-) + sed -n ' + p + /[$]LINENO/= + ' <$as_myself | + sed ' + s/[$]LINENO.*/&-/ + t lineno + b + :lineno + N + :loop + s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/ + t loop + s/-\n.*// + ' >$as_me.lineno && + chmod +x "$as_me.lineno" || + { $as_echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2; as_fn_exit 1; } + + # Don't try to exec as it changes $[0], causing all sort of problems + # (the dirname of $[0] is not the place where we might find the + # original and so on. Autoconf is especially sensitive to this). + . "./$as_me.lineno" + # Exit status is that of the last command. + exit +} + +ECHO_C= ECHO_N= ECHO_T= +case `echo -n x` in #((((( +-n*) + case `echo 'xy\c'` in + *c*) ECHO_T=' ';; # ECHO_T is single tab character. + xy) ECHO_C='\c';; + *) echo `echo ksh88 bug on AIX 6.1` > /dev/null + ECHO_T=' ';; + esac;; +*) + ECHO_N='-n';; +esac + +rm -f conf$$ conf$$.exe conf$$.file +if test -d conf$$.dir; then + rm -f conf$$.dir/conf$$.file +else + rm -f conf$$.dir + mkdir conf$$.dir 2>/dev/null +fi +if (echo >conf$$.file) 2>/dev/null; then + if ln -s conf$$.file conf$$ 2>/dev/null; then + as_ln_s='ln -s' + # ... but there are two gotchas: + # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. + # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. + # In both cases, we have to default to `cp -p'. + ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || + as_ln_s='cp -p' + elif ln conf$$.file conf$$ 2>/dev/null; then + as_ln_s=ln + else + as_ln_s='cp -p' + fi +else + as_ln_s='cp -p' +fi +rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file +rmdir conf$$.dir 2>/dev/null + +if mkdir -p . 2>/dev/null; then + as_mkdir_p='mkdir -p "$as_dir"' +else + test -d ./-p && rmdir ./-p + as_mkdir_p=false +fi + +if test -x / >/dev/null 2>&1; then + as_test_x='test -x' +else + if ls -dL / >/dev/null 2>&1; then + as_ls_L_option=L + else + as_ls_L_option= + fi + as_test_x=' + eval sh -c '\'' + if test -d "$1"; then + test -d "$1/."; + else + case $1 in #( + -*)set "./$1";; + esac; + case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in #(( + ???[sx]*):;;*)false;;esac;fi + '\'' sh + ' +fi +as_executable_p=$as_test_x + +# Sed expression to map a string onto a valid CPP name. +as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" + +# Sed expression to map a string onto a valid variable name. +as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" + + + +# Check that we are running under the correct shell. +SHELL=${CONFIG_SHELL-/bin/sh} + +case X$lt_ECHO in +X*--fallback-echo) + # Remove one level of quotation (which was required for Make). + ECHO=`echo "$lt_ECHO" | sed 's,\\\\\$\\$0,'$0','` + ;; +esac + +ECHO=${lt_ECHO-echo} +if test "X$1" = X--no-reexec; then + # Discard the --no-reexec flag, and continue. + shift +elif test "X$1" = X--fallback-echo; then + # Avoid inline document here, it may be left over + : +elif test "X`{ $ECHO '\t'; } 2>/dev/null`" = 'X\t' ; then + # Yippee, $ECHO works! + : +else + # Restart under the correct shell. + exec $SHELL "$0" --no-reexec ${1+"$@"} +fi + +if test "X$1" = X--fallback-echo; then + # used as fallback echo + shift + cat <<_LT_EOF +$* +_LT_EOF + exit 0 +fi + +# The HP-UX ksh and POSIX shell print the target directory to stdout +# if CDPATH is set. +(unset CDPATH) >/dev/null 2>&1 && unset CDPATH + +if test -z "$lt_ECHO"; then + if test "X${echo_test_string+set}" != Xset; then + # find a string as large as possible, as long as the shell can cope with it + for cmd in 'sed 50q "$0"' 'sed 20q "$0"' 'sed 10q "$0"' 'sed 2q "$0"' 'echo test'; do + # expected sizes: less than 2Kb, 1Kb, 512 bytes, 16 bytes, ... + if { echo_test_string=`eval $cmd`; } 2>/dev/null && + { test "X$echo_test_string" = "X$echo_test_string"; } 2>/dev/null + then + break + fi + done + fi + + if test "X`{ $ECHO '\t'; } 2>/dev/null`" = 'X\t' && + echo_testing_string=`{ $ECHO "$echo_test_string"; } 2>/dev/null` && + test "X$echo_testing_string" = "X$echo_test_string"; then + : + else + # The Solaris, AIX, and Digital Unix default echo programs unquote + # backslashes. This makes it impossible to quote backslashes using + # echo "$something" | sed 's/\\/\\\\/g' + # + # So, first we look for a working echo in the user's PATH. + + lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR + for dir in $PATH /usr/ucb; do + IFS="$lt_save_ifs" + if (test -f $dir/echo || test -f $dir/echo$ac_exeext) && + test "X`($dir/echo '\t') 2>/dev/null`" = 'X\t' && + echo_testing_string=`($dir/echo "$echo_test_string") 2>/dev/null` && + test "X$echo_testing_string" = "X$echo_test_string"; then + ECHO="$dir/echo" + break + fi + done + IFS="$lt_save_ifs" + + if test "X$ECHO" = Xecho; then + # We didn't find a better echo, so look for alternatives. + if test "X`{ print -r '\t'; } 2>/dev/null`" = 'X\t' && + echo_testing_string=`{ print -r "$echo_test_string"; } 2>/dev/null` && + test "X$echo_testing_string" = "X$echo_test_string"; then + # This shell has a builtin print -r that does the trick. + ECHO='print -r' + elif { test -f /bin/ksh || test -f /bin/ksh$ac_exeext; } && + test "X$CONFIG_SHELL" != X/bin/ksh; then + # If we have ksh, try running configure again with it. + ORIGINAL_CONFIG_SHELL=${CONFIG_SHELL-/bin/sh} + export ORIGINAL_CONFIG_SHELL + CONFIG_SHELL=/bin/ksh + export CONFIG_SHELL + exec $CONFIG_SHELL "$0" --no-reexec ${1+"$@"} + else + # Try using printf. + ECHO='printf %s\n' + if test "X`{ $ECHO '\t'; } 2>/dev/null`" = 'X\t' && + echo_testing_string=`{ $ECHO "$echo_test_string"; } 2>/dev/null` && + test "X$echo_testing_string" = "X$echo_test_string"; then + # Cool, printf works + : + elif echo_testing_string=`($ORIGINAL_CONFIG_SHELL "$0" --fallback-echo '\t') 2>/dev/null` && + test "X$echo_testing_string" = 'X\t' && + echo_testing_string=`($ORIGINAL_CONFIG_SHELL "$0" --fallback-echo "$echo_test_string") 2>/dev/null` && + test "X$echo_testing_string" = "X$echo_test_string"; then + CONFIG_SHELL=$ORIGINAL_CONFIG_SHELL + export CONFIG_SHELL + SHELL="$CONFIG_SHELL" + export SHELL + ECHO="$CONFIG_SHELL $0 --fallback-echo" + elif echo_testing_string=`($CONFIG_SHELL "$0" --fallback-echo '\t') 2>/dev/null` && + test "X$echo_testing_string" = 'X\t' && + echo_testing_string=`($CONFIG_SHELL "$0" --fallback-echo "$echo_test_string") 2>/dev/null` && + test "X$echo_testing_string" = "X$echo_test_string"; then + ECHO="$CONFIG_SHELL $0 --fallback-echo" + else + # maybe with a smaller string... + prev=: + + for cmd in 'echo test' 'sed 2q "$0"' 'sed 10q "$0"' 'sed 20q "$0"' 'sed 50q "$0"'; do + if { test "X$echo_test_string" = "X`eval $cmd`"; } 2>/dev/null + then + break + fi + prev="$cmd" + done + + if test "$prev" != 'sed 50q "$0"'; then + echo_test_string=`eval $prev` + export echo_test_string + exec ${ORIGINAL_CONFIG_SHELL-${CONFIG_SHELL-/bin/sh}} "$0" ${1+"$@"} + else + # Oops. We lost completely, so just stick with echo. + ECHO=echo + fi + fi + fi + fi + fi +fi + +# Copy echo and quote the copy suitably for passing to libtool from +# the Makefile, instead of quoting the original, which is used later. +lt_ECHO=$ECHO +if test "X$lt_ECHO" = "X$CONFIG_SHELL $0 --fallback-echo"; then + lt_ECHO="$CONFIG_SHELL \\\$\$0 --fallback-echo" +fi + + + + +test -n "$DJDIR" || exec 7<&0 &1 + +# Name of the host. +# hostname on some systems (SVR3.2, old GNU/Linux) returns a bogus exit status, +# so uname gets run too. +ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q` + +# +# Initializations. +# +ac_default_prefix=/usr/local +ac_clean_files= +ac_config_libobj_dir=. +LIBOBJS= +cross_compiling=no +subdirs= +MFLAGS= +MAKEFLAGS= + +# Identity of this package. +PACKAGE_NAME='curl' +PACKAGE_TARNAME='curl' +PACKAGE_VERSION='-' +PACKAGE_STRING='curl -' +PACKAGE_BUGREPORT='a suitable curl mailing list: http://curl.haxx.se/mail/' +PACKAGE_URL='' + +ac_unique_file="lib/urldata.h" +# Factoring default headers for most tests. +ac_includes_default="\ +#include +#ifdef HAVE_SYS_TYPES_H +# include +#endif +#ifdef HAVE_SYS_STAT_H +# include +#endif +#ifdef STDC_HEADERS +# include +# include +#else +# ifdef HAVE_STDLIB_H +# include +# endif +#endif +#ifdef HAVE_STRING_H +# if !defined STDC_HEADERS && defined HAVE_MEMORY_H +# include +# endif +# include +#endif +#ifdef HAVE_STRINGS_H +# include +#endif +#ifdef HAVE_INTTYPES_H +# include +#endif +#ifdef HAVE_STDINT_H +# include +#endif +#ifdef HAVE_UNISTD_H +# include +#endif" + +enable_option_checking=no +ac_subst_vars='LTLIBOBJS +LIBOBJS +SUPPORT_PROTOCOLS +SUPPORT_FEATURES +ENABLE_SHARED +CROSSCOMPILING_FALSE +CROSSCOMPILING_TRUE +CURL_NETWORK_LIBS +TEST_SERVER_LIBS +CURL_LIBS +LIBCURL_LIBS +SONAME_BUMP_FALSE +SONAME_BUMP_TRUE +USE_WINDOWS_SSPI +BUILD_LIBHOSTNAME_FALSE +BUILD_LIBHOSTNAME_TRUE +USE_EMBEDDED_ARES_FALSE +USE_EMBEDDED_ARES_TRUE +USE_ARES +subdirs +USE_MANUAL_FALSE +USE_MANUAL_TRUE +MANOPT +NROFF +PERL +IPV6_ENABLED +IDN_ENABLED +USE_LIBRTMP +USE_LIBSSH2 +CURL_CA_BUNDLE +SSL_ENABLED +USE_NSS +HAVE_PK11_CREATEGENERICOBJECT +USE_POLARSSL +USE_GNUTLS +RANDOM_FILE +HAVE_LIBZ_FALSE +HAVE_LIBZ_TRUE +HAVE_LIBZ +USE_SSLEAY +PKGCONFIG +KRB4_ENABLED +USE_OPENLDAP +CURL_DISABLE_GOPHER +CURL_DISABLE_SMTP +CURL_DISABLE_IMAP +CURL_DISABLE_POP3 +CURL_DISABLE_TFTP +CURL_DISABLE_TELNET +CURL_DISABLE_DICT +CURL_DISABLE_PROXY +HAVE_LDAP_SSL +CURL_DISABLE_LDAPS +CURL_DISABLE_LDAP +CURL_DISABLE_FILE +CURL_DISABLE_FTP +CURL_DISABLE_RTSP +CURL_DISABLE_HTTP +CURLDEBUG_FALSE +CURLDEBUG_TRUE +NO_UNDEFINED_FALSE +NO_UNDEFINED_TRUE +REQUIRE_LIB_DEPS +STATICLIB_FALSE +STATICLIB_TRUE +MIMPURE_FALSE +MIMPURE_TRUE +OTOOL64 +OTOOL +LIPO +NMEDIT +DSYMUTIL +lt_ECHO +RANLIB +LN_S +NM +ac_ct_DUMPBIN +DUMPBIN +LD +FGREP +LIBTOOL +OBJDUMP +DLLTOOL +AS +CPP +am__fastdepCC_FALSE +am__fastdepCC_TRUE +CCDEPMODE +AMDEPBACKSLASH +AMDEP_FALSE +AMDEP_TRUE +am__quote +am__include +DEPDIR +OBJEXT +EXEEXT +ac_ct_CC +CPPFLAGS +LDFLAGS +CFLAGS +CC +host_os +host_vendor +host_cpu +host +build_os +build_vendor +build_cpu +build +PKGADD_VENDOR +PKGADD_NAME +PKGADD_PKG +VERSIONNUM +am__untar +am__tar +AMTAR +am__leading_dot +SET_MAKE +AWK +mkdir_p +INSTALL_STRIP_PROGRAM +STRIP +install_sh +MAKEINFO +AUTOHEADER +AUTOMAKE +AUTOCONF +ACLOCAL +VERSION +PACKAGE +CYGPATH_W +INSTALL_DATA +INSTALL_SCRIPT +INSTALL_PROGRAM +libext +AR +EGREP +GREP +SED +CURL_CFLAG_EXTRAS +CONFIGURE_OPTIONS +MAINT +MAINTAINER_MODE_FALSE +MAINTAINER_MODE_TRUE +target_alias +host_alias +build_alias +LIBS +ECHO_T +ECHO_N +ECHO_C +DEFS +mandir +localedir +libdir +psdir +pdfdir +dvidir +htmldir +infodir +docdir +oldincludedir +includedir +localstatedir +sharedstatedir +sysconfdir +datadir +datarootdir +libexecdir +sbindir +bindir +program_transform_name +prefix +exec_prefix +PACKAGE_URL +PACKAGE_BUGREPORT +PACKAGE_STRING +PACKAGE_VERSION +PACKAGE_TARNAME +PACKAGE_NAME +SHELL +PATH +PATH_SEPARATOR' +ac_subst_files='' +ac_user_opts=' +enable_option_checking +enable_maintainer_mode +enable_debug +enable_optimize +enable_warnings +enable_werror +enable_curldebug +enable_ares +enable_dependency_tracking +enable_largefile +enable_shared +enable_static +with_pic +enable_fast_install +with_gnu_ld +enable_libtool_lock +enable_http +enable_ftp +enable_file +enable_ldap +enable_ldaps +enable_rtsp +enable_proxy +enable_dict +enable_telnet +enable_tftp +enable_pop3 +enable_imap +enable_smtp +enable_gopher +enable_manual +enable_libgcc +with_ldap_lib +with_lber_lib +enable_ipv6 +with_krb4_includes +with_krb4_libs +with_krb4 +with_spnego +with_gssapi_includes +with_gssapi_libs +with_gssapi +with_ssl +with_zlib +with_egd_socket +with_random +with_gnutls +with_polarssl +with_nss +with_ca_bundle +with_ca_path +with_libssh2 +with_librtmp +with_libidn +enable_nonblocking +enable_threaded_resolver +enable_verbose +enable_sspi +enable_crypto_auth +enable_cookies +enable_hidden_symbols +enable_soname_bump +' + ac_precious_vars='build_alias +host_alias +target_alias +CC +CFLAGS +LDFLAGS +LIBS +CPPFLAGS +CPP' +ac_subdirs_all='ares' + +# Initialize some variables set by options. +ac_init_help= +ac_init_version=false +ac_unrecognized_opts= +ac_unrecognized_sep= +# The variables have the same names as the options, with +# dashes changed to underlines. +cache_file=/dev/null +exec_prefix=NONE +no_create= +no_recursion= +prefix=NONE +program_prefix=NONE +program_suffix=NONE +program_transform_name=s,x,x, +silent= +site= +srcdir= +verbose= +x_includes=NONE +x_libraries=NONE + +# Installation directory options. +# These are left unexpanded so users can "make install exec_prefix=/foo" +# and all the variables that are supposed to be based on exec_prefix +# by default will actually change. +# Use braces instead of parens because sh, perl, etc. also accept them. +# (The list follows the same order as the GNU Coding Standards.) +bindir='${exec_prefix}/bin' +sbindir='${exec_prefix}/sbin' +libexecdir='${exec_prefix}/libexec' +datarootdir='${prefix}/share' +datadir='${datarootdir}' +sysconfdir='${prefix}/etc' +sharedstatedir='${prefix}/com' +localstatedir='${prefix}/var' +includedir='${prefix}/include' +oldincludedir='/usr/include' +docdir='${datarootdir}/doc/${PACKAGE_TARNAME}' +infodir='${datarootdir}/info' +htmldir='${docdir}' +dvidir='${docdir}' +pdfdir='${docdir}' +psdir='${docdir}' +libdir='${exec_prefix}/lib' +localedir='${datarootdir}/locale' +mandir='${datarootdir}/man' + +ac_prev= +ac_dashdash= +for ac_option +do + # If the previous option needs an argument, assign it. + if test -n "$ac_prev"; then + eval $ac_prev=\$ac_option + ac_prev= + continue + fi + + case $ac_option in + *=?*) ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;; + *=) ac_optarg= ;; + *) ac_optarg=yes ;; + esac + + # Accept the important Cygnus configure options, so we can diagnose typos. + + case $ac_dashdash$ac_option in + --) + ac_dashdash=yes ;; + + -bindir | --bindir | --bindi | --bind | --bin | --bi) + ac_prev=bindir ;; + -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) + bindir=$ac_optarg ;; + + -build | --build | --buil | --bui | --bu) + ac_prev=build_alias ;; + -build=* | --build=* | --buil=* | --bui=* | --bu=*) + build_alias=$ac_optarg ;; + + -cache-file | --cache-file | --cache-fil | --cache-fi \ + | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) + ac_prev=cache_file ;; + -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ + | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) + cache_file=$ac_optarg ;; + + --config-cache | -C) + cache_file=config.cache ;; + + -datadir | --datadir | --datadi | --datad) + ac_prev=datadir ;; + -datadir=* | --datadir=* | --datadi=* | --datad=*) + datadir=$ac_optarg ;; + + -datarootdir | --datarootdir | --datarootdi | --datarootd | --dataroot \ + | --dataroo | --dataro | --datar) + ac_prev=datarootdir ;; + -datarootdir=* | --datarootdir=* | --datarootdi=* | --datarootd=* \ + | --dataroot=* | --dataroo=* | --dataro=* | --datar=*) + datarootdir=$ac_optarg ;; + + -disable-* | --disable-*) + ac_useropt=`expr "x$ac_option" : 'x-*disable-\(.*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && + as_fn_error $? "invalid feature name: $ac_useropt" + ac_useropt_orig=$ac_useropt + ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` + case $ac_user_opts in + *" +"enable_$ac_useropt" +"*) ;; + *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--disable-$ac_useropt_orig" + ac_unrecognized_sep=', ';; + esac + eval enable_$ac_useropt=no ;; + + -docdir | --docdir | --docdi | --doc | --do) + ac_prev=docdir ;; + -docdir=* | --docdir=* | --docdi=* | --doc=* | --do=*) + docdir=$ac_optarg ;; + + -dvidir | --dvidir | --dvidi | --dvid | --dvi | --dv) + ac_prev=dvidir ;; + -dvidir=* | --dvidir=* | --dvidi=* | --dvid=* | --dvi=* | --dv=*) + dvidir=$ac_optarg ;; + + -enable-* | --enable-*) + ac_useropt=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && + as_fn_error $? "invalid feature name: $ac_useropt" + ac_useropt_orig=$ac_useropt + ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` + case $ac_user_opts in + *" +"enable_$ac_useropt" +"*) ;; + *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--enable-$ac_useropt_orig" + ac_unrecognized_sep=', ';; + esac + eval enable_$ac_useropt=\$ac_optarg ;; + + -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ + | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ + | --exec | --exe | --ex) + ac_prev=exec_prefix ;; + -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ + | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ + | --exec=* | --exe=* | --ex=*) + exec_prefix=$ac_optarg ;; + + -gas | --gas | --ga | --g) + # Obsolete; use --with-gas. + with_gas=yes ;; + + -help | --help | --hel | --he | -h) + ac_init_help=long ;; + -help=r* | --help=r* | --hel=r* | --he=r* | -hr*) + ac_init_help=recursive ;; + -help=s* | --help=s* | --hel=s* | --he=s* | -hs*) + ac_init_help=short ;; + + -host | --host | --hos | --ho) + ac_prev=host_alias ;; + -host=* | --host=* | --hos=* | --ho=*) + host_alias=$ac_optarg ;; + + -htmldir | --htmldir | --htmldi | --htmld | --html | --htm | --ht) + ac_prev=htmldir ;; + -htmldir=* | --htmldir=* | --htmldi=* | --htmld=* | --html=* | --htm=* \ + | --ht=*) + htmldir=$ac_optarg ;; + + -includedir | --includedir | --includedi | --included | --include \ + | --includ | --inclu | --incl | --inc) + ac_prev=includedir ;; + -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ + | --includ=* | --inclu=* | --incl=* | --inc=*) + includedir=$ac_optarg ;; + + -infodir | --infodir | --infodi | --infod | --info | --inf) + ac_prev=infodir ;; + -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) + infodir=$ac_optarg ;; + + -libdir | --libdir | --libdi | --libd) + ac_prev=libdir ;; + -libdir=* | --libdir=* | --libdi=* | --libd=*) + libdir=$ac_optarg ;; + + -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ + | --libexe | --libex | --libe) + ac_prev=libexecdir ;; + -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ + | --libexe=* | --libex=* | --libe=*) + libexecdir=$ac_optarg ;; + + -localedir | --localedir | --localedi | --localed | --locale) + ac_prev=localedir ;; + -localedir=* | --localedir=* | --localedi=* | --localed=* | --locale=*) + localedir=$ac_optarg ;; + + -localstatedir | --localstatedir | --localstatedi | --localstated \ + | --localstate | --localstat | --localsta | --localst | --locals) + ac_prev=localstatedir ;; + -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ + | --localstate=* | --localstat=* | --localsta=* | --localst=* | --locals=*) + localstatedir=$ac_optarg ;; + + -mandir | --mandir | --mandi | --mand | --man | --ma | --m) + ac_prev=mandir ;; + -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) + mandir=$ac_optarg ;; + + -nfp | --nfp | --nf) + # Obsolete; use --without-fp. + with_fp=no ;; + + -no-create | --no-create | --no-creat | --no-crea | --no-cre \ + | --no-cr | --no-c | -n) + no_create=yes ;; + + -no-recursion | --no-recursion | --no-recursio | --no-recursi \ + | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) + no_recursion=yes ;; + + -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ + | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ + | --oldin | --oldi | --old | --ol | --o) + ac_prev=oldincludedir ;; + -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ + | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ + | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) + oldincludedir=$ac_optarg ;; + + -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) + ac_prev=prefix ;; + -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) + prefix=$ac_optarg ;; + + -program-prefix | --program-prefix | --program-prefi | --program-pref \ + | --program-pre | --program-pr | --program-p) + ac_prev=program_prefix ;; + -program-prefix=* | --program-prefix=* | --program-prefi=* \ + | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) + program_prefix=$ac_optarg ;; + + -program-suffix | --program-suffix | --program-suffi | --program-suff \ + | --program-suf | --program-su | --program-s) + ac_prev=program_suffix ;; + -program-suffix=* | --program-suffix=* | --program-suffi=* \ + | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) + program_suffix=$ac_optarg ;; + + -program-transform-name | --program-transform-name \ + | --program-transform-nam | --program-transform-na \ + | --program-transform-n | --program-transform- \ + | --program-transform | --program-transfor \ + | --program-transfo | --program-transf \ + | --program-trans | --program-tran \ + | --progr-tra | --program-tr | --program-t) + ac_prev=program_transform_name ;; + -program-transform-name=* | --program-transform-name=* \ + | --program-transform-nam=* | --program-transform-na=* \ + | --program-transform-n=* | --program-transform-=* \ + | --program-transform=* | --program-transfor=* \ + | --program-transfo=* | --program-transf=* \ + | --program-trans=* | --program-tran=* \ + | --progr-tra=* | --program-tr=* | --program-t=*) + program_transform_name=$ac_optarg ;; + + -pdfdir | --pdfdir | --pdfdi | --pdfd | --pdf | --pd) + ac_prev=pdfdir ;; + -pdfdir=* | --pdfdir=* | --pdfdi=* | --pdfd=* | --pdf=* | --pd=*) + pdfdir=$ac_optarg ;; + + -psdir | --psdir | --psdi | --psd | --ps) + ac_prev=psdir ;; + -psdir=* | --psdir=* | --psdi=* | --psd=* | --ps=*) + psdir=$ac_optarg ;; + + -q | -quiet | --quiet | --quie | --qui | --qu | --q \ + | -silent | --silent | --silen | --sile | --sil) + silent=yes ;; + + -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) + ac_prev=sbindir ;; + -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ + | --sbi=* | --sb=*) + sbindir=$ac_optarg ;; + + -sharedstatedir | --sharedstatedir | --sharedstatedi \ + | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ + | --sharedst | --shareds | --shared | --share | --shar \ + | --sha | --sh) + ac_prev=sharedstatedir ;; + -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ + | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ + | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ + | --sha=* | --sh=*) + sharedstatedir=$ac_optarg ;; + + -site | --site | --sit) + ac_prev=site ;; + -site=* | --site=* | --sit=*) + site=$ac_optarg ;; + + -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) + ac_prev=srcdir ;; + -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) + srcdir=$ac_optarg ;; + + -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ + | --syscon | --sysco | --sysc | --sys | --sy) + ac_prev=sysconfdir ;; + -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ + | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) + sysconfdir=$ac_optarg ;; + + -target | --target | --targe | --targ | --tar | --ta | --t) + ac_prev=target_alias ;; + -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) + target_alias=$ac_optarg ;; + + -v | -verbose | --verbose | --verbos | --verbo | --verb) + verbose=yes ;; + + -version | --version | --versio | --versi | --vers | -V) + ac_init_version=: ;; + + -with-* | --with-*) + ac_useropt=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && + as_fn_error $? "invalid package name: $ac_useropt" + ac_useropt_orig=$ac_useropt + ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` + case $ac_user_opts in + *" +"with_$ac_useropt" +"*) ;; + *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--with-$ac_useropt_orig" + ac_unrecognized_sep=', ';; + esac + eval with_$ac_useropt=\$ac_optarg ;; + + -without-* | --without-*) + ac_useropt=`expr "x$ac_option" : 'x-*without-\(.*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && + as_fn_error $? "invalid package name: $ac_useropt" + ac_useropt_orig=$ac_useropt + ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` + case $ac_user_opts in + *" +"with_$ac_useropt" +"*) ;; + *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--without-$ac_useropt_orig" + ac_unrecognized_sep=', ';; + esac + eval with_$ac_useropt=no ;; + + --x) + # Obsolete; use --with-x. + with_x=yes ;; + + -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ + | --x-incl | --x-inc | --x-in | --x-i) + ac_prev=x_includes ;; + -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ + | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) + x_includes=$ac_optarg ;; + + -x-libraries | --x-libraries | --x-librarie | --x-librari \ + | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) + ac_prev=x_libraries ;; + -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ + | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) + x_libraries=$ac_optarg ;; + + -*) as_fn_error $? "unrecognized option: \`$ac_option' +Try \`$0 --help' for more information" + ;; + + *=*) + ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='` + # Reject names that are not valid shell variable names. + case $ac_envvar in #( + '' | [0-9]* | *[!_$as_cr_alnum]* ) + as_fn_error $? "invalid variable name: \`$ac_envvar'" ;; + esac + eval $ac_envvar=\$ac_optarg + export $ac_envvar ;; + + *) + # FIXME: should be removed in autoconf 3.0. + $as_echo "$as_me: WARNING: you should use --build, --host, --target" >&2 + expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && + $as_echo "$as_me: WARNING: invalid host type: $ac_option" >&2 + : ${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option} + ;; + + esac +done + +if test -n "$ac_prev"; then + ac_option=--`echo $ac_prev | sed 's/_/-/g'` + as_fn_error $? "missing argument to $ac_option" +fi + +if test -n "$ac_unrecognized_opts"; then + case $enable_option_checking in + no) ;; + fatal) as_fn_error $? "unrecognized options: $ac_unrecognized_opts" ;; + *) $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2 ;; + esac +fi + +# Check all directory arguments for consistency. +for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \ + datadir sysconfdir sharedstatedir localstatedir includedir \ + oldincludedir docdir infodir htmldir dvidir pdfdir psdir \ + libdir localedir mandir +do + eval ac_val=\$$ac_var + # Remove trailing slashes. + case $ac_val in + */ ) + ac_val=`expr "X$ac_val" : 'X\(.*[^/]\)' \| "X$ac_val" : 'X\(.*\)'` + eval $ac_var=\$ac_val;; + esac + # Be sure to have absolute directory names. + case $ac_val in + [\\/$]* | ?:[\\/]* ) continue;; + NONE | '' ) case $ac_var in *prefix ) continue;; esac;; + esac + as_fn_error $? "expected an absolute directory name for --$ac_var: $ac_val" +done + +# There might be people who depend on the old broken behavior: `$host' +# used to hold the argument of --host etc. +# FIXME: To remove some day. +build=$build_alias +host=$host_alias +target=$target_alias + +# FIXME: To remove some day. +if test "x$host_alias" != x; then + if test "x$build_alias" = x; then + cross_compiling=maybe + $as_echo "$as_me: WARNING: if you wanted to set the --build type, don't use --host. + If a cross compiler is detected then cross compile mode will be used" >&2 + elif test "x$build_alias" != "x$host_alias"; then + cross_compiling=yes + fi +fi + +ac_tool_prefix= +test -n "$host_alias" && ac_tool_prefix=$host_alias- + +test "$silent" = yes && exec 6>/dev/null + + +ac_pwd=`pwd` && test -n "$ac_pwd" && +ac_ls_di=`ls -di .` && +ac_pwd_ls_di=`cd "$ac_pwd" && ls -di .` || + as_fn_error $? "working directory cannot be determined" +test "X$ac_ls_di" = "X$ac_pwd_ls_di" || + as_fn_error $? "pwd does not report name of working directory" + + +# Find the source files, if location was not specified. +if test -z "$srcdir"; then + ac_srcdir_defaulted=yes + # Try the directory containing this script, then the parent directory. + ac_confdir=`$as_dirname -- "$as_myself" || +$as_expr X"$as_myself" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$as_myself" : 'X\(//\)[^/]' \| \ + X"$as_myself" : 'X\(//\)$' \| \ + X"$as_myself" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X"$as_myself" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + srcdir=$ac_confdir + if test ! -r "$srcdir/$ac_unique_file"; then + srcdir=.. + fi +else + ac_srcdir_defaulted=no +fi +if test ! -r "$srcdir/$ac_unique_file"; then + test "$ac_srcdir_defaulted" = yes && srcdir="$ac_confdir or .." + as_fn_error $? "cannot find sources ($ac_unique_file) in $srcdir" +fi +ac_msg="sources are in $srcdir, but \`cd $srcdir' does not work" +ac_abs_confdir=`( + cd "$srcdir" && test -r "./$ac_unique_file" || as_fn_error $? "$ac_msg" + pwd)` +# When building in place, set srcdir=. +if test "$ac_abs_confdir" = "$ac_pwd"; then + srcdir=. +fi +# Remove unnecessary trailing slashes from srcdir. +# Double slashes in file names in object file debugging info +# mess up M-x gdb in Emacs. +case $srcdir in +*/) srcdir=`expr "X$srcdir" : 'X\(.*[^/]\)' \| "X$srcdir" : 'X\(.*\)'`;; +esac +for ac_var in $ac_precious_vars; do + eval ac_env_${ac_var}_set=\${${ac_var}+set} + eval ac_env_${ac_var}_value=\$${ac_var} + eval ac_cv_env_${ac_var}_set=\${${ac_var}+set} + eval ac_cv_env_${ac_var}_value=\$${ac_var} +done + +# +# Report the --help message. +# +if test "$ac_init_help" = "long"; then + # Omit some internal or obsolete options to make the list less imposing. + # This message is too long to be a string in the A/UX 3.1 sh. + cat <<_ACEOF +\`configure' configures curl - to adapt to many kinds of systems. + +Usage: $0 [OPTION]... [VAR=VALUE]... + +To assign environment variables (e.g., CC, CFLAGS...), specify them as +VAR=VALUE. See below for descriptions of some of the useful variables. + +Defaults for the options are specified in brackets. + +Configuration: + -h, --help display this help and exit + --help=short display options specific to this package + --help=recursive display the short help of all the included packages + -V, --version display version information and exit + -q, --quiet, --silent do not print \`checking ...' messages + --cache-file=FILE cache test results in FILE [disabled] + -C, --config-cache alias for \`--cache-file=config.cache' + -n, --no-create do not create output files + --srcdir=DIR find the sources in DIR [configure dir or \`..'] + +Installation directories: + --prefix=PREFIX install architecture-independent files in PREFIX + [$ac_default_prefix] + --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX + [PREFIX] + +By default, \`make install' will install all the files in +\`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify +an installation prefix other than \`$ac_default_prefix' using \`--prefix', +for instance \`--prefix=\$HOME'. + +For better control, use the options below. + +Fine tuning of the installation directories: + --bindir=DIR user executables [EPREFIX/bin] + --sbindir=DIR system admin executables [EPREFIX/sbin] + --libexecdir=DIR program executables [EPREFIX/libexec] + --sysconfdir=DIR read-only single-machine data [PREFIX/etc] + --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] + --localstatedir=DIR modifiable single-machine data [PREFIX/var] + --libdir=DIR object code libraries [EPREFIX/lib] + --includedir=DIR C header files [PREFIX/include] + --oldincludedir=DIR C header files for non-gcc [/usr/include] + --datarootdir=DIR read-only arch.-independent data root [PREFIX/share] + --datadir=DIR read-only architecture-independent data [DATAROOTDIR] + --infodir=DIR info documentation [DATAROOTDIR/info] + --localedir=DIR locale-dependent data [DATAROOTDIR/locale] + --mandir=DIR man documentation [DATAROOTDIR/man] + --docdir=DIR documentation root [DATAROOTDIR/doc/curl] + --htmldir=DIR html documentation [DOCDIR] + --dvidir=DIR dvi documentation [DOCDIR] + --pdfdir=DIR pdf documentation [DOCDIR] + --psdir=DIR ps documentation [DOCDIR] +_ACEOF + + cat <<\_ACEOF + +Program names: + --program-prefix=PREFIX prepend PREFIX to installed program names + --program-suffix=SUFFIX append SUFFIX to installed program names + --program-transform-name=PROGRAM run sed PROGRAM on installed program names + +System types: + --build=BUILD configure for building on BUILD [guessed] + --host=HOST cross-compile to build programs to run on HOST [BUILD] +_ACEOF +fi + +if test -n "$ac_init_help"; then + case $ac_init_help in + short | recursive ) echo "Configuration of curl -:";; + esac + cat <<\_ACEOF + +Optional Features: + --disable-option-checking ignore unrecognized --enable/--with options + --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) + --enable-FEATURE[=ARG] include FEATURE [ARG=yes] + --enable-maintainer-mode enable make rules and dependencies not useful + (and sometimes confusing) to the casual installer + --enable-debug Enable debug build options + --disable-debug Disable debug build options + --enable-optimize Enable compiler optimizations + --disable-optimize Disable compiler optimizations + --enable-warnings Enable strict compiler warnings + --disable-warnings Disable strict compiler warnings + --enable-werror Enable compiler warnings as errors + --disable-werror Disable compiler warnings as errors + --enable-curldebug Enable curl debug memory tracking + --disable-curldebug Disable curl debug memory tracking + --enable-ares[=PATH] Enable c-ares for DNS lookups + --disable-ares Disable c-ares for DNS lookups + --disable-dependency-tracking speeds up one-time build + --enable-dependency-tracking do not reject slow dependency extractors + --disable-largefile omit support for large files + --enable-shared[=PKGS] build shared libraries [default=yes] + --enable-static[=PKGS] build static libraries [default=yes] + --enable-fast-install[=PKGS] + optimize for fast installation [default=yes] + --disable-libtool-lock avoid locking (might break parallel builds) + --enable-http Enable HTTP support + --disable-http Disable HTTP support + --enable-ftp Enable FTP support + --disable-ftp Disable FTP support + --enable-file Enable FILE support + --disable-file Disable FILE support + --enable-ldap Enable LDAP support + --disable-ldap Disable LDAP support + --enable-ldaps Enable LDAPS support + --disable-ldaps Disable LDAPS support + --enable-rtsp Enable RTSP support + --disable-rtsp Disable RTSP support + --enable-proxy Enable proxy support + --disable-proxy Disable proxy support + --enable-dict Enable DICT support + --disable-dict Disable DICT support + --enable-telnet Enable TELNET support + --disable-telnet Disable TELNET support + --enable-tftp Enable TFTP support + --disable-tftp Disable TFTP support + --enable-pop3 Enable POP3 support + --disable-pop3 Disable POP3 support + --enable-imap Enable IMAP support + --disable-imap Disable IMAP support + --enable-smtp Enable SMTP support + --disable-smtp Disable SMTP support + --enable-gopher Enable Gopher support + --disable-gopher Disable Gopher support + --enable-manual Enable built-in manual + --disable-manual Disable built-in manual + --enable-libgcc use libgcc when linking + --enable-ipv6 Enable ipv6 (with ipv4) support + --disable-ipv6 Disable ipv6 support + --enable-nonblocking Enable non-blocking communications + --disable-nonblocking Disable non-blocking communications + --enable-threaded-resolver + Enable threaded resolver + --disable-threaded-resolver + Disable threaded resolver + --enable-verbose Enable verbose strings + --disable-verbose Disable verbose strings + --enable-sspi Enable SSPI + --disable-sspi Disable SSPI + --enable-crypto-auth Enable cryptographic authentication + --disable-crypto-auth Disable cryptographic authentication + --enable-cookies Enable cookies support + --disable-cookies Disable cookies support + --enable-hidden-symbols Hide internal symbols in library + --disable-hidden-symbols + Leave all symbols with default visibility in library + --enable-soname-bump Enable enforced SONAME bump + --disable-soname-bump Disable enforced SONAME bump + +Optional Packages: + --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] + --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) + --with-pic try to use only PIC/non-PIC objects [default=use + both] + --with-gnu-ld assume the C compiler uses GNU ld [default=no] + --with-ldap-lib=libname Specify name of ldap lib file + --with-lber-lib=libname Specify name of lber lib file + --with-krb4-includes=DIR + Specify location of kerberos4 headers + --with-krb4-libs=DIR Specify location of kerberos4 libs + --with-krb4=DIR where to look for Kerberos4 + --with-spnego=DIR Specify location of SPNEGO library fbopenssl + --with-gssapi-includes=DIR + Specify location of GSSAPI header + --with-gssapi-libs=DIR Specify location of GSSAPI libs + --with-gssapi=DIR Where to look for GSSAPI + --with-ssl=PATH Where to look for OpenSSL, PATH points to the SSL + installation (default: /usr/local/ssl); when + possible, set the PKG_CONFIG_PATH environment + variable instead of using this option + --without-ssl disable OpenSSL + --with-zlib=PATH search for zlib in PATH + --without-zlib disable use of zlib + --with-egd-socket=FILE Entropy Gathering Daemon socket pathname + --with-random=FILE read randomness from FILE (default=/dev/urandom) + --with-gnutls=PATH where to look for GnuTLS, PATH points to the + installation root (default: /usr/local/) + --without-gnutls disable GnuTLS detection + --with-polarssl=PATH where to look for PolarSSL, PATH points to the + installation root (default: /usr/local/) + --without-polarssl disable PolarSSL detection + --with-nss=PATH where to look for NSS, PATH points to the + installation root (default: /usr/local/) + --without-nss disable NSS detection + --with-ca-bundle=FILE File name to use as CA bundle + --without-ca-bundle Don't use a default CA bundle + --with-ca-path=DIRECTORY + Directory to use as CA path + --without-ca-path Don't use a default CA path + --with-libssh2=PATH Where to look for libssh2, PATH points to the + LIBSSH2 installation (default: /usr/local/lib); when + possible, set the PKG_CONFIG_PATH environment + variable instead of using this option + --without-libssh2 disable LIBSSH2 + --with-librtmp=PATH Where to look for librtmp, PATH points to the + LIBRTMP installation (default: /usr/local/lib); when + possible, set the PKG_CONFIG_PATH environment + variable instead of using this option + --without-librtmp disable LIBRTMP + --with-libidn=PATH Enable libidn usage + --without-libidn Disable libidn usage + +Some influential environment variables: + CC C compiler command + CFLAGS C compiler flags + LDFLAGS linker flags, e.g. -L if you have libraries in a + nonstandard directory + LIBS libraries to pass to the linker, e.g. -l + CPPFLAGS (Objective) C/C++ preprocessor flags, e.g. -I if + you have headers in a nonstandard directory + CPP C preprocessor + +Use these variables to override the choices made by `configure' or to help +it to find libraries and programs with nonstandard names/locations. + +Report bugs to . +_ACEOF +ac_status=$? +fi + +if test "$ac_init_help" = "recursive"; then + # If there are subdirs, report their specific --help. + for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue + test -d "$ac_dir" || + { cd "$srcdir" && ac_pwd=`pwd` && srcdir=. && test -d "$ac_dir"; } || + continue + ac_builddir=. + +case "$ac_dir" in +.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; +*) + ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` + # A ".." for each directory in $ac_dir_suffix. + ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` + case $ac_top_builddir_sub in + "") ac_top_builddir_sub=. ac_top_build_prefix= ;; + *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; + esac ;; +esac +ac_abs_top_builddir=$ac_pwd +ac_abs_builddir=$ac_pwd$ac_dir_suffix +# for backward compatibility: +ac_top_builddir=$ac_top_build_prefix + +case $srcdir in + .) # We are building in place. + ac_srcdir=. + ac_top_srcdir=$ac_top_builddir_sub + ac_abs_top_srcdir=$ac_pwd ;; + [\\/]* | ?:[\\/]* ) # Absolute name. + ac_srcdir=$srcdir$ac_dir_suffix; + ac_top_srcdir=$srcdir + ac_abs_top_srcdir=$srcdir ;; + *) # Relative name. + ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix + ac_top_srcdir=$ac_top_build_prefix$srcdir + ac_abs_top_srcdir=$ac_pwd/$srcdir ;; +esac +ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix + + cd "$ac_dir" || { ac_status=$?; continue; } + # Check for guested configure. + if test -f "$ac_srcdir/configure.gnu"; then + echo && + $SHELL "$ac_srcdir/configure.gnu" --help=recursive + elif test -f "$ac_srcdir/configure"; then + echo && + $SHELL "$ac_srcdir/configure" --help=recursive + else + $as_echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2 + fi || ac_status=$? + cd "$ac_pwd" || { ac_status=$?; break; } + done +fi + +test -n "$ac_init_help" && exit $ac_status +if $ac_init_version; then + cat <<\_ACEOF +curl configure - +generated by GNU Autoconf 2.67 + +Copyright (C) 2010 Free Software Foundation, Inc. +This configure script is free software; the Free Software Foundation +gives unlimited permission to copy, distribute and modify it. + +Copyright (c) 1998 - 2010 Daniel Stenberg, +This configure script may be copied, distributed and modified under the +terms of the curl license; see COPYING for more details +_ACEOF + exit +fi + +## ------------------------ ## +## Autoconf initialization. ## +## ------------------------ ## + +# ac_fn_c_try_compile LINENO +# -------------------------- +# Try to compile conftest.$ac_ext, and return whether this succeeded. +ac_fn_c_try_compile () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + rm -f conftest.$ac_objext + if { { ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_compile") 2>conftest.err + ac_status=$? + if test -s conftest.err; then + grep -v '^ *+' conftest.err >conftest.er1 + cat conftest.er1 >&5 + mv -f conftest.er1 conftest.err + fi + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then : + ac_retval=0 +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_retval=1 +fi + eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} + as_fn_set_status $ac_retval + +} # ac_fn_c_try_compile + +# ac_fn_c_check_header_compile LINENO HEADER VAR INCLUDES +# ------------------------------------------------------- +# Tests whether HEADER exists and can be compiled using the include files in +# INCLUDES, setting the cache variable VAR accordingly. +ac_fn_c_check_header_compile () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 +$as_echo_n "checking for $2... " >&6; } +if eval "test \"\${$3+set}\"" = set; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$4 +#include <$2> +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + eval "$3=yes" +else + eval "$3=no" +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +eval ac_res=\$$3 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } + eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} + +} # ac_fn_c_check_header_compile + +# ac_fn_c_try_run LINENO +# ---------------------- +# Try to link conftest.$ac_ext, and return whether this succeeded. Assumes +# that executables *can* be run. +ac_fn_c_try_run () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + if { { ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_link") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } && { ac_try='./conftest$ac_exeext' + { { case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; }; then : + ac_retval=0 +else + $as_echo "$as_me: program exited with status $ac_status" >&5 + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_retval=$ac_status +fi + rm -rf conftest.dSYM conftest_ipa8_conftest.oo + eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} + as_fn_set_status $ac_retval + +} # ac_fn_c_try_run + +# ac_fn_c_compute_int LINENO EXPR VAR INCLUDES +# -------------------------------------------- +# Tries to find the compile-time value of EXPR in a program that includes +# INCLUDES, setting VAR accordingly. Returns whether the value could be +# computed +ac_fn_c_compute_int () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + if test "$cross_compiling" = yes; then + # Depending upon the size, compute the lo and hi bounds. +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$4 +int main (void) +{ +static int test_array [1 - 2 * !(($2) >= 0)]; +test_array [0] = 0 + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_lo=0 ac_mid=0 + while :; do + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$4 +int main (void) +{ +static int test_array [1 - 2 * !(($2) <= $ac_mid)]; +test_array [0] = 0 + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_hi=$ac_mid; break +else + as_fn_arith $ac_mid + 1 && ac_lo=$as_val + if test $ac_lo -le $ac_mid; then + ac_lo= ac_hi= + break + fi + as_fn_arith 2 '*' $ac_mid + 1 && ac_mid=$as_val +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + done +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$4 +int main (void) +{ +static int test_array [1 - 2 * !(($2) < 0)]; +test_array [0] = 0 + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_hi=-1 ac_mid=-1 + while :; do + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$4 +int main (void) +{ +static int test_array [1 - 2 * !(($2) >= $ac_mid)]; +test_array [0] = 0 + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_lo=$ac_mid; break +else + as_fn_arith '(' $ac_mid ')' - 1 && ac_hi=$as_val + if test $ac_mid -le $ac_hi; then + ac_lo= ac_hi= + break + fi + as_fn_arith 2 '*' $ac_mid && ac_mid=$as_val +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + done +else + ac_lo= ac_hi= +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +# Binary search between lo and hi bounds. +while test "x$ac_lo" != "x$ac_hi"; do + as_fn_arith '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo && ac_mid=$as_val + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$4 +int main (void) +{ +static int test_array [1 - 2 * !(($2) <= $ac_mid)]; +test_array [0] = 0 + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_hi=$ac_mid +else + as_fn_arith '(' $ac_mid ')' + 1 && ac_lo=$as_val +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +done +case $ac_lo in #(( +?*) eval "$3=\$ac_lo"; ac_retval=0 ;; +'') ac_retval=1 ;; +esac + else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$4 +static long int longval () { return $2; } +static unsigned long int ulongval () { return $2; } +#include +#include +int main (void) +{ + + FILE *f = fopen ("conftest.val", "w"); + if (! f) + return 1; + if (($2) < 0) + { + long int i = longval (); + if (i != ($2)) + return 1; + fprintf (f, "%ld", i); + } + else + { + unsigned long int i = ulongval (); + if (i != ($2)) + return 1; + fprintf (f, "%lu", i); + } + /* Do not output a trailing newline, as this causes \r\n confusion + on some platforms. */ + return ferror (f) || fclose (f) != 0; + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_run "$LINENO"; then : + echo >>conftest.val; read $3 &5 + (eval "$ac_cpp conftest.$ac_ext") 2>conftest.err + ac_status=$? + if test -s conftest.err; then + grep -v '^ *+' conftest.err >conftest.er1 + cat conftest.er1 >&5 + mv -f conftest.er1 conftest.err + fi + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } > conftest.i && { + test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || + test ! -s conftest.err + }; then : + ac_retval=0 +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_retval=1 +fi + eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} + as_fn_set_status $ac_retval + +} # ac_fn_c_try_cpp + +# ac_fn_c_try_link LINENO +# ----------------------- +# Try to link conftest.$ac_ext, and return whether this succeeded. +ac_fn_c_try_link () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + rm -f conftest.$ac_objext conftest$ac_exeext + if { { ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_link") 2>conftest.err + ac_status=$? + if test -s conftest.err; then + grep -v '^ *+' conftest.err >conftest.er1 + cat conftest.er1 >&5 + mv -f conftest.er1 conftest.err + fi + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && { + test "$cross_compiling" = yes || + $as_test_x conftest$ac_exeext + }; then : + ac_retval=0 +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_retval=1 +fi + # Delete the IPA/IPO (Inter Procedural Analysis/Optimization) information + # created by the PGI compiler (conftest_ipa8_conftest.oo), as it would + # interfere with the next link command; also delete a directory that is + # left behind by Apple's compiler. We do this before executing the actions. + rm -rf conftest.dSYM conftest_ipa8_conftest.oo + eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} + as_fn_set_status $ac_retval + +} # ac_fn_c_try_link + +# ac_fn_c_check_func LINENO FUNC VAR +# ---------------------------------- +# Tests whether FUNC exists, setting the cache variable VAR accordingly +ac_fn_c_check_func () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 +$as_echo_n "checking for $2... " >&6; } +if eval "test \"\${$3+set}\"" = set; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#define $2 innocuous_$2 +#ifdef __STDC__ +# include +#else +# include +#endif +#undef $2 +#ifdef __cplusplus +extern "C" +#endif +char $2 (); +#if defined __stub_$2 || defined __stub___$2 +choke me +#endif + +int main (void) +{ +return $2 (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + eval "$3=yes" +else + eval "$3=no" +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi +eval ac_res=\$$3 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } + eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} + +} # ac_fn_c_check_func + +# ac_fn_c_check_header_mongrel LINENO HEADER VAR INCLUDES +# ------------------------------------------------------- +# Tests whether HEADER exists, giving a warning if it cannot be compiled using +# the include files in INCLUDES and setting the cache variable VAR +# accordingly. +ac_fn_c_check_header_mongrel () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + if eval "test \"\${$3+set}\"" = set; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 +$as_echo_n "checking for $2... " >&6; } +if eval "test \"\${$3+set}\"" = set; then : + $as_echo_n "(cached) " >&6 +fi +eval ac_res=\$$3 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } +else + # Is the header compilable? +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 usability" >&5 +$as_echo_n "checking $2 usability... " >&6; } +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$4 +#include <$2> +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_header_compiler=yes +else + ac_header_compiler=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_compiler" >&5 +$as_echo "$ac_header_compiler" >&6; } + +# Is the header present? +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 presence" >&5 +$as_echo_n "checking $2 presence... " >&6; } +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include <$2> +_ACEOF +if ac_fn_c_try_cpp "$LINENO"; then : + ac_header_preproc=yes +else + ac_header_preproc=no +fi +rm -f conftest.err conftest.i conftest.$ac_ext +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_preproc" >&5 +$as_echo "$ac_header_preproc" >&6; } + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in #(( + yes:no: ) + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&5 +$as_echo "$as_me: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5 +$as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;} + ;; + no:yes:* ) + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: present but cannot be compiled" >&5 +$as_echo "$as_me: WARNING: $2: present but cannot be compiled" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: check for missing prerequisite headers?" >&5 +$as_echo "$as_me: WARNING: $2: check for missing prerequisite headers?" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: see the Autoconf documentation" >&5 +$as_echo "$as_me: WARNING: $2: see the Autoconf documentation" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&5 +$as_echo "$as_me: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5 +$as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;} +( $as_echo "## ---------------------------------------------------------------------- ## +## Report this to a suitable curl mailing list: http://curl.haxx.se/mail/ ## +## ---------------------------------------------------------------------- ##" + ) | sed "s/^/$as_me: WARNING: /" >&2 + ;; +esac + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 +$as_echo_n "checking for $2... " >&6; } +if eval "test \"\${$3+set}\"" = set; then : + $as_echo_n "(cached) " >&6 +else + eval "$3=\$ac_header_compiler" +fi +eval ac_res=\$$3 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } +fi + eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} + +} # ac_fn_c_check_header_mongrel + +# ac_fn_c_check_type LINENO TYPE VAR INCLUDES +# ------------------------------------------- +# Tests whether TYPE exists after having included INCLUDES, setting cache +# variable VAR accordingly. +ac_fn_c_check_type () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 +$as_echo_n "checking for $2... " >&6; } +if eval "test \"\${$3+set}\"" = set; then : + $as_echo_n "(cached) " >&6 +else + eval "$3=no" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$4 +int main (void) +{ +if (sizeof ($2)) + return 0; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$4 +int main (void) +{ +if (sizeof (($2))) + return 0; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + +else + eval "$3=yes" +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +eval ac_res=\$$3 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } + eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} + +} # ac_fn_c_check_type +cat >config.log <<_ACEOF +This file contains any messages produced by compilers while +running configure, to aid debugging if configure makes a mistake. + +It was created by curl $as_me -, which was +generated by GNU Autoconf 2.67. Invocation command line was + + $ $0 $@ + +_ACEOF +exec 5>>config.log +{ +cat <<_ASUNAME +## --------- ## +## Platform. ## +## --------- ## + +hostname = `(hostname || uname -n) 2>/dev/null | sed 1q` +uname -m = `(uname -m) 2>/dev/null || echo unknown` +uname -r = `(uname -r) 2>/dev/null || echo unknown` +uname -s = `(uname -s) 2>/dev/null || echo unknown` +uname -v = `(uname -v) 2>/dev/null || echo unknown` + +/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown` +/bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown` + +/bin/arch = `(/bin/arch) 2>/dev/null || echo unknown` +/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown` +/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown` +/usr/bin/hostinfo = `(/usr/bin/hostinfo) 2>/dev/null || echo unknown` +/bin/machine = `(/bin/machine) 2>/dev/null || echo unknown` +/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown` +/bin/universe = `(/bin/universe) 2>/dev/null || echo unknown` + +_ASUNAME + +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + $as_echo "PATH: $as_dir" + done +IFS=$as_save_IFS + +} >&5 + +cat >&5 <<_ACEOF + + +## ----------- ## +## Core tests. ## +## ----------- ## + +_ACEOF + + +# Keep a trace of the command line. +# Strip out --no-create and --no-recursion so they do not pile up. +# Strip out --silent because we don't want to record it for future runs. +# Also quote any args containing shell meta-characters. +# Make two passes to allow for proper duplicate-argument suppression. +ac_configure_args= +ac_configure_args0= +ac_configure_args1= +ac_must_keep_next=false +for ac_pass in 1 2 +do + for ac_arg + do + case $ac_arg in + -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;; + -q | -quiet | --quiet | --quie | --qui | --qu | --q \ + | -silent | --silent | --silen | --sile | --sil) + continue ;; + *\'*) + ac_arg=`$as_echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; + esac + case $ac_pass in + 1) as_fn_append ac_configure_args0 " '$ac_arg'" ;; + 2) + as_fn_append ac_configure_args1 " '$ac_arg'" + if test $ac_must_keep_next = true; then + ac_must_keep_next=false # Got value, back to normal. + else + case $ac_arg in + *=* | --config-cache | -C | -disable-* | --disable-* \ + | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \ + | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \ + | -with-* | --with-* | -without-* | --without-* | --x) + case "$ac_configure_args0 " in + "$ac_configure_args1"*" '$ac_arg' "* ) continue ;; + esac + ;; + -* ) ac_must_keep_next=true ;; + esac + fi + as_fn_append ac_configure_args " '$ac_arg'" + ;; + esac + done +done +{ ac_configure_args0=; unset ac_configure_args0;} +{ ac_configure_args1=; unset ac_configure_args1;} + +# When interrupted or exit'd, cleanup temporary files, and complete +# config.log. We remove comments because anyway the quotes in there +# would cause problems or look ugly. +# WARNING: Use '\'' to represent an apostrophe within the trap. +# WARNING: Do not start the trap code with a newline, due to a FreeBSD 4.0 bug. +trap 'exit_status=$? + # Save into config.log some information that might help in debugging. + { + echo + + $as_echo "## ---------------- ## +## Cache variables. ## +## ---------------- ##" + echo + # The following way of writing the cache mishandles newlines in values, +( + for ac_var in `(set) 2>&1 | sed -n '\''s/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'\''`; do + eval ac_val=\$$ac_var + case $ac_val in #( + *${as_nl}*) + case $ac_var in #( + *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 +$as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; + esac + case $ac_var in #( + _ | IFS | as_nl) ;; #( + BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( + *) { eval $ac_var=; unset $ac_var;} ;; + esac ;; + esac + done + (set) 2>&1 | + case $as_nl`(ac_space='\'' '\''; set) 2>&1` in #( + *${as_nl}ac_space=\ *) + sed -n \ + "s/'\''/'\''\\\\'\'''\''/g; + s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\''\\2'\''/p" + ;; #( + *) + sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" + ;; + esac | + sort +) + echo + + $as_echo "## ----------------- ## +## Output variables. ## +## ----------------- ##" + echo + for ac_var in $ac_subst_vars + do + eval ac_val=\$$ac_var + case $ac_val in + *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; + esac + $as_echo "$ac_var='\''$ac_val'\''" + done | sort + echo + + if test -n "$ac_subst_files"; then + $as_echo "## ------------------- ## +## File substitutions. ## +## ------------------- ##" + echo + for ac_var in $ac_subst_files + do + eval ac_val=\$$ac_var + case $ac_val in + *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; + esac + $as_echo "$ac_var='\''$ac_val'\''" + done | sort + echo + fi + + if test -s confdefs.h; then + $as_echo "## ----------- ## +## confdefs.h. ## +## ----------- ##" + echo + cat confdefs.h + echo + fi + test "$ac_signal" != 0 && + $as_echo "$as_me: caught signal $ac_signal" + $as_echo "$as_me: exit $exit_status" + } >&5 + rm -f core *.core core.conftest.* && + rm -f -r conftest* confdefs* conf$$* $ac_clean_files && + exit $exit_status +' 0 +for ac_signal in 1 2 13 15; do + trap 'ac_signal='$ac_signal'; as_fn_exit 1' $ac_signal +done +ac_signal=0 + +# confdefs.h avoids OS command line length limits that DEFS can exceed. +rm -f -r conftest* confdefs.h + +$as_echo "/* confdefs.h */" > confdefs.h + +# Predefined preprocessor variables. + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_NAME "$PACKAGE_NAME" +_ACEOF + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_TARNAME "$PACKAGE_TARNAME" +_ACEOF + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_VERSION "$PACKAGE_VERSION" +_ACEOF + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_STRING "$PACKAGE_STRING" +_ACEOF + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT" +_ACEOF + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_URL "$PACKAGE_URL" +_ACEOF + + +# Let the site file select an alternate cache file if it wants to. +# Prefer an explicitly selected file to automatically selected ones. +ac_site_file1=NONE +ac_site_file2=NONE +if test -n "$CONFIG_SITE"; then + # We do not want a PATH search for config.site. + case $CONFIG_SITE in #(( + -*) ac_site_file1=./$CONFIG_SITE;; + */*) ac_site_file1=$CONFIG_SITE;; + *) ac_site_file1=./$CONFIG_SITE;; + esac +elif test "x$prefix" != xNONE; then + ac_site_file1=$prefix/share/config.site + ac_site_file2=$prefix/etc/config.site +else + ac_site_file1=$ac_default_prefix/share/config.site + ac_site_file2=$ac_default_prefix/etc/config.site +fi +for ac_site_file in "$ac_site_file1" "$ac_site_file2" +do + test "x$ac_site_file" = xNONE && continue + if test /dev/null != "$ac_site_file" && test -r "$ac_site_file"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: loading site script $ac_site_file" >&5 +$as_echo "$as_me: loading site script $ac_site_file" >&6;} + sed 's/^/| /' "$ac_site_file" >&5 + . "$ac_site_file" \ + || { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "failed to load site script $ac_site_file +See \`config.log' for more details" "$LINENO" 5 ; } + fi +done + +if test -r "$cache_file"; then + # Some versions of bash will fail to source /dev/null (special files + # actually), so we avoid doing that. DJGPP emulates it as a regular file. + if test /dev/null != "$cache_file" && test -f "$cache_file"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: loading cache $cache_file" >&5 +$as_echo "$as_me: loading cache $cache_file" >&6;} + case $cache_file in + [\\/]* | ?:[\\/]* ) . "$cache_file";; + *) . "./$cache_file";; + esac + fi +else + { $as_echo "$as_me:${as_lineno-$LINENO}: creating cache $cache_file" >&5 +$as_echo "$as_me: creating cache $cache_file" >&6;} + >$cache_file +fi + +# Check that the precious variables saved in the cache have kept the same +# value. +ac_cache_corrupted=false +for ac_var in $ac_precious_vars; do + eval ac_old_set=\$ac_cv_env_${ac_var}_set + eval ac_new_set=\$ac_env_${ac_var}_set + eval ac_old_val=\$ac_cv_env_${ac_var}_value + eval ac_new_val=\$ac_env_${ac_var}_value + case $ac_old_set,$ac_new_set in + set,) + { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 +$as_echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} + ac_cache_corrupted=: ;; + ,set) + { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was not set in the previous run" >&5 +$as_echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} + ac_cache_corrupted=: ;; + ,);; + *) + if test "x$ac_old_val" != "x$ac_new_val"; then + # differences in whitespace do not lead to failure. + ac_old_val_w=`echo x $ac_old_val` + ac_new_val_w=`echo x $ac_new_val` + if test "$ac_old_val_w" != "$ac_new_val_w"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' has changed since the previous run:" >&5 +$as_echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} + ac_cache_corrupted=: + else + { $as_echo "$as_me:${as_lineno-$LINENO}: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&5 +$as_echo "$as_me: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&2;} + eval $ac_var=\$ac_old_val + fi + { $as_echo "$as_me:${as_lineno-$LINENO}: former value: \`$ac_old_val'" >&5 +$as_echo "$as_me: former value: \`$ac_old_val'" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: current value: \`$ac_new_val'" >&5 +$as_echo "$as_me: current value: \`$ac_new_val'" >&2;} + fi;; + esac + # Pass precious variables to config.status. + if test "$ac_new_set" = set; then + case $ac_new_val in + *\'*) ac_arg=$ac_var=`$as_echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;; + *) ac_arg=$ac_var=$ac_new_val ;; + esac + case " $ac_configure_args " in + *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy. + *) as_fn_append ac_configure_args " '$ac_arg'" ;; + esac + fi +done +if $ac_cache_corrupted; then + { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: error: changes in the environment can compromise the build" >&5 +$as_echo "$as_me: error: changes in the environment can compromise the build" >&2;} + as_fn_error $? "run \`make distclean' and/or \`rm $cache_file' and start over" "$LINENO" 5 +fi +## -------------------- ## +## Main body of script. ## +## -------------------- ## + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + + + + +# using curl-override.m4 + + + + + +ac_config_headers="$ac_config_headers lib/curl_config.h src/curl_config.h include/curl/curlbuild.h" + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to enable maintainer-specific portions of Makefiles" >&5 +$as_echo_n "checking whether to enable maintainer-specific portions of Makefiles... " >&6; } + # Check whether --enable-maintainer-mode was given. +if test "${enable_maintainer_mode+set}" = set; then : + enableval=$enable_maintainer_mode; USE_MAINTAINER_MODE=$enableval +else + USE_MAINTAINER_MODE=no +fi + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $USE_MAINTAINER_MODE" >&5 +$as_echo "$USE_MAINTAINER_MODE" >&6; } + + +if test $USE_MAINTAINER_MODE = yes; then + MAINTAINER_MODE_TRUE= + MAINTAINER_MODE_FALSE='#' +else + MAINTAINER_MODE_TRUE='#' + MAINTAINER_MODE_FALSE= +fi + + MAINT=$MAINTAINER_MODE_TRUE + + + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to enable debug build options" >&5 +$as_echo_n "checking whether to enable debug build options... " >&6; } + OPT_DEBUG_BUILD="default" + # Check whether --enable-debug was given. +if test "${enable_debug+set}" = set; then : + enableval=$enable_debug; OPT_DEBUG_BUILD=$enableval +fi + + case "$OPT_DEBUG_BUILD" in + no) + want_debug="no" + ;; + default) + want_debug="no" + ;; + *) + want_debug="yes" + ;; + esac + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $want_debug" >&5 +$as_echo "$want_debug" >&6; } + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to enable compiler optimizer" >&5 +$as_echo_n "checking whether to enable compiler optimizer... " >&6; } + OPT_COMPILER_OPTIMIZE="default" + # Check whether --enable-optimize was given. +if test "${enable_optimize+set}" = set; then : + enableval=$enable_optimize; OPT_COMPILER_OPTIMIZE=$enableval +fi + + case "$OPT_COMPILER_OPTIMIZE" in + no) + want_optimize="no" + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + ;; + default) + if test "$want_debug" = "yes"; then + want_optimize="assume_no" + { $as_echo "$as_me:${as_lineno-$LINENO}: result: (assumed) no" >&5 +$as_echo "(assumed) no" >&6; } + else + want_optimize="assume_yes" + { $as_echo "$as_me:${as_lineno-$LINENO}: result: (assumed) yes" >&5 +$as_echo "(assumed) yes" >&6; } + fi + ;; + *) + want_optimize="yes" + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + ;; + esac + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to enable strict compiler warnings" >&5 +$as_echo_n "checking whether to enable strict compiler warnings... " >&6; } + OPT_COMPILER_WARNINGS="default" + # Check whether --enable-warnings was given. +if test "${enable_warnings+set}" = set; then : + enableval=$enable_warnings; OPT_COMPILER_WARNINGS=$enableval +fi + + case "$OPT_COMPILER_WARNINGS" in + no) + want_warnings="no" + ;; + default) + want_warnings="$want_debug" + ;; + *) + want_warnings="yes" + ;; + esac + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $want_warnings" >&5 +$as_echo "$want_warnings" >&6; } + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to enable compiler warnings as errors" >&5 +$as_echo_n "checking whether to enable compiler warnings as errors... " >&6; } + OPT_COMPILER_WERROR="default" + # Check whether --enable-werror was given. +if test "${enable_werror+set}" = set; then : + enableval=$enable_werror; OPT_COMPILER_WERROR=$enableval +fi + + case "$OPT_COMPILER_WERROR" in + no) + want_werror="no" + ;; + default) + want_werror="no" + ;; + *) + want_werror="yes" + ;; + esac + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $want_werror" >&5 +$as_echo "$want_werror" >&6; } + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to enable curl debug memory tracking" >&5 +$as_echo_n "checking whether to enable curl debug memory tracking... " >&6; } + OPT_CURLDEBUG_BUILD="default" + # Check whether --enable-curldebug was given. +if test "${enable_curldebug+set}" = set; then : + enableval=$enable_curldebug; OPT_CURLDEBUG_BUILD=$enableval +fi + + case "$OPT_CURLDEBUG_BUILD" in + no) + want_curldebug="no" + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + ;; + default) + if test "$want_debug" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: (assumed) yes" >&5 +$as_echo "(assumed) yes" >&6; } + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + fi + want_curldebug_assumed="yes" + want_curldebug="$want_debug" + ;; + *) + want_curldebug="yes" + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + ;; + esac + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to enable c-ares for DNS lookups" >&5 +$as_echo_n "checking whether to enable c-ares for DNS lookups... " >&6; } + OPT_ARES="default" + # Check whether --enable-ares was given. +if test "${enable_ares+set}" = set; then : + enableval=$enable_ares; OPT_ARES=$enableval +fi + + case "$OPT_ARES" in + no) + want_ares="no" + ;; + default) + want_ares="no" + ;; + *) + want_ares="yes" + if test -n "$enableval" && test "$enableval" != "yes"; then + want_ares_path="$enableval" + fi + ;; + esac + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $want_ares" >&5 +$as_echo "$want_ares" >&6; } + + + + + +# +# save the configure arguments +# +CONFIGURE_OPTIONS="\"$ac_configure_args\"" + + +CURL_CFLAG_EXTRAS="" +if test X"$want_werror" = Xyes; then + CURL_CFLAG_EXTRAS="-Werror" +fi + + +if test -z "$SED"; then + # Extract the first word of "sed", so it can be a program name with args. +set dummy sed; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if test "${ac_cv_path_SED+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + case $SED in + [\\/]* | ?:[\\/]*) + ac_cv_path_SED="$SED" # Let the user override the test with a path. + ;; + *) + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +as_dummy="$PATH:/usr/bin:/usr/local/bin" +for as_dir in $as_dummy +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_path_SED="$as_dir/$ac_word$ac_exec_ext" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + + test -z "$ac_cv_path_SED" && ac_cv_path_SED="not_found" + ;; +esac +fi +SED=$ac_cv_path_SED +if test -n "$SED"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $SED" >&5 +$as_echo "$SED" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + if test -z "$SED" || test "$SED" = "not_found"; then + as_fn_error $? "sed not found in PATH. Cannot continue without sed." "$LINENO" 5 + fi +fi + + +if test -z "$GREP"; then + # Extract the first word of "grep", so it can be a program name with args. +set dummy grep; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if test "${ac_cv_path_GREP+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + case $GREP in + [\\/]* | ?:[\\/]*) + ac_cv_path_GREP="$GREP" # Let the user override the test with a path. + ;; + *) + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +as_dummy="$PATH:/usr/bin:/usr/local/bin" +for as_dir in $as_dummy +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_path_GREP="$as_dir/$ac_word$ac_exec_ext" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + + test -z "$ac_cv_path_GREP" && ac_cv_path_GREP="not_found" + ;; +esac +fi +GREP=$ac_cv_path_GREP +if test -n "$GREP"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $GREP" >&5 +$as_echo "$GREP" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + if test -z "$GREP" || test "$GREP" = "not_found"; then + as_fn_error $? "grep not found in PATH. Cannot continue without grep." "$LINENO" 5 + fi +fi + + +if test -z "$EGREP"; then + if echo a | ($GREP -E '(a|b)') >/dev/null 2>&1; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for egrep" >&5 +$as_echo_n "checking for egrep... " >&6; } + EGREP="$GREP -E" + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $EGREP" >&5 +$as_echo "$EGREP" >&6; } + else + # Extract the first word of "egrep", so it can be a program name with args. +set dummy egrep; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if test "${ac_cv_path_EGREP+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + case $EGREP in + [\\/]* | ?:[\\/]*) + ac_cv_path_EGREP="$EGREP" # Let the user override the test with a path. + ;; + *) + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +as_dummy="$PATH:/usr/bin:/usr/local/bin" +for as_dir in $as_dummy +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_path_EGREP="$as_dir/$ac_word$ac_exec_ext" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + + test -z "$ac_cv_path_EGREP" && ac_cv_path_EGREP="not_found" + ;; +esac +fi +EGREP=$ac_cv_path_EGREP +if test -n "$EGREP"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $EGREP" >&5 +$as_echo "$EGREP" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + fi +fi +if test -z "$EGREP" || test "$EGREP" = "not_found"; then + as_fn_error $? "egrep not found in PATH. Cannot continue without egrep." "$LINENO" 5 +fi + + +if test -z "$AR"; then + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}ar", so it can be a program name with args. +set dummy ${ac_tool_prefix}ar; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if test "${ac_cv_path_AR+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + case $AR in + [\\/]* | ?:[\\/]*) + ac_cv_path_AR="$AR" # Let the user override the test with a path. + ;; + *) + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +as_dummy="$PATH:/usr/bin:/usr/local/bin" +for as_dir in $as_dummy +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_path_AR="$as_dir/$ac_word$ac_exec_ext" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + + ;; +esac +fi +AR=$ac_cv_path_AR +if test -n "$AR"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AR" >&5 +$as_echo "$AR" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +fi +if test -z "$ac_cv_path_AR"; then + ac_pt_AR=$AR + # Extract the first word of "ar", so it can be a program name with args. +set dummy ar; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if test "${ac_cv_path_ac_pt_AR+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + case $ac_pt_AR in + [\\/]* | ?:[\\/]*) + ac_cv_path_ac_pt_AR="$ac_pt_AR" # Let the user override the test with a path. + ;; + *) + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +as_dummy="$PATH:/usr/bin:/usr/local/bin" +for as_dir in $as_dummy +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_path_ac_pt_AR="$as_dir/$ac_word$ac_exec_ext" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + + ;; +esac +fi +ac_pt_AR=$ac_cv_path_ac_pt_AR +if test -n "$ac_pt_AR"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_pt_AR" >&5 +$as_echo "$ac_pt_AR" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + if test "x$ac_pt_AR" = x; then + AR="not_found" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + AR=$ac_pt_AR + fi +else + AR="$ac_cv_path_AR" +fi + + if test -z "$AR" || test "$AR" = "not_found"; then + as_fn_error $? "ar not found in PATH. Cannot continue without ar." "$LINENO" 5 + fi +fi + + + + +if test -f ${srcdir}/include/curl/curlbuild.h; then + rm -f ${srcdir}/include/curl/curlbuild.h +fi + +VERSION=`$SED -ne 's/^#define LIBCURL_VERSION "\(.*\)"/\1/p' ${srcdir}/include/curl/curlver.h` +am__api_version="1.9" +ac_aux_dir= +for ac_dir in "$srcdir" "$srcdir/.." "$srcdir/../.."; do + if test -f "$ac_dir/install-sh"; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/install-sh -c" + break + elif test -f "$ac_dir/install.sh"; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/install.sh -c" + break + elif test -f "$ac_dir/shtool"; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/shtool install -c" + break + fi +done +if test -z "$ac_aux_dir"; then + as_fn_error $? "cannot find install-sh, install.sh, or shtool in \"$srcdir\" \"$srcdir/..\" \"$srcdir/../..\"" "$LINENO" 5 +fi + +# These three variables are undocumented and unsupported, +# and are intended to be withdrawn in a future Autoconf release. +# They can cause serious problems if a builder's source tree is in a directory +# whose full name contains unusual characters. +ac_config_guess="$SHELL $ac_aux_dir/config.guess" # Please don't use this var. +ac_config_sub="$SHELL $ac_aux_dir/config.sub" # Please don't use this var. +ac_configure="$SHELL $ac_aux_dir/configure" # Please don't use this var. + + +# Find a good install program. We prefer a C program (faster), +# so one script is as good as another. But avoid the broken or +# incompatible versions: +# SysV /etc/install, /usr/sbin/install +# SunOS /usr/etc/install +# IRIX /sbin/install +# AIX /bin/install +# AmigaOS /C/install, which installs bootblocks on floppy discs +# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag +# AFS /usr/afsws/bin/install, which mishandles nonexistent args +# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" +# OS/2's system install, which has a completely different semantic +# ./install, which can be erroneously created by make from ./install.sh. +# Reject install programs that cannot install multiple files. +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for a BSD-compatible install" >&5 +$as_echo_n "checking for a BSD-compatible install... " >&6; } +if test -z "$INSTALL"; then +if test "${ac_cv_path_install+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + # Account for people who put trailing slashes in PATH elements. +case $as_dir/ in #(( + ./ | .// | /[cC]/* | \ + /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \ + ?:[\\/]os2[\\/]install[\\/]* | ?:[\\/]OS2[\\/]INSTALL[\\/]* | \ + /usr/ucb/* ) ;; + *) + # OSF1 and SCO ODT 3.0 have their own names for install. + # Don't use installbsd from OSF since it installs stuff as root + # by default. + for ac_prog in ginstall scoinst install; do + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_prog$ac_exec_ext" && $as_test_x "$as_dir/$ac_prog$ac_exec_ext"; }; then + if test $ac_prog = install && + grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then + # AIX install. It has an incompatible calling convention. + : + elif test $ac_prog = install && + grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then + # program-specific install script used by HP pwplus--don't use. + : + else + rm -rf conftest.one conftest.two conftest.dir + echo one > conftest.one + echo two > conftest.two + mkdir conftest.dir + if "$as_dir/$ac_prog$ac_exec_ext" -c conftest.one conftest.two "`pwd`/conftest.dir" && + test -s conftest.one && test -s conftest.two && + test -s conftest.dir/conftest.one && + test -s conftest.dir/conftest.two + then + ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c" + break 3 + fi + fi + fi + done + done + ;; +esac + + done +IFS=$as_save_IFS + +rm -rf conftest.one conftest.two conftest.dir + +fi + if test "${ac_cv_path_install+set}" = set; then + INSTALL=$ac_cv_path_install + else + # As a last resort, use the slow shell script. Don't cache a + # value for INSTALL within a source directory, because that will + # break other packages using the cache if that directory is + # removed, or if the value is a relative name. + INSTALL=$ac_install_sh + fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $INSTALL" >&5 +$as_echo "$INSTALL" >&6; } + +# Use test -z because SunOS4 sh mishandles braces in ${var-val}. +# It thinks the first close brace ends the variable substitution. +test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' + +test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}' + +test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether build environment is sane" >&5 +$as_echo_n "checking whether build environment is sane... " >&6; } +# Just in case +sleep 1 +echo timestamp > conftest.file +# Do `set' in a subshell so we don't clobber the current shell's +# arguments. Must try -L first in case configure is actually a +# symlink; some systems play weird games with the mod time of symlinks +# (eg FreeBSD returns the mod time of the symlink's containing +# directory). +if ( + set X `ls -Lt $srcdir/configure conftest.file 2> /dev/null` + if test "$*" = "X"; then + # -L didn't work. + set X `ls -t $srcdir/configure conftest.file` + fi + rm -f conftest.file + if test "$*" != "X $srcdir/configure conftest.file" \ + && test "$*" != "X conftest.file $srcdir/configure"; then + + # If neither matched, then we have a broken ls. This can happen + # if, for instance, CONFIG_SHELL is bash and it inherits a + # broken ls alias from the environment. This has actually + # happened. Such a system could not be considered "sane". + as_fn_error $? "ls -t appears to fail. Make sure there is not a broken +alias in your environment" "$LINENO" 5 + fi + + test "$2" = conftest.file + ) +then + # Ok. + : +else + as_fn_error $? "newly created file is older than distributed files! +Check your system clock" "$LINENO" 5 +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } +test "$program_prefix" != NONE && + program_transform_name="s&^&$program_prefix&;$program_transform_name" +# Use a double $ so make ignores it. +test "$program_suffix" != NONE && + program_transform_name="s&\$&$program_suffix&;$program_transform_name" +# Double any \ or $. +# By default was `s,x,x', remove it if useless. +ac_script='s/[\\$]/&&/g;s/;s,x,x,$//' +program_transform_name=`$as_echo "$program_transform_name" | sed "$ac_script"` + +# expand $ac_aux_dir to an absolute path +am_aux_dir=`cd $ac_aux_dir && pwd` + +test x"${MISSING+set}" = xset || MISSING="\${SHELL} \"$am_aux_dir/missing\"" +# Use eval to expand $SHELL +if eval "$MISSING --run true"; then + am_missing_run="$MISSING --run " +else + am_missing_run= + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: \`missing' script is too old or missing" >&5 +$as_echo "$as_me: WARNING: \`missing' script is too old or missing" >&2;} +fi + +if mkdir -p --version . >/dev/null 2>&1 && test ! -d ./--version; then + # We used to keeping the `.' as first argument, in order to + # allow $(mkdir_p) to be used without argument. As in + # $(mkdir_p) $(somedir) + # where $(somedir) is conditionally defined. However this is wrong + # for two reasons: + # 1. if the package is installed by a user who cannot write `.' + # make install will fail, + # 2. the above comment should most certainly read + # $(mkdir_p) $(DESTDIR)$(somedir) + # so it does not work when $(somedir) is undefined and + # $(DESTDIR) is not. + # To support the latter case, we have to write + # test -z "$(somedir)" || $(mkdir_p) $(DESTDIR)$(somedir), + # so the `.' trick is pointless. + mkdir_p='mkdir -p --' +else + # On NextStep and OpenStep, the `mkdir' command does not + # recognize any option. It will interpret all options as + # directories to create, and then abort because `.' already + # exists. + for d in ./-p ./--version; + do + test -d $d && rmdir $d + done + # $(mkinstalldirs) is defined by Automake if mkinstalldirs exists. + if test -f "$ac_aux_dir/mkinstalldirs"; then + mkdir_p='$(mkinstalldirs)' + else + mkdir_p='$(install_sh) -d' + fi +fi + +for ac_prog in gawk mawk nawk awk +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if test "${ac_cv_prog_AWK+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$AWK"; then + ac_cv_prog_AWK="$AWK" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_AWK="$ac_prog" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +AWK=$ac_cv_prog_AWK +if test -n "$AWK"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AWK" >&5 +$as_echo "$AWK" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + test -n "$AWK" && break +done + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${MAKE-make} sets \$(MAKE)" >&5 +$as_echo_n "checking whether ${MAKE-make} sets \$(MAKE)... " >&6; } +set x ${MAKE-make} +ac_make=`$as_echo "$2" | sed 's/+/p/g; s/[^a-zA-Z0-9_]/_/g'` +if eval "test \"\${ac_cv_prog_make_${ac_make}_set+set}\"" = set; then : + $as_echo_n "(cached) " >&6 +else + cat >conftest.make <<\_ACEOF +SHELL = /bin/sh +all: + @echo '@@@%%%=$(MAKE)=@@@%%%' +_ACEOF +# GNU make sometimes prints "make[1]: Entering ...", which would confuse us. +case `${MAKE-make} -f conftest.make 2>/dev/null` in + *@@@%%%=?*=@@@%%%*) + eval ac_cv_prog_make_${ac_make}_set=yes;; + *) + eval ac_cv_prog_make_${ac_make}_set=no;; +esac +rm -f conftest.make +fi +if eval test \$ac_cv_prog_make_${ac_make}_set = yes; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + SET_MAKE= +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + SET_MAKE="MAKE=${MAKE-make}" +fi + +rm -rf .tst 2>/dev/null +mkdir .tst 2>/dev/null +if test -d .tst; then + am__leading_dot=. +else + am__leading_dot=_ +fi +rmdir .tst 2>/dev/null + +# test to see if srcdir already configured +if test "`cd $srcdir && pwd`" != "`pwd`" && + test -f $srcdir/config.status; then + as_fn_error $? "source directory already configured; run \"make distclean\" there first" "$LINENO" 5 +fi + +# test whether we have cygpath +if test -z "$CYGPATH_W"; then + if (cygpath --version) >/dev/null 2>/dev/null; then + CYGPATH_W='cygpath -w' + else + CYGPATH_W=echo + fi +fi + + +# Define the identity of the package. + PACKAGE=curl + VERSION=$VERSION + + +cat >>confdefs.h <<_ACEOF +#define PACKAGE "$PACKAGE" +_ACEOF + + +cat >>confdefs.h <<_ACEOF +#define VERSION "$VERSION" +_ACEOF + +# Some tools Automake needs. + +ACLOCAL=${ACLOCAL-"${am_missing_run}aclocal-${am__api_version}"} + + +AUTOCONF=${AUTOCONF-"${am_missing_run}autoconf"} + + +AUTOMAKE=${AUTOMAKE-"${am_missing_run}automake-${am__api_version}"} + + +AUTOHEADER=${AUTOHEADER-"${am_missing_run}autoheader"} + + +MAKEINFO=${MAKEINFO-"${am_missing_run}makeinfo"} + +install_sh=${install_sh-"$am_aux_dir/install-sh"} + +# Installed binaries are usually stripped using `strip' when the user +# run `make install-strip'. However `strip' might not be the right +# tool to use in cross-compilation environments, therefore Automake +# will honor the `STRIP' environment variable to overrule this program. +if test "$cross_compiling" != no; then + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args. +set dummy ${ac_tool_prefix}strip; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if test "${ac_cv_prog_STRIP+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$STRIP"; then + ac_cv_prog_STRIP="$STRIP" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_STRIP="${ac_tool_prefix}strip" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +STRIP=$ac_cv_prog_STRIP +if test -n "$STRIP"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $STRIP" >&5 +$as_echo "$STRIP" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_STRIP"; then + ac_ct_STRIP=$STRIP + # Extract the first word of "strip", so it can be a program name with args. +set dummy strip; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if test "${ac_cv_prog_ac_ct_STRIP+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_STRIP"; then + ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_ac_ct_STRIP="strip" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP +if test -n "$ac_ct_STRIP"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_STRIP" >&5 +$as_echo "$ac_ct_STRIP" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + if test "x$ac_ct_STRIP" = x; then + STRIP=":" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + STRIP=$ac_ct_STRIP + fi +else + STRIP="$ac_cv_prog_STRIP" +fi + +fi +INSTALL_STRIP_PROGRAM="\${SHELL} \$(install_sh) -c -s" + +# We need awk for the "check" target. The system "awk" is bad on +# some platforms. +# Always define AMTAR for backward compatibility. + +AMTAR=${AMTAR-"${am_missing_run}tar"} + +am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -' + + + + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking curl version" >&5 +$as_echo_n "checking curl version... " >&6; } +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $VERSION" >&5 +$as_echo "$VERSION" >&6; } + +VERSIONNUM=`$SED -ne 's/^#define LIBCURL_VERSION_NUM 0x\(.*\)/\1/p' ${srcdir}/include/curl/curlver.h` + + +PKGADD_PKG="HAXXcurl" +PKGADD_NAME="cURL - a client that groks URLs" +PKGADD_VENDOR="curl.haxx.se" + + + + + curl_ssl_msg="no (--with-{ssl,gnutls,nss,polarssl} )" + curl_ssh_msg="no (--with-libssh2)" + curl_zlib_msg="no (--with-zlib)" + curl_krb4_msg="no (--with-krb4*)" + curl_gss_msg="no (--with-gssapi)" + curl_spnego_msg="no (--with-spnego)" + curl_res_msg="default (--enable-ares / --enable-threaded-resolver)" + curl_ipv6_msg="no (--enable-ipv6)" + curl_idn_msg="no (--with-libidn)" + curl_manual_msg="no (--enable-manual)" +curl_verbose_msg="enabled (--disable-verbose)" + curl_sspi_msg="no (--enable-sspi)" + curl_ldap_msg="no (--enable-ldap / --with-ldap-lib / --with-lber-lib)" + curl_ldaps_msg="no (--enable-ldaps)" + curl_rtsp_msg="no (--enable-rtsp)" + curl_rtmp_msg="no (--with-librtmp)" + +ALL_LIBS=$LIBS + + +# Make sure we can run config.sub. +$SHELL "$ac_aux_dir/config.sub" sun4 >/dev/null 2>&1 || + as_fn_error $? "cannot run $SHELL $ac_aux_dir/config.sub" "$LINENO" 5 + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking build system type" >&5 +$as_echo_n "checking build system type... " >&6; } +if test "${ac_cv_build+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + ac_build_alias=$build_alias +test "x$ac_build_alias" = x && + ac_build_alias=`$SHELL "$ac_aux_dir/config.guess"` +test "x$ac_build_alias" = x && + as_fn_error $? "cannot guess build type; you must specify one" "$LINENO" 5 +ac_cv_build=`$SHELL "$ac_aux_dir/config.sub" $ac_build_alias` || + as_fn_error $? "$SHELL $ac_aux_dir/config.sub $ac_build_alias failed" "$LINENO" 5 + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_build" >&5 +$as_echo "$ac_cv_build" >&6; } +case $ac_cv_build in +*-*-*) ;; +*) as_fn_error $? "invalid value of canonical build" "$LINENO" 5 ;; +esac +build=$ac_cv_build +ac_save_IFS=$IFS; IFS='-' +set x $ac_cv_build +shift +build_cpu=$1 +build_vendor=$2 +shift; shift +# Remember, the first character of IFS is used to create $*, +# except with old shells: +build_os=$* +IFS=$ac_save_IFS +case $build_os in *\ *) build_os=`echo "$build_os" | sed 's/ /-/g'`;; esac + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking host system type" >&5 +$as_echo_n "checking host system type... " >&6; } +if test "${ac_cv_host+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + if test "x$host_alias" = x; then + ac_cv_host=$ac_cv_build +else + ac_cv_host=`$SHELL "$ac_aux_dir/config.sub" $host_alias` || + as_fn_error $? "$SHELL $ac_aux_dir/config.sub $host_alias failed" "$LINENO" 5 +fi + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_host" >&5 +$as_echo "$ac_cv_host" >&6; } +case $ac_cv_host in +*-*-*) ;; +*) as_fn_error $? "invalid value of canonical host" "$LINENO" 5 ;; +esac +host=$ac_cv_host +ac_save_IFS=$IFS; IFS='-' +set x $ac_cv_host +shift +host_cpu=$1 +host_vendor=$2 +shift; shift +# Remember, the first character of IFS is used to create $*, +# except with old shells: +host_os=$* +IFS=$ac_save_IFS +case $host_os in *\ *) host_os=`echo "$host_os" | sed 's/ /-/g'`;; esac + + + +cat >>confdefs.h <<_ACEOF +#define OS "${host}" +_ACEOF + + +DEPDIR="${am__leading_dot}deps" + +ac_config_commands="$ac_config_commands depfiles" + + +am_make=${MAKE-make} +cat > confinc << 'END' +am__doit: + @echo done +.PHONY: am__doit +END +# If we don't find an include directive, just comment out the code. +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for style of include used by $am_make" >&5 +$as_echo_n "checking for style of include used by $am_make... " >&6; } +am__include="#" +am__quote= +_am_result=none +# First try GNU make style include. +echo "include confinc" > confmf +# We grep out `Entering directory' and `Leaving directory' +# messages which can occur if `w' ends up in MAKEFLAGS. +# In particular we don't look at `^make:' because GNU make might +# be invoked under some other name (usually "gmake"), in which +# case it prints its new name instead of `make'. +if test "`$am_make -s -f confmf 2> /dev/null | grep -v 'ing directory'`" = "done"; then + am__include=include + am__quote= + _am_result=GNU +fi +# Now try BSD make style include. +if test "$am__include" = "#"; then + echo '.include "confinc"' > confmf + if test "`$am_make -s -f confmf 2> /dev/null`" = "done"; then + am__include=.include + am__quote="\"" + _am_result=BSD + fi +fi + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $_am_result" >&5 +$as_echo "$_am_result" >&6; } +rm -f confinc confmf + +# Check whether --enable-dependency-tracking was given. +if test "${enable_dependency_tracking+set}" = set; then : + enableval=$enable_dependency_tracking; +fi + +if test "x$enable_dependency_tracking" != xno; then + am_depcomp="$ac_aux_dir/depcomp" + AMDEPBACKSLASH='\' +fi + + +if test "x$enable_dependency_tracking" != xno; then + AMDEP_TRUE= + AMDEP_FALSE='#' +else + AMDEP_TRUE='#' + AMDEP_FALSE= +fi + + + + + ac_save_CFLAGS="$CFLAGS" + ac_save_CPPFLAGS="$CPPFLAGS" + ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu +if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. +set dummy ${ac_tool_prefix}gcc; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if test "${ac_cv_prog_CC+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_CC="${ac_tool_prefix}gcc" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +$as_echo "$CC" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_CC"; then + ac_ct_CC=$CC + # Extract the first word of "gcc", so it can be a program name with args. +set dummy gcc; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if test "${ac_cv_prog_ac_ct_CC+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_CC"; then + ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_ac_ct_CC="gcc" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 +$as_echo "$ac_ct_CC" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + if test "x$ac_ct_CC" = x; then + CC="" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + CC=$ac_ct_CC + fi +else + CC="$ac_cv_prog_CC" +fi + +if test -z "$CC"; then + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. +set dummy ${ac_tool_prefix}cc; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if test "${ac_cv_prog_CC+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_CC="${ac_tool_prefix}cc" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +$as_echo "$CC" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + fi +fi +if test -z "$CC"; then + # Extract the first word of "cc", so it can be a program name with args. +set dummy cc; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if test "${ac_cv_prog_CC+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else + ac_prog_rejected=no +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then + ac_prog_rejected=yes + continue + fi + ac_cv_prog_CC="cc" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +if test $ac_prog_rejected = yes; then + # We found a bogon in the path, so make sure we never use it. + set dummy $ac_cv_prog_CC + shift + if test $# != 0; then + # We chose a different compiler from the bogus one. + # However, it has the same basename, so the bogon will be chosen + # first if we set CC to just the basename; use the full file name. + shift + ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@" + fi +fi +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +$as_echo "$CC" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +fi +if test -z "$CC"; then + if test -n "$ac_tool_prefix"; then + for ac_prog in cl.exe + do + # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. +set dummy $ac_tool_prefix$ac_prog; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if test "${ac_cv_prog_CC+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_CC="$ac_tool_prefix$ac_prog" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +$as_echo "$CC" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + test -n "$CC" && break + done +fi +if test -z "$CC"; then + ac_ct_CC=$CC + for ac_prog in cl.exe +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if test "${ac_cv_prog_ac_ct_CC+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_CC"; then + ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_ac_ct_CC="$ac_prog" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 +$as_echo "$ac_ct_CC" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + test -n "$ac_ct_CC" && break +done + + if test "x$ac_ct_CC" = x; then + CC="" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + CC=$ac_ct_CC + fi +fi + +fi + + +test -z "$CC" && { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "no acceptable C compiler found in \$PATH +See \`config.log' for more details" "$LINENO" 5 ; } + +# Provide some information about the compiler. +$as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5 +set X $ac_compile +ac_compiler=$2 +for ac_option in --version -v -V -qversion; do + { { ac_try="$ac_compiler $ac_option >&5" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_compiler $ac_option >&5") 2>conftest.err + ac_status=$? + if test -s conftest.err; then + sed '10a\ +... rest of stderr output deleted ... + 10q' conftest.err >conftest.er1 + cat conftest.er1 >&5 + fi + rm -f conftest.er1 conftest.err + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } +done + +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int main (void) +{ + + ; + return 0; +} +_ACEOF +ac_clean_files_save=$ac_clean_files +ac_clean_files="$ac_clean_files a.out a.out.dSYM a.exe b.out" +# Try to create an executable without -o first, disregard a.out. +# It will help us diagnose broken compilers, and finding out an intuition +# of exeext. +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C compiler works" >&5 +$as_echo_n "checking whether the C compiler works... " >&6; } +ac_link_default=`$as_echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'` + +# The possible output files: +ac_files="a.out conftest.exe conftest a.exe a_out.exe b.out conftest.*" + +ac_rmfiles= +for ac_file in $ac_files +do + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; + * ) ac_rmfiles="$ac_rmfiles $ac_file";; + esac +done +rm -f $ac_rmfiles + +if { { ac_try="$ac_link_default" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_link_default") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then : + # Autoconf-2.13 could set the ac_cv_exeext variable to `no'. +# So ignore a value of `no', otherwise this would lead to `EXEEXT = no' +# in a Makefile. We should not override ac_cv_exeext if it was cached, +# so that the user can short-circuit this test for compilers unknown to +# Autoconf. +for ac_file in $ac_files '' +do + test -f "$ac_file" || continue + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) + ;; + [ab].out ) + # We found the default executable, but exeext='' is most + # certainly right. + break;; + *.* ) + if test "${ac_cv_exeext+set}" = set && test "$ac_cv_exeext" != no; + then :; else + ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` + fi + # We set ac_cv_exeext here because the later test for it is not + # safe: cross compilers may not add the suffix if given an `-o' + # argument, so we may need to know it at that point already. + # Even if this section looks crufty: it has the advantage of + # actually working. + break;; + * ) + break;; + esac +done +test "$ac_cv_exeext" = no && ac_cv_exeext= + +else + ac_file='' +fi +if test -z "$ac_file"; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +$as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error 77 "C compiler cannot create executables +See \`config.log' for more details" "$LINENO" 5 ; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler default output file name" >&5 +$as_echo_n "checking for C compiler default output file name... " >&6; } +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_file" >&5 +$as_echo "$ac_file" >&6; } +ac_exeext=$ac_cv_exeext + +rm -f -r a.out a.out.dSYM a.exe conftest$ac_cv_exeext b.out +ac_clean_files=$ac_clean_files_save +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of executables" >&5 +$as_echo_n "checking for suffix of executables... " >&6; } +if { { ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_link") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then : + # If both `conftest.exe' and `conftest' are `present' (well, observable) +# catch `conftest.exe'. For instance with Cygwin, `ls conftest' will +# work properly (i.e., refer to `conftest.exe'), while it won't with +# `rm'. +for ac_file in conftest.exe conftest conftest.*; do + test -f "$ac_file" || continue + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; + *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` + break;; + * ) break;; + esac +done +else + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "cannot compute suffix of executables: cannot compile and link +See \`config.log' for more details" "$LINENO" 5 ; } +fi +rm -f conftest conftest$ac_cv_exeext +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_exeext" >&5 +$as_echo "$ac_cv_exeext" >&6; } + +rm -f conftest.$ac_ext +EXEEXT=$ac_cv_exeext +ac_exeext=$EXEEXT +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +int main (void) +{ +FILE *f = fopen ("conftest.out", "w"); + return ferror (f) || fclose (f) != 0; + + ; + return 0; +} +_ACEOF +ac_clean_files="$ac_clean_files conftest.out" +# Check that the compiler produces executables we can run. If not, either +# the compiler is broken, or we cross compile. +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are cross compiling" >&5 +$as_echo_n "checking whether we are cross compiling... " >&6; } +if test "$cross_compiling" != yes; then + { { ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_link") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } + if { ac_try='./conftest$ac_cv_exeext' + { { case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; }; then + cross_compiling=no + else + if test "$cross_compiling" = maybe; then + cross_compiling=yes + else + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "cannot run C compiled programs. +If you meant to cross compile, use \`--host'. +See \`config.log' for more details" "$LINENO" 5 ; } + fi + fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $cross_compiling" >&5 +$as_echo "$cross_compiling" >&6; } + +rm -f conftest.$ac_ext conftest$ac_cv_exeext conftest.out +ac_clean_files=$ac_clean_files_save +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of object files" >&5 +$as_echo_n "checking for suffix of object files... " >&6; } +if test "${ac_cv_objext+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int main (void) +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.o conftest.obj +if { { ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_compile") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then : + for ac_file in conftest.o conftest.obj conftest.*; do + test -f "$ac_file" || continue; + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM ) ;; + *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'` + break;; + esac +done +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "cannot compute suffix of object files: cannot compile +See \`config.log' for more details" "$LINENO" 5 ; } +fi +rm -f conftest.$ac_cv_objext conftest.$ac_ext +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_objext" >&5 +$as_echo "$ac_cv_objext" >&6; } +OBJEXT=$ac_cv_objext +ac_objext=$OBJEXT +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C compiler" >&5 +$as_echo_n "checking whether we are using the GNU C compiler... " >&6; } +if test "${ac_cv_c_compiler_gnu+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int main (void) +{ +#ifndef __GNUC__ + choke me +#endif + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_compiler_gnu=yes +else + ac_compiler_gnu=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +ac_cv_c_compiler_gnu=$ac_compiler_gnu + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_compiler_gnu" >&5 +$as_echo "$ac_cv_c_compiler_gnu" >&6; } +if test $ac_compiler_gnu = yes; then + GCC=yes +else + GCC= +fi +ac_test_CFLAGS=${CFLAGS+set} +ac_save_CFLAGS=$CFLAGS +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5 +$as_echo_n "checking whether $CC accepts -g... " >&6; } +if test "${ac_cv_prog_cc_g+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + ac_save_c_werror_flag=$ac_c_werror_flag + ac_c_werror_flag=yes + ac_cv_prog_cc_g=no + CFLAGS="-g" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int main (void) +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_prog_cc_g=yes +else + CFLAGS="" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int main (void) +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + +else + ac_c_werror_flag=$ac_save_c_werror_flag + CFLAGS="-g" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int main (void) +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_prog_cc_g=yes +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + ac_c_werror_flag=$ac_save_c_werror_flag +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_g" >&5 +$as_echo "$ac_cv_prog_cc_g" >&6; } +if test "$ac_test_CFLAGS" = set; then + CFLAGS=$ac_save_CFLAGS +elif test $ac_cv_prog_cc_g = yes; then + if test "$GCC" = yes; then + CFLAGS="-g -O2" + else + CFLAGS="-g" + fi +else + if test "$GCC" = yes; then + CFLAGS="-O2" + else + CFLAGS= + fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C89" >&5 +$as_echo_n "checking for $CC option to accept ISO C89... " >&6; } +if test "${ac_cv_prog_cc_c89+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + ac_cv_prog_cc_c89=no +ac_save_CC=$CC +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +#include +#include +#include +/* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ +struct buf { int x; }; +FILE * (*rcsopen) (struct buf *, struct stat *, int); +static char *e (p, i) + char **p; + int i; +{ + return p[i]; +} +static char *f (char * (*g) (char **, int), char **p, ...) +{ + char *s; + va_list v; + va_start (v,p); + s = g (p, va_arg (v,int)); + va_end (v); + return s; +} + +/* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has + function prototypes and stuff, but not '\xHH' hex character constants. + These don't provoke an error unfortunately, instead are silently treated + as 'x'. The following induces an error, until -std is added to get + proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an + array size at least. It's necessary to write '\x00'==0 to get something + that's true only with -std. */ +int osf4_cc_array ['\x00' == 0 ? 1 : -1]; + +/* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters + inside strings and character constants. */ +#define FOO(x) 'x' +int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1]; + +int test (int i, double x); +struct s1 {int (*f) (int a);}; +struct s2 {int (*f) (double a);}; +int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); +int argc; +char **argv; +int main (void) +{ +return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; + ; + return 0; +} +_ACEOF +for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \ + -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" +do + CC="$ac_save_CC $ac_arg" + if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_prog_cc_c89=$ac_arg +fi +rm -f core conftest.err conftest.$ac_objext + test "x$ac_cv_prog_cc_c89" != "xno" && break +done +rm -f conftest.$ac_ext +CC=$ac_save_CC + +fi +# AC_CACHE_VAL +case "x$ac_cv_prog_cc_c89" in + x) + { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 +$as_echo "none needed" >&6; } ;; + xno) + { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 +$as_echo "unsupported" >&6; } ;; + *) + CC="$CC $ac_cv_prog_cc_c89" + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5 +$as_echo "$ac_cv_prog_cc_c89" >&6; } ;; +esac +if test "x$ac_cv_prog_cc_c89" != xno; then : + +fi + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + +depcc="$CC" am_compiler_list= + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking dependency style of $depcc" >&5 +$as_echo_n "checking dependency style of $depcc... " >&6; } +if test "${am_cv_CC_dependencies_compiler_type+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then + # We make a subdir and do the tests there. Otherwise we can end up + # making bogus files that we don't know about and never remove. For + # instance it was reported that on HP-UX the gcc test will end up + # making a dummy file named `D' -- because `-MD' means `put the output + # in D'. + mkdir conftest.dir + # Copy depcomp to subdir because otherwise we won't find it if we're + # using a relative directory. + cp "$am_depcomp" conftest.dir + cd conftest.dir + # We will build objects and dependencies in a subdirectory because + # it helps to detect inapplicable dependency modes. For instance + # both Tru64's cc and ICC support -MD to output dependencies as a + # side effect of compilation, but ICC will put the dependencies in + # the current directory while Tru64 will put them in the object + # directory. + mkdir sub + + am_cv_CC_dependencies_compiler_type=none + if test "$am_compiler_list" = ""; then + am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp` + fi + for depmode in $am_compiler_list; do + # Setup a source with many dependencies, because some compilers + # like to wrap large dependency lists on column 80 (with \), and + # we should not choose a depcomp mode which is confused by this. + # + # We need to recreate these files for each test, as the compiler may + # overwrite some of them when testing with obscure command lines. + # This happens at least with the AIX C compiler. + : > sub/conftest.c + for i in 1 2 3 4 5 6; do + echo '#include "conftst'$i'.h"' >> sub/conftest.c + # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with + # Solaris 8's {/usr,}/bin/sh. + touch sub/conftst$i.h + done + echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf + + case $depmode in + nosideeffect) + # after this tag, mechanisms are not by side-effect, so they'll + # only be used when explicitly requested + if test "x$enable_dependency_tracking" = xyes; then + continue + else + break + fi + ;; + none) break ;; + esac + # We check with `-c' and `-o' for the sake of the "dashmstdout" + # mode. It turns out that the SunPro C++ compiler does not properly + # handle `-M -o', and we need to detect this. + if depmode=$depmode \ + source=sub/conftest.c object=sub/conftest.${OBJEXT-o} \ + depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ + $SHELL ./depcomp $depcc -c -o sub/conftest.${OBJEXT-o} sub/conftest.c \ + >/dev/null 2>conftest.err && + grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && + grep sub/conftest.${OBJEXT-o} sub/conftest.Po > /dev/null 2>&1 && + ${MAKE-make} -s -f confmf > /dev/null 2>&1; then + # icc doesn't choke on unknown options, it will just issue warnings + # or remarks (even with -Werror). So we grep stderr for any message + # that says an option was ignored or not supported. + # When given -MP, icc 7.0 and 7.1 complain thusly: + # icc: Command line warning: ignoring option '-M'; no argument required + # The diagnosis changed in icc 8.0: + # icc: Command line remark: option '-MP' not supported + if (grep 'ignoring option' conftest.err || + grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else + am_cv_CC_dependencies_compiler_type=$depmode + break + fi + fi + done + + cd .. + rm -rf conftest.dir +else + am_cv_CC_dependencies_compiler_type=none +fi + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_CC_dependencies_compiler_type" >&5 +$as_echo "$am_cv_CC_dependencies_compiler_type" >&6; } +CCDEPMODE=depmode=$am_cv_CC_dependencies_compiler_type + + + +if + test "x$enable_dependency_tracking" != xno \ + && test "$am_cv_CC_dependencies_compiler_type" = gcc3; then + am__fastdepCC_TRUE= + am__fastdepCC_FALSE='#' +else + am__fastdepCC_TRUE='#' + am__fastdepCC_FALSE= +fi + + + CFLAGS="$ac_save_CFLAGS" + CPPFLAGS="$ac_save_CPPFLAGS" + + + + +curl_includes_inttypes="\ +/* includes start */ +#ifdef HAVE_SYS_TYPES_H +# include +#endif +#ifdef HAVE_STDINT_H +# include +#endif +#ifdef HAVE_INTTYPES_H +# include +#endif +/* includes end */" + case $host_os in + irix*) + ac_cv_header_stdint_h="no" + ;; + esac + for ac_header in sys/types.h stdint.h inttypes.h +do : + as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` +ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$curl_includes_inttypes +" +if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : + cat >>confdefs.h <<_ACEOF +#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + +done + + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to run the C preprocessor" >&5 +$as_echo_n "checking how to run the C preprocessor... " >&6; } +# On Suns, sometimes $CPP names a directory. +if test -n "$CPP" && test -d "$CPP"; then + CPP= +fi +if test -z "$CPP"; then + if test "${ac_cv_prog_CPP+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + # Double quotes because CPP needs to be expanded + for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp" + do + ac_preproc_ok=false +for ac_c_preproc_warn_flag in '' yes +do + # Use a header file that comes with gcc, so configuring glibc + # with a fresh cross-compiler works. + # Prefer to if __STDC__ is defined, since + # exists even on freestanding compilers. + # On the NeXT, cc -E runs the code through the compiler's parser, + # not just through cpp. "Syntax error" is here to catch this case. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#ifdef __STDC__ +# include +#else +# include +#endif + Syntax error +_ACEOF +if ac_fn_c_try_cpp "$LINENO"; then : + +else + # Broken: fails on valid input. +continue +fi +rm -f conftest.err conftest.i conftest.$ac_ext + + # OK, works on sane cases. Now check whether nonexistent headers + # can be detected and how. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +_ACEOF +if ac_fn_c_try_cpp "$LINENO"; then : + # Broken: success on invalid input. +continue +else + # Passes both tests. +ac_preproc_ok=: +break +fi +rm -f conftest.err conftest.i conftest.$ac_ext + +done +# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. +rm -f conftest.i conftest.err conftest.$ac_ext +if $ac_preproc_ok; then : + break +fi + + done + ac_cv_prog_CPP=$CPP + +fi + CPP=$ac_cv_prog_CPP +else + ac_cv_prog_CPP=$CPP +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $CPP" >&5 +$as_echo "$CPP" >&6; } +ac_preproc_ok=false +for ac_c_preproc_warn_flag in '' yes +do + # Use a header file that comes with gcc, so configuring glibc + # with a fresh cross-compiler works. + # Prefer to if __STDC__ is defined, since + # exists even on freestanding compilers. + # On the NeXT, cc -E runs the code through the compiler's parser, + # not just through cpp. "Syntax error" is here to catch this case. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#ifdef __STDC__ +# include +#else +# include +#endif + Syntax error +_ACEOF +if ac_fn_c_try_cpp "$LINENO"; then : + +else + # Broken: fails on valid input. +continue +fi +rm -f conftest.err conftest.i conftest.$ac_ext + + # OK, works on sane cases. Now check whether nonexistent headers + # can be detected and how. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +_ACEOF +if ac_fn_c_try_cpp "$LINENO"; then : + # Broken: success on invalid input. +continue +else + # Passes both tests. +ac_preproc_ok=: +break +fi +rm -f conftest.err conftest.i conftest.$ac_ext + +done +# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. +rm -f conftest.i conftest.err conftest.$ac_ext +if $ac_preproc_ok; then : + +else + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "C preprocessor \"$CPP\" fails sanity check +See \`config.log' for more details" "$LINENO" 5 ; } +fi + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for grep that handles long lines and -e" >&5 +$as_echo_n "checking for grep that handles long lines and -e... " >&6; } +if test "${ac_cv_path_GREP+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + if test -z "$GREP"; then + ac_path_GREP_found=false + # Loop through the user's path and test for each of PROGNAME-LIST + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_prog in grep ggrep; do + for ac_exec_ext in '' $ac_executable_extensions; do + ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext" + { test -f "$ac_path_GREP" && $as_test_x "$ac_path_GREP"; } || continue +# Check for GNU ac_path_GREP and select it if it is found. + # Check for GNU $ac_path_GREP +case `"$ac_path_GREP" --version 2>&1` in +*GNU*) + ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_found=:;; +*) + ac_count=0 + $as_echo_n 0123456789 >"conftest.in" + while : + do + cat "conftest.in" "conftest.in" >"conftest.tmp" + mv "conftest.tmp" "conftest.in" + cp "conftest.in" "conftest.nl" + $as_echo 'GREP' >> "conftest.nl" + "$ac_path_GREP" -e 'GREP$' -e '-(cannot match)-' < "conftest.nl" >"conftest.out" 2>/dev/null || break + diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break + as_fn_arith $ac_count + 1 && ac_count=$as_val + if test $ac_count -gt ${ac_path_GREP_max-0}; then + # Best one so far, save it but keep looking for a better one + ac_cv_path_GREP="$ac_path_GREP" + ac_path_GREP_max=$ac_count + fi + # 10*(2^10) chars as input seems more than enough + test $ac_count -gt 10 && break + done + rm -f conftest.in conftest.tmp conftest.nl conftest.out;; +esac + + $ac_path_GREP_found && break 3 + done + done + done +IFS=$as_save_IFS + if test -z "$ac_cv_path_GREP"; then + as_fn_error $? "no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 + fi +else + ac_cv_path_GREP=$GREP +fi + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_GREP" >&5 +$as_echo "$ac_cv_path_GREP" >&6; } + GREP="$ac_cv_path_GREP" + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for egrep" >&5 +$as_echo_n "checking for egrep... " >&6; } +if test "${ac_cv_path_EGREP+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + if echo a | $GREP -E '(a|b)' >/dev/null 2>&1 + then ac_cv_path_EGREP="$GREP -E" + else + if test -z "$EGREP"; then + ac_path_EGREP_found=false + # Loop through the user's path and test for each of PROGNAME-LIST + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_prog in egrep; do + for ac_exec_ext in '' $ac_executable_extensions; do + ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext" + { test -f "$ac_path_EGREP" && $as_test_x "$ac_path_EGREP"; } || continue +# Check for GNU ac_path_EGREP and select it if it is found. + # Check for GNU $ac_path_EGREP +case `"$ac_path_EGREP" --version 2>&1` in +*GNU*) + ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_found=:;; +*) + ac_count=0 + $as_echo_n 0123456789 >"conftest.in" + while : + do + cat "conftest.in" "conftest.in" >"conftest.tmp" + mv "conftest.tmp" "conftest.in" + cp "conftest.in" "conftest.nl" + $as_echo 'EGREP' >> "conftest.nl" + "$ac_path_EGREP" 'EGREP$' < "conftest.nl" >"conftest.out" 2>/dev/null || break + diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break + as_fn_arith $ac_count + 1 && ac_count=$as_val + if test $ac_count -gt ${ac_path_EGREP_max-0}; then + # Best one so far, save it but keep looking for a better one + ac_cv_path_EGREP="$ac_path_EGREP" + ac_path_EGREP_max=$ac_count + fi + # 10*(2^10) chars as input seems more than enough + test $ac_count -gt 10 && break + done + rm -f conftest.in conftest.tmp conftest.nl conftest.out;; +esac + + $ac_path_EGREP_found && break 3 + done + done + done +IFS=$as_save_IFS + if test -z "$ac_cv_path_EGREP"; then + as_fn_error $? "no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 + fi +else + ac_cv_path_EGREP=$EGREP +fi + + fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_EGREP" >&5 +$as_echo "$ac_cv_path_EGREP" >&6; } + EGREP="$ac_cv_path_EGREP" + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5 +$as_echo_n "checking for ANSI C header files... " >&6; } +if test "${ac_cv_header_stdc+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +#include +#include +#include + +int main (void) +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_header_stdc=yes +else + ac_cv_header_stdc=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + +if test $ac_cv_header_stdc = yes; then + # SunOS 4.x string.h does not declare mem*, contrary to ANSI. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "memchr" >/dev/null 2>&1; then : + +else + ac_cv_header_stdc=no +fi +rm -f conftest* + +fi + +if test $ac_cv_header_stdc = yes; then + # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "free" >/dev/null 2>&1; then : + +else + ac_cv_header_stdc=no +fi +rm -f conftest* + +fi + +if test $ac_cv_header_stdc = yes; then + # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. + if test "$cross_compiling" = yes; then : + : +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +#include +#if ((' ' & 0x0FF) == 0x020) +# define ISLOWER(c) ('a' <= (c) && (c) <= 'z') +# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) +#else +# define ISLOWER(c) \ + (('a' <= (c) && (c) <= 'i') \ + || ('j' <= (c) && (c) <= 'r') \ + || ('s' <= (c) && (c) <= 'z')) +# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) +#endif + +#define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) +int +main () +{ + int i; + for (i = 0; i < 256; i++) + if (XOR (islower (i), ISLOWER (i)) + || toupper (i) != TOUPPER (i)) + return 2; + return 0; +} +_ACEOF +if ac_fn_c_try_run "$LINENO"; then : + +else + ac_cv_header_stdc=no +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext +fi + +fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdc" >&5 +$as_echo "$ac_cv_header_stdc" >&6; } +if test $ac_cv_header_stdc = yes; then + +$as_echo "#define STDC_HEADERS 1" >>confdefs.h + +fi + +# On IRIX 5.3, sys/types and inttypes.h are conflicting. +for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \ + inttypes.h stdint.h unistd.h +do : + as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` +ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default +" +if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : + cat >>confdefs.h <<_ACEOF +#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + +done + + + + # + # + if test -z "$SED"; then + as_fn_error $? "SED not set. Cannot continue without SED being set." "$LINENO" 5 + fi + # + # The cast to long int works around a bug in the HP C Compiler +# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects +# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. +# This bug is HP SR number 8606223364. +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking size of long" >&5 +$as_echo_n "checking size of long... " >&6; } +if test "${ac_cv_sizeof_long+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (long))" "ac_cv_sizeof_long" "$ac_includes_default"; then : + +else + if test "$ac_cv_type_long" = yes; then + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error 77 "cannot compute sizeof (long) +See \`config.log' for more details" "$LINENO" 5 ; } + else + ac_cv_sizeof_long=0 + fi +fi + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_long" >&5 +$as_echo "$ac_cv_sizeof_long" >&6; } + + + +cat >>confdefs.h <<_ACEOF +#define SIZEOF_LONG $ac_cv_sizeof_long +_ACEOF + + + # The cast to long int works around a bug in the HP C Compiler +# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects +# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. +# This bug is HP SR number 8606223364. +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking size of void*" >&5 +$as_echo_n "checking size of void*... " >&6; } +if test "${ac_cv_sizeof_voidp+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (void*))" "ac_cv_sizeof_voidp" "$ac_includes_default"; then : + +else + if test "$ac_cv_type_voidp" = yes; then + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error 77 "cannot compute sizeof (void*) +See \`config.log' for more details" "$LINENO" 5 ; } + else + ac_cv_sizeof_voidp=0 + fi +fi + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_voidp" >&5 +$as_echo "$ac_cv_sizeof_voidp" >&6; } + + + +cat >>confdefs.h <<_ACEOF +#define SIZEOF_VOIDP $ac_cv_sizeof_voidp +_ACEOF + + + # + if test -z "$ac_cv_sizeof_long" || + test "$ac_cv_sizeof_long" -eq "0"; then + as_fn_error $? "cannot find out size of long." "$LINENO" 5 + fi + if test -z "$ac_cv_sizeof_voidp" || + test "$ac_cv_sizeof_voidp" -eq "0"; then + as_fn_error $? "cannot find out size of void*." "$LINENO" 5 + fi + # + x_LP64_long="" + x_LP32_long="" + x_LP16_long="" + # + if test "$ac_cv_sizeof_long" -eq "8" && + test "$ac_cv_sizeof_voidp" -ge "8"; then + x_LP64_long="long" + elif test "$ac_cv_sizeof_long" -eq "4" && + test "$ac_cv_sizeof_voidp" -ge "4"; then + x_LP32_long="long" + elif test "$ac_cv_sizeof_long" -eq "2" && + test "$ac_cv_sizeof_voidp" -ge "2"; then + x_LP16_long="long" + fi + # + # + curl_typeof_curl_off_t="unknown" + curl_sizeof_curl_off_t="unknown" + curl_format_curl_off_t="unknown" + curl_format_curl_off_tu="unknown" + # + if test "$curl_typeof_curl_off_t" = "unknown"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for 64-bit curl_off_t data type" >&5 +$as_echo_n "checking for 64-bit curl_off_t data type... " >&6; } + for t8 in \ + "$x_LP64_long" \ + 'int64_t' \ + '__int64' \ + 'long long' \ + '__longlong' \ + '__longlong_t' ; do + + if test "$curl_typeof_curl_off_t" = "unknown" && test ! -z "$t8"; then + tmp_includes="" + tmp_source="" + tmp_fmt="" + case `$as_echo "$t8" | $as_tr_sh` in + int64_t) + tmp_includes="$curl_includes_inttypes" + tmp_source="char f[] = PRId64;" + tmp_fmt="PRId64" + ;; + int32_t) + tmp_includes="$curl_includes_inttypes" + tmp_source="char f[] = PRId32;" + tmp_fmt="PRId32" + ;; + int16_t) + tmp_includes="$curl_includes_inttypes" + tmp_source="char f[] = PRId16;" + tmp_fmt="PRId16" + ;; + esac + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + + $tmp_includes + typedef $t8 curl_off_t; + typedef char dummy_arr[sizeof(curl_off_t) == 8 ? 1 : -1]; + +int main (void) +{ + + $tmp_source + curl_off_t dummy; + + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + + if test -z "$tmp_fmt"; then + curl_typeof_curl_off_t="$t8" + curl_sizeof_curl_off_t="8" + else + + as_ac_HaveDef=`$as_echo "curl_cv_have_def_$tmp_fmt" | $as_tr_sh` + as_ac_Def=`$as_echo "curl_cv_def_$tmp_fmt" | $as_tr_sh` + if test -z "$SED"; then + as_fn_error $? "SED not set. Cannot continue without SED being set." "$LINENO" 5 + fi + if test -z "$GREP"; then + as_fn_error $? "GREP not set. Cannot continue without GREP being set." "$LINENO" 5 + fi + + tmp_exp="" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + $curl_includes_inttypes +#ifdef $tmp_fmt +CURL_DEF_TOKEN $tmp_fmt +#endif + + +_ACEOF +if ac_fn_c_try_cpp "$LINENO"; then : + + tmp_exp=`eval "$ac_cpp conftest.$ac_ext" 2>/dev/null | \ + "$GREP" CURL_DEF_TOKEN 2>/dev/null | \ + "$SED" 's/.*CURL_DEF_TOKEN[ ]//' 2>/dev/null | \ + "$SED" 's/["][ ]*["]//g' 2>/dev/null` + if test -z "$tmp_exp" || test "$tmp_exp" = "$tmp_fmt"; then + tmp_exp="" + fi + +fi +rm -f conftest.err conftest.i conftest.$ac_ext + if test -z "$tmp_exp"; then + eval "$as_ac_HaveDef=no" + + else + eval "$as_ac_HaveDef=yes" + eval "$as_ac_Def=\$tmp_exp" + + fi + + as_tmp_HaveFmtDef=`$as_echo "curl_cv_have_def_$tmp_fmt" | $as_tr_sh` + as_tmp_FmtDef=`$as_echo "curl_cv_def_$tmp_fmt" | $as_tr_sh` + if test `eval 'as_val=${'$as_tmp_HaveFmtDef'};$as_echo "$as_val"'` = "yes"; then + curl_format_curl_off_t=`eval 'as_val=${'$as_tmp_FmtDef'};$as_echo "$as_val"'` + curl_typeof_curl_off_t="$t8" + curl_sizeof_curl_off_t="8" + fi + fi + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + fi + + done + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $curl_typeof_curl_off_t" >&5 +$as_echo "$curl_typeof_curl_off_t" >&6; } + fi + if test "$curl_typeof_curl_off_t" = "unknown"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for 32-bit curl_off_t data type" >&5 +$as_echo_n "checking for 32-bit curl_off_t data type... " >&6; } + for t4 in \ + "$x_LP32_long" \ + 'int32_t' \ + '__int32' \ + 'int' ; do + + if test "$curl_typeof_curl_off_t" = "unknown" && test ! -z "$t4"; then + tmp_includes="" + tmp_source="" + tmp_fmt="" + case `$as_echo "$t4" | $as_tr_sh` in + int64_t) + tmp_includes="$curl_includes_inttypes" + tmp_source="char f[] = PRId64;" + tmp_fmt="PRId64" + ;; + int32_t) + tmp_includes="$curl_includes_inttypes" + tmp_source="char f[] = PRId32;" + tmp_fmt="PRId32" + ;; + int16_t) + tmp_includes="$curl_includes_inttypes" + tmp_source="char f[] = PRId16;" + tmp_fmt="PRId16" + ;; + esac + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + + $tmp_includes + typedef $t4 curl_off_t; + typedef char dummy_arr[sizeof(curl_off_t) == 4 ? 1 : -1]; + +int main (void) +{ + + $tmp_source + curl_off_t dummy; + + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + + if test -z "$tmp_fmt"; then + curl_typeof_curl_off_t="$t4" + curl_sizeof_curl_off_t="4" + else + + as_ac_HaveDef=`$as_echo "curl_cv_have_def_$tmp_fmt" | $as_tr_sh` + as_ac_Def=`$as_echo "curl_cv_def_$tmp_fmt" | $as_tr_sh` + if test -z "$SED"; then + as_fn_error $? "SED not set. Cannot continue without SED being set." "$LINENO" 5 + fi + if test -z "$GREP"; then + as_fn_error $? "GREP not set. Cannot continue without GREP being set." "$LINENO" 5 + fi + + tmp_exp="" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + $curl_includes_inttypes +#ifdef $tmp_fmt +CURL_DEF_TOKEN $tmp_fmt +#endif + + +_ACEOF +if ac_fn_c_try_cpp "$LINENO"; then : + + tmp_exp=`eval "$ac_cpp conftest.$ac_ext" 2>/dev/null | \ + "$GREP" CURL_DEF_TOKEN 2>/dev/null | \ + "$SED" 's/.*CURL_DEF_TOKEN[ ]//' 2>/dev/null | \ + "$SED" 's/["][ ]*["]//g' 2>/dev/null` + if test -z "$tmp_exp" || test "$tmp_exp" = "$tmp_fmt"; then + tmp_exp="" + fi + +fi +rm -f conftest.err conftest.i conftest.$ac_ext + if test -z "$tmp_exp"; then + eval "$as_ac_HaveDef=no" + + else + eval "$as_ac_HaveDef=yes" + eval "$as_ac_Def=\$tmp_exp" + + fi + + as_tmp_HaveFmtDef=`$as_echo "curl_cv_have_def_$tmp_fmt" | $as_tr_sh` + as_tmp_FmtDef=`$as_echo "curl_cv_def_$tmp_fmt" | $as_tr_sh` + if test `eval 'as_val=${'$as_tmp_HaveFmtDef'};$as_echo "$as_val"'` = "yes"; then + curl_format_curl_off_t=`eval 'as_val=${'$as_tmp_FmtDef'};$as_echo "$as_val"'` + curl_typeof_curl_off_t="$t4" + curl_sizeof_curl_off_t="4" + fi + fi + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + fi + + done + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $curl_typeof_curl_off_t" >&5 +$as_echo "$curl_typeof_curl_off_t" >&6; } + fi + if test "$curl_typeof_curl_off_t" = "unknown"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for 16-bit curl_off_t data type" >&5 +$as_echo_n "checking for 16-bit curl_off_t data type... " >&6; } + for t2 in \ + "$x_LP16_long" \ + 'int16_t' \ + '__int16' \ + 'int' ; do + + if test "$curl_typeof_curl_off_t" = "unknown" && test ! -z "$t2"; then + tmp_includes="" + tmp_source="" + tmp_fmt="" + case `$as_echo "$t2" | $as_tr_sh` in + int64_t) + tmp_includes="$curl_includes_inttypes" + tmp_source="char f[] = PRId64;" + tmp_fmt="PRId64" + ;; + int32_t) + tmp_includes="$curl_includes_inttypes" + tmp_source="char f[] = PRId32;" + tmp_fmt="PRId32" + ;; + int16_t) + tmp_includes="$curl_includes_inttypes" + tmp_source="char f[] = PRId16;" + tmp_fmt="PRId16" + ;; + esac + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + + $tmp_includes + typedef $t2 curl_off_t; + typedef char dummy_arr[sizeof(curl_off_t) == 2 ? 1 : -1]; + +int main (void) +{ + + $tmp_source + curl_off_t dummy; + + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + + if test -z "$tmp_fmt"; then + curl_typeof_curl_off_t="$t2" + curl_sizeof_curl_off_t="2" + else + + as_ac_HaveDef=`$as_echo "curl_cv_have_def_$tmp_fmt" | $as_tr_sh` + as_ac_Def=`$as_echo "curl_cv_def_$tmp_fmt" | $as_tr_sh` + if test -z "$SED"; then + as_fn_error $? "SED not set. Cannot continue without SED being set." "$LINENO" 5 + fi + if test -z "$GREP"; then + as_fn_error $? "GREP not set. Cannot continue without GREP being set." "$LINENO" 5 + fi + + tmp_exp="" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + $curl_includes_inttypes +#ifdef $tmp_fmt +CURL_DEF_TOKEN $tmp_fmt +#endif + + +_ACEOF +if ac_fn_c_try_cpp "$LINENO"; then : + + tmp_exp=`eval "$ac_cpp conftest.$ac_ext" 2>/dev/null | \ + "$GREP" CURL_DEF_TOKEN 2>/dev/null | \ + "$SED" 's/.*CURL_DEF_TOKEN[ ]//' 2>/dev/null | \ + "$SED" 's/["][ ]*["]//g' 2>/dev/null` + if test -z "$tmp_exp" || test "$tmp_exp" = "$tmp_fmt"; then + tmp_exp="" + fi + +fi +rm -f conftest.err conftest.i conftest.$ac_ext + if test -z "$tmp_exp"; then + eval "$as_ac_HaveDef=no" + + else + eval "$as_ac_HaveDef=yes" + eval "$as_ac_Def=\$tmp_exp" + + fi + + as_tmp_HaveFmtDef=`$as_echo "curl_cv_have_def_$tmp_fmt" | $as_tr_sh` + as_tmp_FmtDef=`$as_echo "curl_cv_def_$tmp_fmt" | $as_tr_sh` + if test `eval 'as_val=${'$as_tmp_HaveFmtDef'};$as_echo "$as_val"'` = "yes"; then + curl_format_curl_off_t=`eval 'as_val=${'$as_tmp_FmtDef'};$as_echo "$as_val"'` + curl_typeof_curl_off_t="$t2" + curl_sizeof_curl_off_t="2" + fi + fi + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + fi + + done + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $curl_typeof_curl_off_t" >&5 +$as_echo "$curl_typeof_curl_off_t" >&6; } + fi + if test "$curl_typeof_curl_off_t" = "unknown"; then + as_fn_error $? "cannot find data type for curl_off_t." "$LINENO" 5 + fi + # + { $as_echo "$as_me:${as_lineno-$LINENO}: checking size of curl_off_t" >&5 +$as_echo_n "checking size of curl_off_t... " >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $curl_sizeof_curl_off_t" >&5 +$as_echo "$curl_sizeof_curl_off_t" >&6; } + # + { $as_echo "$as_me:${as_lineno-$LINENO}: checking formatting string directive for curl_off_t" >&5 +$as_echo_n "checking formatting string directive for curl_off_t... " >&6; } + if test "$curl_format_curl_off_t" != "unknown"; then + x_pull_headers="yes" + curl_format_curl_off_t=`echo "$curl_format_curl_off_t" | "$SED" 's/["]//g'` + curl_format_curl_off_tu=`echo "$curl_format_curl_off_t" | "$SED" 's/i$/u/'` + curl_format_curl_off_tu=`echo "$curl_format_curl_off_tu" | "$SED" 's/d$/u/'` + curl_format_curl_off_tu=`echo "$curl_format_curl_off_tu" | "$SED" 's/D$/U/'` + else + x_pull_headers="no" + case `$as_echo "$curl_typeof_curl_off_t" | $as_tr_sh` in + long_long | __longlong | __longlong_t) + curl_format_curl_off_t="lld" + curl_format_curl_off_tu="llu" + ;; + long) + curl_format_curl_off_t="ld" + curl_format_curl_off_tu="lu" + ;; + int) + curl_format_curl_off_t="d" + curl_format_curl_off_tu="u" + ;; + __int64) + curl_format_curl_off_t="I64d" + curl_format_curl_off_tu="I64u" + ;; + __int32) + curl_format_curl_off_t="I32d" + curl_format_curl_off_tu="I32u" + ;; + __int16) + curl_format_curl_off_t="I16d" + curl_format_curl_off_tu="I16u" + ;; + *) + as_fn_error $? "cannot find print format string for curl_off_t." "$LINENO" 5 + ;; + esac + fi + { $as_echo "$as_me:${as_lineno-$LINENO}: result: \"$curl_format_curl_off_t\"" >&5 +$as_echo "\"$curl_format_curl_off_t\"" >&6; } + # + { $as_echo "$as_me:${as_lineno-$LINENO}: checking formatting string directive for unsigned curl_off_t" >&5 +$as_echo_n "checking formatting string directive for unsigned curl_off_t... " >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: \"$curl_format_curl_off_tu\"" >&5 +$as_echo "\"$curl_format_curl_off_tu\"" >&6; } + # + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking constant suffix string for curl_off_t" >&5 +$as_echo_n "checking constant suffix string for curl_off_t... " >&6; } + # + curl_suffix_curl_off_t="unknown" + curl_suffix_curl_off_tu="unknown" + # + case `$as_echo "$curl_typeof_curl_off_t" | $as_tr_sh` in + long_long | __longlong | __longlong_t) + tst_suffixes="LL::" + ;; + long) + tst_suffixes="L::" + ;; + int) + tst_suffixes="::" + ;; + __int64 | int64_t) + tst_suffixes="LL:i64::" + ;; + __int32 | int32_t) + tst_suffixes="L:i32::" + ;; + __int16 | int16_t) + tst_suffixes="L:i16::" + ;; + *) + as_fn_error $? "unexpected data type $curl_typeof_curl_off_t" "$LINENO" 5 + ;; + esac + # + old_IFS=$IFS; IFS=':' + for tmp_ssuf in $tst_suffixes ; do + IFS=$old_IFS + if test "x$curl_suffix_curl_off_t" = "xunknown"; then + case $tmp_ssuf in + i64 | i32 | i16) + tmp_usuf="u$tmp_ssuf" + ;; + LL | L) + tmp_usuf="U$tmp_ssuf" + ;; + *) + tmp_usuf="" + ;; + esac + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + + $curl_includes_inttypes + typedef $curl_typeof_curl_off_t new_t; + +int main (void) +{ + + new_t s1; + new_t s2; + s1 = -10$tmp_ssuf ; + s2 = 20$tmp_ssuf ; + if(s1 > s2) + return 1; + + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + + curl_suffix_curl_off_t="$tmp_ssuf" + curl_suffix_curl_off_tu="$tmp_usuf" + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + fi + done + IFS=$old_IFS + # + if test "x$curl_suffix_curl_off_t" = "xunknown"; then + as_fn_error $? "cannot find constant suffix string for curl_off_t." "$LINENO" 5 + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $curl_suffix_curl_off_t" >&5 +$as_echo "$curl_suffix_curl_off_t" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: checking constant suffix string for unsigned curl_off_t" >&5 +$as_echo_n "checking constant suffix string for unsigned curl_off_t... " >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $curl_suffix_curl_off_tu" >&5 +$as_echo "$curl_suffix_curl_off_tu" >&6; } + fi + # + + # + if test "$x_pull_headers" = "yes"; then + if test "x$ac_cv_header_sys_types_h" = "xyes"; then + +cat >>confdefs.h <<_EOF +#define CURL_PULL_SYS_TYPES_H 1 +_EOF + + fi + if test "x$ac_cv_header_stdint_h" = "xyes"; then + +cat >>confdefs.h <<_EOF +#define CURL_PULL_STDINT_H 1 +_EOF + + fi + if test "x$ac_cv_header_inttypes_h" = "xyes"; then + +cat >>confdefs.h <<_EOF +#define CURL_PULL_INTTYPES_H 1 +_EOF + + fi + fi + # + +cat >>confdefs.h <<_EOF +#define CURL_TYPEOF_CURL_OFF_T $curl_typeof_curl_off_t +_EOF + + +cat >>confdefs.h <<_EOF +#define CURL_FORMAT_CURL_OFF_T "$curl_format_curl_off_t" +_EOF + + +cat >>confdefs.h <<_EOF +#define CURL_FORMAT_CURL_OFF_TU "$curl_format_curl_off_tu" +_EOF + + +cat >>confdefs.h <<_EOF +#define CURL_FORMAT_OFF_T "%$curl_format_curl_off_t" +_EOF + + +cat >>confdefs.h <<_EOF +#define CURL_SIZEOF_CURL_OFF_T $curl_sizeof_curl_off_t +_EOF + + +cat >>confdefs.h <<_EOF +#define CURL_SUFFIX_CURL_OFF_T $curl_suffix_curl_off_t +_EOF + + +cat >>confdefs.h <<_EOF +#define CURL_SUFFIX_CURL_OFF_TU $curl_suffix_curl_off_tu +_EOF + + # + + + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if OS is AIX (to define _ALL_SOURCE)" >&5 +$as_echo_n "checking if OS is AIX (to define _ALL_SOURCE)... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#ifdef _AIX + yes_this_is_aix +#endif + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "yes_this_is_aix" >/dev/null 2>&1; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + $as_echo "#define _ALL_SOURCE 1" >>confdefs.h + + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + +fi +rm -f conftest* + + + + + # + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if _THREAD_SAFE is already defined" >&5 +$as_echo_n "checking if _THREAD_SAFE is already defined... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + + +int main (void) +{ + +#ifdef _THREAD_SAFE + int dummy=1; +#else + force compilation error +#endif + + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + tmp_thread_safe_initially_defined="yes" + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + tmp_thread_safe_initially_defined="no" + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + # + if test "$tmp_thread_safe_initially_defined" = "no"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if _THREAD_SAFE is actually needed" >&5 +$as_echo_n "checking if _THREAD_SAFE is actually needed... " >&6; } + + case $host_os in + aix[123].* | aix4.[012].*) + tmp_need_thread_safe="no" + ;; + aix*) + tmp_need_thread_safe="yes" + ;; + *) + tmp_need_thread_safe="no" + ;; + esac + + if test "$tmp_need_thread_safe" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + fi + fi + # + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if _THREAD_SAFE is onwards defined" >&5 +$as_echo_n "checking if _THREAD_SAFE is onwards defined... " >&6; } + if test "$tmp_thread_safe_initially_defined" = "yes" || + test "$tmp_need_thread_safe" = "yes"; then + + +$as_echo "#define NEED_THREAD_SAFE 1" >>confdefs.h + +cat >>confdefs.h <<_EOF +#ifndef _THREAD_SAFE +# define _THREAD_SAFE +#endif +_EOF + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + fi + # + + + # + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if _REENTRANT is already defined" >&5 +$as_echo_n "checking if _REENTRANT is already defined... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + + +int main (void) +{ + +#ifdef _REENTRANT + int dummy=1; +#else + force compilation error +#endif + + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + tmp_reentrant_initially_defined="yes" + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + tmp_reentrant_initially_defined="no" + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + # + if test "$tmp_reentrant_initially_defined" = "no"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if _REENTRANT is actually needed" >&5 +$as_echo_n "checking if _REENTRANT is actually needed... " >&6; } + + case $host_os in + solaris*) + tmp_need_reentrant="yes" + ;; + *) + tmp_need_reentrant="no" + ;; + esac + + if test "$tmp_need_reentrant" = "no"; then + + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + +#include + +int main (void) +{ + + if(0 != errno) + return 1; + + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + + tmp_errno="yes" + +else + + tmp_errno="no" + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + if test "$tmp_errno" = "yes"; then + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + +#include + +int main (void) +{ + +#ifdef errno + int dummy=1; +#else + force compilation error +#endif + + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + + tmp_errno="errno_macro_defined" + +else + + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + +#define _REENTRANT +#include + +int main (void) +{ + +#ifdef errno + int dummy=1; +#else + force compilation error +#endif + + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + + tmp_errno="errno_macro_needs_reentrant" + tmp_need_reentrant="yes" + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + fi + + fi + if test "$tmp_need_reentrant" = "no"; then + + if test "$tmp_need_reentrant" = "no"; then + + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + +#define gmtime_r innocuous_gmtime_r +#ifdef __STDC__ +# include +#else +# include +#endif +#undef gmtime_r +#ifdef __cplusplus +extern "C" +#endif +char gmtime_r (); +#if defined __stub_gmtime_r || defined __stub___gmtime_r +choke me +#endif + +int main (void) +{ +return gmtime_r (); + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + + tmp_gmtime_r="yes" + +else + + tmp_gmtime_r="no" + +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + if test "$tmp_gmtime_r" = "yes"; then + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#include +#include + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "gmtime_r" >/dev/null 2>&1; then : + + tmp_gmtime_r="proto_declared" + +else + + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#define _REENTRANT +#include +#include + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "gmtime_r" >/dev/null 2>&1; then : + + tmp_gmtime_r="proto_needs_reentrant" + tmp_need_reentrant="yes" + +fi +rm -f conftest* + + +fi +rm -f conftest* + + fi + + fi + if test "$tmp_need_reentrant" = "no"; then + + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + +#define localtime_r innocuous_localtime_r +#ifdef __STDC__ +# include +#else +# include +#endif +#undef localtime_r +#ifdef __cplusplus +extern "C" +#endif +char localtime_r (); +#if defined __stub_localtime_r || defined __stub___localtime_r +choke me +#endif + +int main (void) +{ +return localtime_r (); + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + + tmp_localtime_r="yes" + +else + + tmp_localtime_r="no" + +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + if test "$tmp_localtime_r" = "yes"; then + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#include +#include + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "localtime_r" >/dev/null 2>&1; then : + + tmp_localtime_r="proto_declared" + +else + + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#define _REENTRANT +#include +#include + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "localtime_r" >/dev/null 2>&1; then : + + tmp_localtime_r="proto_needs_reentrant" + tmp_need_reentrant="yes" + +fi +rm -f conftest* + + +fi +rm -f conftest* + + fi + + fi + if test "$tmp_need_reentrant" = "no"; then + + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + +#define strerror_r innocuous_strerror_r +#ifdef __STDC__ +# include +#else +# include +#endif +#undef strerror_r +#ifdef __cplusplus +extern "C" +#endif +char strerror_r (); +#if defined __stub_strerror_r || defined __stub___strerror_r +choke me +#endif + +int main (void) +{ +return strerror_r (); + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + + tmp_strerror_r="yes" + +else + + tmp_strerror_r="no" + +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + if test "$tmp_strerror_r" = "yes"; then + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#include +#include + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "strerror_r" >/dev/null 2>&1; then : + + tmp_strerror_r="proto_declared" + +else + + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#define _REENTRANT +#include +#include + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "strerror_r" >/dev/null 2>&1; then : + + tmp_strerror_r="proto_needs_reentrant" + tmp_need_reentrant="yes" + +fi +rm -f conftest* + + +fi +rm -f conftest* + + fi + + fi + if test "$tmp_need_reentrant" = "no"; then + + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + +#define strtok_r innocuous_strtok_r +#ifdef __STDC__ +# include +#else +# include +#endif +#undef strtok_r +#ifdef __cplusplus +extern "C" +#endif +char strtok_r (); +#if defined __stub_strtok_r || defined __stub___strtok_r +choke me +#endif + +int main (void) +{ +return strtok_r (); + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + + tmp_strtok_r="yes" + +else + + tmp_strtok_r="no" + +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + if test "$tmp_strtok_r" = "yes"; then + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#include +#include + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "strtok_r" >/dev/null 2>&1; then : + + tmp_strtok_r="proto_declared" + +else + + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#define _REENTRANT +#include +#include + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "strtok_r" >/dev/null 2>&1; then : + + tmp_strtok_r="proto_needs_reentrant" + tmp_need_reentrant="yes" + +fi +rm -f conftest* + + +fi +rm -f conftest* + + fi + + fi + if test "$tmp_need_reentrant" = "no"; then + + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + +#define inet_ntoa_r innocuous_inet_ntoa_r +#ifdef __STDC__ +# include +#else +# include +#endif +#undef inet_ntoa_r +#ifdef __cplusplus +extern "C" +#endif +char inet_ntoa_r (); +#if defined __stub_inet_ntoa_r || defined __stub___inet_ntoa_r +choke me +#endif + +int main (void) +{ +return inet_ntoa_r (); + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + + tmp_inet_ntoa_r="yes" + +else + + tmp_inet_ntoa_r="no" + +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + if test "$tmp_inet_ntoa_r" = "yes"; then + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#include +#include +#include +#include + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "inet_ntoa_r" >/dev/null 2>&1; then : + + tmp_inet_ntoa_r="proto_declared" + +else + + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#define _REENTRANT +#include +#include +#include +#include + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "inet_ntoa_r" >/dev/null 2>&1; then : + + tmp_inet_ntoa_r="proto_needs_reentrant" + tmp_need_reentrant="yes" + +fi +rm -f conftest* + + +fi +rm -f conftest* + + fi + + fi + if test "$tmp_need_reentrant" = "no"; then + + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + +#define gethostbyaddr_r innocuous_gethostbyaddr_r +#ifdef __STDC__ +# include +#else +# include +#endif +#undef gethostbyaddr_r +#ifdef __cplusplus +extern "C" +#endif +char gethostbyaddr_r (); +#if defined __stub_gethostbyaddr_r || defined __stub___gethostbyaddr_r +choke me +#endif + +int main (void) +{ +return gethostbyaddr_r (); + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + + tmp_gethostbyaddr_r="yes" + +else + + tmp_gethostbyaddr_r="no" + +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + if test "$tmp_gethostbyaddr_r" = "yes"; then + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#include +#include + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "gethostbyaddr_r" >/dev/null 2>&1; then : + + tmp_gethostbyaddr_r="proto_declared" + +else + + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#define _REENTRANT +#include +#include + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "gethostbyaddr_r" >/dev/null 2>&1; then : + + tmp_gethostbyaddr_r="proto_needs_reentrant" + tmp_need_reentrant="yes" + +fi +rm -f conftest* + + +fi +rm -f conftest* + + fi + + fi + if test "$tmp_need_reentrant" = "no"; then + + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + +#define gethostbyname_r innocuous_gethostbyname_r +#ifdef __STDC__ +# include +#else +# include +#endif +#undef gethostbyname_r +#ifdef __cplusplus +extern "C" +#endif +char gethostbyname_r (); +#if defined __stub_gethostbyname_r || defined __stub___gethostbyname_r +choke me +#endif + +int main (void) +{ +return gethostbyname_r (); + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + + tmp_gethostbyname_r="yes" + +else + + tmp_gethostbyname_r="no" + +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + if test "$tmp_gethostbyname_r" = "yes"; then + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#include +#include + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "gethostbyname_r" >/dev/null 2>&1; then : + + tmp_gethostbyname_r="proto_declared" + +else + + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#define _REENTRANT +#include +#include + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "gethostbyname_r" >/dev/null 2>&1; then : + + tmp_gethostbyname_r="proto_needs_reentrant" + tmp_need_reentrant="yes" + +fi +rm -f conftest* + + +fi +rm -f conftest* + + fi + + fi + if test "$tmp_need_reentrant" = "no"; then + + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + +#define getprotobyname_r innocuous_getprotobyname_r +#ifdef __STDC__ +# include +#else +# include +#endif +#undef getprotobyname_r +#ifdef __cplusplus +extern "C" +#endif +char getprotobyname_r (); +#if defined __stub_getprotobyname_r || defined __stub___getprotobyname_r +choke me +#endif + +int main (void) +{ +return getprotobyname_r (); + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + + tmp_getprotobyname_r="yes" + +else + + tmp_getprotobyname_r="no" + +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + if test "$tmp_getprotobyname_r" = "yes"; then + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#include +#include + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "getprotobyname_r" >/dev/null 2>&1; then : + + tmp_getprotobyname_r="proto_declared" + +else + + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#define _REENTRANT +#include +#include + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "getprotobyname_r" >/dev/null 2>&1; then : + + tmp_getprotobyname_r="proto_needs_reentrant" + tmp_need_reentrant="yes" + +fi +rm -f conftest* + + +fi +rm -f conftest* + + fi + + fi + if test "$tmp_need_reentrant" = "no"; then + + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + +#define getservbyport_r innocuous_getservbyport_r +#ifdef __STDC__ +# include +#else +# include +#endif +#undef getservbyport_r +#ifdef __cplusplus +extern "C" +#endif +char getservbyport_r (); +#if defined __stub_getservbyport_r || defined __stub___getservbyport_r +choke me +#endif + +int main (void) +{ +return getservbyport_r (); + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + + tmp_getservbyport_r="yes" + +else + + tmp_getservbyport_r="no" + +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + if test "$tmp_getservbyport_r" = "yes"; then + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#include +#include + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "getservbyport_r" >/dev/null 2>&1; then : + + tmp_getservbyport_r="proto_declared" + +else + + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#define _REENTRANT +#include +#include + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "getservbyport_r" >/dev/null 2>&1; then : + + tmp_getservbyport_r="proto_needs_reentrant" + tmp_need_reentrant="yes" + +fi +rm -f conftest* + + +fi +rm -f conftest* + + fi + + fi + + fi + if test "$tmp_need_reentrant" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + fi + fi + # + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if _REENTRANT is onwards defined" >&5 +$as_echo_n "checking if _REENTRANT is onwards defined... " >&6; } + if test "$tmp_reentrant_initially_defined" = "yes" || + test "$tmp_need_reentrant" = "yes"; then + + +$as_echo "#define NEED_REENTRANT 1" >>confdefs.h + +cat >>confdefs.h <<_EOF +#ifndef _REENTRANT +# define _REENTRANT +#endif +_EOF + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + fi + # + + +# Check whether --enable-largefile was given. +if test "${enable_largefile+set}" = set; then : + enableval=$enable_largefile; +fi + +if test "$enable_largefile" != no; then + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for special C compiler options needed for large files" >&5 +$as_echo_n "checking for special C compiler options needed for large files... " >&6; } +if test "${ac_cv_sys_largefile_CC+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + ac_cv_sys_largefile_CC=no + if test "$GCC" != yes; then + ac_save_CC=$CC + while :; do + # IRIX 6.2 and later do not support large files by default, + # so use the C compiler's -n32 option if that helps. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + /* Check that off_t can represent 2**63 - 1 correctly. + We can't simply define LARGE_OFF_T to be 9223372036854775807, + since some C++ compilers masquerading as C compilers + incorrectly reject 9223372036854775807. */ +#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62)) + int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 + && LARGE_OFF_T % 2147483647 == 1) + ? 1 : -1]; +int main (void) +{ + + ; + return 0; +} +_ACEOF + if ac_fn_c_try_compile "$LINENO"; then : + break +fi +rm -f core conftest.err conftest.$ac_objext + CC="$CC -n32" + if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_sys_largefile_CC=' -n32'; break +fi +rm -f core conftest.err conftest.$ac_objext + break + done + CC=$ac_save_CC + rm -f conftest.$ac_ext + fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sys_largefile_CC" >&5 +$as_echo "$ac_cv_sys_largefile_CC" >&6; } + if test "$ac_cv_sys_largefile_CC" != no; then + CC=$CC$ac_cv_sys_largefile_CC + fi + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for _FILE_OFFSET_BITS value needed for large files" >&5 +$as_echo_n "checking for _FILE_OFFSET_BITS value needed for large files... " >&6; } +if test "${ac_cv_sys_file_offset_bits+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + while :; do + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + /* Check that off_t can represent 2**63 - 1 correctly. + We can't simply define LARGE_OFF_T to be 9223372036854775807, + since some C++ compilers masquerading as C compilers + incorrectly reject 9223372036854775807. */ +#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62)) + int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 + && LARGE_OFF_T % 2147483647 == 1) + ? 1 : -1]; +int main (void) +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_sys_file_offset_bits=no; break +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#define _FILE_OFFSET_BITS 64 +#include + /* Check that off_t can represent 2**63 - 1 correctly. + We can't simply define LARGE_OFF_T to be 9223372036854775807, + since some C++ compilers masquerading as C compilers + incorrectly reject 9223372036854775807. */ +#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62)) + int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 + && LARGE_OFF_T % 2147483647 == 1) + ? 1 : -1]; +int main (void) +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_sys_file_offset_bits=64; break +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + ac_cv_sys_file_offset_bits=unknown + break +done +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sys_file_offset_bits" >&5 +$as_echo "$ac_cv_sys_file_offset_bits" >&6; } +case $ac_cv_sys_file_offset_bits in #( + no | unknown) ;; + *) +cat >>confdefs.h <<_ACEOF +#define _FILE_OFFSET_BITS $ac_cv_sys_file_offset_bits +_ACEOF +;; +esac +rm -rf conftest* + if test $ac_cv_sys_file_offset_bits = unknown; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for _LARGE_FILES value needed for large files" >&5 +$as_echo_n "checking for _LARGE_FILES value needed for large files... " >&6; } +if test "${ac_cv_sys_large_files+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + while :; do + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + /* Check that off_t can represent 2**63 - 1 correctly. + We can't simply define LARGE_OFF_T to be 9223372036854775807, + since some C++ compilers masquerading as C compilers + incorrectly reject 9223372036854775807. */ +#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62)) + int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 + && LARGE_OFF_T % 2147483647 == 1) + ? 1 : -1]; +int main (void) +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_sys_large_files=no; break +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#define _LARGE_FILES 1 +#include + /* Check that off_t can represent 2**63 - 1 correctly. + We can't simply define LARGE_OFF_T to be 9223372036854775807, + since some C++ compilers masquerading as C compilers + incorrectly reject 9223372036854775807. */ +#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62)) + int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 + && LARGE_OFF_T % 2147483647 == 1) + ? 1 : -1]; +int main (void) +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_sys_large_files=1; break +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + ac_cv_sys_large_files=unknown + break +done +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sys_large_files" >&5 +$as_echo "$ac_cv_sys_large_files" >&6; } +case $ac_cv_sys_large_files in #( + no | unknown) ;; + *) +cat >>confdefs.h <<_ACEOF +#define _LARGE_FILES $ac_cv_sys_large_files +_ACEOF +;; +esac +rm -rf conftest* + fi +fi + + +enable_win32_dll=yes + +case $host in +*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-cegcc*) + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}as", so it can be a program name with args. +set dummy ${ac_tool_prefix}as; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if test "${ac_cv_prog_AS+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$AS"; then + ac_cv_prog_AS="$AS" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_AS="${ac_tool_prefix}as" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +AS=$ac_cv_prog_AS +if test -n "$AS"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AS" >&5 +$as_echo "$AS" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_AS"; then + ac_ct_AS=$AS + # Extract the first word of "as", so it can be a program name with args. +set dummy as; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if test "${ac_cv_prog_ac_ct_AS+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_AS"; then + ac_cv_prog_ac_ct_AS="$ac_ct_AS" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_ac_ct_AS="as" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_AS=$ac_cv_prog_ac_ct_AS +if test -n "$ac_ct_AS"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_AS" >&5 +$as_echo "$ac_ct_AS" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + if test "x$ac_ct_AS" = x; then + AS="false" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + AS=$ac_ct_AS + fi +else + AS="$ac_cv_prog_AS" +fi + + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}dlltool", so it can be a program name with args. +set dummy ${ac_tool_prefix}dlltool; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if test "${ac_cv_prog_DLLTOOL+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$DLLTOOL"; then + ac_cv_prog_DLLTOOL="$DLLTOOL" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_DLLTOOL="${ac_tool_prefix}dlltool" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +DLLTOOL=$ac_cv_prog_DLLTOOL +if test -n "$DLLTOOL"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DLLTOOL" >&5 +$as_echo "$DLLTOOL" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_DLLTOOL"; then + ac_ct_DLLTOOL=$DLLTOOL + # Extract the first word of "dlltool", so it can be a program name with args. +set dummy dlltool; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if test "${ac_cv_prog_ac_ct_DLLTOOL+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_DLLTOOL"; then + ac_cv_prog_ac_ct_DLLTOOL="$ac_ct_DLLTOOL" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_ac_ct_DLLTOOL="dlltool" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_DLLTOOL=$ac_cv_prog_ac_ct_DLLTOOL +if test -n "$ac_ct_DLLTOOL"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DLLTOOL" >&5 +$as_echo "$ac_ct_DLLTOOL" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + if test "x$ac_ct_DLLTOOL" = x; then + DLLTOOL="false" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + DLLTOOL=$ac_ct_DLLTOOL + fi +else + DLLTOOL="$ac_cv_prog_DLLTOOL" +fi + + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}objdump", so it can be a program name with args. +set dummy ${ac_tool_prefix}objdump; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if test "${ac_cv_prog_OBJDUMP+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$OBJDUMP"; then + ac_cv_prog_OBJDUMP="$OBJDUMP" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_OBJDUMP="${ac_tool_prefix}objdump" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +OBJDUMP=$ac_cv_prog_OBJDUMP +if test -n "$OBJDUMP"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OBJDUMP" >&5 +$as_echo "$OBJDUMP" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_OBJDUMP"; then + ac_ct_OBJDUMP=$OBJDUMP + # Extract the first word of "objdump", so it can be a program name with args. +set dummy objdump; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if test "${ac_cv_prog_ac_ct_OBJDUMP+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_OBJDUMP"; then + ac_cv_prog_ac_ct_OBJDUMP="$ac_ct_OBJDUMP" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_ac_ct_OBJDUMP="objdump" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_OBJDUMP=$ac_cv_prog_ac_ct_OBJDUMP +if test -n "$ac_ct_OBJDUMP"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OBJDUMP" >&5 +$as_echo "$ac_ct_OBJDUMP" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + if test "x$ac_ct_OBJDUMP" = x; then + OBJDUMP="false" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + OBJDUMP=$ac_ct_OBJDUMP + fi +else + OBJDUMP="$ac_cv_prog_OBJDUMP" +fi + + ;; +esac + +test -z "$AS" && AS=as + + + + + +test -z "$DLLTOOL" && DLLTOOL=dlltool + + + + + +test -z "$OBJDUMP" && OBJDUMP=objdump + + + + + + + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if arch-OS host is AMD64-Linux/FreeBSD (to build static libraries with PIC)" >&5 +$as_echo_n "checking if arch-OS host is AMD64-Linux/FreeBSD (to build static libraries with PIC)... " >&6; } +case $host in + x86_64*linux*|amd64*freebsd*|ia64*freebsd*) + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + with_pic=yes + ;; + *) + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + ;; +esac + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if compiler is icc (to build with PIC)" >&5 +$as_echo_n "checking if compiler is icc (to build with PIC)... " >&6; } +case $CC in + icc | */icc) + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + with_pic=yes + ;; + *) + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + ;; +esac + +case `pwd` in + *\ * | *\ *) + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Libtool does not cope well with whitespace in \`pwd\`" >&5 +$as_echo "$as_me: WARNING: Libtool does not cope well with whitespace in \`pwd\`" >&2;} ;; +esac + + + +macro_version='2.2.6b' +macro_revision='1.3017' + + + + + + + + + + + + + +ltmain="$ac_aux_dir/ltmain.sh" + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for a sed that does not truncate output" >&5 +$as_echo_n "checking for a sed that does not truncate output... " >&6; } +if test "${ac_cv_path_SED+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + ac_script=s/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb/ + for ac_i in 1 2 3 4 5 6 7; do + ac_script="$ac_script$as_nl$ac_script" + done + echo "$ac_script" 2>/dev/null | sed 99q >conftest.sed + { ac_script=; unset ac_script;} + if test -z "$SED"; then + ac_path_SED_found=false + # Loop through the user's path and test for each of PROGNAME-LIST + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_prog in sed gsed; do + for ac_exec_ext in '' $ac_executable_extensions; do + ac_path_SED="$as_dir/$ac_prog$ac_exec_ext" + { test -f "$ac_path_SED" && $as_test_x "$ac_path_SED"; } || continue +# Check for GNU ac_path_SED and select it if it is found. + # Check for GNU $ac_path_SED +case `"$ac_path_SED" --version 2>&1` in +*GNU*) + ac_cv_path_SED="$ac_path_SED" ac_path_SED_found=:;; +*) + ac_count=0 + $as_echo_n 0123456789 >"conftest.in" + while : + do + cat "conftest.in" "conftest.in" >"conftest.tmp" + mv "conftest.tmp" "conftest.in" + cp "conftest.in" "conftest.nl" + $as_echo '' >> "conftest.nl" + "$ac_path_SED" -f conftest.sed < "conftest.nl" >"conftest.out" 2>/dev/null || break + diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break + as_fn_arith $ac_count + 1 && ac_count=$as_val + if test $ac_count -gt ${ac_path_SED_max-0}; then + # Best one so far, save it but keep looking for a better one + ac_cv_path_SED="$ac_path_SED" + ac_path_SED_max=$ac_count + fi + # 10*(2^10) chars as input seems more than enough + test $ac_count -gt 10 && break + done + rm -f conftest.in conftest.tmp conftest.nl conftest.out;; +esac + + $ac_path_SED_found && break 3 + done + done + done +IFS=$as_save_IFS + if test -z "$ac_cv_path_SED"; then + as_fn_error $? "no acceptable sed could be found in \$PATH" "$LINENO" 5 + fi +else + ac_cv_path_SED=$SED +fi + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_SED" >&5 +$as_echo "$ac_cv_path_SED" >&6; } + SED="$ac_cv_path_SED" + rm -f conftest.sed + +test -z "$SED" && SED=sed +Xsed="$SED -e 1s/^X//" + + + + + + + + + + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for fgrep" >&5 +$as_echo_n "checking for fgrep... " >&6; } +if test "${ac_cv_path_FGREP+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + if echo 'ab*c' | $GREP -F 'ab*c' >/dev/null 2>&1 + then ac_cv_path_FGREP="$GREP -F" + else + if test -z "$FGREP"; then + ac_path_FGREP_found=false + # Loop through the user's path and test for each of PROGNAME-LIST + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_prog in fgrep; do + for ac_exec_ext in '' $ac_executable_extensions; do + ac_path_FGREP="$as_dir/$ac_prog$ac_exec_ext" + { test -f "$ac_path_FGREP" && $as_test_x "$ac_path_FGREP"; } || continue +# Check for GNU ac_path_FGREP and select it if it is found. + # Check for GNU $ac_path_FGREP +case `"$ac_path_FGREP" --version 2>&1` in +*GNU*) + ac_cv_path_FGREP="$ac_path_FGREP" ac_path_FGREP_found=:;; +*) + ac_count=0 + $as_echo_n 0123456789 >"conftest.in" + while : + do + cat "conftest.in" "conftest.in" >"conftest.tmp" + mv "conftest.tmp" "conftest.in" + cp "conftest.in" "conftest.nl" + $as_echo 'FGREP' >> "conftest.nl" + "$ac_path_FGREP" FGREP < "conftest.nl" >"conftest.out" 2>/dev/null || break + diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break + as_fn_arith $ac_count + 1 && ac_count=$as_val + if test $ac_count -gt ${ac_path_FGREP_max-0}; then + # Best one so far, save it but keep looking for a better one + ac_cv_path_FGREP="$ac_path_FGREP" + ac_path_FGREP_max=$ac_count + fi + # 10*(2^10) chars as input seems more than enough + test $ac_count -gt 10 && break + done + rm -f conftest.in conftest.tmp conftest.nl conftest.out;; +esac + + $ac_path_FGREP_found && break 3 + done + done + done +IFS=$as_save_IFS + if test -z "$ac_cv_path_FGREP"; then + as_fn_error $? "no acceptable fgrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 + fi +else + ac_cv_path_FGREP=$FGREP +fi + + fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_FGREP" >&5 +$as_echo "$ac_cv_path_FGREP" >&6; } + FGREP="$ac_cv_path_FGREP" + + +test -z "$GREP" && GREP=grep + + + + + + + + + + + + + + + + + + + +# Check whether --with-gnu-ld was given. +if test "${with_gnu_ld+set}" = set; then : + withval=$with_gnu_ld; test "$withval" = no || with_gnu_ld=yes +else + with_gnu_ld=no +fi + +ac_prog=ld +if test "$GCC" = yes; then + # Check if gcc -print-prog-name=ld gives a path. + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ld used by $CC" >&5 +$as_echo_n "checking for ld used by $CC... " >&6; } + case $host in + *-*-mingw*) + # gcc leaves a trailing carriage return which upsets mingw + ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;; + *) + ac_prog=`($CC -print-prog-name=ld) 2>&5` ;; + esac + case $ac_prog in + # Accept absolute paths. + [\\/]* | ?:[\\/]*) + re_direlt='/[^/][^/]*/\.\./' + # Canonicalize the pathname of ld + ac_prog=`$ECHO "$ac_prog"| $SED 's%\\\\%/%g'` + while $ECHO "$ac_prog" | $GREP "$re_direlt" > /dev/null 2>&1; do + ac_prog=`$ECHO $ac_prog| $SED "s%$re_direlt%/%"` + done + test -z "$LD" && LD="$ac_prog" + ;; + "") + # If it fails, then pretend we aren't using GCC. + ac_prog=ld + ;; + *) + # If it is relative, then search for the first ld in PATH. + with_gnu_ld=unknown + ;; + esac +elif test "$with_gnu_ld" = yes; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GNU ld" >&5 +$as_echo_n "checking for GNU ld... " >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for non-GNU ld" >&5 +$as_echo_n "checking for non-GNU ld... " >&6; } +fi +if test "${lt_cv_path_LD+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + if test -z "$LD"; then + lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR + for ac_dir in $PATH; do + IFS="$lt_save_ifs" + test -z "$ac_dir" && ac_dir=. + if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then + lt_cv_path_LD="$ac_dir/$ac_prog" + # Check to see if the program is GNU ld. I'd rather use --version, + # but apparently some variants of GNU ld only accept -v. + # Break only if it was the GNU/non-GNU ld that we prefer. + case `"$lt_cv_path_LD" -v 2>&1 &5 +$as_echo "$LD" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi +test -z "$LD" && as_fn_error $? "no acceptable ld found in \$PATH" "$LINENO" 5 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if the linker ($LD) is GNU ld" >&5 +$as_echo_n "checking if the linker ($LD) is GNU ld... " >&6; } +if test "${lt_cv_prog_gnu_ld+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + # I'd rather use --version here, but apparently some GNU lds only accept -v. +case `$LD -v 2>&1 &5 +$as_echo "$lt_cv_prog_gnu_ld" >&6; } +with_gnu_ld=$lt_cv_prog_gnu_ld + + + + + + + + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for BSD- or MS-compatible name lister (nm)" >&5 +$as_echo_n "checking for BSD- or MS-compatible name lister (nm)... " >&6; } +if test "${lt_cv_path_NM+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$NM"; then + # Let the user override the test. + lt_cv_path_NM="$NM" +else + lt_nm_to_check="${ac_tool_prefix}nm" + if test -n "$ac_tool_prefix" && test "$build" = "$host"; then + lt_nm_to_check="$lt_nm_to_check nm" + fi + for lt_tmp_nm in $lt_nm_to_check; do + lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR + for ac_dir in $PATH /usr/ccs/bin/elf /usr/ccs/bin /usr/ucb /bin; do + IFS="$lt_save_ifs" + test -z "$ac_dir" && ac_dir=. + tmp_nm="$ac_dir/$lt_tmp_nm" + if test -f "$tmp_nm" || test -f "$tmp_nm$ac_exeext" ; then + # Check to see if the nm accepts a BSD-compat flag. + # Adding the `sed 1q' prevents false positives on HP-UX, which says: + # nm: unknown option "B" ignored + # Tru64's nm complains that /dev/null is an invalid object file + case `"$tmp_nm" -B /dev/null 2>&1 | sed '1q'` in + */dev/null* | *'Invalid file or object type'*) + lt_cv_path_NM="$tmp_nm -B" + break + ;; + *) + case `"$tmp_nm" -p /dev/null 2>&1 | sed '1q'` in + */dev/null*) + lt_cv_path_NM="$tmp_nm -p" + break + ;; + *) + lt_cv_path_NM=${lt_cv_path_NM="$tmp_nm"} # keep the first match, but + continue # so that we can try to find one that supports BSD flags + ;; + esac + ;; + esac + fi + done + IFS="$lt_save_ifs" + done + : ${lt_cv_path_NM=no} +fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_path_NM" >&5 +$as_echo "$lt_cv_path_NM" >&6; } +if test "$lt_cv_path_NM" != "no"; then + NM="$lt_cv_path_NM" +else + # Didn't find any BSD compatible name lister, look for dumpbin. + if test -n "$ac_tool_prefix"; then + for ac_prog in "dumpbin -symbols" "link -dump -symbols" + do + # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. +set dummy $ac_tool_prefix$ac_prog; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if test "${ac_cv_prog_DUMPBIN+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$DUMPBIN"; then + ac_cv_prog_DUMPBIN="$DUMPBIN" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_DUMPBIN="$ac_tool_prefix$ac_prog" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +DUMPBIN=$ac_cv_prog_DUMPBIN +if test -n "$DUMPBIN"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DUMPBIN" >&5 +$as_echo "$DUMPBIN" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + test -n "$DUMPBIN" && break + done +fi +if test -z "$DUMPBIN"; then + ac_ct_DUMPBIN=$DUMPBIN + for ac_prog in "dumpbin -symbols" "link -dump -symbols" +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if test "${ac_cv_prog_ac_ct_DUMPBIN+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_DUMPBIN"; then + ac_cv_prog_ac_ct_DUMPBIN="$ac_ct_DUMPBIN" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_ac_ct_DUMPBIN="$ac_prog" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_DUMPBIN=$ac_cv_prog_ac_ct_DUMPBIN +if test -n "$ac_ct_DUMPBIN"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DUMPBIN" >&5 +$as_echo "$ac_ct_DUMPBIN" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + test -n "$ac_ct_DUMPBIN" && break +done + + if test "x$ac_ct_DUMPBIN" = x; then + DUMPBIN=":" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + DUMPBIN=$ac_ct_DUMPBIN + fi +fi + + + if test "$DUMPBIN" != ":"; then + NM="$DUMPBIN" + fi +fi +test -z "$NM" && NM=nm + + + + + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking the name lister ($NM) interface" >&5 +$as_echo_n "checking the name lister ($NM) interface... " >&6; } +if test "${lt_cv_nm_interface+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + lt_cv_nm_interface="BSD nm" + echo "int some_variable = 0;" > conftest.$ac_ext + (eval echo "\"\$as_me:7909: $ac_compile\"" >&5) + (eval "$ac_compile" 2>conftest.err) + cat conftest.err >&5 + (eval echo "\"\$as_me:7912: $NM \\\"conftest.$ac_objext\\\"\"" >&5) + (eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out) + cat conftest.err >&5 + (eval echo "\"\$as_me:7915: output\"" >&5) + cat conftest.out >&5 + if $GREP 'External.*some_variable' conftest.out > /dev/null; then + lt_cv_nm_interface="MS dumpbin" + fi + rm -f conftest* +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_nm_interface" >&5 +$as_echo "$lt_cv_nm_interface" >&6; } + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ln -s works" >&5 +$as_echo_n "checking whether ln -s works... " >&6; } +LN_S=$as_ln_s +if test "$LN_S" = "ln -s"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no, using $LN_S" >&5 +$as_echo "no, using $LN_S" >&6; } +fi + +# find the maximum length of command line arguments +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking the maximum length of command line arguments" >&5 +$as_echo_n "checking the maximum length of command line arguments... " >&6; } +if test "${lt_cv_sys_max_cmd_len+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + i=0 + teststring="ABCD" + + case $build_os in + msdosdjgpp*) + # On DJGPP, this test can blow up pretty badly due to problems in libc + # (any single argument exceeding 2000 bytes causes a buffer overrun + # during glob expansion). Even if it were fixed, the result of this + # check would be larger than it should be. + lt_cv_sys_max_cmd_len=12288; # 12K is about right + ;; + + gnu*) + # Under GNU Hurd, this test is not required because there is + # no limit to the length of command line arguments. + # Libtool will interpret -1 as no limit whatsoever + lt_cv_sys_max_cmd_len=-1; + ;; + + cygwin* | mingw* | cegcc*) + # On Win9x/ME, this test blows up -- it succeeds, but takes + # about 5 minutes as the teststring grows exponentially. + # Worse, since 9x/ME are not pre-emptively multitasking, + # you end up with a "frozen" computer, even though with patience + # the test eventually succeeds (with a max line length of 256k). + # Instead, let's just punt: use the minimum linelength reported by + # all of the supported platforms: 8192 (on NT/2K/XP). + lt_cv_sys_max_cmd_len=8192; + ;; + + amigaos*) + # On AmigaOS with pdksh, this test takes hours, literally. + # So we just punt and use a minimum line length of 8192. + lt_cv_sys_max_cmd_len=8192; + ;; + + netbsd* | freebsd* | openbsd* | darwin* | dragonfly*) + # This has been around since 386BSD, at least. Likely further. + if test -x /sbin/sysctl; then + lt_cv_sys_max_cmd_len=`/sbin/sysctl -n kern.argmax` + elif test -x /usr/sbin/sysctl; then + lt_cv_sys_max_cmd_len=`/usr/sbin/sysctl -n kern.argmax` + else + lt_cv_sys_max_cmd_len=65536 # usable default for all BSDs + fi + # And add a safety zone + lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` + lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` + ;; + + interix*) + # We know the value 262144 and hardcode it with a safety zone (like BSD) + lt_cv_sys_max_cmd_len=196608 + ;; + + osf*) + # Dr. Hans Ekkehard Plesser reports seeing a kernel panic running configure + # due to this test when exec_disable_arg_limit is 1 on Tru64. It is not + # nice to cause kernel panics so lets avoid the loop below. + # First set a reasonable default. + lt_cv_sys_max_cmd_len=16384 + # + if test -x /sbin/sysconfig; then + case `/sbin/sysconfig -q proc exec_disable_arg_limit` in + *1*) lt_cv_sys_max_cmd_len=-1 ;; + esac + fi + ;; + sco3.2v5*) + lt_cv_sys_max_cmd_len=102400 + ;; + sysv5* | sco5v6* | sysv4.2uw2*) + kargmax=`grep ARG_MAX /etc/conf/cf.d/stune 2>/dev/null` + if test -n "$kargmax"; then + lt_cv_sys_max_cmd_len=`echo $kargmax | sed 's/.*[ ]//'` + else + lt_cv_sys_max_cmd_len=32768 + fi + ;; + *) + lt_cv_sys_max_cmd_len=`(getconf ARG_MAX) 2> /dev/null` + if test -n "$lt_cv_sys_max_cmd_len"; then + lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` + lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` + else + # Make teststring a little bigger before we do anything with it. + # a 1K string should be a reasonable start. + for i in 1 2 3 4 5 6 7 8 ; do + teststring=$teststring$teststring + done + SHELL=${SHELL-${CONFIG_SHELL-/bin/sh}} + # If test is not a shell built-in, we'll probably end up computing a + # maximum length that is only half of the actual maximum length, but + # we can't tell. + while { test "X"`$SHELL $0 --fallback-echo "X$teststring$teststring" 2>/dev/null` \ + = "XX$teststring$teststring"; } >/dev/null 2>&1 && + test $i != 17 # 1/2 MB should be enough + do + i=`expr $i + 1` + teststring=$teststring$teststring + done + # Only check the string length outside the loop. + lt_cv_sys_max_cmd_len=`expr "X$teststring" : ".*" 2>&1` + teststring= + # Add a significant safety factor because C++ compilers can tack on + # massive amounts of additional arguments before passing them to the + # linker. It appears as though 1/2 is a usable value. + lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 2` + fi + ;; + esac + +fi + +if test -n $lt_cv_sys_max_cmd_len ; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_sys_max_cmd_len" >&5 +$as_echo "$lt_cv_sys_max_cmd_len" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: none" >&5 +$as_echo "none" >&6; } +fi +max_cmd_len=$lt_cv_sys_max_cmd_len + + + + + + +: ${CP="cp -f"} +: ${MV="mv -f"} +: ${RM="rm -f"} + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the shell understands some XSI constructs" >&5 +$as_echo_n "checking whether the shell understands some XSI constructs... " >&6; } +# Try some XSI features +xsi_shell=no +( _lt_dummy="a/b/c" + test "${_lt_dummy##*/},${_lt_dummy%/*},"${_lt_dummy%"$_lt_dummy"}, \ + = c,a/b,, \ + && eval 'test $(( 1 + 1 )) -eq 2 \ + && test "${#_lt_dummy}" -eq 5' ) >/dev/null 2>&1 \ + && xsi_shell=yes +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $xsi_shell" >&5 +$as_echo "$xsi_shell" >&6; } + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the shell understands \"+=\"" >&5 +$as_echo_n "checking whether the shell understands \"+=\"... " >&6; } +lt_shell_append=no +( foo=bar; set foo baz; eval "$1+=\$2" && test "$foo" = barbaz ) \ + >/dev/null 2>&1 \ + && lt_shell_append=yes +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_shell_append" >&5 +$as_echo "$lt_shell_append" >&6; } + + +if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then + lt_unset=unset +else + lt_unset=false +fi + + + + + +# test EBCDIC or ASCII +case `echo X|tr X '\101'` in + A) # ASCII based system + # \n is not interpreted correctly by Solaris 8 /usr/ucb/tr + lt_SP2NL='tr \040 \012' + lt_NL2SP='tr \015\012 \040\040' + ;; + *) # EBCDIC based system + lt_SP2NL='tr \100 \n' + lt_NL2SP='tr \r\n \100\100' + ;; +esac + + + + + + + + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $LD option to reload object files" >&5 +$as_echo_n "checking for $LD option to reload object files... " >&6; } +if test "${lt_cv_ld_reload_flag+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + lt_cv_ld_reload_flag='-r' +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ld_reload_flag" >&5 +$as_echo "$lt_cv_ld_reload_flag" >&6; } +reload_flag=$lt_cv_ld_reload_flag +case $reload_flag in +"" | " "*) ;; +*) reload_flag=" $reload_flag" ;; +esac +reload_cmds='$LD$reload_flag -o $output$reload_objs' +case $host_os in + darwin*) + if test "$GCC" = yes; then + reload_cmds='$LTCC $LTCFLAGS -nostdlib ${wl}-r -o $output$reload_objs' + else + reload_cmds='$LD$reload_flag -o $output$reload_objs' + fi + ;; +esac + + + + + + + + + +if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}objdump", so it can be a program name with args. +set dummy ${ac_tool_prefix}objdump; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if test "${ac_cv_prog_OBJDUMP+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$OBJDUMP"; then + ac_cv_prog_OBJDUMP="$OBJDUMP" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_OBJDUMP="${ac_tool_prefix}objdump" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +OBJDUMP=$ac_cv_prog_OBJDUMP +if test -n "$OBJDUMP"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OBJDUMP" >&5 +$as_echo "$OBJDUMP" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_OBJDUMP"; then + ac_ct_OBJDUMP=$OBJDUMP + # Extract the first word of "objdump", so it can be a program name with args. +set dummy objdump; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if test "${ac_cv_prog_ac_ct_OBJDUMP+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_OBJDUMP"; then + ac_cv_prog_ac_ct_OBJDUMP="$ac_ct_OBJDUMP" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_ac_ct_OBJDUMP="objdump" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_OBJDUMP=$ac_cv_prog_ac_ct_OBJDUMP +if test -n "$ac_ct_OBJDUMP"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OBJDUMP" >&5 +$as_echo "$ac_ct_OBJDUMP" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + if test "x$ac_ct_OBJDUMP" = x; then + OBJDUMP="false" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + OBJDUMP=$ac_ct_OBJDUMP + fi +else + OBJDUMP="$ac_cv_prog_OBJDUMP" +fi + +test -z "$OBJDUMP" && OBJDUMP=objdump + + + + + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to recognize dependent libraries" >&5 +$as_echo_n "checking how to recognize dependent libraries... " >&6; } +if test "${lt_cv_deplibs_check_method+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + lt_cv_file_magic_cmd='$MAGIC_CMD' +lt_cv_file_magic_test_file= +lt_cv_deplibs_check_method='unknown' +# Need to set the preceding variable on all platforms that support +# interlibrary dependencies. +# 'none' -- dependencies not supported. +# `unknown' -- same as none, but documents that we really don't know. +# 'pass_all' -- all dependencies passed with no checks. +# 'test_compile' -- check by making test program. +# 'file_magic [[regex]]' -- check by looking for files in library path +# which responds to the $file_magic_cmd with a given extended regex. +# If you have `file' or equivalent on your system and you're not sure +# whether `pass_all' will *always* work, you probably want this one. + +case $host_os in +aix[4-9]*) + lt_cv_deplibs_check_method=pass_all + ;; + +beos*) + lt_cv_deplibs_check_method=pass_all + ;; + +bsdi[45]*) + lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib)' + lt_cv_file_magic_cmd='/usr/bin/file -L' + lt_cv_file_magic_test_file=/shlib/libc.so + ;; + +cygwin*) + # func_win32_libid is a shell function defined in ltmain.sh + lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL' + lt_cv_file_magic_cmd='func_win32_libid' + ;; + +mingw* | pw32*) + # Base MSYS/MinGW do not provide the 'file' command needed by + # func_win32_libid shell function, so use a weaker test based on 'objdump', + # unless we find 'file', for example because we are cross-compiling. + if ( file / ) >/dev/null 2>&1; then + lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL' + lt_cv_file_magic_cmd='func_win32_libid' + else + lt_cv_deplibs_check_method='file_magic file format pei*-i386(.*architecture: i386)?' + lt_cv_file_magic_cmd='$OBJDUMP -f' + fi + ;; + +cegcc) + # use the weaker test based on 'objdump'. See mingw*. + lt_cv_deplibs_check_method='file_magic file format pe-arm-.*little(.*architecture: arm)?' + lt_cv_file_magic_cmd='$OBJDUMP -f' + ;; + +darwin* | rhapsody*) + lt_cv_deplibs_check_method=pass_all + ;; + +freebsd* | dragonfly*) + if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then + case $host_cpu in + i*86 ) + # Not sure whether the presence of OpenBSD here was a mistake. + # Let's accept both of them until this is cleared up. + lt_cv_deplibs_check_method='file_magic (FreeBSD|OpenBSD|DragonFly)/i[3-9]86 (compact )?demand paged shared library' + lt_cv_file_magic_cmd=/usr/bin/file + lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*` + ;; + esac + else + lt_cv_deplibs_check_method=pass_all + fi + ;; + +gnu*) + lt_cv_deplibs_check_method=pass_all + ;; + +hpux10.20* | hpux11*) + lt_cv_file_magic_cmd=/usr/bin/file + case $host_cpu in + ia64*) + lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF-[0-9][0-9]) shared object file - IA64' + lt_cv_file_magic_test_file=/usr/lib/hpux32/libc.so + ;; + hppa*64*) + lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF-[0-9][0-9]) shared object file - PA-RISC [0-9].[0-9]' + lt_cv_file_magic_test_file=/usr/lib/pa20_64/libc.sl + ;; + *) + lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|PA-RISC[0-9].[0-9]) shared library' + lt_cv_file_magic_test_file=/usr/lib/libc.sl + ;; + esac + ;; + +interix[3-9]*) + # PIC code is broken on Interix 3.x, that's why |\.a not |_pic\.a here + lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so|\.a)$' + ;; + +irix5* | irix6* | nonstopux*) + case $LD in + *-32|*"-32 ") libmagic=32-bit;; + *-n32|*"-n32 ") libmagic=N32;; + *-64|*"-64 ") libmagic=64-bit;; + *) libmagic=never-match;; + esac + lt_cv_deplibs_check_method=pass_all + ;; + +# This must be Linux ELF. +linux* | k*bsd*-gnu | kopensolaris*-gnu) + lt_cv_deplibs_check_method=pass_all + ;; + +netbsd* | netbsdelf*-gnu) + if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then + lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|_pic\.a)$' + else + lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so|_pic\.a)$' + fi + ;; + +newos6*) + lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (executable|dynamic lib)' + lt_cv_file_magic_cmd=/usr/bin/file + lt_cv_file_magic_test_file=/usr/lib/libnls.so + ;; + +*nto* | *qnx*) + lt_cv_deplibs_check_method=pass_all + ;; + +openbsd*) + if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then + lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|\.so|_pic\.a)$' + else + lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|_pic\.a)$' + fi + ;; + +osf3* | osf4* | osf5*) + lt_cv_deplibs_check_method=pass_all + ;; + +rdos*) + lt_cv_deplibs_check_method=pass_all + ;; + +solaris*) + lt_cv_deplibs_check_method=pass_all + ;; + +sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) + lt_cv_deplibs_check_method=pass_all + ;; + +sysv4 | sysv4.3*) + case $host_vendor in + motorola) + lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib) M[0-9][0-9]* Version [0-9]' + lt_cv_file_magic_test_file=`echo /usr/lib/libc.so*` + ;; + ncr) + lt_cv_deplibs_check_method=pass_all + ;; + sequent) + lt_cv_file_magic_cmd='/bin/file' + lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [LM]SB (shared object|dynamic lib )' + ;; + sni) + lt_cv_file_magic_cmd='/bin/file' + lt_cv_deplibs_check_method="file_magic ELF [0-9][0-9]*-bit [LM]SB dynamic lib" + lt_cv_file_magic_test_file=/lib/libc.so + ;; + siemens) + lt_cv_deplibs_check_method=pass_all + ;; + pc) + lt_cv_deplibs_check_method=pass_all + ;; + esac + ;; + +tpf*) + lt_cv_deplibs_check_method=pass_all + ;; +esac + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_deplibs_check_method" >&5 +$as_echo "$lt_cv_deplibs_check_method" >&6; } +file_magic_cmd=$lt_cv_file_magic_cmd +deplibs_check_method=$lt_cv_deplibs_check_method +test -z "$deplibs_check_method" && deplibs_check_method=unknown + + + + + + + + + + + + +if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}ar", so it can be a program name with args. +set dummy ${ac_tool_prefix}ar; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if test "${ac_cv_prog_AR+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$AR"; then + ac_cv_prog_AR="$AR" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_AR="${ac_tool_prefix}ar" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +AR=$ac_cv_prog_AR +if test -n "$AR"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AR" >&5 +$as_echo "$AR" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_AR"; then + ac_ct_AR=$AR + # Extract the first word of "ar", so it can be a program name with args. +set dummy ar; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if test "${ac_cv_prog_ac_ct_AR+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_AR"; then + ac_cv_prog_ac_ct_AR="$ac_ct_AR" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_ac_ct_AR="ar" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_AR=$ac_cv_prog_ac_ct_AR +if test -n "$ac_ct_AR"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_AR" >&5 +$as_echo "$ac_ct_AR" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + if test "x$ac_ct_AR" = x; then + AR="false" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + AR=$ac_ct_AR + fi +else + AR="$ac_cv_prog_AR" +fi + +test -z "$AR" && AR=ar +test -z "$AR_FLAGS" && AR_FLAGS=cru + + + + + + + + + + + +if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args. +set dummy ${ac_tool_prefix}strip; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if test "${ac_cv_prog_STRIP+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$STRIP"; then + ac_cv_prog_STRIP="$STRIP" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_STRIP="${ac_tool_prefix}strip" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +STRIP=$ac_cv_prog_STRIP +if test -n "$STRIP"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $STRIP" >&5 +$as_echo "$STRIP" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_STRIP"; then + ac_ct_STRIP=$STRIP + # Extract the first word of "strip", so it can be a program name with args. +set dummy strip; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if test "${ac_cv_prog_ac_ct_STRIP+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_STRIP"; then + ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_ac_ct_STRIP="strip" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP +if test -n "$ac_ct_STRIP"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_STRIP" >&5 +$as_echo "$ac_ct_STRIP" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + if test "x$ac_ct_STRIP" = x; then + STRIP=":" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + STRIP=$ac_ct_STRIP + fi +else + STRIP="$ac_cv_prog_STRIP" +fi + +test -z "$STRIP" && STRIP=: + + + + + + +if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args. +set dummy ${ac_tool_prefix}ranlib; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if test "${ac_cv_prog_RANLIB+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$RANLIB"; then + ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +RANLIB=$ac_cv_prog_RANLIB +if test -n "$RANLIB"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $RANLIB" >&5 +$as_echo "$RANLIB" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_RANLIB"; then + ac_ct_RANLIB=$RANLIB + # Extract the first word of "ranlib", so it can be a program name with args. +set dummy ranlib; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if test "${ac_cv_prog_ac_ct_RANLIB+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_RANLIB"; then + ac_cv_prog_ac_ct_RANLIB="$ac_ct_RANLIB" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_ac_ct_RANLIB="ranlib" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_RANLIB=$ac_cv_prog_ac_ct_RANLIB +if test -n "$ac_ct_RANLIB"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_RANLIB" >&5 +$as_echo "$ac_ct_RANLIB" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + if test "x$ac_ct_RANLIB" = x; then + RANLIB=":" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + RANLIB=$ac_ct_RANLIB + fi +else + RANLIB="$ac_cv_prog_RANLIB" +fi + +test -z "$RANLIB" && RANLIB=: + + + + + + +# Determine commands to create old-style static archives. +old_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs' +old_postinstall_cmds='chmod 644 $oldlib' +old_postuninstall_cmds= + +if test -n "$RANLIB"; then + case $host_os in + openbsd*) + old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB -t \$oldlib" + ;; + *) + old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB \$oldlib" + ;; + esac + old_archive_cmds="$old_archive_cmds~\$RANLIB \$oldlib" +fi + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +# If no C compiler was specified, use CC. +LTCC=${LTCC-"$CC"} + +# If no C compiler flags were specified, use CFLAGS. +LTCFLAGS=${LTCFLAGS-"$CFLAGS"} + +# Allow CC to be a program name with arguments. +compiler=$CC + + +# Check for command to grab the raw symbol name followed by C symbol from nm. +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking command to parse $NM output from $compiler object" >&5 +$as_echo_n "checking command to parse $NM output from $compiler object... " >&6; } +if test "${lt_cv_sys_global_symbol_pipe+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + +# These are sane defaults that work on at least a few old systems. +# [They come from Ultrix. What could be older than Ultrix?!! ;)] + +# Character class describing NM global symbol codes. +symcode='[BCDEGRST]' + +# Regexp to match symbols that can be accessed directly from C. +sympat='\([_A-Za-z][_A-Za-z0-9]*\)' + +# Define system-specific variables. +case $host_os in +aix*) + symcode='[BCDT]' + ;; +cygwin* | mingw* | pw32* | cegcc*) + symcode='[ABCDGISTW]' + ;; +hpux*) + if test "$host_cpu" = ia64; then + symcode='[ABCDEGRST]' + fi + ;; +irix* | nonstopux*) + symcode='[BCDEGRST]' + ;; +osf*) + symcode='[BCDEGQRST]' + ;; +solaris*) + symcode='[BDRT]' + ;; +sco3.2v5*) + symcode='[DT]' + ;; +sysv4.2uw2*) + symcode='[DT]' + ;; +sysv5* | sco5v6* | unixware* | OpenUNIX*) + symcode='[ABDT]' + ;; +sysv4) + symcode='[DFNSTU]' + ;; +esac + +# If we're using GNU nm, then use its standard symbol codes. +case `$NM -V 2>&1` in +*GNU* | *'with BFD'*) + symcode='[ABCDGIRSTW]' ;; +esac + +# Transform an extracted symbol line into a proper C declaration. +# Some systems (esp. on ia64) link data and code symbols differently, +# so use this general approach. +lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'" + +# Transform an extracted symbol line into symbol name and symbol address +lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([^ ]*\) $/ {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([^ ]*\) \([^ ]*\)$/ {\"\2\", (void *) \&\2},/p'" +lt_cv_sys_global_symbol_to_c_name_address_lib_prefix="sed -n -e 's/^: \([^ ]*\) $/ {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([^ ]*\) \(lib[^ ]*\)$/ {\"\2\", (void *) \&\2},/p' -e 's/^$symcode* \([^ ]*\) \([^ ]*\)$/ {\"lib\2\", (void *) \&\2},/p'" + +# Handle CRLF in mingw tool chain +opt_cr= +case $build_os in +mingw*) + opt_cr=`$ECHO 'x\{0,1\}' | tr x '\015'` # option cr in regexp + ;; +esac + +# Try without a prefix underscore, then with it. +for ac_symprfx in "" "_"; do + + # Transform symcode, sympat, and symprfx into a raw symbol and a C symbol. + symxfrm="\\1 $ac_symprfx\\2 \\2" + + # Write the raw and C identifiers. + if test "$lt_cv_nm_interface" = "MS dumpbin"; then + # Fake it for dumpbin and say T for any non-static function + # and D for any global variable. + # Also find C++ and __fastcall symbols from MSVC++, + # which start with @ or ?. + lt_cv_sys_global_symbol_pipe="$AWK '"\ +" {last_section=section; section=\$ 3};"\ +" /Section length .*#relocs.*(pick any)/{hide[last_section]=1};"\ +" \$ 0!~/External *\|/{next};"\ +" / 0+ UNDEF /{next}; / UNDEF \([^|]\)*()/{next};"\ +" {if(hide[section]) next};"\ +" {f=0}; \$ 0~/\(\).*\|/{f=1}; {printf f ? \"T \" : \"D \"};"\ +" {split(\$ 0, a, /\||\r/); split(a[2], s)};"\ +" s[1]~/^[@?]/{print s[1], s[1]; next};"\ +" s[1]~prfx {split(s[1],t,\"@\"); print t[1], substr(t[1],length(prfx))}"\ +" ' prfx=^$ac_symprfx" + else + lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[ ]\($symcode$symcode*\)[ ][ ]*$ac_symprfx$sympat$opt_cr$/$symxfrm/p'" + fi + + # Check to see that the pipe works correctly. + pipe_works=no + + rm -f conftest* + cat > conftest.$ac_ext <<_LT_EOF +#ifdef __cplusplus +extern "C" { +#endif +char nm_test_var; +void nm_test_func(void); +void nm_test_func(void){} +#ifdef __cplusplus +} +#endif +int main(){nm_test_var='a';nm_test_func();return(0);} +_LT_EOF + + if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + # Now try to grab the symbols. + nlist=conftest.nm + if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$NM conftest.$ac_objext \| $lt_cv_sys_global_symbol_pipe \> $nlist\""; } >&5 + (eval $NM conftest.$ac_objext \| $lt_cv_sys_global_symbol_pipe \> $nlist) 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } && test -s "$nlist"; then + # Try sorting and uniquifying the output. + if sort "$nlist" | uniq > "$nlist"T; then + mv -f "$nlist"T "$nlist" + else + rm -f "$nlist"T + fi + + # Make sure that we snagged all the symbols we need. + if $GREP ' nm_test_var$' "$nlist" >/dev/null; then + if $GREP ' nm_test_func$' "$nlist" >/dev/null; then + cat <<_LT_EOF > conftest.$ac_ext +#ifdef __cplusplus +extern "C" { +#endif + +_LT_EOF + # Now generate the symbol file. + eval "$lt_cv_sys_global_symbol_to_cdecl"' < "$nlist" | $GREP -v main >> conftest.$ac_ext' + + cat <<_LT_EOF >> conftest.$ac_ext + +/* The mapping between symbol names and symbols. */ +const struct { + const char *name; + void *address; +} +lt__PROGRAM__LTX_preloaded_symbols[] = +{ + { "@PROGRAM@", (void *) 0 }, +_LT_EOF + $SED "s/^$symcode$symcode* \(.*\) \(.*\)$/ {\"\2\", (void *) \&\2},/" < "$nlist" | $GREP -v main >> conftest.$ac_ext + cat <<\_LT_EOF >> conftest.$ac_ext + {0, (void *) 0} +}; + +/* This works around a problem in FreeBSD linker */ +#ifdef FREEBSD_WORKAROUND +static const void *lt_preloaded_setup() { + return lt__PROGRAM__LTX_preloaded_symbols; +} +#endif + +#ifdef __cplusplus +} +#endif +_LT_EOF + # Now try linking the two files. + mv conftest.$ac_objext conftstm.$ac_objext + lt_save_LIBS="$LIBS" + lt_save_CFLAGS="$CFLAGS" + LIBS="conftstm.$ac_objext" + CFLAGS="$CFLAGS$lt_prog_compiler_no_builtin_flag" + if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5 + (eval $ac_link) 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } && test -s conftest${ac_exeext}; then + pipe_works=yes + fi + LIBS="$lt_save_LIBS" + CFLAGS="$lt_save_CFLAGS" + else + echo "cannot find nm_test_func in $nlist" >&5 + fi + else + echo "cannot find nm_test_var in $nlist" >&5 + fi + else + echo "cannot run $lt_cv_sys_global_symbol_pipe" >&5 + fi + else + echo "$progname: failed program was:" >&5 + cat conftest.$ac_ext >&5 + fi + rm -rf conftest* conftst* + + # Do not use the global_symbol_pipe unless it works. + if test "$pipe_works" = yes; then + break + else + lt_cv_sys_global_symbol_pipe= + fi +done + +fi + +if test -z "$lt_cv_sys_global_symbol_pipe"; then + lt_cv_sys_global_symbol_to_cdecl= +fi +if test -z "$lt_cv_sys_global_symbol_pipe$lt_cv_sys_global_symbol_to_cdecl"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: failed" >&5 +$as_echo "failed" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: ok" >&5 +$as_echo "ok" >&6; } +fi + + + + + + + + + + + + + + + + + + + + + + +# Check whether --enable-libtool-lock was given. +if test "${enable_libtool_lock+set}" = set; then : + enableval=$enable_libtool_lock; +fi + +test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes + +# Some flags need to be propagated to the compiler or linker for good +# libtool support. +case $host in +ia64-*-hpux*) + # Find out which ABI we are using. + echo 'int i;' > conftest.$ac_ext + if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + case `/usr/bin/file conftest.$ac_objext` in + *ELF-32*) + HPUX_IA64_MODE="32" + ;; + *ELF-64*) + HPUX_IA64_MODE="64" + ;; + esac + fi + rm -rf conftest* + ;; +*-*-irix6*) + # Find out which ABI we are using. + echo '#line 9117 "configure"' > conftest.$ac_ext + if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + if test "$lt_cv_prog_gnu_ld" = yes; then + case `/usr/bin/file conftest.$ac_objext` in + *32-bit*) + LD="${LD-ld} -melf32bsmip" + ;; + *N32*) + LD="${LD-ld} -melf32bmipn32" + ;; + *64-bit*) + LD="${LD-ld} -melf64bmip" + ;; + esac + else + case `/usr/bin/file conftest.$ac_objext` in + *32-bit*) + LD="${LD-ld} -32" + ;; + *N32*) + LD="${LD-ld} -n32" + ;; + *64-bit*) + LD="${LD-ld} -64" + ;; + esac + fi + fi + rm -rf conftest* + ;; + +x86_64-*kfreebsd*-gnu|x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*| \ +s390*-*linux*|s390*-*tpf*|sparc*-*linux*) + # Find out which ABI we are using. + echo 'int i;' > conftest.$ac_ext + if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + case `/usr/bin/file conftest.o` in + *32-bit*) + case $host in + x86_64-*kfreebsd*-gnu) + LD="${LD-ld} -m elf_i386_fbsd" + ;; + x86_64-*linux*) + LD="${LD-ld} -m elf_i386" + ;; + ppc64-*linux*|powerpc64-*linux*) + LD="${LD-ld} -m elf32ppclinux" + ;; + s390x-*linux*) + LD="${LD-ld} -m elf_s390" + ;; + sparc64-*linux*) + LD="${LD-ld} -m elf32_sparc" + ;; + esac + ;; + *64-bit*) + case $host in + x86_64-*kfreebsd*-gnu) + LD="${LD-ld} -m elf_x86_64_fbsd" + ;; + x86_64-*linux*) + LD="${LD-ld} -m elf_x86_64" + ;; + ppc*-*linux*|powerpc*-*linux*) + LD="${LD-ld} -m elf64ppc" + ;; + s390*-*linux*|s390*-*tpf*) + LD="${LD-ld} -m elf64_s390" + ;; + sparc*-*linux*) + LD="${LD-ld} -m elf64_sparc" + ;; + esac + ;; + esac + fi + rm -rf conftest* + ;; + +*-*-sco3.2v5*) + # On SCO OpenServer 5, we need -belf to get full-featured binaries. + SAVE_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS -belf" + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C compiler needs -belf" >&5 +$as_echo_n "checking whether the C compiler needs -belf... " >&6; } +if test "${lt_cv_cc_needs_belf+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int main (void) +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + lt_cv_cc_needs_belf=yes +else + lt_cv_cc_needs_belf=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_cc_needs_belf" >&5 +$as_echo "$lt_cv_cc_needs_belf" >&6; } + if test x"$lt_cv_cc_needs_belf" != x"yes"; then + # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf + CFLAGS="$SAVE_CFLAGS" + fi + ;; +sparc*-*solaris*) + # Find out which ABI we are using. + echo 'int i;' > conftest.$ac_ext + if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + case `/usr/bin/file conftest.o` in + *64-bit*) + case $lt_cv_prog_gnu_ld in + yes*) LD="${LD-ld} -m elf64_sparc" ;; + *) + if ${LD-ld} -64 -r -o conftest2.o conftest.o >/dev/null 2>&1; then + LD="${LD-ld} -64" + fi + ;; + esac + ;; + esac + fi + rm -rf conftest* + ;; +esac + +need_locks="$enable_libtool_lock" + + + case $host_os in + rhapsody* | darwin*) + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}dsymutil", so it can be a program name with args. +set dummy ${ac_tool_prefix}dsymutil; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if test "${ac_cv_prog_DSYMUTIL+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$DSYMUTIL"; then + ac_cv_prog_DSYMUTIL="$DSYMUTIL" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_DSYMUTIL="${ac_tool_prefix}dsymutil" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +DSYMUTIL=$ac_cv_prog_DSYMUTIL +if test -n "$DSYMUTIL"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DSYMUTIL" >&5 +$as_echo "$DSYMUTIL" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_DSYMUTIL"; then + ac_ct_DSYMUTIL=$DSYMUTIL + # Extract the first word of "dsymutil", so it can be a program name with args. +set dummy dsymutil; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if test "${ac_cv_prog_ac_ct_DSYMUTIL+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_DSYMUTIL"; then + ac_cv_prog_ac_ct_DSYMUTIL="$ac_ct_DSYMUTIL" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_ac_ct_DSYMUTIL="dsymutil" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_DSYMUTIL=$ac_cv_prog_ac_ct_DSYMUTIL +if test -n "$ac_ct_DSYMUTIL"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DSYMUTIL" >&5 +$as_echo "$ac_ct_DSYMUTIL" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + if test "x$ac_ct_DSYMUTIL" = x; then + DSYMUTIL=":" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + DSYMUTIL=$ac_ct_DSYMUTIL + fi +else + DSYMUTIL="$ac_cv_prog_DSYMUTIL" +fi + + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}nmedit", so it can be a program name with args. +set dummy ${ac_tool_prefix}nmedit; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if test "${ac_cv_prog_NMEDIT+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$NMEDIT"; then + ac_cv_prog_NMEDIT="$NMEDIT" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_NMEDIT="${ac_tool_prefix}nmedit" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +NMEDIT=$ac_cv_prog_NMEDIT +if test -n "$NMEDIT"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $NMEDIT" >&5 +$as_echo "$NMEDIT" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_NMEDIT"; then + ac_ct_NMEDIT=$NMEDIT + # Extract the first word of "nmedit", so it can be a program name with args. +set dummy nmedit; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if test "${ac_cv_prog_ac_ct_NMEDIT+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_NMEDIT"; then + ac_cv_prog_ac_ct_NMEDIT="$ac_ct_NMEDIT" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_ac_ct_NMEDIT="nmedit" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_NMEDIT=$ac_cv_prog_ac_ct_NMEDIT +if test -n "$ac_ct_NMEDIT"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_NMEDIT" >&5 +$as_echo "$ac_ct_NMEDIT" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + if test "x$ac_ct_NMEDIT" = x; then + NMEDIT=":" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + NMEDIT=$ac_ct_NMEDIT + fi +else + NMEDIT="$ac_cv_prog_NMEDIT" +fi + + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}lipo", so it can be a program name with args. +set dummy ${ac_tool_prefix}lipo; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if test "${ac_cv_prog_LIPO+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$LIPO"; then + ac_cv_prog_LIPO="$LIPO" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_LIPO="${ac_tool_prefix}lipo" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +LIPO=$ac_cv_prog_LIPO +if test -n "$LIPO"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LIPO" >&5 +$as_echo "$LIPO" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_LIPO"; then + ac_ct_LIPO=$LIPO + # Extract the first word of "lipo", so it can be a program name with args. +set dummy lipo; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if test "${ac_cv_prog_ac_ct_LIPO+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_LIPO"; then + ac_cv_prog_ac_ct_LIPO="$ac_ct_LIPO" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_ac_ct_LIPO="lipo" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_LIPO=$ac_cv_prog_ac_ct_LIPO +if test -n "$ac_ct_LIPO"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_LIPO" >&5 +$as_echo "$ac_ct_LIPO" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + if test "x$ac_ct_LIPO" = x; then + LIPO=":" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + LIPO=$ac_ct_LIPO + fi +else + LIPO="$ac_cv_prog_LIPO" +fi + + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}otool", so it can be a program name with args. +set dummy ${ac_tool_prefix}otool; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if test "${ac_cv_prog_OTOOL+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$OTOOL"; then + ac_cv_prog_OTOOL="$OTOOL" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_OTOOL="${ac_tool_prefix}otool" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +OTOOL=$ac_cv_prog_OTOOL +if test -n "$OTOOL"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OTOOL" >&5 +$as_echo "$OTOOL" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_OTOOL"; then + ac_ct_OTOOL=$OTOOL + # Extract the first word of "otool", so it can be a program name with args. +set dummy otool; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if test "${ac_cv_prog_ac_ct_OTOOL+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_OTOOL"; then + ac_cv_prog_ac_ct_OTOOL="$ac_ct_OTOOL" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_ac_ct_OTOOL="otool" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_OTOOL=$ac_cv_prog_ac_ct_OTOOL +if test -n "$ac_ct_OTOOL"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OTOOL" >&5 +$as_echo "$ac_ct_OTOOL" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + if test "x$ac_ct_OTOOL" = x; then + OTOOL=":" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + OTOOL=$ac_ct_OTOOL + fi +else + OTOOL="$ac_cv_prog_OTOOL" +fi + + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}otool64", so it can be a program name with args. +set dummy ${ac_tool_prefix}otool64; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if test "${ac_cv_prog_OTOOL64+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$OTOOL64"; then + ac_cv_prog_OTOOL64="$OTOOL64" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_OTOOL64="${ac_tool_prefix}otool64" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +OTOOL64=$ac_cv_prog_OTOOL64 +if test -n "$OTOOL64"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OTOOL64" >&5 +$as_echo "$OTOOL64" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_OTOOL64"; then + ac_ct_OTOOL64=$OTOOL64 + # Extract the first word of "otool64", so it can be a program name with args. +set dummy otool64; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if test "${ac_cv_prog_ac_ct_OTOOL64+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_OTOOL64"; then + ac_cv_prog_ac_ct_OTOOL64="$ac_ct_OTOOL64" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_ac_ct_OTOOL64="otool64" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_OTOOL64=$ac_cv_prog_ac_ct_OTOOL64 +if test -n "$ac_ct_OTOOL64"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OTOOL64" >&5 +$as_echo "$ac_ct_OTOOL64" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + if test "x$ac_ct_OTOOL64" = x; then + OTOOL64=":" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + OTOOL64=$ac_ct_OTOOL64 + fi +else + OTOOL64="$ac_cv_prog_OTOOL64" +fi + + + + + + + + + + + + + + + + + + + + + + + + + + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -single_module linker flag" >&5 +$as_echo_n "checking for -single_module linker flag... " >&6; } +if test "${lt_cv_apple_cc_single_mod+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + lt_cv_apple_cc_single_mod=no + if test -z "${LT_MULTI_MODULE}"; then + # By default we will add the -single_module flag. You can override + # by either setting the environment variable LT_MULTI_MODULE + # non-empty at configure time, or by adding -multi_module to the + # link flags. + rm -rf libconftest.dylib* + echo "int foo(void){return 1;}" > conftest.c + echo "$LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \ +-dynamiclib -Wl,-single_module conftest.c" >&5 + $LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \ + -dynamiclib -Wl,-single_module conftest.c 2>conftest.err + _lt_result=$? + if test -f libconftest.dylib && test ! -s conftest.err && test $_lt_result = 0; then + lt_cv_apple_cc_single_mod=yes + else + cat conftest.err >&5 + fi + rm -rf libconftest.dylib* + rm -f conftest.* + fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_apple_cc_single_mod" >&5 +$as_echo "$lt_cv_apple_cc_single_mod" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -exported_symbols_list linker flag" >&5 +$as_echo_n "checking for -exported_symbols_list linker flag... " >&6; } +if test "${lt_cv_ld_exported_symbols_list+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + lt_cv_ld_exported_symbols_list=no + save_LDFLAGS=$LDFLAGS + echo "_main" > conftest.sym + LDFLAGS="$LDFLAGS -Wl,-exported_symbols_list,conftest.sym" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int main (void) +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + lt_cv_ld_exported_symbols_list=yes +else + lt_cv_ld_exported_symbols_list=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + LDFLAGS="$save_LDFLAGS" + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ld_exported_symbols_list" >&5 +$as_echo "$lt_cv_ld_exported_symbols_list" >&6; } + case $host_os in + rhapsody* | darwin1.[012]) + _lt_dar_allow_undefined='${wl}-undefined ${wl}suppress' ;; + darwin1.*) + _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;; + darwin*) # darwin 5.x on + # if running on 10.5 or later, the deployment target defaults + # to the OS version, if on x86, and 10.4, the deployment + # target defaults to 10.4. Don't you love it? + case ${MACOSX_DEPLOYMENT_TARGET-10.0},$host in + 10.0,*86*-darwin8*|10.0,*-darwin[91]*) + _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;; + 10.[012]*) + _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;; + 10.*) + _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;; + esac + ;; + esac + if test "$lt_cv_apple_cc_single_mod" = "yes"; then + _lt_dar_single_mod='$single_module' + fi + if test "$lt_cv_ld_exported_symbols_list" = "yes"; then + _lt_dar_export_syms=' ${wl}-exported_symbols_list,$output_objdir/${libname}-symbols.expsym' + else + _lt_dar_export_syms='~$NMEDIT -s $output_objdir/${libname}-symbols.expsym ${lib}' + fi + if test "$DSYMUTIL" != ":"; then + _lt_dsymutil='~$DSYMUTIL $lib || :' + else + _lt_dsymutil= + fi + ;; + esac + +for ac_header in dlfcn.h +do : + ac_fn_c_check_header_compile "$LINENO" "dlfcn.h" "ac_cv_header_dlfcn_h" "$ac_includes_default +" +if test "x$ac_cv_header_dlfcn_h" = x""yes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_DLFCN_H 1 +_ACEOF + +fi + +done + + + +# Set options + + + + enable_dlopen=no + + + + # Check whether --enable-shared was given. +if test "${enable_shared+set}" = set; then : + enableval=$enable_shared; p=${PACKAGE-default} + case $enableval in + yes) enable_shared=yes ;; + no) enable_shared=no ;; + *) + enable_shared=no + # Look at the argument we got. We use all the common list separators. + lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," + for pkg in $enableval; do + IFS="$lt_save_ifs" + if test "X$pkg" = "X$p"; then + enable_shared=yes + fi + done + IFS="$lt_save_ifs" + ;; + esac +else + enable_shared=yes +fi + + + + + + + + + + # Check whether --enable-static was given. +if test "${enable_static+set}" = set; then : + enableval=$enable_static; p=${PACKAGE-default} + case $enableval in + yes) enable_static=yes ;; + no) enable_static=no ;; + *) + enable_static=no + # Look at the argument we got. We use all the common list separators. + lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," + for pkg in $enableval; do + IFS="$lt_save_ifs" + if test "X$pkg" = "X$p"; then + enable_static=yes + fi + done + IFS="$lt_save_ifs" + ;; + esac +else + enable_static=yes +fi + + + + + + + + + + +# Check whether --with-pic was given. +if test "${with_pic+set}" = set; then : + withval=$with_pic; pic_mode="$withval" +else + pic_mode=default +fi + + +test -z "$pic_mode" && pic_mode=default + + + + + + + + # Check whether --enable-fast-install was given. +if test "${enable_fast_install+set}" = set; then : + enableval=$enable_fast_install; p=${PACKAGE-default} + case $enableval in + yes) enable_fast_install=yes ;; + no) enable_fast_install=no ;; + *) + enable_fast_install=no + # Look at the argument we got. We use all the common list separators. + lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," + for pkg in $enableval; do + IFS="$lt_save_ifs" + if test "X$pkg" = "X$p"; then + enable_fast_install=yes + fi + done + IFS="$lt_save_ifs" + ;; + esac +else + enable_fast_install=yes +fi + + + + + + + + + + + +# This can be used to rebuild libtool when needed +LIBTOOL_DEPS="$ltmain" + +# Always use our own libtool. +LIBTOOL='$(SHELL) $(top_builddir)/libtool' + + + + + + + + + + + + + + + + + + + + + + + + + +test -z "$LN_S" && LN_S="ln -s" + + + + + + + + + + + + + + +if test -n "${ZSH_VERSION+set}" ; then + setopt NO_GLOB_SUBST +fi + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for objdir" >&5 +$as_echo_n "checking for objdir... " >&6; } +if test "${lt_cv_objdir+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + rm -f .libs 2>/dev/null +mkdir .libs 2>/dev/null +if test -d .libs; then + lt_cv_objdir=.libs +else + # MS-DOS does not allow filenames that begin with a dot. + lt_cv_objdir=_libs +fi +rmdir .libs 2>/dev/null +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_objdir" >&5 +$as_echo "$lt_cv_objdir" >&6; } +objdir=$lt_cv_objdir + + + + + +cat >>confdefs.h <<_ACEOF +#define LT_OBJDIR "$lt_cv_objdir/" +_ACEOF + + + + + + + + + + + + + + + + + +case $host_os in +aix3*) + # AIX sometimes has problems with the GCC collect2 program. For some + # reason, if we set the COLLECT_NAMES environment variable, the problems + # vanish in a puff of smoke. + if test "X${COLLECT_NAMES+set}" != Xset; then + COLLECT_NAMES= + export COLLECT_NAMES + fi + ;; +esac + +# Sed substitution that helps us do robust quoting. It backslashifies +# metacharacters that are still active within double-quoted strings. +sed_quote_subst='s/\(["`$\\]\)/\\\1/g' + +# Same as above, but do not quote variable references. +double_quote_subst='s/\(["`\\]\)/\\\1/g' + +# Sed substitution to delay expansion of an escaped shell variable in a +# double_quote_subst'ed string. +delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g' + +# Sed substitution to delay expansion of an escaped single quote. +delay_single_quote_subst='s/'\''/'\'\\\\\\\'\''/g' + +# Sed substitution to avoid accidental globbing in evaled expressions +no_glob_subst='s/\*/\\\*/g' + +# Global variables: +ofile=libtool +can_build_shared=yes + +# All known linkers require a `.a' archive for static linking (except MSVC, +# which needs '.lib'). +libext=a + +with_gnu_ld="$lt_cv_prog_gnu_ld" + +old_CC="$CC" +old_CFLAGS="$CFLAGS" + +# Set sane defaults for various variables +test -z "$CC" && CC=cc +test -z "$LTCC" && LTCC=$CC +test -z "$LTCFLAGS" && LTCFLAGS=$CFLAGS +test -z "$LD" && LD=ld +test -z "$ac_objext" && ac_objext=o + +for cc_temp in $compiler""; do + case $cc_temp in + compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; + distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; + \-*) ;; + *) break;; + esac +done +cc_basename=`$ECHO "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"` + + +# Only perform the check for file, if the check method requires it +test -z "$MAGIC_CMD" && MAGIC_CMD=file +case $deplibs_check_method in +file_magic*) + if test "$file_magic_cmd" = '$MAGIC_CMD'; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${ac_tool_prefix}file" >&5 +$as_echo_n "checking for ${ac_tool_prefix}file... " >&6; } +if test "${lt_cv_path_MAGIC_CMD+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + case $MAGIC_CMD in +[\\/*] | ?:[\\/]*) + lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path. + ;; +*) + lt_save_MAGIC_CMD="$MAGIC_CMD" + lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR + ac_dummy="/usr/bin$PATH_SEPARATOR$PATH" + for ac_dir in $ac_dummy; do + IFS="$lt_save_ifs" + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/${ac_tool_prefix}file; then + lt_cv_path_MAGIC_CMD="$ac_dir/${ac_tool_prefix}file" + if test -n "$file_magic_test_file"; then + case $deplibs_check_method in + "file_magic "*) + file_magic_regex=`expr "$deplibs_check_method" : "file_magic \(.*\)"` + MAGIC_CMD="$lt_cv_path_MAGIC_CMD" + if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null | + $EGREP "$file_magic_regex" > /dev/null; then + : + else + cat <<_LT_EOF 1>&2 + +*** Warning: the command libtool uses to detect shared libraries, +*** $file_magic_cmd, produces output that libtool cannot recognize. +*** The result is that libtool may fail to recognize shared libraries +*** as such. This will affect the creation of libtool libraries that +*** depend on shared libraries, but programs linked with such libtool +*** libraries will work regardless of this problem. Nevertheless, you +*** may want to report the problem to your system manager and/or to +*** bug-libtool@gnu.org + +_LT_EOF + fi ;; + esac + fi + break + fi + done + IFS="$lt_save_ifs" + MAGIC_CMD="$lt_save_MAGIC_CMD" + ;; +esac +fi + +MAGIC_CMD="$lt_cv_path_MAGIC_CMD" +if test -n "$MAGIC_CMD"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MAGIC_CMD" >&5 +$as_echo "$MAGIC_CMD" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + + + +if test -z "$lt_cv_path_MAGIC_CMD"; then + if test -n "$ac_tool_prefix"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for file" >&5 +$as_echo_n "checking for file... " >&6; } +if test "${lt_cv_path_MAGIC_CMD+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + case $MAGIC_CMD in +[\\/*] | ?:[\\/]*) + lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path. + ;; +*) + lt_save_MAGIC_CMD="$MAGIC_CMD" + lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR + ac_dummy="/usr/bin$PATH_SEPARATOR$PATH" + for ac_dir in $ac_dummy; do + IFS="$lt_save_ifs" + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/file; then + lt_cv_path_MAGIC_CMD="$ac_dir/file" + if test -n "$file_magic_test_file"; then + case $deplibs_check_method in + "file_magic "*) + file_magic_regex=`expr "$deplibs_check_method" : "file_magic \(.*\)"` + MAGIC_CMD="$lt_cv_path_MAGIC_CMD" + if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null | + $EGREP "$file_magic_regex" > /dev/null; then + : + else + cat <<_LT_EOF 1>&2 + +*** Warning: the command libtool uses to detect shared libraries, +*** $file_magic_cmd, produces output that libtool cannot recognize. +*** The result is that libtool may fail to recognize shared libraries +*** as such. This will affect the creation of libtool libraries that +*** depend on shared libraries, but programs linked with such libtool +*** libraries will work regardless of this problem. Nevertheless, you +*** may want to report the problem to your system manager and/or to +*** bug-libtool@gnu.org + +_LT_EOF + fi ;; + esac + fi + break + fi + done + IFS="$lt_save_ifs" + MAGIC_CMD="$lt_save_MAGIC_CMD" + ;; +esac +fi + +MAGIC_CMD="$lt_cv_path_MAGIC_CMD" +if test -n "$MAGIC_CMD"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MAGIC_CMD" >&5 +$as_echo "$MAGIC_CMD" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + else + MAGIC_CMD=: + fi +fi + + fi + ;; +esac + +# Use C for the default configuration in the libtool script + +lt_save_CC="$CC" +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + +# Source file extension for C test sources. +ac_ext=c + +# Object file extension for compiled C test sources. +objext=o +objext=$objext + +# Code to be used in simple compile tests +lt_simple_compile_test_code="int some_variable = 0;" + +# Code to be used in simple link tests +lt_simple_link_test_code='int main(){return(0);}' + + + + + + + +# If no C compiler was specified, use CC. +LTCC=${LTCC-"$CC"} + +# If no C compiler flags were specified, use CFLAGS. +LTCFLAGS=${LTCFLAGS-"$CFLAGS"} + +# Allow CC to be a program name with arguments. +compiler=$CC + +# Save the default compiler, since it gets overwritten when the other +# tags are being tested, and _LT_TAGVAR(compiler, []) is a NOP. +compiler_DEFAULT=$CC + +# save warnings/boilerplate of simple test code +ac_outfile=conftest.$ac_objext +echo "$lt_simple_compile_test_code" >conftest.$ac_ext +eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err +_lt_compiler_boilerplate=`cat conftest.err` +$RM conftest* + +ac_outfile=conftest.$ac_objext +echo "$lt_simple_link_test_code" >conftest.$ac_ext +eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err +_lt_linker_boilerplate=`cat conftest.err` +$RM -r conftest* + + +## CAVEAT EMPTOR: +## There is no encapsulation within the following macros, do not change +## the running order or otherwise move them around unless you know exactly +## what you are doing... +if test -n "$compiler"; then + +lt_prog_compiler_no_builtin_flag= + +if test "$GCC" = yes; then + lt_prog_compiler_no_builtin_flag=' -fno-builtin' + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -fno-rtti -fno-exceptions" >&5 +$as_echo_n "checking if $compiler supports -fno-rtti -fno-exceptions... " >&6; } +if test "${lt_cv_prog_compiler_rtti_exceptions+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + lt_cv_prog_compiler_rtti_exceptions=no + ac_outfile=conftest.$ac_objext + echo "$lt_simple_compile_test_code" > conftest.$ac_ext + lt_compiler_flag="-fno-rtti -fno-exceptions" + # Insert the option either (1) after the last *FLAGS variable, or + # (2) before a word containing "conftest.", or (3) at the end. + # Note that $ac_compile itself does not contain backslashes and begins + # with a dollar sign (not a hyphen), so the echo should work correctly. + # The option is referenced via a variable to avoid confusing sed. + lt_compile=`echo "$ac_compile" | $SED \ + -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ + -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ + -e 's:$: $lt_compiler_flag:'` + (eval echo "\"\$as_me:10375: $lt_compile\"" >&5) + (eval "$lt_compile" 2>conftest.err) + ac_status=$? + cat conftest.err >&5 + echo "$as_me:10379: \$? = $ac_status" >&5 + if (exit $ac_status) && test -s "$ac_outfile"; then + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings other than the usual output. + $ECHO "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' >conftest.exp + $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 + if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then + lt_cv_prog_compiler_rtti_exceptions=yes + fi + fi + $RM conftest* + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_rtti_exceptions" >&5 +$as_echo "$lt_cv_prog_compiler_rtti_exceptions" >&6; } + +if test x"$lt_cv_prog_compiler_rtti_exceptions" = xyes; then + lt_prog_compiler_no_builtin_flag="$lt_prog_compiler_no_builtin_flag -fno-rtti -fno-exceptions" +else + : +fi + +fi + + + + + + + lt_prog_compiler_wl= +lt_prog_compiler_pic= +lt_prog_compiler_static= + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $compiler option to produce PIC" >&5 +$as_echo_n "checking for $compiler option to produce PIC... " >&6; } + + if test "$GCC" = yes; then + lt_prog_compiler_wl='-Wl,' + lt_prog_compiler_static='-static' + + case $host_os in + aix*) + # All AIX code is PIC. + if test "$host_cpu" = ia64; then + # AIX 5 now supports IA64 processor + lt_prog_compiler_static='-Bstatic' + fi + ;; + + amigaos*) + case $host_cpu in + powerpc) + # see comment about AmigaOS4 .so support + lt_prog_compiler_pic='-fPIC' + ;; + m68k) + # FIXME: we need at least 68020 code to build shared libraries, but + # adding the `-m68020' flag to GCC prevents building anything better, + # like `-m68040'. + lt_prog_compiler_pic='-m68020 -resident32 -malways-restore-a4' + ;; + esac + ;; + + beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) + # PIC is the default for these OSes. + ;; + + mingw* | cygwin* | pw32* | os2* | cegcc*) + # This hack is so that the source file can tell whether it is being + # built for inclusion in a dll (and should export symbols for example). + # Although the cygwin gcc ignores -fPIC, still need this for old-style + # (--disable-auto-import) libraries + lt_prog_compiler_pic='-DDLL_EXPORT' + ;; + + darwin* | rhapsody*) + # PIC is the default on this platform + # Common symbols not allowed in MH_DYLIB files + lt_prog_compiler_pic='-fno-common' + ;; + + hpux*) + # PIC is the default for 64-bit PA HP-UX, but not for 32-bit + # PA HP-UX. On IA64 HP-UX, PIC is the default but the pic flag + # sets the default TLS model and affects inlining. + case $host_cpu in + hppa*64*) + # +Z the default + ;; + *) + lt_prog_compiler_pic='-fPIC' + ;; + esac + ;; + + interix[3-9]*) + # Interix 3.x gcc -fpic/-fPIC options generate broken code. + # Instead, we relocate shared libraries at runtime. + ;; + + msdosdjgpp*) + # Just because we use GCC doesn't mean we suddenly get shared libraries + # on systems that don't support them. + lt_prog_compiler_can_build_shared=no + enable_shared=no + ;; + + *nto* | *qnx*) + # QNX uses GNU C++, but need to define -shared option too, otherwise + # it will coredump. + lt_prog_compiler_pic='-fPIC -shared' + ;; + + sysv4*MP*) + if test -d /usr/nec; then + lt_prog_compiler_pic=-Kconform_pic + fi + ;; + + *) + lt_prog_compiler_pic='-fPIC' + ;; + esac + else + # PORTME Check for flag to pass linker flags through the system compiler. + case $host_os in + aix*) + lt_prog_compiler_wl='-Wl,' + if test "$host_cpu" = ia64; then + # AIX 5 now supports IA64 processor + lt_prog_compiler_static='-Bstatic' + else + lt_prog_compiler_static='-bnso -bI:/lib/syscalls.exp' + fi + ;; + + mingw* | cygwin* | pw32* | os2* | cegcc*) + # This hack is so that the source file can tell whether it is being + # built for inclusion in a dll (and should export symbols for example). + lt_prog_compiler_pic='-DDLL_EXPORT' + ;; + + hpux9* | hpux10* | hpux11*) + lt_prog_compiler_wl='-Wl,' + # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but + # not for PA HP-UX. + case $host_cpu in + hppa*64*|ia64*) + # +Z the default + ;; + *) + lt_prog_compiler_pic='+Z' + ;; + esac + # Is there a better lt_prog_compiler_static that works with the bundled CC? + lt_prog_compiler_static='${wl}-a ${wl}archive' + ;; + + irix5* | irix6* | nonstopux*) + lt_prog_compiler_wl='-Wl,' + # PIC (with -KPIC) is the default. + lt_prog_compiler_static='-non_shared' + ;; + + linux* | k*bsd*-gnu | kopensolaris*-gnu) + case $cc_basename in + # old Intel for x86_64 which still supported -KPIC. + ecc*) + lt_prog_compiler_wl='-Wl,' + lt_prog_compiler_pic='-KPIC' + lt_prog_compiler_static='-static' + ;; + # icc used to be incompatible with GCC. + # ICC 10 doesn't accept -KPIC any more. + icc* | ifort*) + lt_prog_compiler_wl='-Wl,' + lt_prog_compiler_pic='-fPIC' + lt_prog_compiler_static='-static' + ;; + # Lahey Fortran 8.1. + lf95*) + lt_prog_compiler_wl='-Wl,' + lt_prog_compiler_pic='--shared' + lt_prog_compiler_static='--static' + ;; + pgcc* | pgf77* | pgf90* | pgf95*) + # Portland Group compilers (*not* the Pentium gcc compiler, + # which looks to be a dead project) + lt_prog_compiler_wl='-Wl,' + lt_prog_compiler_pic='-fpic' + lt_prog_compiler_static='-Bstatic' + ;; + ccc*) + lt_prog_compiler_wl='-Wl,' + # All Alpha code is PIC. + lt_prog_compiler_static='-non_shared' + ;; + xl*) + # IBM XL C 8.0/Fortran 10.1 on PPC + lt_prog_compiler_wl='-Wl,' + lt_prog_compiler_pic='-qpic' + lt_prog_compiler_static='-qstaticlink' + ;; + *) + case `$CC -V 2>&1 | sed 5q` in + *Sun\ C*) + # Sun C 5.9 + lt_prog_compiler_pic='-KPIC' + lt_prog_compiler_static='-Bstatic' + lt_prog_compiler_wl='-Wl,' + ;; + *Sun\ F*) + # Sun Fortran 8.3 passes all unrecognized flags to the linker + lt_prog_compiler_pic='-KPIC' + lt_prog_compiler_static='-Bstatic' + lt_prog_compiler_wl='' + ;; + esac + ;; + esac + ;; + + newsos6) + lt_prog_compiler_pic='-KPIC' + lt_prog_compiler_static='-Bstatic' + ;; + + *nto* | *qnx*) + # QNX uses GNU C++, but need to define -shared option too, otherwise + # it will coredump. + lt_prog_compiler_pic='-fPIC -shared' + ;; + + osf3* | osf4* | osf5*) + lt_prog_compiler_wl='-Wl,' + # All OSF/1 code is PIC. + lt_prog_compiler_static='-non_shared' + ;; + + rdos*) + lt_prog_compiler_static='-non_shared' + ;; + + solaris*) + lt_prog_compiler_pic='-KPIC' + lt_prog_compiler_static='-Bstatic' + case $cc_basename in + f77* | f90* | f95*) + lt_prog_compiler_wl='-Qoption ld ';; + *) + lt_prog_compiler_wl='-Wl,';; + esac + ;; + + sunos4*) + lt_prog_compiler_wl='-Qoption ld ' + lt_prog_compiler_pic='-PIC' + lt_prog_compiler_static='-Bstatic' + ;; + + sysv4 | sysv4.2uw2* | sysv4.3*) + lt_prog_compiler_wl='-Wl,' + lt_prog_compiler_pic='-KPIC' + lt_prog_compiler_static='-Bstatic' + ;; + + sysv4*MP*) + if test -d /usr/nec ;then + lt_prog_compiler_pic='-Kconform_pic' + lt_prog_compiler_static='-Bstatic' + fi + ;; + + sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*) + lt_prog_compiler_wl='-Wl,' + lt_prog_compiler_pic='-KPIC' + lt_prog_compiler_static='-Bstatic' + ;; + + unicos*) + lt_prog_compiler_wl='-Wl,' + lt_prog_compiler_can_build_shared=no + ;; + + uts4*) + lt_prog_compiler_pic='-pic' + lt_prog_compiler_static='-Bstatic' + ;; + + *) + lt_prog_compiler_can_build_shared=no + ;; + esac + fi + +case $host_os in + # For platforms which do not support PIC, -DPIC is meaningless: + *djgpp*) + lt_prog_compiler_pic= + ;; + *) + lt_prog_compiler_pic="$lt_prog_compiler_pic -DPIC" + ;; +esac +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_prog_compiler_pic" >&5 +$as_echo "$lt_prog_compiler_pic" >&6; } + + + + + + +# +# Check to make sure the PIC flag actually works. +# +if test -n "$lt_prog_compiler_pic"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler PIC flag $lt_prog_compiler_pic works" >&5 +$as_echo_n "checking if $compiler PIC flag $lt_prog_compiler_pic works... " >&6; } +if test "${lt_cv_prog_compiler_pic_works+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + lt_cv_prog_compiler_pic_works=no + ac_outfile=conftest.$ac_objext + echo "$lt_simple_compile_test_code" > conftest.$ac_ext + lt_compiler_flag="$lt_prog_compiler_pic -DPIC" + # Insert the option either (1) after the last *FLAGS variable, or + # (2) before a word containing "conftest.", or (3) at the end. + # Note that $ac_compile itself does not contain backslashes and begins + # with a dollar sign (not a hyphen), so the echo should work correctly. + # The option is referenced via a variable to avoid confusing sed. + lt_compile=`echo "$ac_compile" | $SED \ + -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ + -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ + -e 's:$: $lt_compiler_flag:'` + (eval echo "\"\$as_me:10714: $lt_compile\"" >&5) + (eval "$lt_compile" 2>conftest.err) + ac_status=$? + cat conftest.err >&5 + echo "$as_me:10718: \$? = $ac_status" >&5 + if (exit $ac_status) && test -s "$ac_outfile"; then + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings other than the usual output. + $ECHO "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' >conftest.exp + $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 + if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then + lt_cv_prog_compiler_pic_works=yes + fi + fi + $RM conftest* + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_pic_works" >&5 +$as_echo "$lt_cv_prog_compiler_pic_works" >&6; } + +if test x"$lt_cv_prog_compiler_pic_works" = xyes; then + case $lt_prog_compiler_pic in + "" | " "*) ;; + *) lt_prog_compiler_pic=" $lt_prog_compiler_pic" ;; + esac +else + lt_prog_compiler_pic= + lt_prog_compiler_can_build_shared=no +fi + +fi + + + + + + +# +# Check to make sure the static flag actually works. +# +wl=$lt_prog_compiler_wl eval lt_tmp_static_flag=\"$lt_prog_compiler_static\" +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler static flag $lt_tmp_static_flag works" >&5 +$as_echo_n "checking if $compiler static flag $lt_tmp_static_flag works... " >&6; } +if test "${lt_cv_prog_compiler_static_works+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + lt_cv_prog_compiler_static_works=no + save_LDFLAGS="$LDFLAGS" + LDFLAGS="$LDFLAGS $lt_tmp_static_flag" + echo "$lt_simple_link_test_code" > conftest.$ac_ext + if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then + # The linker can only warn and ignore the option if not recognized + # So say no if there are warnings + if test -s conftest.err; then + # Append any errors to the config.log. + cat conftest.err 1>&5 + $ECHO "X$_lt_linker_boilerplate" | $Xsed -e '/^$/d' > conftest.exp + $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 + if diff conftest.exp conftest.er2 >/dev/null; then + lt_cv_prog_compiler_static_works=yes + fi + else + lt_cv_prog_compiler_static_works=yes + fi + fi + $RM -r conftest* + LDFLAGS="$save_LDFLAGS" + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_static_works" >&5 +$as_echo "$lt_cv_prog_compiler_static_works" >&6; } + +if test x"$lt_cv_prog_compiler_static_works" = xyes; then + : +else + lt_prog_compiler_static= +fi + + + + + + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -c -o file.$ac_objext" >&5 +$as_echo_n "checking if $compiler supports -c -o file.$ac_objext... " >&6; } +if test "${lt_cv_prog_compiler_c_o+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + lt_cv_prog_compiler_c_o=no + $RM -r conftest 2>/dev/null + mkdir conftest + cd conftest + mkdir out + echo "$lt_simple_compile_test_code" > conftest.$ac_ext + + lt_compiler_flag="-o out/conftest2.$ac_objext" + # Insert the option either (1) after the last *FLAGS variable, or + # (2) before a word containing "conftest.", or (3) at the end. + # Note that $ac_compile itself does not contain backslashes and begins + # with a dollar sign (not a hyphen), so the echo should work correctly. + lt_compile=`echo "$ac_compile" | $SED \ + -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ + -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ + -e 's:$: $lt_compiler_flag:'` + (eval echo "\"\$as_me:10819: $lt_compile\"" >&5) + (eval "$lt_compile" 2>out/conftest.err) + ac_status=$? + cat out/conftest.err >&5 + echo "$as_me:10823: \$? = $ac_status" >&5 + if (exit $ac_status) && test -s out/conftest2.$ac_objext + then + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings + $ECHO "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' > out/conftest.exp + $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2 + if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then + lt_cv_prog_compiler_c_o=yes + fi + fi + chmod u+w . 2>&5 + $RM conftest* + # SGI C++ compiler will create directory out/ii_files/ for + # template instantiation + test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files + $RM out/* && rmdir out + cd .. + $RM -r conftest + $RM conftest* + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_c_o" >&5 +$as_echo "$lt_cv_prog_compiler_c_o" >&6; } + + + + + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -c -o file.$ac_objext" >&5 +$as_echo_n "checking if $compiler supports -c -o file.$ac_objext... " >&6; } +if test "${lt_cv_prog_compiler_c_o+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + lt_cv_prog_compiler_c_o=no + $RM -r conftest 2>/dev/null + mkdir conftest + cd conftest + mkdir out + echo "$lt_simple_compile_test_code" > conftest.$ac_ext + + lt_compiler_flag="-o out/conftest2.$ac_objext" + # Insert the option either (1) after the last *FLAGS variable, or + # (2) before a word containing "conftest.", or (3) at the end. + # Note that $ac_compile itself does not contain backslashes and begins + # with a dollar sign (not a hyphen), so the echo should work correctly. + lt_compile=`echo "$ac_compile" | $SED \ + -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ + -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ + -e 's:$: $lt_compiler_flag:'` + (eval echo "\"\$as_me:10874: $lt_compile\"" >&5) + (eval "$lt_compile" 2>out/conftest.err) + ac_status=$? + cat out/conftest.err >&5 + echo "$as_me:10878: \$? = $ac_status" >&5 + if (exit $ac_status) && test -s out/conftest2.$ac_objext + then + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings + $ECHO "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' > out/conftest.exp + $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2 + if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then + lt_cv_prog_compiler_c_o=yes + fi + fi + chmod u+w . 2>&5 + $RM conftest* + # SGI C++ compiler will create directory out/ii_files/ for + # template instantiation + test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files + $RM out/* && rmdir out + cd .. + $RM -r conftest + $RM conftest* + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_c_o" >&5 +$as_echo "$lt_cv_prog_compiler_c_o" >&6; } + + + + +hard_links="nottested" +if test "$lt_cv_prog_compiler_c_o" = no && test "$need_locks" != no; then + # do not overwrite the value of need_locks provided by the user + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if we can lock with hard links" >&5 +$as_echo_n "checking if we can lock with hard links... " >&6; } + hard_links=yes + $RM conftest* + ln conftest.a conftest.b 2>/dev/null && hard_links=no + touch conftest.a + ln conftest.a conftest.b 2>&5 || hard_links=no + ln conftest.a conftest.b 2>/dev/null && hard_links=no + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $hard_links" >&5 +$as_echo "$hard_links" >&6; } + if test "$hard_links" = no; then + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&5 +$as_echo "$as_me: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&2;} + need_locks=warn + fi +else + need_locks=no +fi + + + + + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the $compiler linker ($LD) supports shared libraries" >&5 +$as_echo_n "checking whether the $compiler linker ($LD) supports shared libraries... " >&6; } + + runpath_var= + allow_undefined_flag= + always_export_symbols=no + archive_cmds= + archive_expsym_cmds= + compiler_needs_object=no + enable_shared_with_static_runtimes=no + export_dynamic_flag_spec= + export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' + hardcode_automatic=no + hardcode_direct=no + hardcode_direct_absolute=no + hardcode_libdir_flag_spec= + hardcode_libdir_flag_spec_ld= + hardcode_libdir_separator= + hardcode_minus_L=no + hardcode_shlibpath_var=unsupported + inherit_rpath=no + link_all_deplibs=unknown + module_cmds= + module_expsym_cmds= + old_archive_from_new_cmds= + old_archive_from_expsyms_cmds= + thread_safe_flag_spec= + whole_archive_flag_spec= + # include_expsyms should be a list of space-separated symbols to be *always* + # included in the symbol list + include_expsyms= + # exclude_expsyms can be an extended regexp of symbols to exclude + # it will be wrapped by ` (' and `)$', so one must not match beginning or + # end of line. Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc', + # as well as any symbol that contains `d'. + exclude_expsyms='_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*' + # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out + # platforms (ab)use it in PIC code, but their linkers get confused if + # the symbol is explicitly referenced. Since portable code cannot + # rely on this symbol name, it's probably fine to never include it in + # preloaded symbol tables. + # Exclude shared library initialization/finalization symbols. + extract_expsyms_cmds= + + case $host_os in + cygwin* | mingw* | pw32* | cegcc*) + # FIXME: the MSVC++ port hasn't been tested in a loooong time + # When not using gcc, we currently assume that we are using + # Microsoft Visual C++. + if test "$GCC" != yes; then + with_gnu_ld=no + fi + ;; + interix*) + # we just hope/assume this is gcc and not c89 (= MSVC++) + with_gnu_ld=yes + ;; + openbsd*) + with_gnu_ld=no + ;; + linux* | k*bsd*-gnu) + link_all_deplibs=no + ;; + esac + + ld_shlibs=yes + if test "$with_gnu_ld" = yes; then + # If archive_cmds runs LD, not CC, wlarc should be empty + wlarc='${wl}' + + # Set some defaults for GNU ld with shared library support. These + # are reset later if shared libraries are not supported. Putting them + # here allows them to be overridden if necessary. + runpath_var=LD_RUN_PATH + hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' + export_dynamic_flag_spec='${wl}--export-dynamic' + # ancient GNU ld didn't support --whole-archive et. al. + if $LD --help 2>&1 | $GREP 'no-whole-archive' > /dev/null; then + whole_archive_flag_spec="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' + else + whole_archive_flag_spec= + fi + supports_anon_versioning=no + case `$LD -v 2>&1` in + *GNU\ gold*) supports_anon_versioning=yes ;; + *\ [01].* | *\ 2.[0-9].* | *\ 2.10.*) ;; # catch versions < 2.11 + *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ... + *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ... + *\ 2.11.*) ;; # other 2.11 versions + *) supports_anon_versioning=yes ;; + esac + + # See if GNU ld supports shared libraries. + case $host_os in + aix[3-9]*) + # On AIX/PPC, the GNU linker is very broken + if test "$host_cpu" != ia64; then + ld_shlibs=no + cat <<_LT_EOF 1>&2 + +*** Warning: the GNU linker, at least up to release 2.9.1, is reported +*** to be unable to reliably create shared libraries on AIX. +*** Therefore, libtool is disabling shared libraries support. If you +*** really care for shared libraries, you may want to modify your PATH +*** so that a non-GNU linker is found, and then restart. + +_LT_EOF + fi + ;; + + amigaos*) + case $host_cpu in + powerpc) + # see comment about AmigaOS4 .so support + archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + archive_expsym_cmds='' + ;; + m68k) + archive_cmds='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' + hardcode_libdir_flag_spec='-L$libdir' + hardcode_minus_L=yes + ;; + esac + ;; + + beos*) + if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then + allow_undefined_flag=unsupported + # Joseph Beckenbach says some releases of gcc + # support --undefined. This deserves some investigation. FIXME + archive_cmds='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + else + ld_shlibs=no + fi + ;; + + cygwin* | mingw* | pw32* | cegcc*) + # _LT_TAGVAR(hardcode_libdir_flag_spec, ) is actually meaningless, + # as there is no search path for DLLs. + hardcode_libdir_flag_spec='-L$libdir' + allow_undefined_flag=unsupported + always_export_symbols=no + enable_shared_with_static_runtimes=yes + export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS][ ]/s/.*[ ]\([^ ]*\)/\1 DATA/'\'' | $SED -e '\''/^[AITW][ ]/s/.*[ ]//'\'' | sort | uniq > $export_symbols' + + if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then + archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' + # If the export-symbols file already is a .def file (1st line + # is EXPORTS), use it as is; otherwise, prepend... + archive_expsym_cmds='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then + cp $export_symbols $output_objdir/$soname.def; + else + echo EXPORTS > $output_objdir/$soname.def; + cat $export_symbols >> $output_objdir/$soname.def; + fi~ + $CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' + else + ld_shlibs=no + fi + ;; + + interix[3-9]*) + hardcode_direct=no + hardcode_shlibpath_var=no + hardcode_libdir_flag_spec='${wl}-rpath,$libdir' + export_dynamic_flag_spec='${wl}-E' + # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc. + # Instead, shared libraries are loaded at an image base (0x10000000 by + # default) and relocated if they conflict, which is a slow very memory + # consuming and fragmenting process. To avoid this, we pick a random, + # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link + # time. Moving up from 0x10000000 also allows more sbrk(2) space. + archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' + archive_expsym_cmds='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' + ;; + + gnu* | linux* | tpf* | k*bsd*-gnu | kopensolaris*-gnu) + tmp_diet=no + if test "$host_os" = linux-dietlibc; then + case $cc_basename in + diet\ *) tmp_diet=yes;; # linux-dietlibc with static linking (!diet-dyn) + esac + fi + if $LD --help 2>&1 | $EGREP ': supported targets:.* elf' > /dev/null \ + && test "$tmp_diet" = no + then + tmp_addflag= + tmp_sharedflag='-shared' + case $cc_basename,$host_cpu in + pgcc*) # Portland Group C compiler + whole_archive_flag_spec='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $ECHO \"$new_convenience\"` ${wl}--no-whole-archive' + tmp_addflag=' $pic_flag' + ;; + pgf77* | pgf90* | pgf95*) # Portland Group f77 and f90 compilers + whole_archive_flag_spec='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $ECHO \"$new_convenience\"` ${wl}--no-whole-archive' + tmp_addflag=' $pic_flag -Mnomain' ;; + ecc*,ia64* | icc*,ia64*) # Intel C compiler on ia64 + tmp_addflag=' -i_dynamic' ;; + efc*,ia64* | ifort*,ia64*) # Intel Fortran compiler on ia64 + tmp_addflag=' -i_dynamic -nofor_main' ;; + ifc* | ifort*) # Intel Fortran compiler + tmp_addflag=' -nofor_main' ;; + lf95*) # Lahey Fortran 8.1 + whole_archive_flag_spec= + tmp_sharedflag='--shared' ;; + xl[cC]*) # IBM XL C 8.0 on PPC (deal with xlf below) + tmp_sharedflag='-qmkshrobj' + tmp_addflag= ;; + esac + case `$CC -V 2>&1 | sed 5q` in + *Sun\ C*) # Sun C 5.9 + whole_archive_flag_spec='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; $ECHO \"$new_convenience\"` ${wl}--no-whole-archive' + compiler_needs_object=yes + tmp_sharedflag='-G' ;; + *Sun\ F*) # Sun Fortran 8.3 + tmp_sharedflag='-G' ;; + esac + archive_cmds='$CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + + if test "x$supports_anon_versioning" = xyes; then + archive_expsym_cmds='echo "{ global:" > $output_objdir/$libname.ver~ + cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ + echo "local: *; };" >> $output_objdir/$libname.ver~ + $CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' + fi + + case $cc_basename in + xlf*) + # IBM XL Fortran 10.1 on PPC cannot create shared libs itself + whole_archive_flag_spec='--whole-archive$convenience --no-whole-archive' + hardcode_libdir_flag_spec= + hardcode_libdir_flag_spec_ld='-rpath $libdir' + archive_cmds='$LD -shared $libobjs $deplibs $compiler_flags -soname $soname -o $lib' + if test "x$supports_anon_versioning" = xyes; then + archive_expsym_cmds='echo "{ global:" > $output_objdir/$libname.ver~ + cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ + echo "local: *; };" >> $output_objdir/$libname.ver~ + $LD -shared $libobjs $deplibs $compiler_flags -soname $soname -version-script $output_objdir/$libname.ver -o $lib' + fi + ;; + esac + else + ld_shlibs=no + fi + ;; + + netbsd* | netbsdelf*-gnu) + if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then + archive_cmds='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' + wlarc= + else + archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + fi + ;; + + solaris*) + if $LD -v 2>&1 | $GREP 'BFD 2\.8' > /dev/null; then + ld_shlibs=no + cat <<_LT_EOF 1>&2 + +*** Warning: The releases 2.8.* of the GNU linker cannot reliably +*** create shared libraries on Solaris systems. Therefore, libtool +*** is disabling shared libraries support. We urge you to upgrade GNU +*** binutils to release 2.9.1 or newer. Another option is to modify +*** your PATH or compiler configuration so that the native linker is +*** used, and then restart. + +_LT_EOF + elif $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then + archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + else + ld_shlibs=no + fi + ;; + + sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX*) + case `$LD -v 2>&1` in + *\ [01].* | *\ 2.[0-9].* | *\ 2.1[0-5].*) + ld_shlibs=no + cat <<_LT_EOF 1>&2 + +*** Warning: Releases of the GNU linker prior to 2.16.91.0.3 can not +*** reliably create shared libraries on SCO systems. Therefore, libtool +*** is disabling shared libraries support. We urge you to upgrade GNU +*** binutils to release 2.16.91.0.3 or newer. Another option is to modify +*** your PATH or compiler configuration so that the native linker is +*** used, and then restart. + +_LT_EOF + ;; + *) + # For security reasons, it is highly recommended that you always + # use absolute paths for naming shared libraries, and exclude the + # DT_RUNPATH tag from executables and libraries. But doing so + # requires that you compile everything twice, which is a pain. + if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then + hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' + archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + else + ld_shlibs=no + fi + ;; + esac + ;; + + sunos4*) + archive_cmds='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags' + wlarc= + hardcode_direct=yes + hardcode_shlibpath_var=no + ;; + + *) + if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then + archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + else + ld_shlibs=no + fi + ;; + esac + + if test "$ld_shlibs" = no; then + runpath_var= + hardcode_libdir_flag_spec= + export_dynamic_flag_spec= + whole_archive_flag_spec= + fi + else + # PORTME fill in a description of your system's linker (not GNU ld) + case $host_os in + aix3*) + allow_undefined_flag=unsupported + always_export_symbols=yes + archive_expsym_cmds='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname' + # Note: this linker hardcodes the directories in LIBPATH if there + # are no directories specified by -L. + hardcode_minus_L=yes + if test "$GCC" = yes && test -z "$lt_prog_compiler_static"; then + # Neither direct hardcoding nor static linking is supported with a + # broken collect2. + hardcode_direct=unsupported + fi + ;; + + aix[4-9]*) + if test "$host_cpu" = ia64; then + # On IA64, the linker does run time linking by default, so we don't + # have to do anything special. + aix_use_runtimelinking=no + exp_sym_flag='-Bexport' + no_entry_flag="" + else + # If we're using GNU nm, then we don't want the "-C" option. + # -C means demangle to AIX nm, but means don't demangle with GNU nm + if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then + export_symbols_cmds='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && (substr(\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' + else + export_symbols_cmds='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && (substr(\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' + fi + aix_use_runtimelinking=no + + # Test if we are trying to use run time linking or normal + # AIX style linking. If -brtl is somewhere in LDFLAGS, we + # need to do runtime linking. + case $host_os in aix4.[23]|aix4.[23].*|aix[5-9]*) + for ld_flag in $LDFLAGS; do + if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then + aix_use_runtimelinking=yes + break + fi + done + ;; + esac + + exp_sym_flag='-bexport' + no_entry_flag='-bnoentry' + fi + + # When large executables or shared objects are built, AIX ld can + # have problems creating the table of contents. If linking a library + # or program results in "error TOC overflow" add -mminimal-toc to + # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not + # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. + + archive_cmds='' + hardcode_direct=yes + hardcode_direct_absolute=yes + hardcode_libdir_separator=':' + link_all_deplibs=yes + file_list_spec='${wl}-f,' + + if test "$GCC" = yes; then + case $host_os in aix4.[012]|aix4.[012].*) + # We only want to do this on AIX 4.2 and lower, the check + # below for broken collect2 doesn't work under 4.3+ + collect2name=`${CC} -print-prog-name=collect2` + if test -f "$collect2name" && + strings "$collect2name" | $GREP resolve_lib_name >/dev/null + then + # We have reworked collect2 + : + else + # We have old collect2 + hardcode_direct=unsupported + # It fails to find uninstalled libraries when the uninstalled + # path is not listed in the libpath. Setting hardcode_minus_L + # to unsupported forces relinking + hardcode_minus_L=yes + hardcode_libdir_flag_spec='-L$libdir' + hardcode_libdir_separator= + fi + ;; + esac + shared_flag='-shared' + if test "$aix_use_runtimelinking" = yes; then + shared_flag="$shared_flag "'${wl}-G' + fi + link_all_deplibs=no + else + # not using gcc + if test "$host_cpu" = ia64; then + # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release + # chokes on -Wl,-G. The following line is correct: + shared_flag='-G' + else + if test "$aix_use_runtimelinking" = yes; then + shared_flag='${wl}-G' + else + shared_flag='${wl}-bM:SRE' + fi + fi + fi + + export_dynamic_flag_spec='${wl}-bexpall' + # It seems that -bexpall does not export symbols beginning with + # underscore (_), so it is better to generate a list of symbols to export. + always_export_symbols=yes + if test "$aix_use_runtimelinking" = yes; then + # Warning - without using the other runtime loading flags (-brtl), + # -berok will link without error, but may produce a broken library. + allow_undefined_flag='-berok' + # Determine the default libpath from the value encoded in an + # empty executable. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int main (void) +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + +lt_aix_libpath_sed=' + /Import File Strings/,/^$/ { + /^0/ { + s/^0 *\(.*\)$/\1/ + p + } + }' +aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` +# Check for a 64-bit object if we didn't find anything. +if test -z "$aix_libpath"; then + aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` +fi +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi + + hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath" + archive_expsym_cmds='$CC -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then $ECHO "X${wl}${allow_undefined_flag}" | $Xsed; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag" + else + if test "$host_cpu" = ia64; then + hardcode_libdir_flag_spec='${wl}-R $libdir:/usr/lib:/lib' + allow_undefined_flag="-z nodefs" + archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols" + else + # Determine the default libpath from the value encoded in an + # empty executable. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int main (void) +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + +lt_aix_libpath_sed=' + /Import File Strings/,/^$/ { + /^0/ { + s/^0 *\(.*\)$/\1/ + p + } + }' +aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` +# Check for a 64-bit object if we didn't find anything. +if test -z "$aix_libpath"; then + aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` +fi +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi + + hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath" + # Warning - without using the other run time loading flags, + # -berok will link without error, but may produce a broken library. + no_undefined_flag=' ${wl}-bernotok' + allow_undefined_flag=' ${wl}-berok' + # Exported symbols can be pulled into shared objects from archives + whole_archive_flag_spec='$convenience' + archive_cmds_need_lc=yes + # This is similar to how AIX traditionally builds its shared libraries. + archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' + fi + fi + ;; + + amigaos*) + case $host_cpu in + powerpc) + # see comment about AmigaOS4 .so support + archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + archive_expsym_cmds='' + ;; + m68k) + archive_cmds='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' + hardcode_libdir_flag_spec='-L$libdir' + hardcode_minus_L=yes + ;; + esac + ;; + + bsdi[45]*) + export_dynamic_flag_spec=-rdynamic + ;; + + cygwin* | mingw* | pw32* | cegcc*) + # When not using gcc, we currently assume that we are using + # Microsoft Visual C++. + # hardcode_libdir_flag_spec is actually meaningless, as there is + # no search path for DLLs. + hardcode_libdir_flag_spec=' ' + allow_undefined_flag=unsupported + # Tell ltmain to make .lib files, not .a files. + libext=lib + # Tell ltmain to make .dll files, not .so files. + shrext_cmds=".dll" + # FIXME: Setting linknames here is a bad hack. + archive_cmds='$CC -o $lib $libobjs $compiler_flags `$ECHO "X$deplibs" | $Xsed -e '\''s/ -lc$//'\''` -link -dll~linknames=' + # The linker will automatically build a .lib file if we build a DLL. + old_archive_from_new_cmds='true' + # FIXME: Should let the user specify the lib program. + old_archive_cmds='lib -OUT:$oldlib$oldobjs$old_deplibs' + fix_srcfile_path='`cygpath -w "$srcfile"`' + enable_shared_with_static_runtimes=yes + ;; + + darwin* | rhapsody*) + + + archive_cmds_need_lc=no + hardcode_direct=no + hardcode_automatic=yes + hardcode_shlibpath_var=unsupported + whole_archive_flag_spec='' + link_all_deplibs=yes + allow_undefined_flag="$_lt_dar_allow_undefined" + case $cc_basename in + ifort*) _lt_dar_can_shared=yes ;; + *) _lt_dar_can_shared=$GCC ;; + esac + if test "$_lt_dar_can_shared" = "yes"; then + output_verbose_link_cmd=echo + archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}" + module_cmds="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}" + archive_expsym_cmds="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}" + module_expsym_cmds="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}" + + else + ld_shlibs=no + fi + + ;; + + dgux*) + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_libdir_flag_spec='-L$libdir' + hardcode_shlibpath_var=no + ;; + + freebsd1*) + ld_shlibs=no + ;; + + # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor + # support. Future versions do this automatically, but an explicit c++rt0.o + # does not break anything, and helps significantly (at the cost of a little + # extra space). + freebsd2.2*) + archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o' + hardcode_libdir_flag_spec='-R$libdir' + hardcode_direct=yes + hardcode_shlibpath_var=no + ;; + + # Unfortunately, older versions of FreeBSD 2 do not have this feature. + freebsd2*) + archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' + hardcode_direct=yes + hardcode_minus_L=yes + hardcode_shlibpath_var=no + ;; + + # FreeBSD 3 and greater uses gcc -shared to do shared libraries. + freebsd* | dragonfly*) + archive_cmds='$CC -shared -o $lib $libobjs $deplibs $compiler_flags' + hardcode_libdir_flag_spec='-R$libdir' + hardcode_direct=yes + hardcode_shlibpath_var=no + ;; + + hpux9*) + if test "$GCC" = yes; then + archive_cmds='$RM $output_objdir/$soname~$CC -shared -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' + else + archive_cmds='$RM $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' + fi + hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' + hardcode_libdir_separator=: + hardcode_direct=yes + + # hardcode_minus_L: Not really in the search PATH, + # but as the default location of the library. + hardcode_minus_L=yes + export_dynamic_flag_spec='${wl}-E' + ;; + + hpux10*) + if test "$GCC" = yes -a "$with_gnu_ld" = no; then + archive_cmds='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' + else + archive_cmds='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' + fi + if test "$with_gnu_ld" = no; then + hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' + hardcode_libdir_flag_spec_ld='+b $libdir' + hardcode_libdir_separator=: + hardcode_direct=yes + hardcode_direct_absolute=yes + export_dynamic_flag_spec='${wl}-E' + # hardcode_minus_L: Not really in the search PATH, + # but as the default location of the library. + hardcode_minus_L=yes + fi + ;; + + hpux11*) + if test "$GCC" = yes -a "$with_gnu_ld" = no; then + case $host_cpu in + hppa*64*) + archive_cmds='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' + ;; + ia64*) + archive_cmds='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' + ;; + *) + archive_cmds='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' + ;; + esac + else + case $host_cpu in + hppa*64*) + archive_cmds='$CC -b ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' + ;; + ia64*) + archive_cmds='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' + ;; + *) + archive_cmds='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' + ;; + esac + fi + if test "$with_gnu_ld" = no; then + hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' + hardcode_libdir_separator=: + + case $host_cpu in + hppa*64*|ia64*) + hardcode_direct=no + hardcode_shlibpath_var=no + ;; + *) + hardcode_direct=yes + hardcode_direct_absolute=yes + export_dynamic_flag_spec='${wl}-E' + + # hardcode_minus_L: Not really in the search PATH, + # but as the default location of the library. + hardcode_minus_L=yes + ;; + esac + fi + ;; + + irix5* | irix6* | nonstopux*) + if test "$GCC" = yes; then + archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + # Try to use the -exported_symbol ld option, if it does not + # work, assume that -exports_file does not work either and + # implicitly export all symbols. + save_LDFLAGS="$LDFLAGS" + LDFLAGS="$LDFLAGS -shared ${wl}-exported_symbol ${wl}foo ${wl}-update_registry ${wl}/dev/null" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +int foo(void) {} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations ${wl}-exports_file ${wl}$export_symbols -o $lib' + +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + LDFLAGS="$save_LDFLAGS" + else + archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib' + archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -exports_file $export_symbols -o $lib' + fi + archive_cmds_need_lc='no' + hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' + hardcode_libdir_separator=: + inherit_rpath=yes + link_all_deplibs=yes + ;; + + netbsd* | netbsdelf*-gnu) + if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then + archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out + else + archive_cmds='$LD -shared -o $lib $libobjs $deplibs $linker_flags' # ELF + fi + hardcode_libdir_flag_spec='-R$libdir' + hardcode_direct=yes + hardcode_shlibpath_var=no + ;; + + newsos6) + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_direct=yes + hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' + hardcode_libdir_separator=: + hardcode_shlibpath_var=no + ;; + + *nto* | *qnx*) + ;; + + openbsd*) + if test -f /usr/libexec/ld.so; then + hardcode_direct=yes + hardcode_shlibpath_var=no + hardcode_direct_absolute=yes + if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then + archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' + archive_expsym_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-retain-symbols-file,$export_symbols' + hardcode_libdir_flag_spec='${wl}-rpath,$libdir' + export_dynamic_flag_spec='${wl}-E' + else + case $host_os in + openbsd[01].* | openbsd2.[0-7] | openbsd2.[0-7].*) + archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' + hardcode_libdir_flag_spec='-R$libdir' + ;; + *) + archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' + hardcode_libdir_flag_spec='${wl}-rpath,$libdir' + ;; + esac + fi + else + ld_shlibs=no + fi + ;; + + os2*) + hardcode_libdir_flag_spec='-L$libdir' + hardcode_minus_L=yes + allow_undefined_flag=unsupported + archive_cmds='$ECHO "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~$ECHO DATA >> $output_objdir/$libname.def~$ECHO " SINGLE NONSHARED" >> $output_objdir/$libname.def~$ECHO EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def' + old_archive_from_new_cmds='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def' + ;; + + osf3*) + if test "$GCC" = yes; then + allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*' + archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + else + allow_undefined_flag=' -expect_unresolved \*' + archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib' + fi + archive_cmds_need_lc='no' + hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' + hardcode_libdir_separator=: + ;; + + osf4* | osf5*) # as osf3* with the addition of -msym flag + if test "$GCC" = yes; then + allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*' + archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' + else + allow_undefined_flag=' -expect_unresolved \*' + archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -msym -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib' + archive_expsym_cmds='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; printf "%s\\n" "-hidden">> $lib.exp~ + $CC -shared${allow_undefined_flag} ${wl}-input ${wl}$lib.exp $compiler_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib~$RM $lib.exp' + + # Both c and cxx compiler support -rpath directly + hardcode_libdir_flag_spec='-rpath $libdir' + fi + archive_cmds_need_lc='no' + hardcode_libdir_separator=: + ;; + + solaris*) + no_undefined_flag=' -z defs' + if test "$GCC" = yes; then + wlarc='${wl}' + archive_cmds='$CC -shared ${wl}-z ${wl}text ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' + archive_expsym_cmds='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ + $CC -shared ${wl}-z ${wl}text ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp' + else + case `$CC -V 2>&1` in + *"Compilers 5.0"*) + wlarc='' + archive_cmds='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' + archive_expsym_cmds='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ + $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$RM $lib.exp' + ;; + *) + wlarc='${wl}' + archive_cmds='$CC -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $compiler_flags' + archive_expsym_cmds='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ + $CC -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp' + ;; + esac + fi + hardcode_libdir_flag_spec='-R$libdir' + hardcode_shlibpath_var=no + case $host_os in + solaris2.[0-5] | solaris2.[0-5].*) ;; + *) + # The compiler driver will combine and reorder linker options, + # but understands `-z linker_flag'. GCC discards it without `$wl', + # but is careful enough not to reorder. + # Supported since Solaris 2.6 (maybe 2.5.1?) + if test "$GCC" = yes; then + whole_archive_flag_spec='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract' + else + whole_archive_flag_spec='-z allextract$convenience -z defaultextract' + fi + ;; + esac + link_all_deplibs=yes + ;; + + sunos4*) + if test "x$host_vendor" = xsequent; then + # Use $CC to link under sequent, because it throws in some extra .o + # files that make .init and .fini sections work. + archive_cmds='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags' + else + archive_cmds='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags' + fi + hardcode_libdir_flag_spec='-L$libdir' + hardcode_direct=yes + hardcode_minus_L=yes + hardcode_shlibpath_var=no + ;; + + sysv4) + case $host_vendor in + sni) + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_direct=yes # is this really true??? + ;; + siemens) + ## LD is ld it makes a PLAMLIB + ## CC just makes a GrossModule. + archive_cmds='$LD -G -o $lib $libobjs $deplibs $linker_flags' + reload_cmds='$CC -r -o $output$reload_objs' + hardcode_direct=no + ;; + motorola) + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_direct=no #Motorola manual says yes, but my tests say they lie + ;; + esac + runpath_var='LD_RUN_PATH' + hardcode_shlibpath_var=no + ;; + + sysv4.3*) + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_shlibpath_var=no + export_dynamic_flag_spec='-Bexport' + ;; + + sysv4*MP*) + if test -d /usr/nec; then + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_shlibpath_var=no + runpath_var=LD_RUN_PATH + hardcode_runpath_var=yes + ld_shlibs=yes + fi + ;; + + sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[01].[10]* | unixware7* | sco3.2v5.0.[024]*) + no_undefined_flag='${wl}-z,text' + archive_cmds_need_lc=no + hardcode_shlibpath_var=no + runpath_var='LD_RUN_PATH' + + if test "$GCC" = yes; then + archive_cmds='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + archive_expsym_cmds='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + else + archive_cmds='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + archive_expsym_cmds='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + fi + ;; + + sysv5* | sco3.2v5* | sco5v6*) + # Note: We can NOT use -z defs as we might desire, because we do not + # link with -lc, and that would cause any symbols used from libc to + # always be unresolved, which means just about no library would + # ever link correctly. If we're not using GNU ld we use -z text + # though, which does catch some bad symbols but isn't as heavy-handed + # as -z defs. + no_undefined_flag='${wl}-z,text' + allow_undefined_flag='${wl}-z,nodefs' + archive_cmds_need_lc=no + hardcode_shlibpath_var=no + hardcode_libdir_flag_spec='${wl}-R,$libdir' + hardcode_libdir_separator=':' + link_all_deplibs=yes + export_dynamic_flag_spec='${wl}-Bexport' + runpath_var='LD_RUN_PATH' + + if test "$GCC" = yes; then + archive_cmds='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + archive_expsym_cmds='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + else + archive_cmds='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + archive_expsym_cmds='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + fi + ;; + + uts4*) + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_libdir_flag_spec='-L$libdir' + hardcode_shlibpath_var=no + ;; + + *) + ld_shlibs=no + ;; + esac + + if test x$host_vendor = xsni; then + case $host in + sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) + export_dynamic_flag_spec='${wl}-Blargedynsym' + ;; + esac + fi + fi + +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ld_shlibs" >&5 +$as_echo "$ld_shlibs" >&6; } +test "$ld_shlibs" = no && can_build_shared=no + +with_gnu_ld=$with_gnu_ld + + + + + + + + + + + + + + + +# +# Do we need to explicitly link libc? +# +case "x$archive_cmds_need_lc" in +x|xyes) + # Assume -lc should be added + archive_cmds_need_lc=yes + + if test "$enable_shared" = yes && test "$GCC" = yes; then + case $archive_cmds in + *'~'*) + # FIXME: we may have to deal with multi-command sequences. + ;; + '$CC '*) + # Test whether the compiler implicitly links with -lc since on some + # systems, -lgcc has to come before -lc. If gcc already passes -lc + # to ld, don't add -lc before -lgcc. + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether -lc should be explicitly linked in" >&5 +$as_echo_n "checking whether -lc should be explicitly linked in... " >&6; } + $RM conftest* + echo "$lt_simple_compile_test_code" > conftest.$ac_ext + + if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } 2>conftest.err; then + soname=conftest + lib=conftest + libobjs=conftest.$ac_objext + deplibs= + wl=$lt_prog_compiler_wl + pic_flag=$lt_prog_compiler_pic + compiler_flags=-v + linker_flags=-v + verstring= + output_objdir=. + libname=conftest + lt_save_allow_undefined_flag=$allow_undefined_flag + allow_undefined_flag= + if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$archive_cmds 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1\""; } >&5 + (eval $archive_cmds 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1) 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } + then + archive_cmds_need_lc=no + else + archive_cmds_need_lc=yes + fi + allow_undefined_flag=$lt_save_allow_undefined_flag + else + cat conftest.err 1>&5 + fi + $RM conftest* + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $archive_cmds_need_lc" >&5 +$as_echo "$archive_cmds_need_lc" >&6; } + ;; + esac + fi + ;; +esac + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking dynamic linker characteristics" >&5 +$as_echo_n "checking dynamic linker characteristics... " >&6; } + +if test "$GCC" = yes; then + case $host_os in + darwin*) lt_awk_arg="/^libraries:/,/LR/" ;; + *) lt_awk_arg="/^libraries:/" ;; + esac + lt_search_path_spec=`$CC -print-search-dirs | awk $lt_awk_arg | $SED -e "s/^libraries://" -e "s,=/,/,g"` + if $ECHO "$lt_search_path_spec" | $GREP ';' >/dev/null ; then + # if the path contains ";" then we assume it to be the separator + # otherwise default to the standard path separator (i.e. ":") - it is + # assumed that no part of a normal pathname contains ";" but that should + # okay in the real world where ";" in dirpaths is itself problematic. + lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED -e 's/;/ /g'` + else + lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` + fi + # Ok, now we have the path, separated by spaces, we can step through it + # and add multilib dir if necessary. + lt_tmp_lt_search_path_spec= + lt_multi_os_dir=`$CC $CPPFLAGS $CFLAGS $LDFLAGS -print-multi-os-directory 2>/dev/null` + for lt_sys_path in $lt_search_path_spec; do + if test -d "$lt_sys_path/$lt_multi_os_dir"; then + lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path/$lt_multi_os_dir" + else + test -d "$lt_sys_path" && \ + lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path" + fi + done + lt_search_path_spec=`$ECHO $lt_tmp_lt_search_path_spec | awk ' +BEGIN {RS=" "; FS="/|\n";} { + lt_foo=""; + lt_count=0; + for (lt_i = NF; lt_i > 0; lt_i--) { + if ($lt_i != "" && $lt_i != ".") { + if ($lt_i == "..") { + lt_count++; + } else { + if (lt_count == 0) { + lt_foo="/" $lt_i lt_foo; + } else { + lt_count--; + } + } + } + } + if (lt_foo != "") { lt_freq[lt_foo]++; } + if (lt_freq[lt_foo] == 1) { print lt_foo; } +}'` + sys_lib_search_path_spec=`$ECHO $lt_search_path_spec` +else + sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" +fi +library_names_spec= +libname_spec='lib$name' +soname_spec= +shrext_cmds=".so" +postinstall_cmds= +postuninstall_cmds= +finish_cmds= +finish_eval= +shlibpath_var= +shlibpath_overrides_runpath=unknown +version_type=none +dynamic_linker="$host_os ld.so" +sys_lib_dlsearch_path_spec="/lib /usr/lib" +need_lib_prefix=unknown +hardcode_into_libs=no + +# when you set need_version to no, make sure it does not cause -set_version +# flags to be left without arguments +need_version=unknown + +case $host_os in +aix3*) + version_type=linux + library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a' + shlibpath_var=LIBPATH + + # AIX 3 has no versioning support, so we append a major version to the name. + soname_spec='${libname}${release}${shared_ext}$major' + ;; + +aix[4-9]*) + version_type=linux + need_lib_prefix=no + need_version=no + hardcode_into_libs=yes + if test "$host_cpu" = ia64; then + # AIX 5 supports IA64 + library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}' + shlibpath_var=LD_LIBRARY_PATH + else + # With GCC up to 2.95.x, collect2 would create an import file + # for dependence libraries. The import file would start with + # the line `#! .'. This would cause the generated library to + # depend on `.', always an invalid library. This was fixed in + # development snapshots of GCC prior to 3.0. + case $host_os in + aix4 | aix4.[01] | aix4.[01].*) + if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)' + echo ' yes ' + echo '#endif'; } | ${CC} -E - | $GREP yes > /dev/null; then + : + else + can_build_shared=no + fi + ;; + esac + # AIX (on Power*) has no versioning support, so currently we can not hardcode correct + # soname into executable. Probably we can add versioning support to + # collect2, so additional links can be useful in future. + if test "$aix_use_runtimelinking" = yes; then + # If using run time linking (on AIX 4.2 or later) use lib.so + # instead of lib.a to let people know that these are not + # typical AIX shared libraries. + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + else + # We preserve .a as extension for shared libraries through AIX4.2 + # and later when we are not doing run time linking. + library_names_spec='${libname}${release}.a $libname.a' + soname_spec='${libname}${release}${shared_ext}$major' + fi + shlibpath_var=LIBPATH + fi + ;; + +amigaos*) + case $host_cpu in + powerpc) + # Since July 2007 AmigaOS4 officially supports .so libraries. + # When compiling the executable, add -use-dynld -Lsobjs: to the compileline. + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + ;; + m68k) + library_names_spec='$libname.ixlibrary $libname.a' + # Create ${libname}_ixlibrary.a entries in /sys/libs. + finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$ECHO "X$lib" | $Xsed -e '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; test $RM /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done' + ;; + esac + ;; + +beos*) + library_names_spec='${libname}${shared_ext}' + dynamic_linker="$host_os ld.so" + shlibpath_var=LIBRARY_PATH + ;; + +bsdi[45]*) + version_type=linux + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir' + shlibpath_var=LD_LIBRARY_PATH + sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib" + sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib" + # the default ld.so.conf also contains /usr/contrib/lib and + # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow + # libtool to hard-code these into programs + ;; + +cygwin* | mingw* | pw32* | cegcc*) + version_type=windows + shrext_cmds=".dll" + need_version=no + need_lib_prefix=no + + case $GCC,$host_os in + yes,cygwin* | yes,mingw* | yes,pw32* | yes,cegcc*) + library_names_spec='$libname.dll.a' + # DLL is installed to $(libdir)/../bin by postinstall_cmds + postinstall_cmds='base_file=`basename \${file}`~ + dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~ + dldir=$destdir/`dirname \$dlpath`~ + test -d \$dldir || mkdir -p \$dldir~ + $install_prog $dir/$dlname \$dldir/$dlname~ + chmod a+x \$dldir/$dlname~ + if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then + eval '\''$striplib \$dldir/$dlname'\'' || exit \$?; + fi' + postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ + dlpath=$dir/\$dldll~ + $RM \$dlpath' + shlibpath_overrides_runpath=yes + + case $host_os in + cygwin*) + # Cygwin DLLs use 'cyg' prefix rather than 'lib' + soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' + sys_lib_search_path_spec="/usr/lib /lib/w32api /lib /usr/local/lib" + ;; + mingw* | cegcc*) + # MinGW DLLs use traditional 'lib' prefix + soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' + sys_lib_search_path_spec=`$CC -print-search-dirs | $GREP "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"` + if $ECHO "$sys_lib_search_path_spec" | $GREP ';[c-zC-Z]:/' >/dev/null; then + # It is most probably a Windows format PATH printed by + # mingw gcc, but we are running on Cygwin. Gcc prints its search + # path with ; separators, and with drive letters. We can handle the + # drive letters (cygwin fileutils understands them), so leave them, + # especially as we might pass files found there to a mingw objdump, + # which wouldn't understand a cygwinified path. Ahh. + sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` + else + sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` + fi + ;; + pw32*) + # pw32 DLLs use 'pw' prefix rather than 'lib' + library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' + ;; + esac + ;; + + *) + library_names_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext} $libname.lib' + ;; + esac + dynamic_linker='Win32 ld.exe' + # FIXME: first we should search . and the directory the executable is in + shlibpath_var=PATH + ;; + +darwin* | rhapsody*) + dynamic_linker="$host_os dyld" + version_type=darwin + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${major}$shared_ext ${libname}$shared_ext' + soname_spec='${libname}${release}${major}$shared_ext' + shlibpath_overrides_runpath=yes + shlibpath_var=DYLD_LIBRARY_PATH + shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`' + + sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/local/lib" + sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib' + ;; + +dgux*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + ;; + +freebsd1*) + dynamic_linker=no + ;; + +freebsd* | dragonfly*) + # DragonFly does not have aout. When/if they implement a new + # versioning mechanism, adjust this. + if test -x /usr/bin/objformat; then + objformat=`/usr/bin/objformat` + else + case $host_os in + freebsd[123]*) objformat=aout ;; + *) objformat=elf ;; + esac + fi + version_type=freebsd-$objformat + case $version_type in + freebsd-elf*) + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' + need_version=no + need_lib_prefix=no + ;; + freebsd-*) + library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix' + need_version=yes + ;; + esac + shlibpath_var=LD_LIBRARY_PATH + case $host_os in + freebsd2*) + shlibpath_overrides_runpath=yes + ;; + freebsd3.[01]* | freebsdelf3.[01]*) + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + ;; + freebsd3.[2-9]* | freebsdelf3.[2-9]* | \ + freebsd4.[0-5] | freebsdelf4.[0-5] | freebsd4.1.1 | freebsdelf4.1.1) + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + ;; + *) # from 4.6 on, and DragonFly + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + ;; + esac + ;; + +gnu*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + hardcode_into_libs=yes + ;; + +hpux9* | hpux10* | hpux11*) + # Give a soname corresponding to the major version so that dld.sl refuses to + # link against other versions. + version_type=sunos + need_lib_prefix=no + need_version=no + case $host_cpu in + ia64*) + shrext_cmds='.so' + hardcode_into_libs=yes + dynamic_linker="$host_os dld.so" + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + if test "X$HPUX_IA64_MODE" = X32; then + sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib" + else + sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64" + fi + sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec + ;; + hppa*64*) + shrext_cmds='.sl' + hardcode_into_libs=yes + dynamic_linker="$host_os dld.sl" + shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH + shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64" + sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec + ;; + *) + shrext_cmds='.sl' + dynamic_linker="$host_os dld.sl" + shlibpath_var=SHLIB_PATH + shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + ;; + esac + # HP-UX runs *really* slowly unless shared libraries are mode 555. + postinstall_cmds='chmod 555 $lib' + ;; + +interix[3-9]*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + dynamic_linker='Interix 3.x ld.so.1 (PE, like ELF)' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + ;; + +irix5* | irix6* | nonstopux*) + case $host_os in + nonstopux*) version_type=nonstopux ;; + *) + if test "$lt_cv_prog_gnu_ld" = yes; then + version_type=linux + else + version_type=irix + fi ;; + esac + need_lib_prefix=no + need_version=no + soname_spec='${libname}${release}${shared_ext}$major' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}' + case $host_os in + irix5* | nonstopux*) + libsuff= shlibsuff= + ;; + *) + case $LD in # libtool.m4 will add one of these switches to LD + *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") + libsuff= shlibsuff= libmagic=32-bit;; + *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") + libsuff=32 shlibsuff=N32 libmagic=N32;; + *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") + libsuff=64 shlibsuff=64 libmagic=64-bit;; + *) libsuff= shlibsuff= libmagic=never-match;; + esac + ;; + esac + shlibpath_var=LD_LIBRARY${shlibsuff}_PATH + shlibpath_overrides_runpath=no + sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}" + sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}" + hardcode_into_libs=yes + ;; + +# No shared lib support for Linux oldld, aout, or coff. +linux*oldld* | linux*aout* | linux*coff*) + dynamic_linker=no + ;; + +# This must be Linux ELF. +linux* | k*bsd*-gnu | kopensolaris*-gnu) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + # Some binutils ld are patched to set DT_RUNPATH + save_LDFLAGS=$LDFLAGS + save_libdir=$libdir + eval "libdir=/foo; wl=\"$lt_prog_compiler_wl\"; \ + LDFLAGS=\"\$LDFLAGS $hardcode_libdir_flag_spec\"" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int main (void) +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + if ($OBJDUMP -p conftest$ac_exeext) 2>/dev/null | grep "RUNPATH.*$libdir" >/dev/null; then : + shlibpath_overrides_runpath=yes +fi +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + LDFLAGS=$save_LDFLAGS + libdir=$save_libdir + + # This implies no fast_install, which is unacceptable. + # Some rework will be needed to allow for fast_install + # before this can be enabled. + hardcode_into_libs=yes + + # Append ld.so.conf contents to the search path + if test -f /etc/ld.so.conf; then + lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[ ]*hwcap[ ]/d;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '` + sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra" + fi + + # We used to test for /lib/ld.so.1 and disable shared libraries on + # powerpc, because MkLinux only supported shared libraries with the + # GNU dynamic linker. Since this was broken with cross compilers, + # most powerpc-linux boxes support dynamic linking these days and + # people can always --disable-shared, the test was removed, and we + # assume the GNU/Linux dynamic linker is in use. + dynamic_linker='GNU/Linux ld.so' + ;; + +netbsdelf*-gnu) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + dynamic_linker='NetBSD ld.elf_so' + ;; + +netbsd*) + version_type=sunos + need_lib_prefix=no + need_version=no + if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' + dynamic_linker='NetBSD (a.out) ld.so' + else + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + dynamic_linker='NetBSD ld.elf_so' + fi + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + ;; + +newsos6) + version_type=linux + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + ;; + +*nto* | *qnx*) + version_type=qnx + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + dynamic_linker='ldqnx.so' + ;; + +openbsd*) + version_type=sunos + sys_lib_dlsearch_path_spec="/usr/lib" + need_lib_prefix=no + # Some older versions of OpenBSD (3.3 at least) *do* need versioned libs. + case $host_os in + openbsd3.3 | openbsd3.3.*) need_version=yes ;; + *) need_version=no ;; + esac + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' + shlibpath_var=LD_LIBRARY_PATH + if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then + case $host_os in + openbsd2.[89] | openbsd2.[89].*) + shlibpath_overrides_runpath=no + ;; + *) + shlibpath_overrides_runpath=yes + ;; + esac + else + shlibpath_overrides_runpath=yes + fi + ;; + +os2*) + libname_spec='$name' + shrext_cmds=".dll" + need_lib_prefix=no + library_names_spec='$libname${shared_ext} $libname.a' + dynamic_linker='OS/2 ld.exe' + shlibpath_var=LIBPATH + ;; + +osf3* | osf4* | osf5*) + version_type=osf + need_lib_prefix=no + need_version=no + soname_spec='${libname}${release}${shared_ext}$major' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + shlibpath_var=LD_LIBRARY_PATH + sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib" + sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec" + ;; + +rdos*) + dynamic_linker=no + ;; + +solaris*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + # ldd complains unless libraries are executable + postinstall_cmds='chmod +x $lib' + ;; + +sunos4*) + version_type=sunos + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' + finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + if test "$with_gnu_ld" = yes; then + need_lib_prefix=no + fi + need_version=yes + ;; + +sysv4 | sysv4.3*) + version_type=linux + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + case $host_vendor in + sni) + shlibpath_overrides_runpath=no + need_lib_prefix=no + runpath_var=LD_RUN_PATH + ;; + siemens) + need_lib_prefix=no + ;; + motorola) + need_lib_prefix=no + need_version=no + shlibpath_overrides_runpath=no + sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib' + ;; + esac + ;; + +sysv4*MP*) + if test -d /usr/nec ;then + version_type=linux + library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}' + soname_spec='$libname${shared_ext}.$major' + shlibpath_var=LD_LIBRARY_PATH + fi + ;; + +sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) + version_type=freebsd-elf + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + if test "$with_gnu_ld" = yes; then + sys_lib_search_path_spec='/usr/local/lib /usr/gnu/lib /usr/ccs/lib /usr/lib /lib' + else + sys_lib_search_path_spec='/usr/ccs/lib /usr/lib' + case $host_os in + sco3.2v5*) + sys_lib_search_path_spec="$sys_lib_search_path_spec /lib" + ;; + esac + fi + sys_lib_dlsearch_path_spec='/usr/lib' + ;; + +tpf*) + # TPF is a cross-target only. Preferred cross-host = GNU/Linux. + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + ;; + +uts4*) + version_type=linux + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + ;; + +*) + dynamic_linker=no + ;; +esac +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $dynamic_linker" >&5 +$as_echo "$dynamic_linker" >&6; } +test "$dynamic_linker" = no && can_build_shared=no + +variables_saved_for_relink="PATH $shlibpath_var $runpath_var" +if test "$GCC" = yes; then + variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" +fi + +if test "${lt_cv_sys_lib_search_path_spec+set}" = set; then + sys_lib_search_path_spec="$lt_cv_sys_lib_search_path_spec" +fi +if test "${lt_cv_sys_lib_dlsearch_path_spec+set}" = set; then + sys_lib_dlsearch_path_spec="$lt_cv_sys_lib_dlsearch_path_spec" +fi + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to hardcode library paths into programs" >&5 +$as_echo_n "checking how to hardcode library paths into programs... " >&6; } +hardcode_action= +if test -n "$hardcode_libdir_flag_spec" || + test -n "$runpath_var" || + test "X$hardcode_automatic" = "Xyes" ; then + + # We can hardcode non-existent directories. + if test "$hardcode_direct" != no && + # If the only mechanism to avoid hardcoding is shlibpath_var, we + # have to relink, otherwise we might link with an installed library + # when we should be linking with a yet-to-be-installed one + ## test "$_LT_TAGVAR(hardcode_shlibpath_var, )" != no && + test "$hardcode_minus_L" != no; then + # Linking always hardcodes the temporary library directory. + hardcode_action=relink + else + # We can link without hardcoding, and we can hardcode nonexisting dirs. + hardcode_action=immediate + fi +else + # We cannot hardcode anything, or else we can only hardcode existing + # directories. + hardcode_action=unsupported +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $hardcode_action" >&5 +$as_echo "$hardcode_action" >&6; } + +if test "$hardcode_action" = relink || + test "$inherit_rpath" = yes; then + # Fast installation is not supported + enable_fast_install=no +elif test "$shlibpath_overrides_runpath" = yes || + test "$enable_shared" = no; then + # Fast installation is not necessary + enable_fast_install=needless +fi + + + + + + + if test "x$enable_dlopen" != xyes; then + enable_dlopen=unknown + enable_dlopen_self=unknown + enable_dlopen_self_static=unknown +else + lt_cv_dlopen=no + lt_cv_dlopen_libs= + + case $host_os in + beos*) + lt_cv_dlopen="load_add_on" + lt_cv_dlopen_libs= + lt_cv_dlopen_self=yes + ;; + + mingw* | pw32* | cegcc*) + lt_cv_dlopen="LoadLibrary" + lt_cv_dlopen_libs= + ;; + + cygwin*) + lt_cv_dlopen="dlopen" + lt_cv_dlopen_libs= + ;; + + darwin*) + # if libdl is installed we need to link against it + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -ldl" >&5 +$as_echo_n "checking for dlopen in -ldl... " >&6; } +if test "${ac_cv_lib_dl_dlopen+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-ldl $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + +#ifdef __cplusplus +extern "C" +#endif +char dlopen (); +int main (void) +{ +return dlopen (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_lib_dl_dlopen=yes +else + ac_cv_lib_dl_dlopen=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dl_dlopen" >&5 +$as_echo "$ac_cv_lib_dl_dlopen" >&6; } +if test "x$ac_cv_lib_dl_dlopen" = x""yes; then : + lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl" +else + + lt_cv_dlopen="dyld" + lt_cv_dlopen_libs= + lt_cv_dlopen_self=yes + +fi + + ;; + + *) + ac_fn_c_check_func "$LINENO" "shl_load" "ac_cv_func_shl_load" +if test "x$ac_cv_func_shl_load" = x""yes; then : + lt_cv_dlopen="shl_load" +else + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for shl_load in -ldld" >&5 +$as_echo_n "checking for shl_load in -ldld... " >&6; } +if test "${ac_cv_lib_dld_shl_load+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-ldld $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + +#ifdef __cplusplus +extern "C" +#endif +char shl_load (); +int main (void) +{ +return shl_load (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_lib_dld_shl_load=yes +else + ac_cv_lib_dld_shl_load=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dld_shl_load" >&5 +$as_echo "$ac_cv_lib_dld_shl_load" >&6; } +if test "x$ac_cv_lib_dld_shl_load" = x""yes; then : + lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-ldld" +else + ac_fn_c_check_func "$LINENO" "dlopen" "ac_cv_func_dlopen" +if test "x$ac_cv_func_dlopen" = x""yes; then : + lt_cv_dlopen="dlopen" +else + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -ldl" >&5 +$as_echo_n "checking for dlopen in -ldl... " >&6; } +if test "${ac_cv_lib_dl_dlopen+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-ldl $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + +#ifdef __cplusplus +extern "C" +#endif +char dlopen (); +int main (void) +{ +return dlopen (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_lib_dl_dlopen=yes +else + ac_cv_lib_dl_dlopen=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dl_dlopen" >&5 +$as_echo "$ac_cv_lib_dl_dlopen" >&6; } +if test "x$ac_cv_lib_dl_dlopen" = x""yes; then : + lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl" +else + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -lsvld" >&5 +$as_echo_n "checking for dlopen in -lsvld... " >&6; } +if test "${ac_cv_lib_svld_dlopen+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lsvld $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + +#ifdef __cplusplus +extern "C" +#endif +char dlopen (); +int main (void) +{ +return dlopen (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_lib_svld_dlopen=yes +else + ac_cv_lib_svld_dlopen=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_svld_dlopen" >&5 +$as_echo "$ac_cv_lib_svld_dlopen" >&6; } +if test "x$ac_cv_lib_svld_dlopen" = x""yes; then : + lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-lsvld" +else + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dld_link in -ldld" >&5 +$as_echo_n "checking for dld_link in -ldld... " >&6; } +if test "${ac_cv_lib_dld_dld_link+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-ldld $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + +#ifdef __cplusplus +extern "C" +#endif +char dld_link (); +int main (void) +{ +return dld_link (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_lib_dld_dld_link=yes +else + ac_cv_lib_dld_dld_link=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dld_dld_link" >&5 +$as_echo "$ac_cv_lib_dld_dld_link" >&6; } +if test "x$ac_cv_lib_dld_dld_link" = x""yes; then : + lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-ldld" +fi + + +fi + + +fi + + +fi + + +fi + + +fi + + ;; + esac + + if test "x$lt_cv_dlopen" != xno; then + enable_dlopen=yes + else + enable_dlopen=no + fi + + case $lt_cv_dlopen in + dlopen) + save_CPPFLAGS="$CPPFLAGS" + test "x$ac_cv_header_dlfcn_h" = xyes && CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H" + + save_LDFLAGS="$LDFLAGS" + wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\" + + save_LIBS="$LIBS" + LIBS="$lt_cv_dlopen_libs $LIBS" + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether a program can dlopen itself" >&5 +$as_echo_n "checking whether a program can dlopen itself... " >&6; } +if test "${lt_cv_dlopen_self+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + if test "$cross_compiling" = yes; then : + lt_cv_dlopen_self=cross +else + lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 + lt_status=$lt_dlunknown + cat > conftest.$ac_ext <<_LT_EOF +#line 13240 "configure" +#include "confdefs.h" + +#if HAVE_DLFCN_H +#include +#endif + +#include + +#ifdef RTLD_GLOBAL +# define LT_DLGLOBAL RTLD_GLOBAL +#else +# ifdef DL_GLOBAL +# define LT_DLGLOBAL DL_GLOBAL +# else +# define LT_DLGLOBAL 0 +# endif +#endif + +/* We may have to define LT_DLLAZY_OR_NOW in the command line if we + find out it does not work in some platform. */ +#ifndef LT_DLLAZY_OR_NOW +# ifdef RTLD_LAZY +# define LT_DLLAZY_OR_NOW RTLD_LAZY +# else +# ifdef DL_LAZY +# define LT_DLLAZY_OR_NOW DL_LAZY +# else +# ifdef RTLD_NOW +# define LT_DLLAZY_OR_NOW RTLD_NOW +# else +# ifdef DL_NOW +# define LT_DLLAZY_OR_NOW DL_NOW +# else +# define LT_DLLAZY_OR_NOW 0 +# endif +# endif +# endif +# endif +#endif + +void fnord() { int i=42;} +int main () +{ + void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); + int status = $lt_dlunknown; + + if (self) + { + if (dlsym (self,"fnord")) status = $lt_dlno_uscore; + else if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; + /* dlclose (self); */ + } + else + puts (dlerror ()); + + return status; +} +_LT_EOF + if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5 + (eval $ac_link) 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } && test -s conftest${ac_exeext} 2>/dev/null; then + (./conftest; exit; ) >&5 2>/dev/null + lt_status=$? + case x$lt_status in + x$lt_dlno_uscore) lt_cv_dlopen_self=yes ;; + x$lt_dlneed_uscore) lt_cv_dlopen_self=yes ;; + x$lt_dlunknown|x*) lt_cv_dlopen_self=no ;; + esac + else : + # compilation failed + lt_cv_dlopen_self=no + fi +fi +rm -fr conftest* + + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_dlopen_self" >&5 +$as_echo "$lt_cv_dlopen_self" >&6; } + + if test "x$lt_cv_dlopen_self" = xyes; then + wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $lt_prog_compiler_static\" + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether a statically linked program can dlopen itself" >&5 +$as_echo_n "checking whether a statically linked program can dlopen itself... " >&6; } +if test "${lt_cv_dlopen_self_static+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + if test "$cross_compiling" = yes; then : + lt_cv_dlopen_self_static=cross +else + lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 + lt_status=$lt_dlunknown + cat > conftest.$ac_ext <<_LT_EOF +#line 13336 "configure" +#include "confdefs.h" + +#if HAVE_DLFCN_H +#include +#endif + +#include + +#ifdef RTLD_GLOBAL +# define LT_DLGLOBAL RTLD_GLOBAL +#else +# ifdef DL_GLOBAL +# define LT_DLGLOBAL DL_GLOBAL +# else +# define LT_DLGLOBAL 0 +# endif +#endif + +/* We may have to define LT_DLLAZY_OR_NOW in the command line if we + find out it does not work in some platform. */ +#ifndef LT_DLLAZY_OR_NOW +# ifdef RTLD_LAZY +# define LT_DLLAZY_OR_NOW RTLD_LAZY +# else +# ifdef DL_LAZY +# define LT_DLLAZY_OR_NOW DL_LAZY +# else +# ifdef RTLD_NOW +# define LT_DLLAZY_OR_NOW RTLD_NOW +# else +# ifdef DL_NOW +# define LT_DLLAZY_OR_NOW DL_NOW +# else +# define LT_DLLAZY_OR_NOW 0 +# endif +# endif +# endif +# endif +#endif + +void fnord() { int i=42;} +int main () +{ + void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); + int status = $lt_dlunknown; + + if (self) + { + if (dlsym (self,"fnord")) status = $lt_dlno_uscore; + else if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; + /* dlclose (self); */ + } + else + puts (dlerror ()); + + return status; +} +_LT_EOF + if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5 + (eval $ac_link) 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } && test -s conftest${ac_exeext} 2>/dev/null; then + (./conftest; exit; ) >&5 2>/dev/null + lt_status=$? + case x$lt_status in + x$lt_dlno_uscore) lt_cv_dlopen_self_static=yes ;; + x$lt_dlneed_uscore) lt_cv_dlopen_self_static=yes ;; + x$lt_dlunknown|x*) lt_cv_dlopen_self_static=no ;; + esac + else : + # compilation failed + lt_cv_dlopen_self_static=no + fi +fi +rm -fr conftest* + + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_dlopen_self_static" >&5 +$as_echo "$lt_cv_dlopen_self_static" >&6; } + fi + + CPPFLAGS="$save_CPPFLAGS" + LDFLAGS="$save_LDFLAGS" + LIBS="$save_LIBS" + ;; + esac + + case $lt_cv_dlopen_self in + yes|no) enable_dlopen_self=$lt_cv_dlopen_self ;; + *) enable_dlopen_self=unknown ;; + esac + + case $lt_cv_dlopen_self_static in + yes|no) enable_dlopen_self_static=$lt_cv_dlopen_self_static ;; + *) enable_dlopen_self_static=unknown ;; + esac +fi + + + + + + + + + + + + + + + + + +striplib= +old_striplib= +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether stripping libraries is possible" >&5 +$as_echo_n "checking whether stripping libraries is possible... " >&6; } +if test -n "$STRIP" && $STRIP -V 2>&1 | $GREP "GNU strip" >/dev/null; then + test -z "$old_striplib" && old_striplib="$STRIP --strip-debug" + test -z "$striplib" && striplib="$STRIP --strip-unneeded" + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } +else +# FIXME - insert some real tests, host_os isn't really good enough + case $host_os in + darwin*) + if test -n "$STRIP" ; then + striplib="$STRIP -x" + old_striplib="$STRIP -S" + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + fi + ;; + *) + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + ;; + esac +fi + + + + + + + + + + + + + # Report which library types will actually be built + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if libtool supports shared libraries" >&5 +$as_echo_n "checking if libtool supports shared libraries... " >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $can_build_shared" >&5 +$as_echo "$can_build_shared" >&6; } + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to build shared libraries" >&5 +$as_echo_n "checking whether to build shared libraries... " >&6; } + test "$can_build_shared" = "no" && enable_shared=no + + # On AIX, shared libraries and static libraries use the same namespace, and + # are all built from PIC. + case $host_os in + aix3*) + test "$enable_shared" = yes && enable_static=no + if test -n "$RANLIB"; then + archive_cmds="$archive_cmds~\$RANLIB \$lib" + postinstall_cmds='$RANLIB $lib' + fi + ;; + + aix[4-9]*) + if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then + test "$enable_shared" = yes && enable_static=no + fi + ;; + esac + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_shared" >&5 +$as_echo "$enable_shared" >&6; } + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to build static libraries" >&5 +$as_echo_n "checking whether to build static libraries... " >&6; } + # Make sure either enable_shared or enable_static is yes. + test "$enable_shared" = yes || enable_static=yes + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_static" >&5 +$as_echo "$enable_static" >&6; } + + + + +fi +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + +CC="$lt_save_CC" + + + + + + + + + + + + + + ac_config_commands="$ac_config_commands libtool" + + + + +# Only expand once: + + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if we need -mimpure-text" >&5 +$as_echo_n "checking if we need -mimpure-text... " >&6; } +mimpure=no +case $host in + *-*-solaris2*) + if test "$GCC" = "yes"; then + mimpure="yes" + fi + ;; + *) + ;; +esac +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $mimpure" >&5 +$as_echo "$mimpure" >&6; } + + +if test x$mimpure = xyes; then + MIMPURE_TRUE= + MIMPURE_FALSE='#' +else + MIMPURE_TRUE='#' + MIMPURE_FALSE= +fi + + + + +if false; then + STATICLIB_TRUE= + STATICLIB_FALSE='#' +else + STATICLIB_TRUE='#' + STATICLIB_FALSE= +fi + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if we need BUILDING_LIBCURL" >&5 +$as_echo_n "checking if we need BUILDING_LIBCURL... " >&6; } +case $host in + *-*-mingw*) + +$as_echo "#define BUILDING_LIBCURL 1" >>confdefs.h + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if we need CURL_STATICLIB" >&5 +$as_echo_n "checking if we need CURL_STATICLIB... " >&6; } + if test "X$enable_shared" = "Xno" + then + +$as_echo "#define CURL_STATICLIB 1" >>confdefs.h + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + + +if true; then + STATICLIB_TRUE= + STATICLIB_FALSE='#' +else + STATICLIB_TRUE='#' + STATICLIB_FALSE= +fi + + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + fi + ;; + *) + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + ;; +esac + +# Determine whether all dependent libraries must be specified when linking +if test "X$enable_shared" = "Xyes" -a "X$link_all_deplibs" = "Xno" +then + REQUIRE_LIB_DEPS=no +else + REQUIRE_LIB_DEPS=yes +fi + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${MAKE-make} sets \$(MAKE)" >&5 +$as_echo_n "checking whether ${MAKE-make} sets \$(MAKE)... " >&6; } +set x ${MAKE-make} +ac_make=`$as_echo "$2" | sed 's/+/p/g; s/[^a-zA-Z0-9_]/_/g'` +if eval "test \"\${ac_cv_prog_make_${ac_make}_set+set}\"" = set; then : + $as_echo_n "(cached) " >&6 +else + cat >conftest.make <<\_ACEOF +SHELL = /bin/sh +all: + @echo '@@@%%%=$(MAKE)=@@@%%%' +_ACEOF +# GNU make sometimes prints "make[1]: Entering ...", which would confuse us. +case `${MAKE-make} -f conftest.make 2>/dev/null` in + *@@@%%%=?*=@@@%%%*) + eval ac_cv_prog_make_${ac_make}_set=yes;; + *) + eval ac_cv_prog_make_${ac_make}_set=no;; +esac +rm -f conftest.make +fi +if eval test \$ac_cv_prog_make_${ac_make}_set = yes; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + SET_MAKE= +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + SET_MAKE="MAKE=${MAKE-make}" +fi + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for inline" >&5 +$as_echo_n "checking for inline... " >&6; } +if test "${ac_cv_c_inline+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + ac_cv_c_inline=no +for ac_kw in inline __inline__ __inline; do + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#ifndef __cplusplus +typedef int foo_t; +static $ac_kw foo_t static_foo () {return 0; } +$ac_kw foo_t foo () {return 0; } +#endif + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_c_inline=$ac_kw +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + test "$ac_cv_c_inline" != no && break +done + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_inline" >&5 +$as_echo "$ac_cv_c_inline" >&6; } + +case $ac_cv_c_inline in + inline | yes) ;; + *) + case $ac_cv_c_inline in + no) ac_val=;; + *) ac_val=$ac_cv_c_inline;; + esac + cat >>confdefs.h <<_ACEOF +#ifndef __cplusplus +#define inline $ac_val +#endif +_ACEOF + ;; +esac + + + + + # + compiler_id="unknown" + compiler_num="0" + # + flags_dbg_all="unknown" + flags_dbg_yes="unknown" + flags_dbg_off="unknown" + flags_opt_all="unknown" + flags_opt_yes="unknown" + flags_opt_off="unknown" + # + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if compiler is DEC/Compaq/HP C" >&5 +$as_echo_n "checking if compiler is DEC/Compaq/HP C... " >&6; } + + if test -z "$SED"; then + as_fn_error $? "SED not set. Cannot continue without SED being set." "$LINENO" 5 + fi + if test -z "$GREP"; then + as_fn_error $? "GREP not set. Cannot continue without GREP being set." "$LINENO" 5 + fi + + tmp_exp="" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + +#ifdef __DECC +CURL_DEF_TOKEN __DECC +#endif + + +_ACEOF +if ac_fn_c_try_cpp "$LINENO"; then : + + tmp_exp=`eval "$ac_cpp conftest.$ac_ext" 2>/dev/null | \ + "$GREP" CURL_DEF_TOKEN 2>/dev/null | \ + "$SED" 's/.*CURL_DEF_TOKEN[ ]//' 2>/dev/null | \ + "$SED" 's/["][ ]*["]//g' 2>/dev/null` + if test -z "$tmp_exp" || test "$tmp_exp" = "__DECC"; then + tmp_exp="" + fi + +fi +rm -f conftest.err conftest.i conftest.$ac_ext + if test -z "$tmp_exp"; then + curl_cv_have_def___DECC=no + + else + curl_cv_have_def___DECC=yes + curl_cv_def___DECC=$tmp_exp + + fi + + + if test -z "$SED"; then + as_fn_error $? "SED not set. Cannot continue without SED being set." "$LINENO" 5 + fi + if test -z "$GREP"; then + as_fn_error $? "GREP not set. Cannot continue without GREP being set." "$LINENO" 5 + fi + + tmp_exp="" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + +#ifdef __DECC_VER +CURL_DEF_TOKEN __DECC_VER +#endif + + +_ACEOF +if ac_fn_c_try_cpp "$LINENO"; then : + + tmp_exp=`eval "$ac_cpp conftest.$ac_ext" 2>/dev/null | \ + "$GREP" CURL_DEF_TOKEN 2>/dev/null | \ + "$SED" 's/.*CURL_DEF_TOKEN[ ]//' 2>/dev/null | \ + "$SED" 's/["][ ]*["]//g' 2>/dev/null` + if test -z "$tmp_exp" || test "$tmp_exp" = "__DECC_VER"; then + tmp_exp="" + fi + +fi +rm -f conftest.err conftest.i conftest.$ac_ext + if test -z "$tmp_exp"; then + curl_cv_have_def___DECC_VER=no + + else + curl_cv_have_def___DECC_VER=yes + curl_cv_def___DECC_VER=$tmp_exp + + fi + + if test "$curl_cv_have_def___DECC" = "yes" && + test "$curl_cv_have_def___DECC_VER" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + compiler_id="DEC_C" + flags_dbg_all="-g -g0 -g1 -g2 -g3" + flags_dbg_yes="-g2" + flags_dbg_off="-g0" + flags_opt_all="-O -O0 -O1 -O2 -O3 -O4" + flags_opt_yes="-O1" + flags_opt_off="-O0" + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + fi + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if compiler is HP-UX C" >&5 +$as_echo_n "checking if compiler is HP-UX C... " >&6; } + + if test -z "$SED"; then + as_fn_error $? "SED not set. Cannot continue without SED being set." "$LINENO" 5 + fi + if test -z "$GREP"; then + as_fn_error $? "GREP not set. Cannot continue without GREP being set." "$LINENO" 5 + fi + + tmp_exp="" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + +#ifdef __HP_cc +CURL_DEF_TOKEN __HP_cc +#endif + + +_ACEOF +if ac_fn_c_try_cpp "$LINENO"; then : + + tmp_exp=`eval "$ac_cpp conftest.$ac_ext" 2>/dev/null | \ + "$GREP" CURL_DEF_TOKEN 2>/dev/null | \ + "$SED" 's/.*CURL_DEF_TOKEN[ ]//' 2>/dev/null | \ + "$SED" 's/["][ ]*["]//g' 2>/dev/null` + if test -z "$tmp_exp" || test "$tmp_exp" = "__HP_cc"; then + tmp_exp="" + fi + +fi +rm -f conftest.err conftest.i conftest.$ac_ext + if test -z "$tmp_exp"; then + curl_cv_have_def___HP_cc=no + + else + curl_cv_have_def___HP_cc=yes + curl_cv_def___HP_cc=$tmp_exp + + fi + + if test "$curl_cv_have_def___HP_cc" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + compiler_id="HP_UX_C" + flags_dbg_all="-g -s" + flags_dbg_yes="-g" + flags_dbg_off="-s" + flags_opt_all="-O +O0 +O1 +O2 +O3 +O4" + flags_opt_yes="+O2" + flags_opt_off="+O0" + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + fi + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if compiler is IBM C" >&5 +$as_echo_n "checking if compiler is IBM C... " >&6; } + + if test -z "$SED"; then + as_fn_error $? "SED not set. Cannot continue without SED being set." "$LINENO" 5 + fi + if test -z "$GREP"; then + as_fn_error $? "GREP not set. Cannot continue without GREP being set." "$LINENO" 5 + fi + + tmp_exp="" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + +#ifdef __IBMC__ +CURL_DEF_TOKEN __IBMC__ +#endif + + +_ACEOF +if ac_fn_c_try_cpp "$LINENO"; then : + + tmp_exp=`eval "$ac_cpp conftest.$ac_ext" 2>/dev/null | \ + "$GREP" CURL_DEF_TOKEN 2>/dev/null | \ + "$SED" 's/.*CURL_DEF_TOKEN[ ]//' 2>/dev/null | \ + "$SED" 's/["][ ]*["]//g' 2>/dev/null` + if test -z "$tmp_exp" || test "$tmp_exp" = "__IBMC__"; then + tmp_exp="" + fi + +fi +rm -f conftest.err conftest.i conftest.$ac_ext + if test -z "$tmp_exp"; then + curl_cv_have_def___IBMC__=no + + else + curl_cv_have_def___IBMC__=yes + curl_cv_def___IBMC__=$tmp_exp + + fi + + if test "$curl_cv_have_def___IBMC__" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + compiler_id="IBM_C" + flags_dbg_all="-g -g0 -g1 -g2 -g3" + flags_dbg_yes="-g" + flags_dbg_off="" + flags_opt_all="-O -O0 -O1 -O2 -O3 -O4 -O5" + flags_opt_all="$flags_opt_all -qnooptimize" + flags_opt_all="$flags_opt_all -qoptimize=0" + flags_opt_all="$flags_opt_all -qoptimize=1" + flags_opt_all="$flags_opt_all -qoptimize=2" + flags_opt_all="$flags_opt_all -qoptimize=3" + flags_opt_all="$flags_opt_all -qoptimize=4" + flags_opt_all="$flags_opt_all -qoptimize=5" + flags_opt_yes="-O2" + flags_opt_off="-qnooptimize" + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + fi + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if compiler is Intel C" >&5 +$as_echo_n "checking if compiler is Intel C... " >&6; } + + if test -z "$SED"; then + as_fn_error $? "SED not set. Cannot continue without SED being set." "$LINENO" 5 + fi + if test -z "$GREP"; then + as_fn_error $? "GREP not set. Cannot continue without GREP being set." "$LINENO" 5 + fi + + tmp_exp="" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + +#ifdef __INTEL_COMPILER +CURL_DEF_TOKEN __INTEL_COMPILER +#endif + + +_ACEOF +if ac_fn_c_try_cpp "$LINENO"; then : + + tmp_exp=`eval "$ac_cpp conftest.$ac_ext" 2>/dev/null | \ + "$GREP" CURL_DEF_TOKEN 2>/dev/null | \ + "$SED" 's/.*CURL_DEF_TOKEN[ ]//' 2>/dev/null | \ + "$SED" 's/["][ ]*["]//g' 2>/dev/null` + if test -z "$tmp_exp" || test "$tmp_exp" = "__INTEL_COMPILER"; then + tmp_exp="" + fi + +fi +rm -f conftest.err conftest.i conftest.$ac_ext + if test -z "$tmp_exp"; then + curl_cv_have_def___INTEL_COMPILER=no + + else + curl_cv_have_def___INTEL_COMPILER=yes + curl_cv_def___INTEL_COMPILER=$tmp_exp + + fi + + if test "$curl_cv_have_def___INTEL_COMPILER" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + compiler_num="$curl_cv_def___INTEL_COMPILER" + + if test -z "$SED"; then + as_fn_error $? "SED not set. Cannot continue without SED being set." "$LINENO" 5 + fi + if test -z "$GREP"; then + as_fn_error $? "GREP not set. Cannot continue without GREP being set." "$LINENO" 5 + fi + + tmp_exp="" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + +#ifdef __unix__ +CURL_DEF_TOKEN __unix__ +#endif + + +_ACEOF +if ac_fn_c_try_cpp "$LINENO"; then : + + tmp_exp=`eval "$ac_cpp conftest.$ac_ext" 2>/dev/null | \ + "$GREP" CURL_DEF_TOKEN 2>/dev/null | \ + "$SED" 's/.*CURL_DEF_TOKEN[ ]//' 2>/dev/null | \ + "$SED" 's/["][ ]*["]//g' 2>/dev/null` + if test -z "$tmp_exp" || test "$tmp_exp" = ""; then + tmp_exp="" + fi + +fi +rm -f conftest.err conftest.i conftest.$ac_ext + if test -z "$tmp_exp"; then + curl_cv_have_def___unix__=no + + else + curl_cv_have_def___unix__=yes + curl_cv_def___unix__=$tmp_exp + + fi + + if test "$curl_cv_have_def___unix__" = "yes"; then + compiler_id="INTEL_UNIX_C" + flags_dbg_all="-g -g0" + flags_dbg_yes="-g" + flags_dbg_off="-g0" + flags_opt_all="-O -O0 -O1 -O2 -O3 -Os" + flags_opt_yes="-O2" + flags_opt_off="-O0" + else + compiler_id="INTEL_WINDOWS_C" + flags_dbg_all="/ZI /Zi /zI /zi /ZD /Zd /zD /zd /Z7 /z7 /Oy /Oy-" + flags_dbg_all="$flags_dbg_all /debug" + flags_dbg_all="$flags_dbg_all /debug:none" + flags_dbg_all="$flags_dbg_all /debug:minimal" + flags_dbg_all="$flags_dbg_all /debug:partial" + flags_dbg_all="$flags_dbg_all /debug:full" + flags_dbg_all="$flags_dbg_all /debug:semantic_stepping" + flags_dbg_all="$flags_dbg_all /debug:extended" + flags_dbg_yes="/Zi /Oy-" + flags_dbg_off="/debug:none /Oy-" + flags_opt_all="/O /O0 /O1 /O2 /O3 /Od /Og /Og- /Oi /Oi-" + flags_opt_yes="/O2" + flags_opt_off="/Od" + fi + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + fi + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if compiler is clang" >&5 +$as_echo_n "checking if compiler is clang... " >&6; } + + if test -z "$SED"; then + as_fn_error $? "SED not set. Cannot continue without SED being set." "$LINENO" 5 + fi + if test -z "$GREP"; then + as_fn_error $? "GREP not set. Cannot continue without GREP being set." "$LINENO" 5 + fi + + tmp_exp="" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + +#ifdef __clang__ +CURL_DEF_TOKEN __clang__ +#endif + + +_ACEOF +if ac_fn_c_try_cpp "$LINENO"; then : + + tmp_exp=`eval "$ac_cpp conftest.$ac_ext" 2>/dev/null | \ + "$GREP" CURL_DEF_TOKEN 2>/dev/null | \ + "$SED" 's/.*CURL_DEF_TOKEN[ ]//' 2>/dev/null | \ + "$SED" 's/["][ ]*["]//g' 2>/dev/null` + if test -z "$tmp_exp" || test "$tmp_exp" = "__clang__"; then + tmp_exp="" + fi + +fi +rm -f conftest.err conftest.i conftest.$ac_ext + if test -z "$tmp_exp"; then + curl_cv_have_def___clang__=no + + else + curl_cv_have_def___clang__=yes + curl_cv_def___clang__=$tmp_exp + + fi + + if test "$curl_cv_have_def___clang__" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + compiler_id="CLANG" + clangver=`$CC -dumpversion` + clangvhi=`echo $clangver | cut -d . -f1` + clangvlo=`echo $clangver | cut -d . -f2` + compiler_num=`(expr $clangvhi "*" 100 + $clangvlo) 2>/dev/null` + flags_dbg_all="-g -g0 -g1 -g2 -g3" + flags_dbg_all="$flags_dbg_all -ggdb" + flags_dbg_all="$flags_dbg_all -gstabs" + flags_dbg_all="$flags_dbg_all -gstabs+" + flags_dbg_all="$flags_dbg_all -gcoff" + flags_dbg_all="$flags_dbg_all -gxcoff" + flags_dbg_all="$flags_dbg_all -gdwarf-2" + flags_dbg_all="$flags_dbg_all -gvms" + flags_dbg_yes="-g" + flags_dbg_off="-g0" + flags_opt_all="-O -O0 -O1 -O2 -Os -O3 -O4" + flags_opt_yes="-Os" + flags_opt_off="-O0" + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + fi + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if compiler is GNU C" >&5 +$as_echo_n "checking if compiler is GNU C... " >&6; } + + if test -z "$SED"; then + as_fn_error $? "SED not set. Cannot continue without SED being set." "$LINENO" 5 + fi + if test -z "$GREP"; then + as_fn_error $? "GREP not set. Cannot continue without GREP being set." "$LINENO" 5 + fi + + tmp_exp="" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + +#ifdef __GNUC__ +CURL_DEF_TOKEN __GNUC__ +#endif + + +_ACEOF +if ac_fn_c_try_cpp "$LINENO"; then : + + tmp_exp=`eval "$ac_cpp conftest.$ac_ext" 2>/dev/null | \ + "$GREP" CURL_DEF_TOKEN 2>/dev/null | \ + "$SED" 's/.*CURL_DEF_TOKEN[ ]//' 2>/dev/null | \ + "$SED" 's/["][ ]*["]//g' 2>/dev/null` + if test -z "$tmp_exp" || test "$tmp_exp" = "__GNUC__"; then + tmp_exp="" + fi + +fi +rm -f conftest.err conftest.i conftest.$ac_ext + if test -z "$tmp_exp"; then + curl_cv_have_def___GNUC__=no + + else + curl_cv_have_def___GNUC__=yes + curl_cv_def___GNUC__=$tmp_exp + + fi + + if test "$curl_cv_have_def___GNUC__" = "yes" && + test "$compiler_id" = "unknown"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + compiler_id="GNU_C" + gccver=`$CC -dumpversion` + gccvhi=`echo $gccver | cut -d . -f1` + gccvlo=`echo $gccver | cut -d . -f2` + compiler_num=`(expr $gccvhi "*" 100 + $gccvlo) 2>/dev/null` + flags_dbg_all="-g -g0 -g1 -g2 -g3" + flags_dbg_all="$flags_dbg_all -ggdb" + flags_dbg_all="$flags_dbg_all -gstabs" + flags_dbg_all="$flags_dbg_all -gstabs+" + flags_dbg_all="$flags_dbg_all -gcoff" + flags_dbg_all="$flags_dbg_all -gxcoff" + flags_dbg_all="$flags_dbg_all -gdwarf-2" + flags_dbg_all="$flags_dbg_all -gvms" + flags_dbg_yes="-g" + flags_dbg_off="-g0" + flags_opt_all="-O -O0 -O1 -O2 -O3 -Os" + flags_opt_yes="-O2" + flags_opt_off="-O0" + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + fi + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if compiler is LCC" >&5 +$as_echo_n "checking if compiler is LCC... " >&6; } + + if test -z "$SED"; then + as_fn_error $? "SED not set. Cannot continue without SED being set." "$LINENO" 5 + fi + if test -z "$GREP"; then + as_fn_error $? "GREP not set. Cannot continue without GREP being set." "$LINENO" 5 + fi + + tmp_exp="" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + +#ifdef __LCC__ +CURL_DEF_TOKEN __LCC__ +#endif + + +_ACEOF +if ac_fn_c_try_cpp "$LINENO"; then : + + tmp_exp=`eval "$ac_cpp conftest.$ac_ext" 2>/dev/null | \ + "$GREP" CURL_DEF_TOKEN 2>/dev/null | \ + "$SED" 's/.*CURL_DEF_TOKEN[ ]//' 2>/dev/null | \ + "$SED" 's/["][ ]*["]//g' 2>/dev/null` + if test -z "$tmp_exp" || test "$tmp_exp" = "__LCC__"; then + tmp_exp="" + fi + +fi +rm -f conftest.err conftest.i conftest.$ac_ext + if test -z "$tmp_exp"; then + curl_cv_have_def___LCC__=no + + else + curl_cv_have_def___LCC__=yes + curl_cv_def___LCC__=$tmp_exp + + fi + + if test "$curl_cv_have_def___LCC__" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + compiler_id="LCC" + flags_dbg_all="-g" + flags_dbg_yes="-g" + flags_dbg_off="" + flags_opt_all="" + flags_opt_yes="" + flags_opt_off="" + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + fi + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if compiler is SGI MIPSpro C" >&5 +$as_echo_n "checking if compiler is SGI MIPSpro C... " >&6; } + + if test -z "$SED"; then + as_fn_error $? "SED not set. Cannot continue without SED being set." "$LINENO" 5 + fi + if test -z "$GREP"; then + as_fn_error $? "GREP not set. Cannot continue without GREP being set." "$LINENO" 5 + fi + + tmp_exp="" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + +#ifdef __GNUC__ +CURL_DEF_TOKEN __GNUC__ +#endif + + +_ACEOF +if ac_fn_c_try_cpp "$LINENO"; then : + + tmp_exp=`eval "$ac_cpp conftest.$ac_ext" 2>/dev/null | \ + "$GREP" CURL_DEF_TOKEN 2>/dev/null | \ + "$SED" 's/.*CURL_DEF_TOKEN[ ]//' 2>/dev/null | \ + "$SED" 's/["][ ]*["]//g' 2>/dev/null` + if test -z "$tmp_exp" || test "$tmp_exp" = "__GNUC__"; then + tmp_exp="" + fi + +fi +rm -f conftest.err conftest.i conftest.$ac_ext + if test -z "$tmp_exp"; then + curl_cv_have_def___GNUC__=no + + else + curl_cv_have_def___GNUC__=yes + curl_cv_def___GNUC__=$tmp_exp + + fi + + + if test -z "$SED"; then + as_fn_error $? "SED not set. Cannot continue without SED being set." "$LINENO" 5 + fi + if test -z "$GREP"; then + as_fn_error $? "GREP not set. Cannot continue without GREP being set." "$LINENO" 5 + fi + + tmp_exp="" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + +#ifdef _COMPILER_VERSION +CURL_DEF_TOKEN _COMPILER_VERSION +#endif + + +_ACEOF +if ac_fn_c_try_cpp "$LINENO"; then : + + tmp_exp=`eval "$ac_cpp conftest.$ac_ext" 2>/dev/null | \ + "$GREP" CURL_DEF_TOKEN 2>/dev/null | \ + "$SED" 's/.*CURL_DEF_TOKEN[ ]//' 2>/dev/null | \ + "$SED" 's/["][ ]*["]//g' 2>/dev/null` + if test -z "$tmp_exp" || test "$tmp_exp" = "_COMPILER_VERSION"; then + tmp_exp="" + fi + +fi +rm -f conftest.err conftest.i conftest.$ac_ext + if test -z "$tmp_exp"; then + curl_cv_have_def__COMPILER_VERSION=no + + else + curl_cv_have_def__COMPILER_VERSION=yes + curl_cv_def__COMPILER_VERSION=$tmp_exp + + fi + + + if test -z "$SED"; then + as_fn_error $? "SED not set. Cannot continue without SED being set." "$LINENO" 5 + fi + if test -z "$GREP"; then + as_fn_error $? "GREP not set. Cannot continue without GREP being set." "$LINENO" 5 + fi + + tmp_exp="" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + +#ifdef _SGI_COMPILER_VERSION +CURL_DEF_TOKEN _SGI_COMPILER_VERSION +#endif + + +_ACEOF +if ac_fn_c_try_cpp "$LINENO"; then : + + tmp_exp=`eval "$ac_cpp conftest.$ac_ext" 2>/dev/null | \ + "$GREP" CURL_DEF_TOKEN 2>/dev/null | \ + "$SED" 's/.*CURL_DEF_TOKEN[ ]//' 2>/dev/null | \ + "$SED" 's/["][ ]*["]//g' 2>/dev/null` + if test -z "$tmp_exp" || test "$tmp_exp" = "_SGI_COMPILER_VERSION"; then + tmp_exp="" + fi + +fi +rm -f conftest.err conftest.i conftest.$ac_ext + if test -z "$tmp_exp"; then + curl_cv_have_def__SGI_COMPILER_VERSION=no + + else + curl_cv_have_def__SGI_COMPILER_VERSION=yes + curl_cv_def__SGI_COMPILER_VERSION=$tmp_exp + + fi + + if test "$curl_cv_have_def___GNUC__" = "no" && + (test "$curl_cv_have_def__SGI_COMPILER_VERSION" = "yes" || + test "$curl_cv_have_def__COMPILER_VERSION" = "yes"); then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + compiler_id="SGI_MIPSPRO_C" + flags_dbg_all="-g -g0 -g1 -g2 -g3" + flags_dbg_yes="-g" + flags_dbg_off="-g0" + flags_opt_all="-O -O0 -O1 -O2 -O3 -Ofast" + flags_opt_yes="-O2" + flags_opt_off="-O0" + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + fi + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if compiler is SGI MIPS C" >&5 +$as_echo_n "checking if compiler is SGI MIPS C... " >&6; } + + if test -z "$SED"; then + as_fn_error $? "SED not set. Cannot continue without SED being set." "$LINENO" 5 + fi + if test -z "$GREP"; then + as_fn_error $? "GREP not set. Cannot continue without GREP being set." "$LINENO" 5 + fi + + tmp_exp="" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + +#ifdef __GNUC__ +CURL_DEF_TOKEN __GNUC__ +#endif + + +_ACEOF +if ac_fn_c_try_cpp "$LINENO"; then : + + tmp_exp=`eval "$ac_cpp conftest.$ac_ext" 2>/dev/null | \ + "$GREP" CURL_DEF_TOKEN 2>/dev/null | \ + "$SED" 's/.*CURL_DEF_TOKEN[ ]//' 2>/dev/null | \ + "$SED" 's/["][ ]*["]//g' 2>/dev/null` + if test -z "$tmp_exp" || test "$tmp_exp" = "__GNUC__"; then + tmp_exp="" + fi + +fi +rm -f conftest.err conftest.i conftest.$ac_ext + if test -z "$tmp_exp"; then + curl_cv_have_def___GNUC__=no + + else + curl_cv_have_def___GNUC__=yes + curl_cv_def___GNUC__=$tmp_exp + + fi + + + if test -z "$SED"; then + as_fn_error $? "SED not set. Cannot continue without SED being set." "$LINENO" 5 + fi + if test -z "$GREP"; then + as_fn_error $? "GREP not set. Cannot continue without GREP being set." "$LINENO" 5 + fi + + tmp_exp="" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + +#ifdef __sgi +CURL_DEF_TOKEN __sgi +#endif + + +_ACEOF +if ac_fn_c_try_cpp "$LINENO"; then : + + tmp_exp=`eval "$ac_cpp conftest.$ac_ext" 2>/dev/null | \ + "$GREP" CURL_DEF_TOKEN 2>/dev/null | \ + "$SED" 's/.*CURL_DEF_TOKEN[ ]//' 2>/dev/null | \ + "$SED" 's/["][ ]*["]//g' 2>/dev/null` + if test -z "$tmp_exp" || test "$tmp_exp" = "__sgi"; then + tmp_exp="" + fi + +fi +rm -f conftest.err conftest.i conftest.$ac_ext + if test -z "$tmp_exp"; then + curl_cv_have_def___sgi=no + + else + curl_cv_have_def___sgi=yes + curl_cv_def___sgi=$tmp_exp + + fi + + if test "$curl_cv_have_def___GNUC__" = "no" && + test "$curl_cv_have_def___sgi" = "yes" && + test "$compiler_id" = "unknown"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + compiler_id="SGI_MIPS_C" + flags_dbg_all="-g -g0 -g1 -g2 -g3" + flags_dbg_yes="-g" + flags_dbg_off="-g0" + flags_opt_all="-O -O0 -O1 -O2 -O3 -Ofast" + flags_opt_yes="-O2" + flags_opt_off="-O0" + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + fi + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if compiler is SunPro C" >&5 +$as_echo_n "checking if compiler is SunPro C... " >&6; } + + if test -z "$SED"; then + as_fn_error $? "SED not set. Cannot continue without SED being set." "$LINENO" 5 + fi + if test -z "$GREP"; then + as_fn_error $? "GREP not set. Cannot continue without GREP being set." "$LINENO" 5 + fi + + tmp_exp="" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + +#ifdef __SUNPRO_C +CURL_DEF_TOKEN __SUNPRO_C +#endif + + +_ACEOF +if ac_fn_c_try_cpp "$LINENO"; then : + + tmp_exp=`eval "$ac_cpp conftest.$ac_ext" 2>/dev/null | \ + "$GREP" CURL_DEF_TOKEN 2>/dev/null | \ + "$SED" 's/.*CURL_DEF_TOKEN[ ]//' 2>/dev/null | \ + "$SED" 's/["][ ]*["]//g' 2>/dev/null` + if test -z "$tmp_exp" || test "$tmp_exp" = "__SUNPRO_C"; then + tmp_exp="" + fi + +fi +rm -f conftest.err conftest.i conftest.$ac_ext + if test -z "$tmp_exp"; then + curl_cv_have_def___SUNPRO_C=no + + else + curl_cv_have_def___SUNPRO_C=yes + curl_cv_def___SUNPRO_C=$tmp_exp + + fi + + if test "$curl_cv_have_def___SUNPRO_C" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + compiler_id="SUNPRO_C" + flags_dbg_all="-g -s" + flags_dbg_yes="-g" + flags_dbg_off="-s" + flags_opt_all="-O -xO -xO1 -xO2 -xO3 -xO4 -xO5" + flags_opt_yes="-xO2" + flags_opt_off="" + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + fi + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if compiler is Tiny C" >&5 +$as_echo_n "checking if compiler is Tiny C... " >&6; } + + if test -z "$SED"; then + as_fn_error $? "SED not set. Cannot continue without SED being set." "$LINENO" 5 + fi + if test -z "$GREP"; then + as_fn_error $? "GREP not set. Cannot continue without GREP being set." "$LINENO" 5 + fi + + tmp_exp="" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + +#ifdef __TINYC__ +CURL_DEF_TOKEN __TINYC__ +#endif + + +_ACEOF +if ac_fn_c_try_cpp "$LINENO"; then : + + tmp_exp=`eval "$ac_cpp conftest.$ac_ext" 2>/dev/null | \ + "$GREP" CURL_DEF_TOKEN 2>/dev/null | \ + "$SED" 's/.*CURL_DEF_TOKEN[ ]//' 2>/dev/null | \ + "$SED" 's/["][ ]*["]//g' 2>/dev/null` + if test -z "$tmp_exp" || test "$tmp_exp" = "__TINYC__"; then + tmp_exp="" + fi + +fi +rm -f conftest.err conftest.i conftest.$ac_ext + if test -z "$tmp_exp"; then + curl_cv_have_def___TINYC__=no + + else + curl_cv_have_def___TINYC__=yes + curl_cv_def___TINYC__=$tmp_exp + + fi + + if test "$curl_cv_have_def___TINYC__" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + compiler_id="TINY_C" + flags_dbg_all="-g -b" + flags_dbg_yes="-g" + flags_dbg_off="" + flags_opt_all="" + flags_opt_yes="" + flags_opt_off="" + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + fi + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if compiler is Watcom C" >&5 +$as_echo_n "checking if compiler is Watcom C... " >&6; } + + if test -z "$SED"; then + as_fn_error $? "SED not set. Cannot continue without SED being set." "$LINENO" 5 + fi + if test -z "$GREP"; then + as_fn_error $? "GREP not set. Cannot continue without GREP being set." "$LINENO" 5 + fi + + tmp_exp="" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + +#ifdef __WATCOMC__ +CURL_DEF_TOKEN __WATCOMC__ +#endif + + +_ACEOF +if ac_fn_c_try_cpp "$LINENO"; then : + + tmp_exp=`eval "$ac_cpp conftest.$ac_ext" 2>/dev/null | \ + "$GREP" CURL_DEF_TOKEN 2>/dev/null | \ + "$SED" 's/.*CURL_DEF_TOKEN[ ]//' 2>/dev/null | \ + "$SED" 's/["][ ]*["]//g' 2>/dev/null` + if test -z "$tmp_exp" || test "$tmp_exp" = "__WATCOMC__"; then + tmp_exp="" + fi + +fi +rm -f conftest.err conftest.i conftest.$ac_ext + if test -z "$tmp_exp"; then + curl_cv_have_def___WATCOMC__=no + + else + curl_cv_have_def___WATCOMC__=yes + curl_cv_def___WATCOMC__=$tmp_exp + + fi + + if test "$curl_cv_have_def___WATCOMC__" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + + if test -z "$SED"; then + as_fn_error $? "SED not set. Cannot continue without SED being set." "$LINENO" 5 + fi + if test -z "$GREP"; then + as_fn_error $? "GREP not set. Cannot continue without GREP being set." "$LINENO" 5 + fi + + tmp_exp="" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + +#ifdef __UNIX__ +CURL_DEF_TOKEN __UNIX__ +#endif + + +_ACEOF +if ac_fn_c_try_cpp "$LINENO"; then : + + tmp_exp=`eval "$ac_cpp conftest.$ac_ext" 2>/dev/null | \ + "$GREP" CURL_DEF_TOKEN 2>/dev/null | \ + "$SED" 's/.*CURL_DEF_TOKEN[ ]//' 2>/dev/null | \ + "$SED" 's/["][ ]*["]//g' 2>/dev/null` + if test -z "$tmp_exp" || test "$tmp_exp" = "__UNIX__"; then + tmp_exp="" + fi + +fi +rm -f conftest.err conftest.i conftest.$ac_ext + if test -z "$tmp_exp"; then + curl_cv_have_def___UNIX__=no + + else + curl_cv_have_def___UNIX__=yes + curl_cv_def___UNIX__=$tmp_exp + + fi + + if test "$curl_cv_have_def___UNIX__" = "yes"; then + compiler_id="WATCOM_UNIX_C" + flags_dbg_all="-g1 -g1+ -g2 -g3" + flags_dbg_yes="-g2" + flags_dbg_off="" + flags_opt_all="-O0 -O1 -O2 -O3" + flags_opt_yes="-O2" + flags_opt_off="-O0" + else + compiler_id="WATCOM_WINDOWS_C" + flags_dbg_all="" + flags_dbg_yes="" + flags_dbg_off="" + flags_opt_all="" + flags_opt_yes="" + flags_opt_off="" + fi + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + fi + + # + if test "$compiler_id" = "unknown"; then + cat <<_EOF 1>&2 +*** +*** Warning: This configure script does not have information about the +*** compiler you are using, relative to the flags required to enable or +*** disable generation of debug info, optimization options or warnings. +*** +*** Whatever settings are present in CFLAGS will be used for this run. +*** +*** If you wish to help the cURL project to better support your compiler +*** you can report this and the required info on the libcurl development +*** mailing list: http://cool.haxx.se/mailman/listinfo/curl-library/ +*** +_EOF + fi + + +squeeze() { + _sqz_result="" + eval _sqz_input=\$$1 + for _sqz_token in $_sqz_input; do + if test -z "$_sqz_result"; then + _sqz_result="$_sqz_token" + else + _sqz_result="$_sqz_result $_sqz_token" + fi + done + eval $1=\$_sqz_result + return 0 +} + + + # + if test "$compiler_id" != "unknown"; then + # + if test "$compiler_id" = "GNU_C" || + test "$compiler_id" = "CLANG"; then + + tmp_has_include="no" + tmp_chg_FLAGS="$CFLAGS" + for word1 in $tmp_chg_FLAGS; do + case "$word1" in + -I*) + tmp_has_include="yes" + ;; + esac + done + if test "$tmp_has_include" = "yes"; then + tmp_chg_FLAGS=`echo "$tmp_chg_FLAGS" | "$SED" 's/^-I/ -isystem /g'` + tmp_chg_FLAGS=`echo "$tmp_chg_FLAGS" | "$SED" 's/ -I/ -isystem /g'` + CFLAGS="$tmp_chg_FLAGS" + squeeze CFLAGS + fi + tmp_has_include="no" + tmp_chg_FLAGS="$CPPFLAGS" + for word1 in $tmp_chg_FLAGS; do + case "$word1" in + -I*) + tmp_has_include="yes" + ;; + esac + done + if test "$tmp_has_include" = "yes"; then + tmp_chg_FLAGS=`echo "$tmp_chg_FLAGS" | "$SED" 's/^-I/ -isystem /g'` + tmp_chg_FLAGS=`echo "$tmp_chg_FLAGS" | "$SED" 's/ -I/ -isystem /g'` + CPPFLAGS="$tmp_chg_FLAGS" + squeeze CPPFLAGS + fi + + fi + # + tmp_save_CPPFLAGS="$CPPFLAGS" + tmp_save_CFLAGS="$CFLAGS" + tmp_CPPFLAGS="" + tmp_CFLAGS="" + # + case "$compiler_id" in + # + CLANG) + # + tmp_CFLAGS="$tmp_CFLAGS -Qunused-arguments" + ;; + # + DEC_C) + # + tmp_CFLAGS="$tmp_CFLAGS -std1" + tmp_CFLAGS="$tmp_CFLAGS -noansi_alias" + tmp_CFLAGS="$tmp_CFLAGS -warnprotos" + tmp_CFLAGS="$tmp_CFLAGS -msg_fatal toofewargs,toomanyargs" + ;; + # + GNU_C) + # + tmp_CFLAGS="$tmp_CFLAGS" + ;; + # + HP_UX_C) + # + tmp_CFLAGS="$tmp_CFLAGS -z" + tmp_CFLAGS="$tmp_CFLAGS +W 4227,4255" + ;; + # + IBM_C) + # + tmp_CFLAGS="$tmp_CFLAGS -qthreaded" + tmp_CFLAGS="$tmp_CFLAGS -qnoansialias" + tmp_CFLAGS="$tmp_CFLAGS -qhalt=e" + ;; + # + INTEL_UNIX_C) + # + tmp_CFLAGS="$tmp_CFLAGS -std=gnu89" + tmp_CPPFLAGS="$tmp_CPPFLAGS -we 140,147,165,266" + tmp_CPPFLAGS="$tmp_CPPFLAGS -wd 279,981,1469" + ;; + # + INTEL_WINDOWS_C) + # + tmp_CFLAGS="$tmp_CFLAGS" + ;; + # + LCC) + # + tmp_CFLAGS="$tmp_CFLAGS -n" + ;; + # + SGI_MIPS_C) + # + tmp_CFLAGS="$tmp_CFLAGS" + ;; + # + SGI_MIPSPRO_C) + # + tmp_CFLAGS="$tmp_CFLAGS" + ;; + # + SUNPRO_C) + # + tmp_CFLAGS="$tmp_CFLAGS" + ;; + # + TINY_C) + # + tmp_CFLAGS="$tmp_CFLAGS" + ;; + # + WATCOM_UNIX_C) + # + tmp_CFLAGS="$tmp_CFLAGS" + ;; + # + WATCOM_WINDOWS_C) + # + tmp_CFLAGS="$tmp_CFLAGS" + ;; + # + esac + # + squeeze tmp_CPPFLAGS + squeeze tmp_CFLAGS + # + if test ! -z "$tmp_CFLAGS" || test ! -z "$tmp_CPPFLAGS"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if compiler accepts some basic options" >&5 +$as_echo_n "checking if compiler accepts some basic options... " >&6; } + CPPFLAGS="$tmp_save_CPPFLAGS $tmp_CPPFLAGS" + CFLAGS="$tmp_save_CFLAGS $tmp_CFLAGS" + squeeze CPPFLAGS + squeeze CFLAGS + + tmp_compiler_works="unknown" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + + +int main (void) +{ + + int i = 1; + return i; + + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + + tmp_compiler_works="yes" + +else + + tmp_compiler_works="no" + echo " " >&6 + sed 's/^/cc-fail: /' conftest.err >&6 + echo " " >&6 + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + if test "$tmp_compiler_works" = "yes"; then + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + + +int main (void) +{ + + int i = 1; + return i; + + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + + tmp_compiler_works="yes" + +else + + tmp_compiler_works="no" + echo " " >&6 + sed 's/^/link-fail: /' conftest.err >&6 + echo " " >&6 + +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + fi + if test "x$cross_compiling" != "xyes" && + test "$tmp_compiler_works" = "yes"; then + if test "$cross_compiling" = yes; then : + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "cannot run test program while cross compiling +See \`config.log' for more details" "$LINENO" 5 ; } +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + +# ifdef __STDC__ +# include +# endif + +int main (void) +{ + + int i = 0; + exit(i); + + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_run "$LINENO"; then : + + tmp_compiler_works="yes" + +else + + tmp_compiler_works="no" + echo " " >&6 + echo "run-fail: test program exited with status $ac_status" >&6 + echo " " >&6 + +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext +fi + + fi + if test "$tmp_compiler_works" = "yes"; then + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: compiler options added: $tmp_CFLAGS $tmp_CPPFLAGS" >&5 +$as_echo "$as_me: compiler options added: $tmp_CFLAGS $tmp_CPPFLAGS" >&6;} + + else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: compiler options rejected: $tmp_CFLAGS $tmp_CPPFLAGS" >&5 +$as_echo "$as_me: WARNING: compiler options rejected: $tmp_CFLAGS $tmp_CPPFLAGS" >&2;} + CPPFLAGS="$tmp_save_CPPFLAGS" + CFLAGS="$tmp_save_CFLAGS" + + fi + + fi + # + fi + + + # + if test "$compiler_id" != "unknown"; then + # + tmp_save_CFLAGS="$CFLAGS" + tmp_save_CPPFLAGS="$CPPFLAGS" + # + tmp_options="" + tmp_CFLAGS="$CFLAGS" + tmp_CPPFLAGS="$CPPFLAGS" + + ac_var_stripped="" + for word1 in $tmp_CFLAGS; do + ac_var_strip_word="no" + for word2 in $flags_dbg_all; do + if test "$word1" = "$word2"; then + ac_var_strip_word="yes" + fi + done + if test "$ac_var_strip_word" = "no"; then + ac_var_stripped="$ac_var_stripped $word1" + fi + done + tmp_CFLAGS="$ac_var_stripped" + squeeze tmp_CFLAGS + + + ac_var_stripped="" + for word1 in $tmp_CPPFLAGS; do + ac_var_strip_word="no" + for word2 in $flags_dbg_all; do + if test "$word1" = "$word2"; then + ac_var_strip_word="yes" + fi + done + if test "$ac_var_strip_word" = "no"; then + ac_var_stripped="$ac_var_stripped $word1" + fi + done + tmp_CPPFLAGS="$ac_var_stripped" + squeeze tmp_CPPFLAGS + + # + if test "$want_debug" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if compiler accepts debug enabling options" >&5 +$as_echo_n "checking if compiler accepts debug enabling options... " >&6; } + tmp_options="$flags_dbg_yes" + fi + if test "$want_debug" = "no"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if compiler accepts debug disabling options" >&5 +$as_echo_n "checking if compiler accepts debug disabling options... " >&6; } + tmp_options="$flags_dbg_off" + fi + # + CPPFLAGS="$tmp_CPPFLAGS" + CFLAGS="$tmp_CFLAGS $tmp_options" + squeeze CPPFLAGS + squeeze CFLAGS + + tmp_compiler_works="unknown" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + + +int main (void) +{ + + int i = 1; + return i; + + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + + tmp_compiler_works="yes" + +else + + tmp_compiler_works="no" + echo " " >&6 + sed 's/^/cc-fail: /' conftest.err >&6 + echo " " >&6 + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + if test "$tmp_compiler_works" = "yes"; then + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + + +int main (void) +{ + + int i = 1; + return i; + + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + + tmp_compiler_works="yes" + +else + + tmp_compiler_works="no" + echo " " >&6 + sed 's/^/link-fail: /' conftest.err >&6 + echo " " >&6 + +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + fi + if test "x$cross_compiling" != "xyes" && + test "$tmp_compiler_works" = "yes"; then + if test "$cross_compiling" = yes; then : + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "cannot run test program while cross compiling +See \`config.log' for more details" "$LINENO" 5 ; } +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + +# ifdef __STDC__ +# include +# endif + +int main (void) +{ + + int i = 0; + exit(i); + + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_run "$LINENO"; then : + + tmp_compiler_works="yes" + +else + + tmp_compiler_works="no" + echo " " >&6 + echo "run-fail: test program exited with status $ac_status" >&6 + echo " " >&6 + +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext +fi + + fi + if test "$tmp_compiler_works" = "yes"; then + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: compiler options added: $tmp_options" >&5 +$as_echo "$as_me: compiler options added: $tmp_options" >&6;} + + else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: compiler options rejected: $tmp_options" >&5 +$as_echo "$as_me: WARNING: compiler options rejected: $tmp_options" >&2;} + CPPFLAGS="$tmp_save_CPPFLAGS" + CFLAGS="$tmp_save_CFLAGS" + + fi + + # + fi + + + # + if test "$compiler_id" != "unknown"; then + # + tmp_save_CFLAGS="$CFLAGS" + tmp_save_CPPFLAGS="$CPPFLAGS" + # + tmp_options="" + tmp_CFLAGS="$CFLAGS" + tmp_CPPFLAGS="$CPPFLAGS" + honor_optimize_option="yes" + # + # + if test "$want_optimize" = "assume_no" || + test "$want_optimize" = "assume_yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if compiler optimizer assumed setting might be used" >&5 +$as_echo_n "checking if compiler optimizer assumed setting might be used... " >&6; } + + + ac_var_match_word="no" + for word1 in $tmp_CFLAGS; do + for word2 in $flags_opt_all; do + if test "$word1" = "$word2"; then + ac_var_match_word="yes" + fi + done + done + + if test "$ac_var_match_word" = "yes"; then + + honor_optimize_option="no" + + + fi + + + + ac_var_match_word="no" + for word1 in $tmp_CPPFLAGS; do + for word2 in $flags_opt_all; do + if test "$word1" = "$word2"; then + ac_var_match_word="yes" + fi + done + done + + if test "$ac_var_match_word" = "yes"; then + + honor_optimize_option="no" + + + fi + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $honor_optimize_option" >&5 +$as_echo "$honor_optimize_option" >&6; } + if test "$honor_optimize_option" = "yes"; then + if test "$want_optimize" = "assume_yes"; then + want_optimize="yes" + fi + if test "$want_optimize" = "assume_no"; then + want_optimize="no" + fi + fi + fi + # + if test "$honor_optimize_option" = "yes"; then + + ac_var_stripped="" + for word1 in $tmp_CFLAGS; do + ac_var_strip_word="no" + for word2 in $flags_opt_all; do + if test "$word1" = "$word2"; then + ac_var_strip_word="yes" + fi + done + if test "$ac_var_strip_word" = "no"; then + ac_var_stripped="$ac_var_stripped $word1" + fi + done + tmp_CFLAGS="$ac_var_stripped" + squeeze tmp_CFLAGS + + + ac_var_stripped="" + for word1 in $tmp_CPPFLAGS; do + ac_var_strip_word="no" + for word2 in $flags_opt_all; do + if test "$word1" = "$word2"; then + ac_var_strip_word="yes" + fi + done + if test "$ac_var_strip_word" = "no"; then + ac_var_stripped="$ac_var_stripped $word1" + fi + done + tmp_CPPFLAGS="$ac_var_stripped" + squeeze tmp_CPPFLAGS + + if test "$want_optimize" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if compiler accepts optimizer enabling options" >&5 +$as_echo_n "checking if compiler accepts optimizer enabling options... " >&6; } + tmp_options="$flags_opt_yes" + fi + if test "$want_optimize" = "no"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if compiler accepts optimizer disabling options" >&5 +$as_echo_n "checking if compiler accepts optimizer disabling options... " >&6; } + tmp_options="$flags_opt_off" + fi + CPPFLAGS="$tmp_CPPFLAGS" + CFLAGS="$tmp_CFLAGS $tmp_options" + squeeze CPPFLAGS + squeeze CFLAGS + + tmp_compiler_works="unknown" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + + +int main (void) +{ + + int i = 1; + return i; + + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + + tmp_compiler_works="yes" + +else + + tmp_compiler_works="no" + echo " " >&6 + sed 's/^/cc-fail: /' conftest.err >&6 + echo " " >&6 + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + if test "$tmp_compiler_works" = "yes"; then + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + + +int main (void) +{ + + int i = 1; + return i; + + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + + tmp_compiler_works="yes" + +else + + tmp_compiler_works="no" + echo " " >&6 + sed 's/^/link-fail: /' conftest.err >&6 + echo " " >&6 + +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + fi + if test "x$cross_compiling" != "xyes" && + test "$tmp_compiler_works" = "yes"; then + if test "$cross_compiling" = yes; then : + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "cannot run test program while cross compiling +See \`config.log' for more details" "$LINENO" 5 ; } +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + +# ifdef __STDC__ +# include +# endif + +int main (void) +{ + + int i = 0; + exit(i); + + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_run "$LINENO"; then : + + tmp_compiler_works="yes" + +else + + tmp_compiler_works="no" + echo " " >&6 + echo "run-fail: test program exited with status $ac_status" >&6 + echo " " >&6 + +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext +fi + + fi + if test "$tmp_compiler_works" = "yes"; then + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: compiler options added: $tmp_options" >&5 +$as_echo "$as_me: compiler options added: $tmp_options" >&6;} + + else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: compiler options rejected: $tmp_options" >&5 +$as_echo "$as_me: WARNING: compiler options rejected: $tmp_options" >&2;} + CPPFLAGS="$tmp_save_CPPFLAGS" + CFLAGS="$tmp_save_CFLAGS" + + fi + + fi + # + fi + + + # + if test "$compiler_id" != "unknown"; then + # + tmp_save_CPPFLAGS="$CPPFLAGS" + tmp_save_CFLAGS="$CFLAGS" + tmp_CPPFLAGS="" + tmp_CFLAGS="" + # + case "$compiler_id" in + # + CLANG) + # + if test "$want_warnings" = "yes"; then + tmp_CFLAGS="$tmp_CFLAGS -pedantic" + tmp_CFLAGS="$tmp_CFLAGS -Wall -Wextra" + tmp_CFLAGS="$tmp_CFLAGS -Wpointer-arith -Wwrite-strings" + tmp_CFLAGS="$tmp_CFLAGS -Wshadow" + tmp_CFLAGS="$tmp_CFLAGS -Winline -Wnested-externs" + tmp_CFLAGS="$tmp_CFLAGS -Wmissing-declarations" + tmp_CFLAGS="$tmp_CFLAGS -Wmissing-prototypes" + tmp_CFLAGS="$tmp_CFLAGS -Wno-long-long" + tmp_CFLAGS="$tmp_CFLAGS -Wfloat-equal" + tmp_CFLAGS="$tmp_CFLAGS -Wno-multichar -Wsign-compare" + tmp_CFLAGS="$tmp_CFLAGS -Wundef" + tmp_CFLAGS="$tmp_CFLAGS -Wno-format-nonliteral" + tmp_CFLAGS="$tmp_CFLAGS -Wendif-labels -Wstrict-prototypes" + tmp_CFLAGS="$tmp_CFLAGS -Wdeclaration-after-statement" + tmp_CFLAGS="$tmp_CFLAGS -Wcast-align" + tmp_CFLAGS="$tmp_CFLAGS -Wno-system-headers" + tmp_CFLAGS="$tmp_CFLAGS -Wshorten-64-to-32" + # + if test "$compiler_num" -ge "101"; then + tmp_CFLAGS="$tmp_CFLAGS -Wunused" + fi + fi + ;; + # + DEC_C) + # + if test "$want_warnings" = "yes"; then + tmp_CFLAGS="$tmp_CFLAGS -msg_enable level3" + fi + ;; + # + GNU_C) + # + if test "$want_warnings" = "yes"; then + # + if test "x$cross_compiling" != "xyes" || + test "$compiler_num" -ge "300"; then + tmp_CFLAGS="$tmp_CFLAGS -pedantic" + fi + # + tmp_CFLAGS="$tmp_CFLAGS -Wall -W" + # + if test "$compiler_num" -ge "104"; then + tmp_CFLAGS="$tmp_CFLAGS -Wpointer-arith -Wwrite-strings" + if test "x$cross_compiling" != "xyes" || + test "$compiler_num" -ge "300"; then + tmp_CFLAGS="$tmp_CFLAGS -Wunused -Wshadow" + fi + fi + # + if test "$compiler_num" -ge "207"; then + tmp_CFLAGS="$tmp_CFLAGS -Winline -Wnested-externs" + if test "x$cross_compiling" != "xyes" || + test "$compiler_num" -ge "300"; then + tmp_CFLAGS="$tmp_CFLAGS -Wmissing-declarations" + tmp_CFLAGS="$tmp_CFLAGS -Wmissing-prototypes" + fi + fi + # + if test "$compiler_num" -ge "295"; then + tmp_CFLAGS="$tmp_CFLAGS -Wno-long-long" + fi + # + if test "$compiler_num" -ge "296"; then + tmp_CFLAGS="$tmp_CFLAGS -Wfloat-equal" + tmp_CFLAGS="$tmp_CFLAGS -Wno-multichar -Wsign-compare" + tmp_CFLAGS="$tmp_CFLAGS -Wundef" + fi + # + if test "$compiler_num" -ge "297"; then + tmp_CFLAGS="$tmp_CFLAGS -Wno-format-nonliteral" + fi + # + if test "$compiler_num" -ge "300"; then + tmp_CFLAGS="$tmp_CFLAGS" + fi + # + if test "$compiler_num" -ge "303"; then + tmp_CFLAGS="$tmp_CFLAGS -Wendif-labels -Wstrict-prototypes" + fi + # + if test "$compiler_num" -ge "304"; then + tmp_CFLAGS="$tmp_CFLAGS -Wdeclaration-after-statement" + fi + # + if test "$compiler_num" -ge "402"; then + tmp_CFLAGS="$tmp_CFLAGS -Wcast-align" + fi + if test "$compiler_num" -ge "403"; then + tmp_CFLAGS="$tmp_CFLAGS -Wtype-limits -Wold-style-declaration" + tmp_CFLAGS="$tmp_CFLAGS -Wmissing-parameter-type -Wempty-body" + tmp_CFLAGS="$tmp_CFLAGS -Wclobbered -Wignored-qualifiers" + tmp_CFLAGS="$tmp_CFLAGS -Wconversion -Wno-sign-conversion -Wvla" + fi + # + fi + # + if test "$compiler_num" -ge "300"; then + tmp_CFLAGS="$tmp_CFLAGS -Wno-system-headers" + else + if test "x$cross_compiling" = "xyes"; then + if test "$compiler_num" -ge "104"; then + tmp_CFLAGS="$tmp_CFLAGS -Wno-unused -Wno-shadow" + fi + if test "$compiler_num" -ge "207"; then + tmp_CFLAGS="$tmp_CFLAGS -Wno-missing-declarations" + tmp_CFLAGS="$tmp_CFLAGS -Wno-missing-prototypes" + fi + fi + fi + ;; + # + HP_UX_C) + # + if test "$want_warnings" = "yes"; then + tmp_CFLAGS="$tmp_CFLAGS +w1" + fi + ;; + # + IBM_C) + # + tmp_CFLAGS="$tmp_CFLAGS" + ;; + # + INTEL_UNIX_C) + # + if test "$want_warnings" = "yes"; then + if test "$compiler_num" -gt "600"; then + tmp_CPPFLAGS="$tmp_CPPFLAGS -Wall -w2" + tmp_CPPFLAGS="$tmp_CPPFLAGS -Wcheck" + tmp_CPPFLAGS="$tmp_CPPFLAGS -Wcomment" + tmp_CPPFLAGS="$tmp_CPPFLAGS -Wdeprecated" + tmp_CPPFLAGS="$tmp_CPPFLAGS -Wmissing-prototypes" + tmp_CPPFLAGS="$tmp_CPPFLAGS -Wp64" + tmp_CPPFLAGS="$tmp_CPPFLAGS -Wpointer-arith" + tmp_CPPFLAGS="$tmp_CPPFLAGS -Wreturn-type" + tmp_CPPFLAGS="$tmp_CPPFLAGS -Wshadow" + tmp_CPPFLAGS="$tmp_CPPFLAGS -Wuninitialized" + tmp_CPPFLAGS="$tmp_CPPFLAGS -Wunused-function" + fi + fi + tmp_CFLAGS="$tmp_CFLAGS -fno-omit-frame-pointer" + tmp_CFLAGS="$tmp_CFLAGS -fno-strict-aliasing" + tmp_CFLAGS="$tmp_CFLAGS -fp-model precise" + if test "$compiler_num" -ge "1000"; then + tmp_CFLAGS="$tmp_CFLAGS -vec-report0" + fi + ;; + # + INTEL_WINDOWS_C) + # + tmp_CFLAGS="$tmp_CFLAGS" + ;; + # + LCC) + # + if test "$want_warnings" = "yes"; then + tmp_CFLAGS="$tmp_CFLAGS" + fi + ;; + # + SGI_MIPS_C) + # + if test "$want_warnings" = "yes"; then + tmp_CFLAGS="$tmp_CFLAGS -fullwarn" + fi + ;; + # + SGI_MIPSPRO_C) + # + if test "$want_warnings" = "yes"; then + tmp_CFLAGS="$tmp_CFLAGS -fullwarn" + tmp_CFLAGS="$tmp_CFLAGS -woff 1209" + fi + ;; + # + SUNPRO_C) + # + if test "$want_warnings" = "yes"; then + tmp_CFLAGS="$tmp_CFLAGS -v" + fi + ;; + # + TINY_C) + # + if test "$want_warnings" = "yes"; then + tmp_CFLAGS="$tmp_CFLAGS -Wall" + tmp_CFLAGS="$tmp_CFLAGS -Wwrite-strings" + tmp_CFLAGS="$tmp_CFLAGS -Wunsupported" + fi + ;; + # + WATCOM_UNIX_C) + # + if test "$want_warnings" = "yes"; then + tmp_CFLAGS="$tmp_CFLAGS -Wall -Wextra" + fi + ;; + # + WATCOM_WINDOWS_C) + # + tmp_CFLAGS="$tmp_CFLAGS" + ;; + # + esac + # + squeeze tmp_CPPFLAGS + squeeze tmp_CFLAGS + # + if test ! -z "$tmp_CFLAGS" || test ! -z "$tmp_CPPFLAGS"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if compiler accepts strict warning options" >&5 +$as_echo_n "checking if compiler accepts strict warning options... " >&6; } + CPPFLAGS="$tmp_save_CPPFLAGS $tmp_CPPFLAGS" + CFLAGS="$tmp_save_CFLAGS $tmp_CFLAGS" + squeeze CPPFLAGS + squeeze CFLAGS + + tmp_compiler_works="unknown" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + + +int main (void) +{ + + int i = 1; + return i; + + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + + tmp_compiler_works="yes" + +else + + tmp_compiler_works="no" + echo " " >&6 + sed 's/^/cc-fail: /' conftest.err >&6 + echo " " >&6 + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + if test "$tmp_compiler_works" = "yes"; then + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + + +int main (void) +{ + + int i = 1; + return i; + + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + + tmp_compiler_works="yes" + +else + + tmp_compiler_works="no" + echo " " >&6 + sed 's/^/link-fail: /' conftest.err >&6 + echo " " >&6 + +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + fi + if test "x$cross_compiling" != "xyes" && + test "$tmp_compiler_works" = "yes"; then + if test "$cross_compiling" = yes; then : + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "cannot run test program while cross compiling +See \`config.log' for more details" "$LINENO" 5 ; } +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + +# ifdef __STDC__ +# include +# endif + +int main (void) +{ + + int i = 0; + exit(i); + + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_run "$LINENO"; then : + + tmp_compiler_works="yes" + +else + + tmp_compiler_works="no" + echo " " >&6 + echo "run-fail: test program exited with status $ac_status" >&6 + echo " " >&6 + +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext +fi + + fi + if test "$tmp_compiler_works" = "yes"; then + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: compiler options added: $tmp_CFLAGS $tmp_CPPFLAGS" >&5 +$as_echo "$as_me: compiler options added: $tmp_CFLAGS $tmp_CPPFLAGS" >&6;} + + else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: compiler options rejected: $tmp_CFLAGS $tmp_CPPFLAGS" >&5 +$as_echo "$as_me: WARNING: compiler options rejected: $tmp_CFLAGS $tmp_CPPFLAGS" >&2;} + CPPFLAGS="$tmp_save_CPPFLAGS" + CFLAGS="$tmp_save_CFLAGS" + + fi + + fi + # + fi + + +if test "$compiler_id" = "INTEL_UNIX_C"; then + # + if test "$compiler_num" -ge "1000"; then + CFLAGS="$CFLAGS -shared-intel" + elif test "$compiler_num" -ge "900"; then + CFLAGS="$CFLAGS -i-dynamic" + fi + # +fi + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if compiler halts on compilation errors" >&5 +$as_echo_n "checking if compiler halts on compilation errors... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + + +int main (void) +{ + + force compilation error + + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + as_fn_error $? "compiler does not halt on compilation errors." "$LINENO" 5 + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if compiler halts on negative sized arrays" >&5 +$as_echo_n "checking if compiler halts on negative sized arrays... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + + typedef char bad_t[sizeof(char) == sizeof(int) ? -1 : -1 ]; + +int main (void) +{ + + bad_t dummy; + + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + as_fn_error $? "compiler does not halt on negative sized arrays." "$LINENO" 5 + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if shared libraries need -no-undefined" >&5 +$as_echo_n "checking if shared libraries need -no-undefined... " >&6; } + need_no_undefined="no" + case $host in + *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-cegcc* | *-*-aix*) + need_no_undefined="yes" + ;; + esac + if test "x$allow_undefined" = "xno"; then + need_no_undefined="yes" + elif test "x$allow_undefined_flag" = "xunsupported"; then + need_no_undefined="yes" + fi + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $need_no_undefined" >&5 +$as_echo "$need_no_undefined" >&6; } + + + +if test x$need_no_undefined = xyes; then + NO_UNDEFINED_TRUE= + NO_UNDEFINED_FALSE='#' +else + NO_UNDEFINED_TRUE='#' + NO_UNDEFINED_FALSE= +fi + + + + supports_curldebug="unknown" + if test "$want_curldebug" = "yes"; then + if test "x$enable_shared" != "xno" && + test "x$enable_shared" != "xyes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: unknown enable_shared setting." >&5 +$as_echo "$as_me: WARNING: unknown enable_shared setting." >&2;} + supports_curldebug="no" + fi + if test "x$enable_static" != "xno" && + test "x$enable_static" != "xyes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: unknown enable_static setting." >&5 +$as_echo "$as_me: WARNING: unknown enable_static setting." >&2;} + supports_curldebug="no" + fi + if test "$supports_curldebug" != "no"; then + if test "$enable_shared" = "yes" && + test "$need_no_undefined" = "yes"; then + supports_curldebug="no" + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: shared library does not support undefined symbols." >&5 +$as_echo "$as_me: WARNING: shared library does not support undefined symbols." >&2;} + fi + fi + fi + # + if test "$want_curldebug" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if curl debug memory tracking can be enabled" >&5 +$as_echo_n "checking if curl debug memory tracking can be enabled... " >&6; } + test "$supports_curldebug" = "no" || supports_curldebug="yes" + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $supports_curldebug" >&5 +$as_echo "$supports_curldebug" >&6; } + if test "$supports_curldebug" = "no"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cannot enable curl debug memory tracking." >&5 +$as_echo "$as_me: WARNING: cannot enable curl debug memory tracking." >&2;} + want_curldebug="no" + fi + fi + # + if test "$want_curldebug" = "yes"; then + CPPFLAGS="$CPPFLAGS -DCURLDEBUG" + squeeze CPPFLAGS + fi + if test "$want_debug" = "yes"; then + CPPFLAGS="$CPPFLAGS -DDEBUGBUILD" + squeeze CPPFLAGS + fi + + + +if test x$want_curldebug = xyes; then + CURLDEBUG_TRUE= + CURLDEBUG_FALSE='#' +else + CURLDEBUG_TRUE='#' + CURLDEBUG_FALSE= +fi + + + + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for windows.h" >&5 +$as_echo_n "checking for windows.h... " >&6; } +if test "${ac_cv_header_windows_h+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + +#undef inline +#ifndef WIN32_LEAN_AND_MEAN +#define WIN32_LEAN_AND_MEAN +#endif +#include + +int main (void) +{ + +#if defined(__CYGWIN__) || defined(__CEGCC__) + HAVE_WINDOWS_H shall not be defined. +#else + int dummy=2*WINVER; +#endif + + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + + ac_cv_header_windows_h="yes" + +else + + ac_cv_header_windows_h="no" + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_windows_h" >&5 +$as_echo "$ac_cv_header_windows_h" >&6; } + case "$ac_cv_header_windows_h" in + yes) + +cat >>confdefs.h <<_ACEOF +#define HAVE_WINDOWS_H 1 +_ACEOF + + +cat >>confdefs.h <<_ACEOF +#define WIN32_LEAN_AND_MEAN 1 +_ACEOF + + ;; + esac + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether build target is a native Windows one" >&5 +$as_echo_n "checking whether build target is a native Windows one... " >&6; } +if test "${ac_cv_native_windows+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + + if test "$ac_cv_header_windows_h" = "no"; then + ac_cv_native_windows="no" + else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + + +int main (void) +{ + +#if defined(__MINGW32__) || defined(__MINGW32CE__) || \ + (defined(_MSC_VER) && (defined(_WIN32) || defined(_WIN64))) + int dummy=1; +#else + Not a native Windows build target. +#endif + + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + + ac_cv_native_windows="yes" + +else + + ac_cv_native_windows="no" + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + fi + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_native_windows" >&5 +$as_echo "$ac_cv_native_windows" >&6; } + case "$ac_cv_native_windows" in + yes) + +cat >>confdefs.h <<_ACEOF +#define NATIVE_WINDOWS 1 +_ACEOF + + ;; + esac + +case X-"$ac_cv_native_windows" in + X-yes) + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for winsock.h" >&5 +$as_echo_n "checking for winsock.h... " >&6; } +if test "${ac_cv_header_winsock_h+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + +#undef inline +#ifndef WIN32_LEAN_AND_MEAN +#define WIN32_LEAN_AND_MEAN +#endif +#include +#include + +int main (void) +{ + +#if defined(__CYGWIN__) || defined(__CEGCC__) + HAVE_WINSOCK_H shall not be defined. +#else + int dummy=WSACleanup(); +#endif + + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + + ac_cv_header_winsock_h="yes" + +else + + ac_cv_header_winsock_h="no" + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_winsock_h" >&5 +$as_echo "$ac_cv_header_winsock_h" >&6; } + case "$ac_cv_header_winsock_h" in + yes) + +cat >>confdefs.h <<_ACEOF +#define HAVE_WINSOCK_H 1 +_ACEOF + + ;; + esac + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for winsock2.h" >&5 +$as_echo_n "checking for winsock2.h... " >&6; } +if test "${ac_cv_header_winsock2_h+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + +#undef inline +#ifndef WIN32_LEAN_AND_MEAN +#define WIN32_LEAN_AND_MEAN +#endif +#include +#include + +int main (void) +{ + +#if defined(__CYGWIN__) || defined(__CEGCC__) || defined(__MINGW32CE__) + HAVE_WINSOCK2_H shall not be defined. +#else + int dummy=2*IPPROTO_ESP; +#endif + + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + + ac_cv_header_winsock2_h="yes" + +else + + ac_cv_header_winsock2_h="no" + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_winsock2_h" >&5 +$as_echo "$ac_cv_header_winsock2_h" >&6; } + case "$ac_cv_header_winsock2_h" in + yes) + +cat >>confdefs.h <<_ACEOF +#define HAVE_WINSOCK2_H 1 +_ACEOF + + ;; + esac + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ws2tcpip.h" >&5 +$as_echo_n "checking for ws2tcpip.h... " >&6; } +if test "${ac_cv_header_ws2tcpip_h+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + +#undef inline +#ifndef WIN32_LEAN_AND_MEAN +#define WIN32_LEAN_AND_MEAN +#endif +#include +#include +#include + +int main (void) +{ + +#if defined(__CYGWIN__) || defined(__CEGCC__) || defined(__MINGW32CE__) + HAVE_WS2TCPIP_H shall not be defined. +#else + int dummy=2*IP_PKTINFO; +#endif + + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + + ac_cv_header_ws2tcpip_h="yes" + +else + + ac_cv_header_ws2tcpip_h="no" + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_ws2tcpip_h" >&5 +$as_echo "$ac_cv_header_ws2tcpip_h" >&6; } + case "$ac_cv_header_ws2tcpip_h" in + yes) + +cat >>confdefs.h <<_ACEOF +#define HAVE_WS2TCPIP_H 1 +_ACEOF + + ;; + esac + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for winldap.h" >&5 +$as_echo_n "checking for winldap.h... " >&6; } +if test "${ac_cv_header_winldap_h+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + +#undef inline +#ifdef HAVE_WINDOWS_H +#ifndef WIN32_LEAN_AND_MEAN +#define WIN32_LEAN_AND_MEAN +#endif +#include +#endif +#include + +int main (void) +{ + +#if defined(__CYGWIN__) || defined(__CEGCC__) + HAVE_WINLDAP_H shall not be defined. +#else + LDAP *ldp = ldap_init("dummy", LDAP_PORT); + ULONG res = ldap_unbind(ldp); +#endif + + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + + ac_cv_header_winldap_h="yes" + +else + + ac_cv_header_winldap_h="no" + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_winldap_h" >&5 +$as_echo "$ac_cv_header_winldap_h" >&6; } + case "$ac_cv_header_winldap_h" in + yes) + +cat >>confdefs.h <<_ACEOF +#define HAVE_WINLDAP_H 1 +_ACEOF + + ;; + esac + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for winber.h" >&5 +$as_echo_n "checking for winber.h... " >&6; } +if test "${ac_cv_header_winber_h+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + +#undef inline +#ifdef HAVE_WINDOWS_H +#ifndef WIN32_LEAN_AND_MEAN +#define WIN32_LEAN_AND_MEAN +#endif +#include +#endif +#include +#include + +int main (void) +{ + +#if defined(__CYGWIN__) || defined(__CEGCC__) + HAVE_WINBER_H shall not be defined. +#else + BERVAL *bvp = NULL; + BerElement *bep = ber_init(bvp); + ber_free(bep, 1); +#endif + + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + + ac_cv_header_winber_h="yes" + +else + + ac_cv_header_winber_h="no" + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_winber_h" >&5 +$as_echo "$ac_cv_header_winber_h" >&6; } + case "$ac_cv_header_winber_h" in + yes) + +cat >>confdefs.h <<_ACEOF +#define HAVE_WINBER_H 1 +_ACEOF + + ;; + esac + + ;; + *) + ac_cv_header_winsock_h="no" + ac_cv_header_winsock2_h="no" + ac_cv_header_ws2tcpip_h="no" + ac_cv_header_winldap_h="no" + ac_cv_header_winber_h="no" + ;; +esac + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether build target supports WIN32 file API" >&5 +$as_echo_n "checking whether build target supports WIN32 file API... " >&6; } + curl_win32_file_api="no" + if test "$ac_cv_header_windows_h" = "yes"; then + if test x"$enable_largefile" != "xno"; then + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + + +int main (void) +{ + +#if !defined(_WIN32_WCE) && \ + (defined(__MINGW32__) || \ + (defined(_MSC_VER) && (defined(_WIN32) || defined(_WIN64)))) + int dummy=1; +#else + WIN32 large file API not supported. +#endif + + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + + curl_win32_file_api="win32_large_files" + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + fi + if test "$curl_win32_file_api" = "no"; then + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + + +int main (void) +{ + +#if defined(_WIN32_WCE) || defined(__MINGW32__) || defined(_MSC_VER) + int dummy=1; +#else + WIN32 small file API not supported. +#endif + + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + + curl_win32_file_api="win32_small_files" + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + fi + fi + case "$curl_win32_file_api" in + win32_large_files) + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes (large file enabled)" >&5 +$as_echo "yes (large file enabled)" >&6; } + +cat >>confdefs.h <<_ACEOF +#define USE_WIN32_LARGE_FILES 1 +_ACEOF + + ;; + win32_small_files) + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes (large file disabled)" >&5 +$as_echo "yes (large file disabled)" >&6; } + +cat >>confdefs.h <<_ACEOF +#define USE_WIN32_LARGE_FILES 1 +_ACEOF + + ;; + *) + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + ;; + esac + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to support http" >&5 +$as_echo_n "checking whether to support http... " >&6; } +# Check whether --enable-http was given. +if test "${enable_http+set}" = set; then : + enableval=$enable_http; case "$enableval" in + no) + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + +$as_echo "#define CURL_DISABLE_HTTP 1" >>confdefs.h + + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: disable HTTP disables FTP over proxy and RTSP" >&5 +$as_echo "$as_me: WARNING: disable HTTP disables FTP over proxy and RTSP" >&2;} + CURL_DISABLE_HTTP=1 + + +$as_echo "#define CURL_DISABLE_RTSP 1" >>confdefs.h + + CURL_DISABLE_RTSP=1 + + ;; + *) { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + ;; + esac +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + +fi + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to support ftp" >&5 +$as_echo_n "checking whether to support ftp... " >&6; } +# Check whether --enable-ftp was given. +if test "${enable_ftp+set}" = set; then : + enableval=$enable_ftp; case "$enableval" in + no) + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + +$as_echo "#define CURL_DISABLE_FTP 1" >>confdefs.h + + CURL_DISABLE_FTP=1 + + ;; + *) { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + ;; + esac +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + +fi + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to support file" >&5 +$as_echo_n "checking whether to support file... " >&6; } +# Check whether --enable-file was given. +if test "${enable_file+set}" = set; then : + enableval=$enable_file; case "$enableval" in + no) + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + +$as_echo "#define CURL_DISABLE_FILE 1" >>confdefs.h + + CURL_DISABLE_FILE=1 + + ;; + *) { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + ;; + esac +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + +fi + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to support ldap" >&5 +$as_echo_n "checking whether to support ldap... " >&6; } +# Check whether --enable-ldap was given. +if test "${enable_ldap+set}" = set; then : + enableval=$enable_ldap; case "$enableval" in + no) + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + +$as_echo "#define CURL_DISABLE_LDAP 1" >>confdefs.h + + CURL_DISABLE_LDAP=1 + + ;; + *) + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + ;; + esac +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + +fi + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to support ldaps" >&5 +$as_echo_n "checking whether to support ldaps... " >&6; } +# Check whether --enable-ldaps was given. +if test "${enable_ldaps+set}" = set; then : + enableval=$enable_ldaps; case "$enableval" in + no) + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + +$as_echo "#define CURL_DISABLE_LDAPS 1" >>confdefs.h + + CURL_DISABLE_LDAPS=1 + + ;; + *) if test "x$CURL_DISABLE_LDAP" = "x1" ; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: LDAP needs to be enabled to support LDAPS" >&5 +$as_echo "LDAP needs to be enabled to support LDAPS" >&6; } + +$as_echo "#define CURL_DISABLE_LDAPS 1" >>confdefs.h + + CURL_DISABLE_LDAPS=1 + + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + +$as_echo "#define HAVE_LDAP_SSL 1" >>confdefs.h + + HAVE_LDAP_SSL=1 + + fi + ;; + esac +else + + if test "x$CURL_DISABLE_LDAP" = "x1" ; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + +$as_echo "#define CURL_DISABLE_LDAPS 1" >>confdefs.h + + CURL_DISABLE_LDAPS=1 + + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + +$as_echo "#define HAVE_LDAP_SSL 1" >>confdefs.h + + HAVE_LDAP_SSL=1 + + fi + +fi + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to support rtsp" >&5 +$as_echo_n "checking whether to support rtsp... " >&6; } +# Check whether --enable-rtsp was given. +if test "${enable_rtsp+set}" = set; then : + enableval=$enable_rtsp; case "$enableval" in + no) + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + +$as_echo "#define CURL_DISABLE_RTSP 1" >>confdefs.h + + CURL_DISABLE_RTSP=1 + + ;; + *) if test x$CURL_DISABLE_HTTP = x1 ; then + as_fn_error $? "HTTP support needs to be enabled in order to enable RTSP support!" "$LINENO" 5 + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + curl_rtsp_msg="enabled" + fi + ;; + esac +else + if test "x$CURL_DISABLE_HTTP" != "x1"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + curl_rtsp_msg="enabled" + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + fi + +fi + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to support proxies" >&5 +$as_echo_n "checking whether to support proxies... " >&6; } +# Check whether --enable-proxy was given. +if test "${enable_proxy+set}" = set; then : + enableval=$enable_proxy; case "$enableval" in + no) + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + +$as_echo "#define CURL_DISABLE_PROXY 1" >>confdefs.h + + CURL_DISABLE_PROXY=1 + + ;; + *) { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + ;; + esac +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + +fi + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to support dict" >&5 +$as_echo_n "checking whether to support dict... " >&6; } +# Check whether --enable-dict was given. +if test "${enable_dict+set}" = set; then : + enableval=$enable_dict; case "$enableval" in + no) + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + +$as_echo "#define CURL_DISABLE_DICT 1" >>confdefs.h + + CURL_DISABLE_DICT=1 + + ;; + *) { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + ;; + esac +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + +fi + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to support telnet" >&5 +$as_echo_n "checking whether to support telnet... " >&6; } +# Check whether --enable-telnet was given. +if test "${enable_telnet+set}" = set; then : + enableval=$enable_telnet; case "$enableval" in + no) + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + +$as_echo "#define CURL_DISABLE_TELNET 1" >>confdefs.h + + CURL_DISABLE_TELNET=1 + + ;; + *) { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + ;; + esac +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + +fi + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to support tftp" >&5 +$as_echo_n "checking whether to support tftp... " >&6; } +# Check whether --enable-tftp was given. +if test "${enable_tftp+set}" = set; then : + enableval=$enable_tftp; case "$enableval" in + no) + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + +$as_echo "#define CURL_DISABLE_TFTP 1" >>confdefs.h + + CURL_DISABLE_TFTP=1 + + ;; + *) { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + ;; + esac +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + +fi + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to support pop3" >&5 +$as_echo_n "checking whether to support pop3... " >&6; } +# Check whether --enable-pop3 was given. +if test "${enable_pop3+set}" = set; then : + enableval=$enable_pop3; case "$enableval" in + no) + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + +$as_echo "#define CURL_DISABLE_POP3 1" >>confdefs.h + + CURL_DISABLE_POP3=1 + + ;; + *) { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + ;; + esac +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + +fi + + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to support imap" >&5 +$as_echo_n "checking whether to support imap... " >&6; } +# Check whether --enable-imap was given. +if test "${enable_imap+set}" = set; then : + enableval=$enable_imap; case "$enableval" in + no) + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + +$as_echo "#define CURL_DISABLE_IMAP 1" >>confdefs.h + + CURL_DISABLE_IMAP=1 + + ;; + *) { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + ;; + esac +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + +fi + + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to support smtp" >&5 +$as_echo_n "checking whether to support smtp... " >&6; } +# Check whether --enable-smtp was given. +if test "${enable_smtp+set}" = set; then : + enableval=$enable_smtp; case "$enableval" in + no) + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + +$as_echo "#define CURL_DISABLE_SMTP 1" >>confdefs.h + + CURL_DISABLE_SMTP=1 + + ;; + *) { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + ;; + esac +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + +fi + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to support gopher" >&5 +$as_echo_n "checking whether to support gopher... " >&6; } +# Check whether --enable-gopher was given. +if test "${enable_gopher+set}" = set; then : + enableval=$enable_gopher; case "$enableval" in + no) + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + +$as_echo "#define CURL_DISABLE_GOPHER 1" >>confdefs.h + + CURL_DISABLE_GOPHER=1 + + ;; + *) { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + ;; + esac +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + +fi + + + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to provide built-in manual" >&5 +$as_echo_n "checking whether to provide built-in manual... " >&6; } +# Check whether --enable-manual was given. +if test "${enable_manual+set}" = set; then : + enableval=$enable_manual; case "$enableval" in + no) + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + ;; + *) { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + USE_MANUAL="1" + ;; + esac +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + USE_MANUAL="1" + +fi + + + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if X/Open network library is required" >&5 +$as_echo_n "checking if X/Open network library is required... " >&6; } + tst_lib_xnet_required="no" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + +int main (void) +{ +#if defined(__hpux) && defined(_XOPEN_SOURCE) && (_XOPEN_SOURCE >= 600) + return 0; +#elif defined(__hpux) && defined(_XOPEN_SOURCE_EXTENDED) + return 0; +#else + force compilation error +#endif +} + + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + + tst_lib_xnet_required="yes" + LIBS="$LIBS -lxnet" + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $tst_lib_xnet_required" >&5 +$as_echo "$tst_lib_xnet_required" >&6; } + + +ac_fn_c_check_func "$LINENO" "gethostbyname" "ac_cv_func_gethostbyname" +if test "x$ac_cv_func_gethostbyname" = x""yes; then : + HAVE_GETHOSTBYNAME="1" + +else + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for gethostbyname in -lnsl" >&5 +$as_echo_n "checking for gethostbyname in -lnsl... " >&6; } +if test "${ac_cv_lib_nsl_gethostbyname+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lnsl $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + +#ifdef __cplusplus +extern "C" +#endif +char gethostbyname (); +int main (void) +{ +return gethostbyname (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_lib_nsl_gethostbyname=yes +else + ac_cv_lib_nsl_gethostbyname=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_nsl_gethostbyname" >&5 +$as_echo "$ac_cv_lib_nsl_gethostbyname" >&6; } +if test "x$ac_cv_lib_nsl_gethostbyname" = x""yes; then : + HAVE_GETHOSTBYNAME="1" + LIBS="$LIBS -lnsl" + +fi + + +fi + + +if test "$HAVE_GETHOSTBYNAME" != "1" +then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for gethostbyname in -lsocket" >&5 +$as_echo_n "checking for gethostbyname in -lsocket... " >&6; } +if test "${ac_cv_lib_socket_gethostbyname+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lsocket $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + +#ifdef __cplusplus +extern "C" +#endif +char gethostbyname (); +int main (void) +{ +return gethostbyname (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_lib_socket_gethostbyname=yes +else + ac_cv_lib_socket_gethostbyname=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_socket_gethostbyname" >&5 +$as_echo "$ac_cv_lib_socket_gethostbyname" >&6; } +if test "x$ac_cv_lib_socket_gethostbyname" = x""yes; then : + HAVE_GETHOSTBYNAME="1" + LIBS="$LIBS -lsocket" + +fi + +fi + +if test "$HAVE_GETHOSTBYNAME" != "1" +then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for gethostbyname with both nsl and socket libs" >&5 +$as_echo_n "checking for gethostbyname with both nsl and socket libs... " >&6; } + my_ac_save_LIBS=$LIBS + LIBS="-lnsl -lsocket $LIBS" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + + +int main (void) +{ + + gethostbyname(); + + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + HAVE_GETHOSTBYNAME="1" + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + LIBS=$my_ac_save_LIBS + +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi + +if test "$HAVE_GETHOSTBYNAME" != "1" +then + if test "$ac_cv_header_windows_h" = "yes"; then + if test "$ac_cv_header_winsock_h" = "yes"; then + case $host in + *-*-mingw32ce*) + winsock_LIB="-lwinsock" + ;; + *) + winsock_LIB="-lwsock32" + ;; + esac + fi + if test "$ac_cv_header_winsock2_h" = "yes"; then + winsock_LIB="-lws2_32" + fi + if test ! -z "$winsock_LIB"; then + my_ac_save_LIBS=$LIBS + LIBS="$winsock_LIB $LIBS" + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for gethostbyname in $winsock_LIB" >&5 +$as_echo_n "checking for gethostbyname in $winsock_LIB... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + +#ifdef HAVE_WINDOWS_H +#ifndef WIN32_LEAN_AND_MEAN +#define WIN32_LEAN_AND_MEAN +#endif +#include +#ifdef HAVE_WINSOCK2_H +#include +#else +#ifdef HAVE_WINSOCK_H +#include +#endif +#endif +#endif + +int main (void) +{ + + gethostbyname("www.dummysite.com"); + + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + HAVE_GETHOSTBYNAME="1" + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + winsock_LIB="" + LIBS=$my_ac_save_LIBS + +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + fi + fi +fi + +if test "$HAVE_GETHOSTBYNAME" != "1" +then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for gethostbyname for Minix 3" >&5 +$as_echo_n "checking for gethostbyname for Minix 3... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + +/* Older Minix versions may need here instead */ +#include + +int main (void) +{ + + gethostbyname("www.dummysite.com"); + + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + HAVE_GETHOSTBYNAME="1" + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi + +if test "$HAVE_GETHOSTBYNAME" != "1" +then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for gethostbyname for eCos" >&5 +$as_echo_n "checking for gethostbyname for eCos... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + +#include +#include + +int main (void) +{ + + gethostbyname("www.dummysite.com"); + + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + HAVE_GETHOSTBYNAME="1" + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi + +if test "$HAVE_GETHOSTBYNAME" != "1" +then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for gethostbyname in -lnetwork" >&5 +$as_echo_n "checking for gethostbyname in -lnetwork... " >&6; } +if test "${ac_cv_lib_network_gethostbyname+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lnetwork $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + +#ifdef __cplusplus +extern "C" +#endif +char gethostbyname (); +int main (void) +{ +return gethostbyname (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_lib_network_gethostbyname=yes +else + ac_cv_lib_network_gethostbyname=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_network_gethostbyname" >&5 +$as_echo "$ac_cv_lib_network_gethostbyname" >&6; } +if test "x$ac_cv_lib_network_gethostbyname" = x""yes; then : + HAVE_GETHOSTBYNAME="1" + LIBS="$LIBS -lnetwork" + +fi + +fi + +if test "$HAVE_GETHOSTBYNAME" != "1" +then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for gethostbyname in -lnet" >&5 +$as_echo_n "checking for gethostbyname in -lnet... " >&6; } +if test "${ac_cv_lib_net_gethostbyname+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lnet $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + +#ifdef __cplusplus +extern "C" +#endif +char gethostbyname (); +int main (void) +{ +return gethostbyname (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_lib_net_gethostbyname=yes +else + ac_cv_lib_net_gethostbyname=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_net_gethostbyname" >&5 +$as_echo "$ac_cv_lib_net_gethostbyname" >&6; } +if test "x$ac_cv_lib_net_gethostbyname" = x""yes; then : + HAVE_GETHOSTBYNAME="1" + LIBS="$LIBS -lnet" + +fi + +fi + + +if test "$HAVE_GETHOSTBYNAME" != "1"; then + as_fn_error $? "couldn't find libraries for gethostbyname()" "$LINENO" 5 +fi + +ac_fn_c_check_func "$LINENO" "strcasecmp" "ac_cv_func_strcasecmp" +if test "x$ac_cv_func_strcasecmp" = x""yes; then : + +else + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for strcasecmp in -lresolve" >&5 +$as_echo_n "checking for strcasecmp in -lresolve... " >&6; } +if test "${ac_cv_lib_resolve_strcasecmp+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lresolve $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + +#ifdef __cplusplus +extern "C" +#endif +char strcasecmp (); +int main (void) +{ +return strcasecmp (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_lib_resolve_strcasecmp=yes +else + ac_cv_lib_resolve_strcasecmp=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_resolve_strcasecmp" >&5 +$as_echo "$ac_cv_lib_resolve_strcasecmp" >&6; } +if test "x$ac_cv_lib_resolve_strcasecmp" = x""yes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_LIBRESOLVE 1 +_ACEOF + + LIBS="-lresolve $LIBS" + +fi + +fi + + +if test "$ac_cv_lib_resolve_strcasecmp" = "$ac_cv_func_strcasecmp"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for strcasecmp in -lresolve" >&5 +$as_echo_n "checking for strcasecmp in -lresolve... " >&6; } +if test "${ac_cv_lib_resolve_strcasecmp+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lresolve -lnsl $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + +#ifdef __cplusplus +extern "C" +#endif +char strcasecmp (); +int main (void) +{ +return strcasecmp (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_lib_resolve_strcasecmp=yes +else + ac_cv_lib_resolve_strcasecmp=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_resolve_strcasecmp" >&5 +$as_echo "$ac_cv_lib_resolve_strcasecmp" >&6; } +if test "x$ac_cv_lib_resolve_strcasecmp" = x""yes; then : + LIBS="-lresolve $LIBS" +fi + +fi +ac_cv_func_strcasecmp="no" + + +curl_includes_winsock2="\ +/* includes start */ +#ifdef HAVE_WINDOWS_H +# ifndef WIN32_LEAN_AND_MEAN +# define WIN32_LEAN_AND_MEAN +# endif +# include +# ifdef HAVE_WINSOCK2_H +# include +# else +# ifdef HAVE_WINSOCK_H +# include +# endif +# endif +#endif +/* includes end */" + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for windows.h" >&5 +$as_echo_n "checking for windows.h... " >&6; } +if test "${ac_cv_header_windows_h+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + +#undef inline +#ifndef WIN32_LEAN_AND_MEAN +#define WIN32_LEAN_AND_MEAN +#endif +#include + +int main (void) +{ + +#if defined(__CYGWIN__) || defined(__CEGCC__) + HAVE_WINDOWS_H shall not be defined. +#else + int dummy=2*WINVER; +#endif + + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + + ac_cv_header_windows_h="yes" + +else + + ac_cv_header_windows_h="no" + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_windows_h" >&5 +$as_echo "$ac_cv_header_windows_h" >&6; } + case "$ac_cv_header_windows_h" in + yes) + +cat >>confdefs.h <<_ACEOF +#define HAVE_WINDOWS_H 1 +_ACEOF + + +cat >>confdefs.h <<_ACEOF +#define WIN32_LEAN_AND_MEAN 1 +_ACEOF + + ;; + esac + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for winsock.h" >&5 +$as_echo_n "checking for winsock.h... " >&6; } +if test "${ac_cv_header_winsock_h+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + +#undef inline +#ifndef WIN32_LEAN_AND_MEAN +#define WIN32_LEAN_AND_MEAN +#endif +#include +#include + +int main (void) +{ + +#if defined(__CYGWIN__) || defined(__CEGCC__) + HAVE_WINSOCK_H shall not be defined. +#else + int dummy=WSACleanup(); +#endif + + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + + ac_cv_header_winsock_h="yes" + +else + + ac_cv_header_winsock_h="no" + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_winsock_h" >&5 +$as_echo "$ac_cv_header_winsock_h" >&6; } + case "$ac_cv_header_winsock_h" in + yes) + +cat >>confdefs.h <<_ACEOF +#define HAVE_WINSOCK_H 1 +_ACEOF + + ;; + esac + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for winsock2.h" >&5 +$as_echo_n "checking for winsock2.h... " >&6; } +if test "${ac_cv_header_winsock2_h+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + +#undef inline +#ifndef WIN32_LEAN_AND_MEAN +#define WIN32_LEAN_AND_MEAN +#endif +#include +#include + +int main (void) +{ + +#if defined(__CYGWIN__) || defined(__CEGCC__) || defined(__MINGW32CE__) + HAVE_WINSOCK2_H shall not be defined. +#else + int dummy=2*IPPROTO_ESP; +#endif + + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + + ac_cv_header_winsock2_h="yes" + +else + + ac_cv_header_winsock2_h="no" + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_winsock2_h" >&5 +$as_echo "$ac_cv_header_winsock2_h" >&6; } + case "$ac_cv_header_winsock2_h" in + yes) + +cat >>confdefs.h <<_ACEOF +#define HAVE_WINSOCK2_H 1 +_ACEOF + + ;; + esac + + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for connect in libraries" >&5 +$as_echo_n "checking for connect in libraries... " >&6; } + tst_connect_save_LIBS="$LIBS" + tst_connect_need_LIBS="unknown" + for tst_lib in '' '-lsocket' ; do + if test "$tst_connect_need_LIBS" = "unknown"; then + LIBS="$tst_lib $tst_connect_save_LIBS" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + + $curl_includes_winsock2 + #ifndef HAVE_WINDOWS_H + int connect(int, void*, int); + #endif + +int main (void) +{ + + if(0 != connect(0, 0, 0)) + return 1; + + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + + tst_connect_need_LIBS="$tst_lib" + +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + fi + done + LIBS="$tst_connect_save_LIBS" + # + case X-"$tst_connect_need_LIBS" in + X-unknown) + { $as_echo "$as_me:${as_lineno-$LINENO}: result: cannot find connect" >&5 +$as_echo "cannot find connect" >&6; } + as_fn_error $? "cannot find connect function in libraries." "$LINENO" 5 + ;; + X-) + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + ;; + *) + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $tst_connect_need_LIBS" >&5 +$as_echo "$tst_connect_need_LIBS" >&6; } + LIBS="$tst_connect_need_LIBS $tst_connect_save_LIBS" + ;; + esac + + +CURL_NETWORK_LIBS=$LIBS + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether time.h and sys/time.h may both be included" >&5 +$as_echo_n "checking whether time.h and sys/time.h may both be included... " >&6; } +if test "${ac_cv_header_time+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +#include +#include + +int main (void) +{ +if ((struct tm *) 0) +return 0; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_header_time=yes +else + ac_cv_header_time=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_time" >&5 +$as_echo "$ac_cv_header_time" >&6; } +if test $ac_cv_header_time = yes; then + +$as_echo "#define TIME_WITH_SYS_TIME 1" >>confdefs.h + +fi + + + for ac_header in sys/types.h sys/time.h time.h +do : + as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` +ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" +if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : + cat >>confdefs.h <<_ACEOF +#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + +done + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for monotonic clock_gettime" >&5 +$as_echo_n "checking for monotonic clock_gettime... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + +#ifdef HAVE_SYS_TYPES_H +#include +#endif +#ifdef HAVE_SYS_TIME_H +#include +#ifdef TIME_WITH_SYS_TIME +#include +#endif +#else +#ifdef HAVE_TIME_H +#include +#endif +#endif + +int main (void) +{ + + struct timespec ts; + (void)clock_gettime(CLOCK_MONOTONIC, &ts); + + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + ac_cv_func_clock_gettime="yes" + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + ac_cv_func_clock_gettime="no" + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + + + # + if test "$ac_cv_func_clock_gettime" = "yes"; then + # + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for clock_gettime in libraries" >&5 +$as_echo_n "checking for clock_gettime in libraries... " >&6; } + # + curl_cv_save_LIBS="$LIBS" + curl_cv_gclk_LIBS="unknown" + # + for x_xlibs in '' '-lrt' '-lposix4' ; do + if test "$curl_cv_gclk_LIBS" = "unknown"; then + if test -z "$x_xlibs"; then + LIBS="$curl_cv_save_LIBS" + else + LIBS="$x_xlibs $curl_cv_save_LIBS" + fi + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + +#ifdef HAVE_SYS_TYPES_H +#include +#endif +#ifdef HAVE_SYS_TIME_H +#include +#ifdef TIME_WITH_SYS_TIME +#include +#endif +#else +#ifdef HAVE_TIME_H +#include +#endif +#endif + +int main (void) +{ + + struct timespec ts; + (void)clock_gettime(CLOCK_MONOTONIC, &ts); + + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + + curl_cv_gclk_LIBS="$x_xlibs" + +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + fi + done + # + LIBS="$curl_cv_save_LIBS" + # + case X-"$curl_cv_gclk_LIBS" in + X-unknown) + { $as_echo "$as_me:${as_lineno-$LINENO}: result: cannot find clock_gettime" >&5 +$as_echo "cannot find clock_gettime" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: HAVE_CLOCK_GETTIME_MONOTONIC will not be defined" >&5 +$as_echo "$as_me: WARNING: HAVE_CLOCK_GETTIME_MONOTONIC will not be defined" >&2;} + ac_cv_func_clock_gettime="no" + ;; + X-) + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no additional lib required" >&5 +$as_echo "no additional lib required" >&6; } + ac_cv_func_clock_gettime="yes" + ;; + *) + if test -z "$curl_cv_save_LIBS"; then + LIBS="$curl_cv_gclk_LIBS" + else + LIBS="$curl_cv_gclk_LIBS $curl_cv_save_LIBS" + fi + CURL_LIBS="$CURL_LIBS $curl_cv_gclk_LIBS" + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $curl_cv_gclk_LIBS" >&5 +$as_echo "$curl_cv_gclk_LIBS" >&6; } + ac_cv_func_clock_gettime="yes" + ;; + esac + # + if test "x$cross_compiling" != "xyes" && + test "$ac_cv_func_clock_gettime" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if monotonic clock_gettime works" >&5 +$as_echo_n "checking if monotonic clock_gettime works... " >&6; } + if test "$cross_compiling" = yes; then : + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "cannot run test program while cross compiling +See \`config.log' for more details" "$LINENO" 5 ; } +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + +#ifdef HAVE_STDLIB_H +#include +#endif +#ifdef HAVE_SYS_TYPES_H +#include +#endif +#ifdef HAVE_SYS_TIME_H +#include +#ifdef TIME_WITH_SYS_TIME +#include +#endif +#else +#ifdef HAVE_TIME_H +#include +#endif +#endif + +int main (void) +{ + + struct timespec ts; + if (0 == clock_gettime(CLOCK_MONOTONIC, &ts)) + exit(0); + else + exit(1); + + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_run "$LINENO"; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: HAVE_CLOCK_GETTIME_MONOTONIC will not be defined" >&5 +$as_echo "$as_me: WARNING: HAVE_CLOCK_GETTIME_MONOTONIC will not be defined" >&2;} + ac_cv_func_clock_gettime="no" + LIBS="$curl_cv_save_LIBS" + +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext +fi + + fi + # + case "$ac_cv_func_clock_gettime" in + yes) + +cat >>confdefs.h <<_ACEOF +#define HAVE_CLOCK_GETTIME_MONOTONIC 1 +_ACEOF + + ;; + esac + # + fi + # + + +TEST_SERVER_LIBS=$LIBS + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to use libgcc" >&5 +$as_echo_n "checking whether to use libgcc... " >&6; } +# Check whether --enable-libgcc was given. +if test "${enable_libgcc+set}" = set; then : + enableval=$enable_libgcc; case "$enableval" in + yes) + ALL_LIBS="$ALL_LIBS -lgcc" + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + ;; + *) { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + ;; + esac +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + +fi + + + +LDAPLIBNAME="" + +# Check whether --with-ldap-lib was given. +if test "${with_ldap_lib+set}" = set; then : + withval=$with_ldap_lib; LDAPLIBNAME="$withval" +fi + + +LBERLIBNAME="" + +# Check whether --with-lber-lib was given. +if test "${with_lber_lib+set}" = set; then : + withval=$with_lber_lib; LBERLIBNAME="$withval" +fi + + +if test x$CURL_DISABLE_LDAP != x1 ; then + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for lber.h" >&5 +$as_echo_n "checking for lber.h... " >&6; } +if test "${ac_cv_header_lber_h+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + +#undef inline +#ifdef HAVE_WINDOWS_H +#ifndef WIN32_LEAN_AND_MEAN +#define WIN32_LEAN_AND_MEAN +#endif +#include +#else +#ifdef HAVE_SYS_TYPES_H +#include +#endif +#endif +#ifndef NULL +#define NULL (void *)0 +#endif +#include + +int main (void) +{ + + BerValue *bvp = NULL; + BerElement *bep = ber_init(bvp); + ber_free(bep, 1); + + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + + ac_cv_header_lber_h="yes" + +else + + ac_cv_header_lber_h="no" + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_lber_h" >&5 +$as_echo "$ac_cv_header_lber_h" >&6; } + if test "$ac_cv_header_lber_h" = "yes"; then + +cat >>confdefs.h <<_ACEOF +#define HAVE_LBER_H 1 +_ACEOF + + # + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + +#undef inline +#ifdef HAVE_WINDOWS_H +#ifndef WIN32_LEAN_AND_MEAN +#define WIN32_LEAN_AND_MEAN +#endif +#include +#else +#ifdef HAVE_SYS_TYPES_H +#include +#endif +#endif +#ifndef NULL +#define NULL (void *)0 +#endif +#ifndef LDAP_DEPRECATED +#define LDAP_DEPRECATED 1 +#endif +#include + +int main (void) +{ + + BerValue *bvp = NULL; + BerElement *bep = ber_init(bvp); + ber_free(bep, 1); + + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + + curl_cv_need_header_lber_h="no" + +else + + curl_cv_need_header_lber_h="yes" + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + # + case "$curl_cv_need_header_lber_h" in + yes) + +cat >>confdefs.h <<_ACEOF +#define NEED_LBER_H 1 +_ACEOF + + ;; + esac + fi + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ldap.h" >&5 +$as_echo_n "checking for ldap.h... " >&6; } +if test "${ac_cv_header_ldap_h+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + +#undef inline +#ifdef HAVE_WINDOWS_H +#ifndef WIN32_LEAN_AND_MEAN +#define WIN32_LEAN_AND_MEAN +#endif +#include +#else +#ifdef HAVE_SYS_TYPES_H +#include +#endif +#endif +#ifndef LDAP_DEPRECATED +#define LDAP_DEPRECATED 1 +#endif +#ifdef NEED_LBER_H +#include +#endif +#include + +int main (void) +{ + + LDAP *ldp = ldap_init("dummy", LDAP_PORT); + int res = ldap_unbind(ldp); + + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + + ac_cv_header_ldap_h="yes" + +else + + ac_cv_header_ldap_h="no" + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_ldap_h" >&5 +$as_echo "$ac_cv_header_ldap_h" >&6; } + case "$ac_cv_header_ldap_h" in + yes) + +cat >>confdefs.h <<_ACEOF +#define HAVE_LDAP_H 1 +_ACEOF + + ;; + esac + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ldapssl.h" >&5 +$as_echo_n "checking for ldapssl.h... " >&6; } +if test "${ac_cv_header_ldapssl_h+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + +#undef inline +#ifdef HAVE_WINDOWS_H +#ifndef WIN32_LEAN_AND_MEAN +#define WIN32_LEAN_AND_MEAN +#endif +#include +#else +#ifdef HAVE_SYS_TYPES_H +#include +#endif +#endif +#ifndef NULL +#define NULL (void *)0 +#endif +#ifndef LDAP_DEPRECATED +#define LDAP_DEPRECATED 1 +#endif +#ifdef NEED_LBER_H +#include +#endif +#ifdef HAVE_LDAP_H +#include +#endif +#include + +int main (void) +{ + + char *cert_label = NULL; + LDAP *ldp = ldap_ssl_init("dummy", LDAPS_PORT, cert_label); + + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + + ac_cv_header_ldapssl_h="yes" + +else + + ac_cv_header_ldapssl_h="no" + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_ldapssl_h" >&5 +$as_echo "$ac_cv_header_ldapssl_h" >&6; } + case "$ac_cv_header_ldapssl_h" in + yes) + +cat >>confdefs.h <<_ACEOF +#define HAVE_LDAPSSL_H 1 +_ACEOF + + ;; + esac + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ldap_ssl.h" >&5 +$as_echo_n "checking for ldap_ssl.h... " >&6; } +if test "${ac_cv_header_ldap_ssl_h+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + +#undef inline +#ifdef HAVE_WINDOWS_H +#ifndef WIN32_LEAN_AND_MEAN +#define WIN32_LEAN_AND_MEAN +#endif +#include +#else +#ifdef HAVE_SYS_TYPES_H +#include +#endif +#endif +#ifndef LDAP_DEPRECATED +#define LDAP_DEPRECATED 1 +#endif +#ifdef NEED_LBER_H +#include +#endif +#ifdef HAVE_LDAP_H +#include +#endif +#include + +int main (void) +{ + + LDAP *ldp = ldapssl_init("dummy", LDAPS_PORT, 1); + + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + + ac_cv_header_ldap_ssl_h="yes" + +else + + ac_cv_header_ldap_ssl_h="no" + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_ldap_ssl_h" >&5 +$as_echo "$ac_cv_header_ldap_ssl_h" >&6; } + case "$ac_cv_header_ldap_ssl_h" in + yes) + +cat >>confdefs.h <<_ACEOF +#define HAVE_LDAP_SSL_H 1 +_ACEOF + + ;; + esac + + + if test -z "$LDAPLIBNAME" ; then + if test "$ac_cv_native_windows" = "yes"; then + LDAPLIBNAME="wldap32" + LBERLIBNAME="no" + fi + fi + + if test "$LDAPLIBNAME" ; then + as_ac_Lib=`$as_echo "ac_cv_lib_"$LDAPLIBNAME"''_ldap_init" | $as_tr_sh` +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ldap_init in -l\"$LDAPLIBNAME\"" >&5 +$as_echo_n "checking for ldap_init in -l\"$LDAPLIBNAME\"... " >&6; } +if eval "test \"\${$as_ac_Lib+set}\"" = set; then : + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-l"$LDAPLIBNAME" $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + +#ifdef __cplusplus +extern "C" +#endif +char ldap_init (); +int main (void) +{ +return ldap_init (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + eval "$as_ac_Lib=yes" +else + eval "$as_ac_Lib=no" +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +eval ac_res=\$$as_ac_Lib + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } +if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then : + cat >>confdefs.h <<_ACEOF +#define `$as_echo "HAVE_LIB"$LDAPLIBNAME"" | $as_tr_cpp` 1 +_ACEOF + + LIBS="-l"$LDAPLIBNAME" $LIBS" + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: \"$LDAPLIBNAME\" is not an LDAP library: LDAP disabled" >&5 +$as_echo "$as_me: WARNING: \"$LDAPLIBNAME\" is not an LDAP library: LDAP disabled" >&2;} + +$as_echo "#define CURL_DISABLE_LDAP 1" >>confdefs.h + + CURL_DISABLE_LDAP=1 + +fi + + +$as_echo "#define CURL_DISABLE_LDAPS 1" >>confdefs.h + + CURL_DISABLE_LDAPS=1 + + else + + # + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for LDAP libraries" >&5 +$as_echo_n "checking for LDAP libraries... " >&6; } + # + u_libs="" + # + + # + curl_cv_save_LIBS="$LIBS" + curl_cv_ldap_LIBS="unknown" + # + for x_nlibs in '' "$u_libs" \ + '-lldap' \ + '-llber -lldap' \ + '-lldap -llber' \ + '-lldapssl -lldapx -lldapsdk' \ + '-lldapsdk -lldapx -lldapssl' ; do + if test "$curl_cv_ldap_LIBS" = "unknown"; then + if test -z "$x_nlibs"; then + LIBS="$curl_cv_save_LIBS" + else + LIBS="$x_nlibs $curl_cv_save_LIBS" + fi + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + +#undef inline +#ifdef HAVE_WINDOWS_H +#ifndef WIN32_LEAN_AND_MEAN +#define WIN32_LEAN_AND_MEAN +#endif +#include +#else +#ifdef HAVE_SYS_TYPES_H +#include +#endif +#endif +#ifndef NULL +#define NULL (void *)0 +#endif +#ifndef LDAP_DEPRECATED +#define LDAP_DEPRECATED 1 +#endif +#ifdef NEED_LBER_H +#include +#endif +#ifdef HAVE_LDAP_H +#include +#endif + +int main (void) +{ + + BerValue *bvp = NULL; + BerElement *bep = ber_init(bvp); + LDAP *ldp = ldap_init("dummy", LDAP_PORT); + int res = ldap_unbind(ldp); + ber_free(bep, 1); + + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + + curl_cv_ldap_LIBS="$x_nlibs" + +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + fi + done + # + LIBS="$curl_cv_save_LIBS" + # + case X-"$curl_cv_ldap_LIBS" in + X-unknown) + { $as_echo "$as_me:${as_lineno-$LINENO}: result: cannot find LDAP libraries" >&5 +$as_echo "cannot find LDAP libraries" >&6; } + ;; + X-) + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no additional lib required" >&5 +$as_echo "no additional lib required" >&6; } + ;; + *) + if test -z "$curl_cv_save_LIBS"; then + LIBS="$curl_cv_ldap_LIBS" + else + LIBS="$curl_cv_ldap_LIBS $curl_cv_save_LIBS" + fi + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $curl_cv_ldap_LIBS" >&5 +$as_echo "$curl_cv_ldap_LIBS" >&6; } + ;; + esac + # + + case X-"$curl_cv_ldap_LIBS" in + X-unknown) + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Cannot find libraries for LDAP support: LDAP disabled" >&5 +$as_echo "$as_me: WARNING: Cannot find libraries for LDAP support: LDAP disabled" >&2;} + +$as_echo "#define CURL_DISABLE_LDAP 1" >>confdefs.h + + CURL_DISABLE_LDAP=1 + + +$as_echo "#define CURL_DISABLE_LDAPS 1" >>confdefs.h + + CURL_DISABLE_LDAPS=1 + + ;; + esac + fi +fi + +if test x$CURL_DISABLE_LDAP != x1 ; then + + if test "$LBERLIBNAME" ; then + if test "$LBERLIBNAME" != "no" ; then + as_ac_Lib=`$as_echo "ac_cv_lib_"$LBERLIBNAME"''_ber_free" | $as_tr_sh` +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ber_free in -l\"$LBERLIBNAME\"" >&5 +$as_echo_n "checking for ber_free in -l\"$LBERLIBNAME\"... " >&6; } +if eval "test \"\${$as_ac_Lib+set}\"" = set; then : + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-l"$LBERLIBNAME" $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + +#ifdef __cplusplus +extern "C" +#endif +char ber_free (); +int main (void) +{ +return ber_free (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + eval "$as_ac_Lib=yes" +else + eval "$as_ac_Lib=no" +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +eval ac_res=\$$as_ac_Lib + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } +if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then : + cat >>confdefs.h <<_ACEOF +#define `$as_echo "HAVE_LIB"$LBERLIBNAME"" | $as_tr_cpp` 1 +_ACEOF + + LIBS="-l"$LBERLIBNAME" $LIBS" + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: \"$LBERLIBNAME\" is not an LBER library: LDAP disabled" >&5 +$as_echo "$as_me: WARNING: \"$LBERLIBNAME\" is not an LBER library: LDAP disabled" >&2;} + +$as_echo "#define CURL_DISABLE_LDAP 1" >>confdefs.h + + CURL_DISABLE_LDAP=1 + +fi + + +$as_echo "#define CURL_DISABLE_LDAPS 1" >>confdefs.h + + CURL_DISABLE_LDAPS=1 + + fi + fi +fi + +if test x$CURL_DISABLE_LDAP != x1 ; then + for ac_func in ldap_url_parse ldap_init_fd +do : + as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` +ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" +if eval test \"x\$"$as_ac_var"\" = x"yes"; then : + cat >>confdefs.h <<_ACEOF +#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 +_ACEOF + +fi +done + + + if test "$LDAPLIBNAME" = "wldap32"; then + curl_ldap_msg="enabled (winldap)" + +$as_echo "#define CURL_LDAP_WIN 1" >>confdefs.h + + else + curl_ldap_msg="enabled (OpenLDAP)" + if test "x$ac_cv_func_ldap_init_fd" = "xyes"; then + +$as_echo "#define USE_OPENLDAP 1" >>confdefs.h + + USE_OPENLDAP=1 + + fi + fi +fi + +if test x$CURL_DISABLE_LDAPS != x1 ; then + curl_ldaps_msg="enabled" +fi + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to enable ipv6" >&5 +$as_echo_n "checking whether to enable ipv6... " >&6; } +# Check whether --enable-ipv6 was given. +if test "${enable_ipv6+set}" = set; then : + enableval=$enable_ipv6; case "$enableval" in + no) + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + ipv6=no + ;; + *) { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + ipv6=yes + ;; + esac +else + if test "$cross_compiling" = yes; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + ipv6=no + +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + /* is AF_INET6 available? */ +#include +#include +main() +{ + if (socket(AF_INET6, SOCK_STREAM, 0) < 0) + exit(1); + else + exit(0); +} + +_ACEOF +if ac_fn_c_try_run "$LINENO"; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + ipv6=yes +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + ipv6=no +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext +fi + +fi + + +if test "$ipv6" = "yes"; then + curl_ipv6_msg="enabled" +fi + +# Check if struct sockaddr_in6 have sin6_scope_id member +if test "$ipv6" = yes; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if struct sockaddr_in6 has sin6_scope_id member" >&5 +$as_echo_n "checking if struct sockaddr_in6 has sin6_scope_id member... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#include +#include +int main (void) +{ +struct sockaddr_in6 s; s.sin6_scope_id = 0; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + have_sin6_scope_id=yes +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + if test "$have_sin6_scope_id" = yes; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + +$as_echo "#define HAVE_SOCKADDR_IN6_SIN6_SCOPE_ID 1" >>confdefs.h + + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + fi +fi + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if argv can be written to" >&5 +$as_echo_n "checking if argv can be written to... " >&6; } +if test "$cross_compiling" = yes; then : + + curl_cv_writable_argv=cross + +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + +int main(int argc, char ** argv) { + argv[0][0] = ' '; + return (argv[0][0] == ' ')?0:1; +} + + +_ACEOF +if ac_fn_c_try_run "$LINENO"; then : + + curl_cv_writable_argv=yes + +else + + curl_cv_writable_argv=no + +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext +fi + +case $curl_cv_writable_argv in +yes) + +$as_echo "#define HAVE_WRITABLE_ARGV 1" >>confdefs.h + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + ;; +no) + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + ;; +*) + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: the previous check could not be made default was used" >&5 +$as_echo "$as_me: WARNING: the previous check could not be made default was used" >&2;} + ;; +esac + + + +# Check whether --with-krb4-includes was given. +if test "${with_krb4_includes+set}" = set; then : + withval=$with_krb4_includes; + CPPFLAGS="$CPPFLAGS -I$withval" + KRB4INC="$withval" + want_krb4=yes + +fi + + + +# Check whether --with-krb4-libs was given. +if test "${with_krb4_libs+set}" = set; then : + withval=$with_krb4_libs; + LDFLAGS="$LDFLAGS -L$withval" + KRB4LIB="$withval" + want_krb4=yes + +fi + + + +OPT_KRB4=off + +# Check whether --with-krb4 was given. +if test "${with_krb4+set}" = set; then : + withval=$with_krb4; + OPT_KRB4="$withval" + if test X"$OPT_KRB4" != Xno; then + want_krb4="yes" + if test X"$OPT_KRB4" != Xyes; then + LDFLAGS="$LDFLAGS -L$OPT_KRB4/lib$libsuff" + KRB4LIB="$OPT_KRB4/lib$libsuff" + CPPFLAGS="$CPPFLAGS -I$OPT_KRB4/include" + KRB4INC="$OPT_KRB4/include" + fi + fi + +fi + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if Kerberos4 support is requested" >&5 +$as_echo_n "checking if Kerberos4 support is requested... " >&6; } + +if test "$want_krb4" = yes +then + if test "$ipv6" = "yes"; then + echo krb4 is not compatible with IPv6 + exit 1 + fi + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking where to look for Kerberos4" >&5 +$as_echo_n "checking where to look for Kerberos4... " >&6; } + if test X"$OPT_KRB4" = Xyes + then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: defaults" >&5 +$as_echo "defaults" >&6; } + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: libs in $KRB4LIB, headers in $KRB4INC" >&5 +$as_echo "libs in $KRB4LIB, headers in $KRB4INC" >&6; } + fi + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for des_pcbc_encrypt in -ldes" >&5 +$as_echo_n "checking for des_pcbc_encrypt in -ldes... " >&6; } +if test "${ac_cv_lib_des_des_pcbc_encrypt+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-ldes $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + +#ifdef __cplusplus +extern "C" +#endif +char des_pcbc_encrypt (); +int main (void) +{ +return des_pcbc_encrypt (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_lib_des_des_pcbc_encrypt=yes +else + ac_cv_lib_des_des_pcbc_encrypt=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_des_des_pcbc_encrypt" >&5 +$as_echo "$ac_cv_lib_des_des_pcbc_encrypt" >&6; } +if test "x$ac_cv_lib_des_des_pcbc_encrypt" = x""yes; then : + + for ac_header in des.h +do : + ac_fn_c_check_header_mongrel "$LINENO" "des.h" "ac_cv_header_des_h" "$ac_includes_default" +if test "x$ac_cv_header_des_h" = x""yes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_DES_H 1 +_ACEOF + +fi + +done + + + ac_fn_c_check_func "$LINENO" "res_search" "ac_cv_func_res_search" +if test "x$ac_cv_func_res_search" = x""yes; then : + +else + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for res_search in -lresolv" >&5 +$as_echo_n "checking for res_search in -lresolv... " >&6; } +if test "${ac_cv_lib_resolv_res_search+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lresolv $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + +#ifdef __cplusplus +extern "C" +#endif +char res_search (); +int main (void) +{ +return res_search (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_lib_resolv_res_search=yes +else + ac_cv_lib_resolv_res_search=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_resolv_res_search" >&5 +$as_echo "$ac_cv_lib_resolv_res_search" >&6; } +if test "x$ac_cv_lib_resolv_res_search" = x""yes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_LIBRESOLV 1 +_ACEOF + + LIBS="-lresolv $LIBS" + +fi + +fi + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for krb_net_read in -lkrb" >&5 +$as_echo_n "checking for krb_net_read in -lkrb... " >&6; } +if test "${ac_cv_lib_krb_krb_net_read+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lkrb $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + +#ifdef __cplusplus +extern "C" +#endif +char krb_net_read (); +int main (void) +{ +return krb_net_read (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_lib_krb_krb_net_read=yes +else + ac_cv_lib_krb_krb_net_read=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_krb_krb_net_read" >&5 +$as_echo "$ac_cv_lib_krb_krb_net_read" >&6; } +if test "x$ac_cv_lib_krb_krb_net_read" = x""yes; then : + + for ac_header in krb.h +do : + ac_fn_c_check_header_mongrel "$LINENO" "krb.h" "ac_cv_header_krb_h" "$ac_includes_default" +if test "x$ac_cv_header_krb_h" = x""yes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_KRB_H 1 +_ACEOF + +fi + +done + + + LIBS="-lkrb -lcom_err -ldes $LIBS" + + for ac_func in krb_get_our_ip_for_realm +do : + ac_fn_c_check_func "$LINENO" "krb_get_our_ip_for_realm" "ac_cv_func_krb_get_our_ip_for_realm" +if test "x$ac_cv_func_krb_get_our_ip_for_realm" = x""yes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_KRB_GET_OUR_IP_FOR_REALM 1 +_ACEOF + +fi +done + + + +$as_echo "#define HAVE_KRB4 1" >>confdefs.h + + + KRB4_ENABLED=1 + + + curl_krb4_msg="enabled" + + for ac_func in strlcpy +do : + ac_fn_c_check_func "$LINENO" "strlcpy" "ac_cv_func_strlcpy" +if test "x$ac_cv_func_strlcpy" = x""yes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_STRLCPY 1 +_ACEOF + +fi +done + + + +fi + + +fi + +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + +# Check whether --with-spnego was given. +if test "${with_spnego+set}" = set; then : + withval=$with_spnego; + SPNEGO_ROOT="$withval" + if test x"$SPNEGO_ROOT" != xno; then + want_spnego="yes" + fi + +fi + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if SPNEGO support is requested" >&5 +$as_echo_n "checking if SPNEGO support is requested... " >&6; } +if test x"$want_spnego" = xyes; then + + if test X"$SPNEGO_ROOT" = Xyes; then + as_fn_error $? "FBOpenSSL libs and/or directories were not found where specified!" "$LINENO" 5 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + else + if test -z "$SPNEGO_LIB_DIR"; then + LDFLAGS="$LDFLAGS -L$SPNEGO_ROOT -lfbopenssl" + else + LDFLAGS="$LDFLAGS $SPNEGO_LIB_DIR" + fi + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + +$as_echo "#define HAVE_SPNEGO 1" >>confdefs.h + + curl_spnego_msg="enabled" + fi +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + +GSSAPI_ROOT="/usr" + +# Check whether --with-gssapi-includes was given. +if test "${with_gssapi_includes+set}" = set; then : + withval=$with_gssapi_includes; GSSAPI_INCS="-I$withval" + want_gss="yes" + +fi + + + +# Check whether --with-gssapi-libs was given. +if test "${with_gssapi_libs+set}" = set; then : + withval=$with_gssapi_libs; GSSAPI_LIB_DIR="-L$withval" + want_gss="yes" + +fi + + + +# Check whether --with-gssapi was given. +if test "${with_gssapi+set}" = set; then : + withval=$with_gssapi; + GSSAPI_ROOT="$withval" + if test x"$GSSAPI_ROOT" != xno; then + want_gss="yes" + if test x"$GSSAPI_ROOT" = xyes; then + GSSAPI_ROOT="/usr" + fi + fi + +fi + + +save_CPPFLAGS="$CPPFLAGS" +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if GSSAPI support is requested" >&5 +$as_echo_n "checking if GSSAPI support is requested... " >&6; } +if test x"$want_gss" = xyes; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + + if test -z "$GSSAPI_INCS"; then + if test -f "$GSSAPI_ROOT/bin/krb5-config"; then + GSSAPI_INCS=`$GSSAPI_ROOT/bin/krb5-config --cflags gssapi` + elif test "$GSSAPI_ROOT" != "yes"; then + GSSAPI_INCS="-I$GSSAPI_ROOT/include" + fi + fi + + CPPFLAGS="$CPPFLAGS $GSSAPI_INCS" + + ac_fn_c_check_header_mongrel "$LINENO" "gss.h" "ac_cv_header_gss_h" "$ac_includes_default" +if test "x$ac_cv_header_gss_h" = x""yes; then : + + +$as_echo "#define HAVE_GSSGNU 1" >>confdefs.h + + gnu_gss=yes + +else + + for ac_header in gssapi/gssapi.h +do : + ac_fn_c_check_header_mongrel "$LINENO" "gssapi/gssapi.h" "ac_cv_header_gssapi_gssapi_h" "$ac_includes_default" +if test "x$ac_cv_header_gssapi_gssapi_h" = x""yes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_GSSAPI_GSSAPI_H 1 +_ACEOF + +else + not_mit=1 +fi + +done + + for ac_header in gssapi/gssapi_generic.h gssapi/gssapi_krb5.h +do : + as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` +ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" " +$ac_includes_default +#ifdef HAVE_GSSAPI_GSSAPI_H +#include +#endif + +" +if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : + cat >>confdefs.h <<_ACEOF +#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +else + not_mit=1 +fi + +done + + if test "x$not_mit" = "x1"; then + ac_fn_c_check_header_mongrel "$LINENO" "gssapi.h" "ac_cv_header_gssapi_h" "$ac_includes_default" +if test "x$ac_cv_header_gssapi_h" = x""yes; then : + + +$as_echo "#define HAVE_GSSHEIMDAL 1" >>confdefs.h + + +else + + want_gss=no + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: disabling GSSAPI since no header files was found" >&5 +$as_echo "$as_me: WARNING: disabling GSSAPI since no header files was found" >&2;} + + +fi + + + else + +$as_echo "#define HAVE_GSSMIT 1" >>confdefs.h + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if gssapi headers declare GSS_C_NT_HOSTBASED_SERVICE" >&5 +$as_echo_n "checking if gssapi headers declare GSS_C_NT_HOSTBASED_SERVICE... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + +#include +#include +#include + +int main (void) +{ + + gss_import_name( + (OM_uint32 *)0, + (gss_buffer_t)0, + GSS_C_NT_HOSTBASED_SERVICE, + (gss_name_t *)0); + + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + +$as_echo "#define HAVE_OLD_GSSMIT 1" >>confdefs.h + + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + fi + + +fi + + +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi +if test x"$want_gss" = xyes; then + +$as_echo "#define HAVE_GSSAPI 1" >>confdefs.h + + + curl_gss_msg="enabled (MIT/Heimdal)" + + if test -n "$gnu_gss"; then + curl_gss_msg="enabled (GNU GSS)" + LDFLAGS="$LDFLAGS $GSSAPI_LIB_DIR" + LIBS="$LIBS -lgss" + elif test -z "$GSSAPI_LIB_DIR"; then + case $host in + *-*-darwin*) + LIBS="$LIBS -lgssapi_krb5 -lresolv" + ;; + *) + if test -f "$GSSAPI_ROOT/bin/krb5-config"; then + gss_libs=`$GSSAPI_ROOT/bin/krb5-config --libs gssapi` + LIBS="$LIBS $gss_libs" + elif test "$GSSAPI_ROOT" != "yes"; then + LDFLAGS="$LDFLAGS -L$GSSAPI_ROOT/lib$libsuff" + LIBS="$LIBS -lgssapi" + else + LIBS="$LIBS -lgssapi" + fi + ;; + esac + else + LDFLAGS="$LDFLAGS $GSSAPI_LIB_DIR" + LIBS="$LIBS -lgssapi" + fi +else + CPPFLAGS="$save_CPPFLAGS" +fi + + +OPT_SSL=off +ca="no" + +# Check whether --with-ssl was given. +if test "${with_ssl+set}" = set; then : + withval=$with_ssl; OPT_SSL=$withval +fi + + +if test X"$OPT_SSL" != Xno; then + CLEANLDFLAGS="$LDFLAGS" + CLEANCPPFLAGS="$CPPFLAGS" + CLEANLIBS="$LIBS" + + case "$OPT_SSL" in + yes) + if test x$cross_compiling != xyes; then + PKGTEST="yes" + fi + PREFIX_OPENSSL=/usr/local/ssl + LIB_OPENSSL="$PREFIX_OPENSSL/lib$libsuff" + ;; + off) + if test x$cross_compiling != xyes; then + PKGTEST="yes" + fi + PREFIX_OPENSSL= + ;; + *) + PKGTEST="no" + PREFIX_OPENSSL=$OPT_SSL + + OPENSSL_PCDIR="$OPT_SSL/lib/pkgconfig" + { $as_echo "$as_me:${as_lineno-$LINENO}: PKG_CONFIG_LIBDIR will be set to \"$OPENSSL_PCDIR\"" >&5 +$as_echo "$as_me: PKG_CONFIG_LIBDIR will be set to \"$OPENSSL_PCDIR\"" >&6;} + if test -e "$OPENSSL_PCDIR/openssl.pc"; then + PKGTEST="yes" + fi + + LIB_OPENSSL="$PREFIX_OPENSSL/lib$libsuff" + if test "$PREFIX_OPENSSL" != "/usr" ; then + SSL_LDFLAGS="-L$LIB_OPENSSL" + SSL_CPPFLAGS="-I$PREFIX_OPENSSL/include" + fi + SSL_CPPFLAGS="$SSL_CPPFLAGS -I$PREFIX_OPENSSL/include/openssl" + ;; + esac + + if test "$PKGTEST" = "yes"; then + + + + PKGCONFIG="no" + + if test x$cross_compiling = xyes; then + # Extract the first word of "${host}-pkg-config", so it can be a program name with args. +set dummy ${host}-pkg-config; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if test "${ac_cv_path_PKGCONFIG+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + case $PKGCONFIG in + [\\/]* | ?:[\\/]*) + ac_cv_path_PKGCONFIG="$PKGCONFIG" # Let the user override the test with a path. + ;; + *) + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +as_dummy="$PATH:/usr/bin:/usr/local/bin" +for as_dir in $as_dummy +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_path_PKGCONFIG="$as_dir/$ac_word$ac_exec_ext" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + + test -z "$ac_cv_path_PKGCONFIG" && ac_cv_path_PKGCONFIG="no" + ;; +esac +fi +PKGCONFIG=$ac_cv_path_PKGCONFIG +if test -n "$PKGCONFIG"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PKGCONFIG" >&5 +$as_echo "$PKGCONFIG" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + fi + + if test x$PKGCONFIG = xno; then + # Extract the first word of "pkg-config", so it can be a program name with args. +set dummy pkg-config; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if test "${ac_cv_path_PKGCONFIG+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + case $PKGCONFIG in + [\\/]* | ?:[\\/]*) + ac_cv_path_PKGCONFIG="$PKGCONFIG" # Let the user override the test with a path. + ;; + *) + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +as_dummy="$PATH:/usr/bin:/usr/local/bin" +for as_dir in $as_dummy +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_path_PKGCONFIG="$as_dir/$ac_word$ac_exec_ext" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + + test -z "$ac_cv_path_PKGCONFIG" && ac_cv_path_PKGCONFIG="no" + ;; +esac +fi +PKGCONFIG=$ac_cv_path_PKGCONFIG +if test -n "$PKGCONFIG"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PKGCONFIG" >&5 +$as_echo "$PKGCONFIG" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + fi + + if test x$PKGCONFIG != xno; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for openssl options with pkg-config" >&5 +$as_echo_n "checking for openssl options with pkg-config... " >&6; } + itexists=` + if test -n "$OPENSSL_PCDIR"; then + PKG_CONFIG_LIBDIR="$OPENSSL_PCDIR" + export PKG_CONFIG_LIBDIR + fi + $PKGCONFIG --exists openssl >/dev/null 2>&1 && echo 1` + + if test -z "$itexists"; then + PKGCONFIG="no" + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: found" >&5 +$as_echo "found" >&6; } + fi + fi + + + if test "$PKGCONFIG" != "no" ; then + SSL_LIBS=` + if test -n "$OPENSSL_PCDIR"; then + PKG_CONFIG_LIBDIR="$OPENSSL_PCDIR" + export PKG_CONFIG_LIBDIR + fi + $PKGCONFIG --libs-only-l openssl 2>/dev/null` + + SSL_LDFLAGS=` + if test -n "$OPENSSL_PCDIR"; then + PKG_CONFIG_LIBDIR="$OPENSSL_PCDIR" + export PKG_CONFIG_LIBDIR + fi + $PKGCONFIG --libs-only-L openssl 2>/dev/null` + + SSL_CPPFLAGS=` + if test -n "$OPENSSL_PCDIR"; then + PKG_CONFIG_LIBDIR="$OPENSSL_PCDIR" + export PKG_CONFIG_LIBDIR + fi + $PKGCONFIG --cflags-only-I openssl 2>/dev/null` + + { $as_echo "$as_me:${as_lineno-$LINENO}: pkg-config: SSL_LIBS: \"$SSL_LIBS\"" >&5 +$as_echo "$as_me: pkg-config: SSL_LIBS: \"$SSL_LIBS\"" >&6;} + { $as_echo "$as_me:${as_lineno-$LINENO}: pkg-config: SSL_LDFLAGS: \"$SSL_LDFLAGS\"" >&5 +$as_echo "$as_me: pkg-config: SSL_LDFLAGS: \"$SSL_LDFLAGS\"" >&6;} + { $as_echo "$as_me:${as_lineno-$LINENO}: pkg-config: SSL_CPPFLAGS: \"$SSL_CPPFLAGS\"" >&5 +$as_echo "$as_me: pkg-config: SSL_CPPFLAGS: \"$SSL_CPPFLAGS\"" >&6;} + + LIB_OPENSSL=`echo $SSL_LDFLAGS | sed -e 's/-L//g'` + + LIBS="$LIBS $SSL_LIBS" + fi + fi + + CPPFLAGS="$CPPFLAGS $SSL_CPPFLAGS" + LDFLAGS="$LDFLAGS $SSL_LDFLAGS" + + case $host in + *-*-msys* | *-*-mingw*) + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for gdi32" >&5 +$as_echo_n "checking for gdi32... " >&6; } + my_ac_save_LIBS=$LIBS + LIBS="-lgdi32 $LIBS" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + #include +int main (void) +{ +GdiFlush(); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } +else + LIBS=$my_ac_save_LIBS + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + ;; + esac + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for CRYPTO_lock in -lcrypto" >&5 +$as_echo_n "checking for CRYPTO_lock in -lcrypto... " >&6; } +if test "${ac_cv_lib_crypto_CRYPTO_lock+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lcrypto $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + +#ifdef __cplusplus +extern "C" +#endif +char CRYPTO_lock (); +int main (void) +{ +return CRYPTO_lock (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_lib_crypto_CRYPTO_lock=yes +else + ac_cv_lib_crypto_CRYPTO_lock=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_crypto_CRYPTO_lock" >&5 +$as_echo "$ac_cv_lib_crypto_CRYPTO_lock" >&6; } +if test "x$ac_cv_lib_crypto_CRYPTO_lock" = x""yes; then : + + HAVECRYPTO="yes" + LIBS="-lcrypto $LIBS" + +else + + LDFLAGS="$CLEANLDFLAGS -L$LIB_OPENSSL" + CPPFLAGS="$CLEANCPPFLAGS -I$PREFIX_OPENSSL/include/openssl -I$PREFIX_OPENSSL/include" + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for CRYPTO_add_lock in -lcrypto" >&5 +$as_echo_n "checking for CRYPTO_add_lock in -lcrypto... " >&6; } +if test "${ac_cv_lib_crypto_CRYPTO_add_lock+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lcrypto $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + +#ifdef __cplusplus +extern "C" +#endif +char CRYPTO_add_lock (); +int main (void) +{ +return CRYPTO_add_lock (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_lib_crypto_CRYPTO_add_lock=yes +else + ac_cv_lib_crypto_CRYPTO_add_lock=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_crypto_CRYPTO_add_lock" >&5 +$as_echo "$ac_cv_lib_crypto_CRYPTO_add_lock" >&6; } +if test "x$ac_cv_lib_crypto_CRYPTO_add_lock" = x""yes; then : + + HAVECRYPTO="yes" + LIBS="-lcrypto $LIBS" +else + + LDFLAGS="$CLEANLDFLAGS" + CPPFLAGS="$CLEANCPPFLAGS" + LIBS="$CLEANLIBS" + +fi + + +fi + + + + if test X"$HAVECRYPTO" = X"yes"; then + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for SSL_connect in -lssl" >&5 +$as_echo_n "checking for SSL_connect in -lssl... " >&6; } +if test "${ac_cv_lib_ssl_SSL_connect+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lssl $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + +#ifdef __cplusplus +extern "C" +#endif +char SSL_connect (); +int main (void) +{ +return SSL_connect (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_lib_ssl_SSL_connect=yes +else + ac_cv_lib_ssl_SSL_connect=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_ssl_SSL_connect" >&5 +$as_echo "$ac_cv_lib_ssl_SSL_connect" >&6; } +if test "x$ac_cv_lib_ssl_SSL_connect" = x""yes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_LIBSSL 1 +_ACEOF + + LIBS="-lssl $LIBS" + +fi + + + if test "$ac_cv_lib_ssl_SSL_connect" != yes; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ssl with RSAglue/rsaref libs in use" >&5 +$as_echo_n "checking for ssl with RSAglue/rsaref libs in use... " >&6; }; + OLIBS=$LIBS + LIBS="$LIBS -lRSAglue -lrsaref" + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for SSL_connect in -lssl" >&5 +$as_echo_n "checking for SSL_connect in -lssl... " >&6; } +if test "${ac_cv_lib_ssl_SSL_connect+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lssl $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + +#ifdef __cplusplus +extern "C" +#endif +char SSL_connect (); +int main (void) +{ +return SSL_connect (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_lib_ssl_SSL_connect=yes +else + ac_cv_lib_ssl_SSL_connect=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_ssl_SSL_connect" >&5 +$as_echo "$ac_cv_lib_ssl_SSL_connect" >&6; } +if test "x$ac_cv_lib_ssl_SSL_connect" = x""yes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_LIBSSL 1 +_ACEOF + + LIBS="-lssl $LIBS" + +fi + + if test "$ac_cv_lib_ssl_SSL_connect" != yes; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + LIBS=$OLIBS + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + fi + + else + + for ac_header in openssl/x509.h openssl/rsa.h openssl/crypto.h \ + openssl/pem.h openssl/ssl.h openssl/err.h +do : + as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` +ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" +if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : + cat >>confdefs.h <<_ACEOF +#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + curl_ssl_msg="enabled (OpenSSL)" + OPENSSL_ENABLED=1 + +$as_echo "#define USE_OPENSSL 1" >>confdefs.h + +fi + +done + + + if test $ac_cv_header_openssl_x509_h = no; then + for ac_header in x509.h rsa.h crypto.h pem.h ssl.h err.h +do : + as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` +ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" +if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : + cat >>confdefs.h <<_ACEOF +#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + +done + + + if test $ac_cv_header_x509_h = yes && + test $ac_cv_header_crypto_h = yes && + test $ac_cv_header_ssl_h = yes; then + curl_ssl_msg="enabled (OpenSSL)" + OPENSSL_ENABLED=1 + fi + fi + fi + + if test X"$OPENSSL_ENABLED" = X"1"; then + +$as_echo "#define USE_SSLEAY 1" >>confdefs.h + + + for ac_header in openssl/pkcs12.h +do : + ac_fn_c_check_header_mongrel "$LINENO" "openssl/pkcs12.h" "ac_cv_header_openssl_pkcs12_h" "$ac_includes_default" +if test "x$ac_cv_header_openssl_pkcs12_h" = x""yes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_OPENSSL_PKCS12_H 1 +_ACEOF + +fi + +done + + else + LIBS="$CLEANLIBS" + fi + USE_SSLEAY="$OPENSSL_ENABLED" + + + if test X"$OPT_SSL" != Xoff && + test "$OPENSSL_ENABLED" != "1"; then + as_fn_error $? "OpenSSL libs and/or directories were not found where specified!" "$LINENO" 5 + fi + fi + + if test X"$OPENSSL_ENABLED" = X"1"; then + ac_fn_c_check_func "$LINENO" "ENGINE_init" "ac_cv_func_ENGINE_init" +if test "x$ac_cv_func_ENGINE_init" = x""yes; then : + + for ac_header in openssl/engine.h +do : + ac_fn_c_check_header_mongrel "$LINENO" "openssl/engine.h" "ac_cv_header_openssl_engine_h" "$ac_includes_default" +if test "x$ac_cv_header_openssl_engine_h" = x""yes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_OPENSSL_ENGINE_H 1 +_ACEOF + +fi + +done + + for ac_func in ENGINE_load_builtin_engines +do : + as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` +ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" +if eval test \"x\$"$as_ac_var"\" = x"yes"; then : + cat >>confdefs.h <<_ACEOF +#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 +_ACEOF + +fi +done + + +fi + + + + for ac_func in RAND_status \ + RAND_screen \ + RAND_egd \ + ENGINE_cleanup \ + CRYPTO_cleanup_all_ex_data \ + SSL_get_shutdown +do : + as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` +ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" +if eval test \"x\$"$as_ac_var"\" = x"yes"; then : + cat >>confdefs.h <<_ACEOF +#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 +_ACEOF + +fi +done + + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for yaSSL using OpenSSL compatibility mode" >&5 +$as_echo_n "checking for yaSSL using OpenSSL compatibility mode... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + +#include + +int main (void) +{ + +#if defined(YASSL_VERSION) && defined(OPENSSL_VERSION_NUMBER) + int dummy = SSL_ERROR_NONE; +#else + Not the yaSSL OpenSSL compatibility header. +#endif + + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + +cat >>confdefs.h <<_ACEOF +#define USE_YASSLEMUL 1 +_ACEOF + + curl_ssl_msg="enabled (OpenSSL emulation by yaSSL)" + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + fi + + if test "$OPENSSL_ENABLED" = "1"; then + if test -n "$LIB_OPENSSL"; then + + LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$LIB_OPENSSL" + export LD_LIBRARY_PATH + { $as_echo "$as_me:${as_lineno-$LINENO}: Added $LIB_OPENSSL to LD_LIBRARY_PATH" >&5 +$as_echo "$as_me: Added $LIB_OPENSSL to LD_LIBRARY_PATH" >&6;} + fi + fi + +fi + + + +_cppflags=$CPPFLAGS +_ldflags=$LDFLAGS + +# Check whether --with-zlib was given. +if test "${with_zlib+set}" = set; then : + withval=$with_zlib; OPT_ZLIB="$withval" +fi + + +if test "$OPT_ZLIB" = "no" ; then + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: zlib disabled" >&5 +$as_echo "$as_me: WARNING: zlib disabled" >&2;} +else + if test "$OPT_ZLIB" = "yes" ; then + OPT_ZLIB="" + fi + + if test -z "$OPT_ZLIB" ; then + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for inflateEnd in -lz" >&5 +$as_echo_n "checking for inflateEnd in -lz... " >&6; } +if test "${ac_cv_lib_z_inflateEnd+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lz $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + +#ifdef __cplusplus +extern "C" +#endif +char inflateEnd (); +int main (void) +{ +return inflateEnd (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_lib_z_inflateEnd=yes +else + ac_cv_lib_z_inflateEnd=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_z_inflateEnd" >&5 +$as_echo "$ac_cv_lib_z_inflateEnd" >&6; } +if test "x$ac_cv_lib_z_inflateEnd" = x""yes; then : + HAVE_LIBZ="1" +else + OPT_ZLIB="/usr/local" +fi + + + fi + + if test -n "$OPT_ZLIB"; then + CPPFLAGS="$CPPFLAGS -I$OPT_ZLIB/include" + LDFLAGS="$LDFLAGS -L$OPT_ZLIB/lib$libsuff" + fi + + ac_fn_c_check_header_mongrel "$LINENO" "zlib.h" "ac_cv_header_zlib_h" "$ac_includes_default" +if test "x$ac_cv_header_zlib_h" = x""yes; then : + + HAVE_ZLIB_H="1" + if test "$HAVE_LIBZ" != "1"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for gzread in -lz" >&5 +$as_echo_n "checking for gzread in -lz... " >&6; } +if test "${ac_cv_lib_z_gzread+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lz $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + +#ifdef __cplusplus +extern "C" +#endif +char gzread (); +int main (void) +{ +return gzread (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_lib_z_gzread=yes +else + ac_cv_lib_z_gzread=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_z_gzread" >&5 +$as_echo "$ac_cv_lib_z_gzread" >&6; } +if test "x$ac_cv_lib_z_gzread" = x""yes; then : + + HAVE_LIBZ="1" + +else + CPPFLAGS=$_cppflags + LDFLAGS=$_ldflags +fi + + fi + +else + + CPPFLAGS=$_cppflags + LDFLAGS=$_ldflags + +fi + + + + if test "$HAVE_LIBZ" = "1" && test "$HAVE_ZLIB_H" != "1" + then + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: configure found only the libz lib, not the header file!" >&5 +$as_echo "$as_me: WARNING: configure found only the libz lib, not the header file!" >&2;} + HAVE_LIBZ="" + elif test "$HAVE_LIBZ" != "1" && test "$HAVE_ZLIB_H" = "1" + then + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: configure found only the libz header file, not the lib!" >&5 +$as_echo "$as_me: WARNING: configure found only the libz header file, not the lib!" >&2;} + elif test "$HAVE_LIBZ" = "1" && test "$HAVE_ZLIB_H" = "1" + then + + +$as_echo "#define HAVE_ZLIB_H 1" >>confdefs.h + + +$as_echo "#define HAVE_LIBZ 1" >>confdefs.h + + + CURL_LIBS="$CURL_LIBS -lz" + LIBS="$LIBS -lz" + + AMFIXLIB="1" + { $as_echo "$as_me:${as_lineno-$LINENO}: found both libz and libz.h header" >&5 +$as_echo "$as_me: found both libz and libz.h header" >&6;} + curl_zlib_msg="enabled" + fi +fi + + + +if test x"$AMFIXLIB" = x1; then + HAVE_LIBZ_TRUE= + HAVE_LIBZ_FALSE='#' +else + HAVE_LIBZ_TRUE='#' + HAVE_LIBZ_FALSE= +fi + + + +if test X"$OPENSSL_ENABLED" = X"1"; then + +# Check whether --with-egd-socket was given. +if test "${with_egd_socket+set}" = set; then : + withval=$with_egd_socket; EGD_SOCKET="$withval" + +fi + + if test -n "$EGD_SOCKET" ; then + +cat >>confdefs.h <<_ACEOF +#define EGD_SOCKET "$EGD_SOCKET" +_ACEOF + + fi + + +# Check whether --with-random was given. +if test "${with_random+set}" = set; then : + withval=$with_random; RANDOM_FILE="$withval" +else + + as_ac_File=`$as_echo "ac_cv_file_"/dev/urandom"" | $as_tr_sh` +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for \"/dev/urandom\"" >&5 +$as_echo_n "checking for \"/dev/urandom\"... " >&6; } +if eval "test \"\${$as_ac_File+set}\"" = set; then : + $as_echo_n "(cached) " >&6 +else + test "$cross_compiling" = yes && + as_fn_error $? "cannot check for file existence when cross compiling" "$LINENO" 5 +if test -r ""/dev/urandom""; then + eval "$as_ac_File=yes" +else + eval "$as_ac_File=no" +fi +fi +eval ac_res=\$$as_ac_File + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } +if eval test \"x\$"$as_ac_File"\" = x"yes"; then : + RANDOM_FILE="/dev/urandom" +fi + + + +fi + + if test -n "$RANDOM_FILE" && test X"$RANDOM_FILE" != Xno ; then + + +cat >>confdefs.h <<_ACEOF +#define RANDOM_FILE "$RANDOM_FILE" +_ACEOF + + fi +fi + + +OPT_GNUTLS=no + + +# Check whether --with-gnutls was given. +if test "${with_gnutls+set}" = set; then : + withval=$with_gnutls; OPT_GNUTLS=$withval +fi + + +if test "$OPENSSL_ENABLED" != "1"; then + + if test X"$OPT_GNUTLS" != Xno; then + + addld="" + if test "x$OPT_GNUTLS" = "xyes"; then + + + PKGCONFIG="no" + + if test x$cross_compiling = xyes; then + # Extract the first word of "${host}-pkg-config", so it can be a program name with args. +set dummy ${host}-pkg-config; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if test "${ac_cv_path_PKGCONFIG+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + case $PKGCONFIG in + [\\/]* | ?:[\\/]*) + ac_cv_path_PKGCONFIG="$PKGCONFIG" # Let the user override the test with a path. + ;; + *) + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +as_dummy="$PATH:/usr/bin:/usr/local/bin" +for as_dir in $as_dummy +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_path_PKGCONFIG="$as_dir/$ac_word$ac_exec_ext" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + + test -z "$ac_cv_path_PKGCONFIG" && ac_cv_path_PKGCONFIG="no" + ;; +esac +fi +PKGCONFIG=$ac_cv_path_PKGCONFIG +if test -n "$PKGCONFIG"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PKGCONFIG" >&5 +$as_echo "$PKGCONFIG" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + fi + + if test x$PKGCONFIG = xno; then + # Extract the first word of "pkg-config", so it can be a program name with args. +set dummy pkg-config; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if test "${ac_cv_path_PKGCONFIG+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + case $PKGCONFIG in + [\\/]* | ?:[\\/]*) + ac_cv_path_PKGCONFIG="$PKGCONFIG" # Let the user override the test with a path. + ;; + *) + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +as_dummy="$PATH:/usr/bin:/usr/local/bin" +for as_dir in $as_dummy +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_path_PKGCONFIG="$as_dir/$ac_word$ac_exec_ext" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + + test -z "$ac_cv_path_PKGCONFIG" && ac_cv_path_PKGCONFIG="no" + ;; +esac +fi +PKGCONFIG=$ac_cv_path_PKGCONFIG +if test -n "$PKGCONFIG"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PKGCONFIG" >&5 +$as_echo "$PKGCONFIG" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + fi + + if test x$PKGCONFIG != xno; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for gnutls options with pkg-config" >&5 +$as_echo_n "checking for gnutls options with pkg-config... " >&6; } + itexists=` + if test -n ""; then + PKG_CONFIG_LIBDIR="" + export PKG_CONFIG_LIBDIR + fi + $PKGCONFIG --exists gnutls >/dev/null 2>&1 && echo 1` + + if test -z "$itexists"; then + PKGCONFIG="no" + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: found" >&5 +$as_echo "found" >&6; } + fi + fi + + + if test "$PKGCONFIG" != "no" ; then + addlib=`$PKGCONFIG --libs-only-l gnutls` + addld=`$PKGCONFIG --libs-only-L gnutls` + addcflags=`$PKGCONFIG --cflags-only-I gnutls` + version=`$PKGCONFIG --modversion gnutls` + gtlslib=`echo $addld | $SED -e 's/-L//'` + else + check=`libgnutls-config --version 2>/dev/null` + if test -n "$check"; then + addlib=`libgnutls-config --libs` + addcflags=`libgnutls-config --cflags` + version=`libgnutls-config --version` + gtlslib=`libgnutls-config --prefix`/lib$libsuff + fi + fi + else + cfg=$OPT_GNUTLS/bin/libgnutls-config + check=`$cfg --version 2>/dev/null` + if test -n "$check"; then + addlib=`$cfg --libs` + addcflags=`$cfg --cflags` + version=`$cfg --version` + gtlslib=`$cfg --prefix`/lib$libsuff + else + addlib=-lgnutls + addld=-L$OPT_GNUTLS/lib$libsuff + addcflags=-I$OPT_GNUTLS/include + version="" # we just don't know + gtlslib=$OPT_GNUTLS/lib$libsuff + fi + fi + + if test -z "$version"; then + version="unknown" + fi + + if test -n "$addlib"; then + + CLEANLIBS="$LIBS" + CLEANCPPFLAGS="$CPPFLAGS" + CLEADLDFLAGS="$LDFLAGS" + + LIBS="$LIBS $addlib" + LDFLAGS="$LDFLAGS $addld" + if test "$addcflags" != "-I/usr/include"; then + CPPFLAGS="$CPPFLAGS $addcflags" + fi + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for gnutls_check_version in -lgnutls" >&5 +$as_echo_n "checking for gnutls_check_version in -lgnutls... " >&6; } +if test "${ac_cv_lib_gnutls_gnutls_check_version+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lgnutls $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + +#ifdef __cplusplus +extern "C" +#endif +char gnutls_check_version (); +int main (void) +{ +return gnutls_check_version (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_lib_gnutls_gnutls_check_version=yes +else + ac_cv_lib_gnutls_gnutls_check_version=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_gnutls_gnutls_check_version" >&5 +$as_echo "$ac_cv_lib_gnutls_gnutls_check_version" >&6; } +if test "x$ac_cv_lib_gnutls_gnutls_check_version" = x""yes; then : + + +$as_echo "#define USE_GNUTLS 1" >>confdefs.h + + USE_GNUTLS=1 + + GNUTLS_ENABLED=1 + USE_GNUTLS="yes" + curl_ssl_msg="enabled (GnuTLS)" + +else + + LIBS="$CLEANLIBS" + CPPFLAGS="$CLEANCPPFLAGS" + +fi + + + if test "x$USE_GNUTLS" = "xyes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: detected GnuTLS version $version" >&5 +$as_echo "$as_me: detected GnuTLS version $version" >&6;} + + if test -n "$gtlslib"; then + + LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$gtlslib" + export LD_LIBRARY_PATH + { $as_echo "$as_me:${as_lineno-$LINENO}: Added $gtlslib to LD_LIBRARY_PATH" >&5 +$as_echo "$as_me: Added $gtlslib to LD_LIBRARY_PATH" >&6;} + fi + fi + + fi + + fi +fi + +if test "$GNUTLS_ENABLED" = "1"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for gcry_control in -lgcrypt" >&5 +$as_echo_n "checking for gcry_control in -lgcrypt... " >&6; } +if test "${ac_cv_lib_gcrypt_gcry_control+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lgcrypt $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + +#ifdef __cplusplus +extern "C" +#endif +char gcry_control (); +int main (void) +{ +return gcry_control (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_lib_gcrypt_gcry_control=yes +else + ac_cv_lib_gcrypt_gcry_control=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_gcrypt_gcry_control" >&5 +$as_echo "$ac_cv_lib_gcrypt_gcry_control" >&6; } +if test "x$ac_cv_lib_gcrypt_gcry_control" = x""yes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_LIBGCRYPT 1 +_ACEOF + + LIBS="-lgcrypt $LIBS" + +else + + as_fn_error $? "need GnuTLS built with gcrypt to function with GnuTLS" "$LINENO" 5 + +fi + +fi + + +OPT_POLARSSL=no + +_cppflags=$CPPFLAGS +_ldflags=$LDFLAGS + +# Check whether --with-polarssl was given. +if test "${with_polarssl+set}" = set; then : + withval=$with_polarssl; OPT_POLARSSL=$withval +fi + + +if test "$OPENSSL_ENABLED" != "1"; then + + if test X"$OPT_POLARSSL" != Xno; then + + if test "$OPT_POLARSSL" = "yes"; then + OPT_POLARSSL="" + fi + + if test -z "$OPT_POLARSSL" ; then + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for havege_init in -lpolarssl" >&5 +$as_echo_n "checking for havege_init in -lpolarssl... " >&6; } +if test "${ac_cv_lib_polarssl_havege_init+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lpolarssl $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + +#ifdef __cplusplus +extern "C" +#endif +char havege_init (); +int main (void) +{ +return havege_init (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_lib_polarssl_havege_init=yes +else + ac_cv_lib_polarssl_havege_init=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_polarssl_havege_init" >&5 +$as_echo "$ac_cv_lib_polarssl_havege_init" >&6; } +if test "x$ac_cv_lib_polarssl_havege_init" = x""yes; then : + + +$as_echo "#define USE_POLARSSL 1" >>confdefs.h + + USE_POLARSSL=1 + + POLARSSL_ENABLED=1 + USE_POLARSSL="yes" + curl_ssl_msg="enabled (PolarSSL)" + +fi + + fi + + if test "x$USE_POLARSSL" != "xyes"; then + addld=-L$OPT_POLARSSL/lib$libsuff + addcflags=-I$OPT_POLARSSL/include + polarssllib=$OPT_POLARSSL/lib$libsuff + + LDFLAGS="$LDFLAGS $addld" + if test "$addcflags" != "-I/usr/include"; then + CPPFLAGS="$CPPFLAGS $addcflags" + fi + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ssl_init in -lpolarssl" >&5 +$as_echo_n "checking for ssl_init in -lpolarssl... " >&6; } +if test "${ac_cv_lib_polarssl_ssl_init+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lpolarssl $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + +#ifdef __cplusplus +extern "C" +#endif +char ssl_init (); +int main (void) +{ +return ssl_init (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_lib_polarssl_ssl_init=yes +else + ac_cv_lib_polarssl_ssl_init=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_polarssl_ssl_init" >&5 +$as_echo "$ac_cv_lib_polarssl_ssl_init" >&6; } +if test "x$ac_cv_lib_polarssl_ssl_init" = x""yes; then : + + +$as_echo "#define USE_POLARSSL 1" >>confdefs.h + + USE_POLARSSL=1 + + POLARSSL_ENABLED=1 + USE_POLARSSL="yes" + curl_ssl_msg="enabled (PolarSSL)" + +else + + CPPFLAGS=$_cppflags + LDFLAGS=$_ldflags + +fi + + fi + + if test "x$USE_POLARSSL" = "xyes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: detected PolarSSL" >&5 +$as_echo "$as_me: detected PolarSSL" >&6;} + + CURL_LIBS="$CURL_LIBS -lpolarssl" + LIBS="$LIBS -lpolarssl" + + if test -n "$polarssllib"; then + + LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$polarssllib" + export LD_LIBRARY_PATH + { $as_echo "$as_me:${as_lineno-$LINENO}: Added $polarssllib to LD_LIBRARY_PATH" >&5 +$as_echo "$as_me: Added $polarssllib to LD_LIBRARY_PATH" >&6;} + fi + + fi + + fi +fi + +OPT_NSS=no + + +# Check whether --with-nss was given. +if test "${with_nss+set}" = set; then : + withval=$with_nss; OPT_NSS=$withval +fi + + +if test "$OPENSSL_ENABLED" != "1" -a "$GNUTLS_ENABLED" != "1"; then + + if test X"$OPT_NSS" != Xno; then + if test "x$OPT_NSS" = "xyes"; then + + + + PKGCONFIG="no" + + if test x$cross_compiling = xyes; then + # Extract the first word of "${host}-pkg-config", so it can be a program name with args. +set dummy ${host}-pkg-config; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if test "${ac_cv_path_PKGCONFIG+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + case $PKGCONFIG in + [\\/]* | ?:[\\/]*) + ac_cv_path_PKGCONFIG="$PKGCONFIG" # Let the user override the test with a path. + ;; + *) + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +as_dummy="$PATH:/usr/bin:/usr/local/bin" +for as_dir in $as_dummy +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_path_PKGCONFIG="$as_dir/$ac_word$ac_exec_ext" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + + test -z "$ac_cv_path_PKGCONFIG" && ac_cv_path_PKGCONFIG="no" + ;; +esac +fi +PKGCONFIG=$ac_cv_path_PKGCONFIG +if test -n "$PKGCONFIG"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PKGCONFIG" >&5 +$as_echo "$PKGCONFIG" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + fi + + if test x$PKGCONFIG = xno; then + # Extract the first word of "pkg-config", so it can be a program name with args. +set dummy pkg-config; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if test "${ac_cv_path_PKGCONFIG+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + case $PKGCONFIG in + [\\/]* | ?:[\\/]*) + ac_cv_path_PKGCONFIG="$PKGCONFIG" # Let the user override the test with a path. + ;; + *) + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +as_dummy="$PATH:/usr/bin:/usr/local/bin" +for as_dir in $as_dummy +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_path_PKGCONFIG="$as_dir/$ac_word$ac_exec_ext" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + + test -z "$ac_cv_path_PKGCONFIG" && ac_cv_path_PKGCONFIG="no" + ;; +esac +fi +PKGCONFIG=$ac_cv_path_PKGCONFIG +if test -n "$PKGCONFIG"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PKGCONFIG" >&5 +$as_echo "$PKGCONFIG" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + fi + + if test x$PKGCONFIG != xno; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for nss options with pkg-config" >&5 +$as_echo_n "checking for nss options with pkg-config... " >&6; } + itexists=` + if test -n ""; then + PKG_CONFIG_LIBDIR="" + export PKG_CONFIG_LIBDIR + fi + $PKGCONFIG --exists nss >/dev/null 2>&1 && echo 1` + + if test -z "$itexists"; then + PKGCONFIG="no" + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: found" >&5 +$as_echo "found" >&6; } + fi + fi + + + if test "$PKGCONFIG" != "no" ; then + addlib=`$PKGCONFIG --libs nss` + addcflags=`$PKGCONFIG --cflags nss` + version=`$PKGCONFIG --modversion nss` + nssprefix=`$PKGCONFIG --variable=prefix nss` + else + + check=`nss-config --version 2>/dev/null` + if test -n "$check"; then + addlib=`nss-config --libs` + addcflags=`nss-config --cflags` + version=`nss-config --version` + nssprefix=`nss-config --prefix` + else + addlib="-lnss3" + addcflags="" + version="unknown" + fi + fi + else + # Without pkg-config, we'll kludge in some defaults + addlib="-L$OPT_NSS/lib -lssl3 -lsmime3 -lnss3 -lplds4 -lplc4 -lnspr4 -lpthread -ldl" + addcflags="-I$OPT_NSS/include" + version="unknown" + nssprefix=$OPT_NSS + fi + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for PK11_CreateGenericObject in -lnss3" >&5 +$as_echo_n "checking for PK11_CreateGenericObject in -lnss3... " >&6; } +if test "${ac_cv_lib_nss3_PK11_CreateGenericObject+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lnss3 $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + +#ifdef __cplusplus +extern "C" +#endif +char PK11_CreateGenericObject (); +int main (void) +{ +return PK11_CreateGenericObject (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_lib_nss3_PK11_CreateGenericObject=yes +else + ac_cv_lib_nss3_PK11_CreateGenericObject=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_nss3_PK11_CreateGenericObject" >&5 +$as_echo "$ac_cv_lib_nss3_PK11_CreateGenericObject" >&6; } +if test "x$ac_cv_lib_nss3_PK11_CreateGenericObject" = x""yes; then : + + +$as_echo "#define HAVE_PK11_CREATEGENERICOBJECT 1" >>confdefs.h + + HAVE_PK11_CREATEGENERICOBJECT=1 + + +fi + + if test -n "$addlib"; then + + CLEANLIBS="$LIBS" + CLEANCPPFLAGS="$CPPFLAGS" + + LIBS="$LIBS $addlib" + if test "$addcflags" != "-I/usr/include"; then + CPPFLAGS="$CPPFLAGS $addcflags" + fi + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for NSS_Initialize in -lnss3" >&5 +$as_echo_n "checking for NSS_Initialize in -lnss3... " >&6; } +if test "${ac_cv_lib_nss3_NSS_Initialize+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lnss3 $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + +#ifdef __cplusplus +extern "C" +#endif +char NSS_Initialize (); +int main (void) +{ +return NSS_Initialize (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_lib_nss3_NSS_Initialize=yes +else + ac_cv_lib_nss3_NSS_Initialize=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_nss3_NSS_Initialize" >&5 +$as_echo "$ac_cv_lib_nss3_NSS_Initialize" >&6; } +if test "x$ac_cv_lib_nss3_NSS_Initialize" = x""yes; then : + + +$as_echo "#define USE_NSS 1" >>confdefs.h + + USE_NSS=1 + + USE_NSS="yes" + NSS_ENABLED=1 + curl_ssl_msg="enabled (NSS)" + +else + + LIBS="$CLEANLIBS" + CPPFLAGS="$CLEANCPPFLAGS" + +fi + + + if test "x$USE_NSS" = "xyes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: detected NSS version $version" >&5 +$as_echo "$as_me: detected NSS version $version" >&6;} + + + LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$nssprefix/lib$libsuff" + export LD_LIBRARY_PATH + { $as_echo "$as_me:${as_lineno-$LINENO}: Added $nssprefix/lib$libsuff to LD_LIBRARY_PATH" >&5 +$as_echo "$as_me: Added $nssprefix/lib$libsuff to LD_LIBRARY_PATH" >&6;} + fi + + fi + + fi +fi +if test "x$OPENSSL_ENABLED$GNUTLS_ENABLED$NSS_ENABLED$POLARSSL_ENABLED" = "x"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: SSL disabled, you will not be able to use HTTPS, FTPS, NTLM and more." >&5 +$as_echo "$as_me: WARNING: SSL disabled, you will not be able to use HTTPS, FTPS, NTLM and more." >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Use --with-ssl, --with-gnutls, --with-polarssl or --with-nss to address this." >&5 +$as_echo "$as_me: WARNING: Use --with-ssl, --with-gnutls, --with-polarssl or --with-nss to address this." >&2;} +else + # SSL is enabled, genericly + + SSL_ENABLED="1" +fi + + + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking default CA cert bundle/path" >&5 +$as_echo_n "checking default CA cert bundle/path... " >&6; } + + +# Check whether --with-ca-bundle was given. +if test "${with_ca_bundle+set}" = set; then : + withval=$with_ca_bundle; + want_ca="$withval" + if test "x$want_ca" = "xyes"; then + as_fn_error $? "--with-ca-bundle=FILE requires a path to the CA bundle" "$LINENO" 5 + fi + +else + want_ca="unset" +fi + + +# Check whether --with-ca-path was given. +if test "${with_ca_path+set}" = set; then : + withval=$with_ca_path; + want_capath="$withval" + if test "x$want_capath" = "xyes"; then + as_fn_error $? "--with-ca-path=DIRECTORY requires a path to the CA path directory" "$LINENO" 5 + fi + +else + want_capath="unset" +fi + + + if test "x$want_ca" != "xno" -a "x$want_ca" != "xunset" -a \ + "x$want_capath" != "xno" -a "x$want_capath" != "xunset"; then + as_fn_error $? "Can't specify both --with-ca-bundle and --with-ca-path." "$LINENO" 5 + elif test "x$want_ca" != "xno" -a "x$want_ca" != "xunset"; then + ca="$want_ca" + capath="no" + elif test "x$want_capath" != "xno" -a "x$want_capath" != "xunset"; then + if test "x$OPENSSL_ENABLED" != "x1"; then + as_fn_error $? "--with-ca-path only works with openSSL" "$LINENO" 5 + fi + capath="$want_capath" + ca="no" + else + ca="no" + capath="no" + if test "x$want_ca" = "xunset"; then + if test "x$prefix" != xNONE; then + cac="${prefix}/share/curl/curl-ca-bundle.crt" + else + cac="$ac_default_prefix/share/curl/curl-ca-bundle.crt" + fi + + for a in /etc/ssl/certs/ca-certificates.crt \ + /etc/pki/tls/certs/ca-bundle.crt \ + /usr/share/ssl/certs/ca-bundle.crt \ + /usr/local/share/certs/ca-root.crt \ + /etc/ssl/cert.pem \ + "$cac"; do + if test -f "$a"; then + ca="$a" + break + fi + done + fi + if test "x$want_capath" = "xunset" -a "x$ca" = "xno" -a \ + "x$OPENSSL_ENABLED" = "x1"; then + for a in /etc/ssl/certs/; do + if test -d "$a" && ls "$a"/[0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f].0 >/dev/null 2>/dev/null; then + capath="$a" + break + fi + done + fi + fi + + + + if test "x$ca" != "xno"; then + CURL_CA_BUNDLE='"'$ca'"' + +cat >>confdefs.h <<_ACEOF +#define CURL_CA_BUNDLE "$ca" +_ACEOF + + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ca" >&5 +$as_echo "$ca" >&6; } + elif test "x$capath" != "xno"; then + CURL_CA_PATH="\"$capath\"" + +cat >>confdefs.h <<_ACEOF +#define CURL_CA_PATH "$capath" +_ACEOF + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $capath (capath)" >&5 +$as_echo "$capath (capath)" >&6; } + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + fi + + + +OPT_LIBSSH2=off + +# Check whether --with-libssh2 was given. +if test "${with_libssh2+set}" = set; then : + withval=$with_libssh2; OPT_LIBSSH2=$withval +fi + + +if test X"$OPT_LIBSSH2" != Xno; then + CLEANLDFLAGS="$LDFLAGS" + CLEANCPPFLAGS="$CPPFLAGS" + CLEANLIBS="$LIBS" + + case "$OPT_LIBSSH2" in + yes) + + + PKGCONFIG="no" + + if test x$cross_compiling = xyes; then + # Extract the first word of "${host}-pkg-config", so it can be a program name with args. +set dummy ${host}-pkg-config; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if test "${ac_cv_path_PKGCONFIG+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + case $PKGCONFIG in + [\\/]* | ?:[\\/]*) + ac_cv_path_PKGCONFIG="$PKGCONFIG" # Let the user override the test with a path. + ;; + *) + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +as_dummy="$PATH:/usr/bin:/usr/local/bin" +for as_dir in $as_dummy +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_path_PKGCONFIG="$as_dir/$ac_word$ac_exec_ext" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + + test -z "$ac_cv_path_PKGCONFIG" && ac_cv_path_PKGCONFIG="no" + ;; +esac +fi +PKGCONFIG=$ac_cv_path_PKGCONFIG +if test -n "$PKGCONFIG"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PKGCONFIG" >&5 +$as_echo "$PKGCONFIG" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + fi + + if test x$PKGCONFIG = xno; then + # Extract the first word of "pkg-config", so it can be a program name with args. +set dummy pkg-config; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if test "${ac_cv_path_PKGCONFIG+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + case $PKGCONFIG in + [\\/]* | ?:[\\/]*) + ac_cv_path_PKGCONFIG="$PKGCONFIG" # Let the user override the test with a path. + ;; + *) + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +as_dummy="$PATH:/usr/bin:/usr/local/bin" +for as_dir in $as_dummy +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_path_PKGCONFIG="$as_dir/$ac_word$ac_exec_ext" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + + test -z "$ac_cv_path_PKGCONFIG" && ac_cv_path_PKGCONFIG="no" + ;; +esac +fi +PKGCONFIG=$ac_cv_path_PKGCONFIG +if test -n "$PKGCONFIG"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PKGCONFIG" >&5 +$as_echo "$PKGCONFIG" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + fi + + if test x$PKGCONFIG != xno; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for libssh2 options with pkg-config" >&5 +$as_echo_n "checking for libssh2 options with pkg-config... " >&6; } + itexists=` + if test -n ""; then + PKG_CONFIG_LIBDIR="" + export PKG_CONFIG_LIBDIR + fi + $PKGCONFIG --exists libssh2 >/dev/null 2>&1 && echo 1` + + if test -z "$itexists"; then + PKGCONFIG="no" + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: found" >&5 +$as_echo "found" >&6; } + fi + fi + + + if test "$PKGCONFIG" != "no" ; then + LIB_SSH2=`$PKGCONFIG --libs-only-l libssh2` + LD_SSH2=`$PKGCONFIG --libs-only-L libssh2` + CPP_SSH2=`$PKGCONFIG --cflags-only-I libssh2` + version=`$PKGCONFIG --modversion libssh2` + DIR_SSH2=`echo $LD_SSH2 | $SED -e 's/-L//'` + fi + + ;; + off) + ;; + *) + PREFIX_SSH2=$OPT_LIBSSH2 + ;; + esac + + if test -n "$PREFIX_SSH2"; then + LD_SSH2=-L${PREFIX_SSH2}/lib$libsuff + CPP_SSH2=-I${PREFIX_SSH2}/include + DIR_SSH2=${PREFIX_SSH2}/lib$libsuff + fi + + LDFLAGS="$LDFLAGS $LD_SSH2" + CPPFLAGS="$CPPFLAGS $CPP_SSH2" + LIBS="$LIBS $LIB_SSH2" + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for libssh2_channel_open_ex in -lssh2" >&5 +$as_echo_n "checking for libssh2_channel_open_ex in -lssh2... " >&6; } +if test "${ac_cv_lib_ssh2_libssh2_channel_open_ex+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lssh2 $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + +#ifdef __cplusplus +extern "C" +#endif +char libssh2_channel_open_ex (); +int main (void) +{ +return libssh2_channel_open_ex (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_lib_ssh2_libssh2_channel_open_ex=yes +else + ac_cv_lib_ssh2_libssh2_channel_open_ex=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_ssh2_libssh2_channel_open_ex" >&5 +$as_echo "$ac_cv_lib_ssh2_libssh2_channel_open_ex" >&6; } +if test "x$ac_cv_lib_ssh2_libssh2_channel_open_ex" = x""yes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_LIBSSH2 1 +_ACEOF + + LIBS="-lssh2 $LIBS" + +fi + + + for ac_header in libssh2.h +do : + ac_fn_c_check_header_mongrel "$LINENO" "libssh2.h" "ac_cv_header_libssh2_h" "$ac_includes_default" +if test "x$ac_cv_header_libssh2_h" = x""yes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_LIBSSH2_H 1 +_ACEOF + curl_ssh_msg="enabled (libSSH2)" + LIBSSH2_ENABLED=1 + +$as_echo "#define USE_LIBSSH2 1" >>confdefs.h + + USE_LIBSSH2=1 + + +fi + +done + + + if test X"$OPT_LIBSSH2" != Xoff && + test "$LIBSSH2_ENABLED" != "1"; then + as_fn_error $? "libSSH2 libs and/or directories were not found where specified!" "$LINENO" 5 + fi + + if test "$LIBSSH2_ENABLED" = "1"; then + if test -n "$DIR_SSH2"; then + + for ac_func in libssh2_version libssh2_init libssh2_exit \ + libssh2_scp_send64 libssh2_session_handshake +do : + as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` +ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" +if eval test \"x\$"$as_ac_var"\" = x"yes"; then : + cat >>confdefs.h <<_ACEOF +#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 +_ACEOF + +fi +done + + + LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$DIR_SSH2" + export LD_LIBRARY_PATH + { $as_echo "$as_me:${as_lineno-$LINENO}: Added $DIR_SSH2 to LD_LIBRARY_PATH" >&5 +$as_echo "$as_me: Added $DIR_SSH2 to LD_LIBRARY_PATH" >&6;} + fi + else + LDFLAGS=$CLEANLDFLAGS + CPPFLAGS=$CLEANCPPFLAGS + LIBS=$CLEANLIBS + fi +fi + + +OPT_LIBRTMP=off + +# Check whether --with-librtmp was given. +if test "${with_librtmp+set}" = set; then : + withval=$with_librtmp; OPT_LIBRTMP=$withval +fi + + +if test X"$OPT_LIBRTMP" != Xno; then + CLEANLDFLAGS="$LDFLAGS" + CLEANCPPFLAGS="$CPPFLAGS" + CLEANLIBS="$LIBS" + + case "$OPT_LIBRTMP" in + yes) + + + PKGCONFIG="no" + + if test x$cross_compiling = xyes; then + # Extract the first word of "${host}-pkg-config", so it can be a program name with args. +set dummy ${host}-pkg-config; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if test "${ac_cv_path_PKGCONFIG+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + case $PKGCONFIG in + [\\/]* | ?:[\\/]*) + ac_cv_path_PKGCONFIG="$PKGCONFIG" # Let the user override the test with a path. + ;; + *) + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +as_dummy="$PATH:/usr/bin:/usr/local/bin" +for as_dir in $as_dummy +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_path_PKGCONFIG="$as_dir/$ac_word$ac_exec_ext" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + + test -z "$ac_cv_path_PKGCONFIG" && ac_cv_path_PKGCONFIG="no" + ;; +esac +fi +PKGCONFIG=$ac_cv_path_PKGCONFIG +if test -n "$PKGCONFIG"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PKGCONFIG" >&5 +$as_echo "$PKGCONFIG" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + fi + + if test x$PKGCONFIG = xno; then + # Extract the first word of "pkg-config", so it can be a program name with args. +set dummy pkg-config; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if test "${ac_cv_path_PKGCONFIG+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + case $PKGCONFIG in + [\\/]* | ?:[\\/]*) + ac_cv_path_PKGCONFIG="$PKGCONFIG" # Let the user override the test with a path. + ;; + *) + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +as_dummy="$PATH:/usr/bin:/usr/local/bin" +for as_dir in $as_dummy +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_path_PKGCONFIG="$as_dir/$ac_word$ac_exec_ext" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + + test -z "$ac_cv_path_PKGCONFIG" && ac_cv_path_PKGCONFIG="no" + ;; +esac +fi +PKGCONFIG=$ac_cv_path_PKGCONFIG +if test -n "$PKGCONFIG"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PKGCONFIG" >&5 +$as_echo "$PKGCONFIG" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + fi + + if test x$PKGCONFIG != xno; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for librtmp options with pkg-config" >&5 +$as_echo_n "checking for librtmp options with pkg-config... " >&6; } + itexists=` + if test -n ""; then + PKG_CONFIG_LIBDIR="" + export PKG_CONFIG_LIBDIR + fi + $PKGCONFIG --exists librtmp >/dev/null 2>&1 && echo 1` + + if test -z "$itexists"; then + PKGCONFIG="no" + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: found" >&5 +$as_echo "found" >&6; } + fi + fi + + + if test "$PKGCONFIG" != "no" ; then + LIB_RTMP=`$PKGCONFIG --libs-only-l librtmp` + LD_RTMP=`$PKGCONFIG --libs-only-L librtmp` + CPP_RTMP=`$PKGCONFIG --cflags-only-I librtmp` + version=`$PKGCONFIG --modversion librtmp` + DIR_RTMP=`echo $LD_RTMP | $SED -e 's/-L//'` + else + as_fn_error $? "--librtmp was specified but could not find librtmp pkgconfig file." "$LINENO" 5 + fi + + ;; + off) + LIB_RTMP="-lrtmp" + ;; + *) + PREFIX_RTMP=$OPT_LIBRTMP + ;; + esac + + if test -n "$PREFIX_RTMP"; then + LD_RTMP=-L${PREFIX_RTMP}/lib$libsuff + CPP_RTMP=-I${PREFIX_RTMP}/include + DIR_RTMP=${PREFIX_RTMP}/lib$libsuff + fi + + LDFLAGS="$LDFLAGS $LD_RTMP" + CPPFLAGS="$CPPFLAGS $CPP_RTMP" + LIBS="$LIBS $LIB_RTMP" + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for RTMP_Init in -lrtmp" >&5 +$as_echo_n "checking for RTMP_Init in -lrtmp... " >&6; } +if test "${ac_cv_lib_rtmp_RTMP_Init+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lrtmp $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + +#ifdef __cplusplus +extern "C" +#endif +char RTMP_Init (); +int main (void) +{ +return RTMP_Init (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_lib_rtmp_RTMP_Init=yes +else + ac_cv_lib_rtmp_RTMP_Init=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_rtmp_RTMP_Init" >&5 +$as_echo "$ac_cv_lib_rtmp_RTMP_Init" >&6; } +if test "x$ac_cv_lib_rtmp_RTMP_Init" = x""yes; then : + + for ac_header in librtmp/rtmp.h +do : + ac_fn_c_check_header_mongrel "$LINENO" "librtmp/rtmp.h" "ac_cv_header_librtmp_rtmp_h" "$ac_includes_default" +if test "x$ac_cv_header_librtmp_rtmp_h" = x""yes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_LIBRTMP_RTMP_H 1 +_ACEOF + curl_rtmp_msg="enabled (librtmp)" + LIBRTMP_ENABLED=1 + +$as_echo "#define USE_LIBRTMP 1" >>confdefs.h + + USE_LIBRTMP=1 + + +fi + +done + + +else + LDFLAGS=$CLEANLDFLAGS + CPPFLAGS=$CLEANCPPFLAGS + LIBS=$CLEANLIBS + +fi + + + if test X"$OPT_LIBRTMP" != Xoff && + test "$LIBRTMP_ENABLED" != "1"; then + as_fn_error $? "librtmp libs and/or directories were not found where specified!" "$LINENO" 5 + fi + +fi + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to build with libidn" >&5 +$as_echo_n "checking whether to build with libidn... " >&6; } + +# Check whether --with-libidn was given. +if test "${with_libidn+set}" = set; then : + withval=$with_libidn; LIBIDN="$withval" +fi + + +case "$LIBIDN" in + no) + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + ;; + *) { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + + idn="" + if test -n "$LIBIDN"; then + if test "x$LIBIDN" != "xyes"; then + oldLDFLAGS=$LDFLAGS + oldCPPFLAGS=$CPPFLAGS + LDFLAGS="$LDFLAGS -L$LIBIDN/lib" + CPPFLAGS="$CPPFLAGS -I$LIBIDN/include" + idn="yes" + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for idna_to_ascii_4i in -lidn" >&5 +$as_echo_n "checking for idna_to_ascii_4i in -lidn... " >&6; } +if test "${ac_cv_lib_idn_idna_to_ascii_4i+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lidn $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + +#ifdef __cplusplus +extern "C" +#endif +char idna_to_ascii_4i (); +int main (void) +{ +return idna_to_ascii_4i (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_lib_idn_idna_to_ascii_4i=yes +else + ac_cv_lib_idn_idna_to_ascii_4i=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_idn_idna_to_ascii_4i" >&5 +$as_echo "$ac_cv_lib_idn_idna_to_ascii_4i" >&6; } +if test "x$ac_cv_lib_idn_idna_to_ascii_4i" = x""yes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_LIBIDN 1 +_ACEOF + + LIBS="-lidn $LIBS" + +else + idn="" + LDFLAGS=$oldLDFLAGS + CPPFLAGS=$oldCPPFLAGS +fi + + fi + fi + + if test "x$idn" != "xyes"; then + idn="yes" + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for idna_to_ascii_lz in -lidn" >&5 +$as_echo_n "checking for idna_to_ascii_lz in -lidn... " >&6; } +if test "${ac_cv_lib_idn_idna_to_ascii_lz+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lidn $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + +#ifdef __cplusplus +extern "C" +#endif +char idna_to_ascii_lz (); +int main (void) +{ +return idna_to_ascii_lz (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_lib_idn_idna_to_ascii_lz=yes +else + ac_cv_lib_idn_idna_to_ascii_lz=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_idn_idna_to_ascii_lz" >&5 +$as_echo "$ac_cv_lib_idn_idna_to_ascii_lz" >&6; } +if test "x$ac_cv_lib_idn_idna_to_ascii_lz" = x""yes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_LIBIDN 1 +_ACEOF + + LIBS="-lidn $LIBS" + +else + idn="" +fi + + fi + + if test "x$idn" = "xyes"; then + curl_idn_msg="enabled" + IDN_ENABLED=1 + + for ac_func in idn_free idna_strerror tld_strerror +do : + as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` +ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" +if eval test \"x\$"$as_ac_var"\" = x"yes"; then : + cat >>confdefs.h <<_ACEOF +#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 +_ACEOF + +fi +done + + for ac_header in idn-free.h tld.h +do : + as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` +ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" +if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : + cat >>confdefs.h <<_ACEOF +#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + +done + + fi + + ;; +esac + + + + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5 +$as_echo_n "checking for ANSI C header files... " >&6; } +if test "${ac_cv_header_stdc+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +#include +#include +#include + +int main (void) +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_header_stdc=yes +else + ac_cv_header_stdc=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + +if test $ac_cv_header_stdc = yes; then + # SunOS 4.x string.h does not declare mem*, contrary to ANSI. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "memchr" >/dev/null 2>&1; then : + +else + ac_cv_header_stdc=no +fi +rm -f conftest* + +fi + +if test $ac_cv_header_stdc = yes; then + # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "free" >/dev/null 2>&1; then : + +else + ac_cv_header_stdc=no +fi +rm -f conftest* + +fi + +if test $ac_cv_header_stdc = yes; then + # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. + if test "$cross_compiling" = yes; then : + : +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +#include +#if ((' ' & 0x0FF) == 0x020) +# define ISLOWER(c) ('a' <= (c) && (c) <= 'z') +# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) +#else +# define ISLOWER(c) \ + (('a' <= (c) && (c) <= 'i') \ + || ('j' <= (c) && (c) <= 'r') \ + || ('s' <= (c) && (c) <= 'z')) +# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) +#endif + +#define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) +int +main () +{ + int i; + for (i = 0; i < 256; i++) + if (XOR (islower (i), ISLOWER (i)) + || toupper (i) != TOUPPER (i)) + return 2; + return 0; +} +_ACEOF +if ac_fn_c_try_run "$LINENO"; then : + +else + ac_cv_header_stdc=no +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext +fi + +fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdc" >&5 +$as_echo "$ac_cv_header_stdc" >&6; } +if test $ac_cv_header_stdc = yes; then + +$as_echo "#define STDC_HEADERS 1" >>confdefs.h + +fi + + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for malloc.h" >&5 +$as_echo_n "checking for malloc.h... " >&6; } +if test "${ac_cv_header_malloc_h+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + +#include + +int main (void) +{ + + void *p = malloc(10); + void *q = calloc(10,10); + free(p); + free(q); + + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + + ac_cv_header_malloc_h="yes" + +else + + ac_cv_header_malloc_h="no" + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_malloc_h" >&5 +$as_echo "$ac_cv_header_malloc_h" >&6; } + if test "$ac_cv_header_malloc_h" = "yes"; then + +cat >>confdefs.h <<_ACEOF +#define HAVE_MALLOC_H 1 +_ACEOF + + # + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + +#include + +int main (void) +{ + + void *p = malloc(10); + void *q = calloc(10,10); + free(p); + free(q); + + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + + curl_cv_need_header_malloc_h="no" + +else + + curl_cv_need_header_malloc_h="yes" + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + # + case "$curl_cv_need_header_malloc_h" in + yes) + +cat >>confdefs.h <<_ACEOF +#define NEED_MALLOC_H 1 +_ACEOF + + ;; + esac + fi + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for memory.h" >&5 +$as_echo_n "checking for memory.h... " >&6; } +if test "${ac_cv_header_memory_h+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + +#include + +int main (void) +{ + + void *p = malloc(10); + void *q = calloc(10,10); + free(p); + free(q); + + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + + ac_cv_header_memory_h="yes" + +else + + ac_cv_header_memory_h="no" + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_memory_h" >&5 +$as_echo "$ac_cv_header_memory_h" >&6; } + if test "$ac_cv_header_memory_h" = "yes"; then + +cat >>confdefs.h <<_ACEOF +#define HAVE_MEMORY_H 1 +_ACEOF + + # + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + +#include + +int main (void) +{ + + void *p = malloc(10); + void *q = calloc(10,10); + free(p); + free(q); + + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + + curl_cv_need_header_memory_h="no" + +else + + curl_cv_need_header_memory_h="yes" + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + # + case "$curl_cv_need_header_memory_h" in + yes) + +cat >>confdefs.h <<_ACEOF +#define NEED_MEMORY_H 1 +_ACEOF + + ;; + esac + fi + + +for ac_header in sys/types.h \ + sys/time.h \ + sys/select.h \ + sys/socket.h \ + sys/ioctl.h \ + sys/uio.h \ + assert.h \ + unistd.h \ + stdlib.h \ + limits.h \ + arpa/inet.h \ + net/if.h \ + netinet/in.h \ + sys/un.h \ + netinet/tcp.h \ + netdb.h \ + sys/sockio.h \ + sys/stat.h \ + sys/param.h \ + termios.h \ + termio.h \ + sgtty.h \ + fcntl.h \ + alloca.h \ + time.h \ + io.h \ + pwd.h \ + utime.h \ + sys/utime.h \ + sys/poll.h \ + poll.h \ + socket.h \ + sys/resource.h \ + libgen.h \ + locale.h \ + errno.h \ + stdbool.h \ + arpa/tftp.h \ + sys/filio.h \ + setjmp.h +do : + as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` +ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" " +#ifdef HAVE_SYS_TYPES_H +#include +#endif +#ifdef HAVE_SYS_TIME_H +#include +#endif +#ifdef HAVE_SYS_SELECT_H +#include +#endif +#ifdef HAVE_SYS_SOCKET_H +#include +#endif +#ifdef HAVE_NETINET_IN_H +#include +#endif +#ifdef HAVE_SYS_UN_H +#include +#endif + + +" +if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : + cat >>confdefs.h <<_ACEOF +#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + +done + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for an ANSI C-conforming const" >&5 +$as_echo_n "checking for an ANSI C-conforming const... " >&6; } +if test "${ac_cv_c_const+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int main (void) +{ +/* FIXME: Include the comments suggested by Paul. */ +#ifndef __cplusplus + /* Ultrix mips cc rejects this. */ + typedef int charset[2]; + const charset cs; + /* SunOS 4.1.1 cc rejects this. */ + char const *const *pcpcc; + char **ppc; + /* NEC SVR4.0.2 mips cc rejects this. */ + struct point {int x, y;}; + static struct point const zero = {0,0}; + /* AIX XL C 1.02.0.0 rejects this. + It does not let you subtract one const X* pointer from another in + an arm of an if-expression whose if-part is not a constant + expression */ + const char *g = "string"; + pcpcc = &g + (g ? g-g : 0); + /* HPUX 7.0 cc rejects these. */ + ++pcpcc; + ppc = (char**) pcpcc; + pcpcc = (char const *const *) ppc; + { /* SCO 3.2v4 cc rejects this. */ + char *t; + char const *s = 0 ? (char *) 0 : (char const *) 0; + + *t++ = 0; + if (s) return 0; + } + { /* Someone thinks the Sun supposedly-ANSI compiler will reject this. */ + int x[] = {25, 17}; + const int *foo = &x[0]; + ++foo; + } + { /* Sun SC1.0 ANSI compiler rejects this -- but not the above. */ + typedef const int *iptr; + iptr p = 0; + ++p; + } + { /* AIX XL C 1.02.0.0 rejects this saying + "k.c", line 2.27: 1506-025 (S) Operand must be a modifiable lvalue. */ + struct s { int j; const int *ap[3]; }; + struct s *b; b->j = 5; + } + { /* ULTRIX-32 V3.1 (Rev 9) vcc rejects this */ + const int foo = 10; + if (!foo) return 0; + } + return !cs[0] && !zero.x; +#endif + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_c_const=yes +else + ac_cv_c_const=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_const" >&5 +$as_echo "$ac_cv_c_const" >&6; } +if test $ac_cv_c_const = no; then + +$as_echo "#define const /**/" >>confdefs.h + +fi + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for compiler support of C99 variadic macro style" >&5 +$as_echo_n "checking for compiler support of C99 variadic macro style... " >&6; } +if test "${curl_cv_variadic_macros_c99+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + +#define c99_vmacro3(first, ...) fun3(first, __VA_ARGS__) +#define c99_vmacro2(first, ...) fun2(first, __VA_ARGS__) + int fun3(int arg1, int arg2, int arg3); + int fun2(int arg1, int arg2); + int fun3(int arg1, int arg2, int arg3) + { return arg1 + arg2 + arg3; } + int fun2(int arg1, int arg2) + { return arg1 + arg2; } + +int main (void) +{ + + int res3 = c99_vmacro3(1, 2, 3); + int res2 = c99_vmacro2(1, 2); + + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + + curl_cv_variadic_macros_c99="yes" + +else + + curl_cv_variadic_macros_c99="no" + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $curl_cv_variadic_macros_c99" >&5 +$as_echo "$curl_cv_variadic_macros_c99" >&6; } + case "$curl_cv_variadic_macros_c99" in + yes) + +cat >>confdefs.h <<_ACEOF +#define HAVE_VARIADIC_MACROS_C99 1 +_ACEOF + + ;; + esac + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for compiler support of old gcc variadic macro style" >&5 +$as_echo_n "checking for compiler support of old gcc variadic macro style... " >&6; } +if test "${curl_cv_variadic_macros_gcc+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + +#define gcc_vmacro3(first, args...) fun3(first, args) +#define gcc_vmacro2(first, args...) fun2(first, args) + int fun3(int arg1, int arg2, int arg3); + int fun2(int arg1, int arg2); + int fun3(int arg1, int arg2, int arg3) + { return arg1 + arg2 + arg3; } + int fun2(int arg1, int arg2) + { return arg1 + arg2; } + +int main (void) +{ + + int res3 = gcc_vmacro3(1, 2, 3); + int res2 = gcc_vmacro2(1, 2); + + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + + curl_cv_variadic_macros_gcc="yes" + +else + + curl_cv_variadic_macros_gcc="no" + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $curl_cv_variadic_macros_gcc" >&5 +$as_echo "$curl_cv_variadic_macros_gcc" >&6; } + case "$curl_cv_variadic_macros_gcc" in + yes) + +cat >>confdefs.h <<_ACEOF +#define HAVE_VARIADIC_MACROS_GCC 1 +_ACEOF + + ;; + esac + +ac_fn_c_check_type "$LINENO" "size_t" "ac_cv_type_size_t" "$ac_includes_default" +if test "x$ac_cv_type_size_t" = x""yes; then : + +else + +cat >>confdefs.h <<_ACEOF +#define size_t unsigned int +_ACEOF + +fi + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether time.h and sys/time.h may both be included" >&5 +$as_echo_n "checking whether time.h and sys/time.h may both be included... " >&6; } +if test "${ac_cv_header_time+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +#include +#include + +int main (void) +{ +if ((struct tm *) 0) +return 0; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_header_time=yes +else + ac_cv_header_time=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_time" >&5 +$as_echo "$ac_cv_header_time" >&6; } +if test $ac_cv_header_time = yes; then + +$as_echo "#define TIME_WITH_SYS_TIME 1" >>confdefs.h + +fi + + + for ac_header in sys/types.h sys/time.h time.h sys/socket.h +do : + as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` +ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" +if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : + cat >>confdefs.h <<_ACEOF +#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + +done + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for struct timeval" >&5 +$as_echo_n "checking for struct timeval... " >&6; } +if test "${ac_cv_struct_timeval+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + +#undef inline +#ifdef HAVE_WINDOWS_H +#ifndef WIN32_LEAN_AND_MEAN +#define WIN32_LEAN_AND_MEAN +#endif +#include +#ifdef HAVE_WINSOCK2_H +#include +#else +#ifdef HAVE_WINSOCK_H +#include +#endif +#endif +#endif +#ifdef HAVE_SYS_TYPES_H +#include +#endif +#ifdef HAVE_SYS_TIME_H +#include +#ifdef TIME_WITH_SYS_TIME +#include +#endif +#else +#ifdef HAVE_TIME_H +#include +#endif +#endif +#ifdef HAVE_SYS_SOCKET_H +#include +#endif + +int main (void) +{ + + struct timeval ts; + ts.tv_sec = 0; + ts.tv_usec = 0; + + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + + ac_cv_struct_timeval="yes" + +else + + ac_cv_struct_timeval="no" + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_struct_timeval" >&5 +$as_echo "$ac_cv_struct_timeval" >&6; } + case "$ac_cv_struct_timeval" in + yes) + +cat >>confdefs.h <<_ACEOF +#define HAVE_STRUCT_TIMEVAL 1 +_ACEOF + + ;; + esac + + + + if test "x$cross_compiling" != xyes; then + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking run-time libs availability" >&5 +$as_echo_n "checking run-time libs availability... " >&6; } + if test "$cross_compiling" = yes; then : + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "cannot run test program while cross compiling +See \`config.log' for more details" "$LINENO" 5 ; } +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +main() +{ + return 0; +} + +_ACEOF +if ac_fn_c_try_run "$LINENO"; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: result: fine" >&5 +$as_echo "fine" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: failed" >&5 +$as_echo "failed" >&6; } + as_fn_error $? "one or more libs available at link-time are not available run-time. Libs used at link-time: $LIBS" "$LINENO" 5 + +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext +fi + + + fi + + +# The cast to long int works around a bug in the HP C Compiler +# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects +# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. +# This bug is HP SR number 8606223364. +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking size of size_t" >&5 +$as_echo_n "checking size of size_t... " >&6; } +if test "${ac_cv_sizeof_size_t+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (size_t))" "ac_cv_sizeof_size_t" "$ac_includes_default"; then : + +else + if test "$ac_cv_type_size_t" = yes; then + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error 77 "cannot compute sizeof (size_t) +See \`config.log' for more details" "$LINENO" 5 ; } + else + ac_cv_sizeof_size_t=0 + fi +fi + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_size_t" >&5 +$as_echo "$ac_cv_sizeof_size_t" >&6; } + + + +cat >>confdefs.h <<_ACEOF +#define SIZEOF_SIZE_T $ac_cv_sizeof_size_t +_ACEOF + + +# The cast to long int works around a bug in the HP C Compiler +# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects +# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. +# This bug is HP SR number 8606223364. +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking size of long" >&5 +$as_echo_n "checking size of long... " >&6; } +if test "${ac_cv_sizeof_long+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (long))" "ac_cv_sizeof_long" "$ac_includes_default"; then : + +else + if test "$ac_cv_type_long" = yes; then + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error 77 "cannot compute sizeof (long) +See \`config.log' for more details" "$LINENO" 5 ; } + else + ac_cv_sizeof_long=0 + fi +fi + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_long" >&5 +$as_echo "$ac_cv_sizeof_long" >&6; } + + + +cat >>confdefs.h <<_ACEOF +#define SIZEOF_LONG $ac_cv_sizeof_long +_ACEOF + + +# The cast to long int works around a bug in the HP C Compiler +# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects +# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. +# This bug is HP SR number 8606223364. +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking size of int" >&5 +$as_echo_n "checking size of int... " >&6; } +if test "${ac_cv_sizeof_int+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (int))" "ac_cv_sizeof_int" "$ac_includes_default"; then : + +else + if test "$ac_cv_type_int" = yes; then + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error 77 "cannot compute sizeof (int) +See \`config.log' for more details" "$LINENO" 5 ; } + else + ac_cv_sizeof_int=0 + fi +fi + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_int" >&5 +$as_echo "$ac_cv_sizeof_int" >&6; } + + + +cat >>confdefs.h <<_ACEOF +#define SIZEOF_INT $ac_cv_sizeof_int +_ACEOF + + +# The cast to long int works around a bug in the HP C Compiler +# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects +# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. +# This bug is HP SR number 8606223364. +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking size of short" >&5 +$as_echo_n "checking size of short... " >&6; } +if test "${ac_cv_sizeof_short+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (short))" "ac_cv_sizeof_short" "$ac_includes_default"; then : + +else + if test "$ac_cv_type_short" = yes; then + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error 77 "cannot compute sizeof (short) +See \`config.log' for more details" "$LINENO" 5 ; } + else + ac_cv_sizeof_short=0 + fi +fi + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_short" >&5 +$as_echo "$ac_cv_sizeof_short" >&6; } + + + +cat >>confdefs.h <<_ACEOF +#define SIZEOF_SHORT $ac_cv_sizeof_short +_ACEOF + + + + if test -z "$ac_cv_sizeof_long" || + test "$ac_cv_sizeof_long" -eq "0"; then + as_fn_error $? "cannot find out size of long." "$LINENO" 5 + fi + +cat >>confdefs.h <<_EOF +#define CURL_SIZEOF_LONG $ac_cv_sizeof_long +_EOF + + +# The cast to long int works around a bug in the HP C Compiler +# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects +# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. +# This bug is HP SR number 8606223364. +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking size of time_t" >&5 +$as_echo_n "checking size of time_t... " >&6; } +if test "${ac_cv_sizeof_time_t+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (time_t))" "ac_cv_sizeof_time_t" "$ac_includes_default"; then : + +else + if test "$ac_cv_type_time_t" = yes; then + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error 77 "cannot compute sizeof (time_t) +See \`config.log' for more details" "$LINENO" 5 ; } + else + ac_cv_sizeof_time_t=0 + fi +fi + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_time_t" >&5 +$as_echo "$ac_cv_sizeof_time_t" >&6; } + + + +cat >>confdefs.h <<_ACEOF +#define SIZEOF_TIME_T $ac_cv_sizeof_time_t +_ACEOF + + +# The cast to long int works around a bug in the HP C Compiler +# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects +# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. +# This bug is HP SR number 8606223364. +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking size of off_t" >&5 +$as_echo_n "checking size of off_t... " >&6; } +if test "${ac_cv_sizeof_off_t+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (off_t))" "ac_cv_sizeof_off_t" "$ac_includes_default"; then : + +else + if test "$ac_cv_type_off_t" = yes; then + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error 77 "cannot compute sizeof (off_t) +See \`config.log' for more details" "$LINENO" 5 ; } + else + ac_cv_sizeof_off_t=0 + fi +fi + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_off_t" >&5 +$as_echo "$ac_cv_sizeof_off_t" >&6; } + + + +cat >>confdefs.h <<_ACEOF +#define SIZEOF_OFF_T $ac_cv_sizeof_off_t +_ACEOF + + + +soname_bump=no +if test x"$ac_cv_native_windows" != "xyes" && + test $ac_cv_sizeof_off_t -ne $curl_sizeof_curl_off_t; then + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: This libcurl built is probably not ABI compatible with previous" >&5 +$as_echo "$as_me: WARNING: This libcurl built is probably not ABI compatible with previous" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: builds! You MUST read lib/README.curl_off_t to figure it out." >&5 +$as_echo "$as_me: WARNING: builds! You MUST read lib/README.curl_off_t to figure it out." >&2;} + soname_bump=yes +fi + + +ac_fn_c_check_type "$LINENO" "long long" "ac_cv_type_long_long" "$ac_includes_default" +if test "x$ac_cv_type_long_long" = x""yes; then : + +$as_echo "#define HAVE_LONGLONG 1" >>confdefs.h + + longlong="yes" + +fi + + +if test "xyes" = "x$longlong"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if numberLL works" >&5 +$as_echo_n "checking if numberLL works... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + + +int main (void) +{ + + long long val = 1000LL; + + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + +$as_echo "#define HAVE_LL 1" >>confdefs.h + + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi + + +# check for ssize_t +ac_fn_c_check_type "$LINENO" "ssize_t" "ac_cv_type_ssize_t" "$ac_includes_default" +if test "x$ac_cv_type_ssize_t" = x""yes; then : + +else + +$as_echo "#define ssize_t int" >>confdefs.h + +fi + + +# check for bool type +ac_fn_c_check_type "$LINENO" "bool" "ac_cv_type_bool" " +#ifdef HAVE_SYS_TYPES_H +#include +#endif +#ifdef HAVE_STDBOOL_H +#include +#endif + +" +if test "x$ac_cv_type_bool" = x""yes; then : + + +$as_echo "#define HAVE_BOOL_T 1" >>confdefs.h + + +fi + + + +curl_includes_ws2tcpip="\ +/* includes start */ +#ifdef HAVE_WINDOWS_H +# ifndef WIN32_LEAN_AND_MEAN +# define WIN32_LEAN_AND_MEAN +# endif +# include +# ifdef HAVE_WINSOCK2_H +# include +# ifdef HAVE_WS2TCPIP_H +# include +# endif +# endif +#endif +/* includes end */" + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for windows.h" >&5 +$as_echo_n "checking for windows.h... " >&6; } +if test "${ac_cv_header_windows_h+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + +#undef inline +#ifndef WIN32_LEAN_AND_MEAN +#define WIN32_LEAN_AND_MEAN +#endif +#include + +int main (void) +{ + +#if defined(__CYGWIN__) || defined(__CEGCC__) + HAVE_WINDOWS_H shall not be defined. +#else + int dummy=2*WINVER; +#endif + + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + + ac_cv_header_windows_h="yes" + +else + + ac_cv_header_windows_h="no" + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_windows_h" >&5 +$as_echo "$ac_cv_header_windows_h" >&6; } + case "$ac_cv_header_windows_h" in + yes) + +cat >>confdefs.h <<_ACEOF +#define HAVE_WINDOWS_H 1 +_ACEOF + + +cat >>confdefs.h <<_ACEOF +#define WIN32_LEAN_AND_MEAN 1 +_ACEOF + + ;; + esac + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for winsock2.h" >&5 +$as_echo_n "checking for winsock2.h... " >&6; } +if test "${ac_cv_header_winsock2_h+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + +#undef inline +#ifndef WIN32_LEAN_AND_MEAN +#define WIN32_LEAN_AND_MEAN +#endif +#include +#include + +int main (void) +{ + +#if defined(__CYGWIN__) || defined(__CEGCC__) || defined(__MINGW32CE__) + HAVE_WINSOCK2_H shall not be defined. +#else + int dummy=2*IPPROTO_ESP; +#endif + + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + + ac_cv_header_winsock2_h="yes" + +else + + ac_cv_header_winsock2_h="no" + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_winsock2_h" >&5 +$as_echo "$ac_cv_header_winsock2_h" >&6; } + case "$ac_cv_header_winsock2_h" in + yes) + +cat >>confdefs.h <<_ACEOF +#define HAVE_WINSOCK2_H 1 +_ACEOF + + ;; + esac + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ws2tcpip.h" >&5 +$as_echo_n "checking for ws2tcpip.h... " >&6; } +if test "${ac_cv_header_ws2tcpip_h+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + +#undef inline +#ifndef WIN32_LEAN_AND_MEAN +#define WIN32_LEAN_AND_MEAN +#endif +#include +#include +#include + +int main (void) +{ + +#if defined(__CYGWIN__) || defined(__CEGCC__) || defined(__MINGW32CE__) + HAVE_WS2TCPIP_H shall not be defined. +#else + int dummy=2*IP_PKTINFO; +#endif + + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + + ac_cv_header_ws2tcpip_h="yes" + +else + + ac_cv_header_ws2tcpip_h="no" + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_ws2tcpip_h" >&5 +$as_echo "$ac_cv_header_ws2tcpip_h" >&6; } + case "$ac_cv_header_ws2tcpip_h" in + yes) + +cat >>confdefs.h <<_ACEOF +#define HAVE_WS2TCPIP_H 1 +_ACEOF + + ;; + esac + + + +curl_includes_sys_socket="\ +/* includes start */ +#ifdef HAVE_SYS_TYPES_H +# include +#endif +#ifdef HAVE_SYS_SOCKET_H +# include +#endif +/* includes end */" + for ac_header in sys/types.h sys/socket.h +do : + as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` +ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$curl_includes_sys_socket +" +if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : + cat >>confdefs.h <<_ACEOF +#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + +done + + + +curl_preprocess_callconv="\ +/* preprocess start */ +#ifdef HAVE_WINDOWS_H +# define FUNCALLCONV __stdcall +#else +# define FUNCALLCONV +#endif +/* preprocess end */" + + + # + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for curl_socklen_t data type" >&5 +$as_echo_n "checking for curl_socklen_t data type... " >&6; } + curl_typeof_curl_socklen_t="unknown" + for arg1 in int SOCKET; do + for arg2 in 'struct sockaddr' void; do + for t in socklen_t int size_t 'unsigned int' long 'unsigned long' void; do + if test "$curl_typeof_curl_socklen_t" = "unknown"; then + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + + $curl_includes_ws2tcpip + $curl_includes_sys_socket + $curl_preprocess_callconv + extern int FUNCALLCONV getpeername($arg1, $arg2 *, $t *); + +int main (void) +{ + + $t *lenptr = 0; + if(0 != getpeername(0, 0, lenptr)) + return 1; + + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + + curl_typeof_curl_socklen_t="$t" + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + fi + done + done + done + for t in socklen_t int; do + if test "$curl_typeof_curl_socklen_t" = "void"; then + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + + $curl_includes_sys_socket + typedef $t curl_socklen_t; + +int main (void) +{ + + curl_socklen_t dummy; + + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + + curl_typeof_curl_socklen_t="$t" + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + fi + done + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $curl_typeof_curl_socklen_t" >&5 +$as_echo "$curl_typeof_curl_socklen_t" >&6; } + if test "$curl_typeof_curl_socklen_t" = "void" || + test "$curl_typeof_curl_socklen_t" = "unknown"; then + as_fn_error $? "cannot find data type for curl_socklen_t." "$LINENO" 5 + fi + # + { $as_echo "$as_me:${as_lineno-$LINENO}: checking size of curl_socklen_t" >&5 +$as_echo_n "checking size of curl_socklen_t... " >&6; } + curl_sizeof_curl_socklen_t="unknown" + curl_pull_headers_socklen_t="unknown" + if test "$ac_cv_header_ws2tcpip_h" = "yes"; then + tst_pull_header_checks='none ws2tcpip' + tst_size_checks='4' + else + tst_pull_header_checks='none systypes syssocket' + tst_size_checks='4 8 2' + fi + for tst_size in $tst_size_checks; do + for tst_pull_headers in $tst_pull_header_checks; do + if test "$curl_sizeof_curl_socklen_t" = "unknown"; then + case $tst_pull_headers in + ws2tcpip) + tmp_includes="$curl_includes_ws2tcpip" + ;; + systypes) + tmp_includes="$curl_includes_sys_types" + ;; + syssocket) + tmp_includes="$curl_includes_sys_socket" + ;; + *) + tmp_includes="" + ;; + esac + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + + $tmp_includes + typedef $curl_typeof_curl_socklen_t curl_socklen_t; + typedef char dummy_arr[sizeof(curl_socklen_t) == $tst_size ? 1 : -1]; + +int main (void) +{ + + curl_socklen_t dummy; + + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + + curl_sizeof_curl_socklen_t="$tst_size" + curl_pull_headers_socklen_t="$tst_pull_headers" + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + fi + done + done + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $curl_sizeof_curl_socklen_t" >&5 +$as_echo "$curl_sizeof_curl_socklen_t" >&6; } + if test "$curl_sizeof_curl_socklen_t" = "unknown"; then + as_fn_error $? "cannot find out size of curl_socklen_t." "$LINENO" 5 + fi + # + case $curl_pull_headers_socklen_t in + ws2tcpip) + +cat >>confdefs.h <<_EOF +#define CURL_PULL_WS2TCPIP_H 1 +_EOF + + ;; + systypes) + +cat >>confdefs.h <<_EOF +#define CURL_PULL_SYS_TYPES_H 1 +_EOF + + ;; + syssocket) + +cat >>confdefs.h <<_EOF +#define CURL_PULL_SYS_TYPES_H 1 +_EOF + + +cat >>confdefs.h <<_EOF +#define CURL_PULL_SYS_SOCKET_H 1 +_EOF + + ;; + esac + +cat >>confdefs.h <<_EOF +#define CURL_TYPEOF_CURL_SOCKLEN_T $curl_typeof_curl_socklen_t +_EOF + + +cat >>confdefs.h <<_EOF +#define CURL_SIZEOF_CURL_SOCKLEN_T $curl_sizeof_curl_socklen_t +_EOF + + + + + ac_fn_c_check_type "$LINENO" "in_addr_t" "ac_cv_type_in_addr_t" " +#undef inline +#ifdef HAVE_WINDOWS_H +#ifndef WIN32_LEAN_AND_MEAN +#define WIN32_LEAN_AND_MEAN +#endif +#include +#ifdef HAVE_WINSOCK2_H +#include +#else +#ifdef HAVE_WINSOCK_H +#include +#endif +#endif +#else +#ifdef HAVE_SYS_TYPES_H +#include +#endif +#ifdef HAVE_SYS_SOCKET_H +#include +#endif +#ifdef HAVE_NETINET_IN_H +#include +#endif +#ifdef HAVE_ARPA_INET_H +#include +#endif +#endif + +" +if test "x$ac_cv_type_in_addr_t" = x""yes; then : + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for in_addr_t equivalent" >&5 +$as_echo_n "checking for in_addr_t equivalent... " >&6; } +if test "${curl_cv_in_addr_t_equiv+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + + curl_cv_in_addr_t_equiv="unknown" + for t in "unsigned long" int size_t unsigned long; do + if test "$curl_cv_in_addr_t_equiv" = "unknown"; then + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + +#undef inline +#ifdef HAVE_WINDOWS_H +#ifndef WIN32_LEAN_AND_MEAN +#define WIN32_LEAN_AND_MEAN +#endif +#include +#ifdef HAVE_WINSOCK2_H +#include +#else +#ifdef HAVE_WINSOCK_H +#include +#endif +#endif +#else +#ifdef HAVE_SYS_TYPES_H +#include +#endif +#ifdef HAVE_SYS_SOCKET_H +#include +#endif +#ifdef HAVE_NETINET_IN_H +#include +#endif +#ifdef HAVE_ARPA_INET_H +#include +#endif +#endif + +int main (void) +{ + + $t data = inet_addr ("1.2.3.4"); + + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + + curl_cv_in_addr_t_equiv="$t" + +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + fi + done + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $curl_cv_in_addr_t_equiv" >&5 +$as_echo "$curl_cv_in_addr_t_equiv" >&6; } + case "$curl_cv_in_addr_t_equiv" in + unknown) + as_fn_error $? "Cannot find a type to use in place of in_addr_t" "$LINENO" 5 + ;; + *) + +cat >>confdefs.h <<_ACEOF +#define in_addr_t $curl_cv_in_addr_t_equiv +_ACEOF + + ;; + esac + +fi + + + + + ac_fn_c_check_type "$LINENO" "struct sockaddr_storage" "ac_cv_type_struct_sockaddr_storage" " +#undef inline +#ifdef HAVE_WINDOWS_H +#ifndef WIN32_LEAN_AND_MEAN +#define WIN32_LEAN_AND_MEAN +#endif +#include +#ifdef HAVE_WINSOCK2_H +#include +#endif +#else +#ifdef HAVE_SYS_TYPES_H +#include +#endif +#ifdef HAVE_SYS_SOCKET_H +#include +#endif +#ifdef HAVE_NETINET_IN_H +#include +#endif +#ifdef HAVE_ARPA_INET_H +#include +#endif +#endif + +" +if test "x$ac_cv_type_struct_sockaddr_storage" = x""yes; then : + +$as_echo "#define HAVE_STRUCT_SOCKADDR_STORAGE 1" >>confdefs.h + +fi + + + + + for ac_header in signal.h +do : + ac_fn_c_check_header_mongrel "$LINENO" "signal.h" "ac_cv_header_signal_h" "$ac_includes_default" +if test "x$ac_cv_header_signal_h" = x""yes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_SIGNAL_H 1 +_ACEOF + +fi + +done + + ac_fn_c_check_type "$LINENO" "sig_atomic_t" "ac_cv_type_sig_atomic_t" " +#ifdef HAVE_SIGNAL_H +#include +#endif + +" +if test "x$ac_cv_type_sig_atomic_t" = x""yes; then : + + +$as_echo "#define HAVE_SIG_ATOMIC_T 1" >>confdefs.h + + +fi + + case "$ac_cv_type_sig_atomic_t" in + yes) + # + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if sig_atomic_t is already defined as volatile" >&5 +$as_echo_n "checking if sig_atomic_t is already defined as volatile... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + +#ifdef HAVE_SIGNAL_H +#include +#endif + +int main (void) +{ + + static volatile sig_atomic_t dummy = 0; + + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + ac_cv_sig_atomic_t_volatile="no" + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + ac_cv_sig_atomic_t_volatile="yes" + +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + # + if test "$ac_cv_sig_atomic_t_volatile" = "yes"; then + +$as_echo "#define HAVE_SIG_ATOMIC_T_VOLATILE 1" >>confdefs.h + + fi + ;; + esac + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking return type of signal handlers" >&5 +$as_echo_n "checking return type of signal handlers... " >&6; } +if test "${ac_cv_type_signal+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +#include + +int main (void) +{ +return *(signal (0, 0)) (0) == 1; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_type_signal=int +else + ac_cv_type_signal=void +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_type_signal" >&5 +$as_echo "$ac_cv_type_signal" >&6; } + +cat >>confdefs.h <<_ACEOF +#define RETSIGTYPE $ac_cv_type_signal +_ACEOF + + + + + for ac_header in sys/select.h sys/socket.h +do : + as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` +ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" +if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : + cat >>confdefs.h <<_ACEOF +#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + +done + + # + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for select" >&5 +$as_echo_n "checking for select... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + +#undef inline +#ifdef HAVE_WINDOWS_H +#ifndef WIN32_LEAN_AND_MEAN +#define WIN32_LEAN_AND_MEAN +#endif +#include +#ifdef HAVE_WINSOCK2_H +#include +#else +#ifdef HAVE_WINSOCK_H +#include +#endif +#endif +#endif +#ifdef HAVE_SYS_TYPES_H +#include +#endif +#ifdef HAVE_SYS_TIME_H +#include +#ifdef TIME_WITH_SYS_TIME +#include +#endif +#else +#ifdef HAVE_TIME_H +#include +#endif +#endif +#ifndef HAVE_WINDOWS_H +#ifdef HAVE_SYS_SELECT_H +#include +#endif +#ifdef HAVE_SYS_SOCKET_H +#include +#endif +#endif + +int main (void) +{ + + select(0, 0, 0, 0, 0); + + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + curl_cv_select="yes" + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + curl_cv_select="no" + +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + # + if test "$curl_cv_select" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking types of args and return type for select" >&5 +$as_echo_n "checking types of args and return type for select... " >&6; } +if test "${curl_cv_func_select_args+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + + curl_cv_func_select_args="unknown" + for sel_retv in 'int' 'ssize_t'; do + for sel_arg1 in 'int' 'ssize_t' 'size_t' 'unsigned long int' 'unsigned int'; do + for sel_arg234 in 'fd_set *' 'int *' 'void *'; do + for sel_arg5 in 'struct timeval *' 'const struct timeval *'; do + if test "$curl_cv_func_select_args" = "unknown"; then + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + +#undef inline +#ifdef HAVE_WINDOWS_H +#ifndef WIN32_LEAN_AND_MEAN +#define WIN32_LEAN_AND_MEAN +#endif +#include +#ifdef HAVE_WINSOCK2_H +#include +#else +#ifdef HAVE_WINSOCK_H +#include +#endif +#endif +#define SELECTCALLCONV PASCAL +#endif +#ifdef HAVE_SYS_TYPES_H +#include +#endif +#ifdef HAVE_SYS_TIME_H +#include +#ifdef TIME_WITH_SYS_TIME +#include +#endif +#else +#ifdef HAVE_TIME_H +#include +#endif +#endif +#ifndef HAVE_WINDOWS_H +#ifdef HAVE_SYS_SELECT_H +#include +#endif +#ifdef HAVE_SYS_SOCKET_H +#include +#endif +#define SELECTCALLCONV +#endif +#ifndef HAVE_STRUCT_TIMEVAL + struct timeval { + long tv_sec; + long tv_usec; + }; +#endif + extern $sel_retv SELECTCALLCONV select($sel_arg1, + $sel_arg234, + $sel_arg234, + $sel_arg234, + $sel_arg5); + +int main (void) +{ + + $sel_arg1 nfds=0; + $sel_arg234 rfds=0; + $sel_arg234 wfds=0; + $sel_arg234 efds=0; + $sel_retv res = select(nfds, rfds, wfds, efds, 0); + + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + + curl_cv_func_select_args="$sel_arg1,$sel_arg234,$sel_arg5,$sel_retv" + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + fi + done + done + done + done + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $curl_cv_func_select_args" >&5 +$as_echo "$curl_cv_func_select_args" >&6; } # AC-CACHE-CHECK + if test "$curl_cv_func_select_args" = "unknown"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Cannot find proper types to use for select args" >&5 +$as_echo "$as_me: WARNING: Cannot find proper types to use for select args" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: HAVE_SELECT will not be defined" >&5 +$as_echo "$as_me: WARNING: HAVE_SELECT will not be defined" >&2;} + else + select_prev_IFS=$IFS; IFS=',' + set dummy `echo "$curl_cv_func_select_args" | sed 's/\*/\*/g'` + IFS=$select_prev_IFS + shift + # + sel_qual_type_arg5=$3 + # + +cat >>confdefs.h <<_ACEOF +#define SELECT_TYPE_ARG1 $1 +_ACEOF + + +cat >>confdefs.h <<_ACEOF +#define SELECT_TYPE_ARG234 $2 +_ACEOF + + +cat >>confdefs.h <<_ACEOF +#define SELECT_TYPE_RETV $4 +_ACEOF + + # + prev_sh_opts=$- + # + case $prev_sh_opts in + *f*) + ;; + *) + set -f + ;; + esac + # + case "$sel_qual_type_arg5" in + const*) + sel_qual_arg5=const + sel_type_arg5=`echo $sel_qual_type_arg5 | sed 's/^const //'` + ;; + *) + sel_qual_arg5= + sel_type_arg5=$sel_qual_type_arg5 + ;; + esac + # + +cat >>confdefs.h <<_ACEOF +#define SELECT_QUAL_ARG5 $sel_qual_arg5 +_ACEOF + + +cat >>confdefs.h <<_ACEOF +#define SELECT_TYPE_ARG5 $sel_type_arg5 +_ACEOF + + # + case $prev_sh_opts in + *f*) + ;; + *) + set +f + ;; + esac + # + +cat >>confdefs.h <<_ACEOF +#define HAVE_SELECT 1 +_ACEOF + + ac_cv_func_select="yes" + fi + fi + + + + for ac_header in sys/types.h sys/socket.h +do : + as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` +ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" +if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : + cat >>confdefs.h <<_ACEOF +#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + +done + + # + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for recv" >&5 +$as_echo_n "checking for recv... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + +#undef inline +#ifdef HAVE_WINDOWS_H +#ifndef WIN32_LEAN_AND_MEAN +#define WIN32_LEAN_AND_MEAN +#endif +#include +#ifdef HAVE_WINSOCK2_H +#include +#else +#ifdef HAVE_WINSOCK_H +#include +#endif +#endif +#else +#ifdef HAVE_SYS_TYPES_H +#include +#endif +#ifdef HAVE_SYS_SOCKET_H +#include +#endif +#endif + +int main (void) +{ + + recv(0, 0, 0, 0); + + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + curl_cv_recv="yes" + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + curl_cv_recv="no" + +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + # + if test "$curl_cv_recv" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking types of args and return type for recv" >&5 +$as_echo_n "checking types of args and return type for recv... " >&6; } +if test "${curl_cv_func_recv_args+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + + curl_cv_func_recv_args="unknown" + for recv_retv in 'int' 'ssize_t'; do + for recv_arg1 in 'int' 'ssize_t' 'SOCKET'; do + for recv_arg2 in 'char *' 'void *'; do + for recv_arg3 in 'size_t' 'int' 'socklen_t' 'unsigned int'; do + for recv_arg4 in 'int' 'unsigned int'; do + if test "$curl_cv_func_recv_args" = "unknown"; then + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + +#undef inline +#ifdef HAVE_WINDOWS_H +#ifndef WIN32_LEAN_AND_MEAN +#define WIN32_LEAN_AND_MEAN +#endif +#include +#ifdef HAVE_WINSOCK2_H +#include +#else +#ifdef HAVE_WINSOCK_H +#include +#endif +#endif +#define RECVCALLCONV PASCAL +#else +#ifdef HAVE_SYS_TYPES_H +#include +#endif +#ifdef HAVE_SYS_SOCKET_H +#include +#endif +#define RECVCALLCONV +#endif + extern $recv_retv RECVCALLCONV + recv($recv_arg1, $recv_arg2, $recv_arg3, $recv_arg4); + +int main (void) +{ + + $recv_arg1 s=0; + $recv_arg2 buf=0; + $recv_arg3 len=0; + $recv_arg4 flags=0; + $recv_retv res = recv(s, buf, len, flags); + + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + + curl_cv_func_recv_args="$recv_arg1,$recv_arg2,$recv_arg3,$recv_arg4,$recv_retv" + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + fi + done + done + done + done + done + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $curl_cv_func_recv_args" >&5 +$as_echo "$curl_cv_func_recv_args" >&6; } # AC-CACHE-CHECK + if test "$curl_cv_func_recv_args" = "unknown"; then + as_fn_error $? "Cannot find proper types to use for recv args" "$LINENO" 5 + else + recv_prev_IFS=$IFS; IFS=',' + set dummy `echo "$curl_cv_func_recv_args" | sed 's/\*/\*/g'` + IFS=$recv_prev_IFS + shift + # + +cat >>confdefs.h <<_ACEOF +#define RECV_TYPE_ARG1 $1 +_ACEOF + + +cat >>confdefs.h <<_ACEOF +#define RECV_TYPE_ARG2 $2 +_ACEOF + + +cat >>confdefs.h <<_ACEOF +#define RECV_TYPE_ARG3 $3 +_ACEOF + + +cat >>confdefs.h <<_ACEOF +#define RECV_TYPE_ARG4 $4 +_ACEOF + + +cat >>confdefs.h <<_ACEOF +#define RECV_TYPE_RETV $5 +_ACEOF + + # + +cat >>confdefs.h <<_ACEOF +#define HAVE_RECV 1 +_ACEOF + + ac_cv_func_recv="yes" + fi + else + as_fn_error $? "Unable to link function recv" "$LINENO" 5 + fi + + + for ac_header in sys/types.h sys/socket.h +do : + as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` +ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" +if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : + cat >>confdefs.h <<_ACEOF +#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + +done + + # + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for recvfrom" >&5 +$as_echo_n "checking for recvfrom... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + +#undef inline +#ifdef HAVE_WINDOWS_H +#ifndef WIN32_LEAN_AND_MEAN +#define WIN32_LEAN_AND_MEAN +#endif +#include +#ifdef HAVE_WINSOCK2_H +#include +#else +#ifdef HAVE_WINSOCK_H +#include +#endif +#endif +#else +#ifdef HAVE_SYS_TYPES_H +#include +#endif +#ifdef HAVE_SYS_SOCKET_H +#include +#endif +#endif + +int main (void) +{ + + recvfrom(0, 0, 0, 0, 0, 0); + + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + curl_cv_recvfrom="yes" + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + curl_cv_recvfrom="no" + +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + # + if test "$curl_cv_recvfrom" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking types of args and return type for recvfrom" >&5 +$as_echo_n "checking types of args and return type for recvfrom... " >&6; } +if test "${curl_cv_func_recvfrom_args+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + + curl_cv_func_recvfrom_args="unknown" + for recvfrom_retv in 'int' 'ssize_t'; do + for recvfrom_arg1 in 'int' 'ssize_t' 'SOCKET'; do + for recvfrom_arg2 in 'char *' 'void *'; do + for recvfrom_arg3 in 'size_t' 'int' 'socklen_t' 'unsigned int'; do + for recvfrom_arg4 in 'int' 'unsigned int'; do + for recvfrom_arg5 in 'struct sockaddr *' 'void *'; do + for recvfrom_arg6 in 'socklen_t *' 'int *' 'unsigned int *' 'size_t *' 'void *'; do + if test "$curl_cv_func_recvfrom_args" = "unknown"; then + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + +#undef inline +#ifdef HAVE_WINDOWS_H +#ifndef WIN32_LEAN_AND_MEAN +#define WIN32_LEAN_AND_MEAN +#endif +#include +#ifdef HAVE_WINSOCK2_H +#include +#else +#ifdef HAVE_WINSOCK_H +#include +#endif +#endif +#define RECVFROMCALLCONV PASCAL +#else +#ifdef HAVE_SYS_TYPES_H +#include +#endif +#ifdef HAVE_SYS_SOCKET_H +#include +#endif +#define RECVFROMCALLCONV +#endif + extern $recvfrom_retv RECVFROMCALLCONV + recvfrom($recvfrom_arg1, $recvfrom_arg2, + $recvfrom_arg3, $recvfrom_arg4, + $recvfrom_arg5, $recvfrom_arg6); + +int main (void) +{ + + $recvfrom_arg1 s=0; + $recvfrom_arg2 buf=0; + $recvfrom_arg3 len=0; + $recvfrom_arg4 flags=0; + $recvfrom_arg5 addr=0; + $recvfrom_arg6 addrlen=0; + $recvfrom_retv res=0; + res = recvfrom(s, buf, len, flags, addr, addrlen); + + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + + curl_cv_func_recvfrom_args="$recvfrom_arg1,$recvfrom_arg2,$recvfrom_arg3,$recvfrom_arg4,$recvfrom_arg5,$recvfrom_arg6,$recvfrom_retv" + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + fi + done + done + done + done + done + done + done + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $curl_cv_func_recvfrom_args" >&5 +$as_echo "$curl_cv_func_recvfrom_args" >&6; } # AC-CACHE-CHECK + # Nearly last minute change for this release starts here + +cat >>confdefs.h <<_ACEOF +#define HAVE_RECVFROM 1 +_ACEOF + + ac_cv_func_recvfrom="yes" + # Nearly last minute change for this release ends here + if test "$curl_cv_func_recvfrom_args" = "unknown"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Cannot find proper types to use for recvfrom args" >&5 +$as_echo "$as_me: WARNING: Cannot find proper types to use for recvfrom args" >&2;} + else + recvfrom_prev_IFS=$IFS; IFS=',' + set dummy `echo "$curl_cv_func_recvfrom_args" | sed 's/\*/\*/g'` + IFS=$recvfrom_prev_IFS + shift + # + recvfrom_ptrt_arg2=$2 + recvfrom_ptrt_arg5=$5 + recvfrom_ptrt_arg6=$6 + # + +cat >>confdefs.h <<_ACEOF +#define RECVFROM_TYPE_ARG1 $1 +_ACEOF + + +cat >>confdefs.h <<_ACEOF +#define RECVFROM_TYPE_ARG3 $3 +_ACEOF + + +cat >>confdefs.h <<_ACEOF +#define RECVFROM_TYPE_ARG4 $4 +_ACEOF + + +cat >>confdefs.h <<_ACEOF +#define RECVFROM_TYPE_RETV $7 +_ACEOF + + # + prev_sh_opts=$- + # + case $prev_sh_opts in + *f*) + ;; + *) + set -f + ;; + esac + # + recvfrom_type_arg2=`echo $recvfrom_ptrt_arg2 | sed 's/ \*//'` + recvfrom_type_arg5=`echo $recvfrom_ptrt_arg5 | sed 's/ \*//'` + recvfrom_type_arg6=`echo $recvfrom_ptrt_arg6 | sed 's/ \*//'` + # + +cat >>confdefs.h <<_ACEOF +#define RECVFROM_TYPE_ARG2 $recvfrom_type_arg2 +_ACEOF + + +cat >>confdefs.h <<_ACEOF +#define RECVFROM_TYPE_ARG5 $recvfrom_type_arg5 +_ACEOF + + +cat >>confdefs.h <<_ACEOF +#define RECVFROM_TYPE_ARG6 $recvfrom_type_arg6 +_ACEOF + + # + if test "$recvfrom_type_arg2" = "void"; then + +cat >>confdefs.h <<_ACEOF +#define RECVFROM_TYPE_ARG2_IS_VOID 1 +_ACEOF + + fi + if test "$recvfrom_type_arg5" = "void"; then + +cat >>confdefs.h <<_ACEOF +#define RECVFROM_TYPE_ARG5_IS_VOID 1 +_ACEOF + + fi + if test "$recvfrom_type_arg6" = "void"; then + +cat >>confdefs.h <<_ACEOF +#define RECVFROM_TYPE_ARG6_IS_VOID 1 +_ACEOF + + fi + # + case $prev_sh_opts in + *f*) + ;; + *) + set +f + ;; + esac + # + +cat >>confdefs.h <<_ACEOF +#define HAVE_RECVFROM 1 +_ACEOF + + ac_cv_func_recvfrom="yes" + fi + else + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Unable to link function recvfrom" >&5 +$as_echo "$as_me: WARNING: Unable to link function recvfrom" >&2;} + fi + + + for ac_header in sys/types.h sys/socket.h +do : + as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` +ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" +if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : + cat >>confdefs.h <<_ACEOF +#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + +done + + # + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for send" >&5 +$as_echo_n "checking for send... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + +#undef inline +#ifdef HAVE_WINDOWS_H +#ifndef WIN32_LEAN_AND_MEAN +#define WIN32_LEAN_AND_MEAN +#endif +#include +#ifdef HAVE_WINSOCK2_H +#include +#else +#ifdef HAVE_WINSOCK_H +#include +#endif +#endif +#else +#ifdef HAVE_SYS_TYPES_H +#include +#endif +#ifdef HAVE_SYS_SOCKET_H +#include +#endif +#endif + +int main (void) +{ + + send(0, 0, 0, 0); + + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + curl_cv_send="yes" + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + curl_cv_send="no" + +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + # + if test "$curl_cv_send" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking types of args and return type for send" >&5 +$as_echo_n "checking types of args and return type for send... " >&6; } +if test "${curl_cv_func_send_args+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + + curl_cv_func_send_args="unknown" + for send_retv in 'int' 'ssize_t'; do + for send_arg1 in 'int' 'ssize_t' 'SOCKET'; do + for send_arg2 in 'char *' 'void *' 'const char *' 'const void *'; do + for send_arg3 in 'size_t' 'int' 'socklen_t' 'unsigned int'; do + for send_arg4 in 'int' 'unsigned int'; do + if test "$curl_cv_func_send_args" = "unknown"; then + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + +#undef inline +#ifdef HAVE_WINDOWS_H +#ifndef WIN32_LEAN_AND_MEAN +#define WIN32_LEAN_AND_MEAN +#endif +#include +#ifdef HAVE_WINSOCK2_H +#include +#else +#ifdef HAVE_WINSOCK_H +#include +#endif +#endif +#define SENDCALLCONV PASCAL +#else +#ifdef HAVE_SYS_TYPES_H +#include +#endif +#ifdef HAVE_SYS_SOCKET_H +#include +#endif +#define SENDCALLCONV +#endif + extern $send_retv SENDCALLCONV + send($send_arg1, $send_arg2, $send_arg3, $send_arg4); + +int main (void) +{ + + $send_arg1 s=0; + $send_arg3 len=0; + $send_arg4 flags=0; + $send_retv res = send(s, 0, len, flags); + + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + + curl_cv_func_send_args="$send_arg1,$send_arg2,$send_arg3,$send_arg4,$send_retv" + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + fi + done + done + done + done + done + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $curl_cv_func_send_args" >&5 +$as_echo "$curl_cv_func_send_args" >&6; } # AC-CACHE-CHECK + if test "$curl_cv_func_send_args" = "unknown"; then + as_fn_error $? "Cannot find proper types to use for send args" "$LINENO" 5 + else + send_prev_IFS=$IFS; IFS=',' + set dummy `echo "$curl_cv_func_send_args" | sed 's/\*/\*/g'` + IFS=$send_prev_IFS + shift + # + send_qual_type_arg2=$2 + # + +cat >>confdefs.h <<_ACEOF +#define SEND_TYPE_ARG1 $1 +_ACEOF + + +cat >>confdefs.h <<_ACEOF +#define SEND_TYPE_ARG3 $3 +_ACEOF + + +cat >>confdefs.h <<_ACEOF +#define SEND_TYPE_ARG4 $4 +_ACEOF + + +cat >>confdefs.h <<_ACEOF +#define SEND_TYPE_RETV $5 +_ACEOF + + # + prev_sh_opts=$- + # + case $prev_sh_opts in + *f*) + ;; + *) + set -f + ;; + esac + # + case "$send_qual_type_arg2" in + const*) + send_qual_arg2=const + send_type_arg2=`echo $send_qual_type_arg2 | sed 's/^const //'` + ;; + *) + send_qual_arg2= + send_type_arg2=$send_qual_type_arg2 + ;; + esac + # + +cat >>confdefs.h <<_ACEOF +#define SEND_QUAL_ARG2 $send_qual_arg2 +_ACEOF + + +cat >>confdefs.h <<_ACEOF +#define SEND_TYPE_ARG2 $send_type_arg2 +_ACEOF + + # + case $prev_sh_opts in + *f*) + ;; + *) + set +f + ;; + esac + # + +cat >>confdefs.h <<_ACEOF +#define HAVE_SEND 1 +_ACEOF + + ac_cv_func_send="yes" + fi + else + as_fn_error $? "Unable to link function send" "$LINENO" 5 + fi + + + for ac_header in sys/types.h sys/socket.h +do : + as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` +ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" +if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : + cat >>confdefs.h <<_ACEOF +#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + +done + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for MSG_NOSIGNAL" >&5 +$as_echo_n "checking for MSG_NOSIGNAL... " >&6; } +if test "${ac_cv_msg_nosignal+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + +#undef inline +#ifdef HAVE_WINDOWS_H +#ifndef WIN32_LEAN_AND_MEAN +#define WIN32_LEAN_AND_MEAN +#endif +#include +#ifdef HAVE_WINSOCK2_H +#include +#else +#ifdef HAVE_WINSOCK_H +#include +#endif +#endif +#else +#ifdef HAVE_SYS_TYPES_H +#include +#endif +#ifdef HAVE_SYS_SOCKET_H +#include +#endif +#endif + +int main (void) +{ + + int flag=MSG_NOSIGNAL; + + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + + ac_cv_msg_nosignal="yes" + +else + + ac_cv_msg_nosignal="no" + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_msg_nosignal" >&5 +$as_echo "$ac_cv_msg_nosignal" >&6; } + case "$ac_cv_msg_nosignal" in + yes) + +cat >>confdefs.h <<_ACEOF +#define HAVE_MSG_NOSIGNAL 1 +_ACEOF + + ;; + esac + + + +curl_includes_unistd="\ +/* includes start */ +#ifdef HAVE_SYS_TYPES_H +# include +#endif +#ifdef HAVE_UNISTD_H +# include +#endif +/* includes end */" + for ac_header in sys/types.h unistd.h +do : + as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` +ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$curl_includes_unistd +" +if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : + cat >>confdefs.h <<_ACEOF +#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + +done + + + + # + tst_links_alarm="unknown" + tst_proto_alarm="unknown" + tst_compi_alarm="unknown" + tst_allow_alarm="unknown" + # + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if alarm can be linked" >&5 +$as_echo_n "checking if alarm can be linked... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + +#define alarm innocuous_alarm +#ifdef __STDC__ +# include +#else +# include +#endif +#undef alarm +#ifdef __cplusplus +extern "C" +#endif +char alarm (); +#if defined __stub_alarm || defined __stub___alarm +choke me +#endif + +int main (void) +{ +return alarm (); + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + tst_links_alarm="yes" + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + tst_links_alarm="no" + +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + # + if test "$tst_links_alarm" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if alarm is prototyped" >&5 +$as_echo_n "checking if alarm is prototyped... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + $curl_includes_unistd + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "alarm" >/dev/null 2>&1; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + tst_proto_alarm="yes" + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + tst_proto_alarm="no" + +fi +rm -f conftest* + + fi + # + if test "$tst_proto_alarm" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if alarm is compilable" >&5 +$as_echo_n "checking if alarm is compilable... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + + $curl_includes_unistd + +int main (void) +{ + + if(0 != alarm(0)) + return 1; + + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + tst_compi_alarm="yes" + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + tst_compi_alarm="no" + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + fi + # + if test "$tst_compi_alarm" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if alarm usage allowed" >&5 +$as_echo_n "checking if alarm usage allowed... " >&6; } + if test "x$curl_disallow_alarm" != "xyes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + tst_allow_alarm="yes" + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + tst_allow_alarm="no" + fi + fi + # + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if alarm might be used" >&5 +$as_echo_n "checking if alarm might be used... " >&6; } + if test "$tst_links_alarm" = "yes" && + test "$tst_proto_alarm" = "yes" && + test "$tst_compi_alarm" = "yes" && + test "$tst_allow_alarm" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + +cat >>confdefs.h <<_ACEOF +#define HAVE_ALARM 1 +_ACEOF + + ac_cv_func_alarm="yes" + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + ac_cv_func_alarm="no" + fi + + +curl_includes_string="\ +/* includes start */ +#ifdef HAVE_SYS_TYPES_H +# include +#endif +#ifdef HAVE_STRING_H +# include +#endif +#ifdef HAVE_STRINGS_H +# include +#endif +/* includes end */" + for ac_header in sys/types.h string.h strings.h +do : + as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` +ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$curl_includes_string +" +if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : + cat >>confdefs.h <<_ACEOF +#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + +done + + + +curl_includes_libgen="\ +/* includes start */ +#ifdef HAVE_SYS_TYPES_H +# include +#endif +#ifdef HAVE_LIBGEN_H +# include +#endif +/* includes end */" + for ac_header in sys/types.h libgen.h +do : + as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` +ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$curl_includes_libgen +" +if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : + cat >>confdefs.h <<_ACEOF +#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + +done + + + + # + tst_links_basename="unknown" + tst_proto_basename="unknown" + tst_compi_basename="unknown" + tst_allow_basename="unknown" + # + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if basename can be linked" >&5 +$as_echo_n "checking if basename can be linked... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + +#define basename innocuous_basename +#ifdef __STDC__ +# include +#else +# include +#endif +#undef basename +#ifdef __cplusplus +extern "C" +#endif +char basename (); +#if defined __stub_basename || defined __stub___basename +choke me +#endif + +int main (void) +{ +return basename (); + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + tst_links_basename="yes" + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + tst_links_basename="no" + +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + # + if test "$tst_links_basename" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if basename is prototyped" >&5 +$as_echo_n "checking if basename is prototyped... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + $curl_includes_string + $curl_includes_libgen + $curl_includes_unistd + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "basename" >/dev/null 2>&1; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + tst_proto_basename="yes" + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + tst_proto_basename="no" + +fi +rm -f conftest* + + fi + # + if test "$tst_proto_basename" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if basename is compilable" >&5 +$as_echo_n "checking if basename is compilable... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + + $curl_includes_string + $curl_includes_libgen + $curl_includes_unistd + +int main (void) +{ + + if(0 != basename(0)) + return 1; + + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + tst_compi_basename="yes" + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + tst_compi_basename="no" + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + fi + # + if test "$tst_compi_basename" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if basename usage allowed" >&5 +$as_echo_n "checking if basename usage allowed... " >&6; } + if test "x$curl_disallow_basename" != "xyes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + tst_allow_basename="yes" + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + tst_allow_basename="no" + fi + fi + # + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if basename might be used" >&5 +$as_echo_n "checking if basename might be used... " >&6; } + if test "$tst_links_basename" = "yes" && + test "$tst_proto_basename" = "yes" && + test "$tst_compi_basename" = "yes" && + test "$tst_allow_basename" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + +cat >>confdefs.h <<_ACEOF +#define HAVE_BASENAME 1 +_ACEOF + + ac_cv_func_basename="yes" + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + ac_cv_func_basename="no" + fi + + +curl_includes_socket="\ +/* includes start */ +#ifdef HAVE_SYS_TYPES_H +# include +#endif +#ifdef HAVE_SOCKET_H +# include +#endif +/* includes end */" + for ac_header in sys/types.h socket.h +do : + as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` +ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$curl_includes_socket +" +if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : + cat >>confdefs.h <<_ACEOF +#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + +done + + + + # + tst_links_closesocket="unknown" + tst_proto_closesocket="unknown" + tst_compi_closesocket="unknown" + tst_allow_closesocket="unknown" + # + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if closesocket can be linked" >&5 +$as_echo_n "checking if closesocket can be linked... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + + $curl_includes_winsock2 + $curl_includes_socket + +int main (void) +{ + + if(0 != closesocket(0)) + return 1; + + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + tst_links_closesocket="yes" + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + tst_links_closesocket="no" + +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + # + if test "$tst_links_closesocket" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if closesocket is prototyped" >&5 +$as_echo_n "checking if closesocket is prototyped... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + $curl_includes_winsock2 + $curl_includes_socket + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "closesocket" >/dev/null 2>&1; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + tst_proto_closesocket="yes" + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + tst_proto_closesocket="no" + +fi +rm -f conftest* + + fi + # + if test "$tst_proto_closesocket" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if closesocket is compilable" >&5 +$as_echo_n "checking if closesocket is compilable... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + + $curl_includes_winsock2 + $curl_includes_socket + +int main (void) +{ + + if(0 != closesocket(0)) + return 1; + + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + tst_compi_closesocket="yes" + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + tst_compi_closesocket="no" + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + fi + # + if test "$tst_compi_closesocket" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if closesocket usage allowed" >&5 +$as_echo_n "checking if closesocket usage allowed... " >&6; } + if test "x$curl_disallow_closesocket" != "xyes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + tst_allow_closesocket="yes" + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + tst_allow_closesocket="no" + fi + fi + # + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if closesocket might be used" >&5 +$as_echo_n "checking if closesocket might be used... " >&6; } + if test "$tst_links_closesocket" = "yes" && + test "$tst_proto_closesocket" = "yes" && + test "$tst_compi_closesocket" = "yes" && + test "$tst_allow_closesocket" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + +cat >>confdefs.h <<_ACEOF +#define HAVE_CLOSESOCKET 1 +_ACEOF + + ac_cv_func_closesocket="yes" + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + ac_cv_func_closesocket="no" + fi + + + # + tst_links_closesocket_camel="unknown" + tst_proto_closesocket_camel="unknown" + tst_compi_closesocket_camel="unknown" + tst_allow_closesocket_camel="unknown" + # + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if CloseSocket can be linked" >&5 +$as_echo_n "checking if CloseSocket can be linked... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + + $curl_includes_sys_socket + +int main (void) +{ + + if(0 != CloseSocket(0)) + return 1; + + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + tst_links_closesocket_camel="yes" + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + tst_links_closesocket_camel="no" + +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + # + if test "$tst_links_closesocket_camel" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if CloseSocket is prototyped" >&5 +$as_echo_n "checking if CloseSocket is prototyped... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + $curl_includes_sys_socket + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "CloseSocket" >/dev/null 2>&1; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + tst_proto_closesocket_camel="yes" + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + tst_proto_closesocket_camel="no" + +fi +rm -f conftest* + + fi + # + if test "$tst_proto_closesocket_camel" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if CloseSocket is compilable" >&5 +$as_echo_n "checking if CloseSocket is compilable... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + + $curl_includes_sys_socket + +int main (void) +{ + + if(0 != CloseSocket(0)) + return 1; + + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + tst_compi_closesocket_camel="yes" + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + tst_compi_closesocket_camel="no" + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + fi + # + if test "$tst_compi_closesocket_camel" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if CloseSocket usage allowed" >&5 +$as_echo_n "checking if CloseSocket usage allowed... " >&6; } + if test "x$curl_disallow_closesocket_camel" != "xyes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + tst_allow_closesocket_camel="yes" + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + tst_allow_closesocket_camel="no" + fi + fi + # + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if CloseSocket might be used" >&5 +$as_echo_n "checking if CloseSocket might be used... " >&6; } + if test "$tst_links_closesocket_camel" = "yes" && + test "$tst_proto_closesocket_camel" = "yes" && + test "$tst_compi_closesocket_camel" = "yes" && + test "$tst_allow_closesocket_camel" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + +cat >>confdefs.h <<_ACEOF +#define HAVE_CLOSESOCKET_CAMEL 1 +_ACEOF + + ac_cv_func_closesocket_camel="yes" + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + ac_cv_func_closesocket_camel="no" + fi + + + # + tst_links_connect="unknown" + tst_proto_connect="unknown" + tst_compi_connect="unknown" + tst_allow_connect="unknown" + # + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if connect can be linked" >&5 +$as_echo_n "checking if connect can be linked... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + + $curl_includes_winsock2 + $curl_includes_sys_socket + $curl_includes_socket + +int main (void) +{ + + if(0 != connect(0, 0, 0)) + return 1; + + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + tst_links_connect="yes" + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + tst_links_connect="no" + +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + # + if test "$tst_links_connect" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if connect is prototyped" >&5 +$as_echo_n "checking if connect is prototyped... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + $curl_includes_winsock2 + $curl_includes_sys_socket + $curl_includes_socket + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "connect" >/dev/null 2>&1; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + tst_proto_connect="yes" + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + tst_proto_connect="no" + +fi +rm -f conftest* + + fi + # + if test "$tst_proto_connect" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if connect is compilable" >&5 +$as_echo_n "checking if connect is compilable... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + + $curl_includes_winsock2 + $curl_includes_sys_socket + $curl_includes_socket + +int main (void) +{ + + if(0 != connect(0, 0, 0)) + return 1; + + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + tst_compi_connect="yes" + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + tst_compi_connect="no" + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + fi + # + if test "$tst_compi_connect" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if connect usage allowed" >&5 +$as_echo_n "checking if connect usage allowed... " >&6; } + if test "x$curl_disallow_connect" != "xyes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + tst_allow_connect="yes" + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + tst_allow_connect="no" + fi + fi + # + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if connect might be used" >&5 +$as_echo_n "checking if connect might be used... " >&6; } + if test "$tst_links_connect" = "yes" && + test "$tst_proto_connect" = "yes" && + test "$tst_compi_connect" = "yes" && + test "$tst_allow_connect" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + +cat >>confdefs.h <<_ACEOF +#define HAVE_CONNECT 1 +_ACEOF + + ac_cv_func_connect="yes" + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + ac_cv_func_connect="no" + fi + + +curl_includes_fcntl="\ +/* includes start */ +#ifdef HAVE_SYS_TYPES_H +# include +#endif +#ifdef HAVE_UNISTD_H +# include +#endif +#ifdef HAVE_FCNTL_H +# include +#endif +/* includes end */" + for ac_header in sys/types.h unistd.h fcntl.h +do : + as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` +ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$curl_includes_fcntl +" +if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : + cat >>confdefs.h <<_ACEOF +#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + +done + + + + # + tst_links_fcntl="unknown" + tst_proto_fcntl="unknown" + tst_compi_fcntl="unknown" + tst_allow_fcntl="unknown" + # + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if fcntl can be linked" >&5 +$as_echo_n "checking if fcntl can be linked... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + +#define fcntl innocuous_fcntl +#ifdef __STDC__ +# include +#else +# include +#endif +#undef fcntl +#ifdef __cplusplus +extern "C" +#endif +char fcntl (); +#if defined __stub_fcntl || defined __stub___fcntl +choke me +#endif + +int main (void) +{ +return fcntl (); + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + tst_links_fcntl="yes" + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + tst_links_fcntl="no" + +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + # + if test "$tst_links_fcntl" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if fcntl is prototyped" >&5 +$as_echo_n "checking if fcntl is prototyped... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + $curl_includes_fcntl + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "fcntl" >/dev/null 2>&1; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + tst_proto_fcntl="yes" + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + tst_proto_fcntl="no" + +fi +rm -f conftest* + + fi + # + if test "$tst_proto_fcntl" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if fcntl is compilable" >&5 +$as_echo_n "checking if fcntl is compilable... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + + $curl_includes_fcntl + +int main (void) +{ + + if(0 != fcntl(0, 0, 0)) + return 1; + + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + tst_compi_fcntl="yes" + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + tst_compi_fcntl="no" + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + fi + # + if test "$tst_compi_fcntl" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if fcntl usage allowed" >&5 +$as_echo_n "checking if fcntl usage allowed... " >&6; } + if test "x$curl_disallow_fcntl" != "xyes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + tst_allow_fcntl="yes" + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + tst_allow_fcntl="no" + fi + fi + # + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if fcntl might be used" >&5 +$as_echo_n "checking if fcntl might be used... " >&6; } + if test "$tst_links_fcntl" = "yes" && + test "$tst_proto_fcntl" = "yes" && + test "$tst_compi_fcntl" = "yes" && + test "$tst_allow_fcntl" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + +cat >>confdefs.h <<_ACEOF +#define HAVE_FCNTL 1 +_ACEOF + + ac_cv_func_fcntl="yes" + + # + tst_compi_fcntl_o_nonblock="unknown" + tst_allow_fcntl_o_nonblock="unknown" + # + case $host_os in + sunos4* | aix3* | beos*) + curl_disallow_fcntl_o_nonblock="yes" + ;; + esac + # + if test "$ac_cv_func_fcntl" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if fcntl O_NONBLOCK is compilable" >&5 +$as_echo_n "checking if fcntl O_NONBLOCK is compilable... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + + $curl_includes_fcntl + +int main (void) +{ + + int flags = 0; + if(0 != fcntl(0, F_SETFL, flags | O_NONBLOCK)) + return 1; + + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + tst_compi_fcntl_o_nonblock="yes" + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + tst_compi_fcntl_o_nonblock="no" + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + fi + # + if test "$tst_compi_fcntl_o_nonblock" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if fcntl O_NONBLOCK usage allowed" >&5 +$as_echo_n "checking if fcntl O_NONBLOCK usage allowed... " >&6; } + if test "x$curl_disallow_fcntl_o_nonblock" != "xyes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + tst_allow_fcntl_o_nonblock="yes" + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + tst_allow_fcntl_o_nonblock="no" + fi + fi + # + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if fcntl O_NONBLOCK might be used" >&5 +$as_echo_n "checking if fcntl O_NONBLOCK might be used... " >&6; } + if test "$tst_compi_fcntl_o_nonblock" = "yes" && + test "$tst_allow_fcntl_o_nonblock" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + +cat >>confdefs.h <<_ACEOF +#define HAVE_FCNTL_O_NONBLOCK 1 +_ACEOF + + ac_cv_func_fcntl_o_nonblock="yes" + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + ac_cv_func_fcntl_o_nonblock="no" + fi + + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + ac_cv_func_fcntl="no" + fi + + +curl_includes_stdio="\ +/* includes start */ +#ifdef HAVE_SYS_TYPES_H +# include +#endif +#ifdef HAVE_STDIO_H +# include +#endif +/* includes end */" + for ac_header in sys/types.h stdio.h +do : + as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` +ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$curl_includes_stdio +" +if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : + cat >>confdefs.h <<_ACEOF +#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + +done + + + + # + tst_links_fdopen="unknown" + tst_proto_fdopen="unknown" + tst_compi_fdopen="unknown" + tst_allow_fdopen="unknown" + # + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if fdopen can be linked" >&5 +$as_echo_n "checking if fdopen can be linked... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + +#define fdopen innocuous_fdopen +#ifdef __STDC__ +# include +#else +# include +#endif +#undef fdopen +#ifdef __cplusplus +extern "C" +#endif +char fdopen (); +#if defined __stub_fdopen || defined __stub___fdopen +choke me +#endif + +int main (void) +{ +return fdopen (); + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + tst_links_fdopen="yes" + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + tst_links_fdopen="no" + +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + # + if test "$tst_links_fdopen" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if fdopen is prototyped" >&5 +$as_echo_n "checking if fdopen is prototyped... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + $curl_includes_stdio + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "fdopen" >/dev/null 2>&1; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + tst_proto_fdopen="yes" + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + tst_proto_fdopen="no" + +fi +rm -f conftest* + + fi + # + if test "$tst_proto_fdopen" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if fdopen is compilable" >&5 +$as_echo_n "checking if fdopen is compilable... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + + $curl_includes_stdio + +int main (void) +{ + + if(0 != fdopen(0, 0)) + return 1; + + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + tst_compi_fdopen="yes" + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + tst_compi_fdopen="no" + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + fi + # + if test "$tst_compi_fdopen" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if fdopen usage allowed" >&5 +$as_echo_n "checking if fdopen usage allowed... " >&6; } + if test "x$curl_disallow_fdopen" != "xyes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + tst_allow_fdopen="yes" + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + tst_allow_fdopen="no" + fi + fi + # + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if fdopen might be used" >&5 +$as_echo_n "checking if fdopen might be used... " >&6; } + if test "$tst_links_fdopen" = "yes" && + test "$tst_proto_fdopen" = "yes" && + test "$tst_compi_fdopen" = "yes" && + test "$tst_allow_fdopen" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + +cat >>confdefs.h <<_ACEOF +#define HAVE_FDOPEN 1 +_ACEOF + + ac_cv_func_fdopen="yes" + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + ac_cv_func_fdopen="no" + fi + + +curl_includes_netdb="\ +/* includes start */ +#ifdef HAVE_SYS_TYPES_H +# include +#endif +#ifdef HAVE_NETDB_H +# include +#endif +/* includes end */" + for ac_header in sys/types.h netdb.h +do : + as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` +ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$curl_includes_netdb +" +if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : + cat >>confdefs.h <<_ACEOF +#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + +done + + + + # + tst_links_freeaddrinfo="unknown" + tst_proto_freeaddrinfo="unknown" + tst_compi_freeaddrinfo="unknown" + tst_allow_freeaddrinfo="unknown" + # + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if freeaddrinfo can be linked" >&5 +$as_echo_n "checking if freeaddrinfo can be linked... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + + $curl_includes_ws2tcpip + $curl_includes_sys_socket + $curl_includes_netdb + +int main (void) +{ + + freeaddrinfo(0); + + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + tst_links_freeaddrinfo="yes" + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + tst_links_freeaddrinfo="no" + +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + # + if test "$tst_links_freeaddrinfo" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if freeaddrinfo is prototyped" >&5 +$as_echo_n "checking if freeaddrinfo is prototyped... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + $curl_includes_ws2tcpip + $curl_includes_sys_socket + $curl_includes_netdb + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "freeaddrinfo" >/dev/null 2>&1; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + tst_proto_freeaddrinfo="yes" + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + tst_proto_freeaddrinfo="no" + +fi +rm -f conftest* + + fi + # + if test "$tst_proto_freeaddrinfo" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if freeaddrinfo is compilable" >&5 +$as_echo_n "checking if freeaddrinfo is compilable... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + + $curl_includes_ws2tcpip + $curl_includes_sys_socket + $curl_includes_netdb + +int main (void) +{ + + freeaddrinfo(0); + + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + tst_compi_freeaddrinfo="yes" + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + tst_compi_freeaddrinfo="no" + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + fi + # + if test "$tst_compi_freeaddrinfo" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if freeaddrinfo usage allowed" >&5 +$as_echo_n "checking if freeaddrinfo usage allowed... " >&6; } + if test "x$curl_disallow_freeaddrinfo" != "xyes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + tst_allow_freeaddrinfo="yes" + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + tst_allow_freeaddrinfo="no" + fi + fi + # + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if freeaddrinfo might be used" >&5 +$as_echo_n "checking if freeaddrinfo might be used... " >&6; } + if test "$tst_links_freeaddrinfo" = "yes" && + test "$tst_proto_freeaddrinfo" = "yes" && + test "$tst_compi_freeaddrinfo" = "yes" && + test "$tst_allow_freeaddrinfo" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + +cat >>confdefs.h <<_ACEOF +#define HAVE_FREEADDRINFO 1 +_ACEOF + + ac_cv_func_freeaddrinfo="yes" + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + ac_cv_func_freeaddrinfo="no" + fi + + +curl_includes_ifaddrs="\ +/* includes start */ +#ifdef HAVE_SYS_TYPES_H +# include +#endif +#ifdef HAVE_SYS_SOCKET_H +# include +#endif +#ifdef HAVE_NETINET_IN_H +# include +#endif +#ifdef HAVE_IFADDRS_H +# include +#endif +/* includes end */" + for ac_header in sys/types.h sys/socket.h netinet/in.h ifaddrs.h +do : + as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` +ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$curl_includes_ifaddrs +" +if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : + cat >>confdefs.h <<_ACEOF +#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + +done + + + + # + tst_links_freeifaddrs="unknown" + tst_proto_freeifaddrs="unknown" + tst_compi_freeifaddrs="unknown" + tst_allow_freeifaddrs="unknown" + # + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if freeifaddrs can be linked" >&5 +$as_echo_n "checking if freeifaddrs can be linked... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + +#define freeifaddrs innocuous_freeifaddrs +#ifdef __STDC__ +# include +#else +# include +#endif +#undef freeifaddrs +#ifdef __cplusplus +extern "C" +#endif +char freeifaddrs (); +#if defined __stub_freeifaddrs || defined __stub___freeifaddrs +choke me +#endif + +int main (void) +{ +return freeifaddrs (); + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + tst_links_freeifaddrs="yes" + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + tst_links_freeifaddrs="no" + +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + # + if test "$tst_links_freeifaddrs" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if freeifaddrs is prototyped" >&5 +$as_echo_n "checking if freeifaddrs is prototyped... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + $curl_includes_ifaddrs + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "freeifaddrs" >/dev/null 2>&1; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + tst_proto_freeifaddrs="yes" + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + tst_proto_freeifaddrs="no" + +fi +rm -f conftest* + + fi + # + if test "$tst_proto_freeifaddrs" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if freeifaddrs is compilable" >&5 +$as_echo_n "checking if freeifaddrs is compilable... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + + $curl_includes_ifaddrs + +int main (void) +{ + + freeifaddrs(0); + + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + tst_compi_freeifaddrs="yes" + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + tst_compi_freeifaddrs="no" + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + fi + # + if test "$tst_compi_freeifaddrs" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if freeifaddrs usage allowed" >&5 +$as_echo_n "checking if freeifaddrs usage allowed... " >&6; } + if test "x$curl_disallow_freeifaddrs" != "xyes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + tst_allow_freeifaddrs="yes" + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + tst_allow_freeifaddrs="no" + fi + fi + # + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if freeifaddrs might be used" >&5 +$as_echo_n "checking if freeifaddrs might be used... " >&6; } + if test "$tst_links_freeifaddrs" = "yes" && + test "$tst_proto_freeifaddrs" = "yes" && + test "$tst_compi_freeifaddrs" = "yes" && + test "$tst_allow_freeifaddrs" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + +cat >>confdefs.h <<_ACEOF +#define HAVE_FREEIFADDRS 1 +_ACEOF + + ac_cv_func_freeifaddrs="yes" + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + ac_cv_func_freeifaddrs="no" + fi + + +curl_includes_sys_xattr="\ +/* includes start */ +#ifdef HAVE_SYS_TYPES_H +# include +#endif +#ifdef HAVE_SYS_XATTR_H +# include +#endif +/* includes end */" + for ac_header in sys/types.h sys/xattr.h +do : + as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` +ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$curl_includes_sys_xattr +" +if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : + cat >>confdefs.h <<_ACEOF +#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + +done + + + + # + tst_links_fsetxattr="unknown" + tst_proto_fsetxattr="unknown" + tst_compi_fsetxattr="unknown" + tst_allow_fsetxattr="unknown" + tst_nargs_fsetxattr="unknown" + # + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if fsetxattr can be linked" >&5 +$as_echo_n "checking if fsetxattr can be linked... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + +#define fsetxattr innocuous_fsetxattr +#ifdef __STDC__ +# include +#else +# include +#endif +#undef fsetxattr +#ifdef __cplusplus +extern "C" +#endif +char fsetxattr (); +#if defined __stub_fsetxattr || defined __stub___fsetxattr +choke me +#endif + +int main (void) +{ +return fsetxattr (); + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + tst_links_fsetxattr="yes" + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + tst_links_fsetxattr="no" + +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + # + if test "$tst_links_fsetxattr" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if fsetxattr is prototyped" >&5 +$as_echo_n "checking if fsetxattr is prototyped... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + $curl_includes_sys_xattr + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "fsetxattr" >/dev/null 2>&1; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + tst_proto_fsetxattr="yes" + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + tst_proto_fsetxattr="no" + +fi +rm -f conftest* + + fi + # + if test "$tst_proto_fsetxattr" = "yes"; then + if test "$tst_nargs_fsetxattr" = "unknown"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if fsetxattr takes 5 args." >&5 +$as_echo_n "checking if fsetxattr takes 5 args.... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + + $curl_includes_sys_xattr + +int main (void) +{ + + if(0 != fsetxattr(0, 0, 0, 0, 0)) + return 1; + + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + tst_compi_fsetxattr="yes" + tst_nargs_fsetxattr="5" + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + tst_compi_fsetxattr="no" + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + fi + if test "$tst_nargs_fsetxattr" = "unknown"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if fsetxattr takes 6 args." >&5 +$as_echo_n "checking if fsetxattr takes 6 args.... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + + $curl_includes_sys_xattr + +int main (void) +{ + + if(0 != fsetxattr(0, 0, 0, 0, 0, 0)) + return 1; + + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + tst_compi_fsetxattr="yes" + tst_nargs_fsetxattr="6" + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + tst_compi_fsetxattr="no" + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + fi + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if fsetxattr is compilable" >&5 +$as_echo_n "checking if fsetxattr is compilable... " >&6; } + if test "$tst_compi_fsetxattr" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + fi + fi + # + if test "$tst_compi_fsetxattr" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if fsetxattr usage allowed" >&5 +$as_echo_n "checking if fsetxattr usage allowed... " >&6; } + if test "x$curl_disallow_fsetxattr" != "xyes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + tst_allow_fsetxattr="yes" + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + tst_allow_fsetxattr="no" + fi + fi + # + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if fsetxattr might be used" >&5 +$as_echo_n "checking if fsetxattr might be used... " >&6; } + if test "$tst_links_fsetxattr" = "yes" && + test "$tst_proto_fsetxattr" = "yes" && + test "$tst_compi_fsetxattr" = "yes" && + test "$tst_allow_fsetxattr" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + +cat >>confdefs.h <<_ACEOF +#define HAVE_FSETXATTR 1 +_ACEOF + + # + if test "$tst_nargs_fsetxattr" -eq "5"; then + +$as_echo "#define HAVE_FSETXATTR_5 1" >>confdefs.h + + elif test "$tst_nargs_fsetxattr" -eq "6"; then + +$as_echo "#define HAVE_FSETXATTR_6 1" >>confdefs.h + + fi + # + ac_cv_func_fsetxattr="yes" + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + ac_cv_func_fsetxattr="no" + fi + + + # + tst_links_ftruncate="unknown" + tst_proto_ftruncate="unknown" + tst_compi_ftruncate="unknown" + tst_allow_ftruncate="unknown" + # + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if ftruncate can be linked" >&5 +$as_echo_n "checking if ftruncate can be linked... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + +#define ftruncate innocuous_ftruncate +#ifdef __STDC__ +# include +#else +# include +#endif +#undef ftruncate +#ifdef __cplusplus +extern "C" +#endif +char ftruncate (); +#if defined __stub_ftruncate || defined __stub___ftruncate +choke me +#endif + +int main (void) +{ +return ftruncate (); + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + tst_links_ftruncate="yes" + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + tst_links_ftruncate="no" + +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + # + if test "$tst_links_ftruncate" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if ftruncate is prototyped" >&5 +$as_echo_n "checking if ftruncate is prototyped... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + $curl_includes_unistd + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "ftruncate" >/dev/null 2>&1; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + tst_proto_ftruncate="yes" + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + tst_proto_ftruncate="no" + +fi +rm -f conftest* + + fi + # + if test "$tst_proto_ftruncate" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if ftruncate is compilable" >&5 +$as_echo_n "checking if ftruncate is compilable... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + + $curl_includes_unistd + +int main (void) +{ + + if(0 != ftruncate(0, 0)) + return 1; + + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + tst_compi_ftruncate="yes" + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + tst_compi_ftruncate="no" + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + fi + # + if test "$tst_compi_ftruncate" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if ftruncate usage allowed" >&5 +$as_echo_n "checking if ftruncate usage allowed... " >&6; } + if test "x$curl_disallow_ftruncate" != "xyes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + tst_allow_ftruncate="yes" + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + tst_allow_ftruncate="no" + fi + fi + # + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if ftruncate might be used" >&5 +$as_echo_n "checking if ftruncate might be used... " >&6; } + if test "$tst_links_ftruncate" = "yes" && + test "$tst_proto_ftruncate" = "yes" && + test "$tst_compi_ftruncate" = "yes" && + test "$tst_allow_ftruncate" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + +cat >>confdefs.h <<_ACEOF +#define HAVE_FTRUNCATE 1 +_ACEOF + + ac_cv_func_ftruncate="yes" + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + ac_cv_func_ftruncate="no" + fi + + +curl_includes_stdlib="\ +/* includes start */ +#ifdef HAVE_SYS_TYPES_H +# include +#endif +#ifdef HAVE_STDLIB_H +# include +#endif +/* includes end */" + for ac_header in sys/types.h stdlib.h +do : + as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` +ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$curl_includes_stdlib +" +if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : + cat >>confdefs.h <<_ACEOF +#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + +done + + + + # + tst_links_getaddrinfo="unknown" + tst_proto_getaddrinfo="unknown" + tst_compi_getaddrinfo="unknown" + tst_works_getaddrinfo="unknown" + tst_allow_getaddrinfo="unknown" + tst_tsafe_getaddrinfo="unknown" + # + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if getaddrinfo can be linked" >&5 +$as_echo_n "checking if getaddrinfo can be linked... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + + $curl_includes_ws2tcpip + $curl_includes_sys_socket + $curl_includes_netdb + +int main (void) +{ + + if(0 != getaddrinfo(0, 0, 0, 0)) + return 1; + + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + tst_links_getaddrinfo="yes" + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + tst_links_getaddrinfo="no" + +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + # + if test "$tst_links_getaddrinfo" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if getaddrinfo is prototyped" >&5 +$as_echo_n "checking if getaddrinfo is prototyped... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + $curl_includes_ws2tcpip + $curl_includes_sys_socket + $curl_includes_netdb + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "getaddrinfo" >/dev/null 2>&1; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + tst_proto_getaddrinfo="yes" + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + tst_proto_getaddrinfo="no" + +fi +rm -f conftest* + + fi + # + if test "$tst_proto_getaddrinfo" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if getaddrinfo is compilable" >&5 +$as_echo_n "checking if getaddrinfo is compilable... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + + $curl_includes_ws2tcpip + $curl_includes_sys_socket + $curl_includes_netdb + +int main (void) +{ + + if(0 != getaddrinfo(0, 0, 0, 0)) + return 1; + + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + tst_compi_getaddrinfo="yes" + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + tst_compi_getaddrinfo="no" + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + fi + # + if test "x$cross_compiling" != "xyes" && + test "$tst_compi_getaddrinfo" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if getaddrinfo seems to work" >&5 +$as_echo_n "checking if getaddrinfo seems to work... " >&6; } + if test "$cross_compiling" = yes; then : + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "cannot run test program while cross compiling +See \`config.log' for more details" "$LINENO" 5 ; } +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + + $curl_includes_ws2tcpip + $curl_includes_stdlib + $curl_includes_string + $curl_includes_sys_socket + $curl_includes_netdb + +int main (void) +{ + + struct addrinfo hints; + struct addrinfo *ai = 0; + int error; + + memset(&hints, 0, sizeof(hints)); + hints.ai_flags = AI_NUMERICHOST; + hints.ai_family = AF_UNSPEC; + hints.ai_socktype = SOCK_STREAM; + error = getaddrinfo("127.0.0.1", 0, &hints, &ai); + if(error || !ai) + exit(1); /* fail */ + else + exit(0); + + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_run "$LINENO"; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + tst_works_getaddrinfo="yes" + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + tst_works_getaddrinfo="no" + +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext +fi + + fi + # + if test "$tst_compi_getaddrinfo" = "yes" && + test "$tst_works_getaddrinfo" != "no"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if getaddrinfo usage allowed" >&5 +$as_echo_n "checking if getaddrinfo usage allowed... " >&6; } + if test "x$curl_disallow_getaddrinfo" != "xyes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + tst_allow_getaddrinfo="yes" + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + tst_allow_getaddrinfo="no" + fi + fi + # + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if getaddrinfo might be used" >&5 +$as_echo_n "checking if getaddrinfo might be used... " >&6; } + if test "$tst_links_getaddrinfo" = "yes" && + test "$tst_proto_getaddrinfo" = "yes" && + test "$tst_compi_getaddrinfo" = "yes" && + test "$tst_allow_getaddrinfo" = "yes" && + test "$tst_works_getaddrinfo" != "no"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + +cat >>confdefs.h <<_ACEOF +#define HAVE_GETADDRINFO 1 +_ACEOF + + ac_cv_func_getaddrinfo="yes" + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + ac_cv_func_getaddrinfo="no" + ac_cv_func_getaddrinfo_threadsafe="no" + fi + # + if test "$ac_cv_func_getaddrinfo" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if getaddrinfo is threadsafe" >&5 +$as_echo_n "checking if getaddrinfo is threadsafe... " >&6; } + case $host_os in + aix[1234].* | aix5.[01].*) + tst_tsafe_getaddrinfo="no" + ;; + aix*) + tst_tsafe_getaddrinfo="yes" + ;; + darwin[12345].*) + tst_tsafe_getaddrinfo="no" + ;; + darwin*) + tst_tsafe_getaddrinfo="yes" + ;; + freebsd[1234].* | freebsd5.[1234]*) + tst_tsafe_getaddrinfo="no" + ;; + freebsd*) + tst_tsafe_getaddrinfo="yes" + ;; + hpux[123456789].* | hpux10.* | hpux11.0* | hpux11.10*) + tst_tsafe_getaddrinfo="no" + ;; + hpux*) + tst_tsafe_getaddrinfo="yes" + ;; + netbsd[123].*) + tst_tsafe_getaddrinfo="no" + ;; + netbsd*) + tst_tsafe_getaddrinfo="yes" + ;; + *bsd*) + tst_tsafe_getaddrinfo="no" + ;; + solaris2*) + tst_tsafe_getaddrinfo="yes" + ;; + esac + if test "$tst_tsafe_getaddrinfo" = "unknown"; then + + + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + + $curl_includes_ws2tcpip + $curl_includes_sys_socket + $curl_includes_netdb + +int main (void) +{ +#ifdef h_errno + return 0; +#else + force compilation error +#endif +} + + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + + tst_symbol_defined="yes" + +else + + tst_symbol_defined="no" + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + if test "$tst_symbol_defined" = "yes"; then + curl_cv_have_def_h_errno=yes + + else + curl_cv_have_def_h_errno=no + + fi + + if test "$curl_cv_have_def_h_errno" = "no"; then + tst_tsafe_getaddrinfo="no" + fi + fi + if test "$tst_tsafe_getaddrinfo" = "unknown"; then + tst_tsafe_getaddrinfo="yes" + fi + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $tst_tsafe_getaddrinfo" >&5 +$as_echo "$tst_tsafe_getaddrinfo" >&6; } + if test "$tst_tsafe_getaddrinfo" = "yes"; then + +cat >>confdefs.h <<_ACEOF +#define HAVE_GETADDRINFO_THREADSAFE 1 +_ACEOF + + ac_cv_func_getaddrinfo_threadsafe="yes" + else + ac_cv_func_getaddrinfo_threadsafe="no" + fi + fi + + + # + tst_links_gethostbyaddr="unknown" + tst_proto_gethostbyaddr="unknown" + tst_compi_gethostbyaddr="unknown" + tst_allow_gethostbyaddr="unknown" + # + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if gethostbyaddr can be linked" >&5 +$as_echo_n "checking if gethostbyaddr can be linked... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + + $curl_includes_winsock2 + $curl_includes_netdb + +int main (void) +{ + + if(0 != gethostbyaddr(0, 0, 0)) + return 1; + + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + tst_links_gethostbyaddr="yes" + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + tst_links_gethostbyaddr="no" + +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + # + if test "$tst_links_gethostbyaddr" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if gethostbyaddr is prototyped" >&5 +$as_echo_n "checking if gethostbyaddr is prototyped... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + $curl_includes_winsock2 + $curl_includes_netdb + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "gethostbyaddr" >/dev/null 2>&1; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + tst_proto_gethostbyaddr="yes" + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + tst_proto_gethostbyaddr="no" + +fi +rm -f conftest* + + fi + # + if test "$tst_proto_gethostbyaddr" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if gethostbyaddr is compilable" >&5 +$as_echo_n "checking if gethostbyaddr is compilable... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + + $curl_includes_winsock2 + $curl_includes_netdb + +int main (void) +{ + + if(0 != gethostbyaddr(0, 0, 0)) + return 1; + + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + tst_compi_gethostbyaddr="yes" + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + tst_compi_gethostbyaddr="no" + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + fi + # + if test "$tst_compi_gethostbyaddr" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if gethostbyaddr usage allowed" >&5 +$as_echo_n "checking if gethostbyaddr usage allowed... " >&6; } + if test "x$curl_disallow_gethostbyaddr" != "xyes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + tst_allow_gethostbyaddr="yes" + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + tst_allow_gethostbyaddr="no" + fi + fi + # + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if gethostbyaddr might be used" >&5 +$as_echo_n "checking if gethostbyaddr might be used... " >&6; } + if test "$tst_links_gethostbyaddr" = "yes" && + test "$tst_proto_gethostbyaddr" = "yes" && + test "$tst_compi_gethostbyaddr" = "yes" && + test "$tst_allow_gethostbyaddr" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + +cat >>confdefs.h <<_ACEOF +#define HAVE_GETHOSTBYADDR 1 +_ACEOF + + ac_cv_func_gethostbyaddr="yes" + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + ac_cv_func_gethostbyaddr="no" + fi + + + # + tst_links_gethostbyaddr_r="unknown" + tst_proto_gethostbyaddr_r="unknown" + tst_compi_gethostbyaddr_r="unknown" + tst_allow_gethostbyaddr_r="unknown" + tst_nargs_gethostbyaddr_r="unknown" + # + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if gethostbyaddr_r can be linked" >&5 +$as_echo_n "checking if gethostbyaddr_r can be linked... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + +#define gethostbyaddr_r innocuous_gethostbyaddr_r +#ifdef __STDC__ +# include +#else +# include +#endif +#undef gethostbyaddr_r +#ifdef __cplusplus +extern "C" +#endif +char gethostbyaddr_r (); +#if defined __stub_gethostbyaddr_r || defined __stub___gethostbyaddr_r +choke me +#endif + +int main (void) +{ +return gethostbyaddr_r (); + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + tst_links_gethostbyaddr_r="yes" + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + tst_links_gethostbyaddr_r="no" + +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + # + if test "$tst_links_gethostbyaddr_r" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if gethostbyaddr_r is prototyped" >&5 +$as_echo_n "checking if gethostbyaddr_r is prototyped... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + $curl_includes_netdb + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "gethostbyaddr_r" >/dev/null 2>&1; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + tst_proto_gethostbyaddr_r="yes" + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + tst_proto_gethostbyaddr_r="no" + +fi +rm -f conftest* + + fi + # + if test "$tst_proto_gethostbyaddr_r" = "yes"; then + if test "$tst_nargs_gethostbyaddr_r" = "unknown"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if gethostbyaddr_r takes 5 args." >&5 +$as_echo_n "checking if gethostbyaddr_r takes 5 args.... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + + $curl_includes_netdb + +int main (void) +{ + + if(0 != gethostbyaddr_r(0, 0, 0, 0, 0)) + return 1; + + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + tst_compi_gethostbyaddr_r="yes" + tst_nargs_gethostbyaddr_r="5" + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + tst_compi_gethostbyaddr_r="no" + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + fi + if test "$tst_nargs_gethostbyaddr_r" = "unknown"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if gethostbyaddr_r takes 7 args." >&5 +$as_echo_n "checking if gethostbyaddr_r takes 7 args.... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + + $curl_includes_netdb + +int main (void) +{ + + if(0 != gethostbyaddr_r(0, 0, 0, 0, 0, 0, 0)) + return 1; + + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + tst_compi_gethostbyaddr_r="yes" + tst_nargs_gethostbyaddr_r="7" + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + tst_compi_gethostbyaddr_r="no" + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + fi + if test "$tst_nargs_gethostbyaddr_r" = "unknown"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if gethostbyaddr_r takes 8 args." >&5 +$as_echo_n "checking if gethostbyaddr_r takes 8 args.... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + + $curl_includes_netdb + +int main (void) +{ + + if(0 != gethostbyaddr_r(0, 0, 0, 0, 0, 0, 0, 0)) + return 1; + + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + tst_compi_gethostbyaddr_r="yes" + tst_nargs_gethostbyaddr_r="8" + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + tst_compi_gethostbyaddr_r="no" + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + fi + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if gethostbyaddr_r is compilable" >&5 +$as_echo_n "checking if gethostbyaddr_r is compilable... " >&6; } + if test "$tst_compi_gethostbyaddr_r" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + fi + fi + # + if test "$tst_compi_gethostbyaddr_r" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if gethostbyaddr_r usage allowed" >&5 +$as_echo_n "checking if gethostbyaddr_r usage allowed... " >&6; } + if test "x$curl_disallow_gethostbyaddr_r" != "xyes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + tst_allow_gethostbyaddr_r="yes" + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + tst_allow_gethostbyaddr_r="no" + fi + fi + # + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if gethostbyaddr_r might be used" >&5 +$as_echo_n "checking if gethostbyaddr_r might be used... " >&6; } + if test "$tst_links_gethostbyaddr_r" = "yes" && + test "$tst_proto_gethostbyaddr_r" = "yes" && + test "$tst_compi_gethostbyaddr_r" = "yes" && + test "$tst_allow_gethostbyaddr_r" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + +cat >>confdefs.h <<_ACEOF +#define HAVE_GETHOSTBYADDR_R 1 +_ACEOF + + # + if test "$tst_nargs_gethostbyaddr_r" -eq "5"; then + +$as_echo "#define HAVE_GETHOSTBYADDR_R_5 1" >>confdefs.h + + elif test "$tst_nargs_gethostbyaddr_r" -eq "7"; then + +$as_echo "#define HAVE_GETHOSTBYADDR_R_7 1" >>confdefs.h + + elif test "$tst_nargs_gethostbyaddr_r" -eq "8"; then + +$as_echo "#define HAVE_GETHOSTBYADDR_R_8 1" >>confdefs.h + + fi + # + ac_cv_func_gethostbyaddr_r="yes" + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + ac_cv_func_gethostbyaddr_r="no" + fi + + + # + tst_links_gethostbyname="unknown" + tst_proto_gethostbyname="unknown" + tst_compi_gethostbyname="unknown" + tst_allow_gethostbyname="unknown" + # + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if gethostbyname can be linked" >&5 +$as_echo_n "checking if gethostbyname can be linked... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + + $curl_includes_winsock2 + $curl_includes_netdb + +int main (void) +{ + + if(0 != gethostbyname(0)) + return 1; + + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + tst_links_gethostbyname="yes" + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + tst_links_gethostbyname="no" + +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + # + if test "$tst_links_gethostbyname" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if gethostbyname is prototyped" >&5 +$as_echo_n "checking if gethostbyname is prototyped... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + $curl_includes_winsock2 + $curl_includes_netdb + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "gethostbyname" >/dev/null 2>&1; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + tst_proto_gethostbyname="yes" + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + tst_proto_gethostbyname="no" + +fi +rm -f conftest* + + fi + # + if test "$tst_proto_gethostbyname" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if gethostbyname is compilable" >&5 +$as_echo_n "checking if gethostbyname is compilable... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + + $curl_includes_winsock2 + $curl_includes_netdb + +int main (void) +{ + + if(0 != gethostbyname(0)) + return 1; + + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + tst_compi_gethostbyname="yes" + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + tst_compi_gethostbyname="no" + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + fi + # + if test "$tst_compi_gethostbyname" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if gethostbyname usage allowed" >&5 +$as_echo_n "checking if gethostbyname usage allowed... " >&6; } + if test "x$curl_disallow_gethostbyname" != "xyes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + tst_allow_gethostbyname="yes" + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + tst_allow_gethostbyname="no" + fi + fi + # + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if gethostbyname might be used" >&5 +$as_echo_n "checking if gethostbyname might be used... " >&6; } + if test "$tst_links_gethostbyname" = "yes" && + test "$tst_proto_gethostbyname" = "yes" && + test "$tst_compi_gethostbyname" = "yes" && + test "$tst_allow_gethostbyname" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + +cat >>confdefs.h <<_ACEOF +#define HAVE_GETHOSTBYNAME 1 +_ACEOF + + ac_cv_func_gethostbyname="yes" + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + ac_cv_func_gethostbyname="no" + fi + + + # + tst_links_gethostbyname_r="unknown" + tst_proto_gethostbyname_r="unknown" + tst_compi_gethostbyname_r="unknown" + tst_allow_gethostbyname_r="unknown" + tst_nargs_gethostbyname_r="unknown" + # + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if gethostbyname_r can be linked" >&5 +$as_echo_n "checking if gethostbyname_r can be linked... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + +#define gethostbyname_r innocuous_gethostbyname_r +#ifdef __STDC__ +# include +#else +# include +#endif +#undef gethostbyname_r +#ifdef __cplusplus +extern "C" +#endif +char gethostbyname_r (); +#if defined __stub_gethostbyname_r || defined __stub___gethostbyname_r +choke me +#endif + +int main (void) +{ +return gethostbyname_r (); + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + tst_links_gethostbyname_r="yes" + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + tst_links_gethostbyname_r="no" + +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + # + if test "$tst_links_gethostbyname_r" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if gethostbyname_r is prototyped" >&5 +$as_echo_n "checking if gethostbyname_r is prototyped... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + $curl_includes_netdb + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "gethostbyname_r" >/dev/null 2>&1; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + tst_proto_gethostbyname_r="yes" + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + tst_proto_gethostbyname_r="no" + +fi +rm -f conftest* + + fi + # + if test "$tst_proto_gethostbyname_r" = "yes"; then + if test "$tst_nargs_gethostbyname_r" = "unknown"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if gethostbyname_r takes 3 args." >&5 +$as_echo_n "checking if gethostbyname_r takes 3 args.... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + + $curl_includes_netdb + +int main (void) +{ + + if(0 != gethostbyname_r(0, 0, 0)) + return 1; + + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + tst_compi_gethostbyname_r="yes" + tst_nargs_gethostbyname_r="3" + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + tst_compi_gethostbyname_r="no" + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + fi + if test "$tst_nargs_gethostbyname_r" = "unknown"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if gethostbyname_r takes 5 args." >&5 +$as_echo_n "checking if gethostbyname_r takes 5 args.... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + + $curl_includes_netdb + +int main (void) +{ + + if(0 != gethostbyname_r(0, 0, 0, 0, 0)) + return 1; + + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + tst_compi_gethostbyname_r="yes" + tst_nargs_gethostbyname_r="5" + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + tst_compi_gethostbyname_r="no" + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + fi + if test "$tst_nargs_gethostbyname_r" = "unknown"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if gethostbyname_r takes 6 args." >&5 +$as_echo_n "checking if gethostbyname_r takes 6 args.... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + + $curl_includes_netdb + +int main (void) +{ + + if(0 != gethostbyname_r(0, 0, 0, 0, 0, 0)) + return 1; + + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + tst_compi_gethostbyname_r="yes" + tst_nargs_gethostbyname_r="6" + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + tst_compi_gethostbyname_r="no" + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + fi + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if gethostbyname_r is compilable" >&5 +$as_echo_n "checking if gethostbyname_r is compilable... " >&6; } + if test "$tst_compi_gethostbyname_r" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + fi + fi + # + if test "$tst_compi_gethostbyname_r" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if gethostbyname_r usage allowed" >&5 +$as_echo_n "checking if gethostbyname_r usage allowed... " >&6; } + if test "x$curl_disallow_gethostbyname_r" != "xyes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + tst_allow_gethostbyname_r="yes" + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + tst_allow_gethostbyname_r="no" + fi + fi + # + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if gethostbyname_r might be used" >&5 +$as_echo_n "checking if gethostbyname_r might be used... " >&6; } + if test "$tst_links_gethostbyname_r" = "yes" && + test "$tst_proto_gethostbyname_r" = "yes" && + test "$tst_compi_gethostbyname_r" = "yes" && + test "$tst_allow_gethostbyname_r" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + +cat >>confdefs.h <<_ACEOF +#define HAVE_GETHOSTBYNAME_R 1 +_ACEOF + + # + if test "$tst_nargs_gethostbyname_r" -eq "3"; then + +$as_echo "#define HAVE_GETHOSTBYNAME_R_3 1" >>confdefs.h + + elif test "$tst_nargs_gethostbyname_r" -eq "5"; then + +$as_echo "#define HAVE_GETHOSTBYNAME_R_5 1" >>confdefs.h + + elif test "$tst_nargs_gethostbyname_r" -eq "6"; then + +$as_echo "#define HAVE_GETHOSTBYNAME_R_6 1" >>confdefs.h + + fi + # + ac_cv_func_gethostbyname_r="yes" + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + ac_cv_func_gethostbyname_r="no" + fi + + + # + tst_links_gethostname="unknown" + tst_proto_gethostname="unknown" + tst_compi_gethostname="unknown" + tst_allow_gethostname="unknown" + # + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if gethostname can be linked" >&5 +$as_echo_n "checking if gethostname can be linked... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + + $curl_includes_winsock2 + $curl_includes_unistd + +int main (void) +{ + + if(0 != gethostname(0, 0)) + return 1; + + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + tst_links_gethostname="yes" + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + tst_links_gethostname="no" + +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + # + if test "$tst_links_gethostname" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if gethostname is prototyped" >&5 +$as_echo_n "checking if gethostname is prototyped... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + $curl_includes_winsock2 + $curl_includes_unistd + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "gethostname" >/dev/null 2>&1; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + tst_proto_gethostname="yes" + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + tst_proto_gethostname="no" + +fi +rm -f conftest* + + fi + # + if test "$tst_proto_gethostname" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if gethostname is compilable" >&5 +$as_echo_n "checking if gethostname is compilable... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + + $curl_includes_winsock2 + $curl_includes_unistd + +int main (void) +{ + + if(0 != gethostname(0, 0)) + return 1; + + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + tst_compi_gethostname="yes" + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + tst_compi_gethostname="no" + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + fi + # + if test "$tst_compi_gethostname" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if gethostname usage allowed" >&5 +$as_echo_n "checking if gethostname usage allowed... " >&6; } + if test "x$curl_disallow_gethostname" != "xyes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + tst_allow_gethostname="yes" + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + tst_allow_gethostname="no" + fi + fi + # + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if gethostname might be used" >&5 +$as_echo_n "checking if gethostname might be used... " >&6; } + if test "$tst_links_gethostname" = "yes" && + test "$tst_proto_gethostname" = "yes" && + test "$tst_compi_gethostname" = "yes" && + test "$tst_allow_gethostname" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + +cat >>confdefs.h <<_ACEOF +#define HAVE_GETHOSTNAME 1 +_ACEOF + + ac_cv_func_gethostname="yes" + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + ac_cv_func_gethostname="no" + fi + + + # + tst_links_getifaddrs="unknown" + tst_proto_getifaddrs="unknown" + tst_compi_getifaddrs="unknown" + tst_works_getifaddrs="unknown" + tst_allow_getifaddrs="unknown" + # + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if getifaddrs can be linked" >&5 +$as_echo_n "checking if getifaddrs can be linked... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + +#define getifaddrs innocuous_getifaddrs +#ifdef __STDC__ +# include +#else +# include +#endif +#undef getifaddrs +#ifdef __cplusplus +extern "C" +#endif +char getifaddrs (); +#if defined __stub_getifaddrs || defined __stub___getifaddrs +choke me +#endif + +int main (void) +{ +return getifaddrs (); + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + tst_links_getifaddrs="yes" + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + tst_links_getifaddrs="no" + +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + # + if test "$tst_links_getifaddrs" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if getifaddrs is prototyped" >&5 +$as_echo_n "checking if getifaddrs is prototyped... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + $curl_includes_ifaddrs + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "getifaddrs" >/dev/null 2>&1; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + tst_proto_getifaddrs="yes" + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + tst_proto_getifaddrs="no" + +fi +rm -f conftest* + + fi + # + if test "$tst_proto_getifaddrs" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if getifaddrs is compilable" >&5 +$as_echo_n "checking if getifaddrs is compilable... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + + $curl_includes_ifaddrs + +int main (void) +{ + + if(0 != getifaddrs(0)) + return 1; + + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + tst_compi_getifaddrs="yes" + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + tst_compi_getifaddrs="no" + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + fi + # + if test "x$cross_compiling" != "xyes" && + test "$tst_compi_getifaddrs" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if getifaddrs seems to work" >&5 +$as_echo_n "checking if getifaddrs seems to work... " >&6; } + if test "$cross_compiling" = yes; then : + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "cannot run test program while cross compiling +See \`config.log' for more details" "$LINENO" 5 ; } +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + + $curl_includes_stdlib + $curl_includes_ifaddrs + +int main (void) +{ + + struct ifaddrs *ifa = 0; + int error; + + error = getifaddrs(&ifa); + if(error || !ifa) + exit(1); /* fail */ + else + exit(0); + + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_run "$LINENO"; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + tst_works_getifaddrs="yes" + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + tst_works_getifaddrs="no" + +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext +fi + + fi + # + if test "$tst_compi_getifaddrs" = "yes" && + test "$tst_works_getifaddrs" != "no"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if getifaddrs usage allowed" >&5 +$as_echo_n "checking if getifaddrs usage allowed... " >&6; } + if test "x$curl_disallow_getifaddrs" != "xyes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + tst_allow_getifaddrs="yes" + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + tst_allow_getifaddrs="no" + fi + fi + # + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if getifaddrs might be used" >&5 +$as_echo_n "checking if getifaddrs might be used... " >&6; } + if test "$tst_links_getifaddrs" = "yes" && + test "$tst_proto_getifaddrs" = "yes" && + test "$tst_compi_getifaddrs" = "yes" && + test "$tst_allow_getifaddrs" = "yes" && + test "$tst_works_getifaddrs" != "no"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + +cat >>confdefs.h <<_ACEOF +#define HAVE_GETIFADDRS 1 +_ACEOF + + ac_cv_func_getifaddrs="yes" + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + ac_cv_func_getifaddrs="no" + fi + + + # + tst_links_getservbyport_r="unknown" + tst_proto_getservbyport_r="unknown" + tst_compi_getservbyport_r="unknown" + tst_allow_getservbyport_r="unknown" + tst_nargs_getservbyport_r="unknown" + # + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if getservbyport_r can be linked" >&5 +$as_echo_n "checking if getservbyport_r can be linked... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + +#define getservbyport_r innocuous_getservbyport_r +#ifdef __STDC__ +# include +#else +# include +#endif +#undef getservbyport_r +#ifdef __cplusplus +extern "C" +#endif +char getservbyport_r (); +#if defined __stub_getservbyport_r || defined __stub___getservbyport_r +choke me +#endif + +int main (void) +{ +return getservbyport_r (); + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + tst_links_getservbyport_r="yes" + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + tst_links_getservbyport_r="no" + +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + # + if test "$tst_links_getservbyport_r" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if getservbyport_r is prototyped" >&5 +$as_echo_n "checking if getservbyport_r is prototyped... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + $curl_includes_netdb + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "getservbyport_r" >/dev/null 2>&1; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + tst_proto_getservbyport_r="yes" + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + tst_proto_getservbyport_r="no" + +fi +rm -f conftest* + + fi + # + if test "$tst_proto_getservbyport_r" = "yes"; then + if test "$tst_nargs_getservbyport_r" = "unknown"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if getservbyport_r takes 4 args." >&5 +$as_echo_n "checking if getservbyport_r takes 4 args.... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + + $curl_includes_netdb + +int main (void) +{ + + if(0 != getservbyport_r(0, 0, 0, 0)) + return 1; + + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + tst_compi_getservbyport_r="yes" + tst_nargs_getservbyport_r="4" + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + tst_compi_getservbyport_r="no" + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + fi + if test "$tst_nargs_getservbyport_r" = "unknown"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if getservbyport_r takes 5 args." >&5 +$as_echo_n "checking if getservbyport_r takes 5 args.... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + + $curl_includes_netdb + +int main (void) +{ + + if(0 != getservbyport_r(0, 0, 0, 0, 0)) + return 1; + + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + tst_compi_getservbyport_r="yes" + tst_nargs_getservbyport_r="5" + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + tst_compi_getservbyport_r="no" + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + fi + if test "$tst_nargs_getservbyport_r" = "unknown"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if getservbyport_r takes 6 args." >&5 +$as_echo_n "checking if getservbyport_r takes 6 args.... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + + $curl_includes_netdb + +int main (void) +{ + + if(0 != getservbyport_r(0, 0, 0, 0, 0, 0)) + return 1; + + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + tst_compi_getservbyport_r="yes" + tst_nargs_getservbyport_r="6" + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + tst_compi_getservbyport_r="no" + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + fi + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if getservbyport_r is compilable" >&5 +$as_echo_n "checking if getservbyport_r is compilable... " >&6; } + if test "$tst_compi_getservbyport_r" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + fi + fi + # + if test "$tst_compi_getservbyport_r" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if getservbyport_r usage allowed" >&5 +$as_echo_n "checking if getservbyport_r usage allowed... " >&6; } + if test "x$curl_disallow_getservbyport_r" != "xyes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + tst_allow_getservbyport_r="yes" + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + tst_allow_getservbyport_r="no" + fi + fi + # + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if getservbyport_r might be used" >&5 +$as_echo_n "checking if getservbyport_r might be used... " >&6; } + if test "$tst_links_getservbyport_r" = "yes" && + test "$tst_proto_getservbyport_r" = "yes" && + test "$tst_compi_getservbyport_r" = "yes" && + test "$tst_allow_getservbyport_r" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + +cat >>confdefs.h <<_ACEOF +#define HAVE_GETSERVBYPORT_R 1 +_ACEOF + + +cat >>confdefs.h <<_ACEOF +#define GETSERVBYPORT_R_ARGS $tst_nargs_getservbyport_r +_ACEOF + + if test "$tst_nargs_getservbyport_r" -eq "4"; then + +$as_echo "#define GETSERVBYPORT_R_BUFSIZE sizeof(struct servent_data)" >>confdefs.h + + else + +$as_echo "#define GETSERVBYPORT_R_BUFSIZE 4096" >>confdefs.h + + fi + ac_cv_func_getservbyport_r="yes" + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + ac_cv_func_getservbyport_r="no" + fi + + +curl_includes_time="\ +/* includes start */ +#ifdef HAVE_SYS_TYPES_H +# include +#endif +#ifdef HAVE_SYS_TIME_H +# include +# ifdef TIME_WITH_SYS_TIME +# include +# endif +#else +# ifdef HAVE_TIME_H +# include +# endif +#endif +/* includes end */" + for ac_header in sys/types.h sys/time.h time.h +do : + as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` +ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$curl_includes_time +" +if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : + cat >>confdefs.h <<_ACEOF +#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + +done + + + + # + tst_links_gmtime_r="unknown" + tst_proto_gmtime_r="unknown" + tst_compi_gmtime_r="unknown" + tst_works_gmtime_r="unknown" + tst_allow_gmtime_r="unknown" + # + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if gmtime_r can be linked" >&5 +$as_echo_n "checking if gmtime_r can be linked... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + +#define gmtime_r innocuous_gmtime_r +#ifdef __STDC__ +# include +#else +# include +#endif +#undef gmtime_r +#ifdef __cplusplus +extern "C" +#endif +char gmtime_r (); +#if defined __stub_gmtime_r || defined __stub___gmtime_r +choke me +#endif + +int main (void) +{ +return gmtime_r (); + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + tst_links_gmtime_r="yes" + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + tst_links_gmtime_r="no" + +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + # + if test "$tst_links_gmtime_r" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if gmtime_r is prototyped" >&5 +$as_echo_n "checking if gmtime_r is prototyped... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + $curl_includes_time + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "gmtime_r" >/dev/null 2>&1; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + tst_proto_gmtime_r="yes" + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + tst_proto_gmtime_r="no" + +fi +rm -f conftest* + + fi + # + if test "$tst_proto_gmtime_r" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if gmtime_r is compilable" >&5 +$as_echo_n "checking if gmtime_r is compilable... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + + $curl_includes_time + +int main (void) +{ + + if(0 != gmtime_r(0, 0)) + return 1; + + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + tst_compi_gmtime_r="yes" + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + tst_compi_gmtime_r="no" + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + fi + # + if test "x$cross_compiling" != "xyes" && + test "$tst_compi_gmtime_r" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if gmtime_r seems to work" >&5 +$as_echo_n "checking if gmtime_r seems to work... " >&6; } + if test "$cross_compiling" = yes; then : + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "cannot run test program while cross compiling +See \`config.log' for more details" "$LINENO" 5 ; } +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + + $curl_includes_stdlib + $curl_includes_time + +int main (void) +{ + + time_t local = 1170352587; + struct tm *gmt = 0; + struct tm result; + gmt = gmtime_r(&local, &result); + if(gmt) + exit(0); + else + exit(1); + + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_run "$LINENO"; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + tst_works_gmtime_r="yes" + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + tst_works_gmtime_r="no" + +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext +fi + + fi + # + if test "$tst_compi_gmtime_r" = "yes" && + test "$tst_works_gmtime_r" != "no"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if gmtime_r usage allowed" >&5 +$as_echo_n "checking if gmtime_r usage allowed... " >&6; } + if test "x$curl_disallow_gmtime_r" != "xyes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + tst_allow_gmtime_r="yes" + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + tst_allow_gmtime_r="no" + fi + fi + # + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if gmtime_r might be used" >&5 +$as_echo_n "checking if gmtime_r might be used... " >&6; } + if test "$tst_links_gmtime_r" = "yes" && + test "$tst_proto_gmtime_r" = "yes" && + test "$tst_compi_gmtime_r" = "yes" && + test "$tst_allow_gmtime_r" = "yes" && + test "$tst_works_gmtime_r" != "no"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + +cat >>confdefs.h <<_ACEOF +#define HAVE_GMTIME_R 1 +_ACEOF + + ac_cv_func_gmtime_r="yes" + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + ac_cv_func_gmtime_r="no" + fi + + +curl_includes_arpa_inet="\ +/* includes start */ +#ifdef HAVE_SYS_TYPES_H +# include +#endif +#ifdef HAVE_SYS_SOCKET_H +# include +#endif +#ifdef HAVE_NETINET_IN_H +# include +#endif +#ifdef HAVE_ARPA_INET_H +# include +#endif +/* includes end */" + for ac_header in sys/types.h sys/socket.h netinet/in.h arpa/inet.h +do : + as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` +ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$curl_includes_arpa_inet +" +if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : + cat >>confdefs.h <<_ACEOF +#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + +done + + + + # + tst_links_inet_ntoa_r="unknown" + tst_proto_inet_ntoa_r="unknown" + tst_compi_inet_ntoa_r="unknown" + tst_allow_inet_ntoa_r="unknown" + tst_nargs_inet_ntoa_r="unknown" + # + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if inet_ntoa_r can be linked" >&5 +$as_echo_n "checking if inet_ntoa_r can be linked... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + +#define inet_ntoa_r innocuous_inet_ntoa_r +#ifdef __STDC__ +# include +#else +# include +#endif +#undef inet_ntoa_r +#ifdef __cplusplus +extern "C" +#endif +char inet_ntoa_r (); +#if defined __stub_inet_ntoa_r || defined __stub___inet_ntoa_r +choke me +#endif + +int main (void) +{ +return inet_ntoa_r (); + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + tst_links_inet_ntoa_r="yes" + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + tst_links_inet_ntoa_r="no" + +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + # + if test "$tst_links_inet_ntoa_r" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if inet_ntoa_r is prototyped" >&5 +$as_echo_n "checking if inet_ntoa_r is prototyped... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + $curl_includes_arpa_inet + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "inet_ntoa_r" >/dev/null 2>&1; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + tst_proto_inet_ntoa_r="yes" + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + tst_proto_inet_ntoa_r="no" + +fi +rm -f conftest* + + fi + # + if test "$tst_proto_inet_ntoa_r" = "yes"; then + if test "$tst_nargs_inet_ntoa_r" = "unknown"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if inet_ntoa_r takes 2 args." >&5 +$as_echo_n "checking if inet_ntoa_r takes 2 args.... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + + $curl_includes_arpa_inet + +int main (void) +{ + + struct in_addr addr; + if(0 != inet_ntoa_r(addr, 0)) + return 1; + + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + tst_compi_inet_ntoa_r="yes" + tst_nargs_inet_ntoa_r="2" + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + tst_compi_inet_ntoa_r="no" + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + fi + if test "$tst_nargs_inet_ntoa_r" = "unknown"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if inet_ntoa_r takes 3 args." >&5 +$as_echo_n "checking if inet_ntoa_r takes 3 args.... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + + $curl_includes_arpa_inet + +int main (void) +{ + + struct in_addr addr; + if(0 != inet_ntoa_r(addr, 0, 0)) + return 1; + + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + tst_compi_inet_ntoa_r="yes" + tst_nargs_inet_ntoa_r="3" + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + tst_compi_inet_ntoa_r="no" + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + fi + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if inet_ntoa_r is compilable" >&5 +$as_echo_n "checking if inet_ntoa_r is compilable... " >&6; } + if test "$tst_compi_inet_ntoa_r" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + fi + fi + # + if test "$tst_compi_inet_ntoa_r" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if inet_ntoa_r usage allowed" >&5 +$as_echo_n "checking if inet_ntoa_r usage allowed... " >&6; } + if test "x$curl_disallow_inet_ntoa_r" != "xyes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + tst_allow_inet_ntoa_r="yes" + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + tst_allow_inet_ntoa_r="no" + fi + fi + # + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if inet_ntoa_r might be used" >&5 +$as_echo_n "checking if inet_ntoa_r might be used... " >&6; } + if test "$tst_links_inet_ntoa_r" = "yes" && + test "$tst_proto_inet_ntoa_r" = "yes" && + test "$tst_compi_inet_ntoa_r" = "yes" && + test "$tst_allow_inet_ntoa_r" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + +cat >>confdefs.h <<_ACEOF +#define HAVE_INET_NTOA_R 1 +_ACEOF + + # + if test "$tst_nargs_inet_ntoa_r" -eq "2"; then + +$as_echo "#define HAVE_INET_NTOA_R_2 1" >>confdefs.h + + elif test "$tst_nargs_inet_ntoa_r" -eq "3"; then + +$as_echo "#define HAVE_INET_NTOA_R_3 1" >>confdefs.h + + fi + # + ac_cv_func_inet_ntoa_r="yes" + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + ac_cv_func_inet_ntoa_r="no" + fi + + + # + tst_links_inet_ntop="unknown" + tst_proto_inet_ntop="unknown" + tst_compi_inet_ntop="unknown" + tst_works_inet_ntop="unknown" + tst_allow_inet_ntop="unknown" + # + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if inet_ntop can be linked" >&5 +$as_echo_n "checking if inet_ntop can be linked... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + +#define inet_ntop innocuous_inet_ntop +#ifdef __STDC__ +# include +#else +# include +#endif +#undef inet_ntop +#ifdef __cplusplus +extern "C" +#endif +char inet_ntop (); +#if defined __stub_inet_ntop || defined __stub___inet_ntop +choke me +#endif + +int main (void) +{ +return inet_ntop (); + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + tst_links_inet_ntop="yes" + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + tst_links_inet_ntop="no" + +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + # + if test "$tst_links_inet_ntop" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if inet_ntop is prototyped" >&5 +$as_echo_n "checking if inet_ntop is prototyped... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + $curl_includes_arpa_inet + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "inet_ntop" >/dev/null 2>&1; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + tst_proto_inet_ntop="yes" + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + tst_proto_inet_ntop="no" + +fi +rm -f conftest* + + fi + # + if test "$tst_proto_inet_ntop" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if inet_ntop is compilable" >&5 +$as_echo_n "checking if inet_ntop is compilable... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + + $curl_includes_arpa_inet + +int main (void) +{ + + if(0 != inet_ntop(0, 0, 0, 0)) + return 1; + + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + tst_compi_inet_ntop="yes" + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + tst_compi_inet_ntop="no" + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + fi + # + if test "x$cross_compiling" != "xyes" && + test "$tst_compi_inet_ntop" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if inet_ntop seems to work" >&5 +$as_echo_n "checking if inet_ntop seems to work... " >&6; } + if test "$cross_compiling" = yes; then : + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "cannot run test program while cross compiling +See \`config.log' for more details" "$LINENO" 5 ; } +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + + $curl_includes_stdlib + $curl_includes_arpa_inet + $curl_includes_string + +int main (void) +{ + + char ipv6res[sizeof("ffff:ffff:ffff:ffff:ffff:ffff:255.255.255.255")]; + char ipv4res[sizeof "255.255.255.255"]; + unsigned char ipv6a[26]; + unsigned char ipv4a[5]; + char *ipv6ptr = 0; + char *ipv4ptr = 0; + /* - */ + ipv4res[0] = '\0'; + ipv4a[0] = 0xc0; + ipv4a[1] = 0xa8; + ipv4a[2] = 0x64; + ipv4a[3] = 0x01; + ipv4a[4] = 0x01; + /* - */ + ipv4ptr = inet_ntop(AF_INET, ipv4a, ipv4res, sizeof(ipv4res)); + if(!ipv4ptr) + exit(1); /* fail */ + if(ipv4ptr != ipv4res) + exit(1); /* fail */ + if(!ipv4ptr[0]) + exit(1); /* fail */ + if(memcmp(ipv4res, "192.168.100.1", 13) != 0) + exit(1); /* fail */ + /* - */ + ipv6res[0] = '\0'; + memset(ipv6a, 0, sizeof(ipv6a)); + ipv6a[0] = 0xfe; + ipv6a[1] = 0x80; + ipv6a[8] = 0x02; + ipv6a[9] = 0x14; + ipv6a[10] = 0x4f; + ipv6a[11] = 0xff; + ipv6a[12] = 0xfe; + ipv6a[13] = 0x0b; + ipv6a[14] = 0x76; + ipv6a[15] = 0xc8; + ipv6a[25] = 0x01; + /* - */ + ipv6ptr = inet_ntop(AF_INET6, ipv6a, ipv6res, sizeof(ipv6res)); + if(!ipv6ptr) + exit(1); /* fail */ + if(ipv6ptr != ipv6res) + exit(1); /* fail */ + if(!ipv6ptr[0]) + exit(1); /* fail */ + if(memcmp(ipv6res, "fe80::214:4fff:fe0b:76c8", 24) != 0) + exit(1); /* fail */ + /* - */ + exit(0); + + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_run "$LINENO"; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + tst_works_inet_ntop="yes" + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + tst_works_inet_ntop="no" + +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext +fi + + fi + # + if test "$tst_compi_inet_ntop" = "yes" && + test "$tst_works_inet_ntop" != "no"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if inet_ntop usage allowed" >&5 +$as_echo_n "checking if inet_ntop usage allowed... " >&6; } + if test "x$curl_disallow_inet_ntop" != "xyes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + tst_allow_inet_ntop="yes" + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + tst_allow_inet_ntop="no" + fi + fi + # + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if inet_ntop might be used" >&5 +$as_echo_n "checking if inet_ntop might be used... " >&6; } + if test "$tst_links_inet_ntop" = "yes" && + test "$tst_proto_inet_ntop" = "yes" && + test "$tst_compi_inet_ntop" = "yes" && + test "$tst_allow_inet_ntop" = "yes" && + test "$tst_works_inet_ntop" != "no"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + +cat >>confdefs.h <<_ACEOF +#define HAVE_INET_NTOP 1 +_ACEOF + + ac_cv_func_inet_ntop="yes" + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + ac_cv_func_inet_ntop="no" + fi + + + # + tst_links_inet_pton="unknown" + tst_proto_inet_pton="unknown" + tst_compi_inet_pton="unknown" + tst_works_inet_pton="unknown" + tst_allow_inet_pton="unknown" + # + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if inet_pton can be linked" >&5 +$as_echo_n "checking if inet_pton can be linked... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + +#define inet_pton innocuous_inet_pton +#ifdef __STDC__ +# include +#else +# include +#endif +#undef inet_pton +#ifdef __cplusplus +extern "C" +#endif +char inet_pton (); +#if defined __stub_inet_pton || defined __stub___inet_pton +choke me +#endif + +int main (void) +{ +return inet_pton (); + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + tst_links_inet_pton="yes" + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + tst_links_inet_pton="no" + +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + # + if test "$tst_links_inet_pton" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if inet_pton is prototyped" >&5 +$as_echo_n "checking if inet_pton is prototyped... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + $curl_includes_arpa_inet + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "inet_pton" >/dev/null 2>&1; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + tst_proto_inet_pton="yes" + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + tst_proto_inet_pton="no" + +fi +rm -f conftest* + + fi + # + if test "$tst_proto_inet_pton" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if inet_pton is compilable" >&5 +$as_echo_n "checking if inet_pton is compilable... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + + $curl_includes_arpa_inet + +int main (void) +{ + + if(0 != inet_pton(0, 0, 0)) + return 1; + + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + tst_compi_inet_pton="yes" + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + tst_compi_inet_pton="no" + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + fi + # + if test "x$cross_compiling" != "xyes" && + test "$tst_compi_inet_pton" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if inet_pton seems to work" >&5 +$as_echo_n "checking if inet_pton seems to work... " >&6; } + if test "$cross_compiling" = yes; then : + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "cannot run test program while cross compiling +See \`config.log' for more details" "$LINENO" 5 ; } +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + + $curl_includes_stdlib + $curl_includes_arpa_inet + $curl_includes_string + +int main (void) +{ + + unsigned char ipv6a[16+1]; + unsigned char ipv4a[4+1]; + const char *ipv6src = "fe80::214:4fff:fe0b:76c8"; + const char *ipv4src = "192.168.100.1"; + /* - */ + memset(ipv4a, 1, sizeof(ipv4a)); + if(1 != inet_pton(AF_INET, ipv4src, ipv4a)) + exit(1); /* fail */ + /* - */ + if( (ipv4a[0] != 0xc0) || + (ipv4a[1] != 0xa8) || + (ipv4a[2] != 0x64) || + (ipv4a[3] != 0x01) || + (ipv4a[4] != 0x01) ) + exit(1); /* fail */ + /* - */ + memset(ipv6a, 1, sizeof(ipv6a)); + if(1 != inet_pton(AF_INET6, ipv6src, ipv6a)) + exit(1); /* fail */ + /* - */ + if( (ipv6a[0] != 0xfe) || + (ipv6a[1] != 0x80) || + (ipv6a[8] != 0x02) || + (ipv6a[9] != 0x14) || + (ipv6a[10] != 0x4f) || + (ipv6a[11] != 0xff) || + (ipv6a[12] != 0xfe) || + (ipv6a[13] != 0x0b) || + (ipv6a[14] != 0x76) || + (ipv6a[15] != 0xc8) || + (ipv6a[16] != 0x01) ) + exit(1); /* fail */ + /* - */ + if( (ipv6a[2] != 0x0) || + (ipv6a[3] != 0x0) || + (ipv6a[4] != 0x0) || + (ipv6a[5] != 0x0) || + (ipv6a[6] != 0x0) || + (ipv6a[7] != 0x0) ) + exit(1); /* fail */ + /* - */ + exit(0); + + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_run "$LINENO"; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + tst_works_inet_pton="yes" + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + tst_works_inet_pton="no" + +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext +fi + + fi + # + if test "$tst_compi_inet_pton" = "yes" && + test "$tst_works_inet_pton" != "no"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if inet_pton usage allowed" >&5 +$as_echo_n "checking if inet_pton usage allowed... " >&6; } + if test "x$curl_disallow_inet_pton" != "xyes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + tst_allow_inet_pton="yes" + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + tst_allow_inet_pton="no" + fi + fi + # + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if inet_pton might be used" >&5 +$as_echo_n "checking if inet_pton might be used... " >&6; } + if test "$tst_links_inet_pton" = "yes" && + test "$tst_proto_inet_pton" = "yes" && + test "$tst_compi_inet_pton" = "yes" && + test "$tst_allow_inet_pton" = "yes" && + test "$tst_works_inet_pton" != "no"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + +cat >>confdefs.h <<_ACEOF +#define HAVE_INET_PTON 1 +_ACEOF + + ac_cv_func_inet_pton="yes" + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + ac_cv_func_inet_pton="no" + fi + + +curl_includes_stropts="\ +/* includes start */ +#ifdef HAVE_SYS_TYPES_H +# include +#endif +#ifdef HAVE_UNISTD_H +# include +#endif +#ifdef HAVE_SYS_SOCKET_H +# include +#endif +#ifdef HAVE_SYS_IOCTL_H +# include +#endif +#ifdef HAVE_STROPTS_H +# include +#endif +/* includes end */" + for ac_header in sys/types.h unistd.h sys/socket.h sys/ioctl.h stropts.h +do : + as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` +ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$curl_includes_stropts +" +if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : + cat >>confdefs.h <<_ACEOF +#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + +done + + + + # + tst_links_ioctl="unknown" + tst_proto_ioctl="unknown" + tst_compi_ioctl="unknown" + tst_allow_ioctl="unknown" + # + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if ioctl can be linked" >&5 +$as_echo_n "checking if ioctl can be linked... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + +#define ioctl innocuous_ioctl +#ifdef __STDC__ +# include +#else +# include +#endif +#undef ioctl +#ifdef __cplusplus +extern "C" +#endif +char ioctl (); +#if defined __stub_ioctl || defined __stub___ioctl +choke me +#endif + +int main (void) +{ +return ioctl (); + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + tst_links_ioctl="yes" + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + tst_links_ioctl="no" + +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + # + if test "$tst_links_ioctl" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if ioctl is prototyped" >&5 +$as_echo_n "checking if ioctl is prototyped... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + $curl_includes_stropts + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "ioctl" >/dev/null 2>&1; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + tst_proto_ioctl="yes" + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + tst_proto_ioctl="no" + +fi +rm -f conftest* + + fi + # + if test "$tst_proto_ioctl" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if ioctl is compilable" >&5 +$as_echo_n "checking if ioctl is compilable... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + + $curl_includes_stropts + +int main (void) +{ + + if(0 != ioctl(0, 0, 0)) + return 1; + + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + tst_compi_ioctl="yes" + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + tst_compi_ioctl="no" + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + fi + # + if test "$tst_compi_ioctl" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if ioctl usage allowed" >&5 +$as_echo_n "checking if ioctl usage allowed... " >&6; } + if test "x$curl_disallow_ioctl" != "xyes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + tst_allow_ioctl="yes" + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + tst_allow_ioctl="no" + fi + fi + # + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if ioctl might be used" >&5 +$as_echo_n "checking if ioctl might be used... " >&6; } + if test "$tst_links_ioctl" = "yes" && + test "$tst_proto_ioctl" = "yes" && + test "$tst_compi_ioctl" = "yes" && + test "$tst_allow_ioctl" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + +cat >>confdefs.h <<_ACEOF +#define HAVE_IOCTL 1 +_ACEOF + + ac_cv_func_ioctl="yes" + + # + tst_compi_ioctl_fionbio="unknown" + tst_allow_ioctl_fionbio="unknown" + # + if test "$ac_cv_func_ioctl" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if ioctl FIONBIO is compilable" >&5 +$as_echo_n "checking if ioctl FIONBIO is compilable... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + + $curl_includes_stropts + +int main (void) +{ + + int flags = 0; + if(0 != ioctl(0, FIONBIO, &flags)) + return 1; + + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + tst_compi_ioctl_fionbio="yes" + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + tst_compi_ioctl_fionbio="no" + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + fi + # + if test "$tst_compi_ioctl_fionbio" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if ioctl FIONBIO usage allowed" >&5 +$as_echo_n "checking if ioctl FIONBIO usage allowed... " >&6; } + if test "x$curl_disallow_ioctl_fionbio" != "xyes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + tst_allow_ioctl_fionbio="yes" + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + tst_allow_ioctl_fionbio="no" + fi + fi + # + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if ioctl FIONBIO might be used" >&5 +$as_echo_n "checking if ioctl FIONBIO might be used... " >&6; } + if test "$tst_compi_ioctl_fionbio" = "yes" && + test "$tst_allow_ioctl_fionbio" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + +cat >>confdefs.h <<_ACEOF +#define HAVE_IOCTL_FIONBIO 1 +_ACEOF + + ac_cv_func_ioctl_fionbio="yes" + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + ac_cv_func_ioctl_fionbio="no" + fi + + + # + tst_compi_ioctl_siocgifaddr="unknown" + tst_allow_ioctl_siocgifaddr="unknown" + # + if test "$ac_cv_func_ioctl" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if ioctl SIOCGIFADDR is compilable" >&5 +$as_echo_n "checking if ioctl SIOCGIFADDR is compilable... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + + $curl_includes_stropts + #include + +int main (void) +{ + + struct ifreq ifr; + if(0 != ioctl(0, SIOCGIFADDR, &ifr)) + return 1; + + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + tst_compi_ioctl_siocgifaddr="yes" + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + tst_compi_ioctl_siocgifaddr="no" + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + fi + # + if test "$tst_compi_ioctl_siocgifaddr" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if ioctl SIOCGIFADDR usage allowed" >&5 +$as_echo_n "checking if ioctl SIOCGIFADDR usage allowed... " >&6; } + if test "x$curl_disallow_ioctl_siocgifaddr" != "xyes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + tst_allow_ioctl_siocgifaddr="yes" + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + tst_allow_ioctl_siocgifaddr="no" + fi + fi + # + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if ioctl SIOCGIFADDR might be used" >&5 +$as_echo_n "checking if ioctl SIOCGIFADDR might be used... " >&6; } + if test "$tst_compi_ioctl_siocgifaddr" = "yes" && + test "$tst_allow_ioctl_siocgifaddr" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + +cat >>confdefs.h <<_ACEOF +#define HAVE_IOCTL_SIOCGIFADDR 1 +_ACEOF + + ac_cv_func_ioctl_siocgifaddr="yes" + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + ac_cv_func_ioctl_siocgifaddr="no" + fi + + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + ac_cv_func_ioctl="no" + fi + + + # + tst_links_ioctlsocket="unknown" + tst_proto_ioctlsocket="unknown" + tst_compi_ioctlsocket="unknown" + tst_allow_ioctlsocket="unknown" + # + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if ioctlsocket can be linked" >&5 +$as_echo_n "checking if ioctlsocket can be linked... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + + $curl_includes_winsock2 + +int main (void) +{ + + if(0 != ioctlsocket(0, 0, 0)) + return 1; + + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + tst_links_ioctlsocket="yes" + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + tst_links_ioctlsocket="no" + +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + # + if test "$tst_links_ioctlsocket" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if ioctlsocket is prototyped" >&5 +$as_echo_n "checking if ioctlsocket is prototyped... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + $curl_includes_winsock2 + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "ioctlsocket" >/dev/null 2>&1; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + tst_proto_ioctlsocket="yes" + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + tst_proto_ioctlsocket="no" + +fi +rm -f conftest* + + fi + # + if test "$tst_proto_ioctlsocket" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if ioctlsocket is compilable" >&5 +$as_echo_n "checking if ioctlsocket is compilable... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + + $curl_includes_winsock2 + +int main (void) +{ + + if(0 != ioctlsocket(0, 0, 0)) + return 1; + + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + tst_compi_ioctlsocket="yes" + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + tst_compi_ioctlsocket="no" + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + fi + # + if test "$tst_compi_ioctlsocket" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if ioctlsocket usage allowed" >&5 +$as_echo_n "checking if ioctlsocket usage allowed... " >&6; } + if test "x$curl_disallow_ioctlsocket" != "xyes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + tst_allow_ioctlsocket="yes" + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + tst_allow_ioctlsocket="no" + fi + fi + # + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if ioctlsocket might be used" >&5 +$as_echo_n "checking if ioctlsocket might be used... " >&6; } + if test "$tst_links_ioctlsocket" = "yes" && + test "$tst_proto_ioctlsocket" = "yes" && + test "$tst_compi_ioctlsocket" = "yes" && + test "$tst_allow_ioctlsocket" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + +cat >>confdefs.h <<_ACEOF +#define HAVE_IOCTLSOCKET 1 +_ACEOF + + ac_cv_func_ioctlsocket="yes" + + # + tst_compi_ioctlsocket_fionbio="unknown" + tst_allow_ioctlsocket_fionbio="unknown" + # + if test "$ac_cv_func_ioctlsocket" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if ioctlsocket FIONBIO is compilable" >&5 +$as_echo_n "checking if ioctlsocket FIONBIO is compilable... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + + $curl_includes_winsock2 + +int main (void) +{ + + int flags = 0; + if(0 != ioctlsocket(0, FIONBIO, &flags)) + return 1; + + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + tst_compi_ioctlsocket_fionbio="yes" + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + tst_compi_ioctlsocket_fionbio="no" + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + fi + # + if test "$tst_compi_ioctlsocket_fionbio" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if ioctlsocket FIONBIO usage allowed" >&5 +$as_echo_n "checking if ioctlsocket FIONBIO usage allowed... " >&6; } + if test "x$curl_disallow_ioctlsocket_fionbio" != "xyes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + tst_allow_ioctlsocket_fionbio="yes" + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + tst_allow_ioctlsocket_fionbio="no" + fi + fi + # + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if ioctlsocket FIONBIO might be used" >&5 +$as_echo_n "checking if ioctlsocket FIONBIO might be used... " >&6; } + if test "$tst_compi_ioctlsocket_fionbio" = "yes" && + test "$tst_allow_ioctlsocket_fionbio" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + +cat >>confdefs.h <<_ACEOF +#define HAVE_IOCTLSOCKET_FIONBIO 1 +_ACEOF + + ac_cv_func_ioctlsocket_fionbio="yes" + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + ac_cv_func_ioctlsocket_fionbio="no" + fi + + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + ac_cv_func_ioctlsocket="no" + fi + + + # + tst_links_ioctlsocket_camel="unknown" + tst_proto_ioctlsocket_camel="unknown" + tst_compi_ioctlsocket_camel="unknown" + tst_allow_ioctlsocket_camel="unknown" + # + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if IoctlSocket can be linked" >&5 +$as_echo_n "checking if IoctlSocket can be linked... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + +#define IoctlSocket innocuous_IoctlSocket +#ifdef __STDC__ +# include +#else +# include +#endif +#undef IoctlSocket +#ifdef __cplusplus +extern "C" +#endif +char IoctlSocket (); +#if defined __stub_IoctlSocket || defined __stub___IoctlSocket +choke me +#endif + +int main (void) +{ +return IoctlSocket (); + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + tst_links_ioctlsocket_camel="yes" + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + tst_links_ioctlsocket_camel="no" + +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + # + if test "$tst_links_ioctlsocket_camel" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if IoctlSocket is prototyped" >&5 +$as_echo_n "checking if IoctlSocket is prototyped... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + $curl_includes_stropts + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "IoctlSocket" >/dev/null 2>&1; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + tst_proto_ioctlsocket_camel="yes" + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + tst_proto_ioctlsocket_camel="no" + +fi +rm -f conftest* + + fi + # + if test "$tst_proto_ioctlsocket_camel" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if IoctlSocket is compilable" >&5 +$as_echo_n "checking if IoctlSocket is compilable... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + + $curl_includes_stropts + +int main (void) +{ + + if(0 != IoctlSocket(0, 0, 0)) + return 1; + + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + tst_compi_ioctlsocket_camel="yes" + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + tst_compi_ioctlsocket_camel="no" + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + fi + # + if test "$tst_compi_ioctlsocket_camel" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if IoctlSocket usage allowed" >&5 +$as_echo_n "checking if IoctlSocket usage allowed... " >&6; } + if test "x$curl_disallow_ioctlsocket_camel" != "xyes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + tst_allow_ioctlsocket_camel="yes" + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + tst_allow_ioctlsocket_camel="no" + fi + fi + # + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if IoctlSocket might be used" >&5 +$as_echo_n "checking if IoctlSocket might be used... " >&6; } + if test "$tst_links_ioctlsocket_camel" = "yes" && + test "$tst_proto_ioctlsocket_camel" = "yes" && + test "$tst_compi_ioctlsocket_camel" = "yes" && + test "$tst_allow_ioctlsocket_camel" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + +cat >>confdefs.h <<_ACEOF +#define HAVE_IOCTLSOCKET_CAMEL 1 +_ACEOF + + ac_cv_func_ioctlsocket_camel="yes" + + # + tst_compi_ioctlsocket_camel_fionbio="unknown" + tst_allow_ioctlsocket_camel_fionbio="unknown" + # + if test "$ac_cv_func_ioctlsocket_camel" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if IoctlSocket FIONBIO is compilable" >&5 +$as_echo_n "checking if IoctlSocket FIONBIO is compilable... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + + $curl_includes_stropts + +int main (void) +{ + + long flags = 0; + if(0 != ioctlsocket(0, FIONBIO, &flags)) + return 1; + + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + tst_compi_ioctlsocket_camel_fionbio="yes" + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + tst_compi_ioctlsocket_camel_fionbio="no" + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + fi + # + if test "$tst_compi_ioctlsocket_camel_fionbio" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if IoctlSocket FIONBIO usage allowed" >&5 +$as_echo_n "checking if IoctlSocket FIONBIO usage allowed... " >&6; } + if test "x$curl_disallow_ioctlsocket_camel_fionbio" != "xyes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + tst_allow_ioctlsocket_camel_fionbio="yes" + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + tst_allow_ioctlsocket_camel_fionbio="no" + fi + fi + # + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if IoctlSocket FIONBIO might be used" >&5 +$as_echo_n "checking if IoctlSocket FIONBIO might be used... " >&6; } + if test "$tst_compi_ioctlsocket_camel_fionbio" = "yes" && + test "$tst_allow_ioctlsocket_camel_fionbio" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + +cat >>confdefs.h <<_ACEOF +#define HAVE_IOCTLSOCKET_CAMEL_FIONBIO 1 +_ACEOF + + ac_cv_func_ioctlsocket_camel_fionbio="yes" + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + ac_cv_func_ioctlsocket_camel_fionbio="no" + fi + + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + ac_cv_func_ioctlsocket_camel="no" + fi + + + # + tst_links_localtime_r="unknown" + tst_proto_localtime_r="unknown" + tst_compi_localtime_r="unknown" + tst_works_localtime_r="unknown" + tst_allow_localtime_r="unknown" + # + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if localtime_r can be linked" >&5 +$as_echo_n "checking if localtime_r can be linked... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + +#define localtime_r innocuous_localtime_r +#ifdef __STDC__ +# include +#else +# include +#endif +#undef localtime_r +#ifdef __cplusplus +extern "C" +#endif +char localtime_r (); +#if defined __stub_localtime_r || defined __stub___localtime_r +choke me +#endif + +int main (void) +{ +return localtime_r (); + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + tst_links_localtime_r="yes" + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + tst_links_localtime_r="no" + +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + # + if test "$tst_links_localtime_r" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if localtime_r is prototyped" >&5 +$as_echo_n "checking if localtime_r is prototyped... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + $curl_includes_time + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "localtime_r" >/dev/null 2>&1; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + tst_proto_localtime_r="yes" + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + tst_proto_localtime_r="no" + +fi +rm -f conftest* + + fi + # + if test "$tst_proto_localtime_r" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if localtime_r is compilable" >&5 +$as_echo_n "checking if localtime_r is compilable... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + + $curl_includes_time + +int main (void) +{ + + if(0 != localtime_r(0, 0)) + return 1; + + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + tst_compi_localtime_r="yes" + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + tst_compi_localtime_r="no" + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + fi + # + if test "x$cross_compiling" != "xyes" && + test "$tst_compi_localtime_r" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if localtime_r seems to work" >&5 +$as_echo_n "checking if localtime_r seems to work... " >&6; } + if test "$cross_compiling" = yes; then : + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "cannot run test program while cross compiling +See \`config.log' for more details" "$LINENO" 5 ; } +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + + $curl_includes_stdlib + $curl_includes_time + +int main (void) +{ + + time_t clock = 1170352587; + struct tm *tmp = 0; + struct tm result; + tmp = localtime_r(&clock, &result); + if(tmp) + exit(0); + else + exit(1); + + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_run "$LINENO"; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + tst_works_localtime_r="yes" + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + tst_works_localtime_r="no" + +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext +fi + + fi + # + if test "$tst_compi_localtime_r" = "yes" && + test "$tst_works_localtime_r" != "no"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if localtime_r usage allowed" >&5 +$as_echo_n "checking if localtime_r usage allowed... " >&6; } + if test "x$curl_disallow_localtime_r" != "xyes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + tst_allow_localtime_r="yes" + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + tst_allow_localtime_r="no" + fi + fi + # + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if localtime_r might be used" >&5 +$as_echo_n "checking if localtime_r might be used... " >&6; } + if test "$tst_links_localtime_r" = "yes" && + test "$tst_proto_localtime_r" = "yes" && + test "$tst_compi_localtime_r" = "yes" && + test "$tst_allow_localtime_r" = "yes" && + test "$tst_works_localtime_r" != "no"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + +cat >>confdefs.h <<_ACEOF +#define HAVE_LOCALTIME_R 1 +_ACEOF + + ac_cv_func_localtime_r="yes" + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + ac_cv_func_localtime_r="no" + fi + + + # + tst_links_memrchr="unknown" + tst_macro_memrchr="unknown" + tst_proto_memrchr="unknown" + tst_compi_memrchr="unknown" + tst_allow_memrchr="unknown" + # + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if memrchr can be linked" >&5 +$as_echo_n "checking if memrchr can be linked... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + +#define memrchr innocuous_memrchr +#ifdef __STDC__ +# include +#else +# include +#endif +#undef memrchr +#ifdef __cplusplus +extern "C" +#endif +char memrchr (); +#if defined __stub_memrchr || defined __stub___memrchr +choke me +#endif + +int main (void) +{ +return memrchr (); + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + tst_links_memrchr="yes" + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + tst_links_memrchr="no" + +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + # + if test "$tst_links_memrchr" = "no"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if memrchr seems a macro" >&5 +$as_echo_n "checking if memrchr seems a macro... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + + $curl_includes_string + +int main (void) +{ + + if(0 != memrchr(0, 0, 0)) + return 1; + + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + tst_macro_memrchr="yes" + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + tst_macro_memrchr="no" + +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + fi + # + if test "$tst_links_memrchr" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if memrchr is prototyped" >&5 +$as_echo_n "checking if memrchr is prototyped... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + $curl_includes_string + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "memrchr" >/dev/null 2>&1; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + tst_proto_memrchr="yes" + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + tst_proto_memrchr="no" + +fi +rm -f conftest* + + fi + # + if test "$tst_proto_memrchr" = "yes" || + test "$tst_macro_memrchr" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if memrchr is compilable" >&5 +$as_echo_n "checking if memrchr is compilable... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + + $curl_includes_string + +int main (void) +{ + + if(0 != memrchr(0, 0, 0)) + return 1; + + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + tst_compi_memrchr="yes" + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + tst_compi_memrchr="no" + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + fi + # + if test "$tst_compi_memrchr" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if memrchr usage allowed" >&5 +$as_echo_n "checking if memrchr usage allowed... " >&6; } + if test "x$curl_disallow_memrchr" != "xyes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + tst_allow_memrchr="yes" + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + tst_allow_memrchr="no" + fi + fi + # + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if memrchr might be used" >&5 +$as_echo_n "checking if memrchr might be used... " >&6; } + if (test "$tst_proto_memrchr" = "yes" || + test "$tst_macro_memrchr" = "yes") && + test "$tst_compi_memrchr" = "yes" && + test "$tst_allow_memrchr" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + +cat >>confdefs.h <<_ACEOF +#define HAVE_MEMRCHR 1 +_ACEOF + + ac_cv_func_memrchr="yes" + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + ac_cv_func_memrchr="no" + fi + + +curl_includes_poll="\ +/* includes start */ +#ifdef HAVE_SYS_TYPES_H +# include +#endif +#ifdef HAVE_POLL_H +# include +#endif +#ifdef HAVE_SYS_POLL_H +# include +#endif +/* includes end */" + for ac_header in sys/types.h poll.h sys/poll.h +do : + as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` +ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$curl_includes_poll +" +if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : + cat >>confdefs.h <<_ACEOF +#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + +done + + + + # + tst_links_poll="unknown" + tst_proto_poll="unknown" + tst_compi_poll="unknown" + tst_works_poll="unknown" + tst_allow_poll="unknown" + # + case $host_os in + darwin*|interix*) + curl_disallow_poll="yes" + ;; + esac + # + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if poll can be linked" >&5 +$as_echo_n "checking if poll can be linked... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + + $curl_includes_poll + +int main (void) +{ + + if(0 != poll(0, 0, 0)) + return 1; + + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + tst_links_poll="yes" + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + tst_links_poll="no" + +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + # + if test "$tst_links_poll" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if poll is prototyped" >&5 +$as_echo_n "checking if poll is prototyped... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + $curl_includes_poll + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "poll" >/dev/null 2>&1; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + tst_proto_poll="yes" + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + tst_proto_poll="no" + +fi +rm -f conftest* + + fi + # + if test "$tst_proto_poll" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if poll is compilable" >&5 +$as_echo_n "checking if poll is compilable... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + + $curl_includes_poll + +int main (void) +{ + + if(0 != poll(0, 0, 0)) + return 1; + + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + tst_compi_poll="yes" + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + tst_compi_poll="no" + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + fi + # + if test "x$cross_compiling" != "xyes" && + test "$tst_compi_poll" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if poll seems to work" >&5 +$as_echo_n "checking if poll seems to work... " >&6; } + if test "$cross_compiling" = yes; then : + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "cannot run test program while cross compiling +See \`config.log' for more details" "$LINENO" 5 ; } +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + + $curl_includes_stdlib + $curl_includes_poll + +int main (void) +{ + + if(0 != poll(0, 0, 10)) + exit(1); /* fail */ + else + exit(0); + + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_run "$LINENO"; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + tst_works_poll="yes" + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + tst_works_poll="no" + +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext +fi + + fi + # + if test "$tst_compi_poll" = "yes" && + test "$tst_works_poll" != "no"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if poll usage allowed" >&5 +$as_echo_n "checking if poll usage allowed... " >&6; } + if test "x$curl_disallow_poll" != "xyes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + tst_allow_poll="yes" + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + tst_allow_poll="no" + fi + fi + # + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if poll might be used" >&5 +$as_echo_n "checking if poll might be used... " >&6; } + if test "$tst_links_poll" = "yes" && + test "$tst_proto_poll" = "yes" && + test "$tst_compi_poll" = "yes" && + test "$tst_allow_poll" = "yes" && + test "$tst_works_poll" != "no"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + +cat >>confdefs.h <<_ACEOF +#define HAVE_POLL 1 +_ACEOF + + +cat >>confdefs.h <<_ACEOF +#define HAVE_POLL_FINE 1 +_ACEOF + + ac_cv_func_poll="yes" + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + ac_cv_func_poll="no" + fi + + + # + tst_links_setsockopt="unknown" + tst_proto_setsockopt="unknown" + tst_compi_setsockopt="unknown" + tst_allow_setsockopt="unknown" + # + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if setsockopt can be linked" >&5 +$as_echo_n "checking if setsockopt can be linked... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + + $curl_includes_winsock2 + $curl_includes_sys_socket + +int main (void) +{ + + if(0 != setsockopt(0, 0, 0, 0, 0)) + return 1; + + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + tst_links_setsockopt="yes" + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + tst_links_setsockopt="no" + +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + # + if test "$tst_links_setsockopt" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if setsockopt is prototyped" >&5 +$as_echo_n "checking if setsockopt is prototyped... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + $curl_includes_winsock2 + $curl_includes_sys_socket + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "setsockopt" >/dev/null 2>&1; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + tst_proto_setsockopt="yes" + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + tst_proto_setsockopt="no" + +fi +rm -f conftest* + + fi + # + if test "$tst_proto_setsockopt" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if setsockopt is compilable" >&5 +$as_echo_n "checking if setsockopt is compilable... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + + $curl_includes_winsock2 + $curl_includes_sys_socket + +int main (void) +{ + + if(0 != setsockopt(0, 0, 0, 0, 0)) + return 1; + + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + tst_compi_setsockopt="yes" + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + tst_compi_setsockopt="no" + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + fi + # + if test "$tst_compi_setsockopt" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if setsockopt usage allowed" >&5 +$as_echo_n "checking if setsockopt usage allowed... " >&6; } + if test "x$curl_disallow_setsockopt" != "xyes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + tst_allow_setsockopt="yes" + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + tst_allow_setsockopt="no" + fi + fi + # + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if setsockopt might be used" >&5 +$as_echo_n "checking if setsockopt might be used... " >&6; } + if test "$tst_links_setsockopt" = "yes" && + test "$tst_proto_setsockopt" = "yes" && + test "$tst_compi_setsockopt" = "yes" && + test "$tst_allow_setsockopt" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + +cat >>confdefs.h <<_ACEOF +#define HAVE_SETSOCKOPT 1 +_ACEOF + + ac_cv_func_setsockopt="yes" + + # + tst_compi_setsockopt_so_nonblock="unknown" + tst_allow_setsockopt_so_nonblock="unknown" + # + if test "$ac_cv_func_setsockopt" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if setsockopt SO_NONBLOCK is compilable" >&5 +$as_echo_n "checking if setsockopt SO_NONBLOCK is compilable... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + + $curl_includes_winsock2 + $curl_includes_sys_socket + +int main (void) +{ + + if(0 != setsockopt(0, SOL_SOCKET, SO_NONBLOCK, 0, 0)) + return 1; + + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + tst_compi_setsockopt_so_nonblock="yes" + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + tst_compi_setsockopt_so_nonblock="no" + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + fi + # + if test "$tst_compi_setsockopt_so_nonblock" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if setsockopt SO_NONBLOCK usage allowed" >&5 +$as_echo_n "checking if setsockopt SO_NONBLOCK usage allowed... " >&6; } + if test "x$curl_disallow_setsockopt_so_nonblock" != "xyes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + tst_allow_setsockopt_so_nonblock="yes" + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + tst_allow_setsockopt_so_nonblock="no" + fi + fi + # + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if setsockopt SO_NONBLOCK might be used" >&5 +$as_echo_n "checking if setsockopt SO_NONBLOCK might be used... " >&6; } + if test "$tst_compi_setsockopt_so_nonblock" = "yes" && + test "$tst_allow_setsockopt_so_nonblock" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + +cat >>confdefs.h <<_ACEOF +#define HAVE_SETSOCKOPT_SO_NONBLOCK 1 +_ACEOF + + ac_cv_func_setsockopt_so_nonblock="yes" + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + ac_cv_func_setsockopt_so_nonblock="no" + fi + + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + ac_cv_func_setsockopt="no" + fi + + +curl_includes_signal="\ +/* includes start */ +#ifdef HAVE_SYS_TYPES_H +# include +#endif +#ifdef HAVE_SIGNAL_H +# include +#endif +/* includes end */" + for ac_header in sys/types.h signal.h +do : + as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` +ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$curl_includes_signal +" +if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : + cat >>confdefs.h <<_ACEOF +#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + +done + + + + # + tst_links_sigaction="unknown" + tst_proto_sigaction="unknown" + tst_compi_sigaction="unknown" + tst_allow_sigaction="unknown" + # + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if sigaction can be linked" >&5 +$as_echo_n "checking if sigaction can be linked... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + +#define sigaction innocuous_sigaction +#ifdef __STDC__ +# include +#else +# include +#endif +#undef sigaction +#ifdef __cplusplus +extern "C" +#endif +char sigaction (); +#if defined __stub_sigaction || defined __stub___sigaction +choke me +#endif + +int main (void) +{ +return sigaction (); + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + tst_links_sigaction="yes" + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + tst_links_sigaction="no" + +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + # + if test "$tst_links_sigaction" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if sigaction is prototyped" >&5 +$as_echo_n "checking if sigaction is prototyped... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + $curl_includes_signal + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "sigaction" >/dev/null 2>&1; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + tst_proto_sigaction="yes" + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + tst_proto_sigaction="no" + +fi +rm -f conftest* + + fi + # + if test "$tst_proto_sigaction" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if sigaction is compilable" >&5 +$as_echo_n "checking if sigaction is compilable... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + + $curl_includes_signal + +int main (void) +{ + + if(0 != sigaction(0, 0, 0)) + return 1; + + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + tst_compi_sigaction="yes" + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + tst_compi_sigaction="no" + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + fi + # + if test "$tst_compi_sigaction" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if sigaction usage allowed" >&5 +$as_echo_n "checking if sigaction usage allowed... " >&6; } + if test "x$curl_disallow_sigaction" != "xyes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + tst_allow_sigaction="yes" + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + tst_allow_sigaction="no" + fi + fi + # + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if sigaction might be used" >&5 +$as_echo_n "checking if sigaction might be used... " >&6; } + if test "$tst_links_sigaction" = "yes" && + test "$tst_proto_sigaction" = "yes" && + test "$tst_compi_sigaction" = "yes" && + test "$tst_allow_sigaction" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + +cat >>confdefs.h <<_ACEOF +#define HAVE_SIGACTION 1 +_ACEOF + + ac_cv_func_sigaction="yes" + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + ac_cv_func_sigaction="no" + fi + + + # + tst_links_siginterrupt="unknown" + tst_proto_siginterrupt="unknown" + tst_compi_siginterrupt="unknown" + tst_allow_siginterrupt="unknown" + # + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if siginterrupt can be linked" >&5 +$as_echo_n "checking if siginterrupt can be linked... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + +#define siginterrupt innocuous_siginterrupt +#ifdef __STDC__ +# include +#else +# include +#endif +#undef siginterrupt +#ifdef __cplusplus +extern "C" +#endif +char siginterrupt (); +#if defined __stub_siginterrupt || defined __stub___siginterrupt +choke me +#endif + +int main (void) +{ +return siginterrupt (); + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + tst_links_siginterrupt="yes" + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + tst_links_siginterrupt="no" + +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + # + if test "$tst_links_siginterrupt" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if siginterrupt is prototyped" >&5 +$as_echo_n "checking if siginterrupt is prototyped... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + $curl_includes_signal + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "siginterrupt" >/dev/null 2>&1; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + tst_proto_siginterrupt="yes" + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + tst_proto_siginterrupt="no" + +fi +rm -f conftest* + + fi + # + if test "$tst_proto_siginterrupt" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if siginterrupt is compilable" >&5 +$as_echo_n "checking if siginterrupt is compilable... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + + $curl_includes_signal + +int main (void) +{ + + if(0 != siginterrupt(0, 0)) + return 1; + + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + tst_compi_siginterrupt="yes" + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + tst_compi_siginterrupt="no" + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + fi + # + if test "$tst_compi_siginterrupt" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if siginterrupt usage allowed" >&5 +$as_echo_n "checking if siginterrupt usage allowed... " >&6; } + if test "x$curl_disallow_siginterrupt" != "xyes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + tst_allow_siginterrupt="yes" + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + tst_allow_siginterrupt="no" + fi + fi + # + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if siginterrupt might be used" >&5 +$as_echo_n "checking if siginterrupt might be used... " >&6; } + if test "$tst_links_siginterrupt" = "yes" && + test "$tst_proto_siginterrupt" = "yes" && + test "$tst_compi_siginterrupt" = "yes" && + test "$tst_allow_siginterrupt" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + +cat >>confdefs.h <<_ACEOF +#define HAVE_SIGINTERRUPT 1 +_ACEOF + + ac_cv_func_siginterrupt="yes" + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + ac_cv_func_siginterrupt="no" + fi + + + # + tst_links_signal="unknown" + tst_proto_signal="unknown" + tst_compi_signal="unknown" + tst_allow_signal="unknown" + # + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if signal can be linked" >&5 +$as_echo_n "checking if signal can be linked... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + +#define signal innocuous_signal +#ifdef __STDC__ +# include +#else +# include +#endif +#undef signal +#ifdef __cplusplus +extern "C" +#endif +char signal (); +#if defined __stub_signal || defined __stub___signal +choke me +#endif + +int main (void) +{ +return signal (); + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + tst_links_signal="yes" + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + tst_links_signal="no" + +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + # + if test "$tst_links_signal" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if signal is prototyped" >&5 +$as_echo_n "checking if signal is prototyped... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + $curl_includes_signal + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "signal" >/dev/null 2>&1; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + tst_proto_signal="yes" + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + tst_proto_signal="no" + +fi +rm -f conftest* + + fi + # + if test "$tst_proto_signal" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if signal is compilable" >&5 +$as_echo_n "checking if signal is compilable... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + + $curl_includes_signal + +int main (void) +{ + + if(0 != signal(0, 0)) + return 1; + + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + tst_compi_signal="yes" + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + tst_compi_signal="no" + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + fi + # + if test "$tst_compi_signal" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if signal usage allowed" >&5 +$as_echo_n "checking if signal usage allowed... " >&6; } + if test "x$curl_disallow_signal" != "xyes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + tst_allow_signal="yes" + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + tst_allow_signal="no" + fi + fi + # + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if signal might be used" >&5 +$as_echo_n "checking if signal might be used... " >&6; } + if test "$tst_links_signal" = "yes" && + test "$tst_proto_signal" = "yes" && + test "$tst_compi_signal" = "yes" && + test "$tst_allow_signal" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + +cat >>confdefs.h <<_ACEOF +#define HAVE_SIGNAL 1 +_ACEOF + + ac_cv_func_signal="yes" + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + ac_cv_func_signal="no" + fi + + +curl_includes_setjmp="\ +/* includes start */ +#ifdef HAVE_SYS_TYPES_H +# include +#endif +#ifdef HAVE_SETJMP_H +# include +#endif +/* includes end */" + for ac_header in sys/types.h setjmp.h +do : + as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` +ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$curl_includes_setjmp +" +if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : + cat >>confdefs.h <<_ACEOF +#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + +done + + + + # + tst_links_sigsetjmp="unknown" + tst_macro_sigsetjmp="unknown" + tst_proto_sigsetjmp="unknown" + tst_compi_sigsetjmp="unknown" + tst_allow_sigsetjmp="unknown" + # + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if sigsetjmp can be linked" >&5 +$as_echo_n "checking if sigsetjmp can be linked... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + +#define sigsetjmp innocuous_sigsetjmp +#ifdef __STDC__ +# include +#else +# include +#endif +#undef sigsetjmp +#ifdef __cplusplus +extern "C" +#endif +char sigsetjmp (); +#if defined __stub_sigsetjmp || defined __stub___sigsetjmp +choke me +#endif + +int main (void) +{ +return sigsetjmp (); + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + tst_links_sigsetjmp="yes" + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + tst_links_sigsetjmp="no" + +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + # + if test "$tst_links_sigsetjmp" = "no"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if sigsetjmp seems a macro" >&5 +$as_echo_n "checking if sigsetjmp seems a macro... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + + $curl_includes_setjmp + +int main (void) +{ + + sigjmp_buf env; + if(0 != sigsetjmp(env, 0)) + return 1; + + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + tst_macro_sigsetjmp="yes" + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + tst_macro_sigsetjmp="no" + +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + fi + # + if test "$tst_links_sigsetjmp" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if sigsetjmp is prototyped" >&5 +$as_echo_n "checking if sigsetjmp is prototyped... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + $curl_includes_setjmp + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "sigsetjmp" >/dev/null 2>&1; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + tst_proto_sigsetjmp="yes" + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + tst_proto_sigsetjmp="no" + +fi +rm -f conftest* + + fi + # + if test "$tst_proto_sigsetjmp" = "yes" || + test "$tst_macro_sigsetjmp" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if sigsetjmp is compilable" >&5 +$as_echo_n "checking if sigsetjmp is compilable... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + + $curl_includes_setjmp + +int main (void) +{ + + sigjmp_buf env; + if(0 != sigsetjmp(env, 0)) + return 1; + + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + tst_compi_sigsetjmp="yes" + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + tst_compi_sigsetjmp="no" + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + fi + # + if test "$tst_compi_sigsetjmp" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if sigsetjmp usage allowed" >&5 +$as_echo_n "checking if sigsetjmp usage allowed... " >&6; } + if test "x$curl_disallow_sigsetjmp" != "xyes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + tst_allow_sigsetjmp="yes" + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + tst_allow_sigsetjmp="no" + fi + fi + # + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if sigsetjmp might be used" >&5 +$as_echo_n "checking if sigsetjmp might be used... " >&6; } + if (test "$tst_proto_sigsetjmp" = "yes" || + test "$tst_macro_sigsetjmp" = "yes") && + test "$tst_compi_sigsetjmp" = "yes" && + test "$tst_allow_sigsetjmp" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + +cat >>confdefs.h <<_ACEOF +#define HAVE_SIGSETJMP 1 +_ACEOF + + ac_cv_func_sigsetjmp="yes" + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + ac_cv_func_sigsetjmp="no" + fi + + + # + tst_links_socket="unknown" + tst_proto_socket="unknown" + tst_compi_socket="unknown" + tst_allow_socket="unknown" + # + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if socket can be linked" >&5 +$as_echo_n "checking if socket can be linked... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + + $curl_includes_winsock2 + $curl_includes_sys_socket + $curl_includes_socket + +int main (void) +{ + + if(0 != socket(0, 0, 0)) + return 1; + + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + tst_links_socket="yes" + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + tst_links_socket="no" + +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + # + if test "$tst_links_socket" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if socket is prototyped" >&5 +$as_echo_n "checking if socket is prototyped... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + $curl_includes_winsock2 + $curl_includes_sys_socket + $curl_includes_socket + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "socket" >/dev/null 2>&1; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + tst_proto_socket="yes" + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + tst_proto_socket="no" + +fi +rm -f conftest* + + fi + # + if test "$tst_proto_socket" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if socket is compilable" >&5 +$as_echo_n "checking if socket is compilable... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + + $curl_includes_winsock2 + $curl_includes_sys_socket + $curl_includes_socket + +int main (void) +{ + + if(0 != socket(0, 0, 0)) + return 1; + + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + tst_compi_socket="yes" + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + tst_compi_socket="no" + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + fi + # + if test "$tst_compi_socket" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if socket usage allowed" >&5 +$as_echo_n "checking if socket usage allowed... " >&6; } + if test "x$curl_disallow_socket" != "xyes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + tst_allow_socket="yes" + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + tst_allow_socket="no" + fi + fi + # + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if socket might be used" >&5 +$as_echo_n "checking if socket might be used... " >&6; } + if test "$tst_links_socket" = "yes" && + test "$tst_proto_socket" = "yes" && + test "$tst_compi_socket" = "yes" && + test "$tst_allow_socket" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + +cat >>confdefs.h <<_ACEOF +#define HAVE_SOCKET 1 +_ACEOF + + ac_cv_func_socket="yes" + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + ac_cv_func_socket="no" + fi + + + # + tst_links_strcasecmp="unknown" + tst_proto_strcasecmp="unknown" + tst_compi_strcasecmp="unknown" + tst_allow_strcasecmp="unknown" + # + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if strcasecmp can be linked" >&5 +$as_echo_n "checking if strcasecmp can be linked... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + +#define strcasecmp innocuous_strcasecmp +#ifdef __STDC__ +# include +#else +# include +#endif +#undef strcasecmp +#ifdef __cplusplus +extern "C" +#endif +char strcasecmp (); +#if defined __stub_strcasecmp || defined __stub___strcasecmp +choke me +#endif + +int main (void) +{ +return strcasecmp (); + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + tst_links_strcasecmp="yes" + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + tst_links_strcasecmp="no" + +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + # + if test "$tst_links_strcasecmp" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if strcasecmp is prototyped" >&5 +$as_echo_n "checking if strcasecmp is prototyped... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + $curl_includes_string + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "strcasecmp" >/dev/null 2>&1; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + tst_proto_strcasecmp="yes" + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + tst_proto_strcasecmp="no" + +fi +rm -f conftest* + + fi + # + if test "$tst_proto_strcasecmp" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if strcasecmp is compilable" >&5 +$as_echo_n "checking if strcasecmp is compilable... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + + $curl_includes_string + +int main (void) +{ + + if(0 != strcasecmp(0, 0)) + return 1; + + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + tst_compi_strcasecmp="yes" + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + tst_compi_strcasecmp="no" + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + fi + # + if test "$tst_compi_strcasecmp" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if strcasecmp usage allowed" >&5 +$as_echo_n "checking if strcasecmp usage allowed... " >&6; } + if test "x$curl_disallow_strcasecmp" != "xyes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + tst_allow_strcasecmp="yes" + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + tst_allow_strcasecmp="no" + fi + fi + # + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if strcasecmp might be used" >&5 +$as_echo_n "checking if strcasecmp might be used... " >&6; } + if test "$tst_links_strcasecmp" = "yes" && + test "$tst_proto_strcasecmp" = "yes" && + test "$tst_compi_strcasecmp" = "yes" && + test "$tst_allow_strcasecmp" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + +cat >>confdefs.h <<_ACEOF +#define HAVE_STRCASECMP 1 +_ACEOF + + ac_cv_func_strcasecmp="yes" + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + ac_cv_func_strcasecmp="no" + fi + + + # + tst_links_strcasestr="unknown" + tst_proto_strcasestr="unknown" + tst_compi_strcasestr="unknown" + tst_allow_strcasestr="unknown" + # + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if strcasestr can be linked" >&5 +$as_echo_n "checking if strcasestr can be linked... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + +#define strcasestr innocuous_strcasestr +#ifdef __STDC__ +# include +#else +# include +#endif +#undef strcasestr +#ifdef __cplusplus +extern "C" +#endif +char strcasestr (); +#if defined __stub_strcasestr || defined __stub___strcasestr +choke me +#endif + +int main (void) +{ +return strcasestr (); + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + tst_links_strcasestr="yes" + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + tst_links_strcasestr="no" + +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + # + if test "$tst_links_strcasestr" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if strcasestr is prototyped" >&5 +$as_echo_n "checking if strcasestr is prototyped... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + $curl_includes_string + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "strcasestr" >/dev/null 2>&1; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + tst_proto_strcasestr="yes" + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + tst_proto_strcasestr="no" + +fi +rm -f conftest* + + fi + # + if test "$tst_proto_strcasestr" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if strcasestr is compilable" >&5 +$as_echo_n "checking if strcasestr is compilable... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + + $curl_includes_string + +int main (void) +{ + + if(0 != strcasestr(0, 0)) + return 1; + + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + tst_compi_strcasestr="yes" + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + tst_compi_strcasestr="no" + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + fi + # + if test "$tst_compi_strcasestr" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if strcasestr usage allowed" >&5 +$as_echo_n "checking if strcasestr usage allowed... " >&6; } + if test "x$curl_disallow_strcasestr" != "xyes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + tst_allow_strcasestr="yes" + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + tst_allow_strcasestr="no" + fi + fi + # + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if strcasestr might be used" >&5 +$as_echo_n "checking if strcasestr might be used... " >&6; } + if test "$tst_links_strcasestr" = "yes" && + test "$tst_proto_strcasestr" = "yes" && + test "$tst_compi_strcasestr" = "yes" && + test "$tst_allow_strcasestr" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + +cat >>confdefs.h <<_ACEOF +#define HAVE_STRCASESTR 1 +_ACEOF + + ac_cv_func_strcasestr="yes" + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + ac_cv_func_strcasestr="no" + fi + + + # + tst_links_strcmpi="unknown" + tst_proto_strcmpi="unknown" + tst_compi_strcmpi="unknown" + tst_allow_strcmpi="unknown" + # + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if strcmpi can be linked" >&5 +$as_echo_n "checking if strcmpi can be linked... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + +#define strcmpi innocuous_strcmpi +#ifdef __STDC__ +# include +#else +# include +#endif +#undef strcmpi +#ifdef __cplusplus +extern "C" +#endif +char strcmpi (); +#if defined __stub_strcmpi || defined __stub___strcmpi +choke me +#endif + +int main (void) +{ +return strcmpi (); + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + tst_links_strcmpi="yes" + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + tst_links_strcmpi="no" + +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + # + if test "$tst_links_strcmpi" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if strcmpi is prototyped" >&5 +$as_echo_n "checking if strcmpi is prototyped... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + $curl_includes_string + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "strcmpi" >/dev/null 2>&1; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + tst_proto_strcmpi="yes" + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + tst_proto_strcmpi="no" + +fi +rm -f conftest* + + fi + # + if test "$tst_proto_strcmpi" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if strcmpi is compilable" >&5 +$as_echo_n "checking if strcmpi is compilable... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + + $curl_includes_string + +int main (void) +{ + + if(0 != strcmpi(0, 0)) + return 1; + + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + tst_compi_strcmpi="yes" + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + tst_compi_strcmpi="no" + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + fi + # + if test "$tst_compi_strcmpi" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if strcmpi usage allowed" >&5 +$as_echo_n "checking if strcmpi usage allowed... " >&6; } + if test "x$curl_disallow_strcmpi" != "xyes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + tst_allow_strcmpi="yes" + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + tst_allow_strcmpi="no" + fi + fi + # + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if strcmpi might be used" >&5 +$as_echo_n "checking if strcmpi might be used... " >&6; } + if test "$tst_links_strcmpi" = "yes" && + test "$tst_proto_strcmpi" = "yes" && + test "$tst_compi_strcmpi" = "yes" && + test "$tst_allow_strcmpi" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + +cat >>confdefs.h <<_ACEOF +#define HAVE_STRCMPI 1 +_ACEOF + + ac_cv_func_strcmpi="yes" + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + ac_cv_func_strcmpi="no" + fi + + + # + tst_links_strdup="unknown" + tst_proto_strdup="unknown" + tst_compi_strdup="unknown" + tst_allow_strdup="unknown" + # + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if strdup can be linked" >&5 +$as_echo_n "checking if strdup can be linked... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + +#define strdup innocuous_strdup +#ifdef __STDC__ +# include +#else +# include +#endif +#undef strdup +#ifdef __cplusplus +extern "C" +#endif +char strdup (); +#if defined __stub_strdup || defined __stub___strdup +choke me +#endif + +int main (void) +{ +return strdup (); + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + tst_links_strdup="yes" + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + tst_links_strdup="no" + +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + # + if test "$tst_links_strdup" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if strdup is prototyped" >&5 +$as_echo_n "checking if strdup is prototyped... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + $curl_includes_string + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "strdup" >/dev/null 2>&1; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + tst_proto_strdup="yes" + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + tst_proto_strdup="no" + +fi +rm -f conftest* + + fi + # + if test "$tst_proto_strdup" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if strdup is compilable" >&5 +$as_echo_n "checking if strdup is compilable... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + + $curl_includes_string + +int main (void) +{ + + if(0 != strdup(0)) + return 1; + + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + tst_compi_strdup="yes" + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + tst_compi_strdup="no" + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + fi + # + if test "$tst_compi_strdup" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if strdup usage allowed" >&5 +$as_echo_n "checking if strdup usage allowed... " >&6; } + if test "x$curl_disallow_strdup" != "xyes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + tst_allow_strdup="yes" + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + tst_allow_strdup="no" + fi + fi + # + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if strdup might be used" >&5 +$as_echo_n "checking if strdup might be used... " >&6; } + if test "$tst_links_strdup" = "yes" && + test "$tst_proto_strdup" = "yes" && + test "$tst_compi_strdup" = "yes" && + test "$tst_allow_strdup" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + +cat >>confdefs.h <<_ACEOF +#define HAVE_STRDUP 1 +_ACEOF + + ac_cv_func_strdup="yes" + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + ac_cv_func_strdup="no" + fi + + + # + tst_links_strerror_r="unknown" + tst_proto_strerror_r="unknown" + tst_compi_strerror_r="unknown" + tst_glibc_strerror_r="unknown" + tst_posix_strerror_r="unknown" + tst_allow_strerror_r="unknown" + tst_works_glibc_strerror_r="unknown" + tst_works_posix_strerror_r="unknown" + tst_glibc_strerror_r_type_arg3="unknown" + tst_posix_strerror_r_type_arg3="unknown" + # + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if strerror_r can be linked" >&5 +$as_echo_n "checking if strerror_r can be linked... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + +#define strerror_r innocuous_strerror_r +#ifdef __STDC__ +# include +#else +# include +#endif +#undef strerror_r +#ifdef __cplusplus +extern "C" +#endif +char strerror_r (); +#if defined __stub_strerror_r || defined __stub___strerror_r +choke me +#endif + +int main (void) +{ +return strerror_r (); + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + tst_links_strerror_r="yes" + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + tst_links_strerror_r="no" + +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + # + if test "$tst_links_strerror_r" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if strerror_r is prototyped" >&5 +$as_echo_n "checking if strerror_r is prototyped... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + $curl_includes_string + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "strerror_r" >/dev/null 2>&1; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + tst_proto_strerror_r="yes" + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + tst_proto_strerror_r="no" + +fi +rm -f conftest* + + fi + # + if test "$tst_proto_strerror_r" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if strerror_r is compilable" >&5 +$as_echo_n "checking if strerror_r is compilable... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + + $curl_includes_string + +int main (void) +{ + + if(0 != strerror_r(0, 0, 0)) + return 1; + + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + tst_compi_strerror_r="yes" + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + tst_compi_strerror_r="no" + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + fi + # + if test "$tst_compi_strerror_r" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if strerror_r is glibc like" >&5 +$as_echo_n "checking if strerror_r is glibc like... " >&6; } + tst_glibc_strerror_r_type_arg3="unknown" + for arg3 in 'size_t' 'int' 'unsigned int'; do + if test "$tst_glibc_strerror_r_type_arg3" = "unknown"; then + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + + $curl_includes_string + +int main (void) +{ + + char *strerror_r(int errnum, char *workbuf, $arg3 bufsize); + if(0 != strerror_r(0, 0, 0)) + return 1; + + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + + tst_glibc_strerror_r_type_arg3="$arg3" + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + fi + done + case "$tst_glibc_strerror_r_type_arg3" in + unknown) + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + tst_glibc_strerror_r="no" + ;; + *) + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + tst_glibc_strerror_r="yes" + ;; + esac + fi + # + if test "x$cross_compiling" != "xyes" && + test "$tst_glibc_strerror_r" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if strerror_r seems to work" >&5 +$as_echo_n "checking if strerror_r seems to work... " >&6; } + if test "$cross_compiling" = yes; then : + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "cannot run test program while cross compiling +See \`config.log' for more details" "$LINENO" 5 ; } +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + + $curl_includes_stdlib + $curl_includes_string +# include + +int main (void) +{ + + char buffer[1024]; + char *string = 0; + buffer[0] = '\0'; + string = strerror_r(EACCES, buffer, sizeof(buffer)); + if(!string) + exit(1); /* fail */ + if(!string[0]) + exit(1); /* fail */ + else + exit(0); + + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_run "$LINENO"; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + tst_works_glibc_strerror_r="yes" + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + tst_works_glibc_strerror_r="no" + +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext +fi + + fi + # + if test "$tst_compi_strerror_r" = "yes" && + test "$tst_works_glibc_strerror_r" != "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if strerror_r is POSIX like" >&5 +$as_echo_n "checking if strerror_r is POSIX like... " >&6; } + tst_posix_strerror_r_type_arg3="unknown" + for arg3 in 'size_t' 'int' 'unsigned int'; do + if test "$tst_posix_strerror_r_type_arg3" = "unknown"; then + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + + $curl_includes_string + +int main (void) +{ + + int strerror_r(int errnum, char *resultbuf, $arg3 bufsize); + if(0 != strerror_r(0, 0, 0)) + return 1; + + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + + tst_posix_strerror_r_type_arg3="$arg3" + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + fi + done + case "$tst_posix_strerror_r_type_arg3" in + unknown) + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + tst_posix_strerror_r="no" + ;; + *) + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + tst_posix_strerror_r="yes" + ;; + esac + fi + # + if test "x$cross_compiling" != "xyes" && + test "$tst_posix_strerror_r" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if strerror_r seems to work" >&5 +$as_echo_n "checking if strerror_r seems to work... " >&6; } + if test "$cross_compiling" = yes; then : + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "cannot run test program while cross compiling +See \`config.log' for more details" "$LINENO" 5 ; } +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + + $curl_includes_stdlib + $curl_includes_string +# include + +int main (void) +{ + + char buffer[1024]; + int error = 1; + buffer[0] = '\0'; + error = strerror_r(EACCES, buffer, sizeof(buffer)); + if(error) + exit(1); /* fail */ + if(buffer[0] == '\0') + exit(1); /* fail */ + else + exit(0); + + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_run "$LINENO"; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + tst_works_posix_strerror_r="yes" + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + tst_works_posix_strerror_r="no" + +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext +fi + + fi + # + if test "$tst_works_glibc_strerror_r" = "yes"; then + tst_posix_strerror_r="no" + fi + if test "$tst_works_posix_strerror_r" = "yes"; then + tst_glibc_strerror_r="no" + fi + if test "$tst_glibc_strerror_r" = "yes" && + test "$tst_works_glibc_strerror_r" != "no" && + test "$tst_posix_strerror_r" != "yes"; then + tst_allow_strerror_r="check" + fi + if test "$tst_posix_strerror_r" = "yes" && + test "$tst_works_posix_strerror_r" != "no" && + test "$tst_glibc_strerror_r" != "yes"; then + tst_allow_strerror_r="check" + fi + if test "$tst_allow_strerror_r" = "check"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if strerror_r usage allowed" >&5 +$as_echo_n "checking if strerror_r usage allowed... " >&6; } + if test "x$curl_disallow_strerror_r" != "xyes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + tst_allow_strerror_r="yes" + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + tst_allow_strerror_r="no" + fi + fi + # + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if strerror_r might be used" >&5 +$as_echo_n "checking if strerror_r might be used... " >&6; } + if test "$tst_links_strerror_r" = "yes" && + test "$tst_proto_strerror_r" = "yes" && + test "$tst_compi_strerror_r" = "yes" && + test "$tst_allow_strerror_r" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + if test "$tst_glibc_strerror_r" = "yes"; then + +cat >>confdefs.h <<_ACEOF +#define HAVE_STRERROR_R 1 +_ACEOF + + +cat >>confdefs.h <<_ACEOF +#define HAVE_GLIBC_STRERROR_R 1 +_ACEOF + + +cat >>confdefs.h <<_ACEOF +#define STRERROR_R_TYPE_ARG3 $tst_glibc_strerror_r_type_arg3 +_ACEOF + + fi + if test "$tst_posix_strerror_r" = "yes"; then + +cat >>confdefs.h <<_ACEOF +#define HAVE_STRERROR_R 1 +_ACEOF + + +cat >>confdefs.h <<_ACEOF +#define HAVE_POSIX_STRERROR_R 1 +_ACEOF + + +cat >>confdefs.h <<_ACEOF +#define STRERROR_R_TYPE_ARG3 $tst_posix_strerror_r_type_arg3 +_ACEOF + + fi + ac_cv_func_strerror_r="yes" + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + ac_cv_func_strerror_r="no" + fi + # + if test "$tst_compi_strerror_r" = "yes" && + test "$tst_allow_strerror_r" = "unknown"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cannot determine strerror_r() style: edit lib/curl_config.h manually." >&5 +$as_echo "$as_me: WARNING: cannot determine strerror_r() style: edit lib/curl_config.h manually." >&2;} + fi + # + + + # + tst_links_stricmp="unknown" + tst_proto_stricmp="unknown" + tst_compi_stricmp="unknown" + tst_allow_stricmp="unknown" + # + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if stricmp can be linked" >&5 +$as_echo_n "checking if stricmp can be linked... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + +#define stricmp innocuous_stricmp +#ifdef __STDC__ +# include +#else +# include +#endif +#undef stricmp +#ifdef __cplusplus +extern "C" +#endif +char stricmp (); +#if defined __stub_stricmp || defined __stub___stricmp +choke me +#endif + +int main (void) +{ +return stricmp (); + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + tst_links_stricmp="yes" + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + tst_links_stricmp="no" + +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + # + if test "$tst_links_stricmp" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if stricmp is prototyped" >&5 +$as_echo_n "checking if stricmp is prototyped... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + $curl_includes_string + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "stricmp" >/dev/null 2>&1; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + tst_proto_stricmp="yes" + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + tst_proto_stricmp="no" + +fi +rm -f conftest* + + fi + # + if test "$tst_proto_stricmp" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if stricmp is compilable" >&5 +$as_echo_n "checking if stricmp is compilable... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + + $curl_includes_string + +int main (void) +{ + + if(0 != stricmp(0, 0)) + return 1; + + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + tst_compi_stricmp="yes" + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + tst_compi_stricmp="no" + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + fi + # + if test "$tst_compi_stricmp" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if stricmp usage allowed" >&5 +$as_echo_n "checking if stricmp usage allowed... " >&6; } + if test "x$curl_disallow_stricmp" != "xyes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + tst_allow_stricmp="yes" + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + tst_allow_stricmp="no" + fi + fi + # + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if stricmp might be used" >&5 +$as_echo_n "checking if stricmp might be used... " >&6; } + if test "$tst_links_stricmp" = "yes" && + test "$tst_proto_stricmp" = "yes" && + test "$tst_compi_stricmp" = "yes" && + test "$tst_allow_stricmp" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + +cat >>confdefs.h <<_ACEOF +#define HAVE_STRICMP 1 +_ACEOF + + ac_cv_func_stricmp="yes" + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + ac_cv_func_stricmp="no" + fi + + + # + tst_links_strlcat="unknown" + tst_proto_strlcat="unknown" + tst_compi_strlcat="unknown" + tst_allow_strlcat="unknown" + # + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if strlcat can be linked" >&5 +$as_echo_n "checking if strlcat can be linked... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + +#define strlcat innocuous_strlcat +#ifdef __STDC__ +# include +#else +# include +#endif +#undef strlcat +#ifdef __cplusplus +extern "C" +#endif +char strlcat (); +#if defined __stub_strlcat || defined __stub___strlcat +choke me +#endif + +int main (void) +{ +return strlcat (); + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + tst_links_strlcat="yes" + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + tst_links_strlcat="no" + +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + # + if test "$tst_links_strlcat" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if strlcat is prototyped" >&5 +$as_echo_n "checking if strlcat is prototyped... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + $curl_includes_string + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "strlcat" >/dev/null 2>&1; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + tst_proto_strlcat="yes" + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + tst_proto_strlcat="no" + +fi +rm -f conftest* + + fi + # + if test "$tst_proto_strlcat" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if strlcat is compilable" >&5 +$as_echo_n "checking if strlcat is compilable... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + + $curl_includes_string + +int main (void) +{ + + if(0 != strlcat(0, 0, 0)) + return 1; + + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + tst_compi_strlcat="yes" + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + tst_compi_strlcat="no" + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + fi + # + if test "$tst_compi_strlcat" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if strlcat usage allowed" >&5 +$as_echo_n "checking if strlcat usage allowed... " >&6; } + if test "x$curl_disallow_strlcat" != "xyes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + tst_allow_strlcat="yes" + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + tst_allow_strlcat="no" + fi + fi + # + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if strlcat might be used" >&5 +$as_echo_n "checking if strlcat might be used... " >&6; } + if test "$tst_links_strlcat" = "yes" && + test "$tst_proto_strlcat" = "yes" && + test "$tst_compi_strlcat" = "yes" && + test "$tst_allow_strlcat" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + +cat >>confdefs.h <<_ACEOF +#define HAVE_STRLCAT 1 +_ACEOF + + ac_cv_func_strlcat="yes" + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + ac_cv_func_strlcat="no" + fi + + + # + tst_links_strncasecmp="unknown" + tst_proto_strncasecmp="unknown" + tst_compi_strncasecmp="unknown" + tst_allow_strncasecmp="unknown" + # + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if strncasecmp can be linked" >&5 +$as_echo_n "checking if strncasecmp can be linked... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + +#define strncasecmp innocuous_strncasecmp +#ifdef __STDC__ +# include +#else +# include +#endif +#undef strncasecmp +#ifdef __cplusplus +extern "C" +#endif +char strncasecmp (); +#if defined __stub_strncasecmp || defined __stub___strncasecmp +choke me +#endif + +int main (void) +{ +return strncasecmp (); + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + tst_links_strncasecmp="yes" + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + tst_links_strncasecmp="no" + +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + # + if test "$tst_links_strncasecmp" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if strncasecmp is prototyped" >&5 +$as_echo_n "checking if strncasecmp is prototyped... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + $curl_includes_string + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "strncasecmp" >/dev/null 2>&1; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + tst_proto_strncasecmp="yes" + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + tst_proto_strncasecmp="no" + +fi +rm -f conftest* + + fi + # + if test "$tst_proto_strncasecmp" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if strncasecmp is compilable" >&5 +$as_echo_n "checking if strncasecmp is compilable... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + + $curl_includes_string + +int main (void) +{ + + if(0 != strncasecmp(0, 0, 0)) + return 1; + + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + tst_compi_strncasecmp="yes" + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + tst_compi_strncasecmp="no" + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + fi + # + if test "$tst_compi_strncasecmp" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if strncasecmp usage allowed" >&5 +$as_echo_n "checking if strncasecmp usage allowed... " >&6; } + if test "x$curl_disallow_strncasecmp" != "xyes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + tst_allow_strncasecmp="yes" + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + tst_allow_strncasecmp="no" + fi + fi + # + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if strncasecmp might be used" >&5 +$as_echo_n "checking if strncasecmp might be used... " >&6; } + if test "$tst_links_strncasecmp" = "yes" && + test "$tst_proto_strncasecmp" = "yes" && + test "$tst_compi_strncasecmp" = "yes" && + test "$tst_allow_strncasecmp" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + +cat >>confdefs.h <<_ACEOF +#define HAVE_STRNCASECMP 1 +_ACEOF + + ac_cv_func_strncasecmp="yes" + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + ac_cv_func_strncasecmp="no" + fi + + + # + tst_links_strncmpi="unknown" + tst_proto_strncmpi="unknown" + tst_compi_strncmpi="unknown" + tst_allow_strncmpi="unknown" + # + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if strncmpi can be linked" >&5 +$as_echo_n "checking if strncmpi can be linked... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + +#define strncmpi innocuous_strncmpi +#ifdef __STDC__ +# include +#else +# include +#endif +#undef strncmpi +#ifdef __cplusplus +extern "C" +#endif +char strncmpi (); +#if defined __stub_strncmpi || defined __stub___strncmpi +choke me +#endif + +int main (void) +{ +return strncmpi (); + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + tst_links_strncmpi="yes" + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + tst_links_strncmpi="no" + +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + # + if test "$tst_links_strncmpi" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if strncmpi is prototyped" >&5 +$as_echo_n "checking if strncmpi is prototyped... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + $curl_includes_string + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "strncmpi" >/dev/null 2>&1; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + tst_proto_strncmpi="yes" + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + tst_proto_strncmpi="no" + +fi +rm -f conftest* + + fi + # + if test "$tst_proto_strncmpi" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if strncmpi is compilable" >&5 +$as_echo_n "checking if strncmpi is compilable... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + + $curl_includes_string + +int main (void) +{ + + if(0 != strncmpi(0, 0)) + return 1; + + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + tst_compi_strncmpi="yes" + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + tst_compi_strncmpi="no" + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + fi + # + if test "$tst_compi_strncmpi" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if strncmpi usage allowed" >&5 +$as_echo_n "checking if strncmpi usage allowed... " >&6; } + if test "x$curl_disallow_strncmpi" != "xyes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + tst_allow_strncmpi="yes" + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + tst_allow_strncmpi="no" + fi + fi + # + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if strncmpi might be used" >&5 +$as_echo_n "checking if strncmpi might be used... " >&6; } + if test "$tst_links_strncmpi" = "yes" && + test "$tst_proto_strncmpi" = "yes" && + test "$tst_compi_strncmpi" = "yes" && + test "$tst_allow_strncmpi" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + +cat >>confdefs.h <<_ACEOF +#define HAVE_STRNCMPI 1 +_ACEOF + + ac_cv_func_strncmpi="yes" + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + ac_cv_func_strncmpi="no" + fi + + + # + tst_links_strnicmp="unknown" + tst_proto_strnicmp="unknown" + tst_compi_strnicmp="unknown" + tst_allow_strnicmp="unknown" + # + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if strnicmp can be linked" >&5 +$as_echo_n "checking if strnicmp can be linked... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + +#define strnicmp innocuous_strnicmp +#ifdef __STDC__ +# include +#else +# include +#endif +#undef strnicmp +#ifdef __cplusplus +extern "C" +#endif +char strnicmp (); +#if defined __stub_strnicmp || defined __stub___strnicmp +choke me +#endif + +int main (void) +{ +return strnicmp (); + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + tst_links_strnicmp="yes" + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + tst_links_strnicmp="no" + +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + # + if test "$tst_links_strnicmp" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if strnicmp is prototyped" >&5 +$as_echo_n "checking if strnicmp is prototyped... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + $curl_includes_string + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "strnicmp" >/dev/null 2>&1; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + tst_proto_strnicmp="yes" + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + tst_proto_strnicmp="no" + +fi +rm -f conftest* + + fi + # + if test "$tst_proto_strnicmp" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if strnicmp is compilable" >&5 +$as_echo_n "checking if strnicmp is compilable... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + + $curl_includes_string + +int main (void) +{ + + if(0 != strnicmp(0, 0)) + return 1; + + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + tst_compi_strnicmp="yes" + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + tst_compi_strnicmp="no" + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + fi + # + if test "$tst_compi_strnicmp" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if strnicmp usage allowed" >&5 +$as_echo_n "checking if strnicmp usage allowed... " >&6; } + if test "x$curl_disallow_strnicmp" != "xyes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + tst_allow_strnicmp="yes" + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + tst_allow_strnicmp="no" + fi + fi + # + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if strnicmp might be used" >&5 +$as_echo_n "checking if strnicmp might be used... " >&6; } + if test "$tst_links_strnicmp" = "yes" && + test "$tst_proto_strnicmp" = "yes" && + test "$tst_compi_strnicmp" = "yes" && + test "$tst_allow_strnicmp" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + +cat >>confdefs.h <<_ACEOF +#define HAVE_STRNICMP 1 +_ACEOF + + ac_cv_func_strnicmp="yes" + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + ac_cv_func_strnicmp="no" + fi + + + # + tst_links_strstr="unknown" + tst_proto_strstr="unknown" + tst_compi_strstr="unknown" + tst_allow_strstr="unknown" + # + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if strstr can be linked" >&5 +$as_echo_n "checking if strstr can be linked... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + +#define strstr innocuous_strstr +#ifdef __STDC__ +# include +#else +# include +#endif +#undef strstr +#ifdef __cplusplus +extern "C" +#endif +char strstr (); +#if defined __stub_strstr || defined __stub___strstr +choke me +#endif + +int main (void) +{ +return strstr (); + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + tst_links_strstr="yes" + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + tst_links_strstr="no" + +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + # + if test "$tst_links_strstr" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if strstr is prototyped" >&5 +$as_echo_n "checking if strstr is prototyped... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + $curl_includes_string + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "strstr" >/dev/null 2>&1; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + tst_proto_strstr="yes" + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + tst_proto_strstr="no" + +fi +rm -f conftest* + + fi + # + if test "$tst_proto_strstr" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if strstr is compilable" >&5 +$as_echo_n "checking if strstr is compilable... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + + $curl_includes_string + +int main (void) +{ + + if(0 != strstr(0, 0)) + return 1; + + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + tst_compi_strstr="yes" + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + tst_compi_strstr="no" + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + fi + # + if test "$tst_compi_strstr" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if strstr usage allowed" >&5 +$as_echo_n "checking if strstr usage allowed... " >&6; } + if test "x$curl_disallow_strstr" != "xyes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + tst_allow_strstr="yes" + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + tst_allow_strstr="no" + fi + fi + # + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if strstr might be used" >&5 +$as_echo_n "checking if strstr might be used... " >&6; } + if test "$tst_links_strstr" = "yes" && + test "$tst_proto_strstr" = "yes" && + test "$tst_compi_strstr" = "yes" && + test "$tst_allow_strstr" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + +cat >>confdefs.h <<_ACEOF +#define HAVE_STRSTR 1 +_ACEOF + + ac_cv_func_strstr="yes" + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + ac_cv_func_strstr="no" + fi + + + # + tst_links_strtok_r="unknown" + tst_proto_strtok_r="unknown" + tst_compi_strtok_r="unknown" + tst_allow_strtok_r="unknown" + # + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if strtok_r can be linked" >&5 +$as_echo_n "checking if strtok_r can be linked... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + +#define strtok_r innocuous_strtok_r +#ifdef __STDC__ +# include +#else +# include +#endif +#undef strtok_r +#ifdef __cplusplus +extern "C" +#endif +char strtok_r (); +#if defined __stub_strtok_r || defined __stub___strtok_r +choke me +#endif + +int main (void) +{ +return strtok_r (); + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + tst_links_strtok_r="yes" + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + tst_links_strtok_r="no" + +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + # + if test "$tst_links_strtok_r" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if strtok_r is prototyped" >&5 +$as_echo_n "checking if strtok_r is prototyped... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + $curl_includes_string + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "strtok_r" >/dev/null 2>&1; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + tst_proto_strtok_r="yes" + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + tst_proto_strtok_r="no" + +fi +rm -f conftest* + + fi + # + if test "$tst_proto_strtok_r" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if strtok_r is compilable" >&5 +$as_echo_n "checking if strtok_r is compilable... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + + $curl_includes_string + +int main (void) +{ + + if(0 != strtok_r(0, 0, 0)) + return 1; + + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + tst_compi_strtok_r="yes" + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + tst_compi_strtok_r="no" + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + fi + # + if test "$tst_compi_strtok_r" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if strtok_r usage allowed" >&5 +$as_echo_n "checking if strtok_r usage allowed... " >&6; } + if test "x$curl_disallow_strtok_r" != "xyes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + tst_allow_strtok_r="yes" + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + tst_allow_strtok_r="no" + fi + fi + # + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if strtok_r might be used" >&5 +$as_echo_n "checking if strtok_r might be used... " >&6; } + if test "$tst_links_strtok_r" = "yes" && + test "$tst_proto_strtok_r" = "yes" && + test "$tst_compi_strtok_r" = "yes" && + test "$tst_allow_strtok_r" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + +cat >>confdefs.h <<_ACEOF +#define HAVE_STRTOK_R 1 +_ACEOF + + ac_cv_func_strtok_r="yes" + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + ac_cv_func_strtok_r="no" + fi + + + # + tst_links_strtoll="unknown" + tst_proto_strtoll="unknown" + tst_compi_strtoll="unknown" + tst_allow_strtoll="unknown" + # + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if strtoll can be linked" >&5 +$as_echo_n "checking if strtoll can be linked... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + +#define strtoll innocuous_strtoll +#ifdef __STDC__ +# include +#else +# include +#endif +#undef strtoll +#ifdef __cplusplus +extern "C" +#endif +char strtoll (); +#if defined __stub_strtoll || defined __stub___strtoll +choke me +#endif + +int main (void) +{ +return strtoll (); + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + tst_links_strtoll="yes" + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + tst_links_strtoll="no" + +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + # + if test "$tst_links_strtoll" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if strtoll is prototyped" >&5 +$as_echo_n "checking if strtoll is prototyped... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + $curl_includes_stdlib + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "strtoll" >/dev/null 2>&1; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + tst_proto_strtoll="yes" + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + tst_proto_strtoll="no" + +fi +rm -f conftest* + + fi + # + if test "$tst_proto_strtoll" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if strtoll is compilable" >&5 +$as_echo_n "checking if strtoll is compilable... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + + $curl_includes_stdlib + +int main (void) +{ + + if(0 != strtoll(0, 0, 0)) + return 1; + + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + tst_compi_strtoll="yes" + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + tst_compi_strtoll="no" + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + fi + # + if test "$tst_compi_strtoll" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if strtoll usage allowed" >&5 +$as_echo_n "checking if strtoll usage allowed... " >&6; } + if test "x$curl_disallow_strtoll" != "xyes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + tst_allow_strtoll="yes" + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + tst_allow_strtoll="no" + fi + fi + # + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if strtoll might be used" >&5 +$as_echo_n "checking if strtoll might be used... " >&6; } + if test "$tst_links_strtoll" = "yes" && + test "$tst_proto_strtoll" = "yes" && + test "$tst_compi_strtoll" = "yes" && + test "$tst_allow_strtoll" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + +cat >>confdefs.h <<_ACEOF +#define HAVE_STRTOLL 1 +_ACEOF + + ac_cv_func_strtoll="yes" + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + ac_cv_func_strtoll="no" + fi + + +curl_includes_sys_uio="\ +/* includes start */ +#ifdef HAVE_SYS_TYPES_H +# include +#endif +#ifdef HAVE_SYS_UIO_H +# include +#endif +/* includes end */" + for ac_header in sys/types.h sys/uio.h +do : + as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` +ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$curl_includes_sys_uio +" +if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : + cat >>confdefs.h <<_ACEOF +#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + +done + + + + # + tst_links_writev="unknown" + tst_proto_writev="unknown" + tst_compi_writev="unknown" + tst_allow_writev="unknown" + # + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if writev can be linked" >&5 +$as_echo_n "checking if writev can be linked... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + +#define writev innocuous_writev +#ifdef __STDC__ +# include +#else +# include +#endif +#undef writev +#ifdef __cplusplus +extern "C" +#endif +char writev (); +#if defined __stub_writev || defined __stub___writev +choke me +#endif + +int main (void) +{ +return writev (); + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + tst_links_writev="yes" + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + tst_links_writev="no" + +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + # + if test "$tst_links_writev" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if writev is prototyped" >&5 +$as_echo_n "checking if writev is prototyped... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + $curl_includes_sys_uio + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "writev" >/dev/null 2>&1; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + tst_proto_writev="yes" + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + tst_proto_writev="no" + +fi +rm -f conftest* + + fi + # + if test "$tst_proto_writev" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if writev is compilable" >&5 +$as_echo_n "checking if writev is compilable... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + + $curl_includes_sys_uio + +int main (void) +{ + + if(0 != writev(0, 0, 0)) + return 1; + + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + tst_compi_writev="yes" + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + tst_compi_writev="no" + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + fi + # + if test "$tst_compi_writev" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if writev usage allowed" >&5 +$as_echo_n "checking if writev usage allowed... " >&6; } + if test "x$curl_disallow_writev" != "xyes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + tst_allow_writev="yes" + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + tst_allow_writev="no" + fi + fi + # + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if writev might be used" >&5 +$as_echo_n "checking if writev might be used... " >&6; } + if test "$tst_links_writev" = "yes" && + test "$tst_proto_writev" = "yes" && + test "$tst_compi_writev" = "yes" && + test "$tst_allow_writev" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + +cat >>confdefs.h <<_ACEOF +#define HAVE_WRITEV 1 +_ACEOF + + ac_cv_func_writev="yes" + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + ac_cv_func_writev="no" + fi + + +case $host in + *msdosdjgpp) + ac_cv_func_pipe=no + skipcheck_pipe=yes + { $as_echo "$as_me:${as_lineno-$LINENO}: skip check for pipe on msdosdjgpp" >&5 +$as_echo "$as_me: skip check for pipe on msdosdjgpp" >&6;} + ;; +esac + +for ac_func in fork \ + geteuid \ + getpass_r \ + getppid \ + getprotobyname \ + getpwuid \ + getrlimit \ + gettimeofday \ + inet_addr \ + perror \ + pipe \ + setlocale \ + setmode \ + setrlimit \ + uname \ + utime + +do : + as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` +ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" +if eval test \"x\$"$as_ac_var"\" = x"yes"; then : + cat >>confdefs.h <<_ACEOF +#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 +_ACEOF + + +else + + func="$ac_func" + eval skipcheck=\$skipcheck_$func + if test "x$skipcheck" != "xyes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking deeper for $func" >&5 +$as_echo_n "checking deeper for $func... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + + +int main (void) +{ + + $func (); + + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + eval "ac_cv_func_$func=yes" + +cat >>confdefs.h <<_ACEOF +#define `$as_echo "HAVE_$func" | $as_tr_cpp` 1 +_ACEOF + + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: but still no" >&5 +$as_echo "but still no" >&6; } + +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + fi + +fi +done + + + + for ac_header in sys/types.h sys/socket.h netdb.h +do : + as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` +ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" +if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : + cat >>confdefs.h <<_ACEOF +#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + +done + + # + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for getnameinfo" >&5 +$as_echo_n "checking for getnameinfo... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + +#define getnameinfo innocuous_getnameinfo +#ifdef __STDC__ +# include +#else +# include +#endif +#undef getnameinfo +#ifdef __cplusplus +extern "C" +#endif +char getnameinfo (); +#if defined __stub_getnameinfo || defined __stub___getnameinfo +choke me +#endif + +int main (void) +{ +return getnameinfo (); + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + curl_cv_getnameinfo="yes" + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + curl_cv_getnameinfo="no" + +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + # + if test "$curl_cv_getnameinfo" != "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking deeper for getnameinfo" >&5 +$as_echo_n "checking deeper for getnameinfo... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + + +int main (void) +{ + + getnameinfo(); + + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + curl_cv_getnameinfo="yes" + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: but still no" >&5 +$as_echo "but still no" >&6; } + curl_cv_getnameinfo="no" + +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + fi + # + if test "$curl_cv_getnameinfo" != "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking deeper and deeper for getnameinfo" >&5 +$as_echo_n "checking deeper and deeper for getnameinfo... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + +#undef inline +#ifdef HAVE_WINDOWS_H +#ifndef WIN32_LEAN_AND_MEAN +#define WIN32_LEAN_AND_MEAN +#endif +#include +#ifdef HAVE_WINSOCK2_H +#include +#ifdef HAVE_WS2TCPIP_H +#include +#endif +#endif +#else +#ifdef HAVE_SYS_TYPES_H +#include +#endif +#ifdef HAVE_SYS_SOCKET_H +#include +#endif +#ifdef HAVE_NETDB_H +#include +#endif +#endif + +int main (void) +{ + + getnameinfo(0, 0, 0, 0, 0, 0, 0); + + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + curl_cv_getnameinfo="yes" + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: but still no" >&5 +$as_echo "but still no" >&6; } + curl_cv_getnameinfo="no" + +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + fi + # + if test "$curl_cv_getnameinfo" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking types of arguments for getnameinfo" >&5 +$as_echo_n "checking types of arguments for getnameinfo... " >&6; } +if test "${curl_cv_func_getnameinfo_args+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + + curl_cv_func_getnameinfo_args="unknown" + for gni_arg1 in 'struct sockaddr *' 'const struct sockaddr *' 'void *'; do + for gni_arg2 in 'socklen_t' 'size_t' 'int'; do + for gni_arg46 in 'size_t' 'int' 'socklen_t' 'unsigned int' 'DWORD'; do + for gni_arg7 in 'int' 'unsigned int'; do + if test "$curl_cv_func_getnameinfo_args" = "unknown"; then + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + +#undef inline +#ifdef HAVE_WINDOWS_H +#ifndef WIN32_LEAN_AND_MEAN +#define WIN32_LEAN_AND_MEAN +#endif +#if (!defined(_WIN32_WINNT)) || (_WIN32_WINNT < 0x0501) +#undef _WIN32_WINNT +#define _WIN32_WINNT 0x0501 +#endif +#include +#ifdef HAVE_WINSOCK2_H +#include +#ifdef HAVE_WS2TCPIP_H +#include +#endif +#endif +#define GNICALLCONV WSAAPI +#else +#ifdef HAVE_SYS_TYPES_H +#include +#endif +#ifdef HAVE_SYS_SOCKET_H +#include +#endif +#ifdef HAVE_NETDB_H +#include +#endif +#define GNICALLCONV +#endif + extern int GNICALLCONV getnameinfo($gni_arg1, $gni_arg2, + char *, $gni_arg46, + char *, $gni_arg46, + $gni_arg7); + +int main (void) +{ + + $gni_arg2 salen=0; + $gni_arg46 hostlen=0; + $gni_arg46 servlen=0; + $gni_arg7 flags=0; + int res = getnameinfo(0, salen, 0, hostlen, 0, servlen, flags); + + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + + curl_cv_func_getnameinfo_args="$gni_arg1,$gni_arg2,$gni_arg46,$gni_arg7" + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + fi + done + done + done + done + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $curl_cv_func_getnameinfo_args" >&5 +$as_echo "$curl_cv_func_getnameinfo_args" >&6; } # AC-CACHE-CHECK + if test "$curl_cv_func_getnameinfo_args" = "unknown"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Cannot find proper types to use for getnameinfo args" >&5 +$as_echo "$as_me: WARNING: Cannot find proper types to use for getnameinfo args" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: HAVE_GETNAMEINFO will not be defined" >&5 +$as_echo "$as_me: WARNING: HAVE_GETNAMEINFO will not be defined" >&2;} + else + gni_prev_IFS=$IFS; IFS=',' + set dummy `echo "$curl_cv_func_getnameinfo_args" | sed 's/\*/\*/g'` + IFS=$gni_prev_IFS + shift + # + gni_qual_type_arg1=$1 + # + +cat >>confdefs.h <<_ACEOF +#define GETNAMEINFO_TYPE_ARG2 $2 +_ACEOF + + +cat >>confdefs.h <<_ACEOF +#define GETNAMEINFO_TYPE_ARG46 $3 +_ACEOF + + +cat >>confdefs.h <<_ACEOF +#define GETNAMEINFO_TYPE_ARG7 $4 +_ACEOF + + # + prev_sh_opts=$- + # + case $prev_sh_opts in + *f*) + ;; + *) + set -f + ;; + esac + # + case "$gni_qual_type_arg1" in + const*) + gni_qual_arg1=const + gni_type_arg1=`echo $gni_qual_type_arg1 | sed 's/^const //'` + ;; + *) + gni_qual_arg1= + gni_type_arg1=$gni_qual_type_arg1 + ;; + esac + # + +cat >>confdefs.h <<_ACEOF +#define GETNAMEINFO_QUAL_ARG1 $gni_qual_arg1 +_ACEOF + + +cat >>confdefs.h <<_ACEOF +#define GETNAMEINFO_TYPE_ARG1 $gni_type_arg1 +_ACEOF + + # + case $prev_sh_opts in + *f*) + ;; + *) + set +f + ;; + esac + # + +cat >>confdefs.h <<_ACEOF +#define HAVE_GETNAMEINFO 1 +_ACEOF + + ac_cv_func_getnameinfo="yes" + fi + fi + + +if test "$ipv6" = "yes"; then + if test "$ac_cv_func_getaddrinfo" = "yes"; then + +$as_echo "#define ENABLE_IPV6 1" >>confdefs.h + + IPV6_ENABLED=1 + + fi + + for ac_header in stdio.h sys/types.h sys/socket.h \ + netdb.h netinet/in.h arpa/inet.h +do : + as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` +ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" +if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : + cat >>confdefs.h <<_ACEOF +#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + +done + + # + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for working NI_WITHSCOPEID" >&5 +$as_echo_n "checking for working NI_WITHSCOPEID... " >&6; } +if test "${ac_cv_working_ni_withscopeid+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + + if test "$cross_compiling" = yes; then : + + # Program is not run when cross-compiling. So we assume + # NI_WITHSCOPEID will work if we are able to compile it. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + +#include +#include +#include + +int main (void) +{ + + unsigned int dummy= NI_NUMERICHOST | NI_NUMERICSERV | NI_WITHSCOPEID; + + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + + ac_cv_working_ni_withscopeid="yes" + +else + + ac_cv_working_ni_withscopeid="no" + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext # AC-COMPILE-IFELSE + +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + +#ifdef HAVE_STDLIB_H +#include +#endif +#ifdef HAVE_STDIO_H +#include +#endif +#ifdef HAVE_SYS_TYPES_H +#include +#endif +#ifdef HAVE_SYS_SOCKET_H +#include +#endif +#ifdef HAVE_NETDB_H +#include +#endif +#ifdef HAVE_NETINET_IN_H +#include +#endif +#ifdef HAVE_ARPA_INET_H +#include +#endif + +int main (void) +{ + +#if defined(NI_WITHSCOPEID) && defined(HAVE_GETNAMEINFO) +#ifdef HAVE_STRUCT_SOCKADDR_STORAGE + struct sockaddr_storage sa; +#else + unsigned char sa[256]; +#endif + char hostbuf[NI_MAXHOST]; + int rc; + GETNAMEINFO_TYPE_ARG2 salen = (GETNAMEINFO_TYPE_ARG2)sizeof(sa); + GETNAMEINFO_TYPE_ARG46 hostlen = (GETNAMEINFO_TYPE_ARG46)sizeof(hostbuf); + GETNAMEINFO_TYPE_ARG7 flags = NI_NUMERICHOST | NI_NUMERICSERV | NI_WITHSCOPEID; + int fd = socket(AF_INET6, SOCK_STREAM, 0); + if(fd < 0) { + perror("socket()"); + return 1; /* Error creating socket */ + } + rc = getsockname(fd, (GETNAMEINFO_TYPE_ARG1)&sa, &salen); + if(rc) { + perror("getsockname()"); + return 2; /* Error retrieving socket name */ + } + rc = getnameinfo((GETNAMEINFO_TYPE_ARG1)&sa, salen, hostbuf, hostlen, NULL, 0, flags); + if(rc) { + printf("rc = %s\n", gai_strerror(rc)); + return 3; /* Error translating socket address */ + } + return 0; /* Ok, NI_WITHSCOPEID works */ +#else + return 4; /* Error, NI_WITHSCOPEID not defined or no getnameinfo() */ +#endif + + ; + return 0; +} # AC-LANG-PROGRAM + +_ACEOF +if ac_fn_c_try_run "$LINENO"; then : + + # Exit code == 0. Program worked. + ac_cv_working_ni_withscopeid="yes" + +else + + # Exit code != 0. Program failed. + ac_cv_working_ni_withscopeid="no" + +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext +fi + # AC-RUN-IFELSE + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_working_ni_withscopeid" >&5 +$as_echo "$ac_cv_working_ni_withscopeid" >&6; } # AC-CACHE-CHECK + case "$ac_cv_working_ni_withscopeid" in + yes) + +$as_echo "#define HAVE_NI_WITHSCOPEID 1" >>confdefs.h + + ;; + esac + +fi + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to enable non-blocking communications" >&5 +$as_echo_n "checking whether to enable non-blocking communications... " >&6; } + OPT_NONBLOCKING="default" + # Check whether --enable-nonblocking was given. +if test "${enable_nonblocking+set}" = set; then : + enableval=$enable_nonblocking; OPT_NONBLOCKING=$enableval +fi + + case "$OPT_NONBLOCKING" in + no) + want_nonblocking="no" + ;; + default) + want_nonblocking="yes" + ;; + *) + want_nonblocking="yes" + ;; + esac + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $want_nonblocking" >&5 +$as_echo "$want_nonblocking" >&6; } + + + # + tst_method="unknown" + if test "$want_nonblocking" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to set a socket into non-blocking mode" >&5 +$as_echo_n "checking how to set a socket into non-blocking mode... " >&6; } + if test "x$ac_cv_func_fcntl_o_nonblock" = "xyes"; then + tst_method="fcntl O_NONBLOCK" + elif test "x$ac_cv_func_ioctl_fionbio" = "xyes"; then + tst_method="ioctl FIONBIO" + elif test "x$ac_cv_func_ioctlsocket_fionbio" = "xyes"; then + tst_method="ioctlsocket FIONBIO" + elif test "x$ac_cv_func_ioctlsocket_camel_fionbio" = "xyes"; then + tst_method="IoctlSocket FIONBIO" + elif test "x$ac_cv_func_setsockopt_so_nonblock" = "xyes"; then + tst_method="setsockopt SO_NONBLOCK" + fi + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $tst_method" >&5 +$as_echo "$tst_method" >&6; } + if test "$tst_method" = "unknown"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cannot determine non-blocking socket method." >&5 +$as_echo "$as_me: WARNING: cannot determine non-blocking socket method." >&2;} + fi + fi + if test "$tst_method" = "unknown"; then + +cat >>confdefs.h <<_ACEOF +#define USE_BLOCKING_SOCKETS 1 +_ACEOF + + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: non-blocking sockets disabled." >&5 +$as_echo "$as_me: WARNING: non-blocking sockets disabled." >&2;} + fi + + + +# Extract the first word of "perl", so it can be a program name with args. +set dummy perl; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if test "${ac_cv_path_PERL+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + case $PERL in + [\\/]* | ?:[\\/]*) + ac_cv_path_PERL="$PERL" # Let the user override the test with a path. + ;; + *) + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +as_dummy="$PATH:/usr/local/bin/perl:/usr/bin/:/usr/local/bin " +for as_dir in $as_dummy +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_path_PERL="$as_dir/$ac_word$ac_exec_ext" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + + ;; +esac +fi +PERL=$ac_cv_path_PERL +if test -n "$PERL"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PERL" >&5 +$as_echo "$PERL" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + + +for ac_prog in gnroff nroff +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if test "${ac_cv_path_NROFF+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + case $NROFF in + [\\/]* | ?:[\\/]*) + ac_cv_path_NROFF="$NROFF" # Let the user override the test with a path. + ;; + *) + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +as_dummy="$PATH:/usr/bin/:/usr/local/bin " +for as_dir in $as_dummy +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_path_NROFF="$as_dir/$ac_word$ac_exec_ext" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + + ;; +esac +fi +NROFF=$ac_cv_path_NROFF +if test -n "$NROFF"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $NROFF" >&5 +$as_echo "$NROFF" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + test -n "$NROFF" && break +done + + + +if test -n "$NROFF"; then + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to use *nroff to get plain text from man pages" >&5 +$as_echo_n "checking how to use *nroff to get plain text from man pages... " >&6; } + MANOPT="-man" + mancheck=`echo foo | $NROFF $MANOPT 2>/dev/null` + if test -z "$mancheck"; then + MANOPT="-mandoc" + mancheck=`echo foo | $NROFF $MANOPT 2>/dev/null` + if test -z "$mancheck"; then + MANOPT="" + { $as_echo "$as_me:${as_lineno-$LINENO}: result: failed" >&5 +$as_echo "failed" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: found no *nroff option to get plaintext from man pages" >&5 +$as_echo "$as_me: WARNING: found no *nroff option to get plaintext from man pages" >&2;} + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MANOPT" >&5 +$as_echo "$MANOPT" >&6; } + fi + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MANOPT" >&5 +$as_echo "$MANOPT" >&6; } + fi + +fi + +if test -z "$MANOPT" +then + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: disabling built-in manual" >&5 +$as_echo "$as_me: WARNING: disabling built-in manual" >&2;} + USE_MANUAL="no"; +fi + + +if test "$USE_MANUAL" = "1"; then + +$as_echo "#define USE_MANUAL 1" >>confdefs.h + + curl_manual_msg="enabled" +fi + + + +if test x"$USE_MANUAL" = x1; then + USE_MANUAL_TRUE= + USE_MANUAL_FALSE='#' +else + USE_MANUAL_TRUE='#' + USE_MANUAL_FALSE= +fi + + + + + + # + if test "$want_ares" = "yes"; then + clean_CPPFLAGS="$CPPFLAGS" + clean_LDFLAGS="$LDFLAGS" + clean_LIBS="$LIBS" + embedded_ares="unknown" + configure_runpath=`pwd` + embedded_ares_builddir="$configure_runpath/ares" + if test -n "$want_ares_path"; then + ares_CPPFLAGS="-I$want_ares_path/include" + ares_LDFLAGS="-L$want_ares_path/lib" + ares_LIBS="-lcares" + else + if test -d "$srcdir/ares"; then + embedded_ares="yes" + subdirs="$subdirs ares" + + ares_CPPFLAGS="" + ares_LDFLAGS="-L$embedded_ares_builddir" + ares_LIBS="-lcares" + else + ares_CPPFLAGS="" + ares_LDFLAGS="" + ares_LIBS="-lcares" + fi + fi + # + CPPFLAGS="$ares_CPPFLAGS $clean_CPPFLAGS" + LDFLAGS="$ares_LDFLAGS $clean_LDFLAGS" + LIBS="$ares_LIBS $clean_LIBS" + # + if test "$embedded_ares" != "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking that c-ares is good and recent enough" >&5 +$as_echo_n "checking that c-ares is good and recent enough... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + +#include + /* set of dummy functions in case c-ares was built with debug */ + void curl_dofree() { } + void curl_sclose() { } + void curl_domalloc() { } + void curl_docalloc() { } + void curl_socket() { } + +int main (void) +{ + + ares_channel channel; + ares_cancel(channel); /* added in 1.2.0 */ + ares_process_fd(channel, 0, 0); /* added in 1.4.0 */ + ares_dup(&channel, channel); /* added in 1.6.0 */ + + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + as_fn_error $? "c-ares library defective or too old" "$LINENO" 5 + CPPFLAGS="$clean_CPPFLAGS" + LDFLAGS="$clean_LDFLAGS" + LIBS="$clean_LIBS" + # prevent usage + want_ares="no" + +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + fi + if test "$want_ares" = "yes"; then + +$as_echo "#define USE_ARES 1" >>confdefs.h + + USE_ARES=1 + + curl_res_msg="c-ares" + fi + fi + + + +if test x$embedded_ares = xyes; then + USE_EMBEDDED_ARES_TRUE= + USE_EMBEDDED_ARES_FALSE='#' +else + USE_EMBEDDED_ARES_TRUE='#' + USE_EMBEDDED_ARES_FALSE= +fi + + +if test "x$enable_shared" = "xyes"; then + build_libhostname=yes +else + build_libhostname=no +fi + + +if test x$build_libhostname = xyes; then + BUILD_LIBHOSTNAME_TRUE= + BUILD_LIBHOSTNAME_FALSE='#' +else + BUILD_LIBHOSTNAME_TRUE='#' + BUILD_LIBHOSTNAME_FALSE= +fi + + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to enable the threaded resolver" >&5 +$as_echo_n "checking whether to enable the threaded resolver... " >&6; } + OPT_THRES="default" + # Check whether --enable-threaded_resolver was given. +if test "${enable_threaded_resolver+set}" = set; then : + enableval=$enable_threaded_resolver; OPT_THRES=$enableval +fi + + case "$OPT_THRES" in + yes) + want_thres="yes" + ;; + *) + want_thres="no" + ;; + esac + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $want_thres" >&5 +$as_echo "$want_thres" >&6; } + + +if test "x$want_thres" = xyes && test "x$want_ares" = xyes; then + as_fn_error $? "Options --enable-threaded-resolver and --enable-ares are mutually exclusive" "$LINENO" 5 +fi + +if test "$want_thres" = "yes"; then + ac_fn_c_check_header_mongrel "$LINENO" "pthread.h" "ac_cv_header_pthread_h" "$ac_includes_default" +if test "x$ac_cv_header_pthread_h" = x""yes; then : + +$as_echo "#define HAVE_PTHREAD_H 1" >>confdefs.h + + save_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS -pthread" + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pthread_create in -lpthread" >&5 +$as_echo_n "checking for pthread_create in -lpthread... " >&6; } +if test "${ac_cv_lib_pthread_pthread_create+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lpthread $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + +#ifdef __cplusplus +extern "C" +#endif +char pthread_create (); +int main (void) +{ +return pthread_create (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_lib_pthread_pthread_create=yes +else + ac_cv_lib_pthread_pthread_create=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_pthread_pthread_create" >&5 +$as_echo "$ac_cv_lib_pthread_pthread_create" >&6; } +if test "x$ac_cv_lib_pthread_pthread_create" = x""yes; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: using POSIX threaded DNS lookup" >&5 +$as_echo "$as_me: using POSIX threaded DNS lookup" >&6;} + +$as_echo "#define USE_THREADS_POSIX 1" >>confdefs.h + + USE_THREADS_POSIX=1 + curl_res_msg="threaded" + +else + CFLAGS="$save_CFLAGS" +fi + + +fi + + +fi + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to enable verbose strings" >&5 +$as_echo_n "checking whether to enable verbose strings... " >&6; } +# Check whether --enable-verbose was given. +if test "${enable_verbose+set}" = set; then : + enableval=$enable_verbose; case "$enableval" in + no) + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + +$as_echo "#define CURL_DISABLE_VERBOSE_STRINGS 1" >>confdefs.h + + curl_verbose_msg="no" + ;; + *) { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + ;; + esac +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + +fi + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to enable SSPI support (Windows native builds only)" >&5 +$as_echo_n "checking whether to enable SSPI support (Windows native builds only)... " >&6; } +# Check whether --enable-sspi was given. +if test "${enable_sspi+set}" = set; then : + enableval=$enable_sspi; case "$enableval" in + yes) + if test "$ac_cv_native_windows" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + +$as_echo "#define USE_WINDOWS_SSPI 1" >>confdefs.h + + USE_WINDOWS_SSPI=1 + + curl_sspi_msg="enabled" + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: --enable-sspi Ignored. Only supported on native Windows builds." >&5 +$as_echo "$as_me: WARNING: --enable-sspi Ignored. Only supported on native Windows builds." >&2;} + fi + ;; + *) + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + ;; + esac +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + +fi + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to enable cryptographic authentication methods" >&5 +$as_echo_n "checking whether to enable cryptographic authentication methods... " >&6; } +# Check whether --enable-crypto-auth was given. +if test "${enable_crypto_auth+set}" = set; then : + enableval=$enable_crypto_auth; case "$enableval" in + no) + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + +$as_echo "#define CURL_DISABLE_CRYPTO_AUTH 1" >>confdefs.h + + ;; + *) { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + ;; + esac +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + +fi + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to enable support for cookies" >&5 +$as_echo_n "checking whether to enable support for cookies... " >&6; } +# Check whether --enable-cookies was given. +if test "${enable_cookies+set}" = set; then : + enableval=$enable_cookies; case "$enableval" in + no) + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + +$as_echo "#define CURL_DISABLE_COOKIES 1" >>confdefs.h + + ;; + *) { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + ;; + esac +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + +fi + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to enable hidden symbols in the library" >&5 +$as_echo_n "checking whether to enable hidden symbols in the library... " >&6; } +# Check whether --enable-hidden-symbols was given. +if test "${enable_hidden_symbols+set}" = set; then : + enableval=$enable_hidden_symbols; case "$enableval" in + no) + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + ;; + *) + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC supports it" >&5 +$as_echo_n "checking whether $CC supports it... " >&6; } + if test "$GCC" = yes ; then + if $CC --help --verbose 2>&1 | grep fvisibility= > /dev/null || + test "$compiler_id" = "CLANG"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + +$as_echo "#define CURL_HIDDEN_SYMBOLS 1" >>confdefs.h + + +$as_echo "#define CURL_EXTERN_SYMBOL __attribute__ ((visibility (\"default\")))" >>confdefs.h + + CFLAGS="$CFLAGS -fvisibility=hidden" + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + fi + + else + if $CC 2>&1 | grep flags >/dev/null && $CC -flags | grep xldscope= >/dev/null ; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + +$as_echo "#define CURL_HIDDEN_SYMBOLS 1" >>confdefs.h + + +$as_echo "#define CURL_EXTERN_SYMBOL __global" >>confdefs.h + + CFLAGS="$CFLAGS -xldscope=hidden" + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + fi + fi + ;; + esac +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + +fi + + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to enforce SONAME bump" >&5 +$as_echo_n "checking whether to enforce SONAME bump... " >&6; } +# Check whether --enable-soname-bump was given. +if test "${enable_soname_bump+set}" = set; then : + enableval=$enable_soname_bump; case "$enableval" in + yes) { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + soname_bump=yes + ;; + *) + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + ;; + esac +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $soname_bump" >&5 +$as_echo "$soname_bump" >&6; } + +fi + + + +if test x$soname_bump = xyes; then + SONAME_BUMP_TRUE= + SONAME_BUMP_FALSE='#' +else + SONAME_BUMP_TRUE='#' + SONAME_BUMP_FALSE= +fi + + + +if test ! -z "$winsock_LIB"; then + + + LIBS="$LIBS $winsock_LIB" + TEST_SERVER_LIBS="$TEST_SERVER_LIBS $winsock_LIB" + +fi + +LIBCURL_LIBS=$LIBS + + + + + +LIBS=$ALL_LIBS + + +if test x$cross_compiling = xyes; then + CROSSCOMPILING_TRUE= + CROSSCOMPILING_FALSE='#' +else + CROSSCOMPILING_TRUE='#' + CROSSCOMPILING_FALSE= +fi + + +ENABLE_SHARED="$enable_shared" + + + +if test "x$USE_SSLEAY" = "x1"; then + SUPPORT_FEATURES="$SUPPORT_FEATURES SSL" +elif test -n "$SSL_ENABLED"; then + SUPPORT_FEATURES="$SUPPORT_FEATURES SSL" +fi +if test "@KRB4_ENABLED@" = "x1"; then + SUPPORT_FEATURES="$SUPPORT_FEATURES KRB4" +fi +if test "x$IPV6_ENABLED" = "x1"; then + SUPPORT_FEATURES="$SUPPORT_FEATURES IPv6" +fi +if test "x$HAVE_LIBZ" = "x1"; then + SUPPORT_FEATURES="$SUPPORT_FEATURES libz" +fi +if test "x$USE_ARES" = "x1" -o "x$USE_THREADS_POSIX" = "x1"; then + SUPPORT_FEATURES="$SUPPORT_FEATURES AsynchDNS" +fi +if test "x$IDN_ENABLED" = "x1"; then + SUPPORT_FEATURES="$SUPPORT_FEATURES IDN" +fi +if test "x$USE_WINDOWS_SSPI" = "x1"; then + SUPPORT_FEATURES="$SUPPORT_FEATURES SSPI" +fi +if test "x$USE_SSLEAY" = "x1" -o "x$USE_WINDOWS_SSPI" = "x1" \ + -o "x$GNUTLS_ENABLED" = "x1" -o "x$NSS_ENABLED" = "x1"; then + SUPPORT_FEATURES="$SUPPORT_FEATURES NTLM" +fi + + + +if test "x$CURL_DISABLE_HTTP" != "x1"; then + SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS HTTP" + if test "x$SSL_ENABLED" = "x1"; then + SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS HTTPS" + fi +fi +if test "x$CURL_DISABLE_FTP" != "x1"; then + SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS FTP" + if test "x$SSL_ENABLED" = "x1"; then + SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS FTPS" + fi +fi +if test "x$CURL_DISABLE_FILE" != "x1"; then + SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS FILE" +fi +if test "x$CURL_DISABLE_TELNET" != "x1"; then + SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS TELNET" +fi +if test "x$CURL_DISABLE_LDAP" != "x1"; then + SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS LDAP" + if test "x$CURL_DISABLE_LDAPS" != "x1"; then + if (test "x$USE_OPENLDAP" = "x1" && test "x$SSL_ENABLED" = "x1") || + (test "x$USE_OPENLDAP" != "x1" && test "x$HAVE_LDAP_SSL" = "x1"); then + SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS LDAPS" + fi + fi +fi +if test "x$CURL_DISABLE_DICT" != "x1"; then + SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS DICT" +fi +if test "x$CURL_DISABLE_TFTP" != "x1"; then + SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS TFTP" +fi +if test "x$CURL_DISABLE_GOPHER" != "x1"; then + SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS GOPHER" +fi +if test "x$CURL_DISABLE_POP3" != "x1"; then + SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS POP3" + if test "x$SSL_ENABLED" = "x1"; then + SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS POP3S" + fi +fi +if test "x$CURL_DISABLE_IMAP" != "x1"; then + SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS IMAP" + if test "x$SSL_ENABLED" = "x1"; then + SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS IMAPS" + fi +fi +if test "x$CURL_DISABLE_SMTP" != "x1"; then + SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS SMTP" + if test "x$SSL_ENABLED" = "x1"; then + SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS SMTPS" + fi +fi +if test "x$USE_LIBSSH2" = "x1"; then + SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS SCP" + SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS SFTP" +fi +if test "x$CURL_DISABLE_RTSP" != "x1"; then + SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS RTSP" +fi +if test "x$USE_LIBRTMP" = "x1"; then + SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS RTMP" +fi + +SUPPORT_PROTOCOLS=`echo $SUPPORT_PROTOCOLS | tr ' ' '\012' | sort | tr '\012' ' '` + + + + +squeeze CFLAGS +squeeze CPPFLAGS +squeeze DEFS +squeeze LDFLAGS +squeeze LIBS + +squeeze CURL_LIBS +squeeze LIBCURL_LIBS +squeeze TEST_SERVER_LIBS +squeeze CURL_NETWORK_LIBS + +squeeze SUPPORT_FEATURES +squeeze SUPPORT_PROTOCOLS + +if test "x$want_curldebug_assumed" = "xyes" && + test "x$want_curldebug" = "xyes" && test "x$USE_ARES" = "x1"; then + ac_configure_args="$ac_configure_args --enable-curldebug" +fi + +ac_config_files="$ac_config_files Makefile docs/Makefile docs/examples/Makefile docs/libcurl/Makefile include/Makefile include/curl/Makefile src/Makefile lib/Makefile tests/Makefile tests/data/Makefile tests/server/Makefile tests/libtest/Makefile packages/Makefile packages/Win32/Makefile packages/Win32/cygwin/Makefile packages/Linux/Makefile packages/Linux/RPM/Makefile packages/Linux/RPM/curl.spec packages/Linux/RPM/curl-ssl.spec packages/Solaris/Makefile packages/EPM/curl.list packages/EPM/Makefile packages/vms/Makefile packages/AIX/Makefile packages/AIX/RPM/Makefile packages/AIX/RPM/curl.spec curl-config libcurl.pc" + +cat >confcache <<\_ACEOF +# This file is a shell script that caches the results of configure +# tests run on this system so they can be shared between configure +# scripts and configure runs, see configure's option --config-cache. +# It is not useful on other systems. If it contains results you don't +# want to keep, you may remove or edit it. +# +# config.status only pays attention to the cache file if you give it +# the --recheck option to rerun configure. +# +# `ac_cv_env_foo' variables (set or unset) will be overridden when +# loading this file, other *unset* `ac_cv_foo' will be assigned the +# following values. + +_ACEOF + +# The following way of writing the cache mishandles newlines in values, +# but we know of no workaround that is simple, portable, and efficient. +# So, we kill variables containing newlines. +# Ultrix sh set writes to stderr and can't be redirected directly, +# and sets the high bit in the cache file unless we assign to the vars. +( + for ac_var in `(set) 2>&1 | sed -n 's/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'`; do + eval ac_val=\$$ac_var + case $ac_val in #( + *${as_nl}*) + case $ac_var in #( + *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 +$as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; + esac + case $ac_var in #( + _ | IFS | as_nl) ;; #( + BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( + *) { eval $ac_var=; unset $ac_var;} ;; + esac ;; + esac + done + + (set) 2>&1 | + case $as_nl`(ac_space=' '; set) 2>&1` in #( + *${as_nl}ac_space=\ *) + # `set' does not quote correctly, so add quotes: double-quote + # substitution turns \\\\ into \\, and sed turns \\ into \. + sed -n \ + "s/'/'\\\\''/g; + s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" + ;; #( + *) + # `set' quotes correctly as required by POSIX, so do not add quotes. + sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" + ;; + esac | + sort +) | + sed ' + /^ac_cv_env_/b end + t clear + :clear + s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/ + t end + s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ + :end' >>confcache +if diff "$cache_file" confcache >/dev/null 2>&1; then :; else + if test -w "$cache_file"; then + test "x$cache_file" != "x/dev/null" && + { $as_echo "$as_me:${as_lineno-$LINENO}: updating cache $cache_file" >&5 +$as_echo "$as_me: updating cache $cache_file" >&6;} + cat confcache >$cache_file + else + { $as_echo "$as_me:${as_lineno-$LINENO}: not updating unwritable cache $cache_file" >&5 +$as_echo "$as_me: not updating unwritable cache $cache_file" >&6;} + fi +fi +rm -f confcache + +test "x$prefix" = xNONE && prefix=$ac_default_prefix +# Let make expand exec_prefix. +test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' + +DEFS=-DHAVE_CONFIG_H + +ac_libobjs= +ac_ltlibobjs= +U= +for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue + # 1. Remove the extension, and $U if already installed. + ac_script='s/\$U\././;s/\.o$//;s/\.obj$//' + ac_i=`$as_echo "$ac_i" | sed "$ac_script"` + # 2. Prepend LIBOBJDIR. When used with automake>=1.10 LIBOBJDIR + # will be set to the directory where LIBOBJS objects are built. + as_fn_append ac_libobjs " \${LIBOBJDIR}$ac_i\$U.$ac_objext" + as_fn_append ac_ltlibobjs " \${LIBOBJDIR}$ac_i"'$U.lo' +done +LIBOBJS=$ac_libobjs + +LTLIBOBJS=$ac_ltlibobjs + + +if test -z "${MAINTAINER_MODE_TRUE}" && test -z "${MAINTAINER_MODE_FALSE}"; then + as_fn_error $? "conditional \"MAINTAINER_MODE\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${AMDEP_TRUE}" && test -z "${AMDEP_FALSE}"; then + as_fn_error $? "conditional \"AMDEP\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${am__fastdepCC_TRUE}" && test -z "${am__fastdepCC_FALSE}"; then + as_fn_error $? "conditional \"am__fastdepCC\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${MIMPURE_TRUE}" && test -z "${MIMPURE_FALSE}"; then + as_fn_error $? "conditional \"MIMPURE\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${STATICLIB_TRUE}" && test -z "${STATICLIB_FALSE}"; then + as_fn_error $? "conditional \"STATICLIB\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${STATICLIB_TRUE}" && test -z "${STATICLIB_FALSE}"; then + as_fn_error $? "conditional \"STATICLIB\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${NO_UNDEFINED_TRUE}" && test -z "${NO_UNDEFINED_FALSE}"; then + as_fn_error $? "conditional \"NO_UNDEFINED\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${CURLDEBUG_TRUE}" && test -z "${CURLDEBUG_FALSE}"; then + as_fn_error $? "conditional \"CURLDEBUG\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${HAVE_LIBZ_TRUE}" && test -z "${HAVE_LIBZ_FALSE}"; then + as_fn_error $? "conditional \"HAVE_LIBZ\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${USE_MANUAL_TRUE}" && test -z "${USE_MANUAL_FALSE}"; then + as_fn_error $? "conditional \"USE_MANUAL\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${USE_EMBEDDED_ARES_TRUE}" && test -z "${USE_EMBEDDED_ARES_FALSE}"; then + as_fn_error $? "conditional \"USE_EMBEDDED_ARES\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${BUILD_LIBHOSTNAME_TRUE}" && test -z "${BUILD_LIBHOSTNAME_FALSE}"; then + as_fn_error $? "conditional \"BUILD_LIBHOSTNAME\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${SONAME_BUMP_TRUE}" && test -z "${SONAME_BUMP_FALSE}"; then + as_fn_error $? "conditional \"SONAME_BUMP\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${CROSSCOMPILING_TRUE}" && test -z "${CROSSCOMPILING_FALSE}"; then + as_fn_error $? "conditional \"CROSSCOMPILING\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi + +: ${CONFIG_STATUS=./config.status} +ac_write_fail=0 +ac_clean_files_save=$ac_clean_files +ac_clean_files="$ac_clean_files $CONFIG_STATUS" +{ $as_echo "$as_me:${as_lineno-$LINENO}: creating $CONFIG_STATUS" >&5 +$as_echo "$as_me: creating $CONFIG_STATUS" >&6;} +as_write_fail=0 +cat >$CONFIG_STATUS <<_ASEOF || as_write_fail=1 +#! $SHELL +# Generated by $as_me. +# Run this file to recreate the current configuration. +# Compiler output produced by configure, useful for debugging +# configure, is in config.log if it exists. + +debug=false +ac_cs_recheck=false +ac_cs_silent=false + +SHELL=\${CONFIG_SHELL-$SHELL} +export SHELL +_ASEOF +cat >>$CONFIG_STATUS <<\_ASEOF || as_write_fail=1 +## -------------------- ## +## M4sh Initialization. ## +## -------------------- ## + +# Be more Bourne compatible +DUALCASE=1; export DUALCASE # for MKS sh +if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : + emulate sh + NULLCMD=: + # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which + # is contrary to our usage. Disable this feature. + alias -g '${1+"$@"}'='"$@"' + setopt NO_GLOB_SUBST +else + case `(set -o) 2>/dev/null` in #( + *posix*) : + set -o posix ;; #( + *) : + ;; +esac +fi + + +as_nl=' +' +export as_nl +# Printing a long string crashes Solaris 7 /usr/bin/printf. +as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' +as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo +as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo +# Prefer a ksh shell builtin over an external printf program on Solaris, +# but without wasting forks for bash or zsh. +if test -z "$BASH_VERSION$ZSH_VERSION" \ + && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then + as_echo='print -r --' + as_echo_n='print -rn --' +elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then + as_echo='printf %s\n' + as_echo_n='printf %s' +else + if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then + as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' + as_echo_n='/usr/ucb/echo -n' + else + as_echo_body='eval expr "X$1" : "X\\(.*\\)"' + as_echo_n_body='eval + arg=$1; + case $arg in #( + *"$as_nl"*) + expr "X$arg" : "X\\(.*\\)$as_nl"; + arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; + esac; + expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" + ' + export as_echo_n_body + as_echo_n='sh -c $as_echo_n_body as_echo' + fi + export as_echo_body + as_echo='sh -c $as_echo_body as_echo' +fi + + + +# IFS +# We need space, tab and new line, in precisely that order. Quoting is +# there to prevent editors from complaining about space-tab. +# (If _AS_PATH_WALK were called with IFS unset, it would disable word +# splitting by setting IFS to empty value.) +IFS=" "" $as_nl" + +# Find who we are. Look in the path if we contain no directory separator. +case $0 in #(( + *[\\/]* ) as_myself=$0 ;; + *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break + done +IFS=$as_save_IFS + + ;; +esac +# We did not find ourselves, most probably we were run as `sh COMMAND' +# in which case we are not to be found in the path. +if test "x$as_myself" = x; then + as_myself=$0 +fi +if test ! -f "$as_myself"; then + $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 + exit 1 +fi + +# Unset variables that we do not need and which cause bugs (e.g. in +# pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1" +# suppresses any "Segmentation fault" message there. '((' could +# trigger a bug in pdksh 5.2.14. +for as_var in BASH_ENV ENV MAIL MAILPATH +do eval test x\${$as_var+set} = xset \ + && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : +done +PS1='$ ' +PS2='> ' +PS4='+ ' + +# NLS nuisances. +LC_ALL=C +export LC_ALL +LANGUAGE=C +export LANGUAGE + +# CDPATH. +(unset CDPATH) >/dev/null 2>&1 && unset CDPATH + + +# as_fn_error STATUS ERROR [LINENO LOG_FD] +# ---------------------------------------- +# Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are +# provided, also output the error to LOG_FD, referencing LINENO. Then exit the +# script with STATUS, using 1 if that was 0. +as_fn_error () +{ + as_status=$1; test $as_status -eq 0 && as_status=1 + if test "$4"; then + as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 + fi + $as_echo "$as_me: error: $2" >&2 + as_fn_exit $as_status +} # as_fn_error + + +# as_fn_set_status STATUS +# ----------------------- +# Set $? to STATUS, without forking. +as_fn_set_status () +{ + return $1 +} # as_fn_set_status + +# as_fn_exit STATUS +# ----------------- +# Exit the shell with STATUS, even in a "trap 0" or "set -e" context. +as_fn_exit () +{ + set +e + as_fn_set_status $1 + exit $1 +} # as_fn_exit + +# as_fn_unset VAR +# --------------- +# Portably unset VAR. +as_fn_unset () +{ + { eval $1=; unset $1;} +} +as_unset=as_fn_unset +# as_fn_append VAR VALUE +# ---------------------- +# Append the text in VALUE to the end of the definition contained in VAR. Take +# advantage of any shell optimizations that allow amortized linear growth over +# repeated appends, instead of the typical quadratic growth present in naive +# implementations. +if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then : + eval 'as_fn_append () + { + eval $1+=\$2 + }' +else + as_fn_append () + { + eval $1=\$$1\$2 + } +fi # as_fn_append + +# as_fn_arith ARG... +# ------------------ +# Perform arithmetic evaluation on the ARGs, and store the result in the +# global $as_val. Take advantage of shells that can avoid forks. The arguments +# must be portable across $(()) and expr. +if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then : + eval 'as_fn_arith () + { + as_val=$(( $* )) + }' +else + as_fn_arith () + { + as_val=`expr "$@" || test $? -eq 1` + } +fi # as_fn_arith + + +if expr a : '\(a\)' >/dev/null 2>&1 && + test "X`expr 00001 : '.*\(...\)'`" = X001; then + as_expr=expr +else + as_expr=false +fi + +if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then + as_basename=basename +else + as_basename=false +fi + +if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then + as_dirname=dirname +else + as_dirname=false +fi + +as_me=`$as_basename -- "$0" || +$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ + X"$0" : 'X\(//\)$' \| \ + X"$0" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X/"$0" | + sed '/^.*\/\([^/][^/]*\)\/*$/{ + s//\1/ + q + } + /^X\/\(\/\/\)$/{ + s//\1/ + q + } + /^X\/\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + +# Avoid depending upon Character Ranges. +as_cr_letters='abcdefghijklmnopqrstuvwxyz' +as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' +as_cr_Letters=$as_cr_letters$as_cr_LETTERS +as_cr_digits='0123456789' +as_cr_alnum=$as_cr_Letters$as_cr_digits + +ECHO_C= ECHO_N= ECHO_T= +case `echo -n x` in #((((( +-n*) + case `echo 'xy\c'` in + *c*) ECHO_T=' ';; # ECHO_T is single tab character. + xy) ECHO_C='\c';; + *) echo `echo ksh88 bug on AIX 6.1` > /dev/null + ECHO_T=' ';; + esac;; +*) + ECHO_N='-n';; +esac + +rm -f conf$$ conf$$.exe conf$$.file +if test -d conf$$.dir; then + rm -f conf$$.dir/conf$$.file +else + rm -f conf$$.dir + mkdir conf$$.dir 2>/dev/null +fi +if (echo >conf$$.file) 2>/dev/null; then + if ln -s conf$$.file conf$$ 2>/dev/null; then + as_ln_s='ln -s' + # ... but there are two gotchas: + # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. + # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. + # In both cases, we have to default to `cp -p'. + ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || + as_ln_s='cp -p' + elif ln conf$$.file conf$$ 2>/dev/null; then + as_ln_s=ln + else + as_ln_s='cp -p' + fi +else + as_ln_s='cp -p' +fi +rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file +rmdir conf$$.dir 2>/dev/null + + +# as_fn_mkdir_p +# ------------- +# Create "$as_dir" as a directory, including parents if necessary. +as_fn_mkdir_p () +{ + + case $as_dir in #( + -*) as_dir=./$as_dir;; + esac + test -d "$as_dir" || eval $as_mkdir_p || { + as_dirs= + while :; do + case $as_dir in #( + *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( + *) as_qdir=$as_dir;; + esac + as_dirs="'$as_qdir' $as_dirs" + as_dir=`$as_dirname -- "$as_dir" || +$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$as_dir" : 'X\(//\)[^/]' \| \ + X"$as_dir" : 'X\(//\)$' \| \ + X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X"$as_dir" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + test -d "$as_dir" && break + done + test -z "$as_dirs" || eval "mkdir $as_dirs" + } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir" + + +} # as_fn_mkdir_p +if mkdir -p . 2>/dev/null; then + as_mkdir_p='mkdir -p "$as_dir"' +else + test -d ./-p && rmdir ./-p + as_mkdir_p=false +fi + +if test -x / >/dev/null 2>&1; then + as_test_x='test -x' +else + if ls -dL / >/dev/null 2>&1; then + as_ls_L_option=L + else + as_ls_L_option= + fi + as_test_x=' + eval sh -c '\'' + if test -d "$1"; then + test -d "$1/."; + else + case $1 in #( + -*)set "./$1";; + esac; + case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in #(( + ???[sx]*):;;*)false;;esac;fi + '\'' sh + ' +fi +as_executable_p=$as_test_x + +# Sed expression to map a string onto a valid CPP name. +as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" + +# Sed expression to map a string onto a valid variable name. +as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" + + +exec 6>&1 +## ----------------------------------- ## +## Main body of $CONFIG_STATUS script. ## +## ----------------------------------- ## +_ASEOF +test $as_write_fail = 0 && chmod +x $CONFIG_STATUS || ac_write_fail=1 + +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +# Save the log message, to keep $0 and so on meaningful, and to +# report actual input values of CONFIG_FILES etc. instead of their +# values after options handling. +ac_log=" +This file was extended by curl $as_me -, which was +generated by GNU Autoconf 2.67. Invocation command line was + + CONFIG_FILES = $CONFIG_FILES + CONFIG_HEADERS = $CONFIG_HEADERS + CONFIG_LINKS = $CONFIG_LINKS + CONFIG_COMMANDS = $CONFIG_COMMANDS + $ $0 $@ + +on `(hostname || uname -n) 2>/dev/null | sed 1q` +" + +_ACEOF + +case $ac_config_files in *" +"*) set x $ac_config_files; shift; ac_config_files=$*;; +esac + +case $ac_config_headers in *" +"*) set x $ac_config_headers; shift; ac_config_headers=$*;; +esac + + +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +# Files that config.status was made for. +config_files="$ac_config_files" +config_headers="$ac_config_headers" +config_commands="$ac_config_commands" + +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +ac_cs_usage="\ +\`$as_me' instantiates files and other configuration actions +from templates according to the current configuration. Unless the files +and actions are specified as TAGs, all are instantiated by default. + +Usage: $0 [OPTION]... [TAG]... + + -h, --help print this help, then exit + -V, --version print version number and configuration settings, then exit + --config print configuration, then exit + -q, --quiet, --silent + do not print progress messages + -d, --debug don't remove temporary files + --recheck update $as_me by reconfiguring in the same conditions + --file=FILE[:TEMPLATE] + instantiate the configuration file FILE + --header=FILE[:TEMPLATE] + instantiate the configuration header FILE + +Configuration files: +$config_files + +Configuration headers: +$config_headers + +Configuration commands: +$config_commands + +Report bugs to ." + +_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" +ac_cs_version="\\ +curl config.status - +configured by $0, generated by GNU Autoconf 2.67, + with options \\"\$ac_cs_config\\" + +Copyright (C) 2010 Free Software Foundation, Inc. +This config.status script is free software; the Free Software Foundation +gives unlimited permission to copy, distribute and modify it." + +ac_pwd='$ac_pwd' +srcdir='$srcdir' +INSTALL='$INSTALL' +AWK='$AWK' +test -n "\$AWK" || AWK=awk +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +# The default lists apply if the user does not specify any file. +ac_need_defaults=: +while test $# != 0 +do + case $1 in + --*=?*) + ac_option=`expr "X$1" : 'X\([^=]*\)='` + ac_optarg=`expr "X$1" : 'X[^=]*=\(.*\)'` + ac_shift=: + ;; + --*=) + ac_option=`expr "X$1" : 'X\([^=]*\)='` + ac_optarg= + ac_shift=: + ;; + *) + ac_option=$1 + ac_optarg=$2 + ac_shift=shift + ;; + esac + + case $ac_option in + # Handling of the options. + -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) + ac_cs_recheck=: ;; + --version | --versio | --versi | --vers | --ver | --ve | --v | -V ) + $as_echo "$ac_cs_version"; exit ;; + --config | --confi | --conf | --con | --co | --c ) + $as_echo "$ac_cs_config"; exit ;; + --debug | --debu | --deb | --de | --d | -d ) + debug=: ;; + --file | --fil | --fi | --f ) + $ac_shift + case $ac_optarg in + *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; + '') as_fn_error $? "missing file argument" ;; + esac + as_fn_append CONFIG_FILES " '$ac_optarg'" + ac_need_defaults=false;; + --header | --heade | --head | --hea ) + $ac_shift + case $ac_optarg in + *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; + esac + as_fn_append CONFIG_HEADERS " '$ac_optarg'" + ac_need_defaults=false;; + --he | --h) + # Conflict between --help and --header + as_fn_error $? "ambiguous option: \`$1' +Try \`$0 --help' for more information.";; + --help | --hel | -h ) + $as_echo "$ac_cs_usage"; exit ;; + -q | -quiet | --quiet | --quie | --qui | --qu | --q \ + | -silent | --silent | --silen | --sile | --sil | --si | --s) + ac_cs_silent=: ;; + + # This is an error. + -*) as_fn_error $? "unrecognized option: \`$1' +Try \`$0 --help' for more information." ;; + + *) as_fn_append ac_config_targets " $1" + ac_need_defaults=false ;; + + esac + shift +done + +ac_configure_extra_args= + +if $ac_cs_silent; then + exec 6>/dev/null + ac_configure_extra_args="$ac_configure_extra_args --silent" +fi + +_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +if \$ac_cs_recheck; then + set X '$SHELL' '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion + shift + \$as_echo "running CONFIG_SHELL=$SHELL \$*" >&6 + CONFIG_SHELL='$SHELL' + export CONFIG_SHELL + exec "\$@" +fi + +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +exec 5>>config.log +{ + echo + sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX +## Running $as_me. ## +_ASBOX + $as_echo "$ac_log" +} >&5 + +_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +# +# INIT-COMMANDS +# +AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir" + + +# The HP-UX ksh and POSIX shell print the target directory to stdout +# if CDPATH is set. +(unset CDPATH) >/dev/null 2>&1 && unset CDPATH + +sed_quote_subst='$sed_quote_subst' +double_quote_subst='$double_quote_subst' +delay_variable_subst='$delay_variable_subst' +AS='`$ECHO "X$AS" | $Xsed -e "$delay_single_quote_subst"`' +DLLTOOL='`$ECHO "X$DLLTOOL" | $Xsed -e "$delay_single_quote_subst"`' +OBJDUMP='`$ECHO "X$OBJDUMP" | $Xsed -e "$delay_single_quote_subst"`' +macro_version='`$ECHO "X$macro_version" | $Xsed -e "$delay_single_quote_subst"`' +macro_revision='`$ECHO "X$macro_revision" | $Xsed -e "$delay_single_quote_subst"`' +enable_shared='`$ECHO "X$enable_shared" | $Xsed -e "$delay_single_quote_subst"`' +enable_static='`$ECHO "X$enable_static" | $Xsed -e "$delay_single_quote_subst"`' +pic_mode='`$ECHO "X$pic_mode" | $Xsed -e "$delay_single_quote_subst"`' +enable_fast_install='`$ECHO "X$enable_fast_install" | $Xsed -e "$delay_single_quote_subst"`' +host_alias='`$ECHO "X$host_alias" | $Xsed -e "$delay_single_quote_subst"`' +host='`$ECHO "X$host" | $Xsed -e "$delay_single_quote_subst"`' +host_os='`$ECHO "X$host_os" | $Xsed -e "$delay_single_quote_subst"`' +build_alias='`$ECHO "X$build_alias" | $Xsed -e "$delay_single_quote_subst"`' +build='`$ECHO "X$build" | $Xsed -e "$delay_single_quote_subst"`' +build_os='`$ECHO "X$build_os" | $Xsed -e "$delay_single_quote_subst"`' +SED='`$ECHO "X$SED" | $Xsed -e "$delay_single_quote_subst"`' +Xsed='`$ECHO "X$Xsed" | $Xsed -e "$delay_single_quote_subst"`' +GREP='`$ECHO "X$GREP" | $Xsed -e "$delay_single_quote_subst"`' +EGREP='`$ECHO "X$EGREP" | $Xsed -e "$delay_single_quote_subst"`' +FGREP='`$ECHO "X$FGREP" | $Xsed -e "$delay_single_quote_subst"`' +LD='`$ECHO "X$LD" | $Xsed -e "$delay_single_quote_subst"`' +NM='`$ECHO "X$NM" | $Xsed -e "$delay_single_quote_subst"`' +LN_S='`$ECHO "X$LN_S" | $Xsed -e "$delay_single_quote_subst"`' +max_cmd_len='`$ECHO "X$max_cmd_len" | $Xsed -e "$delay_single_quote_subst"`' +ac_objext='`$ECHO "X$ac_objext" | $Xsed -e "$delay_single_quote_subst"`' +exeext='`$ECHO "X$exeext" | $Xsed -e "$delay_single_quote_subst"`' +lt_unset='`$ECHO "X$lt_unset" | $Xsed -e "$delay_single_quote_subst"`' +lt_SP2NL='`$ECHO "X$lt_SP2NL" | $Xsed -e "$delay_single_quote_subst"`' +lt_NL2SP='`$ECHO "X$lt_NL2SP" | $Xsed -e "$delay_single_quote_subst"`' +reload_flag='`$ECHO "X$reload_flag" | $Xsed -e "$delay_single_quote_subst"`' +reload_cmds='`$ECHO "X$reload_cmds" | $Xsed -e "$delay_single_quote_subst"`' +deplibs_check_method='`$ECHO "X$deplibs_check_method" | $Xsed -e "$delay_single_quote_subst"`' +file_magic_cmd='`$ECHO "X$file_magic_cmd" | $Xsed -e "$delay_single_quote_subst"`' +AR='`$ECHO "X$AR" | $Xsed -e "$delay_single_quote_subst"`' +AR_FLAGS='`$ECHO "X$AR_FLAGS" | $Xsed -e "$delay_single_quote_subst"`' +STRIP='`$ECHO "X$STRIP" | $Xsed -e "$delay_single_quote_subst"`' +RANLIB='`$ECHO "X$RANLIB" | $Xsed -e "$delay_single_quote_subst"`' +old_postinstall_cmds='`$ECHO "X$old_postinstall_cmds" | $Xsed -e "$delay_single_quote_subst"`' +old_postuninstall_cmds='`$ECHO "X$old_postuninstall_cmds" | $Xsed -e "$delay_single_quote_subst"`' +old_archive_cmds='`$ECHO "X$old_archive_cmds" | $Xsed -e "$delay_single_quote_subst"`' +CC='`$ECHO "X$CC" | $Xsed -e "$delay_single_quote_subst"`' +CFLAGS='`$ECHO "X$CFLAGS" | $Xsed -e "$delay_single_quote_subst"`' +compiler='`$ECHO "X$compiler" | $Xsed -e "$delay_single_quote_subst"`' +GCC='`$ECHO "X$GCC" | $Xsed -e "$delay_single_quote_subst"`' +lt_cv_sys_global_symbol_pipe='`$ECHO "X$lt_cv_sys_global_symbol_pipe" | $Xsed -e "$delay_single_quote_subst"`' +lt_cv_sys_global_symbol_to_cdecl='`$ECHO "X$lt_cv_sys_global_symbol_to_cdecl" | $Xsed -e "$delay_single_quote_subst"`' +lt_cv_sys_global_symbol_to_c_name_address='`$ECHO "X$lt_cv_sys_global_symbol_to_c_name_address" | $Xsed -e "$delay_single_quote_subst"`' +lt_cv_sys_global_symbol_to_c_name_address_lib_prefix='`$ECHO "X$lt_cv_sys_global_symbol_to_c_name_address_lib_prefix" | $Xsed -e "$delay_single_quote_subst"`' +objdir='`$ECHO "X$objdir" | $Xsed -e "$delay_single_quote_subst"`' +SHELL='`$ECHO "X$SHELL" | $Xsed -e "$delay_single_quote_subst"`' +ECHO='`$ECHO "X$ECHO" | $Xsed -e "$delay_single_quote_subst"`' +MAGIC_CMD='`$ECHO "X$MAGIC_CMD" | $Xsed -e "$delay_single_quote_subst"`' +lt_prog_compiler_no_builtin_flag='`$ECHO "X$lt_prog_compiler_no_builtin_flag" | $Xsed -e "$delay_single_quote_subst"`' +lt_prog_compiler_wl='`$ECHO "X$lt_prog_compiler_wl" | $Xsed -e "$delay_single_quote_subst"`' +lt_prog_compiler_pic='`$ECHO "X$lt_prog_compiler_pic" | $Xsed -e "$delay_single_quote_subst"`' +lt_prog_compiler_static='`$ECHO "X$lt_prog_compiler_static" | $Xsed -e "$delay_single_quote_subst"`' +lt_cv_prog_compiler_c_o='`$ECHO "X$lt_cv_prog_compiler_c_o" | $Xsed -e "$delay_single_quote_subst"`' +need_locks='`$ECHO "X$need_locks" | $Xsed -e "$delay_single_quote_subst"`' +DSYMUTIL='`$ECHO "X$DSYMUTIL" | $Xsed -e "$delay_single_quote_subst"`' +NMEDIT='`$ECHO "X$NMEDIT" | $Xsed -e "$delay_single_quote_subst"`' +LIPO='`$ECHO "X$LIPO" | $Xsed -e "$delay_single_quote_subst"`' +OTOOL='`$ECHO "X$OTOOL" | $Xsed -e "$delay_single_quote_subst"`' +OTOOL64='`$ECHO "X$OTOOL64" | $Xsed -e "$delay_single_quote_subst"`' +libext='`$ECHO "X$libext" | $Xsed -e "$delay_single_quote_subst"`' +shrext_cmds='`$ECHO "X$shrext_cmds" | $Xsed -e "$delay_single_quote_subst"`' +extract_expsyms_cmds='`$ECHO "X$extract_expsyms_cmds" | $Xsed -e "$delay_single_quote_subst"`' +archive_cmds_need_lc='`$ECHO "X$archive_cmds_need_lc" | $Xsed -e "$delay_single_quote_subst"`' +enable_shared_with_static_runtimes='`$ECHO "X$enable_shared_with_static_runtimes" | $Xsed -e "$delay_single_quote_subst"`' +export_dynamic_flag_spec='`$ECHO "X$export_dynamic_flag_spec" | $Xsed -e "$delay_single_quote_subst"`' +whole_archive_flag_spec='`$ECHO "X$whole_archive_flag_spec" | $Xsed -e "$delay_single_quote_subst"`' +compiler_needs_object='`$ECHO "X$compiler_needs_object" | $Xsed -e "$delay_single_quote_subst"`' +old_archive_from_new_cmds='`$ECHO "X$old_archive_from_new_cmds" | $Xsed -e "$delay_single_quote_subst"`' +old_archive_from_expsyms_cmds='`$ECHO "X$old_archive_from_expsyms_cmds" | $Xsed -e "$delay_single_quote_subst"`' +archive_cmds='`$ECHO "X$archive_cmds" | $Xsed -e "$delay_single_quote_subst"`' +archive_expsym_cmds='`$ECHO "X$archive_expsym_cmds" | $Xsed -e "$delay_single_quote_subst"`' +module_cmds='`$ECHO "X$module_cmds" | $Xsed -e "$delay_single_quote_subst"`' +module_expsym_cmds='`$ECHO "X$module_expsym_cmds" | $Xsed -e "$delay_single_quote_subst"`' +with_gnu_ld='`$ECHO "X$with_gnu_ld" | $Xsed -e "$delay_single_quote_subst"`' +allow_undefined_flag='`$ECHO "X$allow_undefined_flag" | $Xsed -e "$delay_single_quote_subst"`' +no_undefined_flag='`$ECHO "X$no_undefined_flag" | $Xsed -e "$delay_single_quote_subst"`' +hardcode_libdir_flag_spec='`$ECHO "X$hardcode_libdir_flag_spec" | $Xsed -e "$delay_single_quote_subst"`' +hardcode_libdir_flag_spec_ld='`$ECHO "X$hardcode_libdir_flag_spec_ld" | $Xsed -e "$delay_single_quote_subst"`' +hardcode_libdir_separator='`$ECHO "X$hardcode_libdir_separator" | $Xsed -e "$delay_single_quote_subst"`' +hardcode_direct='`$ECHO "X$hardcode_direct" | $Xsed -e "$delay_single_quote_subst"`' +hardcode_direct_absolute='`$ECHO "X$hardcode_direct_absolute" | $Xsed -e "$delay_single_quote_subst"`' +hardcode_minus_L='`$ECHO "X$hardcode_minus_L" | $Xsed -e "$delay_single_quote_subst"`' +hardcode_shlibpath_var='`$ECHO "X$hardcode_shlibpath_var" | $Xsed -e "$delay_single_quote_subst"`' +hardcode_automatic='`$ECHO "X$hardcode_automatic" | $Xsed -e "$delay_single_quote_subst"`' +inherit_rpath='`$ECHO "X$inherit_rpath" | $Xsed -e "$delay_single_quote_subst"`' +link_all_deplibs='`$ECHO "X$link_all_deplibs" | $Xsed -e "$delay_single_quote_subst"`' +fix_srcfile_path='`$ECHO "X$fix_srcfile_path" | $Xsed -e "$delay_single_quote_subst"`' +always_export_symbols='`$ECHO "X$always_export_symbols" | $Xsed -e "$delay_single_quote_subst"`' +export_symbols_cmds='`$ECHO "X$export_symbols_cmds" | $Xsed -e "$delay_single_quote_subst"`' +exclude_expsyms='`$ECHO "X$exclude_expsyms" | $Xsed -e "$delay_single_quote_subst"`' +include_expsyms='`$ECHO "X$include_expsyms" | $Xsed -e "$delay_single_quote_subst"`' +prelink_cmds='`$ECHO "X$prelink_cmds" | $Xsed -e "$delay_single_quote_subst"`' +file_list_spec='`$ECHO "X$file_list_spec" | $Xsed -e "$delay_single_quote_subst"`' +variables_saved_for_relink='`$ECHO "X$variables_saved_for_relink" | $Xsed -e "$delay_single_quote_subst"`' +need_lib_prefix='`$ECHO "X$need_lib_prefix" | $Xsed -e "$delay_single_quote_subst"`' +need_version='`$ECHO "X$need_version" | $Xsed -e "$delay_single_quote_subst"`' +version_type='`$ECHO "X$version_type" | $Xsed -e "$delay_single_quote_subst"`' +runpath_var='`$ECHO "X$runpath_var" | $Xsed -e "$delay_single_quote_subst"`' +shlibpath_var='`$ECHO "X$shlibpath_var" | $Xsed -e "$delay_single_quote_subst"`' +shlibpath_overrides_runpath='`$ECHO "X$shlibpath_overrides_runpath" | $Xsed -e "$delay_single_quote_subst"`' +libname_spec='`$ECHO "X$libname_spec" | $Xsed -e "$delay_single_quote_subst"`' +library_names_spec='`$ECHO "X$library_names_spec" | $Xsed -e "$delay_single_quote_subst"`' +soname_spec='`$ECHO "X$soname_spec" | $Xsed -e "$delay_single_quote_subst"`' +postinstall_cmds='`$ECHO "X$postinstall_cmds" | $Xsed -e "$delay_single_quote_subst"`' +postuninstall_cmds='`$ECHO "X$postuninstall_cmds" | $Xsed -e "$delay_single_quote_subst"`' +finish_cmds='`$ECHO "X$finish_cmds" | $Xsed -e "$delay_single_quote_subst"`' +finish_eval='`$ECHO "X$finish_eval" | $Xsed -e "$delay_single_quote_subst"`' +hardcode_into_libs='`$ECHO "X$hardcode_into_libs" | $Xsed -e "$delay_single_quote_subst"`' +sys_lib_search_path_spec='`$ECHO "X$sys_lib_search_path_spec" | $Xsed -e "$delay_single_quote_subst"`' +sys_lib_dlsearch_path_spec='`$ECHO "X$sys_lib_dlsearch_path_spec" | $Xsed -e "$delay_single_quote_subst"`' +hardcode_action='`$ECHO "X$hardcode_action" | $Xsed -e "$delay_single_quote_subst"`' +enable_dlopen='`$ECHO "X$enable_dlopen" | $Xsed -e "$delay_single_quote_subst"`' +enable_dlopen_self='`$ECHO "X$enable_dlopen_self" | $Xsed -e "$delay_single_quote_subst"`' +enable_dlopen_self_static='`$ECHO "X$enable_dlopen_self_static" | $Xsed -e "$delay_single_quote_subst"`' +old_striplib='`$ECHO "X$old_striplib" | $Xsed -e "$delay_single_quote_subst"`' +striplib='`$ECHO "X$striplib" | $Xsed -e "$delay_single_quote_subst"`' + +LTCC='$LTCC' +LTCFLAGS='$LTCFLAGS' +compiler='$compiler_DEFAULT' + +# Quote evaled strings. +for var in SED \ +GREP \ +EGREP \ +FGREP \ +LD \ +NM \ +LN_S \ +lt_SP2NL \ +lt_NL2SP \ +reload_flag \ +deplibs_check_method \ +file_magic_cmd \ +AR \ +AR_FLAGS \ +STRIP \ +RANLIB \ +CC \ +CFLAGS \ +compiler \ +lt_cv_sys_global_symbol_pipe \ +lt_cv_sys_global_symbol_to_cdecl \ +lt_cv_sys_global_symbol_to_c_name_address \ +lt_cv_sys_global_symbol_to_c_name_address_lib_prefix \ +SHELL \ +ECHO \ +lt_prog_compiler_no_builtin_flag \ +lt_prog_compiler_wl \ +lt_prog_compiler_pic \ +lt_prog_compiler_static \ +lt_cv_prog_compiler_c_o \ +need_locks \ +DSYMUTIL \ +NMEDIT \ +LIPO \ +OTOOL \ +OTOOL64 \ +shrext_cmds \ +export_dynamic_flag_spec \ +whole_archive_flag_spec \ +compiler_needs_object \ +with_gnu_ld \ +allow_undefined_flag \ +no_undefined_flag \ +hardcode_libdir_flag_spec \ +hardcode_libdir_flag_spec_ld \ +hardcode_libdir_separator \ +fix_srcfile_path \ +exclude_expsyms \ +include_expsyms \ +file_list_spec \ +variables_saved_for_relink \ +libname_spec \ +library_names_spec \ +soname_spec \ +finish_eval \ +old_striplib \ +striplib; do + case \`eval \\\\\$ECHO "X\\\\\$\$var"\` in + *[\\\\\\\`\\"\\\$]*) + eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"X\\\$\$var\\" | \\\$Xsed -e \\"\\\$sed_quote_subst\\"\\\`\\\\\\"" + ;; + *) + eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\"" + ;; + esac +done + +# Double-quote double-evaled strings. +for var in reload_cmds \ +old_postinstall_cmds \ +old_postuninstall_cmds \ +old_archive_cmds \ +extract_expsyms_cmds \ +old_archive_from_new_cmds \ +old_archive_from_expsyms_cmds \ +archive_cmds \ +archive_expsym_cmds \ +module_cmds \ +module_expsym_cmds \ +export_symbols_cmds \ +prelink_cmds \ +postinstall_cmds \ +postuninstall_cmds \ +finish_cmds \ +sys_lib_search_path_spec \ +sys_lib_dlsearch_path_spec; do + case \`eval \\\\\$ECHO "X\\\\\$\$var"\` in + *[\\\\\\\`\\"\\\$]*) + eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"X\\\$\$var\\" | \\\$Xsed -e \\"\\\$double_quote_subst\\" -e \\"\\\$sed_quote_subst\\" -e \\"\\\$delay_variable_subst\\"\\\`\\\\\\"" + ;; + *) + eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\"" + ;; + esac +done + +# Fix-up fallback echo if it was mangled by the above quoting rules. +case \$lt_ECHO in +*'\\\$0 --fallback-echo"') lt_ECHO=\`\$ECHO "X\$lt_ECHO" | \$Xsed -e 's/\\\\\\\\\\\\\\\$0 --fallback-echo"\$/\$0 --fallback-echo"/'\` + ;; +esac + +ac_aux_dir='$ac_aux_dir' +xsi_shell='$xsi_shell' +lt_shell_append='$lt_shell_append' + +# See if we are running on zsh, and set the options which allow our +# commands through without removal of \ escapes INIT. +if test -n "\${ZSH_VERSION+set}" ; then + setopt NO_GLOB_SUBST +fi + + + PACKAGE='$PACKAGE' + VERSION='$VERSION' + TIMESTAMP='$TIMESTAMP' + RM='$RM' + ofile='$ofile' + + + + +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 + +# Handling of arguments. +for ac_config_target in $ac_config_targets +do + case $ac_config_target in + "lib/curl_config.h") CONFIG_HEADERS="$CONFIG_HEADERS lib/curl_config.h" ;; + "src/curl_config.h") CONFIG_HEADERS="$CONFIG_HEADERS src/curl_config.h" ;; + "include/curl/curlbuild.h") CONFIG_HEADERS="$CONFIG_HEADERS include/curl/curlbuild.h" ;; + "depfiles") CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;; + "libtool") CONFIG_COMMANDS="$CONFIG_COMMANDS libtool" ;; + "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;; + "docs/Makefile") CONFIG_FILES="$CONFIG_FILES docs/Makefile" ;; + "docs/examples/Makefile") CONFIG_FILES="$CONFIG_FILES docs/examples/Makefile" ;; + "docs/libcurl/Makefile") CONFIG_FILES="$CONFIG_FILES docs/libcurl/Makefile" ;; + "include/Makefile") CONFIG_FILES="$CONFIG_FILES include/Makefile" ;; + "include/curl/Makefile") CONFIG_FILES="$CONFIG_FILES include/curl/Makefile" ;; + "src/Makefile") CONFIG_FILES="$CONFIG_FILES src/Makefile" ;; + "lib/Makefile") CONFIG_FILES="$CONFIG_FILES lib/Makefile" ;; + "tests/Makefile") CONFIG_FILES="$CONFIG_FILES tests/Makefile" ;; + "tests/data/Makefile") CONFIG_FILES="$CONFIG_FILES tests/data/Makefile" ;; + "tests/server/Makefile") CONFIG_FILES="$CONFIG_FILES tests/server/Makefile" ;; + "tests/libtest/Makefile") CONFIG_FILES="$CONFIG_FILES tests/libtest/Makefile" ;; + "packages/Makefile") CONFIG_FILES="$CONFIG_FILES packages/Makefile" ;; + "packages/Win32/Makefile") CONFIG_FILES="$CONFIG_FILES packages/Win32/Makefile" ;; + "packages/Win32/cygwin/Makefile") CONFIG_FILES="$CONFIG_FILES packages/Win32/cygwin/Makefile" ;; + "packages/Linux/Makefile") CONFIG_FILES="$CONFIG_FILES packages/Linux/Makefile" ;; + "packages/Linux/RPM/Makefile") CONFIG_FILES="$CONFIG_FILES packages/Linux/RPM/Makefile" ;; + "packages/Linux/RPM/curl.spec") CONFIG_FILES="$CONFIG_FILES packages/Linux/RPM/curl.spec" ;; + "packages/Linux/RPM/curl-ssl.spec") CONFIG_FILES="$CONFIG_FILES packages/Linux/RPM/curl-ssl.spec" ;; + "packages/Solaris/Makefile") CONFIG_FILES="$CONFIG_FILES packages/Solaris/Makefile" ;; + "packages/EPM/curl.list") CONFIG_FILES="$CONFIG_FILES packages/EPM/curl.list" ;; + "packages/EPM/Makefile") CONFIG_FILES="$CONFIG_FILES packages/EPM/Makefile" ;; + "packages/vms/Makefile") CONFIG_FILES="$CONFIG_FILES packages/vms/Makefile" ;; + "packages/AIX/Makefile") CONFIG_FILES="$CONFIG_FILES packages/AIX/Makefile" ;; + "packages/AIX/RPM/Makefile") CONFIG_FILES="$CONFIG_FILES packages/AIX/RPM/Makefile" ;; + "packages/AIX/RPM/curl.spec") CONFIG_FILES="$CONFIG_FILES packages/AIX/RPM/curl.spec" ;; + "curl-config") CONFIG_FILES="$CONFIG_FILES curl-config" ;; + "libcurl.pc") CONFIG_FILES="$CONFIG_FILES libcurl.pc" ;; + + *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5 ;; + esac +done + + +# If the user did not use the arguments to specify the items to instantiate, +# then the envvar interface is used. Set only those that are not. +# We use the long form for the default assignment because of an extremely +# bizarre bug on SunOS 4.1.3. +if $ac_need_defaults; then + test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files + test "${CONFIG_HEADERS+set}" = set || CONFIG_HEADERS=$config_headers + test "${CONFIG_COMMANDS+set}" = set || CONFIG_COMMANDS=$config_commands +fi + +# Have a temporary directory for convenience. Make it in the build tree +# simply because there is no reason against having it here, and in addition, +# creating and moving files from /tmp can sometimes cause problems. +# Hook for its removal unless debugging. +# Note that there is a small window in which the directory will not be cleaned: +# after its creation but before its name has been assigned to `$tmp'. +$debug || +{ + tmp= + trap 'exit_status=$? + { test -z "$tmp" || test ! -d "$tmp" || rm -fr "$tmp"; } && exit $exit_status +' 0 + trap 'as_fn_exit 1' 1 2 13 15 +} +# Create a (secure) tmp directory for tmp files. + +{ + tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` && + test -n "$tmp" && test -d "$tmp" +} || +{ + tmp=./conf$$-$RANDOM + (umask 077 && mkdir "$tmp") +} || as_fn_error $? "cannot create a temporary directory in ." "$LINENO" 5 + +# Set up the scripts for CONFIG_FILES section. +# No need to generate them if there are no CONFIG_FILES. +# This happens for instance with `./config.status config.h'. +if test -n "$CONFIG_FILES"; then + + +ac_cr=`echo X | tr X '\015'` +# On cygwin, bash can eat \r inside `` if the user requested igncr. +# But we know of no other shell where ac_cr would be empty at this +# point, so we can use a bashism as a fallback. +if test "x$ac_cr" = x; then + eval ac_cr=\$\'\\r\' +fi +ac_cs_awk_cr=`$AWK 'BEGIN { print "a\rb" }' /dev/null` +if test "$ac_cs_awk_cr" = "a${ac_cr}b"; then + ac_cs_awk_cr='\\r' +else + ac_cs_awk_cr=$ac_cr +fi + +echo 'BEGIN {' >"$tmp/subs1.awk" && +_ACEOF + + +{ + echo "cat >conf$$subs.awk <<_ACEOF" && + echo "$ac_subst_vars" | sed 's/.*/&!$&$ac_delim/' && + echo "_ACEOF" +} >conf$$subs.sh || + as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 +ac_delim_num=`echo "$ac_subst_vars" | grep -c '^'` +ac_delim='%!_!# ' +for ac_last_try in false false false false false :; do + . ./conf$$subs.sh || + as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 + + ac_delim_n=`sed -n "s/.*$ac_delim\$/X/p" conf$$subs.awk | grep -c X` + if test $ac_delim_n = $ac_delim_num; then + break + elif $ac_last_try; then + as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 + else + ac_delim="$ac_delim!$ac_delim _$ac_delim!! " + fi +done +rm -f conf$$subs.sh + +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +cat >>"\$tmp/subs1.awk" <<\\_ACAWK && +_ACEOF +sed -n ' +h +s/^/S["/; s/!.*/"]=/ +p +g +s/^[^!]*!// +:repl +t repl +s/'"$ac_delim"'$// +t delim +:nl +h +s/\(.\{148\}\)..*/\1/ +t more1 +s/["\\]/\\&/g; s/^/"/; s/$/\\n"\\/ +p +n +b repl +:more1 +s/["\\]/\\&/g; s/^/"/; s/$/"\\/ +p +g +s/.\{148\}// +t nl +:delim +h +s/\(.\{148\}\)..*/\1/ +t more2 +s/["\\]/\\&/g; s/^/"/; s/$/"/ +p +b +:more2 +s/["\\]/\\&/g; s/^/"/; s/$/"\\/ +p +g +s/.\{148\}// +t delim +' >$CONFIG_STATUS || ac_write_fail=1 +rm -f conf$$subs.awk +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +_ACAWK +cat >>"\$tmp/subs1.awk" <<_ACAWK && + for (key in S) S_is_set[key] = 1 + FS = "" + +} +{ + line = $ 0 + nfields = split(line, field, "@") + substed = 0 + len = length(field[1]) + for (i = 2; i < nfields; i++) { + key = field[i] + keylen = length(key) + if (S_is_set[key]) { + value = S[key] + line = substr(line, 1, len) "" value "" substr(line, len + keylen + 3) + len += length(value) + length(field[++i]) + substed = 1 + } else + len += 1 + keylen + } + + print line +} + +_ACAWK +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +if sed "s/$ac_cr//" < /dev/null > /dev/null 2>&1; then + sed "s/$ac_cr\$//; s/$ac_cr/$ac_cs_awk_cr/g" +else + cat +fi < "$tmp/subs1.awk" > "$tmp/subs.awk" \ + || as_fn_error $? "could not setup config files machinery" "$LINENO" 5 +_ACEOF + +# VPATH may cause trouble with some makes, so we remove sole $(srcdir), +# ${srcdir} and @srcdir@ entries from VPATH if srcdir is ".", strip leading and +# trailing colons and then remove the whole line if VPATH becomes empty +# (actually we leave an empty line to preserve line numbers). +if test "x$srcdir" = x.; then + ac_vpsub='/^[ ]*VPATH[ ]*=[ ]*/{ +h +s/// +s/^/:/ +s/[ ]*$/:/ +s/:\$(srcdir):/:/g +s/:\${srcdir}:/:/g +s/:@srcdir@:/:/g +s/^:*// +s/:*$// +x +s/\(=[ ]*\).*/\1/ +G +s/\n// +s/^[^=]*=[ ]*$// +}' +fi + +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +fi # test -n "$CONFIG_FILES" + +# Set up the scripts for CONFIG_HEADERS section. +# No need to generate them if there are no CONFIG_HEADERS. +# This happens for instance with `./config.status Makefile'. +if test -n "$CONFIG_HEADERS"; then +cat >"$tmp/defines.awk" <<\_ACAWK || +BEGIN { +_ACEOF + +# Transform confdefs.h into an awk script `defines.awk', embedded as +# here-document in config.status, that substitutes the proper values into +# config.h.in to produce config.h. + +# Create a delimiter string that does not exist in confdefs.h, to ease +# handling of long lines. +ac_delim='%!_!# ' +for ac_last_try in false false :; do + ac_t=`sed -n "/$ac_delim/p" confdefs.h` + if test -z "$ac_t"; then + break + elif $ac_last_try; then + as_fn_error $? "could not make $CONFIG_HEADERS" "$LINENO" 5 + else + ac_delim="$ac_delim!$ac_delim _$ac_delim!! " + fi +done + +# For the awk script, D is an array of macro values keyed by name, +# likewise P contains macro parameters if any. Preserve backslash +# newline sequences. + +ac_word_re=[_$as_cr_Letters][_$as_cr_alnum]* +sed -n ' +s/.\{148\}/&'"$ac_delim"'/g +t rset +:rset +s/^[ ]*#[ ]*define[ ][ ]*/ / +t def +d +:def +s/\\$// +t bsnl +s/["\\]/\\&/g +s/^ \('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/P["\1"]="\2"\ +D["\1"]=" \3"/p +s/^ \('"$ac_word_re"'\)[ ]*\(.*\)/D["\1"]=" \2"/p +d +:bsnl +s/["\\]/\\&/g +s/^ \('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/P["\1"]="\2"\ +D["\1"]=" \3\\\\\\n"\\/p +t cont +s/^ \('"$ac_word_re"'\)[ ]*\(.*\)/D["\1"]=" \2\\\\\\n"\\/p +t cont +d +:cont +n +s/.\{148\}/&'"$ac_delim"'/g +t clear +:clear +s/\\$// +t bsnlc +s/["\\]/\\&/g; s/^/"/; s/$/"/p +d +:bsnlc +s/["\\]/\\&/g; s/^/"/; s/$/\\\\\\n"\\/p +b cont +' >$CONFIG_STATUS || ac_write_fail=1 + +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 + for (key in D) D_is_set[key] = 1 + FS = "" +} +/^[\t ]*#[\t ]*(define|undef)[\t ]+$ac_word_re([\t (]|\$)/ { + line = \$ 0 + split(line, arg, " ") + if (arg[1] == "#") { + defundef = arg[2] + mac1 = arg[3] + } else { + defundef = substr(arg[1], 2) + mac1 = arg[2] + } + split(mac1, mac2, "(") #) + macro = mac2[1] + prefix = substr(line, 1, index(line, defundef) - 1) + if (D_is_set[macro]) { + # Preserve the white space surrounding the "#". + print prefix "define", macro P[macro] D[macro] + next + } else { + # Replace #undef with comments. This is necessary, for example, + # in the case of _POSIX_SOURCE, which is predefined and required + # on some systems where configure will not decide to define it. + if (defundef == "undef") { + print "/*", prefix defundef, macro, "*/" + next + } + } +} +{ print } +_ACAWK +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 + as_fn_error $? "could not setup config headers machinery" "$LINENO" 5 +fi # test -n "$CONFIG_HEADERS" + + +eval set X " :F $CONFIG_FILES :H $CONFIG_HEADERS :C $CONFIG_COMMANDS" +shift +for ac_tag +do + case $ac_tag in + :[FHLC]) ac_mode=$ac_tag; continue;; + esac + case $ac_mode$ac_tag in + :[FHL]*:*);; + :L* | :C*:*) as_fn_error $? "invalid tag \`$ac_tag'" "$LINENO" 5 ;; + :[FH]-) ac_tag=-:-;; + :[FH]*) ac_tag=$ac_tag:$ac_tag.in;; + esac + ac_save_IFS=$IFS + IFS=: + set x $ac_tag + IFS=$ac_save_IFS + shift + ac_file=$1 + shift + + case $ac_mode in + :L) ac_source=$1;; + :[FH]) + ac_file_inputs= + for ac_f + do + case $ac_f in + -) ac_f="$tmp/stdin";; + *) # Look for the file first in the build tree, then in the source tree + # (if the path is not absolute). The absolute path cannot be DOS-style, + # because $ac_f cannot contain `:'. + test -f "$ac_f" || + case $ac_f in + [\\/$]*) false;; + *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";; + esac || + as_fn_error 1 "cannot find input file: \`$ac_f'" "$LINENO" 5 ;; + esac + case $ac_f in *\'*) ac_f=`$as_echo "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac + as_fn_append ac_file_inputs " '$ac_f'" + done + + # Let's still pretend it is `configure' which instantiates (i.e., don't + # use $as_me), people would be surprised to read: + # /* config.h. Generated by config.status. */ + configure_input='Generated from '` + $as_echo "$*" | sed 's|^[^:]*/||;s|:[^:]*/|, |g' + `' by configure.' + if test x"$ac_file" != x-; then + configure_input="$ac_file. $configure_input" + { $as_echo "$as_me:${as_lineno-$LINENO}: creating $ac_file" >&5 +$as_echo "$as_me: creating $ac_file" >&6;} + fi + # Neutralize special characters interpreted by sed in replacement strings. + case $configure_input in #( + *\&* | *\|* | *\\* ) + ac_sed_conf_input=`$as_echo "$configure_input" | + sed 's/[\\\\&|]/\\\\&/g'`;; #( + *) ac_sed_conf_input=$configure_input;; + esac + + case $ac_tag in + *:-:* | *:-) cat >"$tmp/stdin" \ + || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;; + esac + ;; + esac + + ac_dir=`$as_dirname -- "$ac_file" || +$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$ac_file" : 'X\(//\)[^/]' \| \ + X"$ac_file" : 'X\(//\)$' \| \ + X"$ac_file" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X"$ac_file" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + as_dir="$ac_dir"; as_fn_mkdir_p + ac_builddir=. + +case "$ac_dir" in +.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; +*) + ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` + # A ".." for each directory in $ac_dir_suffix. + ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` + case $ac_top_builddir_sub in + "") ac_top_builddir_sub=. ac_top_build_prefix= ;; + *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; + esac ;; +esac +ac_abs_top_builddir=$ac_pwd +ac_abs_builddir=$ac_pwd$ac_dir_suffix +# for backward compatibility: +ac_top_builddir=$ac_top_build_prefix + +case $srcdir in + .) # We are building in place. + ac_srcdir=. + ac_top_srcdir=$ac_top_builddir_sub + ac_abs_top_srcdir=$ac_pwd ;; + [\\/]* | ?:[\\/]* ) # Absolute name. + ac_srcdir=$srcdir$ac_dir_suffix; + ac_top_srcdir=$srcdir + ac_abs_top_srcdir=$srcdir ;; + *) # Relative name. + ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix + ac_top_srcdir=$ac_top_build_prefix$srcdir + ac_abs_top_srcdir=$ac_pwd/$srcdir ;; +esac +ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix + + + case $ac_mode in + :F) + # + # CONFIG_FILE + # + + case $INSTALL in + [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;; + *) ac_INSTALL=$ac_top_build_prefix$INSTALL ;; + esac +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +# If the template does not know about datarootdir, expand it. +# FIXME: This hack should be removed a few years after 2.60. +ac_datarootdir_hack=; ac_datarootdir_seen= +ac_sed_dataroot=' +/datarootdir/ { + p + q +} +/@datadir@/p +/@docdir@/p +/@infodir@/p +/@localedir@/p +/@mandir@/p' +case `eval "sed -n \"\$ac_sed_dataroot\" $ac_file_inputs"` in +*datarootdir*) ac_datarootdir_seen=yes;; +*@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*) + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5 +$as_echo "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;} +_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 + ac_datarootdir_hack=' + s&@datadir@&$datadir&g + s&@docdir@&$docdir&g + s&@infodir@&$infodir&g + s&@localedir@&$localedir&g + s&@mandir@&$mandir&g + s&\\\${datarootdir}&$datarootdir&g' ;; +esac +_ACEOF + +# Neutralize VPATH when `$srcdir' = `.'. +# Shell code in configure.ac might set extrasub. +# FIXME: do we really want to maintain this feature? +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +ac_sed_extra="$ac_vpsub +$extrasub +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +:t +/@[a-zA-Z_][a-zA-Z_0-9]*@/!b +s|@configure_input@|$ac_sed_conf_input|;t t +s&@top_builddir@&$ac_top_builddir_sub&;t t +s&@top_build_prefix@&$ac_top_build_prefix&;t t +s&@srcdir@&$ac_srcdir&;t t +s&@abs_srcdir@&$ac_abs_srcdir&;t t +s&@top_srcdir@&$ac_top_srcdir&;t t +s&@abs_top_srcdir@&$ac_abs_top_srcdir&;t t +s&@builddir@&$ac_builddir&;t t +s&@abs_builddir@&$ac_abs_builddir&;t t +s&@abs_top_builddir@&$ac_abs_top_builddir&;t t +s&@INSTALL@&$ac_INSTALL&;t t +$ac_datarootdir_hack +" +eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | $AWK -f "$tmp/subs.awk" >$tmp/out \ + || as_fn_error $? "could not create $ac_file" "$LINENO" 5 + +test -z "$ac_datarootdir_hack$ac_datarootdir_seen" && + { ac_out=`sed -n '/\${datarootdir}/p' "$tmp/out"`; test -n "$ac_out"; } && + { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' "$tmp/out"`; test -z "$ac_out"; } && + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file contains a reference to the variable \`datarootdir' +which seems to be undefined. Please make sure it is defined" >&5 +$as_echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir' +which seems to be undefined. Please make sure it is defined" >&2;} + + rm -f "$tmp/stdin" + case $ac_file in + -) cat "$tmp/out" && rm -f "$tmp/out";; + *) rm -f "$ac_file" && mv "$tmp/out" "$ac_file";; + esac \ + || as_fn_error $? "could not create $ac_file" "$LINENO" 5 + ;; + :H) + # + # CONFIG_HEADER + # + if test x"$ac_file" != x-; then + { + $as_echo "/* $configure_input */" \ + && eval '$AWK -f "$tmp/defines.awk"' "$ac_file_inputs" + } >"$tmp/config.h" \ + || as_fn_error $? "could not create $ac_file" "$LINENO" 5 + if diff "$ac_file" "$tmp/config.h" >/dev/null 2>&1; then + { $as_echo "$as_me:${as_lineno-$LINENO}: $ac_file is unchanged" >&5 +$as_echo "$as_me: $ac_file is unchanged" >&6;} + else + rm -f "$ac_file" + mv "$tmp/config.h" "$ac_file" \ + || as_fn_error $? "could not create $ac_file" "$LINENO" 5 + fi + else + $as_echo "/* $configure_input */" \ + && eval '$AWK -f "$tmp/defines.awk"' "$ac_file_inputs" \ + || as_fn_error $? "could not create -" "$LINENO" 5 + fi +# Compute "$ac_file"'s index in $config_headers. +_am_stamp_count=1 +for _am_header in $config_headers :; do + case $_am_header in + "$ac_file" | "$ac_file":* ) + break ;; + * ) + _am_stamp_count=`expr $_am_stamp_count + 1` ;; + esac +done +echo "timestamp for "$ac_file"" >`$as_dirname -- "$ac_file" || +$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$ac_file" : 'X\(//\)[^/]' \| \ + X"$ac_file" : 'X\(//\)$' \| \ + X"$ac_file" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X"$ac_file" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'`/stamp-h$_am_stamp_count + ;; + + :C) { $as_echo "$as_me:${as_lineno-$LINENO}: executing $ac_file commands" >&5 +$as_echo "$as_me: executing $ac_file commands" >&6;} + ;; + esac + + + case $ac_file$ac_mode in + "depfiles":C) test x"$AMDEP_TRUE" != x"" || for mf in $CONFIG_FILES; do + # Strip MF so we end up with the name of the file. + mf=`echo "$mf" | sed -e 's/:.*$//'` + # Check whether this is an Automake generated Makefile or not. + # We used to match only the files named `Makefile.in', but + # some people rename them; so instead we look at the file content. + # Grep'ing the first line is not enough: some people post-process + # each Makefile.in and add a new line on top of each file to say so. + # So let's grep whole file. + if grep '^#.*generated by automake' $mf > /dev/null 2>&1; then + dirpart=`$as_dirname -- "$mf" || +$as_expr X"$mf" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$mf" : 'X\(//\)[^/]' \| \ + X"$mf" : 'X\(//\)$' \| \ + X"$mf" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X"$mf" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + else + continue + fi + # Extract the definition of DEPDIR, am__include, and am__quote + # from the Makefile without running `make'. + DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"` + test -z "$DEPDIR" && continue + am__include=`sed -n 's/^am__include = //p' < "$mf"` + test -z "am__include" && continue + am__quote=`sed -n 's/^am__quote = //p' < "$mf"` + # When using ansi2knr, U may be empty or an underscore; expand it + U=`sed -n 's/^U = //p' < "$mf"` + # Find all dependency output files, they are included files with + # $(DEPDIR) in their names. We invoke sed twice because it is the + # simplest approach to changing $(DEPDIR) to its actual value in the + # expansion. + for file in `sed -n " + s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \ + sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do + # Make sure the directory exists. + test -f "$dirpart/$file" && continue + fdir=`$as_dirname -- "$file" || +$as_expr X"$file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$file" : 'X\(//\)[^/]' \| \ + X"$file" : 'X\(//\)$' \| \ + X"$file" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X"$file" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + as_dir=$dirpart/$fdir; as_fn_mkdir_p + # echo "creating $dirpart/$file" + echo '# dummy' > "$dirpart/$file" + done +done + ;; + "libtool":C) + + # See if we are running on zsh, and set the options which allow our + # commands through without removal of \ escapes. + if test -n "${ZSH_VERSION+set}" ; then + setopt NO_GLOB_SUBST + fi + + cfgfile="${ofile}T" + trap "$RM \"$cfgfile\"; exit 1" 1 2 15 + $RM "$cfgfile" + + cat <<_LT_EOF >> "$cfgfile" +#! $SHELL + +# `$ECHO "$ofile" | sed 's%^.*/%%'` - Provide generalized library-building support services. +# Generated automatically by $as_me ($PACKAGE$TIMESTAMP) $VERSION +# Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`: +# NOTE: Changes made to this file will be lost: look at ltmain.sh. +# +# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, +# 2006, 2007, 2008 Free Software Foundation, Inc. +# Written by Gordon Matzigkeit, 1996 +# +# This file is part of GNU Libtool. +# +# GNU Libtool is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation; either version 2 of +# the License, or (at your option) any later version. +# +# As a special exception to the GNU General Public License, +# if you distribute this file as part of a program or library that +# is built using GNU Libtool, you may include this file under the +# same distribution terms that you use for the rest of that program. +# +# GNU Libtool is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with GNU Libtool; see the file COPYING. If not, a copy +# can be downloaded from http://www.gnu.org/licenses/gpl.html, or +# obtained by writing to the Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + + +# The names of the tagged configurations supported by this script. +available_tags="" + +# ### BEGIN LIBTOOL CONFIG + +# Assembler program. +AS=$AS + +# DLL creation program. +DLLTOOL=$DLLTOOL + +# Object dumper program. +OBJDUMP=$OBJDUMP + +# Which release of libtool.m4 was used? +macro_version=$macro_version +macro_revision=$macro_revision + +# Whether or not to build shared libraries. +build_libtool_libs=$enable_shared + +# Whether or not to build static libraries. +build_old_libs=$enable_static + +# What type of objects to build. +pic_mode=$pic_mode + +# Whether or not to optimize for fast installation. +fast_install=$enable_fast_install + +# The host system. +host_alias=$host_alias +host=$host +host_os=$host_os + +# The build system. +build_alias=$build_alias +build=$build +build_os=$build_os + +# A sed program that does not truncate output. +SED=$lt_SED + +# Sed that helps us avoid accidentally triggering echo(1) options like -n. +Xsed="\$SED -e 1s/^X//" + +# A grep program that handles long lines. +GREP=$lt_GREP + +# An ERE matcher. +EGREP=$lt_EGREP + +# A literal string matcher. +FGREP=$lt_FGREP + +# A BSD- or MS-compatible name lister. +NM=$lt_NM + +# Whether we need soft or hard links. +LN_S=$lt_LN_S + +# What is the maximum length of a command? +max_cmd_len=$max_cmd_len + +# Object file suffix (normally "o"). +objext=$ac_objext + +# Executable file suffix (normally ""). +exeext=$exeext + +# whether the shell understands "unset". +lt_unset=$lt_unset + +# turn spaces into newlines. +SP2NL=$lt_lt_SP2NL + +# turn newlines into spaces. +NL2SP=$lt_lt_NL2SP + +# How to create reloadable object files. +reload_flag=$lt_reload_flag +reload_cmds=$lt_reload_cmds + +# Method to check whether dependent libraries are shared objects. +deplibs_check_method=$lt_deplibs_check_method + +# Command to use when deplibs_check_method == "file_magic". +file_magic_cmd=$lt_file_magic_cmd + +# The archiver. +AR=$lt_AR +AR_FLAGS=$lt_AR_FLAGS + +# A symbol stripping program. +STRIP=$lt_STRIP + +# Commands used to install an old-style archive. +RANLIB=$lt_RANLIB +old_postinstall_cmds=$lt_old_postinstall_cmds +old_postuninstall_cmds=$lt_old_postuninstall_cmds + +# A C compiler. +LTCC=$lt_CC + +# LTCC compiler flags. +LTCFLAGS=$lt_CFLAGS + +# Take the output of nm and produce a listing of raw symbols and C names. +global_symbol_pipe=$lt_lt_cv_sys_global_symbol_pipe + +# Transform the output of nm in a proper C declaration. +global_symbol_to_cdecl=$lt_lt_cv_sys_global_symbol_to_cdecl + +# Transform the output of nm in a C name address pair. +global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address + +# Transform the output of nm in a C name address pair when lib prefix is needed. +global_symbol_to_c_name_address_lib_prefix=$lt_lt_cv_sys_global_symbol_to_c_name_address_lib_prefix + +# The name of the directory that contains temporary libtool files. +objdir=$objdir + +# Shell to use when invoking shell scripts. +SHELL=$lt_SHELL + +# An echo program that does not interpret backslashes. +ECHO=$lt_ECHO + +# Used to examine libraries when file_magic_cmd begins with "file". +MAGIC_CMD=$MAGIC_CMD + +# Must we lock files when doing compilation? +need_locks=$lt_need_locks + +# Tool to manipulate archived DWARF debug symbol files on Mac OS X. +DSYMUTIL=$lt_DSYMUTIL + +# Tool to change global to local symbols on Mac OS X. +NMEDIT=$lt_NMEDIT + +# Tool to manipulate fat objects and archives on Mac OS X. +LIPO=$lt_LIPO + +# ldd/readelf like tool for Mach-O binaries on Mac OS X. +OTOOL=$lt_OTOOL + +# ldd/readelf like tool for 64 bit Mach-O binaries on Mac OS X 10.4. +OTOOL64=$lt_OTOOL64 + +# Old archive suffix (normally "a"). +libext=$libext + +# Shared library suffix (normally ".so"). +shrext_cmds=$lt_shrext_cmds + +# The commands to extract the exported symbol list from a shared archive. +extract_expsyms_cmds=$lt_extract_expsyms_cmds + +# Variables whose values should be saved in libtool wrapper scripts and +# restored at link time. +variables_saved_for_relink=$lt_variables_saved_for_relink + +# Do we need the "lib" prefix for modules? +need_lib_prefix=$need_lib_prefix + +# Do we need a version for libraries? +need_version=$need_version + +# Library versioning type. +version_type=$version_type + +# Shared library runtime path variable. +runpath_var=$runpath_var + +# Shared library path variable. +shlibpath_var=$shlibpath_var + +# Is shlibpath searched before the hard-coded library search path? +shlibpath_overrides_runpath=$shlibpath_overrides_runpath + +# Format of library name prefix. +libname_spec=$lt_libname_spec + +# List of archive names. First name is the real one, the rest are links. +# The last name is the one that the linker finds with -lNAME +library_names_spec=$lt_library_names_spec + +# The coded name of the library, if different from the real name. +soname_spec=$lt_soname_spec + +# Command to use after installation of a shared archive. +postinstall_cmds=$lt_postinstall_cmds + +# Command to use after uninstallation of a shared archive. +postuninstall_cmds=$lt_postuninstall_cmds + +# Commands used to finish a libtool library installation in a directory. +finish_cmds=$lt_finish_cmds + +# As "finish_cmds", except a single script fragment to be evaled but +# not shown. +finish_eval=$lt_finish_eval + +# Whether we should hardcode library paths into libraries. +hardcode_into_libs=$hardcode_into_libs + +# Compile-time system search path for libraries. +sys_lib_search_path_spec=$lt_sys_lib_search_path_spec + +# Run-time system search path for libraries. +sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec + +# Whether dlopen is supported. +dlopen_support=$enable_dlopen + +# Whether dlopen of programs is supported. +dlopen_self=$enable_dlopen_self + +# Whether dlopen of statically linked programs is supported. +dlopen_self_static=$enable_dlopen_self_static + +# Commands to strip libraries. +old_striplib=$lt_old_striplib +striplib=$lt_striplib + + +# The linker used to build libraries. +LD=$lt_LD + +# Commands used to build an old-style archive. +old_archive_cmds=$lt_old_archive_cmds + +# A language specific compiler. +CC=$lt_compiler + +# Is the compiler the GNU compiler? +with_gcc=$GCC + +# Compiler flag to turn off builtin functions. +no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag + +# How to pass a linker flag through the compiler. +wl=$lt_lt_prog_compiler_wl + +# Additional compiler flags for building library objects. +pic_flag=$lt_lt_prog_compiler_pic + +# Compiler flag to prevent dynamic linking. +link_static_flag=$lt_lt_prog_compiler_static + +# Does compiler simultaneously support -c and -o options? +compiler_c_o=$lt_lt_cv_prog_compiler_c_o + +# Whether or not to add -lc for building shared libraries. +build_libtool_need_lc=$archive_cmds_need_lc + +# Whether or not to disallow shared libs when runtime libs are static. +allow_libtool_libs_with_static_runtimes=$enable_shared_with_static_runtimes + +# Compiler flag to allow reflexive dlopens. +export_dynamic_flag_spec=$lt_export_dynamic_flag_spec + +# Compiler flag to generate shared objects directly from archives. +whole_archive_flag_spec=$lt_whole_archive_flag_spec + +# Whether the compiler copes with passing no objects directly. +compiler_needs_object=$lt_compiler_needs_object + +# Create an old-style archive from a shared archive. +old_archive_from_new_cmds=$lt_old_archive_from_new_cmds + +# Create a temporary old-style archive to link instead of a shared archive. +old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds + +# Commands used to build a shared archive. +archive_cmds=$lt_archive_cmds +archive_expsym_cmds=$lt_archive_expsym_cmds + +# Commands used to build a loadable module if different from building +# a shared archive. +module_cmds=$lt_module_cmds +module_expsym_cmds=$lt_module_expsym_cmds + +# Whether we are building with GNU ld or not. +with_gnu_ld=$lt_with_gnu_ld + +# Flag that allows shared libraries with undefined symbols to be built. +allow_undefined_flag=$lt_allow_undefined_flag + +# Flag that enforces no undefined symbols. +no_undefined_flag=$lt_no_undefined_flag + +# Flag to hardcode \$libdir into a binary during linking. +# This must work even if \$libdir does not exist +hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec + +# If ld is used when linking, flag to hardcode \$libdir into a binary +# during linking. This must work even if \$libdir does not exist. +hardcode_libdir_flag_spec_ld=$lt_hardcode_libdir_flag_spec_ld + +# Whether we need a single "-rpath" flag with a separated argument. +hardcode_libdir_separator=$lt_hardcode_libdir_separator + +# Set to "yes" if using DIR/libNAME\${shared_ext} during linking hardcodes +# DIR into the resulting binary. +hardcode_direct=$hardcode_direct + +# Set to "yes" if using DIR/libNAME\${shared_ext} during linking hardcodes +# DIR into the resulting binary and the resulting library dependency is +# "absolute",i.e impossible to change by setting \${shlibpath_var} if the +# library is relocated. +hardcode_direct_absolute=$hardcode_direct_absolute + +# Set to "yes" if using the -LDIR flag during linking hardcodes DIR +# into the resulting binary. +hardcode_minus_L=$hardcode_minus_L + +# Set to "yes" if using SHLIBPATH_VAR=DIR during linking hardcodes DIR +# into the resulting binary. +hardcode_shlibpath_var=$hardcode_shlibpath_var + +# Set to "yes" if building a shared library automatically hardcodes DIR +# into the library and all subsequent libraries and executables linked +# against it. +hardcode_automatic=$hardcode_automatic + +# Set to yes if linker adds runtime paths of dependent libraries +# to runtime path list. +inherit_rpath=$inherit_rpath + +# Whether libtool must link a program against all its dependency libraries. +link_all_deplibs=$link_all_deplibs + +# Fix the shell variable \$srcfile for the compiler. +fix_srcfile_path=$lt_fix_srcfile_path + +# Set to "yes" if exported symbols are required. +always_export_symbols=$always_export_symbols + +# The commands to list exported symbols. +export_symbols_cmds=$lt_export_symbols_cmds + +# Symbols that should not be listed in the preloaded symbols. +exclude_expsyms=$lt_exclude_expsyms + +# Symbols that must always be exported. +include_expsyms=$lt_include_expsyms + +# Commands necessary for linking programs (against libraries) with templates. +prelink_cmds=$lt_prelink_cmds + +# Specify filename containing input files. +file_list_spec=$lt_file_list_spec + +# How to hardcode a shared library path into an executable. +hardcode_action=$hardcode_action + +# ### END LIBTOOL CONFIG + +_LT_EOF + + case $host_os in + aix3*) + cat <<\_LT_EOF >> "$cfgfile" +# AIX sometimes has problems with the GCC collect2 program. For some +# reason, if we set the COLLECT_NAMES environment variable, the problems +# vanish in a puff of smoke. +if test "X${COLLECT_NAMES+set}" != Xset; then + COLLECT_NAMES= + export COLLECT_NAMES +fi +_LT_EOF + ;; + esac + + +ltmain="$ac_aux_dir/ltmain.sh" + + + # We use sed instead of cat because bash on DJGPP gets confused if + # if finds mixed CR/LF and LF-only lines. Since sed operates in + # text mode, it properly converts lines to CR/LF. This bash problem + # is reportedly fixed, but why not run on old versions too? + sed '/^# Generated shell functions inserted here/q' "$ltmain" >> "$cfgfile" \ + || (rm -f "$cfgfile"; exit 1) + + case $xsi_shell in + yes) + cat << \_LT_EOF >> "$cfgfile" + +# func_dirname file append nondir_replacement +# Compute the dirname of FILE. If nonempty, add APPEND to the result, +# otherwise set result to NONDIR_REPLACEMENT. +func_dirname () +{ + case ${1} in + */*) func_dirname_result="${1%/*}${2}" ;; + * ) func_dirname_result="${3}" ;; + esac +} + +# func_basename file +func_basename () +{ + func_basename_result="${1##*/}" +} + +# func_dirname_and_basename file append nondir_replacement +# perform func_basename and func_dirname in a single function +# call: +# dirname: Compute the dirname of FILE. If nonempty, +# add APPEND to the result, otherwise set result +# to NONDIR_REPLACEMENT. +# value returned in "$func_dirname_result" +# basename: Compute filename of FILE. +# value retuned in "$func_basename_result" +# Implementation must be kept synchronized with func_dirname +# and func_basename. For efficiency, we do not delegate to +# those functions but instead duplicate the functionality here. +func_dirname_and_basename () +{ + case ${1} in + */*) func_dirname_result="${1%/*}${2}" ;; + * ) func_dirname_result="${3}" ;; + esac + func_basename_result="${1##*/}" +} + +# func_stripname prefix suffix name +# strip PREFIX and SUFFIX off of NAME. +# PREFIX and SUFFIX must not contain globbing or regex special +# characters, hashes, percent signs, but SUFFIX may contain a leading +# dot (in which case that matches only a dot). +func_stripname () +{ + # pdksh 5.2.14 does not do ${X%$Y} correctly if both X and Y are + # positional parameters, so assign one to ordinary parameter first. + func_stripname_result=${3} + func_stripname_result=${func_stripname_result#"${1}"} + func_stripname_result=${func_stripname_result%"${2}"} +} + +# func_opt_split +func_opt_split () +{ + func_opt_split_opt=${1%%=*} + func_opt_split_arg=${1#*=} +} + +# func_lo2o object +func_lo2o () +{ + case ${1} in + *.lo) func_lo2o_result=${1%.lo}.${objext} ;; + *) func_lo2o_result=${1} ;; + esac +} + +# func_xform libobj-or-source +func_xform () +{ + func_xform_result=${1%.*}.lo +} + +# func_arith arithmetic-term... +func_arith () +{ + func_arith_result=$(( $* )) +} + +# func_len string +# STRING may not start with a hyphen. +func_len () +{ + func_len_result=${#1} +} + +_LT_EOF + ;; + *) # Bourne compatible functions. + cat << \_LT_EOF >> "$cfgfile" + +# func_dirname file append nondir_replacement +# Compute the dirname of FILE. If nonempty, add APPEND to the result, +# otherwise set result to NONDIR_REPLACEMENT. +func_dirname () +{ + # Extract subdirectory from the argument. + func_dirname_result=`$ECHO "X${1}" | $Xsed -e "$dirname"` + if test "X$func_dirname_result" = "X${1}"; then + func_dirname_result="${3}" + else + func_dirname_result="$func_dirname_result${2}" + fi +} + +# func_basename file +func_basename () +{ + func_basename_result=`$ECHO "X${1}" | $Xsed -e "$basename"` +} + + +# func_stripname prefix suffix name +# strip PREFIX and SUFFIX off of NAME. +# PREFIX and SUFFIX must not contain globbing or regex special +# characters, hashes, percent signs, but SUFFIX may contain a leading +# dot (in which case that matches only a dot). +# func_strip_suffix prefix name +func_stripname () +{ + case ${2} in + .*) func_stripname_result=`$ECHO "X${3}" \ + | $Xsed -e "s%^${1}%%" -e "s%\\\\${2}\$%%"`;; + *) func_stripname_result=`$ECHO "X${3}" \ + | $Xsed -e "s%^${1}%%" -e "s%${2}\$%%"`;; + esac +} + +# sed scripts: +my_sed_long_opt='1s/^\(-[^=]*\)=.*/\1/;q' +my_sed_long_arg='1s/^-[^=]*=//' + +# func_opt_split +func_opt_split () +{ + func_opt_split_opt=`$ECHO "X${1}" | $Xsed -e "$my_sed_long_opt"` + func_opt_split_arg=`$ECHO "X${1}" | $Xsed -e "$my_sed_long_arg"` +} + +# func_lo2o object +func_lo2o () +{ + func_lo2o_result=`$ECHO "X${1}" | $Xsed -e "$lo2o"` +} + +# func_xform libobj-or-source +func_xform () +{ + func_xform_result=`$ECHO "X${1}" | $Xsed -e 's/\.[^.]*$/.lo/'` +} + +# func_arith arithmetic-term... +func_arith () +{ + func_arith_result=`expr "$@"` +} + +# func_len string +# STRING may not start with a hyphen. +func_len () +{ + func_len_result=`expr "$1" : ".*" 2>/dev/null || echo $max_cmd_len` +} + +_LT_EOF +esac + +case $lt_shell_append in + yes) + cat << \_LT_EOF >> "$cfgfile" + +# func_append var value +# Append VALUE to the end of shell variable VAR. +func_append () +{ + eval "$1+=\$2" +} +_LT_EOF + ;; + *) + cat << \_LT_EOF >> "$cfgfile" + +# func_append var value +# Append VALUE to the end of shell variable VAR. +func_append () +{ + eval "$1=\$$1\$2" +} + +_LT_EOF + ;; + esac + + + sed -n '/^# Generated shell functions inserted here/,$p' "$ltmain" >> "$cfgfile" \ + || (rm -f "$cfgfile"; exit 1) + + mv -f "$cfgfile" "$ofile" || + (rm -f "$ofile" && cp "$cfgfile" "$ofile" && rm -f "$cfgfile") + chmod +x "$ofile" + + ;; + + esac +done # for ac_tag + + +as_fn_exit 0 +_ACEOF +ac_clean_files=$ac_clean_files_save + +test $ac_write_fail = 0 || + as_fn_error $? "write failure creating $CONFIG_STATUS" "$LINENO" 5 + + +# configure is writing to config.log, and then calls config.status. +# config.status does its own redirection, appending to config.log. +# Unfortunately, on DOS this fails, as config.log is still kept open +# by configure, so config.status won't be able to write to it; its +# output is simply discarded. So we exec the FD to /dev/null, +# effectively closing config.log, so it can be properly (re)opened and +# appended to by config.status. When coming back to configure, we +# need to make the FD available again. +if test "$no_create" != yes; then + ac_cs_success=: + ac_config_status_args= + test "$silent" = yes && + ac_config_status_args="$ac_config_status_args --quiet" + exec 5>/dev/null + $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false + exec 5>>config.log + # Use ||, not &&, to avoid exiting from the if with $? = 1, which + # would make configure fail if this is the last instruction. + $ac_cs_success || as_fn_exit 1 +fi + +# +# CONFIG_SUBDIRS section. +# +if test "$no_recursion" != yes; then + + # Remove --cache-file, --srcdir, and --disable-option-checking arguments + # so they do not pile up. + ac_sub_configure_args= + ac_prev= + eval "set x $ac_configure_args" + shift + for ac_arg + do + if test -n "$ac_prev"; then + ac_prev= + continue + fi + case $ac_arg in + -cache-file | --cache-file | --cache-fil | --cache-fi \ + | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) + ac_prev=cache_file ;; + -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ + | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* \ + | --c=*) + ;; + --config-cache | -C) + ;; + -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) + ac_prev=srcdir ;; + -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) + ;; + -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) + ac_prev=prefix ;; + -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) + ;; + --disable-option-checking) + ;; + *) + case $ac_arg in + *\'*) ac_arg=`$as_echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; + esac + as_fn_append ac_sub_configure_args " '$ac_arg'" ;; + esac + done + + # Always prepend --prefix to ensure using the same prefix + # in subdir configurations. + ac_arg="--prefix=$prefix" + case $ac_arg in + *\'*) ac_arg=`$as_echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; + esac + ac_sub_configure_args="'$ac_arg' $ac_sub_configure_args" + + # Pass --silent + if test "$silent" = yes; then + ac_sub_configure_args="--silent $ac_sub_configure_args" + fi + + # Always prepend --disable-option-checking to silence warnings, since + # different subdirs can have different --enable and --with options. + ac_sub_configure_args="--disable-option-checking $ac_sub_configure_args" + + ac_popdir=`pwd` + for ac_dir in : $subdirs; do test "x$ac_dir" = x: && continue + + # Do not complain, so a configure script can configure whichever + # parts of a large source tree are present. + test -d "$srcdir/$ac_dir" || continue + + ac_msg="=== configuring in $ac_dir (`pwd`/$ac_dir)" + $as_echo "$as_me:${as_lineno-$LINENO}: $ac_msg" >&5 + $as_echo "$ac_msg" >&6 + as_dir="$ac_dir"; as_fn_mkdir_p + ac_builddir=. + +case "$ac_dir" in +.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; +*) + ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` + # A ".." for each directory in $ac_dir_suffix. + ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` + case $ac_top_builddir_sub in + "") ac_top_builddir_sub=. ac_top_build_prefix= ;; + *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; + esac ;; +esac +ac_abs_top_builddir=$ac_pwd +ac_abs_builddir=$ac_pwd$ac_dir_suffix +# for backward compatibility: +ac_top_builddir=$ac_top_build_prefix + +case $srcdir in + .) # We are building in place. + ac_srcdir=. + ac_top_srcdir=$ac_top_builddir_sub + ac_abs_top_srcdir=$ac_pwd ;; + [\\/]* | ?:[\\/]* ) # Absolute name. + ac_srcdir=$srcdir$ac_dir_suffix; + ac_top_srcdir=$srcdir + ac_abs_top_srcdir=$srcdir ;; + *) # Relative name. + ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix + ac_top_srcdir=$ac_top_build_prefix$srcdir + ac_abs_top_srcdir=$ac_pwd/$srcdir ;; +esac +ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix + + + cd "$ac_dir" + + # Check for guested configure; otherwise get Cygnus style configure. + if test -f "$ac_srcdir/configure.gnu"; then + ac_sub_configure=$ac_srcdir/configure.gnu + elif test -f "$ac_srcdir/configure"; then + ac_sub_configure=$ac_srcdir/configure + elif test -f "$ac_srcdir/configure.in"; then + # This should be Cygnus configure. + ac_sub_configure=$ac_aux_dir/configure + else + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: no configuration information is in $ac_dir" >&5 +$as_echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2;} + ac_sub_configure= + fi + + # The recursion is here. + if test -n "$ac_sub_configure"; then + # Make the cache file name correct relative to the subdirectory. + case $cache_file in + [\\/]* | ?:[\\/]* ) ac_sub_cache_file=$cache_file ;; + *) # Relative name. + ac_sub_cache_file=$ac_top_build_prefix$cache_file ;; + esac + + { $as_echo "$as_me:${as_lineno-$LINENO}: running $SHELL $ac_sub_configure $ac_sub_configure_args --cache-file=$ac_sub_cache_file --srcdir=$ac_srcdir" >&5 +$as_echo "$as_me: running $SHELL $ac_sub_configure $ac_sub_configure_args --cache-file=$ac_sub_cache_file --srcdir=$ac_srcdir" >&6;} + # The eval makes quoting arguments work. + eval "\$SHELL \"\$ac_sub_configure\" $ac_sub_configure_args \ + --cache-file=\"\$ac_sub_cache_file\" --srcdir=\"\$ac_srcdir\"" || + as_fn_error $? "$ac_sub_configure failed for $ac_dir" "$LINENO" 5 + fi + + cd "$ac_popdir" + done +fi +if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: unrecognized options: $ac_unrecognized_opts" >&5 +$as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;} +fi + + + + tmp_cpp=`eval echo "$ac_cpp" 2>/dev/null` + if test -z "$tmp_cpp"; then + tmp_cpp='cpp' + fi + cat >./tests/configurehelp.pm <<_EOF +# This is a generated file. Do not edit. + +package configurehelp; + +use strict; +use warnings; +use Exporter; + +use vars qw( + @ISA + @EXPORT_OK + \$Cpreprocessor + ); + +@ISA = qw(Exporter); + +@EXPORT_OK = qw( + \$Cpreprocessor + ); + +\$Cpreprocessor = '$tmp_cpp'; + +1; +_EOF + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: Configured to build curl/libcurl: + + curl version: ${VERSION} + Host setup: ${host} + Install prefix: ${prefix} + Compiler: ${CC} + SSL support: ${curl_ssl_msg} + SSH support: ${curl_ssh_msg} + zlib support: ${curl_zlib_msg} + krb4 support: ${curl_krb4_msg} + GSSAPI support: ${curl_gss_msg} + SPNEGO support: ${curl_spnego_msg} + resolver: ${curl_res_msg} + ipv6 support: ${curl_ipv6_msg} + IDN support: ${curl_idn_msg} + Build libcurl: Shared=${enable_shared}, Static=${enable_static} + Built-in manual: ${curl_manual_msg} + Verbose errors: ${curl_verbose_msg} + SSPI support: ${curl_sspi_msg} + ca cert bundle: ${ca} + ca cert path: ${capath} + LDAP support: ${curl_ldap_msg} + LDAPS support: ${curl_ldaps_msg} + RTSP support: ${curl_rtsp_msg} + RTMP support: ${curl_rtmp_msg} + Protocols: ${SUPPORT_PROTOCOLS} +" >&5 +$as_echo "$as_me: Configured to build curl/libcurl: + + curl version: ${VERSION} + Host setup: ${host} + Install prefix: ${prefix} + Compiler: ${CC} + SSL support: ${curl_ssl_msg} + SSH support: ${curl_ssh_msg} + zlib support: ${curl_zlib_msg} + krb4 support: ${curl_krb4_msg} + GSSAPI support: ${curl_gss_msg} + SPNEGO support: ${curl_spnego_msg} + resolver: ${curl_res_msg} + ipv6 support: ${curl_ipv6_msg} + IDN support: ${curl_idn_msg} + Build libcurl: Shared=${enable_shared}, Static=${enable_static} + Built-in manual: ${curl_manual_msg} + Verbose errors: ${curl_verbose_msg} + SSPI support: ${curl_sspi_msg} + ca cert bundle: ${ca} + ca cert path: ${capath} + LDAP support: ${curl_ldap_msg} + LDAPS support: ${curl_ldaps_msg} + RTSP support: ${curl_rtsp_msg} + RTMP support: ${curl_rtmp_msg} + Protocols: ${SUPPORT_PROTOCOLS} +" >&6;} + +if test "x$soname_bump" = "xyes"; then + +cat <, et al. +# +# This software is licensed as described in the file COPYING, which +# you should have received as part of this distribution. The terms +# are also available at http://curl.haxx.se/docs/copyright.html. +# +# You may opt to use, copy, modify, merge, publish, distribute and/or sell +# copies of the Software, and permit persons to whom the Software is +# furnished to do so, under the terms of the COPYING file. +# +# This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY +# KIND, either express or implied. +# +#*************************************************************************** +dnl Process this file with autoconf to produce a configure script. + +AC_PREREQ(2.57) + +dnl We don't know the version number "statically" so we use a dash here +AC_INIT([curl], [-], [a suitable curl mailing list: http://curl.haxx.se/mail/]) + +CURL_OVERRIDE_AUTOCONF + +dnl configure script copyright +AC_COPYRIGHT([Copyright (c) 1998 - 2010 Daniel Stenberg, +This configure script may be copied, distributed and modified under the +terms of the curl license; see COPYING for more details]) + +AC_CONFIG_SRCDIR([lib/urldata.h]) +AM_CONFIG_HEADER(lib/curl_config.h src/curl_config.h include/curl/curlbuild.h) +AM_MAINTAINER_MODE + +CURL_CHECK_OPTION_DEBUG +CURL_CHECK_OPTION_OPTIMIZE +CURL_CHECK_OPTION_WARNINGS +CURL_CHECK_OPTION_WERROR +CURL_CHECK_OPTION_CURLDEBUG +CURL_CHECK_OPTION_ARES + +CURL_CHECK_PATH_SEPARATOR_REQUIRED + +# +# save the configure arguments +# +CONFIGURE_OPTIONS="\"$ac_configure_args\"" +AC_SUBST(CONFIGURE_OPTIONS) + +CURL_CFLAG_EXTRAS="" +if test X"$want_werror" = Xyes; then + CURL_CFLAG_EXTRAS="-Werror" +fi +AC_SUBST(CURL_CFLAG_EXTRAS) + +dnl SED is mandatory for configure process and libtool. +dnl Set it now, allowing it to be changed later. +if test -z "$SED"; then + dnl allow it to be overridden + AC_PATH_PROG([SED], [sed], [not_found], + [$PATH:/usr/bin:/usr/local/bin]) + if test -z "$SED" || test "$SED" = "not_found"; then + AC_MSG_ERROR([sed not found in PATH. Cannot continue without sed.]) + fi +fi +AC_SUBST([SED]) + +dnl GREP is mandatory for configure process and libtool. +dnl Set it now, allowing it to be changed later. +if test -z "$GREP"; then + dnl allow it to be overridden + AC_PATH_PROG([GREP], [grep], [not_found], + [$PATH:/usr/bin:/usr/local/bin]) + if test -z "$GREP" || test "$GREP" = "not_found"; then + AC_MSG_ERROR([grep not found in PATH. Cannot continue without grep.]) + fi +fi +AC_SUBST([GREP]) + +dnl EGREP is mandatory for configure process and libtool. +dnl Set it now, allowing it to be changed later. +if test -z "$EGREP"; then + dnl allow it to be overridden + if echo a | ($GREP -E '(a|b)') >/dev/null 2>&1; then + AC_MSG_CHECKING([for egrep]) + EGREP="$GREP -E" + AC_MSG_RESULT([$EGREP]) + else + AC_PATH_PROG([EGREP], [egrep], [not_found], + [$PATH:/usr/bin:/usr/local/bin]) + fi +fi +if test -z "$EGREP" || test "$EGREP" = "not_found"; then + AC_MSG_ERROR([egrep not found in PATH. Cannot continue without egrep.]) +fi +AC_SUBST([EGREP]) + +dnl AR is mandatory for configure process and libtool. +dnl This is target dependent, so check it as a tool. +if test -z "$AR"; then + dnl allow it to be overridden + AC_PATH_TOOL([AR], [ar], [not_found], + [$PATH:/usr/bin:/usr/local/bin]) + if test -z "$AR" || test "$AR" = "not_found"; then + AC_MSG_ERROR([ar not found in PATH. Cannot continue without ar.]) + fi +fi +AC_SUBST([AR]) + +AC_SUBST(libext) + +dnl Remove non-configure distributed curlbuild.h +if test -f ${srcdir}/include/curl/curlbuild.h; then + rm -f ${srcdir}/include/curl/curlbuild.h +fi + +dnl figure out the libcurl version +VERSION=`$SED -ne 's/^#define LIBCURL_VERSION "\(.*\)"/\1/p' ${srcdir}/include/curl/curlver.h` +AM_INIT_AUTOMAKE(curl,$VERSION) +AC_MSG_CHECKING([curl version]) +AC_MSG_RESULT($VERSION) + +dnl +dnl we extract the numerical version for curl-config only +VERSIONNUM=`$SED -ne 's/^#define LIBCURL_VERSION_NUM 0x\(.*\)/\1/p' ${srcdir}/include/curl/curlver.h` +AC_SUBST(VERSIONNUM) + +dnl Solaris pkgadd support definitions +PKGADD_PKG="HAXXcurl" +PKGADD_NAME="cURL - a client that groks URLs" +PKGADD_VENDOR="curl.haxx.se" +AC_SUBST(PKGADD_PKG) +AC_SUBST(PKGADD_NAME) +AC_SUBST(PKGADD_VENDOR) + +dnl +dnl initialize all the info variables + curl_ssl_msg="no (--with-{ssl,gnutls,nss,polarssl} )" + curl_ssh_msg="no (--with-libssh2)" + curl_zlib_msg="no (--with-zlib)" + curl_krb4_msg="no (--with-krb4*)" + curl_gss_msg="no (--with-gssapi)" + curl_spnego_msg="no (--with-spnego)" + curl_res_msg="default (--enable-ares / --enable-threaded-resolver)" + curl_ipv6_msg="no (--enable-ipv6)" + curl_idn_msg="no (--with-libidn)" + curl_manual_msg="no (--enable-manual)" +curl_verbose_msg="enabled (--disable-verbose)" + curl_sspi_msg="no (--enable-sspi)" + curl_ldap_msg="no (--enable-ldap / --with-ldap-lib / --with-lber-lib)" + curl_ldaps_msg="no (--enable-ldaps)" + curl_rtsp_msg="no (--enable-rtsp)" + curl_rtmp_msg="no (--with-librtmp)" + +dnl +dnl Save anything in $LIBS for later +dnl +ALL_LIBS=$LIBS + +dnl +dnl Detect the canonical host and target build environment +dnl + +AC_CANONICAL_HOST +dnl Get system canonical name +AC_DEFINE_UNQUOTED(OS, "${host}", [cpu-machine-OS]) + +dnl Checks for programs. +CURL_CHECK_PROG_CC + +dnl Our curl_off_t internal and external configure settings +CURL_CONFIGURE_CURL_OFF_T + +dnl This defines _ALL_SOURCE for AIX +CURL_CHECK_AIX_ALL_SOURCE + +dnl Our configure and build reentrant settings +CURL_CONFIGURE_THREAD_SAFE +CURL_CONFIGURE_REENTRANT + +dnl check for how to do large files +AC_SYS_LARGEFILE + +dnl support building of Windows DLLs +AC_LIBTOOL_WIN32_DLL + +dnl force libtool to build static libraries with PIC on AMD64-Linux & FreeBSD +AC_MSG_CHECKING([if arch-OS host is AMD64-Linux/FreeBSD (to build static libraries with PIC)]) +case $host in + x86_64*linux*|amd64*freebsd*|ia64*freebsd*) + AC_MSG_RESULT([yes]) + with_pic=yes + ;; + *) + AC_MSG_RESULT([no]) + ;; +esac + +AC_MSG_CHECKING([if compiler is icc (to build with PIC)]) +case $CC in + icc | */icc) + AC_MSG_RESULT([yes]) + with_pic=yes + ;; + *) + AC_MSG_RESULT([no]) + ;; +esac + +dnl libtool setup +AC_PROG_LIBTOOL + +AC_MSG_CHECKING([if we need -mimpure-text]) +mimpure=no +case $host in + *-*-solaris2*) + if test "$GCC" = "yes"; then + mimpure="yes" + fi + ;; + *) + ;; +esac +AC_MSG_RESULT($mimpure) +AM_CONDITIONAL(MIMPURE, test x$mimpure = xyes) + +dnl 'STATICLIB' is, in spite of its name, not generic but only for static-only +dnl builds on Windows +AM_CONDITIONAL(STATICLIB, false) + +AC_MSG_CHECKING([if we need BUILDING_LIBCURL]) +case $host in + *-*-mingw*) + AC_DEFINE(BUILDING_LIBCURL, 1, [when building libcurl itself]) + AC_MSG_RESULT(yes) + AC_MSG_CHECKING([if we need CURL_STATICLIB]) + if test "X$enable_shared" = "Xno" + then + AC_DEFINE(CURL_STATICLIB, 1, [when not building a shared library]) + AC_MSG_RESULT(yes) + AM_CONDITIONAL(STATICLIB, true) + else + AC_MSG_RESULT(no) + fi + ;; + *) + AC_MSG_RESULT(no) + ;; +esac + +# Determine whether all dependent libraries must be specified when linking +if test "X$enable_shared" = "Xyes" -a "X$link_all_deplibs" = "Xno" +then + REQUIRE_LIB_DEPS=no +else + REQUIRE_LIB_DEPS=yes +fi +AC_SUBST(REQUIRE_LIB_DEPS) + +dnl The install stuff has already been taken care of by the automake stuff +dnl AC_PROG_INSTALL +AC_PROG_MAKE_SET + +dnl check if there's a way to force code inline +AC_C_INLINE + +dnl ********************************************************************** +dnl platform/compiler/architecture specific checks/flags +dnl ********************************************************************** + +CURL_CHECK_COMPILER +CURL_SET_COMPILER_BASIC_OPTS +CURL_SET_COMPILER_DEBUG_OPTS +CURL_SET_COMPILER_OPTIMIZE_OPTS +CURL_SET_COMPILER_WARNING_OPTS + +if test "$compiler_id" = "INTEL_UNIX_C"; then + # + if test "$compiler_num" -ge "1000"; then + dnl icc 10.X or later + CFLAGS="$CFLAGS -shared-intel" + elif test "$compiler_num" -ge "900"; then + dnl icc 9.X specific + CFLAGS="$CFLAGS -i-dynamic" + fi + # +fi + +CURL_CHECK_COMPILER_HALT_ON_ERROR +CURL_CHECK_COMPILER_ARRAY_SIZE_NEGATIVE + +CURL_CHECK_NO_UNDEFINED +AM_CONDITIONAL(NO_UNDEFINED, test x$need_no_undefined = xyes) + +CURL_CHECK_CURLDEBUG +AM_CONDITIONAL(CURLDEBUG, test x$want_curldebug = xyes) + +dnl ********************************************************************** +dnl Compilation based checks should not be done before this point. +dnl ********************************************************************** + +dnl ********************************************************************** +dnl Make sure that our checks for headers windows.h winsock.h winsock2.h +dnl and ws2tcpip.h take precedence over any other further checks which +dnl could be done later using AC_CHECK_HEADER or AC_CHECK_HEADERS for +dnl this specific header files. And do them before its results are used. +dnl ********************************************************************** + +CURL_CHECK_HEADER_WINDOWS +CURL_CHECK_NATIVE_WINDOWS +case X-"$ac_cv_native_windows" in + X-yes) + CURL_CHECK_HEADER_WINSOCK + CURL_CHECK_HEADER_WINSOCK2 + CURL_CHECK_HEADER_WS2TCPIP + CURL_CHECK_HEADER_WINLDAP + CURL_CHECK_HEADER_WINBER + ;; + *) + ac_cv_header_winsock_h="no" + ac_cv_header_winsock2_h="no" + ac_cv_header_ws2tcpip_h="no" + ac_cv_header_winldap_h="no" + ac_cv_header_winber_h="no" + ;; +esac +CURL_CHECK_WIN32_LARGEFILE + +dnl ************************************************************ +dnl switch off particular protocols +dnl +AC_MSG_CHECKING([whether to support http]) +AC_ARG_ENABLE(http, +AC_HELP_STRING([--enable-http],[Enable HTTP support]) +AC_HELP_STRING([--disable-http],[Disable HTTP support]), +[ case "$enableval" in + no) + AC_MSG_RESULT(no) + AC_DEFINE(CURL_DISABLE_HTTP, 1, [to disable HTTP]) + AC_MSG_WARN([disable HTTP disables FTP over proxy and RTSP]) + AC_SUBST(CURL_DISABLE_HTTP, [1]) + AC_DEFINE(CURL_DISABLE_RTSP, 1, [to disable RTSP]) + AC_SUBST(CURL_DISABLE_RTSP, [1]) + ;; + *) AC_MSG_RESULT(yes) + ;; + esac ], + AC_MSG_RESULT(yes) +) +AC_MSG_CHECKING([whether to support ftp]) +AC_ARG_ENABLE(ftp, +AC_HELP_STRING([--enable-ftp],[Enable FTP support]) +AC_HELP_STRING([--disable-ftp],[Disable FTP support]), +[ case "$enableval" in + no) + AC_MSG_RESULT(no) + AC_DEFINE(CURL_DISABLE_FTP, 1, [to disable FTP]) + AC_SUBST(CURL_DISABLE_FTP, [1]) + ;; + *) AC_MSG_RESULT(yes) + ;; + esac ], + AC_MSG_RESULT(yes) +) +AC_MSG_CHECKING([whether to support file]) +AC_ARG_ENABLE(file, +AC_HELP_STRING([--enable-file],[Enable FILE support]) +AC_HELP_STRING([--disable-file],[Disable FILE support]), +[ case "$enableval" in + no) + AC_MSG_RESULT(no) + AC_DEFINE(CURL_DISABLE_FILE, 1, [to disable FILE]) + AC_SUBST(CURL_DISABLE_FILE, [1]) + ;; + *) AC_MSG_RESULT(yes) + ;; + esac ], + AC_MSG_RESULT(yes) +) +AC_MSG_CHECKING([whether to support ldap]) +AC_ARG_ENABLE(ldap, +AC_HELP_STRING([--enable-ldap],[Enable LDAP support]) +AC_HELP_STRING([--disable-ldap],[Disable LDAP support]), +[ case "$enableval" in + no) + AC_MSG_RESULT(no) + AC_DEFINE(CURL_DISABLE_LDAP, 1, [to disable LDAP]) + AC_SUBST(CURL_DISABLE_LDAP, [1]) + ;; + *) + AC_MSG_RESULT(yes) + ;; + esac ],[ + AC_MSG_RESULT(yes) ] +) +AC_MSG_CHECKING([whether to support ldaps]) +AC_ARG_ENABLE(ldaps, +AC_HELP_STRING([--enable-ldaps],[Enable LDAPS support]) +AC_HELP_STRING([--disable-ldaps],[Disable LDAPS support]), +[ case "$enableval" in + no) + AC_MSG_RESULT(no) + AC_DEFINE(CURL_DISABLE_LDAPS, 1, [to disable LDAPS]) + AC_SUBST(CURL_DISABLE_LDAPS, [1]) + ;; + *) if test "x$CURL_DISABLE_LDAP" = "x1" ; then + AC_MSG_RESULT(LDAP needs to be enabled to support LDAPS) + AC_DEFINE(CURL_DISABLE_LDAPS, 1, [to disable LDAPS]) + AC_SUBST(CURL_DISABLE_LDAPS, [1]) + else + AC_MSG_RESULT(yes) + AC_DEFINE(HAVE_LDAP_SSL, 1, [Use LDAPS implementation]) + AC_SUBST(HAVE_LDAP_SSL, [1]) + fi + ;; + esac ],[ + if test "x$CURL_DISABLE_LDAP" = "x1" ; then + AC_MSG_RESULT(no) + AC_DEFINE(CURL_DISABLE_LDAPS, 1, [to disable LDAPS]) + AC_SUBST(CURL_DISABLE_LDAPS, [1]) + else + AC_MSG_RESULT(yes) + AC_DEFINE(HAVE_LDAP_SSL, 1, [Use LDAPS implementation]) + AC_SUBST(HAVE_LDAP_SSL, [1]) + fi ] +) + +AC_MSG_CHECKING([whether to support rtsp]) +AC_ARG_ENABLE(rtsp, +AC_HELP_STRING([--enable-rtsp],[Enable RTSP support]) +AC_HELP_STRING([--disable-rtsp],[Disable RTSP support]), +[ case "$enableval" in + no) + AC_MSG_RESULT(no) + AC_DEFINE(CURL_DISABLE_RTSP, 1, [to disable RTSP]) + AC_SUBST(CURL_DISABLE_RTSP, [1]) + ;; + *) if test x$CURL_DISABLE_HTTP = x1 ; then + AC_MSG_ERROR(HTTP support needs to be enabled in order to enable RTSP support!) + else + AC_MSG_RESULT(yes) + curl_rtsp_msg="enabled" + fi + ;; + esac ], + if test "x$CURL_DISABLE_HTTP" != "x1"; then + AC_MSG_RESULT(yes) + curl_rtsp_msg="enabled" + else + AC_MSG_RESULT(no) + fi +) + +AC_MSG_CHECKING([whether to support proxies]) +AC_ARG_ENABLE(proxy, +AC_HELP_STRING([--enable-proxy],[Enable proxy support]) +AC_HELP_STRING([--disable-proxy],[Disable proxy support]), +[ case "$enableval" in + no) + AC_MSG_RESULT(no) + AC_DEFINE(CURL_DISABLE_PROXY, 1, [to disable proxies]) + AC_SUBST(CURL_DISABLE_PROXY, [1]) + ;; + *) AC_MSG_RESULT(yes) + ;; + esac ], + AC_MSG_RESULT(yes) +) + +AC_MSG_CHECKING([whether to support dict]) +AC_ARG_ENABLE(dict, +AC_HELP_STRING([--enable-dict],[Enable DICT support]) +AC_HELP_STRING([--disable-dict],[Disable DICT support]), +[ case "$enableval" in + no) + AC_MSG_RESULT(no) + AC_DEFINE(CURL_DISABLE_DICT, 1, [to disable DICT]) + AC_SUBST(CURL_DISABLE_DICT, [1]) + ;; + *) AC_MSG_RESULT(yes) + ;; + esac ], + AC_MSG_RESULT(yes) +) +AC_MSG_CHECKING([whether to support telnet]) +AC_ARG_ENABLE(telnet, +AC_HELP_STRING([--enable-telnet],[Enable TELNET support]) +AC_HELP_STRING([--disable-telnet],[Disable TELNET support]), +[ case "$enableval" in + no) + AC_MSG_RESULT(no) + AC_DEFINE(CURL_DISABLE_TELNET, 1, [to disable TELNET]) + AC_SUBST(CURL_DISABLE_TELNET, [1]) + ;; + *) AC_MSG_RESULT(yes) + ;; + esac ], + AC_MSG_RESULT(yes) +) +AC_MSG_CHECKING([whether to support tftp]) +AC_ARG_ENABLE(tftp, +AC_HELP_STRING([--enable-tftp],[Enable TFTP support]) +AC_HELP_STRING([--disable-tftp],[Disable TFTP support]), +[ case "$enableval" in + no) + AC_MSG_RESULT(no) + AC_DEFINE(CURL_DISABLE_TFTP, 1, [to disable TFTP]) + AC_SUBST(CURL_DISABLE_TFTP, [1]) + ;; + *) AC_MSG_RESULT(yes) + ;; + esac ], + AC_MSG_RESULT(yes) +) + +AC_MSG_CHECKING([whether to support pop3]) +AC_ARG_ENABLE(pop3, +AC_HELP_STRING([--enable-pop3],[Enable POP3 support]) +AC_HELP_STRING([--disable-pop3],[Disable POP3 support]), +[ case "$enableval" in + no) + AC_MSG_RESULT(no) + AC_DEFINE(CURL_DISABLE_POP3, 1, [to disable POP3]) + AC_SUBST(CURL_DISABLE_POP3, [1]) + ;; + *) AC_MSG_RESULT(yes) + ;; + esac ], + AC_MSG_RESULT(yes) +) + + +AC_MSG_CHECKING([whether to support imap]) +AC_ARG_ENABLE(imap, +AC_HELP_STRING([--enable-imap],[Enable IMAP support]) +AC_HELP_STRING([--disable-imap],[Disable IMAP support]), +[ case "$enableval" in + no) + AC_MSG_RESULT(no) + AC_DEFINE(CURL_DISABLE_IMAP, 1, [to disable IMAP]) + AC_SUBST(CURL_DISABLE_IMAP, [1]) + ;; + *) AC_MSG_RESULT(yes) + ;; + esac ], + AC_MSG_RESULT(yes) +) + + +AC_MSG_CHECKING([whether to support smtp]) +AC_ARG_ENABLE(smtp, +AC_HELP_STRING([--enable-smtp],[Enable SMTP support]) +AC_HELP_STRING([--disable-smtp],[Disable SMTP support]), +[ case "$enableval" in + no) + AC_MSG_RESULT(no) + AC_DEFINE(CURL_DISABLE_SMTP, 1, [to disable SMTP]) + AC_SUBST(CURL_DISABLE_SMTP, [1]) + ;; + *) AC_MSG_RESULT(yes) + ;; + esac ], + AC_MSG_RESULT(yes) +) + +AC_MSG_CHECKING([whether to support gopher]) +AC_ARG_ENABLE(gopher, +AC_HELP_STRING([--enable-gopher],[Enable Gopher support]) +AC_HELP_STRING([--disable-gopher],[Disable Gopher support]), +[ case "$enableval" in + no) + AC_MSG_RESULT(no) + AC_DEFINE(CURL_DISABLE_GOPHER, 1, [to disable Gopher]) + AC_SUBST(CURL_DISABLE_GOPHER, [1]) + ;; + *) AC_MSG_RESULT(yes) + ;; + esac ], + AC_MSG_RESULT(yes) +) + + +dnl ********************************************************************** +dnl Check for built-in manual +dnl ********************************************************************** + +AC_MSG_CHECKING([whether to provide built-in manual]) +AC_ARG_ENABLE(manual, +AC_HELP_STRING([--enable-manual],[Enable built-in manual]) +AC_HELP_STRING([--disable-manual],[Disable built-in manual]), +[ case "$enableval" in + no) + AC_MSG_RESULT(no) + ;; + *) AC_MSG_RESULT(yes) + USE_MANUAL="1" + ;; + esac ], + AC_MSG_RESULT(yes) + USE_MANUAL="1" +) +dnl The actual use of the USE_MANUAL variable is done much later in this +dnl script to allow other actions to disable it as well. + +dnl ********************************************************************** +dnl Checks for libraries. +dnl ********************************************************************** + +CURL_CHECK_LIB_XNET + +dnl gethostbyname without lib or in the nsl lib? +AC_CHECK_FUNC(gethostbyname, + [HAVE_GETHOSTBYNAME="1" + ], + [ AC_CHECK_LIB(nsl, gethostbyname, + [HAVE_GETHOSTBYNAME="1" + LIBS="$LIBS -lnsl" + ]) + ]) + +if test "$HAVE_GETHOSTBYNAME" != "1" +then + dnl gethostbyname in the socket lib? + AC_CHECK_LIB(socket, gethostbyname, + [HAVE_GETHOSTBYNAME="1" + LIBS="$LIBS -lsocket" + ]) +fi + +dnl At least one system has been identified to require BOTH nsl and socket +dnl libs at the same time to link properly. +if test "$HAVE_GETHOSTBYNAME" != "1" +then + AC_MSG_CHECKING([for gethostbyname with both nsl and socket libs]) + my_ac_save_LIBS=$LIBS + LIBS="-lnsl -lsocket $LIBS" + AC_LINK_IFELSE([ + AC_LANG_PROGRAM([[ + ]],[[ + gethostbyname(); + ]]) + ],[ + AC_MSG_RESULT([yes]) + HAVE_GETHOSTBYNAME="1" + ],[ + AC_MSG_RESULT([no]) + LIBS=$my_ac_save_LIBS + ]) +fi + +if test "$HAVE_GETHOSTBYNAME" != "1" +then + dnl This is for winsock systems + if test "$ac_cv_header_windows_h" = "yes"; then + if test "$ac_cv_header_winsock_h" = "yes"; then + case $host in + *-*-mingw32ce*) + winsock_LIB="-lwinsock" + ;; + *) + winsock_LIB="-lwsock32" + ;; + esac + fi + if test "$ac_cv_header_winsock2_h" = "yes"; then + winsock_LIB="-lws2_32" + fi + if test ! -z "$winsock_LIB"; then + my_ac_save_LIBS=$LIBS + LIBS="$winsock_LIB $LIBS" + AC_MSG_CHECKING([for gethostbyname in $winsock_LIB]) + AC_LINK_IFELSE([ + AC_LANG_PROGRAM([[ +#ifdef HAVE_WINDOWS_H +#ifndef WIN32_LEAN_AND_MEAN +#define WIN32_LEAN_AND_MEAN +#endif +#include +#ifdef HAVE_WINSOCK2_H +#include +#else +#ifdef HAVE_WINSOCK_H +#include +#endif +#endif +#endif + ]],[[ + gethostbyname("www.dummysite.com"); + ]]) + ],[ + AC_MSG_RESULT([yes]) + HAVE_GETHOSTBYNAME="1" + ],[ + AC_MSG_RESULT([no]) + winsock_LIB="" + LIBS=$my_ac_save_LIBS + ]) + fi + fi +fi + +if test "$HAVE_GETHOSTBYNAME" != "1" +then + dnl This is for Minix 3.1 + AC_MSG_CHECKING([for gethostbyname for Minix 3]) + AC_LINK_IFELSE([ + AC_LANG_PROGRAM([[ +/* Older Minix versions may need here instead */ +#include + ]],[[ + gethostbyname("www.dummysite.com"); + ]]) + ],[ + AC_MSG_RESULT([yes]) + HAVE_GETHOSTBYNAME="1" + ],[ + AC_MSG_RESULT([no]) + ]) +fi + +if test "$HAVE_GETHOSTBYNAME" != "1" +then + dnl This is for eCos with a stubbed DNS implementation + AC_MSG_CHECKING([for gethostbyname for eCos]) + AC_LINK_IFELSE([ + AC_LANG_PROGRAM([[ +#include +#include + ]],[[ + gethostbyname("www.dummysite.com"); + ]]) + ],[ + AC_MSG_RESULT([yes]) + HAVE_GETHOSTBYNAME="1" + ],[ + AC_MSG_RESULT([no]) + ]) +fi + +if test "$HAVE_GETHOSTBYNAME" != "1" +then + dnl gethostbyname in the network lib - for Haiku OS + AC_CHECK_LIB(network, gethostbyname, + [HAVE_GETHOSTBYNAME="1" + LIBS="$LIBS -lnetwork" + ]) +fi + +if test "$HAVE_GETHOSTBYNAME" != "1" +then + dnl gethostbyname in the net lib - for BeOS + AC_CHECK_LIB(net, gethostbyname, + [HAVE_GETHOSTBYNAME="1" + LIBS="$LIBS -lnet" + ]) +fi + + +if test "$HAVE_GETHOSTBYNAME" != "1"; then + AC_MSG_ERROR([couldn't find libraries for gethostbyname()]) +fi + +dnl resolve lib? +AC_CHECK_FUNC(strcasecmp, , [ AC_CHECK_LIB(resolve, strcasecmp) ]) + +if test "$ac_cv_lib_resolve_strcasecmp" = "$ac_cv_func_strcasecmp"; then + AC_CHECK_LIB(resolve, strcasecmp, + [LIBS="-lresolve $LIBS"], + , + -lnsl) +fi +ac_cv_func_strcasecmp="no" + +CURL_CHECK_LIBS_CONNECT + +CURL_NETWORK_LIBS=$LIBS + +dnl ********************************************************************** +dnl In case that function clock_gettime with monotonic timer is available, +dnl check for additional required libraries. +dnl ********************************************************************** +CURL_CHECK_LIBS_CLOCK_GETTIME_MONOTONIC + +dnl ********************************************************************** +dnl The preceding library checks are all potentially useful for test +dnl servers (for providing networking support). Save the list of required +dnl libraries at this point for use while linking those test servers. +dnl ********************************************************************** +TEST_SERVER_LIBS=$LIBS + +dnl ********************************************************************** +AC_MSG_CHECKING([whether to use libgcc]) +AC_ARG_ENABLE(libgcc, +AC_HELP_STRING([--enable-libgcc],[use libgcc when linking]), +[ case "$enableval" in + yes) + ALL_LIBS="$ALL_LIBS -lgcc" + AC_MSG_RESULT(yes) + ;; + *) AC_MSG_RESULT(no) + ;; + esac ], + AC_MSG_RESULT(no) +) + +dnl ********************************************************************** +dnl Check for LDAP +dnl ********************************************************************** + +LDAPLIBNAME="" +AC_ARG_WITH(ldap-lib, +AC_HELP_STRING([--with-ldap-lib=libname],[Specify name of ldap lib file]), + [LDAPLIBNAME="$withval"]) + +LBERLIBNAME="" +AC_ARG_WITH(lber-lib, +AC_HELP_STRING([--with-lber-lib=libname],[Specify name of lber lib file]), + [LBERLIBNAME="$withval"]) + +if test x$CURL_DISABLE_LDAP != x1 ; then + + CURL_CHECK_HEADER_LBER + CURL_CHECK_HEADER_LDAP + CURL_CHECK_HEADER_LDAPSSL + CURL_CHECK_HEADER_LDAP_SSL + + if test -z "$LDAPLIBNAME" ; then + if test "$ac_cv_native_windows" = "yes"; then + dnl Windows uses a single and unique LDAP library name + LDAPLIBNAME="wldap32" + LBERLIBNAME="no" + fi + fi + + if test "$LDAPLIBNAME" ; then + AC_CHECK_LIB("$LDAPLIBNAME", ldap_init,, [ + AC_MSG_WARN(["$LDAPLIBNAME" is not an LDAP library: LDAP disabled]) + AC_DEFINE(CURL_DISABLE_LDAP, 1, [to disable LDAP]) + AC_SUBST(CURL_DISABLE_LDAP, [1])]) + AC_DEFINE(CURL_DISABLE_LDAPS, 1, [to disable LDAPS]) + AC_SUBST(CURL_DISABLE_LDAPS, [1]) + else + dnl Try to find the right ldap libraries for this system + CURL_CHECK_LIBS_LDAP + case X-"$curl_cv_ldap_LIBS" in + X-unknown) + AC_MSG_WARN([Cannot find libraries for LDAP support: LDAP disabled]) + AC_DEFINE(CURL_DISABLE_LDAP, 1, [to disable LDAP]) + AC_SUBST(CURL_DISABLE_LDAP, [1]) + AC_DEFINE(CURL_DISABLE_LDAPS, 1, [to disable LDAPS]) + AC_SUBST(CURL_DISABLE_LDAPS, [1]) + ;; + esac + fi +fi + +if test x$CURL_DISABLE_LDAP != x1 ; then + + if test "$LBERLIBNAME" ; then + dnl If name is "no" then don't define this library at all + dnl (it's only needed if libldap.so's dependencies are broken). + if test "$LBERLIBNAME" != "no" ; then + AC_CHECK_LIB("$LBERLIBNAME", ber_free,, [ + AC_MSG_WARN(["$LBERLIBNAME" is not an LBER library: LDAP disabled]) + AC_DEFINE(CURL_DISABLE_LDAP, 1, [to disable LDAP]) + AC_SUBST(CURL_DISABLE_LDAP, [1])]) + AC_DEFINE(CURL_DISABLE_LDAPS, 1, [to disable LDAPS]) + AC_SUBST(CURL_DISABLE_LDAPS, [1]) + fi + fi +fi + +if test x$CURL_DISABLE_LDAP != x1 ; then + AC_CHECK_FUNCS([ldap_url_parse ldap_init_fd]) + + if test "$LDAPLIBNAME" = "wldap32"; then + curl_ldap_msg="enabled (winldap)" + AC_DEFINE(CURL_LDAP_WIN, 1, [Use Windows LDAP implementation]) + else + curl_ldap_msg="enabled (OpenLDAP)" + if test "x$ac_cv_func_ldap_init_fd" = "xyes"; then + AC_DEFINE(USE_OPENLDAP, 1, [Use OpenLDAP-specific code]) + AC_SUBST(USE_OPENLDAP, [1]) + fi + fi +fi + +if test x$CURL_DISABLE_LDAPS != x1 ; then + curl_ldaps_msg="enabled" +fi + +dnl ********************************************************************** +dnl Checks for IPv6 +dnl ********************************************************************** + +AC_MSG_CHECKING([whether to enable ipv6]) +AC_ARG_ENABLE(ipv6, +AC_HELP_STRING([--enable-ipv6],[Enable ipv6 (with ipv4) support]) +AC_HELP_STRING([--disable-ipv6],[Disable ipv6 support]), +[ case "$enableval" in + no) + AC_MSG_RESULT(no) + ipv6=no + ;; + *) AC_MSG_RESULT(yes) + ipv6=yes + ;; + esac ], + + AC_TRY_RUN([ /* is AF_INET6 available? */ +#include +#include +main() +{ + if (socket(AF_INET6, SOCK_STREAM, 0) < 0) + exit(1); + else + exit(0); +} +], + AC_MSG_RESULT(yes) + ipv6=yes, + AC_MSG_RESULT(no) + ipv6=no, + AC_MSG_RESULT(no) + ipv6=no +)) + +if test "$ipv6" = "yes"; then + curl_ipv6_msg="enabled" +fi + +# Check if struct sockaddr_in6 have sin6_scope_id member +if test "$ipv6" = yes; then + AC_MSG_CHECKING([if struct sockaddr_in6 has sin6_scope_id member]) + AC_TRY_COMPILE([ +#include +#include ] , + struct sockaddr_in6 s; s.sin6_scope_id = 0; , have_sin6_scope_id=yes) + if test "$have_sin6_scope_id" = yes; then + AC_MSG_RESULT([yes]) + AC_DEFINE(HAVE_SOCKADDR_IN6_SIN6_SCOPE_ID, 1, [Define to 1 if struct sockaddr_in6 has the sin6_scope_id member]) + else + AC_MSG_RESULT([no]) + fi +fi + +dnl ********************************************************************** +dnl Check if the operating system allows programs to write to their own argv[] +dnl ********************************************************************** + +AC_MSG_CHECKING([if argv can be written to]) +AC_RUN_IFELSE([ + AC_LANG_SOURCE([[ +int main(int argc, char ** argv) { + argv[0][0] = ' '; + return (argv[0][0] == ' ')?0:1; +} + ]]) +],[ + curl_cv_writable_argv=yes +],[ + curl_cv_writable_argv=no +],[ + curl_cv_writable_argv=cross +]) +case $curl_cv_writable_argv in +yes) + AC_DEFINE(HAVE_WRITABLE_ARGV, 1, [Define this symbol if your OS supports changing the contents of argv]) + AC_MSG_RESULT(yes) + ;; +no) + AC_MSG_RESULT(no) + ;; +*) + AC_MSG_RESULT(no) + AC_MSG_WARN([the previous check could not be made default was used]) + ;; +esac + +dnl ********************************************************************** +dnl Check for the presence of Kerberos4 libraries and headers +dnl ********************************************************************** + +AC_ARG_WITH(krb4-includes, +AC_HELP_STRING([--with-krb4-includes=DIR], + [Specify location of kerberos4 headers]),[ + CPPFLAGS="$CPPFLAGS -I$withval" + KRB4INC="$withval" + want_krb4=yes + ]) + +AC_ARG_WITH(krb4-libs, +AC_HELP_STRING([--with-krb4-libs=DIR],[Specify location of kerberos4 libs]),[ + LDFLAGS="$LDFLAGS -L$withval" + KRB4LIB="$withval" + want_krb4=yes + ]) + + +OPT_KRB4=off +AC_ARG_WITH(krb4,dnl +AC_HELP_STRING([--with-krb4=DIR],[where to look for Kerberos4]),[ + OPT_KRB4="$withval" + if test X"$OPT_KRB4" != Xno; then + want_krb4="yes" + if test X"$OPT_KRB4" != Xyes; then + LDFLAGS="$LDFLAGS -L$OPT_KRB4/lib$libsuff" + KRB4LIB="$OPT_KRB4/lib$libsuff" + CPPFLAGS="$CPPFLAGS -I$OPT_KRB4/include" + KRB4INC="$OPT_KRB4/include" + fi + fi + ]) + +AC_MSG_CHECKING([if Kerberos4 support is requested]) + +if test "$want_krb4" = yes +then + if test "$ipv6" = "yes"; then + echo krb4 is not compatible with IPv6 + exit 1 + fi + AC_MSG_RESULT(yes) + + dnl Check for & handle argument to --with-krb4 + + AC_MSG_CHECKING(where to look for Kerberos4) + if test X"$OPT_KRB4" = Xyes + then + AC_MSG_RESULT([defaults]) + else + AC_MSG_RESULT([libs in $KRB4LIB, headers in $KRB4INC]) + fi + + dnl Check for DES library + AC_CHECK_LIB(des, des_pcbc_encrypt, + [ + AC_CHECK_HEADERS(des.h) + + dnl resolv lib? + AC_CHECK_FUNC(res_search, , [AC_CHECK_LIB(resolv, res_search)]) + + dnl Check for the Kerberos4 library + AC_CHECK_LIB(krb, krb_net_read, + [ + dnl Check for header files + AC_CHECK_HEADERS(krb.h) + + dnl we found the required libraries, add to LIBS + LIBS="-lkrb -lcom_err -ldes $LIBS" + + dnl Check for function krb_get_our_ip_for_realm + dnl this is needed for NAT networks + AC_CHECK_FUNCS(krb_get_our_ip_for_realm) + + dnl add define KRB4 + AC_DEFINE(HAVE_KRB4, 1, + [if you have the Kerberos4 libraries (including -ldes)]) + + dnl substitute it too! + KRB4_ENABLED=1 + AC_SUBST(KRB4_ENABLED) + + curl_krb4_msg="enabled" + + dnl the krb4 stuff needs a strlcpy() + AC_CHECK_FUNCS(strlcpy) + + ]) + ]) +else + AC_MSG_RESULT(no) +fi + +dnl ********************************************************************** +dnl Check for FBopenssl(SPNEGO) libraries +dnl ********************************************************************** + +AC_ARG_WITH(spnego, + AC_HELP_STRING([--with-spnego=DIR], + [Specify location of SPNEGO library fbopenssl]), [ + SPNEGO_ROOT="$withval" + if test x"$SPNEGO_ROOT" != xno; then + want_spnego="yes" + fi +]) + +AC_MSG_CHECKING([if SPNEGO support is requested]) +if test x"$want_spnego" = xyes; then + + if test X"$SPNEGO_ROOT" = Xyes; then + AC_MSG_ERROR([FBOpenSSL libs and/or directories were not found where specified!]) + AC_MSG_RESULT(no) + else + if test -z "$SPNEGO_LIB_DIR"; then + LDFLAGS="$LDFLAGS -L$SPNEGO_ROOT -lfbopenssl" + else + LDFLAGS="$LDFLAGS $SPNEGO_LIB_DIR" + fi + + AC_MSG_RESULT(yes) + AC_DEFINE(HAVE_SPNEGO, 1, + [Define this if you have the SPNEGO library fbopenssl]) + curl_spnego_msg="enabled" + fi +else + AC_MSG_RESULT(no) +fi + +dnl ********************************************************************** +dnl Check for GSS-API libraries +dnl ********************************************************************** + +dnl check for gss stuff in the /usr as default + +GSSAPI_ROOT="/usr" +AC_ARG_WITH(gssapi-includes, + AC_HELP_STRING([--with-gssapi-includes=DIR], + [Specify location of GSSAPI header]), + [ GSSAPI_INCS="-I$withval" + want_gss="yes" ] +) + +AC_ARG_WITH(gssapi-libs, + AC_HELP_STRING([--with-gssapi-libs=DIR], + [Specify location of GSSAPI libs]), + [ GSSAPI_LIB_DIR="-L$withval" + want_gss="yes" ] +) + +AC_ARG_WITH(gssapi, + AC_HELP_STRING([--with-gssapi=DIR], + [Where to look for GSSAPI]), [ + GSSAPI_ROOT="$withval" + if test x"$GSSAPI_ROOT" != xno; then + want_gss="yes" + if test x"$GSSAPI_ROOT" = xyes; then + dnl if yes, then use default root + GSSAPI_ROOT="/usr" + fi + fi +]) + +save_CPPFLAGS="$CPPFLAGS" +AC_MSG_CHECKING([if GSSAPI support is requested]) +if test x"$want_gss" = xyes; then + AC_MSG_RESULT(yes) + + if test -z "$GSSAPI_INCS"; then + if test -f "$GSSAPI_ROOT/bin/krb5-config"; then + GSSAPI_INCS=`$GSSAPI_ROOT/bin/krb5-config --cflags gssapi` + elif test "$GSSAPI_ROOT" != "yes"; then + GSSAPI_INCS="-I$GSSAPI_ROOT/include" + fi + fi + + CPPFLAGS="$CPPFLAGS $GSSAPI_INCS" + + AC_CHECK_HEADER(gss.h, + [ + dnl found in the given dirs + AC_DEFINE(HAVE_GSSGNU, 1, [if you have the GNU gssapi libraries]) + gnu_gss=yes + ], + [ + dnl not found, check Heimdal or MIT + AC_CHECK_HEADERS([gssapi/gssapi.h], [], [not_mit=1]) + AC_CHECK_HEADERS( + [gssapi/gssapi_generic.h gssapi/gssapi_krb5.h], + [], + [not_mit=1], + [ +AC_INCLUDES_DEFAULT +#ifdef HAVE_GSSAPI_GSSAPI_H +#include +#endif + ]) + if test "x$not_mit" = "x1"; then + dnl MIT not found, check for Heimdal + AC_CHECK_HEADER(gssapi.h, + [ + dnl found + AC_DEFINE(HAVE_GSSHEIMDAL, 1, [if you have the Heimdal gssapi libraries]) + ], + [ + dnl no header found, disabling GSS + want_gss=no + AC_MSG_WARN(disabling GSSAPI since no header files was found) + ] + ) + else + dnl MIT found + AC_DEFINE(HAVE_GSSMIT, 1, [if you have the MIT gssapi libraries]) + dnl check if we have a really old MIT kerberos (<= 1.2) + AC_MSG_CHECKING([if gssapi headers declare GSS_C_NT_HOSTBASED_SERVICE]) + AC_COMPILE_IFELSE([ + AC_LANG_PROGRAM([[ +#include +#include +#include + ]],[[ + gss_import_name( + (OM_uint32 *)0, + (gss_buffer_t)0, + GSS_C_NT_HOSTBASED_SERVICE, + (gss_name_t *)0); + ]]) + ],[ + AC_MSG_RESULT([yes]) + ],[ + AC_MSG_RESULT([no]) + AC_DEFINE(HAVE_OLD_GSSMIT, 1, + [if you have an old MIT gssapi library, lacking GSS_C_NT_HOSTBASED_SERVICE]) + ]) + fi + ] + ) +else + AC_MSG_RESULT(no) +fi +if test x"$want_gss" = xyes; then + AC_DEFINE(HAVE_GSSAPI, 1, [if you have the gssapi libraries]) + + curl_gss_msg="enabled (MIT/Heimdal)" + + if test -n "$gnu_gss"; then + curl_gss_msg="enabled (GNU GSS)" + LDFLAGS="$LDFLAGS $GSSAPI_LIB_DIR" + LIBS="$LIBS -lgss" + elif test -z "$GSSAPI_LIB_DIR"; then + case $host in + *-*-darwin*) + LIBS="$LIBS -lgssapi_krb5 -lresolv" + ;; + *) + if test -f "$GSSAPI_ROOT/bin/krb5-config"; then + dnl krb5-config doesn't have --libs-only-L or similar, put everything + dnl into LIBS + gss_libs=`$GSSAPI_ROOT/bin/krb5-config --libs gssapi` + LIBS="$LIBS $gss_libs" + elif test "$GSSAPI_ROOT" != "yes"; then + LDFLAGS="$LDFLAGS -L$GSSAPI_ROOT/lib$libsuff" + LIBS="$LIBS -lgssapi" + else + LIBS="$LIBS -lgssapi" + fi + ;; + esac + else + LDFLAGS="$LDFLAGS $GSSAPI_LIB_DIR" + LIBS="$LIBS -lgssapi" + fi +else + CPPFLAGS="$save_CPPFLAGS" +fi + +dnl ********************************************************************** +dnl Check for the presence of SSL libraries and headers +dnl ********************************************************************** + +dnl Default to compiler & linker defaults for SSL files & libraries. +OPT_SSL=off +dnl Default to no CA bundle +ca="no" +AC_ARG_WITH(ssl,dnl +AC_HELP_STRING([--with-ssl=PATH],[Where to look for OpenSSL, PATH points to the SSL installation (default: /usr/local/ssl); when possible, set the PKG_CONFIG_PATH environment variable instead of using this option]) +AC_HELP_STRING([--without-ssl], [disable OpenSSL]), + OPT_SSL=$withval) + +if test X"$OPT_SSL" != Xno; then + dnl backup the pre-ssl variables + CLEANLDFLAGS="$LDFLAGS" + CLEANCPPFLAGS="$CPPFLAGS" + CLEANLIBS="$LIBS" + + case "$OPT_SSL" in + yes) + dnl --with-ssl (without path) used + if test x$cross_compiling != xyes; then + dnl only do pkg-config magic when not cross-compiling + PKGTEST="yes" + fi + PREFIX_OPENSSL=/usr/local/ssl + LIB_OPENSSL="$PREFIX_OPENSSL/lib$libsuff" + ;; + off) + dnl no --with-ssl option given, just check default places + if test x$cross_compiling != xyes; then + dnl only do pkg-config magic when not cross-compiling + PKGTEST="yes" + fi + PREFIX_OPENSSL= + ;; + *) + dnl check the given --with-ssl spot + PKGTEST="no" + PREFIX_OPENSSL=$OPT_SSL + + dnl Try pkg-config even when cross-compiling. Since we + dnl specify PKG_CONFIG_LIBDIR we're only looking where + dnl the user told us to look + OPENSSL_PCDIR="$OPT_SSL/lib/pkgconfig" + AC_MSG_NOTICE([PKG_CONFIG_LIBDIR will be set to "$OPENSSL_PCDIR"]) + if test -e "$OPENSSL_PCDIR/openssl.pc"; then + PKGTEST="yes" + fi + + dnl in case pkg-config comes up empty, use what we got + dnl via --with-ssl + LIB_OPENSSL="$PREFIX_OPENSSL/lib$libsuff" + if test "$PREFIX_OPENSSL" != "/usr" ; then + SSL_LDFLAGS="-L$LIB_OPENSSL" + SSL_CPPFLAGS="-I$PREFIX_OPENSSL/include" + fi + SSL_CPPFLAGS="$SSL_CPPFLAGS -I$PREFIX_OPENSSL/include/openssl" + ;; + esac + + if test "$PKGTEST" = "yes"; then + + CURL_CHECK_PKGCONFIG(openssl, [$OPENSSL_PCDIR]) + + if test "$PKGCONFIG" != "no" ; then + SSL_LIBS=`CURL_EXPORT_PCDIR([$OPENSSL_PCDIR]) dnl + $PKGCONFIG --libs-only-l openssl 2>/dev/null` + + SSL_LDFLAGS=`CURL_EXPORT_PCDIR([$OPENSSL_PCDIR]) dnl + $PKGCONFIG --libs-only-L openssl 2>/dev/null` + + SSL_CPPFLAGS=`CURL_EXPORT_PCDIR([$OPENSSL_PCDIR]) dnl + $PKGCONFIG --cflags-only-I openssl 2>/dev/null` + + AC_MSG_NOTICE([pkg-config: SSL_LIBS: "$SSL_LIBS"]) + AC_MSG_NOTICE([pkg-config: SSL_LDFLAGS: "$SSL_LDFLAGS"]) + AC_MSG_NOTICE([pkg-config: SSL_CPPFLAGS: "$SSL_CPPFLAGS"]) + + LIB_OPENSSL=`echo $SSL_LDFLAGS | sed -e 's/-L//g'` + + dnl use the values pkg-config reported. This is here + dnl instead of below with CPPFLAGS and LDFLAGS because we only + dnl learn about this via pkg-config. If we only have + dnl the argument to --with-ssl we don't know what + dnl additional libs may be necessary. Hope that we + dnl don't need any. + LIBS="$LIBS $SSL_LIBS" + fi + fi + + dnl finally, set flags to use SSL + CPPFLAGS="$CPPFLAGS $SSL_CPPFLAGS" + LDFLAGS="$LDFLAGS $SSL_LDFLAGS" + + dnl This is for Msys/Mingw + case $host in + *-*-msys* | *-*-mingw*) + AC_MSG_CHECKING([for gdi32]) + my_ac_save_LIBS=$LIBS + LIBS="-lgdi32 $LIBS" + AC_TRY_LINK([#include + #include ], + [GdiFlush();], + [ dnl worked! + AC_MSG_RESULT([yes])], + [ dnl failed, restore LIBS + LIBS=$my_ac_save_LIBS + AC_MSG_RESULT(no)] + ) + ;; + esac + + AC_CHECK_LIB(crypto, CRYPTO_lock,[ + HAVECRYPTO="yes" + LIBS="-lcrypto $LIBS" + ],[ + LDFLAGS="$CLEANLDFLAGS -L$LIB_OPENSSL" + CPPFLAGS="$CLEANCPPFLAGS -I$PREFIX_OPENSSL/include/openssl -I$PREFIX_OPENSSL/include" + AC_CHECK_LIB(crypto, CRYPTO_add_lock,[ + HAVECRYPTO="yes" + LIBS="-lcrypto $LIBS"], [ + LDFLAGS="$CLEANLDFLAGS" + CPPFLAGS="$CLEANCPPFLAGS" + LIBS="$CLEANLIBS" + ]) + ]) + + + if test X"$HAVECRYPTO" = X"yes"; then + dnl This is only reasonable to do if crypto actually is there: check for + dnl SSL libs NOTE: it is important to do this AFTER the crypto lib + + AC_CHECK_LIB(ssl, SSL_connect) + + if test "$ac_cv_lib_ssl_SSL_connect" != yes; then + dnl we didn't find the SSL lib, try the RSAglue/rsaref stuff + AC_MSG_CHECKING(for ssl with RSAglue/rsaref libs in use); + OLIBS=$LIBS + LIBS="$LIBS -lRSAglue -lrsaref" + AC_CHECK_LIB(ssl, SSL_connect) + if test "$ac_cv_lib_ssl_SSL_connect" != yes; then + dnl still no SSL_connect + AC_MSG_RESULT(no) + LIBS=$OLIBS + else + AC_MSG_RESULT(yes) + fi + + else + + dnl Have the libraries--check for SSLeay/OpenSSL headers + AC_CHECK_HEADERS(openssl/x509.h openssl/rsa.h openssl/crypto.h \ + openssl/pem.h openssl/ssl.h openssl/err.h, + curl_ssl_msg="enabled (OpenSSL)" + OPENSSL_ENABLED=1 + AC_DEFINE(USE_OPENSSL, 1, [if OpenSSL is in use])) + + if test $ac_cv_header_openssl_x509_h = no; then + dnl we don't use the "action" part of the AC_CHECK_HEADERS macro + dnl since 'err.h' might in fact find a krb4 header with the same + dnl name + AC_CHECK_HEADERS(x509.h rsa.h crypto.h pem.h ssl.h err.h) + + if test $ac_cv_header_x509_h = yes && + test $ac_cv_header_crypto_h = yes && + test $ac_cv_header_ssl_h = yes; then + dnl three matches + curl_ssl_msg="enabled (OpenSSL)" + OPENSSL_ENABLED=1 + fi + fi + fi + + if test X"$OPENSSL_ENABLED" = X"1"; then + AC_DEFINE(USE_SSLEAY, 1, [if SSL is enabled]) + + dnl is there a pkcs12.h header present? + AC_CHECK_HEADERS(openssl/pkcs12.h) + else + LIBS="$CLEANLIBS" + fi + dnl USE_SSLEAY is the historical name for what configure calls + dnl OPENSSL_ENABLED; the names should really be unified + USE_SSLEAY="$OPENSSL_ENABLED" + AC_SUBST(USE_SSLEAY) + + if test X"$OPT_SSL" != Xoff && + test "$OPENSSL_ENABLED" != "1"; then + AC_MSG_ERROR([OpenSSL libs and/or directories were not found where specified!]) + fi + fi + + if test X"$OPENSSL_ENABLED" = X"1"; then + dnl If the ENGINE library seems to be around, check for the OpenSSL engine + dnl stuff, it is kind of "separated" from the main SSL check + AC_CHECK_FUNC(ENGINE_init, + [ + AC_CHECK_HEADERS(openssl/engine.h) + AC_CHECK_FUNCS( ENGINE_load_builtin_engines ) + ]) + + dnl these can only exist if openssl exists + dnl yassl doesn't have SSL_get_shutdown + + AC_CHECK_FUNCS( RAND_status \ + RAND_screen \ + RAND_egd \ + ENGINE_cleanup \ + CRYPTO_cleanup_all_ex_data \ + SSL_get_shutdown ) + + dnl Make an attempt to detect if this is actually yassl's headers and + dnl OpenSSL emulation layer. We still leave everything else believing + dnl and acting like OpenSSL. + + AC_MSG_CHECKING([for yaSSL using OpenSSL compatibility mode]) + AC_COMPILE_IFELSE([ + AC_LANG_PROGRAM([[ +#include + ]],[[ +#if defined(YASSL_VERSION) && defined(OPENSSL_VERSION_NUMBER) + int dummy = SSL_ERROR_NONE; +#else + Not the yaSSL OpenSSL compatibility header. +#endif + ]]) + ],[ + AC_MSG_RESULT([yes]) + AC_DEFINE_UNQUOTED(USE_YASSLEMUL, 1, + [Define to 1 if using yaSSL in OpenSSL compatibility mode.]) + curl_ssl_msg="enabled (OpenSSL emulation by yaSSL)" + ],[ + AC_MSG_RESULT([no]) + ]) + fi + + if test "$OPENSSL_ENABLED" = "1"; then + if test -n "$LIB_OPENSSL"; then + dnl when the ssl shared libs were found in a path that the run-time + dnl linker doesn't search through, we need to add it to LD_LIBRARY_PATH + dnl to prevent further configure tests to fail due to this + + LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$LIB_OPENSSL" + export LD_LIBRARY_PATH + AC_MSG_NOTICE([Added $LIB_OPENSSL to LD_LIBRARY_PATH]) + fi + fi + +fi + +dnl ********************************************************************** +dnl Check for the presence of ZLIB libraries and headers +dnl ********************************************************************** + +dnl Check for & handle argument to --with-zlib. + +_cppflags=$CPPFLAGS +_ldflags=$LDFLAGS +AC_ARG_WITH(zlib, +AC_HELP_STRING([--with-zlib=PATH],[search for zlib in PATH]) +AC_HELP_STRING([--without-zlib],[disable use of zlib]), + [OPT_ZLIB="$withval"]) + +if test "$OPT_ZLIB" = "no" ; then + AC_MSG_WARN([zlib disabled]) +else + if test "$OPT_ZLIB" = "yes" ; then + OPT_ZLIB="" + fi + + if test -z "$OPT_ZLIB" ; then + dnl check for the lib first without setting any new path, since many + dnl people have it in the default path + + AC_CHECK_LIB(z, inflateEnd, + dnl libz found, set the variable + [HAVE_LIBZ="1"], + dnl if no lib found, try /usr/local + [OPT_ZLIB="/usr/local"]) + + fi + + dnl Add a nonempty path to the compiler flags + if test -n "$OPT_ZLIB"; then + CPPFLAGS="$CPPFLAGS -I$OPT_ZLIB/include" + LDFLAGS="$LDFLAGS -L$OPT_ZLIB/lib$libsuff" + fi + + AC_CHECK_HEADER(zlib.h, + [ + dnl zlib.h was found + HAVE_ZLIB_H="1" + dnl if the lib wasn't found already, try again with the new paths + if test "$HAVE_LIBZ" != "1"; then + AC_CHECK_LIB(z, gzread, + [ + dnl the lib was found! + HAVE_LIBZ="1" + ], + [ CPPFLAGS=$_cppflags + LDFLAGS=$_ldflags]) + fi + ], + [ + dnl zlib.h was not found, restore the flags + CPPFLAGS=$_cppflags + LDFLAGS=$_ldflags] + ) + + if test "$HAVE_LIBZ" = "1" && test "$HAVE_ZLIB_H" != "1" + then + AC_MSG_WARN([configure found only the libz lib, not the header file!]) + HAVE_LIBZ="" + elif test "$HAVE_LIBZ" != "1" && test "$HAVE_ZLIB_H" = "1" + then + AC_MSG_WARN([configure found only the libz header file, not the lib!]) + elif test "$HAVE_LIBZ" = "1" && test "$HAVE_ZLIB_H" = "1" + then + dnl both header and lib were found! + AC_SUBST(HAVE_LIBZ) + AC_DEFINE(HAVE_ZLIB_H, 1, [if you have the zlib.h header file]) + AC_DEFINE(HAVE_LIBZ, 1, [if zlib is available]) + + CURL_LIBS="$CURL_LIBS -lz" + LIBS="$LIBS -lz" + + dnl replace 'HAVE_LIBZ' in the automake makefile.ams + AMFIXLIB="1" + AC_MSG_NOTICE([found both libz and libz.h header]) + curl_zlib_msg="enabled" + fi +fi + +dnl set variable for use in automakefile(s) +AM_CONDITIONAL(HAVE_LIBZ, test x"$AMFIXLIB" = x1) + +dnl ********************************************************************** +dnl Check for the random seed preferences +dnl ********************************************************************** + +if test X"$OPENSSL_ENABLED" = X"1"; then + AC_ARG_WITH(egd-socket, + AC_HELP_STRING([--with-egd-socket=FILE], + [Entropy Gathering Daemon socket pathname]), + [ EGD_SOCKET="$withval" ] + ) + if test -n "$EGD_SOCKET" ; then + AC_DEFINE_UNQUOTED(EGD_SOCKET, "$EGD_SOCKET", + [your Entropy Gathering Daemon socket pathname] ) + fi + + dnl Check for user-specified random device + AC_ARG_WITH(random, + AC_HELP_STRING([--with-random=FILE], + [read randomness from FILE (default=/dev/urandom)]), + [ RANDOM_FILE="$withval" ], + [ + dnl Check for random device + AC_CHECK_FILE("/dev/urandom", [ RANDOM_FILE="/dev/urandom"] ) + ] + ) + if test -n "$RANDOM_FILE" && test X"$RANDOM_FILE" != Xno ; then + AC_SUBST(RANDOM_FILE) + AC_DEFINE_UNQUOTED(RANDOM_FILE, "$RANDOM_FILE", + [a suitable file to read random data from]) + fi +fi + +dnl ---------------------------------------------------- +dnl check for GnuTLS +dnl ---------------------------------------------------- + +dnl Default to compiler & linker defaults for GnuTLS files & libraries. +OPT_GNUTLS=no + +AC_ARG_WITH(gnutls,dnl +AC_HELP_STRING([--with-gnutls=PATH],[where to look for GnuTLS, PATH points to the installation root (default: /usr/local/)]) +AC_HELP_STRING([--without-gnutls], [disable GnuTLS detection]), + OPT_GNUTLS=$withval) + +if test "$OPENSSL_ENABLED" != "1"; then + + if test X"$OPT_GNUTLS" != Xno; then + + addld="" + if test "x$OPT_GNUTLS" = "xyes"; then + dnl this is with no partiular path given + CURL_CHECK_PKGCONFIG(gnutls) + + if test "$PKGCONFIG" != "no" ; then + addlib=`$PKGCONFIG --libs-only-l gnutls` + addld=`$PKGCONFIG --libs-only-L gnutls` + addcflags=`$PKGCONFIG --cflags-only-I gnutls` + version=`$PKGCONFIG --modversion gnutls` + gtlslib=`echo $addld | $SED -e 's/-L//'` + else + dnl without pkg-config, we try libgnutls-config as that was how it + dnl used to be done + check=`libgnutls-config --version 2>/dev/null` + if test -n "$check"; then + addlib=`libgnutls-config --libs` + addcflags=`libgnutls-config --cflags` + version=`libgnutls-config --version` + gtlslib=`libgnutls-config --prefix`/lib$libsuff + fi + fi + else + dnl this is with a given path, first check if there's a libgnutls-config + dnl there and if not, make an educated guess + cfg=$OPT_GNUTLS/bin/libgnutls-config + check=`$cfg --version 2>/dev/null` + if test -n "$check"; then + addlib=`$cfg --libs` + addcflags=`$cfg --cflags` + version=`$cfg --version` + gtlslib=`$cfg --prefix`/lib$libsuff + else + dnl without pkg-config and libgnutls-config, we guess a lot! + addlib=-lgnutls + addld=-L$OPT_GNUTLS/lib$libsuff + addcflags=-I$OPT_GNUTLS/include + version="" # we just don't know + gtlslib=$OPT_GNUTLS/lib$libsuff + fi + fi + + if test -z "$version"; then + dnl lots of efforts, still no go + version="unknown" + fi + + if test -n "$addlib"; then + + CLEANLIBS="$LIBS" + CLEANCPPFLAGS="$CPPFLAGS" + CLEADLDFLAGS="$LDFLAGS" + + LIBS="$LIBS $addlib" + LDFLAGS="$LDFLAGS $addld" + if test "$addcflags" != "-I/usr/include"; then + CPPFLAGS="$CPPFLAGS $addcflags" + fi + + AC_CHECK_LIB(gnutls, gnutls_check_version, + [ + AC_DEFINE(USE_GNUTLS, 1, [if GnuTLS is enabled]) + AC_SUBST(USE_GNUTLS, [1]) + GNUTLS_ENABLED=1 + USE_GNUTLS="yes" + curl_ssl_msg="enabled (GnuTLS)" + ], + [ + LIBS="$CLEANLIBS" + CPPFLAGS="$CLEANCPPFLAGS" + ]) + + if test "x$USE_GNUTLS" = "xyes"; then + AC_MSG_NOTICE([detected GnuTLS version $version]) + + if test -n "$gtlslib"; then + dnl when shared libs were found in a path that the run-time + dnl linker doesn't search through, we need to add it to + dnl LD_LIBRARY_PATH to prevent further configure tests to fail + dnl due to this + + LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$gtlslib" + export LD_LIBRARY_PATH + AC_MSG_NOTICE([Added $gtlslib to LD_LIBRARY_PATH]) + fi + fi + + fi + + fi dnl GNUTLS not disabled + +fi dnl OPENSSL != 1 + +dnl --- +dnl If GnuTLS is enabled, we MUST verify that it uses libgcrypt since +dnl curl code relies on that but recent GnuTLS versions can in fact build +dnl with different crypto libraries which curl right now cannot handle +dnl --- + +if test "$GNUTLS_ENABLED" = "1"; then + AC_CHECK_LIB(gcrypt, + gcry_control, , + [ + AC_MSG_ERROR([need GnuTLS built with gcrypt to function with GnuTLS]) + ]) +fi + +dnl ---------------------------------------------------- +dnl check for PolarSSL +dnl ---------------------------------------------------- + +dnl Default to compiler & linker defaults for PolarSSL files & libraries. +OPT_POLARSSL=no + +_cppflags=$CPPFLAGS +_ldflags=$LDFLAGS +AC_ARG_WITH(polarssl,dnl +AC_HELP_STRING([--with-polarssl=PATH],[where to look for PolarSSL, PATH points to the installation root (default: /usr/local/)]) +AC_HELP_STRING([--without-polarssl], [disable PolarSSL detection]), + OPT_POLARSSL=$withval) + +if test "$OPENSSL_ENABLED" != "1"; then + + if test X"$OPT_POLARSSL" != Xno; then + + if test "$OPT_POLARSSL" = "yes"; then + OPT_POLARSSL="" + fi + + if test -z "$OPT_POLARSSL" ; then + dnl check for lib first without setting any new path + + AC_CHECK_LIB(polarssl, havege_init, + dnl libpolarssl found, set the variable + [ + AC_DEFINE(USE_POLARSSL, 1, [if PolarSSL is enabled]) + AC_SUBST(USE_POLARSSL, [1]) + POLARSSL_ENABLED=1 + USE_POLARSSL="yes" + curl_ssl_msg="enabled (PolarSSL)" + ]) + fi + + if test "x$USE_POLARSSL" != "xyes"; then + dnl add the path and test again + addld=-L$OPT_POLARSSL/lib$libsuff + addcflags=-I$OPT_POLARSSL/include + polarssllib=$OPT_POLARSSL/lib$libsuff + + LDFLAGS="$LDFLAGS $addld" + if test "$addcflags" != "-I/usr/include"; then + CPPFLAGS="$CPPFLAGS $addcflags" + fi + + AC_CHECK_LIB(polarssl, ssl_init, + [ + AC_DEFINE(USE_POLARSSL, 1, [if PolarSSL is enabled]) + AC_SUBST(USE_POLARSSL, [1]) + POLARSSL_ENABLED=1 + USE_POLARSSL="yes" + curl_ssl_msg="enabled (PolarSSL)" + ], + [ + CPPFLAGS=$_cppflags + LDFLAGS=$_ldflags + ]) + fi + + if test "x$USE_POLARSSL" = "xyes"; then + AC_MSG_NOTICE([detected PolarSSL]) + + CURL_LIBS="$CURL_LIBS -lpolarssl" + LIBS="$LIBS -lpolarssl" + + if test -n "$polarssllib"; then + dnl when shared libs were found in a path that the run-time + dnl linker doesn't search through, we need to add it to + dnl LD_LIBRARY_PATH to prevent further configure tests to fail + dnl due to this + + LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$polarssllib" + export LD_LIBRARY_PATH + AC_MSG_NOTICE([Added $polarssllib to LD_LIBRARY_PATH]) + fi + + fi + + fi dnl PolarSSL not disabled + +fi dnl OPENSSL != 1 + +dnl ---------------------------------------------------- +dnl NSS. Only check if GnuTLS and OpenSSL are not enabled +dnl ---------------------------------------------------- + +dnl Default to compiler & linker defaults for NSS files & libraries. +OPT_NSS=no + +AC_ARG_WITH(nss,dnl +AC_HELP_STRING([--with-nss=PATH],[where to look for NSS, PATH points to the installation root (default: /usr/local/)]) +AC_HELP_STRING([--without-nss], [disable NSS detection]), + OPT_NSS=$withval) + +if test "$OPENSSL_ENABLED" != "1" -a "$GNUTLS_ENABLED" != "1"; then + + if test X"$OPT_NSS" != Xno; then + if test "x$OPT_NSS" = "xyes"; then + + CURL_CHECK_PKGCONFIG(nss) + + if test "$PKGCONFIG" != "no" ; then + addlib=`$PKGCONFIG --libs nss` + addcflags=`$PKGCONFIG --cflags nss` + version=`$PKGCONFIG --modversion nss` + nssprefix=`$PKGCONFIG --variable=prefix nss` + else + dnl Without pkg-config, we check for nss-config + + check=`nss-config --version 2>/dev/null` + if test -n "$check"; then + addlib=`nss-config --libs` + addcflags=`nss-config --cflags` + version=`nss-config --version` + nssprefix=`nss-config --prefix` + else + addlib="-lnss3" + addcflags="" + version="unknown" + fi + fi + else + # Without pkg-config, we'll kludge in some defaults + addlib="-L$OPT_NSS/lib -lssl3 -lsmime3 -lnss3 -lplds4 -lplc4 -lnspr4 -lpthread -ldl" + addcflags="-I$OPT_NSS/include" + version="unknown" + nssprefix=$OPT_NSS + fi + + dnl Check for functionPK11_CreateGenericObject + dnl this is needed for using the PEM PKCS#11 module + AC_CHECK_LIB(nss3, PK11_CreateGenericObject, + [ + AC_DEFINE(HAVE_PK11_CREATEGENERICOBJECT, 1, [if you have the function PK11_CreateGenericObject]) + AC_SUBST(HAVE_PK11_CREATEGENERICOBJECT, [1]) + ]) + if test -n "$addlib"; then + + CLEANLIBS="$LIBS" + CLEANCPPFLAGS="$CPPFLAGS" + + LIBS="$LIBS $addlib" + if test "$addcflags" != "-I/usr/include"; then + CPPFLAGS="$CPPFLAGS $addcflags" + fi + + AC_CHECK_LIB(nss3, NSS_Initialize, + [ + AC_DEFINE(USE_NSS, 1, [if NSS is enabled]) + AC_SUBST(USE_NSS, [1]) + USE_NSS="yes" + NSS_ENABLED=1 + curl_ssl_msg="enabled (NSS)" + ], + [ + LIBS="$CLEANLIBS" + CPPFLAGS="$CLEANCPPFLAGS" + ]) + + if test "x$USE_NSS" = "xyes"; then + AC_MSG_NOTICE([detected NSS version $version]) + + dnl when shared libs were found in a path that the run-time + dnl linker doesn't search through, we need to add it to + dnl LD_LIBRARY_PATH to prevent further configure tests to fail + dnl due to this + + LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$nssprefix/lib$libsuff" + export LD_LIBRARY_PATH + AC_MSG_NOTICE([Added $nssprefix/lib$libsuff to LD_LIBRARY_PATH]) + fi + + fi + + fi dnl NSS not disabled + +fi dnl OPENSSL != 1 -a GNUTLS_ENABLED != 1 + +if test "x$OPENSSL_ENABLED$GNUTLS_ENABLED$NSS_ENABLED$POLARSSL_ENABLED" = "x"; then + AC_MSG_WARN([SSL disabled, you will not be able to use HTTPS, FTPS, NTLM and more.]) + AC_MSG_WARN([Use --with-ssl, --with-gnutls, --with-polarssl or --with-nss to address this.]) +else + # SSL is enabled, genericly + AC_SUBST(SSL_ENABLED) + SSL_ENABLED="1" +fi + +dnl ********************************************************************** +dnl Check for the CA bundle +dnl ********************************************************************** + +CURL_CHECK_CA_BUNDLE + +dnl ********************************************************************** +dnl Check for the presence of LIBSSH2 libraries and headers +dnl ********************************************************************** + +dnl Default to compiler & linker defaults for LIBSSH2 files & libraries. +OPT_LIBSSH2=off +AC_ARG_WITH(libssh2,dnl +AC_HELP_STRING([--with-libssh2=PATH],[Where to look for libssh2, PATH points to the LIBSSH2 installation (default: /usr/local/lib); when possible, set the PKG_CONFIG_PATH environment variable instead of using this option]) +AC_HELP_STRING([--without-libssh2], [disable LIBSSH2]), + OPT_LIBSSH2=$withval) + +if test X"$OPT_LIBSSH2" != Xno; then + dnl backup the pre-libssh2 variables + CLEANLDFLAGS="$LDFLAGS" + CLEANCPPFLAGS="$CPPFLAGS" + CLEANLIBS="$LIBS" + + case "$OPT_LIBSSH2" in + yes) + dnl --with-libssh2 (without path) used + CURL_CHECK_PKGCONFIG(libssh2) + + if test "$PKGCONFIG" != "no" ; then + LIB_SSH2=`$PKGCONFIG --libs-only-l libssh2` + LD_SSH2=`$PKGCONFIG --libs-only-L libssh2` + CPP_SSH2=`$PKGCONFIG --cflags-only-I libssh2` + version=`$PKGCONFIG --modversion libssh2` + DIR_SSH2=`echo $LD_SSH2 | $SED -e 's/-L//'` + fi + + ;; + off) + dnl no --with-libssh2 option given, just check default places + ;; + *) + dnl use the given --with-libssh2 spot + PREFIX_SSH2=$OPT_LIBSSH2 + ;; + esac + + dnl if given with a prefix, we set -L and -I based on that + if test -n "$PREFIX_SSH2"; then + LD_SSH2=-L${PREFIX_SSH2}/lib$libsuff + CPP_SSH2=-I${PREFIX_SSH2}/include + DIR_SSH2=${PREFIX_SSH2}/lib$libsuff + fi + + LDFLAGS="$LDFLAGS $LD_SSH2" + CPPFLAGS="$CPPFLAGS $CPP_SSH2" + LIBS="$LIBS $LIB_SSH2" + + AC_CHECK_LIB(ssh2, libssh2_channel_open_ex) + + AC_CHECK_HEADERS(libssh2.h, + curl_ssh_msg="enabled (libSSH2)" + LIBSSH2_ENABLED=1 + AC_DEFINE(USE_LIBSSH2, 1, [if libSSH2 is in use]) + AC_SUBST(USE_LIBSSH2, [1]) + ) + + if test X"$OPT_LIBSSH2" != Xoff && + test "$LIBSSH2_ENABLED" != "1"; then + AC_MSG_ERROR([libSSH2 libs and/or directories were not found where specified!]) + fi + + if test "$LIBSSH2_ENABLED" = "1"; then + if test -n "$DIR_SSH2"; then + dnl when the libssh2 shared libs were found in a path that the run-time + dnl linker doesn't search through, we need to add it to LD_LIBRARY_PATH + dnl to prevent further configure tests to fail due to this + + dnl libssh2_version is a post 1.0 addition + dnl libssh2_init and libssh2_exit were added in 1.2.5 + dnl libssh2_scp_send64 was added in 1.2.6 + dnl libssh2_session_handshake was added in 1.2.8 + AC_CHECK_FUNCS( libssh2_version libssh2_init libssh2_exit \ + libssh2_scp_send64 libssh2_session_handshake) + + LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$DIR_SSH2" + export LD_LIBRARY_PATH + AC_MSG_NOTICE([Added $DIR_SSH2 to LD_LIBRARY_PATH]) + fi + else + dnl no libssh2, revert back to clean variables + LDFLAGS=$CLEANLDFLAGS + CPPFLAGS=$CLEANCPPFLAGS + LIBS=$CLEANLIBS + fi +fi + +dnl ********************************************************************** +dnl Check for the presence of LIBRTMP libraries and headers +dnl ********************************************************************** + +dnl Default to compiler & linker defaults for LIBRTMP files & libraries. +OPT_LIBRTMP=off +AC_ARG_WITH(librtmp,dnl +AC_HELP_STRING([--with-librtmp=PATH],[Where to look for librtmp, PATH points to the LIBRTMP installation (default: /usr/local/lib); when possible, set the PKG_CONFIG_PATH environment variable instead of using this option]) +AC_HELP_STRING([--without-librtmp], [disable LIBRTMP]), + OPT_LIBRTMP=$withval) + +if test X"$OPT_LIBRTMP" != Xno; then + dnl backup the pre-librtmp variables + CLEANLDFLAGS="$LDFLAGS" + CLEANCPPFLAGS="$CPPFLAGS" + CLEANLIBS="$LIBS" + + case "$OPT_LIBRTMP" in + yes) + dnl --with-librtmp (without path) used + CURL_CHECK_PKGCONFIG(librtmp) + + if test "$PKGCONFIG" != "no" ; then + LIB_RTMP=`$PKGCONFIG --libs-only-l librtmp` + LD_RTMP=`$PKGCONFIG --libs-only-L librtmp` + CPP_RTMP=`$PKGCONFIG --cflags-only-I librtmp` + version=`$PKGCONFIG --modversion librtmp` + DIR_RTMP=`echo $LD_RTMP | $SED -e 's/-L//'` + else + dnl To avoid link errors, we do not allow --librtmp without + dnl a pkgconfig file + AC_MSG_ERROR([--librtmp was specified but could not find librtmp pkgconfig file.]) + fi + + ;; + off) + dnl no --with-librtmp option given, just check default places + LIB_RTMP="-lrtmp" + ;; + *) + dnl use the given --with-librtmp spot + PREFIX_RTMP=$OPT_LIBRTMP + ;; + esac + + dnl if given with a prefix, we set -L and -I based on that + if test -n "$PREFIX_RTMP"; then + LD_RTMP=-L${PREFIX_RTMP}/lib$libsuff + CPP_RTMP=-I${PREFIX_RTMP}/include + DIR_RTMP=${PREFIX_RTMP}/lib$libsuff + fi + + LDFLAGS="$LDFLAGS $LD_RTMP" + CPPFLAGS="$CPPFLAGS $CPP_RTMP" + LIBS="$LIBS $LIB_RTMP" + + AC_CHECK_LIB(rtmp, RTMP_Init, + [ + AC_CHECK_HEADERS(librtmp/rtmp.h, + curl_rtmp_msg="enabled (librtmp)" + LIBRTMP_ENABLED=1 + AC_DEFINE(USE_LIBRTMP, 1, [if librtmp is in use]) + AC_SUBST(USE_LIBRTMP, [1]) + ) + ], + dnl not found, revert back to clean variables + LDFLAGS=$CLEANLDFLAGS + CPPFLAGS=$CLEANCPPFLAGS + LIBS=$CLEANLIBS + ) + + if test X"$OPT_LIBRTMP" != Xoff && + test "$LIBRTMP_ENABLED" != "1"; then + AC_MSG_ERROR([librtmp libs and/or directories were not found where specified!]) + fi + +fi + +dnl ********************************************************************** +dnl Check for the presence of IDN libraries and headers +dnl ********************************************************************** + +AC_MSG_CHECKING([whether to build with libidn]) +AC_ARG_WITH(libidn, +AC_HELP_STRING([--with-libidn=PATH],[Enable libidn usage]) +AC_HELP_STRING([--without-libidn],[Disable libidn usage]), + [LIBIDN="$withval"]) + +case "$LIBIDN" in + no) + AC_MSG_RESULT(no) + ;; + *) AC_MSG_RESULT(yes) + + idn="" + dnl if there is a given path, check that FIRST + if test -n "$LIBIDN"; then + if test "x$LIBIDN" != "xyes"; then + oldLDFLAGS=$LDFLAGS + oldCPPFLAGS=$CPPFLAGS + LDFLAGS="$LDFLAGS -L$LIBIDN/lib" + CPPFLAGS="$CPPFLAGS -I$LIBIDN/include" + idn="yes" + AC_CHECK_LIB(idn, idna_to_ascii_4i, , + idn="" + LDFLAGS=$oldLDFLAGS + CPPFLAGS=$oldCPPFLAGS) + fi + fi + + if test "x$idn" != "xyes"; then + dnl check with default paths + idn="yes" + AC_CHECK_LIB(idn, idna_to_ascii_lz, , + idn="") + fi + + if test "x$idn" = "xyes"; then + curl_idn_msg="enabled" + AC_SUBST(IDN_ENABLED, [1]) + dnl different versions of libidn have different setups of these: + AC_CHECK_FUNCS( idn_free idna_strerror tld_strerror) + AC_CHECK_HEADERS( idn-free.h tld.h ) + fi + + ;; +esac + + +dnl Let's hope this split URL remains working: +dnl http://publibn.boulder.ibm.com/doc_link/en_US/a_doc_lib/aixprggd/ \ +dnl genprogc/thread_quick_ref.htm + + +dnl ********************************************************************** +dnl Back to "normal" configuring +dnl ********************************************************************** + +dnl Checks for header files. +AC_HEADER_STDC + +CURL_CHECK_HEADER_MALLOC +CURL_CHECK_HEADER_MEMORY + +dnl Now check for the very most basic headers. Then we can use these +dnl ones as default-headers when checking for the rest! +AC_CHECK_HEADERS( + sys/types.h \ + sys/time.h \ + sys/select.h \ + sys/socket.h \ + sys/ioctl.h \ + sys/uio.h \ + assert.h \ + unistd.h \ + stdlib.h \ + limits.h \ + arpa/inet.h \ + net/if.h \ + netinet/in.h \ + sys/un.h \ + netinet/tcp.h \ + netdb.h \ + sys/sockio.h \ + sys/stat.h \ + sys/param.h \ + termios.h \ + termio.h \ + sgtty.h \ + fcntl.h \ + alloca.h \ + time.h \ + io.h \ + pwd.h \ + utime.h \ + sys/utime.h \ + sys/poll.h \ + poll.h \ + socket.h \ + sys/resource.h \ + libgen.h \ + locale.h \ + errno.h \ + stdbool.h \ + arpa/tftp.h \ + sys/filio.h \ + setjmp.h, +dnl to do if not found +[], +dnl to do if found +[], +dnl default includes +[ +#ifdef HAVE_SYS_TYPES_H +#include +#endif +#ifdef HAVE_SYS_TIME_H +#include +#endif +#ifdef HAVE_SYS_SELECT_H +#include +#endif +#ifdef HAVE_SYS_SOCKET_H +#include +#endif +#ifdef HAVE_NETINET_IN_H +#include +#endif +#ifdef HAVE_SYS_UN_H +#include +#endif +] +) + +dnl Checks for typedefs, structures, and compiler characteristics. +AC_C_CONST +CURL_CHECK_VARIADIC_MACROS +AC_TYPE_SIZE_T +AC_HEADER_TIME +CURL_CHECK_STRUCT_TIMEVAL +CURL_VERIFY_RUNTIMELIBS + +AC_CHECK_SIZEOF(size_t) +AC_CHECK_SIZEOF(long) +AC_CHECK_SIZEOF(int) +AC_CHECK_SIZEOF(short) +CURL_CONFIGURE_LONG +AC_CHECK_SIZEOF(time_t) +AC_CHECK_SIZEOF(off_t) + +soname_bump=no +if test x"$ac_cv_native_windows" != "xyes" && + test $ac_cv_sizeof_off_t -ne $curl_sizeof_curl_off_t; then + AC_MSG_WARN([This libcurl built is probably not ABI compatible with previous]) + AC_MSG_WARN([builds! You MUST read lib/README.curl_off_t to figure it out.]) + soname_bump=yes +fi + + +AC_CHECK_TYPE(long long, + [AC_DEFINE(HAVE_LONGLONG, 1, + [Define to 1 if the compiler supports the 'long long' data type.])] + longlong="yes" +) + +if test "xyes" = "x$longlong"; then + AC_MSG_CHECKING([if numberLL works]) + AC_COMPILE_IFELSE([ + AC_LANG_PROGRAM([[ + ]],[[ + long long val = 1000LL; + ]]) + ],[ + AC_MSG_RESULT([yes]) + AC_DEFINE(HAVE_LL, 1, [if your compiler supports LL]) + ],[ + AC_MSG_RESULT([no]) + ]) +fi + + +# check for ssize_t +AC_CHECK_TYPE(ssize_t, , + AC_DEFINE(ssize_t, int, [the signed version of size_t])) + +# check for bool type +AC_CHECK_TYPE([bool],[ + AC_DEFINE(HAVE_BOOL_T, 1, + [Define to 1 if bool is an available type.]) +], ,[ +#ifdef HAVE_SYS_TYPES_H +#include +#endif +#ifdef HAVE_STDBOOL_H +#include +#endif +]) + +CURL_CONFIGURE_CURL_SOCKLEN_T + +TYPE_IN_ADDR_T + +TYPE_SOCKADDR_STORAGE + +TYPE_SIG_ATOMIC_T + +AC_TYPE_SIGNAL + +CURL_CHECK_FUNC_SELECT + +CURL_CHECK_FUNC_RECV +CURL_CHECK_FUNC_RECVFROM +CURL_CHECK_FUNC_SEND +CURL_CHECK_MSG_NOSIGNAL + +CURL_CHECK_FUNC_ALARM +CURL_CHECK_FUNC_BASENAME +CURL_CHECK_FUNC_CLOSESOCKET +CURL_CHECK_FUNC_CLOSESOCKET_CAMEL +CURL_CHECK_FUNC_CONNECT +CURL_CHECK_FUNC_FCNTL +CURL_CHECK_FUNC_FDOPEN +CURL_CHECK_FUNC_FREEADDRINFO +CURL_CHECK_FUNC_FREEIFADDRS +CURL_CHECK_FUNC_FSETXATTR +CURL_CHECK_FUNC_FTRUNCATE +CURL_CHECK_FUNC_GETADDRINFO +CURL_CHECK_FUNC_GETHOSTBYADDR +CURL_CHECK_FUNC_GETHOSTBYADDR_R +CURL_CHECK_FUNC_GETHOSTBYNAME +CURL_CHECK_FUNC_GETHOSTBYNAME_R +CURL_CHECK_FUNC_GETHOSTNAME +CURL_CHECK_FUNC_GETIFADDRS +CURL_CHECK_FUNC_GETSERVBYPORT_R +CURL_CHECK_FUNC_GMTIME_R +CURL_CHECK_FUNC_INET_NTOA_R +CURL_CHECK_FUNC_INET_NTOP +CURL_CHECK_FUNC_INET_PTON +CURL_CHECK_FUNC_IOCTL +CURL_CHECK_FUNC_IOCTLSOCKET +CURL_CHECK_FUNC_IOCTLSOCKET_CAMEL +CURL_CHECK_FUNC_LOCALTIME_R +CURL_CHECK_FUNC_MEMRCHR +CURL_CHECK_FUNC_POLL +CURL_CHECK_FUNC_SETSOCKOPT +CURL_CHECK_FUNC_SIGACTION +CURL_CHECK_FUNC_SIGINTERRUPT +CURL_CHECK_FUNC_SIGNAL +CURL_CHECK_FUNC_SIGSETJMP +CURL_CHECK_FUNC_SOCKET +CURL_CHECK_FUNC_STRCASECMP +CURL_CHECK_FUNC_STRCASESTR +CURL_CHECK_FUNC_STRCMPI +CURL_CHECK_FUNC_STRDUP +CURL_CHECK_FUNC_STRERROR_R +CURL_CHECK_FUNC_STRICMP +CURL_CHECK_FUNC_STRLCAT +CURL_CHECK_FUNC_STRNCASECMP +CURL_CHECK_FUNC_STRNCMPI +CURL_CHECK_FUNC_STRNICMP +CURL_CHECK_FUNC_STRSTR +CURL_CHECK_FUNC_STRTOK_R +CURL_CHECK_FUNC_STRTOLL +CURL_CHECK_FUNC_WRITEV + +case $host in + *msdosdjgpp) + ac_cv_func_pipe=no + skipcheck_pipe=yes + AC_MSG_NOTICE([skip check for pipe on msdosdjgpp]) + ;; +esac + +AC_CHECK_FUNCS([fork \ + geteuid \ + getpass_r \ + getppid \ + getprotobyname \ + getpwuid \ + getrlimit \ + gettimeofday \ + inet_addr \ + perror \ + pipe \ + setlocale \ + setmode \ + setrlimit \ + uname \ + utime +],[ +],[ + func="$ac_func" + eval skipcheck=\$skipcheck_$func + if test "x$skipcheck" != "xyes"; then + AC_MSG_CHECKING([deeper for $func]) + AC_LINK_IFELSE([ + AC_LANG_PROGRAM([[ + ]],[[ + $func (); + ]]) + ],[ + AC_MSG_RESULT([yes]) + eval "ac_cv_func_$func=yes" + AC_DEFINE_UNQUOTED(AS_TR_CPP([HAVE_$func]), [1], + [Define to 1 if you have the $func function.]) + ],[ + AC_MSG_RESULT([but still no]) + ]) + fi +]) + +dnl Check if the getnameinfo function is available +dnl and get the types of five of its arguments. +CURL_CHECK_FUNC_GETNAMEINFO + +if test "$ipv6" = "yes"; then + if test "$ac_cv_func_getaddrinfo" = "yes"; then + AC_DEFINE(ENABLE_IPV6, 1, [Define if you want to enable IPv6 support]) + IPV6_ENABLED=1 + AC_SUBST(IPV6_ENABLED) + fi + CURL_CHECK_NI_WITHSCOPEID +fi + +dnl ************************************************************ +dnl enable non-blocking communications +dnl +CURL_CHECK_OPTION_NONBLOCKING +CURL_CHECK_NONBLOCKING_SOCKET + +dnl ************************************************************ +dnl nroff tool stuff +dnl + +AC_PATH_PROG( PERL, perl, , + $PATH:/usr/local/bin/perl:/usr/bin/:/usr/local/bin ) +AC_SUBST(PERL) + +AC_PATH_PROGS( NROFF, gnroff nroff, , + $PATH:/usr/bin/:/usr/local/bin ) +AC_SUBST(NROFF) + +if test -n "$NROFF"; then + dnl only check for nroff options if an nroff command was found + + AC_MSG_CHECKING([how to use *nroff to get plain text from man pages]) + MANOPT="-man" + mancheck=`echo foo | $NROFF $MANOPT 2>/dev/null` + if test -z "$mancheck"; then + MANOPT="-mandoc" + mancheck=`echo foo | $NROFF $MANOPT 2>/dev/null` + if test -z "$mancheck"; then + MANOPT="" + AC_MSG_RESULT([failed]) + AC_MSG_WARN([found no *nroff option to get plaintext from man pages]) + else + AC_MSG_RESULT([$MANOPT]) + fi + else + AC_MSG_RESULT([$MANOPT]) + fi + AC_SUBST(MANOPT) +fi + +if test -z "$MANOPT" +then + dnl if no nroff tool was found, or no option that could convert man pages + dnl was found, then disable the built-in manual stuff + AC_MSG_WARN([disabling built-in manual]) + USE_MANUAL="no"; +fi + +dnl ************************************************************************* +dnl If the manual variable still is set, then we go with providing a built-in +dnl manual + +if test "$USE_MANUAL" = "1"; then + AC_DEFINE(USE_MANUAL, 1, [If you want to build curl with the built-in manual]) + curl_manual_msg="enabled" +fi + +dnl set variable for use in automakefile(s) +AM_CONDITIONAL(USE_MANUAL, test x"$USE_MANUAL" = x1) + +CURL_CHECK_LIB_ARES +AM_CONDITIONAL(USE_EMBEDDED_ARES, test x$embedded_ares = xyes) + +if test "x$enable_shared" = "xyes"; then + build_libhostname=yes +else + build_libhostname=no +fi +AM_CONDITIONAL(BUILD_LIBHOSTNAME, test x$build_libhostname = xyes) + +CURL_CHECK_OPTION_THREADED_RESOLVER + +if test "x$want_thres" = xyes && test "x$want_ares" = xyes; then + AC_MSG_ERROR( +[Options --enable-threaded-resolver and --enable-ares are mutually exclusive]) +fi + +if test "$want_thres" = "yes"; then + AC_CHECK_HEADER(pthread.h, + [ AC_DEFINE(HAVE_PTHREAD_H, 1, [if you have ]) + save_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS -pthread" + AC_CHECK_LIB(pthread, pthread_create, + [ AC_MSG_NOTICE([using POSIX threaded DNS lookup]) + AC_DEFINE(USE_THREADS_POSIX, 1, [if you want POSIX threaded DNS lookup]) + USE_THREADS_POSIX=1 + curl_res_msg="threaded" + ], + [ CFLAGS="$save_CFLAGS"]) + ]) +fi + +dnl ************************************************************ +dnl disable verbose text strings +dnl +AC_MSG_CHECKING([whether to enable verbose strings]) +AC_ARG_ENABLE(verbose, +AC_HELP_STRING([--enable-verbose],[Enable verbose strings]) +AC_HELP_STRING([--disable-verbose],[Disable verbose strings]), +[ case "$enableval" in + no) + AC_MSG_RESULT(no) + AC_DEFINE(CURL_DISABLE_VERBOSE_STRINGS, 1, [to disable verbose strings]) + curl_verbose_msg="no" + ;; + *) AC_MSG_RESULT(yes) + ;; + esac ], + AC_MSG_RESULT(yes) +) + +dnl ************************************************************ +dnl enable SSPI support +dnl +AC_MSG_CHECKING([whether to enable SSPI support (Windows native builds only)]) +AC_ARG_ENABLE(sspi, +AC_HELP_STRING([--enable-sspi],[Enable SSPI]) +AC_HELP_STRING([--disable-sspi],[Disable SSPI]), +[ case "$enableval" in + yes) + if test "$ac_cv_native_windows" = "yes"; then + AC_MSG_RESULT(yes) + AC_DEFINE(USE_WINDOWS_SSPI, 1, [to enable SSPI support]) + AC_SUBST(USE_WINDOWS_SSPI, [1]) + curl_sspi_msg="enabled" + else + AC_MSG_RESULT(no) + AC_MSG_WARN([--enable-sspi Ignored. Only supported on native Windows builds.]) + fi + ;; + *) + AC_MSG_RESULT(no) + ;; + esac ], + AC_MSG_RESULT(no) +) + +dnl ************************************************************ +dnl disable cryptographic authentication +dnl +AC_MSG_CHECKING([whether to enable cryptographic authentication methods]) +AC_ARG_ENABLE(crypto-auth, +AC_HELP_STRING([--enable-crypto-auth],[Enable cryptographic authentication]) +AC_HELP_STRING([--disable-crypto-auth],[Disable cryptographic authentication]), +[ case "$enableval" in + no) + AC_MSG_RESULT(no) + AC_DEFINE(CURL_DISABLE_CRYPTO_AUTH, 1, [to disable cryptographic authentication]) + ;; + *) AC_MSG_RESULT(yes) + ;; + esac ], + AC_MSG_RESULT(yes) +) + +dnl ************************************************************ +dnl disable cookies support +dnl +AC_MSG_CHECKING([whether to enable support for cookies]) +AC_ARG_ENABLE(cookies, +AC_HELP_STRING([--enable-cookies],[Enable cookies support]) +AC_HELP_STRING([--disable-cookies],[Disable cookies support]), +[ case "$enableval" in + no) + AC_MSG_RESULT(no) + AC_DEFINE(CURL_DISABLE_COOKIES, 1, [to disable cookies support]) + ;; + *) AC_MSG_RESULT(yes) + ;; + esac ], + AC_MSG_RESULT(yes) +) + +dnl ************************************************************ +dnl Enable hiding of internal symbols in library to reduce its size and +dnl speed dynamic linking of applications. This currently is only supported +dnl on gcc >= 4.0 and SunPro C. +dnl +AC_MSG_CHECKING([whether to enable hidden symbols in the library]) +AC_ARG_ENABLE(hidden-symbols, +AC_HELP_STRING([--enable-hidden-symbols],[Hide internal symbols in library]) +AC_HELP_STRING([--disable-hidden-symbols],[Leave all symbols with default visibility in library]), +[ case "$enableval" in + no) + AC_MSG_RESULT(no) + ;; + *) + AC_MSG_CHECKING([whether $CC supports it]) + if test "$GCC" = yes ; then + if $CC --help --verbose 2>&1 | grep fvisibility= > /dev/null || + dnl clang always supports -fvisibility= but it doesn't show up + dnl under --help. + test "$compiler_id" = "CLANG"; then + AC_MSG_RESULT(yes) + AC_DEFINE(CURL_HIDDEN_SYMBOLS, 1, [to enable hidden symbols]) + AC_DEFINE(CURL_EXTERN_SYMBOL, [__attribute__ ((visibility ("default")))], [to make a symbol visible]) + CFLAGS="$CFLAGS -fvisibility=hidden" + else + AC_MSG_RESULT(no) + fi + + else + dnl Test for SunPro cc + if $CC 2>&1 | grep flags >/dev/null && $CC -flags | grep xldscope= >/dev/null ; then + AC_MSG_RESULT(yes) + AC_DEFINE(CURL_HIDDEN_SYMBOLS, 1, [to enable hidden symbols]) + AC_DEFINE(CURL_EXTERN_SYMBOL, [__global], [to make a symbol visible]) + CFLAGS="$CFLAGS -xldscope=hidden" + else + AC_MSG_RESULT(no) + fi + fi + ;; + esac ], + AC_MSG_RESULT(no) +) + +dnl ************************************************************ +dnl enforce SONAME bump +dnl + +AC_MSG_CHECKING([whether to enforce SONAME bump]) +AC_ARG_ENABLE(soname-bump, +AC_HELP_STRING([--enable-soname-bump],[Enable enforced SONAME bump]) +AC_HELP_STRING([--disable-soname-bump],[Disable enforced SONAME bump]), +[ case "$enableval" in + yes) AC_MSG_RESULT(yes) + soname_bump=yes + ;; + *) + AC_MSG_RESULT(no) + ;; + esac ], + AC_MSG_RESULT($soname_bump) +) +AM_CONDITIONAL(SONAME_BUMP, test x$soname_bump = xyes) + + +dnl ************************************************************ +if test ! -z "$winsock_LIB"; then + + dnl If ws2_32 is wanted, make sure it is the _last_ lib in LIBS (makes + dnl things work when built with c-ares). But we can't just move it last + dnl since then other stuff (SSL) won't build. So we simply append it to the + dnl end. + + LIBS="$LIBS $winsock_LIB" + TEST_SERVER_LIBS="$TEST_SERVER_LIBS $winsock_LIB" + +fi + +dnl +dnl All the library dependencies put into $LIB apply to libcurl only. +dnl Those in $CURL_LIBS apply to the curl command-line client only. +dnl Those in $TEST_SERVER_LIBS apply to test servers only. +dnl Those in $ALL_LIBS apply to all targets, including test targets. +dnl +LIBCURL_LIBS=$LIBS + +AC_SUBST(LIBCURL_LIBS) +AC_SUBST(CURL_LIBS) +AC_SUBST(TEST_SERVER_LIBS) +AC_SUBST(CURL_NETWORK_LIBS) +LIBS=$ALL_LIBS dnl LIBS is a magic variable that's used for every link + +AM_CONDITIONAL(CROSSCOMPILING, test x$cross_compiling = xyes) + +dnl yes or no +ENABLE_SHARED="$enable_shared" +AC_SUBST(ENABLE_SHARED) + +dnl +dnl For keeping supported features and protocols also in pkg-config file +dnl since it is more cross-compile frient than curl-config +dnl + +if test "x$USE_SSLEAY" = "x1"; then + SUPPORT_FEATURES="$SUPPORT_FEATURES SSL" +elif test -n "$SSL_ENABLED"; then + SUPPORT_FEATURES="$SUPPORT_FEATURES SSL" +fi +if test "@KRB4_ENABLED@" = "x1"; then + SUPPORT_FEATURES="$SUPPORT_FEATURES KRB4" +fi +if test "x$IPV6_ENABLED" = "x1"; then + SUPPORT_FEATURES="$SUPPORT_FEATURES IPv6" +fi +if test "x$HAVE_LIBZ" = "x1"; then + SUPPORT_FEATURES="$SUPPORT_FEATURES libz" +fi +if test "x$USE_ARES" = "x1" -o "x$USE_THREADS_POSIX" = "x1"; then + SUPPORT_FEATURES="$SUPPORT_FEATURES AsynchDNS" +fi +if test "x$IDN_ENABLED" = "x1"; then + SUPPORT_FEATURES="$SUPPORT_FEATURES IDN" +fi +if test "x$USE_WINDOWS_SSPI" = "x1"; then + SUPPORT_FEATURES="$SUPPORT_FEATURES SSPI" +fi +if test "x$USE_SSLEAY" = "x1" -o "x$USE_WINDOWS_SSPI" = "x1" \ + -o "x$GNUTLS_ENABLED" = "x1" -o "x$NSS_ENABLED" = "x1"; then + SUPPORT_FEATURES="$SUPPORT_FEATURES NTLM" +fi + +AC_SUBST(SUPPORT_FEATURES) + +dnl For supported protocols in pkg-config file +if test "x$CURL_DISABLE_HTTP" != "x1"; then + SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS HTTP" + if test "x$SSL_ENABLED" = "x1"; then + SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS HTTPS" + fi +fi +if test "x$CURL_DISABLE_FTP" != "x1"; then + SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS FTP" + if test "x$SSL_ENABLED" = "x1"; then + SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS FTPS" + fi +fi +if test "x$CURL_DISABLE_FILE" != "x1"; then + SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS FILE" +fi +if test "x$CURL_DISABLE_TELNET" != "x1"; then + SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS TELNET" +fi +if test "x$CURL_DISABLE_LDAP" != "x1"; then + SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS LDAP" + if test "x$CURL_DISABLE_LDAPS" != "x1"; then + if (test "x$USE_OPENLDAP" = "x1" && test "x$SSL_ENABLED" = "x1") || + (test "x$USE_OPENLDAP" != "x1" && test "x$HAVE_LDAP_SSL" = "x1"); then + SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS LDAPS" + fi + fi +fi +if test "x$CURL_DISABLE_DICT" != "x1"; then + SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS DICT" +fi +if test "x$CURL_DISABLE_TFTP" != "x1"; then + SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS TFTP" +fi +if test "x$CURL_DISABLE_GOPHER" != "x1"; then + SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS GOPHER" +fi +if test "x$CURL_DISABLE_POP3" != "x1"; then + SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS POP3" + if test "x$SSL_ENABLED" = "x1"; then + SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS POP3S" + fi +fi +if test "x$CURL_DISABLE_IMAP" != "x1"; then + SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS IMAP" + if test "x$SSL_ENABLED" = "x1"; then + SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS IMAPS" + fi +fi +if test "x$CURL_DISABLE_SMTP" != "x1"; then + SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS SMTP" + if test "x$SSL_ENABLED" = "x1"; then + SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS SMTPS" + fi +fi +if test "x$USE_LIBSSH2" = "x1"; then + SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS SCP" + SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS SFTP" +fi +if test "x$CURL_DISABLE_RTSP" != "x1"; then + SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS RTSP" +fi +if test "x$USE_LIBRTMP" = "x1"; then + SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS RTMP" +fi + +dnl replace spaces with newlines +dnl sort the lines +dnl replace the newlines back to spaces +SUPPORT_PROTOCOLS=`echo $SUPPORT_PROTOCOLS | tr ' ' '\012' | sort | tr '\012' ' '` + +AC_SUBST(SUPPORT_PROTOCOLS) + +dnl squeeze whitespace out of some variables + +squeeze CFLAGS +squeeze CPPFLAGS +squeeze DEFS +squeeze LDFLAGS +squeeze LIBS + +squeeze CURL_LIBS +squeeze LIBCURL_LIBS +squeeze TEST_SERVER_LIBS +squeeze CURL_NETWORK_LIBS + +squeeze SUPPORT_FEATURES +squeeze SUPPORT_PROTOCOLS + +if test "x$want_curldebug_assumed" = "xyes" && + test "x$want_curldebug" = "xyes" && test "x$USE_ARES" = "x1"; then + ac_configure_args="$ac_configure_args --enable-curldebug" +fi + +AC_CONFIG_FILES([Makefile \ + docs/Makefile \ + docs/examples/Makefile \ + docs/libcurl/Makefile \ + include/Makefile \ + include/curl/Makefile \ + src/Makefile \ + lib/Makefile \ + tests/Makefile \ + tests/data/Makefile \ + tests/server/Makefile \ + tests/libtest/Makefile \ + packages/Makefile \ + packages/Win32/Makefile \ + packages/Win32/cygwin/Makefile \ + packages/Linux/Makefile \ + packages/Linux/RPM/Makefile \ + packages/Linux/RPM/curl.spec \ + packages/Linux/RPM/curl-ssl.spec \ + packages/Solaris/Makefile \ + packages/EPM/curl.list \ + packages/EPM/Makefile \ + packages/vms/Makefile \ + packages/AIX/Makefile \ + packages/AIX/RPM/Makefile \ + packages/AIX/RPM/curl.spec \ + curl-config \ + libcurl.pc +]) +AC_OUTPUT + +CURL_GENERATE_CONFIGUREHELP_PM + +AC_MSG_NOTICE([Configured to build curl/libcurl: + + curl version: ${VERSION} + Host setup: ${host} + Install prefix: ${prefix} + Compiler: ${CC} + SSL support: ${curl_ssl_msg} + SSH support: ${curl_ssh_msg} + zlib support: ${curl_zlib_msg} + krb4 support: ${curl_krb4_msg} + GSSAPI support: ${curl_gss_msg} + SPNEGO support: ${curl_spnego_msg} + resolver: ${curl_res_msg} + ipv6 support: ${curl_ipv6_msg} + IDN support: ${curl_idn_msg} + Build libcurl: Shared=${enable_shared}, Static=${enable_static} + Built-in manual: ${curl_manual_msg} + Verbose errors: ${curl_verbose_msg} + SSPI support: ${curl_sspi_msg} + ca cert bundle: ${ca} + ca cert path: ${capath} + LDAP support: ${curl_ldap_msg} + LDAPS support: ${curl_ldaps_msg} + RTSP support: ${curl_rtsp_msg} + RTMP support: ${curl_rtmp_msg} + Protocols: ${SUPPORT_PROTOCOLS} +]) + +if test "x$soname_bump" = "xyes"; then + +cat <, et al. +# +# This software is licensed as described in the file COPYING, which +# you should have received as part of this distribution. The terms +# are also available at http://curl.haxx.se/docs/copyright.html. +# +# You may opt to use, copy, modify, merge, publish, distribute and/or sell +# copies of the Software, and permit persons to whom the Software is +# furnished to do so, under the terms of the COPYING file. +# +# This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY +# KIND, either express or implied. +# +########################################################################### + +prefix=@prefix@ +exec_prefix=@exec_prefix@ +includedir=@includedir@ + +usage() +{ + cat </dev/null 2>&1; then \ + include_option=--etags-include; \ + empty_fix=.; \ + else \ + include_option=--include; \ + empty_fix=; \ + fi; \ + list='$(SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + test ! -f $$subdir/TAGS || \ + tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \ + fi; \ + done; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$tags $$unique; \ + fi +ctags: CTAGS +CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + test -z "$(CTAGS_ARGS)$$tags$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$tags $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && cd $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) $$here + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ + list='$(DISTFILES)'; for file in $$list; do \ + case $$file in \ + $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ + $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ + esac; \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test "$$dir" != "$$file" && test "$$dir" != "."; then \ + dir="/$$dir"; \ + $(mkdir_p) "$(distdir)$$dir"; \ + else \ + dir=''; \ + fi; \ + if test -d $$d/$$file; then \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ + fi; \ + cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ + else \ + test -f $(distdir)/$$file \ + || cp -p $$d/$$file $(distdir)/$$file \ + || exit 1; \ + fi; \ + done + list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + test -d "$(distdir)/$$subdir" \ + || $(mkdir_p) "$(distdir)/$$subdir" \ + || exit 1; \ + distdir=`$(am__cd) $(distdir) && pwd`; \ + top_distdir=`$(am__cd) $(top_distdir) && pwd`; \ + (cd $$subdir && \ + $(MAKE) $(AM_MAKEFLAGS) \ + top_distdir="$$top_distdir" \ + distdir="$$distdir/$$subdir" \ + distdir) \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-recursive +all-am: Makefile +installdirs: installdirs-recursive +installdirs-am: +install: install-recursive +install-exec: install-exec-recursive +install-data: install-data-recursive +uninstall: uninstall-recursive + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-recursive +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-recursive + +clean-am: clean-generic clean-libtool mostlyclean-am + +distclean: distclean-recursive + -rm -f Makefile +distclean-am: clean-am distclean-generic distclean-libtool \ + distclean-tags + +dvi: dvi-recursive + +dvi-am: + +html: html-recursive + +info: info-recursive + +info-am: + +install-data-am: + +install-exec-am: + +install-info: install-info-recursive + +install-man: + +installcheck-am: + +maintainer-clean: maintainer-clean-recursive + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-recursive + +mostlyclean-am: mostlyclean-generic mostlyclean-libtool + +pdf: pdf-recursive + +pdf-am: + +ps: ps-recursive + +ps-am: + +uninstall-am: uninstall-info-am + +uninstall-info: uninstall-info-recursive + +.PHONY: $(RECURSIVE_TARGETS) CTAGS GTAGS all all-am check check-am \ + clean clean-generic clean-libtool clean-recursive ctags \ + ctags-recursive distclean distclean-generic distclean-libtool \ + distclean-recursive distclean-tags distdir dvi dvi-am html \ + html-am info info-am install install-am install-data \ + install-data-am install-exec install-exec-am install-info \ + install-info-am install-man install-strip installcheck \ + installcheck-am installdirs installdirs-am maintainer-clean \ + maintainer-clean-generic maintainer-clean-recursive \ + mostlyclean mostlyclean-generic mostlyclean-libtool \ + mostlyclean-recursive pdf pdf-am ps ps-am tags tags-recursive \ + uninstall uninstall-am uninstall-info-am + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/mobicore/common/curl/include/README b/mobicore/common/curl/include/README new file mode 100644 index 0000000000000000000000000000000000000000..205f9f7dd4f587071baa21e8502f4a920076b933 --- /dev/null +++ b/mobicore/common/curl/include/README @@ -0,0 +1,55 @@ + _ _ ____ _ + ___| | | | _ \| | + / __| | | | |_) | | + | (__| |_| | _ <| |___ + \___|\___/|_| \_\_____| + +Include files for libcurl, external users. + +They're all placed in the curl subdirectory here for better fit in any kind +of environment. You must include files from here using... + + #include + +... style and point the compiler's include path to the directory holding the +curl subdirectory. It makes it more likely to survive future modifications. + +NOTE FOR LIBCURL HACKERS + +The following notes apply to libcurl version 7.19.0 and later. + +* The distributed curl/curlbuild.h file is only intended to be used on systems + which can not run the also distributed configure script. + +* The distributed curlbuild.h file is generated as a copy of curlbuild.h.dist + when the libcurl source code distribution archive file is originally created. + +* If you check out from git on a non-configure platform, you must run the + appropriate buildconf* script to set up curlbuild.h and other local files + before being able of compiling the library. + +* On systems capable of running the configure script, the configure process + will overwrite the distributed include/curl/curlbuild.h file with one that + is suitable and specific to the library being configured and built, which + is generated from the include/curl/curlbuild.h.in template file. + +* If you intend to distribute an already compiled libcurl library you _MUST_ + also distribute along with it the generated curl/curlbuild.h which has been + used to compile it. Otherwise the library will be of no use for the users of + the library that you have built. It is _your_ responsability to provide this + file. No one at the cURL project can know how you have built the library. + +* File curl/curlbuild.h includes platform and configuration dependent info, + and must not be modified by anyone. Configure script generates it for you. + +* We cannot assume anything else but very basic compiler features being + present. While libcurl requires an ANSI C compiler to build, some of the + earlier ANSI compilers clearly can't deal with some preprocessor operators. + +* Newlines must remain unix-style for older compilers' sake. + +* Comments must be written in the old-style /* unnested C-fashion */ + +To figure out how to do good and portable checks for features, operating +systems or specific hardwarare, a very good resource is Bjorn Reese's +collection at http://predef.sf.net/ diff --git a/mobicore/common/curl/include/curl/Makefile.am b/mobicore/common/curl/include/curl/Makefile.am new file mode 100644 index 0000000000000000000000000000000000000000..a3b4443865af9ea14812ee0dfe3dc85d34c34f77 --- /dev/null +++ b/mobicore/common/curl/include/curl/Makefile.am @@ -0,0 +1,25 @@ +pkginclude_HEADERS = \ + curl.h curlver.h easy.h mprintf.h stdcheaders.h types.h multi.h \ + typecheck-gcc.h curlbuild.h curlrules.h + +pkgincludedir= $(includedir)/curl + +# curlbuild.h does not exist in the git tree. When the original libcurl +# source code distribution archive file is created, curlbuild.h.dist is +# renamed to curlbuild.h and included in the tarball so that it can be +# used directly on non-configure systems. +# +# The distributed curlbuild.h will be overwritten on configure systems +# when the configure script runs, with one that is suitable and specific +# to the library being configured and built. +# +# curlbuild.h.in is the distributed template file from which the configure +# script creates curlbuild.h at library configuration time, overwiting the +# one included in the distribution archive. +# +# curlbuild.h.dist is not included in the source code distribution archive. + +EXTRA_DIST = curlbuild.h.in + +DISTCLEANFILES = curlbuild.h + diff --git a/mobicore/common/curl/include/curl/Makefile.in b/mobicore/common/curl/include/curl/Makefile.in new file mode 100644 index 0000000000000000000000000000000000000000..7edaf4606519f13d5e9c95ca0f56e3927b840dc6 --- /dev/null +++ b/mobicore/common/curl/include/curl/Makefile.in @@ -0,0 +1,521 @@ +# Makefile.in generated by automake 1.9.6 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005 Free Software Foundation, Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + +srcdir = @srcdir@ +top_srcdir = @top_srcdir@ +VPATH = @srcdir@ +pkgdatadir = $(datadir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +top_builddir = ../.. +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +INSTALL = @INSTALL@ +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +subdir = include/curl +DIST_COMMON = $(pkginclude_HEADERS) $(srcdir)/Makefile.am \ + $(srcdir)/Makefile.in $(srcdir)/curlbuild.h.in +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/m4/curl-compilers.m4 \ + $(top_srcdir)/m4/curl-confopts.m4 \ + $(top_srcdir)/m4/curl-functions.m4 \ + $(top_srcdir)/m4/curl-override.m4 \ + $(top_srcdir)/m4/curl-reentrant.m4 \ + $(top_srcdir)/m4/curl-system.m4 $(top_srcdir)/m4/libtool.m4 \ + $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ + $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ + $(top_srcdir)/acinclude.m4 $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs +CONFIG_HEADER = $(top_builddir)/lib/curl_config.h \ + $(top_builddir)/src/curl_config.h curlbuild.h +CONFIG_CLEAN_FILES = +SOURCES = +DIST_SOURCES = +am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; +am__vpath_adj = case $$p in \ + $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ + *) f=$$p;; \ + esac; +am__strip_dir = `echo $$p | sed -e 's|^.*/||'`; +am__installdirs = "$(DESTDIR)$(pkgincludedir)" +pkgincludeHEADERS_INSTALL = $(INSTALL_HEADER) +HEADERS = $(pkginclude_HEADERS) +ETAGS = etags +CTAGS = ctags +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +pkgincludedir = $(includedir)/curl +ACLOCAL = @ACLOCAL@ +AMDEP_FALSE = @AMDEP_FALSE@ +AMDEP_TRUE = @AMDEP_TRUE@ +AMTAR = @AMTAR@ +AR = @AR@ +AS = @AS@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +BUILD_LIBHOSTNAME_FALSE = @BUILD_LIBHOSTNAME_FALSE@ +BUILD_LIBHOSTNAME_TRUE = @BUILD_LIBHOSTNAME_TRUE@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CONFIGURE_OPTIONS = @CONFIGURE_OPTIONS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CROSSCOMPILING_FALSE = @CROSSCOMPILING_FALSE@ +CROSSCOMPILING_TRUE = @CROSSCOMPILING_TRUE@ +CURLDEBUG_FALSE = @CURLDEBUG_FALSE@ +CURLDEBUG_TRUE = @CURLDEBUG_TRUE@ +CURL_CA_BUNDLE = @CURL_CA_BUNDLE@ +CURL_CFLAG_EXTRAS = @CURL_CFLAG_EXTRAS@ +CURL_DISABLE_DICT = @CURL_DISABLE_DICT@ +CURL_DISABLE_FILE = @CURL_DISABLE_FILE@ +CURL_DISABLE_FTP = @CURL_DISABLE_FTP@ +CURL_DISABLE_GOPHER = @CURL_DISABLE_GOPHER@ +CURL_DISABLE_HTTP = @CURL_DISABLE_HTTP@ +CURL_DISABLE_IMAP = @CURL_DISABLE_IMAP@ +CURL_DISABLE_LDAP = @CURL_DISABLE_LDAP@ +CURL_DISABLE_LDAPS = @CURL_DISABLE_LDAPS@ +CURL_DISABLE_POP3 = @CURL_DISABLE_POP3@ +CURL_DISABLE_PROXY = @CURL_DISABLE_PROXY@ +CURL_DISABLE_RTSP = @CURL_DISABLE_RTSP@ +CURL_DISABLE_SMTP = @CURL_DISABLE_SMTP@ +CURL_DISABLE_TELNET = @CURL_DISABLE_TELNET@ +CURL_DISABLE_TFTP = @CURL_DISABLE_TFTP@ +CURL_LIBS = @CURL_LIBS@ +CURL_NETWORK_LIBS = @CURL_NETWORK_LIBS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DLLTOOL = @DLLTOOL@ +DSYMUTIL = @DSYMUTIL@ +DUMPBIN = @DUMPBIN@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +ENABLE_SHARED = @ENABLE_SHARED@ +EXEEXT = @EXEEXT@ +FGREP = @FGREP@ +GREP = @GREP@ +HAVE_LDAP_SSL = @HAVE_LDAP_SSL@ +HAVE_LIBZ = @HAVE_LIBZ@ +HAVE_LIBZ_FALSE = @HAVE_LIBZ_FALSE@ +HAVE_LIBZ_TRUE = @HAVE_LIBZ_TRUE@ +HAVE_PK11_CREATEGENERICOBJECT = @HAVE_PK11_CREATEGENERICOBJECT@ +IDN_ENABLED = @IDN_ENABLED@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +IPV6_ENABLED = @IPV6_ENABLED@ +KRB4_ENABLED = @KRB4_ENABLED@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LIBCURL_LIBS = @LIBCURL_LIBS@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +MAINT = @MAINT@ +MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@ +MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@ +MAKEINFO = @MAKEINFO@ +MANOPT = @MANOPT@ +MIMPURE_FALSE = @MIMPURE_FALSE@ +MIMPURE_TRUE = @MIMPURE_TRUE@ +NM = @NM@ +NMEDIT = @NMEDIT@ +NO_UNDEFINED_FALSE = @NO_UNDEFINED_FALSE@ +NO_UNDEFINED_TRUE = @NO_UNDEFINED_TRUE@ +NROFF = @NROFF@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +OTOOL = @OTOOL@ +OTOOL64 = @OTOOL64@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH = @PATH@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PERL = @PERL@ +PKGADD_NAME = @PKGADD_NAME@ +PKGADD_PKG = @PKGADD_PKG@ +PKGADD_VENDOR = @PKGADD_VENDOR@ +PKGCONFIG = @PKGCONFIG@ +RANDOM_FILE = @RANDOM_FILE@ +RANLIB = @RANLIB@ +REQUIRE_LIB_DEPS = @REQUIRE_LIB_DEPS@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +SONAME_BUMP_FALSE = @SONAME_BUMP_FALSE@ +SONAME_BUMP_TRUE = @SONAME_BUMP_TRUE@ +SSL_ENABLED = @SSL_ENABLED@ +STATICLIB_FALSE = @STATICLIB_FALSE@ +STATICLIB_TRUE = @STATICLIB_TRUE@ +STRIP = @STRIP@ +SUPPORT_FEATURES = @SUPPORT_FEATURES@ +SUPPORT_PROTOCOLS = @SUPPORT_PROTOCOLS@ +TEST_SERVER_LIBS = @TEST_SERVER_LIBS@ +USE_ARES = @USE_ARES@ +USE_EMBEDDED_ARES_FALSE = @USE_EMBEDDED_ARES_FALSE@ +USE_EMBEDDED_ARES_TRUE = @USE_EMBEDDED_ARES_TRUE@ +USE_GNUTLS = @USE_GNUTLS@ +USE_LIBRTMP = @USE_LIBRTMP@ +USE_LIBSSH2 = @USE_LIBSSH2@ +USE_MANUAL_FALSE = @USE_MANUAL_FALSE@ +USE_MANUAL_TRUE = @USE_MANUAL_TRUE@ +USE_NSS = @USE_NSS@ +USE_OPENLDAP = @USE_OPENLDAP@ +USE_POLARSSL = @USE_POLARSSL@ +USE_SSLEAY = @USE_SSLEAY@ +USE_WINDOWS_SSPI = @USE_WINDOWS_SSPI@ +VERSION = @VERSION@ +VERSIONNUM = @VERSIONNUM@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ +am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ +am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +libext = @libext@ +localedir = @localedir@ +localstatedir = @localstatedir@ +lt_ECHO = @lt_ECHO@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +subdirs = @subdirs@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +pkginclude_HEADERS = \ + curl.h curlver.h easy.h mprintf.h stdcheaders.h types.h multi.h \ + typecheck-gcc.h curlbuild.h curlrules.h + + +# curlbuild.h does not exist in the git tree. When the original libcurl +# source code distribution archive file is created, curlbuild.h.dist is +# renamed to curlbuild.h and included in the tarball so that it can be +# used directly on non-configure systems. +# +# The distributed curlbuild.h will be overwritten on configure systems +# when the configure script runs, with one that is suitable and specific +# to the library being configured and built. +# +# curlbuild.h.in is the distributed template file from which the configure +# script creates curlbuild.h at library configuration time, overwiting the +# one included in the distribution archive. +# +# curlbuild.h.dist is not included in the source code distribution archive. +EXTRA_DIST = curlbuild.h.in +DISTCLEANFILES = curlbuild.h +all: curlbuild.h + $(MAKE) $(AM_MAKEFLAGS) all-am + +.SUFFIXES: +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ + && exit 0; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu include/curl/Makefile'; \ + cd $(top_srcdir) && \ + $(AUTOMAKE) --gnu include/curl/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +curlbuild.h: stamp-h3 + @if test ! -f $@; then \ + rm -f stamp-h3; \ + $(MAKE) stamp-h3; \ + else :; fi + +stamp-h3: $(srcdir)/curlbuild.h.in $(top_builddir)/config.status + @rm -f stamp-h3 + cd $(top_builddir) && $(SHELL) ./config.status include/curl/curlbuild.h +$(srcdir)/curlbuild.h.in: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) + cd $(top_srcdir) && $(AUTOHEADER) + rm -f stamp-h3 + touch $@ + +distclean-hdr: + -rm -f curlbuild.h stamp-h3 + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +distclean-libtool: + -rm -f libtool +uninstall-info-am: +install-pkgincludeHEADERS: $(pkginclude_HEADERS) + @$(NORMAL_INSTALL) + test -z "$(pkgincludedir)" || $(mkdir_p) "$(DESTDIR)$(pkgincludedir)" + @list='$(pkginclude_HEADERS)'; for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + f=$(am__strip_dir) \ + echo " $(pkgincludeHEADERS_INSTALL) '$$d$$p' '$(DESTDIR)$(pkgincludedir)/$$f'"; \ + $(pkgincludeHEADERS_INSTALL) "$$d$$p" "$(DESTDIR)$(pkgincludedir)/$$f"; \ + done + +uninstall-pkgincludeHEADERS: + @$(NORMAL_UNINSTALL) + @list='$(pkginclude_HEADERS)'; for p in $$list; do \ + f=$(am__strip_dir) \ + echo " rm -f '$(DESTDIR)$(pkgincludedir)/$$f'"; \ + rm -f "$(DESTDIR)$(pkgincludedir)/$$f"; \ + done + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + mkid -fID $$unique +tags: TAGS + +TAGS: $(HEADERS) $(SOURCES) curlbuild.h.in $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) curlbuild.h.in $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$tags $$unique; \ + fi +ctags: CTAGS +CTAGS: $(HEADERS) $(SOURCES) curlbuild.h.in $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) curlbuild.h.in $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + test -z "$(CTAGS_ARGS)$$tags$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$tags $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && cd $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) $$here + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ + list='$(DISTFILES)'; for file in $$list; do \ + case $$file in \ + $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ + $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ + esac; \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test "$$dir" != "$$file" && test "$$dir" != "."; then \ + dir="/$$dir"; \ + $(mkdir_p) "$(distdir)$$dir"; \ + else \ + dir=''; \ + fi; \ + if test -d $$d/$$file; then \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ + fi; \ + cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ + else \ + test -f $(distdir)/$$file \ + || cp -p $$d/$$file $(distdir)/$$file \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile $(HEADERS) curlbuild.h +installdirs: + for dir in "$(DESTDIR)$(pkgincludedir)"; do \ + test -z "$$dir" || $(mkdir_p) "$$dir"; \ + done +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test -z "$(DISTCLEANFILES)" || rm -f $(DISTCLEANFILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-generic clean-libtool mostlyclean-am + +distclean: distclean-am + -rm -f Makefile +distclean-am: clean-am distclean-generic distclean-hdr \ + distclean-libtool distclean-tags + +dvi: dvi-am + +dvi-am: + +html: html-am + +info: info-am + +info-am: + +install-data-am: install-pkgincludeHEADERS + +install-exec-am: + +install-info: install-info-am + +install-man: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-generic mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: uninstall-info-am uninstall-pkgincludeHEADERS + +.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ + clean-libtool ctags distclean distclean-generic distclean-hdr \ + distclean-libtool distclean-tags distdir dvi dvi-am html \ + html-am info info-am install install-am install-data \ + install-data-am install-exec install-exec-am install-info \ + install-info-am install-man install-pkgincludeHEADERS \ + install-strip installcheck installcheck-am installdirs \ + maintainer-clean maintainer-clean-generic mostlyclean \ + mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ + tags uninstall uninstall-am uninstall-info-am \ + uninstall-pkgincludeHEADERS + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/mobicore/common/curl/include/curl/curl.h b/mobicore/common/curl/include/curl/curl.h new file mode 100644 index 0000000000000000000000000000000000000000..fbd0d9b01c7ddab10cca0a14392f5670a9bd6093 --- /dev/null +++ b/mobicore/common/curl/include/curl/curl.h @@ -0,0 +1,2125 @@ +#ifndef __CURL_CURL_H +#define __CURL_CURL_H +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) 1998 - 2010, Daniel Stenberg, , et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at http://curl.haxx.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ***************************************************************************/ + +/* + * If you have libcurl problems, all docs and details are found here: + * http://curl.haxx.se/libcurl/ + * + * curl-library mailing list subscription and unsubscription web interface: + * http://cool.haxx.se/mailman/listinfo/curl-library/ + */ + +#include "curlver.h" /* libcurl version defines */ +#include "curlbuild.h" /* libcurl build definitions */ +#include "curlrules.h" /* libcurl rules enforcement */ + +/* + * Define WIN32 when build target is Win32 API + */ + +#if (defined(_WIN32) || defined(__WIN32__)) && \ + !defined(WIN32) && !defined(__SYMBIAN32__) +#define WIN32 +#endif + +#include +#include + +#if defined(__FreeBSD__) && (__FreeBSD__ >= 2) +/* Needed for __FreeBSD_version symbol definition */ +#include +#endif + +/* The include stuff here below is mainly for time_t! */ +#include +#include + +#if defined(WIN32) && !defined(_WIN32_WCE) && !defined(__GNUC__) && \ + !defined(__CYGWIN__) || defined(__MINGW32__) +#if !(defined(_WINSOCKAPI_) || defined(_WINSOCK_H)) +/* The check above prevents the winsock2 inclusion if winsock.h already was + included, since they can't co-exist without problems */ +#include +#include +#endif +#else + +/* HP-UX systems version 9, 10 and 11 lack sys/select.h and so does oldish + libc5-based Linux systems. Only include it on system that are known to + require it! */ +#if defined(_AIX) || defined(__NOVELL_LIBC__) || defined(__NetBSD__) || \ + defined(__minix) || defined(__SYMBIAN32__) || defined(__INTEGRITY) || \ + defined(ANDROID) || \ + (defined(__FreeBSD_version) && (__FreeBSD_version < 800000)) +#include +#endif + +#ifndef _WIN32_WCE +#include +#endif +#if !defined(WIN32) && !defined(__WATCOMC__) && !defined(__VXWORKS__) +#include +#endif +#include +#endif + +#ifdef __BEOS__ +#include +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +typedef void CURL; + +/* + * Decorate exportable functions for Win32 and Symbian OS DLL linking. + * This avoids using a .def file for building libcurl.dll. + */ +#if (defined(WIN32) || defined(_WIN32) || defined(__SYMBIAN32__)) && \ + !defined(CURL_STATICLIB) +#if defined(BUILDING_LIBCURL) +#define CURL_EXTERN __declspec(dllexport) +#else +#define CURL_EXTERN __declspec(dllimport) +#endif +#else + +#ifdef CURL_HIDDEN_SYMBOLS +/* + * This definition is used to make external definitions visible in the + * shared library when symbols are hidden by default. It makes no + * difference when compiling applications whether this is set or not, + * only when compiling the library. + */ +#define CURL_EXTERN CURL_EXTERN_SYMBOL +#else +#define CURL_EXTERN +#endif +#endif + +#ifndef curl_socket_typedef +/* socket typedef */ +#ifdef WIN32 +typedef SOCKET curl_socket_t; +#define CURL_SOCKET_BAD INVALID_SOCKET +#else +typedef int curl_socket_t; +#define CURL_SOCKET_BAD -1 +#endif +#define curl_socket_typedef +#endif /* curl_socket_typedef */ + +struct curl_httppost { + struct curl_httppost *next; /* next entry in the list */ + char *name; /* pointer to allocated name */ + long namelength; /* length of name length */ + char *contents; /* pointer to allocated data contents */ + long contentslength; /* length of contents field */ + char *buffer; /* pointer to allocated buffer contents */ + long bufferlength; /* length of buffer field */ + char *contenttype; /* Content-Type */ + struct curl_slist* contentheader; /* list of extra headers for this form */ + struct curl_httppost *more; /* if one field name has more than one + file, this link should link to following + files */ + long flags; /* as defined below */ +#define HTTPPOST_FILENAME (1<<0) /* specified content is a file name */ +#define HTTPPOST_READFILE (1<<1) /* specified content is a file name */ +#define HTTPPOST_PTRNAME (1<<2) /* name is only stored pointer + do not free in formfree */ +#define HTTPPOST_PTRCONTENTS (1<<3) /* contents is only stored pointer + do not free in formfree */ +#define HTTPPOST_BUFFER (1<<4) /* upload file from buffer */ +#define HTTPPOST_PTRBUFFER (1<<5) /* upload file from pointer contents */ +#define HTTPPOST_CALLBACK (1<<6) /* upload file contents by using the + regular read callback to get the data + and pass the given pointer as custom + pointer */ + + char *showfilename; /* The file name to show. If not set, the + actual file name will be used (if this + is a file part) */ + void *userp; /* custom pointer used for + HTTPPOST_CALLBACK posts */ +}; + +typedef int (*curl_progress_callback)(void *clientp, + double dltotal, + double dlnow, + double ultotal, + double ulnow); + +#ifndef CURL_MAX_WRITE_SIZE + /* Tests have proven that 20K is a very bad buffer size for uploads on + Windows, while 16K for some odd reason performed a lot better. + We do the ifndef check to allow this value to easier be changed at build + time for those who feel adventurous. The practical minimum is about + 400 bytes since libcurl uses a buffer of this size as a scratch area + (unrelated to network send operations). */ +#define CURL_MAX_WRITE_SIZE 16384 +#endif + +#ifndef CURL_MAX_HTTP_HEADER +/* The only reason to have a max limit for this is to avoid the risk of a bad + server feeding libcurl with a never-ending header that will cause reallocs + infinitely */ +#define CURL_MAX_HTTP_HEADER (100*1024) +#endif + + +/* This is a magic return code for the write callback that, when returned, + will signal libcurl to pause receiving on the current transfer. */ +#define CURL_WRITEFUNC_PAUSE 0x10000001 +typedef size_t (*curl_write_callback)(char *buffer, + size_t size, + size_t nitems, + void *outstream); + + + +/* enumeration of file types */ +typedef enum { + CURLFILETYPE_FILE = 0, + CURLFILETYPE_DIRECTORY, + CURLFILETYPE_SYMLINK, + CURLFILETYPE_DEVICE_BLOCK, + CURLFILETYPE_DEVICE_CHAR, + CURLFILETYPE_NAMEDPIPE, + CURLFILETYPE_SOCKET, + CURLFILETYPE_DOOR, /* is possible only on Sun Solaris now */ + + CURLFILETYPE_UNKNOWN /* should never occur */ +} curlfiletype; + +#define CURLFINFOFLAG_KNOWN_FILENAME (1<<0) +#define CURLFINFOFLAG_KNOWN_FILETYPE (1<<1) +#define CURLFINFOFLAG_KNOWN_TIME (1<<2) +#define CURLFINFOFLAG_KNOWN_PERM (1<<3) +#define CURLFINFOFLAG_KNOWN_UID (1<<4) +#define CURLFINFOFLAG_KNOWN_GID (1<<5) +#define CURLFINFOFLAG_KNOWN_SIZE (1<<6) +#define CURLFINFOFLAG_KNOWN_HLINKCOUNT (1<<7) + +/* Content of this structure depends on information which is known and is + achievable (e.g. by FTP LIST parsing). Please see the url_easy_setopt(3) man + page for callbacks returning this structure -- some fields are mandatory, + some others are optional. The FLAG field has special meaning. */ +struct curl_fileinfo { + char *filename; + curlfiletype filetype; + time_t time; + unsigned int perm; + int uid; + int gid; + curl_off_t size; + long int hardlinks; + + struct { + /* If some of these fields is not NULL, it is a pointer to b_data. */ + char *time; + char *perm; + char *user; + char *group; + char *target; /* pointer to the target filename of a symlink */ + } strings; + + unsigned int flags; + + /* used internally */ + char * b_data; + size_t b_size; + size_t b_used; +}; + +/* return codes for CURLOPT_CHUNK_BGN_FUNCTION */ +#define CURL_CHUNK_BGN_FUNC_OK 0 +#define CURL_CHUNK_BGN_FUNC_FAIL 1 /* tell the lib to end the task */ +#define CURL_CHUNK_BGN_FUNC_SKIP 2 /* skip this chunk over */ + +/* if splitting of data transfer is enabled, this callback is called before + download of an individual chunk started. Note that parameter "remains" works + only for FTP wildcard downloading (for now), otherwise is not used */ +typedef long (*curl_chunk_bgn_callback)(const void *transfer_info, + void *ptr, + int remains); + +/* return codes for CURLOPT_CHUNK_END_FUNCTION */ +#define CURL_CHUNK_END_FUNC_OK 0 +#define CURL_CHUNK_END_FUNC_FAIL 1 /* tell the lib to end the task */ + +/* If splitting of data transfer is enabled this callback is called after + download of an individual chunk finished. + Note! After this callback was set then it have to be called FOR ALL chunks. + Even if downloading of this chunk was skipped in CHUNK_BGN_FUNC. + This is the reason why we don't need "transfer_info" parameter in this + callback and we are not interested in "remains" parameter too. */ +typedef long (*curl_chunk_end_callback)(void *ptr); + +/* return codes for FNMATCHFUNCTION */ +#define CURL_FNMATCHFUNC_MATCH 0 /* string corresponds to the pattern */ +#define CURL_FNMATCHFUNC_NOMATCH 1 /* pattern doesn't match the string */ +#define CURL_FNMATCHFUNC_FAIL 2 /* an error occurred */ + +/* callback type for wildcard downloading pattern matching. If the + string matches the pattern, return CURL_FNMATCHFUNC_MATCH value, etc. */ +typedef int (*curl_fnmatch_callback)(void *ptr, + const char *pattern, + const char *string); + +/* These are the return codes for the seek callbacks */ +#define CURL_SEEKFUNC_OK 0 +#define CURL_SEEKFUNC_FAIL 1 /* fail the entire transfer */ +#define CURL_SEEKFUNC_CANTSEEK 2 /* tell libcurl seeking can't be done, so + libcurl might try other means instead */ +typedef int (*curl_seek_callback)(void *instream, + curl_off_t offset, + int origin); /* 'whence' */ + +/* This is a return code for the read callback that, when returned, will + signal libcurl to immediately abort the current transfer. */ +#define CURL_READFUNC_ABORT 0x10000000 +/* This is a return code for the read callback that, when returned, will + signal libcurl to pause sending data on the current transfer. */ +#define CURL_READFUNC_PAUSE 0x10000001 + +typedef size_t (*curl_read_callback)(char *buffer, + size_t size, + size_t nitems, + void *instream); + +typedef enum { + CURLSOCKTYPE_IPCXN, /* socket created for a specific IP connection */ + CURLSOCKTYPE_LAST /* never use */ +} curlsocktype; + +typedef int (*curl_sockopt_callback)(void *clientp, + curl_socket_t curlfd, + curlsocktype purpose); + +struct curl_sockaddr { + int family; + int socktype; + int protocol; + unsigned int addrlen; /* addrlen was a socklen_t type before 7.18.0 but it + turned really ugly and painful on the systems that + lack this type */ + struct sockaddr addr; +}; + +typedef curl_socket_t +(*curl_opensocket_callback)(void *clientp, + curlsocktype purpose, + struct curl_sockaddr *address); + +typedef enum { + CURLIOE_OK, /* I/O operation successful */ + CURLIOE_UNKNOWNCMD, /* command was unknown to callback */ + CURLIOE_FAILRESTART, /* failed to restart the read */ + CURLIOE_LAST /* never use */ +} curlioerr; + +typedef enum { + CURLIOCMD_NOP, /* no operation */ + CURLIOCMD_RESTARTREAD, /* restart the read stream from start */ + CURLIOCMD_LAST /* never use */ +} curliocmd; + +typedef curlioerr (*curl_ioctl_callback)(CURL *handle, + int cmd, + void *clientp); + +/* + * The following typedef's are signatures of malloc, free, realloc, strdup and + * calloc respectively. Function pointers of these types can be passed to the + * curl_global_init_mem() function to set user defined memory management + * callback routines. + */ +typedef void *(*curl_malloc_callback)(size_t size); +typedef void (*curl_free_callback)(void *ptr); +typedef void *(*curl_realloc_callback)(void *ptr, size_t size); +typedef char *(*curl_strdup_callback)(const char *str); +typedef void *(*curl_calloc_callback)(size_t nmemb, size_t size); + +/* the kind of data that is passed to information_callback*/ +typedef enum { + CURLINFO_TEXT = 0, + CURLINFO_HEADER_IN, /* 1 */ + CURLINFO_HEADER_OUT, /* 2 */ + CURLINFO_DATA_IN, /* 3 */ + CURLINFO_DATA_OUT, /* 4 */ + CURLINFO_SSL_DATA_IN, /* 5 */ + CURLINFO_SSL_DATA_OUT, /* 6 */ + CURLINFO_END +} curl_infotype; + +typedef int (*curl_debug_callback) + (CURL *handle, /* the handle/transfer this concerns */ + curl_infotype type, /* what kind of data */ + char *data, /* points to the data */ + size_t size, /* size of the data pointed to */ + void *userptr); /* whatever the user please */ + +/* All possible error codes from all sorts of curl functions. Future versions + may return other values, stay prepared. + + Always add new return codes last. Never *EVER* remove any. The return + codes must remain the same! + */ + +typedef enum { + CURLE_OK = 0, + CURLE_UNSUPPORTED_PROTOCOL, /* 1 */ + CURLE_FAILED_INIT, /* 2 */ + CURLE_URL_MALFORMAT, /* 3 */ + CURLE_OBSOLETE4, /* 4 - NOT USED */ + CURLE_COULDNT_RESOLVE_PROXY, /* 5 */ + CURLE_COULDNT_RESOLVE_HOST, /* 6 */ + CURLE_COULDNT_CONNECT, /* 7 */ + CURLE_FTP_WEIRD_SERVER_REPLY, /* 8 */ + CURLE_REMOTE_ACCESS_DENIED, /* 9 a service was denied by the server + due to lack of access - when login fails + this is not returned. */ + CURLE_OBSOLETE10, /* 10 - NOT USED */ + CURLE_FTP_WEIRD_PASS_REPLY, /* 11 */ + CURLE_OBSOLETE12, /* 12 - NOT USED */ + CURLE_FTP_WEIRD_PASV_REPLY, /* 13 */ + CURLE_FTP_WEIRD_227_FORMAT, /* 14 */ + CURLE_FTP_CANT_GET_HOST, /* 15 */ + CURLE_OBSOLETE16, /* 16 - NOT USED */ + CURLE_FTP_COULDNT_SET_TYPE, /* 17 */ + CURLE_PARTIAL_FILE, /* 18 */ + CURLE_FTP_COULDNT_RETR_FILE, /* 19 */ + CURLE_OBSOLETE20, /* 20 - NOT USED */ + CURLE_QUOTE_ERROR, /* 21 - quote command failure */ + CURLE_HTTP_RETURNED_ERROR, /* 22 */ + CURLE_WRITE_ERROR, /* 23 */ + CURLE_OBSOLETE24, /* 24 - NOT USED */ + CURLE_UPLOAD_FAILED, /* 25 - failed upload "command" */ + CURLE_READ_ERROR, /* 26 - couldn't open/read from file */ + CURLE_OUT_OF_MEMORY, /* 27 */ + /* Note: CURLE_OUT_OF_MEMORY may sometimes indicate a conversion error + instead of a memory allocation error if CURL_DOES_CONVERSIONS + is defined + */ + CURLE_OPERATION_TIMEDOUT, /* 28 - the timeout time was reached */ + CURLE_OBSOLETE29, /* 29 - NOT USED */ + CURLE_FTP_PORT_FAILED, /* 30 - FTP PORT operation failed */ + CURLE_FTP_COULDNT_USE_REST, /* 31 - the REST command failed */ + CURLE_OBSOLETE32, /* 32 - NOT USED */ + CURLE_RANGE_ERROR, /* 33 - RANGE "command" didn't work */ + CURLE_HTTP_POST_ERROR, /* 34 */ + CURLE_SSL_CONNECT_ERROR, /* 35 - wrong when connecting with SSL */ + CURLE_BAD_DOWNLOAD_RESUME, /* 36 - couldn't resume download */ + CURLE_FILE_COULDNT_READ_FILE, /* 37 */ + CURLE_LDAP_CANNOT_BIND, /* 38 */ + CURLE_LDAP_SEARCH_FAILED, /* 39 */ + CURLE_OBSOLETE40, /* 40 - NOT USED */ + CURLE_FUNCTION_NOT_FOUND, /* 41 */ + CURLE_ABORTED_BY_CALLBACK, /* 42 */ + CURLE_BAD_FUNCTION_ARGUMENT, /* 43 */ + CURLE_OBSOLETE44, /* 44 - NOT USED */ + CURLE_INTERFACE_FAILED, /* 45 - CURLOPT_INTERFACE failed */ + CURLE_OBSOLETE46, /* 46 - NOT USED */ + CURLE_TOO_MANY_REDIRECTS , /* 47 - catch endless re-direct loops */ + CURLE_UNKNOWN_TELNET_OPTION, /* 48 - User specified an unknown option */ + CURLE_TELNET_OPTION_SYNTAX , /* 49 - Malformed telnet option */ + CURLE_OBSOLETE50, /* 50 - NOT USED */ + CURLE_PEER_FAILED_VERIFICATION, /* 51 - peer's certificate or fingerprint + wasn't verified fine */ + CURLE_GOT_NOTHING, /* 52 - when this is a specific error */ + CURLE_SSL_ENGINE_NOTFOUND, /* 53 - SSL crypto engine not found */ + CURLE_SSL_ENGINE_SETFAILED, /* 54 - can not set SSL crypto engine as + default */ + CURLE_SEND_ERROR, /* 55 - failed sending network data */ + CURLE_RECV_ERROR, /* 56 - failure in receiving network data */ + CURLE_OBSOLETE57, /* 57 - NOT IN USE */ + CURLE_SSL_CERTPROBLEM, /* 58 - problem with the local certificate */ + CURLE_SSL_CIPHER, /* 59 - couldn't use specified cipher */ + CURLE_SSL_CACERT, /* 60 - problem with the CA cert (path?) */ + CURLE_BAD_CONTENT_ENCODING, /* 61 - Unrecognized transfer encoding */ + CURLE_LDAP_INVALID_URL, /* 62 - Invalid LDAP URL */ + CURLE_FILESIZE_EXCEEDED, /* 63 - Maximum file size exceeded */ + CURLE_USE_SSL_FAILED, /* 64 - Requested FTP SSL level failed */ + CURLE_SEND_FAIL_REWIND, /* 65 - Sending the data requires a rewind + that failed */ + CURLE_SSL_ENGINE_INITFAILED, /* 66 - failed to initialise ENGINE */ + CURLE_LOGIN_DENIED, /* 67 - user, password or similar was not + accepted and we failed to login */ + CURLE_TFTP_NOTFOUND, /* 68 - file not found on server */ + CURLE_TFTP_PERM, /* 69 - permission problem on server */ + CURLE_REMOTE_DISK_FULL, /* 70 - out of disk space on server */ + CURLE_TFTP_ILLEGAL, /* 71 - Illegal TFTP operation */ + CURLE_TFTP_UNKNOWNID, /* 72 - Unknown transfer ID */ + CURLE_REMOTE_FILE_EXISTS, /* 73 - File already exists */ + CURLE_TFTP_NOSUCHUSER, /* 74 - No such user */ + CURLE_CONV_FAILED, /* 75 - conversion failed */ + CURLE_CONV_REQD, /* 76 - caller must register conversion + callbacks using curl_easy_setopt options + CURLOPT_CONV_FROM_NETWORK_FUNCTION, + CURLOPT_CONV_TO_NETWORK_FUNCTION, and + CURLOPT_CONV_FROM_UTF8_FUNCTION */ + CURLE_SSL_CACERT_BADFILE, /* 77 - could not load CACERT file, missing + or wrong format */ + CURLE_REMOTE_FILE_NOT_FOUND, /* 78 - remote file not found */ + CURLE_SSH, /* 79 - error from the SSH layer, somewhat + generic so the error message will be of + interest when this has happened */ + + CURLE_SSL_SHUTDOWN_FAILED, /* 80 - Failed to shut down the SSL + connection */ + CURLE_AGAIN, /* 81 - socket is not ready for send/recv, + wait till it's ready and try again (Added + in 7.18.2) */ + CURLE_SSL_CRL_BADFILE, /* 82 - could not load CRL file, missing or + wrong format (Added in 7.19.0) */ + CURLE_SSL_ISSUER_ERROR, /* 83 - Issuer check failed. (Added in + 7.19.0) */ + CURLE_FTP_PRET_FAILED, /* 84 - a PRET command failed */ + CURLE_RTSP_CSEQ_ERROR, /* 85 - mismatch of RTSP CSeq numbers */ + CURLE_RTSP_SESSION_ERROR, /* 86 - mismatch of RTSP Session Identifiers */ + CURLE_FTP_BAD_FILE_LIST, /* 87 - unable to parse FTP file list */ + CURLE_CHUNK_FAILED, /* 88 - chunk callback reported error */ + + CURL_LAST /* never use! */ +} CURLcode; + +#ifndef CURL_NO_OLDIES /* define this to test if your app builds with all + the obsolete stuff removed! */ + +/* Backwards compatibility with older names */ + +/* The following were added in 7.17.1 */ +/* These are scheduled to disappear by 2009 */ +#define CURLE_SSL_PEER_CERTIFICATE CURLE_PEER_FAILED_VERIFICATION + +/* The following were added in 7.17.0 */ +/* These are scheduled to disappear by 2009 */ +#define CURLE_OBSOLETE CURLE_OBSOLETE50 /* noone should be using this! */ +#define CURLE_BAD_PASSWORD_ENTERED CURLE_OBSOLETE46 +#define CURLE_BAD_CALLING_ORDER CURLE_OBSOLETE44 +#define CURLE_FTP_USER_PASSWORD_INCORRECT CURLE_OBSOLETE10 +#define CURLE_FTP_CANT_RECONNECT CURLE_OBSOLETE16 +#define CURLE_FTP_COULDNT_GET_SIZE CURLE_OBSOLETE32 +#define CURLE_FTP_COULDNT_SET_ASCII CURLE_OBSOLETE29 +#define CURLE_FTP_WEIRD_USER_REPLY CURLE_OBSOLETE12 +#define CURLE_FTP_WRITE_ERROR CURLE_OBSOLETE20 +#define CURLE_LIBRARY_NOT_FOUND CURLE_OBSOLETE40 +#define CURLE_MALFORMAT_USER CURLE_OBSOLETE24 +#define CURLE_SHARE_IN_USE CURLE_OBSOLETE57 +#define CURLE_URL_MALFORMAT_USER CURLE_OBSOLETE4 + +#define CURLE_FTP_ACCESS_DENIED CURLE_REMOTE_ACCESS_DENIED +#define CURLE_FTP_COULDNT_SET_BINARY CURLE_FTP_COULDNT_SET_TYPE +#define CURLE_FTP_QUOTE_ERROR CURLE_QUOTE_ERROR +#define CURLE_TFTP_DISKFULL CURLE_REMOTE_DISK_FULL +#define CURLE_TFTP_EXISTS CURLE_REMOTE_FILE_EXISTS +#define CURLE_HTTP_RANGE_ERROR CURLE_RANGE_ERROR +#define CURLE_FTP_SSL_FAILED CURLE_USE_SSL_FAILED + +/* The following were added earlier */ + +#define CURLE_OPERATION_TIMEOUTED CURLE_OPERATION_TIMEDOUT + +#define CURLE_HTTP_NOT_FOUND CURLE_HTTP_RETURNED_ERROR +#define CURLE_HTTP_PORT_FAILED CURLE_INTERFACE_FAILED +#define CURLE_FTP_COULDNT_STOR_FILE CURLE_UPLOAD_FAILED + +#define CURLE_FTP_PARTIAL_FILE CURLE_PARTIAL_FILE +#define CURLE_FTP_BAD_DOWNLOAD_RESUME CURLE_BAD_DOWNLOAD_RESUME + +/* This was the error code 50 in 7.7.3 and a few earlier versions, this + is no longer used by libcurl but is instead #defined here only to not + make programs break */ +#define CURLE_ALREADY_COMPLETE 99999 + +#endif /*!CURL_NO_OLDIES*/ + +/* This prototype applies to all conversion callbacks */ +typedef CURLcode (*curl_conv_callback)(char *buffer, size_t length); + +typedef CURLcode (*curl_ssl_ctx_callback)(CURL *curl, /* easy handle */ + void *ssl_ctx, /* actually an + OpenSSL SSL_CTX */ + void *userptr); + +typedef enum { + CURLPROXY_HTTP = 0, /* added in 7.10, new in 7.19.4 default is to use + CONNECT HTTP/1.1 */ + CURLPROXY_HTTP_1_0 = 1, /* added in 7.19.4, force to use CONNECT + HTTP/1.0 */ + CURLPROXY_SOCKS4 = 4, /* support added in 7.15.2, enum existed already + in 7.10 */ + CURLPROXY_SOCKS5 = 5, /* added in 7.10 */ + CURLPROXY_SOCKS4A = 6, /* added in 7.18.0 */ + CURLPROXY_SOCKS5_HOSTNAME = 7 /* Use the SOCKS5 protocol but pass along the + host name rather than the IP address. added + in 7.18.0 */ +} curl_proxytype; /* this enum was added in 7.10 */ + +#define CURLAUTH_NONE 0 /* nothing */ +#define CURLAUTH_BASIC (1<<0) /* Basic (default) */ +#define CURLAUTH_DIGEST (1<<1) /* Digest */ +#define CURLAUTH_GSSNEGOTIATE (1<<2) /* GSS-Negotiate */ +#define CURLAUTH_NTLM (1<<3) /* NTLM */ +#define CURLAUTH_DIGEST_IE (1<<4) /* Digest with IE flavour */ +#define CURLAUTH_ONLY (1<<31) /* used together with a single other + type to force no auth or just that + single type */ +#define CURLAUTH_ANY (~CURLAUTH_DIGEST_IE) /* all fine types set */ +#define CURLAUTH_ANYSAFE (~(CURLAUTH_BASIC|CURLAUTH_DIGEST_IE)) + +#define CURLSSH_AUTH_ANY ~0 /* all types supported by the server */ +#define CURLSSH_AUTH_NONE 0 /* none allowed, silly but complete */ +#define CURLSSH_AUTH_PUBLICKEY (1<<0) /* public/private key files */ +#define CURLSSH_AUTH_PASSWORD (1<<1) /* password */ +#define CURLSSH_AUTH_HOST (1<<2) /* host key files */ +#define CURLSSH_AUTH_KEYBOARD (1<<3) /* keyboard interactive */ +#define CURLSSH_AUTH_DEFAULT CURLSSH_AUTH_ANY + +#define CURL_ERROR_SIZE 256 + +struct curl_khkey { + const char *key; /* points to a zero-terminated string encoded with base64 + if len is zero, otherwise to the "raw" data */ + size_t len; + enum type { + CURLKHTYPE_UNKNOWN, + CURLKHTYPE_RSA1, + CURLKHTYPE_RSA, + CURLKHTYPE_DSS + } keytype; +}; + +/* this is the set of return values expected from the curl_sshkeycallback + callback */ +enum curl_khstat { + CURLKHSTAT_FINE_ADD_TO_FILE, + CURLKHSTAT_FINE, + CURLKHSTAT_REJECT, /* reject the connection, return an error */ + CURLKHSTAT_DEFER, /* do not accept it, but we can't answer right now so + this causes a CURLE_DEFER error but otherwise the + connection will be left intact etc */ + CURLKHSTAT_LAST /* not for use, only a marker for last-in-list */ +}; + +/* this is the set of status codes pass in to the callback */ +enum curl_khmatch { + CURLKHMATCH_OK, /* match */ + CURLKHMATCH_MISMATCH, /* host found, key mismatch! */ + CURLKHMATCH_MISSING, /* no matching host/key found */ + CURLKHMATCH_LAST /* not for use, only a marker for last-in-list */ +}; + +typedef int + (*curl_sshkeycallback) (CURL *easy, /* easy handle */ + const struct curl_khkey *knownkey, /* known */ + const struct curl_khkey *foundkey, /* found */ + enum curl_khmatch, /* libcurl's view on the keys */ + void *clientp); /* custom pointer passed from app */ + +/* parameter for the CURLOPT_USE_SSL option */ +typedef enum { + CURLUSESSL_NONE, /* do not attempt to use SSL */ + CURLUSESSL_TRY, /* try using SSL, proceed anyway otherwise */ + CURLUSESSL_CONTROL, /* SSL for the control connection or fail */ + CURLUSESSL_ALL, /* SSL for all communication or fail */ + CURLUSESSL_LAST /* not an option, never use */ +} curl_usessl; + +#ifndef CURL_NO_OLDIES /* define this to test if your app builds with all + the obsolete stuff removed! */ + +/* Backwards compatibility with older names */ +/* These are scheduled to disappear by 2009 */ + +#define CURLFTPSSL_NONE CURLUSESSL_NONE +#define CURLFTPSSL_TRY CURLUSESSL_TRY +#define CURLFTPSSL_CONTROL CURLUSESSL_CONTROL +#define CURLFTPSSL_ALL CURLUSESSL_ALL +#define CURLFTPSSL_LAST CURLUSESSL_LAST +#define curl_ftpssl curl_usessl +#endif /*!CURL_NO_OLDIES*/ + +/* parameter for the CURLOPT_FTP_SSL_CCC option */ +typedef enum { + CURLFTPSSL_CCC_NONE, /* do not send CCC */ + CURLFTPSSL_CCC_PASSIVE, /* Let the server initiate the shutdown */ + CURLFTPSSL_CCC_ACTIVE, /* Initiate the shutdown */ + CURLFTPSSL_CCC_LAST /* not an option, never use */ +} curl_ftpccc; + +/* parameter for the CURLOPT_FTPSSLAUTH option */ +typedef enum { + CURLFTPAUTH_DEFAULT, /* let libcurl decide */ + CURLFTPAUTH_SSL, /* use "AUTH SSL" */ + CURLFTPAUTH_TLS, /* use "AUTH TLS" */ + CURLFTPAUTH_LAST /* not an option, never use */ +} curl_ftpauth; + +/* parameter for the CURLOPT_FTP_CREATE_MISSING_DIRS option */ +typedef enum { + CURLFTP_CREATE_DIR_NONE, /* do NOT create missing dirs! */ + CURLFTP_CREATE_DIR, /* (FTP/SFTP) if CWD fails, try MKD and then CWD + again if MKD succeeded, for SFTP this does + similar magic */ + CURLFTP_CREATE_DIR_RETRY, /* (FTP only) if CWD fails, try MKD and then CWD + again even if MKD failed! */ + CURLFTP_CREATE_DIR_LAST /* not an option, never use */ +} curl_ftpcreatedir; + +/* parameter for the CURLOPT_FTP_FILEMETHOD option */ +typedef enum { + CURLFTPMETHOD_DEFAULT, /* let libcurl pick */ + CURLFTPMETHOD_MULTICWD, /* single CWD operation for each path part */ + CURLFTPMETHOD_NOCWD, /* no CWD at all */ + CURLFTPMETHOD_SINGLECWD, /* one CWD to full dir, then work on file */ + CURLFTPMETHOD_LAST /* not an option, never use */ +} curl_ftpmethod; + +/* CURLPROTO_ defines are for the CURLOPT_*PROTOCOLS options */ +#define CURLPROTO_HTTP (1<<0) +#define CURLPROTO_HTTPS (1<<1) +#define CURLPROTO_FTP (1<<2) +#define CURLPROTO_FTPS (1<<3) +#define CURLPROTO_SCP (1<<4) +#define CURLPROTO_SFTP (1<<5) +#define CURLPROTO_TELNET (1<<6) +#define CURLPROTO_LDAP (1<<7) +#define CURLPROTO_LDAPS (1<<8) +#define CURLPROTO_DICT (1<<9) +#define CURLPROTO_FILE (1<<10) +#define CURLPROTO_TFTP (1<<11) +#define CURLPROTO_IMAP (1<<12) +#define CURLPROTO_IMAPS (1<<13) +#define CURLPROTO_POP3 (1<<14) +#define CURLPROTO_POP3S (1<<15) +#define CURLPROTO_SMTP (1<<16) +#define CURLPROTO_SMTPS (1<<17) +#define CURLPROTO_RTSP (1<<18) +#define CURLPROTO_RTMP (1<<19) +#define CURLPROTO_RTMPT (1<<20) +#define CURLPROTO_RTMPE (1<<21) +#define CURLPROTO_RTMPTE (1<<22) +#define CURLPROTO_RTMPS (1<<23) +#define CURLPROTO_RTMPTS (1<<24) +#define CURLPROTO_GOPHER (1<<25) +#define CURLPROTO_ALL (~0) /* enable everything */ + +/* long may be 32 or 64 bits, but we should never depend on anything else + but 32 */ +#define CURLOPTTYPE_LONG 0 +#define CURLOPTTYPE_OBJECTPOINT 10000 +#define CURLOPTTYPE_FUNCTIONPOINT 20000 +#define CURLOPTTYPE_OFF_T 30000 + +/* name is uppercase CURLOPT_, + type is one of the defined CURLOPTTYPE_ + number is unique identifier */ +#ifdef CINIT +#undef CINIT +#endif + +#ifdef CURL_ISOCPP +#define CINIT(name,type,number) CURLOPT_ ## name = CURLOPTTYPE_ ## type + number +#else +/* The macro "##" is ISO C, we assume pre-ISO C doesn't support it. */ +#define LONG CURLOPTTYPE_LONG +#define OBJECTPOINT CURLOPTTYPE_OBJECTPOINT +#define FUNCTIONPOINT CURLOPTTYPE_FUNCTIONPOINT +#define OFF_T CURLOPTTYPE_OFF_T +#define CINIT(name,type,number) CURLOPT_/**/name = type + number +#endif + +/* + * This macro-mania below setups the CURLOPT_[what] enum, to be used with + * curl_easy_setopt(). The first argument in the CINIT() macro is the [what] + * word. + */ + +typedef enum { + /* This is the FILE * or void * the regular output should be written to. */ + CINIT(FILE, OBJECTPOINT, 1), + + /* The full URL to get/put */ + CINIT(URL, OBJECTPOINT, 2), + + /* Port number to connect to, if other than default. */ + CINIT(PORT, LONG, 3), + + /* Name of proxy to use. */ + CINIT(PROXY, OBJECTPOINT, 4), + + /* "name:password" to use when fetching. */ + CINIT(USERPWD, OBJECTPOINT, 5), + + /* "name:password" to use with proxy. */ + CINIT(PROXYUSERPWD, OBJECTPOINT, 6), + + /* Range to get, specified as an ASCII string. */ + CINIT(RANGE, OBJECTPOINT, 7), + + /* not used */ + + /* Specified file stream to upload from (use as input): */ + CINIT(INFILE, OBJECTPOINT, 9), + + /* Buffer to receive error messages in, must be at least CURL_ERROR_SIZE + * bytes big. If this is not used, error messages go to stderr instead: */ + CINIT(ERRORBUFFER, OBJECTPOINT, 10), + + /* Function that will be called to store the output (instead of fwrite). The + * parameters will use fwrite() syntax, make sure to follow them. */ + CINIT(WRITEFUNCTION, FUNCTIONPOINT, 11), + + /* Function that will be called to read the input (instead of fread). The + * parameters will use fread() syntax, make sure to follow them. */ + CINIT(READFUNCTION, FUNCTIONPOINT, 12), + + /* Time-out the read operation after this amount of seconds */ + CINIT(TIMEOUT, LONG, 13), + + /* If the CURLOPT_INFILE is used, this can be used to inform libcurl about + * how large the file being sent really is. That allows better error + * checking and better verifies that the upload was successful. -1 means + * unknown size. + * + * For large file support, there is also a _LARGE version of the key + * which takes an off_t type, allowing platforms with larger off_t + * sizes to handle larger files. See below for INFILESIZE_LARGE. + */ + CINIT(INFILESIZE, LONG, 14), + + /* POST static input fields. */ + CINIT(POSTFIELDS, OBJECTPOINT, 15), + + /* Set the referrer page (needed by some CGIs) */ + CINIT(REFERER, OBJECTPOINT, 16), + + /* Set the FTP PORT string (interface name, named or numerical IP address) + Use i.e '-' to use default address. */ + CINIT(FTPPORT, OBJECTPOINT, 17), + + /* Set the User-Agent string (examined by some CGIs) */ + CINIT(USERAGENT, OBJECTPOINT, 18), + + /* If the download receives less than "low speed limit" bytes/second + * during "low speed time" seconds, the operations is aborted. + * You could i.e if you have a pretty high speed connection, abort if + * it is less than 2000 bytes/sec during 20 seconds. + */ + + /* Set the "low speed limit" */ + CINIT(LOW_SPEED_LIMIT, LONG, 19), + + /* Set the "low speed time" */ + CINIT(LOW_SPEED_TIME, LONG, 20), + + /* Set the continuation offset. + * + * Note there is also a _LARGE version of this key which uses + * off_t types, allowing for large file offsets on platforms which + * use larger-than-32-bit off_t's. Look below for RESUME_FROM_LARGE. + */ + CINIT(RESUME_FROM, LONG, 21), + + /* Set cookie in request: */ + CINIT(COOKIE, OBJECTPOINT, 22), + + /* This points to a linked list of headers, struct curl_slist kind */ + CINIT(HTTPHEADER, OBJECTPOINT, 23), + + /* This points to a linked list of post entries, struct curl_httppost */ + CINIT(HTTPPOST, OBJECTPOINT, 24), + + /* name of the file keeping your private SSL-certificate */ + CINIT(SSLCERT, OBJECTPOINT, 25), + + /* password for the SSL or SSH private key */ + CINIT(KEYPASSWD, OBJECTPOINT, 26), + + /* send TYPE parameter? */ + CINIT(CRLF, LONG, 27), + + /* send linked-list of QUOTE commands */ + CINIT(QUOTE, OBJECTPOINT, 28), + + /* send FILE * or void * to store headers to, if you use a callback it + is simply passed to the callback unmodified */ + CINIT(WRITEHEADER, OBJECTPOINT, 29), + + /* point to a file to read the initial cookies from, also enables + "cookie awareness" */ + CINIT(COOKIEFILE, OBJECTPOINT, 31), + + /* What version to specifically try to use. + See CURL_SSLVERSION defines below. */ + CINIT(SSLVERSION, LONG, 32), + + /* What kind of HTTP time condition to use, see defines */ + CINIT(TIMECONDITION, LONG, 33), + + /* Time to use with the above condition. Specified in number of seconds + since 1 Jan 1970 */ + CINIT(TIMEVALUE, LONG, 34), + + /* 35 = OBSOLETE */ + + /* Custom request, for customizing the get command like + HTTP: DELETE, TRACE and others + FTP: to use a different list command + */ + CINIT(CUSTOMREQUEST, OBJECTPOINT, 36), + + /* HTTP request, for odd commands like DELETE, TRACE and others */ + CINIT(STDERR, OBJECTPOINT, 37), + + /* 38 is not used */ + + /* send linked-list of post-transfer QUOTE commands */ + CINIT(POSTQUOTE, OBJECTPOINT, 39), + + /* Pass a pointer to string of the output using full variable-replacement + as described elsewhere. */ + CINIT(WRITEINFO, OBJECTPOINT, 40), + + CINIT(VERBOSE, LONG, 41), /* talk a lot */ + CINIT(HEADER, LONG, 42), /* throw the header out too */ + CINIT(NOPROGRESS, LONG, 43), /* shut off the progress meter */ + CINIT(NOBODY, LONG, 44), /* use HEAD to get http document */ + CINIT(FAILONERROR, LONG, 45), /* no output on http error codes >= 300 */ + CINIT(UPLOAD, LONG, 46), /* this is an upload */ + CINIT(POST, LONG, 47), /* HTTP POST method */ + CINIT(DIRLISTONLY, LONG, 48), /* return bare names when listing directories */ + + CINIT(APPEND, LONG, 50), /* Append instead of overwrite on upload! */ + + /* Specify whether to read the user+password from the .netrc or the URL. + * This must be one of the CURL_NETRC_* enums below. */ + CINIT(NETRC, LONG, 51), + + CINIT(FOLLOWLOCATION, LONG, 52), /* use Location: Luke! */ + + CINIT(TRANSFERTEXT, LONG, 53), /* transfer data in text/ASCII format */ + CINIT(PUT, LONG, 54), /* HTTP PUT */ + + /* 55 = OBSOLETE */ + + /* Function that will be called instead of the internal progress display + * function. This function should be defined as the curl_progress_callback + * prototype defines. */ + CINIT(PROGRESSFUNCTION, FUNCTIONPOINT, 56), + + /* Data passed to the progress callback */ + CINIT(PROGRESSDATA, OBJECTPOINT, 57), + + /* We want the referrer field set automatically when following locations */ + CINIT(AUTOREFERER, LONG, 58), + + /* Port of the proxy, can be set in the proxy string as well with: + "[host]:[port]" */ + CINIT(PROXYPORT, LONG, 59), + + /* size of the POST input data, if strlen() is not good to use */ + CINIT(POSTFIELDSIZE, LONG, 60), + + /* tunnel non-http operations through a HTTP proxy */ + CINIT(HTTPPROXYTUNNEL, LONG, 61), + + /* Set the interface string to use as outgoing network interface */ + CINIT(INTERFACE, OBJECTPOINT, 62), + + /* Set the krb4/5 security level, this also enables krb4/5 awareness. This + * is a string, 'clear', 'safe', 'confidential' or 'private'. If the string + * is set but doesn't match one of these, 'private' will be used. */ + CINIT(KRBLEVEL, OBJECTPOINT, 63), + + /* Set if we should verify the peer in ssl handshake, set 1 to verify. */ + CINIT(SSL_VERIFYPEER, LONG, 64), + + /* The CApath or CAfile used to validate the peer certificate + this option is used only if SSL_VERIFYPEER is true */ + CINIT(CAINFO, OBJECTPOINT, 65), + + /* 66 = OBSOLETE */ + /* 67 = OBSOLETE */ + + /* Maximum number of http redirects to follow */ + CINIT(MAXREDIRS, LONG, 68), + + /* Pass a long set to 1 to get the date of the requested document (if + possible)! Pass a zero to shut it off. */ + CINIT(FILETIME, LONG, 69), + + /* This points to a linked list of telnet options */ + CINIT(TELNETOPTIONS, OBJECTPOINT, 70), + + /* Max amount of cached alive connections */ + CINIT(MAXCONNECTS, LONG, 71), + + /* What policy to use when closing connections when the cache is filled + up */ + CINIT(CLOSEPOLICY, LONG, 72), + + /* 73 = OBSOLETE */ + + /* Set to explicitly use a new connection for the upcoming transfer. + Do not use this unless you're absolutely sure of this, as it makes the + operation slower and is less friendly for the network. */ + CINIT(FRESH_CONNECT, LONG, 74), + + /* Set to explicitly forbid the upcoming transfer's connection to be re-used + when done. Do not use this unless you're absolutely sure of this, as it + makes the operation slower and is less friendly for the network. */ + CINIT(FORBID_REUSE, LONG, 75), + + /* Set to a file name that contains random data for libcurl to use to + seed the random engine when doing SSL connects. */ + CINIT(RANDOM_FILE, OBJECTPOINT, 76), + + /* Set to the Entropy Gathering Daemon socket pathname */ + CINIT(EGDSOCKET, OBJECTPOINT, 77), + + /* Time-out connect operations after this amount of seconds, if connects + are OK within this time, then fine... This only aborts the connect + phase. [Only works on unix-style/SIGALRM operating systems] */ + CINIT(CONNECTTIMEOUT, LONG, 78), + + /* Function that will be called to store headers (instead of fwrite). The + * parameters will use fwrite() syntax, make sure to follow them. */ + CINIT(HEADERFUNCTION, FUNCTIONPOINT, 79), + + /* Set this to force the HTTP request to get back to GET. Only really usable + if POST, PUT or a custom request have been used first. + */ + CINIT(HTTPGET, LONG, 80), + + /* Set if we should verify the Common name from the peer certificate in ssl + * handshake, set 1 to check existence, 2 to ensure that it matches the + * provided hostname. */ + CINIT(SSL_VERIFYHOST, LONG, 81), + + /* Specify which file name to write all known cookies in after completed + operation. Set file name to "-" (dash) to make it go to stdout. */ + CINIT(COOKIEJAR, OBJECTPOINT, 82), + + /* Specify which SSL ciphers to use */ + CINIT(SSL_CIPHER_LIST, OBJECTPOINT, 83), + + /* Specify which HTTP version to use! This must be set to one of the + CURL_HTTP_VERSION* enums set below. */ + CINIT(HTTP_VERSION, LONG, 84), + + /* Specifically switch on or off the FTP engine's use of the EPSV command. By + default, that one will always be attempted before the more traditional + PASV command. */ + CINIT(FTP_USE_EPSV, LONG, 85), + + /* type of the file keeping your SSL-certificate ("DER", "PEM", "ENG") */ + CINIT(SSLCERTTYPE, OBJECTPOINT, 86), + + /* name of the file keeping your private SSL-key */ + CINIT(SSLKEY, OBJECTPOINT, 87), + + /* type of the file keeping your private SSL-key ("DER", "PEM", "ENG") */ + CINIT(SSLKEYTYPE, OBJECTPOINT, 88), + + /* crypto engine for the SSL-sub system */ + CINIT(SSLENGINE, OBJECTPOINT, 89), + + /* set the crypto engine for the SSL-sub system as default + the param has no meaning... + */ + CINIT(SSLENGINE_DEFAULT, LONG, 90), + + /* Non-zero value means to use the global dns cache */ + CINIT(DNS_USE_GLOBAL_CACHE, LONG, 91), /* To become OBSOLETE soon */ + + /* DNS cache timeout */ + CINIT(DNS_CACHE_TIMEOUT, LONG, 92), + + /* send linked-list of pre-transfer QUOTE commands */ + CINIT(PREQUOTE, OBJECTPOINT, 93), + + /* set the debug function */ + CINIT(DEBUGFUNCTION, FUNCTIONPOINT, 94), + + /* set the data for the debug function */ + CINIT(DEBUGDATA, OBJECTPOINT, 95), + + /* mark this as start of a cookie session */ + CINIT(COOKIESESSION, LONG, 96), + + /* The CApath directory used to validate the peer certificate + this option is used only if SSL_VERIFYPEER is true */ + CINIT(CAPATH, OBJECTPOINT, 97), + + /* Instruct libcurl to use a smaller receive buffer */ + CINIT(BUFFERSIZE, LONG, 98), + + /* Instruct libcurl to not use any signal/alarm handlers, even when using + timeouts. This option is useful for multi-threaded applications. + See libcurl-the-guide for more background information. */ + CINIT(NOSIGNAL, LONG, 99), + + /* Provide a CURLShare for mutexing non-ts data */ + CINIT(SHARE, OBJECTPOINT, 100), + + /* indicates type of proxy. accepted values are CURLPROXY_HTTP (default), + CURLPROXY_SOCKS4, CURLPROXY_SOCKS4A and CURLPROXY_SOCKS5. */ + CINIT(PROXYTYPE, LONG, 101), + + /* Set the Accept-Encoding string. Use this to tell a server you would like + the response to be compressed. */ + CINIT(ENCODING, OBJECTPOINT, 102), + + /* Set pointer to private data */ + CINIT(PRIVATE, OBJECTPOINT, 103), + + /* Set aliases for HTTP 200 in the HTTP Response header */ + CINIT(HTTP200ALIASES, OBJECTPOINT, 104), + + /* Continue to send authentication (user+password) when following locations, + even when hostname changed. This can potentially send off the name + and password to whatever host the server decides. */ + CINIT(UNRESTRICTED_AUTH, LONG, 105), + + /* Specifically switch on or off the FTP engine's use of the EPRT command ( it + also disables the LPRT attempt). By default, those ones will always be + attempted before the good old traditional PORT command. */ + CINIT(FTP_USE_EPRT, LONG, 106), + + /* Set this to a bitmask value to enable the particular authentications + methods you like. Use this in combination with CURLOPT_USERPWD. + Note that setting multiple bits may cause extra network round-trips. */ + CINIT(HTTPAUTH, LONG, 107), + + /* Set the ssl context callback function, currently only for OpenSSL ssl_ctx + in second argument. The function must be matching the + curl_ssl_ctx_callback proto. */ + CINIT(SSL_CTX_FUNCTION, FUNCTIONPOINT, 108), + + /* Set the userdata for the ssl context callback function's third + argument */ + CINIT(SSL_CTX_DATA, OBJECTPOINT, 109), + + /* FTP Option that causes missing dirs to be created on the remote server. + In 7.19.4 we introduced the convenience enums for this option using the + CURLFTP_CREATE_DIR prefix. + */ + CINIT(FTP_CREATE_MISSING_DIRS, LONG, 110), + + /* Set this to a bitmask value to enable the particular authentications + methods you like. Use this in combination with CURLOPT_PROXYUSERPWD. + Note that setting multiple bits may cause extra network round-trips. */ + CINIT(PROXYAUTH, LONG, 111), + + /* FTP option that changes the timeout, in seconds, associated with + getting a response. This is different from transfer timeout time and + essentially places a demand on the FTP server to acknowledge commands + in a timely manner. */ + CINIT(FTP_RESPONSE_TIMEOUT, LONG, 112), +#define CURLOPT_SERVER_RESPONSE_TIMEOUT CURLOPT_FTP_RESPONSE_TIMEOUT + + /* Set this option to one of the CURL_IPRESOLVE_* defines (see below) to + tell libcurl to resolve names to those IP versions only. This only has + affect on systems with support for more than one, i.e IPv4 _and_ IPv6. */ + CINIT(IPRESOLVE, LONG, 113), + + /* Set this option to limit the size of a file that will be downloaded from + an HTTP or FTP server. + + Note there is also _LARGE version which adds large file support for + platforms which have larger off_t sizes. See MAXFILESIZE_LARGE below. */ + CINIT(MAXFILESIZE, LONG, 114), + + /* See the comment for INFILESIZE above, but in short, specifies + * the size of the file being uploaded. -1 means unknown. + */ + CINIT(INFILESIZE_LARGE, OFF_T, 115), + + /* Sets the continuation offset. There is also a LONG version of this; + * look above for RESUME_FROM. + */ + CINIT(RESUME_FROM_LARGE, OFF_T, 116), + + /* Sets the maximum size of data that will be downloaded from + * an HTTP or FTP server. See MAXFILESIZE above for the LONG version. + */ + CINIT(MAXFILESIZE_LARGE, OFF_T, 117), + + /* Set this option to the file name of your .netrc file you want libcurl + to parse (using the CURLOPT_NETRC option). If not set, libcurl will do + a poor attempt to find the user's home directory and check for a .netrc + file in there. */ + CINIT(NETRC_FILE, OBJECTPOINT, 118), + + /* Enable SSL/TLS for FTP, pick one of: + CURLFTPSSL_TRY - try using SSL, proceed anyway otherwise + CURLFTPSSL_CONTROL - SSL for the control connection or fail + CURLFTPSSL_ALL - SSL for all communication or fail + */ + CINIT(USE_SSL, LONG, 119), + + /* The _LARGE version of the standard POSTFIELDSIZE option */ + CINIT(POSTFIELDSIZE_LARGE, OFF_T, 120), + + /* Enable/disable the TCP Nagle algorithm */ + CINIT(TCP_NODELAY, LONG, 121), + + /* 122 OBSOLETE, used in 7.12.3. Gone in 7.13.0 */ + /* 123 OBSOLETE. Gone in 7.16.0 */ + /* 124 OBSOLETE, used in 7.12.3. Gone in 7.13.0 */ + /* 125 OBSOLETE, used in 7.12.3. Gone in 7.13.0 */ + /* 126 OBSOLETE, used in 7.12.3. Gone in 7.13.0 */ + /* 127 OBSOLETE. Gone in 7.16.0 */ + /* 128 OBSOLETE. Gone in 7.16.0 */ + + /* When FTP over SSL/TLS is selected (with CURLOPT_USE_SSL), this option + can be used to change libcurl's default action which is to first try + "AUTH SSL" and then "AUTH TLS" in this order, and proceed when a OK + response has been received. + + Available parameters are: + CURLFTPAUTH_DEFAULT - let libcurl decide + CURLFTPAUTH_SSL - try "AUTH SSL" first, then TLS + CURLFTPAUTH_TLS - try "AUTH TLS" first, then SSL + */ + CINIT(FTPSSLAUTH, LONG, 129), + + CINIT(IOCTLFUNCTION, FUNCTIONPOINT, 130), + CINIT(IOCTLDATA, OBJECTPOINT, 131), + + /* 132 OBSOLETE. Gone in 7.16.0 */ + /* 133 OBSOLETE. Gone in 7.16.0 */ + + /* zero terminated string for pass on to the FTP server when asked for + "account" info */ + CINIT(FTP_ACCOUNT, OBJECTPOINT, 134), + + /* feed cookies into cookie engine */ + CINIT(COOKIELIST, OBJECTPOINT, 135), + + /* ignore Content-Length */ + CINIT(IGNORE_CONTENT_LENGTH, LONG, 136), + + /* Set to non-zero to skip the IP address received in a 227 PASV FTP server + response. Typically used for FTP-SSL purposes but is not restricted to + that. libcurl will then instead use the same IP address it used for the + control connection. */ + CINIT(FTP_SKIP_PASV_IP, LONG, 137), + + /* Select "file method" to use when doing FTP, see the curl_ftpmethod + above. */ + CINIT(FTP_FILEMETHOD, LONG, 138), + + /* Local port number to bind the socket to */ + CINIT(LOCALPORT, LONG, 139), + + /* Number of ports to try, including the first one set with LOCALPORT. + Thus, setting it to 1 will make no additional attempts but the first. + */ + CINIT(LOCALPORTRANGE, LONG, 140), + + /* no transfer, set up connection and let application use the socket by + extracting it with CURLINFO_LASTSOCKET */ + CINIT(CONNECT_ONLY, LONG, 141), + + /* Function that will be called to convert from the + network encoding (instead of using the iconv calls in libcurl) */ + CINIT(CONV_FROM_NETWORK_FUNCTION, FUNCTIONPOINT, 142), + + /* Function that will be called to convert to the + network encoding (instead of using the iconv calls in libcurl) */ + CINIT(CONV_TO_NETWORK_FUNCTION, FUNCTIONPOINT, 143), + + /* Function that will be called to convert from UTF8 + (instead of using the iconv calls in libcurl) + Note that this is used only for SSL certificate processing */ + CINIT(CONV_FROM_UTF8_FUNCTION, FUNCTIONPOINT, 144), + + /* if the connection proceeds too quickly then need to slow it down */ + /* limit-rate: maximum number of bytes per second to send or receive */ + CINIT(MAX_SEND_SPEED_LARGE, OFF_T, 145), + CINIT(MAX_RECV_SPEED_LARGE, OFF_T, 146), + + /* Pointer to command string to send if USER/PASS fails. */ + CINIT(FTP_ALTERNATIVE_TO_USER, OBJECTPOINT, 147), + + /* callback function for setting socket options */ + CINIT(SOCKOPTFUNCTION, FUNCTIONPOINT, 148), + CINIT(SOCKOPTDATA, OBJECTPOINT, 149), + + /* set to 0 to disable session ID re-use for this transfer, default is + enabled (== 1) */ + CINIT(SSL_SESSIONID_CACHE, LONG, 150), + + /* allowed SSH authentication methods */ + CINIT(SSH_AUTH_TYPES, LONG, 151), + + /* Used by scp/sftp to do public/private key authentication */ + CINIT(SSH_PUBLIC_KEYFILE, OBJECTPOINT, 152), + CINIT(SSH_PRIVATE_KEYFILE, OBJECTPOINT, 153), + + /* Send CCC (Clear Command Channel) after authentication */ + CINIT(FTP_SSL_CCC, LONG, 154), + + /* Same as TIMEOUT and CONNECTTIMEOUT, but with ms resolution */ + CINIT(TIMEOUT_MS, LONG, 155), + CINIT(CONNECTTIMEOUT_MS, LONG, 156), + + /* set to zero to disable the libcurl's decoding and thus pass the raw body + data to the application even when it is encoded/compressed */ + CINIT(HTTP_TRANSFER_DECODING, LONG, 157), + CINIT(HTTP_CONTENT_DECODING, LONG, 158), + + /* Permission used when creating new files and directories on the remote + server for protocols that support it, SFTP/SCP/FILE */ + CINIT(NEW_FILE_PERMS, LONG, 159), + CINIT(NEW_DIRECTORY_PERMS, LONG, 160), + + /* Set the behaviour of POST when redirecting. Values must be set to one + of CURL_REDIR* defines below. This used to be called CURLOPT_POST301 */ + CINIT(POSTREDIR, LONG, 161), + + /* used by scp/sftp to verify the host's public key */ + CINIT(SSH_HOST_PUBLIC_KEY_MD5, OBJECTPOINT, 162), + + /* Callback function for opening socket (instead of socket(2)). Optionally, + callback is able change the address or refuse to connect returning + CURL_SOCKET_BAD. The callback should have type + curl_opensocket_callback */ + CINIT(OPENSOCKETFUNCTION, FUNCTIONPOINT, 163), + CINIT(OPENSOCKETDATA, OBJECTPOINT, 164), + + /* POST volatile input fields. */ + CINIT(COPYPOSTFIELDS, OBJECTPOINT, 165), + + /* set transfer mode (;type=) when doing FTP via an HTTP proxy */ + CINIT(PROXY_TRANSFER_MODE, LONG, 166), + + /* Callback function for seeking in the input stream */ + CINIT(SEEKFUNCTION, FUNCTIONPOINT, 167), + CINIT(SEEKDATA, OBJECTPOINT, 168), + + /* CRL file */ + CINIT(CRLFILE, OBJECTPOINT, 169), + + /* Issuer certificate */ + CINIT(ISSUERCERT, OBJECTPOINT, 170), + + /* (IPv6) Address scope */ + CINIT(ADDRESS_SCOPE, LONG, 171), + + /* Collect certificate chain info and allow it to get retrievable with + CURLINFO_CERTINFO after the transfer is complete. (Unfortunately) only + working with OpenSSL-powered builds. */ + CINIT(CERTINFO, LONG, 172), + + /* "name" and "pwd" to use when fetching. */ + CINIT(USERNAME, OBJECTPOINT, 173), + CINIT(PASSWORD, OBJECTPOINT, 174), + + /* "name" and "pwd" to use with Proxy when fetching. */ + CINIT(PROXYUSERNAME, OBJECTPOINT, 175), + CINIT(PROXYPASSWORD, OBJECTPOINT, 176), + + /* Comma separated list of hostnames defining no-proxy zones. These should + match both hostnames directly, and hostnames within a domain. For + example, local.com will match local.com and www.local.com, but NOT + notlocal.com or www.notlocal.com. For compatibility with other + implementations of this, .local.com will be considered to be the same as + local.com. A single * is the only valid wildcard, and effectively + disables the use of proxy. */ + CINIT(NOPROXY, OBJECTPOINT, 177), + + /* block size for TFTP transfers */ + CINIT(TFTP_BLKSIZE, LONG, 178), + + /* Socks Service */ + CINIT(SOCKS5_GSSAPI_SERVICE, OBJECTPOINT, 179), + + /* Socks Service */ + CINIT(SOCKS5_GSSAPI_NEC, LONG, 180), + + /* set the bitmask for the protocols that are allowed to be used for the + transfer, which thus helps the app which takes URLs from users or other + external inputs and want to restrict what protocol(s) to deal + with. Defaults to CURLPROTO_ALL. */ + CINIT(PROTOCOLS, LONG, 181), + + /* set the bitmask for the protocols that libcurl is allowed to follow to, + as a subset of the CURLOPT_PROTOCOLS ones. That means the protocol needs + to be set in both bitmasks to be allowed to get redirected to. Defaults + to all protocols except FILE and SCP. */ + CINIT(REDIR_PROTOCOLS, LONG, 182), + + /* set the SSH knownhost file name to use */ + CINIT(SSH_KNOWNHOSTS, OBJECTPOINT, 183), + + /* set the SSH host key callback, must point to a curl_sshkeycallback + function */ + CINIT(SSH_KEYFUNCTION, FUNCTIONPOINT, 184), + + /* set the SSH host key callback custom pointer */ + CINIT(SSH_KEYDATA, OBJECTPOINT, 185), + + /* set the SMTP mail originator */ + CINIT(MAIL_FROM, OBJECTPOINT, 186), + + /* set the SMTP mail receiver(s) */ + CINIT(MAIL_RCPT, OBJECTPOINT, 187), + + /* FTP: send PRET before PASV */ + CINIT(FTP_USE_PRET, LONG, 188), + + /* RTSP request method (OPTIONS, SETUP, PLAY, etc...) */ + CINIT(RTSP_REQUEST, LONG, 189), + + /* The RTSP session identifier */ + CINIT(RTSP_SESSION_ID, OBJECTPOINT, 190), + + /* The RTSP stream URI */ + CINIT(RTSP_STREAM_URI, OBJECTPOINT, 191), + + /* The Transport: header to use in RTSP requests */ + CINIT(RTSP_TRANSPORT, OBJECTPOINT, 192), + + /* Manually initialize the client RTSP CSeq for this handle */ + CINIT(RTSP_CLIENT_CSEQ, LONG, 193), + + /* Manually initialize the server RTSP CSeq for this handle */ + CINIT(RTSP_SERVER_CSEQ, LONG, 194), + + /* The stream to pass to INTERLEAVEFUNCTION. */ + CINIT(INTERLEAVEDATA, OBJECTPOINT, 195), + + /* Let the application define a custom write method for RTP data */ + CINIT(INTERLEAVEFUNCTION, FUNCTIONPOINT, 196), + + /* Turn on wildcard matching */ + CINIT(WILDCARDMATCH, LONG, 197), + + /* Directory matching callback called before downloading of an + individual file (chunk) started */ + CINIT(CHUNK_BGN_FUNCTION, FUNCTIONPOINT, 198), + + /* Directory matching callback called after the file (chunk) + was downloaded, or skipped */ + CINIT(CHUNK_END_FUNCTION, FUNCTIONPOINT, 199), + + /* Change match (fnmatch-like) callback for wildcard matching */ + CINIT(FNMATCH_FUNCTION, FUNCTIONPOINT, 200), + + /* Let the application define custom chunk data pointer */ + CINIT(CHUNK_DATA, OBJECTPOINT, 201), + + /* FNMATCH_FUNCTION user pointer */ + CINIT(FNMATCH_DATA, OBJECTPOINT, 202), + + /* send linked-list of name:port:address sets */ + CINIT(RESOLVE, OBJECTPOINT, 203), + + CURLOPT_LASTENTRY /* the last unused */ +} CURLoption; + +#ifndef CURL_NO_OLDIES /* define this to test if your app builds with all + the obsolete stuff removed! */ + +/* Backwards compatibility with older names */ +/* These are scheduled to disappear by 2011 */ + +/* This was added in version 7.19.1 */ +#define CURLOPT_POST301 CURLOPT_POSTREDIR + +/* These are scheduled to disappear by 2009 */ + +/* The following were added in 7.17.0 */ +#define CURLOPT_SSLKEYPASSWD CURLOPT_KEYPASSWD +#define CURLOPT_FTPAPPEND CURLOPT_APPEND +#define CURLOPT_FTPLISTONLY CURLOPT_DIRLISTONLY +#define CURLOPT_FTP_SSL CURLOPT_USE_SSL + +/* The following were added earlier */ + +#define CURLOPT_SSLCERTPASSWD CURLOPT_KEYPASSWD +#define CURLOPT_KRB4LEVEL CURLOPT_KRBLEVEL + +#else +/* This is set if CURL_NO_OLDIES is defined at compile-time */ +#undef CURLOPT_DNS_USE_GLOBAL_CACHE /* soon obsolete */ +#endif + + + /* Below here follows defines for the CURLOPT_IPRESOLVE option. If a host + name resolves addresses using more than one IP protocol version, this + option might be handy to force libcurl to use a specific IP version. */ +#define CURL_IPRESOLVE_WHATEVER 0 /* default, resolves addresses to all IP + versions that your system allows */ +#define CURL_IPRESOLVE_V4 1 /* resolve to ipv4 addresses */ +#define CURL_IPRESOLVE_V6 2 /* resolve to ipv6 addresses */ + + /* three convenient "aliases" that follow the name scheme better */ +#define CURLOPT_WRITEDATA CURLOPT_FILE +#define CURLOPT_READDATA CURLOPT_INFILE +#define CURLOPT_HEADERDATA CURLOPT_WRITEHEADER +#define CURLOPT_RTSPHEADER CURLOPT_HTTPHEADER + + /* These enums are for use with the CURLOPT_HTTP_VERSION option. */ +enum { + CURL_HTTP_VERSION_NONE, /* setting this means we don't care, and that we'd + like the library to choose the best possible + for us! */ + CURL_HTTP_VERSION_1_0, /* please use HTTP 1.0 in the request */ + CURL_HTTP_VERSION_1_1, /* please use HTTP 1.1 in the request */ + + CURL_HTTP_VERSION_LAST /* *ILLEGAL* http version */ +}; + +/* + * Public API enums for RTSP requests + */ +enum { + CURL_RTSPREQ_NONE, /* first in list */ + CURL_RTSPREQ_OPTIONS, + CURL_RTSPREQ_DESCRIBE, + CURL_RTSPREQ_ANNOUNCE, + CURL_RTSPREQ_SETUP, + CURL_RTSPREQ_PLAY, + CURL_RTSPREQ_PAUSE, + CURL_RTSPREQ_TEARDOWN, + CURL_RTSPREQ_GET_PARAMETER, + CURL_RTSPREQ_SET_PARAMETER, + CURL_RTSPREQ_RECORD, + CURL_RTSPREQ_RECEIVE, + CURL_RTSPREQ_LAST /* last in list */ +}; + + /* These enums are for use with the CURLOPT_NETRC option. */ +enum CURL_NETRC_OPTION { + CURL_NETRC_IGNORED, /* The .netrc will never be read. + * This is the default. */ + CURL_NETRC_OPTIONAL, /* A user:password in the URL will be preferred + * to one in the .netrc. */ + CURL_NETRC_REQUIRED, /* A user:password in the URL will be ignored. + * Unless one is set programmatically, the .netrc + * will be queried. */ + CURL_NETRC_LAST +}; + +enum { + CURL_SSLVERSION_DEFAULT, + CURL_SSLVERSION_TLSv1, + CURL_SSLVERSION_SSLv2, + CURL_SSLVERSION_SSLv3, + + CURL_SSLVERSION_LAST /* never use, keep last */ +}; + +/* symbols to use with CURLOPT_POSTREDIR. + CURL_REDIR_POST_301 and CURL_REDIR_POST_302 can be bitwise ORed so that + CURL_REDIR_POST_301 | CURL_REDIR_POST_302 == CURL_REDIR_POST_ALL */ + +#define CURL_REDIR_GET_ALL 0 +#define CURL_REDIR_POST_301 1 +#define CURL_REDIR_POST_302 2 +#define CURL_REDIR_POST_ALL (CURL_REDIR_POST_301|CURL_REDIR_POST_302) + +typedef enum { + CURL_TIMECOND_NONE, + + CURL_TIMECOND_IFMODSINCE, + CURL_TIMECOND_IFUNMODSINCE, + CURL_TIMECOND_LASTMOD, + + CURL_TIMECOND_LAST +} curl_TimeCond; + + +/* curl_strequal() and curl_strnequal() are subject for removal in a future + libcurl, see lib/README.curlx for details */ +CURL_EXTERN int (curl_strequal)(const char *s1, const char *s2); +CURL_EXTERN int (curl_strnequal)(const char *s1, const char *s2, size_t n); + +/* name is uppercase CURLFORM_ */ +#ifdef CFINIT +#undef CFINIT +#endif + +#ifdef CURL_ISOCPP +#define CFINIT(name) CURLFORM_ ## name +#else +/* The macro "##" is ISO C, we assume pre-ISO C doesn't support it. */ +#define CFINIT(name) CURLFORM_/**/name +#endif + +typedef enum { + CFINIT(NOTHING), /********* the first one is unused ************/ + + /* */ + CFINIT(COPYNAME), + CFINIT(PTRNAME), + CFINIT(NAMELENGTH), + CFINIT(COPYCONTENTS), + CFINIT(PTRCONTENTS), + CFINIT(CONTENTSLENGTH), + CFINIT(FILECONTENT), + CFINIT(ARRAY), + CFINIT(OBSOLETE), + CFINIT(FILE), + + CFINIT(BUFFER), + CFINIT(BUFFERPTR), + CFINIT(BUFFERLENGTH), + + CFINIT(CONTENTTYPE), + CFINIT(CONTENTHEADER), + CFINIT(FILENAME), + CFINIT(END), + CFINIT(OBSOLETE2), + + CFINIT(STREAM), + + CURLFORM_LASTENTRY /* the last unused */ +} CURLformoption; + +#undef CFINIT /* done */ + +/* structure to be used as parameter for CURLFORM_ARRAY */ +struct curl_forms { + CURLformoption option; + const char *value; +}; + +/* use this for multipart formpost building */ +/* Returns code for curl_formadd() + * + * Returns: + * CURL_FORMADD_OK on success + * CURL_FORMADD_MEMORY if the FormInfo allocation fails + * CURL_FORMADD_OPTION_TWICE if one option is given twice for one Form + * CURL_FORMADD_NULL if a null pointer was given for a char + * CURL_FORMADD_MEMORY if the allocation of a FormInfo struct failed + * CURL_FORMADD_UNKNOWN_OPTION if an unknown option was used + * CURL_FORMADD_INCOMPLETE if the some FormInfo is not complete (or error) + * CURL_FORMADD_MEMORY if a curl_httppost struct cannot be allocated + * CURL_FORMADD_MEMORY if some allocation for string copying failed. + * CURL_FORMADD_ILLEGAL_ARRAY if an illegal option is used in an array + * + ***************************************************************************/ +typedef enum { + CURL_FORMADD_OK, /* first, no error */ + + CURL_FORMADD_MEMORY, + CURL_FORMADD_OPTION_TWICE, + CURL_FORMADD_NULL, + CURL_FORMADD_UNKNOWN_OPTION, + CURL_FORMADD_INCOMPLETE, + CURL_FORMADD_ILLEGAL_ARRAY, + CURL_FORMADD_DISABLED, /* libcurl was built with this disabled */ + + CURL_FORMADD_LAST /* last */ +} CURLFORMcode; + +/* + * NAME curl_formadd() + * + * DESCRIPTION + * + * Pretty advanced function for building multi-part formposts. Each invoke + * adds one part that together construct a full post. Then use + * CURLOPT_HTTPPOST to send it off to libcurl. + */ +CURL_EXTERN CURLFORMcode curl_formadd(struct curl_httppost **httppost, + struct curl_httppost **last_post, + ...); + +/* + * callback function for curl_formget() + * The void *arg pointer will be the one passed as second argument to + * curl_formget(). + * The character buffer passed to it must not be freed. + * Should return the buffer length passed to it as the argument "len" on + * success. + */ +typedef size_t (*curl_formget_callback)(void *arg, const char *buf, size_t len); + +/* + * NAME curl_formget() + * + * DESCRIPTION + * + * Serialize a curl_httppost struct built with curl_formadd(). + * Accepts a void pointer as second argument which will be passed to + * the curl_formget_callback function. + * Returns 0 on success. + */ +CURL_EXTERN int curl_formget(struct curl_httppost *form, void *arg, + curl_formget_callback append); +/* + * NAME curl_formfree() + * + * DESCRIPTION + * + * Free a multipart formpost previously built with curl_formadd(). + */ +CURL_EXTERN void curl_formfree(struct curl_httppost *form); + +/* + * NAME curl_getenv() + * + * DESCRIPTION + * + * Returns a malloc()'ed string that MUST be curl_free()ed after usage is + * complete. DEPRECATED - see lib/README.curlx + */ +CURL_EXTERN char *curl_getenv(const char *variable); + +/* + * NAME curl_version() + * + * DESCRIPTION + * + * Returns a static ascii string of the libcurl version. + */ +CURL_EXTERN char *curl_version(void); + +/* + * NAME curl_easy_escape() + * + * DESCRIPTION + * + * Escapes URL strings (converts all letters consider illegal in URLs to their + * %XX versions). This function returns a new allocated string or NULL if an + * error occurred. + */ +CURL_EXTERN char *curl_easy_escape(CURL *handle, + const char *string, + int length); + +/* the previous version: */ +CURL_EXTERN char *curl_escape(const char *string, + int length); + + +/* + * NAME curl_easy_unescape() + * + * DESCRIPTION + * + * Unescapes URL encoding in strings (converts all %XX codes to their 8bit + * versions). This function returns a new allocated string or NULL if an error + * occurred. + * Conversion Note: On non-ASCII platforms the ASCII %XX codes are + * converted into the host encoding. + */ +CURL_EXTERN char *curl_easy_unescape(CURL *handle, + const char *string, + int length, + int *outlength); + +/* the previous version */ +CURL_EXTERN char *curl_unescape(const char *string, + int length); + +/* + * NAME curl_free() + * + * DESCRIPTION + * + * Provided for de-allocation in the same translation unit that did the + * allocation. Added in libcurl 7.10 + */ +CURL_EXTERN void curl_free(void *p); + +/* + * NAME curl_global_init() + * + * DESCRIPTION + * + * curl_global_init() should be invoked exactly once for each application that + * uses libcurl and before any call of other libcurl functions. + * + * This function is not thread-safe! + */ +CURL_EXTERN CURLcode curl_global_init(long flags); + +/* + * NAME curl_global_init_mem() + * + * DESCRIPTION + * + * curl_global_init() or curl_global_init_mem() should be invoked exactly once + * for each application that uses libcurl. This function can be used to + * initialize libcurl and set user defined memory management callback + * functions. Users can implement memory management routines to check for + * memory leaks, check for mis-use of the curl library etc. User registered + * callback routines with be invoked by this library instead of the system + * memory management routines like malloc, free etc. + */ +CURL_EXTERN CURLcode curl_global_init_mem(long flags, + curl_malloc_callback m, + curl_free_callback f, + curl_realloc_callback r, + curl_strdup_callback s, + curl_calloc_callback c); + +/* + * NAME curl_global_cleanup() + * + * DESCRIPTION + * + * curl_global_cleanup() should be invoked exactly once for each application + * that uses libcurl + */ +CURL_EXTERN void curl_global_cleanup(void); + +/* linked-list structure for the CURLOPT_QUOTE option (and other) */ +struct curl_slist { + char *data; + struct curl_slist *next; +}; + +/* + * NAME curl_slist_append() + * + * DESCRIPTION + * + * Appends a string to a linked list. If no list exists, it will be created + * first. Returns the new list, after appending. + */ +CURL_EXTERN struct curl_slist *curl_slist_append(struct curl_slist *, + const char *); + +/* + * NAME curl_slist_free_all() + * + * DESCRIPTION + * + * free a previously built curl_slist. + */ +CURL_EXTERN void curl_slist_free_all(struct curl_slist *); + +/* + * NAME curl_getdate() + * + * DESCRIPTION + * + * Returns the time, in seconds since 1 Jan 1970 of the time string given in + * the first argument. The time argument in the second parameter is unused + * and should be set to NULL. + */ +CURL_EXTERN time_t curl_getdate(const char *p, const time_t *unused); + +/* info about the certificate chain, only for OpenSSL builds. Asked + for with CURLOPT_CERTINFO / CURLINFO_CERTINFO */ +struct curl_certinfo { + int num_of_certs; /* number of certificates with information */ + struct curl_slist **certinfo; /* for each index in this array, there's a + linked list with textual information in the + format "name: value" */ +}; + +#define CURLINFO_STRING 0x100000 +#define CURLINFO_LONG 0x200000 +#define CURLINFO_DOUBLE 0x300000 +#define CURLINFO_SLIST 0x400000 +#define CURLINFO_MASK 0x0fffff +#define CURLINFO_TYPEMASK 0xf00000 + +typedef enum { + CURLINFO_NONE, /* first, never use this */ + CURLINFO_EFFECTIVE_URL = CURLINFO_STRING + 1, + CURLINFO_RESPONSE_CODE = CURLINFO_LONG + 2, + CURLINFO_TOTAL_TIME = CURLINFO_DOUBLE + 3, + CURLINFO_NAMELOOKUP_TIME = CURLINFO_DOUBLE + 4, + CURLINFO_CONNECT_TIME = CURLINFO_DOUBLE + 5, + CURLINFO_PRETRANSFER_TIME = CURLINFO_DOUBLE + 6, + CURLINFO_SIZE_UPLOAD = CURLINFO_DOUBLE + 7, + CURLINFO_SIZE_DOWNLOAD = CURLINFO_DOUBLE + 8, + CURLINFO_SPEED_DOWNLOAD = CURLINFO_DOUBLE + 9, + CURLINFO_SPEED_UPLOAD = CURLINFO_DOUBLE + 10, + CURLINFO_HEADER_SIZE = CURLINFO_LONG + 11, + CURLINFO_REQUEST_SIZE = CURLINFO_LONG + 12, + CURLINFO_SSL_VERIFYRESULT = CURLINFO_LONG + 13, + CURLINFO_FILETIME = CURLINFO_LONG + 14, + CURLINFO_CONTENT_LENGTH_DOWNLOAD = CURLINFO_DOUBLE + 15, + CURLINFO_CONTENT_LENGTH_UPLOAD = CURLINFO_DOUBLE + 16, + CURLINFO_STARTTRANSFER_TIME = CURLINFO_DOUBLE + 17, + CURLINFO_CONTENT_TYPE = CURLINFO_STRING + 18, + CURLINFO_REDIRECT_TIME = CURLINFO_DOUBLE + 19, + CURLINFO_REDIRECT_COUNT = CURLINFO_LONG + 20, + CURLINFO_PRIVATE = CURLINFO_STRING + 21, + CURLINFO_HTTP_CONNECTCODE = CURLINFO_LONG + 22, + CURLINFO_HTTPAUTH_AVAIL = CURLINFO_LONG + 23, + CURLINFO_PROXYAUTH_AVAIL = CURLINFO_LONG + 24, + CURLINFO_OS_ERRNO = CURLINFO_LONG + 25, + CURLINFO_NUM_CONNECTS = CURLINFO_LONG + 26, + CURLINFO_SSL_ENGINES = CURLINFO_SLIST + 27, + CURLINFO_COOKIELIST = CURLINFO_SLIST + 28, + CURLINFO_LASTSOCKET = CURLINFO_LONG + 29, + CURLINFO_FTP_ENTRY_PATH = CURLINFO_STRING + 30, + CURLINFO_REDIRECT_URL = CURLINFO_STRING + 31, + CURLINFO_PRIMARY_IP = CURLINFO_STRING + 32, + CURLINFO_APPCONNECT_TIME = CURLINFO_DOUBLE + 33, + CURLINFO_CERTINFO = CURLINFO_SLIST + 34, + CURLINFO_CONDITION_UNMET = CURLINFO_LONG + 35, + CURLINFO_RTSP_SESSION_ID = CURLINFO_STRING + 36, + CURLINFO_RTSP_CLIENT_CSEQ = CURLINFO_LONG + 37, + CURLINFO_RTSP_SERVER_CSEQ = CURLINFO_LONG + 38, + CURLINFO_RTSP_CSEQ_RECV = CURLINFO_LONG + 39, + CURLINFO_PRIMARY_PORT = CURLINFO_LONG + 40, + CURLINFO_LOCAL_IP = CURLINFO_STRING + 41, + CURLINFO_LOCAL_PORT = CURLINFO_LONG + 42, + /* Fill in new entries below here! */ + + CURLINFO_LASTONE = 42 +} CURLINFO; + +/* CURLINFO_RESPONSE_CODE is the new name for the option previously known as + CURLINFO_HTTP_CODE */ +#define CURLINFO_HTTP_CODE CURLINFO_RESPONSE_CODE + +typedef enum { + CURLCLOSEPOLICY_NONE, /* first, never use this */ + + CURLCLOSEPOLICY_OLDEST, + CURLCLOSEPOLICY_LEAST_RECENTLY_USED, + CURLCLOSEPOLICY_LEAST_TRAFFIC, + CURLCLOSEPOLICY_SLOWEST, + CURLCLOSEPOLICY_CALLBACK, + + CURLCLOSEPOLICY_LAST /* last, never use this */ +} curl_closepolicy; + +#define CURL_GLOBAL_SSL (1<<0) +#define CURL_GLOBAL_WIN32 (1<<1) +#define CURL_GLOBAL_ALL (CURL_GLOBAL_SSL|CURL_GLOBAL_WIN32) +#define CURL_GLOBAL_NOTHING 0 +#define CURL_GLOBAL_DEFAULT CURL_GLOBAL_ALL + + +/***************************************************************************** + * Setup defines, protos etc for the sharing stuff. + */ + +/* Different data locks for a single share */ +typedef enum { + CURL_LOCK_DATA_NONE = 0, + /* CURL_LOCK_DATA_SHARE is used internally to say that + * the locking is just made to change the internal state of the share + * itself. + */ + CURL_LOCK_DATA_SHARE, + CURL_LOCK_DATA_COOKIE, + CURL_LOCK_DATA_DNS, + CURL_LOCK_DATA_SSL_SESSION, + CURL_LOCK_DATA_CONNECT, + CURL_LOCK_DATA_LAST +} curl_lock_data; + +/* Different lock access types */ +typedef enum { + CURL_LOCK_ACCESS_NONE = 0, /* unspecified action */ + CURL_LOCK_ACCESS_SHARED = 1, /* for read perhaps */ + CURL_LOCK_ACCESS_SINGLE = 2, /* for write perhaps */ + CURL_LOCK_ACCESS_LAST /* never use */ +} curl_lock_access; + +typedef void (*curl_lock_function)(CURL *handle, + curl_lock_data data, + curl_lock_access locktype, + void *userptr); +typedef void (*curl_unlock_function)(CURL *handle, + curl_lock_data data, + void *userptr); + +typedef void CURLSH; + +typedef enum { + CURLSHE_OK, /* all is fine */ + CURLSHE_BAD_OPTION, /* 1 */ + CURLSHE_IN_USE, /* 2 */ + CURLSHE_INVALID, /* 3 */ + CURLSHE_NOMEM, /* out of memory */ + CURLSHE_LAST /* never use */ +} CURLSHcode; + +typedef enum { + CURLSHOPT_NONE, /* don't use */ + CURLSHOPT_SHARE, /* specify a data type to share */ + CURLSHOPT_UNSHARE, /* specify which data type to stop sharing */ + CURLSHOPT_LOCKFUNC, /* pass in a 'curl_lock_function' pointer */ + CURLSHOPT_UNLOCKFUNC, /* pass in a 'curl_unlock_function' pointer */ + CURLSHOPT_USERDATA, /* pass in a user data pointer used in the lock/unlock + callback functions */ + CURLSHOPT_LAST /* never use */ +} CURLSHoption; + +CURL_EXTERN CURLSH *curl_share_init(void); +CURL_EXTERN CURLSHcode curl_share_setopt(CURLSH *, CURLSHoption option, ...); +CURL_EXTERN CURLSHcode curl_share_cleanup(CURLSH *); + +/**************************************************************************** + * Structures for querying information about the curl library at runtime. + */ + +typedef enum { + CURLVERSION_FIRST, + CURLVERSION_SECOND, + CURLVERSION_THIRD, + CURLVERSION_FOURTH, + CURLVERSION_LAST /* never actually use this */ +} CURLversion; + +/* The 'CURLVERSION_NOW' is the symbolic name meant to be used by + basically all programs ever that want to get version information. It is + meant to be a built-in version number for what kind of struct the caller + expects. If the struct ever changes, we redefine the NOW to another enum + from above. */ +#define CURLVERSION_NOW CURLVERSION_FOURTH + +typedef struct { + CURLversion age; /* age of the returned struct */ + const char *version; /* LIBCURL_VERSION */ + unsigned int version_num; /* LIBCURL_VERSION_NUM */ + const char *host; /* OS/host/cpu/machine when configured */ + int features; /* bitmask, see defines below */ + const char *ssl_version; /* human readable string */ + long ssl_version_num; /* not used anymore, always 0 */ + const char *libz_version; /* human readable string */ + /* protocols is terminated by an entry with a NULL protoname */ + const char * const *protocols; + + /* The fields below this were added in CURLVERSION_SECOND */ + const char *ares; + int ares_num; + + /* This field was added in CURLVERSION_THIRD */ + const char *libidn; + + /* These field were added in CURLVERSION_FOURTH */ + + /* Same as '_libiconv_version' if built with HAVE_ICONV */ + int iconv_ver_num; + + const char *libssh_version; /* human readable string */ + +} curl_version_info_data; + +#define CURL_VERSION_IPV6 (1<<0) /* IPv6-enabled */ +#define CURL_VERSION_KERBEROS4 (1<<1) /* kerberos auth is supported */ +#define CURL_VERSION_SSL (1<<2) /* SSL options are present */ +#define CURL_VERSION_LIBZ (1<<3) /* libz features are present */ +#define CURL_VERSION_NTLM (1<<4) /* NTLM auth is supported */ +#define CURL_VERSION_GSSNEGOTIATE (1<<5) /* Negotiate auth support */ +#define CURL_VERSION_DEBUG (1<<6) /* built with debug capabilities */ +#define CURL_VERSION_ASYNCHDNS (1<<7) /* asynchronous dns resolves */ +#define CURL_VERSION_SPNEGO (1<<8) /* SPNEGO auth */ +#define CURL_VERSION_LARGEFILE (1<<9) /* supports files bigger than 2GB */ +#define CURL_VERSION_IDN (1<<10) /* International Domain Names support */ +#define CURL_VERSION_SSPI (1<<11) /* SSPI is supported */ +#define CURL_VERSION_CONV (1<<12) /* character conversions supported */ +#define CURL_VERSION_CURLDEBUG (1<<13) /* debug memory tracking supported */ + +/* + * NAME curl_version_info() + * + * DESCRIPTION + * + * This function returns a pointer to a static copy of the version info + * struct. See above. + */ +CURL_EXTERN curl_version_info_data *curl_version_info(CURLversion); + +/* + * NAME curl_easy_strerror() + * + * DESCRIPTION + * + * The curl_easy_strerror function may be used to turn a CURLcode value + * into the equivalent human readable error string. This is useful + * for printing meaningful error messages. + */ +CURL_EXTERN const char *curl_easy_strerror(CURLcode); + +/* + * NAME curl_share_strerror() + * + * DESCRIPTION + * + * The curl_share_strerror function may be used to turn a CURLSHcode value + * into the equivalent human readable error string. This is useful + * for printing meaningful error messages. + */ +CURL_EXTERN const char *curl_share_strerror(CURLSHcode); + +/* + * NAME curl_easy_pause() + * + * DESCRIPTION + * + * The curl_easy_pause function pauses or unpauses transfers. Select the new + * state by setting the bitmask, use the convenience defines below. + * + */ +CURL_EXTERN CURLcode curl_easy_pause(CURL *handle, int bitmask); + +#define CURLPAUSE_RECV (1<<0) +#define CURLPAUSE_RECV_CONT (0) + +#define CURLPAUSE_SEND (1<<2) +#define CURLPAUSE_SEND_CONT (0) + +#define CURLPAUSE_ALL (CURLPAUSE_RECV|CURLPAUSE_SEND) +#define CURLPAUSE_CONT (CURLPAUSE_RECV_CONT|CURLPAUSE_SEND_CONT) + +#ifdef __cplusplus +} +#endif + +/* unfortunately, the easy.h and multi.h include files need options and info + stuff before they can be included! */ +#include "easy.h" /* nothing in curl is fun without the easy stuff */ +#include "multi.h" + +/* the typechecker doesn't work in C++ (yet) */ +#if defined(__GNUC__) && defined(__GNUC_MINOR__) && \ + ((__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3)) && \ + !defined(__cplusplus) && !defined(CURL_DISABLE_TYPECHECK) +#include "typecheck-gcc.h" +#else +#if defined(__STDC__) && (__STDC__ >= 1) +/* This preprocessor magic that replaces a call with the exact same call is + only done to make sure application authors pass exactly three arguments + to these functions. */ +#define curl_easy_setopt(handle,opt,param) curl_easy_setopt(handle,opt,param) +#define curl_easy_getinfo(handle,info,arg) curl_easy_getinfo(handle,info,arg) +#define curl_share_setopt(share,opt,param) curl_share_setopt(share,opt,param) +#define curl_multi_setopt(handle,opt,param) curl_multi_setopt(handle,opt,param) +#endif /* __STDC__ >= 1 */ +#endif /* gcc >= 4.3 && !__cplusplus */ + +#endif /* __CURL_CURL_H */ diff --git a/mobicore/common/curl/include/curl/curlbuild.h b/mobicore/common/curl/include/curl/curlbuild.h new file mode 100644 index 0000000000000000000000000000000000000000..81f4a285470c0e6a8bec459574d8a7e64c02e666 --- /dev/null +++ b/mobicore/common/curl/include/curl/curlbuild.h @@ -0,0 +1,191 @@ +/* include/curl/curlbuild.h. Generated from curlbuild.h.in by configure. */ +#ifndef __CURL_CURLBUILD_H +#define __CURL_CURLBUILD_H +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) 1998 - 2009, Daniel Stenberg, , et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at http://curl.haxx.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ***************************************************************************/ + +/* ================================================================ */ +/* NOTES FOR CONFIGURE CAPABLE SYSTEMS */ +/* ================================================================ */ + +/* + * NOTE 1: + * ------- + * + * Nothing in this file is intended to be modified or adjusted by the + * curl library user nor by the curl library builder. + * + * If you think that something actually needs to be changed, adjusted + * or fixed in this file, then, report it on the libcurl development + * mailing list: http://cool.haxx.se/mailman/listinfo/curl-library/ + * + * This header file shall only export symbols which are 'curl' or 'CURL' + * prefixed, otherwise public name space would be polluted. + * + * NOTE 2: + * ------- + * + * Right now you might be staring at file include/curl/curlbuild.h.in or + * at file include/curl/curlbuild.h, this is due to the following reason: + * + * On systems capable of running the configure script, the configure process + * will overwrite the distributed include/curl/curlbuild.h file with one that + * is suitable and specific to the library being configured and built, which + * is generated from the include/curl/curlbuild.h.in template file. + * + */ + +/* ================================================================ */ +/* DEFINITION OF THESE SYMBOLS SHALL NOT TAKE PLACE ANYWHERE ELSE */ +/* ================================================================ */ + +#ifdef CURL_SIZEOF_LONG +# error "CURL_SIZEOF_LONG shall not be defined except in curlbuild.h" + Error Compilation_aborted_CURL_SIZEOF_LONG_already_defined +#endif + +#ifdef CURL_TYPEOF_CURL_SOCKLEN_T +# error "CURL_TYPEOF_CURL_SOCKLEN_T shall not be defined except in curlbuild.h" + Error Compilation_aborted_CURL_TYPEOF_CURL_SOCKLEN_T_already_defined +#endif + +#ifdef CURL_SIZEOF_CURL_SOCKLEN_T +# error "CURL_SIZEOF_CURL_SOCKLEN_T shall not be defined except in curlbuild.h" + Error Compilation_aborted_CURL_SIZEOF_CURL_SOCKLEN_T_already_defined +#endif + +#ifdef CURL_TYPEOF_CURL_OFF_T +# error "CURL_TYPEOF_CURL_OFF_T shall not be defined except in curlbuild.h" + Error Compilation_aborted_CURL_TYPEOF_CURL_OFF_T_already_defined +#endif + +#ifdef CURL_FORMAT_CURL_OFF_T +# error "CURL_FORMAT_CURL_OFF_T shall not be defined except in curlbuild.h" + Error Compilation_aborted_CURL_FORMAT_CURL_OFF_T_already_defined +#endif + +#ifdef CURL_FORMAT_CURL_OFF_TU +# error "CURL_FORMAT_CURL_OFF_TU shall not be defined except in curlbuild.h" + Error Compilation_aborted_CURL_FORMAT_CURL_OFF_TU_already_defined +#endif + +#ifdef CURL_FORMAT_OFF_T +# error "CURL_FORMAT_OFF_T shall not be defined except in curlbuild.h" + Error Compilation_aborted_CURL_FORMAT_OFF_T_already_defined +#endif + +#ifdef CURL_SIZEOF_CURL_OFF_T +# error "CURL_SIZEOF_CURL_OFF_T shall not be defined except in curlbuild.h" + Error Compilation_aborted_CURL_SIZEOF_CURL_OFF_T_already_defined +#endif + +#ifdef CURL_SUFFIX_CURL_OFF_T +# error "CURL_SUFFIX_CURL_OFF_T shall not be defined except in curlbuild.h" + Error Compilation_aborted_CURL_SUFFIX_CURL_OFF_T_already_defined +#endif + +#ifdef CURL_SUFFIX_CURL_OFF_TU +# error "CURL_SUFFIX_CURL_OFF_TU shall not be defined except in curlbuild.h" + Error Compilation_aborted_CURL_SUFFIX_CURL_OFF_TU_already_defined +#endif + +/* ================================================================ */ +/* EXTERNAL INTERFACE SETTINGS FOR CONFIGURE CAPABLE SYSTEMS ONLY */ +/* ================================================================ */ + +/* Configure process defines this to 1 when it finds out that system */ +/* header file ws2tcpip.h must be included by the external interface. */ +/* #undef CURL_PULL_WS2TCPIP_H */ +#ifdef CURL_PULL_WS2TCPIP_H +# ifndef WIN32_LEAN_AND_MEAN +# define WIN32_LEAN_AND_MEAN +# endif +# include +# include +# include +#endif + +/* Configure process defines this to 1 when it finds out that system */ +/* header file sys/types.h must be included by the external interface. */ +#define CURL_PULL_SYS_TYPES_H 1 +#ifdef CURL_PULL_SYS_TYPES_H +# include +#endif + +/* Configure process defines this to 1 when it finds out that system */ +/* header file stdint.h must be included by the external interface. */ +#define CURL_PULL_STDINT_H 1 +#ifdef CURL_PULL_STDINT_H +# include +#endif + +/* Configure process defines this to 1 when it finds out that system */ +/* header file inttypes.h must be included by the external interface. */ +#define CURL_PULL_INTTYPES_H 1 +#ifdef CURL_PULL_INTTYPES_H +# include +#endif + +/* Configure process defines this to 1 when it finds out that system */ +/* header file sys/socket.h must be included by the external interface. */ +#define CURL_PULL_SYS_SOCKET_H 1 +#ifdef CURL_PULL_SYS_SOCKET_H +# include +#endif + +/* The size of `long', as computed by sizeof. */ +#define CURL_SIZEOF_LONG 4 + +/* Integral data type used for curl_socklen_t. */ +#define CURL_TYPEOF_CURL_SOCKLEN_T socklen_t + +/* The size of `curl_socklen_t', as computed by sizeof. */ +#define CURL_SIZEOF_CURL_SOCKLEN_T 4 + +/* Data type definition of curl_socklen_t. */ +typedef CURL_TYPEOF_CURL_SOCKLEN_T curl_socklen_t; + +/* Signed integral data type used for curl_off_t. */ +#define CURL_TYPEOF_CURL_OFF_T int64_t + +/* Data type definition of curl_off_t. */ +typedef CURL_TYPEOF_CURL_OFF_T curl_off_t; + +/* curl_off_t formatting string directive without "%" conversion specifier. */ +#define CURL_FORMAT_CURL_OFF_T "lld" + +/* unsigned curl_off_t formatting string without "%" conversion specifier. */ +#define CURL_FORMAT_CURL_OFF_TU "llu" + +/* curl_off_t formatting string directive with "%" conversion specifier. */ +#define CURL_FORMAT_OFF_T "%lld" + +/* The size of `curl_off_t', as computed by sizeof. */ +#define CURL_SIZEOF_CURL_OFF_T 8 + +/* curl_off_t constant suffix. */ +#define CURL_SUFFIX_CURL_OFF_T LL + +/* unsigned curl_off_t constant suffix. */ +#define CURL_SUFFIX_CURL_OFF_TU ULL + +#endif /* __CURL_CURLBUILD_H */ diff --git a/mobicore/common/curl/include/curl/curlbuild.h.cmake b/mobicore/common/curl/include/curl/curlbuild.h.cmake new file mode 100644 index 0000000000000000000000000000000000000000..3aa772fc4715dc853ee1c4752f55eaa900d1d2b3 --- /dev/null +++ b/mobicore/common/curl/include/curl/curlbuild.h.cmake @@ -0,0 +1,180 @@ +#ifndef __CURL_CURLBUILD_H +#define __CURL_CURLBUILD_H +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) 1998 - 2008, Daniel Stenberg, , et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at http://curl.haxx.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ***************************************************************************/ + +/* ================================================================ */ +/* NOTES FOR CONFIGURE CAPABLE SYSTEMS */ +/* ================================================================ */ + +/* + * NOTE 1: + * ------- + * + * Nothing in this file is intended to be modified or adjusted by the + * curl library user nor by the curl library builder. + * + * If you think that something actually needs to be changed, adjusted + * or fixed in this file, then, report it on the libcurl development + * mailing list: http://cool.haxx.se/mailman/listinfo/curl-library/ + * + * This header file shall only export symbols which are 'curl' or 'CURL' + * prefixed, otherwise public name space would be polluted. + * + * NOTE 2: + * ------- + * + * Right now you might be staring at file include/curl/curlbuild.h.in or + * at file include/curl/curlbuild.h, this is due to the following reason: + * + * On systems capable of running the configure script, the configure process + * will overwrite the distributed include/curl/curlbuild.h file with one that + * is suitable and specific to the library being configured and built, which + * is generated from the include/curl/curlbuild.h.in template file. + * + */ + +/* ================================================================ */ +/* DEFINITION OF THESE SYMBOLS SHALL NOT TAKE PLACE ANYWHERE ELSE */ +/* ================================================================ */ + +#ifdef CURL_SIZEOF_LONG +# error "CURL_SIZEOF_LONG shall not be defined except in curlbuild.h" + Error Compilation_aborted_CURL_SIZEOF_LONG_already_defined +#endif + +#ifdef CURL_TYPEOF_CURL_SOCKLEN_T +# error "CURL_TYPEOF_CURL_SOCKLEN_T shall not be defined except in curlbuild.h" + Error Compilation_aborted_CURL_TYPEOF_CURL_SOCKLEN_T_already_defined +#endif + +#ifdef CURL_SIZEOF_CURL_SOCKLEN_T +# error "CURL_SIZEOF_CURL_SOCKLEN_T shall not be defined except in curlbuild.h" + Error Compilation_aborted_CURL_SIZEOF_CURL_SOCKLEN_T_already_defined +#endif +#ifdef CURL_TYPEOF_CURL_OFF_T +# error "CURL_TYPEOF_CURL_OFF_T shall not be defined except in curlbuild.h" + Error Compilation_aborted_CURL_TYPEOF_CURL_OFF_T_already_defined +#endif + +#ifdef CURL_FORMAT_CURL_OFF_T +# error "CURL_FORMAT_CURL_OFF_T shall not be defined except in curlbuild.h" + Error Compilation_aborted_CURL_FORMAT_CURL_OFF_T_already_defined +#endif + +#ifdef CURL_FORMAT_CURL_OFF_TU +# error "CURL_FORMAT_CURL_OFF_TU shall not be defined except in curlbuild.h" + Error Compilation_aborted_CURL_FORMAT_CURL_OFF_TU_already_defined +#endif + +#ifdef CURL_FORMAT_OFF_T +# error "CURL_FORMAT_OFF_T shall not be defined except in curlbuild.h" + Error Compilation_aborted_CURL_FORMAT_OFF_T_already_defined +#endif + +#ifdef CURL_SIZEOF_CURL_OFF_T +# error "CURL_SIZEOF_CURL_OFF_T shall not be defined except in curlbuild.h" + Error Compilation_aborted_CURL_SIZEOF_CURL_OFF_T_already_defined +#endif + +#ifdef CURL_SUFFIX_CURL_OFF_T +# error "CURL_SUFFIX_CURL_OFF_T shall not be defined except in curlbuild.h" + Error Compilation_aborted_CURL_SUFFIX_CURL_OFF_T_already_defined +#endif + +#ifdef CURL_SUFFIX_CURL_OFF_TU +# error "CURL_SUFFIX_CURL_OFF_TU shall not be defined except in curlbuild.h" + Error Compilation_aborted_CURL_SUFFIX_CURL_OFF_TU_already_defined +#endif + +/* ================================================================ */ +/* EXTERNAL INTERFACE SETTINGS FOR CONFIGURE CAPABLE SYSTEMS ONLY */ +/* ================================================================ */ + +/* Configure process defines this to 1 when it finds out that system */ +/* header file sys/types.h must be included by the external interface. */ +#cmakedefine CURL_PULL_SYS_TYPES_H ${CURL_PULL_SYS_TYPES_H} +#ifdef CURL_PULL_SYS_TYPES_H +# include +#endif + +/* Configure process defines this to 1 when it finds out that system */ +/* header file stdint.h must be included by the external interface. */ +#cmakedefine CURL_PULL_STDINT_H ${CURL_PULL_STDINT_H} +#ifdef CURL_PULL_STDINT_H +# include +#endif + +/* Configure process defines this to 1 when it finds out that system */ +/* header file inttypes.h must be included by the external interface. */ +#cmakedefine CURL_PULL_INTTYPES_H ${CURL_PULL_INTTYPES_H} +#ifdef CURL_PULL_INTTYPES_H +# include +#endif + +/* The size of `long', as computed by sizeof. */ +#cmakedefine CURL_SIZEOF_LONG ${CURL_SIZEOF_LONG} + +/* Integral data type used for curl_socklen_t. */ +#cmakedefine CURL_TYPEOF_CURL_SOCKLEN_T ${CURL_TYPEOF_CURL_SOCKLEN_T} + +/* on windows socklen_t is in here */ +#ifdef _WIN32 +# include +# include +#endif + +#ifdef HAVE_SYS_SOCKET_H +# include +#endif + +/* Data type definition of curl_socklen_t. */ +typedef CURL_TYPEOF_CURL_SOCKLEN_T curl_socklen_t; + +/* The size of `curl_socklen_t', as computed by sizeof. */ +#cmakedefine CURL_SIZEOF_CURL_SOCKLEN_T ${CURL_SIZEOF_CURL_SOCKLEN_T} + +/* Signed integral data type used for curl_off_t. */ +#cmakedefine CURL_TYPEOF_CURL_OFF_T ${CURL_TYPEOF_CURL_OFF_T} + +/* Data type definition of curl_off_t. */ +typedef CURL_TYPEOF_CURL_OFF_T curl_off_t; + +/* curl_off_t formatting string directive without "%" conversion specifier. */ +#cmakedefine CURL_FORMAT_CURL_OFF_T "${CURL_FORMAT_CURL_OFF_T}" + +/* unsigned curl_off_t formatting string without "%" conversion specifier. */ +#cmakedefine CURL_FORMAT_CURL_OFF_TU "${CURL_FORMAT_CURL_OFF_TU}" + +/* curl_off_t formatting string directive with "%" conversion specifier. */ +#cmakedefine CURL_FORMAT_OFF_T "${CURL_FORMAT_OFF_T}" + +/* The size of `curl_off_t', as computed by sizeof. */ +#cmakedefine CURL_SIZEOF_CURL_OFF_T ${CURL_SIZEOF_CURL_OFF_T} + +/* curl_off_t constant suffix. */ +#cmakedefine CURL_SUFFIX_CURL_OFF_T ${CURL_SUFFIX_CURL_OFF_T} + +/* unsigned curl_off_t constant suffix. */ +#cmakedefine CURL_SUFFIX_CURL_OFF_TU ${CURL_SUFFIX_CURL_OFF_TU} + +#endif /* __CURL_CURLBUILD_H */ diff --git a/mobicore/common/curl/include/curl/curlbuild.h.in b/mobicore/common/curl/include/curl/curlbuild.h.in new file mode 100644 index 0000000000000000000000000000000000000000..cb1de80a03e6ec7f4c1c3ed410ccfb3d76e1f17e --- /dev/null +++ b/mobicore/common/curl/include/curl/curlbuild.h.in @@ -0,0 +1,190 @@ +#ifndef __CURL_CURLBUILD_H +#define __CURL_CURLBUILD_H +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) 1998 - 2009, Daniel Stenberg, , et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at http://curl.haxx.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ***************************************************************************/ + +/* ================================================================ */ +/* NOTES FOR CONFIGURE CAPABLE SYSTEMS */ +/* ================================================================ */ + +/* + * NOTE 1: + * ------- + * + * Nothing in this file is intended to be modified or adjusted by the + * curl library user nor by the curl library builder. + * + * If you think that something actually needs to be changed, adjusted + * or fixed in this file, then, report it on the libcurl development + * mailing list: http://cool.haxx.se/mailman/listinfo/curl-library/ + * + * This header file shall only export symbols which are 'curl' or 'CURL' + * prefixed, otherwise public name space would be polluted. + * + * NOTE 2: + * ------- + * + * Right now you might be staring at file include/curl/curlbuild.h.in or + * at file include/curl/curlbuild.h, this is due to the following reason: + * + * On systems capable of running the configure script, the configure process + * will overwrite the distributed include/curl/curlbuild.h file with one that + * is suitable and specific to the library being configured and built, which + * is generated from the include/curl/curlbuild.h.in template file. + * + */ + +/* ================================================================ */ +/* DEFINITION OF THESE SYMBOLS SHALL NOT TAKE PLACE ANYWHERE ELSE */ +/* ================================================================ */ + +#ifdef CURL_SIZEOF_LONG +# error "CURL_SIZEOF_LONG shall not be defined except in curlbuild.h" + Error Compilation_aborted_CURL_SIZEOF_LONG_already_defined +#endif + +#ifdef CURL_TYPEOF_CURL_SOCKLEN_T +# error "CURL_TYPEOF_CURL_SOCKLEN_T shall not be defined except in curlbuild.h" + Error Compilation_aborted_CURL_TYPEOF_CURL_SOCKLEN_T_already_defined +#endif + +#ifdef CURL_SIZEOF_CURL_SOCKLEN_T +# error "CURL_SIZEOF_CURL_SOCKLEN_T shall not be defined except in curlbuild.h" + Error Compilation_aborted_CURL_SIZEOF_CURL_SOCKLEN_T_already_defined +#endif + +#ifdef CURL_TYPEOF_CURL_OFF_T +# error "CURL_TYPEOF_CURL_OFF_T shall not be defined except in curlbuild.h" + Error Compilation_aborted_CURL_TYPEOF_CURL_OFF_T_already_defined +#endif + +#ifdef CURL_FORMAT_CURL_OFF_T +# error "CURL_FORMAT_CURL_OFF_T shall not be defined except in curlbuild.h" + Error Compilation_aborted_CURL_FORMAT_CURL_OFF_T_already_defined +#endif + +#ifdef CURL_FORMAT_CURL_OFF_TU +# error "CURL_FORMAT_CURL_OFF_TU shall not be defined except in curlbuild.h" + Error Compilation_aborted_CURL_FORMAT_CURL_OFF_TU_already_defined +#endif + +#ifdef CURL_FORMAT_OFF_T +# error "CURL_FORMAT_OFF_T shall not be defined except in curlbuild.h" + Error Compilation_aborted_CURL_FORMAT_OFF_T_already_defined +#endif + +#ifdef CURL_SIZEOF_CURL_OFF_T +# error "CURL_SIZEOF_CURL_OFF_T shall not be defined except in curlbuild.h" + Error Compilation_aborted_CURL_SIZEOF_CURL_OFF_T_already_defined +#endif + +#ifdef CURL_SUFFIX_CURL_OFF_T +# error "CURL_SUFFIX_CURL_OFF_T shall not be defined except in curlbuild.h" + Error Compilation_aborted_CURL_SUFFIX_CURL_OFF_T_already_defined +#endif + +#ifdef CURL_SUFFIX_CURL_OFF_TU +# error "CURL_SUFFIX_CURL_OFF_TU shall not be defined except in curlbuild.h" + Error Compilation_aborted_CURL_SUFFIX_CURL_OFF_TU_already_defined +#endif + +/* ================================================================ */ +/* EXTERNAL INTERFACE SETTINGS FOR CONFIGURE CAPABLE SYSTEMS ONLY */ +/* ================================================================ */ + +/* Configure process defines this to 1 when it finds out that system */ +/* header file ws2tcpip.h must be included by the external interface. */ +#undef CURL_PULL_WS2TCPIP_H +#ifdef CURL_PULL_WS2TCPIP_H +# ifndef WIN32_LEAN_AND_MEAN +# define WIN32_LEAN_AND_MEAN +# endif +# include +# include +# include +#endif + +/* Configure process defines this to 1 when it finds out that system */ +/* header file sys/types.h must be included by the external interface. */ +#undef CURL_PULL_SYS_TYPES_H +#ifdef CURL_PULL_SYS_TYPES_H +# include +#endif + +/* Configure process defines this to 1 when it finds out that system */ +/* header file stdint.h must be included by the external interface. */ +#undef CURL_PULL_STDINT_H +#ifdef CURL_PULL_STDINT_H +# include +#endif + +/* Configure process defines this to 1 when it finds out that system */ +/* header file inttypes.h must be included by the external interface. */ +#undef CURL_PULL_INTTYPES_H +#ifdef CURL_PULL_INTTYPES_H +# include +#endif + +/* Configure process defines this to 1 when it finds out that system */ +/* header file sys/socket.h must be included by the external interface. */ +#undef CURL_PULL_SYS_SOCKET_H +#ifdef CURL_PULL_SYS_SOCKET_H +# include +#endif + +/* The size of `long', as computed by sizeof. */ +#undef CURL_SIZEOF_LONG + +/* Integral data type used for curl_socklen_t. */ +#undef CURL_TYPEOF_CURL_SOCKLEN_T + +/* The size of `curl_socklen_t', as computed by sizeof. */ +#undef CURL_SIZEOF_CURL_SOCKLEN_T + +/* Data type definition of curl_socklen_t. */ +typedef CURL_TYPEOF_CURL_SOCKLEN_T curl_socklen_t; + +/* Signed integral data type used for curl_off_t. */ +#undef CURL_TYPEOF_CURL_OFF_T + +/* Data type definition of curl_off_t. */ +typedef CURL_TYPEOF_CURL_OFF_T curl_off_t; + +/* curl_off_t formatting string directive without "%" conversion specifier. */ +#undef CURL_FORMAT_CURL_OFF_T + +/* unsigned curl_off_t formatting string without "%" conversion specifier. */ +#undef CURL_FORMAT_CURL_OFF_TU + +/* curl_off_t formatting string directive with "%" conversion specifier. */ +#undef CURL_FORMAT_OFF_T + +/* The size of `curl_off_t', as computed by sizeof. */ +#undef CURL_SIZEOF_CURL_OFF_T + +/* curl_off_t constant suffix. */ +#undef CURL_SUFFIX_CURL_OFF_T + +/* unsigned curl_off_t constant suffix. */ +#undef CURL_SUFFIX_CURL_OFF_TU + +#endif /* __CURL_CURLBUILD_H */ diff --git a/mobicore/common/curl/include/curl/curlrules.h b/mobicore/common/curl/include/curl/curlrules.h new file mode 100644 index 0000000000000000000000000000000000000000..8aad1df678c0d827ca792c16137d17d86963fc3d --- /dev/null +++ b/mobicore/common/curl/include/curl/curlrules.h @@ -0,0 +1,252 @@ +#ifndef __CURL_CURLRULES_H +#define __CURL_CURLRULES_H +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) 1998 - 2010, Daniel Stenberg, , et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at http://curl.haxx.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ***************************************************************************/ + +/* ================================================================ */ +/* COMPILE TIME SANITY CHECKS */ +/* ================================================================ */ + +/* + * NOTE 1: + * ------- + * + * All checks done in this file are intentionally placed in a public + * header file which is pulled by curl/curl.h when an application is + * being built using an already built libcurl library. Additionally + * this file is also included and used when building the library. + * + * If compilation fails on this file it is certainly sure that the + * problem is elsewhere. It could be a problem in the curlbuild.h + * header file, or simply that you are using different compilation + * settings than those used to build the library. + * + * Nothing in this file is intended to be modified or adjusted by the + * curl library user nor by the curl library builder. + * + * Do not deactivate any check, these are done to make sure that the + * library is properly built and used. + * + * You can find further help on the libcurl development mailing list: + * http://cool.haxx.se/mailman/listinfo/curl-library/ + * + * NOTE 2 + * ------ + * + * Some of the following compile time checks are based on the fact + * that the dimension of a constant array can not be a negative one. + * In this way if the compile time verification fails, the compilation + * will fail issuing an error. The error description wording is compiler + * dependent but it will be quite similar to one of the following: + * + * "negative subscript or subscript is too large" + * "array must have at least one element" + * "-1 is an illegal array size" + * "size of array is negative" + * + * If you are building an application which tries to use an already + * built libcurl library and you are getting this kind of errors on + * this file, it is a clear indication that there is a mismatch between + * how the library was built and how you are trying to use it for your + * application. Your already compiled or binary library provider is the + * only one who can give you the details you need to properly use it. + */ + +/* + * Verify that some macros are actually defined. + */ + +#ifndef CURL_SIZEOF_LONG +# error "CURL_SIZEOF_LONG definition is missing!" + Error Compilation_aborted_CURL_SIZEOF_LONG_is_missing +#endif + +#ifndef CURL_TYPEOF_CURL_SOCKLEN_T +# error "CURL_TYPEOF_CURL_SOCKLEN_T definition is missing!" + Error Compilation_aborted_CURL_TYPEOF_CURL_SOCKLEN_T_is_missing +#endif + +#ifndef CURL_SIZEOF_CURL_SOCKLEN_T +# error "CURL_SIZEOF_CURL_SOCKLEN_T definition is missing!" + Error Compilation_aborted_CURL_SIZEOF_CURL_SOCKLEN_T_is_missing +#endif + +#ifndef CURL_TYPEOF_CURL_OFF_T +# error "CURL_TYPEOF_CURL_OFF_T definition is missing!" + Error Compilation_aborted_CURL_TYPEOF_CURL_OFF_T_is_missing +#endif + +#ifndef CURL_FORMAT_CURL_OFF_T +# error "CURL_FORMAT_CURL_OFF_T definition is missing!" + Error Compilation_aborted_CURL_FORMAT_CURL_OFF_T_is_missing +#endif + +#ifndef CURL_FORMAT_CURL_OFF_TU +# error "CURL_FORMAT_CURL_OFF_TU definition is missing!" + Error Compilation_aborted_CURL_FORMAT_CURL_OFF_TU_is_missing +#endif + +#ifndef CURL_FORMAT_OFF_T +# error "CURL_FORMAT_OFF_T definition is missing!" + Error Compilation_aborted_CURL_FORMAT_OFF_T_is_missing +#endif + +#ifndef CURL_SIZEOF_CURL_OFF_T +# error "CURL_SIZEOF_CURL_OFF_T definition is missing!" + Error Compilation_aborted_CURL_SIZEOF_CURL_OFF_T_is_missing +#endif + +#ifndef CURL_SUFFIX_CURL_OFF_T +# error "CURL_SUFFIX_CURL_OFF_T definition is missing!" + Error Compilation_aborted_CURL_SUFFIX_CURL_OFF_T_is_missing +#endif + +#ifndef CURL_SUFFIX_CURL_OFF_TU +# error "CURL_SUFFIX_CURL_OFF_TU definition is missing!" + Error Compilation_aborted_CURL_SUFFIX_CURL_OFF_TU_is_missing +#endif + +/* + * Macros private to this header file. + */ + +#define CurlchkszEQ(t, s) sizeof(t) == s ? 1 : -1 + +#define CurlchkszGE(t1, t2) sizeof(t1) >= sizeof(t2) ? 1 : -1 + +/* + * Verify that the size previously defined and expected for long + * is the same as the one reported by sizeof() at compile time. + */ + +typedef char + __curl_rule_01__ + [CurlchkszEQ(long, CURL_SIZEOF_LONG)]; + +/* + * Verify that the size previously defined and expected for + * curl_off_t is actually the the same as the one reported + * by sizeof() at compile time. + */ + +typedef char + __curl_rule_02__ + [CurlchkszEQ(curl_off_t, CURL_SIZEOF_CURL_OFF_T)]; + +/* + * Verify at compile time that the size of curl_off_t as reported + * by sizeof() is greater or equal than the one reported for long + * for the current compilation. + */ + +typedef char + __curl_rule_03__ + [CurlchkszGE(curl_off_t, long)]; + +/* + * Verify that the size previously defined and expected for + * curl_socklen_t is actually the the same as the one reported + * by sizeof() at compile time. + */ + +typedef char + __curl_rule_04__ + [CurlchkszEQ(curl_socklen_t, CURL_SIZEOF_CURL_SOCKLEN_T)]; + +/* + * Verify at compile time that the size of curl_socklen_t as reported + * by sizeof() is greater or equal than the one reported for int for + * the current compilation. + */ + +typedef char + __curl_rule_05__ + [CurlchkszGE(curl_socklen_t, int)]; + +/* ================================================================ */ +/* EXTERNALLY AND INTERNALLY VISIBLE DEFINITIONS */ +/* ================================================================ */ + +/* + * CURL_ISOCPP and CURL_OFF_T_C definitions are done here in order to allow + * these to be visible and exported by the external libcurl interface API, + * while also making them visible to the library internals, simply including + * setup.h, without actually needing to include curl.h internally. + * If some day this section would grow big enough, all this should be moved + * to its own header file. + */ + +/* + * Figure out if we can use the ## preprocessor operator, which is supported + * by ISO/ANSI C and C++. Some compilers support it without setting __STDC__ + * or __cplusplus so we need to carefully check for them too. + */ + +#if defined(__STDC__) || defined(_MSC_VER) || defined(__cplusplus) || \ + defined(__HP_aCC) || defined(__BORLANDC__) || defined(__LCC__) || \ + defined(__POCC__) || defined(__SALFORDC__) || defined(__HIGHC__) || \ + defined(__ILEC400__) + /* This compiler is believed to have an ISO compatible preprocessor */ +#define CURL_ISOCPP +#else + /* This compiler is believed NOT to have an ISO compatible preprocessor */ +#undef CURL_ISOCPP +#endif + +/* + * Macros for minimum-width signed and unsigned curl_off_t integer constants. + */ + +#ifdef CURL_ISOCPP +# define __CURL_OFF_T_C_HELPER2(Val,Suffix) Val ## Suffix +#else +# define __CURL_OFF_T_C_HELPER2(Val,Suffix) Val/**/Suffix +#endif +#define __CURL_OFF_T_C_HELPER1(Val,Suffix) __CURL_OFF_T_C_HELPER2(Val,Suffix) +#define CURL_OFF_T_C(Val) __CURL_OFF_T_C_HELPER1(Val,CURL_SUFFIX_CURL_OFF_T) +#define CURL_OFF_TU_C(Val) __CURL_OFF_T_C_HELPER1(Val,CURL_SUFFIX_CURL_OFF_TU) + +/* + * Get rid of macros private to this header file. + */ + +#undef CurlchkszEQ +#undef CurlchkszGE + +/* + * Get rid of macros not intended to exist beyond this point. + */ + +#undef CURL_PULL_WS2TCPIP_H +#undef CURL_PULL_SYS_TYPES_H +#undef CURL_PULL_SYS_SOCKET_H +#undef CURL_PULL_STDINT_H +#undef CURL_PULL_INTTYPES_H + +#undef CURL_TYPEOF_CURL_SOCKLEN_T +#undef CURL_TYPEOF_CURL_OFF_T + +#ifdef CURL_NO_OLDIES +#undef CURL_FORMAT_OFF_T /* not required since 7.19.0 - obsoleted in 7.20.0 */ +#endif + +#endif /* __CURL_CURLRULES_H */ diff --git a/mobicore/common/curl/include/curl/curlver.h b/mobicore/common/curl/include/curl/curlver.h new file mode 100644 index 0000000000000000000000000000000000000000..7c3ccc905c6dc505731f58b037c1ab49982504dd --- /dev/null +++ b/mobicore/common/curl/include/curl/curlver.h @@ -0,0 +1,69 @@ +#ifndef __CURL_CURLVER_H +#define __CURL_CURLVER_H +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) 1998 - 2010, Daniel Stenberg, , et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at http://curl.haxx.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ***************************************************************************/ + +/* This header file contains nothing but libcurl version info, generated by + a script at release-time. This was made its own header file in 7.11.2 */ + +/* This is the global package copyright */ +#define LIBCURL_COPYRIGHT "1996 - 2010 Daniel Stenberg, ." + +/* This is the version number of the libcurl package from which this header + file origins: */ +#define LIBCURL_VERSION "7.21.3" + +/* The numeric version number is also available "in parts" by using these + defines: */ +#define LIBCURL_VERSION_MAJOR 7 +#define LIBCURL_VERSION_MINOR 21 +#define LIBCURL_VERSION_PATCH 3 + +/* This is the numeric version of the libcurl version number, meant for easier + parsing and comparions by programs. The LIBCURL_VERSION_NUM define will + always follow this syntax: + + 0xXXYYZZ + + Where XX, YY and ZZ are the main version, release and patch numbers in + hexadecimal (using 8 bits each). All three numbers are always represented + using two digits. 1.2 would appear as "0x010200" while version 9.11.7 + appears as "0x090b07". + + This 6-digit (24 bits) hexadecimal number does not show pre-release number, + and it is always a greater number in a more recent release. It makes + comparisons with greater than and less than work. +*/ +#define LIBCURL_VERSION_NUM 0x071503 + +/* + * This is the date and time when the full source package was created. The + * timestamp is not stored in git, as the timestamp is properly set in the + * tarballs by the maketgz script. + * + * The format of the date should follow this template: + * + * "Mon Feb 12 11:35:33 UTC 2007" + */ +#define LIBCURL_TIMESTAMP "Wed Dec 15 14:07:08 UTC 2010" + +#endif /* __CURL_CURLVER_H */ diff --git a/mobicore/common/curl/include/curl/easy.h b/mobicore/common/curl/include/curl/easy.h new file mode 100644 index 0000000000000000000000000000000000000000..1ddb4fe5a2cb476f1a1278b83c7b576135bd5aa9 --- /dev/null +++ b/mobicore/common/curl/include/curl/easy.h @@ -0,0 +1,102 @@ +#ifndef __CURL_EASY_H +#define __CURL_EASY_H +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) 1998 - 2008, Daniel Stenberg, , et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at http://curl.haxx.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ***************************************************************************/ +#ifdef __cplusplus +extern "C" { +#endif + +CURL_EXTERN CURL *curl_easy_init(void); +CURL_EXTERN CURLcode curl_easy_setopt(CURL *curl, CURLoption option, ...); +CURL_EXTERN CURLcode curl_easy_perform(CURL *curl); +CURL_EXTERN void curl_easy_cleanup(CURL *curl); + +/* + * NAME curl_easy_getinfo() + * + * DESCRIPTION + * + * Request internal information from the curl session with this function. The + * third argument MUST be a pointer to a long, a pointer to a char * or a + * pointer to a double (as the documentation describes elsewhere). The data + * pointed to will be filled in accordingly and can be relied upon only if the + * function returns CURLE_OK. This function is intended to get used *AFTER* a + * performed transfer, all results from this function are undefined until the + * transfer is completed. + */ +CURL_EXTERN CURLcode curl_easy_getinfo(CURL *curl, CURLINFO info, ...); + + +/* + * NAME curl_easy_duphandle() + * + * DESCRIPTION + * + * Creates a new curl session handle with the same options set for the handle + * passed in. Duplicating a handle could only be a matter of cloning data and + * options, internal state info and things like persistant connections cannot + * be transfered. It is useful in multithreaded applications when you can run + * curl_easy_duphandle() for each new thread to avoid a series of identical + * curl_easy_setopt() invokes in every thread. + */ +CURL_EXTERN CURL* curl_easy_duphandle(CURL *curl); + +/* + * NAME curl_easy_reset() + * + * DESCRIPTION + * + * Re-initializes a CURL handle to the default values. This puts back the + * handle to the same state as it was in when it was just created. + * + * It does keep: live connections, the Session ID cache, the DNS cache and the + * cookies. + */ +CURL_EXTERN void curl_easy_reset(CURL *curl); + +/* + * NAME curl_easy_recv() + * + * DESCRIPTION + * + * Receives data from the connected socket. Use after successful + * curl_easy_perform() with CURLOPT_CONNECT_ONLY option. + */ +CURL_EXTERN CURLcode curl_easy_recv(CURL *curl, void *buffer, size_t buflen, + size_t *n); + +/* + * NAME curl_easy_send() + * + * DESCRIPTION + * + * Sends data over the connected socket. Use after successful + * curl_easy_perform() with CURLOPT_CONNECT_ONLY option. + */ +CURL_EXTERN CURLcode curl_easy_send(CURL *curl, const void *buffer, + size_t buflen, size_t *n); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/mobicore/common/curl/include/curl/mprintf.h b/mobicore/common/curl/include/curl/mprintf.h new file mode 100644 index 0000000000000000000000000000000000000000..de7dd2f3c360e327e6280372e8a10f335fcf3504 --- /dev/null +++ b/mobicore/common/curl/include/curl/mprintf.h @@ -0,0 +1,81 @@ +#ifndef __CURL_MPRINTF_H +#define __CURL_MPRINTF_H +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) 1998 - 2006, Daniel Stenberg, , et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at http://curl.haxx.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ***************************************************************************/ + +#include +#include /* needed for FILE */ + +#include "curl.h" + +#ifdef __cplusplus +extern "C" { +#endif + +CURL_EXTERN int curl_mprintf(const char *format, ...); +CURL_EXTERN int curl_mfprintf(FILE *fd, const char *format, ...); +CURL_EXTERN int curl_msprintf(char *buffer, const char *format, ...); +CURL_EXTERN int curl_msnprintf(char *buffer, size_t maxlength, + const char *format, ...); +CURL_EXTERN int curl_mvprintf(const char *format, va_list args); +CURL_EXTERN int curl_mvfprintf(FILE *fd, const char *format, va_list args); +CURL_EXTERN int curl_mvsprintf(char *buffer, const char *format, va_list args); +CURL_EXTERN int curl_mvsnprintf(char *buffer, size_t maxlength, + const char *format, va_list args); +CURL_EXTERN char *curl_maprintf(const char *format, ...); +CURL_EXTERN char *curl_mvaprintf(const char *format, va_list args); + +#ifdef _MPRINTF_REPLACE +# undef printf +# undef fprintf +# undef sprintf +# undef vsprintf +# undef snprintf +# undef vprintf +# undef vfprintf +# undef vsnprintf +# undef aprintf +# undef vaprintf +# define printf curl_mprintf +# define fprintf curl_mfprintf +#ifdef CURLDEBUG +/* When built with CURLDEBUG we define away the sprintf() functions since we + don't want internal code to be using them */ +# define sprintf sprintf_was_used +# define vsprintf vsprintf_was_used +#else +# define sprintf curl_msprintf +# define vsprintf curl_mvsprintf +#endif +# define snprintf curl_msnprintf +# define vprintf curl_mvprintf +# define vfprintf curl_mvfprintf +# define vsnprintf curl_mvsnprintf +# define aprintf curl_maprintf +# define vaprintf curl_mvaprintf +#endif + +#ifdef __cplusplus +} +#endif + +#endif /* __CURL_MPRINTF_H */ diff --git a/mobicore/common/curl/include/curl/multi.h b/mobicore/common/curl/include/curl/multi.h new file mode 100644 index 0000000000000000000000000000000000000000..f96566669c6771fbbf2e1735f826d8cb3a1fce11 --- /dev/null +++ b/mobicore/common/curl/include/curl/multi.h @@ -0,0 +1,345 @@ +#ifndef __CURL_MULTI_H +#define __CURL_MULTI_H +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) 1998 - 2007, Daniel Stenberg, , et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at http://curl.haxx.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ***************************************************************************/ +/* + This is an "external" header file. Don't give away any internals here! + + GOALS + + o Enable a "pull" interface. The application that uses libcurl decides where + and when to ask libcurl to get/send data. + + o Enable multiple simultaneous transfers in the same thread without making it + complicated for the application. + + o Enable the application to select() on its own file descriptors and curl's + file descriptors simultaneous easily. + +*/ + +/* + * This header file should not really need to include "curl.h" since curl.h + * itself includes this file and we expect user applications to do #include + * without the need for especially including multi.h. + * + * For some reason we added this include here at one point, and rather than to + * break existing (wrongly written) libcurl applications, we leave it as-is + * but with this warning attached. + */ +#include "curl.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef void CURLM; + +typedef enum { + CURLM_CALL_MULTI_PERFORM = -1, /* please call curl_multi_perform() or + curl_multi_socket*() soon */ + CURLM_OK, + CURLM_BAD_HANDLE, /* the passed-in handle is not a valid CURLM handle */ + CURLM_BAD_EASY_HANDLE, /* an easy handle was not good/valid */ + CURLM_OUT_OF_MEMORY, /* if you ever get this, you're in deep sh*t */ + CURLM_INTERNAL_ERROR, /* this is a libcurl bug */ + CURLM_BAD_SOCKET, /* the passed in socket argument did not match */ + CURLM_UNKNOWN_OPTION, /* curl_multi_setopt() with unsupported option */ + CURLM_LAST +} CURLMcode; + +/* just to make code nicer when using curl_multi_socket() you can now check + for CURLM_CALL_MULTI_SOCKET too in the same style it works for + curl_multi_perform() and CURLM_CALL_MULTI_PERFORM */ +#define CURLM_CALL_MULTI_SOCKET CURLM_CALL_MULTI_PERFORM + +typedef enum { + CURLMSG_NONE, /* first, not used */ + CURLMSG_DONE, /* This easy handle has completed. 'result' contains + the CURLcode of the transfer */ + CURLMSG_LAST /* last, not used */ +} CURLMSG; + +struct CURLMsg { + CURLMSG msg; /* what this message means */ + CURL *easy_handle; /* the handle it concerns */ + union { + void *whatever; /* message-specific data */ + CURLcode result; /* return code for transfer */ + } data; +}; +typedef struct CURLMsg CURLMsg; + +/* + * Name: curl_multi_init() + * + * Desc: inititalize multi-style curl usage + * + * Returns: a new CURLM handle to use in all 'curl_multi' functions. + */ +CURL_EXTERN CURLM *curl_multi_init(void); + +/* + * Name: curl_multi_add_handle() + * + * Desc: add a standard curl handle to the multi stack + * + * Returns: CURLMcode type, general multi error code. + */ +CURL_EXTERN CURLMcode curl_multi_add_handle(CURLM *multi_handle, + CURL *curl_handle); + + /* + * Name: curl_multi_remove_handle() + * + * Desc: removes a curl handle from the multi stack again + * + * Returns: CURLMcode type, general multi error code. + */ +CURL_EXTERN CURLMcode curl_multi_remove_handle(CURLM *multi_handle, + CURL *curl_handle); + + /* + * Name: curl_multi_fdset() + * + * Desc: Ask curl for its fd_set sets. The app can use these to select() or + * poll() on. We want curl_multi_perform() called as soon as one of + * them are ready. + * + * Returns: CURLMcode type, general multi error code. + */ +CURL_EXTERN CURLMcode curl_multi_fdset(CURLM *multi_handle, + fd_set *read_fd_set, + fd_set *write_fd_set, + fd_set *exc_fd_set, + int *max_fd); + + /* + * Name: curl_multi_perform() + * + * Desc: When the app thinks there's data available for curl it calls this + * function to read/write whatever there is right now. This returns + * as soon as the reads and writes are done. This function does not + * require that there actually is data available for reading or that + * data can be written, it can be called just in case. It returns + * the number of handles that still transfer data in the second + * argument's integer-pointer. + * + * Returns: CURLMcode type, general multi error code. *NOTE* that this only + * returns errors etc regarding the whole multi stack. There might + * still have occurred problems on invidual transfers even when this + * returns OK. + */ +CURL_EXTERN CURLMcode curl_multi_perform(CURLM *multi_handle, + int *running_handles); + + /* + * Name: curl_multi_cleanup() + * + * Desc: Cleans up and removes a whole multi stack. It does not free or + * touch any individual easy handles in any way. We need to define + * in what state those handles will be if this function is called + * in the middle of a transfer. + * + * Returns: CURLMcode type, general multi error code. + */ +CURL_EXTERN CURLMcode curl_multi_cleanup(CURLM *multi_handle); + +/* + * Name: curl_multi_info_read() + * + * Desc: Ask the multi handle if there's any messages/informationals from + * the individual transfers. Messages include informationals such as + * error code from the transfer or just the fact that a transfer is + * completed. More details on these should be written down as well. + * + * Repeated calls to this function will return a new struct each + * time, until a special "end of msgs" struct is returned as a signal + * that there is no more to get at this point. + * + * The data the returned pointer points to will not survive calling + * curl_multi_cleanup(). + * + * The 'CURLMsg' struct is meant to be very simple and only contain + * very basic informations. If more involved information is wanted, + * we will provide the particular "transfer handle" in that struct + * and that should/could/would be used in subsequent + * curl_easy_getinfo() calls (or similar). The point being that we + * must never expose complex structs to applications, as then we'll + * undoubtably get backwards compatibility problems in the future. + * + * Returns: A pointer to a filled-in struct, or NULL if it failed or ran out + * of structs. It also writes the number of messages left in the + * queue (after this read) in the integer the second argument points + * to. + */ +CURL_EXTERN CURLMsg *curl_multi_info_read(CURLM *multi_handle, + int *msgs_in_queue); + +/* + * Name: curl_multi_strerror() + * + * Desc: The curl_multi_strerror function may be used to turn a CURLMcode + * value into the equivalent human readable error string. This is + * useful for printing meaningful error messages. + * + * Returns: A pointer to a zero-terminated error message. + */ +CURL_EXTERN const char *curl_multi_strerror(CURLMcode); + +/* + * Name: curl_multi_socket() and + * curl_multi_socket_all() + * + * Desc: An alternative version of curl_multi_perform() that allows the + * application to pass in one of the file descriptors that have been + * detected to have "action" on them and let libcurl perform. + * See man page for details. + */ +#define CURL_POLL_NONE 0 +#define CURL_POLL_IN 1 +#define CURL_POLL_OUT 2 +#define CURL_POLL_INOUT 3 +#define CURL_POLL_REMOVE 4 + +#define CURL_SOCKET_TIMEOUT CURL_SOCKET_BAD + +#define CURL_CSELECT_IN 0x01 +#define CURL_CSELECT_OUT 0x02 +#define CURL_CSELECT_ERR 0x04 + +typedef int (*curl_socket_callback)(CURL *easy, /* easy handle */ + curl_socket_t s, /* socket */ + int what, /* see above */ + void *userp, /* private callback + pointer */ + void *socketp); /* private socket + pointer */ +/* + * Name: curl_multi_timer_callback + * + * Desc: Called by libcurl whenever the library detects a change in the + * maximum number of milliseconds the app is allowed to wait before + * curl_multi_socket() or curl_multi_perform() must be called + * (to allow libcurl's timed events to take place). + * + * Returns: The callback should return zero. + */ +typedef int (*curl_multi_timer_callback)(CURLM *multi, /* multi handle */ + long timeout_ms, /* see above */ + void *userp); /* private callback + pointer */ + +CURL_EXTERN CURLMcode curl_multi_socket(CURLM *multi_handle, curl_socket_t s, + int *running_handles); + +CURL_EXTERN CURLMcode curl_multi_socket_action(CURLM *multi_handle, + curl_socket_t s, + int ev_bitmask, + int *running_handles); + +CURL_EXTERN CURLMcode curl_multi_socket_all(CURLM *multi_handle, + int *running_handles); + +#ifndef CURL_ALLOW_OLD_MULTI_SOCKET +/* This macro below was added in 7.16.3 to push users who recompile to use + the new curl_multi_socket_action() instead of the old curl_multi_socket() +*/ +#define curl_multi_socket(x,y,z) curl_multi_socket_action(x,y,0,z) +#endif + +/* + * Name: curl_multi_timeout() + * + * Desc: Returns the maximum number of milliseconds the app is allowed to + * wait before curl_multi_socket() or curl_multi_perform() must be + * called (to allow libcurl's timed events to take place). + * + * Returns: CURLM error code. + */ +CURL_EXTERN CURLMcode curl_multi_timeout(CURLM *multi_handle, + long *milliseconds); + +#undef CINIT /* re-using the same name as in curl.h */ + +#ifdef CURL_ISOCPP +#define CINIT(name,type,num) CURLMOPT_ ## name = CURLOPTTYPE_ ## type + num +#else +/* The macro "##" is ISO C, we assume pre-ISO C doesn't support it. */ +#define LONG CURLOPTTYPE_LONG +#define OBJECTPOINT CURLOPTTYPE_OBJECTPOINT +#define FUNCTIONPOINT CURLOPTTYPE_FUNCTIONPOINT +#define OFF_T CURLOPTTYPE_OFF_T +#define CINIT(name,type,number) CURLMOPT_/**/name = type + number +#endif + +typedef enum { + /* This is the socket callback function pointer */ + CINIT(SOCKETFUNCTION, FUNCTIONPOINT, 1), + + /* This is the argument passed to the socket callback */ + CINIT(SOCKETDATA, OBJECTPOINT, 2), + + /* set to 1 to enable pipelining for this multi handle */ + CINIT(PIPELINING, LONG, 3), + + /* This is the timer callback function pointer */ + CINIT(TIMERFUNCTION, FUNCTIONPOINT, 4), + + /* This is the argument passed to the timer callback */ + CINIT(TIMERDATA, OBJECTPOINT, 5), + + /* maximum number of entries in the connection cache */ + CINIT(MAXCONNECTS, LONG, 6), + + CURLMOPT_LASTENTRY /* the last unused */ +} CURLMoption; + + +/* + * Name: curl_multi_setopt() + * + * Desc: Sets options for the multi handle. + * + * Returns: CURLM error code. + */ +CURL_EXTERN CURLMcode curl_multi_setopt(CURLM *multi_handle, + CURLMoption option, ...); + + +/* + * Name: curl_multi_assign() + * + * Desc: This function sets an association in the multi handle between the + * given socket and a private pointer of the application. This is + * (only) useful for curl_multi_socket uses. + * + * Returns: CURLM error code. + */ +CURL_EXTERN CURLMcode curl_multi_assign(CURLM *multi_handle, + curl_socket_t sockfd, void *sockp); + +#ifdef __cplusplus +} /* end of extern "C" */ +#endif + +#endif diff --git a/mobicore/common/curl/include/curl/stamp-h3 b/mobicore/common/curl/include/curl/stamp-h3 new file mode 100644 index 0000000000000000000000000000000000000000..e4ea1b88ab14f56c13de79a4baa60fce09d9b3f4 --- /dev/null +++ b/mobicore/common/curl/include/curl/stamp-h3 @@ -0,0 +1 @@ +timestamp for include/curl/curlbuild.h diff --git a/mobicore/common/curl/include/curl/stdcheaders.h b/mobicore/common/curl/include/curl/stdcheaders.h new file mode 100644 index 0000000000000000000000000000000000000000..ad82ef6335d6167aecf8b9e49d68c462ea028bfd --- /dev/null +++ b/mobicore/common/curl/include/curl/stdcheaders.h @@ -0,0 +1,33 @@ +#ifndef __STDC_HEADERS_H +#define __STDC_HEADERS_H +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) 1998 - 2010, Daniel Stenberg, , et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at http://curl.haxx.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ***************************************************************************/ + +#include + +size_t fread (void *, size_t, size_t, FILE *); +size_t fwrite (const void *, size_t, size_t, FILE *); + +int strcasecmp(const char *, const char *); +int strncasecmp(const char *, const char *, size_t); + +#endif /* __STDC_HEADERS_H */ diff --git a/mobicore/common/curl/include/curl/typecheck-gcc.h b/mobicore/common/curl/include/curl/typecheck-gcc.h new file mode 100644 index 0000000000000000000000000000000000000000..e6f74a95840326a9156032507a7844cca76ad683 --- /dev/null +++ b/mobicore/common/curl/include/curl/typecheck-gcc.h @@ -0,0 +1,584 @@ +#ifndef __CURL_TYPECHECK_GCC_H +#define __CURL_TYPECHECK_GCC_H +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) 1998 - 2010, Daniel Stenberg, , et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at http://curl.haxx.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ***************************************************************************/ + +/* wraps curl_easy_setopt() with typechecking */ + +/* To add a new kind of warning, add an + * if(_curl_is_sometype_option(_curl_opt)) + * if(!_curl_is_sometype(value)) + * _curl_easy_setopt_err_sometype(); + * block and define _curl_is_sometype_option, _curl_is_sometype and + * _curl_easy_setopt_err_sometype below + * + * NOTE: We use two nested 'if' statements here instead of the && operator, in + * order to work around gcc bug #32061. It affects only gcc 4.3.x/4.4.x + * when compiling with -Wlogical-op. + * + * To add an option that uses the same type as an existing option, you'll just + * need to extend the appropriate _curl_*_option macro + */ +#define curl_easy_setopt(handle, option, value) \ +__extension__ ({ \ + __typeof__ (option) _curl_opt = option; \ + if (__builtin_constant_p(_curl_opt)) { \ + if (_curl_is_long_option(_curl_opt)) \ + if (!_curl_is_long(value)) \ + _curl_easy_setopt_err_long(); \ + if (_curl_is_off_t_option(_curl_opt)) \ + if (!_curl_is_off_t(value)) \ + _curl_easy_setopt_err_curl_off_t(); \ + if (_curl_is_string_option(_curl_opt)) \ + if (!_curl_is_string(value)) \ + _curl_easy_setopt_err_string(); \ + if (_curl_is_write_cb_option(_curl_opt)) \ + if (!_curl_is_write_cb(value)) \ + _curl_easy_setopt_err_write_callback(); \ + if ((_curl_opt) == CURLOPT_READFUNCTION) \ + if (!_curl_is_read_cb(value)) \ + _curl_easy_setopt_err_read_cb(); \ + if ((_curl_opt) == CURLOPT_IOCTLFUNCTION) \ + if (!_curl_is_ioctl_cb(value)) \ + _curl_easy_setopt_err_ioctl_cb(); \ + if ((_curl_opt) == CURLOPT_SOCKOPTFUNCTION) \ + if (!_curl_is_sockopt_cb(value)) \ + _curl_easy_setopt_err_sockopt_cb(); \ + if ((_curl_opt) == CURLOPT_OPENSOCKETFUNCTION) \ + if (!_curl_is_opensocket_cb(value)) \ + _curl_easy_setopt_err_opensocket_cb(); \ + if ((_curl_opt) == CURLOPT_PROGRESSFUNCTION) \ + if (!_curl_is_progress_cb(value)) \ + _curl_easy_setopt_err_progress_cb(); \ + if ((_curl_opt) == CURLOPT_DEBUGFUNCTION) \ + if (!_curl_is_debug_cb(value)) \ + _curl_easy_setopt_err_debug_cb(); \ + if ((_curl_opt) == CURLOPT_SSL_CTX_FUNCTION) \ + if (!_curl_is_ssl_ctx_cb(value)) \ + _curl_easy_setopt_err_ssl_ctx_cb(); \ + if (_curl_is_conv_cb_option(_curl_opt)) \ + if (!_curl_is_conv_cb(value)) \ + _curl_easy_setopt_err_conv_cb(); \ + if ((_curl_opt) == CURLOPT_SEEKFUNCTION) \ + if (!_curl_is_seek_cb(value)) \ + _curl_easy_setopt_err_seek_cb(); \ + if (_curl_is_cb_data_option(_curl_opt)) \ + if (!_curl_is_cb_data(value)) \ + _curl_easy_setopt_err_cb_data(); \ + if ((_curl_opt) == CURLOPT_ERRORBUFFER) \ + if (!_curl_is_error_buffer(value)) \ + _curl_easy_setopt_err_error_buffer(); \ + if ((_curl_opt) == CURLOPT_STDERR) \ + if (!_curl_is_FILE(value)) \ + _curl_easy_setopt_err_FILE(); \ + if (_curl_is_postfields_option(_curl_opt)) \ + if (!_curl_is_postfields(value)) \ + _curl_easy_setopt_err_postfields(); \ + if ((_curl_opt) == CURLOPT_HTTPPOST) \ + if (!_curl_is_arr((value), struct curl_httppost)) \ + _curl_easy_setopt_err_curl_httpost(); \ + if (_curl_is_slist_option(_curl_opt)) \ + if (!_curl_is_arr((value), struct curl_slist)) \ + _curl_easy_setopt_err_curl_slist(); \ + if ((_curl_opt) == CURLOPT_SHARE) \ + if (!_curl_is_ptr((value), CURLSH)) \ + _curl_easy_setopt_err_CURLSH(); \ + } \ + curl_easy_setopt(handle, _curl_opt, value); \ +}) + +/* wraps curl_easy_getinfo() with typechecking */ +/* FIXME: don't allow const pointers */ +#define curl_easy_getinfo(handle, info, arg) \ +__extension__ ({ \ + __typeof__ (info) _curl_info = info; \ + if (__builtin_constant_p(_curl_info)) { \ + if (_curl_is_string_info(_curl_info)) \ + if (!_curl_is_arr((arg), char *)) \ + _curl_easy_getinfo_err_string(); \ + if (_curl_is_long_info(_curl_info)) \ + if (!_curl_is_arr((arg), long)) \ + _curl_easy_getinfo_err_long(); \ + if (_curl_is_double_info(_curl_info)) \ + if (!_curl_is_arr((arg), double)) \ + _curl_easy_getinfo_err_double(); \ + if (_curl_is_slist_info(_curl_info)) \ + if (!_curl_is_arr((arg), struct curl_slist *)) \ + _curl_easy_getinfo_err_curl_slist(); \ + } \ + curl_easy_getinfo(handle, _curl_info, arg); \ +}) + +/* TODO: typechecking for curl_share_setopt() and curl_multi_setopt(), + * for now just make sure that the functions are called with three + * arguments + */ +#define curl_share_setopt(share,opt,param) curl_share_setopt(share,opt,param) +#define curl_multi_setopt(handle,opt,param) curl_multi_setopt(handle,opt,param) + + +/* the actual warnings, triggered by calling the _curl_easy_setopt_err* + * functions */ + +/* To define a new warning, use _CURL_WARNING(identifier, "message") */ +#define _CURL_WARNING(id, message) \ + static void __attribute__((warning(message))) __attribute__((unused)) \ + __attribute__((noinline)) id(void) { __asm__(""); } + +_CURL_WARNING(_curl_easy_setopt_err_long, + "curl_easy_setopt expects a long argument for this option") +_CURL_WARNING(_curl_easy_setopt_err_curl_off_t, + "curl_easy_setopt expects a curl_off_t argument for this option") +_CURL_WARNING(_curl_easy_setopt_err_string, + "curl_easy_setopt expects a string (char* or char[]) argument for this option" + ) +_CURL_WARNING(_curl_easy_setopt_err_write_callback, + "curl_easy_setopt expects a curl_write_callback argument for this option") +_CURL_WARNING(_curl_easy_setopt_err_read_cb, + "curl_easy_setopt expects a curl_read_callback argument for this option") +_CURL_WARNING(_curl_easy_setopt_err_ioctl_cb, + "curl_easy_setopt expects a curl_ioctl_callback argument for this option") +_CURL_WARNING(_curl_easy_setopt_err_sockopt_cb, + "curl_easy_setopt expects a curl_sockopt_callback argument for this option") +_CURL_WARNING(_curl_easy_setopt_err_opensocket_cb, + "curl_easy_setopt expects a curl_opensocket_callback argument for this option" + ) +_CURL_WARNING(_curl_easy_setopt_err_progress_cb, + "curl_easy_setopt expects a curl_progress_callback argument for this option") +_CURL_WARNING(_curl_easy_setopt_err_debug_cb, + "curl_easy_setopt expects a curl_debug_callback argument for this option") +_CURL_WARNING(_curl_easy_setopt_err_ssl_ctx_cb, + "curl_easy_setopt expects a curl_ssl_ctx_callback argument for this option") +_CURL_WARNING(_curl_easy_setopt_err_conv_cb, + "curl_easy_setopt expects a curl_conv_callback argument for this option") +_CURL_WARNING(_curl_easy_setopt_err_seek_cb, + "curl_easy_setopt expects a curl_seek_callback argument for this option") +_CURL_WARNING(_curl_easy_setopt_err_cb_data, + "curl_easy_setopt expects a private data pointer as argument for this option") +_CURL_WARNING(_curl_easy_setopt_err_error_buffer, + "curl_easy_setopt expects a char buffer of CURL_ERROR_SIZE as argument for this option") +_CURL_WARNING(_curl_easy_setopt_err_FILE, + "curl_easy_setopt expects a FILE* argument for this option") +_CURL_WARNING(_curl_easy_setopt_err_postfields, + "curl_easy_setopt expects a void* or char* argument for this option") +_CURL_WARNING(_curl_easy_setopt_err_curl_httpost, + "curl_easy_setopt expects a struct curl_httppost* argument for this option") +_CURL_WARNING(_curl_easy_setopt_err_curl_slist, + "curl_easy_setopt expects a struct curl_slist* argument for this option") +_CURL_WARNING(_curl_easy_setopt_err_CURLSH, + "curl_easy_setopt expects a CURLSH* argument for this option") + +_CURL_WARNING(_curl_easy_getinfo_err_string, + "curl_easy_getinfo expects a pointer to char * for this info") +_CURL_WARNING(_curl_easy_getinfo_err_long, + "curl_easy_getinfo expects a pointer to long for this info") +_CURL_WARNING(_curl_easy_getinfo_err_double, + "curl_easy_getinfo expects a pointer to double for this info") +_CURL_WARNING(_curl_easy_getinfo_err_curl_slist, + "curl_easy_getinfo expects a pointer to struct curl_slist * for this info") + +/* groups of curl_easy_setops options that take the same type of argument */ + +/* To add a new option to one of the groups, just add + * (option) == CURLOPT_SOMETHING + * to the or-expression. If the option takes a long or curl_off_t, you don't + * have to do anything + */ + +/* evaluates to true if option takes a long argument */ +#define _curl_is_long_option(option) \ + (0 < (option) && (option) < CURLOPTTYPE_OBJECTPOINT) + +#define _curl_is_off_t_option(option) \ + ((option) > CURLOPTTYPE_OFF_T) + +/* evaluates to true if option takes a char* argument */ +#define _curl_is_string_option(option) \ + ((option) == CURLOPT_URL || \ + (option) == CURLOPT_PROXY || \ + (option) == CURLOPT_INTERFACE || \ + (option) == CURLOPT_NETRC_FILE || \ + (option) == CURLOPT_USERPWD || \ + (option) == CURLOPT_USERNAME || \ + (option) == CURLOPT_PASSWORD || \ + (option) == CURLOPT_PROXYUSERPWD || \ + (option) == CURLOPT_PROXYUSERNAME || \ + (option) == CURLOPT_PROXYPASSWORD || \ + (option) == CURLOPT_NOPROXY || \ + (option) == CURLOPT_ENCODING || \ + (option) == CURLOPT_REFERER || \ + (option) == CURLOPT_USERAGENT || \ + (option) == CURLOPT_COOKIE || \ + (option) == CURLOPT_COOKIEFILE || \ + (option) == CURLOPT_COOKIEJAR || \ + (option) == CURLOPT_COOKIELIST || \ + (option) == CURLOPT_FTPPORT || \ + (option) == CURLOPT_FTP_ALTERNATIVE_TO_USER || \ + (option) == CURLOPT_FTP_ACCOUNT || \ + (option) == CURLOPT_RANGE || \ + (option) == CURLOPT_CUSTOMREQUEST || \ + (option) == CURLOPT_SSLCERT || \ + (option) == CURLOPT_SSLCERTTYPE || \ + (option) == CURLOPT_SSLKEY || \ + (option) == CURLOPT_SSLKEYTYPE || \ + (option) == CURLOPT_KEYPASSWD || \ + (option) == CURLOPT_SSLENGINE || \ + (option) == CURLOPT_CAINFO || \ + (option) == CURLOPT_CAPATH || \ + (option) == CURLOPT_RANDOM_FILE || \ + (option) == CURLOPT_EGDSOCKET || \ + (option) == CURLOPT_SSL_CIPHER_LIST || \ + (option) == CURLOPT_KRBLEVEL || \ + (option) == CURLOPT_SSH_HOST_PUBLIC_KEY_MD5 || \ + (option) == CURLOPT_SSH_PUBLIC_KEYFILE || \ + (option) == CURLOPT_SSH_PRIVATE_KEYFILE || \ + (option) == CURLOPT_CRLFILE || \ + (option) == CURLOPT_ISSUERCERT || \ + (option) == CURLOPT_SOCKS5_GSSAPI_SERVICE || \ + (option) == CURLOPT_SSH_KNOWNHOSTS || \ + (option) == CURLOPT_MAIL_FROM || \ + (option) == CURLOPT_RTSP_SESSION_ID || \ + (option) == CURLOPT_RTSP_STREAM_URI || \ + (option) == CURLOPT_RTSP_TRANSPORT || \ + 0) + +/* evaluates to true if option takes a curl_write_callback argument */ +#define _curl_is_write_cb_option(option) \ + ((option) == CURLOPT_HEADERFUNCTION || \ + (option) == CURLOPT_WRITEFUNCTION) + +/* evaluates to true if option takes a curl_conv_callback argument */ +#define _curl_is_conv_cb_option(option) \ + ((option) == CURLOPT_CONV_TO_NETWORK_FUNCTION || \ + (option) == CURLOPT_CONV_FROM_NETWORK_FUNCTION || \ + (option) == CURLOPT_CONV_FROM_UTF8_FUNCTION) + +/* evaluates to true if option takes a data argument to pass to a callback */ +#define _curl_is_cb_data_option(option) \ + ((option) == CURLOPT_WRITEDATA || \ + (option) == CURLOPT_READDATA || \ + (option) == CURLOPT_IOCTLDATA || \ + (option) == CURLOPT_SOCKOPTDATA || \ + (option) == CURLOPT_OPENSOCKETDATA || \ + (option) == CURLOPT_PROGRESSDATA || \ + (option) == CURLOPT_WRITEHEADER || \ + (option) == CURLOPT_DEBUGDATA || \ + (option) == CURLOPT_SSL_CTX_DATA || \ + (option) == CURLOPT_SEEKDATA || \ + (option) == CURLOPT_PRIVATE || \ + (option) == CURLOPT_SSH_KEYDATA || \ + (option) == CURLOPT_INTERLEAVEDATA || \ + (option) == CURLOPT_CHUNK_DATA || \ + (option) == CURLOPT_FNMATCH_DATA || \ + 0) + +/* evaluates to true if option takes a POST data argument (void* or char*) */ +#define _curl_is_postfields_option(option) \ + ((option) == CURLOPT_POSTFIELDS || \ + (option) == CURLOPT_COPYPOSTFIELDS || \ + 0) + +/* evaluates to true if option takes a struct curl_slist * argument */ +#define _curl_is_slist_option(option) \ + ((option) == CURLOPT_HTTPHEADER || \ + (option) == CURLOPT_HTTP200ALIASES || \ + (option) == CURLOPT_QUOTE || \ + (option) == CURLOPT_POSTQUOTE || \ + (option) == CURLOPT_PREQUOTE || \ + (option) == CURLOPT_TELNETOPTIONS || \ + (option) == CURLOPT_MAIL_RCPT || \ + 0) + +/* groups of curl_easy_getinfo infos that take the same type of argument */ + +/* evaluates to true if info expects a pointer to char * argument */ +#define _curl_is_string_info(info) \ + (CURLINFO_STRING < (info) && (info) < CURLINFO_LONG) + +/* evaluates to true if info expects a pointer to long argument */ +#define _curl_is_long_info(info) \ + (CURLINFO_LONG < (info) && (info) < CURLINFO_DOUBLE) + +/* evaluates to true if info expects a pointer to double argument */ +#define _curl_is_double_info(info) \ + (CURLINFO_DOUBLE < (info) && (info) < CURLINFO_SLIST) + +/* true if info expects a pointer to struct curl_slist * argument */ +#define _curl_is_slist_info(info) \ + (CURLINFO_SLIST < (info)) + + +/* typecheck helpers -- check whether given expression has requested type*/ + +/* For pointers, you can use the _curl_is_ptr/_curl_is_arr macros, + * otherwise define a new macro. Search for __builtin_types_compatible_p + * in the GCC manual. + * NOTE: these macros MUST NOT EVALUATE their arguments! The argument is + * the actual expression passed to the curl_easy_setopt macro. This + * means that you can only apply the sizeof and __typeof__ operators, no + * == or whatsoever. + */ + +/* XXX: should evaluate to true iff expr is a pointer */ +#define _curl_is_any_ptr(expr) \ + (sizeof(expr) == sizeof(void*)) + +/* evaluates to true if expr is NULL */ +/* XXX: must not evaluate expr, so this check is not accurate */ +#define _curl_is_NULL(expr) \ + (__builtin_types_compatible_p(__typeof__(expr), __typeof__(NULL))) + +/* evaluates to true if expr is type*, const type* or NULL */ +#define _curl_is_ptr(expr, type) \ + (_curl_is_NULL(expr) || \ + __builtin_types_compatible_p(__typeof__(expr), type *) || \ + __builtin_types_compatible_p(__typeof__(expr), const type *)) + +/* evaluates to true if expr is one of type[], type*, NULL or const type* */ +#define _curl_is_arr(expr, type) \ + (_curl_is_ptr((expr), type) || \ + __builtin_types_compatible_p(__typeof__(expr), type [])) + +/* evaluates to true if expr is a string */ +#define _curl_is_string(expr) \ + (_curl_is_arr((expr), char) || \ + _curl_is_arr((expr), signed char) || \ + _curl_is_arr((expr), unsigned char)) + +/* evaluates to true if expr is a long (no matter the signedness) + * XXX: for now, int is also accepted (and therefore short and char, which + * are promoted to int when passed to a variadic function) */ +#define _curl_is_long(expr) \ + (__builtin_types_compatible_p(__typeof__(expr), long) || \ + __builtin_types_compatible_p(__typeof__(expr), signed long) || \ + __builtin_types_compatible_p(__typeof__(expr), unsigned long) || \ + __builtin_types_compatible_p(__typeof__(expr), int) || \ + __builtin_types_compatible_p(__typeof__(expr), signed int) || \ + __builtin_types_compatible_p(__typeof__(expr), unsigned int) || \ + __builtin_types_compatible_p(__typeof__(expr), short) || \ + __builtin_types_compatible_p(__typeof__(expr), signed short) || \ + __builtin_types_compatible_p(__typeof__(expr), unsigned short) || \ + __builtin_types_compatible_p(__typeof__(expr), char) || \ + __builtin_types_compatible_p(__typeof__(expr), signed char) || \ + __builtin_types_compatible_p(__typeof__(expr), unsigned char)) + +/* evaluates to true if expr is of type curl_off_t */ +#define _curl_is_off_t(expr) \ + (__builtin_types_compatible_p(__typeof__(expr), curl_off_t)) + +/* evaluates to true if expr is abuffer suitable for CURLOPT_ERRORBUFFER */ +/* XXX: also check size of an char[] array? */ +#define _curl_is_error_buffer(expr) \ + (__builtin_types_compatible_p(__typeof__(expr), char *) || \ + __builtin_types_compatible_p(__typeof__(expr), char[])) + +/* evaluates to true if expr is of type (const) void* or (const) FILE* */ +#if 0 +#define _curl_is_cb_data(expr) \ + (_curl_is_ptr((expr), void) || \ + _curl_is_ptr((expr), FILE)) +#else /* be less strict */ +#define _curl_is_cb_data(expr) \ + _curl_is_any_ptr(expr) +#endif + +/* evaluates to true if expr is of type FILE* */ +#define _curl_is_FILE(expr) \ + (__builtin_types_compatible_p(__typeof__(expr), FILE *)) + +/* evaluates to true if expr can be passed as POST data (void* or char*) */ +#define _curl_is_postfields(expr) \ + (_curl_is_ptr((expr), void) || \ + _curl_is_arr((expr), char)) + +/* FIXME: the whole callback checking is messy... + * The idea is to tolerate char vs. void and const vs. not const + * pointers in arguments at least + */ +/* helper: __builtin_types_compatible_p distinguishes between functions and + * function pointers, hide it */ +#define _curl_callback_compatible(func, type) \ + (__builtin_types_compatible_p(__typeof__(func), type) || \ + __builtin_types_compatible_p(__typeof__(func), type*)) + +/* evaluates to true if expr is of type curl_read_callback or "similar" */ +#define _curl_is_read_cb(expr) \ + (_curl_is_NULL(expr) || \ + __builtin_types_compatible_p(__typeof__(expr), __typeof__(fread)) || \ + __builtin_types_compatible_p(__typeof__(expr), curl_read_callback) || \ + _curl_callback_compatible((expr), _curl_read_callback1) || \ + _curl_callback_compatible((expr), _curl_read_callback2) || \ + _curl_callback_compatible((expr), _curl_read_callback3) || \ + _curl_callback_compatible((expr), _curl_read_callback4) || \ + _curl_callback_compatible((expr), _curl_read_callback5) || \ + _curl_callback_compatible((expr), _curl_read_callback6)) +typedef size_t (_curl_read_callback1)(char *, size_t, size_t, void*); +typedef size_t (_curl_read_callback2)(char *, size_t, size_t, const void*); +typedef size_t (_curl_read_callback3)(char *, size_t, size_t, FILE*); +typedef size_t (_curl_read_callback4)(void *, size_t, size_t, void*); +typedef size_t (_curl_read_callback5)(void *, size_t, size_t, const void*); +typedef size_t (_curl_read_callback6)(void *, size_t, size_t, FILE*); + +/* evaluates to true if expr is of type curl_write_callback or "similar" */ +#define _curl_is_write_cb(expr) \ + (_curl_is_read_cb(expr) || \ + __builtin_types_compatible_p(__typeof__(expr), __typeof__(fwrite)) || \ + __builtin_types_compatible_p(__typeof__(expr), curl_write_callback) || \ + _curl_callback_compatible((expr), _curl_write_callback1) || \ + _curl_callback_compatible((expr), _curl_write_callback2) || \ + _curl_callback_compatible((expr), _curl_write_callback3) || \ + _curl_callback_compatible((expr), _curl_write_callback4) || \ + _curl_callback_compatible((expr), _curl_write_callback5) || \ + _curl_callback_compatible((expr), _curl_write_callback6)) +typedef size_t (_curl_write_callback1)(const char *, size_t, size_t, void*); +typedef size_t (_curl_write_callback2)(const char *, size_t, size_t, + const void*); +typedef size_t (_curl_write_callback3)(const char *, size_t, size_t, FILE*); +typedef size_t (_curl_write_callback4)(const void *, size_t, size_t, void*); +typedef size_t (_curl_write_callback5)(const void *, size_t, size_t, + const void*); +typedef size_t (_curl_write_callback6)(const void *, size_t, size_t, FILE*); + +/* evaluates to true if expr is of type curl_ioctl_callback or "similar" */ +#define _curl_is_ioctl_cb(expr) \ + (_curl_is_NULL(expr) || \ + __builtin_types_compatible_p(__typeof__(expr), curl_ioctl_callback) || \ + _curl_callback_compatible((expr), _curl_ioctl_callback1) || \ + _curl_callback_compatible((expr), _curl_ioctl_callback2) || \ + _curl_callback_compatible((expr), _curl_ioctl_callback3) || \ + _curl_callback_compatible((expr), _curl_ioctl_callback4)) +typedef curlioerr (_curl_ioctl_callback1)(CURL *, int, void*); +typedef curlioerr (_curl_ioctl_callback2)(CURL *, int, const void*); +typedef curlioerr (_curl_ioctl_callback3)(CURL *, curliocmd, void*); +typedef curlioerr (_curl_ioctl_callback4)(CURL *, curliocmd, const void*); + +/* evaluates to true if expr is of type curl_sockopt_callback or "similar" */ +#define _curl_is_sockopt_cb(expr) \ + (_curl_is_NULL(expr) || \ + __builtin_types_compatible_p(__typeof__(expr), curl_sockopt_callback) || \ + _curl_callback_compatible((expr), _curl_sockopt_callback1) || \ + _curl_callback_compatible((expr), _curl_sockopt_callback2)) +typedef int (_curl_sockopt_callback1)(void *, curl_socket_t, curlsocktype); +typedef int (_curl_sockopt_callback2)(const void *, curl_socket_t, + curlsocktype); + +/* evaluates to true if expr is of type curl_opensocket_callback or "similar" */ +#define _curl_is_opensocket_cb(expr) \ + (_curl_is_NULL(expr) || \ + __builtin_types_compatible_p(__typeof__(expr), curl_opensocket_callback) ||\ + _curl_callback_compatible((expr), _curl_opensocket_callback1) || \ + _curl_callback_compatible((expr), _curl_opensocket_callback2) || \ + _curl_callback_compatible((expr), _curl_opensocket_callback3) || \ + _curl_callback_compatible((expr), _curl_opensocket_callback4)) +typedef curl_socket_t (_curl_opensocket_callback1) + (void *, curlsocktype, struct curl_sockaddr *); +typedef curl_socket_t (_curl_opensocket_callback2) + (void *, curlsocktype, const struct curl_sockaddr *); +typedef curl_socket_t (_curl_opensocket_callback3) + (const void *, curlsocktype, struct curl_sockaddr *); +typedef curl_socket_t (_curl_opensocket_callback4) + (const void *, curlsocktype, const struct curl_sockaddr *); + +/* evaluates to true if expr is of type curl_progress_callback or "similar" */ +#define _curl_is_progress_cb(expr) \ + (_curl_is_NULL(expr) || \ + __builtin_types_compatible_p(__typeof__(expr), curl_progress_callback) || \ + _curl_callback_compatible((expr), _curl_progress_callback1) || \ + _curl_callback_compatible((expr), _curl_progress_callback2)) +typedef int (_curl_progress_callback1)(void *, + double, double, double, double); +typedef int (_curl_progress_callback2)(const void *, + double, double, double, double); + +/* evaluates to true if expr is of type curl_debug_callback or "similar" */ +#define _curl_is_debug_cb(expr) \ + (_curl_is_NULL(expr) || \ + __builtin_types_compatible_p(__typeof__(expr), curl_debug_callback) || \ + _curl_callback_compatible((expr), _curl_debug_callback1) || \ + _curl_callback_compatible((expr), _curl_debug_callback2) || \ + _curl_callback_compatible((expr), _curl_debug_callback3) || \ + _curl_callback_compatible((expr), _curl_debug_callback4)) +typedef int (_curl_debug_callback1) (CURL *, + curl_infotype, char *, size_t, void *); +typedef int (_curl_debug_callback2) (CURL *, + curl_infotype, char *, size_t, const void *); +typedef int (_curl_debug_callback3) (CURL *, + curl_infotype, const char *, size_t, void *); +typedef int (_curl_debug_callback4) (CURL *, + curl_infotype, const char *, size_t, const void *); + +/* evaluates to true if expr is of type curl_ssl_ctx_callback or "similar" */ +/* this is getting even messier... */ +#define _curl_is_ssl_ctx_cb(expr) \ + (_curl_is_NULL(expr) || \ + __builtin_types_compatible_p(__typeof__(expr), curl_ssl_ctx_callback) || \ + _curl_callback_compatible((expr), _curl_ssl_ctx_callback1) || \ + _curl_callback_compatible((expr), _curl_ssl_ctx_callback2) || \ + _curl_callback_compatible((expr), _curl_ssl_ctx_callback3) || \ + _curl_callback_compatible((expr), _curl_ssl_ctx_callback4) || \ + _curl_callback_compatible((expr), _curl_ssl_ctx_callback5) || \ + _curl_callback_compatible((expr), _curl_ssl_ctx_callback6) || \ + _curl_callback_compatible((expr), _curl_ssl_ctx_callback7) || \ + _curl_callback_compatible((expr), _curl_ssl_ctx_callback8)) +typedef CURLcode (_curl_ssl_ctx_callback1)(CURL *, void *, void *); +typedef CURLcode (_curl_ssl_ctx_callback2)(CURL *, void *, const void *); +typedef CURLcode (_curl_ssl_ctx_callback3)(CURL *, const void *, void *); +typedef CURLcode (_curl_ssl_ctx_callback4)(CURL *, const void *, const void *); +#ifdef HEADER_SSL_H +/* hack: if we included OpenSSL's ssl.h, we know about SSL_CTX + * this will of course break if we're included before OpenSSL headers... + */ +typedef CURLcode (_curl_ssl_ctx_callback5)(CURL *, SSL_CTX, void *); +typedef CURLcode (_curl_ssl_ctx_callback6)(CURL *, SSL_CTX, const void *); +typedef CURLcode (_curl_ssl_ctx_callback7)(CURL *, const SSL_CTX, void *); +typedef CURLcode (_curl_ssl_ctx_callback8)(CURL *, const SSL_CTX, const void *); +#else +typedef _curl_ssl_ctx_callback1 _curl_ssl_ctx_callback5; +typedef _curl_ssl_ctx_callback1 _curl_ssl_ctx_callback6; +typedef _curl_ssl_ctx_callback1 _curl_ssl_ctx_callback7; +typedef _curl_ssl_ctx_callback1 _curl_ssl_ctx_callback8; +#endif + +/* evaluates to true if expr is of type curl_conv_callback or "similar" */ +#define _curl_is_conv_cb(expr) \ + (_curl_is_NULL(expr) || \ + __builtin_types_compatible_p(__typeof__(expr), curl_conv_callback) || \ + _curl_callback_compatible((expr), _curl_conv_callback1) || \ + _curl_callback_compatible((expr), _curl_conv_callback2) || \ + _curl_callback_compatible((expr), _curl_conv_callback3) || \ + _curl_callback_compatible((expr), _curl_conv_callback4)) +typedef CURLcode (*_curl_conv_callback1)(char *, size_t length); +typedef CURLcode (*_curl_conv_callback2)(const char *, size_t length); +typedef CURLcode (*_curl_conv_callback3)(void *, size_t length); +typedef CURLcode (*_curl_conv_callback4)(const void *, size_t length); + +/* evaluates to true if expr is of type curl_seek_callback or "similar" */ +#define _curl_is_seek_cb(expr) \ + (_curl_is_NULL(expr) || \ + __builtin_types_compatible_p(__typeof__(expr), curl_seek_callback) || \ + _curl_callback_compatible((expr), _curl_seek_callback1) || \ + _curl_callback_compatible((expr), _curl_seek_callback2)) +typedef CURLcode (*_curl_seek_callback1)(void *, curl_off_t, int); +typedef CURLcode (*_curl_seek_callback2)(const void *, curl_off_t, int); + + +#endif /* __CURL_TYPECHECK_GCC_H */ diff --git a/mobicore/common/curl/include/curl/types.h b/mobicore/common/curl/include/curl/types.h new file mode 100644 index 0000000000000000000000000000000000000000..d37d6ae9e11e48d3f8aaba1957015a03f7f12c63 --- /dev/null +++ b/mobicore/common/curl/include/curl/types.h @@ -0,0 +1 @@ +/* not used */ diff --git a/mobicore/common/curl/install-sh b/mobicore/common/curl/install-sh new file mode 100644 index 0000000000000000000000000000000000000000..a85c202958c31f03648d12c77611e7ad23939d84 --- /dev/null +++ b/mobicore/common/curl/install-sh @@ -0,0 +1,250 @@ +#!/bin/sh +# +# install - install a program, script, or datafile +# This comes from X11R5 (mit/util/scripts/install.sh). +# +# Copyright 1991 by the Massachusetts Institute of Technology +# +# Permission to use, copy, modify, distribute, and sell this software and its +# documentation for any purpose is hereby granted without fee, provided that +# the above copyright notice appear in all copies and that both that +# copyright notice and this permission notice appear in supporting +# documentation, and that the name of M.I.T. not be used in advertising or +# publicity pertaining to distribution of the software without specific, +# written prior permission. M.I.T. makes no representations about the +# suitability of this software for any purpose. It is provided "as is" +# without express or implied warranty. +# +# Calling this script install-sh is preferred over install.sh, to prevent +# `make' implicit rules from creating a file called install from it +# when there is no Makefile. +# +# This script is compatible with the BSD install script, but was written +# from scratch. It can only install one file at a time, a restriction +# shared with many OS's install programs. + + +# set DOITPROG to echo to test this script + +# Don't use :- since 4.3BSD and earlier shells don't like it. +doit="${DOITPROG-}" + + +# put in absolute paths if you don't have them in your path; or use env. vars. + +mvprog="${MVPROG-mv}" +cpprog="${CPPROG-cp}" +chmodprog="${CHMODPROG-chmod}" +chownprog="${CHOWNPROG-chown}" +chgrpprog="${CHGRPPROG-chgrp}" +stripprog="${STRIPPROG-strip}" +rmprog="${RMPROG-rm}" +mkdirprog="${MKDIRPROG-mkdir}" + +transformbasename="" +transform_arg="" +instcmd="$mvprog" +chmodcmd="$chmodprog 0755" +chowncmd="" +chgrpcmd="" +stripcmd="" +rmcmd="$rmprog -f" +mvcmd="$mvprog" +src="" +dst="" +dir_arg="" + +while [ x"$1" != x ]; do + case $1 in + -c) instcmd="$cpprog" + shift + continue;; + + -d) dir_arg=true + shift + continue;; + + -m) chmodcmd="$chmodprog $2" + shift + shift + continue;; + + -o) chowncmd="$chownprog $2" + shift + shift + continue;; + + -g) chgrpcmd="$chgrpprog $2" + shift + shift + continue;; + + -s) stripcmd="$stripprog" + shift + continue;; + + -t=*) transformarg=`echo $1 | sed 's/-t=//'` + shift + continue;; + + -b=*) transformbasename=`echo $1 | sed 's/-b=//'` + shift + continue;; + + *) if [ x"$src" = x ] + then + src=$1 + else + # this colon is to work around a 386BSD /bin/sh bug + : + dst=$1 + fi + shift + continue;; + esac +done + +if [ x"$src" = x ] +then + echo "install: no input file specified" + exit 1 +else + true +fi + +if [ x"$dir_arg" != x ]; then + dst=$src + src="" + + if [ -d $dst ]; then + instcmd=: + else + instcmd=mkdir + fi +else + +# Waiting for this to be detected by the "$instcmd $src $dsttmp" command +# might cause directories to be created, which would be especially bad +# if $src (and thus $dsttmp) contains '*'. + + if [ -f $src -o -d $src ] + then + true + else + echo "install: $src does not exist" + exit 1 + fi + + if [ x"$dst" = x ] + then + echo "install: no destination specified" + exit 1 + else + true + fi + +# If destination is a directory, append the input filename; if your system +# does not like double slashes in filenames, you may need to add some logic + + if [ -d $dst ] + then + dst="$dst"/`basename $src` + else + true + fi +fi + +## this sed command emulates the dirname command +dstdir=`echo $dst | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'` + +# Make sure that the destination directory exists. +# this part is taken from Noah Friedman's mkinstalldirs script + +# Skip lots of stat calls in the usual case. +if [ ! -d "$dstdir" ]; then +defaultIFS=' +' +IFS="${IFS-${defaultIFS}}" + +oIFS="${IFS}" +# Some sh's can't handle IFS=/ for some reason. +IFS='%' +set - `echo ${dstdir} | sed -e 's@/@%@g' -e 's@^%@/@'` +IFS="${oIFS}" + +pathcomp='' + +while [ $# -ne 0 ] ; do + pathcomp="${pathcomp}${1}" + shift + + if [ ! -d "${pathcomp}" ] ; + then + $mkdirprog "${pathcomp}" + else + true + fi + + pathcomp="${pathcomp}/" +done +fi + +if [ x"$dir_arg" != x ] +then + $doit $instcmd $dst && + + if [ x"$chowncmd" != x ]; then $doit $chowncmd $dst; else true ; fi && + if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dst; else true ; fi && + if [ x"$stripcmd" != x ]; then $doit $stripcmd $dst; else true ; fi && + if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dst; else true ; fi +else + +# If we're going to rename the final executable, determine the name now. + + if [ x"$transformarg" = x ] + then + dstfile=`basename $dst` + else + dstfile=`basename $dst $transformbasename | + sed $transformarg`$transformbasename + fi + +# don't allow the sed command to completely eliminate the filename + + if [ x"$dstfile" = x ] + then + dstfile=`basename $dst` + else + true + fi + +# Make a temp file name in the proper directory. + + dsttmp=$dstdir/#inst.$$# + +# Move or copy the file name to the temp name + + $doit $instcmd $src $dsttmp && + + trap "rm -f ${dsttmp}" 0 && + +# and set any options; do chmod last to preserve setuid bits + +# If any of these fail, we abort the whole thing. If we want to +# ignore errors from any of these, just make sure not to ignore +# errors from the above "$doit $instcmd $src $dsttmp" command. + + if [ x"$chowncmd" != x ]; then $doit $chowncmd $dsttmp; else true;fi && + if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dsttmp; else true;fi && + if [ x"$stripcmd" != x ]; then $doit $stripcmd $dsttmp; else true;fi && + if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dsttmp; else true;fi && + +# Now rename the file to the real destination. + + $doit $rmcmd -f $dstdir/$dstfile && + $doit $mvcmd $dsttmp $dstdir/$dstfile + +fi && + + +exit 0 diff --git a/mobicore/common/curl/lib/CMakeLists.txt b/mobicore/common/curl/lib/CMakeLists.txt new file mode 100644 index 0000000000000000000000000000000000000000..aec1a3c5bdf168606ba7b344612bd94b112c8b7b --- /dev/null +++ b/mobicore/common/curl/lib/CMakeLists.txt @@ -0,0 +1,124 @@ +set(LIB_NAME libcurl) + +configure_file(${CURL_SOURCE_DIR}/include/curl/curlbuild.h.cmake + ${CURL_BINARY_DIR}/include/curl/curlbuild.h) +configure_file(curl_config.h.cmake + ${CMAKE_CURRENT_BINARY_DIR}/curl_config.h) + +transform_makefile_inc("Makefile.inc" "${CMAKE_CURRENT_BINARY_DIR}/Makefile.inc.cmake") +include(${CMAKE_CURRENT_BINARY_DIR}/Makefile.inc.cmake) + +list(APPEND HHEADERS + ${CMAKE_CURRENT_BINARY_DIR}/curl_config.h + ${CURL_BINARY_DIR}/include/curl/curlbuild.h + ) + +if(MSVC) + list(APPEND CSOURCES libcurl.rc) +endif() + +# SET(CSOURCES +# # memdebug.c -not used +# # nwlib.c - Not used +# # strtok.c - specify later +# # strtoofft.c - specify later +# ) + +# # if we have Kerberos 4, right now this is never on +# #OPTION(CURL_KRB4 "Use Kerberos 4" OFF) +# IF(CURL_KRB4) +# SET(CSOURCES ${CSOURCES} +# krb4.c +# security.c +# ) +# ENDIF(CURL_KRB4) + +# #OPTION(CURL_MALLOC_DEBUG "Debug mallocs in Curl" OFF) +# MARK_AS_ADVANCED(CURL_MALLOC_DEBUG) +# IF(CURL_MALLOC_DEBUG) +# SET(CSOURCES ${CSOURCES} +# memdebug.c +# ) +# ENDIF(CURL_MALLOC_DEBUG) + +# # only build compat strtoofft if we need to +# IF(NOT HAVE_STRTOLL AND NOT HAVE__STRTOI64) +# SET(CSOURCES ${CSOURCES} +# strtoofft.c +# ) +# ENDIF(NOT HAVE_STRTOLL AND NOT HAVE__STRTOI64) + +if(HAVE_FEATURES_H) + set_source_files_properties( + cookie.c + easy.c + formdata.c + getenv.c + nonblock.c + hash.c + http.c + if2ip.c + mprintf.c + multi.c + sendf.c + telnet.c + transfer.c + url.c + COMPILE_FLAGS -D_BSD_SOURCE) +endif(HAVE_FEATURES_H) + + +# The rest of the build + +include_directories(${CMAKE_CURRENT_BINARY_DIR}/../include) +include_directories(${CMAKE_CURRENT_SOURCE_DIR}/..) +include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../include) +include_directories(${CMAKE_CURRENT_BINARY_DIR}/..) +include_directories(${CMAKE_CURRENT_SOURCE_DIR}) +include_directories(${CMAKE_CURRENT_BINARY_DIR}) +if(CURL_USE_ARES) + include_directories(${CARES_INCLUDE_DIR}) +endif() + +if(CURL_STATICLIB) + # Static lib + set(CURL_USER_DEFINED_DYNAMIC_OR_STATIC STATIC) +else() + # DLL / so dynamic lib + set(CURL_USER_DEFINED_DYNAMIC_OR_STATIC SHARED) +endif() + +add_library( + ${LIB_NAME} + ${CURL_USER_DEFINED_DYNAMIC_OR_STATIC} + ${HHEADERS} ${CSOURCES} + ) + +target_link_libraries(${LIB_NAME} ${CURL_LIBS}) + +if(WIN32) + add_definitions( -D_USRDLL ) +endif() + +set_target_properties(${LIB_NAME} PROPERTIES COMPILE_DEFINITIONS BUILDING_LIBCURL) + +setup_curl_dependencies(${LIB_NAME}) + +# Remove the "lib" prefix since the library is already named "libcurl". +set_target_properties(${LIB_NAME} PROPERTIES PREFIX "") +set_target_properties(${LIB_NAME} PROPERTIES IMPORT_PREFIX "") + +if(MSVC) + if(NOT BUILD_RELEASE_DEBUG_DIRS) + # Ugly workaround to remove the "/debug" or "/release" in each output + set_target_properties(${LIB_NAME} PROPERTIES PREFIX "../") + set_target_properties(${LIB_NAME} PROPERTIES IMPORT_PREFIX "../") + endif() +endif() + +if(WIN32) + if(NOT CURL_STATICLIB) + # Add "_imp" as a suffix before the extension to avoid conflicting with the statically linked "libcurl.lib" + set_target_properties(${LIB_NAME} PROPERTIES IMPORT_SUFFIX "_imp.lib") + endif() +endif() diff --git a/mobicore/common/curl/lib/Makefile.Watcom b/mobicore/common/curl/lib/Makefile.Watcom new file mode 100644 index 0000000000000000000000000000000000000000..7af368ba6cb793080545904a5c1cc77cb0cb62dc --- /dev/null +++ b/mobicore/common/curl/lib/Makefile.Watcom @@ -0,0 +1,236 @@ +# +# Watcom / OpenWatcom / Win32 makefile for libcurl. +# G. Vanem +# + +!ifndef %watcom +!error WATCOM environment variable not set! +!endif + +!ifdef %libname +LIBNAME = $(%libname) +!else +LIBNAME = libcurl +!endif +TARGETS = $(LIBNAME).dll $(LIBNAME)_imp.lib $(LIBNAME).lib + +CC = wcc386 +LD = wlink +AR = wlib +RC = wrc + +!ifdef __LOADDLL__ +! loaddll wcc386 wccd386 +! loaddll wpp386 wppd386 +! loaddll wlib wlibd +! if $(__VERSION__) > 1270 +! loaddll wlink wlinkd +! else +! loaddll wlink wlink +! endif +!endif + +!ifdef __LINUX__ +DS = / +CP = cp +MD = mkdir -p +RD = rmdir -p +RM = rm -f +!else +DS = $(X)\$(X) +CP = copy 2>NUL +MD = mkdir +RD = rmdir /q /s 2>NUL +!if $(__VERSION__) < 1250 +RM = del /q /f 2>NUL +!else +RM = rm -f +!endif +!endif + +SYS_INCL = -I$(%watcom)$(DS)h$(DS)nt -I$(%watcom)$(DS)h +SYS_LIBS = $(%watcom)$(DS)lib386$(DS)nt;$(%watcom)$(DS)lib386 + +CFLAGS = -3r -mf -hc -zff -zgf -zq -zm -zc -s -fr=con -w2 -fpi -oilrtfm & + -wcd=201 -bt=nt -d+ -dWIN32 -dCURL_WANTS_CA_BUNDLE_ENV & + -dBUILDING_LIBCURL -dHAVE_SPNEGO=1 -I. -I..$(DS)include $(SYS_INCL) + +!ifdef %debug +DEBUG = -dDEBUG=1 -dDEBUGBUILD +CFLAGS += -d3 $(DEBUG) +!else +CFLAGS += -d0 +!endif + +!ifdef %use_ipv6 +CFLAGS += -d_WIN32_WINNT=0x0501 -dENABLE_IPV6 +!endif + +!ifdef %use_sspi +CFLAGS += -dUSE_WINDOWS_SSPI +!endif + +# +# Change to suite. +# +!ifdef %zlib_root +ZLIB_ROOT = $(%zlib_root) +!else +ZLIB_ROOT = ..$(DS)..$(DS)zlib-1.2.5 +!endif + +!ifdef %libssh2_root +LIBSSH2_ROOT = $(%libssh2_root) +!else +LIBSSH2_ROOT = ..$(DS)..$(DS)libssh2-1.2.7 +!endif + +!ifdef %librtmp_root +LIBRTMP_ROOT = $(%librtmp_root) +!else +LIBRTMP_ROOT = ..$(DS)..$(DS)rtmpdump-2.3 +!endif + +!ifdef %openssl_root +OPENSSL_ROOT = $(%openssl_root) +!else +OPENSSL_ROOT = ..$(DS)..$(DS)openssl-0.9.8q +!endif + +!ifdef %ares_root +ARES_ROOT = $(%ares_root) +!else +ARES_ROOT = ..$(DS)ares +!endif + +!ifdef %use_zlib +CFLAGS += -dHAVE_ZLIB_H -dHAVE_LIBZ -I$(ZLIB_ROOT) +!endif + +!ifdef %use_rtmp +CFLAGS += -dUSE_LIBRTMP -I$(LIBRTMP_ROOT) +!endif + +!ifdef %use_ssh2 +CFLAGS += -DUSE_LIBSSH2 -DHAVE_LIBSSH2_H -I$(LIBSSH2_ROOT)$(DS)include -I$(LIBSSH2_ROOT)$(DS)win32 +!endif + +!ifdef %use_ssl +CFLAGS += -wcd=138 -dUSE_OPENSSL -dUSE_SSLEAY -I$(OPENSSL_ROOT)$(DS)inc32 +!endif + +!ifdef %use_ares +CFLAGS += -dUSE_ARES -I$(ARES_ROOT) +!endif + +!ifdef %use_watt32 +CFLAGS += -dUSE_WATT32 -I$(%watt_root)$(DS)inc +!endif + +OBJ_BASE = WC_Win32.obj +LINK_ARG = $(OBJ_BASE)$(DS)dyn$(DS)wlink.arg +LIB_ARG = $(OBJ_BASE)$(DS)stat$(DS)wlib.arg + +# In order to process Makefile.inc wmake must be called with -u switch! +!ifndef %MAKEFLAGS +!error You MUST call wmake with the -u switch! +!else +!include Makefile.inc +!endif + +OBJS = $(CSOURCES:.c=.obj) +!ifdef __LINUX__ +OBJS = $OBJ_DIR/$(OBJS: = $OBJ_DIR/) + +!else +OBJS = $OBJ_DIR\$(OBJS: = $OBJ_DIR\) +!endif + +# +# Use $(OBJS) as a template to generate $(OBJS_STAT) and $(OBJS_DYN). +# +OBJ_DIR = $(OBJ_BASE)$(DS)stat +OBJS_STAT = $+ $(OBJS) $- + +OBJ_DIR = $(OBJ_BASE)$(DS)dyn +OBJS_DYN = $+ $(OBJS) $- + +CURLBUILDH = ..$(DS)include$(DS)curl$(DS)curlbuild.h +RESOURCE = $(OBJ_BASE)$(DS)dyn$(DS)libcurl.res + +all: $(CURLBUILDH) $(OBJ_BASE) $(TARGETS) .SYMBOLIC + @echo Welcome to libcurl + +clean: .SYMBOLIC + -$(RM) $(OBJS_STAT) + -$(RM) $(OBJS_DYN) + -$(RM) $(RESOURCE) $(LINK_ARG) $(LIB_ARG) + +vclean distclean: clean .SYMBOLIC + -$(RM) $(TARGETS) $(LIBNAME).map $(LIBNAME).sym + -$(RD) $(OBJ_BASE)$(DS)stat + -$(RD) $(OBJ_BASE)$(DS)dyn + -$(RD) $(OBJ_BASE) + +$(OBJ_BASE): + -$(MD) $^@ + -$(MD) $^@$(DS)stat + -$(MD) $^@$(DS)dyn + +$(CURLBUILDH): .EXISTSONLY + $(CP) $^@.dist $^@ + +$(LIBNAME).dll: $(OBJS_DYN) $(RESOURCE) $(LINK_ARG) + $(LD) name $^@ @$]@ + +$(LIBNAME).lib: $(OBJS_STAT) $(LIB_ARG) + $(AR) -q -b -c $^@ @$]@ + +.ERASE +$(RESOURCE): libcurl.rc + $(RC) $(DEBUG) -q -r -zm -bt=nt -I..$(DS)include $(SYS_INCL) $[@ -fo=$^@ + +.ERASE +.c{$(OBJ_BASE)$(DS)dyn}.obj: + $(CC) $(CFLAGS) -bd -br $[@ -fo=$^@ + +.ERASE +.c{$(OBJ_BASE)$(DS)stat}.obj: + $(CC) $(CFLAGS) -DCURL_STATICLIB $[@ -fo=$^@ + +$(LINK_ARG): $(__MAKEFILES__) + %create $^@ + @%append $^@ system nt dll + @%append $^@ file { $(OBJS_DYN) } +!ifdef %debug + @%append $^@ debug all + @%append $^@ option symfile +!endif + @%append $^@ option quiet, map, caseexact, eliminate, implib=$(LIBNAME)_imp.lib, + @%append $^@ res=$(RESOURCE) libpath $(SYS_LIBS) + @%append $^@ library wldap32.lib +!ifdef %use_watt32 + @%append $^@ library $(%watt_root)$(DS)lib$(DS)wattcpw_imp.lib +!else + @%append $^@ library ws2_32.lib +!endif +!ifdef %use_zlib + @%append $^@ library $(ZLIB_ROOT)$(DS)zlib.lib +!endif +!ifdef %use_rtmp + @%append $^@ library $(LIBRTMP_ROOT)$(DS)librtmp$(DS)librtmp.lib +!endif +!ifdef %use_ssh2 + @%append $^@ library $(LIBSSH2_ROOT)$(DS)win32$(DS)libssh2.lib +!endif +!ifdef %use_ssl + @%append $^@ library $(OPENSSL_ROOT)$(DS)out32$(DS)libeay32.lib, $(OPENSSL_ROOT)$(DS)out32$(DS)ssleay32.lib +!endif +!ifdef %use_ares + @%append $^@ library $(ARES_ROOT)$(DS)cares.lib +!endif + +$(LIB_ARG): $(__MAKEFILES__) + %create $^@ + @for %f in ($(OBJS_STAT)) do @%append $^@ +- %f + diff --git a/mobicore/common/curl/lib/Makefile.am b/mobicore/common/curl/lib/Makefile.am new file mode 100644 index 0000000000000000000000000000000000000000..4a35c72c669378ac940b517e1f6391d9fe43484f --- /dev/null +++ b/mobicore/common/curl/lib/Makefile.am @@ -0,0 +1,175 @@ +#*************************************************************************** +# _ _ ____ _ +# Project ___| | | | _ \| | +# / __| | | | |_) | | +# | (__| |_| | _ <| |___ +# \___|\___/|_| \_\_____| +# +# Copyright (C) 1998 - 2010, Daniel Stenberg, , et al. +# +# This software is licensed as described in the file COPYING, which +# you should have received as part of this distribution. The terms +# are also available at http://curl.haxx.se/docs/copyright.html. +# +# You may opt to use, copy, modify, merge, publish, distribute and/or sell +# copies of the Software, and permit persons to whom the Software is +# furnished to do so, under the terms of the COPYING file. +# +# This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY +# KIND, either express or implied. +# +########################################################################### +AUTOMAKE_OPTIONS = foreign nostdinc + +DSP = vc6libcurl.dsp +VCPROJ = libcurl.vcproj + +DOCS = README.encoding README.memoryleak README.ares README.curlx \ + README.hostip README.multi_socket README.httpauth README.pipelining \ + README.curl_off_t README.pingpong + +CMAKE_DIST = CMakeLists.txt curl_config.h.cmake + +EXTRA_DIST = Makefile.b32 Makefile.m32 Makefile.vc6 $(DSP) \ + vc6libcurl.dsw config-win32.h config-win32ce.h config-riscos.h \ + config-mac.h curl_config.h.in makefile.dj config-dos.h libcurl.plist \ + libcurl.rc config-amigaos.h amigaos.c amigaos.h makefile.amiga \ + Makefile.netware nwlib.c nwos.c libcurl.imp msvcproj.head msvcproj.foot \ + config-win32ce.h config-os400.h setup-os400.h config-symbian.h \ + Makefile.Watcom config-tpf.h $(DOCS) $(VCPROJ) mk-ca-bundle.pl \ + mk-ca-bundle.vbs firefox-db2pem.sh $(CMAKE_DIST) config-vxworks.h \ + Makefile.vxworks config-vms.h + +CLEANFILES = $(DSP) $(VCPROJ) + +lib_LTLIBRARIES = libcurl.la +LIBCURL_LIBS = @LIBCURL_LIBS@ + +# This might hold -Werror +CFLAGS += @CURL_CFLAG_EXTRAS@ + +# Specify our include paths here, and do it relative to $(top_srcdir) and +# $(top_builddir), to ensure that these paths which belong to the library +# being currently built and tested are searched before the library which +# might possibly already be installed in the system. +# +# $(top_builddir)/include/curl for generated curlbuild.h included from curl.h +# $(top_builddir)/include for generated curlbuild.h included from lib/setup.h +# $(top_srcdir)/include is for libcurl's external include files +# $(top_builddir)/lib is for libcurl's generated lib/curl_config.h file +# $(top_srcdir)/lib is for libcurl's lib/setup.h and other "private" files +# $(top_builddir)/ares is for in-tree c-ares's generated ares_build.h file +# $(top_srcdir)/ares is for in-tree c-ares's external include files + +if USE_EMBEDDED_ARES +INCLUDES = -I$(top_builddir)/include/curl \ + -I$(top_builddir)/include \ + -I$(top_srcdir)/include \ + -I$(top_builddir)/lib \ + -I$(top_srcdir)/lib \ + -I$(top_builddir)/ares \ + -I$(top_srcdir)/ares +else +INCLUDES = -I$(top_builddir)/include/curl \ + -I$(top_builddir)/include \ + -I$(top_srcdir)/include \ + -I$(top_builddir)/lib \ + -I$(top_srcdir)/lib +endif + +if SONAME_BUMP +# +# Bumping of SONAME conditionally may seem like a weird thing to do, and yeah +# it is. The problem is that we try to avoid the bump as hard as possible, but +# yet it is still necessary for a few rare situations. The configure script will +# attempt to figure out these situations, and it can be forced to consider this +# to be such a case! See README.curl_off_t for further details. +# +# This conditional soname bump SHOULD be removed at next "proper" bump. +# +VERSIONINFO=-version-info 7:0:2 +else +VERSIONINFO=-version-info 6:0:2 +endif + +# This flag accepts an argument of the form current[:revision[:age]]. So, +# passing -version-info 3:12:1 sets current to 3, revision to 12, and age to +# 1. +# +# Here's the simplified rule guide on how to change -version-info: +# (current version is C:R:A) +# +# 1. if there are only source changes, use C:R+1:A +# 2. if interfaces were added use C+1:0:A+1 +# 3. if interfaces were removed, then use C+1:0:0 +# +# For the full guide on libcurl ABI rules, see docs/libcurl/ABI + +if NO_UNDEFINED +# The -no-undefined flag is CRUCIAL for this to build fine on Cygwin. +UNDEF = -no-undefined +endif + +if MIMPURE +# This is for gcc on Solaris (8+ ?) to avoid "relocations remain against +# allocatable but non-writable sections" problems. +MIMPURE = -mimpure-text +endif + +libcurl_la_LDFLAGS = $(UNDEF) $(VERSIONINFO) $(MIMPURE) $(LIBCURL_LIBS) + +# Makefile.inc provides the CSOURCES and HHEADERS defines +include Makefile.inc + +libcurl_la_SOURCES = $(CSOURCES) $(HHEADERS) + +WIN32SOURCES = $(CSOURCES) +WIN32HEADERS = $(HHEADERS) config-win32.h + +DSPOUT = | awk '{printf("%s\r\n", $$0)}' >> $(DSP) +VCPROJOUT = | awk '{printf("%s\r\n", $$0)}' >> $(VCPROJ) + +$(DSP): msvcproj.head msvcproj.foot Makefile.am + echo "creating $(DSP)" + @(cp $(srcdir)/msvcproj.head $(DSP); \ + echo "# Begin Group \"Source Files\"" $(DSPOUT); \ + echo "" $(DSPOUT); \ + echo "# PROP Default_Filter \"\"" $(DSPOUT); \ + win32_srcs='$(WIN32SOURCES)'; \ + sorted_srcs=`for file in $$win32_srcs; do echo $$file; done | sort`; \ + for file in $$sorted_srcs; do \ + echo "# Begin Source File" $(DSPOUT); \ + echo "" $(DSPOUT); \ + echo "SOURCE=.\\"$$file $(DSPOUT); \ + echo "# End Source File" $(DSPOUT); \ + done; \ + echo "# End Group" $(DSPOUT); \ + echo "# Begin Group \"Header Files\"" $(DSPOUT); \ + echo "" $(DSPOUT); \ + echo "# PROP Default_Filter \"\"" $(DSPOUT); \ + win32_hdrs='$(WIN32HEADERS)'; \ + sorted_hdrs=`for file in $$win32_hdrs; do echo $$file; done | sort`; \ + for file in $$sorted_hdrs; do \ + echo "# Begin Source File" $(DSPOUT); \ + echo "" $(DSPOUT); \ + echo "SOURCE=.\\"$$file $(DSPOUT); \ + echo "# End Source File" $(DSPOUT); \ + done; \ + echo "# End Group" $(DSPOUT); \ + cat $(srcdir)/msvcproj.foot $(DSPOUT) ) + +$(VCPROJ): vc8proj.head vc8proj.foot Makefile.am + echo "creating $(VCPROJ)" + @(cp $(srcdir)/vc8proj.head $(VCPROJ); \ + win32_srcs='$(WIN32SOURCES)'; \ + sorted_srcs=`for file in $$win32_srcs; do echo $$file; done | sort`; \ + for file in $$sorted_srcs; do \ + echo "" $(VCPROJOUT); \ + done; \ + echo "" $(VCPROJOUT); \ + win32_hdrs='$(WIN32HEADERS)'; \ + sorted_hdrs=`for file in $$win32_hdrs; do echo $$file; done | sort`; \ + for file in $$sorted_hdrs; do \ + echo "" $(VCPROJOUT); \ + done; \ + cat $(srcdir)/vc8proj.foot $(VCPROJOUT) ) diff --git a/mobicore/common/curl/lib/Makefile.b32 b/mobicore/common/curl/lib/Makefile.b32 new file mode 100644 index 0000000000000000000000000000000000000000..509ae270736f8d65c6eb6cf92d8c9210fb8fe8f0 --- /dev/null +++ b/mobicore/common/curl/lib/Makefile.b32 @@ -0,0 +1,89 @@ +############################################################ +# +# Makefile.b32 - Borland's C++ Compiler 5.X +# +# 'lib' directory +# +# 'BCCDIR' has to be set up to point to the base directory +# of the compiler, i.e. SET BCCDIR = c:\Borland\BCC55 +# where c:\Borland\BCC55 is the compiler is installed +# +# Written by Jaepil Kim, pit@paradise.net.nz +############################################################ + +# Edit the path below to point to the base of your Zlib sources. +!ifndef ZLIB_PATH +ZLIB_PATH = ../../zlib-1.2.1 +!endif + +# Edit the path below to point to the base of your OpenSSL package. +!ifndef OPENSSL_PATH +OPENSSL_PATH = ../../openssl-0.9.7d +!endif + +# Set libcurl static lib, dll and import lib +LIBCURL_LIB = libcurl.lib +LIBCURL_DLL = libcurl.dll +LIBCURL_IMPLIB = libcurl_imp.lib + +# Setup environment +CXX = bcc32 +LD = bcc32 +CP = copy +RM = del +LIB = tlib +IMPLIB = implib + +CXXFLAGS = -q -5 -O2 -w-aus -w-ccc -w-csu -w-par -w-pia -w-rch -w-inl -w-ngu -w-pro -tWM +LIBFLAGS = /C /P32 +LDFLAGS = -q -lq -laa -tWD + +INCDIRS = -I.;../include +LINKLIB = $(BCCDIR)/lib/cw32mt.lib + +# If you build with SSL support, set WITH_SSL=1 +DEFINES = -DNDEBUG -DWIN32 -D_CONSOLE -D_MBCS -DBUILDING_LIBCURL + +!ifdef WITH_ZLIB +DEFINES = $(DEFINES) -DHAVE_LIBZ -DHAVE_ZLIB_H +INCDIRS = $(INCDIRS);$(ZLIB_PATH) +LINKLIB = $(LINKLIB) $(ZLIB_PATH)/zlib.lib +!endif + +!ifdef WITH_SSL +DEFINES = $(DEFINES) -DUSE_SSLEAY +INCDIRS = $(INCDIRS);$(OPENSSL_PATH)/inc32;$(OPENSSL_PATH)/inc32/openssl +LINKLIB = $(LINKLIB) $(OPENSSL_PATH)/out32/ssleay32.lib $(OPENSSL_PATH)/out32/libeay32.lib +!endif + +.autodepend + +# Makefile.inc provides the CSOURCES and HHEADERS defines +!include Makefile.inc + +OBJECTS = $(CSOURCES:.c=.obj) + +.c.obj: + $(CXX) -c $(INCDIRS) $(CXXFLAGS) $(DEFINES) $< + +all: $(LIBCURL_LIB) $(LIBCURL_DLL) + +clean: + -$(RM) $(LIBCURL_LIB) + -$(RM) $(LIBCURL_IMPLIB) + -$(RM) libcurl.tds + -$(RM) *.obj + +$(LIBCURL_LIB): $(OBJECTS) + @-$(RM) $@ + $(LIB) $(LIBFLAGS) $@ @&&! ++$(**: = &^ ++) +! + +$(LIBCURL_DLL) $(LIBCURL_IMPLIB): $(OBJECTS) $(LINKLIB) + @-$(RM) $(LIBCURL_DLL) + @-$(RM) $(LIBCURL_IMPLIB) + $(LD) $(LDFLAGS) -e$(LIBCURL_DLL) $** + $(IMPLIB) $(LIBCURL_IMPLIB) $(LIBCURL_DLL) + diff --git a/mobicore/common/curl/lib/Makefile.in b/mobicore/common/curl/lib/Makefile.in new file mode 100644 index 0000000000000000000000000000000000000000..1a868210ef7efea73540318a9a820e872428add0 --- /dev/null +++ b/mobicore/common/curl/lib/Makefile.in @@ -0,0 +1,865 @@ +# Makefile.in generated by automake 1.9.6 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005 Free Software Foundation, Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + +# ./lib/Makefile.inc +# Using the backslash as line continuation character might be problematic +# with some make flavours, as Watcom's wmake showed us already. If we +# ever want to change this in a portable manner then we should consider +# this idea (posted to the libcurl list by Adam Kellas): +# CSRC1 = file1.c file2.c file3.c +# CSRC2 = file4.c file5.c file6.c +# CSOURCES = $(CSRC1) $(CSRC2) + +srcdir = @srcdir@ +top_srcdir = @top_srcdir@ +VPATH = @srcdir@ +pkgdatadir = $(datadir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +top_builddir = .. +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +INSTALL = @INSTALL@ +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \ + $(srcdir)/Makefile.inc $(srcdir)/curl_config.h.in +subdir = lib +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/m4/curl-compilers.m4 \ + $(top_srcdir)/m4/curl-confopts.m4 \ + $(top_srcdir)/m4/curl-functions.m4 \ + $(top_srcdir)/m4/curl-override.m4 \ + $(top_srcdir)/m4/curl-reentrant.m4 \ + $(top_srcdir)/m4/curl-system.m4 $(top_srcdir)/m4/libtool.m4 \ + $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ + $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ + $(top_srcdir)/acinclude.m4 $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs +CONFIG_HEADER = curl_config.h $(top_builddir)/src/curl_config.h \ + $(top_builddir)/include/curl/curlbuild.h +CONFIG_CLEAN_FILES = +am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; +am__vpath_adj = case $$p in \ + $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ + *) f=$$p;; \ + esac; +am__strip_dir = `echo $$p | sed -e 's|^.*/||'`; +am__installdirs = "$(DESTDIR)$(libdir)" +libLTLIBRARIES_INSTALL = $(INSTALL) +LTLIBRARIES = $(lib_LTLIBRARIES) +libcurl_la_LIBADD = +am__objects_1 = file.lo timeval.lo base64.lo hostip.lo progress.lo \ + formdata.lo cookie.lo http.lo sendf.lo ftp.lo url.lo dict.lo \ + if2ip.lo speedcheck.lo ldap.lo ssluse.lo version.lo getenv.lo \ + escape.lo mprintf.lo telnet.lo netrc.lo getinfo.lo transfer.lo \ + strequal.lo easy.lo security.lo krb4.lo curl_fnmatch.lo \ + fileinfo.lo ftplistparser.lo wildcard.lo krb5.lo memdebug.lo \ + http_chunks.lo strtok.lo connect.lo llist.lo hash.lo multi.lo \ + content_encoding.lo share.lo http_digest.lo md4.lo md5.lo \ + curl_rand.lo http_negotiate.lo http_ntlm.lo inet_pton.lo \ + strtoofft.lo strerror.lo hostares.lo hostasyn.lo hostip4.lo \ + hostip6.lo hostsyn.lo hostthre.lo inet_ntop.lo parsedate.lo \ + select.lo gtls.lo sslgen.lo tftp.lo splay.lo strdup.lo \ + socks.lo ssh.lo nss.lo qssl.lo rawstr.lo curl_addrinfo.lo \ + socks_gssapi.lo socks_sspi.lo curl_sspi.lo slist.lo \ + nonblock.lo curl_memrchr.lo imap.lo pop3.lo smtp.lo \ + pingpong.lo rtsp.lo curl_threads.lo warnless.lo hmac.lo \ + polarssl.lo curl_rtmp.lo openldap.lo curl_gethostname.lo \ + gopher.lo +am__objects_2 = +am_libcurl_la_OBJECTS = $(am__objects_1) $(am__objects_2) +libcurl_la_OBJECTS = $(am_libcurl_la_OBJECTS) +DEFAULT_INCLUDES = +depcomp = $(SHELL) $(top_srcdir)/depcomp +am__depfiles_maybe = depfiles +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +LTCOMPILE = $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) \ + $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ + $(AM_CFLAGS) $(CFLAGS) +CCLD = $(CC) +LINK = $(LIBTOOL) --tag=CC --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ + $(AM_LDFLAGS) $(LDFLAGS) -o $@ +SOURCES = $(libcurl_la_SOURCES) +DIST_SOURCES = $(libcurl_la_SOURCES) +ETAGS = etags +CTAGS = ctags +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +AMDEP_FALSE = @AMDEP_FALSE@ +AMDEP_TRUE = @AMDEP_TRUE@ +AMTAR = @AMTAR@ +AR = @AR@ +AS = @AS@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +BUILD_LIBHOSTNAME_FALSE = @BUILD_LIBHOSTNAME_FALSE@ +BUILD_LIBHOSTNAME_TRUE = @BUILD_LIBHOSTNAME_TRUE@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ + +# This might hold -Werror +CFLAGS = @CFLAGS@ @CURL_CFLAG_EXTRAS@ +CONFIGURE_OPTIONS = @CONFIGURE_OPTIONS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CROSSCOMPILING_FALSE = @CROSSCOMPILING_FALSE@ +CROSSCOMPILING_TRUE = @CROSSCOMPILING_TRUE@ +CURLDEBUG_FALSE = @CURLDEBUG_FALSE@ +CURLDEBUG_TRUE = @CURLDEBUG_TRUE@ +CURL_CA_BUNDLE = @CURL_CA_BUNDLE@ +CURL_CFLAG_EXTRAS = @CURL_CFLAG_EXTRAS@ +CURL_DISABLE_DICT = @CURL_DISABLE_DICT@ +CURL_DISABLE_FILE = @CURL_DISABLE_FILE@ +CURL_DISABLE_FTP = @CURL_DISABLE_FTP@ +CURL_DISABLE_GOPHER = @CURL_DISABLE_GOPHER@ +CURL_DISABLE_HTTP = @CURL_DISABLE_HTTP@ +CURL_DISABLE_IMAP = @CURL_DISABLE_IMAP@ +CURL_DISABLE_LDAP = @CURL_DISABLE_LDAP@ +CURL_DISABLE_LDAPS = @CURL_DISABLE_LDAPS@ +CURL_DISABLE_POP3 = @CURL_DISABLE_POP3@ +CURL_DISABLE_PROXY = @CURL_DISABLE_PROXY@ +CURL_DISABLE_RTSP = @CURL_DISABLE_RTSP@ +CURL_DISABLE_SMTP = @CURL_DISABLE_SMTP@ +CURL_DISABLE_TELNET = @CURL_DISABLE_TELNET@ +CURL_DISABLE_TFTP = @CURL_DISABLE_TFTP@ +CURL_LIBS = @CURL_LIBS@ +CURL_NETWORK_LIBS = @CURL_NETWORK_LIBS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DLLTOOL = @DLLTOOL@ +DSYMUTIL = @DSYMUTIL@ +DUMPBIN = @DUMPBIN@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +ENABLE_SHARED = @ENABLE_SHARED@ +EXEEXT = @EXEEXT@ +FGREP = @FGREP@ +GREP = @GREP@ +HAVE_LDAP_SSL = @HAVE_LDAP_SSL@ +HAVE_LIBZ = @HAVE_LIBZ@ +HAVE_LIBZ_FALSE = @HAVE_LIBZ_FALSE@ +HAVE_LIBZ_TRUE = @HAVE_LIBZ_TRUE@ +HAVE_PK11_CREATEGENERICOBJECT = @HAVE_PK11_CREATEGENERICOBJECT@ +IDN_ENABLED = @IDN_ENABLED@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +IPV6_ENABLED = @IPV6_ENABLED@ +KRB4_ENABLED = @KRB4_ENABLED@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LIBCURL_LIBS = @LIBCURL_LIBS@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +MAINT = @MAINT@ +MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@ +MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@ +MAKEINFO = @MAKEINFO@ +MANOPT = @MANOPT@ +MIMPURE_FALSE = @MIMPURE_FALSE@ +MIMPURE_TRUE = @MIMPURE_TRUE@ +NM = @NM@ +NMEDIT = @NMEDIT@ +NO_UNDEFINED_FALSE = @NO_UNDEFINED_FALSE@ +NO_UNDEFINED_TRUE = @NO_UNDEFINED_TRUE@ +NROFF = @NROFF@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +OTOOL = @OTOOL@ +OTOOL64 = @OTOOL64@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH = @PATH@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PERL = @PERL@ +PKGADD_NAME = @PKGADD_NAME@ +PKGADD_PKG = @PKGADD_PKG@ +PKGADD_VENDOR = @PKGADD_VENDOR@ +PKGCONFIG = @PKGCONFIG@ +RANDOM_FILE = @RANDOM_FILE@ +RANLIB = @RANLIB@ +REQUIRE_LIB_DEPS = @REQUIRE_LIB_DEPS@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +SONAME_BUMP_FALSE = @SONAME_BUMP_FALSE@ +SONAME_BUMP_TRUE = @SONAME_BUMP_TRUE@ +SSL_ENABLED = @SSL_ENABLED@ +STATICLIB_FALSE = @STATICLIB_FALSE@ +STATICLIB_TRUE = @STATICLIB_TRUE@ +STRIP = @STRIP@ +SUPPORT_FEATURES = @SUPPORT_FEATURES@ +SUPPORT_PROTOCOLS = @SUPPORT_PROTOCOLS@ +TEST_SERVER_LIBS = @TEST_SERVER_LIBS@ +USE_ARES = @USE_ARES@ +USE_EMBEDDED_ARES_FALSE = @USE_EMBEDDED_ARES_FALSE@ +USE_EMBEDDED_ARES_TRUE = @USE_EMBEDDED_ARES_TRUE@ +USE_GNUTLS = @USE_GNUTLS@ +USE_LIBRTMP = @USE_LIBRTMP@ +USE_LIBSSH2 = @USE_LIBSSH2@ +USE_MANUAL_FALSE = @USE_MANUAL_FALSE@ +USE_MANUAL_TRUE = @USE_MANUAL_TRUE@ +USE_NSS = @USE_NSS@ +USE_OPENLDAP = @USE_OPENLDAP@ +USE_POLARSSL = @USE_POLARSSL@ +USE_SSLEAY = @USE_SSLEAY@ +USE_WINDOWS_SSPI = @USE_WINDOWS_SSPI@ +VERSION = @VERSION@ +VERSIONNUM = @VERSIONNUM@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ +am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ +am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +libext = @libext@ +localedir = @localedir@ +localstatedir = @localstatedir@ +lt_ECHO = @lt_ECHO@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +subdirs = @subdirs@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ + +#*************************************************************************** +# _ _ ____ _ +# Project ___| | | | _ \| | +# / __| | | | |_) | | +# | (__| |_| | _ <| |___ +# \___|\___/|_| \_\_____| +# +# Copyright (C) 1998 - 2010, Daniel Stenberg, , et al. +# +# This software is licensed as described in the file COPYING, which +# you should have received as part of this distribution. The terms +# are also available at http://curl.haxx.se/docs/copyright.html. +# +# You may opt to use, copy, modify, merge, publish, distribute and/or sell +# copies of the Software, and permit persons to whom the Software is +# furnished to do so, under the terms of the COPYING file. +# +# This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY +# KIND, either express or implied. +# +########################################################################### +AUTOMAKE_OPTIONS = foreign nostdinc +DSP = vc6libcurl.dsp +VCPROJ = libcurl.vcproj +DOCS = README.encoding README.memoryleak README.ares README.curlx \ + README.hostip README.multi_socket README.httpauth README.pipelining \ + README.curl_off_t README.pingpong + +CMAKE_DIST = CMakeLists.txt curl_config.h.cmake +EXTRA_DIST = Makefile.b32 Makefile.m32 Makefile.vc6 $(DSP) \ + vc6libcurl.dsw config-win32.h config-win32ce.h config-riscos.h \ + config-mac.h curl_config.h.in makefile.dj config-dos.h libcurl.plist \ + libcurl.rc config-amigaos.h amigaos.c amigaos.h makefile.amiga \ + Makefile.netware nwlib.c nwos.c libcurl.imp msvcproj.head msvcproj.foot \ + config-win32ce.h config-os400.h setup-os400.h config-symbian.h \ + Makefile.Watcom config-tpf.h $(DOCS) $(VCPROJ) mk-ca-bundle.pl \ + mk-ca-bundle.vbs firefox-db2pem.sh $(CMAKE_DIST) config-vxworks.h \ + Makefile.vxworks config-vms.h + +CLEANFILES = $(DSP) $(VCPROJ) +lib_LTLIBRARIES = libcurl.la +@USE_EMBEDDED_ARES_FALSE@INCLUDES = -I$(top_builddir)/include/curl \ +@USE_EMBEDDED_ARES_FALSE@ -I$(top_builddir)/include \ +@USE_EMBEDDED_ARES_FALSE@ -I$(top_srcdir)/include \ +@USE_EMBEDDED_ARES_FALSE@ -I$(top_builddir)/lib \ +@USE_EMBEDDED_ARES_FALSE@ -I$(top_srcdir)/lib + + +# Specify our include paths here, and do it relative to $(top_srcdir) and +# $(top_builddir), to ensure that these paths which belong to the library +# being currently built and tested are searched before the library which +# might possibly already be installed in the system. +# +# $(top_builddir)/include/curl for generated curlbuild.h included from curl.h +# $(top_builddir)/include for generated curlbuild.h included from lib/setup.h +# $(top_srcdir)/include is for libcurl's external include files +# $(top_builddir)/lib is for libcurl's generated lib/curl_config.h file +# $(top_srcdir)/lib is for libcurl's lib/setup.h and other "private" files +# $(top_builddir)/ares is for in-tree c-ares's generated ares_build.h file +# $(top_srcdir)/ares is for in-tree c-ares's external include files +@USE_EMBEDDED_ARES_TRUE@INCLUDES = -I$(top_builddir)/include/curl \ +@USE_EMBEDDED_ARES_TRUE@ -I$(top_builddir)/include \ +@USE_EMBEDDED_ARES_TRUE@ -I$(top_srcdir)/include \ +@USE_EMBEDDED_ARES_TRUE@ -I$(top_builddir)/lib \ +@USE_EMBEDDED_ARES_TRUE@ -I$(top_srcdir)/lib \ +@USE_EMBEDDED_ARES_TRUE@ -I$(top_builddir)/ares \ +@USE_EMBEDDED_ARES_TRUE@ -I$(top_srcdir)/ares + +@SONAME_BUMP_FALSE@VERSIONINFO = -version-info 6:0:2 + +# +# Bumping of SONAME conditionally may seem like a weird thing to do, and yeah +# it is. The problem is that we try to avoid the bump as hard as possible, but +# yet it is still necessary for a few rare situations. The configure script will +# attempt to figure out these situations, and it can be forced to consider this +# to be such a case! See README.curl_off_t for further details. +# +# This conditional soname bump SHOULD be removed at next "proper" bump. +# +@SONAME_BUMP_TRUE@VERSIONINFO = -version-info 7:0:2 + +# This flag accepts an argument of the form current[:revision[:age]]. So, +# passing -version-info 3:12:1 sets current to 3, revision to 12, and age to +# 1. +# +# Here's the simplified rule guide on how to change -version-info: +# (current version is C:R:A) +# +# 1. if there are only source changes, use C:R+1:A +# 2. if interfaces were added use C+1:0:A+1 +# 3. if interfaces were removed, then use C+1:0:0 +# +# For the full guide on libcurl ABI rules, see docs/libcurl/ABI + +# The -no-undefined flag is CRUCIAL for this to build fine on Cygwin. +@NO_UNDEFINED_TRUE@UNDEF = -no-undefined + +# This is for gcc on Solaris (8+ ?) to avoid "relocations remain against +# allocatable but non-writable sections" problems. +@MIMPURE_TRUE@MIMPURE = -mimpure-text +libcurl_la_LDFLAGS = $(UNDEF) $(VERSIONINFO) $(MIMPURE) $(LIBCURL_LIBS) +CSOURCES = file.c timeval.c base64.c hostip.c progress.c formdata.c \ + cookie.c http.c sendf.c ftp.c url.c dict.c if2ip.c speedcheck.c \ + ldap.c ssluse.c version.c getenv.c escape.c mprintf.c telnet.c \ + netrc.c getinfo.c transfer.c strequal.c easy.c security.c krb4.c \ + curl_fnmatch.c fileinfo.c ftplistparser.c wildcard.c krb5.c \ + memdebug.c http_chunks.c strtok.c connect.c llist.c hash.c multi.c \ + content_encoding.c share.c http_digest.c md4.c md5.c curl_rand.c \ + http_negotiate.c http_ntlm.c inet_pton.c strtoofft.c strerror.c \ + hostares.c hostasyn.c hostip4.c hostip6.c hostsyn.c hostthre.c \ + inet_ntop.c parsedate.c select.c gtls.c sslgen.c tftp.c splay.c \ + strdup.c socks.c ssh.c nss.c qssl.c rawstr.c curl_addrinfo.c \ + socks_gssapi.c socks_sspi.c curl_sspi.c slist.c nonblock.c \ + curl_memrchr.c imap.c pop3.c smtp.c pingpong.c rtsp.c curl_threads.c \ + warnless.c hmac.c polarssl.c curl_rtmp.c openldap.c curl_gethostname.c\ + gopher.c + +HHEADERS = arpa_telnet.h netrc.h file.h timeval.h qssl.h hostip.h \ + progress.h formdata.h cookie.h http.h sendf.h ftp.h url.h dict.h \ + if2ip.h speedcheck.h urldata.h curl_ldap.h ssluse.h escape.h telnet.h \ + getinfo.h strequal.h krb4.h memdebug.h http_chunks.h curl_rand.h \ + curl_fnmatch.h wildcard.h fileinfo.h ftplistparser.h strtok.h \ + connect.h llist.h hash.h content_encoding.h share.h curl_md4.h \ + curl_md5.h http_digest.h http_negotiate.h http_ntlm.h inet_pton.h \ + strtoofft.h strerror.h inet_ntop.h curlx.h curl_memory.h setup.h \ + transfer.h select.h easyif.h multiif.h parsedate.h sslgen.h gtls.h \ + tftp.h sockaddr.h splay.h strdup.h setup_once.h socks.h ssh.h nssg.h \ + curl_base64.h rawstr.h curl_addrinfo.h curl_sspi.h slist.h nonblock.h \ + curl_memrchr.h imap.h pop3.h smtp.h pingpong.h rtsp.h curl_threads.h \ + warnless.h curl_hmac.h polarssl.h curl_rtmp.h curl_gethostname.h \ + gopher.h + + +# Makefile.inc provides the CSOURCES and HHEADERS defines +libcurl_la_SOURCES = $(CSOURCES) $(HHEADERS) +WIN32SOURCES = $(CSOURCES) +WIN32HEADERS = $(HHEADERS) config-win32.h +DSPOUT = | awk '{printf("%s\r\n", $$0)}' >> $(DSP) +VCPROJOUT = | awk '{printf("%s\r\n", $$0)}' >> $(VCPROJ) +all: curl_config.h + $(MAKE) $(AM_MAKEFLAGS) all-am + +.SUFFIXES: +.SUFFIXES: .c .lo .o .obj +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(srcdir)/Makefile.inc $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ + && exit 0; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign lib/Makefile'; \ + cd $(top_srcdir) && \ + $(AUTOMAKE) --foreign lib/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +curl_config.h: stamp-h1 + @if test ! -f $@; then \ + rm -f stamp-h1; \ + $(MAKE) stamp-h1; \ + else :; fi + +stamp-h1: $(srcdir)/curl_config.h.in $(top_builddir)/config.status + @rm -f stamp-h1 + cd $(top_builddir) && $(SHELL) ./config.status lib/curl_config.h +$(srcdir)/curl_config.h.in: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) + cd $(top_srcdir) && $(AUTOHEADER) + rm -f stamp-h1 + touch $@ + +distclean-hdr: + -rm -f curl_config.h stamp-h1 +install-libLTLIBRARIES: $(lib_LTLIBRARIES) + @$(NORMAL_INSTALL) + test -z "$(libdir)" || $(mkdir_p) "$(DESTDIR)$(libdir)" + @list='$(lib_LTLIBRARIES)'; for p in $$list; do \ + if test -f $$p; then \ + f=$(am__strip_dir) \ + echo " $(LIBTOOL) --mode=install $(libLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(libdir)/$$f'"; \ + $(LIBTOOL) --mode=install $(libLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(libdir)/$$f"; \ + else :; fi; \ + done + +uninstall-libLTLIBRARIES: + @$(NORMAL_UNINSTALL) + @set -x; list='$(lib_LTLIBRARIES)'; for p in $$list; do \ + p=$(am__strip_dir) \ + echo " $(LIBTOOL) --mode=uninstall rm -f '$(DESTDIR)$(libdir)/$$p'"; \ + $(LIBTOOL) --mode=uninstall rm -f "$(DESTDIR)$(libdir)/$$p"; \ + done + +clean-libLTLIBRARIES: + -test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES) + @list='$(lib_LTLIBRARIES)'; for p in $$list; do \ + dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ + test "$$dir" != "$$p" || dir=.; \ + echo "rm -f \"$${dir}/so_locations\""; \ + rm -f "$${dir}/so_locations"; \ + done +libcurl.la: $(libcurl_la_OBJECTS) $(libcurl_la_DEPENDENCIES) + $(LINK) -rpath $(libdir) $(libcurl_la_LDFLAGS) $(libcurl_la_OBJECTS) $(libcurl_la_LIBADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/base64.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/connect.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/content_encoding.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cookie.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/curl_addrinfo.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/curl_fnmatch.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/curl_gethostname.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/curl_memrchr.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/curl_rand.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/curl_rtmp.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/curl_sspi.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/curl_threads.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dict.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/easy.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/escape.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/file.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fileinfo.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/formdata.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ftp.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ftplistparser.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/getenv.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/getinfo.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gopher.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gtls.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/hash.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/hmac.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/hostares.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/hostasyn.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/hostip.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/hostip4.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/hostip6.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/hostsyn.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/hostthre.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/http.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/http_chunks.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/http_digest.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/http_negotiate.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/http_ntlm.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/if2ip.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/imap.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/inet_ntop.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/inet_pton.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/krb4.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/krb5.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ldap.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/llist.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/md4.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/md5.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/memdebug.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mprintf.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/multi.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/netrc.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/nonblock.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/nss.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/openldap.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/parsedate.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pingpong.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/polarssl.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pop3.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/progress.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/qssl.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rawstr.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rtsp.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/security.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/select.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sendf.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/share.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/slist.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/smtp.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/socks.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/socks_gssapi.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/socks_sspi.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/speedcheck.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/splay.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ssh.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sslgen.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ssluse.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/strdup.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/strequal.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/strerror.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/strtok.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/strtoofft.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/telnet.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tftp.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/timeval.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/transfer.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/url.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/version.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/warnless.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/wildcard.Plo@am__quote@ + +.c.o: +@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c $< + +.c.obj: +@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` + +.c.lo: +@am__fastdepCC_TRUE@ if $(LTCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $< + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +distclean-libtool: + -rm -f libtool +uninstall-info-am: + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + mkid -fID $$unique +tags: TAGS + +TAGS: $(HEADERS) $(SOURCES) curl_config.h.in $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) curl_config.h.in $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$tags $$unique; \ + fi +ctags: CTAGS +CTAGS: $(HEADERS) $(SOURCES) curl_config.h.in $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) curl_config.h.in $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + test -z "$(CTAGS_ARGS)$$tags$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$tags $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && cd $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) $$here + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ + list='$(DISTFILES)'; for file in $$list; do \ + case $$file in \ + $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ + $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ + esac; \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test "$$dir" != "$$file" && test "$$dir" != "."; then \ + dir="/$$dir"; \ + $(mkdir_p) "$(distdir)$$dir"; \ + else \ + dir=''; \ + fi; \ + if test -d $$d/$$file; then \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ + fi; \ + cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ + else \ + test -f $(distdir)/$$file \ + || cp -p $$d/$$file $(distdir)/$$file \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile $(LTLIBRARIES) curl_config.h +installdirs: + for dir in "$(DESTDIR)$(libdir)"; do \ + test -z "$$dir" || $(mkdir_p) "$$dir"; \ + done +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-generic clean-libLTLIBRARIES clean-libtool \ + mostlyclean-am + +distclean: distclean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-hdr distclean-libtool distclean-tags + +dvi: dvi-am + +dvi-am: + +html: html-am + +info: info-am + +info-am: + +install-data-am: + +install-exec-am: install-libLTLIBRARIES + +install-info: install-info-am + +install-man: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: uninstall-info-am uninstall-libLTLIBRARIES + +.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ + clean-libLTLIBRARIES clean-libtool ctags distclean \ + distclean-compile distclean-generic distclean-hdr \ + distclean-libtool distclean-tags distdir dvi dvi-am html \ + html-am info info-am install install-am install-data \ + install-data-am install-exec install-exec-am install-info \ + install-info-am install-libLTLIBRARIES install-man \ + install-strip installcheck installcheck-am installdirs \ + maintainer-clean maintainer-clean-generic mostlyclean \ + mostlyclean-compile mostlyclean-generic mostlyclean-libtool \ + pdf pdf-am ps ps-am tags uninstall uninstall-am \ + uninstall-info-am uninstall-libLTLIBRARIES + + +$(DSP): msvcproj.head msvcproj.foot Makefile.am + echo "creating $(DSP)" + @(cp $(srcdir)/msvcproj.head $(DSP); \ + echo "# Begin Group \"Source Files\"" $(DSPOUT); \ + echo "" $(DSPOUT); \ + echo "# PROP Default_Filter \"\"" $(DSPOUT); \ + win32_srcs='$(WIN32SOURCES)'; \ + sorted_srcs=`for file in $$win32_srcs; do echo $$file; done | sort`; \ + for file in $$sorted_srcs; do \ + echo "# Begin Source File" $(DSPOUT); \ + echo "" $(DSPOUT); \ + echo "SOURCE=.\\"$$file $(DSPOUT); \ + echo "# End Source File" $(DSPOUT); \ + done; \ + echo "# End Group" $(DSPOUT); \ + echo "# Begin Group \"Header Files\"" $(DSPOUT); \ + echo "" $(DSPOUT); \ + echo "# PROP Default_Filter \"\"" $(DSPOUT); \ + win32_hdrs='$(WIN32HEADERS)'; \ + sorted_hdrs=`for file in $$win32_hdrs; do echo $$file; done | sort`; \ + for file in $$sorted_hdrs; do \ + echo "# Begin Source File" $(DSPOUT); \ + echo "" $(DSPOUT); \ + echo "SOURCE=.\\"$$file $(DSPOUT); \ + echo "# End Source File" $(DSPOUT); \ + done; \ + echo "# End Group" $(DSPOUT); \ + cat $(srcdir)/msvcproj.foot $(DSPOUT) ) + +$(VCPROJ): vc8proj.head vc8proj.foot Makefile.am + echo "creating $(VCPROJ)" + @(cp $(srcdir)/vc8proj.head $(VCPROJ); \ + win32_srcs='$(WIN32SOURCES)'; \ + sorted_srcs=`for file in $$win32_srcs; do echo $$file; done | sort`; \ + for file in $$sorted_srcs; do \ + echo "" $(VCPROJOUT); \ + done; \ + echo "" $(VCPROJOUT); \ + win32_hdrs='$(WIN32HEADERS)'; \ + sorted_hdrs=`for file in $$win32_hdrs; do echo $$file; done | sort`; \ + for file in $$sorted_hdrs; do \ + echo "" $(VCPROJOUT); \ + done; \ + cat $(srcdir)/vc8proj.foot $(VCPROJOUT) ) +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/mobicore/common/curl/lib/Makefile.inc b/mobicore/common/curl/lib/Makefile.inc new file mode 100644 index 0000000000000000000000000000000000000000..41ab8277d720e534b939785e25ad0d51adc5615a --- /dev/null +++ b/mobicore/common/curl/lib/Makefile.inc @@ -0,0 +1,40 @@ +# ./lib/Makefile.inc +# Using the backslash as line continuation character might be problematic +# with some make flavours, as Watcom's wmake showed us already. If we +# ever want to change this in a portable manner then we should consider +# this idea (posted to the libcurl list by Adam Kellas): +# CSRC1 = file1.c file2.c file3.c +# CSRC2 = file4.c file5.c file6.c +# CSOURCES = $(CSRC1) $(CSRC2) + +CSOURCES = file.c timeval.c base64.c hostip.c progress.c formdata.c \ + cookie.c http.c sendf.c ftp.c url.c dict.c if2ip.c speedcheck.c \ + ldap.c ssluse.c version.c getenv.c escape.c mprintf.c telnet.c \ + netrc.c getinfo.c transfer.c strequal.c easy.c security.c krb4.c \ + curl_fnmatch.c fileinfo.c ftplistparser.c wildcard.c krb5.c \ + memdebug.c http_chunks.c strtok.c connect.c llist.c hash.c multi.c \ + content_encoding.c share.c http_digest.c md4.c md5.c curl_rand.c \ + http_negotiate.c http_ntlm.c inet_pton.c strtoofft.c strerror.c \ + hostares.c hostasyn.c hostip4.c hostip6.c hostsyn.c hostthre.c \ + inet_ntop.c parsedate.c select.c gtls.c sslgen.c tftp.c splay.c \ + strdup.c socks.c ssh.c nss.c qssl.c rawstr.c curl_addrinfo.c \ + socks_gssapi.c socks_sspi.c curl_sspi.c slist.c nonblock.c \ + curl_memrchr.c imap.c pop3.c smtp.c pingpong.c rtsp.c curl_threads.c \ + warnless.c hmac.c polarssl.c curl_rtmp.c openldap.c curl_gethostname.c\ + gopher.c + +HHEADERS = arpa_telnet.h netrc.h file.h timeval.h qssl.h hostip.h \ + progress.h formdata.h cookie.h http.h sendf.h ftp.h url.h dict.h \ + if2ip.h speedcheck.h urldata.h curl_ldap.h ssluse.h escape.h telnet.h \ + getinfo.h strequal.h krb4.h memdebug.h http_chunks.h curl_rand.h \ + curl_fnmatch.h wildcard.h fileinfo.h ftplistparser.h strtok.h \ + connect.h llist.h hash.h content_encoding.h share.h curl_md4.h \ + curl_md5.h http_digest.h http_negotiate.h http_ntlm.h inet_pton.h \ + strtoofft.h strerror.h inet_ntop.h curlx.h curl_memory.h setup.h \ + transfer.h select.h easyif.h multiif.h parsedate.h sslgen.h gtls.h \ + tftp.h sockaddr.h splay.h strdup.h setup_once.h socks.h ssh.h nssg.h \ + curl_base64.h rawstr.h curl_addrinfo.h curl_sspi.h slist.h nonblock.h \ + curl_memrchr.h imap.h pop3.h smtp.h pingpong.h rtsp.h curl_threads.h \ + warnless.h curl_hmac.h polarssl.h curl_rtmp.h curl_gethostname.h \ + gopher.h + diff --git a/mobicore/common/curl/lib/Makefile.m32 b/mobicore/common/curl/lib/Makefile.m32 new file mode 100644 index 0000000000000000000000000000000000000000..04b6450a5f63fd63991a91c5a0d918a9c041bf14 --- /dev/null +++ b/mobicore/common/curl/lib/Makefile.m32 @@ -0,0 +1,167 @@ +######################################################################### +# +## Makefile for building libcurl.a with MingW32 (GCC-3.2 or later) +## and optionally OpenSSL (0.9.8), libssh2 (1.2), zlib (1.2.5) +## +## Usage: +## mingw32-make -f Makefile.m32 [SSL=1] [SSH2=1] [ZLIB=1] [IDN=1] [SSPI=1] [IPV6=1] [LDAPS=1] [RTMP=1] [DYN=1] +## +## Hint: you can also set environment vars to control the build, f.e.: +## set ZLIB_PATH=c:/zlib-1.2.5 +## set ZLIB=1 +## +## Comments to: Troy Engel or +## Joern Hartroth +######################################################################### + +# Edit the path below to point to the base of your Zlib sources. +ifndef ZLIB_PATH +ZLIB_PATH = ../../zlib-1.2.5 +endif +# Edit the path below to point to the base of your OpenSSL package. +ifndef OPENSSL_PATH +OPENSSL_PATH = ../../openssl-0.9.8q +endif +# Edit the path below to point to the base of your LibSSH2 package. +ifndef LIBSSH2_PATH +LIBSSH2_PATH = ../../libssh2-1.2.7 +endif +# Edit the path below to point to the base of your libidn package. +ifndef LIBIDN_PATH +LIBIDN_PATH = ../../libidn-1.18 +endif +# Edit the path below to point to the base of your librtmp package. +ifndef LIBRTMP_PATH +LIBRTMP_PATH = ../../librtmp-2.3 +endif +# Edit the path below to point to the base of your Novell LDAP NDK. +ifndef LDAP_SDK +LDAP_SDK = c:/novell/ndk/cldapsdk/win32 +endif + +# Edit the path below to point to the base of your c-ares package. +ifndef LIBCARES_PATH +LIBCARES_PATH = ../ares +endif + +CC = gcc +AR = ar +# comment LDFLAGS below to keep debug info +LDFLAGS = -s +RANLIB = ranlib +RC = windres +RCFLAGS = --include-dir=../include -DDEBUGBUILD=0 -O COFF -i +RM = del /q /f 2>NUL +STRIP = strip -g + +######################################################## +## Nothing more to do below this line! + +INCLUDES = -I. -I../include +CFLAGS = -g -O2 -DBUILDING_LIBCURL +ifdef ARES + INCLUDES += -I$(LIBCARES_PATH) + CFLAGS += -DUSE_ARES + DLL_LIBS += -L$(LIBCARES_PATH) -lcares + libcurl_dll_DEPENDENCIES = $(LIBCARES_PATH)/libcares.a +endif +ifdef RTMP + INCLUDES += -I"$(LIBRTMP_PATH)" + CFLAGS += -DUSE_LIBRTMP + DLL_LIBS += -L"$(LIBRTMP_PATH)/librtmp" -lrtmp -lwinmm +endif +ifdef SSH2 + INCLUDES += -I"$(LIBSSH2_PATH)/include" -I"$(LIBSSH2_PATH)/win32" + CFLAGS += -DUSE_LIBSSH2 -DHAVE_LIBSSH2_H + DLL_LIBS += -L$(LIBSSH2_PATH)/win32 -lssh2 +endif +ifdef SSL + INCLUDES += -I"$(OPENSSL_PATH)/outinc" -I"$(OPENSSL_PATH)/outinc/openssl" + CFLAGS += -DUSE_SSLEAY -DUSE_OPENSSL -DHAVE_OPENSSL_ENGINE_H -DHAVE_OPENSSL_PKCS12_H \ + -DHAVE_ENGINE_LOAD_BUILTIN_ENGINES -DOPENSSL_NO_KRB5 \ + -DCURL_WANTS_CA_BUNDLE_ENV + DLL_LIBS += -L$(OPENSSL_PATH)/out -leay32 -lssl32 +endif +ifdef ZLIB + INCLUDES += -I"$(ZLIB_PATH)" + CFLAGS += -DHAVE_LIBZ -DHAVE_ZLIB_H + DLL_LIBS += -L$(ZLIB_PATH) -lz +endif +ifdef IDN + INCLUDES += -I"$(LIBIDN_PATH)/include" + CFLAGS += -DUSE_LIBIDN + DLL_LIBS += -L$(LIBIDN_PATH)/lib -lidn +endif +ifdef SSPI + CFLAGS += -DUSE_WINDOWS_SSPI +endif +ifdef IPV6 + CFLAGS += -DENABLE_IPV6 +endif +ifdef LDAPS + CFLAGS += -DHAVE_LDAP_SSL +endif +ifdef USE_LDAP_NOVELL + INCLUDES += -I"$(LDAP_SDK)/inc" + CFLAGS += -DCURL_HAS_NOVELL_LDAPSDK + DLL_LIBS += -L"$(LDAP_SDK)/lib/mscvc" -lldapsdk -lldapssl -lldapx +endif +ifdef USE_LDAP_OPENLDAP + INCLUDES += -I"$(LDAP_SDK)/include" + CFLAGS += -DCURL_HAS_OPENLDAP_LDAPSDK + DLL_LIBS += -L"$(LDAP_SDK)/lib" -lldap -llber +endif +ifndef USE_LDAP_NOVELL +ifndef USE_LDAP_OPENLDAP +DLL_LIBS += -lwldap32 +endif +endif +DLL_LIBS += -lws2_32 +COMPILE = $(CC) $(INCLUDES) $(CFLAGS) + +# Makefile.inc provides the CSOURCES and HHEADERS defines +include Makefile.inc + +libcurl_dll_LIBRARY = libcurl.dll +libcurl_dll_a_LIBRARY = libcurldll.a +libcurl_a_LIBRARY = libcurl.a + +libcurl_a_OBJECTS := $(patsubst %.c,%.o,$(strip $(CSOURCES))) +libcurl_a_DEPENDENCIES := $(strip $(CSOURCES) $(HHEADERS)) + +RESOURCE = libcurl.res + +.SUFFIXES: .rc .res + +all: $(libcurl_a_LIBRARY) $(libcurl_dll_LIBRARY) + +$(libcurl_a_LIBRARY): $(libcurl_a_OBJECTS) $(libcurl_a_DEPENDENCIES) + -$(RM) $@ + $(AR) cru $@ $(libcurl_a_OBJECTS) + $(RANLIB) $@ + $(STRIP) $@ + +# remove the last line above to keep debug info + +$(libcurl_dll_LIBRARY): $(libcurl_a_OBJECTS) $(RESOURCE) $(libcurl_dll_DEPENDENCIES) + -$(RM) $@ + $(CC) $(LDFLAGS) -shared -Wl,--out-implib,$(libcurl_dll_a_LIBRARY) \ + -o $@ $(libcurl_a_OBJECTS) $(RESOURCE) $(DLL_LIBS) + +.c.o: + $(COMPILE) -c $< + +.rc.res: + $(RC) $(RCFLAGS) $< -o $@ + +clean: + -$(RM) $(libcurl_a_OBJECTS) $(RESOURCE) + +distclean vclean: clean + -$(RM) $(libcurl_a_LIBRARY) $(libcurl_dll_LIBRARY) $(libcurl_dll_a_LIBRARY) + +FORCE: ; + +$(LIBCARES_PATH)/libcares.a: + $(MAKE) -C $(LIBCARES_PATH) -f Makefile.m32 + diff --git a/mobicore/common/curl/lib/Makefile.netware b/mobicore/common/curl/lib/Makefile.netware new file mode 100644 index 0000000000000000000000000000000000000000..bce429e66b258eb46ba6f0c666a0d7b9b742374d --- /dev/null +++ b/mobicore/common/curl/lib/Makefile.netware @@ -0,0 +1,669 @@ +################################################################# +# +## Makefile for building libcurl.nlm (NetWare version - gnu make) +## Use: make -f Makefile.netware +## +## Comments to: Guenter Knauf http://www.gknw.net/phpbb +# +################################################################# + +# Edit the path below to point to the base of your Novell NDK. +ifndef NDKBASE +NDKBASE = c:/novell +endif + +# Edit the path below to point to the base of your Zlib sources. +ifndef ZLIB_PATH +ZLIB_PATH = ../../zlib-1.2.5 +endif + +# Edit the path below to point to the base of your OpenSSL package. +ifndef OPENSSL_PATH +OPENSSL_PATH = ../../openssl-0.9.8q +endif + +# Edit the path below to point to the base of your LibSSH2 package. +ifndef LIBSSH2_PATH +LIBSSH2_PATH = ../../libssh2-1.2.7 +endif + +# Edit the path below to point to the base of your libidn package. +ifndef LIBIDN_PATH +LIBIDN_PATH = ../../libidn-1.18 +endif + +# Edit the path below to point to the base of your librtmp package. +ifndef LIBRTMP_PATH +LIBRTMP_PATH = ../../librtmp-2.3 +endif + +# Edit the path below to point to the base of your c-ares package. +ifndef LIBCARES_PATH +LIBCARES_PATH = ../ares +endif + +ifndef INSTDIR +INSTDIR = ..$(DS)curl-$(LIBCURL_VERSION_STR)-bin-nw +endif + +# Edit the vars below to change NLM target settings. +TARGET = libcurl +VERSION = $(LIBCURL_VERSION) +COPYR = Copyright (C) $(LIBCURL_COPYRIGHT_STR) +DESCR = cURL libcurl $(LIBCURL_VERSION_STR) ($(LIBARCH)) - http://curl.haxx.se +MTSAFE = YES +STACK = 64000 +SCREEN = none +EXPORTS = @libcurl.imp + +# Uncomment the next line to enable linking with POSIX semantics. +# POSIXFL = 1 + +# Edit the var below to point to your lib architecture. +ifndef LIBARCH +LIBARCH = LIBC +endif + +# must be equal to NDEBUG or DEBUG, CURLDEBUG +ifndef DB +DB = NDEBUG +endif +# Optimization: -O or debugging: -g +ifeq ($(DB),NDEBUG) + OPT = -O2 + OBJDIR = release +else + OPT = -g + OBJDIR = debug +endif + +# The following lines defines your compiler. +ifdef CWFolder + METROWERKS = $(CWFolder) +endif +ifdef METROWERKS + # MWCW_PATH = $(subst \,/,$(METROWERKS))/Novell Support + MWCW_PATH = $(subst \,/,$(METROWERKS))/Novell Support/Metrowerks Support + CC = mwccnlm +else + CC = gcc +endif +PERL = perl +# Here you can find a native Win32 binary of the original awk: +# http://www.gknw.net/development/prgtools/awk-20070501.zip +AWK = awk +CP = cp -afv +MKDIR = mkdir +# RM = rm -f +# If you want to mark the target as MTSAFE you will need a tool for +# generating the xdc data for the linker; here's a minimal tool: +# http://www.gknw.net/development/prgtools/mkxdc.zip +MPKXDC = mkxdc + +# LIBARCH_U = $(shell $(AWK) 'BEGIN {print toupper(ARGV[1])}' $(LIBARCH)) +LIBARCH_L = $(shell $(AWK) 'BEGIN {print tolower(ARGV[1])}' $(LIBARCH)) + +# Include the version info retrieved from curlver.h +-include $(OBJDIR)/version.inc + +# Global flags for all compilers +CFLAGS += $(OPT) -D$(DB) -DNETWARE -DHAVE_CONFIG_H -nostdinc + +ifeq ($(CC),mwccnlm) +LD = mwldnlm +LDFLAGS = -nostdlib $(PRELUDE) $(OBJL) -o $@ -commandfile +AR = mwldnlm +ARFLAGS = -nostdlib -type library -o +LIBEXT = lib +#RANLIB = +CFLAGS += -msgstyle gcc -gccinc -inline off -opt nointrinsics -proc 586 +CFLAGS += -relax_pointers +#CFLAGS += -w on +ifeq ($(LIBARCH),LIBC) +ifeq ($(POSIXFL),1) + PRELUDE = $(NDK_LIBC)/imports/posixpre.o +else + PRELUDE = $(NDK_LIBC)/imports/libcpre.o +endif + CFLAGS += -align 4 +else + # PRELUDE = $(NDK_CLIB)/imports/clibpre.o + # to avoid the __init_* / __deinit_* whoes dont use prelude from NDK + PRELUDE = "$(MWCW_PATH)/libraries/runtime/prelude.obj" + # CFLAGS += -include "$(MWCW_PATH)/headers/nlm_clib_prefix.h" + CFLAGS += -align 1 +endif +else +LD = nlmconv +LDFLAGS = -T +AR = ar +ARFLAGS = -cq +LIBEXT = a +RANLIB = ranlib +CFLAGS += -fno-builtin -fpcc-struct-return -fno-strict-aliasing +CFLAGS += -Wall # -pedantic +ifeq ($(LIBARCH),LIBC) +ifeq ($(POSIXFL),1) + PRELUDE = $(NDK_LIBC)/imports/posixpre.gcc.o +else + PRELUDE = $(NDK_LIBC)/imports/libcpre.gcc.o +endif +else + PRELUDE = $(NDK_CLIB)/imports/clibpre.gcc.o + # to avoid the __init_* / __deinit_* whoes dont use prelude from NDK + # http://www.gknw.net/development/mk_nlm/gcc_pre.zip + # PRELUDE = $(NDK_ROOT)/pre/prelude.o + CFLAGS += -include $(NDKBASE)/nlmconv/genlm.h +endif +endif + +NDK_ROOT = $(NDKBASE)/ndk +ifndef NDK_CLIB +NDK_CLIB = $(NDK_ROOT)/nwsdk +endif +ifndef NDK_LIBC +NDK_LIBC = $(NDK_ROOT)/libc +endif +ifndef NDK_LDAP +NDK_LDAP = $(NDK_ROOT)/cldapsdk/netware +endif +CURL_INC = ../include +CURL_LIB = ../lib + +INCLUDES = -I$(CURL_INC) -I$(CURL_LIB) + +ifdef WITH_ARES + INCLUDES += -I$(LIBCARES_PATH) + LDLIBS += $(LIBCARES_PATH)/libcares.$(LIBEXT) +endif +ifdef WITH_SSH2 + INCLUDES += -I$(LIBSSH2_PATH)/include +ifdef LINK_STATIC + LDLIBS += $(LIBSSH2_PATH)/nw/libssh2.$(LIBEXT) +else + MODULES += libssh2.nlm + IMPORTS += @$(LIBSSH2_PATH)/nw/libssh2.imp +endif +endif +ifdef WITH_RTMP + INCLUDES += -I$(LIBRTMP_PATH) + LDLIBS += $(LIBRTMP_PATH)/librtmp/librtmp.$(LIBEXT) +endif +ifdef WITH_SSL + INCLUDES += -I$(OPENSSL_PATH)/outinc_nw_$(LIBARCH_L) + LDLIBS += $(OPENSSL_PATH)/out_nw_$(LIBARCH_L)/ssl.$(LIBEXT) + LDLIBS += $(OPENSSL_PATH)/out_nw_$(LIBARCH_L)/crypto.$(LIBEXT) + IMPORTS += GetProcessSwitchCount RunningProcess + INSTDEP += ca-bundle.crt +endif +ifdef WITH_ZLIB + INCLUDES += -I$(ZLIB_PATH) +ifdef LINK_STATIC + LDLIBS += $(ZLIB_PATH)/nw/$(LIBARCH)/libz.$(LIBEXT) +else + MODULES += libz.nlm + IMPORTS += @$(ZLIB_PATH)/nw/$(LIBARCH)/libz.imp +endif +endif +ifdef WITH_IDN + INCLUDES += -I$(LIBIDN_PATH)/include + LDLIBS += $(LIBIDN_PATH)/lib/libidn.$(LIBEXT) +endif + +ifeq ($(LIBARCH),LIBC) + INCLUDES += -I$(NDK_LIBC)/include + # INCLUDES += -I$(NDK_LIBC)/include/nks + # INCLUDES += -I$(NDK_LIBC)/include/winsock + CFLAGS += -D_POSIX_SOURCE +else + INCLUDES += -I$(NDK_CLIB)/include/nlm + # INCLUDES += -I$(NDK_CLIB)/include/nlm/obsolete + # INCLUDES += -I$(NDK_CLIB)/include +endif +ifndef DISABLE_LDAP + INCLUDES += -I$(NDK_LDAP)/$(LIBARCH_L)/inc +endif +CFLAGS += $(INCLUDES) + +ifeq ($(MTSAFE),YES) + XDCOPT = -n +endif +ifeq ($(MTSAFE),NO) + XDCOPT = -u +endif +ifdef XDCOPT + XDCDATA = $(OBJDIR)/$(TARGET).xdc +endif + +ifeq ($(findstring /sh,$(SHELL)),/sh) +DL = ' +DS = / +PCT = % +#-include $(NDKBASE)/nlmconv/ncpfs.inc +else +DS = \\ +PCT = %% +endif + +# Makefile.inc provides the CSOURCES and HHEADERS defines +include Makefile.inc + +OBJS := $(patsubst %.c,$(OBJDIR)/%.o,$(strip $(CSOURCES))) $(OBJDIR)/nwos.o + +OBJL = $(OBJS) $(OBJDIR)/nwlib.o $(LDLIBS) + +all: lib nlm + +nlm: prebuild $(TARGET).nlm + +lib: prebuild $(TARGET).$(LIBEXT) + +prebuild: $(OBJDIR) $(CURL_INC)/curl/curlbuild.h $(OBJDIR)/version.inc curl_config.h + +$(OBJDIR)/%.o: %.c +# @echo Compiling $< + $(CC) $(CFLAGS) -c $< -o $@ + +$(OBJDIR)/version.inc: ../include/curl/curlver.h $(OBJDIR) + @echo Creating $@ + @$(AWK) -f ../packages/NetWare/get_ver.awk $< > $@ + +install: $(INSTDIR) all $(INSTDEP) + @$(CP) $(TARGET).nlm $(INSTDIR) + @$(CP) $(TARGET).$(LIBEXT) $(INSTDIR) + @$(CP) ../CHANGES $(INSTDIR) + @$(CP) ../COPYING $(INSTDIR) + @$(CP) ../README $(INSTDIR) + @$(CP) ../RELEASE-NOTES $(INSTDIR) +ifdef WITH_SSL + @-$(CP) ca-bundle.crt $(INSTDIR)/ca-bundle.crt +endif + +clean: + -$(RM) curl_config.h + -$(RM) -r $(OBJDIR) + +distclean vclean: clean + -$(RM) $(TARGET).$(LIBEXT) $(TARGET).nlm + -$(RM) certdata.txt ca-bundle.crt + +$(OBJDIR) $(INSTDIR): + @$(MKDIR) $@ + +$(TARGET).$(LIBEXT): $(OBJS) + @echo Creating $@ + @-$(RM) $@ + @$(AR) $(ARFLAGS) $@ $^ +ifdef RANLIB + @$(RANLIB) $@ +endif + +$(TARGET).nlm: $(OBJDIR)/$(TARGET).def $(OBJL) $(XDCDATA) + @echo Linking $@ + @-$(RM) $@ + @$(LD) $(LDFLAGS) $< + +$(OBJDIR)/%.xdc: Makefile.netware + @echo Creating $@ + @$(MPKXDC) $(XDCOPT) $@ + +$(OBJDIR)/%.def: Makefile.netware + @echo $(DL)# DEF file for linking with $(LD)$(DL) > $@ + @echo $(DL)# Do not edit this file - it is created by make!$(DL) >> $@ + @echo $(DL)# All your changes will be lost!!$(DL) >> $@ + @echo $(DL)#$(DL) >> $@ + @echo $(DL)copyright "$(COPYR)"$(DL) >> $@ + @echo $(DL)description "$(DESCR)"$(DL) >> $@ + @echo $(DL)version $(VERSION)$(DL) >> $@ +ifdef NLMTYPE + @echo $(DL)type $(NLMTYPE)$(DL) >> $@ +endif +ifdef STACK + @echo $(DL)stack $(STACK)$(DL) >> $@ +endif +ifdef SCREEN + @echo $(DL)screenname "$(SCREEN)"$(DL) >> $@ +else + @echo $(DL)screenname "DEFAULT"$(DL) >> $@ +endif +ifneq ($(DB),NDEBUG) + @echo $(DL)debug$(DL) >> $@ +endif + @echo $(DL)threadname "$(TARGET)"$(DL) >> $@ +ifdef XDCDATA + @echo $(DL)xdcdata $(XDCDATA)$(DL) >> $@ +endif + @echo $(DL)flag_on 64$(DL) >> $@ +ifeq ($(LIBARCH),CLIB) + @echo $(DL)start _Prelude$(DL) >> $@ + @echo $(DL)exit _Stop$(DL) >> $@ + @echo $(DL)import @$(NDK_CLIB)/imports/clib.imp$(DL) >> $@ + @echo $(DL)import @$(NDK_CLIB)/imports/threads.imp$(DL) >> $@ + @echo $(DL)import @$(NDK_CLIB)/imports/nlmlib.imp$(DL) >> $@ + @echo $(DL)import @$(NDK_CLIB)/imports/socklib.imp$(DL) >> $@ + @echo $(DL)module clib$(DL) >> $@ +ifndef DISABLE_LDAP + @echo $(DL)import @$(NDK_LDAP)/clib/imports/ldapsdk.imp$(DL) >> $@ + @echo $(DL)import @$(NDK_LDAP)/clib/imports/ldapssl.imp$(DL) >> $@ +# @echo $(DL)import @$(NDK_LDAP)/clib/imports/ldapx.imp$(DL) >> $@ + @echo $(DL)module ldapsdk ldapssl$(DL) >> $@ +endif +else +ifeq ($(POSIXFL),1) + @echo $(DL)flag_on 4194304$(DL) >> $@ +endif + @echo $(DL)pseudopreemption$(DL) >> $@ +ifeq ($(findstring posixpre,$(PRELUDE)),posixpre) + @echo $(DL)start POSIX_Start$(DL) >> $@ + @echo $(DL)exit POSIX_Stop$(DL) >> $@ + @echo $(DL)check POSIX_CheckUnload$(DL) >> $@ +else + @echo $(DL)start _LibCPrelude$(DL) >> $@ + @echo $(DL)exit _LibCPostlude$(DL) >> $@ + @echo $(DL)check _LibCCheckUnload$(DL) >> $@ +endif + @echo $(DL)import @$(NDK_LIBC)/imports/libc.imp$(DL) >> $@ + @echo $(DL)import @$(NDK_LIBC)/imports/netware.imp$(DL) >> $@ + @echo $(DL)module libc$(DL) >> $@ +ifndef DISABLE_LDAP + @echo $(DL)import @$(NDK_LDAP)/libc/imports/lldapsdk.imp$(DL) >> $@ + @echo $(DL)import @$(NDK_LDAP)/libc/imports/lldapssl.imp$(DL) >> $@ +# @echo $(DL)import @$(NDK_LDAP)/libc/imports/lldapx.imp$(DL) >> $@ + @echo $(DL)module lldapsdk lldapssl$(DL) >> $@ +endif +endif +ifdef MODULES + @echo $(DL)module $(MODULES)$(DL) >> $@ +endif +ifdef EXPORTS + @echo $(DL)export $(EXPORTS)$(DL) >> $@ +endif +ifdef IMPORTS + @echo $(DL)import $(IMPORTS)$(DL) >> $@ +endif +ifeq ($(findstring nlmconv,$(LD)),nlmconv) + @echo $(DL)input $(PRELUDE)$(DL) >> $@ + @echo $(DL)input $(OBJL)$(DL) >> $@ +#ifdef LDLIBS +# @echo $(DL)input $(LDLIBS)$(DL) >> $@ +#endif + @echo $(DL)output $(TARGET).nlm$(DL) >> $@ +endif + +curl_config.h: Makefile.netware + @echo Creating $@ + @echo $(DL)/* $@ for NetWare target.$(DL) > $@ + @echo $(DL)** Do not edit this file - it is created by make!$(DL) >> $@ + @echo $(DL)** All your changes will be lost!!$(DL) >> $@ + @echo $(DL)*/$(DL) >> $@ + @echo $(DL)#ifndef NETWARE$(DL) >> $@ + @echo $(DL)#error This $(notdir $@) is created for NetWare platform!$(DL) >> $@ + @echo $(DL)#endif$(DL) >> $@ + @echo $(DL)#define VERSION "$(LIBCURL_VERSION_STR)"$(DL) >> $@ + @echo $(DL)#define PACKAGE_BUGREPORT "a suitable curl mailing list => http://curl.haxx.se/mail/"$(DL) >> $@ +ifeq ($(LIBARCH),CLIB) + @echo $(DL)#define OS "i586-pc-clib-NetWare"$(DL) >> $@ + @echo $(DL)#define NETDB_USE_INTERNET 1$(DL) >> $@ + @echo $(DL)#define HAVE_STRICMP 1$(DL) >> $@ + @echo $(DL)#define HAVE_STRNICMP 1$(DL) >> $@ + @echo $(DL)#define RECV_TYPE_ARG1 int$(DL) >> $@ + @echo $(DL)#define RECV_TYPE_ARG2 char *$(DL) >> $@ + @echo $(DL)#define RECV_TYPE_ARG3 int$(DL) >> $@ + @echo $(DL)#define RECV_TYPE_ARG4 int$(DL) >> $@ + @echo $(DL)#define RECV_TYPE_RETV int$(DL) >> $@ + @echo $(DL)#define RECVFROM_TYPE_ARG1 int$(DL) >> $@ + @echo $(DL)#define RECVFROM_TYPE_ARG2 char$(DL) >> $@ + @echo $(DL)#define RECVFROM_TYPE_ARG3 int$(DL) >> $@ + @echo $(DL)#define RECVFROM_TYPE_ARG4 int$(DL) >> $@ + @echo $(DL)#define RECVFROM_TYPE_ARG5 struct sockaddr$(DL) >> $@ + @echo $(DL)#define RECVFROM_TYPE_ARG6 int$(DL) >> $@ + @echo $(DL)#define RECVFROM_TYPE_RETV int$(DL) >> $@ + @echo $(DL)#define SEND_QUAL_ARG2$(DL) >> $@ + @echo $(DL)#define SEND_TYPE_ARG1 int$(DL) >> $@ + @echo $(DL)#define SEND_TYPE_ARG2 char *$(DL) >> $@ + @echo $(DL)#define SEND_TYPE_ARG3 int$(DL) >> $@ + @echo $(DL)#define SEND_TYPE_ARG4 int$(DL) >> $@ + @echo $(DL)#define SEND_TYPE_RETV int$(DL) >> $@ + @echo $(DL)#define SIZEOF_SIZE_T 4$(DL) >> $@ + @echo $(DL)#define pressanykey PressAnyKeyToContinue$(DL) >> $@ +else + @echo $(DL)#define OS "i586-pc-libc-NetWare"$(DL) >> $@ + @echo $(DL)#define HAVE_FTRUNCATE 1$(DL) >> $@ + @echo $(DL)#define HAVE_GETTIMEOFDAY 1$(DL) >> $@ + @echo $(DL)#define HAVE_INTTYPES_H 1$(DL) >> $@ + @echo $(DL)#define HAVE_LONGLONG 1$(DL) >> $@ + @echo $(DL)#define HAVE_STDINT_H 1$(DL) >> $@ + @echo $(DL)#define HAVE_STRCASECMP 1$(DL) >> $@ + @echo $(DL)#define HAVE_STRLCAT 1$(DL) >> $@ + @echo $(DL)#define HAVE_STRLCPY 1$(DL) >> $@ + @echo $(DL)#define HAVE_STRTOLL 1$(DL) >> $@ + @echo $(DL)#define HAVE_SYS_PARAM_H 1$(DL) >> $@ + @echo $(DL)#define HAVE_SYS_SELECT_H 1$(DL) >> $@ + @echo $(DL)#define HAVE_TERMIOS_H 1$(DL) >> $@ + @echo $(DL)#define RECV_TYPE_ARG1 int$(DL) >> $@ + @echo $(DL)#define RECV_TYPE_ARG2 void *$(DL) >> $@ + @echo $(DL)#define RECV_TYPE_ARG3 size_t$(DL) >> $@ + @echo $(DL)#define RECV_TYPE_ARG4 int$(DL) >> $@ + @echo $(DL)#define RECV_TYPE_RETV ssize_t$(DL) >> $@ + @echo $(DL)#define RECVFROM_TYPE_ARG1 int$(DL) >> $@ + @echo $(DL)#define RECVFROM_TYPE_ARG2 void$(DL) >> $@ + @echo $(DL)#define RECVFROM_TYPE_ARG3 size_t$(DL) >> $@ + @echo $(DL)#define RECVFROM_TYPE_ARG4 int$(DL) >> $@ + @echo $(DL)#define RECVFROM_TYPE_ARG5 struct sockaddr$(DL) >> $@ + @echo $(DL)#define RECVFROM_TYPE_ARG6 size_t$(DL) >> $@ + @echo $(DL)#define RECVFROM_TYPE_RETV ssize_t$(DL) >> $@ + @echo $(DL)#define RECVFROM_TYPE_ARG2_IS_VOID 1$(DL) >> $@ + @echo $(DL)#define SEND_QUAL_ARG2$(DL) >> $@ + @echo $(DL)#define SEND_TYPE_ARG1 int$(DL) >> $@ + @echo $(DL)#define SEND_TYPE_ARG2 void *$(DL) >> $@ + @echo $(DL)#define SEND_TYPE_ARG3 size_t$(DL) >> $@ + @echo $(DL)#define SEND_TYPE_ARG4 int$(DL) >> $@ + @echo $(DL)#define SEND_TYPE_RETV ssize_t$(DL) >> $@ + @echo $(DL)#define SIZEOF_OFF_T 8$(DL) >> $@ + @echo $(DL)#define SIZEOF_SIZE_T 8$(DL) >> $@ + @echo $(DL)#define _LARGEFILE 1$(DL) >> $@ +ifdef ENABLE_IPV6 + @echo $(DL)#define ENABLE_IPV6 1$(DL) >> $@ + @echo $(DL)#define HAVE_AF_INET6 1$(DL) >> $@ + @echo $(DL)#define HAVE_PF_INET6 1$(DL) >> $@ + @echo $(DL)#define HAVE_FREEADDRINFO 1$(DL) >> $@ + @echo $(DL)#define HAVE_GETADDRINFO 1$(DL) >> $@ + @echo $(DL)#define HAVE_SOCKADDR_IN6_SIN6_SCOPE_ID 1$(DL) >> $@ + @echo $(DL)#define HAVE_STRUCT_ADDRINFO 1$(DL) >> $@ + @echo $(DL)#define HAVE_STRUCT_IN6_ADDR 1$(DL) >> $@ + @echo $(DL)#define HAVE_STRUCT_SOCKADDR_IN6 1$(DL) >> $@ + @echo $(DL)#define SIZEOF_STRUCT_IN6_ADDR 16$(DL) >> $@ +endif +endif + @echo $(DL)#define USE_MANUAL 1$(DL) >> $@ + @echo $(DL)#define HAVE_ARPA_INET_H 1$(DL) >> $@ + @echo $(DL)#define HAVE_ASSERT_H 1$(DL) >> $@ + @echo $(DL)#define HAVE_ERR_H 1$(DL) >> $@ + @echo $(DL)#define HAVE_FCNTL_H 1$(DL) >> $@ + @echo $(DL)#define HAVE_GETHOSTBYADDR 1$(DL) >> $@ + @echo $(DL)#define HAVE_GETHOSTBYNAME 1$(DL) >> $@ + @echo $(DL)#define HAVE_GETPROTOBYNAME 1$(DL) >> $@ + @echo $(DL)#define HAVE_GMTIME_R 1$(DL) >> $@ + @echo $(DL)#define HAVE_INET_ADDR 1$(DL) >> $@ + @echo $(DL)#define HAVE_IOCTL 1$(DL) >> $@ + @echo $(DL)#define HAVE_IOCTL_FIONBIO 1$(DL) >> $@ + @echo $(DL)#define HAVE_LIMITS_H 1$(DL) >> $@ + @echo $(DL)#define HAVE_LL 1$(DL) >> $@ + @echo $(DL)#define HAVE_LOCALE_H 1$(DL) >> $@ + @echo $(DL)#define HAVE_LOCALTIME_R 1$(DL) >> $@ + @echo $(DL)#define HAVE_MALLOC_H 1$(DL) >> $@ + @echo $(DL)#define HAVE_NETINET_IN_H 1$(DL) >> $@ + @echo $(DL)#define HAVE_RECV 1$(DL) >> $@ + @echo $(DL)#define HAVE_RECVFROM 1$(DL) >> $@ + @echo $(DL)#define HAVE_SELECT 1$(DL) >> $@ + @echo $(DL)#define HAVE_SEND 1$(DL) >> $@ + @echo $(DL)#define HAVE_SETJMP_H 1$(DL) >> $@ + @echo $(DL)#define HAVE_SETLOCALE 1$(DL) >> $@ + @echo $(DL)#define HAVE_SIGNAL 1$(DL) >> $@ + @echo $(DL)#define HAVE_SIGNAL_H 1$(DL) >> $@ + @echo $(DL)#define HAVE_SIG_ATOMIC_T 1$(DL) >> $@ + @echo $(DL)#define HAVE_SOCKET 1$(DL) >> $@ + @echo $(DL)#define HAVE_STDLIB_H 1$(DL) >> $@ + @echo $(DL)#define HAVE_STRDUP 1$(DL) >> $@ + @echo $(DL)#define HAVE_STRFTIME 1$(DL) >> $@ + @echo $(DL)#define HAVE_STRING_H 1$(DL) >> $@ + @echo $(DL)#define HAVE_STRSTR 1$(DL) >> $@ + @echo $(DL)#define HAVE_STRUCT_TIMEVAL 1$(DL) >> $@ + @echo $(DL)#define HAVE_SYS_IOCTL_H 1$(DL) >> $@ + @echo $(DL)#define HAVE_SYS_STAT_H 1$(DL) >> $@ + @echo $(DL)#define HAVE_SYS_TIME_H 1$(DL) >> $@ + @echo $(DL)#define HAVE_TIME_H 1$(DL) >> $@ + @echo $(DL)#define HAVE_UNAME 1$(DL) >> $@ + @echo $(DL)#define HAVE_UNISTD_H 1$(DL) >> $@ + @echo $(DL)#define HAVE_UTIME 1$(DL) >> $@ + @echo $(DL)#define HAVE_UTIME_H 1$(DL) >> $@ + @echo $(DL)#define HAVE_WRITEV 1$(DL) >> $@ + @echo $(DL)#define RETSIGTYPE void$(DL) >> $@ + @echo $(DL)#define SIZEOF_INT 4$(DL) >> $@ + @echo $(DL)#define SIZEOF_SHORT 2$(DL) >> $@ + @echo $(DL)#define SIZEOF_STRUCT_IN_ADDR 4$(DL) >> $@ + @echo $(DL)#define STDC_HEADERS 1$(DL) >> $@ + @echo $(DL)#define TIME_WITH_SYS_TIME 1$(DL) >> $@ +ifdef DISABLE_LDAP + @echo $(DL)#define CURL_DISABLE_LDAP 1$(DL) >> $@ +else + @echo $(DL)#define CURL_HAS_NOVELL_LDAPSDK 1$(DL) >> $@ +ifndef DISABLE_LDAPS + @echo $(DL)#define HAVE_LDAP_SSL 1$(DL) >> $@ +endif + @echo $(DL)#define HAVE_LDAP_SSL_H 1$(DL) >> $@ + @echo $(DL)#define HAVE_LDAP_URL_PARSE 1$(DL) >> $@ +endif +ifdef NW_WINSOCK + @echo $(DL)#define HAVE_CLOSESOCKET 1$(DL) >> $@ +else + @echo $(DL)#define USE_BSD_SOCKETS 1$(DL) >> $@ + @echo $(DL)#define HAVE_SYS_TYPES_H 1$(DL) >> $@ + @echo $(DL)#define HAVE_SYS_SOCKET_H 1$(DL) >> $@ + @echo $(DL)#define HAVE_SYS_SOCKIO_H 1$(DL) >> $@ + @echo $(DL)#define HAVE_NETDB_H 1$(DL) >> $@ +endif +ifdef WITH_ARES + @echo $(DL)#define USE_ARES 1$(DL) >> $@ +endif +ifdef WITH_ZLIB + @echo $(DL)#define HAVE_ZLIB_H 1$(DL) >> $@ + @echo $(DL)#define HAVE_LIBZ 1$(DL) >> $@ +endif +ifdef WITH_SSL + @echo $(DL)#define USE_SSLEAY 1$(DL) >> $@ + @echo $(DL)#define USE_OPENSSL 1$(DL) >> $@ + @echo $(DL)#define HAVE_OPENSSL_X509_H 1$(DL) >> $@ + @echo $(DL)#define HAVE_OPENSSL_SSL_H 1$(DL) >> $@ + @echo $(DL)#define HAVE_OPENSSL_RSA_H 1$(DL) >> $@ + @echo $(DL)#define HAVE_OPENSSL_PEM_H 1$(DL) >> $@ + @echo $(DL)#define HAVE_OPENSSL_ERR_H 1$(DL) >> $@ + @echo $(DL)#define HAVE_OPENSSL_CRYPTO_H 1$(DL) >> $@ + @echo $(DL)#define HAVE_OPENSSL_ENGINE_H 1$(DL) >> $@ + @echo $(DL)#define HAVE_LIBSSL 1$(DL) >> $@ + @echo $(DL)#define HAVE_LIBCRYPTO 1$(DL) >> $@ + @echo $(DL)#define OPENSSL_NO_KRB5 1$(DL) >> $@ +endif +ifdef WITH_SSH2 + @echo $(DL)#define USE_LIBSSH2 1$(DL) >> $@ + @echo $(DL)#define HAVE_LIBSSH2_H 1$(DL) >> $@ +endif +ifdef WITH_IDN + @echo $(DL)#define HAVE_LIBIDN 1$(DL) >> $@ + @echo $(DL)#define HAVE_TLD_H 1$(DL) >> $@ +endif +ifdef WITH_RTMP + @echo $(DL)#define USE_LIBRTMP 1$(DL) >> $@ +endif + @echo $(DL)#ifdef __GNUC__$(DL) >> $@ + @echo $(DL)#define HAVE_VARIADIC_MACROS_GCC 1$(DL) >> $@ + @echo $(DL)#else$(DL) >> $@ + @echo $(DL)#define HAVE_VARIADIC_MACROS_C99 1$(DL) >> $@ + @echo $(DL)#endif$(DL) >> $@ +ifdef CABUNDLE + @echo $(DL)#define CURL_CA_BUNDLE "$(CABUNDLE)"$(DL) >> $@ +else + @echo $(DL)#define CURL_CA_BUNDLE getenv("CURL_CA_BUNDLE")$(DL) >> $@ +endif + +FORCE: ; + +info: $(OBJDIR)/version.inc + @echo Configured to build $(TARGET) with these options: + @echo libarchitecture: $(LIBARCH) + @echo curl version: $(LIBCURL_VERSION_STR) + @echo compiler/linker: $(CC) / $(LD) +ifdef CABUNDLE + @echo ca-bundle path: $(CABUNDLE) +endif +ifdef WITH_SSL + @echo SSL support: enabled (OpenSSL) +else + @echo SSL support: no +endif +ifdef WITH_SSH2 + @echo SSH2 support: enabled (libssh2) +else + @echo SSH2 support: no +endif +ifdef WITH_ZLIB + @echo zlib support: enabled +else + @echo zlib support: no +endif +ifdef WITH_ARES + @echo c-ares support: enabled +else + @echo c-ares support: no +endif +ifdef ENABLE_IPV6 + @echo ipv6 support: enabled +else + @echo ipv6 support: no +endif + +$(LIBCARES_PATH)/libcares.$(LIBEXT): + $(MAKE) -C $(LIBCARES_PATH) -f Makefile.netware lib + +ca-bundle.crt: mk-ca-bundle.pl + @echo Creating $@ + @-$(PERL) $< -b -n $@ + +$(CURL_INC)/curl/curlbuild.h: Makefile.netware FORCE + @echo Creating $@ + @echo $(DL)/* $@ intended for NetWare target.$(DL) > $@ + @echo $(DL)** Do not edit this file - it is created by make!$(DL) >> $@ + @echo $(DL)** All your changes will be lost!!$(DL) >> $@ + @echo $(DL)*/$(DL) >> $@ + @echo $(DL)#ifndef NETWARE$(DL) >> $@ + @echo $(DL)#error This $(notdir $@) is created for NetWare platform!$(DL) >> $@ + @echo $(DL)#endif$(DL) >> $@ + @echo $(DL)#ifndef __CURL_CURLBUILD_H$(DL) >> $@ + @echo $(DL)#define __CURL_CURLBUILD_H$(DL) >> $@ +ifeq ($(LIBARCH),LIBC) + @echo $(DL)#define CURL_SIZEOF_LONG 4$(DL) >> $@ + @echo $(DL)#define CURL_TYPEOF_CURL_SOCKLEN_T unsigned int$(DL) >> $@ + @echo $(DL)#define CURL_SIZEOF_CURL_SOCKLEN_T 4$(DL) >> $@ + @echo $(DL)#define CURL_TYPEOF_CURL_OFF_T long long$(DL) >> $@ + @echo $(DL)#define CURL_FORMAT_CURL_OFF_T "lld"$(DL) >> $@ + @echo $(DL)#define CURL_FORMAT_CURL_OFF_TU "llu"$(DL) >> $@ + @echo $(DL)#define CURL_FORMAT_OFF_T "$(PCT)lld"$(DL) >> $@ + @echo $(DL)#define CURL_SIZEOF_CURL_OFF_T 8$(DL) >> $@ + @echo $(DL)#define CURL_SUFFIX_CURL_OFF_T LL$(DL) >> $@ + @echo $(DL)#define CURL_SUFFIX_CURL_OFF_TU ULL$(DL) >> $@ +else + @echo $(DL)#define CURL_SIZEOF_LONG 4$(DL) >> $@ + @echo $(DL)#define CURL_TYPEOF_CURL_SOCKLEN_T int$(DL) >> $@ + @echo $(DL)#define CURL_SIZEOF_CURL_SOCKLEN_T 4$(DL) >> $@ + @echo $(DL)#define CURL_TYPEOF_CURL_OFF_T long$(DL) >> $@ + @echo $(DL)#define CURL_FORMAT_CURL_OFF_T "ld"$(DL) >> $@ + @echo $(DL)#define CURL_FORMAT_CURL_OFF_TU "lu"$(DL) >> $@ + @echo $(DL)#define CURL_FORMAT_OFF_T "$(PCT)ld"$(DL) >> $@ + @echo $(DL)#define CURL_SIZEOF_CURL_OFF_T 4$(DL) >> $@ + @echo $(DL)#define CURL_SUFFIX_CURL_OFF_T L$(DL) >> $@ + @echo $(DL)#define CURL_SUFFIX_CURL_OFF_TU UL$(DL) >> $@ +endif + @echo $(DL)typedef CURL_TYPEOF_CURL_SOCKLEN_T curl_socklen_t;$(DL) >> $@ + @echo $(DL)typedef CURL_TYPEOF_CURL_OFF_T curl_off_t;$(DL) >> $@ + @echo $(DL)#endif /* __CURL_CURLBUILD_H */$(DL) >> $@ + diff --git a/mobicore/common/curl/lib/Makefile.vc10 b/mobicore/common/curl/lib/Makefile.vc10 new file mode 100644 index 0000000000000000000000000000000000000000..960052796962dfd9b401d5218e8372feeb182cb8 --- /dev/null +++ b/mobicore/common/curl/lib/Makefile.vc10 @@ -0,0 +1,571 @@ +#*************************************************************************** +# _ _ ____ _ +# Project ___| | | | _ \| | +# / __| | | | |_) | | +# | (__| |_| | _ <| |___ +# \___|\___/|_| \_\_____| +# +# Copyright (C) 1999 - 2010, Daniel Stenberg, , et al. +# +# This software is licensed as described in the file COPYING, which +# you should have received as part of this distribution. The terms +# are also available at http://curl.haxx.se/docs/copyright.html. +# +# You may opt to use, copy, modify, merge, publish, distribute and/or sell +# copies of the Software, and permit persons to whom the Software is +# furnished to do so, under the terms of the COPYING file. +# +# This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY +# KIND, either express or implied. +# +########################################################################### +# +# Makefile for building libcurl with MSVC10 +# +# Usage: see usage message below +# Should be invoked from \lib directory +# Edit the paths and desired library name +# SSL path is only required if you intend compiling +# with SSL. +# +# This make file leaves the result either a .lib or .dll file +# in the \lib directory. It should be called from the \lib +# directory. +# +# An option would have been to allow the source directory to +# be specified, but I saw no requirement. +# +# Another option would have been to leave the .lib and .dll +# files in the "cfg" directory, but then the make file +# in \src would need to be changed. +# +############################################################## + +# +# Stem for static libs and DLLs +# +LIB_NAME = libcurl +LIB_NAME_DEBUG = libcurld + +# +# Stem for DLL import libs +# +IMPLIB_NAME = libcurl_imp +IMPLIB_NAME_DEBUG = libcurld_imp + +!IFNDEF OPENSSL_PATH +OPENSSL_PATH = ../../openssl-0.9.8o +!ENDIF + +!IFNDEF ZLIB_PATH +ZLIB_PATH = ../../zlib-1.2.5 +!ENDIF + +!IFNDEF MACHINE +MACHINE = X86 +!ENDIF + +# USE_WINDOWS_SSPI uses windows libraries to allow NTLM authentication +# without an openssl installation and offers the ability to authenticate +# using the "current logged in user". Since at least with MSVC10 the sspi.h +# header is broken it is either required to install the Windows SDK, +# or to fix sspi.h with adding this define at the beginning of sspi.h: +# #define FreeCredentialHandle FreeCredentialsHandle +# +# If, for some reason the Windows SDK is installed but not installed +# in the default location, you can specify WINDOWS_SDK_PATH. +# It can be downloaded from: +# http://www.microsoft.com/msdownload/platformsdk/sdkupdate/ + +# WINDOWS_SSPI = 1 + +!IFDEF WINDOWS_SSPI +!IFNDEF WINDOWS_SDK_PATH +WINDOWS_SDK_PATH = "C:\Program Files\Microsoft SDK" +!ENDIF +!ENDIF + +############################################################# +## Nothing more to do below this line! + +CCNODBG = cl.exe /O2 /DNDEBUG +CCDEBUG = cl.exe /Od /Gm /Zi /D_DEBUG /RTC1 +CFLAGSSSL = /DUSE_SSLEAY /I "$(OPENSSL_PATH)/inc32" /I "$(OPENSSL_PATH)/inc32/openssl" +CFLAGSZLIB = /DHAVE_ZLIB_H /DHAVE_ZLIB /DHAVE_LIBZ /I "$(ZLIB_PATH)" +CFLAGS = /I. /I../include /nologo /W3 /EHsc /DWIN32 /FD /c /DBUILDING_LIBCURL +CFLAGSLIB = /DCURL_STATICLIB +LNKDLL = link.exe /DLL +LNKLIB = link.exe /lib +LFLAGS = /nologo /machine:$(MACHINE) +SSLLIBS = libeay32.lib ssleay32.lib +ZLIBLIBSDLL= zdll.lib +ZLIBLIBS = zlib.lib +WINLIBS = ws2_32.lib wldap32.lib +CFLAGS = $(CFLAGS) + +CFGSET = FALSE + +!IFDEF WINDOWS_SSPI +CFLAGS = $(CFLAGS) /DUSE_WINDOWS_SSPI /I$(WINDOWS_SDK_PATH)\include +!ENDIF + +!IFDEF USE_IPV6 +CFLAGS = $(CFLAGS) /DUSE_IPV6 +!ENDIF + +############################################################## +# Runtime library configuration + +RTLIB = /MD +RTLIBD = /MDd + +!IF "$(RTLIBCFG)" == "static" +RTLIB = /MT +RTLIBD = /MTd +!ENDIF + + +###################### +# release + +!IF "$(CFG)" == "release" +TARGET = $(LIB_NAME).lib +DIROBJ = $(CFG) +LNK = $(LNKLIB) /out:$(DIROBJ)\$(TARGET) +CC = $(CCNODBG) $(RTLIB) $(CFLAGSLIB) +CFGSET = TRUE +!ENDIF + +###################### +# release-zlib + +!IF "$(CFG)" == "release-zlib" +TARGET = $(LIB_NAME).lib +DIROBJ = $(CFG) +LFLAGSZLIB = "/LIBPATH:$(ZLIB_PATH)" +LNK = $(LNKLIB) $(ZLIBLIBS) $(LFLAGSZLIB) /out:$(DIROBJ)\$(TARGET) +CC = $(CCNODBG) $(RTLIB) $(CFLAGSZLIB) $(CFLAGSLIB) +CFGSET = TRUE +!ENDIF + +###################### +# release-dll + +!IF "$(CFG)" == "release-dll" +TARGET = $(LIB_NAME).dll +DIROBJ = $(CFG) +LNK = $(LNKDLL) $(WINLIBS) /out:$(DIROBJ)\$(TARGET) /IMPLIB:$(DIROBJ)\$(IMPLIB_NAME).lib +CC = $(CCNODBG) $(RTLIB) +CFGSET = TRUE +RESOURCE = $(DIROBJ)\libcurl.res +!ENDIF + +###################### +# release-ssl + +!IF "$(CFG)" == "release-ssl" +TARGET = $(LIB_NAME).lib +DIROBJ = $(CFG) +LFLAGSSSL = "/LIBPATH:$(OPENSSL_PATH)\out32" +LNK = $(LNKLIB) $(LFLAGSSSL) /out:$(DIROBJ)\$(TARGET) +CC = $(CCNODBG) $(RTLIB) $(CFLAGSSSL) $(CFLAGSLIB) +CFGSET = TRUE +!ENDIF + +###################### +# release-ssl-dll + +!IF "$(CFG)" == "release-ssl-dll" +TARGET = $(LIB_NAME).lib +DIROBJ = $(CFG) +LFLAGSSSL = "/LIBPATH:$(OPENSSL_PATH)\out32dll" +LNK = $(LNKLIB) $(WINLIBS) $(SSLLIBS) $(LFLAGSSSL) /out:$(DIROBJ)\$(TARGET) +CC = $(CCNODBG) $(RTLIB) $(CFLAGSSSL) $(CFLAGSLIB) +CFGSET = TRUE +!ENDIF + +###################### +# release-ssl-zlib + +!IF "$(CFG)" == "release-ssl-zlib" +TARGET = $(LIB_NAME).lib +DIROBJ = $(CFG) +LFLAGSSSL = "/LIBPATH:$(OPENSSL_PATH)\out32" +LFLAGSZLIB = "/LIBPATH:$(ZLIB_PATH)" +LNK = $(LNKLIB) $(LFLAGSSSL) $(LFLAGSZLIB) /out:$(DIROBJ)\$(TARGET) +CC = $(CCNODBG) $(RTLIB) $(CFLAGSSSL) $(CFLAGSZLIB) $(CFLAGSLIB) +CFGSET = TRUE +!ENDIF + +###################### +# release-dll-ssl-dll + +!IF "$(CFG)" == "release-dll-ssl-dll" +TARGET = $(LIB_NAME).dll +DIROBJ = $(CFG) +LFLAGSSSL = "/LIBPATH:$(OPENSSL_PATH)\out32dll" +LNK = $(LNKDLL) $(WINLIBS) $(SSLLIBS) $(LFLAGSSSL) /out:$(DIROBJ)\$(TARGET) /IMPLIB:$(DIROBJ)\$(IMPLIB_NAME).lib +CC = $(CCNODBG) $(RTLIB) $(CFLAGSSSL) +CFGSET = TRUE +RESOURCE = $(DIROBJ)\libcurl.res +!ENDIF + +###################### +# release-zlib-dll + +!IF "$(CFG)" == "release-zlib-dll" +TARGET = $(LIB_NAME).lib +DIROBJ = $(CFG) +LFLAGSZLIB = "/LIBPATH:$(ZLIB_PATH)" +LNK = $(LNKLIB) $(WINLIBS) $(ZLIBLIBSDLL) $(LFLAGSZLIB) /out:$(DIROBJ)\$(TARGET) +CC = $(CCNODBG) $(RTLIB) $(CFLAGSZLIB) $(CFLAGSLIB) +CFGSET = TRUE +!ENDIF + +###################### +# release-ssl-dll-zlib-dll + +!IF "$(CFG)" == "release-ssl-dll-zlib-dll" +TARGET = $(LIB_NAME).lib +DIROBJ = $(CFG) +LFLAGSZLIB = "/LIBPATH:$(ZLIB_PATH)" +LFLAGSSSL = "/LIBPATH:$(OPENSSL_PATH)\out32dll" +LNK = $(LNKLIB) $(WINLIBS) $(SSLLIBS) $(ZLIBLIBSDLL) $(LFLAGSSSL) $(LFLAGSZLIB) /out:$(DIROBJ)\$(TARGET) +CC = $(CCNODBG) $(RTLIB) $(CFLAGSSSL) $(CFLAGSZLIB) $(CFLAGSLIB) +CFGSET = TRUE +!ENDIF + +###################### +# release-dll-zlib-dll + +!IF "$(CFG)" == "release-dll-zlib-dll" +TARGET = $(LIB_NAME).dll +DIROBJ = $(CFG) +LFLAGSZLIB = "/LIBPATH:$(ZLIB_PATH)" +LNK = $(LNKDLL) $(WINLIBS) $(ZLIBLIBSDLL) $(LFLAGSZLIB) /out:$(DIROBJ)\$(TARGET) /IMPLIB:$(DIROBJ)\$(IMPLIB_NAME).lib +CC = $(CCNODBG) $(RTLIB) $(CFLAGSZLIB) +CFGSET = TRUE +RESOURCE = $(DIROBJ)\libcurl.res +!ENDIF + +###################### +# release-dll-ssl-dll-zlib-dll + +!IF "$(CFG)" == "release-dll-ssl-dll-zlib-dll" +TARGET = $(LIB_NAME).dll +DIROBJ = $(CFG) +LFLAGSZLIB = "/LIBPATH:$(ZLIB_PATH)" +LFLAGSSSL = "/LIBPATH:$(OPENSSL_PATH)\out32dll" +LNK = $(LNKDLL) $(WINLIBS) $(SSLLIBS) $(ZLIBLIBSDLL) $(LFLAGSSSL) $(LFLAGSZLIB) /out:$(DIROBJ)\$(TARGET) /IMPLIB:$(DIROBJ)\$(IMPLIB_NAME).lib +CC = $(CCNODBG) $(RTLIB) $(CFLAGSSSL) $(CFLAGSZLIB) +CFGSET = TRUE +RESOURCE = $(DIROBJ)\libcurl.res +!ENDIF + +###################### +# debug + +!IF "$(CFG)" == "debug" +TARGET = $(LIB_NAME_DEBUG).lib +DIROBJ = $(CFG) +LNK = $(LNKLIB) /out:$(DIROBJ)\$(TARGET) +CC = $(CCDEBUG) $(RTLIBD) $(CFLAGSLIB) +CFGSET = TRUE +!ENDIF + +###################### +# debug-ssl + +!IF "$(CFG)" == "debug-ssl" +TARGET = $(LIB_NAME_DEBUG).lib +DIROBJ = $(CFG) +LFLAGSSSL = "/LIBPATH:$(OPENSSL_PATH)\out32" +LNK = $(LNKLIB) $(LFLAGSSSL) /out:$(DIROBJ)\$(TARGET) +CC = $(CCDEBUG) $(RTLIBD) $(CFLAGSSSL) $(CFLAGSLIB) +CFGSET = TRUE +!ENDIF + +###################### +# debug-zlib + +!IF "$(CFG)" == "debug-zlib" +TARGET = $(LIB_NAME_DEBUG).lib +DIROBJ = $(CFG) +LFLAGSZLIB = "/LIBPATH:$(ZLIB_PATH)" +LNK = $(LNKLIB) $(ZLIBLIBS) $(LFLAGSZLIB) /out:$(DIROBJ)\$(TARGET) +CC = $(CCDEBUG) $(RTLIBD) $(CFLAGSZLIB) $(CFLAGSLIB) +CFGSET = TRUE +!ENDIF + +###################### +# debug-ssl-dll + +!IF "$(CFG)" == "debug-ssl-dll" +TARGET = $(LIB_NAME_DEBUG).lib +DIROBJ = $(CFG) +LFLAGSSSL = /LIBPATH:$(OPENSSL_PATH)\out32dll +LNK = $(LNKLIB) $(WINLIBS) $(SSLLIBS) $(LFLAGSSSL) /out:$(DIROBJ)\$(TARGET) +CC = $(CCDEBUG) $(RTLIBD) $(CFLAGSSSL) $(CFLAGSLIB) +CFGSET = TRUE +!ENDIF + +###################### +# debug-ssl-zlib + +!IF "$(CFG)" == "debug-ssl-zlib" +TARGET = $(LIB_NAME_DEBUG).lib +DIROBJ = $(CFG) +LFLAGSZLIB = "/LIBPATH:$(ZLIB_PATH)" +LFLAGSSSL = "/LIBPATH:$(OPENSSL_PATH)\out32" +LNK = $(LNKLIB) $(ZLIBLIBS) $(LFLAGSSSL) $(LFLAGSZLIB) /out:$(DIROBJ)\$(TARGET) +CC = $(CCDEBUG) $(RTLIBD) $(CFLAGSSSL) $(CFLAGSZLIB) $(CFLAGSLIB) +CFGSET = TRUE +!ENDIF + +###################### +# debug-zlib-dll + +!IF "$(CFG)" == "debug-zlib-dll" +TARGET = $(LIB_NAME_DEBUG).lib +DIROBJ = $(CFG) +LFLAGSZLIB = "/LIBPATH:$(ZLIB_PATH)" +LNK = $(LNKLIB) $(WINLIBS) $(ZLIBLIBSDLL) $(LFLAGSZLIB) /out:$(DIROBJ)\$(TARGET) +CC = $(CCDEBUG) $(RTLIBD) $(CFLAGSZLIB) $(CFLAGSLIB) +CFGSET = TRUE +!ENDIF + +###################### +# debug-ssl-dll-zlib-dll + +!IF "$(CFG)" == "debug-ssl-dll-zlib-dll" +TARGET = $(LIB_NAME_DEBUG).lib +DIROBJ = $(CFG) +LFLAGSZLIB = "/LIBPATH:$(ZLIB_PATH)" +LFLAGSSSL = "/LIBPATH:$(OPENSSL_PATH)\out32dll" +LNK = $(LNKLIB) $(WINLIBS) $(SSLLIBS) $(ZLIBLIBSDLL) $(LFLAGSSSL) $(LFLAGSZLIB) /out:$(DIROBJ)\$(TARGET) +CC = $(CCDEBUG) $(RTLIBD) $(CFLAGSSSL) $(CFLAGSZLIB) $(CFLAGSLIB) +CFGSET = TRUE +!ENDIF + +###################### +# debug-dll + +!IF "$(CFG)" == "debug-dll" +TARGET = $(LIB_NAME_DEBUG).dll +DIROBJ = $(CFG) +LNK = $(LNKDLL) $(WINLIBS) /DEBUG /out:$(DIROBJ)\$(TARGET) /IMPLIB:$(DIROBJ)\$(IMPLIB_NAME_DEBUG).lib /PDB:$(DIROBJ)\$(IMPLIB_NAME_DEBUG).pdb +CC = $(CCDEBUG) $(RTLIBD) +CFGSET = TRUE +RESOURCE = $(DIROBJ)\libcurl.res +!ENDIF + +###################### +# debug-dll-ssl-dll + +!IF "$(CFG)" == "debug-dll-ssl-dll" +TARGET = $(LIB_NAME_DEBUG).dll +DIROBJ = $(CFG) +LFLAGSSSL = "/LIBPATH:$(OPENSSL_PATH)\out32dll" +LNK = $(LNKDLL) $(WINLIBS) $(SSLLIBS) $(LFLAGSSSL) /DEBUG /out:$(DIROBJ)\$(TARGET) /IMPLIB:$(DIROBJ)\$(IMPLIB_NAME_DEBUG).lib /PDB:$(DIROBJ)\$(IMPLIB_NAME_DEBUG).pdb +CC = $(CCDEBUG) $(RTLIBD) $(CFLAGSSSL) +CFGSET = TRUE +RESOURCE = $(DIROBJ)\libcurl.res +!ENDIF + +###################### +# debug-dll-zlib-dll + +!IF "$(CFG)" == "debug-dll-zlib-dll" +TARGET = $(LIB_NAME_DEBUG).dll +DIROBJ = $(CFG) +LFLAGSZLIB = "/LIBPATH:$(ZLIB_PATH)" +LNK = $(LNKDLL) $(WINLIBS) $(ZLIBLIBSDLL) $(LFLAGSZLIB) /DEBUG /out:$(DIROBJ)\$(TARGET) /IMPLIB:$(DIROBJ)\$(IMPLIB_NAME_DEBUG).lib /PDB:$(DIROBJ)\$(IMPLIB_NAME_DEBUG).pdb +CC = $(CCDEBUG) $(RTLIBD) $(CFLAGSZLIB) +CFGSET = TRUE +RESOURCE = $(DIROBJ)\libcurl.res +!ENDIF + +###################### +# debug-dll-ssl-dll-zlib-dll + +!IF "$(CFG)" == "debug-dll-ssl-dll-zlib-dll" +TARGET = $(LIB_NAME_DEBUG).dll +DIROBJ = $(CFG) +LFLAGSZLIB = "/LIBPATH:$(ZLIB_PATH)" +LFLAGSSSL = "/LIBPATH:$(OPENSSL_PATH)\out32dll" +LNK = $(LNKDLL) $(WINLIBS) $(SSLLIBS) $(ZLIBLIBSDLL) $(LFLAGSSSL) $(LFLAGSZLIB) /DEBUG /out:$(DIROBJ)\$(TARGET) /IMPLIB:$(DIROBJ)\$(IMPLIB_NAME_DEBUG).lib /PDB:$(DIROBJ)\$(IMPLIB_NAME_DEBUG).pdb +CC = $(CCDEBUG) $(RTLIBD) $(CFLAGSSSL) $(CFLAGSZLIB) +CFGSET = TRUE +RESOURCE = $(DIROBJ)\libcurl.res +!ENDIF + +####################### +# Usage +# +!IF "$(CFGSET)" == "FALSE" && "$(CFG)" != "" +!MESSAGE Usage: nmake /f makefile.vc10 CFG= +!MESSAGE where is one of: +!MESSAGE release - release static library +!MESSAGE release-ssl - release static library with ssl +!MESSAGE release-zlib - release static library with zlib +!MESSAGE release-ssl-zlib - release static library with ssl and zlib +!MESSAGE release-ssl-dll - release static library with dynamic ssl +!MESSAGE release-zlib-dll - release static library with dynamic zlib +!MESSAGE release-ssl-dll-zlib-dll - release static library with dynamic ssl and dynamic zlib +!MESSAGE release-dll - release dynamic library +!MESSAGE release-dll-ssl-dll - release dynamic library with dynamic ssl +!MESSAGE release-dll-zlib-dll - release dynamic library with dynamic zlib +!MESSAGE release-dll-ssl-dll-zlib-dll - release dynamic library with dynamic ssl and dynamic zlib +!MESSAGE debug - debug static library +!MESSAGE debug-ssl - debug static library with ssl +!MESSAGE debug-zlib - debug static library with zlib +!MESSAGE debug-ssl-zlib - debug static library with ssl and zlib +!MESSAGE debug-ssl-dll - debug static library with dynamic ssl +!MESSAGE debug-zlib-dll - debug static library with dynamic zlib +!MESSAGE debug-ssl-dll-zlib-dll - debug static library with dynamic ssl and dynamic zlib +!MESSAGE debug-dll - debug dynamic library +!MESSAGE debug-dll-ssl-dll - debug dynamic library with dynamic ssl +!MESSAGE debug-dll-zlib-dll - debug dynamic library with dynamic zlib1 +!MESSAGE debug-dll-ssl-dll-zlib-dll - debug dynamic library with dynamic ssl and dynamic zlib +!MESSAGE can be left blank in which case all is assumed +!ERROR please choose a valid configuration "$(CFG)" +!ENDIF + +####################### +# Only the clean target can be used if a config was not provided. +# +!IF "$(CFGSET)" == "FALSE" +clean: + @-erase /s *.dll 2> NUL + @-erase /s *.exp 2> NUL + @-erase /s *.idb 2> NUL + @-erase /s *.lib 2> NUL + @-erase /s *.obj 2> NUL + @-erase /s *.pch 2> NUL + @-erase /s *.pdb 2> NUL + @-erase /s *.res 2> NUL +!ELSE +# A config was provided, so the library can be built. +# +X_OBJS= \ + $(DIROBJ)\base64.obj \ + $(DIROBJ)\connect.obj \ + $(DIROBJ)\content_encoding.obj \ + $(DIROBJ)\cookie.obj \ + $(DIROBJ)\curl_addrinfo.obj \ + $(DIROBJ)\curl_fnmatch.obj \ + $(DIROBJ)\curl_gethostname.obj \ + $(DIROBJ)\curl_memrchr.obj \ + $(DIROBJ)\curl_rand.obj \ + $(DIROBJ)\curl_rtmp.obj \ + $(DIROBJ)\curl_sspi.obj \ + $(DIROBJ)\curl_threads.obj \ + $(DIROBJ)\dict.obj \ + $(DIROBJ)\easy.obj \ + $(DIROBJ)\escape.obj \ + $(DIROBJ)\fileinfo.obj \ + $(DIROBJ)\file.obj \ + $(DIROBJ)\formdata.obj \ + $(DIROBJ)\ftplistparser.obj \ + $(DIROBJ)\ftp.obj \ + $(DIROBJ)\getenv.obj \ + $(DIROBJ)\getinfo.obj \ + $(DIROBJ)\gtls.obj \ + $(DIROBJ)\gopher.obj \ + $(DIROBJ)\hash.obj \ + $(DIROBJ)\hmac.obj \ + $(DIROBJ)\hostares.obj \ + $(DIROBJ)\hostasyn.obj \ + $(DIROBJ)\hostip4.obj \ + $(DIROBJ)\hostip6.obj \ + $(DIROBJ)\hostip.obj \ + $(DIROBJ)\hostsyn.obj \ + $(DIROBJ)\hostthre.obj \ + $(DIROBJ)\http_chunks.obj \ + $(DIROBJ)\http_digest.obj \ + $(DIROBJ)\http_negotiate.obj \ + $(DIROBJ)\http_ntlm.obj \ + $(DIROBJ)\http.obj \ + $(DIROBJ)\if2ip.obj \ + $(DIROBJ)\imap.obj \ + $(DIROBJ)\inet_ntop.obj \ + $(DIROBJ)\inet_pton.obj \ + $(DIROBJ)\ldap.obj \ + $(DIROBJ)\llist.obj \ + $(DIROBJ)\md4.obj \ + $(DIROBJ)\md5.obj \ + $(DIROBJ)\memdebug.obj \ + $(DIROBJ)\mprintf.obj \ + $(DIROBJ)\multi.obj \ + $(DIROBJ)\netrc.obj \ + $(DIROBJ)\nonblock.obj \ + $(DIROBJ)\openldap.obj \ + $(DIROBJ)\parsedate.obj \ + $(DIROBJ)\pingpong.obj \ + $(DIROBJ)\polarssl.obj \ + $(DIROBJ)\pop3.obj \ + $(DIROBJ)\progress.obj \ + $(DIROBJ)\rawstr.obj \ + $(DIROBJ)\rtsp.obj \ + $(DIROBJ)\select.obj \ + $(DIROBJ)\sendf.obj \ + $(DIROBJ)\share.obj \ + $(DIROBJ)\slist.obj \ + $(DIROBJ)\smtp.obj \ + $(DIROBJ)\socks_gssapi.obj \ + $(DIROBJ)\socks.obj \ + $(DIROBJ)\socks_sspi.obj \ + $(DIROBJ)\speedcheck.obj \ + $(DIROBJ)\splay.obj \ + $(DIROBJ)\ssh.obj \ + $(DIROBJ)\sslgen.obj \ + $(DIROBJ)\ssluse.obj \ + $(DIROBJ)\strequal.obj \ + $(DIROBJ)\strerror.obj \ + $(DIROBJ)\strtok.obj \ + $(DIROBJ)\strtoofft.obj \ + $(DIROBJ)\telnet.obj \ + $(DIROBJ)\tftp.obj \ + $(DIROBJ)\timeval.obj \ + $(DIROBJ)\transfer.obj \ + $(DIROBJ)\url.obj \ + $(DIROBJ)\version.obj \ + $(DIROBJ)\warnless.obj \ + $(DIROBJ)\wildcard.obj \ + $(RESOURCE) + +all : $(TARGET) + +$(TARGET): $(X_OBJS) + $(LNK) $(LFLAGS) $(X_OBJS) + -xcopy $(DIROBJ)\$(LIB_NAME).dll . /y + -xcopy $(DIROBJ)\$(LIB_NAME).lib . /y + -xcopy $(DIROBJ)\$(LIB_NAME_DEBUG).dll . /y + -xcopy $(DIROBJ)\$(LIB_NAME_DEBUG).lib . /y + -xcopy $(DIROBJ)\$(IMPLIB_NAME).lib . /y + -xcopy $(DIROBJ)\$(IMPLIB_NAME_DEBUG).lib . /y + -xcopy $(DIROBJ)\*.exp . /y + -xcopy $(DIROBJ)\*.pdb . /y + +$(X_OBJS): $(DIROBJ) + +$(DIROBJ): + @if not exist "$(DIROBJ)" mkdir $(DIROBJ) + +.SUFFIXES: .c .obj .res + +{.\}.c{$(DIROBJ)\}.obj: + $(CC) $(CFLAGS) /Fo"$@" $< + +debug-dll\libcurl.res \ +debug-dll-ssl-dll\libcurl.res \ +debug-dll-zlib-dll\libcurl.res \ +debug-dll-ssl-dll-zlib-dll\libcurl.res: libcurl.rc + rc /dDEBUGBUILD=1 /Fo $@ libcurl.rc + +release-dll\libcurl.res \ +release-dll-ssl-dll\libcurl.res \ +release-dll-zlib-dll\libcurl.res \ +release-dll-ssl-dll-zlib-dll\libcurl.res: libcurl.rc + rc /dDEBUGBUILD=0 /Fo $@ libcurl.rc +!ENDIF # End of case where a config was provided. diff --git a/mobicore/common/curl/lib/Makefile.vc6 b/mobicore/common/curl/lib/Makefile.vc6 new file mode 100644 index 0000000000000000000000000000000000000000..2e18e145b221a13471228db35b6b353b01a410d6 --- /dev/null +++ b/mobicore/common/curl/lib/Makefile.vc6 @@ -0,0 +1,571 @@ +#*************************************************************************** +# _ _ ____ _ +# Project ___| | | | _ \| | +# / __| | | | |_) | | +# | (__| |_| | _ <| |___ +# \___|\___/|_| \_\_____| +# +# Copyright (C) 1999 - 2010, Daniel Stenberg, , et al. +# +# This software is licensed as described in the file COPYING, which +# you should have received as part of this distribution. The terms +# are also available at http://curl.haxx.se/docs/copyright.html. +# +# You may opt to use, copy, modify, merge, publish, distribute and/or sell +# copies of the Software, and permit persons to whom the Software is +# furnished to do so, under the terms of the COPYING file. +# +# This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY +# KIND, either express or implied. +# +########################################################################### +# +# Makefile for building libcurl with MSVC6 +# +# Usage: see usage message below +# Should be invoked from \lib directory +# Edit the paths and desired library name +# SSL path is only required if you intend compiling +# with SSL. +# +# This make file leaves the result either a .lib or .dll file +# in the \lib directory. It should be called from the \lib +# directory. +# +# An option would have been to allow the source directory to +# be specified, but I saw no requirement. +# +# Another option would have been to leave the .lib and .dll +# files in the "cfg" directory, but then the make file +# in \src would need to be changed. +# +############################################################## + +# +# Stem for static libs and DLLs +# +LIB_NAME = libcurl +LIB_NAME_DEBUG = libcurld + +# +# Stem for DLL import libs +# +IMPLIB_NAME = libcurl_imp +IMPLIB_NAME_DEBUG = libcurld_imp + +!IFNDEF OPENSSL_PATH +OPENSSL_PATH = ../../openssl-0.9.8o +!ENDIF + +!IFNDEF ZLIB_PATH +ZLIB_PATH = ../../zlib-1.2.5 +!ENDIF + +!IFNDEF MACHINE +MACHINE = X86 +!ENDIF + +# USE_WINDOWS_SSPI uses windows libraries to allow NTLM authentication +# without an openssl installation and offers the ability to authenticate +# using the "current logged in user". Since at least with MSVC6 the sspi.h +# header is broken it is either required to install the Windows SDK, +# or to fix sspi.h with adding this define at the beginning of sspi.h: +# #define FreeCredentialHandle FreeCredentialsHandle +# +# If, for some reason the Windows SDK is installed but not installed +# in the default location, you can specify WINDOWS_SDK_PATH. +# It can be downloaded from: +# http://www.microsoft.com/msdownload/platformsdk/sdkupdate/ + +# WINDOWS_SSPI = 1 + +!IFDEF WINDOWS_SSPI +!IFNDEF WINDOWS_SDK_PATH +WINDOWS_SDK_PATH = "C:\Program Files\Microsoft SDK" +!ENDIF +!ENDIF + +############################################################# +## Nothing more to do below this line! + +CCNODBG = cl.exe /O2 /DNDEBUG +CCDEBUG = cl.exe /Od /Gm /Zi /D_DEBUG /GZ +CFLAGSSSL = /DUSE_SSLEAY /I "$(OPENSSL_PATH)/inc32" /I "$(OPENSSL_PATH)/inc32/openssl" +CFLAGSZLIB = /DHAVE_ZLIB_H /DHAVE_ZLIB /DHAVE_LIBZ /I "$(ZLIB_PATH)" +CFLAGS = /I. /I../include /nologo /W3 /GX /DWIN32 /YX /FD /c /DBUILDING_LIBCURL +CFLAGSLIB = /DCURL_STATICLIB +LNKDLL = link.exe /DLL +LNKLIB = link.exe /lib +LFLAGS = /nologo /machine:$(MACHINE) +SSLLIBS = libeay32.lib ssleay32.lib +ZLIBLIBSDLL= zdll.lib +ZLIBLIBS = zlib.lib +WINLIBS = ws2_32.lib wldap32.lib +CFLAGS = $(CFLAGS) + +CFGSET = FALSE + +!IFDEF WINDOWS_SSPI +CFLAGS = $(CFLAGS) /DUSE_WINDOWS_SSPI /I$(WINDOWS_SDK_PATH)\include +!ENDIF + +!IFDEF USE_IPV6 +CFLAGS = $(CFLAGS) /DUSE_IPV6 +!ENDIF + +############################################################## +# Runtime library configuration + +RTLIB = /MD +RTLIBD = /MDd + +!IF "$(RTLIBCFG)" == "static" +RTLIB = /MT +RTLIBD = /MTd +!ENDIF + + +###################### +# release + +!IF "$(CFG)" == "release" +TARGET = $(LIB_NAME).lib +DIROBJ = $(CFG) +LNK = $(LNKLIB) /out:$(DIROBJ)\$(TARGET) +CC = $(CCNODBG) $(RTLIB) $(CFLAGSLIB) +CFGSET = TRUE +!ENDIF + +###################### +# release-zlib + +!IF "$(CFG)" == "release-zlib" +TARGET = $(LIB_NAME).lib +DIROBJ = $(CFG) +LFLAGSZLIB = "/LIBPATH:$(ZLIB_PATH)" +LNK = $(LNKLIB) $(ZLIBLIBS) $(LFLAGSZLIB) /out:$(DIROBJ)\$(TARGET) +CC = $(CCNODBG) $(RTLIB) $(CFLAGSZLIB) $(CFLAGSLIB) +CFGSET = TRUE +!ENDIF + +###################### +# release-dll + +!IF "$(CFG)" == "release-dll" +TARGET = $(LIB_NAME).dll +DIROBJ = $(CFG) +LNK = $(LNKDLL) $(WINLIBS) /out:$(DIROBJ)\$(TARGET) /IMPLIB:$(DIROBJ)\$(IMPLIB_NAME).lib +CC = $(CCNODBG) $(RTLIB) +CFGSET = TRUE +RESOURCE = $(DIROBJ)\libcurl.res +!ENDIF + +###################### +# release-ssl + +!IF "$(CFG)" == "release-ssl" +TARGET = $(LIB_NAME).lib +DIROBJ = $(CFG) +LFLAGSSSL = "/LIBPATH:$(OPENSSL_PATH)\out32" +LNK = $(LNKLIB) $(LFLAGSSSL) /out:$(DIROBJ)\$(TARGET) +CC = $(CCNODBG) $(RTLIB) $(CFLAGSSSL) $(CFLAGSLIB) +CFGSET = TRUE +!ENDIF + +###################### +# release-ssl-dll + +!IF "$(CFG)" == "release-ssl-dll" +TARGET = $(LIB_NAME).lib +DIROBJ = $(CFG) +LFLAGSSSL = "/LIBPATH:$(OPENSSL_PATH)\out32dll" +LNK = $(LNKLIB) $(WINLIBS) $(SSLLIBS) $(LFLAGSSSL) /out:$(DIROBJ)\$(TARGET) +CC = $(CCNODBG) $(RTLIB) $(CFLAGSSSL) $(CFLAGSLIB) +CFGSET = TRUE +!ENDIF + +###################### +# release-ssl-zlib + +!IF "$(CFG)" == "release-ssl-zlib" +TARGET = $(LIB_NAME).lib +DIROBJ = $(CFG) +LFLAGSSSL = "/LIBPATH:$(OPENSSL_PATH)\out32" +LFLAGSZLIB = "/LIBPATH:$(ZLIB_PATH)" +LNK = $(LNKLIB) $(LFLAGSSSL) $(LFLAGSZLIB) /out:$(DIROBJ)\$(TARGET) +CC = $(CCNODBG) $(RTLIB) $(CFLAGSSSL) $(CFLAGSZLIB) $(CFLAGSLIB) +CFGSET = TRUE +!ENDIF + +###################### +# release-dll-ssl-dll + +!IF "$(CFG)" == "release-dll-ssl-dll" +TARGET = $(LIB_NAME).dll +DIROBJ = $(CFG) +LFLAGSSSL = "/LIBPATH:$(OPENSSL_PATH)\out32dll" +LNK = $(LNKDLL) $(WINLIBS) $(SSLLIBS) $(LFLAGSSSL) /out:$(DIROBJ)\$(TARGET) /IMPLIB:$(DIROBJ)\$(IMPLIB_NAME).lib +CC = $(CCNODBG) $(RTLIB) $(CFLAGSSSL) +CFGSET = TRUE +RESOURCE = $(DIROBJ)\libcurl.res +!ENDIF + +###################### +# release-zlib-dll + +!IF "$(CFG)" == "release-zlib-dll" +TARGET = $(LIB_NAME).lib +DIROBJ = $(CFG) +LFLAGSZLIB = "/LIBPATH:$(ZLIB_PATH)" +LNK = $(LNKLIB) $(WINLIBS) $(ZLIBLIBSDLL) $(LFLAGSZLIB) /out:$(DIROBJ)\$(TARGET) +CC = $(CCNODBG) $(RTLIB) $(CFLAGSZLIB) $(CFLAGSLIB) +CFGSET = TRUE +!ENDIF + +###################### +# release-ssl-dll-zlib-dll + +!IF "$(CFG)" == "release-ssl-dll-zlib-dll" +TARGET = $(LIB_NAME).lib +DIROBJ = $(CFG) +LFLAGSZLIB = "/LIBPATH:$(ZLIB_PATH)" +LFLAGSSSL = "/LIBPATH:$(OPENSSL_PATH)\out32dll" +LNK = $(LNKLIB) $(WINLIBS) $(SSLLIBS) $(ZLIBLIBSDLL) $(LFLAGSSSL) $(LFLAGSZLIB) /out:$(DIROBJ)\$(TARGET) +CC = $(CCNODBG) $(RTLIB) $(CFLAGSSSL) $(CFLAGSZLIB) $(CFLAGSLIB) +CFGSET = TRUE +!ENDIF + +###################### +# release-dll-zlib-dll + +!IF "$(CFG)" == "release-dll-zlib-dll" +TARGET = $(LIB_NAME).dll +DIROBJ = $(CFG) +LFLAGSZLIB = "/LIBPATH:$(ZLIB_PATH)" +LNK = $(LNKDLL) $(WINLIBS) $(ZLIBLIBSDLL) $(LFLAGSZLIB) /out:$(DIROBJ)\$(TARGET) /IMPLIB:$(DIROBJ)\$(IMPLIB_NAME).lib +CC = $(CCNODBG) $(RTLIB) $(CFLAGSZLIB) +CFGSET = TRUE +RESOURCE = $(DIROBJ)\libcurl.res +!ENDIF + +###################### +# release-dll-ssl-dll-zlib-dll + +!IF "$(CFG)" == "release-dll-ssl-dll-zlib-dll" +TARGET = $(LIB_NAME).dll +DIROBJ = $(CFG) +LFLAGSZLIB = "/LIBPATH:$(ZLIB_PATH)" +LFLAGSSSL = "/LIBPATH:$(OPENSSL_PATH)\out32dll" +LNK = $(LNKDLL) $(WINLIBS) $(SSLLIBS) $(ZLIBLIBSDLL) $(LFLAGSSSL) $(LFLAGSZLIB) /out:$(DIROBJ)\$(TARGET) /IMPLIB:$(DIROBJ)\$(IMPLIB_NAME).lib +CC = $(CCNODBG) $(RTLIB) $(CFLAGSSSL) $(CFLAGSZLIB) +CFGSET = TRUE +RESOURCE = $(DIROBJ)\libcurl.res +!ENDIF + +###################### +# debug + +!IF "$(CFG)" == "debug" +TARGET = $(LIB_NAME_DEBUG).lib +DIROBJ = $(CFG) +LNK = $(LNKLIB) /out:$(DIROBJ)\$(TARGET) +CC = $(CCDEBUG) $(RTLIBD) $(CFLAGSLIB) +CFGSET = TRUE +!ENDIF + +###################### +# debug-ssl + +!IF "$(CFG)" == "debug-ssl" +TARGET = $(LIB_NAME_DEBUG).lib +DIROBJ = $(CFG) +LFLAGSSSL = "/LIBPATH:$(OPENSSL_PATH)\out32" +LNK = $(LNKLIB) $(LFLAGSSSL) /out:$(DIROBJ)\$(TARGET) +CC = $(CCDEBUG) $(RTLIBD) $(CFLAGSSSL) $(CFLAGSLIB) +CFGSET = TRUE +!ENDIF + +###################### +# debug-zlib + +!IF "$(CFG)" == "debug-zlib" +TARGET = $(LIB_NAME_DEBUG).lib +DIROBJ = $(CFG) +LFLAGSZLIB = "/LIBPATH:$(ZLIB_PATH)" +LNK = $(LNKLIB) $(ZLIBLIBS) $(LFLAGSZLIB) /out:$(DIROBJ)\$(TARGET) +CC = $(CCDEBUG) $(RTLIBD) $(CFLAGSZLIB) $(CFLAGSLIB) +CFGSET = TRUE +!ENDIF + +###################### +# debug-ssl-dll + +!IF "$(CFG)" == "debug-ssl-dll" +TARGET = $(LIB_NAME_DEBUG).lib +DIROBJ = $(CFG) +LFLAGSSSL = /LIBPATH:$(OPENSSL_PATH)\out32dll +LNK = $(LNKLIB) $(WINLIBS) $(SSLLIBS) $(LFLAGSSSL) /out:$(DIROBJ)\$(TARGET) +CC = $(CCDEBUG) $(RTLIBD) $(CFLAGSSSL) $(CFLAGSLIB) +CFGSET = TRUE +!ENDIF + +###################### +# debug-ssl-zlib + +!IF "$(CFG)" == "debug-ssl-zlib" +TARGET = $(LIB_NAME_DEBUG).lib +DIROBJ = $(CFG) +LFLAGSZLIB = "/LIBPATH:$(ZLIB_PATH)" +LFLAGSSSL = "/LIBPATH:$(OPENSSL_PATH)\out32" +LNK = $(LNKLIB) $(ZLIBLIBS) $(LFLAGSSSL) $(LFLAGSZLIB) /out:$(DIROBJ)\$(TARGET) +CC = $(CCDEBUG) $(RTLIBD) $(CFLAGSSSL) $(CFLAGSZLIB) $(CFLAGSLIB) +CFGSET = TRUE +!ENDIF + +###################### +# debug-zlib-dll + +!IF "$(CFG)" == "debug-zlib-dll" +TARGET = $(LIB_NAME_DEBUG).lib +DIROBJ = $(CFG) +LFLAGSZLIB = "/LIBPATH:$(ZLIB_PATH)" +LNK = $(LNKLIB) $(WINLIBS) $(ZLIBLIBSDLL) $(LFLAGSZLIB) /out:$(DIROBJ)\$(TARGET) +CC = $(CCDEBUG) $(RTLIBD) $(CFLAGSZLIB) $(CFLAGSLIB) +CFGSET = TRUE +!ENDIF + +###################### +# debug-ssl-dll-zlib-dll + +!IF "$(CFG)" == "debug-ssl-dll-zlib-dll" +TARGET = $(LIB_NAME_DEBUG).lib +DIROBJ = $(CFG) +LFLAGSZLIB = "/LIBPATH:$(ZLIB_PATH)" +LFLAGSSSL = "/LIBPATH:$(OPENSSL_PATH)\out32dll" +LNK = $(LNKLIB) $(WINLIBS) $(SSLLIBS) $(ZLIBLIBSDLL) $(LFLAGSSSL) $(LFLAGSZLIB) /out:$(DIROBJ)\$(TARGET) +CC = $(CCDEBUG) $(RTLIBD) $(CFLAGSSSL) $(CFLAGSZLIB) $(CFLAGSLIB) +CFGSET = TRUE +!ENDIF + +###################### +# debug-dll + +!IF "$(CFG)" == "debug-dll" +TARGET = $(LIB_NAME_DEBUG).dll +DIROBJ = $(CFG) +LNK = $(LNKDLL) $(WINLIBS) /DEBUG /out:$(DIROBJ)\$(TARGET) /IMPLIB:$(DIROBJ)\$(IMPLIB_NAME_DEBUG).lib /PDB:$(DIROBJ)\$(IMPLIB_NAME_DEBUG).pdb +CC = $(CCDEBUG) $(RTLIBD) +CFGSET = TRUE +RESOURCE = $(DIROBJ)\libcurl.res +!ENDIF + +###################### +# debug-dll-ssl-dll + +!IF "$(CFG)" == "debug-dll-ssl-dll" +TARGET = $(LIB_NAME_DEBUG).dll +DIROBJ = $(CFG) +LFLAGSSSL = "/LIBPATH:$(OPENSSL_PATH)\out32dll" +LNK = $(LNKDLL) $(WINLIBS) $(SSLLIBS) $(LFLAGSSSL) /DEBUG /out:$(DIROBJ)\$(TARGET) /IMPLIB:$(DIROBJ)\$(IMPLIB_NAME_DEBUG).lib /PDB:$(DIROBJ)\$(IMPLIB_NAME_DEBUG).pdb +CC = $(CCDEBUG) $(RTLIBD) $(CFLAGSSSL) +CFGSET = TRUE +RESOURCE = $(DIROBJ)\libcurl.res +!ENDIF + +###################### +# debug-dll-zlib-dll + +!IF "$(CFG)" == "debug-dll-zlib-dll" +TARGET = $(LIB_NAME_DEBUG).dll +DIROBJ = $(CFG) +LFLAGSZLIB = "/LIBPATH:$(ZLIB_PATH)" +LNK = $(LNKDLL) $(WINLIBS) $(ZLIBLIBSDLL) $(LFLAGSZLIB) /DEBUG /out:$(DIROBJ)\$(TARGET) /IMPLIB:$(DIROBJ)\$(IMPLIB_NAME_DEBUG).lib /PDB:$(DIROBJ)\$(IMPLIB_NAME_DEBUG).pdb +CC = $(CCDEBUG) $(RTLIBD) $(CFLAGSZLIB) +CFGSET = TRUE +RESOURCE = $(DIROBJ)\libcurl.res +!ENDIF + +###################### +# debug-dll-ssl-dll-zlib-dll + +!IF "$(CFG)" == "debug-dll-ssl-dll-zlib-dll" +TARGET = $(LIB_NAME_DEBUG).dll +DIROBJ = $(CFG) +LFLAGSZLIB = "/LIBPATH:$(ZLIB_PATH)" +LFLAGSSSL = "/LIBPATH:$(OPENSSL_PATH)\out32dll" +LNK = $(LNKDLL) $(WINLIBS) $(SSLLIBS) $(ZLIBLIBSDLL) $(LFLAGSSSL) $(LFLAGSZLIB) /DEBUG /out:$(DIROBJ)\$(TARGET) /IMPLIB:$(DIROBJ)\$(IMPLIB_NAME_DEBUG).lib /PDB:$(DIROBJ)\$(IMPLIB_NAME_DEBUG).pdb +CC = $(CCDEBUG) $(RTLIBD) $(CFLAGSSSL) $(CFLAGSZLIB) +CFGSET = TRUE +RESOURCE = $(DIROBJ)\libcurl.res +!ENDIF + +####################### +# Usage +# +!IF "$(CFGSET)" == "FALSE" && "$(CFG)" != "" +!MESSAGE Usage: nmake /f makefile.vc6 CFG= +!MESSAGE where is one of: +!MESSAGE release - release static library +!MESSAGE release-ssl - release static library with ssl +!MESSAGE release-zlib - release static library with zlib +!MESSAGE release-ssl-zlib - release static library with ssl and zlib +!MESSAGE release-ssl-dll - release static library with dynamic ssl +!MESSAGE release-zlib-dll - release static library with dynamic zlib +!MESSAGE release-ssl-dll-zlib-dll - release static library with dynamic ssl and dynamic zlib +!MESSAGE release-dll - release dynamic library +!MESSAGE release-dll-ssl-dll - release dynamic library with dynamic ssl +!MESSAGE release-dll-zlib-dll - release dynamic library with dynamic zlib +!MESSAGE release-dll-ssl-dll-zlib-dll - release dynamic library with dynamic ssl and dynamic zlib +!MESSAGE debug - debug static library +!MESSAGE debug-ssl - debug static library with ssl +!MESSAGE debug-zlib - debug static library with zlib +!MESSAGE debug-ssl-zlib - debug static library with ssl and zlib +!MESSAGE debug-ssl-dll - debug static library with dynamic ssl +!MESSAGE debug-zlib-dll - debug static library with dynamic zlib +!MESSAGE debug-ssl-dll-zlib-dll - debug static library with dynamic ssl and dynamic zlib +!MESSAGE debug-dll - debug dynamic library +!MESSAGE debug-dll-ssl-dll - debug dynamic library with dynamic ssl +!MESSAGE debug-dll-zlib-dll - debug dynamic library with dynamic zlib1 +!MESSAGE debug-dll-ssl-dll-zlib-dll - debug dynamic library with dynamic ssl and dynamic zlib +!MESSAGE can be left blank in which case all is assumed +!ERROR please choose a valid configuration "$(CFG)" +!ENDIF + +####################### +# Only the clean target can be used if a config was not provided. +# +!IF "$(CFGSET)" == "FALSE" +clean: + @-erase /s *.dll 2> NUL + @-erase /s *.exp 2> NUL + @-erase /s *.idb 2> NUL + @-erase /s *.lib 2> NUL + @-erase /s *.obj 2> NUL + @-erase /s *.pch 2> NUL + @-erase /s *.pdb 2> NUL + @-erase /s *.res 2> NUL +!ELSE +# A config was provided, so the library can be built. +# +X_OBJS= \ + $(DIROBJ)\base64.obj \ + $(DIROBJ)\connect.obj \ + $(DIROBJ)\content_encoding.obj \ + $(DIROBJ)\cookie.obj \ + $(DIROBJ)\curl_addrinfo.obj \ + $(DIROBJ)\curl_fnmatch.obj \ + $(DIROBJ)\curl_gethostname.obj \ + $(DIROBJ)\curl_memrchr.obj \ + $(DIROBJ)\curl_rand.obj \ + $(DIROBJ)\curl_rtmp.obj \ + $(DIROBJ)\curl_sspi.obj \ + $(DIROBJ)\curl_threads.obj \ + $(DIROBJ)\dict.obj \ + $(DIROBJ)\easy.obj \ + $(DIROBJ)\escape.obj \ + $(DIROBJ)\fileinfo.obj \ + $(DIROBJ)\file.obj \ + $(DIROBJ)\formdata.obj \ + $(DIROBJ)\ftplistparser.obj \ + $(DIROBJ)\ftp.obj \ + $(DIROBJ)\getenv.obj \ + $(DIROBJ)\getinfo.obj \ + $(DIROBJ)\gtls.obj \ + $(DIROBJ)\gopher.obj \ + $(DIROBJ)\hash.obj \ + $(DIROBJ)\hmac.obj \ + $(DIROBJ)\hostares.obj \ + $(DIROBJ)\hostasyn.obj \ + $(DIROBJ)\hostip4.obj \ + $(DIROBJ)\hostip6.obj \ + $(DIROBJ)\hostip.obj \ + $(DIROBJ)\hostsyn.obj \ + $(DIROBJ)\hostthre.obj \ + $(DIROBJ)\http_chunks.obj \ + $(DIROBJ)\http_digest.obj \ + $(DIROBJ)\http_negotiate.obj \ + $(DIROBJ)\http_ntlm.obj \ + $(DIROBJ)\http.obj \ + $(DIROBJ)\if2ip.obj \ + $(DIROBJ)\imap.obj \ + $(DIROBJ)\inet_ntop.obj \ + $(DIROBJ)\inet_pton.obj \ + $(DIROBJ)\ldap.obj \ + $(DIROBJ)\llist.obj \ + $(DIROBJ)\md4.obj \ + $(DIROBJ)\md5.obj \ + $(DIROBJ)\memdebug.obj \ + $(DIROBJ)\mprintf.obj \ + $(DIROBJ)\multi.obj \ + $(DIROBJ)\netrc.obj \ + $(DIROBJ)\nonblock.obj \ + $(DIROBJ)\openldap.obj \ + $(DIROBJ)\parsedate.obj \ + $(DIROBJ)\pingpong.obj \ + $(DIROBJ)\polarssl.obj \ + $(DIROBJ)\pop3.obj \ + $(DIROBJ)\progress.obj \ + $(DIROBJ)\rawstr.obj \ + $(DIROBJ)\rtsp.obj \ + $(DIROBJ)\select.obj \ + $(DIROBJ)\sendf.obj \ + $(DIROBJ)\share.obj \ + $(DIROBJ)\slist.obj \ + $(DIROBJ)\smtp.obj \ + $(DIROBJ)\socks_gssapi.obj \ + $(DIROBJ)\socks.obj \ + $(DIROBJ)\socks_sspi.obj \ + $(DIROBJ)\speedcheck.obj \ + $(DIROBJ)\splay.obj \ + $(DIROBJ)\ssh.obj \ + $(DIROBJ)\sslgen.obj \ + $(DIROBJ)\ssluse.obj \ + $(DIROBJ)\strequal.obj \ + $(DIROBJ)\strerror.obj \ + $(DIROBJ)\strtok.obj \ + $(DIROBJ)\strtoofft.obj \ + $(DIROBJ)\telnet.obj \ + $(DIROBJ)\tftp.obj \ + $(DIROBJ)\timeval.obj \ + $(DIROBJ)\transfer.obj \ + $(DIROBJ)\url.obj \ + $(DIROBJ)\version.obj \ + $(DIROBJ)\warnless.obj \ + $(DIROBJ)\wildcard.obj \ + $(RESOURCE) + +all : $(TARGET) + +$(TARGET): $(X_OBJS) + $(LNK) $(LFLAGS) $(X_OBJS) + -xcopy $(DIROBJ)\$(LIB_NAME).dll . /y + -xcopy $(DIROBJ)\$(LIB_NAME).lib . /y + -xcopy $(DIROBJ)\$(LIB_NAME_DEBUG).dll . /y + -xcopy $(DIROBJ)\$(LIB_NAME_DEBUG).lib . /y + -xcopy $(DIROBJ)\$(IMPLIB_NAME).lib . /y + -xcopy $(DIROBJ)\$(IMPLIB_NAME_DEBUG).lib . /y + -xcopy $(DIROBJ)\*.exp . /y + -xcopy $(DIROBJ)\*.pdb . /y + +$(X_OBJS): $(DIROBJ) + +$(DIROBJ): + @if not exist "$(DIROBJ)" mkdir $(DIROBJ) + +.SUFFIXES: .c .obj .res + +{.\}.c{$(DIROBJ)\}.obj: + $(CC) $(CFLAGS) /Fo"$@" $< + +debug-dll\libcurl.res \ +debug-dll-ssl-dll\libcurl.res \ +debug-dll-zlib-dll\libcurl.res \ +debug-dll-ssl-dll-zlib-dll\libcurl.res: libcurl.rc + rc /dDEBUGBUILD=1 /Fo $@ libcurl.rc + +release-dll\libcurl.res \ +release-dll-ssl-dll\libcurl.res \ +release-dll-zlib-dll\libcurl.res \ +release-dll-ssl-dll-zlib-dll\libcurl.res: libcurl.rc + rc /dDEBUGBUILD=0 /Fo $@ libcurl.rc +!ENDIF # End of case where a config was provided. diff --git a/mobicore/common/curl/lib/Makefile.vc8 b/mobicore/common/curl/lib/Makefile.vc8 new file mode 100644 index 0000000000000000000000000000000000000000..af6fbf075e27395e0241270e3614c966b5209794 --- /dev/null +++ b/mobicore/common/curl/lib/Makefile.vc8 @@ -0,0 +1,571 @@ +#*************************************************************************** +# _ _ ____ _ +# Project ___| | | | _ \| | +# / __| | | | |_) | | +# | (__| |_| | _ <| |___ +# \___|\___/|_| \_\_____| +# +# Copyright (C) 1999 - 2010, Daniel Stenberg, , et al. +# +# This software is licensed as described in the file COPYING, which +# you should have received as part of this distribution. The terms +# are also available at http://curl.haxx.se/docs/copyright.html. +# +# You may opt to use, copy, modify, merge, publish, distribute and/or sell +# copies of the Software, and permit persons to whom the Software is +# furnished to do so, under the terms of the COPYING file. +# +# This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY +# KIND, either express or implied. +# +########################################################################### +# +# Makefile for building libcurl with MSVC8 +# +# Usage: see usage message below +# Should be invoked from \lib directory +# Edit the paths and desired library name +# SSL path is only required if you intend compiling +# with SSL. +# +# This make file leaves the result either a .lib or .dll file +# in the \lib directory. It should be called from the \lib +# directory. +# +# An option would have been to allow the source directory to +# be specified, but I saw no requirement. +# +# Another option would have been to leave the .lib and .dll +# files in the "cfg" directory, but then the make file +# in \src would need to be changed. +# +############################################################## + +# +# Stem for static libs and DLLs +# +LIB_NAME = libcurl +LIB_NAME_DEBUG = libcurld + +# +# Stem for DLL import libs +# +IMPLIB_NAME = libcurl_imp +IMPLIB_NAME_DEBUG = libcurld_imp + +!IFNDEF OPENSSL_PATH +OPENSSL_PATH = ../../openssl-0.9.8o +!ENDIF + +!IFNDEF ZLIB_PATH +ZLIB_PATH = ../../zlib-1.2.5 +!ENDIF + +!IFNDEF MACHINE +MACHINE = X86 +!ENDIF + +# USE_WINDOWS_SSPI uses windows libraries to allow NTLM authentication +# without an openssl installation and offers the ability to authenticate +# using the "current logged in user". Since at least with MSVC8 the sspi.h +# header is broken it is either required to install the Windows SDK, +# or to fix sspi.h with adding this define at the beginning of sspi.h: +# #define FreeCredentialHandle FreeCredentialsHandle +# +# If, for some reason the Windows SDK is installed but not installed +# in the default location, you can specify WINDOWS_SDK_PATH. +# It can be downloaded from: +# http://www.microsoft.com/msdownload/platformsdk/sdkupdate/ + +# WINDOWS_SSPI = 1 + +!IFDEF WINDOWS_SSPI +!IFNDEF WINDOWS_SDK_PATH +WINDOWS_SDK_PATH = "C:\Program Files\Microsoft SDK" +!ENDIF +!ENDIF + +############################################################# +## Nothing more to do below this line! + +CCNODBG = cl.exe /O2 /DNDEBUG +CCDEBUG = cl.exe /Od /Gm /Zi /D_DEBUG /RTC1 +CFLAGSSSL = /DUSE_SSLEAY /I "$(OPENSSL_PATH)/inc32" /I "$(OPENSSL_PATH)/inc32/openssl" +CFLAGSZLIB = /DHAVE_ZLIB_H /DHAVE_ZLIB /DHAVE_LIBZ /I "$(ZLIB_PATH)" +CFLAGS = /I. /I../include /nologo /W3 /EHsc /DWIN32 /FD /c /DBUILDING_LIBCURL +CFLAGSLIB = /DCURL_STATICLIB +LNKDLL = link.exe /DLL +LNKLIB = link.exe /lib +LFLAGS = /nologo /machine:$(MACHINE) +SSLLIBS = libeay32.lib ssleay32.lib +ZLIBLIBSDLL= zdll.lib +ZLIBLIBS = zlib.lib +WINLIBS = ws2_32.lib bufferoverflowu.lib wldap32.lib +CFLAGS = $(CFLAGS) + +CFGSET = FALSE + +!IFDEF WINDOWS_SSPI +CFLAGS = $(CFLAGS) /DUSE_WINDOWS_SSPI /I$(WINDOWS_SDK_PATH)\include +!ENDIF + +!IFDEF USE_IPV6 +CFLAGS = $(CFLAGS) /DUSE_IPV6 +!ENDIF + +############################################################## +# Runtime library configuration + +RTLIB = /MD +RTLIBD = /MDd + +!IF "$(RTLIBCFG)" == "static" +RTLIB = /MT +RTLIBD = /MTd +!ENDIF + + +###################### +# release + +!IF "$(CFG)" == "release" +TARGET = $(LIB_NAME).lib +DIROBJ = $(CFG) +LNK = $(LNKLIB) /out:$(DIROBJ)\$(TARGET) +CC = $(CCNODBG) $(RTLIB) $(CFLAGSLIB) +CFGSET = TRUE +!ENDIF + +###################### +# release-zlib + +!IF "$(CFG)" == "release-zlib" +TARGET = $(LIB_NAME).lib +DIROBJ = $(CFG) +LFLAGSZLIB = "/LIBPATH:$(ZLIB_PATH)" +LNK = $(LNKLIB) $(ZLIBLIBS) $(LFLAGSZLIB) /out:$(DIROBJ)\$(TARGET) +CC = $(CCNODBG) $(RTLIB) $(CFLAGSZLIB) $(CFLAGSLIB) +CFGSET = TRUE +!ENDIF + +###################### +# release-dll + +!IF "$(CFG)" == "release-dll" +TARGET = $(LIB_NAME).dll +DIROBJ = $(CFG) +LNK = $(LNKDLL) $(WINLIBS) /out:$(DIROBJ)\$(TARGET) /IMPLIB:$(DIROBJ)\$(IMPLIB_NAME).lib +CC = $(CCNODBG) $(RTLIB) +CFGSET = TRUE +RESOURCE = $(DIROBJ)\libcurl.res +!ENDIF + +###################### +# release-ssl + +!IF "$(CFG)" == "release-ssl" +TARGET = $(LIB_NAME).lib +DIROBJ = $(CFG) +LFLAGSSSL = "/LIBPATH:$(OPENSSL_PATH)\out32" +LNK = $(LNKLIB) $(LFLAGSSSL) /out:$(DIROBJ)\$(TARGET) +CC = $(CCNODBG) $(RTLIB) $(CFLAGSSSL) $(CFLAGSLIB) +CFGSET = TRUE +!ENDIF + +###################### +# release-ssl-dll + +!IF "$(CFG)" == "release-ssl-dll" +TARGET = $(LIB_NAME).lib +DIROBJ = $(CFG) +LFLAGSSSL = "/LIBPATH:$(OPENSSL_PATH)\out32dll" +LNK = $(LNKLIB) $(WINLIBS) $(SSLLIBS) $(LFLAGSSSL) /out:$(DIROBJ)\$(TARGET) +CC = $(CCNODBG) $(RTLIB) $(CFLAGSSSL) $(CFLAGSLIB) +CFGSET = TRUE +!ENDIF + +###################### +# release-ssl-zlib + +!IF "$(CFG)" == "release-ssl-zlib" +TARGET = $(LIB_NAME).lib +DIROBJ = $(CFG) +LFLAGSSSL = "/LIBPATH:$(OPENSSL_PATH)\out32" +LFLAGSZLIB = "/LIBPATH:$(ZLIB_PATH)" +LNK = $(LNKLIB) $(LFLAGSSSL) $(LFLAGSZLIB) /out:$(DIROBJ)\$(TARGET) +CC = $(CCNODBG) $(RTLIB) $(CFLAGSSSL) $(CFLAGSZLIB) $(CFLAGSLIB) +CFGSET = TRUE +!ENDIF + +###################### +# release-dll-ssl-dll + +!IF "$(CFG)" == "release-dll-ssl-dll" +TARGET = $(LIB_NAME).dll +DIROBJ = $(CFG) +LFLAGSSSL = "/LIBPATH:$(OPENSSL_PATH)\out32dll" +LNK = $(LNKDLL) $(WINLIBS) $(SSLLIBS) $(LFLAGSSSL) /out:$(DIROBJ)\$(TARGET) /IMPLIB:$(DIROBJ)\$(IMPLIB_NAME).lib +CC = $(CCNODBG) $(RTLIB) $(CFLAGSSSL) +CFGSET = TRUE +RESOURCE = $(DIROBJ)\libcurl.res +!ENDIF + +###################### +# release-zlib-dll + +!IF "$(CFG)" == "release-zlib-dll" +TARGET = $(LIB_NAME).lib +DIROBJ = $(CFG) +LFLAGSZLIB = "/LIBPATH:$(ZLIB_PATH)" +LNK = $(LNKLIB) $(WINLIBS) $(ZLIBLIBSDLL) $(LFLAGSZLIB) /out:$(DIROBJ)\$(TARGET) +CC = $(CCNODBG) $(RTLIB) $(CFLAGSZLIB) $(CFLAGSLIB) +CFGSET = TRUE +!ENDIF + +###################### +# release-ssl-dll-zlib-dll + +!IF "$(CFG)" == "release-ssl-dll-zlib-dll" +TARGET = $(LIB_NAME).lib +DIROBJ = $(CFG) +LFLAGSZLIB = "/LIBPATH:$(ZLIB_PATH)" +LFLAGSSSL = "/LIBPATH:$(OPENSSL_PATH)\out32dll" +LNK = $(LNKLIB) $(WINLIBS) $(SSLLIBS) $(ZLIBLIBSDLL) $(LFLAGSSSL) $(LFLAGSZLIB) /out:$(DIROBJ)\$(TARGET) +CC = $(CCNODBG) $(RTLIB) $(CFLAGSSSL) $(CFLAGSZLIB) $(CFLAGSLIB) +CFGSET = TRUE +!ENDIF + +###################### +# release-dll-zlib-dll + +!IF "$(CFG)" == "release-dll-zlib-dll" +TARGET = $(LIB_NAME).dll +DIROBJ = $(CFG) +LFLAGSZLIB = "/LIBPATH:$(ZLIB_PATH)" +LNK = $(LNKDLL) $(WINLIBS) $(ZLIBLIBSDLL) $(LFLAGSZLIB) /out:$(DIROBJ)\$(TARGET) /IMPLIB:$(DIROBJ)\$(IMPLIB_NAME).lib +CC = $(CCNODBG) $(RTLIB) $(CFLAGSZLIB) +CFGSET = TRUE +RESOURCE = $(DIROBJ)\libcurl.res +!ENDIF + +###################### +# release-dll-ssl-dll-zlib-dll + +!IF "$(CFG)" == "release-dll-ssl-dll-zlib-dll" +TARGET = $(LIB_NAME).dll +DIROBJ = $(CFG) +LFLAGSZLIB = "/LIBPATH:$(ZLIB_PATH)" +LFLAGSSSL = "/LIBPATH:$(OPENSSL_PATH)\out32dll" +LNK = $(LNKDLL) $(WINLIBS) $(SSLLIBS) $(ZLIBLIBSDLL) $(LFLAGSSSL) $(LFLAGSZLIB) /out:$(DIROBJ)\$(TARGET) /IMPLIB:$(DIROBJ)\$(IMPLIB_NAME).lib +CC = $(CCNODBG) $(RTLIB) $(CFLAGSSSL) $(CFLAGSZLIB) +CFGSET = TRUE +RESOURCE = $(DIROBJ)\libcurl.res +!ENDIF + +###################### +# debug + +!IF "$(CFG)" == "debug" +TARGET = $(LIB_NAME_DEBUG).lib +DIROBJ = $(CFG) +LNK = $(LNKLIB) /out:$(DIROBJ)\$(TARGET) +CC = $(CCDEBUG) $(RTLIBD) $(CFLAGSLIB) +CFGSET = TRUE +!ENDIF + +###################### +# debug-ssl + +!IF "$(CFG)" == "debug-ssl" +TARGET = $(LIB_NAME_DEBUG).lib +DIROBJ = $(CFG) +LFLAGSSSL = "/LIBPATH:$(OPENSSL_PATH)\out32" +LNK = $(LNKLIB) $(LFLAGSSSL) /out:$(DIROBJ)\$(TARGET) +CC = $(CCDEBUG) $(RTLIBD) $(CFLAGSSSL) $(CFLAGSLIB) +CFGSET = TRUE +!ENDIF + +###################### +# debug-zlib + +!IF "$(CFG)" == "debug-zlib" +TARGET = $(LIB_NAME_DEBUG).lib +DIROBJ = $(CFG) +LFLAGSZLIB = "/LIBPATH:$(ZLIB_PATH)" +LNK = $(LNKLIB) $(ZLIBLIBS) $(LFLAGSZLIB) /out:$(DIROBJ)\$(TARGET) +CC = $(CCDEBUG) $(RTLIBD) $(CFLAGSZLIB) $(CFLAGSLIB) +CFGSET = TRUE +!ENDIF + +###################### +# debug-ssl-dll + +!IF "$(CFG)" == "debug-ssl-dll" +TARGET = $(LIB_NAME_DEBUG).lib +DIROBJ = $(CFG) +LFLAGSSSL = /LIBPATH:$(OPENSSL_PATH)\out32dll +LNK = $(LNKLIB) $(WINLIBS) $(SSLLIBS) $(LFLAGSSSL) /out:$(DIROBJ)\$(TARGET) +CC = $(CCDEBUG) $(RTLIBD) $(CFLAGSSSL) $(CFLAGSLIB) +CFGSET = TRUE +!ENDIF + +###################### +# debug-ssl-zlib + +!IF "$(CFG)" == "debug-ssl-zlib" +TARGET = $(LIB_NAME_DEBUG).lib +DIROBJ = $(CFG) +LFLAGSZLIB = "/LIBPATH:$(ZLIB_PATH)" +LFLAGSSSL = "/LIBPATH:$(OPENSSL_PATH)\out32" +LNK = $(LNKLIB) $(ZLIBLIBS) $(LFLAGSSSL) $(LFLAGSZLIB) /out:$(DIROBJ)\$(TARGET) +CC = $(CCDEBUG) $(RTLIBD) $(CFLAGSSSL) $(CFLAGSZLIB) $(CFLAGSLIB) +CFGSET = TRUE +!ENDIF + +###################### +# debug-zlib-dll + +!IF "$(CFG)" == "debug-zlib-dll" +TARGET = $(LIB_NAME_DEBUG).lib +DIROBJ = $(CFG) +LFLAGSZLIB = "/LIBPATH:$(ZLIB_PATH)" +LNK = $(LNKLIB) $(WINLIBS) $(ZLIBLIBSDLL) $(LFLAGSZLIB) /out:$(DIROBJ)\$(TARGET) +CC = $(CCDEBUG) $(RTLIBD) $(CFLAGSZLIB) $(CFLAGSLIB) +CFGSET = TRUE +!ENDIF + +###################### +# debug-ssl-dll-zlib-dll + +!IF "$(CFG)" == "debug-ssl-dll-zlib-dll" +TARGET = $(LIB_NAME_DEBUG).lib +DIROBJ = $(CFG) +LFLAGSZLIB = "/LIBPATH:$(ZLIB_PATH)" +LFLAGSSSL = "/LIBPATH:$(OPENSSL_PATH)\out32dll" +LNK = $(LNKLIB) $(WINLIBS) $(SSLLIBS) $(ZLIBLIBSDLL) $(LFLAGSSSL) $(LFLAGSZLIB) /out:$(DIROBJ)\$(TARGET) +CC = $(CCDEBUG) $(RTLIBD) $(CFLAGSSSL) $(CFLAGSZLIB) $(CFLAGSLIB) +CFGSET = TRUE +!ENDIF + +###################### +# debug-dll + +!IF "$(CFG)" == "debug-dll" +TARGET = $(LIB_NAME_DEBUG).dll +DIROBJ = $(CFG) +LNK = $(LNKDLL) $(WINLIBS) /DEBUG /out:$(DIROBJ)\$(TARGET) /IMPLIB:$(DIROBJ)\$(IMPLIB_NAME_DEBUG).lib /PDB:$(DIROBJ)\$(IMPLIB_NAME_DEBUG).pdb +CC = $(CCDEBUG) $(RTLIBD) +CFGSET = TRUE +RESOURCE = $(DIROBJ)\libcurl.res +!ENDIF + +###################### +# debug-dll-ssl-dll + +!IF "$(CFG)" == "debug-dll-ssl-dll" +TARGET = $(LIB_NAME_DEBUG).dll +DIROBJ = $(CFG) +LFLAGSSSL = "/LIBPATH:$(OPENSSL_PATH)\out32dll" +LNK = $(LNKDLL) $(WINLIBS) $(SSLLIBS) $(LFLAGSSSL) /DEBUG /out:$(DIROBJ)\$(TARGET) /IMPLIB:$(DIROBJ)\$(IMPLIB_NAME_DEBUG).lib /PDB:$(DIROBJ)\$(IMPLIB_NAME_DEBUG).pdb +CC = $(CCDEBUG) $(RTLIBD) $(CFLAGSSSL) +CFGSET = TRUE +RESOURCE = $(DIROBJ)\libcurl.res +!ENDIF + +###################### +# debug-dll-zlib-dll + +!IF "$(CFG)" == "debug-dll-zlib-dll" +TARGET = $(LIB_NAME_DEBUG).dll +DIROBJ = $(CFG) +LFLAGSZLIB = "/LIBPATH:$(ZLIB_PATH)" +LNK = $(LNKDLL) $(WINLIBS) $(ZLIBLIBSDLL) $(LFLAGSZLIB) /DEBUG /out:$(DIROBJ)\$(TARGET) /IMPLIB:$(DIROBJ)\$(IMPLIB_NAME_DEBUG).lib /PDB:$(DIROBJ)\$(IMPLIB_NAME_DEBUG).pdb +CC = $(CCDEBUG) $(RTLIBD) $(CFLAGSZLIB) +CFGSET = TRUE +RESOURCE = $(DIROBJ)\libcurl.res +!ENDIF + +###################### +# debug-dll-ssl-dll-zlib-dll + +!IF "$(CFG)" == "debug-dll-ssl-dll-zlib-dll" +TARGET = $(LIB_NAME_DEBUG).dll +DIROBJ = $(CFG) +LFLAGSZLIB = "/LIBPATH:$(ZLIB_PATH)" +LFLAGSSSL = "/LIBPATH:$(OPENSSL_PATH)\out32dll" +LNK = $(LNKDLL) $(WINLIBS) $(SSLLIBS) $(ZLIBLIBSDLL) $(LFLAGSSSL) $(LFLAGSZLIB) /DEBUG /out:$(DIROBJ)\$(TARGET) /IMPLIB:$(DIROBJ)\$(IMPLIB_NAME_DEBUG).lib /PDB:$(DIROBJ)\$(IMPLIB_NAME_DEBUG).pdb +CC = $(CCDEBUG) $(RTLIBD) $(CFLAGSSSL) $(CFLAGSZLIB) +CFGSET = TRUE +RESOURCE = $(DIROBJ)\libcurl.res +!ENDIF + +####################### +# Usage +# +!IF "$(CFGSET)" == "FALSE" && "$(CFG)" != "" +!MESSAGE Usage: nmake /f makefile.vc6 CFG= +!MESSAGE where is one of: +!MESSAGE release - release static library +!MESSAGE release-ssl - release static library with ssl +!MESSAGE release-zlib - release static library with zlib +!MESSAGE release-ssl-zlib - release static library with ssl and zlib +!MESSAGE release-ssl-dll - release static library with dynamic ssl +!MESSAGE release-zlib-dll - release static library with dynamic zlib +!MESSAGE release-ssl-dll-zlib-dll - release static library with dynamic ssl and dynamic zlib +!MESSAGE release-dll - release dynamic library +!MESSAGE release-dll-ssl-dll - release dynamic library with dynamic ssl +!MESSAGE release-dll-zlib-dll - release dynamic library with dynamic zlib +!MESSAGE release-dll-ssl-dll-zlib-dll - release dynamic library with dynamic ssl and dynamic zlib +!MESSAGE debug - debug static library +!MESSAGE debug-ssl - debug static library with ssl +!MESSAGE debug-zlib - debug static library with zlib +!MESSAGE debug-ssl-zlib - debug static library with ssl and zlib +!MESSAGE debug-ssl-dll - debug static library with dynamic ssl +!MESSAGE debug-zlib-dll - debug static library with dynamic zlib +!MESSAGE debug-ssl-dll-zlib-dll - debug static library with dynamic ssl and dynamic zlib +!MESSAGE debug-dll - debug dynamic library +!MESSAGE debug-dll-ssl-dll - debug dynamic library with dynamic ssl +!MESSAGE debug-dll-zlib-dll - debug dynamic library with dynamic zlib1 +!MESSAGE debug-dll-ssl-dll-zlib-dll - debug dynamic library with dynamic ssl and dynamic zlib +!MESSAGE can be left blank in which case all is assumed +!ERROR please choose a valid configuration "$(CFG)" +!ENDIF + +####################### +# Only the clean target can be used if a config was not provided. +# +!IF "$(CFGSET)" == "FALSE" +clean: + @-erase /s *.dll 2> NUL + @-erase /s *.exp 2> NUL + @-erase /s *.idb 2> NUL + @-erase /s *.lib 2> NUL + @-erase /s *.obj 2> NUL + @-erase /s *.pch 2> NUL + @-erase /s *.pdb 2> NUL + @-erase /s *.res 2> NUL +!ELSE +# A config was provided, so the library can be built. +# +X_OBJS= \ + $(DIROBJ)\base64.obj \ + $(DIROBJ)\connect.obj \ + $(DIROBJ)\content_encoding.obj \ + $(DIROBJ)\cookie.obj \ + $(DIROBJ)\curl_addrinfo.obj \ + $(DIROBJ)\curl_fnmatch.obj \ + $(DIROBJ)\curl_gethostname.obj \ + $(DIROBJ)\curl_memrchr.obj \ + $(DIROBJ)\curl_rand.obj \ + $(DIROBJ)\curl_rtmp.obj \ + $(DIROBJ)\curl_sspi.obj \ + $(DIROBJ)\curl_threads.obj \ + $(DIROBJ)\dict.obj \ + $(DIROBJ)\easy.obj \ + $(DIROBJ)\escape.obj \ + $(DIROBJ)\fileinfo.obj \ + $(DIROBJ)\file.obj \ + $(DIROBJ)\formdata.obj \ + $(DIROBJ)\ftplistparser.obj \ + $(DIROBJ)\ftp.obj \ + $(DIROBJ)\getenv.obj \ + $(DIROBJ)\getinfo.obj \ + $(DIROBJ)\gtls.obj \ + $(DIROBJ)\gopher.obj \ + $(DIROBJ)\hash.obj \ + $(DIROBJ)\hmac.obj \ + $(DIROBJ)\hostares.obj \ + $(DIROBJ)\hostasyn.obj \ + $(DIROBJ)\hostip4.obj \ + $(DIROBJ)\hostip6.obj \ + $(DIROBJ)\hostip.obj \ + $(DIROBJ)\hostsyn.obj \ + $(DIROBJ)\hostthre.obj \ + $(DIROBJ)\http_chunks.obj \ + $(DIROBJ)\http_digest.obj \ + $(DIROBJ)\http_negotiate.obj \ + $(DIROBJ)\http_ntlm.obj \ + $(DIROBJ)\http.obj \ + $(DIROBJ)\if2ip.obj \ + $(DIROBJ)\imap.obj \ + $(DIROBJ)\inet_ntop.obj \ + $(DIROBJ)\inet_pton.obj \ + $(DIROBJ)\ldap.obj \ + $(DIROBJ)\llist.obj \ + $(DIROBJ)\md4.obj \ + $(DIROBJ)\md5.obj \ + $(DIROBJ)\memdebug.obj \ + $(DIROBJ)\mprintf.obj \ + $(DIROBJ)\multi.obj \ + $(DIROBJ)\netrc.obj \ + $(DIROBJ)\nonblock.obj \ + $(DIROBJ)\openldap.obj \ + $(DIROBJ)\parsedate.obj \ + $(DIROBJ)\pingpong.obj \ + $(DIROBJ)\polarssl.obj \ + $(DIROBJ)\pop3.obj \ + $(DIROBJ)\progress.obj \ + $(DIROBJ)\rawstr.obj \ + $(DIROBJ)\rtsp.obj \ + $(DIROBJ)\select.obj \ + $(DIROBJ)\sendf.obj \ + $(DIROBJ)\share.obj \ + $(DIROBJ)\slist.obj \ + $(DIROBJ)\smtp.obj \ + $(DIROBJ)\socks_gssapi.obj \ + $(DIROBJ)\socks.obj \ + $(DIROBJ)\socks_sspi.obj \ + $(DIROBJ)\speedcheck.obj \ + $(DIROBJ)\splay.obj \ + $(DIROBJ)\ssh.obj \ + $(DIROBJ)\sslgen.obj \ + $(DIROBJ)\ssluse.obj \ + $(DIROBJ)\strequal.obj \ + $(DIROBJ)\strerror.obj \ + $(DIROBJ)\strtok.obj \ + $(DIROBJ)\strtoofft.obj \ + $(DIROBJ)\telnet.obj \ + $(DIROBJ)\tftp.obj \ + $(DIROBJ)\timeval.obj \ + $(DIROBJ)\transfer.obj \ + $(DIROBJ)\url.obj \ + $(DIROBJ)\version.obj \ + $(DIROBJ)\warnless.obj \ + $(DIROBJ)\wildcard.obj \ + $(RESOURCE) + +all : $(TARGET) + +$(TARGET): $(X_OBJS) + $(LNK) $(LFLAGS) $(X_OBJS) + -xcopy $(DIROBJ)\$(LIB_NAME).dll . /y + -xcopy $(DIROBJ)\$(LIB_NAME).lib . /y + -xcopy $(DIROBJ)\$(LIB_NAME_DEBUG).dll . /y + -xcopy $(DIROBJ)\$(LIB_NAME_DEBUG).lib . /y + -xcopy $(DIROBJ)\$(IMPLIB_NAME).lib . /y + -xcopy $(DIROBJ)\$(IMPLIB_NAME_DEBUG).lib . /y + -xcopy $(DIROBJ)\*.exp . /y + -xcopy $(DIROBJ)\*.pdb . /y + +$(X_OBJS): $(DIROBJ) + +$(DIROBJ): + @if not exist "$(DIROBJ)" mkdir $(DIROBJ) + +.SUFFIXES: .c .obj .res + +{.\}.c{$(DIROBJ)\}.obj: + $(CC) $(CFLAGS) /Fo"$@" $< + +debug-dll\libcurl.res \ +debug-dll-ssl-dll\libcurl.res \ +debug-dll-zlib-dll\libcurl.res \ +debug-dll-ssl-dll-zlib-dll\libcurl.res: libcurl.rc + rc /dDEBUGBUILD=1 /Fo $@ libcurl.rc + +release-dll\libcurl.res \ +release-dll-ssl-dll\libcurl.res \ +release-dll-zlib-dll\libcurl.res \ +release-dll-ssl-dll-zlib-dll\libcurl.res: libcurl.rc + rc /dDEBUGBUILD=0 /Fo $@ libcurl.rc +!ENDIF # End of case where a config was provided. diff --git a/mobicore/common/curl/lib/Makefile.vc9 b/mobicore/common/curl/lib/Makefile.vc9 new file mode 100644 index 0000000000000000000000000000000000000000..7d5eb2fb6d494c01e544a7e931eb33e3014b2e2e --- /dev/null +++ b/mobicore/common/curl/lib/Makefile.vc9 @@ -0,0 +1,571 @@ +#*************************************************************************** +# _ _ ____ _ +# Project ___| | | | _ \| | +# / __| | | | |_) | | +# | (__| |_| | _ <| |___ +# \___|\___/|_| \_\_____| +# +# Copyright (C) 1999 - 2010, Daniel Stenberg, , et al. +# +# This software is licensed as described in the file COPYING, which +# you should have received as part of this distribution. The terms +# are also available at http://curl.haxx.se/docs/copyright.html. +# +# You may opt to use, copy, modify, merge, publish, distribute and/or sell +# copies of the Software, and permit persons to whom the Software is +# furnished to do so, under the terms of the COPYING file. +# +# This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY +# KIND, either express or implied. +# +########################################################################### +# +# Makefile for building libcurl with MSVC9 +# +# Usage: see usage message below +# Should be invoked from \lib directory +# Edit the paths and desired library name +# SSL path is only required if you intend compiling +# with SSL. +# +# This make file leaves the result either a .lib or .dll file +# in the \lib directory. It should be called from the \lib +# directory. +# +# An option would have been to allow the source directory to +# be specified, but I saw no requirement. +# +# Another option would have been to leave the .lib and .dll +# files in the "cfg" directory, but then the make file +# in \src would need to be changed. +# +############################################################## + +# +# Stem for static libs and DLLs +# +LIB_NAME = libcurl +LIB_NAME_DEBUG = libcurld + +# +# Stem for DLL import libs +# +IMPLIB_NAME = libcurl_imp +IMPLIB_NAME_DEBUG = libcurld_imp + +!IFNDEF OPENSSL_PATH +OPENSSL_PATH = ../../openssl-0.9.8o +!ENDIF + +!IFNDEF ZLIB_PATH +ZLIB_PATH = ../../zlib-1.2.5 +!ENDIF + +!IFNDEF MACHINE +MACHINE = X86 +!ENDIF + +# USE_WINDOWS_SSPI uses windows libraries to allow NTLM authentication +# without an openssl installation and offers the ability to authenticate +# using the "current logged in user". Since at least with MSVC9 the sspi.h +# header is broken it is either required to install the Windows SDK, +# or to fix sspi.h with adding this define at the beginning of sspi.h: +# #define FreeCredentialHandle FreeCredentialsHandle +# +# If, for some reason the Windows SDK is installed but not installed +# in the default location, you can specify WINDOWS_SDK_PATH. +# It can be downloaded from: +# http://www.microsoft.com/msdownload/platformsdk/sdkupdate/ + +# WINDOWS_SSPI = 1 + +!IFDEF WINDOWS_SSPI +!IFNDEF WINDOWS_SDK_PATH +WINDOWS_SDK_PATH = "C:\Program Files\Microsoft SDK" +!ENDIF +!ENDIF + +############################################################# +## Nothing more to do below this line! + +CCNODBG = cl.exe /O2 /DNDEBUG +CCDEBUG = cl.exe /Od /Gm /Zi /D_DEBUG /RTC1 +CFLAGSSSL = /DUSE_SSLEAY /I "$(OPENSSL_PATH)/inc32" /I "$(OPENSSL_PATH)/inc32/openssl" +CFLAGSZLIB = /DHAVE_ZLIB_H /DHAVE_ZLIB /DHAVE_LIBZ /I "$(ZLIB_PATH)" +CFLAGS = /I. /I../include /nologo /W3 /EHsc /DWIN32 /FD /c /DBUILDING_LIBCURL +CFLAGSLIB = /DCURL_STATICLIB +LNKDLL = link.exe /DLL +LNKLIB = link.exe /lib +LFLAGS = /nologo /machine:$(MACHINE) +SSLLIBS = libeay32.lib ssleay32.lib +ZLIBLIBSDLL= zdll.lib +ZLIBLIBS = zlib.lib +WINLIBS = ws2_32.lib wldap32.lib +CFLAGS = $(CFLAGS) + +CFGSET = FALSE + +!IFDEF WINDOWS_SSPI +CFLAGS = $(CFLAGS) /DUSE_WINDOWS_SSPI /I$(WINDOWS_SDK_PATH)\include +!ENDIF + +!IFDEF USE_IPV6 +CFLAGS = $(CFLAGS) /DUSE_IPV6 +!ENDIF + +############################################################## +# Runtime library configuration + +RTLIB = /MD +RTLIBD = /MDd + +!IF "$(RTLIBCFG)" == "static" +RTLIB = /MT +RTLIBD = /MTd +!ENDIF + + +###################### +# release + +!IF "$(CFG)" == "release" +TARGET = $(LIB_NAME).lib +DIROBJ = $(CFG) +LNK = $(LNKLIB) /out:$(DIROBJ)\$(TARGET) +CC = $(CCNODBG) $(RTLIB) $(CFLAGSLIB) +CFGSET = TRUE +!ENDIF + +###################### +# release-zlib + +!IF "$(CFG)" == "release-zlib" +TARGET = $(LIB_NAME).lib +DIROBJ = $(CFG) +LFLAGSZLIB = "/LIBPATH:$(ZLIB_PATH)" +LNK = $(LNKLIB) $(ZLIBLIBS) $(LFLAGSZLIB) /out:$(DIROBJ)\$(TARGET) +CC = $(CCNODBG) $(RTLIB) $(CFLAGSZLIB) $(CFLAGSLIB) +CFGSET = TRUE +!ENDIF + +###################### +# release-dll + +!IF "$(CFG)" == "release-dll" +TARGET = $(LIB_NAME).dll +DIROBJ = $(CFG) +LNK = $(LNKDLL) $(WINLIBS) /out:$(DIROBJ)\$(TARGET) /IMPLIB:$(DIROBJ)\$(IMPLIB_NAME).lib +CC = $(CCNODBG) $(RTLIB) +CFGSET = TRUE +RESOURCE = $(DIROBJ)\libcurl.res +!ENDIF + +###################### +# release-ssl + +!IF "$(CFG)" == "release-ssl" +TARGET = $(LIB_NAME).lib +DIROBJ = $(CFG) +LFLAGSSSL = "/LIBPATH:$(OPENSSL_PATH)\out32" +LNK = $(LNKLIB) $(LFLAGSSSL) /out:$(DIROBJ)\$(TARGET) +CC = $(CCNODBG) $(RTLIB) $(CFLAGSSSL) $(CFLAGSLIB) +CFGSET = TRUE +!ENDIF + +###################### +# release-ssl-dll + +!IF "$(CFG)" == "release-ssl-dll" +TARGET = $(LIB_NAME).lib +DIROBJ = $(CFG) +LFLAGSSSL = "/LIBPATH:$(OPENSSL_PATH)\out32dll" +LNK = $(LNKLIB) $(WINLIBS) $(SSLLIBS) $(LFLAGSSSL) /out:$(DIROBJ)\$(TARGET) +CC = $(CCNODBG) $(RTLIB) $(CFLAGSSSL) $(CFLAGSLIB) +CFGSET = TRUE +!ENDIF + +###################### +# release-ssl-zlib + +!IF "$(CFG)" == "release-ssl-zlib" +TARGET = $(LIB_NAME).lib +DIROBJ = $(CFG) +LFLAGSSSL = "/LIBPATH:$(OPENSSL_PATH)\out32" +LFLAGSZLIB = "/LIBPATH:$(ZLIB_PATH)" +LNK = $(LNKLIB) $(LFLAGSSSL) $(LFLAGSZLIB) /out:$(DIROBJ)\$(TARGET) +CC = $(CCNODBG) $(RTLIB) $(CFLAGSSSL) $(CFLAGSZLIB) $(CFLAGSLIB) +CFGSET = TRUE +!ENDIF + +###################### +# release-dll-ssl-dll + +!IF "$(CFG)" == "release-dll-ssl-dll" +TARGET = $(LIB_NAME).dll +DIROBJ = $(CFG) +LFLAGSSSL = "/LIBPATH:$(OPENSSL_PATH)\out32dll" +LNK = $(LNKDLL) $(WINLIBS) $(SSLLIBS) $(LFLAGSSSL) /out:$(DIROBJ)\$(TARGET) /IMPLIB:$(DIROBJ)\$(IMPLIB_NAME).lib +CC = $(CCNODBG) $(RTLIB) $(CFLAGSSSL) +CFGSET = TRUE +RESOURCE = $(DIROBJ)\libcurl.res +!ENDIF + +###################### +# release-zlib-dll + +!IF "$(CFG)" == "release-zlib-dll" +TARGET = $(LIB_NAME).lib +DIROBJ = $(CFG) +LFLAGSZLIB = "/LIBPATH:$(ZLIB_PATH)" +LNK = $(LNKLIB) $(WINLIBS) $(ZLIBLIBSDLL) $(LFLAGSZLIB) /out:$(DIROBJ)\$(TARGET) +CC = $(CCNODBG) $(RTLIB) $(CFLAGSZLIB) $(CFLAGSLIB) +CFGSET = TRUE +!ENDIF + +###################### +# release-ssl-dll-zlib-dll + +!IF "$(CFG)" == "release-ssl-dll-zlib-dll" +TARGET = $(LIB_NAME).lib +DIROBJ = $(CFG) +LFLAGSZLIB = "/LIBPATH:$(ZLIB_PATH)" +LFLAGSSSL = "/LIBPATH:$(OPENSSL_PATH)\out32dll" +LNK = $(LNKLIB) $(WINLIBS) $(SSLLIBS) $(ZLIBLIBSDLL) $(LFLAGSSSL) $(LFLAGSZLIB) /out:$(DIROBJ)\$(TARGET) +CC = $(CCNODBG) $(RTLIB) $(CFLAGSSSL) $(CFLAGSZLIB) $(CFLAGSLIB) +CFGSET = TRUE +!ENDIF + +###################### +# release-dll-zlib-dll + +!IF "$(CFG)" == "release-dll-zlib-dll" +TARGET = $(LIB_NAME).dll +DIROBJ = $(CFG) +LFLAGSZLIB = "/LIBPATH:$(ZLIB_PATH)" +LNK = $(LNKDLL) $(WINLIBS) $(ZLIBLIBSDLL) $(LFLAGSZLIB) /out:$(DIROBJ)\$(TARGET) /IMPLIB:$(DIROBJ)\$(IMPLIB_NAME).lib +CC = $(CCNODBG) $(RTLIB) $(CFLAGSZLIB) +CFGSET = TRUE +RESOURCE = $(DIROBJ)\libcurl.res +!ENDIF + +###################### +# release-dll-ssl-dll-zlib-dll + +!IF "$(CFG)" == "release-dll-ssl-dll-zlib-dll" +TARGET = $(LIB_NAME).dll +DIROBJ = $(CFG) +LFLAGSZLIB = "/LIBPATH:$(ZLIB_PATH)" +LFLAGSSSL = "/LIBPATH:$(OPENSSL_PATH)\out32dll" +LNK = $(LNKDLL) $(WINLIBS) $(SSLLIBS) $(ZLIBLIBSDLL) $(LFLAGSSSL) $(LFLAGSZLIB) /out:$(DIROBJ)\$(TARGET) /IMPLIB:$(DIROBJ)\$(IMPLIB_NAME).lib +CC = $(CCNODBG) $(RTLIB) $(CFLAGSSSL) $(CFLAGSZLIB) +CFGSET = TRUE +RESOURCE = $(DIROBJ)\libcurl.res +!ENDIF + +###################### +# debug + +!IF "$(CFG)" == "debug" +TARGET = $(LIB_NAME_DEBUG).lib +DIROBJ = $(CFG) +LNK = $(LNKLIB) /out:$(DIROBJ)\$(TARGET) +CC = $(CCDEBUG) $(RTLIBD) $(CFLAGSLIB) +CFGSET = TRUE +!ENDIF + +###################### +# debug-ssl + +!IF "$(CFG)" == "debug-ssl" +TARGET = $(LIB_NAME_DEBUG).lib +DIROBJ = $(CFG) +LFLAGSSSL = "/LIBPATH:$(OPENSSL_PATH)\out32" +LNK = $(LNKLIB) $(LFLAGSSSL) /out:$(DIROBJ)\$(TARGET) +CC = $(CCDEBUG) $(RTLIBD) $(CFLAGSSSL) $(CFLAGSLIB) +CFGSET = TRUE +!ENDIF + +###################### +# debug-zlib + +!IF "$(CFG)" == "debug-zlib" +TARGET = $(LIB_NAME_DEBUG).lib +DIROBJ = $(CFG) +LFLAGSZLIB = "/LIBPATH:$(ZLIB_PATH)" +LNK = $(LNKLIB) $(ZLIBLIBS) $(LFLAGSZLIB) /out:$(DIROBJ)\$(TARGET) +CC = $(CCDEBUG) $(RTLIBD) $(CFLAGSZLIB) $(CFLAGSLIB) +CFGSET = TRUE +!ENDIF + +###################### +# debug-ssl-dll + +!IF "$(CFG)" == "debug-ssl-dll" +TARGET = $(LIB_NAME_DEBUG).lib +DIROBJ = $(CFG) +LFLAGSSSL = /LIBPATH:$(OPENSSL_PATH)\out32dll +LNK = $(LNKLIB) $(WINLIBS) $(SSLLIBS) $(LFLAGSSSL) /out:$(DIROBJ)\$(TARGET) +CC = $(CCDEBUG) $(RTLIBD) $(CFLAGSSSL) $(CFLAGSLIB) +CFGSET = TRUE +!ENDIF + +###################### +# debug-ssl-zlib + +!IF "$(CFG)" == "debug-ssl-zlib" +TARGET = $(LIB_NAME_DEBUG).lib +DIROBJ = $(CFG) +LFLAGSZLIB = "/LIBPATH:$(ZLIB_PATH)" +LFLAGSSSL = "/LIBPATH:$(OPENSSL_PATH)\out32" +LNK = $(LNKLIB) $(ZLIBLIBS) $(LFLAGSSSL) $(LFLAGSZLIB) /out:$(DIROBJ)\$(TARGET) +CC = $(CCDEBUG) $(RTLIBD) $(CFLAGSSSL) $(CFLAGSZLIB) $(CFLAGSLIB) +CFGSET = TRUE +!ENDIF + +###################### +# debug-zlib-dll + +!IF "$(CFG)" == "debug-zlib-dll" +TARGET = $(LIB_NAME_DEBUG).lib +DIROBJ = $(CFG) +LFLAGSZLIB = "/LIBPATH:$(ZLIB_PATH)" +LNK = $(LNKLIB) $(WINLIBS) $(ZLIBLIBSDLL) $(LFLAGSZLIB) /out:$(DIROBJ)\$(TARGET) +CC = $(CCDEBUG) $(RTLIBD) $(CFLAGSZLIB) $(CFLAGSLIB) +CFGSET = TRUE +!ENDIF + +###################### +# debug-ssl-dll-zlib-dll + +!IF "$(CFG)" == "debug-ssl-dll-zlib-dll" +TARGET = $(LIB_NAME_DEBUG).lib +DIROBJ = $(CFG) +LFLAGSZLIB = "/LIBPATH:$(ZLIB_PATH)" +LFLAGSSSL = "/LIBPATH:$(OPENSSL_PATH)\out32dll" +LNK = $(LNKLIB) $(WINLIBS) $(SSLLIBS) $(ZLIBLIBSDLL) $(LFLAGSSSL) $(LFLAGSZLIB) /out:$(DIROBJ)\$(TARGET) +CC = $(CCDEBUG) $(RTLIBD) $(CFLAGSSSL) $(CFLAGSZLIB) $(CFLAGSLIB) +CFGSET = TRUE +!ENDIF + +###################### +# debug-dll + +!IF "$(CFG)" == "debug-dll" +TARGET = $(LIB_NAME_DEBUG).dll +DIROBJ = $(CFG) +LNK = $(LNKDLL) $(WINLIBS) /DEBUG /out:$(DIROBJ)\$(TARGET) /IMPLIB:$(DIROBJ)\$(IMPLIB_NAME_DEBUG).lib /PDB:$(DIROBJ)\$(IMPLIB_NAME_DEBUG).pdb +CC = $(CCDEBUG) $(RTLIBD) +CFGSET = TRUE +RESOURCE = $(DIROBJ)\libcurl.res +!ENDIF + +###################### +# debug-dll-ssl-dll + +!IF "$(CFG)" == "debug-dll-ssl-dll" +TARGET = $(LIB_NAME_DEBUG).dll +DIROBJ = $(CFG) +LFLAGSSSL = "/LIBPATH:$(OPENSSL_PATH)\out32dll" +LNK = $(LNKDLL) $(WINLIBS) $(SSLLIBS) $(LFLAGSSSL) /DEBUG /out:$(DIROBJ)\$(TARGET) /IMPLIB:$(DIROBJ)\$(IMPLIB_NAME_DEBUG).lib /PDB:$(DIROBJ)\$(IMPLIB_NAME_DEBUG).pdb +CC = $(CCDEBUG) $(RTLIBD) $(CFLAGSSSL) +CFGSET = TRUE +RESOURCE = $(DIROBJ)\libcurl.res +!ENDIF + +###################### +# debug-dll-zlib-dll + +!IF "$(CFG)" == "debug-dll-zlib-dll" +TARGET = $(LIB_NAME_DEBUG).dll +DIROBJ = $(CFG) +LFLAGSZLIB = "/LIBPATH:$(ZLIB_PATH)" +LNK = $(LNKDLL) $(WINLIBS) $(ZLIBLIBSDLL) $(LFLAGSZLIB) /DEBUG /out:$(DIROBJ)\$(TARGET) /IMPLIB:$(DIROBJ)\$(IMPLIB_NAME_DEBUG).lib /PDB:$(DIROBJ)\$(IMPLIB_NAME_DEBUG).pdb +CC = $(CCDEBUG) $(RTLIBD) $(CFLAGSZLIB) +CFGSET = TRUE +RESOURCE = $(DIROBJ)\libcurl.res +!ENDIF + +###################### +# debug-dll-ssl-dll-zlib-dll + +!IF "$(CFG)" == "debug-dll-ssl-dll-zlib-dll" +TARGET = $(LIB_NAME_DEBUG).dll +DIROBJ = $(CFG) +LFLAGSZLIB = "/LIBPATH:$(ZLIB_PATH)" +LFLAGSSSL = "/LIBPATH:$(OPENSSL_PATH)\out32dll" +LNK = $(LNKDLL) $(WINLIBS) $(SSLLIBS) $(ZLIBLIBSDLL) $(LFLAGSSSL) $(LFLAGSZLIB) /DEBUG /out:$(DIROBJ)\$(TARGET) /IMPLIB:$(DIROBJ)\$(IMPLIB_NAME_DEBUG).lib /PDB:$(DIROBJ)\$(IMPLIB_NAME_DEBUG).pdb +CC = $(CCDEBUG) $(RTLIBD) $(CFLAGSSSL) $(CFLAGSZLIB) +CFGSET = TRUE +RESOURCE = $(DIROBJ)\libcurl.res +!ENDIF + +####################### +# Usage +# +!IF "$(CFGSET)" == "FALSE" && "$(CFG)" != "" +!MESSAGE Usage: nmake /f makefile.vc9 CFG= +!MESSAGE where is one of: +!MESSAGE release - release static library +!MESSAGE release-ssl - release static library with ssl +!MESSAGE release-zlib - release static library with zlib +!MESSAGE release-ssl-zlib - release static library with ssl and zlib +!MESSAGE release-ssl-dll - release static library with dynamic ssl +!MESSAGE release-zlib-dll - release static library with dynamic zlib +!MESSAGE release-ssl-dll-zlib-dll - release static library with dynamic ssl and dynamic zlib +!MESSAGE release-dll - release dynamic library +!MESSAGE release-dll-ssl-dll - release dynamic library with dynamic ssl +!MESSAGE release-dll-zlib-dll - release dynamic library with dynamic zlib +!MESSAGE release-dll-ssl-dll-zlib-dll - release dynamic library with dynamic ssl and dynamic zlib +!MESSAGE debug - debug static library +!MESSAGE debug-ssl - debug static library with ssl +!MESSAGE debug-zlib - debug static library with zlib +!MESSAGE debug-ssl-zlib - debug static library with ssl and zlib +!MESSAGE debug-ssl-dll - debug static library with dynamic ssl +!MESSAGE debug-zlib-dll - debug static library with dynamic zlib +!MESSAGE debug-ssl-dll-zlib-dll - debug static library with dynamic ssl and dynamic zlib +!MESSAGE debug-dll - debug dynamic library +!MESSAGE debug-dll-ssl-dll - debug dynamic library with dynamic ssl +!MESSAGE debug-dll-zlib-dll - debug dynamic library with dynamic zlib1 +!MESSAGE debug-dll-ssl-dll-zlib-dll - debug dynamic library with dynamic ssl and dynamic zlib +!MESSAGE can be left blank in which case all is assumed +!ERROR please choose a valid configuration "$(CFG)" +!ENDIF + +####################### +# Only the clean target can be used if a config was not provided. +# +!IF "$(CFGSET)" == "FALSE" +clean: + @-erase /s *.dll 2> NUL + @-erase /s *.exp 2> NUL + @-erase /s *.idb 2> NUL + @-erase /s *.lib 2> NUL + @-erase /s *.obj 2> NUL + @-erase /s *.pch 2> NUL + @-erase /s *.pdb 2> NUL + @-erase /s *.res 2> NUL +!ELSE +# A config was provided, so the library can be built. +# +X_OBJS= \ + $(DIROBJ)\base64.obj \ + $(DIROBJ)\connect.obj \ + $(DIROBJ)\content_encoding.obj \ + $(DIROBJ)\cookie.obj \ + $(DIROBJ)\curl_addrinfo.obj \ + $(DIROBJ)\curl_fnmatch.obj \ + $(DIROBJ)\curl_gethostname.obj \ + $(DIROBJ)\curl_memrchr.obj \ + $(DIROBJ)\curl_rand.obj \ + $(DIROBJ)\curl_rtmp.obj \ + $(DIROBJ)\curl_sspi.obj \ + $(DIROBJ)\curl_threads.obj \ + $(DIROBJ)\dict.obj \ + $(DIROBJ)\easy.obj \ + $(DIROBJ)\escape.obj \ + $(DIROBJ)\fileinfo.obj \ + $(DIROBJ)\file.obj \ + $(DIROBJ)\formdata.obj \ + $(DIROBJ)\ftplistparser.obj \ + $(DIROBJ)\ftp.obj \ + $(DIROBJ)\getenv.obj \ + $(DIROBJ)\getinfo.obj \ + $(DIROBJ)\gtls.obj \ + $(DIROBJ)\gopher.obj \ + $(DIROBJ)\hash.obj \ + $(DIROBJ)\hmac.obj \ + $(DIROBJ)\hostares.obj \ + $(DIROBJ)\hostasyn.obj \ + $(DIROBJ)\hostip4.obj \ + $(DIROBJ)\hostip6.obj \ + $(DIROBJ)\hostip.obj \ + $(DIROBJ)\hostsyn.obj \ + $(DIROBJ)\hostthre.obj \ + $(DIROBJ)\http_chunks.obj \ + $(DIROBJ)\http_digest.obj \ + $(DIROBJ)\http_negotiate.obj \ + $(DIROBJ)\http_ntlm.obj \ + $(DIROBJ)\http.obj \ + $(DIROBJ)\if2ip.obj \ + $(DIROBJ)\imap.obj \ + $(DIROBJ)\inet_ntop.obj \ + $(DIROBJ)\inet_pton.obj \ + $(DIROBJ)\ldap.obj \ + $(DIROBJ)\llist.obj \ + $(DIROBJ)\md4.obj \ + $(DIROBJ)\md5.obj \ + $(DIROBJ)\memdebug.obj \ + $(DIROBJ)\mprintf.obj \ + $(DIROBJ)\multi.obj \ + $(DIROBJ)\netrc.obj \ + $(DIROBJ)\nonblock.obj \ + $(DIROBJ)\openldap.obj \ + $(DIROBJ)\parsedate.obj \ + $(DIROBJ)\pingpong.obj \ + $(DIROBJ)\polarssl.obj \ + $(DIROBJ)\pop3.obj \ + $(DIROBJ)\progress.obj \ + $(DIROBJ)\rawstr.obj \ + $(DIROBJ)\rtsp.obj \ + $(DIROBJ)\select.obj \ + $(DIROBJ)\sendf.obj \ + $(DIROBJ)\share.obj \ + $(DIROBJ)\slist.obj \ + $(DIROBJ)\smtp.obj \ + $(DIROBJ)\socks_gssapi.obj \ + $(DIROBJ)\socks.obj \ + $(DIROBJ)\socks_sspi.obj \ + $(DIROBJ)\speedcheck.obj \ + $(DIROBJ)\splay.obj \ + $(DIROBJ)\ssh.obj \ + $(DIROBJ)\sslgen.obj \ + $(DIROBJ)\ssluse.obj \ + $(DIROBJ)\strequal.obj \ + $(DIROBJ)\strerror.obj \ + $(DIROBJ)\strtok.obj \ + $(DIROBJ)\strtoofft.obj \ + $(DIROBJ)\telnet.obj \ + $(DIROBJ)\tftp.obj \ + $(DIROBJ)\timeval.obj \ + $(DIROBJ)\transfer.obj \ + $(DIROBJ)\url.obj \ + $(DIROBJ)\version.obj \ + $(DIROBJ)\warnless.obj \ + $(DIROBJ)\wildcard.obj \ + $(RESOURCE) + +all : $(TARGET) + +$(TARGET): $(X_OBJS) + $(LNK) $(LFLAGS) $(X_OBJS) + -xcopy $(DIROBJ)\$(LIB_NAME).dll . /y + -xcopy $(DIROBJ)\$(LIB_NAME).lib . /y + -xcopy $(DIROBJ)\$(LIB_NAME_DEBUG).dll . /y + -xcopy $(DIROBJ)\$(LIB_NAME_DEBUG).lib . /y + -xcopy $(DIROBJ)\$(IMPLIB_NAME).lib . /y + -xcopy $(DIROBJ)\$(IMPLIB_NAME_DEBUG).lib . /y + -xcopy $(DIROBJ)\*.exp . /y + -xcopy $(DIROBJ)\*.pdb . /y + +$(X_OBJS): $(DIROBJ) + +$(DIROBJ): + @if not exist "$(DIROBJ)" mkdir $(DIROBJ) + +.SUFFIXES: .c .obj .res + +{.\}.c{$(DIROBJ)\}.obj: + $(CC) $(CFLAGS) /Fo"$@" $< + +debug-dll\libcurl.res \ +debug-dll-ssl-dll\libcurl.res \ +debug-dll-zlib-dll\libcurl.res \ +debug-dll-ssl-dll-zlib-dll\libcurl.res: libcurl.rc + rc /dDEBUGBUILD=1 /Fo $@ libcurl.rc + +release-dll\libcurl.res \ +release-dll-ssl-dll\libcurl.res \ +release-dll-zlib-dll\libcurl.res \ +release-dll-ssl-dll-zlib-dll\libcurl.res: libcurl.rc + rc /dDEBUGBUILD=0 /Fo $@ libcurl.rc +!ENDIF # End of case where a config was provided. diff --git a/mobicore/common/curl/lib/Makefile.vxworks b/mobicore/common/curl/lib/Makefile.vxworks new file mode 100644 index 0000000000000000000000000000000000000000..796d1605ec37e7ee8dc46d1eaab4ab8f29859ac9 --- /dev/null +++ b/mobicore/common/curl/lib/Makefile.vxworks @@ -0,0 +1,177 @@ +#***************************************************************************** +# +# +#Filename : Makefile.vxworks +#Description: makefile to be used in order to compile libcurl for VxWoorks 6.3. +# +#How to use: +# 1. Adjust environment variables at the file begining +# 2. Open the Command Prompt window and change directory ('cd') +# into the 'lib' folder +# 3. Add /bin folder to the PATH environment variable +# For example type 'set PATH=C:/embedded/cygwin/bin;%PATH%' +# 4. Build the library by typing 'make -f ./Makefile.vxworks' +# As a result the libcurl.a should be created in the 'lib' folder. +# To clean package use 'make -f ./Makefile.vxworks clean' +#Requirements: +# 1. WinXP machine +# 2. Full CYGWIN installation (open source) with GNU make version +# v3.78 or higher +# 3. WindRiver Workbench with vxWorks 6.3 (commercial) +#***************************************************************************** + +# ---------------------------------------------------------------------- +# Environment +# ---------------------------------------------------------------------- + +export WIND_HOME := C:/embedded/Workbench2.5.0.1 +export WIND_BASE := $(WIND_HOME)/vxworks-6.3 +export WIND_HOST_TYPE := x86-win32 + +# BUILD_TYE:= | (build with debugging info or optimized) +BUILD_TYPE := debug +USER_CFLAGS:= + +# directories where to seek for includes and libraries +OPENSSL_INC := D:/libraries/openssl/openssl-0.9.8a-vxWorks6.3/include +OPENSSL_LIB := D:/libraries/openssl/openssl-0.9.8a-vxWorks6.3 +ZLIB_INC := D:/libraries/zlib/zlib-1.2.3-VxWorks6.3/zlib-1.2.3 +ZLIB_LIB := D:/libraries/zlib/zlib-1.2.3-VxWorks6.3/binaries/vxworks_3.1_gnu/Debug/lib +ARES_INC := +ARES_LIB := + + +# ---------------------------------------------------------------------- +# Compiler +# ---------------------------------------------------------------------- + +CC := ccppc +AR := arppc +LINK := ccppc +CFLAGS := -D__GNUC__ -D__ppc__ -msoft-float -fno-builtin -mcpu=604 -mlongcall -DCPU=PPC604 -D_GNU_TOOL -Wall -W -Winline $(USER_CFLAGS) +LDFLAGS := -nostdlib -Wl,-i -Wl,-X +INCLUDE_FLAG := -I +C_DEBUGFLAG := -g +C_OPTFLAG := -O2 +COMPILE_ONLY_FLAG := -c +OBJ_EXTENSION := .o +CC_OBJ_OUTPUT = -o $@ +ARFLAGS := -rc +LIBS_FLAG := -l +LIBS_DIRFLAG:= -L +LD_DEBUGFLAG := $(C_DEBUGFLAG) +EXECUTE_EXTENSION := .out +TOOL_CHAIN_BIN := $(WIND_HOME)/gnu/3.4.4-vxworks-6.3/$(WIND_HOST_TYPE)/bin/ + +# ---------------------------------------------------------------------- + +# Add -DINET6 if the OS kernel image was built with IPv6 support +# CFLAGS += -DINET6 + +# Set up compiler and linker flags for debug or optimization +ifeq ($(BUILD_TYPE), debug) +CFLAGS += $(C_DEBUGFLAG) +LDFLAGS += $(LD_DEBUGFLAG) +else +CFLAGS += $(C_OPTFLAG) +endif + +# ---------------------------------------------------------------------- + +# Main Makefile and possible sub-make files +MAKEFILES := Makefile.vxworks + +# List of external include directories +#----- +# IMPORTANT: include OPENSSL directories before system +# in order to prevent WindRiver OpenSSL to be used. +#----- +INCLUDE_DIRS := ../include $(OPENSSL_INC) $(ZLIB_INC) $(ARES_INC) $(WIND_BASE)/target/h $(WIND_BASE)/target/h/wrn/coreip + +# List of external libraries and their directories +LIBS_LIST := . +LIB_DIRS := . +ifneq ($(OPENSSL_LIB), ) +LIBS_LIST += crypto ssl +LIB_DIRS += $(OPENSSL_LIB) +endif +ifneq ($(ZLIB_LIB), ) +LIBS_LIST += z +LIB_DIRS += $(ZLIB_LIB) +endif +ifneq ($(ARES_LIB), ) +LIBS_LIST += ares +LIB_DIRS += $(ARES_LIB) +endif + +# Add include and library directories and libraries +CFLAGS += $(INCLUDE_DIRS:%=$(INCLUDE_FLAG)%) +LDFLAGS += $(LIB_DIRS:%=$(LIBS_DIRFLAG)%) + +# List of targets to make for libs target +LIBS_TARGET_LIST := libcurl.a + +# List of execuatble applications to make in addition to libs for all target +EXE_TARGET_LIST := + +# Support for echoing rules +# If ECHORULES variable was set (for example, using 'make' command line) +# some shell commands in the rules will be echoed +ifneq ($(strip $(findstring $(ECHORULES), yes YES 1 true TRUE)),) +_@_ := +else +_@_ := @ +endif + +# Directory to hold compilation intermediate files +TMP_DIR := tmp + +# Get sources and headers to be compiled +include Makefile.inc + +# List of headers +INCLUDE_FILES := $(HHEADERS) +INCLUDE_FILES += $(shell find ../include -name \*.h) + +# List of sources +OBJLIST := $(CSOURCES:%.c=$(TMP_DIR)/%$(OBJ_EXTENSION)) + + +# ---------------------------------------------------------------------- + +#### default rule +# It should be first rule in this file +.PHONY: default +default: libcurl.a + +#### Compiling C files +$(TMP_DIR)/%$(OBJ_EXTENSION): %.c $(MAKEFILES) + @echo Compiling C file $< $(ECHO_STDOUT) + @[ -d $(@D) ] || mkdir -p $(@D) + $(_@_) $(TOOL_CHAIN_BIN)$(CC) $(COMPILE_ONLY_FLAG) $(CFLAGS) $< $(CC_OBJ_OUTPUT) + +#### Creating library +$(LIBS_TARGET_LIST): $(INCLUDE_FILES) $(MAKEFILES) $(OBJLIST) + @echo Creating library $@ $(ECHO_STDOUT) + $(_@_) [ -d $(@D) ] || mkdir -p $(@D) + $(_@_) rm -f $@ + $(_@_) $(TOOL_CHAIN_BIN)$(AR) $(ARFLAGS) $@ $(filter %$(OBJ_EXTENSION), $^) + +#### Creating application +$(EXE_TARGET_LIST): $(INCLUDE_FILES) $(MAKEFILES) $(LIBS_TARGET_LIST) + @echo Creating application $@ + @[ -d $(@D) ] || mkdir -p $(@D) + $(_@_) $(TOOL_CHAIN_BIN)$(LINK) $(CC_OBJ_OUTPUT) $($(@)_EXE_OBJ_LIST) $(LDFLAGS) $($(@)_EXE_LIBS_NEEDED:%=$(LIBS_FLAG)%) $(LIBS_LIST:%=$(LIBS_FLAG)%) $(USER_LIBS_LIST) $(USER_LIBS_LIST) + +#### Master Targets +libs: $(LIBS_TARGET_LIST) + @echo All libs made. + +all: $(LIBS_TARGET_LIST) $(EXE_TARGET_LIST) $(INCLUDE_TARGET_LIST) + @echo All targets made. + +# Clean up +.PHONY: clean +clean: + $(_@_) rm -rf $(TMP_DIR) + @echo libcurl was cleaned. diff --git a/mobicore/common/curl/lib/README.ares b/mobicore/common/curl/lib/README.ares new file mode 100644 index 0000000000000000000000000000000000000000..8c77937ebdd134b03e21c1acf891f7ba4e536db6 --- /dev/null +++ b/mobicore/common/curl/lib/README.ares @@ -0,0 +1,69 @@ + _ _ ____ _ + ___| | | | _ \| | + / __| | | | |_) | | + | (__| |_| | _ <| |___ + \___|\___/|_| \_\_____| + + How To Build libcurl to Use c-ares For Asynch Name Resolves + =========================================================== + +c-ares: + http://c-ares.haxx.se/ + +NOTE + The latest libcurl version requires c-ares 1.6.0 or later. + + Once upon the time libcurl built fine with the "original" ares. That is no + longer true. You need to use c-ares. + +Build c-ares +============ + +1. unpack the c-ares archive +2. cd c-ares-dir +3. ./configure +4. make +5. make install + +Build libcurl to use c-ares in the curl source tree +=================================================== + +1. name or symlink the c-ares source directory 'ares' in the curl source + directory +2. ./configure --enable-ares + + Optionally, you can point out the c-ares install tree root with the the + --enable-ares option. + +3. make + +Build libcurl to use an installed c-ares +======================================== + +1. ./configure --enable-ares=/path/to/ares/install +2. make + +c-ares on win32 +=============== +(description brought by Dominick Meglio) + +First I compiled c-ares. I changed the default C runtime library to be the +single-threaded rather than the multi-threaded (this seems to be required to +prevent linking errors later on). Then I simply build the areslib project (the +other projects adig/ahost seem to fail under MSVC). + +Next was libcurl. I opened lib/config-win32.h and I added a: + #define USE_ARES 1 + +Next thing I did was I added the path for the ares includes to the include +path, and the libares.lib to the libraries. + +Lastly, I also changed libcurl to be single-threaded rather than +multi-threaded, again this was to prevent some duplicate symbol errors. I'm +not sure why I needed to change everything to single-threaded, but when I +didn't I got redefinition errors for several CRT functions (malloc, stricmp, +etc.) + +I would have modified the MSVC++ project files, but I only have VC.NET and it +uses a different format than VC6.0 so I didn't want to go and change +everything and remove VC6.0 support from libcurl. diff --git a/mobicore/common/curl/lib/README.curl_off_t b/mobicore/common/curl/lib/README.curl_off_t new file mode 100644 index 0000000000000000000000000000000000000000..923b2774cd1657ae1de67f3baacbea2d5bfed042 --- /dev/null +++ b/mobicore/common/curl/lib/README.curl_off_t @@ -0,0 +1,68 @@ + + curl_off_t explained + ==================== + +curl_off_t is a data type provided by the external libcurl include headers. It +is the type meant to be used for the curl_easy_setopt() options that end with +LARGE. The type is 64bit large on most modern platforms. + +Transition from < 7.19.0 to >= 7.19.0 +------------------------------------- + +Applications that used libcurl before 7.19.0 that are rebuilt with a libcurl +that is 7.19.0 or later may or may not have to worry about anything of +this. We have made a significant effort to make the transition really seamless +and transparent. + +You have have to take notice if you are in one of the following situations: + +o Your app is using or will after the transition use a libcurl that is built + with LFS (large file support) disabled even though your system otherwise + supports it. + +o Your app is using or will after the transition use a libcurl that doesn't + support LFS at all, but your system and compiler support 64bit data types. + +In both these cases, the curl_off_t type will now (after the transition) be +64bit where it previously was 32bit. This will cause a binary incompatibility +that you MAY need to deal with. + +Benefits +-------- + +This new way has several benefits: + +o Platforms without LFS support can still use libcurl to do >32 bit file + transfers and range operations etc as long as they have >32 bit data-types + supported. + +o Applications will no longer easily build with the curl_off_t size + mismatched, which has been a very frequent (and annoying) problem with + libcurl <= 7.18.2 + +Historically +------------ + +Previously, before 7.19.0, the curl_off_t type would be rather strongly +connected to the size of the system off_t type, where currently curl_off_t is +independent of that. + +The strong connection to off_t made it troublesome for application authors +since when they did mistakes, they could get curl_off_t type of different +sizes in the app vs libcurl, and that caused strange effects that were hard to +track and detect by users of libcurl. + +SONAME +------ + +We opted to not bump the soname for the library unconditionally, simply +because soname bumping is causing a lot of grief and moaning all over the +community so we try to keep that at minimum. Also, our selected design path +should be 100% backwards compatible for the vast majority of all libcurl +users. + +Enforce SONAME bump +------------------- + +If configure doesn't detect your case where a bump is necessary, re-run it +with the --enable-soname-bump command line option! diff --git a/mobicore/common/curl/lib/README.curlx b/mobicore/common/curl/lib/README.curlx new file mode 100644 index 0000000000000000000000000000000000000000..5375b0d1d3400354b8a7220572c205aac46216b5 --- /dev/null +++ b/mobicore/common/curl/lib/README.curlx @@ -0,0 +1,61 @@ + _ _ ____ _ + ___| | | | _ \| | + / __| | | | |_) | | + | (__| |_| | _ <| |___ + \___|\___/|_| \_\_____| + + Source Code Functions Apps Might Use + ==================================== + +The libcurl source code offers a few functions by source only. They are not +part of the official libcurl API, but the source files might be useful for +others so apps can optionally compile/build with these sources to gain +additional functions. + +We provide them through a single header file for easy access for apps: +"curlx.h" + + curlx_strtoofft() + + A macro that converts a string containing a number to a curl_off_t number. + This might use the curlx_strtoll() function which is provided as source + code in strtoofft.c. Note that the function is only provided if no + strtoll() (or equivalent) function exist on your platform. If curl_off_t + is only a 32 bit number on your platform, this macro uses strtol(). + + curlx_tvnow() + + returns a struct timeval for the current time. + + curlx_tvdiff() + + returns the difference between two timeval structs, in number of + milliseconds. + + curlx_tvdiff_secs() + + returns the same as curlx_tvdiff but with full usec resolution (as a + double) + +FUTURE +====== + + Several functions will be removed from the public curl_ name space in a + future libcurl release. They will then only become available as curlx_ + functions instead. To make the transition easier, we already today provide + these functions with the curlx_ prefix to allow sources to get built properly + with the new function names. The functions this concerns are: + + curlx_getenv + curlx_strequal + curlx_strnequal + curlx_mvsnprintf + curlx_msnprintf + curlx_maprintf + curlx_mvaprintf + curlx_msprintf + curlx_mprintf + curlx_mfprintf + curlx_mvsprintf + curlx_mvprintf + curlx_mvfprintf diff --git a/mobicore/common/curl/lib/README.encoding b/mobicore/common/curl/lib/README.encoding new file mode 100644 index 0000000000000000000000000000000000000000..0d31b3652a7ab8a7ff8b6aab1c23e79db7804489 --- /dev/null +++ b/mobicore/common/curl/lib/README.encoding @@ -0,0 +1,60 @@ + + Content Encoding Support for libcurl + +* About content encodings: + +HTTP/1.1 [RFC 2616] specifies that a client may request that a server encode +its response. This is usually used to compress a response using one of a set +of commonly available compression techniques. These schemes are `deflate' (the +zlib algorithm), `gzip' and `compress' [sec 3.5, RFC 2616]. A client requests +that the sever perform an encoding by including an Accept-Encoding header in +the request document. The value of the header should be one of the recognized +tokens `deflate', ... (there's a way to register new schemes/tokens, see sec +3.5 of the spec). A server MAY honor the client's encoding request. When a +response is encoded, the server includes a Content-Encoding header in the +response. The value of the Content-Encoding header indicates which scheme was +used to encode the data. + +A client may tell a server that it can understand several different encoding +schemes. In this case the server may choose any one of those and use it to +encode the response (indicating which one using the Content-Encoding header). +It's also possible for a client to attach priorities to different schemes so +that the server knows which it prefers. See sec 14.3 of RFC 2616 for more +information on the Accept-Encoding header. + +* Current support for content encoding: + +Support for the 'deflate' and 'gzip' content encoding are supported by +libcurl. Both regular and chunked transfers should work fine. The library +zlib is required for this feature. 'deflate' support was added by James +Gallagher, and support for the 'gzip' encoding was added by Dan Fandrich. + +* The libcurl interface: + +To cause libcurl to request a content encoding use: + + curl_easy_setopt(curl, CURLOPT_ENCODING, ) + +where is the intended value of the Accept-Encoding header. + +Currently, libcurl only understands how to process responses that use the +"deflate" or "gzip" Content-Encoding, so the only values for CURLOPT_ENCODING +that will work (besides "identity," which does nothing) are "deflate" and +"gzip" If a response is encoded using the "compress" or methods, libcurl will +return an error indicating that the response could not be decoded. If + is NULL no Accept-Encoding header is generated. If is a +zero-length string, then an Accept-Encoding header containing all supported +encodings will be generated. + +The CURLOPT_ENCODING must be set to any non-NULL value for content to be +automatically decoded. If it is not set and the server still sends encoded +content (despite not having been asked), the data is returned in its raw form +and the Content-Encoding type is not checked. + +* The curl interface: + +Use the --compressed option with curl to cause it to ask servers to compress +responses using any format supported by curl. + +James Gallagher +Dan Fandrich diff --git a/mobicore/common/curl/lib/README.hostip b/mobicore/common/curl/lib/README.hostip new file mode 100644 index 0000000000000000000000000000000000000000..9723b93fd8eefe183f124b935e7173f0a785065c --- /dev/null +++ b/mobicore/common/curl/lib/README.hostip @@ -0,0 +1,35 @@ + hostip.c explained + ================== + + The main COMPILE-TIME DEFINES to keep in mind when reading the host*.c + source file are these: + + CURLRES_IPV6 - this host has getaddrinfo() and family, and thus we use + that. The host may not be able to resolve IPv6, but we don't really have to + take that into account. Hosts that aren't IPv6-enabled have CURLRES_IPV4 + defined. + + CURLRES_ARES - is defined if libcurl is built to use c-ares for asynchronous + name resolves. It cannot have ENABLE_IPV6 defined at the same time, as c-ares + has no ipv6 support. This can be Windows or *nix. + + CURLRES_THREADED - is defined if libcurl is built to run under (native) + Windows, and then the name resolve will be done in a new thread, and the + supported asynch API will be the same as for ares-builds. + + If any of the two previous are defined, CURLRES_ASYNCH is defined too. If + libcurl is not built to use an asynchronous resolver, CURLRES_SYNCH is + defined. + + The host*.c sources files are split up like this: + + hostip.c - method-independent resolver functions and utility functions + hostasyn.c - functions for asynchronous name resolves + hostsyn.c - functions for synchronous name resolves + hostares.c - functions for ares-using name resolves + hostthre.c - functions for threaded name resolves + hostip4.c - ipv4-specific functions + hostip6.c - ipv6-specific functions + + The hostip.h is the single united header file for all this. It defines the + CURLRES_* defines based on the config*.h and setup.h defines. diff --git a/mobicore/common/curl/lib/README.httpauth b/mobicore/common/curl/lib/README.httpauth new file mode 100644 index 0000000000000000000000000000000000000000..9605045107df90aed52b0e8f15699a92c5b821a6 --- /dev/null +++ b/mobicore/common/curl/lib/README.httpauth @@ -0,0 +1,74 @@ + +1. PUT/POST without a known auth to use (possibly no auth required): + + (When explicitly set to use a multi-pass auth when doing a POST/PUT, + libcurl should immediately go the Content-Length: 0 bytes route to avoid + the first send all data phase, step 2. If told to use a single-pass auth, + goto step 3.) + + Issue the proper PUT/POST request immediately, with the correct + Content-Length and Expect: headers. + + If a 100 response is received or the wait for one times out, start sending + the request-body. + + If a 401 (or 407 when talking through a proxy) is received, then: + + If we have "more than just a little" data left to send, close the + connection. Exactly what "more than just a little" means will have to be + determined. Possibly the current transfer speed should be taken into + account as well. + + NOTE: if the size of the POST data is less than MAX_INITIAL_POST_SIZE (when + CURLOPT_POSTFIELDS is used), libcurl will send everything in one single + write() (all request-headers and request-body) and thus it will + unconditionally send the full post data here. + +2. PUT/POST with multi-pass auth but not yet completely negotiated: + + Send a PUT/POST request, we know that it will be rejected and thus we claim + Content-Length zero to avoid having to send the request-body. (This seems + to be what IE does.) + +3. PUT/POST as the last step in the auth negotiation, that is when we have + what we believe is a completed negotiation: + + Send a full and proper PUT/POST request (again) with the proper + Content-Length and a following request-body. + + NOTE: this may very well be the second (or even third) time the whole or at + least parts of the request body is sent to the server. Since the data may + be provided to libcurl with a callback, we need a way to tell the app that + the upload is to be restarted so that the callback will provide data from + the start again. This requires an API method/mechanism that libcurl + doesn't have today. See below. + +Data Rewind + + It will be troublesome for some apps to deal with a rewind like this in all + circumstances. I'm thinking for example when using 'curl' to upload data + from stdin. If libcurl ends up having to rewind the reading for a request + to succeed, of course a lack of this callback or if it returns failure, will + cause the request to fail completely. + + The new callback is set with CURLOPT_IOCTLFUNCTION (in an attempt to add a + more generic function that might be used for other IO-related controls in + the future): + + curlioerr curl_ioctl(CURL *handle, curliocmd cmd, void *clientp); + + And in the case where the read is to be rewinded, it would be called with a + cmd named CURLIOCMD_RESTARTREAD. The callback would then return CURLIOE_OK, + if things are fine, or CURLIOE_FAILRESTART if not. + +Backwards Compatibility + + The approach used until now, that issues a HEAD on the given URL to trigger + the auth negotiation could still be supported and encouraged, but it would + be up to the app to first fetch a URL with GET/HEAD to negotiate on, since + then a following PUT/POST wouldn't need to negotiate authentication and + thus avoid double-sending data. + + Optionally, we keep the current approach if some option is set + (CURLOPT_HEADBEFOREAUTH or similar), since it seems to work fairly well for + POST on most servers. diff --git a/mobicore/common/curl/lib/README.memoryleak b/mobicore/common/curl/lib/README.memoryleak new file mode 100644 index 0000000000000000000000000000000000000000..166177794ff862f8a1ed5870067aafaac90edb63 --- /dev/null +++ b/mobicore/common/curl/lib/README.memoryleak @@ -0,0 +1,55 @@ + _ _ ____ _ + ___| | | | _ \| | + / __| | | | |_) | | + | (__| |_| | _ <| |___ + \___|\___/|_| \_\_____| + + How To Track Down Suspected Memory Leaks in libcurl + =================================================== + +Single-threaded + + Please note that this memory leak system is not adjusted to work in more + than one thread. If you want/need to use it in a multi-threaded app. Please + adjust accordingly. + + +Build + + Rebuild libcurl with -DCURLDEBUG (usually, rerunning configure with + --enable-debug fixes this). 'make clean' first, then 'make' so that all + files actually are rebuilt properly. It will also make sense to build + libcurl with the debug option (usually -g to the compiler) so that debugging + it will be easier if you actually do find a leak in the library. + + This will create a library that has memory debugging enabled. + +Modify Your Application + + Add a line in your application code: + + curl_memdebug("dump"); + + This will make the malloc debug system output a full trace of all resource + using functions to the given file name. Make sure you rebuild your program + and that you link with the same libcurl you built for this purpose as + described above. + +Run Your Application + + Run your program as usual. Watch the specified memory trace file grow. + + Make your program exit and use the proper libcurl cleanup functions etc. So + that all non-leaks are returned/freed properly. + +Analyze the Flow + + Use the tests/memanalyze.pl perl script to analyze the dump file: + + tests/memanalyze.pl dump + + This now outputs a report on what resources that were allocated but never + freed etc. This report is very fine for posting to the list! + + If this doesn't produce any output, no leak was detected in libcurl. Then + the leak is mostly likely to be in your code. diff --git a/mobicore/common/curl/lib/README.multi_socket b/mobicore/common/curl/lib/README.multi_socket new file mode 100644 index 0000000000000000000000000000000000000000..d91e1d9f27258ce9830f3379ccece14f1cf440d0 --- /dev/null +++ b/mobicore/common/curl/lib/README.multi_socket @@ -0,0 +1,53 @@ +Implementation of the curl_multi_socket API + + The main ideas of the new API are simply: + + 1 - The application can use whatever event system it likes as it gets info + from libcurl about what file descriptors libcurl waits for what action + on. (The previous API returns fd_sets which is very select()-centric). + + 2 - When the application discovers action on a single socket, it calls + libcurl and informs that there was action on this particular socket and + libcurl can then act on that socket/transfer only and not care about + any other transfers. (The previous API always had to scan through all + the existing transfers.) + + The idea is that curl_multi_socket_action() calls a given callback with + information about what socket to wait for what action on, and the callback + only gets called if the status of that socket has changed. + + We also added a timer callback that makes libcurl call the application when + the timeout value changes, and you set that with curl_multi_setopt() and the + CURLMOPT_TIMERFUNCTION option. To get this to work, Internally, there's an + added a struct to each easy handle in which we store an "expire time" (if + any). The structs are then "splay sorted" so that we can add and remove + times from the linked list and yet somewhat swiftly figure out both how long + time there is until the next nearest timer expires and which timer (handle) + we should take care of now. Of course, the upside of all this is that we get + a curl_multi_timeout() that should also work with old-style applications + that use curl_multi_perform(). + + We created an internal "socket to easy handles" hash table that given + a socket (file descriptor) return the easy handle that waits for action on + that socket. This hash is made using the already existing hash code + (previously only used for the DNS cache). + + To make libcurl able to report plain sockets in the socket callback, we had + to re-organize the internals of the curl_multi_fdset() etc so that the + conversion from sockets to fd_sets for that function is only done in the + last step before the data is returned. I also had to extend c-ares to get a + function that can return plain sockets, as that library too returned only + fd_sets and that is no longer good enough. The changes done to c-ares are + available in c-ares 1.3.1 and later. + + We have done a test runs with up to 9000 connections (with a single active + one). The curl_multi_socket_action() invoke then takes less than 10 + microseconds in average (using the read-only-1-byte-at-a-time hack). We are + now below the 60 microseconds "per socket action" goal (the extra 50 is the + time libevent needs). + +Documentation + + http://curl.haxx.se/libcurl/c/curl_multi_socket_action.html + http://curl.haxx.se/libcurl/c/curl_multi_timeout.html + http://curl.haxx.se/libcurl/c/curl_multi_setopt.html diff --git a/mobicore/common/curl/lib/README.pingpong b/mobicore/common/curl/lib/README.pingpong new file mode 100644 index 0000000000000000000000000000000000000000..69ba9aadbff72f5a365819eaf998e63938a905c5 --- /dev/null +++ b/mobicore/common/curl/lib/README.pingpong @@ -0,0 +1,30 @@ +Date: December 5, 2009 + +Pingpong +======== + + Pingpong is just my (Daniel's) jestful collective name on the protocols that + share a very similar kind of back-and-forth procedure with command and + responses to and from the server. FTP was previously the only protocol in + that family that libcurl supported, but when POP3, IMAP and SMTP joined the + team I moved some of the internals into a separate pingpong module to be + easier to get used by all these protocols to reduce code duplication and ease + code re-use between these protocols. + +FTP + + In 7.20.0 we converted code to use the new pingpong code from previously + having been all "native" FTP code. + +POP3 + + There's no support in the documented URL format to specify the exact mail to + get, but we support that as the path specified in the URL. + +IMAP + +SMTP + + There's no official URL syntax defined for SMTP, but we use only the generic + one and we provide two additional libcurl options to specify receivers and + sender of the actual mail. diff --git a/mobicore/common/curl/lib/README.pipelining b/mobicore/common/curl/lib/README.pipelining new file mode 100644 index 0000000000000000000000000000000000000000..c7b462248ac47e8757a6459d21bf1960bda74472 --- /dev/null +++ b/mobicore/common/curl/lib/README.pipelining @@ -0,0 +1,51 @@ +HTTP Pipelining with libcurl +============================ + +Background + +Since pipelining implies that one or more requests are sent to a server before +the previous response(s) have been received, we only support it for multi +interface use. + +Considerations + +When using the multi interface, you create one easy handle for each transfer. +Bascially any number of handles can be created, added and used with the multi +interface - simultaneously. It is an interface designed to allow many +simultaneous transfers while still using a single thread. Pipelining does not +change any of these details. + +API + +We've added a new option to curl_multi_setopt() called CURLMOPT_PIPELINING +that enables "attempted pipelining" and then all easy handles used on that +handle will attempt to use an existing pipeline. + +Details + +- A pipeline is only created if a previous connection exists to the same IP + address that the new request is being made to use. + +- Pipelines are only supported for HTTP(S) as no other currently supported + protocol has features resemembling this, but we still name this feature + plain 'pipelining' to possibly one day support it for other protocols as + well. + +- HTTP Pipelining is for GET and HEAD requests only. + +- When a pipeline is in use, we must take precautions so that when used easy + handles (i.e those who still wait for a response) are removed from the multi + handle, we must deal with the outstanding response nicely. + +- Explicitly asking for pipelining handle X and handle Y won't be supported. + It isn't easy for an app to do this association. The lib should probably + still resolve the second one properly to make sure that they actually _can_ + be considered for pipelining. Also, asking for explicit pipelining on handle + X may be tricky when handle X get a closed connection. + +- We need options to control max pipeline length, and probably how to behave + if we reach that limit. As was discussed on the list, it can probably be + made very complicated, so perhaps we can think of a way to pass all + variables involved to a callback and let the application decide how to act + in specific situations. Either way, these fancy options are only interesting + to work on when everything is working and we have working apps to test with. diff --git a/mobicore/common/curl/lib/amigaos.c b/mobicore/common/curl/lib/amigaos.c new file mode 100644 index 0000000000000000000000000000000000000000..2055126feddd30f545738d379b237bd3ecced4b3 --- /dev/null +++ b/mobicore/common/curl/lib/amigaos.c @@ -0,0 +1,80 @@ +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) 1998 - 2009, Daniel Stenberg, , et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at http://curl.haxx.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ***************************************************************************/ + +#ifdef __AMIGA__ /* Any AmigaOS flavour */ + +#include "amigaos.h" +#include + +struct Library *SocketBase = NULL; +extern int errno, h_errno; + +#ifdef __libnix__ +#include +void __request(const char *msg); +#else +# define __request( msg ) Printf( msg "\n\a") +#endif + +void amiga_cleanup() +{ + if(SocketBase) { + CloseLibrary(SocketBase); + SocketBase = NULL; + } +} + +BOOL amiga_init() +{ + if(!SocketBase) + SocketBase = OpenLibrary("bsdsocket.library", 4); + + if(!SocketBase) { + __request("No TCP/IP Stack running!"); + return FALSE; + } + + if(SocketBaseTags(SBTM_SETVAL(SBTC_ERRNOPTR(sizeof(errno))), (ULONG) &errno, + SBTM_SETVAL(SBTC_LOGTAGPTR), (ULONG) "cURL", + TAG_DONE)) { + __request("SocketBaseTags ERROR"); + return FALSE; + } + +#ifndef __libnix__ + atexit(amiga_cleanup); +#endif + + return TRUE; +} + +#ifdef __libnix__ +ADD2EXIT(amiga_cleanup,-50); +#endif + +#else /* __AMIGA__ */ + +#ifdef __POCC__ +# pragma warn(disable:2024) /* Disable warning #2024: Empty input file */ +#endif + +#endif /* __AMIGA__ */ diff --git a/mobicore/common/curl/lib/amigaos.h b/mobicore/common/curl/lib/amigaos.h new file mode 100644 index 0000000000000000000000000000000000000000..d6ff0646ae6c442b713ff40b62c91369ace7c58e --- /dev/null +++ b/mobicore/common/curl/lib/amigaos.h @@ -0,0 +1,57 @@ +#ifndef LIBCURL_AMIGAOS_H +#define LIBCURL_AMIGAOS_H +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) 1998 - 2007, Daniel Stenberg, , et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at http://curl.haxx.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ***************************************************************************/ + +#ifdef __AMIGA__ /* Any AmigaOS flavour */ + +#ifndef __ixemul__ + +#include +#include + +#include +#include + +#include + +#include "config-amigaos.h" + +#ifndef select +# define select(args...) WaitSelect( args, NULL) +#endif +#ifndef ioctl +# define ioctl(a,b,c,d) IoctlSocket( (LONG)a, (ULONG)b, (char*)c) +#endif +#define _AMIGASF 1 + +extern void amiga_cleanup(); +extern BOOL amiga_init(); + +#else /* __ixemul__ */ + +#warning compiling with ixemul... + +#endif /* __ixemul__ */ +#endif /* __AMIGA__ */ +#endif /* LIBCURL_AMIGAOS_H */ + diff --git a/mobicore/common/curl/lib/arpa_telnet.h b/mobicore/common/curl/lib/arpa_telnet.h new file mode 100644 index 0000000000000000000000000000000000000000..ddb14f6fe58918c6b113e013adab6a58a9eae172 --- /dev/null +++ b/mobicore/common/curl/lib/arpa_telnet.h @@ -0,0 +1,102 @@ +#ifndef HEADER_CURL_ARPA_TELNET_H +#define HEADER_CURL_ARPA_TELNET_H +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) 1998 - 2010, Daniel Stenberg, , et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at http://curl.haxx.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ***************************************************************************/ +#ifndef CURL_DISABLE_TELNET +/* + * Telnet option defines. Add more here if in need. + */ +#define CURL_TELOPT_BINARY 0 /* binary 8bit data */ +#define CURL_TELOPT_SGA 3 /* Supress Go Ahead */ +#define CURL_TELOPT_EXOPL 255 /* EXtended OPtions List */ +#define CURL_TELOPT_TTYPE 24 /* Terminal TYPE */ +#define CURL_TELOPT_XDISPLOC 35 /* X DISPlay LOCation */ + +#define CURL_TELOPT_NEW_ENVIRON 39 /* NEW ENVIRONment variables */ +#define CURL_NEW_ENV_VAR 0 +#define CURL_NEW_ENV_VALUE 1 + +/* + * The telnet options represented as strings + */ +static const char * const telnetoptions[]= +{ + "BINARY", "ECHO", "RCP", "SUPPRESS GO AHEAD", + "NAME", "STATUS", "TIMING MARK", "RCTE", + "NAOL", "NAOP", "NAOCRD", "NAOHTS", + "NAOHTD", "NAOFFD", "NAOVTS", "NAOVTD", + "NAOLFD", "EXTEND ASCII", "LOGOUT", "BYTE MACRO", + "DE TERMINAL", "SUPDUP", "SUPDUP OUTPUT", "SEND LOCATION", + "TERM TYPE", "END OF RECORD", "TACACS UID", "OUTPUT MARKING", + "TTYLOC", "3270 REGIME", "X3 PAD", "NAWS", + "TERM SPEED", "LFLOW", "LINEMODE", "XDISPLOC", + "OLD-ENVIRON", "AUTHENTICATION", "ENCRYPT", "NEW-ENVIRON" +}; + +#define CURL_TELOPT_MAXIMUM CURL_TELOPT_NEW_ENVIRON + +#define CURL_TELOPT_OK(x) ((x) <= CURL_TELOPT_MAXIMUM) +#define CURL_TELOPT(x) telnetoptions[x] + +#define CURL_NTELOPTS 40 + +/* + * First some defines + */ +#define CURL_xEOF 236 /* End Of File */ +#define CURL_SE 240 /* Sub negotiation End */ +#define CURL_NOP 241 /* No OPeration */ +#define CURL_DM 242 /* Data Mark */ +#define CURL_GA 249 /* Go Ahead, reverse the line */ +#define CURL_SB 250 /* SuBnegotiation */ +#define CURL_WILL 251 /* Our side WILL use this option */ +#define CURL_WONT 252 /* Our side WON'T use this option */ +#define CURL_DO 253 /* DO use this option! */ +#define CURL_DONT 254 /* DON'T use this option! */ +#define CURL_IAC 255 /* Interpret As Command */ + +/* + * Then those numbers represented as strings: + */ +static const char * const telnetcmds[]= +{ + "EOF", "SUSP", "ABORT", "EOR", "SE", + "NOP", "DMARK", "BRK", "IP", "AO", + "AYT", "EC", "EL", "GA", "SB", + "WILL", "WONT", "DO", "DONT", "IAC" +}; + +#define CURL_TELCMD_MINIMUM CURL_xEOF /* the first one */ +#define CURL_TELCMD_MAXIMUM CURL_IAC /* surprise, 255 is the last one! ;-) */ + +#define CURL_TELQUAL_IS 0 +#define CURL_TELQUAL_SEND 1 +#define CURL_TELQUAL_INFO 2 +#define CURL_TELQUAL_NAME 3 + +#define CURL_TELCMD_OK(x) ( ((unsigned int)(x) >= CURL_TELCMD_MINIMUM) && \ + ((unsigned int)(x) <= CURL_TELCMD_MAXIMUM) ) +#define CURL_TELCMD(x) telnetcmds[(x)-CURL_TELCMD_MINIMUM] + +#endif /* CURL_DISABLE_TELNET */ + +#endif /* HEADER_CURL_ARPA_TELNET_H */ diff --git a/mobicore/common/curl/lib/base64.c b/mobicore/common/curl/lib/base64.c new file mode 100644 index 0000000000000000000000000000000000000000..edccf54025ec2a7b13efe46f72234a3c8f22f4f5 --- /dev/null +++ b/mobicore/common/curl/lib/base64.c @@ -0,0 +1,247 @@ +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) 1998 - 2009, Daniel Stenberg, , et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at http://curl.haxx.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ***************************************************************************/ + +/* Base64 encoding/decoding + * + * Test harnesses down the bottom - compile with -DTEST_ENCODE for + * a program that will read in raw data from stdin and write out + * a base64-encoded version to stdout, and the length returned by the + * encoding function to stderr. Compile with -DTEST_DECODE for a program that + * will go the other way. + * + * This code will break if int is smaller than 32 bits + */ + +#include "setup.h" + +#include +#include + +#define _MPRINTF_REPLACE /* use our functions only */ +#include + +#include "urldata.h" /* for the SessionHandle definition */ +#include "easyif.h" /* for Curl_convert_... prototypes */ +#include "warnless.h" +#include "curl_base64.h" +#include "curl_memory.h" + +/* include memdebug.h last */ +#include "memdebug.h" + +/* ---- Base64 Encoding/Decoding Table --- */ +static const char table64[]= + "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; + +static void decodeQuantum(unsigned char *dest, const char *src) +{ + const char *s, *p; + unsigned long i, v, x = 0; + + for(i = 0, s = src; i < 4; i++, s++) { + v = 0; + p = table64; + while(*p && (*p != *s)) { + v++; + p++; + } + if(*p == *s) + x = (x << 6) + v; + else if(*s == '=') + x = (x << 6); + } + + dest[2] = curlx_ultouc(x); + x >>= 8; + dest[1] = curlx_ultouc(x); + x >>= 8; + dest[0] = curlx_ultouc(x); +} + +/* + * Curl_base64_decode() + * + * Given a base64 string at src, decode it and return an allocated memory in + * the *outptr. Returns the length of the decoded data. + */ +size_t Curl_base64_decode(const char *src, unsigned char **outptr) +{ + size_t length = 0; + size_t equalsTerm = 0; + size_t i; + size_t numQuantums; + unsigned char lastQuantum[3]; + size_t rawlen = 0; + unsigned char *newstr; + + *outptr = NULL; + + while((src[length] != '=') && src[length]) + length++; + /* A maximum of two = padding characters is allowed */ + if(src[length] == '=') { + equalsTerm++; + if(src[length+equalsTerm] == '=') + equalsTerm++; + } + numQuantums = (length + equalsTerm) / 4; + + /* Don't allocate a buffer if the decoded length is 0 */ + if(numQuantums == 0) + return 0; + + rawlen = (numQuantums * 3) - equalsTerm; + + /* The buffer must be large enough to make room for the last quantum + (which may be partially thrown out) and the zero terminator. */ + newstr = malloc(rawlen+4); + if(!newstr) + return 0; + + *outptr = newstr; + + /* Decode all but the last quantum (which may not decode to a + multiple of 3 bytes) */ + for(i = 0; i < numQuantums - 1; i++) { + decodeQuantum(newstr, src); + newstr += 3; src += 4; + } + + /* This final decode may actually read slightly past the end of the buffer + if the input string is missing pad bytes. This will almost always be + harmless. */ + decodeQuantum(lastQuantum, src); + for(i = 0; i < 3 - equalsTerm; i++) + newstr[i] = lastQuantum[i]; + + newstr[i] = '\0'; /* zero terminate */ + return rawlen; +} + +/* + * Curl_base64_encode() + * + * Returns the length of the newly created base64 string. The third argument + * is a pointer to an allocated area holding the base64 data. If something + * went wrong, 0 is returned. + * + */ +size_t Curl_base64_encode(struct SessionHandle *data, + const char *inputbuff, size_t insize, + char **outptr) +{ + unsigned char ibuf[3]; + unsigned char obuf[4]; + int i; + int inputparts; + char *output; + char *base64data; +#ifdef CURL_DOES_CONVERSIONS + char *convbuf = NULL; +#endif + + const char *indata = inputbuff; + + *outptr = NULL; /* set to NULL in case of failure before we reach the end */ + + if(0 == insize) + insize = strlen(indata); + + base64data = output = malloc(insize*4/3+4); + if(NULL == output) + return 0; + +#ifdef CURL_DOES_CONVERSIONS + /* + * The base64 data needs to be created using the network encoding + * not the host encoding. And we can't change the actual input + * so we copy it to a buffer, translate it, and use that instead. + */ + if(data) { + convbuf = malloc(insize); + if(!convbuf) { + free(output); + return 0; + } + memcpy(convbuf, indata, insize); + if(CURLE_OK != Curl_convert_to_network(data, convbuf, insize)) { + free(convbuf); + free(output); + return 0; + } + indata = convbuf; /* switch to the converted buffer */ + } +#else + (void)data; +#endif + + while(insize > 0) { + for (i = inputparts = 0; i < 3; i++) { + if(insize > 0) { + inputparts++; + ibuf[i] = (unsigned char) *indata; + indata++; + insize--; + } + else + ibuf[i] = 0; + } + + obuf[0] = (unsigned char) ((ibuf[0] & 0xFC) >> 2); + obuf[1] = (unsigned char) (((ibuf[0] & 0x03) << 4) | \ + ((ibuf[1] & 0xF0) >> 4)); + obuf[2] = (unsigned char) (((ibuf[1] & 0x0F) << 2) | \ + ((ibuf[2] & 0xC0) >> 6)); + obuf[3] = (unsigned char) (ibuf[2] & 0x3F); + + switch(inputparts) { + case 1: /* only one byte read */ + snprintf(output, 5, "%c%c==", + table64[obuf[0]], + table64[obuf[1]]); + break; + case 2: /* two bytes read */ + snprintf(output, 5, "%c%c%c=", + table64[obuf[0]], + table64[obuf[1]], + table64[obuf[2]]); + break; + default: + snprintf(output, 5, "%c%c%c%c", + table64[obuf[0]], + table64[obuf[1]], + table64[obuf[2]], + table64[obuf[3]] ); + break; + } + output += 4; + } + *output=0; + *outptr = base64data; /* make it return the actual data memory */ + +#ifdef CURL_DOES_CONVERSIONS + if(data) + free(convbuf); +#endif + return strlen(base64data); /* return the length of the new data */ +} +/* ---- End of Base64 Encoding ---- */ diff --git a/mobicore/common/curl/lib/config-amigaos.h b/mobicore/common/curl/lib/config-amigaos.h new file mode 100644 index 0000000000000000000000000000000000000000..99b96d6563c2d26983bfef52fb047128709300f6 --- /dev/null +++ b/mobicore/common/curl/lib/config-amigaos.h @@ -0,0 +1,152 @@ +#ifndef LIBCURL_CONFIG_AMIGAOS_H +#define LIBCURL_CONFIG_AMIGAOS_H +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) 1998 - 2009, Daniel Stenberg, , et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at http://curl.haxx.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ***************************************************************************/ + +#ifdef __AMIGA__ /* Any AmigaOS flavour */ + +#define HAVE_ARPA_INET_H 1 +#define HAVE_CLOSESOCKET_CAMEL 1 +#define HAVE_GETHOSTBYADDR 1 +#define HAVE_INET_ADDR 1 +#define HAVE_INTTYPES_H 1 +#define HAVE_IOCTLSOCKET_CAMEL 1 +#define HAVE_IOCTLSOCKET_CAMEL_FIONBIO 1 +#define HAVE_LIBCRYPTO 1 +#define HAVE_LIBSSL 1 +#define HAVE_LIBZ 1 +#define HAVE_LONGLONG 1 +#define HAVE_MALLOC_H 1 +#define HAVE_MEMORY_H 1 +#define HAVE_NETDB_H 1 +#define HAVE_NETINET_IN_H 1 +#define HAVE_NET_IF_H 1 +#define HAVE_OPENSSL_CRYPTO_H 1 +#define HAVE_OPENSSL_ERR_H 1 +#define HAVE_OPENSSL_PEM_H 1 +#define HAVE_OPENSSL_RSA_H 1 +#define HAVE_OPENSSL_SSL_H 1 +#define HAVE_OPENSSL_X509_H 1 +#define HAVE_PERROR 1 +#define HAVE_PWD_H 1 +#define HAVE_RAND_EGD 1 +#define HAVE_RAND_STATUS 1 +#define HAVE_SELECT 1 +#define HAVE_SETJMP_H 1 +#define HAVE_SGTTY_H 1 +#define HAVE_SIGNAL 1 +#define HAVE_SIGNAL_H 1 +#define HAVE_SIG_ATOMIC_T 1 +#define HAVE_SOCKET 1 +#define HAVE_STRCASECMP 1 +#define HAVE_STRDUP 1 +#define HAVE_STRFTIME 1 +#define HAVE_STRICMP 1 +#define HAVE_STRINGS_H 1 +#define HAVE_STRING_H 1 +#define HAVE_STRSTR 1 +#define HAVE_STRUCT_TIMEVAL 1 +#define HAVE_SYS_PARAM_H 1 +#define HAVE_SYS_SOCKET_H 1 +#define HAVE_SYS_SOCKIO_H 1 +#define HAVE_SYS_STAT_H 1 +#define HAVE_SYS_TIME_H 1 +#define HAVE_SYS_TYPES_H 1 +#define HAVE_TERMIOS_H 1 +#define HAVE_TERMIO_H 1 +#define HAVE_TIME_H 1 +#define HAVE_UNAME 1 +#define HAVE_UNISTD_H 1 +#define HAVE_UTIME 1 +#define HAVE_UTIME_H 1 +#define HAVE_WRITABLE_ARGV 1 +#define HAVE_ZLIB_H 1 +#define HAVE_SYS_IOCTL_H 1 + +#define NEED_MALLOC_H 1 + +#define SIZEOF_INT 4 +#define SIZEOF_SHORT 2 +#define SIZEOF_SIZE_T 4 + +#define USE_OPENSSL 1 +#define USE_SSLEAY 1 +#define CURL_DISABLE_LDAP 1 + + +#define OS "AmigaOS" + +#define PACKAGE "curl" +#define PACKAGE_BUGREPORT "curl-bug@haxx.se" +#define PACKAGE_NAME "curl" +#define PACKAGE_STRING "curl -" +#define PACKAGE_TARNAME "curl" +#define PACKAGE_VERSION "-" +#define CURL_CA_BUNDLE "s:curl-ca-bundle.crt" + +#define RETSIGTYPE void +#define SELECT_TYPE_ARG1 int +#define SELECT_TYPE_ARG234 (fd_set *) +#define SELECT_TYPE_ARG5 (struct timeval *) + +#define STDC_HEADERS 1 +#define TIME_WITH_SYS_TIME 1 + +#define in_addr_t int + +#ifndef O_RDONLY +# define O_RDONLY 0x0000 +#endif + +#define HAVE_GETNAMEINFO 1 +#define GETNAMEINFO_QUAL_ARG1 const +#define GETNAMEINFO_TYPE_ARG1 struct sockaddr * +#define GETNAMEINFO_TYPE_ARG2 int +#define GETNAMEINFO_TYPE_ARG46 size_t +#define GETNAMEINFO_TYPE_ARG7 int + +#define HAVE_RECV 1 +#define RECV_TYPE_ARG1 long +#define RECV_TYPE_ARG2 char * +#define RECV_TYPE_ARG3 long +#define RECV_TYPE_ARG4 long +#define RECV_TYPE_RETV long + +#define HAVE_RECVFROM 1 +#define RECVFROM_TYPE_ARG1 long +#define RECVFROM_TYPE_ARG2 char +#define RECVFROM_TYPE_ARG3 long +#define RECVFROM_TYPE_ARG4 long +#define RECVFROM_TYPE_ARG5 struct sockaddr +#define RECVFROM_TYPE_ARG6 long +#define RECVFROM_TYPE_RETV long + +#define HAVE_SEND 1 +#define SEND_TYPE_ARG1 int +#define SEND_QUAL_ARG2 const +#define SEND_TYPE_ARG2 char * +#define SEND_TYPE_ARG3 int +#define SEND_TYPE_ARG4 int +#define SEND_TYPE_RETV int + +#endif /* __AMIGA__ */ +#endif /* LIBCURL_CONFIG_AMIGAOS_H */ diff --git a/mobicore/common/curl/lib/config-dos.h b/mobicore/common/curl/lib/config-dos.h new file mode 100644 index 0000000000000000000000000000000000000000..bb0315e2cbdd46994d41227bedd9b9e1879b52d2 --- /dev/null +++ b/mobicore/common/curl/lib/config-dos.h @@ -0,0 +1,170 @@ +#ifndef HEADER_CONFIG_DOS_H +#define HEADER_CONFIG_DOS_H + + +/* ================================================================ */ +/* lib/config-dos.h - Hand crafted config file for DOS */ +/* ================================================================ */ + +#if defined(DJGPP) + #define OS "MSDOS/djgpp" +#elif defined(__HIGHC__) + #define OS "MSDOS/HighC" +#elif defined(__WATCOMC__) + #define OS "MSDOS/Watcom" +#else + #define OS "MSDOS/?" +#endif + +#define PACKAGE "curl" + +#define HAVE_ARPA_INET_H 1 +#define HAVE_FCNTL_H 1 +#define HAVE_GETADDRINFO 1 +#define HAVE_GETNAMEINFO 1 +#define HAVE_GETPROTOBYNAME 1 +#define HAVE_GETTIMEOFDAY 1 +#define HAVE_IO_H 1 +#define HAVE_IOCTL 1 +#define HAVE_IOCTL_FIONBIO 1 +#define HAVE_IOCTLSOCKET 1 +#define HAVE_IOCTLSOCKET_FIONBIO 1 +#define HAVE_LIMITS_H 1 +#define HAVE_LOCALE_H 1 +#define HAVE_LONGLONG 1 +#define HAVE_MEMORY_H 1 +#define HAVE_NETDB_H 1 +#define HAVE_NETINET_IN_H 1 +#define HAVE_NETINET_TCP_H 1 +#define HAVE_NET_IF_H 1 +#define HAVE_PROCESS_H 1 +#define HAVE_RECV 1 +#define HAVE_RECVFROM 1 +#define HAVE_SELECT 1 +#define HAVE_SEND 1 +#define HAVE_SETJMP_H 1 +#define HAVE_SETLOCALE 1 +#define HAVE_SETMODE 1 +#define HAVE_SIGNAL 1 +#define HAVE_SOCKET 1 +#define HAVE_SPNEGO 1 +#define HAVE_STRDUP 1 +#define HAVE_STRICMP 1 +#define HAVE_STRTOLL 1 +#define HAVE_STRUCT_TIMEVAL 1 +#define HAVE_STRUCT_IN6_ADDR 1 +#define HAVE_SYS_IOCTL_H 1 +#define HAVE_SYS_SOCKET_H 1 +#define HAVE_SYS_STAT_H 1 +#define HAVE_SYS_TYPES_H 1 +#define HAVE_TERMIOS_H 1 +#define HAVE_TIME_H 1 +#define HAVE_UNISTD_H 1 + +#define NEED_MALLOC_H 1 + +#define RETSIGTYPE void +#define SIZEOF_INT 4 +#define SIZEOF_LONG_DOUBLE 16 +#define SIZEOF_SHORT 2 +#define SIZEOF_SIZE_T 4 +#define STDC_HEADERS 1 +#define TIME_WITH_SYS_TIME 1 + +/* Qualifiers for send(), recv(), recvfrom() and getnameinfo(). */ + +#define SEND_TYPE_ARG1 int +#define SEND_QUAL_ARG2 const +#define SEND_TYPE_ARG2 void * +#define SEND_TYPE_ARG3 int +#define SEND_TYPE_ARG4 int +#define SEND_TYPE_RETV int + +#define RECV_TYPE_ARG1 int +#define RECV_TYPE_ARG2 void * +#define RECV_TYPE_ARG3 int +#define RECV_TYPE_ARG4 int +#define RECV_TYPE_RETV int + +#define RECVFROM_TYPE_ARG1 int +#define RECVFROM_TYPE_ARG2 void +#define RECVFROM_TYPE_ARG3 int +#define RECVFROM_TYPE_ARG4 int +#define RECVFROM_TYPE_ARG5 struct sockaddr +#define RECVFROM_TYPE_ARG6 int +#define RECVFROM_TYPE_RETV int +#define RECVFROM_TYPE_ARG2_IS_VOID 1 + +#define GETNAMEINFO_QUAL_ARG1 const +#define GETNAMEINFO_TYPE_ARG1 struct sockaddr * +#define GETNAMEINFO_TYPE_ARG2 int +#define GETNAMEINFO_TYPE_ARG46 int +#define GETNAMEINFO_TYPE_ARG7 int + +#define BSD + +/* CURLDEBUG definition enables memory tracking */ +/* #define CURLDEBUG */ + +/* USE_ZLIB on cmd-line */ +#ifdef USE_ZLIB + #define HAVE_ZLIB_H 1 + #define HAVE_LIBZ 1 +#endif + +/* USE_SSLEAY on cmd-line */ +#ifdef USE_SSLEAY + #define HAVE_CRYPTO_CLEANUP_ALL_EX_DATA 1 + #define HAVE_OPENSSL_ENGINE_H 1 + #define OPENSSL_NO_KRB5 1 + #define USE_OPENSSL 1 +#endif + +/* to disable LDAP */ +#define CURL_DISABLE_LDAP 1 + +#define in_addr_t u_long + +#if defined(__HIGHC__) || \ + (defined(__GNUC__) && (__GNUC__ < 4)) +#define ssize_t int +#endif + +#define CURL_CA_BUNDLE getenv("CURL_CA_BUNDLE") + +/* Target HAVE_x section */ + +#if defined(DJGPP) + #define HAVE_BASENAME 1 + #define HAVE_STRCASECMP 1 + #define HAVE_SIGACTION 1 + #define HAVE_SIGSETJMP 1 + #define HAVE_SYS_TIME_H 1 + #define HAVE_VARIADIC_MACROS_GCC 1 + + #if (DJGPP_MINOR >= 4) + #define HAVE_STRLCAT 1 + #endif + + /* Because djgpp <= 2.03 doesn't have snprintf() etc. */ + #if (DJGPP_MINOR < 4) + #define _MPRINTF_REPLACE + #endif + +#elif defined(__WATCOMC__) + #define HAVE_STRCASECMP 1 + +#elif defined(__HIGHC__) + #define HAVE_SYS_TIME_H 1 +#endif + +#ifdef MSDOS /* Watt-32 */ + #define HAVE_CLOSESOCKET_CAMEL 1 + #define CloseSocket(s) close_s((s)) +#endif + +#undef word +#undef byte + +#endif /* HEADER_CONFIG_DOS_H */ + diff --git a/mobicore/common/curl/lib/config-mac.h b/mobicore/common/curl/lib/config-mac.h new file mode 100644 index 0000000000000000000000000000000000000000..1f7950ab1c2304c71562c560852c0d1b2266bcc5 --- /dev/null +++ b/mobicore/common/curl/lib/config-mac.h @@ -0,0 +1,101 @@ +#ifndef __LIB_CONFIG_MAC_H +#define __LIB_CONFIG_MAC_H + +/* =================================================================== */ +/* lib/config-mac.h - Hand crafted config file for Mac OS 9 */ +/* =================================================================== */ +/* On Mac OS X you must run configure to generate curl_config.h file */ +/* =================================================================== */ + +#define OS "mac" + +#define HAVE_NETINET_IN_H 1 +#define HAVE_SYS_SOCKET_H 1 +#define HAVE_SYS_SELECT_H 1 +#define HAVE_NETDB_H 1 +#define HAVE_ARPA_INET_H 1 +#define HAVE_UNISTD_H 1 +#define HAVE_NET_IF_H 1 +#define HAVE_SYS_TYPES_H 1 +#define HAVE_GETTIMEOFDAY 1 +#define HAVE_FCNTL_H 1 +#define HAVE_SYS_STAT_H 1 +#define HAVE_ALLOCA_H 1 +#define HAVE_TIME_H 1 +#define HAVE_STDLIB_H 1 +#define HAVE_UTIME_H 1 +#define HAVE_SYS_TIME_H 1 + +#define TIME_WITH_SYS_TIME 1 + +#define HAVE_ALARM 1 +#define HAVE_STRDUP 1 +#define HAVE_UTIME 1 +#define HAVE_SETVBUF 1 +#define HAVE_STRFTIME 1 +#define HAVE_INET_ADDR 1 +#define HAVE_MEMCPY 1 +#define HAVE_SELECT 1 +#define HAVE_SOCKET 1 +#define HAVE_STRUCT_TIMEVAL 1 + +//#define HAVE_STRICMP 1 +#define HAVE_SIGACTION 1 +#define HAVE_SIGNAL_H 1 +#define HAVE_SIG_ATOMIC_T 1 + +#ifdef MACOS_SSL_SUPPORT +# define USE_SSLEAY 1 +# define USE_OPENSSL 1 +#endif + +#define CURL_DISABLE_LDAP 1 + +#define HAVE_RAND_STATUS 1 +#define HAVE_RAND_EGD 1 + +#define HAVE_IOCTL 1 +#define HAVE_IOCTL_FIONBIO 1 + +#define RETSIGTYPE void + +#define SIZEOF_INT 4 +#define SIZEOF_SHORT 2 +#define SIZEOF_SIZE_T 4 + +#define HAVE_GETNAMEINFO 1 +#define GETNAMEINFO_QUAL_ARG1 const +#define GETNAMEINFO_TYPE_ARG1 struct sockaddr * +#define GETNAMEINFO_TYPE_ARG2 socklen_t +#define GETNAMEINFO_TYPE_ARG46 size_t +#define GETNAMEINFO_TYPE_ARG7 int + +#define HAVE_RECV 1 +#define RECV_TYPE_ARG1 int +#define RECV_TYPE_ARG2 void * +#define RECV_TYPE_ARG3 size_t +#define RECV_TYPE_ARG4 int +#define RECV_TYPE_RETV ssize_t + +#define HAVE_RECVFROM 1 +#define RECVFROM_TYPE_ARG1 int +#define RECVFROM_TYPE_ARG2 void +#define RECVFROM_TYPE_ARG3 size_t +#define RECVFROM_TYPE_ARG4 int +#define RECVFROM_TYPE_ARG5 struct sockaddr +#define RECVFROM_TYPE_ARG6 int +#define RECVFROM_TYPE_RETV ssize_t +#define RECVFROM_TYPE_ARG2_IS_VOID 1 + +#define HAVE_SEND 1 +#define SEND_TYPE_ARG1 int +#define SEND_QUAL_ARG2 const +#define SEND_TYPE_ARG2 void * +#define SEND_TYPE_ARG3 size_T +#define SEND_TYPE_ARG4 int +#define SEND_TYPE_RETV ssize_t + +#define HAVE_EXTRA_STRICMP_H 1 +#define HAVE_EXTRA_STRDUP_H 1 + +#endif /* __LIB_CONFIG_MAC_H */ diff --git a/mobicore/common/curl/lib/config-os400.h b/mobicore/common/curl/lib/config-os400.h new file mode 100644 index 0000000000000000000000000000000000000000..370fc1138213ff1b6055a42382d4c3011009e6c4 --- /dev/null +++ b/mobicore/common/curl/lib/config-os400.h @@ -0,0 +1,520 @@ +/* ================================================================ */ +/* lib/config-os400.h - Hand crafted config file for OS/400 */ +/* ================================================================ */ + +#pragma enum(int) + +#undef PACKAGE + +/* Version number of this archive. */ +#undef VERSION + +/* Define if you have the getpass function. */ +#undef HAVE_GETPASS + +/* Define cpu-machine-OS */ +#define OS "OS/400" + +/* Define if you have the gethostbyaddr_r() function with 5 arguments */ +#define HAVE_GETHOSTBYADDR_R_5 + +/* Define if you have the gethostbyaddr_r() function with 7 arguments */ +#undef HAVE_GETHOSTBYADDR_R_7 + +/* Define if you have the gethostbyaddr_r() function with 8 arguments */ +#undef HAVE_GETHOSTBYADDR_R_8 + +/* OS400 supports a 3-argument ASCII version of gethostbyaddr_r(), but its + * prototype is incompatible with the "standard" one (1st argument is not + * const). However, getaddrinfo() is supported (ASCII version defined as + * a local wrapper in setup-os400.h) in a threadsafe way: we can then + * configure getaddrinfo() as such and get rid of gethostbyname_r() without + * loss of threadsafeness. */ +#undef HAVE_GETHOSTBYNAME_R +#undef HAVE_GETHOSTBYNAME_R_3 +#undef HAVE_GETHOSTBYNAME_R_5 +#undef HAVE_GETHOSTBYNAME_R_6 +#define HAVE_GETADDRINFO +#define HAVE_GETADDRINFO_THREADSAFE + +/* Define if you need the _REENTRANT define for some functions */ +#undef NEED_REENTRANT + +/* Define if you have the Kerberos4 libraries (including -ldes) */ +#undef HAVE_KRB4 + +/* Define if you want to enable IPv6 support */ +#define ENABLE_IPV6 + +/* Define if struct sockaddr_in6 has the sin6_scope_id member */ +#define HAVE_SOCKADDR_IN6_SIN6_SCOPE_ID 1 + +/* Define this to 'int' if ssize_t is not an available typedefed type */ +#undef ssize_t + +/* Define this as a suitable file to read random data from */ +#undef RANDOM_FILE + +/* Define this to your Entropy Gathering Daemon socket pathname */ +#undef EGD_SOCKET + +/* Define to 1 if you have the alarm function. */ +#define HAVE_ALARM 1 + +/* Define if you have the header file. */ +#undef HAVE_ALLOCA_H + +/* Define if you have the header file. */ +#define HAVE_ARPA_INET_H + +/* Define if you have the `closesocket' function. */ +#undef HAVE_CLOSESOCKET + +/* Define if you have the header file. */ +#undef HAVE_CRYPTO_H + +/* Define if you have the header file. */ +#undef HAVE_DES_H + +/* Define if you have the header file. */ +#undef HAVE_ERR_H + +/* Define if you have the header file. */ +#define HAVE_FCNTL_H + +/* Define if you have the `geteuid' function. */ +#define HAVE_GETEUID + +/* Define if you have the `gethostbyaddr' function. */ +#define HAVE_GETHOSTBYADDR + +/* Define if you have the `gethostbyaddr_r' function. */ +#define HAVE_GETHOSTBYADDR_R + +/* Define if you have the `gethostname' function. */ +#define HAVE_GETHOSTNAME + +/* Define if you have the header file. */ +#undef HAVE_GETOPT_H + +/* Define if you have the `getpass_r' function. */ +#undef HAVE_GETPASS_R + +/* Define if you have the `getpwuid' function. */ +#define HAVE_GETPWUID + +/* Define if you have the `getservbyname' function. */ +#define HAVE_GETSERVBYNAME + +/* Define if you have the `gettimeofday' function. */ +#define HAVE_GETTIMEOFDAY + +/* Define if you have the `timeval' struct. */ +#define HAVE_STRUCT_TIMEVAL + +/* Define if you have the `inet_addr' function. */ +#define HAVE_INET_ADDR + +/* Define if you have the header file. */ +#define HAVE_INTTYPES_H + +/* Define if you have the header file. */ +#undef HAVE_IO_H + +/* Define if you have the `krb_get_our_ip_for_realm' function. */ +#undef HAVE_KRB_GET_OUR_IP_FOR_REALM + +/* Define if you have the header file. */ +#undef HAVE_KRB_H + +/* Define if you have the `crypto' library (-lcrypto). */ +#undef HAVE_LIBCRYPTO + +/* Define if you have the `nsl' library (-lnsl). */ +#undef HAVE_LIBNSL + +/* Define if you have the `resolv' library (-lresolv). */ +#undef HAVE_LIBRESOLV + +/* Define if you have the `resolve' library (-lresolve). */ +#undef HAVE_LIBRESOLVE + +/* Define if you have the `socket' library (-lsocket). */ +#undef HAVE_LIBSOCKET + +/* Define if you have the `ssl' library (-lssl). */ +#undef HAVE_LIBSSL + +/* Define if you have GSS API. */ +#define HAVE_GSSAPI + +/* Define if you have the `ucb' library (-lucb). */ +#undef HAVE_LIBUCB + +/* Define if you have the `localtime_r' function. */ +#define HAVE_LOCALTIME_R + +/* Define if you have the header file. */ +#define HAVE_MALLOC_H + +/* Define if you need the malloc.h header file even with stdlib.h */ +/* #define NEED_MALLOC_H 1 */ + +/* Define if you have the header file. */ +#undef HAVE_MEMORY_H + +/* Define if you have the header file. */ +#define HAVE_NETDB_H + +/* Define if you have the header file. */ +#undef HAVE_NETINET_IF_ETHER_H + +/* Define if you have the header file. */ +#define HAVE_NETINET_IN_H + +/* Define if you have the header file. */ +#define HAVE_NET_IF_H + +/* Define if you have the header file. */ +#undef HAVE_OPENSSL_CRYPTO_H + +/* Define if you have the header file. */ +#undef HAVE_OPENSSL_ERR_H + +/* Define if you have the header file. */ +#undef HAVE_OPENSSL_PEM_H + +/* Define if you have the header file. */ +#undef HAVE_OPENSSL_RSA_H + +/* Define if you have the header file. */ +#undef HAVE_OPENSSL_SSL_H + +/* Define if you have the header file. */ +#undef HAVE_OPENSSL_X509_H + +/* Define if you have the header file. */ +#undef HAVE_PEM_H + +/* Define if you have the `perror' function. */ +#define HAVE_PERROR + +/* Define if you have the header file. */ +#define HAVE_PWD_H + +/* Define if you have the `RAND_egd' function. */ +#undef HAVE_RAND_EGD + +/* Define if you have the `RAND_screen' function. */ +#undef HAVE_RAND_SCREEN + +/* Define if you have the `RAND_status' function. */ +#undef HAVE_RAND_STATUS + +/* Define if you have the header file. */ +#undef HAVE_RSA_H + +/* Define if you have the `select' function. */ +#define HAVE_SELECT + +/* Define if you have the `setvbuf' function. */ +#define HAVE_SETVBUF + +/* Define if you have the header file. */ +#undef HAVE_SGTTY_H + +/* Define if you have the `sigaction' function. */ +#define HAVE_SIGACTION + +/* Define if you have the `signal' function. */ +#undef HAVE_SIGNAL + +/* Define if you have the header file. */ +#define HAVE_SIGNAL_H + +/* Define if sig_atomic_t is an available typedef. */ +#define HAVE_SIG_ATOMIC_T + +/* Define if sig_atomic_t is already defined as volatile. */ +#undef HAVE_SIG_ATOMIC_T_VOLATILE + +/* Define if you have the `socket' function. */ +#define HAVE_SOCKET + +/* Define if you have the header file. */ +#undef HAVE_SSL_H + +/* Define if you have the header file. */ +#undef HAVE_STDINT_H + +/* Define if you have the header file. */ +#define HAVE_STDLIB_H + +/* Define if you have the `strcasecmp' function. */ +#undef HAVE_STRCASECMP + +/* Define if you have the `strcmpi' function. */ +#undef HAVE_STRCMPI + +/* Define if you have the `strdup' function. */ +#undef HAVE_STRDUP + +/* Define if you have the `strftime' function. */ +#define HAVE_STRFTIME + +/* Define if you have the `stricmp' function. */ +#undef HAVE_STRICMP + +/* Define if you have the header file. */ +#define HAVE_STRINGS_H + +/* Define if you have the header file. */ +#define HAVE_STRING_H + +/* Define if you have the `strlcat' function. */ +#undef HAVE_STRLCAT + +/* Define if you have the `strlcpy' function. */ +#undef HAVE_STRLCPY + +/* Define if you have the header file. */ +#undef HAVE_STROPTS_H + +/* Define if you have the `strstr' function. */ +#define HAVE_STRSTR + +/* Define if you have the `strtok_r' function. */ +#define HAVE_STRTOK_R + +/* Define if you have the `strtoll' function. */ +#undef HAVE_STRTOLL /* Allows ASCII compile on V5R1. */ + +/* Define if you have the header file. */ +#define HAVE_SYS_PARAM_H + +/* Define if you have the header file. */ +#undef HAVE_SYS_SELECT_H + +/* Define if you have the header file. */ +#define HAVE_SYS_SOCKET_H + +/* Define if you have the header file. */ +#undef HAVE_SYS_SOCKIO_H + +/* Define if you have the header file. */ +#define HAVE_SYS_STAT_H + +/* Define if you have the header file. */ +#define HAVE_SYS_TIME_H + +/* Define if you have the header file. */ +#define HAVE_SYS_TYPES_H + +/* Define if you have the header file. */ +#define HAVE_SYS_UN_H + +/* Define if you have the header file. */ +#define HAVE_SYS_IOCTL_H + +/* Define if you have the `tcgetattr' function. */ +#undef HAVE_TCGETATTR + +/* Define if you have the `tcsetattr' function. */ +#undef HAVE_TCSETATTR + +/* Define if you have the header file. */ +#undef HAVE_TERMIOS_H + +/* Define if you have the header file. */ +#undef HAVE_TERMIO_H + +/* Define if you have the header file. */ +#define HAVE_TIME_H + +/* Define if you have the `uname' function. */ +#undef HAVE_UNAME + +/* Define if you have the header file. */ +#define HAVE_UNISTD_H + +/* Define if you have the header file. */ +#undef HAVE_WINSOCK_H + +/* Define if you have the header file. */ +#undef HAVE_X509_H + +/* Name of package */ +#undef PACKAGE + +/* Define as the return type of signal handlers (`int' or `void'). */ +#define RETSIGTYPE void + +/* The size of `int', as computed by sizeof. */ +#define SIZEOF_INT 4 + +/* The size of a `long double', as computed by sizeof. */ +#define SIZEOF_LONG_DOUBLE 8 + +/* Define if the compiler supports the 'long long' data type. */ +#define HAVE_LONGLONG + +/* The size of a `long long', as computed by sizeof. */ +#define SIZEOF_LONG_LONG 8 + +/* The size of `short', as computed by sizeof. */ +#define SIZEOF_SHORT 2 + +/* The size of `size_t', as computed by sizeof. */ +#define SIZEOF_SIZE_T 8 + +/* Whether long long constants must be suffixed by LL. */ + +#define HAVE_LL + +/* Define this if you have struct sockaddr_storage */ +#define HAVE_STRUCT_SOCKADDR_STORAGE + +/* Define if you have the ANSI C header files. */ +#define STDC_HEADERS + +/* Define if you can safely include both and . */ +#define TIME_WITH_SYS_TIME + +/* Version number of package */ +#undef VERSION + +/* Number of bits in a file offset, on hosts where this is settable. */ +#undef _FILE_OFFSET_BITS + +/* Define for large files, on AIX-style hosts. */ +#define _LARGE_FILES + +/* Define to empty if `const' does not conform to ANSI C. */ +#undef const + +/* type to use in place of in_addr_t if not defined */ +#define in_addr_t unsigned long + +/* Define to `unsigned' if does not define. */ +#undef size_t + +/* Define if you have the ioctl function. */ +#define HAVE_IOCTL + +/* Define if you have a working ioctl FIONBIO function. */ +#define HAVE_IOCTL_FIONBIO + +/* Define if you have a working ioctl SIOCGIFADDR function. */ +#define HAVE_IOCTL_SIOCGIFADDR + +/* To disable LDAP */ +#undef CURL_DISABLE_LDAP + +/* To avoid external use of library hidden symbols */ +#define CURL_HIDDEN_SYMBOLS + +/* External symbols need no special keyword. */ +#define CURL_EXTERN_SYMBOL + +/* Define if you have the ldap_url_parse procedure. */ +/* #define HAVE_LDAP_URL_PARSE */ /* Disabled because of an IBM bug. */ + +/* Define if you have the getnameinfo function. */ +/* OS400 has no ASCII version of this procedure: wrapped in setup-os400.h. */ +#define HAVE_GETNAMEINFO + +/* Define to the type qualifier of arg 1 for getnameinfo. */ +#define GETNAMEINFO_QUAL_ARG1 const + +/* Define to the type of arg 1 for getnameinfo. */ +#define GETNAMEINFO_TYPE_ARG1 struct sockaddr * + +/* Define to the type of arg 2 for getnameinfo. */ +#define GETNAMEINFO_TYPE_ARG2 socklen_t + +/* Define to the type of args 4 and 6 for getnameinfo. */ +#define GETNAMEINFO_TYPE_ARG46 socklen_t + +/* Define to the type of arg 7 for getnameinfo. */ +#define GETNAMEINFO_TYPE_ARG7 int + +/* Define if you have the recv function. */ +#define HAVE_RECV + +/* Define to the type of arg 1 for recv. */ +#define RECV_TYPE_ARG1 int + +/* Define to the type of arg 2 for recv. */ +#define RECV_TYPE_ARG2 char * + +/* Define to the type of arg 3 for recv. */ +#define RECV_TYPE_ARG3 int + +/* Define to the type of arg 4 for recv. */ +#define RECV_TYPE_ARG4 int + +/* Define to the function return type for recv. */ +#define RECV_TYPE_RETV int + +/* Define if you have the recvfrom function. */ +#define HAVE_RECVFROM + +/* Define to the type of arg 1 for recvfrom. */ +#define RECVFROM_TYPE_ARG1 int + +/* Define to the type pointed by arg 2 for recvfrom. */ +#define RECVFROM_TYPE_ARG2 char + +/* Define to the type of arg 3 for recvfrom. */ +#define RECVFROM_TYPE_ARG3 int + +/* Define to the type of arg 4 for recvfrom. */ +#define RECVFROM_TYPE_ARG4 int + +/* Define to the type pointed by arg 5 for recvfrom. */ +#define RECVFROM_TYPE_ARG5 struct sockaddr + +/* Define to the type pointed by arg 6 for recvfrom. */ +#define RECVFROM_TYPE_ARG6 int + +/* Define to the function return type for recvfrom. */ +#define RECVFROM_TYPE_RETV int + +/* Define if you have the send function. */ +#define HAVE_SEND + +/* Define to the type of arg 1 for send. */ +#define SEND_TYPE_ARG1 int + +/* Define to the type qualifier of arg 2 for send. */ +#define SEND_QUAL_ARG2 + +/* Define to the type of arg 2 for send. */ +#define SEND_TYPE_ARG2 char * + +/* Define to the type of arg 3 for send. */ +#define SEND_TYPE_ARG3 int + +/* Define to the type of arg 4 for send. */ +#define SEND_TYPE_ARG4 int + +/* Define to the function return type for send. */ +#define SEND_TYPE_RETV int + +/* Define to use the QsoSSL package. */ +#define USE_QSOSSL + +/* Use the system keyring as the default CA bundle. */ +#define CURL_CA_BUNDLE "/QIBM/UserData/ICSS/Cert/Server/DEFAULT.KDB" + +/* ---------------------------------------------------------------- */ +/* ADDITIONAL DEFINITIONS */ +/* ---------------------------------------------------------------- */ + +/* The following must be defined BEFORE system header files inclusion. */ + +#define __ptr128 /* No teraspace. */ +#define qadrt_use_fputc_inline /* Generate fputc() wrapper inline. */ +#define qadrt_use_fread_inline /* Generate fread() wrapper inline. */ +#define qadrt_use_fwrite_inline /* Generate fwrite() wrapper inline. */ + diff --git a/mobicore/common/curl/lib/config-riscos.h b/mobicore/common/curl/lib/config-riscos.h new file mode 100644 index 0000000000000000000000000000000000000000..84683aa2668c3cbeee1b749165fb0bbe6ff49887 --- /dev/null +++ b/mobicore/common/curl/lib/config-riscos.h @@ -0,0 +1,478 @@ +/* curl_config.h.in. Generated automatically from configure.in by autoheader. */ +/* Name of this package! */ +#undef PACKAGE + +/* Version number of this archive. */ +#undef VERSION + +/* Define if you have the getpass function. */ +#undef HAVE_GETPASS + +/* Define cpu-machine-OS */ +#define OS "ARM-RISC OS" + +/* Define if you have the gethostbyaddr_r() function with 5 arguments */ +#undef HAVE_GETHOSTBYADDR_R_5 + +/* Define if you have the gethostbyaddr_r() function with 7 arguments */ +#undef HAVE_GETHOSTBYADDR_R_7 + +/* Define if you have the gethostbyaddr_r() function with 8 arguments */ +#undef HAVE_GETHOSTBYADDR_R_8 + +/* Define if you have the gethostbyname_r() function with 3 arguments */ +#undef HAVE_GETHOSTBYNAME_R_3 + +/* Define if you have the gethostbyname_r() function with 5 arguments */ +#undef HAVE_GETHOSTBYNAME_R_5 + +/* Define if you have the gethostbyname_r() function with 6 arguments */ +#undef HAVE_GETHOSTBYNAME_R_6 + +/* Define if you need the _REENTRANT define for some functions */ +#undef NEED_REENTRANT + +/* Define if you have the Kerberos4 libraries (including -ldes) */ +#undef HAVE_KRB4 + +/* Define if you want to enable IPv6 support */ +#undef ENABLE_IPV6 + +/* Define if struct sockaddr_in6 has the sin6_scope_id member */ +#define HAVE_SOCKADDR_IN6_SIN6_SCOPE_ID 1 + +/* Define this to 'int' if ssize_t is not an available typedefed type */ +#undef ssize_t + +/* Define this as a suitable file to read random data from */ +#undef RANDOM_FILE + +/* Define this to your Entropy Gathering Daemon socket pathname */ +#undef EGD_SOCKET + +/* Define if you want to enable IPv6 support */ +#undef ENABLE_IPV6 + +/* Define to 1 if you have the alarm function. */ +#define HAVE_ALARM 1 + +/* Define if you have the header file. */ +#define HAVE_ALLOCA_H + +/* Define if you have the header file. */ +#define HAVE_ARPA_INET_H + +/* Define if you have the `closesocket' function. */ +#undef HAVE_CLOSESOCKET + +/* Define if you have the header file. */ +#undef HAVE_CRYPTO_H + +/* Define if you have the header file. */ +#undef HAVE_DES_H + +/* Define if you have the header file. */ +#undef HAVE_ERR_H + +/* Define if you have the header file. */ +#define HAVE_FCNTL_H + +/* Define if getaddrinfo exists and works */ +#define HAVE_GETADDRINFO + +/* Define if you have the `geteuid' function. */ +#undef HAVE_GETEUID + +/* Define if you have the `gethostbyaddr' function. */ +#define HAVE_GETHOSTBYADDR + +/* Define if you have the `gethostbyaddr_r' function. */ +#undef HAVE_GETHOSTBYADDR_R + +/* Define if you have the `gethostbyname_r' function. */ +#undef HAVE_GETHOSTBYNAME_R + +/* Define if you have the `gethostname' function. */ +#define HAVE_GETHOSTNAME + +/* Define if you have the header file. */ +#define HAVE_GETOPT_H + +/* Define if you have the `getpass_r' function. */ +#undef HAVE_GETPASS_R + +/* Define if you have the `getpwuid' function. */ +#undef HAVE_GETPWUID + +/* Define if you have the `getservbyname' function. */ +#undef HAVE_GETSERVBYNAME + +/* Define if you have the `gettimeofday' function. */ +#define HAVE_GETTIMEOFDAY + +/* Define if you have the `timeval' struct. */ +#define HAVE_STRUCT_TIMEVAL + +/* Define if you have the `inet_addr' function. */ +#undef HAVE_INET_ADDR + +/* Define if you have the header file. */ +#define HAVE_INTTYPES_H + +/* Define if you have the header file. */ +#define HAVE_IO_H + +/* Define if you have the `krb_get_our_ip_for_realm' function. */ +#undef HAVE_KRB_GET_OUR_IP_FOR_REALM + +/* Define if you have the header file. */ +#undef HAVE_KRB_H + +/* Define if you have the `crypto' library (-lcrypto). */ +#undef HAVE_LIBCRYPTO + +/* Define if you have the `nsl' library (-lnsl). */ +#undef HAVE_LIBNSL + +/* Define if you have the `resolv' library (-lresolv). */ +#undef HAVE_LIBRESOLV + +/* Define if you have the `resolve' library (-lresolve). */ +#undef HAVE_LIBRESOLVE + +/* Define if you have the `socket' library (-lsocket). */ +#undef HAVE_LIBSOCKET + +/* Define if you have the `ssl' library (-lssl). */ +#undef HAVE_LIBSSL + +/* Define if you have the `ucb' library (-lucb). */ +#undef HAVE_LIBUCB + +/* Define if you have the `localtime_r' function. */ +#undef HAVE_LOCALTIME_R + +/* Define if you have the header file. */ +#define HAVE_MALLOC_H + +/* Define if you need the malloc.h header file even with stdlib.h */ +/* #define NEED_MALLOC_H 1 */ + +/* Define if you have the header file. */ +#undef HAVE_MEMORY_H + +/* Define if you have the header file. */ +#define HAVE_NETDB_H + +/* Define if you have the header file. */ +#undef HAVE_NETINET_IF_ETHER_H + +/* Define if you have the header file. */ +#define HAVE_NETINET_IN_H + +/* Define if you have the header file. */ +#define HAVE_NET_IF_H + +/* Define if you have the header file. */ +#undef HAVE_OPENSSL_CRYPTO_H + +/* Define if you have the header file. */ +#undef HAVE_OPENSSL_ERR_H + +/* Define if you have the header file. */ +#undef HAVE_OPENSSL_PEM_H + +/* Define if you have the header file. */ +#undef HAVE_OPENSSL_RSA_H + +/* Define if you have the header file. */ +#undef HAVE_OPENSSL_SSL_H + +/* Define if you have the header file. */ +#undef HAVE_OPENSSL_X509_H + +/* Define if you have the header file. */ +#undef HAVE_PEM_H + +/* Define if you have the `perror' function. */ +#undef HAVE_PERROR + +/* Define if you have the header file. */ +#undef HAVE_PWD_H + +/* Define if you have the `RAND_egd' function. */ +#undef HAVE_RAND_EGD + +/* Define if you have the `RAND_screen' function. */ +#undef HAVE_RAND_SCREEN + +/* Define if you have the `RAND_status' function. */ +#undef HAVE_RAND_STATUS + +/* Define if you have the header file. */ +#undef HAVE_RSA_H + +/* Define if you have the `select' function. */ +#define HAVE_SELECT + +/* Define if you have the `setvbuf' function. */ +#undef HAVE_SETVBUF + +/* Define if you have the header file. */ +#define HAVE_SGTTY_H + +/* Define if you have the `sigaction' function. */ +#undef HAVE_SIGACTION + +/* Define if you have the `signal' function. */ +#define HAVE_SIGNAL + +/* Define if you have the header file. */ +#define HAVE_SIGNAL_H + +/* Define if sig_atomic_t is an available typedef. */ +#define HAVE_SIG_ATOMIC_T + +/* Define if sig_atomic_t is already defined as volatile. */ +#undef HAVE_SIG_ATOMIC_T_VOLATILE + +/* Define if you have the `socket' function. */ +#define HAVE_SOCKET + +/* Define if you have the header file. */ +#undef HAVE_SSL_H + +/* Define if you have the header file. */ +#undef HAVE_STDINT_H + +/* Define if you have the header file. */ +#define HAVE_STDLIB_H + +/* Define if you have the `strcasecmp' function. */ +#undef HAVE_STRCASECMP + +/* Define if you have the `strcmpi' function. */ +#undef HAVE_STRCMPI + +/* Define if you have the `strdup' function. */ +#define HAVE_STRDUP + +/* Define if you have the `strftime' function. */ +#define HAVE_STRFTIME + +/* Define if you have the `stricmp' function. */ +#define HAVE_STRICMP + +/* Define if you have the header file. */ +#undef HAVE_STRINGS_H + +/* Define if you have the header file. */ +#define HAVE_STRING_H + +/* Define if you have the `strlcat' function. */ +#undef HAVE_STRLCAT + +/* Define if you have the `strlcpy' function. */ +#undef HAVE_STRLCPY + +/* Define if you have the `strstr' function. */ +#define HAVE_STRSTR + +/* Define if you have the `strtok_r' function. */ +#undef HAVE_STRTOK_R + +/* Define if you have the `strtoll' function. */ +#undef HAVE_STRTOLL + +/* Define if you have the header file. */ +#undef HAVE_SYS_PARAM_H + +/* Define if you have the header file. */ +#undef HAVE_SYS_SELECT_H + +/* Define if you have the header file. */ +#define HAVE_SYS_SOCKET_H + +/* Define if you have the header file. */ +#undef HAVE_SYS_SOCKIO_H + +/* Define if you have the header file. */ +#undef HAVE_SYS_STAT_H + +/* Define if you have the header file. */ +#define HAVE_SYS_TIME_H + +/* Define if you have the header file. */ +#define HAVE_SYS_TYPES_H + +/* Define if you have the `tcgetattr' function. */ +#define HAVE_TCGETATTR + +/* Define if you have the `tcsetattr' function. */ +#define HAVE_TCSETATTR + +/* Define if you have the header file. */ +#define HAVE_TERMIOS_H + +/* Define if you have the header file. */ +#undef HAVE_TERMIO_H + +/* Define if you have the header file. */ +#undef HAVE_TIME_H + +/* Define if you have the `uname' function. */ +#define HAVE_UNAME + +/* Define if you have the header file. */ +#define HAVE_UNISTD_H + +/* Define if you have the header file. */ +#undef HAVE_WINSOCK_H + +/* Define if you have the header file. */ +#undef HAVE_X509_H + +/* Name of package */ +#undef PACKAGE + +/* Define as the return type of signal handlers (`int' or `void'). */ +#define RETSIGTYPE void + +/* The size of `int', as computed by sizeof. */ +#define SIZEOF_INT 4 + +/* The size of `long double', as computed by sizeof. */ +#undef SIZEOF_LONG_DOUBLE + +/* The size of `long long', as computed by sizeof. */ +#undef SIZEOF_LONG_LONG + +/* The size of `short', as computed by sizeof. */ +#define SIZEOF_SHORT 2 + +/* The size of `size_t', as computed by sizeof. */ +#define SIZEOF_SIZE_T 4 + +/* Define if you have the ANSI C header files. */ +#undef STDC_HEADERS + +/* Define if you can safely include both and . */ +#undef TIME_WITH_SYS_TIME + +/* Version number of package */ +#undef VERSION + +/* Define if on AIX 3. + System headers sometimes define this. + We just want to avoid a redefinition error message. */ +#ifndef _ALL_SOURCE +# undef _ALL_SOURCE +#endif + +/* Number of bits in a file offset, on hosts where this is settable. */ +#undef _FILE_OFFSET_BITS + +/* Define for large files, on AIX-style hosts. */ +#undef _LARGE_FILES + +/* Define to empty if `const' does not conform to ANSI C. */ +#undef const + +/* Define to `unsigned' if does not define. */ +#undef size_t + +/* Define to `int' if does not define. */ +#undef ssize_t + +/* Define if you have the ioctl function. */ +#define HAVE_IOCTL + +/* Define if you have a working ioctl FIONBIO function. */ +#define HAVE_IOCTL_FIONBIO + +/* to disable LDAP */ +#define CURL_DISABLE_LDAP + +/* Define if you have the getnameinfo function. */ +#define HAVE_GETNAMEINFO 1 + +/* Define to the type qualifier of arg 1 for getnameinfo. */ +#define GETNAMEINFO_QUAL_ARG1 const + +/* Define to the type of arg 1 for getnameinfo. */ +#define GETNAMEINFO_TYPE_ARG1 struct sockaddr * + +/* Define to the type of arg 2 for getnameinfo. */ +#define GETNAMEINFO_TYPE_ARG2 socklen_t + +/* Define to the type of args 4 and 6 for getnameinfo. */ +#define GETNAMEINFO_TYPE_ARG46 size_t + +/* Define to the type of arg 7 for getnameinfo. */ +#define GETNAMEINFO_TYPE_ARG7 int + +/* Define if you have the recv function. */ +#define HAVE_RECV 1 + +/* Define to the type of arg 1 for recv. */ +#define RECV_TYPE_ARG1 int + +/* Define to the type of arg 2 for recv. */ +#define RECV_TYPE_ARG2 void * + +/* Define to the type of arg 3 for recv. */ +#define RECV_TYPE_ARG3 size_t + +/* Define to the type of arg 4 for recv. */ +#define RECV_TYPE_ARG4 int + +/* Define to the function return type for recv. */ +#define RECV_TYPE_RETV ssize_t + +/* Define 1 if you have the recvfrom function. */ +#define HAVE_RECVFROM 1 + +/* Define to the type of arg 1 for recvfrom. */ +#define RECVFROM_TYPE_ARG1 int + +/* Define to the type pointed by arg 2 for recvfrom. */ +#define RECVFROM_TYPE_ARG2 void + +/* Define to 1 if the type pointed by arg 2 for recvfrom is void. */ +#define RECVFROM_TYPE_ARG2_IS_VOID 1 + +/* Define to the type of arg 3 for recvfrom. */ +#define RECVFROM_TYPE_ARG3 size_t + +/* Define to the type of arg 4 for recvfrom. */ +#define RECVFROM_TYPE_ARG4 int + +/* Define to the type pointed by arg 5 for recvfrom. */ +#define RECVFROM_TYPE_ARG5 struct sockaddr + +/* Define to the type pointed by arg 6 for recvfrom. */ +#define RECVFROM_TYPE_ARG6 int + +/* Define to the function return type for recvfrom. */ +#define RECVFROM_TYPE_RETV ssize_t + +/* Define if you have the send function. */ +#define HAVE_SEND 1 + +/* Define to the type of arg 1 for send. */ +#define SEND_TYPE_ARG1 int + +/* Define to the type qualifier of arg 2 for send. */ +#define SEND_QUAL_ARG2 const + +/* Define to the type of arg 2 for send. */ +#define SEND_TYPE_ARG2 void * + +/* Define to the type of arg 3 for send. */ +#define SEND_TYPE_ARG3 size_t + +/* Define to the type of arg 4 for send. */ +#define SEND_TYPE_ARG4 int + +/* Define to the function return type for send. */ +#define SEND_TYPE_RETV ssize_t diff --git a/mobicore/common/curl/lib/config-symbian.h b/mobicore/common/curl/lib/config-symbian.h new file mode 100644 index 0000000000000000000000000000000000000000..9f8b74a575108245a37bc075ae86e88161568b19 --- /dev/null +++ b/mobicore/common/curl/lib/config-symbian.h @@ -0,0 +1,811 @@ +/* config-symbian.h. Manually generated. */ + +/* when building libcurl itself */ +/* #undef BUILDING_LIBCURL */ + +/* Location of default ca bundle */ +/* #define CURL_CA_BUNDLE "/etc/pki/tls/certs/ca-bundle.crt"*/ + +/* Location of default ca path */ +/* #undef CURL_CA_PATH */ + +/* to disable cookies support */ +/* #undef CURL_DISABLE_COOKIES */ + +/* to disable cryptographic authentication */ +/* #undef CURL_DISABLE_CRYPTO_AUTH */ + +/* to disable DICT */ +/* #undef CURL_DISABLE_DICT */ + +/* to disable FILE */ +/* #undef CURL_DISABLE_FILE */ + +/* to disable FTP */ +/* #undef CURL_DISABLE_FTP */ + +/* to disable HTTP */ +/* #undef CURL_DISABLE_HTTP */ + +/* to disable LDAP */ +#define CURL_DISABLE_LDAP 1 + +/* to disable LDAPS */ +#define CURL_DISABLE_LDAPS 1 + +/* to disable TELNET */ +/* #undef CURL_DISABLE_TELNET */ + +/* to disable TFTP */ +/* #undef CURL_DISABLE_TFTP */ + +/* to disable verbose strings */ +/* #define CURL_DISABLE_VERBOSE_STRINGS 1*/ + +/* to make a symbol visible */ +/*#define CURL_EXTERN_SYMBOL __declspec(dllexport)*/ + +/* to enable hidden symbols */ +/*#define CURL_HIDDEN_SYMBOLS 1*/ + +/* Use Windows LDAP implementation */ +/* #undef CURL_LDAP_WIN */ + +/* when not building a shared library */ +/* #undef CURL_STATICLIB */ + +/* your Entropy Gathering Daemon socket pathname */ +/* #undef EGD_SOCKET */ + +/* Define if you want to enable IPv6 support */ +#define ENABLE_IPV6 1 + +/* Define if struct sockaddr_in6 has the sin6_scope_id member */ +#define HAVE_SOCKADDR_IN6_SIN6_SCOPE_ID 1 + +/* Define to the type qualifier of arg 1 for getnameinfo. */ +#define GETNAMEINFO_QUAL_ARG1 const + +/* Define to the type of arg 1 for getnameinfo. */ +#define GETNAMEINFO_TYPE_ARG1 struct sockaddr * + +/* Define to the type of arg 2 for getnameinfo. */ +#define GETNAMEINFO_TYPE_ARG2 socklen_t + +/* Define to the type of args 4 and 6 for getnameinfo. */ +#define GETNAMEINFO_TYPE_ARG46 size_t + +/* Define to the type of arg 7 for getnameinfo. */ +#define GETNAMEINFO_TYPE_ARG7 int + +/* Define to 1 if you have the header file. */ +/*#define HAVE_ALLOCA_H 1*/ + +/* Define to 1 if you have the header file. */ +#define HAVE_ARPA_INET_H 1 + +/* Define to 1 if you have the header file. */ +/*#define HAVE_ARPA_TFTP_H 1*/ + +/* Define to 1 if you have the header file. */ +#define HAVE_ASSERT_H 1 + +/* Define to 1 if you have the `basename' function. */ +/*#define HAVE_BASENAME 1*/ + +/* Define to 1 if bool is an available type. */ +/*#define HAVE_BOOL_T 1*/ + +/* Define to 1 if you have the `closesocket' function. */ +/* #undef HAVE_CLOSESOCKET */ + +/* Define to 1 if you have the `CRYPTO_cleanup_all_ex_data' function. */ +/*#define HAVE_CRYPTO_CLEANUP_ALL_EX_DATA 1*/ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_CRYPTO_H */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_DES_H */ + +/* Define to 1 if you have the header file. */ +#define HAVE_DLFCN_H 1 + +/* Define to 1 if you have the `ENGINE_load_builtin_engines' function. */ +/*#define HAVE_ENGINE_LOAD_BUILTIN_ENGINES 1*/ + +/* Define to 1 if you have the header file. */ +#define HAVE_ERRNO_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_ERR_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_FCNTL_H 1 + +/* Define to 1 if you have the fcntl function. */ +#define HAVE_FCNTL 1 + +/* Define to 1 if you have a working fcntl O_NONBLOCK function. */ +#define HAVE_FCNTL_O_NONBLOCK 1 + +/* Define to 1 if you have the `fork' function. */ +/*#define HAVE_FORK 1*/ + +/* Define to 1 if you have the `ftruncate' function. */ +#define HAVE_FTRUNCATE 1 + +/* Define if getaddrinfo exists and works */ +#define HAVE_GETADDRINFO 1 + +/* Define to 1 if you have the `geteuid' function. */ +#define HAVE_GETEUID 1 + +/* Define to 1 if you have the `gethostbyaddr' function. */ +#define HAVE_GETHOSTBYADDR 1 + +/* If you have gethostbyname */ +#define HAVE_GETHOSTBYNAME 1 + +/* Define to 1 if you have the `gethostbyname_r' function. */ +/* #undef HAVE_GETHOSTBYNAME_R */ + +/* gethostbyname_r() takes 3 args */ +/* #undef HAVE_GETHOSTBYNAME_R_3 */ + +/* gethostbyname_r() takes 5 args */ +/* #undef HAVE_GETHOSTBYNAME_R_5 */ + +/* gethostbyname_r() takes 6 args */ +/* #undef HAVE_GETHOSTBYNAME_R_6 */ + +/* Define to 1 if you have the getnameinfo function. */ +#define HAVE_GETNAMEINFO 1 + +/* Define to 1 if you have the `getpass_r' function. */ +/* #undef HAVE_GETPASS_R */ + +/* Define to 1 if you have the `getppid' function. */ +#define HAVE_GETPPID 1 + +/* Define to 1 if you have the `getprotobyname' function. */ +#define HAVE_GETPROTOBYNAME 1 + +/* Define to 1 if you have the `getpwuid' function. */ +#define HAVE_GETPWUID 1 + +/* Define to 1 if you have the `getrlimit' function. */ +/*#define HAVE_GETRLIMIT 1*/ + +/* Define to 1 if you have the `gettimeofday' function. */ +#define HAVE_GETTIMEOFDAY 1 + +/* we have a glibc-style strerror_r() */ +/* #undef HAVE_GLIBC_STRERROR_R */ + +/* Define to 1 if you have the `gmtime_r' function. */ +#define HAVE_GMTIME_R 1 + +/* if you have the gssapi libraries */ +/* #undef HAVE_GSSAPI */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_GSSAPI_GSSAPI_GENERIC_H */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_GSSAPI_GSSAPI_H */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_GSSAPI_GSSAPI_KRB5_H */ + +/* if you have the GNU gssapi libraries */ +/* #undef HAVE_GSSGNU */ + +/* if you have the Heimdal gssapi libraries */ +/* #undef HAVE_GSSHEIMDAL */ + +/* if you have the MIT gssapi libraries */ +/* #undef HAVE_GSSMIT */ + +/* Define to 1 if you have the `idna_strerror' function. */ +/*#define HAVE_IDNA_STRERROR 1*/ + +/* Define to 1 if you have the `idn_free' function. */ +/*#define HAVE_IDN_FREE 1*/ + +/* Define to 1 if you have the header file. */ +/*#define HAVE_IDN_FREE_H 1*/ + +/* Define to 1 if you have the `inet_addr' function. */ +/*#define HAVE_INET_ADDR 1*/ + +/* Define to 1 if you have a IPv6 capable working inet_ntop function. */ +/*#define HAVE_INET_NTOP 1*/ + +/* Define to 1 if you have a IPv6 capable working inet_pton function. */ +/*#define HAVE_INET_PTON 1*/ + +/* Define to 1 if you have the header file. */ +#define HAVE_INTTYPES_H 1 + +/* Define to 1 if you have the ioctl function. */ +#define HAVE_IOCTL 1 + +/* Define to 1 if you have a working ioctl FIONBIO function. */ +#define HAVE_IOCTL_FIONBIO 1 + +/* Define to 1 if you have the ioctlsocket function. */ +/* #undef HAVE_IOCTLSOCKET */ + +/* Define to 1 if you have a working ioctlsocket FIONBIO function. */ +/* #undef HAVE_IOCTLSOCKET_FIONBIO */ + +/* Define to 1 if you have the IoctlSocket camel case function. */ +/* #undef HAVE_IOCTLSOCKET_CAMEL */ + +/* Define to 1 if you have a working IoctlSocket camel case FIONBIO function. */ +/* #undef HAVE_IOCTLSOCKET_CAMEL_FIONBIO */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_IO_H */ + +/* if you have the Kerberos4 libraries (including -ldes) */ +/* #undef HAVE_KRB4 */ + +/* Define to 1 if you have the `krb_get_our_ip_for_realm' function. */ +/* #undef HAVE_KRB_GET_OUR_IP_FOR_REALM */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_KRB_H */ + +/* Define to 1 if you have the lber.h header file. */ +/*#define HAVE_LBER_H 1*/ + +/* Define to 1 if you have the ldapssl.h header file. */ +/* #undef HAVE_LDAPSSL_H */ + +/* Define to 1 if you have the ldap.h header file. */ +/*#define HAVE_LDAP_H 1*/ + +/* Use LDAPS implementation */ +/*#define HAVE_LDAP_SSL 1*/ + +/* Define to 1 if you have the ldap_ssl.h header file. */ +/* #undef HAVE_LDAP_SSL_H */ + +/* Define to 1 if you have the `ldap_url_parse' function. */ +/*#define HAVE_LDAP_URL_PARSE 1*/ + +/* Define to 1 if you have the header file. */ +/*#define HAVE_LIBGEN_H 1*/ + +/* Define to 1 if you have the `idn' library (-lidn). */ +/*#define HAVE_LIBIDN 1*/ + +/* Define to 1 if you have the `resolv' library (-lresolv). */ +/* #undef HAVE_LIBRESOLV */ + +/* Define to 1 if you have the `resolve' library (-lresolve). */ +/* #undef HAVE_LIBRESOLVE */ + +/* Define to 1 if you have the `socket' library (-lsocket). */ +/* #undef HAVE_LIBSOCKET */ + +/* Define to 1 if you have the `ssh2' library (-lssh2). */ +/*#define HAVE_LIBSSH2 1*/ + +/* Define to 1 if you have the header file. */ +/*#define HAVE_LIBSSH2_H 1*/ + +/* Define to 1 if you have the `ssl' library (-lssl). */ +/*#define HAVE_LIBSSL 1*/ + +/* Define to 1 if you have the header file. */ +#define HAVE_LIMITS_H 1 + +/* if your compiler supports LL */ +#define HAVE_LL 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_LOCALE_H 1 + +/* Define to 1 if you have the `localtime_r' function. */ +#define HAVE_LOCALTIME_R 1 + +/* Define to 1 if the compiler supports the 'long long' data type. */ +#define HAVE_LONGLONG 1 + +/* Define to 1 if you have the malloc.h header file. */ +/*#define HAVE_MALLOC_H 1*/ + +/* Define to 1 if you have the header file. */ +#define HAVE_MEMORY_H 1 + +/* Define to 1 if you have the MSG_NOSIGNAL flag. */ +/*#define HAVE_MSG_NOSIGNAL 1*/ + +/* Define to 1 if you have the header file. */ +#define HAVE_NETDB_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_NETINET_IN_H 1 + +/* Define to 1 if you have the header file. */ +/*#define HAVE_NETINET_TCP_H 1*/ + +/* Define to 1 if you have the header file. */ +#define HAVE_NET_IF_H 1 + +/* Define to 1 if NI_WITHSCOPEID exists and works. */ +/*#define HAVE_NI_WITHSCOPEID 1*/ + +/* we have no strerror_r() proto */ +/* #undef HAVE_NO_STRERROR_R_DECL */ + +/* if you have an old MIT gssapi library, lacking GSS_C_NT_HOSTBASED_SERVICE + */ +/* #undef HAVE_OLD_GSSMIT */ + +/* Define to 1 if you have the header file. */ +/*#define HAVE_OPENSSL_CRYPTO_H 1*/ + +/* Define to 1 if you have the header file. */ +/*#define HAVE_OPENSSL_ENGINE_H 1*/ + +/* Define to 1 if you have the header file. */ +/*#define HAVE_OPENSSL_ERR_H 1*/ + +/* Define to 1 if you have the header file. */ +/*#define HAVE_OPENSSL_PEM_H 1*/ + +/* Define to 1 if you have the header file. */ +/*#define HAVE_OPENSSL_PKCS12_H 1*/ + +/* Define to 1 if you have the header file. */ +/*#define HAVE_OPENSSL_RSA_H 1*/ + +/* Define to 1 if you have the header file. */ +/*#define HAVE_OPENSSL_SSL_H 1*/ + +/* Define to 1 if you have the header file. */ +/*#define HAVE_OPENSSL_X509_H 1*/ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_PEM_H */ + +/* Define to 1 if you have the `perror' function. */ +#define HAVE_PERROR 1 + +/* Define to 1 if you have the `pipe' function. */ +#define HAVE_PIPE 1 + +/* if you have the function PK11_CreateGenericObject */ +/* #undef HAVE_PK11_CREATEGENERICOBJECT */ + +/* Define to 1 if you have the `poll' function. */ +/*#define HAVE_POLL 1*/ + +/* If you have a fine poll */ +/*#define HAVE_POLL_FINE 1*/ + +/* Define to 1 if you have the header file. */ +/*#define HAVE_POLL_H 1*/ + +/* we have a POSIX-style strerror_r() */ +#define HAVE_POSIX_STRERROR_R 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_PWD_H 1 + +/* Define to 1 if you have the `RAND_egd' function. */ +#define HAVE_RAND_EGD 1 + +/* Define to 1 if you have the `RAND_screen' function. */ +/* #undef HAVE_RAND_SCREEN */ + +/* Define to 1 if you have the `RAND_status' function. */ +/*#define HAVE_RAND_STATUS 1*/ + +/* Define to 1 if you have the recv function. */ +#define HAVE_RECV 1 + +/* Define to 1 if you have the recvfrom function. */ +#define HAVE_RECVFROM 1 + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_RSA_H */ + +/* Define to 1 if you have the select function. */ +#define HAVE_SELECT 1 + +/* Define to 1 if you have the send function. */ +#define HAVE_SEND 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SETJMP_H 1 + +/* Define to 1 if you have the `setlocale' function. */ +#define HAVE_SETLOCALE 1 + +/* Define to 1 if you have the `setmode' function. */ +/* #undef HAVE_SETMODE */ + +/* Define to 1 if you have the `setrlimit' function. */ +/*#define HAVE_SETRLIMIT 1*/ + +/* Define to 1 if you have the setsockopt function. */ +/* #undef HAVE_SETSOCKOPT */ + +/* Define to 1 if you have a working setsockopt SO_NONBLOCK function. */ +/* #undef HAVE_SETSOCKOPT_SO_NONBLOCK */ + +/* Define to 1 if you have the header file. */ +/*#define HAVE_SGTTY_H 1*/ + +/* Define to 1 if you have the `sigaction' function. */ +/*#define HAVE_SIGACTION 1*/ + +/* Define to 1 if you have the `siginterrupt' function. */ +/*#define HAVE_SIGINTERRUPT 1*/ + +/* Define to 1 if you have the `signal' function. */ +/*#define HAVE_SIGNAL 1*/ + +/* Define to 1 if you have the header file. */ +#define HAVE_SIGNAL_H 1 + +/* If you have sigsetjmp */ +/*#define HAVE_SIGSETJMP 1*/ + +/* Define to 1 if sig_atomic_t is an available typedef. */ +/*#define HAVE_SIG_ATOMIC_T 1*/ + +/* Define to 1 if sig_atomic_t is already defined as volatile. */ +/* #undef HAVE_SIG_ATOMIC_T_VOLATILE */ + +/* Define to 1 if you have the `socket' function. */ +#define HAVE_SOCKET 1 + +/* Define this if you have the SPNEGO library fbopenssl */ +/* #undef HAVE_SPNEGO */ + +/* Define to 1 if you have the `SSL_get_shutdown' function. */ +/*#define HAVE_SSL_GET_SHUTDOWN 1*/ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_SSL_H */ + +/* Define to 1 if you have the header file. */ +#define HAVE_STDBOOL_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STDINT_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STDIO_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STDLIB_H 1 + +/* Define to 1 if you have the `strcasecmp' function. */ +#define HAVE_STRCASECMP 1 + +/* Define to 1 if you have the `strcasestr' function. */ +#define HAVE_STRCASESTR 1 + +/* Define to 1 if you have the `strcmpi' function. */ +/* #undef HAVE_STRCMPI */ + +/* Define to 1 if you have the `strdup' function. */ +#define HAVE_STRDUP 1 + +/* Define to 1 if you have the `strerror_r' function. */ +#define HAVE_STRERROR_R 1 + +/* Define to 1 if you have the `stricmp' function. */ +/* #undef HAVE_STRICMP */ + +/* Define to 1 if you have the header file. */ +#define HAVE_STRINGS_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STRING_H 1 + +/* Define to 1 if you have the `strlcat' function. */ +#define HAVE_STRLCAT 1 + +/* Define to 1 if you have the `strlcpy' function. */ +#define HAVE_STRLCPY 1 + +/* Define to 1 if you have the `strstr' function. */ +#define HAVE_STRSTR 1 + +/* Define to 1 if you have the `strtok_r' function. */ +#define HAVE_STRTOK_R 1 + +/* Define to 1 if you have the `strtoll' function. */ +#define HAVE_STRTOLL 1 + +/* if struct sockaddr_storage is defined */ +#define HAVE_STRUCT_SOCKADDR_STORAGE 1 + +/* Define to 1 if you have the timeval struct. */ +#define HAVE_STRUCT_TIMEVAL 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_FILIO_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_IOCTL_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_PARAM_H 1 + +/* Define to 1 if you have the header file. */ +/*#define HAVE_SYS_POLL_H 1*/ + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_RESOURCE_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_SELECT_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_SOCKET_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_SOCKIO_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_STAT_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_TIME_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_TYPES_H 1 + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_SYS_UTIME_H */ + +/* Define to 1 if you have the header file. */ +/*#define HAVE_TERMIOS_H 1*/ + +/* Define to 1 if you have the header file. */ +/*#define HAVE_TERMIO_H 1*/ + +/* Define to 1 if you have the header file. */ +#define HAVE_TIME_H 1 + +/* Define to 1 if you have the header file. */ +/*#define HAVE_TLD_H 1*/ + +/* Define to 1 if you have the `tld_strerror' function. */ +/*#define HAVE_TLD_STRERROR 1*/ + +/* Define to 1 if you have the `uname' function. */ +#define HAVE_UNAME 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_UNISTD_H 1 + +/* Define to 1 if you have the `utime' function. */ +#define HAVE_UTIME 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_UTIME_H 1 + +/* Define to 1 if compiler supports C99 variadic macro style. */ +#define HAVE_VARIADIC_MACROS_C99 1 + +/* Define to 1 if compiler supports old gcc variadic macro style. */ +/*#define HAVE_VARIADIC_MACROS_GCC 1*/ + +/* Define to 1 if you have the winber.h header file. */ +/* #undef HAVE_WINBER_H */ + +/* Define to 1 if you have the windows.h header file. */ +/* #undef HAVE_WINDOWS_H */ + +/* Define to 1 if you have the winldap.h header file. */ +/* #undef HAVE_WINLDAP_H */ + +/* Define to 1 if you have the winsock2.h header file. */ +/* #undef HAVE_WINSOCK2_H */ + +/* Define to 1 if you have the winsock.h header file. */ +/* #undef HAVE_WINSOCK_H */ + +/* Define this symbol if your OS supports changing the contents of argv */ +/*#define HAVE_WRITABLE_ARGV 1*/ + +/* Define to 1 if you have the ws2tcpip.h header file. */ +/* #undef HAVE_WS2TCPIP_H */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_X509_H */ + +/* Define to 1 if you are building a native Windows target. */ +/* #undef NATIVE_WINDOWS */ + +/* Define to 1 if you need the lber.h header file even with ldap.h */ +/* #undef NEED_LBER_H */ + +/* Define to 1 if you need the malloc.h header file even with stdlib.h */ +/* #undef NEED_MALLOC_H */ + +/* Define to 1 if _REENTRANT preprocessor symbol must be defined. */ +/* #undef NEED_REENTRANT */ + +/* Define to 1 if _THREAD_SAFE preprocessor symbol must be defined. */ +/* #undef NEED_THREAD_SAFE */ + +/* cpu-machine-OS */ +#ifdef __WINS__ +#define OS "i386-pc-epoc32" +#elif __MARM__ +#define OS "arm-unknown-epoc32" +#else +/* This won't happen on any current Symbian version */ +#define OS "unknown-unknown-epoc32" +#endif + +/* Name of package */ +/*#define PACKAGE "curl"*/ + +/* Define to the address where bug reports for this package should be sent. */ +/*#define PACKAGE_BUGREPORT "a suitable curl mailing list => http://curl.haxx.se/mail/"*/ + +/* Define to the full name of this package. */ +/*#define PACKAGE_NAME "curl"*/ + +/* Define to the full name and version of this package. */ +/*#define PACKAGE_STRING "curl -"*/ + +/* Define to the one symbol short name of this package. */ +/*#define PACKAGE_TARNAME "curl"*/ + +/* Define to the version of this package. */ +/*#define PACKAGE_VERSION "-"*/ + +/* a suitable file to read random data from */ +/*#define RANDOM_FILE "/dev/urandom"*/ + +#define RECV_TYPE_ARG1 int +#define RECV_TYPE_ARG2 void* +#define RECV_TYPE_ARG3 size_t +#define RECV_TYPE_ARG4 int +#define RECV_TYPE_RETV ssize_t + +#define RECVFROM_TYPE_ARG1 int +#define RECVFROM_TYPE_ARG2 void +#define RECVFROM_TYPE_ARG3 size_t +#define RECVFROM_TYPE_ARG4 int +#define RECVFROM_TYPE_ARG5 struct sockaddr +#define RECVFROM_TYPE_ARG6 size_t +#define RECVFROM_TYPE_RETV ssize_t +#define RECVFROM_TYPE_ARG2_IS_VOID 1 + +#define SEND_TYPE_ARG1 int +#define SEND_QUAL_ARG2 const +#define SEND_TYPE_ARG2 void* +#define SEND_TYPE_ARG3 size_t +#define SEND_TYPE_ARG4 int +#define SEND_TYPE_RETV ssize_t + + +/* Define as the return type of signal handlers (`int' or `void'). */ +/*#define RETSIGTYPE void*/ + +/* Define to the type of arg 1 for `select'. */ +#define SELECT_TYPE_ARG1 int + +/* Define to the type of args 2, 3 and 4 for `select'. */ +#define SELECT_TYPE_ARG234 (fd_set *) + +/* Define to the type of arg 5 for `select'. */ +#define SELECT_TYPE_ARG5 (struct timeval *) + +/* The size of `int', as computed by sizeof. */ +#define SIZEOF_INT 4 + +/* The size of `off_t', as computed by sizeof. */ +#define SIZEOF_OFF_T 8 + +/* The size of `short', as computed by sizeof. */ +#define SIZEOF_SHORT 2 + +/* The size of `size_t', as computed by sizeof. */ +#define SIZEOF_SIZE_T 4 + +/* The size of `time_t', as computed by sizeof. */ +#define SIZEOF_TIME_T 4 + +/* Define to 1 if you have the ANSI C header files. */ +#define STDC_HEADERS 1 + +/* Define to 1 if you can safely include both and . */ +#define TIME_WITH_SYS_TIME 1 + +/* Define if you want to enable c-ares support */ +/* #undef USE_ARES */ + +/* Define to disable non-blocking sockets */ +/* #undef USE_BLOCKING_SOCKETS */ + +/* if GnuTLS is enabled */ +/* #undef USE_GNUTLS */ + +/* if libSSH2 is in use */ +/*#define USE_LIBSSH2 1*/ + +/* If you want to build curl with the built-in manual */ +/*#define USE_MANUAL 1*/ + +/* if NSS is enabled */ +/* #undef USE_NSS */ + +/* to enable SSPI support */ +/* #undef USE_WINDOWS_SSPI */ + +/* Define to 1 if using yaSSL in OpenSSL compatibility mode. */ +/* #undef USE_YASSLEMUL */ + +/* Version number of package */ +/*#define VERSION "7.18.2-CVS"*/ + +/* Define to avoid automatic inclusion of winsock.h */ +/* #undef WIN32_LEAN_AND_MEAN */ + +/* Define to 1 if on AIX 3. + System headers sometimes define this. + We just want to avoid a redefinition error message. */ +#ifndef _ALL_SOURCE +/* # undef _ALL_SOURCE */ +#endif + +/* Number of bits in a file offset, on hosts where this is settable. */ +#define _FILE_OFFSET_BITS 64 + +/* Define for large files, on AIX-style hosts. */ +/* #undef _LARGE_FILES */ + +/* Define to empty if `const' does not conform to ANSI C. */ +/* #undef const */ + +/* type to use in place of in_addr_t if not defined */ +/* #undef in_addr_t */ + +/* Define to `__inline__' or `__inline' if that's what the C compiler + calls it, or to nothing if 'inline' is not supported under any name. */ +#ifndef __cplusplus +/* #undef inline */ +#endif + +/* Define to `unsigned int' if does not define. */ +/* #undef size_t */ + +/* the signed version of size_t */ +/* #undef ssize_t */ + +/* Enabling curl debug mode when building in Symbian debug mode would work */ +/* except that debug mode introduces new exports that must be frozen. */ +#ifdef _DEBUG +/* #define CURLDEBUG */ +#endif + +/* sys/cdefs.h fails to define this for WINSCW prior to Symbian OS ver. 9.4 */ +#ifndef __LONG_LONG_SUPPORTED +#define __LONG_LONG_SUPPORTED +#endif + +/* Enable appropriate header only when zlib support is enabled */ +#ifdef HAVE_LIBZ +#define HAVE_ZLIB_H 1 +#endif + +/* Enable appropriate definitions only when OpenSSL support is enabled */ +#ifdef USE_SSLEAY +/* if OpenSSL is in use */ +#define USE_OPENSSL +#endif diff --git a/mobicore/common/curl/lib/config-tpf.h b/mobicore/common/curl/lib/config-tpf.h new file mode 100644 index 0000000000000000000000000000000000000000..3e494f7c93cb88890d49e086dd37f5ee3acdb00b --- /dev/null +++ b/mobicore/common/curl/lib/config-tpf.h @@ -0,0 +1,761 @@ +#ifndef __LIBCONFIGTPF_H +#define __LIBCONFIGTPF_H + +/* ================================================================ */ +/* lib/config-tpf.h - Hand crafted config file for TPF */ +/* ================================================================ */ + +/* ---------------------------------------------------------------- */ +/* FEATURES, FUNCTIONS, and DEFINITIONS */ +/* ---------------------------------------------------------------- */ + +/* NOTE: Refer also to the .mak file for some of the flags below */ + +/* when building libcurl itself */ +/* #undef BUILDING_LIBCURL */ + +/* to disable cookies support */ +/* #undef CURL_DISABLE_COOKIES */ + +/* to disable cryptographic authentication */ +/* #undef CURL_DISABLE_CRYPTO_AUTH */ + +/* to disable DICT */ +/* #undef CURL_DISABLE_DICT */ + +/* to disable FILE */ +/* #undef CURL_DISABLE_FILE */ + +/* to disable FTP */ +/* #undef CURL_DISABLE_FTP */ + +/* to disable HTTP */ +/* #undef CURL_DISABLE_HTTP */ + +/* to disable LDAP */ +/* #undef CURL_DISABLE_LDAP */ + +/* to disable TELNET */ +/* #undef CURL_DISABLE_TELNET */ + +/* to disable TFTP */ +/* #undef CURL_DISABLE_TFTP */ + +/* to disable verbose strings */ +/* #undef CURL_DISABLE_VERBOSE_STRINGS */ + +/* when not building a shared library */ +/* #undef CURL_STATICLIB */ + +/* lber dynamic library file */ +/* #undef DL_LBER_FILE */ + +/* ldap dynamic library file */ +/* #undef DL_LDAP_FILE */ + +/* your Entropy Gathering Daemon socket pathname */ +/* #undef EGD_SOCKET */ + +/* Define if you want to enable IPv6 support */ +/* #undef ENABLE_IPV6 */ + +/* Define if struct sockaddr_in6 has the sin6_scope_id member */ +/* #undef HAVE_SOCKADDR_IN6_SIN6_SCOPE_ID */ + +/* Define to the type of arg 1 for getnameinfo. */ +/* #undef GETNAMEINFO_TYPE_ARG1 */ + +/* Define to the type of arg 2 for getnameinfo. */ +/* #undef GETNAMEINFO_TYPE_ARG2 */ + +/* Define to the type of args 4 and 6 for getnameinfo. */ +/* #undef GETNAMEINFO_TYPE_ARG46 */ + +/* Define to the type of arg 7 for getnameinfo. */ +/* #undef GETNAMEINFO_TYPE_ARG7 */ + +/* Define to 1 if you have the alarm function. */ +#define HAVE_ALARM 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_ARPA_INET_H 1 + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_ARPA_TFTP_H */ + +/* Define to 1 if you have the header file. */ +#define HAVE_ASSERT_H 1 + +/* Define to 1 if you have the `basename' function. */ +#define HAVE_BASENAME 1 + +/* Define to 1 if you have the `closesocket' function. */ +/* #undef HAVE_CLOSESOCKET */ + +/* Define to 1 if you have the `CRYPTO_cleanup_all_ex_data' function. */ +/* #undef HAVE_CRYPTO_CLEANUP_ALL_EX_DATA */ +#define HAVE_CRYPTO_CLEANUP_ALL_EX_DATA 1 + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_CRYPTO_H */ +#define HAVE_CRYPTO_H 1 + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_DES_H */ +#define HAVE_DES_H 1 + +/* Define to 1 if you have the `ENGINE_load_builtin_engines' function. */ +/* #undef HAVE_ENGINE_LOAD_BUILTIN_ENGINES */ +#define HAVE_ENGINE_LOAD_BUILTIN_ENGINES 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_ERRNO_H 1 + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_ERR_H */ +#define HAVE_ERR_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_FCNTL_H 1 + +/* Define to 1 if you have the fcntl function. */ +#define HAVE_FCNTL 1 + +/* Define to 1 if you have a working fcntl O_NONBLOCK function. */ +#define HAVE_FCNTL_O_NONBLOCK 1 + +/* Define to 1 if you have the `fork' function. */ +/* #undef HAVE_FORK */ +#define HAVE_FORK 1 + +/* Define to 1 if you have the `ftruncate' function. */ +#define HAVE_FTRUNCATE 1 + +/* Define if getaddrinfo exists and works */ +/* #undef HAVE_GETADDRINFO */ + +/* Define to 1 if you have the `geteuid' function. */ +#define HAVE_GETEUID 1 + +/* Define to 1 if you have the `gethostbyaddr' function. */ +#define HAVE_GETHOSTBYADDR 1 + +/* If you have gethostbyname */ +#define HAVE_GETHOSTBYNAME 1 + +/* Define to 1 if you have the `gethostbyname_r' function. */ +/* #undef HAVE_GETHOSTBYNAME_R */ + +/* gethostbyname_r() takes 3 args */ +/* #undef HAVE_GETHOSTBYNAME_R_3 */ + +/* gethostbyname_r() takes 5 args */ +/* #undef HAVE_GETHOSTBYNAME_R_5 */ + +/* gethostbyname_r() takes 6 args */ +/* #undef HAVE_GETHOSTBYNAME_R_6 1 */ + +/* Define to 1 if you have the getnameinfo function. */ +/* #undef HAVE_GETNAMEINFO */ + +/* Define to 1 if you have the `getpass_r' function. */ +/* #undef HAVE_GETPASS_R */ + +/* Define to 1 if you have the `getprotobyname' function. */ +/* #undef HAVE_GETPROTOBYNAME */ + +/* Define to 1 if you have the `getpwuid' function. */ +#define HAVE_GETPWUID 1 + +/* Define to 1 if you have the `getrlimit' function. */ +/* #undef HAVE_GETRLIMIT */ + +/* Define to 1 if you have the `gettimeofday' function. */ +#define HAVE_GETTIMEOFDAY 1 + +/* we have a glibc-style strerror_r() */ +/* #undef HAVE_GLIBC_STRERROR_R */ +#define HAVE_GLIBC_STRERROR_R 1 + +/* Define to 1 if you have the `gmtime_r' function. */ +#define HAVE_GMTIME_R 1 + +/* if you have the gssapi libraries */ +/* #undef HAVE_GSSAPI */ + +/* if you have the GNU gssapi libraries */ +/* #undef HAVE_GSSGNU */ + +/* if you have the Heimdal gssapi libraries */ +/* #undef HAVE_GSSHEIMDAL */ + +/* if you have the MIT gssapi libraries */ +/* #undef HAVE_GSSMIT */ + +/* Define to 1 if you have the `iconv' functions. */ +#define HAVE_ICONV 1 + +/* Define to 1 if you have the `idna_strerror' function. */ +/* #undef HAVE_IDNA_STRERROR */ + +/* Define to 1 if you have the `idn_free' function. */ +/* #undef HAVE_IDN_FREE */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_IDN_FREE_H */ + +/* Define to 1 if you have the `inet_addr' function. */ +#define HAVE_INET_ADDR 1 + +/* Define to 1 if you have a IPv6 capable working inet_ntop function. */ +/* #undef HAVE_INET_NTOP */ + +/* Define to 1 if you have a IPv6 capable working inet_pton function. */ +/* #undef HAVE_INET_PTON */ + +/* Define to 1 if you have the header file. */ +#define HAVE_INTTYPES_H 1 + +/* Define to 1 if you have the ioctl function. */ +#define HAVE_IOCTL 1 + +/* Define to 1 if you have a working ioctl FIONBIO function. */ +#define HAVE_IOCTL_FIONBIO 1 + +/* Define to 1 if you have the ioctlsocket function. */ +/* #undef HAVE_IOCTLSOCKET */ + +/* Define to 1 if you have a working ioctlsocket FIONBIO function. */ +/* #undef HAVE_IOCTLSOCKET_FIONBIO */ + +/* Define to 1 if you have the IoctlSocket camel case function. */ +/* #undef HAVE_IOCTLSOCKET_CAMEL */ + +/* Define to 1 if you have a working IoctlSocket camel case FIONBIO function. */ +/* #undef HAVE_IOCTLSOCKET_CAMEL_FIONBIO */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_IO_H */ + +/* if you have the Kerberos4 libraries (including -ldes) */ +/* #undef HAVE_KRB4 */ + +/* Define to 1 if you have the `krb_get_our_ip_for_realm' function. */ +/* #undef HAVE_KRB_GET_OUR_IP_FOR_REALM */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_KRB_H */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_LIBGEN_H 1 */ + +/* Define to 1 if you have the `idn' library (-lidn). */ +/* #undef HAVE_LIBIDN */ + +/* Define to 1 if you have the `resolv' library (-lresolv). */ +/* #undef HAVE_LIBRESOLV */ + +/* Define to 1 if you have the `resolve' library (-lresolve). */ +/* #undef HAVE_LIBRESOLVE */ + +/* Define to 1 if you have the `socket' library (-lsocket). */ +/* #undef HAVE_LIBSOCKET */ + +/* Define to 1 if you have the `ssl' library (-lssl). */ +/* #undef HAVE_LIBSSL */ +#define HAVE_LIBSSL 1 + +/* if zlib is available */ +/* #undef HAVE_LIBZ */ + +/* Define to 1 if you have the header file. */ +#define HAVE_LIMITS_H 1 + +/* if your compiler supports LL */ +#define HAVE_LL 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_LOCALE_H 1 + +/* Define to 1 if you have the `localtime_r' function. */ +#define HAVE_LOCALTIME_R 1 + +/* Define to 1 if the compiler supports the 'long long' data type. */ +#define HAVE_LONGLONG 1 + +/* Define to 1 if you need the malloc.h header file even with stdlib.h */ +/* #undef NEED_MALLOC_H */ + +/* Define to 1 if you have the header file. */ +#define HAVE_MEMORY_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_NETDB_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_NETINET_IN_H 1 + +/* Define to 1 if you have the header file. */ +/* undef HAVE_NETINET_TCP_H */ + +/* Define to 1 if you have the header file. */ +#define HAVE_NET_IF_H 1 + +/* Define if NI_WITHSCOPEID exists and works */ +/* #undef HAVE_NI_WITHSCOPEID */ + +/* we have no strerror_r() proto */ +/* #undef HAVE_NO_STRERROR_R_DECL */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_OPENSSL_CRYPTO_H */ +#define HAVE_OPENSSL_CRYPTO_H 1 + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_OPENSSL_ENGINE_H */ +#define HAVE_OPENSSL_ENGINE_H 1 + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_OPENSSL_ERR_H */ +#define HAVE_OPENSSL_ERR_H 1 + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_OPENSSL_PEM_H */ +#define HAVE_OPENSSL_PEM_H 1 + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_OPENSSL_PKCS12_H */ +#define HAVE_OPENSSL_PKCS12_H 1 + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_OPENSSL_RSA_H */ +#define HAVE_OPENSSL_RSA_H 1 + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_OPENSSL_SSL_H */ +#define HAVE_OPENSSL_SSL_H 1 + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_OPENSSL_X509_H */ +#define HAVE_OPENSSL_X509_H 1 + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_PEM_H */ +#define HAVE_PEM_H 1 + +/* Define to 1 if you have the `perror' function. */ +#define HAVE_PERROR 1 + +/* Define to 1 if you have the `pipe' function. */ +#define HAVE_PIPE 1 + +/* Define to 1 if you have the `poll' function. */ +/* #undef HAVE_POLL */ + +/* If you have a fine poll */ +/* #undef HAVE_POLL_FINE */ + +/* we have a POSIX-style strerror_r() */ +/* #undef HAVE_POSIX_STRERROR_R */ + +/* Define to 1 if you have the header file. */ +#define HAVE_PWD_H 1 + +/* Define to 1 if you have the `RAND_egd' function. */ +/* #undef HAVE_RAND_EGD */ +#define HAVE_RAND_EGD 1 + +/* Define to 1 if you have the `RAND_screen' function. */ +/* #undef HAVE_RAND_SCREEN */ + +/* Define to 1 if you have the `RAND_status' function. */ +/* #undef HAVE_RAND_STATUS */ +#define HAVE_RAND_STATUS 1 + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_RSA_H */ +#define HAVE_RSA_H 1 + +/* Define to 1 if you have the `select' function. */ +#define HAVE_SELECT 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SETJMP_H 1 + +/* Define to 1 if you have the `setlocale' function. */ +#define HAVE_SETLOCALE 1 + +/* Define to 1 if you have the `setrlimit' function. */ +#define HAVE_SETRLIMIT 1 + +/* Define to 1 if you have the setsockopt function. */ +/* #undef HAVE_SETSOCKOPT */ + +/* Define to 1 if you have a working setsockopt SO_NONBLOCK function. */ +/* #undef HAVE_SETSOCKOPT_SO_NONBLOCK */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_SGTTY_H 1 */ + +/* Define to 1 if you have the `sigaction' function. */ +#define HAVE_SIGACTION 1 + +/* Define to 1 if you have the `siginterrupt' function. */ +/* #undef HAVE_SIGINTERRUPT */ + +/* Define to 1 if you have the `signal' function. */ +#define HAVE_SIGNAL 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SIGNAL_H 1 + +/* Define to 1 if sig_atomic_t is an available typedef. */ +#define HAVE_SIG_ATOMIC_T 1 + +/* Define to 1 if sig_atomic_t is already defined as volatile. */ +/* #undef HAVE_SIG_ATOMIC_T_VOLATILE */ + +/* If you have sigsetjmp */ +/* #undef HAVE_SIGSETJMP */ + +/* Define to 1 if you have the `socket' function. */ +#define HAVE_SOCKET 1 + +/* Define this if you have the SPNEGO library fbopenssl */ +/* #undef HAVE_SPNEGO */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_SSL_H */ +#define HAVE_SSL_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STDINT_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STDLIB_H 1 + +/* Define to 1 if you have the `strcasecmp' function. */ +#define HAVE_STRCASECMP 1 + +/* Define to 1 if you have the `strcmpi' function. */ +/* #undef HAVE_STRCMPI */ + +/* Define to 1 if you have the `strdup' function. */ +#define HAVE_STRDUP 1 + +/* Define to 1 if you have the `strerror_r' function. */ +#define HAVE_STRERROR_R 1 + +/* Define to 1 if you have the `stricmp' function. */ +/* #undef HAVE_STRICMP */ +#define HAVE_STRICMP 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STRINGS_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STRING_H 1 + +/* Define to 1 if you have the `strlcat' function. */ +/* #undef HAVE_STRLCAT */ + +/* Define to 1 if you have the `strlcpy' function. */ +/* #undef HAVE_STRLCPY */ + +/* Define to 1 if you have the `strstr' function. */ +#define HAVE_STRSTR 1 + +/* Define to 1 if you have the `strtok_r' function. */ +#define HAVE_STRTOK_R 1 + +/* Define to 1 if you have the `strtoll' function. */ +#define HAVE_STRTOLL 1 + +/* if struct sockaddr_storage is defined */ +/* #undef HAVE_STRUCT_SOCKADDR_STORAGE */ + +/* Define this if you have struct timeval */ +#define HAVE_STRUCT_TIMEVAL 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_FILIO_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_IOCTL_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_PARAM_H 1 + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_SYS_POLL_H */ + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_RESOURCE_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_SELECT_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_SOCKET_H 1 + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_SYS_SOCKIO_H */ +#define HAVE_SYS_SOCKIO_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_STAT_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_TIME_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_TYPES_H 1 + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_SYS_UTIME_H */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_TERMIOS_H */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_TERMIO_H */ + +/* Define to 1 if you have the header file. */ +#define HAVE_TIME_H 1 + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_TLD_H */ + +/* Define to 1 if you have the `tld_strerror' function. */ +/* #undef HAVE_TLD_STRERROR */ + +/* Define to 1 if you have the header file. */ +#define HAVE_UNISTD_H 1 + +/* Define to 1 if you have the `utime' function. */ +#define HAVE_UTIME 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_UTIME_H 1 + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_WINSOCK2_H */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_WINSOCK_H */ + +/* Define this symbol if your OS supports changing the contents of argv */ +/* #undef HAVE_WRITABLE_ARGV */ + +/* Define to 1 if you have the ws2tcpip.h header file. */ +/* #undef HAVE_WS2TCPIP_H */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_X509_H */ + +/* if you have the zlib.h header file */ +/* #undef HAVE_ZLIB_H */ + +/* Define to 1 if _REENTRANT preprocessor symbol must be defined. */ +/* #undef NEED_REENTRANT */ + +/* Define to 1 if _THREAD_SAFE preprocessor symbol must be defined. */ +/* #undef NEED_THREAD_SAFE */ + +/* cpu-machine-OS */ +#define OS "s390x-ibm-tpf" + +/* Name of package */ +#define PACKAGE "curl" + +/* Define to the address where bug reports for this package should be sent. */ +#define PACKAGE_BUGREPORT "a suitable curl mailing list => http://curl.haxx.se/mail/" + +/* Define to the full name of this package. */ +#define PACKAGE_NAME "curl" + +/* Define to the full name and version of this package. */ +#define PACKAGE_STRING "curl -" + +/* Define to the one symbol short name of this package. */ +#define PACKAGE_TARNAME "curl" + +/* Define to the version of this package. */ +#define PACKAGE_VERSION "-" + +/* a suitable file to read random data from */ +/* #undef RANDOM_FILE */ + +/* Define as the return type of signal handlers (`int' or `void'). */ +#define RETSIGTYPE void + +/* Define to the type of arg 1 for `select'. */ +#define SELECT_TYPE_ARG1 int + +/* Define to the type of args 2, 3 and 4 for `select'. */ +#define SELECT_TYPE_ARG234 (fd_set *) + +/* Define to the type of arg 5 for `select'. */ +#define SELECT_TYPE_ARG5 (struct timeval *) + +/* The size of `int', as computed by sizeof. */ +#define SIZEOF_INT 4 + +/* The size of `off_t', as computed by sizeof. */ +#define SIZEOF_OFF_T 8 + +/* The size of `short', as computed by sizeof. */ +#define SIZEOF_SHORT 2 + +/* The size of `size_t', as computed by sizeof. */ +#define SIZEOF_SIZE_T 8 + +/* The size of `time_t', as computed by sizeof. */ +#define SIZEOF_TIME_T 8 + +/* Define to 1 if you have the ANSI C header files. */ +#define STDC_HEADERS 1 + +/* Define to 1 if you can safely include both and . */ +#define TIME_WITH_SYS_TIME 1 + +/* Define if you want to enable ares support */ +/* #undef USE_ARES */ + +/* Define to disable non-blocking sockets */ +/* #undef USE_BLOCKING_SOCKETS */ + +/* if GnuTLS is enabled */ +/* #undef USE_GNUTLS */ + +/* If you want to build curl with the built-in manual */ +/* #undef USE_MANUAL */ + +/* if OpenSSL is in use */ +/* #undef USE_OPENSSL */ + +/* if SSL is enabled */ +/* #undef USE_SSLEAY */ + +/* to enable SSPI support */ +/* #undef USE_WINDOWS_SSPI */ + +/* Version number of package */ +#define VERSION "not-used" + +/* Define to avoid automatic inclusion of winsock.h */ +/* #undef WIN32_LEAN_AND_MEAN */ + +/* Define to 1 if on AIX 3. + System headers sometimes define this. + We just want to avoid a redefinition error message. */ +#ifndef _ALL_SOURCE +/* # undef _ALL_SOURCE */ +#endif + +/* Number of bits in a file offset, on hosts where this is settable. */ +/* #undef _FILE_OFFSET_BITS */ + +/* Define for large files, on AIX-style hosts. */ +/* #undef _LARGE_FILES */ + +/* Define to empty if `const' does not conform to ANSI C. */ +/* #undef const */ + +/* type to use in place of in_addr_t if not defined */ +/* #undef in_addr_t */ + +/* Define to `unsigned' if does not define. */ +/* #undef size_t */ + +/* the signed version of size_t */ +/* #undef ssize_t */ + +/* Define to 1 if you have the getnameinfo function. */ +/* #undef HAVE_GETNAMEINFO 1 */ + +/* Define to the type qualifier of arg 1 for getnameinfo. */ +/* #undef GETNAMEINFO_QUAL_ARG1 const */ + +/* Define to the type of arg 1 for getnameinfo. */ +/* #undef GETNAMEINFO_TYPE_ARG1 struct sockaddr * */ + +/* Define to the type of arg 2 for getnameinfo. */ +/* #undef GETNAMEINFO_TYPE_ARG2 socklen_t */ + +/* Define to the type of args 4 and 6 for getnameinfo. */ +/* #undef GETNAMEINFO_TYPE_ARG46 size_t */ + +/* Define to the type of arg 7 for getnameinfo. */ +/* #undef GETNAMEINFO_TYPE_ARG7 int */ + +/* Define to 1 if you have the recv function. */ +#define HAVE_RECV 1 + +/* Define to the type of arg 1 for recv. */ +#define RECV_TYPE_ARG1 int + +/* Define to the type of arg 2 for recv. */ +#define RECV_TYPE_ARG2 char * + +/* Define to the type of arg 3 for recv. */ +#define RECV_TYPE_ARG3 int + +/* Define to the type of arg 4 for recv. */ +#define RECV_TYPE_ARG4 int + +/* Define to the function return type for recv. */ +#define RECV_TYPE_RETV int + +/* Define to 1 if you have the recvfrom function. */ +#define HAVE_RECVFROM 1 + +/* Define to the type of arg 1 for recvfrom. */ +#define RECVFROM_TYPE_ARG1 int + +/* Define to the type pointed by arg 2 for recvfrom. */ +#define RECVFROM_TYPE_ARG2 char + +/* Define to the type of arg 3 for recvfrom. */ +#define RECVFROM_TYPE_ARG3 int + +/* Define to the type of arg 4 for recvfrom. */ +#define RECVFROM_TYPE_ARG4 int + +/* Define to the type pointed by arg 5 for recvfrom. */ +#define RECVFROM_TYPE_ARG5 struct sockaddr + +/* Define to the type pointed by arg 6 for recvfrom. */ +#define RECVFROM_TYPE_ARG6 int + +/* Define to the function return type for recvfrom. */ +#define RECVFROM_TYPE_RETV int + +/* Define to 1 if you have the send function. */ +#define HAVE_SEND 1 + +/* Define to the type of arg 1 for send. */ +#define SEND_TYPE_ARG1 int + +/* Define to the type qualifier of arg 2 for send. */ +#define SEND_QUAL_ARG2 const + +/* Define to the type of arg 2 for send. */ +#define SEND_TYPE_ARG2 char * + +/* Define to the type of arg 3 for send. */ +#define SEND_TYPE_ARG3 int + +/* Define to the type of arg 4 for send. */ +#define SEND_TYPE_ARG4 int + +/* Define to the function return type for send. */ +#define SEND_TYPE_RETV int + +#define CURL_DOES_CONVERSIONS +#ifndef CURL_ICONV_CODESET_OF_HOST +#define CURL_ICONV_CODESET_OF_HOST "IBM-1047" +#endif + + +#endif /* __LIBCONFIGTPF_H */ diff --git a/mobicore/common/curl/lib/config-vms.h b/mobicore/common/curl/lib/config-vms.h new file mode 100644 index 0000000000000000000000000000000000000000..73ef5c026585a7b3df0fff8389bf711b9c00dfd6 --- /dev/null +++ b/mobicore/common/curl/lib/config-vms.h @@ -0,0 +1,374 @@ +#ifndef HEADER_CONFIG_VMS_H +#define HEADER_CONFIG_VMS_H + +/* */ +/* MSK, 02/05/04, Hand edited for trail build on Alpha V7.3, DEC C 6.5-003 */ +/* MSK, 03/09/04, Seems to work for all platforms I've built on so far. */ +/* Added HAVE_SYS_IOCTL_H define */ +/* TES, 10/06/04, Added MAX_INITIAL_POST_SIZE, HAVE_BASENAME */ +/* MSK, 02/02/05, Changed HAVE_TERMIOS_H to an undef since the change in */ +/* getpass.c no longer undef'd it during compile. */ +/* MSK, 02/08/05, turned two config-vms files into one by using USE_SSLEAY */ +/* MPZ, 12/28/05, changed HAVE_STRTOK_R define to use CRTL_VER */ +/* MSK, 01/27/07, needed to add HAVE_STRUCT_TIMEVAL define */ + +/* Define cpu-machine-OS */ +#if defined(__alpha) +# define OS "ALPHA-HP-VMS" +#elif defined(__vax) +# define OS "VAX-HP-VMS" +#elif defined(__ia64) +# define OS "IA64-HP-VMS" +#else +# define OS "UNKNOWN-HP-VMS" +#endif + +/* Define if you have the ANSI C header files. */ +#define STDC_HEADERS 1 + +/* Define if you can safely include both and . */ +#define TIME_WITH_SYS_TIME 1 + +/* The size of `int', as computed by sizeof. */ +#define SIZEOF_INT 4 + +/* The size of `long double', as computed by sizeof. */ +#define SIZEOF_LONG_DOUBLE 8 + +/* The size of `long long', as computed by sizeof. */ +#define SIZEOF_LONG_LONG 8 + +/* The size of `short', as computed by sizeof. */ +#define SIZEOF_SHORT 2 + +/* The size of `size_t', as computed by sizeof. */ +#define SIZEOF_SIZE_T 4 + +/* Define if you have the alarm function. */ +#define HAVE_ALARM 1 + +/* Define if you have the geteuid function. */ +#define HAVE_GETEUID 1 + +/* Define if you have the basename function. */ +#define HAVE_BASENAME 1 + +/* Define if you have the gethostbyaddr function. */ +#define HAVE_GETHOSTBYADDR 1 + +/* Define if you have the gethostname function. */ +#define HAVE_GETHOSTNAME 1 + +/* Define if you have the getpwuid function. */ +#define HAVE_GETPWUID 1 + +/* Define if you have the getservbyname function. */ +#define HAVE_GETSERVBYNAME 1 + +/* Define if you have the gettimeofday function. */ +#define HAVE_GETTIMEOFDAY 1 + +/* Define if you have the inet_addr function. */ +#define HAVE_INET_ADDR 1 + +/* Define if you have the ioctl function. */ +#define HAVE_IOCTL 1 + +/* Define if you have a working ioctl FIONBIO function. */ +#define HAVE_IOCTL_FIONBIO 1 + +/* Define if you have a working ioctl SIOCGIFADDR function. */ +#define HAVE_IOCTL_SIOCGIFADDR 1 + +/* Define if you have the perror function. */ +#define HAVE_PERROR 1 + +/* Define if you have the select function. */ +#define HAVE_SELECT 1 + +/* Define if you have the setvbuf function. */ +#define HAVE_SETVBUF 1 + +/* Define if you have the sigaction function. */ +#define HAVE_SIGACTION 1 + +/* Define if you have the signal function. */ +#define HAVE_SIGNAL 1 + +/* Define if you have the socket function. */ +#define HAVE_SOCKET 1 + +/* Define if you have the strcasecmp function. */ +#define HAVE_STRCASECMP 1 + +/* Define if you have the strcmpi function. */ +/* #define HAVE_STRCMPI 1 */ + +/* Define if you have the strdup function. */ +#define HAVE_STRDUP 1 + +/* Define if you have the strftime function. */ +#define HAVE_STRFTIME 1 + +/* Define if you have the stricmp function. */ +/* #define HAVE_STRICMP 1 */ + +/* Define if you have the strstr function. */ +#define HAVE_STRSTR 1 + +/* Define if you have the ftruncate function. */ +#define HAVE_FTRUNCATE 1 + +/* Define if you have the uname function. */ +#define HAVE_UNAME 1 + +/* Define if you have the header file. */ +#define HAVE_ERR_H 1 + +/* Define if you have the header file. */ +#define HAVE_FCNTL_H 1 + +/* Define if you have the header file. */ +#define HAVE_GETOPT_H 1 + +/* Define if you have the header file. */ +#define HAVE_MALLOC_H 1 + +/* Define if you need the malloc.h header header file even with stdlib.h */ +/* #define NEED_MALLOC_H 1 */ + +/* Define if you have the header file. */ +#define HAVE_NET_IF_H 1 + +/* Define if you have the header file. */ +#define HAVE_NETDB_H 1 + +/* Define if you have the header file. */ +#define HAVE_NETINET_IF_ETHER_H 1 + +/* Define if you have the header file. */ +#define HAVE_NETINET_IN_H 1 + +/* OpenSSL section starts here */ + +/* Define if you have a working OpenSSL installation */ +#ifdef USE_SSLEAY + +/* if OpenSSL is in use */ +#define USE_OPENSSL 1 + +/* Define if you have the crypto library (-lcrypto). */ +#define HAVE_LIBCRYPTO 1 + +/* Define if you have the ssl library (-lssl). */ +#define HAVE_LIBSSL 1 + +/* Define if you have the header file. */ +#define HAVE_OPENSSL_CRYPTO_H 1 + +/* Define if you have the header file. */ +#define HAVE_OPENSSL_ERR_H 1 + +/* Define if you have the header file. */ +#define HAVE_OPENSSL_PEM_H 1 + +/* Define if you have the header file. */ +#define HAVE_OPENSSL_RSA_H 1 + +/* Define if you have the header file. */ +#define HAVE_OPENSSL_SSL_H 1 + +/* Define if you have the header file. */ +#define HAVE_OPENSSL_X509_H 1 + +/* + * This needs to be defined for OpenSSL 0.9.7 and other versions that have the + * ENGINE stuff supported. If an include of "openssl/engine.h" fails, then + * undefine the define below. +*/ +#define HAVE_OPENSSL_ENGINE_H 1 + +#endif /* USE_SSLEAY */ +/* OpenSSL section ends here */ + +/* Define if you have the header file. */ +#define HAVE_PWD_H 1 + +/* Define if you have the header file. */ +#define HAVE_SGTTY_H 1 + +/* Define if you have the header file. */ +#define HAVE_STDLIB_H 1 + +/* Define if you have the header file. */ +#define HAVE_SYS_SOCKET_H 1 + +/* Define if you have the header file. */ +#define HAVE_SYS_STAT_H 1 + +/* Define if you have the header file. */ +#define HAVE_SYS_TIME_H 1 + +/* Define if you have the header file. */ +#define HAVE_SYS_TYPES_H 1 + +/* Define if you have the header file. */ +#undef HAVE_TERMIOS_H + +/* Define if you have the header file. */ +#define HAVE_TIME_H 1 + +/* Define if you have the header file. */ +#define HAVE_UNISTD_H 1 + +/* Define if you have the resolv library (-lresolv). */ +#define HAVE_LIBRESOLV 1 + +/* Define if you have the socket library (-lsocket). */ +#define HAVE_LIBSOCKET 1 + +/* Define if getaddrinfo exists and works */ +#define HAVE_GETADDRINFO 1 + +/* Define if you have the header file. */ +#define HAVE_TIMEVAL_H 1 + +/* Define if you have the timeval struct. */ +#define HAVE_STRUCT_TIMEVAL 1 + +/* Name of this package! */ +#define PACKAGE "not-used" + +/* Version number of this archive. */ +#define VERSION "not-used" + +/* Define if you have the getpass function. */ +#undef HAVE_GETPASS + +/* Define if you have the header file. */ +#undef HAVE_INTTYPES_H + +/* Define if you have the header file. */ +#define HAVE_STRINGS_H 1 + +/* Define if you have the header file. */ +#define HAVE_STRING_H 1 + +/* Define if you have the `strtok_r' function. */ +/* Condition lifted from */ +#if __CRTL_VER >= 70301000 +# define HAVE_STRTOK_R 1 +#endif + +/* Define if you have the `strtoll' function. */ +#define HAVE_STRTOLL 1 + +/* Define if you have the header file. */ +#define HAVE_MEMORY_H 1 + +/* Define to 1 if you need the memory.h header file even with stdlib.h */ +#define NEED_MEMORY_H 1 + +/* Define if you have the `sigsetjmp' function. */ +#define HAVE_SIGSETJMP 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SETJMP_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_LIMITS_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_IOCTL_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STROPTS_H 1 + +/* Define if you have the getnameinfo function. */ +#define HAVE_GETNAMEINFO 1 + +/* Define to the type qualifier of arg 1 for getnameinfo. */ +#define GETNAMEINFO_QUAL_ARG1 const + +/* Define to the type of arg 1 for getnameinfo. */ +#define GETNAMEINFO_TYPE_ARG1 struct sockaddr * + +/* Define to the type of arg 2 for getnameinfo. */ +#define GETNAMEINFO_TYPE_ARG2 size_t + +/* Define to the type of args 4 and 6 for getnameinfo. */ +#define GETNAMEINFO_TYPE_ARG46 size_t + +/* Define to the type of arg 7 for getnameinfo. */ +#define GETNAMEINFO_TYPE_ARG7 int + +/* Define if you have the recv function. */ +#define HAVE_RECV 1 + +/* Define to the type of arg 1 for recv. */ +#define RECV_TYPE_ARG1 int + +/* Define to the type of arg 2 for recv. */ +#define RECV_TYPE_ARG2 void * + +/* Define to the type of arg 3 for recv. */ +#define RECV_TYPE_ARG3 int + +/* Define to the type of arg 4 for recv. */ +#define RECV_TYPE_ARG4 int + +/* Define to the function return type for recv. */ +#define RECV_TYPE_RETV int + +/* Define if you have the recvfrom function. */ +#define HAVE_RECVFROM 1 + +/* Define to the type of arg 1 for recvfrom. */ +#define RECVFROM_TYPE_ARG1 int + +/* Define to the type pointed by arg 2 for recvfrom. */ +#define RECVFROM_TYPE_ARG2 void + +/* Define if the type pointed by arg 2 for recvfrom is void. */ +#define RECVFROM_TYPE_ARG2_IS_VOID 1 + +/* Define to the type of arg 3 for recvfrom. */ +#define RECVFROM_TYPE_ARG3 int + +/* Define to the type of arg 4 for recvfrom. */ +#define RECVFROM_TYPE_ARG4 int + +/* Define to the type pointed by arg 5 for recvfrom. */ +#define RECVFROM_TYPE_ARG5 struct sockaddr + +/* Define to the type pointed by arg 6 for recvfrom. */ +#define RECVFROM_TYPE_ARG6 int + +/* Define to the function return type for recvfrom. */ +#define RECVFROM_TYPE_RETV int + +/* Define if you have the send function. */ +#define HAVE_SEND 1 + +/* Define to the type of arg 1 for send. */ +#define SEND_TYPE_ARG1 int + +/* Define to the type qualifier of arg 2 for send. */ +#define SEND_QUAL_ARG2 const + +/* Define to the type of arg 2 for send. */ +#define SEND_TYPE_ARG2 void * + +/* Define to the type of arg 3 for send. */ +#define SEND_TYPE_ARG3 int + +/* Define to the type of arg 4 for send. */ +#define SEND_TYPE_ARG4 int + +/* Define to the function return type for send. */ +#define SEND_TYPE_RETV int + +/* Define to hide dollar sign from compilers in strict ansi mode. */ +#define decc_translate_vms(__s) decc$translate_vms(__s) + +#endif /* HEADER_CONFIG_VMS_H */ diff --git a/mobicore/common/curl/lib/config-vxworks.h b/mobicore/common/curl/lib/config-vxworks.h new file mode 100644 index 0000000000000000000000000000000000000000..f7797fd0ed7e8ce4b04168f5fcbc39eb3e2d39bb --- /dev/null +++ b/mobicore/common/curl/lib/config-vxworks.h @@ -0,0 +1,934 @@ +#ifndef __LIB_CONFIG_VXWORKS_H +#define __LIB_CONFIG_VXWORKS_H + +/* =============================================================== */ +/* lib/config-vxworks.h - Hand crafted config file for VxWorks */ +/* =============================================================== */ + +/* when building libcurl itself */ +/* #undef BUILDING_LIBCURL */ + +/* Location of default ca bundle */ +/* #undef CURL_CA_BUNDLE */ + +/* Location of default ca path */ +/* #undef CURL_CA_PATH */ + +/* to disable cookies support */ +/* #undef CURL_DISABLE_COOKIES */ + +/* to disable cryptographic authentication */ +/* #undef CURL_DISABLE_CRYPTO_AUTH */ + +/* to disable DICT */ +/* #undef CURL_DISABLE_DICT */ + +/* to disable FILE */ +/* #undef CURL_DISABLE_FILE */ + +/* to disable FTP */ +#define CURL_DISABLE_FTP 1 + +/* to disable HTTP */ +/* #undef CURL_DISABLE_HTTP */ + +/* to disable LDAP */ +#define CURL_DISABLE_LDAP 1 + +/* to disable LDAPS */ +#define CURL_DISABLE_LDAPS 1 + +/* to disable NTLM authentication */ +#define CURL_DISABLE_NTLM 1 + +/* to disable proxies */ +/* #undef CURL_DISABLE_PROXY */ + +/* to disable TELNET */ +#define CURL_DISABLE_TELNET 1 + +/* to disable TFTP */ +#define CURL_DISABLE_TFTP 1 + +/* to disable verbose strings */ +/* #undef CURL_DISABLE_VERBOSE_STRINGS */ + +/* to make a symbol visible */ +/* #undef CURL_EXTERN_SYMBOL */ + +/* to enable hidden symbols */ +/* #undef CURL_HIDDEN_SYMBOLS */ + +/* Use Windows LDAP implementation */ +/* #undef CURL_LDAP_WIN */ + +/* when not building a shared library */ +/* #undef CURL_STATICLIB */ + +/* your Entropy Gathering Daemon socket pathname */ +/* #undef EGD_SOCKET */ + +/* Define if you want to enable IPv6 support */ +#define ENABLE_IPV6 1 + +/* Define to the type qualifier of arg 1 for getnameinfo. */ +#define GETNAMEINFO_QUAL_ARG1 const + +/* Define to the type of arg 1 for getnameinfo. */ +#define GETNAMEINFO_TYPE_ARG1 struct sockaddr * + +/* Define to the type of arg 2 for getnameinfo. */ +#define GETNAMEINFO_TYPE_ARG2 socklen_t + +/* Define to the type of args 4 and 6 for getnameinfo. */ +#define GETNAMEINFO_TYPE_ARG46 size_t + +/* Define to the type of arg 7 for getnameinfo. */ +#define GETNAMEINFO_TYPE_ARG7 unsigned int + +/* Specifies the number of arguments to getservbyport_r */ +#define GETSERVBYPORT_R_ARGS 6 + +/* Specifies the size of the buffer to pass to getservbyport_r */ +#define GETSERVBYPORT_R_BUFSIZE 4096 + +/* Define to 1 if you have the alarm function. */ +#define HAVE_ALARM 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_ALLOCA_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_ARPA_INET_H 1 + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_ARPA_TFTP_H */ + +/* Define to 1 if you have the header file. */ +#define HAVE_ASSERT_H 1 + +/* Define to 1 if you have the `basename' function. */ +/* #undef HAVE_BASENAME */ + +/* Define to 1 if bool is an available type. */ +#define HAVE_BOOL_T 1 + +/* Define to 1 if you have the clock_gettime function and monotonic timer. */ +/* #undef HAVE_CLOCK_GETTIME_MONOTONIC */ + +/* Define to 1 if you have the `closesocket' function. */ +/* #undef HAVE_CLOSESOCKET */ + +/* Define to 1 if you have the `CRYPTO_cleanup_all_ex_data' function. */ +#define HAVE_CRYPTO_CLEANUP_ALL_EX_DATA 1 + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_CRYPTO_H */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_DES_H */ + +/* Define to 1 if you have the header file. */ +#define HAVE_DLFCN_H 1 + +/* Define to 1 if you have the `ENGINE_load_builtin_engines' function. */ +#define HAVE_ENGINE_LOAD_BUILTIN_ENGINES 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_ERRNO_H 1 + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_ERR_H */ + +/* Define to 1 if you have the fcntl function. */ +#define HAVE_FCNTL 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_FCNTL_H 1 + +/* Define to 1 if you have a working fcntl O_NONBLOCK function. */ +#define HAVE_FCNTL_O_NONBLOCK 1 + +/* Define to 1 if you have the fdopen function. */ +#define HAVE_FDOPEN 1 + +/* Define to 1 if you have the `fork' function. */ +#define HAVE_FORK 1 + +/* Define to 1 if you have the freeaddrinfo function. */ +#define HAVE_FREEADDRINFO 1 + +/* Define to 1 if you have the freeifaddrs function. */ +#define HAVE_FREEIFADDRS 1 + +/* Define to 1 if you have the ftruncate function. */ +#define HAVE_FTRUNCATE 1 + +/* Define to 1 if you have a working getaddrinfo function. */ +#define HAVE_GETADDRINFO 1 + +/* Define to 1 if you have the `geteuid' function. */ +/* #undef HAVE_GETEUID */ + +/* Define to 1 if you have the gethostbyaddr function. */ +#define HAVE_GETHOSTBYADDR 1 + +/* Define to 1 if you have the gethostbyaddr_r function. */ +#define HAVE_GETHOSTBYADDR_R 1 + +/* gethostbyaddr_r() takes 5 args */ +/* #undef HAVE_GETHOSTBYADDR_R_5 */ + +/* gethostbyaddr_r() takes 7 args */ +/* #undef HAVE_GETHOSTBYADDR_R_7 */ + +/* gethostbyaddr_r() takes 8 args */ +#define HAVE_GETHOSTBYADDR_R_8 1 + +/* Define to 1 if you have the gethostbyname function. */ +#define HAVE_GETHOSTBYNAME 1 + +/* Define to 1 if you have the gethostbyname_r function. */ +/* #undef HAVE_GETHOSTBYNAME_R */ + +/* gethostbyname_r() takes 3 args */ +/* #undef HAVE_GETHOSTBYNAME_R_3 */ + +/* gethostbyname_r() takes 5 args */ +/* #undef HAVE_GETHOSTBYNAME_R_5 */ + +/* gethostbyname_r() takes 6 args */ +/* #undef HAVE_GETHOSTBYNAME_R_6 */ + +/* Define to 1 if you have the gethostname function. */ +#define HAVE_GETHOSTNAME 1 + +/* Define to 1 if you have a working getifaddrs function. */ +/* #undef HAVE_GETIFADDRS */ + +/* Define to 1 if you have the getnameinfo function. */ +#define HAVE_GETNAMEINFO 1 + +/* Define to 1 if you have the `getpass_r' function. */ +/* #undef HAVE_GETPASS_R */ + +/* Define to 1 if you have the `getppid' function. */ +#define HAVE_GETPPID 1 + +/* Define to 1 if you have the `getprotobyname' function. */ +#define HAVE_GETPROTOBYNAME 1 + +/* Define to 1 if you have the `getpwuid' function. */ +/* #undef HAVE_GETPWUID */ + +/* Define to 1 if you have the `getrlimit' function. */ +#define HAVE_GETRLIMIT 1 + +/* Define to 1 if you have the getservbyport_r function. */ +/* #undef HAVE_GETSERVBYPORT_R */ + +/* Define to 1 if you have the `gettimeofday' function. */ +/* #undef HAVE_GETTIMEOFDAY */ + +/* Define to 1 if you have a working glibc-style strerror_r function. */ +/* #undef HAVE_GLIBC_STRERROR_R */ + +/* Define to 1 if you have a working gmtime_r function. */ +#define HAVE_GMTIME_R 1 + +/* if you have the gssapi libraries */ +/* #undef HAVE_GSSAPI */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_GSSAPI_GSSAPI_GENERIC_H */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_GSSAPI_GSSAPI_H */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_GSSAPI_GSSAPI_KRB5_H */ + +/* if you have the GNU gssapi libraries */ +/* #undef HAVE_GSSGNU */ + +/* if you have the Heimdal gssapi libraries */ +/* #undef HAVE_GSSHEIMDAL */ + +/* if you have the MIT gssapi libraries */ +/* #undef HAVE_GSSMIT */ + +/* Define to 1 if you have the `idna_strerror' function. */ +/* #undef HAVE_IDNA_STRERROR */ + +/* Define to 1 if you have the `idn_free' function. */ +/* #undef HAVE_IDN_FREE */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_IDN_FREE_H */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_IFADDRS_H */ + +/* Define to 1 if you have the `inet_addr' function. */ +#define HAVE_INET_ADDR 1 + +/* Define to 1 if you have the inet_ntoa_r function. */ +/* #undef HAVE_INET_NTOA_R */ + +/* inet_ntoa_r() takes 2 args */ +/* #undef HAVE_INET_NTOA_R_2 */ + +/* inet_ntoa_r() takes 3 args */ +/* #undef HAVE_INET_NTOA_R_3 */ + +/* Define to 1 if you have a IPv6 capable working inet_ntop function. */ +/* #undef HAVE_INET_NTOP */ + +/* Define to 1 if you have a IPv6 capable working inet_pton function. */ +/* #undef HAVE_INET_PTON */ + +/* Define to 1 if you have the header file. */ +#define HAVE_INTTYPES_H 1 + +/* Define to 1 if you have the ioctl function. */ +#define HAVE_IOCTL 1 + +/* Define to 1 if you have the ioctlsocket function. */ +/* #undef HAVE_IOCTLSOCKET */ + +/* Define to 1 if you have the IoctlSocket camel case function. */ +/* #undef HAVE_IOCTLSOCKET_CAMEL */ + +/* Define to 1 if you have a working IoctlSocket camel case FIONBIO function. + */ +/* #undef HAVE_IOCTLSOCKET_CAMEL_FIONBIO */ + +/* Define to 1 if you have a working ioctlsocket FIONBIO function. */ +/* #undef HAVE_IOCTLSOCKET_FIONBIO */ + +/* Define to 1 if you have a working ioctl FIONBIO function. */ +#define HAVE_IOCTL_FIONBIO 1 + +/* Define to 1 if you have a working ioctl SIOCGIFADDR function. */ +#define HAVE_IOCTL_SIOCGIFADDR 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_IO_H 1 + +/* if you have the Kerberos4 libraries (including -ldes) */ +/* #undef HAVE_KRB4 */ + +/* Define to 1 if you have the `krb_get_our_ip_for_realm' function. */ +/* #undef HAVE_KRB_GET_OUR_IP_FOR_REALM */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_KRB_H */ + +/* Define to 1 if you have the lber.h header file. */ +/* #undef HAVE_LBER_H */ + +/* Define to 1 if you have the ldapssl.h header file. */ +/* #undef HAVE_LDAPSSL_H */ + +/* Define to 1 if you have the ldap.h header file. */ +/* #undef HAVE_LDAP_H */ + +/* Use LDAPS implementation */ +/* #undef HAVE_LDAP_SSL */ + +/* Define to 1 if you have the ldap_ssl.h header file. */ +/* #undef HAVE_LDAP_SSL_H */ + +/* Define to 1 if you have the `ldap_url_parse' function. */ +/* #undef HAVE_LDAP_URL_PARSE */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_LIBGEN_H */ + +/* Define to 1 if you have the `idn' library (-lidn). */ +/* #undef HAVE_LIBIDN */ + +/* Define to 1 if you have the `resolv' library (-lresolv). */ +/* #undef HAVE_LIBRESOLV */ + +/* Define to 1 if you have the `resolve' library (-lresolve). */ +/* #undef HAVE_LIBRESOLVE */ + +/* Define to 1 if you have the `socket' library (-lsocket). */ +/* #undef HAVE_LIBSOCKET */ + +/* Define to 1 if you have the `ssh2' library (-lssh2). */ +/* #undef HAVE_LIBSSH2 */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_LIBSSH2_H */ + +/* Define to 1 if you have the `libssh2_version' function. */ +/* #undef HAVE_LIBSSH2_VERSION */ + +/* Define to 1 if you have the `ssl' library (-lssl). */ +#define HAVE_LIBSSL 1 + +/* if zlib is available */ +#define HAVE_LIBZ 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_LIMITS_H 1 + +/* if your compiler supports LL */ +#define HAVE_LL 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_LOCALE_H 1 + +/* Define to 1 if you have a working localtime_r function. */ +#define HAVE_LOCALTIME_R 1 + +/* Define to 1 if the compiler supports the 'long long' data type. */ +#define HAVE_LONGLONG 1 + +/* Define to 1 if you have the malloc.h header file. */ +#define HAVE_MALLOC_H 1 + +/* Define to 1 if you have the memory.h header file. */ +#define HAVE_MEMORY_H 1 + +/* Define to 1 if you have the MSG_NOSIGNAL flag. */ +/* #undef HAVE_MSG_NOSIGNAL */ + +/* Define to 1 if you have the header file. */ +#define HAVE_NETDB_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_NETINET_IN_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_NETINET_TCP_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_NET_IF_H 1 + +/* Define to 1 if NI_WITHSCOPEID exists and works. */ +/* #undef HAVE_NI_WITHSCOPEID */ + +/* if you have an old MIT gssapi library, lacking GSS_C_NT_HOSTBASED_SERVICE + */ +/* #undef HAVE_OLD_GSSMIT */ + +/* Define to 1 if you have the header file. */ +#define HAVE_OPENSSL_CRYPTO_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_OPENSSL_ENGINE_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_OPENSSL_ERR_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_OPENSSL_PEM_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_OPENSSL_PKCS12_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_OPENSSL_RSA_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_OPENSSL_SSL_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_OPENSSL_X509_H 1 + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_PEM_H */ + +/* Define to 1 if you have the `perror' function. */ +#define HAVE_PERROR 1 + +/* Define to 1 if you have the `pipe' function. */ +#define HAVE_PIPE 1 + +/* if you have the function PK11_CreateGenericObject */ +/* #undef HAVE_PK11_CREATEGENERICOBJECT */ + +/* Define to 1 if you have a working poll function. */ +/* #undef HAVE_POLL */ + +/* If you have a fine poll */ +/* #undef HAVE_POLL_FINE */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_POLL_H */ + +/* Define to 1 if you have a working POSIX-style strerror_r function. */ +/* #undef HAVE_POSIX_STRERROR_R */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_PWD_H */ + +/* Define to 1 if you have the `RAND_egd' function. */ +#define HAVE_RAND_EGD 1 + +/* Define to 1 if you have the `RAND_screen' function. */ +/* #undef HAVE_RAND_SCREEN */ + +/* Define to 1 if you have the `RAND_status' function. */ +#define HAVE_RAND_STATUS 1 + +/* Define to 1 if you have the recv function. */ +#define HAVE_RECV 1 + +/* Define to 1 if you have the recvfrom function. */ +#define HAVE_RECVFROM 1 + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_RSA_H */ + +/* Define to 1 if you have the select function. */ +#define HAVE_SELECT 1 + +/* Define to 1 if you have the send function. */ +#define HAVE_SEND 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SETJMP_H 1 + +/* Define to 1 if you have the `setlocale' function. */ +#define HAVE_SETLOCALE 1 + +/* Define to 1 if you have the `setmode' function. */ +#define HAVE_SETMODE 1 + +/* Define to 1 if you have the `setrlimit' function. */ +#define HAVE_SETRLIMIT 1 + +/* Define to 1 if you have the setsockopt function. */ +#define HAVE_SETSOCKOPT 1 + +/* Define to 1 if you have a working setsockopt SO_NONBLOCK function. */ +/* #undef HAVE_SETSOCKOPT_SO_NONBLOCK */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_SGTTY_H */ + +/* Define to 1 if you have the sigaction function. */ +#define HAVE_SIGACTION 1 + +/* Define to 1 if you have the siginterrupt function. */ +#define HAVE_SIGINTERRUPT 1 + +/* Define to 1 if you have the signal function. */ +#define HAVE_SIGNAL 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SIGNAL_H 1 + +/* Define to 1 if you have the sigsetjmp function or macro. */ +/* #undef HAVE_SIGSETJMP */ + +/* Define to 1 if sig_atomic_t is an available typedef. */ +#define HAVE_SIG_ATOMIC_T 1 + +/* Define to 1 if sig_atomic_t is already defined as volatile. */ +/* #undef HAVE_SIG_ATOMIC_T_VOLATILE */ + +/* Define to 1 if struct sockaddr_in6 has the sin6_scope_id member */ +#define HAVE_SOCKADDR_IN6_SIN6_SCOPE_ID 1 + +/* Define to 1 if you have the `socket' function. */ +#define HAVE_SOCKET 1 + +/* Define this if you have the SPNEGO library fbopenssl */ +/* #undef HAVE_SPNEGO */ + +/* Define to 1 if you have the `SSL_get_shutdown' function. */ +#define HAVE_SSL_GET_SHUTDOWN 1 + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_SSL_H */ + +/* Define to 1 if you have the header file. */ +#define HAVE_STDBOOL_H 1 + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_STDINT_H */ + +/* Define to 1 if you have the header file. */ +#define HAVE_STDIO_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STDLIB_H 1 + +/* Define to 1 if you have the strcasecmp function. */ +#define HAVE_STRCASECMP 1 + +/* Define to 1 if you have the strcasestr function. */ +/* #undef HAVE_STRCASESTR */ + +/* Define to 1 if you have the strcmpi function. */ +/* #undef HAVE_STRCMPI */ + +/* Define to 1 if you have the strdup function. */ +#define HAVE_STRDUP 1 + +/* Define to 1 if you have the strerror_r function. */ +#define HAVE_STRERROR_R 1 + +/* Define to 1 if you have the stricmp function. */ +/* #undef HAVE_STRICMP */ + +/* Define to 1 if you have the header file. */ +#define HAVE_STRINGS_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STRING_H 1 + +/* Define to 1 if you have the strlcat function. */ +/* #undef HAVE_STRLCAT */ + +/* Define to 1 if you have the `strlcpy' function. */ +/* #undef HAVE_STRLCPY */ + +/* Define to 1 if you have the strncasecmp function. */ +#define HAVE_STRNCASECMP 1 + +/* Define to 1 if you have the strncmpi function. */ +/* #undef HAVE_STRNCMPI */ + +/* Define to 1 if you have the strnicmp function. */ +/* #undef HAVE_STRNICMP */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_STROPTS_H */ + +/* Define to 1 if you have the strstr function. */ +#define HAVE_STRSTR 1 + +/* Define to 1 if you have the strtok_r function. */ +#define HAVE_STRTOK_R 1 + +/* Define to 1 if you have the strtoll function. */ +/* #undef HAVE_STRTOLL */ + +/* if struct sockaddr_storage is defined */ +#define HAVE_STRUCT_SOCKADDR_STORAGE 1 + +/* Define to 1 if you have the timeval struct. */ +#define HAVE_STRUCT_TIMEVAL 1 + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_SYS_FILIO_H */ + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_IOCTL_H 1 + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_SYS_PARAM_H */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_SYS_POLL_H */ + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_RESOURCE_H 1 + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_SYS_SELECT_H */ + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_SOCKET_H 1 + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_SYS_SOCKIO_H */ + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_STAT_H 1 + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_SYS_TIME_H */ + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_TYPES_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_UIO_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_UN_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_UTIME_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_TERMIOS_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_TERMIO_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_TIME_H 1 + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_TLD_H */ + +/* Define to 1 if you have the `tld_strerror' function. */ +/* #undef HAVE_TLD_STRERROR */ + +/* Define to 1 if you have the `uname' function. */ +#define HAVE_UNAME 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_UNISTD_H 1 + +/* Define to 1 if you have the `utime' function. */ +#define HAVE_UTIME 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_UTIME_H 1 + +/* Define to 1 if compiler supports C99 variadic macro style. */ +#define HAVE_VARIADIC_MACROS_C99 1 + +/* Define to 1 if compiler supports old gcc variadic macro style. */ +#define HAVE_VARIADIC_MACROS_GCC 1 + +/* Define to 1 if you have a working vxworks-style strerror_r function. */ +#define HAVE_VXWORKS_STRERROR_R 1 + +/* Define to 1 if you have the winber.h header file. */ +/* #undef HAVE_WINBER_H */ + +/* Define to 1 if you have the windows.h header file. */ +/* #undef HAVE_WINDOWS_H */ + +/* Define to 1 if you have the winldap.h header file. */ +/* #undef HAVE_WINLDAP_H */ + +/* Define to 1 if you have the winsock2.h header file. */ +/* #undef HAVE_WINSOCK2_H */ + +/* Define to 1 if you have the winsock.h header file. */ +/* #undef HAVE_WINSOCK_H */ + +/* Define this symbol if your OS supports changing the contents of argv */ +#define HAVE_WRITABLE_ARGV 1 + +/* Define to 1 if you have the writev function. */ +#define HAVE_WRITEV 1 + +/* Define to 1 if you have the ws2tcpip.h header file. */ +/* #undef HAVE_WS2TCPIP_H */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_X509_H */ + +/* if you have the zlib.h header file */ +#define HAVE_ZLIB_H 1 + +/* Define to 1 if you are building a native Windows target. */ +/* #undef NATIVE_WINDOWS */ + +/* Define to 1 if you need the lber.h header file even with ldap.h */ +/* #undef NEED_LBER_H */ + +/* Define to 1 if you need the malloc.h header file even with stdlib.h */ +/* #undef NEED_MALLOC_H */ + +/* Define to 1 if you need the memory.h header file even with stdlib.h */ +/* #undef NEED_MEMORY_H */ + +/* Define to 1 if _REENTRANT preprocessor symbol must be defined. */ +/* #undef NEED_REENTRANT */ + +/* Define to 1 if _THREAD_SAFE preprocessor symbol must be defined. */ +/* #undef NEED_THREAD_SAFE */ + +/* Define to 1 if the open function requires three arguments. */ +#define OPEN_NEEDS_ARG3 1 + +/* cpu-machine-OS */ +#define OS "unknown-unknown-vxworks" + +/* Name of package */ +#define PACKAGE "curl" + +/* a suitable file to read random data from */ +#define RANDOM_FILE "/dev/urandom" + +/* Define to the type of arg 1 for recvfrom. */ +#define RECVFROM_TYPE_ARG1 int + +/* Define to the type pointed by arg 2 for recvfrom. */ +#define RECVFROM_TYPE_ARG2 void + +/* Define to 1 if the type pointed by arg 2 for recvfrom is void. */ +#define RECVFROM_TYPE_ARG2_IS_VOID 1 + +/* Define to the type of arg 3 for recvfrom. */ +#define RECVFROM_TYPE_ARG3 size_t + +/* Define to the type of arg 4 for recvfrom. */ +#define RECVFROM_TYPE_ARG4 int + +/* Define to the type pointed by arg 5 for recvfrom. */ +#define RECVFROM_TYPE_ARG5 struct sockaddr + +/* Define to 1 if the type pointed by arg 5 for recvfrom is void. */ +/* #undef RECVFROM_TYPE_ARG5_IS_VOID */ + +/* Define to the type pointed by arg 6 for recvfrom. */ +#define RECVFROM_TYPE_ARG6 socklen_t + +/* Define to 1 if the type pointed by arg 6 for recvfrom is void. */ +/* #undef RECVFROM_TYPE_ARG6_IS_VOID */ + +/* Define to the function return type for recvfrom. */ +#define RECVFROM_TYPE_RETV int + +/* Define to the type of arg 1 for recv. */ +#define RECV_TYPE_ARG1 int + +/* Define to the type of arg 2 for recv. */ +#define RECV_TYPE_ARG2 void * + +/* Define to the type of arg 3 for recv. */ +#define RECV_TYPE_ARG3 size_t + +/* Define to the type of arg 4 for recv. */ +#define RECV_TYPE_ARG4 int + +/* Define to the function return type for recv. */ +#define RECV_TYPE_RETV int + +/* Define as the return type of signal handlers (`int' or `void'). */ +#define RETSIGTYPE void + +/* Define to the type qualifier of arg 5 for select. */ +#define SELECT_QUAL_ARG5 + +/* Define to the type of arg 1 for select. */ +#define SELECT_TYPE_ARG1 int + +/* Define to the type of args 2, 3 and 4 for select. */ +#define SELECT_TYPE_ARG234 fd_set * + +/* Define to the type of arg 5 for select. */ +#define SELECT_TYPE_ARG5 struct timeval * + +/* Define to the function return type for select. */ +#define SELECT_TYPE_RETV int + +/* Define to the type qualifier of arg 2 for send. */ +#define SEND_QUAL_ARG2 const + +/* Define to the type of arg 1 for send. */ +#define SEND_TYPE_ARG1 int + +/* Define to the type of arg 2 for send. */ +#define SEND_TYPE_ARG2 void * + +/* Define to the type of arg 3 for send. */ +#define SEND_TYPE_ARG3 size_t + +/* Define to the type of arg 4 for send. */ +#define SEND_TYPE_ARG4 int + +/* Define to the function return type for send. */ +#define SEND_TYPE_RETV int + +/* The size of `int', as computed by sizeof. */ +#define SIZEOF_INT 4 + +/* The size of `long', as computed by sizeof. */ +#define SIZEOF_LONG 4 + +/* The size of `off_t', as computed by sizeof. */ +#define SIZEOF_OFF_T 8 + +/* The size of `short', as computed by sizeof. */ +#define SIZEOF_SHORT 2 + +/* The size of `size_t', as computed by sizeof. */ +#define SIZEOF_SIZE_T 4 + +/* The size of `time_t', as computed by sizeof. */ +#define SIZEOF_TIME_T 4 + +/* The size of `void*', as computed by sizeof. */ +#define SIZEOF_VOIDP 4 + +/* Define to 1 if you have the ANSI C header files. */ +#define STDC_HEADERS 1 + +/* Define to the type of arg 3 for strerror_r. */ +/* #undef STRERROR_R_TYPE_ARG3 */ + +/* Define to 1 if you can safely include both and . */ +/* #undef TIME_WITH_SYS_TIME */ + +/* Define if you want to enable c-ares support */ +/* #undef USE_ARES */ + +/* Define to disable non-blocking sockets. */ +/* #undef USE_BLOCKING_SOCKETS */ + +/* if GnuTLS is enabled */ +/* #undef USE_GNUTLS */ + +/* if libSSH2 is in use */ +/* #undef USE_LIBSSH2 */ + +/* If you want to build curl with the built-in manual */ +#define USE_MANUAL 1 + +/* if NSS is enabled */ +/* #undef USE_NSS */ + +/* if OpenSSL is in use */ +#define USE_OPENSSL 1 + +/* if SSL is enabled */ +#define USE_SSLEAY 1 + +/* Define to 1 if you are building a Windows target without large file + support. */ +/* #undef USE_WIN32_LARGE_FILES */ + +/* to enable SSPI support */ +/* #undef USE_WINDOWS_SSPI */ + +/* Define to 1 if using yaSSL in OpenSSL compatibility mode. */ +/* #undef USE_YASSLEMUL */ + +/* Define to avoid automatic inclusion of winsock.h */ +/* #undef WIN32_LEAN_AND_MEAN */ + +/* Define to 1 if OS is AIX. */ +#ifndef _ALL_SOURCE +/* # undef _ALL_SOURCE */ +#endif + +/* Number of bits in a file offset, on hosts where this is settable. */ +/* #undef _FILE_OFFSET_BITS */ + +/* Define for large files, on AIX-style hosts. */ +/* #undef _LARGE_FILES */ + +/* Define to empty if `const' does not conform to ANSI C. */ +/* #undef const */ + +/* Type to use in place of in_addr_t when system does not provide it. */ +/* #undef in_addr_t */ + +/* Define to `__inline__' or `__inline' if that's what the C compiler + calls it, or to nothing if 'inline' is not supported under any name. */ +#ifndef __cplusplus +/* #undef inline */ +#endif + +/* Define to `unsigned int' if does not define. */ +/* #undef size_t */ + +/* the signed version of size_t */ +/* #undef ssize_t */ + +#endif /* __LIB_CONFIG_VXWORKS_H */ diff --git a/mobicore/common/curl/lib/config-win32.h b/mobicore/common/curl/lib/config-win32.h new file mode 100644 index 0000000000000000000000000000000000000000..67bfec3c0616d34bbf3237a1d78dcebbb9eeac29 --- /dev/null +++ b/mobicore/common/curl/lib/config-win32.h @@ -0,0 +1,594 @@ +#ifndef __LIB_CONFIG_WIN32_H +#define __LIB_CONFIG_WIN32_H + +/* ================================================================ */ +/* lib/config-win32.h - Hand crafted config file for Windows */ +/* ================================================================ */ + +/* ---------------------------------------------------------------- */ +/* HEADER FILES */ +/* ---------------------------------------------------------------- */ + +/* Define if you have the header file. */ +/* #define HAVE_ARPA_INET_H 1 */ + +/* Define if you have the header file. */ +#define HAVE_ASSERT_H 1 + +/* Define if you have the header file. */ +/* #define HAVE_CRYPTO_H 1 */ + +/* Define if you have the header file. */ +/* #define HAVE_ERR_H 1 */ + +/* Define if you have the header file. */ +#define HAVE_FCNTL_H 1 + +/* Define if you have the header file. */ +/* #define HAVE_GETOPT_H 1 */ + +/* Define if you have the header file. */ +#define HAVE_IO_H 1 + +/* Define if you have the header file. */ +#define HAVE_LIMITS_H 1 + +/* Define if you need the malloc.h header file even with stdlib.h */ +#if !defined(__SALFORDC__) && !defined(__POCC__) +#define NEED_MALLOC_H 1 +#endif + +/* Define if you have the header file. */ +/* #define HAVE_NETDB_H 1 */ + +/* Define if you have the header file. */ +/* #define HAVE_NETINET_IN_H 1 */ + +/* Define if you have the header file. */ +#ifndef __SALFORDC__ +#define HAVE_PROCESS_H 1 +#endif + +/* Define if you have the header file. */ +#define HAVE_SIGNAL_H 1 + +/* Define if you have the header file. */ +/* #define HAVE_SGTTY_H 1 */ + +/* Define if you have the header file. */ +/* #define HAVE_SSL_H 1 */ + +/* Define if you have the header file. */ +#define HAVE_STDLIB_H 1 + +/* Define if you have the header file. */ +/* #define HAVE_SYS_PARAM_H 1 */ + +/* Define if you have the header file. */ +/* #define HAVE_SYS_SELECT_H 1 */ + +/* Define if you have the header file. */ +/* #define HAVE_SYS_SOCKET_H 1 */ + +/* Define if you have the header file. */ +/* #define HAVE_SYS_SOCKIO_H 1 */ + +/* Define if you have the header file. */ +#define HAVE_SYS_STAT_H 1 + +/* Define if you have the header file */ +/* #define HAVE_SYS_TIME_H 1 */ + +/* Define if you have the header file. */ +#define HAVE_SYS_TYPES_H 1 + +/* Define if you have the header file. */ +#ifndef __BORLANDC__ +#define HAVE_SYS_UTIME_H 1 +#endif + +/* Define if you have the header file. */ +/* #define HAVE_TERMIO_H 1 */ + +/* Define if you have the header file. */ +/* #define HAVE_TERMIOS_H 1 */ + +/* Define if you have the header file. */ +#define HAVE_TIME_H 1 + +/* Define if you have the header file. */ +#if defined(__MINGW32__) || defined(__WATCOMC__) || defined(__LCC__) || \ + defined(__POCC__) +#define HAVE_UNISTD_H 1 +#endif + +/* Define if you have the header file. */ +#define HAVE_WINDOWS_H 1 + +/* Define if you have the header file. */ +#define HAVE_WINSOCK_H 1 + +/* Define if you have the header file. */ +#ifndef __SALFORDC__ +#define HAVE_WINSOCK2_H 1 +#endif + +/* Define if you have the header file. */ +#ifndef __SALFORDC__ +#define HAVE_WS2TCPIP_H 1 +#endif + +/* ---------------------------------------------------------------- */ +/* OTHER HEADER INFO */ +/* ---------------------------------------------------------------- */ + +/* Define if sig_atomic_t is an available typedef. */ +#define HAVE_SIG_ATOMIC_T 1 + +/* Define if you have the ANSI C header files. */ +#define STDC_HEADERS 1 + +/* Define if you can safely include both and . */ +/* #define TIME_WITH_SYS_TIME 1 */ + +/* ---------------------------------------------------------------- */ +/* FUNCTIONS */ +/* ---------------------------------------------------------------- */ + +/* Define if you have the closesocket function. */ +#define HAVE_CLOSESOCKET 1 + +/* Define if you don't have vprintf but do have _doprnt. */ +/* #define HAVE_DOPRNT 1 */ + +/* Define if you have the gethostbyaddr function. */ +#define HAVE_GETHOSTBYADDR 1 + +/* Define if you have the gethostname function. */ +#define HAVE_GETHOSTNAME 1 + +/* Define if you have the getpass function. */ +/* #define HAVE_GETPASS 1 */ + +/* Define if you have the getservbyname function. */ +#define HAVE_GETSERVBYNAME 1 + +/* Define if you have the getprotobyname function. */ +#define HAVE_GETPROTOBYNAME + +/* Define if you have the gettimeofday function. */ +/* #define HAVE_GETTIMEOFDAY 1 */ + +/* Define if you have the inet_addr function. */ +#define HAVE_INET_ADDR 1 + +/* Define if you have the ioctlsocket function. */ +#define HAVE_IOCTLSOCKET 1 + +/* Define if you have a working ioctlsocket FIONBIO function. */ +#define HAVE_IOCTLSOCKET_FIONBIO 1 + +/* Define if you have the perror function. */ +#define HAVE_PERROR 1 + +/* Define if you have the RAND_screen function when using SSL */ +#define HAVE_RAND_SCREEN 1 + +/* Define if you have the `RAND_status' function when using SSL. */ +#define HAVE_RAND_STATUS 1 + +/* Define to 1 if you have the `CRYPTO_cleanup_all_ex_data' function. + This is present in OpenSSL versions after 0.9.6b */ +#define HAVE_CRYPTO_CLEANUP_ALL_EX_DATA 1 + +/* Define if you have the select function. */ +#define HAVE_SELECT 1 + +/* Define if you have the setvbuf function. */ +#define HAVE_SETVBUF 1 + +/* Define if you have the socket function. */ +#define HAVE_SOCKET 1 + +/* Define if you have the strcasecmp function. */ +/* #define HAVE_STRCASECMP 1 */ + +/* Define if you have the strdup function. */ +#define HAVE_STRDUP 1 + +/* Define if you have the strftime function. */ +#define HAVE_STRFTIME 1 + +/* Define if you have the stricmp function. */ +#define HAVE_STRICMP 1 + +/* Define if you have the strncasecmp function. */ +/* #define HAVE_STRNCASECMP 1 */ + +/* Define if you have the strnicmp function. */ +#define HAVE_STRNICMP 1 + +/* Define if you have the strstr function. */ +#define HAVE_STRSTR 1 + +/* Define if you have the strtoll function. */ +#if defined(__MINGW32__) || defined(__WATCOMC__) || defined(__POCC__) +#define HAVE_STRTOLL 1 +#endif + +/* Define if you have the tcgetattr function. */ +/* #define HAVE_TCGETATTR 1 */ + +/* Define if you have the tcsetattr function. */ +/* #define HAVE_TCSETATTR 1 */ + +/* Define if you have the utime function */ +#ifndef __BORLANDC__ +#define HAVE_UTIME 1 +#endif + +/* Define to the type qualifier of arg 1 for getnameinfo. */ +#define GETNAMEINFO_QUAL_ARG1 const + +/* Define to the type of arg 1 for getnameinfo. */ +#define GETNAMEINFO_TYPE_ARG1 struct sockaddr * + +/* Define to the type of arg 2 for getnameinfo. */ +#define GETNAMEINFO_TYPE_ARG2 socklen_t + +/* Define to the type of args 4 and 6 for getnameinfo. */ +#define GETNAMEINFO_TYPE_ARG46 DWORD + +/* Define to the type of arg 7 for getnameinfo. */ +#define GETNAMEINFO_TYPE_ARG7 int + +/* Define if you have the recv function. */ +#define HAVE_RECV 1 + +/* Define to the type of arg 1 for recv. */ +#define RECV_TYPE_ARG1 SOCKET + +/* Define to the type of arg 2 for recv. */ +#define RECV_TYPE_ARG2 char * + +/* Define to the type of arg 3 for recv. */ +#define RECV_TYPE_ARG3 int + +/* Define to the type of arg 4 for recv. */ +#define RECV_TYPE_ARG4 int + +/* Define to the function return type for recv. */ +#define RECV_TYPE_RETV int + +/* Define if you have the recvfrom function. */ +#define HAVE_RECVFROM 1 + +/* Define to the type of arg 1 for recvfrom. */ +#define RECVFROM_TYPE_ARG1 SOCKET + +/* Define to the type pointed by arg 2 for recvfrom. */ +#define RECVFROM_TYPE_ARG2 char + +/* Define to the type of arg 3 for recvfrom. */ +#define RECVFROM_TYPE_ARG3 int + +/* Define to the type of arg 4 for recvfrom. */ +#define RECVFROM_TYPE_ARG4 int + +/* Define to the type pointed by arg 5 for recvfrom. */ +#define RECVFROM_TYPE_ARG5 struct sockaddr + +/* Define to the type pointed by arg 6 for recvfrom. */ +#define RECVFROM_TYPE_ARG6 int + +/* Define to the function return type for recvfrom. */ +#define RECVFROM_TYPE_RETV int + +/* Define if you have the send function. */ +#define HAVE_SEND 1 + +/* Define to the type of arg 1 for send. */ +#define SEND_TYPE_ARG1 SOCKET + +/* Define to the type qualifier of arg 2 for send. */ +#define SEND_QUAL_ARG2 const + +/* Define to the type of arg 2 for send. */ +#define SEND_TYPE_ARG2 char * + +/* Define to the type of arg 3 for send. */ +#define SEND_TYPE_ARG3 int + +/* Define to the type of arg 4 for send. */ +#define SEND_TYPE_ARG4 int + +/* Define to the function return type for send. */ +#define SEND_TYPE_RETV int + +/* ---------------------------------------------------------------- */ +/* TYPEDEF REPLACEMENTS */ +/* ---------------------------------------------------------------- */ + +/* Define this if in_addr_t is not an available 'typedefed' type */ +#define in_addr_t unsigned long + +/* Define as the return type of signal handlers (int or void). */ +#define RETSIGTYPE void + +/* Define ssize_t if it is not an available 'typedefed' type */ +#ifndef _SSIZE_T_DEFINED +# if (defined(__WATCOMC__) && (__WATCOMC__ >= 1240)) || \ + defined(__POCC__) || \ + defined(__MINGW32__) +# elif defined(_WIN64) +# define _SSIZE_T_DEFINED +# define ssize_t __int64 +# else +# define _SSIZE_T_DEFINED +# define ssize_t int +# endif +#endif + +/* ---------------------------------------------------------------- */ +/* TYPE SIZES */ +/* ---------------------------------------------------------------- */ + +/* The size of `int', as computed by sizeof. */ +#define SIZEOF_INT 4 + +/* The size of `long double', as computed by sizeof. */ +#define SIZEOF_LONG_DOUBLE 16 + +/* The size of `long long', as computed by sizeof. */ +/* #define SIZEOF_LONG_LONG 8 */ + +/* The size of `short', as computed by sizeof. */ +#define SIZEOF_SHORT 2 + +/* The size of `size_t', as computed by sizeof. */ +#if defined(_WIN64) +# define SIZEOF_SIZE_T 8 +#else +# define SIZEOF_SIZE_T 4 +#endif + +/* ---------------------------------------------------------------- */ +/* STRUCT RELATED */ +/* ---------------------------------------------------------------- */ + +/* Define this if you have struct sockaddr_storage */ +#ifndef __SALFORDC__ +#define HAVE_STRUCT_SOCKADDR_STORAGE 1 +#endif + +/* Define this if you have struct timeval */ +#define HAVE_STRUCT_TIMEVAL 1 + +/* ---------------------------------------------------------------- */ +/* Watt-32 tcp/ip SPECIFIC */ +/* ---------------------------------------------------------------- */ + +#ifdef USE_WATT32 + #include + #undef byte + #undef word + #undef USE_WINSOCK + #undef HAVE_WINSOCK_H + #undef HAVE_WINSOCK2_H + #undef HAVE_WS2TCPIP_H + #define HAVE_GETADDRINFO + #define HAVE_GETNAMEINFO + #define HAVE_SYS_IOCTL_H + #define HAVE_SYS_SOCKET_H + #define HAVE_NETINET_IN_H + #define HAVE_NETDB_H + #define HAVE_ARPA_INET_H + #define HAVE_FREEADDRINFO + #define SOCKET int +#endif + + +/* ---------------------------------------------------------------- */ +/* COMPILER SPECIFIC */ +/* ---------------------------------------------------------------- */ + +/* Undef keyword 'const' if it does not work. */ +/* #undef const */ + +/* Windows should not have HAVE_GMTIME_R defined */ +/* #undef HAVE_GMTIME_R */ + +/* Define if the compiler supports C99 variadic macro style. */ +#if defined(_MSC_VER) && (_MSC_VER >= 1400) +#define HAVE_VARIADIC_MACROS_C99 1 +#endif + +/* Define if the compiler supports the 'long long' data type. */ +#if defined(__MINGW32__) || defined(__WATCOMC__) +#define HAVE_LONGLONG 1 +#endif + +/* Define to avoid VS2005 complaining about portable C functions */ +#if defined(_MSC_VER) && (_MSC_VER >= 1400) +#define _CRT_SECURE_NO_DEPRECATE 1 +#define _CRT_NONSTDC_NO_DEPRECATE 1 +#endif + +/* VS2005 and later dafault size for time_t is 64-bit, unless */ +/* _USE_32BIT_TIME_T has been defined to get a 32-bit time_t. */ +#if defined(_MSC_VER) && (_MSC_VER >= 1400) +# ifndef _USE_32BIT_TIME_T +# define SIZEOF_TIME_T 8 +# else +# define SIZEOF_TIME_T 4 +# endif +#endif + +/* Officially, Microsoft's Windows SDK versions 6.X do not support Windows + 2000 as a supported build target. VS2008 default installations provide an + embedded Windows SDK v6.0A along with the claim that Windows 2000 is a + valid build target for VS2008. Popular belief is that binaries built using + Windows SDK versions 6.X and Windows 2000 as a build target are functional */ +#if defined(_MSC_VER) && (_MSC_VER >= 1500) +# define VS2008_MINIMUM_TARGET 0x0500 +#endif + +/* When no build target is specified VS2008 default build target is Windows + Vista, which leaves out even Winsows XP. If no build target has been given + for VS2008 we will target the minimum Officially supported build target, + which happens to be Windows XP. */ +#if defined(_MSC_VER) && (_MSC_VER >= 1500) +# define VS2008_DEFAULT_TARGET 0x0501 +#endif + +/* VS2008 default target settings and minimum build target check */ +#if defined(_MSC_VER) && (_MSC_VER >= 1500) +# ifndef _WIN32_WINNT +# define _WIN32_WINNT VS2008_DEFAULT_TARGET +# endif +# ifndef WINVER +# define WINVER VS2008_DEFAULT_TARGET +# endif +# if (_WIN32_WINNT < VS2008_MINIMUM_TARGET) || (WINVER < VS2008_MINIMUM_TARGET) +# error VS2008 does not support Windows build targets prior to Windows 2000 +# endif +#endif + +/* When no build target is specified Pelles C 5.00 and later default build + target is Windows Vista. We override default target to be Windows 2000. */ +#if defined(__POCC__) && (__POCC__ >= 500) +# ifndef _WIN32_WINNT +# define _WIN32_WINNT 0x0500 +# endif +# ifndef WINVER +# define WINVER 0x0500 +# endif +#endif + +/* Availability of freeaddrinfo, getaddrinfo and getnameinfo functions is + quite convoluted, compiler dependent and even build target dependent. */ +#if defined(HAVE_WS2TCPIP_H) +# if defined(__POCC__) +# define HAVE_FREEADDRINFO 1 +# define HAVE_GETADDRINFO 1 +# define HAVE_GETADDRINFO_THREADSAFE 1 +# define HAVE_GETNAMEINFO 1 +# elif defined(_WIN32_WINNT) && (_WIN32_WINNT >= 0x0501) +# define HAVE_FREEADDRINFO 1 +# define HAVE_GETADDRINFO 1 +# define HAVE_GETADDRINFO_THREADSAFE 1 +# define HAVE_GETNAMEINFO 1 +# elif defined(_MSC_VER) && (_MSC_VER >= 1200) +# define HAVE_FREEADDRINFO 1 +# define HAVE_GETADDRINFO 1 +# define HAVE_GETADDRINFO_THREADSAFE 1 +# define HAVE_GETNAMEINFO 1 +# endif +#endif + +#if defined(__POCC__) +# ifndef _MSC_VER +# error Microsoft extensions /Ze compiler option is required +# endif +# ifndef __POCC__OLDNAMES +# error Compatibility names /Go compiler option is required +# endif +#endif + +/* ---------------------------------------------------------------- */ +/* LARGE FILE SUPPORT */ +/* ---------------------------------------------------------------- */ + +#if defined(_MSC_VER) && !defined(_WIN32_WCE) +# if (_MSC_VER >= 900) && (_INTEGRAL_MAX_BITS >= 64) +# define USE_WIN32_LARGE_FILES +# else +# define USE_WIN32_SMALL_FILES +# endif +#endif + +#if defined(__MINGW32__) && !defined(USE_WIN32_LARGE_FILES) +# define USE_WIN32_LARGE_FILES +#endif + +#if defined(__WATCOMC__) && !defined(USE_WIN32_LARGE_FILES) +# define USE_WIN32_LARGE_FILES +#endif + +#if defined(__POCC__) +# undef USE_WIN32_LARGE_FILES +#endif + +#if !defined(USE_WIN32_LARGE_FILES) && !defined(USE_WIN32_SMALL_FILES) +# define USE_WIN32_SMALL_FILES +#endif + +/* ---------------------------------------------------------------- */ +/* DNS RESOLVER SPECIALTY */ +/* ---------------------------------------------------------------- */ + +/* + * Undefine both USE_ARES and USE_THREADS_WIN32 for synchronous DNS + */ + +/* Define USE_ARES to enable c-ares asynchronous DNS lookups */ +/* #define USE_ARES 1 */ + +/* Define USE_THREADS_WIN32 to enable threaded asynchronous DNS lookups */ +#define USE_THREADS_WIN32 1 + +#if defined(USE_ARES) && defined(USE_THREADS_WIN32) +# error "Only one DNS lookup specialty may be defined at most" +#endif + +/* ---------------------------------------------------------------- */ +/* LDAP SUPPORT */ +/* ---------------------------------------------------------------- */ + +#if defined(CURL_HAS_NOVELL_LDAPSDK) || defined(CURL_HAS_MOZILLA_LDAPSDK) +#undef CURL_LDAP_WIN +#define HAVE_LDAP_SSL_H 1 +#define HAVE_LDAP_URL_PARSE 1 +#elif defined(CURL_HAS_OPENLDAP_LDAPSDK) +#undef CURL_LDAP_WIN +#define HAVE_LDAP_URL_PARSE 1 +#else +#undef HAVE_LDAP_URL_PARSE +#define CURL_LDAP_WIN 1 +#endif + +#if defined(__WATCOMC__) && defined(CURL_LDAP_WIN) +#if __WATCOMC__ < 1280 +#define WINBERAPI __declspec(cdecl) +#define WINLDAPAPI __declspec(cdecl) +#endif +#endif + +#if defined(__POCC__) && defined(CURL_LDAP_WIN) +# define CURL_DISABLE_LDAP 1 +#endif + +/* ---------------------------------------------------------------- */ +/* ADDITIONAL DEFINITIONS */ +/* ---------------------------------------------------------------- */ + +/* Define cpu-machine-OS */ +#undef OS +#if defined(_M_IX86) || defined(__i386__) /* x86 (MSVC or gcc) */ +#define OS "i386-pc-win32" +#elif defined(_M_IA64) /* Itanium */ +#define OS "ia64-pc-win32" +#elif defined(_M_X64) /* AMD64/EM64T - Not defined until MSVC 2005 */ +#define OS "amd64-pc-win32" +#else +#define OS "unknown-pc-win32" +#endif + +/* Name of package */ +#define PACKAGE "curl" + +#if defined(__POCC__) || (USE_IPV6) +# define ENABLE_IPV6 1 +#endif + +#endif /* __LIB_CONFIG_WIN32_H */ diff --git a/mobicore/common/curl/lib/config-win32ce.h b/mobicore/common/curl/lib/config-win32ce.h new file mode 100644 index 0000000000000000000000000000000000000000..3a5913e99af6bf603878634dbfc925a962eea090 --- /dev/null +++ b/mobicore/common/curl/lib/config-win32ce.h @@ -0,0 +1,416 @@ +#ifndef __LIB_CONFIG_WIN32CE_H +#define __LIB_CONFIG_WIN32CE_H + +/* ================================================================ */ +/* lib/config-win32ce.h - Hand crafted config file for windows ce */ +/* ================================================================ */ + +/* ---------------------------------------------------------------- */ +/* HEADER FILES */ +/* ---------------------------------------------------------------- */ + +/* Define if you have the header file. */ +/* #define HAVE_ARPA_INET_H 1 */ + +/* Define if you have the header file. */ +/* #define HAVE_ASSERT_H 1 */ + +/* Define if you have the header file. */ +/* #define HAVE_CRYPTO_H 1 */ + +/* Define if you have the header file. */ +/* #define HAVE_ERR_H 1 */ + +/* Define if you have the header file. */ +#define HAVE_FCNTL_H 1 + +/* Define if you have the header file. */ +/* #define HAVE_GETOPT_H 1 */ + +/* Define if you have the header file. */ +#define HAVE_IO_H 1 + +/* Define if you have the header file. */ +#define HAVE_LIMITS_H 1 + +/* Define if you need the malloc.h header header file even with stdlib.h */ +#define NEED_MALLOC_H 1 + +/* Define if you have the header file. */ +/* #define HAVE_NETDB_H 1 */ + +/* Define if you have the header file. */ +/* #define HAVE_NETINET_IN_H 1 */ + +/* Define if you have the header file. */ +#define HAVE_SIGNAL_H 1 + +/* Define if you have the header file. */ +/* #define HAVE_SGTTY_H 1 */ + +/* Define if you have the header file. */ +/* #define HAVE_SSL_H 1 */ + +/* Define if you have the header file. */ +#define HAVE_STDLIB_H 1 + +/* Define if you have the header file. */ +#define HAVE_PROCESS_H 1 + +/* Define if you have the header file. */ +/* #define HAVE_SYS_PARAM_H 1 */ + +/* Define if you have the header file. */ +/* #define HAVE_SYS_SELECT_H 1 */ + +/* Define if you have the header file. */ +/* #define HAVE_SYS_SOCKET_H 1 */ + +/* Define if you have the header file. */ +/* #define HAVE_SYS_SOCKIO_H 1 */ + +/* Define if you have the header file. */ +#define HAVE_SYS_STAT_H 1 + +/* Define if you have the header file */ +/* #define HAVE_SYS_TIME_H 1 */ + +/* Define if you have the header file. */ +/* #define HAVE_SYS_TYPES_H 1 */ + +/* Define if you have the header file */ +#define HAVE_SYS_UTIME_H 1 + +/* Define if you have the header file. */ +/* #define HAVE_TERMIO_H 1 */ + +/* Define if you have the header file. */ +/* #define HAVE_TERMIOS_H 1 */ + +/* Define if you have the header file. */ +#define HAVE_TIME_H 1 + +/* Define if you have the header file. */ +#if defined(__MINGW32__) || defined(__WATCOMC__) || defined(__LCC__) +#define HAVE_UNISTD_H 1 +#endif + +/* Define if you have the header file. */ +#define HAVE_WINDOWS_H 1 + +/* Define if you have the header file. */ +#define HAVE_WINSOCK_H 1 + +/* Define if you have the header file. */ +/* #define HAVE_WINSOCK2_H 1 */ + +/* Define if you have the header file. */ +/* #define HAVE_WS2TCPIP_H 1 */ + +/* ---------------------------------------------------------------- */ +/* OTHER HEADER INFO */ +/* ---------------------------------------------------------------- */ + +/* Define if sig_atomic_t is an available typedef. */ +#define HAVE_SIG_ATOMIC_T 1 + +/* Define if you have the ANSI C header files. */ +#define STDC_HEADERS 1 + +/* Define if you can safely include both and . */ +/* #define TIME_WITH_SYS_TIME 1 */ + +/* ---------------------------------------------------------------- */ +/* FUNCTIONS */ +/* ---------------------------------------------------------------- */ + +/* Define if you have the closesocket function. */ +#define HAVE_CLOSESOCKET 1 + +/* Define if you don't have vprintf but do have _doprnt. */ +/* #define HAVE_DOPRNT 1 */ + +/* Define if you have the gethostbyaddr function. */ +#define HAVE_GETHOSTBYADDR 1 + +/* Define if you have the gethostname function. */ +#define HAVE_GETHOSTNAME 1 + +/* Define if you have the getpass function. */ +/* #define HAVE_GETPASS 1 */ + +/* Define if you have the getservbyname function. */ +#define HAVE_GETSERVBYNAME 1 + +/* Define if you have the gettimeofday function. */ +/* #define HAVE_GETTIMEOFDAY 1 */ + +/* Define if you have the inet_addr function. */ +#define HAVE_INET_ADDR 1 + +/* Define if you have the ioctlsocket function. */ +#define HAVE_IOCTLSOCKET 1 + +/* Define if you have a working ioctlsocket FIONBIO function. */ +#define HAVE_IOCTLSOCKET_FIONBIO 1 + +/* Define if you have the perror function. */ +#define HAVE_PERROR 1 + +/* Define if you have the RAND_screen function when using SSL */ +#define HAVE_RAND_SCREEN 1 + +/* Define if you have the `RAND_status' function when using SSL. */ +#define HAVE_RAND_STATUS 1 + +/* Define if you have the select function. */ +#define HAVE_SELECT 1 + +/* Define if you have the setvbuf function. */ +#define HAVE_SETVBUF 1 + +/* Define if you have the socket function. */ +#define HAVE_SOCKET 1 + +/* Define if you have the strcasecmp function. */ +/* #define HAVE_STRCASECMP 1 */ + +/* Define if you have the strdup function. */ +/* #define HAVE_STRDUP 1 */ + +/* Define if you have the strftime function. */ +/* #define HAVE_STRFTIME 1 */ + +/* Define if you have the stricmp function. */ +/* #define HAVE_STRICMP 1 */ + +/* Define if you have the strncasecmp function. */ +/* #define HAVE_STRNCASECMP 1 */ + +/* Define if you have the strnicmp function. */ +/* #define HAVE_STRNICMP 1 */ + +/* Define if you have the strstr function. */ +#define HAVE_STRSTR 1 + +/* Define if you have the strtoll function. */ +#if defined(__MINGW32__) || defined(__WATCOMC__) +#define HAVE_STRTOLL 1 +#endif + +/* Define if you have the tcgetattr function. */ +/* #define HAVE_TCGETATTR 1 */ + +/* Define if you have the tcsetattr function. */ +/* #define HAVE_TCSETATTR 1 */ + +/* Define if you have the utime function */ +#define HAVE_UTIME 1 + +/* Define if you have the getnameinfo function. */ +#define HAVE_GETNAMEINFO 1 + +/* Define to the type qualifier of arg 1 for getnameinfo. */ +#define GETNAMEINFO_QUAL_ARG1 const + +/* Define to the type of arg 1 for getnameinfo. */ +#define GETNAMEINFO_TYPE_ARG1 struct sockaddr * + +/* Define to the type of arg 2 for getnameinfo. */ +#define GETNAMEINFO_TYPE_ARG2 socklen_t + +/* Define to the type of args 4 and 6 for getnameinfo. */ +#define GETNAMEINFO_TYPE_ARG46 DWORD + +/* Define to the type of arg 7 for getnameinfo. */ +#define GETNAMEINFO_TYPE_ARG7 int + +/* Define if you have the recv function. */ +#define HAVE_RECV 1 + +/* Define to the type of arg 1 for recv. */ +#define RECV_TYPE_ARG1 SOCKET + +/* Define to the type of arg 2 for recv. */ +#define RECV_TYPE_ARG2 char * + +/* Define to the type of arg 3 for recv. */ +#define RECV_TYPE_ARG3 int + +/* Define to the type of arg 4 for recv. */ +#define RECV_TYPE_ARG4 int + +/* Define to the function return type for recv. */ +#define RECV_TYPE_RETV int + +/* Define if you have the recvfrom function. */ +#define HAVE_RECVFROM 1 + +/* Define to the type of arg 1 for recvfrom. */ +#define RECVFROM_TYPE_ARG1 SOCKET + +/* Define to the type pointed by arg 2 for recvfrom. */ +#define RECVFROM_TYPE_ARG2 char + +/* Define to the type of arg 3 for recvfrom. */ +#define RECVFROM_TYPE_ARG3 int + +/* Define to the type of arg 4 for recvfrom. */ +#define RECVFROM_TYPE_ARG4 int + +/* Define to the type pointed by arg 5 for recvfrom. */ +#define RECVFROM_TYPE_ARG5 struct sockaddr + +/* Define to the type pointed by arg 6 for recvfrom. */ +#define RECVFROM_TYPE_ARG6 int + +/* Define to the function return type for recvfrom. */ +#define RECVFROM_TYPE_RETV int + +/* Define if you have the send function. */ +#define HAVE_SEND 1 + +/* Define to the type of arg 1 for send. */ +#define SEND_TYPE_ARG1 SOCKET + +/* Define to the type qualifier of arg 2 for send. */ +#define SEND_QUAL_ARG2 const + +/* Define to the type of arg 2 for send. */ +#define SEND_TYPE_ARG2 char * + +/* Define to the type of arg 3 for send. */ +#define SEND_TYPE_ARG3 int + +/* Define to the type of arg 4 for send. */ +#define SEND_TYPE_ARG4 int + +/* Define to the function return type for send. */ +#define SEND_TYPE_RETV int + +/* ---------------------------------------------------------------- */ +/* TYPEDEF REPLACEMENTS */ +/* ---------------------------------------------------------------- */ + +/* Define this if in_addr_t is not an available 'typedefed' type */ +#define in_addr_t unsigned long + +/* Define as the return type of signal handlers (int or void). */ +#define RETSIGTYPE void + +/* Define ssize_t if it is not an available 'typedefed' type */ +#if (defined(__WATCOMC__) && (__WATCOMC__ >= 1240)) || defined(__POCC__) +#elif defined(_WIN64) +#define ssize_t __int64 +#else +#define ssize_t int +#endif + +/* ---------------------------------------------------------------- */ +/* TYPE SIZES */ +/* ---------------------------------------------------------------- */ + +/* The size of `int', as computed by sizeof. */ +#define SIZEOF_INT 4 + +/* The size of `long double', as computed by sizeof. */ +#define SIZEOF_LONG_DOUBLE 16 + +/* The size of `long long', as computed by sizeof. */ +/* #define SIZEOF_LONG_LONG 8 */ + +/* The size of `short', as computed by sizeof. */ +#define SIZEOF_SHORT 2 + +/* The size of `size_t', as computed by sizeof. */ +#if defined(_WIN64) +# define SIZEOF_SIZE_T 8 +#else +# define SIZEOF_SIZE_T 4 +#endif + +/* ---------------------------------------------------------------- */ +/* STRUCT RELATED */ +/* ---------------------------------------------------------------- */ + +/* Define this if you have struct sockaddr_storage */ +/* #define HAVE_STRUCT_SOCKADDR_STORAGE 1 */ + +/* Define this if you have struct timeval */ +#define HAVE_STRUCT_TIMEVAL 1 + +/* Define this if struct sockaddr_in6 has the sin6_scope_id member */ +#define HAVE_SOCKADDR_IN6_SIN6_SCOPE_ID 1 + +/* ---------------------------------------------------------------- */ +/* COMPILER SPECIFIC */ +/* ---------------------------------------------------------------- */ + +/* Undef keyword 'const' if it does not work. */ +/* #undef const */ + +/* Define to avoid VS2005 complaining about portable C functions */ +#if defined(_MSC_VER) && (_MSC_VER >= 1400) +#define _CRT_SECURE_NO_DEPRECATE 1 +#define _CRT_NONSTDC_NO_DEPRECATE 1 +#endif + +/* VS2005 and later dafault size for time_t is 64-bit, unless */ +/* _USE_32BIT_TIME_T has been defined to get a 32-bit time_t. */ +#if defined(_MSC_VER) && (_MSC_VER >= 1400) +# ifndef _USE_32BIT_TIME_T +# define SIZEOF_TIME_T 8 +# else +# define SIZEOF_TIME_T 4 +# endif +#endif + +/* ---------------------------------------------------------------- */ +/* LARGE FILE SUPPORT */ +/* ---------------------------------------------------------------- */ + +#if defined(_MSC_VER) && !defined(_WIN32_WCE) +# if (_MSC_VER >= 900) && (_INTEGRAL_MAX_BITS >= 64) +# define USE_WIN32_LARGE_FILES +# else +# define USE_WIN32_SMALL_FILES +# endif +#endif + +#if !defined(USE_WIN32_LARGE_FILES) && !defined(USE_WIN32_SMALL_FILES) +# define USE_WIN32_SMALL_FILES +#endif + +/* ---------------------------------------------------------------- */ +/* LDAP SUPPORT */ +/* ---------------------------------------------------------------- */ + +#define CURL_LDAP_WIN 1 +#undef HAVE_LDAP_URL_PARSE + +/* ---------------------------------------------------------------- */ +/* ADDITIONAL DEFINITIONS */ +/* ---------------------------------------------------------------- */ + +/* Define cpu-machine-OS */ +#undef OS +#define OS "i386-pc-win32ce" + +/* Name of package */ +#define PACKAGE "curl" + +/* ---------------------------------------------------------------- */ +/* WinCE */ +/* ---------------------------------------------------------------- */ + +#define CURL_DISABLE_FILE 1 +#define CURL_DISABLE_TELNET 1 +#define CURL_DISABLE_LDAP 1 + +#define ENOSPC 1 +#define ENOMEM 2 +#define EAGAIN 3 + +extern int stat(const char *path,struct stat *buffer ); + +#endif /* __LIB_CONFIG_WIN32CE_H */ diff --git a/mobicore/common/curl/lib/connect.c b/mobicore/common/curl/lib/connect.c new file mode 100644 index 0000000000000000000000000000000000000000..7638854b30d082ae50ed7540bd9ab34cf6f7426c --- /dev/null +++ b/mobicore/common/curl/lib/connect.c @@ -0,0 +1,1138 @@ +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) 1998 - 2010, Daniel Stenberg, , et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at http://curl.haxx.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ***************************************************************************/ + +#include "setup.h" + +#ifdef HAVE_SYS_TIME_H +#include +#endif +#ifdef HAVE_SYS_SOCKET_H +#include +#endif +#ifdef HAVE_NETINET_IN_H +#include /* may need it */ +#endif +#ifdef HAVE_SYS_UN_H +#include /* for sockaddr_un */ +#endif +#ifdef HAVE_NETINET_TCP_H +#include /* for TCP_NODELAY */ +#endif +#ifdef HAVE_SYS_IOCTL_H +#include +#endif +#ifdef HAVE_UNISTD_H +#include +#endif +#ifdef HAVE_NETDB_H +#include +#endif +#ifdef HAVE_FCNTL_H +#include +#endif +#ifdef HAVE_ARPA_INET_H +#include +#endif +#ifdef HAVE_STDLIB_H +#include +#endif + +#if (defined(HAVE_IOCTL_FIONBIO) && defined(NETWARE)) +#include +#endif +#ifdef NETWARE +#undef in_addr_t +#define in_addr_t unsigned long +#endif +#ifdef __VMS +#include +#include +#endif + +#include +#include +#include + +#define _MPRINTF_REPLACE /* use our functions only */ +#include + +#include "urldata.h" +#include "sendf.h" +#include "if2ip.h" +#include "strerror.h" +#include "connect.h" +#include "curl_memory.h" +#include "select.h" +#include "url.h" /* for Curl_safefree() */ +#include "multiif.h" +#include "sockaddr.h" /* required for Curl_sockaddr_storage */ +#include "inet_ntop.h" +#include "inet_pton.h" +#include "sslgen.h" /* for Curl_ssl_check_cxn() */ +#include "progress.h" + +/* The last #include file should be: */ +#include "memdebug.h" + +#ifdef __SYMBIAN32__ +/* This isn't actually supported under Symbian OS */ +#undef SO_NOSIGPIPE +#endif + +struct Curl_sockaddr_ex { + int family; + int socktype; + int protocol; + unsigned int addrlen; + union { + struct sockaddr addr; + struct Curl_sockaddr_storage buff; + } _sa_ex_u; +}; +#define sa_addr _sa_ex_u.addr + +static bool verifyconnect(curl_socket_t sockfd, int *error); + +static CURLcode +singleipconnect(struct connectdata *conn, + const Curl_addrinfo *ai, /* start connecting to this */ + long timeout_ms, + curl_socket_t *sock, + bool *connected); + +/* + * Curl_timeleft() returns the amount of milliseconds left allowed for the + * transfer/connection. If the value is negative, the timeout time has already + * elapsed. + * + * If 'nowp' is non-NULL, it points to the current time. + * 'duringconnect' is FALSE if not during a connect, as then of course the + * connect timeout is not taken into account! + */ +long Curl_timeleft(struct connectdata *conn, + struct timeval *nowp, + bool duringconnect) +{ + struct SessionHandle *data = conn->data; + int timeout_set = 0; + long timeout_ms = duringconnect?DEFAULT_CONNECT_TIMEOUT:0; + struct timeval now; + + /* if a timeout is set, use the most restrictive one */ + + if(data->set.timeout > 0) + timeout_set |= 1; + if(duringconnect && (data->set.connecttimeout > 0)) + timeout_set |= 2; + + switch (timeout_set) { + case 1: + timeout_ms = data->set.timeout; + break; + case 2: + timeout_ms = data->set.connecttimeout; + break; + case 3: + if(data->set.timeout < data->set.connecttimeout) + timeout_ms = data->set.timeout; + else + timeout_ms = data->set.connecttimeout; + break; + default: + /* use the default */ + if(!duringconnect) + /* if we're not during connect, there's no default timeout so if we're + at zero we better just return zero and not make it a negative number + by the math below */ + return 0; + break; + } + + if(!nowp) { + now = Curl_tvnow(); + nowp = &now; + } + + /* substract elapsed time */ + timeout_ms -= Curl_tvdiff(*nowp, data->progress.t_startsingle); + if(!timeout_ms) + /* avoid returning 0 as that means no timeout! */ + return -1; + + return timeout_ms; +} + +/* + * waitconnect() waits for a TCP connect on the given socket for the specified + * number if milliseconds. It returns: + */ + +#define WAITCONN_CONNECTED 0 +#define WAITCONN_SELECT_ERROR -1 +#define WAITCONN_TIMEOUT 1 +#define WAITCONN_FDSET_ERROR 2 +#define WAITCONN_ABORTED 3 + +static +int waitconnect(struct connectdata *conn, + curl_socket_t sockfd, /* socket */ + long timeout_msec) +{ + int rc; +#ifdef mpeix + /* Call this function once now, and ignore the results. We do this to + "clear" the error state on the socket so that we can later read it + reliably. This is reported necessary on the MPE/iX operating system. */ + (void)verifyconnect(sockfd, NULL); +#endif + + for(;;) { + + /* now select() until we get connect or timeout */ + rc = Curl_socket_ready(CURL_SOCKET_BAD, sockfd, (int)(timeout_msec>1000? + 1000:timeout_msec)); + if(Curl_pgrsUpdate(conn)) + return WAITCONN_ABORTED; + + if(-1 == rc) + /* error, no connect here, try next */ + return WAITCONN_SELECT_ERROR; + + else if(0 == rc) { + /* timeout */ + timeout_msec -= 1000; + if(timeout_msec <= 0) + return WAITCONN_TIMEOUT; + + continue; + } + + if(rc & CURL_CSELECT_ERR) + /* error condition caught */ + return WAITCONN_FDSET_ERROR; + + break; + } + return WAITCONN_CONNECTED; +} + +static CURLcode bindlocal(struct connectdata *conn, + curl_socket_t sockfd, int af) +{ + struct SessionHandle *data = conn->data; + + struct Curl_sockaddr_storage sa; + struct sockaddr *sock = (struct sockaddr *)&sa; /* bind to this address */ + curl_socklen_t sizeof_sa = 0; /* size of the data sock points to */ + struct sockaddr_in *si4 = (struct sockaddr_in *)&sa; +#ifdef ENABLE_IPV6 + struct sockaddr_in6 *si6 = (struct sockaddr_in6 *)&sa; +#endif + + struct Curl_dns_entry *h=NULL; + unsigned short port = data->set.localport; /* use this port number, 0 for + "random" */ + /* how many port numbers to try to bind to, increasing one at a time */ + int portnum = data->set.localportrange; + const char *dev = data->set.str[STRING_DEVICE]; + int error; + char myhost[256] = ""; + int done = 0; /* -1 for error, 1 for address found */ + + /************************************************************* + * Select device to bind socket to + *************************************************************/ + if ( !dev && !port ) + /* no local kind of binding was requested */ + return CURLE_OK; + + memset(&sa, 0, sizeof(struct Curl_sockaddr_storage)); + + if(dev && (strlen(dev)<255) ) { + + /* interface */ + if(Curl_if2ip(af, dev, myhost, sizeof(myhost))) { + /* + * We now have the numerical IP address in the 'myhost' buffer + */ + infof(data, "Local Interface %s is ip %s using address family %i\n", + dev, myhost, af); + done = 1; + +#ifdef SO_BINDTODEVICE + /* I am not sure any other OSs than Linux that provide this feature, and + * at the least I cannot test. --Ben + * + * This feature allows one to tightly bind the local socket to a + * particular interface. This will force even requests to other local + * interfaces to go out the external interface. + * + * + * Only bind to the interface when specified as interface, not just as a + * hostname or ip address. + */ + if(setsockopt(sockfd, SOL_SOCKET, SO_BINDTODEVICE, + dev, (curl_socklen_t)strlen(dev)+1) != 0) { + error = SOCKERRNO; + infof(data, "SO_BINDTODEVICE %s failed with errno %d: %s;" + " will do regular bind\n", + dev, error, Curl_strerror(conn, error)); + /* This is typically "errno 1, error: Operation not permitted" if + you're not running as root or another suitable privileged user */ + } +#endif + } + else { + /* + * This was not an interface, resolve the name as a host name + * or IP number + * + * Temporarily force name resolution to use only the address type + * of the connection. The resolve functions should really be changed + * to take a type parameter instead. + */ + long ipver = conn->ip_version; + int rc; + + if (af == AF_INET) + conn->ip_version = CURL_IPRESOLVE_V4; +#ifdef ENABLE_IPV6 + else if (af == AF_INET6) + conn->ip_version = CURL_IPRESOLVE_V6; +#endif + + rc = Curl_resolv(conn, dev, 0, &h); + if(rc == CURLRESOLV_PENDING) + (void)Curl_wait_for_resolv(conn, &h); + conn->ip_version = ipver; + + if(h) { + /* convert the resolved address, sizeof myhost >= INET_ADDRSTRLEN */ + Curl_printable_address(h->addr, myhost, sizeof(myhost)); + infof(data, "Name '%s' family %i resolved to '%s' family %i\n", + dev, af, myhost, h->addr->ai_family); + Curl_resolv_unlock(data, h); + done = 1; + } + else { + /* + * provided dev was no interface (or interfaces are not supported + * e.g. solaris) no ip address and no domain we fail here + */ + done = -1; + } + } + + if(done > 0) { +#ifdef ENABLE_IPV6 + /* ipv6 address */ + if((af == AF_INET6) && + (Curl_inet_pton(AF_INET6, myhost, &si6->sin6_addr) > 0)) { + si6->sin6_family = AF_INET6; + si6->sin6_port = htons(port); + sizeof_sa = sizeof(struct sockaddr_in6); + } + else +#endif + /* ipv4 address */ + if((af == AF_INET) && + (Curl_inet_pton(AF_INET, myhost, &si4->sin_addr) > 0)) { + si4->sin_family = AF_INET; + si4->sin_port = htons(port); + sizeof_sa = sizeof(struct sockaddr_in); + } + } + + if(done < 1) { + failf(data, "Couldn't bind to '%s'", dev); + return CURLE_INTERFACE_FAILED; + } + } + else { + /* no device was given, prepare sa to match af's needs */ +#ifdef ENABLE_IPV6 + if ( af == AF_INET6 ) { + si6->sin6_family = AF_INET6; + si6->sin6_port = htons(port); + sizeof_sa = sizeof(struct sockaddr_in6); + } + else +#endif + if ( af == AF_INET ) { + si4->sin_family = AF_INET; + si4->sin_port = htons(port); + sizeof_sa = sizeof(struct sockaddr_in); + } + } + + for(;;) { + if( bind(sockfd, sock, sizeof_sa) >= 0) { + /* we succeeded to bind */ + struct Curl_sockaddr_storage add; + curl_socklen_t size = sizeof(add); + memset(&add, 0, sizeof(struct Curl_sockaddr_storage)); + if(getsockname(sockfd, (struct sockaddr *) &add, &size) < 0) { + data->state.os_errno = error = SOCKERRNO; + failf(data, "getsockname() failed with errno %d: %s", + error, Curl_strerror(conn, error)); + return CURLE_INTERFACE_FAILED; + } + infof(data, "Local port: %hu\n", port); + conn->bits.bound = TRUE; + return CURLE_OK; + } + + if(--portnum > 0) { + infof(data, "Bind to local port %hu failed, trying next\n", port); + port++; /* try next port */ + /* We re-use/clobber the port variable here below */ + if(sock->sa_family == AF_INET) + si4->sin_port = ntohs(port); +#ifdef ENABLE_IPV6 + else + si6->sin6_port = ntohs(port); +#endif + } + else + break; + } + + data->state.os_errno = error = SOCKERRNO; + failf(data, "bind failed with errno %d: %s", + error, Curl_strerror(conn, error)); + + return CURLE_INTERFACE_FAILED; +} + +/* + * verifyconnect() returns TRUE if the connect really has happened. + */ +static bool verifyconnect(curl_socket_t sockfd, int *error) +{ + bool rc = TRUE; +#ifdef SO_ERROR + int err = 0; + curl_socklen_t errSize = sizeof(err); + +#ifdef WIN32 + /* + * In October 2003 we effectively nullified this function on Windows due to + * problems with it using all CPU in multi-threaded cases. + * + * In May 2004, we bring it back to offer more info back on connect failures. + * Gisle Vanem could reproduce the former problems with this function, but + * could avoid them by adding this SleepEx() call below: + * + * "I don't have Rational Quantify, but the hint from his post was + * ntdll::NtRemoveIoCompletion(). So I'd assume the SleepEx (or maybe + * just Sleep(0) would be enough?) would release whatever + * mutex/critical-section the ntdll call is waiting on. + * + * Someone got to verify this on Win-NT 4.0, 2000." + */ + +#ifdef _WIN32_WCE + Sleep(0); +#else + SleepEx(0, FALSE); +#endif + +#endif + + if(0 != getsockopt(sockfd, SOL_SOCKET, SO_ERROR, (void *)&err, &errSize)) + err = SOCKERRNO; +#ifdef _WIN32_WCE + /* Old WinCE versions don't support SO_ERROR */ + if(WSAENOPROTOOPT == err) { + SET_SOCKERRNO(0); + err = 0; + } +#endif +#ifdef __minix + /* Minix 3.1.x doesn't support getsockopt on UDP sockets */ + if(EBADIOCTL == err) { + SET_SOCKERRNO(0); + err = 0; + } +#endif + if((0 == err) || (EISCONN == err)) + /* we are connected, awesome! */ + rc = TRUE; + else + /* This wasn't a successful connect */ + rc = FALSE; + if(error) + *error = err; +#else + (void)sockfd; + if(error) + *error = SOCKERRNO; +#endif + return rc; +} + +/* Used within the multi interface. Try next IP address, return TRUE if no + more address exists or error */ +static CURLcode trynextip(struct connectdata *conn, + int sockindex, + bool *connected) +{ + curl_socket_t sockfd; + Curl_addrinfo *ai; + + /* First clean up after the failed socket. + Don't close it yet to ensure that the next IP's socket gets a different + file descriptor, which can prevent bugs when the curl_multi_socket_action + interface is used with certain select() replacements such as kqueue. */ + curl_socket_t fd_to_close = conn->sock[sockindex]; + conn->sock[sockindex] = CURL_SOCKET_BAD; + *connected = FALSE; + + if(sockindex != FIRSTSOCKET) { + sclose(fd_to_close); + return CURLE_COULDNT_CONNECT; /* no next */ + } + + /* try the next address */ + ai = conn->ip_addr->ai_next; + + while(ai) { + CURLcode res = singleipconnect(conn, ai, 0L, &sockfd, connected); + if(res) + return res; + if(sockfd != CURL_SOCKET_BAD) { + /* store the new socket descriptor */ + conn->sock[sockindex] = sockfd; + conn->ip_addr = ai; + sclose(fd_to_close); + return CURLE_OK; + } + ai = ai->ai_next; + } + sclose(fd_to_close); + return CURLE_COULDNT_CONNECT; +} + +/* Copies connection info into the session handle to make it available + when the session handle is no longer associated with a connection. */ +void Curl_persistconninfo(struct connectdata *conn) +{ + memcpy(conn->data->info.conn_primary_ip, conn->primary_ip, MAX_IPADR_LEN); + memcpy(conn->data->info.conn_local_ip, conn->local_ip, MAX_IPADR_LEN); + conn->data->info.conn_primary_port = conn->primary_port; + conn->data->info.conn_local_port = conn->local_port; +} + +/* retrieves ip address and port from a sockaddr structure */ +static bool getaddressinfo(struct sockaddr* sa, char* addr, + long* port) +{ + unsigned short us_port; + struct sockaddr_in* si = NULL; +#ifdef ENABLE_IPV6 + struct sockaddr_in6* si6 = NULL; +#endif +#if defined(HAVE_SYS_UN_H) && defined(AF_UNIX) + struct sockaddr_un* su = NULL; +#endif + + switch (sa->sa_family) { + case AF_INET: + si = (struct sockaddr_in*) sa; + if(Curl_inet_ntop(sa->sa_family, &si->sin_addr, + addr, MAX_IPADR_LEN)) { + us_port = ntohs(si->sin_port); + *port = us_port; + return TRUE; + } + break; +#ifdef ENABLE_IPV6 + case AF_INET6: + si6 = (struct sockaddr_in6*)sa; + if(Curl_inet_ntop(sa->sa_family, &si6->sin6_addr, + addr, MAX_IPADR_LEN)) { + us_port = ntohs(si6->sin6_port); + *port = us_port; + return TRUE; + } + break; +#endif +#if defined(HAVE_SYS_UN_H) && defined(AF_UNIX) + case AF_UNIX: + su = (struct sockaddr_un*)sa; + snprintf(addr, MAX_IPADR_LEN, "%s", su->sun_path); + *port = 0; + return TRUE; +#endif + default: + break; + } + + addr[0] = '\0'; + *port = 0; + + return FALSE; +} + +/* retrieves the start/end point information of a socket of an established + connection */ +void Curl_updateconninfo(struct connectdata *conn, curl_socket_t sockfd) +{ + int error; + curl_socklen_t len; + struct Curl_sockaddr_storage ssrem; + struct Curl_sockaddr_storage ssloc; + struct SessionHandle *data = conn->data; + + if(!conn->bits.reuse) { + + len = sizeof(struct Curl_sockaddr_storage); + if(getpeername(sockfd, (struct sockaddr*) &ssrem, &len)) { + error = SOCKERRNO; + failf(data, "getpeername() failed with errno %d: %s", + error, Curl_strerror(conn, error)); + return; + } + + len = sizeof(struct Curl_sockaddr_storage); + if(getsockname(sockfd, (struct sockaddr*) &ssloc, &len)) { + error = SOCKERRNO; + failf(data, "getsockname() failed with errno %d: %s", + error, Curl_strerror(conn, error)); + return; + } + + if(!getaddressinfo((struct sockaddr*)&ssrem, + conn->primary_ip, &conn->primary_port)) { + error = ERRNO; + failf(data, "ssrem inet_ntop() failed with errno %d: %s", + error, Curl_strerror(conn, error)); + return; + } + + if(!getaddressinfo((struct sockaddr*)&ssloc, + conn->local_ip, &conn->local_port)) { + error = ERRNO; + failf(data, "ssloc inet_ntop() failed with errno %d: %s", + error, Curl_strerror(conn, error)); + return; + } + + } + + /* persist connection info in session handle */ + Curl_persistconninfo(conn); +} + +/* + * Curl_is_connected() is used from the multi interface to check if the + * firstsocket has connected. + */ + +CURLcode Curl_is_connected(struct connectdata *conn, + int sockindex, + bool *connected) +{ + int rc; + struct SessionHandle *data = conn->data; + CURLcode code = CURLE_OK; + curl_socket_t sockfd = conn->sock[sockindex]; + long allow = DEFAULT_CONNECT_TIMEOUT; + int error = 0; + + DEBUGASSERT(sockindex >= FIRSTSOCKET && sockindex <= SECONDARYSOCKET); + + *connected = FALSE; /* a very negative world view is best */ + + if(conn->bits.tcpconnect) { + /* we are connected already! */ + *connected = TRUE; + return CURLE_OK; + } + + /* figure out how long time we have left to connect */ + allow = Curl_timeleft(conn, NULL, TRUE); + + if(allow < 0) { + /* time-out, bail out, go home */ + failf(data, "Connection time-out"); + return CURLE_OPERATION_TIMEDOUT; + } + + /* check for connect without timeout as we want to return immediately */ + rc = waitconnect(conn, sockfd, 0); + if(WAITCONN_TIMEOUT == rc) + /* not an error, but also no connection yet */ + return code; + + if(WAITCONN_CONNECTED == rc) { + if(verifyconnect(sockfd, &error)) { + /* we are connected, awesome! */ + conn->bits.tcpconnect = TRUE; + *connected = TRUE; + Curl_pgrsTime(data, TIMER_CONNECT); /* connect done */ + Curl_verboseconnect(conn); + Curl_updateconninfo(conn, sockfd); + + return CURLE_OK; + } + /* nope, not connected for real */ + } + else { + /* nope, not connected */ + if(WAITCONN_FDSET_ERROR == rc) { + (void)verifyconnect(sockfd, &error); + infof(data, "%s\n",Curl_strerror(conn, error)); + } + else + infof(data, "Connection failed\n"); + } + + /* + * The connection failed here, we should attempt to connect to the "next + * address" for the given host. But first remember the latest error. + */ + if(error) { + data->state.os_errno = error; + SET_SOCKERRNO(error); + } + + code = trynextip(conn, sockindex, connected); + + if(code) { + error = SOCKERRNO; + data->state.os_errno = error; + failf(data, "Failed connect to %s:%ld; %s", + conn->host.name, conn->port, Curl_strerror(conn, error)); + } + + return code; +} + +static void tcpnodelay(struct connectdata *conn, + curl_socket_t sockfd) +{ +#ifdef TCP_NODELAY + struct SessionHandle *data= conn->data; + curl_socklen_t onoff = (curl_socklen_t) data->set.tcp_nodelay; + int proto = IPPROTO_TCP; + +#if 0 + /* The use of getprotobyname() is disabled since it isn't thread-safe on + numerous systems. On these getprotobyname_r() should be used instead, but + that exists in at least one 4 arg version and one 5 arg version, and + since the proto number rarely changes anyway we now just use the hard + coded number. The "proper" fix would need a configure check for the + correct function much in the same style the gethostbyname_r versions are + detected. */ + struct protoent *pe = getprotobyname("tcp"); + if(pe) + proto = pe->p_proto; +#endif + + if(setsockopt(sockfd, proto, TCP_NODELAY, (void *)&onoff, + sizeof(onoff)) < 0) + infof(data, "Could not set TCP_NODELAY: %s\n", + Curl_strerror(conn, SOCKERRNO)); + else + infof(data,"TCP_NODELAY set\n"); +#else + (void)conn; + (void)sockfd; +#endif +} + +#ifdef SO_NOSIGPIPE +/* The preferred method on Mac OS X (10.2 and later) to prevent SIGPIPEs when + sending data to a dead peer (instead of relying on the 4th argument to send + being MSG_NOSIGNAL). Possibly also existing and in use on other BSD + systems? */ +static void nosigpipe(struct connectdata *conn, + curl_socket_t sockfd) +{ + struct SessionHandle *data= conn->data; + int onoff = 1; + if(setsockopt(sockfd, SOL_SOCKET, SO_NOSIGPIPE, (void *)&onoff, + sizeof(onoff)) < 0) + infof(data, "Could not set SO_NOSIGPIPE: %s\n", + Curl_strerror(conn, SOCKERRNO)); +} +#else +#define nosigpipe(x,y) +#endif + +#ifdef WIN32 +/* When you run a program that uses the Windows Sockets API, you may + experience slow performance when you copy data to a TCP server. + + http://support.microsoft.com/kb/823764 + + Work-around: Make the Socket Send Buffer Size Larger Than the Program Send + Buffer Size + +*/ +void Curl_sndbufset(curl_socket_t sockfd) +{ + int val = CURL_MAX_WRITE_SIZE + 32; + int curval = 0; + int curlen = sizeof(curval); + + if (getsockopt(sockfd, SOL_SOCKET, SO_SNDBUF, (char *)&curval, &curlen) == 0) + if (curval > val) + return; + + setsockopt(sockfd, SOL_SOCKET, SO_SNDBUF, (const char *)&val, sizeof(val)); +} +#endif + + +/* + * singleipconnect() + * + * Note that even on connect fail it returns CURLE_OK, but with 'sock' set to + * CURL_SOCKET_BAD. Other errors will however return proper errors. + * + * singleipconnect() connects to the given IP only, and it may return without + * having connected if used from the multi interface. + */ +static CURLcode +singleipconnect(struct connectdata *conn, + const Curl_addrinfo *ai, + long timeout_ms, + curl_socket_t *sockp, + bool *connected) +{ + struct Curl_sockaddr_ex addr; + int rc; + int error; + bool isconnected; + struct SessionHandle *data = conn->data; + curl_socket_t sockfd; + CURLcode res = CURLE_OK; +#if defined(ENABLE_IPV6) && defined(HAVE_SOCKADDR_IN6_SIN6_SCOPE_ID) + struct sockaddr_in6 * const sa6 = (void *)&addr.sa_addr; +#endif + + *sockp = CURL_SOCKET_BAD; + + /* + * The Curl_sockaddr_ex structure is basically libcurl's external API + * curl_sockaddr structure with enough space available to directly hold + * any protocol-specific address structures. The variable declared here + * will be used to pass / receive data to/from the fopensocket callback + * if this has been set, before that, it is initialized from parameters. + */ + + addr.family = ai->ai_family; + addr.socktype = conn->socktype; + addr.protocol = ai->ai_protocol; + addr.addrlen = ai->ai_addrlen; + + if(addr.addrlen > sizeof(struct Curl_sockaddr_storage)) + addr.addrlen = sizeof(struct Curl_sockaddr_storage); + memcpy(&addr.sa_addr, ai->ai_addr, addr.addrlen); + + *connected = FALSE; /* default is not connected */ + + if(data->set.fopensocket) + /* + * If the opensocket callback is set, all the destination address + * information is passed to the callback. Depending on this information the + * callback may opt to abort the connection, this is indicated returning + * CURL_SOCKET_BAD; otherwise it will return a not-connected socket. When + * the callback returns a valid socket the destination address information + * might have been changed and this 'new' address will actually be used + * here to connect. + */ + sockfd = data->set.fopensocket(data->set.opensocket_client, + CURLSOCKTYPE_IPCXN, + (struct curl_sockaddr *)&addr); + else + /* opensocket callback not set, so simply create the socket now */ + sockfd = socket(addr.family, addr.socktype, addr.protocol); + + if(sockfd == CURL_SOCKET_BAD) + /* no socket, no connection */ + return CURLE_OK; + +#if defined(ENABLE_IPV6) && defined(HAVE_SOCKADDR_IN6_SIN6_SCOPE_ID) + if (conn->scope && (addr.family == AF_INET6)) + sa6->sin6_scope_id = conn->scope; +#endif + + /* store remote address and port used in this connection attempt */ + if(!getaddressinfo((struct sockaddr*)&addr.sa_addr, + conn->primary_ip, &conn->primary_port)) { + /* malformed address or bug in inet_ntop, try next address */ + error = ERRNO; + failf(data, "sa_addr inet_ntop() failed with errno %d: %s", + error, Curl_strerror(conn, error)); + sclose(sockfd); + return CURLE_OK; + } + memcpy(conn->ip_addr_str, conn->primary_ip, MAX_IPADR_LEN); + infof(data, " Trying %s... ", conn->ip_addr_str); + + Curl_persistconninfo(conn); + +#ifdef ENABLE_IPV6 + if(addr.family == AF_INET6) + conn->bits.ipv6 = TRUE; +#endif + + if(data->set.tcp_nodelay) + tcpnodelay(conn, sockfd); + + nosigpipe(conn, sockfd); + + Curl_sndbufset(sockfd); + + if(data->set.fsockopt) { + /* activate callback for setting socket options */ + error = data->set.fsockopt(data->set.sockopt_client, + sockfd, + CURLSOCKTYPE_IPCXN); + if(error) { + sclose(sockfd); /* close the socket and bail out */ + return res; + } + } + + /* possibly bind the local end to an IP, interface or port */ + res = bindlocal(conn, sockfd, addr.family); + if(res) { + sclose(sockfd); /* close socket and bail out */ + return res; + } + + /* set socket non-blocking */ + curlx_nonblock(sockfd, TRUE); + + /* Connect TCP sockets, bind UDP */ + if(conn->socktype == SOCK_STREAM) + rc = connect(sockfd, &addr.sa_addr, addr.addrlen); + else + rc = 0; + + if(-1 == rc) { + error = SOCKERRNO; + + switch (error) { + case EINPROGRESS: + case EWOULDBLOCK: +#if defined(EAGAIN) +#if (EAGAIN) != (EWOULDBLOCK) + /* On some platforms EAGAIN and EWOULDBLOCK are the + * same value, and on others they are different, hence + * the odd #if + */ + case EAGAIN: +#endif +#endif + rc = waitconnect(conn, sockfd, timeout_ms); + if(WAITCONN_ABORTED == rc) { + sclose(sockfd); + return CURLE_ABORTED_BY_CALLBACK; + } + break; + default: + /* unknown error, fallthrough and try another address! */ + failf(data, "Failed to connect to %s: %s", + conn->ip_addr_str, Curl_strerror(conn,error)); + data->state.os_errno = error; + break; + } + } + + /* The 'WAITCONN_TIMEOUT == rc' comes from the waitconnect(), and not from + connect(). We can be sure of this since connect() cannot return 1. */ + if((WAITCONN_TIMEOUT == rc) && + (data->state.used_interface == Curl_if_multi)) { + /* Timeout when running the multi interface */ + *sockp = sockfd; + return CURLE_OK; + } + + isconnected = verifyconnect(sockfd, &error); + + if(!rc && isconnected) { + /* we are connected, awesome! */ + *connected = TRUE; /* this is a true connect */ + infof(data, "connected\n"); + Curl_updateconninfo(conn, sockfd); + *sockp = sockfd; + return CURLE_OK; + } + else if(WAITCONN_TIMEOUT == rc) + infof(data, "Timeout\n"); + else { + data->state.os_errno = error; + infof(data, "%s\n", Curl_strerror(conn, error)); + } + + /* connect failed or timed out */ + sclose(sockfd); + + return CURLE_OK; +} + +/* + * TCP connect to the given host with timeout, proxy or remote doesn't matter. + * There might be more than one IP address to try out. Fill in the passed + * pointer with the connected socket. + */ + +CURLcode Curl_connecthost(struct connectdata *conn, /* context */ + const struct Curl_dns_entry *remotehost, + curl_socket_t *sockconn, /* the connected socket */ + Curl_addrinfo **addr, /* the one we used */ + bool *connected) /* really connected? */ +{ + struct SessionHandle *data = conn->data; + curl_socket_t sockfd = CURL_SOCKET_BAD; + int aliasindex; + int num_addr; + Curl_addrinfo *ai; + Curl_addrinfo *curr_addr; + + struct timeval after; + struct timeval before = Curl_tvnow(); + + /************************************************************* + * Figure out what maximum time we have left + *************************************************************/ + long timeout_ms; + long timeout_per_addr; + + DEBUGASSERT(sockconn); + *connected = FALSE; /* default to not connected */ + + /* get the timeout left */ + timeout_ms = Curl_timeleft(conn, &before, TRUE); + + if(timeout_ms < 0) { + /* a precaution, no need to continue if time already is up */ + failf(data, "Connection time-out"); + return CURLE_OPERATION_TIMEDOUT; + } + + /* Max time for each address */ + num_addr = Curl_num_addresses(remotehost->addr); + timeout_per_addr = timeout_ms / num_addr; + + ai = remotehost->addr; + + /* Below is the loop that attempts to connect to all IP-addresses we + * know for the given host. One by one until one IP succeeds. + */ + + if(data->state.used_interface == Curl_if_multi) + /* don't hang when doing multi */ + timeout_per_addr = 0; + + /* + * Connecting with a Curl_addrinfo chain + */ + for (curr_addr = ai, aliasindex=0; curr_addr; + curr_addr = curr_addr->ai_next, aliasindex++) { + + /* start connecting to the IP curr_addr points to */ + CURLcode res = + singleipconnect(conn, curr_addr, timeout_per_addr, &sockfd, connected); + + if(res) + return res; + + if(sockfd != CURL_SOCKET_BAD) + break; + + /* get a new timeout for next attempt */ + after = Curl_tvnow(); + timeout_ms -= Curl_tvdiff(after, before); + if(timeout_ms < 0) { + failf(data, "connect() timed out!"); + return CURLE_OPERATION_TIMEDOUT; + } + before = after; + } /* end of connect-to-each-address loop */ + + *sockconn = sockfd; /* the socket descriptor we've connected */ + + if(sockfd == CURL_SOCKET_BAD) { + /* no good connect was made */ + failf(data, "couldn't connect to host"); + return CURLE_COULDNT_CONNECT; + } + + /* leave the socket in non-blocking mode */ + + /* store the address we use */ + if(addr) + *addr = curr_addr; + + data->info.numconnects++; /* to track the number of connections made */ + + return CURLE_OK; +} + +/* + * Used to extract socket and connectdata struct for the most recent + * transfer on the given SessionHandle. + * + * The returned socket will be CURL_SOCKET_BAD in case of failure! + */ +curl_socket_t Curl_getconnectinfo(struct SessionHandle *data, + struct connectdata **connp) +{ + curl_socket_t sockfd; + if((data->state.lastconnect != -1) && + (data->state.connc->connects[data->state.lastconnect] != NULL)) { + struct connectdata *c = + data->state.connc->connects[data->state.lastconnect]; + if(connp) + /* only store this if the caller cares for it */ + *connp = c; + sockfd = c->sock[FIRSTSOCKET]; + /* we have a socket connected, let's determine if the server shut down */ + /* determine if ssl */ + if(c->ssl[FIRSTSOCKET].use) { + /* use the SSL context */ + if(!Curl_ssl_check_cxn(c)) + return CURL_SOCKET_BAD; /* FIN received */ + } +/* Minix 3.1 doesn't support any flags on recv; just assume socket is OK */ +#ifdef MSG_PEEK + else { + /* use the socket */ + char buf; + if(recv((RECV_TYPE_ARG1)c->sock[FIRSTSOCKET], (RECV_TYPE_ARG2)&buf, + (RECV_TYPE_ARG3)1, (RECV_TYPE_ARG4)MSG_PEEK) == 0) { + return CURL_SOCKET_BAD; /* FIN received */ + } + } +#endif + } + else + return CURL_SOCKET_BAD; + + return sockfd; +} diff --git a/mobicore/common/curl/lib/connect.h b/mobicore/common/curl/lib/connect.h new file mode 100644 index 0000000000000000000000000000000000000000..6cc403d9f0dc8c24548af4e5179e586b5cdaf016 --- /dev/null +++ b/mobicore/common/curl/lib/connect.h @@ -0,0 +1,74 @@ +#ifndef __CONNECT_H +#define __CONNECT_H +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) 1998 - 2010, Daniel Stenberg, , et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at http://curl.haxx.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ***************************************************************************/ + +#include "nonblock.h" /* for curlx_nonblock(), formerly Curl_nonblock() */ + +CURLcode Curl_is_connected(struct connectdata *conn, + int sockindex, + bool *connected); + +CURLcode Curl_connecthost(struct connectdata *conn, + const struct Curl_dns_entry *host, /* connect to + this */ + curl_socket_t *sockconn, /* not set if error */ + Curl_addrinfo **addr, /* the one we used */ + bool *connected); /* truly connected? */ + +/* generic function that returns how much time there's left to run, according + to the timeouts set */ +long Curl_timeleft(struct connectdata *conn, + struct timeval *nowp, + bool duringconnect); + +#define DEFAULT_CONNECT_TIMEOUT 300000 /* milliseconds == five minutes */ + +/* + * Used to extract socket and connectdata struct for the most recent + * transfer on the given SessionHandle. + * + * The returned socket will be CURL_SOCKET_BAD in case of failure! + */ +curl_socket_t Curl_getconnectinfo(struct SessionHandle *data, + struct connectdata **connp); + +#ifdef WIN32 +/* When you run a program that uses the Windows Sockets API, you may + experience slow performance when you copy data to a TCP server. + + http://support.microsoft.com/kb/823764 + + Work-around: Make the Socket Send Buffer Size Larger Than the Program Send + Buffer Size + +*/ +void Curl_sndbufset(curl_socket_t sockfd); +#else +#define Curl_sndbufset(y) +#endif + +void Curl_updateconninfo(struct connectdata *conn, curl_socket_t sockfd); + +void Curl_persistconninfo(struct connectdata *conn); + +#endif diff --git a/mobicore/common/curl/lib/content_encoding.c b/mobicore/common/curl/lib/content_encoding.c new file mode 100644 index 0000000000000000000000000000000000000000..6fb7c8d3a89518668b77e15013c8264e6767d88b --- /dev/null +++ b/mobicore/common/curl/lib/content_encoding.c @@ -0,0 +1,426 @@ +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) 1998 - 2010, Daniel Stenberg, , et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at http://curl.haxx.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ***************************************************************************/ + +#include "setup.h" + +#ifdef HAVE_LIBZ + +#include +#include + +#include "urldata.h" +#include +#include "sendf.h" +#include "content_encoding.h" +#include "curl_memory.h" + +#include "memdebug.h" + +/* Comment this out if zlib is always going to be at least ver. 1.2.0.4 + (doing so will reduce code size slightly). */ +#define OLD_ZLIB_SUPPORT 1 + +#define DSIZ CURL_MAX_WRITE_SIZE /* buffer size for decompressed data */ + +#define GZIP_MAGIC_0 0x1f +#define GZIP_MAGIC_1 0x8b + +/* gzip flag byte */ +#define ASCII_FLAG 0x01 /* bit 0 set: file probably ascii text */ +#define HEAD_CRC 0x02 /* bit 1 set: header CRC present */ +#define EXTRA_FIELD 0x04 /* bit 2 set: extra field present */ +#define ORIG_NAME 0x08 /* bit 3 set: original file name present */ +#define COMMENT 0x10 /* bit 4 set: file comment present */ +#define RESERVED 0xE0 /* bits 5..7: reserved */ + +static CURLcode +process_zlib_error(struct connectdata *conn, z_stream *z) +{ + struct SessionHandle *data = conn->data; + if(z->msg) + failf (data, "Error while processing content unencoding: %s", + z->msg); + else + failf (data, "Error while processing content unencoding: " + "Unknown failure within decompression software."); + + return CURLE_BAD_CONTENT_ENCODING; +} + +static CURLcode +exit_zlib(z_stream *z, zlibInitState *zlib_init, CURLcode result) +{ + inflateEnd(z); + *zlib_init = ZLIB_UNINIT; + return result; +} + +static CURLcode +inflate_stream(struct connectdata *conn, + struct SingleRequest *k) +{ + int allow_restart = 1; + z_stream *z = &k->z; /* zlib state structure */ + uInt nread = z->avail_in; + Bytef *orig_in = z->next_in; + int status; /* zlib status */ + CURLcode result = CURLE_OK; /* Curl_client_write status */ + char *decomp; /* Put the decompressed data here. */ + + /* Dynamically allocate a buffer for decompression because it's uncommonly + large to hold on the stack */ + decomp = malloc(DSIZ); + if(decomp == NULL) { + return exit_zlib(z, &k->zlib_init, CURLE_OUT_OF_MEMORY); + } + + /* because the buffer size is fixed, iteratively decompress and transfer to + the client via client_write. */ + for (;;) { + /* (re)set buffer for decompressed output for every iteration */ + z->next_out = (Bytef *)decomp; + z->avail_out = DSIZ; + + status = inflate(z, Z_SYNC_FLUSH); + if(status == Z_OK || status == Z_STREAM_END) { + allow_restart = 0; + if((DSIZ - z->avail_out) && (!k->ignorebody)) { + result = Curl_client_write(conn, CLIENTWRITE_BODY, decomp, + DSIZ - z->avail_out); + /* if !CURLE_OK, clean up, return */ + if(result) { + free(decomp); + return exit_zlib(z, &k->zlib_init, result); + } + } + + /* Done? clean up, return */ + if(status == Z_STREAM_END) { + free(decomp); + if(inflateEnd(z) == Z_OK) + return exit_zlib(z, &k->zlib_init, result); + else + return exit_zlib(z, &k->zlib_init, process_zlib_error(conn, z)); + } + + /* Done with these bytes, exit */ + + /* status is always Z_OK at this point! */ + if(z->avail_in == 0) { + free(decomp); + return result; + } + } + else if(allow_restart && status == Z_DATA_ERROR) { + /* some servers seem to not generate zlib headers, so this is an attempt + to fix and continue anyway */ + + (void) inflateEnd(z); /* don't care about the return code */ + if(inflateInit2(z, -MAX_WBITS) != Z_OK) { + free(decomp); + return exit_zlib(z, &k->zlib_init, process_zlib_error(conn, z)); + } + z->next_in = orig_in; + z->avail_in = nread; + allow_restart = 0; + continue; + } + else { /* Error; exit loop, handle below */ + free(decomp); + return exit_zlib(z, &k->zlib_init, process_zlib_error(conn, z)); + } + } + /* Will never get here */ +} + +CURLcode +Curl_unencode_deflate_write(struct connectdata *conn, + struct SingleRequest *k, + ssize_t nread) +{ + z_stream *z = &k->z; /* zlib state structure */ + + /* Initialize zlib? */ + if(k->zlib_init == ZLIB_UNINIT) { + z->zalloc = (alloc_func)Z_NULL; + z->zfree = (free_func)Z_NULL; + z->opaque = 0; + z->next_in = NULL; + z->avail_in = 0; + if(inflateInit(z) != Z_OK) + return process_zlib_error(conn, z); + k->zlib_init = ZLIB_INIT; + } + + /* Set the compressed input when this function is called */ + z->next_in = (Bytef *)k->str; + z->avail_in = (uInt)nread; + + /* Now uncompress the data */ + return inflate_stream(conn, k); +} + +#ifdef OLD_ZLIB_SUPPORT +/* Skip over the gzip header */ +static enum { + GZIP_OK, + GZIP_BAD, + GZIP_UNDERFLOW +} check_gzip_header(unsigned char const *data, ssize_t len, ssize_t *headerlen) +{ + int method, flags; + const ssize_t totallen = len; + + /* The shortest header is 10 bytes */ + if(len < 10) + return GZIP_UNDERFLOW; + + if((data[0] != GZIP_MAGIC_0) || (data[1] != GZIP_MAGIC_1)) + return GZIP_BAD; + + method = data[2]; + flags = data[3]; + + if(method != Z_DEFLATED || (flags & RESERVED) != 0) { + /* Can't handle this compression method or unknown flag */ + return GZIP_BAD; + } + + /* Skip over time, xflags, OS code and all previous bytes */ + len -= 10; + data += 10; + + if(flags & EXTRA_FIELD) { + ssize_t extra_len; + + if(len < 2) + return GZIP_UNDERFLOW; + + extra_len = (data[1] << 8) | data[0]; + + if(len < (extra_len+2)) + return GZIP_UNDERFLOW; + + len -= (extra_len + 2); + data += (extra_len + 2); + } + + if(flags & ORIG_NAME) { + /* Skip over NUL-terminated file name */ + while(len && *data) { + --len; + ++data; + } + if(!len || *data) + return GZIP_UNDERFLOW; + + /* Skip over the NUL */ + --len; + ++data; + } + + if(flags & COMMENT) { + /* Skip over NUL-terminated comment */ + while(len && *data) { + --len; + ++data; + } + if(!len || *data) + return GZIP_UNDERFLOW; + + /* Skip over the NUL */ + --len; + } + + if(flags & HEAD_CRC) { + if(len < 2) + return GZIP_UNDERFLOW; + + len -= 2; + } + + *headerlen = totallen - len; + return GZIP_OK; +} +#endif + +CURLcode +Curl_unencode_gzip_write(struct connectdata *conn, + struct SingleRequest *k, + ssize_t nread) +{ + z_stream *z = &k->z; /* zlib state structure */ + + /* Initialize zlib? */ + if(k->zlib_init == ZLIB_UNINIT) { + z->zalloc = (alloc_func)Z_NULL; + z->zfree = (free_func)Z_NULL; + z->opaque = 0; + z->next_in = NULL; + z->avail_in = 0; + + if(strcmp(zlibVersion(), "1.2.0.4") >= 0) { + /* zlib ver. >= 1.2.0.4 supports transparent gzip decompressing */ + if(inflateInit2(z, MAX_WBITS+32) != Z_OK) { + return process_zlib_error(conn, z); + } + k->zlib_init = ZLIB_INIT_GZIP; /* Transparent gzip decompress state */ + } + else { + /* we must parse the gzip header ourselves */ + if(inflateInit2(z, -MAX_WBITS) != Z_OK) { + return process_zlib_error(conn, z); + } + k->zlib_init = ZLIB_INIT; /* Initial call state */ + } + } + + if(k->zlib_init == ZLIB_INIT_GZIP) { + /* Let zlib handle the gzip decompression entirely */ + z->next_in = (Bytef *)k->str; + z->avail_in = (uInt)nread; + /* Now uncompress the data */ + return inflate_stream(conn, k); + } + +#ifndef OLD_ZLIB_SUPPORT + /* Support for old zlib versions is compiled away and we are running with + an old version, so return an error. */ + return exit_zlib(z, &k->zlib_init, CURLE_FUNCTION_NOT_FOUND); + +#else + /* This next mess is to get around the potential case where there isn't + * enough data passed in to skip over the gzip header. If that happens, we + * malloc a block and copy what we have then wait for the next call. If + * there still isn't enough (this is definitely a worst-case scenario), we + * make the block bigger, copy the next part in and keep waiting. + * + * This is only required with zlib versions < 1.2.0.4 as newer versions + * can handle the gzip header themselves. + */ + + switch (k->zlib_init) { + /* Skip over gzip header? */ + case ZLIB_INIT: + { + /* Initial call state */ + ssize_t hlen; + + switch (check_gzip_header((unsigned char *)k->str, nread, &hlen)) { + case GZIP_OK: + z->next_in = (Bytef *)k->str + hlen; + z->avail_in = (uInt)(nread - hlen); + k->zlib_init = ZLIB_GZIP_INFLATING; /* Inflating stream state */ + break; + + case GZIP_UNDERFLOW: + /* We need more data so we can find the end of the gzip header. It's + * possible that the memory block we malloc here will never be freed if + * the transfer abruptly aborts after this point. Since it's unlikely + * that circumstances will be right for this code path to be followed in + * the first place, and it's even more unlikely for a transfer to fail + * immediately afterwards, it should seldom be a problem. + */ + z->avail_in = (uInt)nread; + z->next_in = malloc(z->avail_in); + if(z->next_in == NULL) { + return exit_zlib(z, &k->zlib_init, CURLE_OUT_OF_MEMORY); + } + memcpy(z->next_in, k->str, z->avail_in); + k->zlib_init = ZLIB_GZIP_HEADER; /* Need more gzip header data state */ + /* We don't have any data to inflate yet */ + return CURLE_OK; + + case GZIP_BAD: + default: + return exit_zlib(z, &k->zlib_init, process_zlib_error(conn, z)); + } + + } + break; + + case ZLIB_GZIP_HEADER: + { + /* Need more gzip header data state */ + ssize_t hlen; + unsigned char *oldblock = z->next_in; + + z->avail_in += (uInt)nread; + z->next_in = realloc(z->next_in, z->avail_in); + if(z->next_in == NULL) { + free(oldblock); + return exit_zlib(z, &k->zlib_init, CURLE_OUT_OF_MEMORY); + } + /* Append the new block of data to the previous one */ + memcpy(z->next_in + z->avail_in - nread, k->str, nread); + + switch (check_gzip_header(z->next_in, z->avail_in, &hlen)) { + case GZIP_OK: + /* This is the zlib stream data */ + free(z->next_in); + /* Don't point into the malloced block since we just freed it */ + z->next_in = (Bytef *)k->str + hlen + nread - z->avail_in; + z->avail_in = (uInt)(z->avail_in - hlen); + k->zlib_init = ZLIB_GZIP_INFLATING; /* Inflating stream state */ + break; + + case GZIP_UNDERFLOW: + /* We still don't have any data to inflate! */ + return CURLE_OK; + + case GZIP_BAD: + default: + free(z->next_in); + return exit_zlib(z, &k->zlib_init, process_zlib_error(conn, z)); + } + + } + break; + + case ZLIB_GZIP_INFLATING: + default: + /* Inflating stream state */ + z->next_in = (Bytef *)k->str; + z->avail_in = (uInt)nread; + break; + } + + if(z->avail_in == 0) { + /* We don't have any data to inflate; wait until next time */ + return CURLE_OK; + } + + /* We've parsed the header, now uncompress the data */ + return inflate_stream(conn, k); +#endif +} + +void Curl_unencode_cleanup(struct connectdata *conn) +{ + struct SessionHandle *data = conn->data; + struct SingleRequest *k = &data->req; + z_stream *z = &k->z; + if(k->zlib_init != ZLIB_UNINIT) + (void) exit_zlib(z, &k->zlib_init, CURLE_OK); +} + +#endif /* HAVE_LIBZ */ diff --git a/mobicore/common/curl/lib/content_encoding.h b/mobicore/common/curl/lib/content_encoding.h new file mode 100644 index 0000000000000000000000000000000000000000..3aff9d3c0ba882770cb09b331e1985f73021ffc1 --- /dev/null +++ b/mobicore/common/curl/lib/content_encoding.h @@ -0,0 +1,48 @@ +#ifndef __CURL_CONTENT_ENCODING_H +#define __CURL_CONTENT_ENCODING_H +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) 1998 - 2009, Daniel Stenberg, , et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at http://curl.haxx.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ***************************************************************************/ +#include "setup.h" + +/* + * Comma-separated list all supported Content-Encodings ('identity' is implied) + */ +#ifdef HAVE_LIBZ +#define ALL_CONTENT_ENCODINGS "deflate, gzip" +/* force a cleanup */ +void Curl_unencode_cleanup(struct connectdata *conn); +#else +#define ALL_CONTENT_ENCODINGS "identity" +#define Curl_unencode_cleanup(x) +#endif + +CURLcode Curl_unencode_deflate_write(struct connectdata *conn, + struct SingleRequest *req, + ssize_t nread); + +CURLcode +Curl_unencode_gzip_write(struct connectdata *conn, + struct SingleRequest *k, + ssize_t nread); + + +#endif diff --git a/mobicore/common/curl/lib/cookie.c b/mobicore/common/curl/lib/cookie.c new file mode 100644 index 0000000000000000000000000000000000000000..c6460a1003d5db8104c25a7a7dc0831b020e0f62 --- /dev/null +++ b/mobicore/common/curl/lib/cookie.c @@ -0,0 +1,1135 @@ +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) 1998 - 2010, Daniel Stenberg, , et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at http://curl.haxx.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ***************************************************************************/ + +/*** + + +RECEIVING COOKIE INFORMATION +============================ + +struct CookieInfo *cookie_init(char *file); + + Inits a cookie struct to store data in a local file. This is always + called before any cookies are set. + +int cookies_set(struct CookieInfo *cookie, char *cookie_line); + + The 'cookie_line' parameter is a full "Set-cookie:" line as + received from a server. + + The function need to replace previously stored lines that this new + line superceeds. + + It may remove lines that are expired. + + It should return an indication of success/error. + + +SENDING COOKIE INFORMATION +========================== + +struct Cookies *cookie_getlist(struct CookieInfo *cookie, + char *host, char *path, bool secure); + + For a given host and path, return a linked list of cookies that + the client should send to the server if used now. The secure + boolean informs the cookie if a secure connection is achieved or + not. + + It shall only return cookies that haven't expired. + + +Example set of cookies: + + Set-cookie: PRODUCTINFO=webxpress; domain=.fidelity.com; path=/; secure + Set-cookie: PERSONALIZE=none;expires=Monday, 13-Jun-1988 03:04:55 GMT; + domain=.fidelity.com; path=/ftgw; secure + Set-cookie: FidHist=none;expires=Monday, 13-Jun-1988 03:04:55 GMT; + domain=.fidelity.com; path=/; secure + Set-cookie: FidOrder=none;expires=Monday, 13-Jun-1988 03:04:55 GMT; + domain=.fidelity.com; path=/; secure + Set-cookie: DisPend=none;expires=Monday, 13-Jun-1988 03:04:55 GMT; + domain=.fidelity.com; path=/; secure + Set-cookie: FidDis=none;expires=Monday, 13-Jun-1988 03:04:55 GMT; + domain=.fidelity.com; path=/; secure + Set-cookie: + Session_Key@6791a9e0-901a-11d0-a1c8-9b012c88aa77=none;expires=Monday, + 13-Jun-1988 03:04:55 GMT; domain=.fidelity.com; path=/; secure +****/ + + +#include "setup.h" + +#if !defined(CURL_DISABLE_HTTP) && !defined(CURL_DISABLE_COOKIES) + +#include +#include + +#define _MPRINTF_REPLACE /* without this on windows OS we get undefined reference to snprintf */ +#include + +#include "urldata.h" +#include "cookie.h" +#include "strequal.h" +#include "strtok.h" +#include "sendf.h" +#include "curl_memory.h" +#include "share.h" +#include "strtoofft.h" +#include "rawstr.h" +#include "curl_memrchr.h" + +/* The last #include file should be: */ +#include "memdebug.h" + + +static void freecookie(struct Cookie *co) +{ + if(co->expirestr) + free(co->expirestr); + if(co->domain) + free(co->domain); + if(co->path) + free(co->path); + if(co->name) + free(co->name); + if(co->value) + free(co->value); + if(co->maxage) + free(co->maxage); + if(co->version) + free(co->version); + + free(co); +} + +static bool tailmatch(const char *little, const char *bigone) +{ + size_t littlelen = strlen(little); + size_t biglen = strlen(bigone); + + if(littlelen > biglen) + return FALSE; + + return (bool)Curl_raw_equal(little, bigone+biglen-littlelen); +} + +/* + * Load cookies from all given cookie files (CURLOPT_COOKIEFILE). + */ +void Curl_cookie_loadfiles(struct SessionHandle *data) +{ + struct curl_slist *list = data->change.cookielist; + if(list) { + Curl_share_lock(data, CURL_LOCK_DATA_COOKIE, CURL_LOCK_ACCESS_SINGLE); + while(list) { + data->cookies = Curl_cookie_init(data, + list->data, + data->cookies, + data->set.cookiesession); + list = list->next; + } + Curl_share_unlock(data, CURL_LOCK_DATA_COOKIE); + curl_slist_free_all(data->change.cookielist); /* clean up list */ + data->change.cookielist = NULL; /* don't do this again! */ + } +} + +/* + * strstore() makes a strdup() on the 'newstr' and if '*str' is non-NULL + * that will be freed before the allocated string is stored there. + * + * It is meant to easily replace strdup() + */ +static void strstore(char **str, const char *newstr) +{ + if(*str) + free(*str); + *str = strdup(newstr); +} + + +/**************************************************************************** + * + * Curl_cookie_add() + * + * Add a single cookie line to the cookie keeping object. + * + ***************************************************************************/ + +struct Cookie * +Curl_cookie_add(struct SessionHandle *data, + /* The 'data' pointer here may be NULL at times, and thus + must only be used very carefully for things that can deal + with data being NULL. Such as infof() and similar */ + + struct CookieInfo *c, + bool httpheader, /* TRUE if HTTP header-style line */ + char *lineptr, /* first character of the line */ + const char *domain, /* default domain */ + const char *path) /* full path used when this cookie is set, + used to get default path for the cookie + unless set */ +{ + struct Cookie *clist; + char name[MAX_NAME]; + struct Cookie *co; + struct Cookie *lastc=NULL; + time_t now = time(NULL); + bool replace_old = FALSE; + bool badcookie = FALSE; /* cookies are good by default. mmmmm yummy */ + +#ifdef CURL_DISABLE_VERBOSE_STRINGS + (void)data; +#endif + + /* First, alloc and init a new struct for it */ + co = calloc(1, sizeof(struct Cookie)); + if(!co) + return NULL; /* bail out if we're this low on memory */ + + if(httpheader) { + /* This line was read off a HTTP-header */ + const char *ptr; + const char *sep; + const char *semiptr; + char *what; + + what = malloc(MAX_COOKIE_LINE); + if(!what) { + free(co); + return NULL; + } + + semiptr=strchr(lineptr, ';'); /* first, find a semicolon */ + + while(*lineptr && ISBLANK(*lineptr)) + lineptr++; + + ptr = lineptr; + do { + /* we have a = pair or a 'secure' word here */ + sep = strchr(ptr, '='); + if(sep && (!semiptr || (semiptr>sep)) ) { + /* + * There is a = sign and if there was a semicolon too, which make sure + * that the semicolon comes _after_ the equal sign. + */ + + name[0]=what[0]=0; /* init the buffers */ + if(1 <= sscanf(ptr, "%" MAX_NAME_TXT "[^;=]=%" + MAX_COOKIE_LINE_TXT "[^;\r\n]", + name, what)) { + /* this is a = pair. We use strstore() below to properly + deal with received cookie headers that have the same string + property set more than once, and then we use the last one. */ + + const char *whatptr; + + /* Strip off trailing whitespace from the 'what' */ + size_t len=strlen(what); + while(len && ISBLANK(what[len-1])) { + what[len-1]=0; + len--; + } + + /* Skip leading whitespace from the 'what' */ + whatptr=what; + while(*whatptr && ISBLANK(*whatptr)) { + whatptr++; + } + + if(Curl_raw_equal("path", name)) { + strstore(&co->path, whatptr); + if(!co->path) { + badcookie = TRUE; /* out of memory bad */ + break; + } + } + else if(Curl_raw_equal("domain", name)) { + /* note that this name may or may not have a preceeding dot, but + we don't care about that, we treat the names the same anyway */ + + const char *domptr=whatptr; + int dotcount=1; + + /* Count the dots, we need to make sure that there are enough + of them. */ + + if('.' == whatptr[0]) + /* don't count the initial dot, assume it */ + domptr++; + + do { + domptr = strchr(domptr, '.'); + if(domptr) { + domptr++; + dotcount++; + } + } while(domptr); + + /* The original Netscape cookie spec defined that this domain name + MUST have three dots (or two if one of the seven holy TLDs), + but it seems that these kinds of cookies are in use "out there" + so we cannot be that strict. I've therefore lowered the check + to not allow less than two dots. */ + + if(dotcount < 2) { + /* Received and skipped a cookie with a domain using too few + dots. */ + badcookie=TRUE; /* mark this as a bad cookie */ + infof(data, "skipped cookie with illegal dotcount domain: %s\n", + whatptr); + } + else { + /* Now, we make sure that our host is within the given domain, + or the given domain is not valid and thus cannot be set. */ + + if('.' == whatptr[0]) + whatptr++; /* ignore preceeding dot */ + + if(!domain || tailmatch(whatptr, domain)) { + const char *tailptr=whatptr; + if(tailptr[0] == '.') + tailptr++; + strstore(&co->domain, tailptr); /* don't prefix w/dots + internally */ + if(!co->domain) { + badcookie = TRUE; + break; + } + co->tailmatch=TRUE; /* we always do that if the domain name was + given */ + } + else { + /* we did not get a tailmatch and then the attempted set domain + is not a domain to which the current host belongs. Mark as + bad. */ + badcookie=TRUE; + infof(data, "skipped cookie with bad tailmatch domain: %s\n", + whatptr); + } + } + } + else if(Curl_raw_equal("version", name)) { + strstore(&co->version, whatptr); + if(!co->version) { + badcookie = TRUE; + break; + } + } + else if(Curl_raw_equal("max-age", name)) { + /* Defined in RFC2109: + + Optional. The Max-Age attribute defines the lifetime of the + cookie, in seconds. The delta-seconds value is a decimal non- + negative integer. After delta-seconds seconds elapse, the + client should discard the cookie. A value of zero means the + cookie should be discarded immediately. + + */ + strstore(&co->maxage, whatptr); + if(!co->maxage) { + badcookie = TRUE; + break; + } + co->expires = + strtol((*co->maxage=='\"')?&co->maxage[1]:&co->maxage[0],NULL,10) + + (long)now; + } + else if(Curl_raw_equal("expires", name)) { + strstore(&co->expirestr, whatptr); + if(!co->expirestr) { + badcookie = TRUE; + break; + } + /* Note that if the date couldn't get parsed for whatever reason, + the cookie will be treated as a session cookie */ + co->expires = curl_getdate(what, &now); + + /* Session cookies have expires set to 0 so if we get that back + from the date parser let's add a second to make it a + non-session cookie */ + if (co->expires == 0) + co->expires = 1; + else if( co->expires < 0 ) + co->expires = 0; + } + else if(!co->name) { + co->name = strdup(name); + co->value = strdup(whatptr); + if(!co->name || !co->value) { + badcookie = TRUE; + break; + } + } + /* + else this is the second (or more) name we don't know + about! */ + } + else { + /* this is an "illegal" = pair */ + } + } + else { + if(sscanf(ptr, "%" MAX_COOKIE_LINE_TXT "[^;\r\n]", + what)) { + if(Curl_raw_equal("secure", what)) { + co->secure = TRUE; + } + else if (Curl_raw_equal("httponly", what)) { + co->httponly = TRUE; + } + /* else, + unsupported keyword without assign! */ + + } + } + if(!semiptr || !*semiptr) { + /* we already know there are no more cookies */ + semiptr = NULL; + continue; + } + + ptr=semiptr+1; + while(*ptr && ISBLANK(*ptr)) + ptr++; + semiptr=strchr(ptr, ';'); /* now, find the next semicolon */ + + if(!semiptr && *ptr) + /* There are no more semicolons, but there's a final name=value pair + coming up */ + semiptr=strchr(ptr, '\0'); + } while(semiptr); + + if(!badcookie && !co->domain) { + if(domain) { + /* no domain was given in the header line, set the default */ + co->domain=strdup(domain); + if(!co->domain) + badcookie = TRUE; + } + } + + if(!badcookie && !co->path && path) { + /* No path was given in the header line, set the default. + Note that the passed-in path to this function MAY have a '?' and + following part that MUST not be stored as part of the path. */ + char *queryp = strchr(path, '?'); + + /* queryp is where the interesting part of the path ends, so now we + want to the find the last */ + char *endslash; + if(!queryp) + endslash = strrchr(path, '/'); + else + endslash = memrchr(path, '/', (size_t)(queryp - path)); + if(endslash) { + size_t pathlen = (size_t)(endslash-path+1); /* include ending slash */ + co->path=malloc(pathlen+1); /* one extra for the zero byte */ + if(co->path) { + memcpy(co->path, path, pathlen); + co->path[pathlen]=0; /* zero terminate */ + } + else + badcookie = TRUE; + } + } + + free(what); + + if(badcookie || !co->name) { + /* we didn't get a cookie name or a bad one, + this is an illegal line, bail out */ + freecookie(co); + return NULL; + } + + } + else { + /* This line is NOT a HTTP header style line, we do offer support for + reading the odd netscape cookies-file format here */ + char *ptr; + char *firstptr; + char *tok_buf=NULL; + int fields; + + /* IE introduced HTTP-only cookies to prevent XSS attacks. Cookies + marked with httpOnly after the domain name are not accessible + from javascripts, but since curl does not operate at javascript + level, we include them anyway. In Firefox's cookie files, these + lines are preceeded with #HttpOnly_ and then everything is + as usual, so we skip 10 characters of the line.. + */ + if (strncmp(lineptr, "#HttpOnly_", 10) == 0) { + lineptr += 10; + co->httponly = TRUE; + } + + if(lineptr[0]=='#') { + /* don't even try the comments */ + free(co); + return NULL; + } + /* strip off the possible end-of-line characters */ + ptr=strchr(lineptr, '\r'); + if(ptr) + *ptr=0; /* clear it */ + ptr=strchr(lineptr, '\n'); + if(ptr) + *ptr=0; /* clear it */ + + firstptr=strtok_r(lineptr, "\t", &tok_buf); /* tokenize it on the TAB */ + + /* Here's a quick check to eliminate normal HTTP-headers from this */ + if(!firstptr || strchr(firstptr, ':')) { + free(co); + return NULL; + } + + /* Now loop through the fields and init the struct we already have + allocated */ + for(ptr=firstptr, fields=0; ptr && !badcookie; + ptr=strtok_r(NULL, "\t", &tok_buf), fields++) { + switch(fields) { + case 0: + if(ptr[0]=='.') /* skip preceeding dots */ + ptr++; + co->domain = strdup(ptr); + if(!co->domain) + badcookie = TRUE; + break; + case 1: + /* This field got its explanation on the 23rd of May 2001 by + Andrs Garca: + + flag: A TRUE/FALSE value indicating if all machines within a given + domain can access the variable. This value is set automatically by + the browser, depending on the value you set for the domain. + + As far as I can see, it is set to true when the cookie says + .domain.com and to false when the domain is complete www.domain.com + */ + co->tailmatch=(bool)Curl_raw_equal(ptr, "TRUE"); /* store information */ + break; + case 2: + /* It turns out, that sometimes the file format allows the path + field to remain not filled in, we try to detect this and work + around it! Andrs Garca made us aware of this... */ + if(strcmp("TRUE", ptr) && strcmp("FALSE", ptr)) { + /* only if the path doesn't look like a boolean option! */ + co->path = strdup(ptr); + if(!co->path) + badcookie = TRUE; + break; + } + /* this doesn't look like a path, make one up! */ + co->path = strdup("/"); + if(!co->path) + badcookie = TRUE; + fields++; /* add a field and fall down to secure */ + /* FALLTHROUGH */ + case 3: + co->secure = (bool)Curl_raw_equal(ptr, "TRUE"); + break; + case 4: + co->expires = curlx_strtoofft(ptr, NULL, 10); + break; + case 5: + co->name = strdup(ptr); + if(!co->name) + badcookie = TRUE; + break; + case 6: + co->value = strdup(ptr); + if(!co->value) + badcookie = TRUE; + break; + } + } + if(6 == fields) { + /* we got a cookie with blank contents, fix it */ + co->value = strdup(""); + if(!co->value) + badcookie = TRUE; + else + fields++; + } + + if(!badcookie && (7 != fields)) + /* we did not find the sufficient number of fields */ + badcookie = TRUE; + + if(badcookie) { + freecookie(co); + return NULL; + } + + } + + if(!c->running && /* read from a file */ + c->newsession && /* clean session cookies */ + !co->expires) { /* this is a session cookie since it doesn't expire! */ + freecookie(co); + return NULL; + } + + co->livecookie = c->running; + + /* now, we have parsed the incoming line, we must now check if this + superceeds an already existing cookie, which it may if the previous have + the same domain and path as this */ + + clist = c->cookies; + replace_old = FALSE; + while(clist) { + if(Curl_raw_equal(clist->name, co->name)) { + /* the names are identical */ + + if(clist->domain && co->domain) { + if(Curl_raw_equal(clist->domain, co->domain)) + /* The domains are identical */ + replace_old=TRUE; + } + else if(!clist->domain && !co->domain) + replace_old = TRUE; + + if(replace_old) { + /* the domains were identical */ + + if(clist->path && co->path) { + if(Curl_raw_equal(clist->path, co->path)) { + replace_old = TRUE; + } + else + replace_old = FALSE; + } + else if(!clist->path && !co->path) + replace_old = TRUE; + else + replace_old = FALSE; + + } + + if(replace_old && !co->livecookie && clist->livecookie) { + /* Both cookies matched fine, except that the already present + cookie is "live", which means it was set from a header, while + the new one isn't "live" and thus only read from a file. We let + live cookies stay alive */ + + /* Free the newcomer and get out of here! */ + freecookie(co); + return NULL; + } + + if(replace_old) { + co->next = clist->next; /* get the next-pointer first */ + + /* then free all the old pointers */ + free(clist->name); + if(clist->value) + free(clist->value); + if(clist->domain) + free(clist->domain); + if(clist->path) + free(clist->path); + if(clist->expirestr) + free(clist->expirestr); + + if(clist->version) + free(clist->version); + if(clist->maxage) + free(clist->maxage); + + *clist = *co; /* then store all the new data */ + + free(co); /* free the newly alloced memory */ + co = clist; /* point to the previous struct instead */ + + /* We have replaced a cookie, now skip the rest of the list but + make sure the 'lastc' pointer is properly set */ + do { + lastc = clist; + clist = clist->next; + } while(clist); + break; + } + } + lastc = clist; + clist = clist->next; + } + + if(c->running) + /* Only show this when NOT reading the cookies from a file */ + infof(data, "%s cookie %s=\"%s\" for domain %s, path %s, " + "expire %" FORMAT_OFF_T "\n", + replace_old?"Replaced":"Added", co->name, co->value, + co->domain, co->path, co->expires); + + if(!replace_old) { + /* then make the last item point on this new one */ + if(lastc) + lastc->next = co; + else + c->cookies = co; + } + + c->numcookies++; /* one more cookie in the jar */ + return co; +} + +/***************************************************************************** + * + * Curl_cookie_init() + * + * Inits a cookie struct to read data from a local file. This is always + * called before any cookies are set. File may be NULL. + * + * If 'newsession' is TRUE, discard all "session cookies" on read from file. + * + ****************************************************************************/ +struct CookieInfo *Curl_cookie_init(struct SessionHandle *data, + const char *file, + struct CookieInfo *inc, + bool newsession) +{ + struct CookieInfo *c; + FILE *fp; + bool fromfile=TRUE; + + if(NULL == inc) { + /* we didn't get a struct, create one */ + c = calloc(1, sizeof(struct CookieInfo)); + if(!c) + return NULL; /* failed to get memory */ + c->filename = strdup(file?file:"none"); /* copy the name just in case */ + } + else { + /* we got an already existing one, use that */ + c = inc; + } + c->running = FALSE; /* this is not running, this is init */ + + if(file && strequal(file, "-")) { + fp = stdin; + fromfile=FALSE; + } + else if(file && !*file) { + /* points to a "" string */ + fp = NULL; + } + else + fp = file?fopen(file, "r"):NULL; + + c->newsession = newsession; /* new session? */ + + if(fp) { + char *lineptr; + bool headerline; + + char *line = malloc(MAX_COOKIE_LINE); + if(line) { + while(fgets(line, MAX_COOKIE_LINE, fp)) { + if(checkprefix("Set-Cookie:", line)) { + /* This is a cookie line, get it! */ + lineptr=&line[11]; + headerline=TRUE; + } + else { + lineptr=line; + headerline=FALSE; + } + while(*lineptr && ISBLANK(*lineptr)) + lineptr++; + + Curl_cookie_add(data, c, headerline, lineptr, NULL, NULL); + } + free(line); /* free the line buffer */ + } + if(fromfile) + fclose(fp); + } + + c->running = TRUE; /* now, we're running */ + + return c; +} + +/* sort this so that the longest path gets before the shorter path */ +static int cookie_sort(const void *p1, const void *p2) +{ + struct Cookie *c1 = *(struct Cookie **)p1; + struct Cookie *c2 = *(struct Cookie **)p2; + + size_t l1 = c1->path?strlen(c1->path):0; + size_t l2 = c2->path?strlen(c2->path):0; + + return (l2 > l1) ? 1 : (l2 < l1) ? -1 : 0 ; +} + +/***************************************************************************** + * + * Curl_cookie_getlist() + * + * For a given host and path, return a linked list of cookies that the + * client should send to the server if used now. The secure boolean informs + * the cookie if a secure connection is achieved or not. + * + * It shall only return cookies that haven't expired. + * + ****************************************************************************/ + +struct Cookie *Curl_cookie_getlist(struct CookieInfo *c, + const char *host, const char *path, + bool secure) +{ + struct Cookie *newco; + struct Cookie *co; + time_t now = time(NULL); + struct Cookie *mainco=NULL; + size_t matches = 0; + + if(!c || !c->cookies) + return NULL; /* no cookie struct or no cookies in the struct */ + + co = c->cookies; + + while(co) { + /* only process this cookie if it is not expired or had no expire + date AND that if the cookie requires we're secure we must only + continue if we are! */ + if( (!co->expires || (co->expires > now)) && + (co->secure?secure:TRUE) ) { + + /* now check if the domain is correct */ + if(!co->domain || + (co->tailmatch && tailmatch(co->domain, host)) || + (!co->tailmatch && Curl_raw_equal(host, co->domain)) ) { + /* the right part of the host matches the domain stuff in the + cookie data */ + + /* now check the left part of the path with the cookies path + requirement */ + if(!co->path || + /* not using checkprefix() because matching should be + case-sensitive */ + !strncmp(co->path, path, strlen(co->path)) ) { + + /* and now, we know this is a match and we should create an + entry for the return-linked-list */ + + newco = malloc(sizeof(struct Cookie)); + if(newco) { + /* first, copy the whole source cookie: */ + memcpy(newco, co, sizeof(struct Cookie)); + + /* then modify our next */ + newco->next = mainco; + + /* point the main to us */ + mainco = newco; + + matches++; + } + else { + fail: + /* failure, clear up the allocated chain and return NULL */ + while(mainco) { + co = mainco->next; + free(mainco); + mainco = co; + } + + return NULL; + } + } + } + } + co = co->next; + } + + if(matches) { + /* Now we need to make sure that if there is a name appearing more than + once, the longest specified path version comes first. To make this + the swiftest way, we just sort them all based on path length. */ + struct Cookie **array; + size_t i; + + /* alloc an array and store all cookie pointers */ + array = (struct Cookie **)malloc(sizeof(struct Cookie *) * matches); + if(!array) + goto fail; + + co = mainco; + + for(i=0; co; co = co->next) + array[i++] = co; + + /* now sort the cookie pointers in path lenth order */ + qsort(array, matches, sizeof(struct Cookie *), cookie_sort); + + /* remake the linked list order according to the new order */ + + mainco = array[0]; /* start here */ + for(i=0; inext = array[i+1]; + array[matches-1]->next = NULL; /* terminate the list */ + + free(array); /* remove the temporary data again */ + } + + return mainco; /* return the new list */ +} + +/***************************************************************************** + * + * Curl_cookie_clearall() + * + * Clear all existing cookies and reset the counter. + * + ****************************************************************************/ +void Curl_cookie_clearall(struct CookieInfo *cookies) +{ + if(cookies) { + Curl_cookie_freelist(cookies->cookies, TRUE); + cookies->cookies = NULL; + cookies->numcookies = 0; + } +} + +/***************************************************************************** + * + * Curl_cookie_freelist() + * + * Free a list of cookies previously returned by Curl_cookie_getlist(); + * + * The 'cookiestoo' argument tells this function whether to just free the + * list or actually also free all cookies within the list as well. + * + ****************************************************************************/ + +void Curl_cookie_freelist(struct Cookie *co, bool cookiestoo) +{ + struct Cookie *next; + if(co) { + while(co) { + next = co->next; + if(cookiestoo) + freecookie(co); + else + free(co); /* we only free the struct since the "members" are all just + pointed out in the main cookie list! */ + co = next; + } + } +} + + +/***************************************************************************** + * + * Curl_cookie_clearsess() + * + * Free all session cookies in the cookies list. + * + ****************************************************************************/ +void Curl_cookie_clearsess(struct CookieInfo *cookies) +{ + struct Cookie *first, *curr, *next, *prev = NULL; + + if(!cookies || !cookies->cookies) + return; + + first = curr = prev = cookies->cookies; + + for(; curr; curr = next) { + next = curr->next; + if(!curr->expires) { + if(first == curr) + first = next; + + if(prev == curr) + prev = next; + else + prev->next = next; + + freecookie(curr); + cookies->numcookies--; + } + else + prev = curr; + } + + cookies->cookies = first; +} + + +/***************************************************************************** + * + * Curl_cookie_cleanup() + * + * Free a "cookie object" previous created with cookie_init(). + * + ****************************************************************************/ +void Curl_cookie_cleanup(struct CookieInfo *c) +{ + struct Cookie *co; + struct Cookie *next; + if(c) { + if(c->filename) + free(c->filename); + co = c->cookies; + + while(co) { + next = co->next; + freecookie(co); + co = next; + } + free(c); /* free the base struct as well */ + } +} + +/* get_netscape_format() + * + * Formats a string for Netscape output file, w/o a newline at the end. + * + * Function returns a char * to a formatted line. Has to be free()d +*/ +static char *get_netscape_format(const struct Cookie *co) +{ + return aprintf( + "%s" /* httponly preamble */ + "%s%s\t" /* domain */ + "%s\t" /* tailmatch */ + "%s\t" /* path */ + "%s\t" /* secure */ + "%" FORMAT_OFF_T "\t" /* expires */ + "%s\t" /* name */ + "%s", /* value */ + co->httponly?"#HttpOnly_":"", + /* Make sure all domains are prefixed with a dot if they allow + tailmatching. This is Mozilla-style. */ + (co->tailmatch && co->domain && co->domain[0] != '.')? ".":"", + co->domain?co->domain:"unknown", + co->tailmatch?"TRUE":"FALSE", + co->path?co->path:"/", + co->secure?"TRUE":"FALSE", + co->expires, + co->name, + co->value?co->value:""); +} + +/* + * Curl_cookie_output() + * + * Writes all internally known cookies to the specified file. Specify + * "-" as file name to write to stdout. + * + * The function returns non-zero on write failure. + */ +int Curl_cookie_output(struct CookieInfo *c, const char *dumphere) +{ + struct Cookie *co; + FILE *out; + bool use_stdout=FALSE; + + if((NULL == c) || (0 == c->numcookies)) + /* If there are no known cookies, we don't write or even create any + destination file */ + return 0; + + if(strequal("-", dumphere)) { + /* use stdout */ + out = stdout; + use_stdout=TRUE; + } + else { + out = fopen(dumphere, "w"); + if(!out) + return 1; /* failure */ + } + + if(c) { + char *format_ptr; + + fputs("# Netscape HTTP Cookie File\n" + "# http://curl.haxx.se/rfc/cookie_spec.html\n" + "# This file was generated by libcurl! Edit at your own risk.\n\n", + out); + co = c->cookies; + + while(co) { + format_ptr = get_netscape_format(co); + if(format_ptr == NULL) { + fprintf(out, "#\n# Fatal libcurl error\n"); + if(!use_stdout) + fclose(out); + return 1; + } + fprintf(out, "%s\n", format_ptr); + free(format_ptr); + co=co->next; + } + } + + if(!use_stdout) + fclose(out); + + return 0; +} + +struct curl_slist *Curl_cookie_list(struct SessionHandle *data) +{ + struct curl_slist *list = NULL; + struct curl_slist *beg; + struct Cookie *c; + char *line; + + if((data->cookies == NULL) || + (data->cookies->numcookies == 0)) + return NULL; + + c = data->cookies->cookies; + + beg = list; + while(c) { + /* fill the list with _all_ the cookies we know */ + line = get_netscape_format(c); + if(line == NULL) { + curl_slist_free_all(beg); + return NULL; + } + list = curl_slist_append(list, line); + free(line); + if(list == NULL) { + curl_slist_free_all(beg); + return NULL; + } + else if(beg == NULL) { + beg = list; + } + c = c->next; + } + + return list; +} + +#endif /* CURL_DISABLE_HTTP || CURL_DISABLE_COOKIES */ diff --git a/mobicore/common/curl/lib/cookie.h b/mobicore/common/curl/lib/cookie.h new file mode 100644 index 0000000000000000000000000000000000000000..e8c005f20de9aff294f4dc3b6e9be69d296a1e9d --- /dev/null +++ b/mobicore/common/curl/lib/cookie.h @@ -0,0 +1,108 @@ +#ifndef __COOKIE_H +#define __COOKIE_H +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) 1998 - 2008, Daniel Stenberg, , et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at http://curl.haxx.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ***************************************************************************/ + +#include +#if defined(WIN32) +#include +#else +#ifdef HAVE_SYS_TIME_H +#include +#endif +#endif + +#include + +struct Cookie { + struct Cookie *next; /* next in the chain */ + char *name; /* = value */ + char *value; /* name = */ + char *path; /* path = */ + char *domain; /* domain = */ + curl_off_t expires; /* expires = */ + char *expirestr; /* the plain text version */ + bool tailmatch; /* weather we do tail-matchning of the domain name */ + + /* RFC 2109 keywords. Version=1 means 2109-compliant cookie sending */ + char *version; /* Version = */ + char *maxage; /* Max-Age = */ + + bool secure; /* whether the 'secure' keyword was used */ + bool livecookie; /* updated from a server, not a stored file */ + bool httponly; /* true if the httponly directive is present */ +}; + +struct CookieInfo { + /* linked list of cookies we know of */ + struct Cookie *cookies; + + char *filename; /* file we read from/write to */ + bool running; /* state info, for cookie adding information */ + long numcookies; /* number of cookies in the "jar" */ + bool newsession; /* new session, discard session cookies on load */ +}; + +/* This is the maximum line length we accept for a cookie line. RFC 2109 + section 6.3 says: + + "at least 4096 bytes per cookie (as measured by the size of the characters + that comprise the cookie non-terminal in the syntax description of the + Set-Cookie header)" + +*/ +#define MAX_COOKIE_LINE 5000 +#define MAX_COOKIE_LINE_TXT "4999" + +/* This is the maximum length of a cookie name we deal with: */ +#define MAX_NAME 1024 +#define MAX_NAME_TXT "1023" + +struct SessionHandle; +/* + * Add a cookie to the internal list of cookies. The domain and path arguments + * are only used if the header boolean is TRUE. + */ + +struct Cookie *Curl_cookie_add(struct SessionHandle *data, + struct CookieInfo *, bool header, char *lineptr, + const char *domain, const char *path); + +struct CookieInfo *Curl_cookie_init(struct SessionHandle *data, + const char *, struct CookieInfo *, bool); +struct Cookie *Curl_cookie_getlist(struct CookieInfo *, const char *, + const char *, bool); +void Curl_cookie_freelist(struct Cookie *cookies, bool cookiestoo); +void Curl_cookie_clearall(struct CookieInfo *cookies); +void Curl_cookie_clearsess(struct CookieInfo *cookies); +void Curl_cookie_cleanup(struct CookieInfo *); +int Curl_cookie_output(struct CookieInfo *, const char *); + +#if defined(CURL_DISABLE_HTTP) || defined(CURL_DISABLE_COOKIES) +#define Curl_cookie_list(x) NULL +#define Curl_cookie_loadfiles(x) do { } while (0) +#else +struct curl_slist *Curl_cookie_list(struct SessionHandle *data); +void Curl_cookie_loadfiles(struct SessionHandle *data); +#endif + +#endif diff --git a/mobicore/common/curl/lib/curl_addrinfo.c b/mobicore/common/curl/lib/curl_addrinfo.c new file mode 100644 index 0000000000000000000000000000000000000000..6feccf2d084eeaa88e9b27c0484bca6d9070537b --- /dev/null +++ b/mobicore/common/curl/lib/curl_addrinfo.c @@ -0,0 +1,530 @@ +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) 1998 - 2010, Daniel Stenberg, , et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at http://curl.haxx.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ***************************************************************************/ + +#include "setup.h" + +#include + +#ifdef HAVE_SYS_SOCKET_H +# include +#endif +#ifdef HAVE_NETINET_IN_H +# include +#endif +#ifdef HAVE_NETDB_H +# include +#endif +#ifdef HAVE_ARPA_INET_H +# include +#endif + +#ifdef __VMS +# include +# include +# include +#endif + +#if defined(NETWARE) && defined(__NOVELL_LIBC__) +# undef in_addr_t +# define in_addr_t unsigned long +#endif + +#include "curl_addrinfo.h" +#include "inet_pton.h" + +#define _MPRINTF_REPLACE /* use our functions only */ +#include + +#include "curl_memory.h" +/* The last #include file should be: */ +#include "memdebug.h" + + +/* + * Curl_freeaddrinfo() + * + * This is used to free a linked list of Curl_addrinfo structs along + * with all its associated allocated storage. This function should be + * called once for each successful call to Curl_getaddrinfo_ex() or to + * any function call which actually allocates a Curl_addrinfo struct. + */ + +#if defined(__INTEL_COMPILER) && (__INTEL_COMPILER == 910) && \ + defined(__OPTIMIZE__) && defined(__unix__) && defined(__i386__) + /* workaround icc 9.1 optimizer issue */ +# define vqualifier volatile +#else +# define vqualifier +#endif + +void +Curl_freeaddrinfo(Curl_addrinfo *cahead) +{ + Curl_addrinfo *vqualifier canext; + Curl_addrinfo *ca; + + for(ca = cahead; ca != NULL; ca = canext) { + + if(ca->ai_addr) + free(ca->ai_addr); + + if(ca->ai_canonname) + free(ca->ai_canonname); + + canext = ca->ai_next; + + free(ca); + } +} + + +#ifdef HAVE_GETADDRINFO +/* + * Curl_getaddrinfo_ex() + * + * This is a wrapper function around system's getaddrinfo(), with + * the only difference that instead of returning a linked list of + * addrinfo structs this one returns a linked list of Curl_addrinfo + * ones. The memory allocated by this function *MUST* be free'd with + * Curl_freeaddrinfo(). For each successful call to this function + * there must be an associated call later to Curl_freeaddrinfo(). + * + * There should be no single call to system's getaddrinfo() in the + * whole library, any such call should be 'routed' through this one. + */ + +int +Curl_getaddrinfo_ex(const char *nodename, + const char *servname, + const struct addrinfo *hints, + Curl_addrinfo **result) +{ + const struct addrinfo *ai; + struct addrinfo *aihead; + Curl_addrinfo *cafirst = NULL; + Curl_addrinfo *calast = NULL; + Curl_addrinfo *ca; + size_t ss_size; + int error; + + *result = NULL; /* assume failure */ + + error = getaddrinfo(nodename, servname, hints, &aihead); + if(error) + return error; + + /* traverse the addrinfo list */ + + for(ai = aihead; ai != NULL; ai = ai->ai_next) { + + /* ignore elements with unsupported address family, */ + /* settle family-specific sockaddr structure size. */ + if(ai->ai_family == AF_INET) + ss_size = sizeof(struct sockaddr_in); +#ifdef ENABLE_IPV6 + else if(ai->ai_family == AF_INET6) + ss_size = sizeof(struct sockaddr_in6); +#endif + else + continue; + + /* ignore elements without required address info */ + if((ai->ai_addr == NULL) || !(ai->ai_addrlen > 0)) + continue; + + /* ignore elements with bogus address size */ + if((size_t)ai->ai_addrlen < ss_size) + continue; + + if((ca = malloc(sizeof(Curl_addrinfo))) == NULL) { + error = EAI_MEMORY; + break; + } + + /* copy each structure member individually, member ordering, */ + /* size, or padding might be different for each platform. */ + + ca->ai_flags = ai->ai_flags; + ca->ai_family = ai->ai_family; + ca->ai_socktype = ai->ai_socktype; + ca->ai_protocol = ai->ai_protocol; + ca->ai_addrlen = (curl_socklen_t)ss_size; + ca->ai_addr = NULL; + ca->ai_canonname = NULL; + ca->ai_next = NULL; + + if((ca->ai_addr = malloc(ss_size)) == NULL) { + error = EAI_MEMORY; + free(ca); + break; + } + memcpy(ca->ai_addr, ai->ai_addr, ss_size); + + if(ai->ai_canonname != NULL) { + if((ca->ai_canonname = strdup(ai->ai_canonname)) == NULL) { + error = EAI_MEMORY; + free(ca->ai_addr); + free(ca); + break; + } + } + + /* if the return list is empty, this becomes the first element */ + if(!cafirst) + cafirst = ca; + + /* add this element last in the return list */ + if(calast) + calast->ai_next = ca; + calast = ca; + + } + + /* destroy the addrinfo list */ + if(aihead) + freeaddrinfo(aihead); + + /* if we failed, also destroy the Curl_addrinfo list */ + if(error) { + Curl_freeaddrinfo(cafirst); + cafirst = NULL; + } + else if(!cafirst) { +#ifdef EAI_NONAME + /* rfc3493 conformant */ + error = EAI_NONAME; +#else + /* rfc3493 obsoleted */ + error = EAI_NODATA; +#endif +#ifdef USE_WINSOCK + SET_SOCKERRNO(error); +#endif + } + + *result = cafirst; + + /* This is not a CURLcode */ + return error; +} +#endif /* HAVE_GETADDRINFO */ + + +/* + * Curl_he2ai() + * + * This function returns a pointer to the first element of a newly allocated + * Curl_addrinfo struct linked list filled with the data of a given hostent. + * Curl_addrinfo is meant to work like the addrinfo struct does for a IPv6 + * stack, but usable also for IPv4, all hosts and environments. + * + * The memory allocated by this function *MUST* be free'd later on calling + * Curl_freeaddrinfo(). For each successful call to this function there + * must be an associated call later to Curl_freeaddrinfo(). + * + * Curl_addrinfo defined in "lib/curl_addrinfo.h" + * + * struct Curl_addrinfo { + * int ai_flags; + * int ai_family; + * int ai_socktype; + * int ai_protocol; + * curl_socklen_t ai_addrlen; * Follow rfc3493 struct addrinfo * + * char *ai_canonname; + * struct sockaddr *ai_addr; + * struct Curl_addrinfo *ai_next; + * }; + * typedef struct Curl_addrinfo Curl_addrinfo; + * + * hostent defined in + * + * struct hostent { + * char *h_name; + * char **h_aliases; + * int h_addrtype; + * int h_length; + * char **h_addr_list; + * }; + * + * for backward compatibility: + * + * #define h_addr h_addr_list[0] + */ + +Curl_addrinfo * +Curl_he2ai(const struct hostent *he, int port) +{ + Curl_addrinfo *ai; + Curl_addrinfo *prevai = NULL; + Curl_addrinfo *firstai = NULL; + struct sockaddr_in *addr; +#ifdef ENABLE_IPV6 + struct sockaddr_in6 *addr6; +#endif + CURLcode result = CURLE_OK; + int i; + char *curr; + + if(!he) + /* no input == no output! */ + return NULL; + + DEBUGASSERT((he->h_name != NULL) && (he->h_addr_list != NULL)); + + for(i=0; (curr = he->h_addr_list[i]) != NULL; i++) { + + size_t ss_size; +#ifdef ENABLE_IPV6 + if (he->h_addrtype == AF_INET6) + ss_size = sizeof (struct sockaddr_in6); + else +#endif + ss_size = sizeof (struct sockaddr_in); + + if((ai = calloc(1, sizeof(Curl_addrinfo))) == NULL) { + result = CURLE_OUT_OF_MEMORY; + break; + } + if((ai->ai_canonname = strdup(he->h_name)) == NULL) { + result = CURLE_OUT_OF_MEMORY; + free(ai); + break; + } + if((ai->ai_addr = calloc(1, ss_size)) == NULL) { + result = CURLE_OUT_OF_MEMORY; + free(ai->ai_canonname); + free(ai); + break; + } + + if(!firstai) + /* store the pointer we want to return from this function */ + firstai = ai; + + if(prevai) + /* make the previous entry point to this */ + prevai->ai_next = ai; + + ai->ai_family = he->h_addrtype; + + /* we return all names as STREAM, so when using this address for TFTP + the type must be ignored and conn->socktype be used instead! */ + ai->ai_socktype = SOCK_STREAM; + + ai->ai_addrlen = (curl_socklen_t)ss_size; + + /* leave the rest of the struct filled with zero */ + + switch (ai->ai_family) { + case AF_INET: + addr = (void *)ai->ai_addr; /* storage area for this info */ + + memcpy(&addr->sin_addr, curr, sizeof(struct in_addr)); + addr->sin_family = (unsigned short)(he->h_addrtype); + addr->sin_port = htons((unsigned short)port); + break; + +#ifdef ENABLE_IPV6 + case AF_INET6: + addr6 = (void *)ai->ai_addr; /* storage area for this info */ + + memcpy(&addr6->sin6_addr, curr, sizeof(struct in6_addr)); + addr6->sin6_family = (unsigned short)(he->h_addrtype); + addr6->sin6_port = htons((unsigned short)port); + break; +#endif + } + + prevai = ai; + } + + if(result != CURLE_OK) { + Curl_freeaddrinfo(firstai); + firstai = NULL; + } + + return firstai; +} + + +struct namebuff { + struct hostent hostentry; + union { + struct in_addr ina4; +#ifdef ENABLE_IPV6 + struct in6_addr ina6; +#endif + } addrentry; + char *h_addr_list[2]; +}; + + +/* + * Curl_ip2addr() + * + * This function takes an internet address, in binary form, as input parameter + * along with its address family and the string version of the address, and it + * returns a Curl_addrinfo chain filled in correctly with information for the + * given address/host + */ + +Curl_addrinfo * +Curl_ip2addr(int af, const void *inaddr, const char *hostname, int port) +{ + Curl_addrinfo *ai; + +#if defined(__VMS) && \ + defined(__INITIAL_POINTER_SIZE) && (__INITIAL_POINTER_SIZE == 64) +#pragma pointer_size save +#pragma pointer_size short +#pragma message disable PTRMISMATCH +#endif + + struct hostent *h; + struct namebuff *buf; + char *addrentry; + char *hoststr; + size_t addrsize; + + DEBUGASSERT(inaddr && hostname); + + buf = malloc(sizeof(struct namebuff)); + if(!buf) + return NULL; + + hoststr = strdup(hostname); + if(!hoststr) { + free(buf); + return NULL; + } + + switch(af) { + case AF_INET: + addrsize = sizeof(struct in_addr); + addrentry = (void *)&buf->addrentry.ina4; + memcpy(addrentry, inaddr, sizeof(struct in_addr)); + break; +#ifdef ENABLE_IPV6 + case AF_INET6: + addrsize = sizeof(struct in6_addr); + addrentry = (void *)&buf->addrentry.ina6; + memcpy(addrentry, inaddr, sizeof(struct in6_addr)); + break; +#endif + default: + free(hoststr); + free(buf); + return NULL; + } + + h = &buf->hostentry; + h->h_name = hoststr; + h->h_aliases = NULL; + h->h_addrtype = (short)af; + h->h_length = (short)addrsize; + h->h_addr_list = &buf->h_addr_list[0]; + h->h_addr_list[0] = addrentry; + h->h_addr_list[1] = NULL; /* terminate list of entries */ + +#if defined(__VMS) && \ + defined(__INITIAL_POINTER_SIZE) && (__INITIAL_POINTER_SIZE == 64) +#pragma pointer_size restore +#pragma message enable PTRMISMATCH +#endif + + ai = Curl_he2ai(h, port); + + free(hoststr); + free(buf); + + return ai; +} + +/* + * Given an IPv4 or IPv6 dotted string address, this converts it to a proper + * allocated Curl_addrinfo struct and returns it. + */ +Curl_addrinfo *Curl_str2addr(char *address, int port) +{ + struct in_addr in; + if(Curl_inet_pton(AF_INET, address, &in) > 0) + /* This is a dotted IP address 123.123.123.123-style */ + return Curl_ip2addr(AF_INET, &in, address, port); +#ifdef ENABLE_IPV6 + else { + struct in6_addr in6; + if(Curl_inet_pton(AF_INET6, address, &in6) > 0) + /* This is a dotted IPv6 address ::1-style */ + return Curl_ip2addr(AF_INET6, &in6, address, port); + } +#endif + return NULL; /* bad input format */ +} + +#if defined(CURLDEBUG) && defined(HAVE_FREEADDRINFO) +/* + * curl_dofreeaddrinfo() + * + * This is strictly for memory tracing and are using the same style as the + * family otherwise present in memdebug.c. I put these ones here since they + * require a bunch of structs I didn't wanna include in memdebug.c + */ + +void +curl_dofreeaddrinfo(struct addrinfo *freethis, + int line, const char *source) +{ + (freeaddrinfo)(freethis); + curl_memlog("ADDR %s:%d freeaddrinfo(%p)\n", + source, line, (void *)freethis); +} +#endif /* defined(CURLDEBUG) && defined(HAVE_FREEADDRINFO) */ + + +#if defined(CURLDEBUG) && defined(HAVE_GETADDRINFO) +/* + * curl_dogetaddrinfo() + * + * This is strictly for memory tracing and are using the same style as the + * family otherwise present in memdebug.c. I put these ones here since they + * require a bunch of structs I didn't wanna include in memdebug.c + */ + +int +curl_dogetaddrinfo(const char *hostname, + const char *service, + const struct addrinfo *hints, + struct addrinfo **result, + int line, const char *source) +{ + int res=(getaddrinfo)(hostname, service, hints, result); + if(0 == res) + /* success */ + curl_memlog("ADDR %s:%d getaddrinfo() = %p\n", + source, line, (void *)*result); + else + curl_memlog("ADDR %s:%d getaddrinfo() failed\n", + source, line); + return res; +} +#endif /* defined(CURLDEBUG) && defined(HAVE_GETADDRINFO) */ + diff --git a/mobicore/common/curl/lib/curl_addrinfo.h b/mobicore/common/curl/lib/curl_addrinfo.h new file mode 100644 index 0000000000000000000000000000000000000000..11c339474cfe5e6e343a16ea96b47404bc1e6c17 --- /dev/null +++ b/mobicore/common/curl/lib/curl_addrinfo.h @@ -0,0 +1,100 @@ +#ifndef HEADER_CURL_ADDRINFO_H +#define HEADER_CURL_ADDRINFO_H +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) 1998 - 2010, Daniel Stenberg, , et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at http://curl.haxx.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ***************************************************************************/ + +#include "setup.h" + +#ifdef HAVE_SYS_SOCKET_H +# include +#endif +#ifdef HAVE_NETINET_IN_H +# include +#endif +#ifdef HAVE_NETDB_H +# include +#endif +#ifdef HAVE_ARPA_INET_H +# include +#endif + +#ifdef __VMS +# include +# include +# include +#endif + + +/* + * Curl_addrinfo is our internal struct definition that we use to allow + * consistent internal handling of this data. We use this even when the + * system provides an addrinfo structure definition. And we use this for + * all sorts of IPv4 and IPV6 builds. + */ + +struct Curl_addrinfo { + int ai_flags; + int ai_family; + int ai_socktype; + int ai_protocol; + curl_socklen_t ai_addrlen; /* Follow rfc3493 struct addrinfo */ + char *ai_canonname; + struct sockaddr *ai_addr; + struct Curl_addrinfo *ai_next; +}; +typedef struct Curl_addrinfo Curl_addrinfo; + +void +Curl_freeaddrinfo(Curl_addrinfo *cahead); + +#ifdef HAVE_GETADDRINFO +int +Curl_getaddrinfo_ex(const char *nodename, + const char *servname, + const struct addrinfo *hints, + Curl_addrinfo **result); +#endif + +Curl_addrinfo * +Curl_he2ai(const struct hostent *he, int port); + +Curl_addrinfo * +Curl_ip2addr(int af, const void *inaddr, const char *hostname, int port); + +Curl_addrinfo *Curl_str2addr(char *dotted, int port); + +#if defined(CURLDEBUG) && defined(HAVE_FREEADDRINFO) +void +curl_dofreeaddrinfo(struct addrinfo *freethis, + int line, const char *source); +#endif + +#if defined(CURLDEBUG) && defined(HAVE_GETADDRINFO) +int +curl_dogetaddrinfo(const char *hostname, + const char *service, + const struct addrinfo *hints, + struct addrinfo **result, + int line, const char *source); +#endif + +#endif /* HEADER_CURL_ADDRINFO_H */ diff --git a/mobicore/common/curl/lib/curl_base64.h b/mobicore/common/curl/lib/curl_base64.h new file mode 100644 index 0000000000000000000000000000000000000000..2498a0a2259e5f09dd85a733cc547be967eeec50 --- /dev/null +++ b/mobicore/common/curl/lib/curl_base64.h @@ -0,0 +1,31 @@ +#ifndef HEADER_CURL_BASE64_H +#define HEADER_CURL_BASE64_H +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) 1998 - 2009, Daniel Stenberg, , et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at http://curl.haxx.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ***************************************************************************/ + +size_t Curl_base64_encode(struct SessionHandle *data, + const char *inputbuff, size_t insize, + char **outptr); + +size_t Curl_base64_decode(const char *src, unsigned char **outptr); + +#endif /* HEADER_CURL_BASE64_H */ diff --git a/mobicore/common/curl/lib/curl_config.h b/mobicore/common/curl/lib/curl_config.h new file mode 100644 index 0000000000000000000000000000000000000000..91882102f0727f4bedf7205aec01225c2377c6da --- /dev/null +++ b/mobicore/common/curl/lib/curl_config.h @@ -0,0 +1,1022 @@ +/* lib/curl_config.h. Generated from curl_config.h.in by configure. */ +/* lib/curl_config.h.in. Generated from configure.ac by autoheader. */ + +/* when building libcurl itself */ +/* #undef BUILDING_LIBCURL */ + +/* Location of default ca bundle */ +/* #undef CURL_CA_BUNDLE */ + +/* Location of default ca path */ +#define CURL_CA_PATH "/etc/ssl/certs/" + +/* to disable cookies support */ +#define CURL_DISABLE_COOKIES 1 + +/* to disable cryptographic authentication */ +/* #undef CURL_DISABLE_CRYPTO_AUTH */ + +/* to disable DICT */ +#define CURL_DISABLE_DICT 1 + +/* to disable FILE */ +#define CURL_DISABLE_FILE 1 + +/* to disable FTP */ +#define CURL_DISABLE_FTP 1 + +/* to disable Gopher */ +#define CURL_DISABLE_GOPHER 1 + +/* to disable HTTP */ +/* #undef CURL_DISABLE_HTTP */ + +/* to disable IMAP */ +#define CURL_DISABLE_IMAP 1 + +/* to disable LDAP */ +#define CURL_DISABLE_LDAP 1 + +/* to disable LDAPS */ +#define CURL_DISABLE_LDAPS 1 + +/* to disable POP3 */ +#define CURL_DISABLE_POP3 1 + +/* to disable proxies */ +/* #undef CURL_DISABLE_PROXY */ + +/* to disable RTSP */ +#define CURL_DISABLE_RTSP 1 + +/* to disable SMTP */ +#define CURL_DISABLE_SMTP 1 + +/* to disable TELNET */ +#define CURL_DISABLE_TELNET 1 + +/* to disable TFTP */ +#define CURL_DISABLE_TFTP 1 + +/* to disable verbose strings */ +/* #undef CURL_DISABLE_VERBOSE_STRINGS */ + +/* to make a symbol visible */ +/* #undef CURL_EXTERN_SYMBOL */ + +/* to enable hidden symbols */ +/* #undef CURL_HIDDEN_SYMBOLS */ + +/* Use Windows LDAP implementation */ +/* #undef CURL_LDAP_WIN */ + +/* when not building a shared library */ +/* #undef CURL_STATICLIB */ + +/* your Entropy Gathering Daemon socket pathname */ +/* #undef EGD_SOCKET */ + +/* Define if you want to enable IPv6 support */ +#define ENABLE_IPV6 1 + +/* Define to the type qualifier of arg 1 for getnameinfo. */ +#define GETNAMEINFO_QUAL_ARG1 const + +/* Define to the type of arg 1 for getnameinfo. */ +#define GETNAMEINFO_TYPE_ARG1 struct sockaddr * + +/* Define to the type of arg 2 for getnameinfo. */ +#define GETNAMEINFO_TYPE_ARG2 socklen_t + +/* Define to the type of args 4 and 6 for getnameinfo. */ +#define GETNAMEINFO_TYPE_ARG46 size_t + +/* Define to the type of arg 7 for getnameinfo. */ +#define GETNAMEINFO_TYPE_ARG7 int + +/* Specifies the number of arguments to getservbyport_r */ +/* #undef GETSERVBYPORT_R_ARGS */ + +/* Specifies the size of the buffer to pass to getservbyport_r */ +/* #undef GETSERVBYPORT_R_BUFSIZE */ + +/* Define to 1 if you have the alarm function. */ +#define HAVE_ALARM 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_ALLOCA_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_ARPA_INET_H 1 + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_ARPA_TFTP_H */ + +/* Define to 1 if you have the header file. */ +#define HAVE_ASSERT_H 1 + +/* Define to 1 if you have the basename function. */ +#define HAVE_BASENAME 1 + +/* Define to 1 if bool is an available type. */ +#define HAVE_BOOL_T 1 + +/* Define to 1 if you have the clock_gettime function and monotonic timer. */ +#define HAVE_CLOCK_GETTIME_MONOTONIC 1 + +/* Define to 1 if you have the closesocket function. */ +/* #undef HAVE_CLOSESOCKET */ + +/* Define to 1 if you have the CloseSocket camel case function. */ +/* #undef HAVE_CLOSESOCKET_CAMEL */ + +/* Define to 1 if you have the connect function. */ +#define HAVE_CONNECT 1 + +/* Define to 1 if you have the `CRYPTO_cleanup_all_ex_data' function. */ +#define HAVE_CRYPTO_CLEANUP_ALL_EX_DATA 1 + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_CRYPTO_H */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_DES_H */ + +/* Define to 1 if you have the header file. */ +#define HAVE_DLFCN_H 1 + +/* Define to 1 if you have the `ENGINE_cleanup' function. */ +/* #undef HAVE_ENGINE_CLEANUP */ + +/* Define to 1 if you have the `ENGINE_load_builtin_engines' function. */ +/* #undef HAVE_ENGINE_LOAD_BUILTIN_ENGINES */ + +/* Define to 1 if you have the header file. */ +#define HAVE_ERRNO_H 1 + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_ERR_H */ + +/* Define to 1 if you have the fcntl function. */ +#define HAVE_FCNTL 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_FCNTL_H 1 + +/* Define to 1 if you have a working fcntl O_NONBLOCK function. */ +#define HAVE_FCNTL_O_NONBLOCK 1 + +/* Define to 1 if you have the fdopen function. */ +#define HAVE_FDOPEN 1 + +/* Define to 1 if you have the `fork' function. */ +#define HAVE_FORK 1 + +/* Define to 1 if you have the freeaddrinfo function. */ +#define HAVE_FREEADDRINFO 1 + +/* Define to 1 if you have the freeifaddrs function. */ +/* #undef HAVE_FREEIFADDRS */ + +/* Define to 1 if you have the fsetxattr function. */ +/* #undef HAVE_FSETXATTR */ + +/* fsetxattr() takes 5 args */ +/* #undef HAVE_FSETXATTR_5 */ + +/* fsetxattr() takes 6 args */ +/* #undef HAVE_FSETXATTR_6 */ + +/* Define to 1 if you have the ftruncate function. */ +#define HAVE_FTRUNCATE 1 + +/* Define to 1 if you have a working getaddrinfo function. */ +#define HAVE_GETADDRINFO 1 + +/* Define to 1 if the getaddrinfo function is threadsafe. */ +#define HAVE_GETADDRINFO_THREADSAFE 1 + +/* Define to 1 if you have the `geteuid' function. */ +#define HAVE_GETEUID 1 + +/* Define to 1 if you have the gethostbyaddr function. */ +#define HAVE_GETHOSTBYADDR 1 + +/* Define to 1 if you have the gethostbyaddr_r function. */ +/* #undef HAVE_GETHOSTBYADDR_R */ + +/* gethostbyaddr_r() takes 5 args */ +/* #undef HAVE_GETHOSTBYADDR_R_5 */ + +/* gethostbyaddr_r() takes 7 args */ +/* #undef HAVE_GETHOSTBYADDR_R_7 */ + +/* gethostbyaddr_r() takes 8 args */ +/* #undef HAVE_GETHOSTBYADDR_R_8 */ + +/* Define to 1 if you have the gethostbyname function. */ +#define HAVE_GETHOSTBYNAME 1 + +/* Define to 1 if you have the gethostbyname_r function. */ +#define HAVE_GETHOSTBYNAME_R 1 + +/* gethostbyname_r() takes 3 args */ +/* #undef HAVE_GETHOSTBYNAME_R_3 */ + +/* gethostbyname_r() takes 5 args */ +/* #undef HAVE_GETHOSTBYNAME_R_5 */ + +/* gethostbyname_r() takes 6 args */ +#define HAVE_GETHOSTBYNAME_R_6 1 + +/* Define to 1 if you have the gethostname function. */ +#define HAVE_GETHOSTNAME 1 + +/* Define to 1 if you have a working getifaddrs function. */ +/* #undef HAVE_GETIFADDRS */ + +/* Define to 1 if you have the getnameinfo function. */ +#define HAVE_GETNAMEINFO 1 + +/* Define to 1 if you have the `getpass_r' function. */ +/* #undef HAVE_GETPASS_R */ + +/* Define to 1 if you have the `getppid' function. */ +#define HAVE_GETPPID 1 + +/* Define to 1 if you have the `getprotobyname' function. */ +#define HAVE_GETPROTOBYNAME 1 + +/* Define to 1 if you have the `getpwuid' function. */ +#define HAVE_GETPWUID 1 + +/* Define to 1 if you have the `getrlimit' function. */ +#define HAVE_GETRLIMIT 1 + +/* Define to 1 if you have the getservbyport_r function. */ +/* #undef HAVE_GETSERVBYPORT_R */ + +/* Define to 1 if you have the `gettimeofday' function. */ +#define HAVE_GETTIMEOFDAY 1 + +/* Define to 1 if you have a working glibc-style strerror_r function. */ +/* #undef HAVE_GLIBC_STRERROR_R */ + +/* Define to 1 if you have a working gmtime_r function. */ +#define HAVE_GMTIME_R 1 + +/* if you have the gssapi libraries */ +/* #undef HAVE_GSSAPI */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_GSSAPI_GSSAPI_GENERIC_H */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_GSSAPI_GSSAPI_H */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_GSSAPI_GSSAPI_KRB5_H */ + +/* if you have the GNU gssapi libraries */ +/* #undef HAVE_GSSGNU */ + +/* if you have the Heimdal gssapi libraries */ +/* #undef HAVE_GSSHEIMDAL */ + +/* if you have the MIT gssapi libraries */ +/* #undef HAVE_GSSMIT */ + +/* Define to 1 if you have the `idna_strerror' function. */ +/* #undef HAVE_IDNA_STRERROR */ + +/* Define to 1 if you have the `idn_free' function. */ +/* #undef HAVE_IDN_FREE */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_IDN_FREE_H */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_IFADDRS_H */ + +/* Define to 1 if you have the `inet_addr' function. */ +#define HAVE_INET_ADDR 1 + +/* Define to 1 if you have the inet_ntoa_r function. */ +/* #undef HAVE_INET_NTOA_R */ + +/* inet_ntoa_r() takes 2 args */ +/* #undef HAVE_INET_NTOA_R_2 */ + +/* inet_ntoa_r() takes 3 args */ +/* #undef HAVE_INET_NTOA_R_3 */ + +/* Define to 1 if you have a IPv6 capable working inet_ntop function. */ +#define HAVE_INET_NTOP 1 + +/* Define to 1 if you have a IPv6 capable working inet_pton function. */ +#define HAVE_INET_PTON 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_INTTYPES_H 1 + +/* Define to 1 if you have the ioctl function. */ +#define HAVE_IOCTL 1 + +/* Define to 1 if you have the ioctlsocket function. */ +/* #undef HAVE_IOCTLSOCKET */ + +/* Define to 1 if you have the IoctlSocket camel case function. */ +/* #undef HAVE_IOCTLSOCKET_CAMEL */ + +/* Define to 1 if you have a working IoctlSocket camel case FIONBIO function. + */ +/* #undef HAVE_IOCTLSOCKET_CAMEL_FIONBIO */ + +/* Define to 1 if you have a working ioctlsocket FIONBIO function. */ +/* #undef HAVE_IOCTLSOCKET_FIONBIO */ + +/* Define to 1 if you have a working ioctl FIONBIO function. */ +#define HAVE_IOCTL_FIONBIO 1 + +/* Define to 1 if you have a working ioctl SIOCGIFADDR function. */ +#define HAVE_IOCTL_SIOCGIFADDR 1 + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_IO_H */ + +/* if you have the Kerberos4 libraries (including -ldes) */ +/* #undef HAVE_KRB4 */ + +/* Define to 1 if you have the `krb_get_our_ip_for_realm' function. */ +/* #undef HAVE_KRB_GET_OUR_IP_FOR_REALM */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_KRB_H */ + +/* Define to 1 if you have the lber.h header file. */ +/* #undef HAVE_LBER_H */ + +/* Define to 1 if you have the ldapssl.h header file. */ +/* #undef HAVE_LDAPSSL_H */ + +/* Define to 1 if you have the ldap.h header file. */ +/* #undef HAVE_LDAP_H */ + +/* Define to 1 if you have the `ldap_init_fd' function. */ +/* #undef HAVE_LDAP_INIT_FD */ + +/* Use LDAPS implementation */ +/* #undef HAVE_LDAP_SSL */ + +/* Define to 1 if you have the ldap_ssl.h header file. */ +/* #undef HAVE_LDAP_SSL_H */ + +/* Define to 1 if you have the `ldap_url_parse' function. */ +/* #undef HAVE_LDAP_URL_PARSE */ + +/* Define to 1 if you have the `gcrypt' library (-lgcrypt). */ +/* #undef HAVE_LIBGCRYPT */ + +/* Define to 1 if you have the header file. */ +#define HAVE_LIBGEN_H 1 + +/* Define to 1 if you have the `idn' library (-lidn). */ +/* #undef HAVE_LIBIDN */ + +/* Define to 1 if you have the `resolv' library (-lresolv). */ +/* #undef HAVE_LIBRESOLV */ + +/* Define to 1 if you have the `resolve' library (-lresolve). */ +/* #undef HAVE_LIBRESOLVE */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_LIBRTMP_RTMP_H */ + +/* Define to 1 if you have the `ssh2' library (-lssh2). */ +/* #undef HAVE_LIBSSH2 */ + +/* Define to 1 if you have the `libssh2_exit' function. */ +/* #undef HAVE_LIBSSH2_EXIT */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_LIBSSH2_H */ + +/* Define to 1 if you have the `libssh2_init' function. */ +/* #undef HAVE_LIBSSH2_INIT */ + +/* Define to 1 if you have the `libssh2_scp_send64' function. */ +/* #undef HAVE_LIBSSH2_SCP_SEND64 */ + +/* Define to 1 if you have the `libssh2_session_handshake' function. */ +/* #undef HAVE_LIBSSH2_SESSION_HANDSHAKE */ + +/* Define to 1 if you have the `libssh2_version' function. */ +/* #undef HAVE_LIBSSH2_VERSION */ + +/* Define to 1 if you have the `ssl' library (-lssl). */ +#define HAVE_LIBSSL 1 + +/* if zlib is available */ +#define HAVE_LIBZ 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_LIMITS_H 1 + +/* if your compiler supports LL */ +#define HAVE_LL 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_LOCALE_H 1 + +/* Define to 1 if you have a working localtime_r function. */ +#define HAVE_LOCALTIME_R 1 + +/* Define to 1 if the compiler supports the 'long long' data type. */ +#define HAVE_LONGLONG 1 + +/* Define to 1 if you have the malloc.h header file. */ +#define HAVE_MALLOC_H 1 + +/* Define to 1 if you have the memory.h header file. */ +#define HAVE_MEMORY_H 1 + +/* Define to 1 if you have the memrchr function or macro. */ +#define HAVE_MEMRCHR 1 + +/* Define to 1 if you have the MSG_NOSIGNAL flag. */ +#define HAVE_MSG_NOSIGNAL 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_NETDB_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_NETINET_IN_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_NETINET_TCP_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_NET_IF_H 1 + +/* Define to 1 if NI_WITHSCOPEID exists and works. */ +/* #undef HAVE_NI_WITHSCOPEID */ + +/* if you have an old MIT gssapi library, lacking GSS_C_NT_HOSTBASED_SERVICE + */ +/* #undef HAVE_OLD_GSSMIT */ + +/* Define to 1 if you have the header file. */ +#define HAVE_OPENSSL_CRYPTO_H 1 + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_OPENSSL_ENGINE_H */ + +/* Define to 1 if you have the header file. */ +#define HAVE_OPENSSL_ERR_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_OPENSSL_PEM_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_OPENSSL_PKCS12_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_OPENSSL_RSA_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_OPENSSL_SSL_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_OPENSSL_X509_H 1 + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_PEM_H */ + +/* Define to 1 if you have the `perror' function. */ +#define HAVE_PERROR 1 + +/* Define to 1 if you have the `pipe' function. */ +#define HAVE_PIPE 1 + +/* if you have the function PK11_CreateGenericObject */ +/* #undef HAVE_PK11_CREATEGENERICOBJECT */ + +/* Define to 1 if you have a working poll function. */ +#define HAVE_POLL 1 + +/* If you have a fine poll */ +#define HAVE_POLL_FINE 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_POLL_H 1 + +/* Define to 1 if you have a working POSIX-style strerror_r function. */ +#define HAVE_POSIX_STRERROR_R 1 + +/* if you have */ +/* #undef HAVE_PTHREAD_H */ + +/* Define to 1 if you have the header file. */ +#define HAVE_PWD_H 1 + +/* Define to 1 if you have the `RAND_egd' function. */ +#define HAVE_RAND_EGD 1 + +/* Define to 1 if you have the `RAND_screen' function. */ +/* #undef HAVE_RAND_SCREEN */ + +/* Define to 1 if you have the `RAND_status' function. */ +#define HAVE_RAND_STATUS 1 + +/* Define to 1 if you have the recv function. */ +#define HAVE_RECV 1 + +/* Define to 1 if you have the recvfrom function. */ +#define HAVE_RECVFROM 1 + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_RSA_H */ + +/* Define to 1 if you have the select function. */ +#define HAVE_SELECT 1 + +/* Define to 1 if you have the send function. */ +#define HAVE_SEND 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SETJMP_H 1 + +/* Define to 1 if you have the `setlocale' function. */ +#define HAVE_SETLOCALE 1 + +/* Define to 1 if you have the `setmode' function. */ +/* #undef HAVE_SETMODE */ + +/* Define to 1 if you have the `setrlimit' function. */ +#define HAVE_SETRLIMIT 1 + +/* Define to 1 if you have the setsockopt function. */ +#define HAVE_SETSOCKOPT 1 + +/* Define to 1 if you have a working setsockopt SO_NONBLOCK function. */ +/* #undef HAVE_SETSOCKOPT_SO_NONBLOCK */ + +/* Define to 1 if you have the header file. */ +#define HAVE_SGTTY_H 1 + +/* Define to 1 if you have the sigaction function. */ +#define HAVE_SIGACTION 1 + +/* Define to 1 if you have the siginterrupt function. */ +#define HAVE_SIGINTERRUPT 1 + +/* Define to 1 if you have the signal function. */ +/* #undef HAVE_SIGNAL */ + +/* Define to 1 if you have the header file. */ +#define HAVE_SIGNAL_H 1 + +/* Define to 1 if you have the sigsetjmp function or macro. */ +#define HAVE_SIGSETJMP 1 + +/* Define to 1 if sig_atomic_t is an available typedef. */ +#define HAVE_SIG_ATOMIC_T 1 + +/* Define to 1 if sig_atomic_t is already defined as volatile. */ +/* #undef HAVE_SIG_ATOMIC_T_VOLATILE */ + +/* Define to 1 if struct sockaddr_in6 has the sin6_scope_id member */ +#define HAVE_SOCKADDR_IN6_SIN6_SCOPE_ID 1 + +/* Define to 1 if you have the socket function. */ +#define HAVE_SOCKET 1 + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_SOCKET_H */ + +/* Define this if you have the SPNEGO library fbopenssl */ +/* #undef HAVE_SPNEGO */ + +/* Define to 1 if you have the `SSL_get_shutdown' function. */ +#define HAVE_SSL_GET_SHUTDOWN 1 + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_SSL_H */ + +/* Define to 1 if you have the header file. */ +#define HAVE_STDBOOL_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STDINT_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STDIO_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STDLIB_H 1 + +/* Define to 1 if you have the strcasecmp function. */ +#define HAVE_STRCASECMP 1 + +/* Define to 1 if you have the strcasestr function. */ +#define HAVE_STRCASESTR 1 + +/* Define to 1 if you have the strcmpi function. */ +/* #undef HAVE_STRCMPI */ + +/* Define to 1 if you have the strdup function. */ +#define HAVE_STRDUP 1 + +/* Define to 1 if you have the strerror_r function. */ +#define HAVE_STRERROR_R 1 + +/* Define to 1 if you have the stricmp function. */ +/* #undef HAVE_STRICMP */ + +/* Define to 1 if you have the header file. */ +#define HAVE_STRINGS_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STRING_H 1 + +/* Define to 1 if you have the strlcat function. */ +#define HAVE_STRLCAT 1 + +/* Define to 1 if you have the `strlcpy' function. */ +/* #undef HAVE_STRLCPY */ + +/* Define to 1 if you have the strncasecmp function. */ +#define HAVE_STRNCASECMP 1 + +/* Define to 1 if you have the strncmpi function. */ +/* #undef HAVE_STRNCMPI */ + +/* Define to 1 if you have the strnicmp function. */ +/* #undef HAVE_STRNICMP */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_STROPTS_H */ + +/* Define to 1 if you have the strstr function. */ +#define HAVE_STRSTR 1 + +/* Define to 1 if you have the strtok_r function. */ +#define HAVE_STRTOK_R 1 + +/* Define to 1 if you have the strtoll function. */ +#define HAVE_STRTOLL 1 + +/* if struct sockaddr_storage is defined */ +#define HAVE_STRUCT_SOCKADDR_STORAGE 1 + +/* Define to 1 if you have the timeval struct. */ +#define HAVE_STRUCT_TIMEVAL 1 + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_SYS_FILIO_H */ + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_IOCTL_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_PARAM_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_POLL_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_RESOURCE_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_SELECT_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_SOCKET_H 1 + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_SYS_SOCKIO_H */ + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_STAT_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_TIME_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_TYPES_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_UIO_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_UN_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_UTIME_H 1 + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_SYS_XATTR_H */ + +/* Define to 1 if you have the header file. */ +#define HAVE_TERMIOS_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_TERMIO_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_TIME_H 1 + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_TLD_H */ + +/* Define to 1 if you have the `tld_strerror' function. */ +/* #undef HAVE_TLD_STRERROR */ + +/* Define to 1 if you have the `uname' function. */ +#define HAVE_UNAME 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_UNISTD_H 1 + +/* Define to 1 if you have the `utime' function. */ +#define HAVE_UTIME 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_UTIME_H 1 + +/* Define to 1 if compiler supports C99 variadic macro style. */ +#define HAVE_VARIADIC_MACROS_C99 1 + +/* Define to 1 if compiler supports old gcc variadic macro style. */ +#define HAVE_VARIADIC_MACROS_GCC 1 + +/* Define to 1 if you have the winber.h header file. */ +/* #undef HAVE_WINBER_H */ + +/* Define to 1 if you have the windows.h header file. */ +/* #undef HAVE_WINDOWS_H */ + +/* Define to 1 if you have the winldap.h header file. */ +/* #undef HAVE_WINLDAP_H */ + +/* Define to 1 if you have the winsock2.h header file. */ +/* #undef HAVE_WINSOCK2_H */ + +/* Define to 1 if you have the winsock.h header file. */ +/* #undef HAVE_WINSOCK_H */ + +/* Define this symbol if your OS supports changing the contents of argv */ +/* #undef HAVE_WRITABLE_ARGV */ + +/* Define to 1 if you have the writev function. */ +#define HAVE_WRITEV 1 + +/* Define to 1 if you have the ws2tcpip.h header file. */ +/* #undef HAVE_WS2TCPIP_H */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_X509_H */ + +/* if you have the zlib.h header file */ +#define HAVE_ZLIB_H 1 + +/* Define to the sub-directory in which libtool stores uninstalled libraries. + */ +#define LT_OBJDIR ".libs/" + +/* Define to 1 if you are building a native Windows target. */ +/* #undef NATIVE_WINDOWS */ + +/* Define to 1 if you need the lber.h header file even with ldap.h */ +/* #undef NEED_LBER_H */ + +/* Define to 1 if you need the malloc.h header file even with stdlib.h */ +/* #undef NEED_MALLOC_H */ + +/* Define to 1 if you need the memory.h header file even with stdlib.h */ +/* #undef NEED_MEMORY_H */ + +/* Define to 1 if _REENTRANT preprocessor symbol must be defined. */ +/* #undef NEED_REENTRANT */ + +/* Define to 1 if _THREAD_SAFE preprocessor symbol must be defined. */ +/* #undef NEED_THREAD_SAFE */ + +/* cpu-machine-OS */ +#define OS "arm-unknown-eabi" + +/* Name of package */ +#define PACKAGE "curl" + +/* Define to the address where bug reports for this package should be sent. */ +#define PACKAGE_BUGREPORT "a suitable curl mailing list: http://curl.haxx.se/mail/" + +/* Define to the full name of this package. */ +#define PACKAGE_NAME "curl" + +/* Define to the full name and version of this package. */ +#define PACKAGE_STRING "curl -" + +/* Define to the one symbol short name of this package. */ +#define PACKAGE_TARNAME "curl" + +/* Define to the home page for this package. */ +#define PACKAGE_URL "" + +/* Define to the version of this package. */ +#define PACKAGE_VERSION "-" + +/* a suitable file to read random data from */ +/* #undef RANDOM_FILE */ + +/* Define to the type of arg 1 for recvfrom. */ +/* #undef RECVFROM_TYPE_ARG1 */ + +/* Define to the type pointed by arg 2 for recvfrom. */ +/* #undef RECVFROM_TYPE_ARG2 */ + +/* Define to 1 if the type pointed by arg 2 for recvfrom is void. */ +/* #undef RECVFROM_TYPE_ARG2_IS_VOID */ + +/* Define to the type of arg 3 for recvfrom. */ +/* #undef RECVFROM_TYPE_ARG3 */ + +/* Define to the type of arg 4 for recvfrom. */ +/* #undef RECVFROM_TYPE_ARG4 */ + +/* Define to the type pointed by arg 5 for recvfrom. */ +/* #undef RECVFROM_TYPE_ARG5 */ + +/* Define to 1 if the type pointed by arg 5 for recvfrom is void. */ +/* #undef RECVFROM_TYPE_ARG5_IS_VOID */ + +/* Define to the type pointed by arg 6 for recvfrom. */ +/* #undef RECVFROM_TYPE_ARG6 */ + +/* Define to 1 if the type pointed by arg 6 for recvfrom is void. */ +/* #undef RECVFROM_TYPE_ARG6_IS_VOID */ + +/* Define to the function return type for recvfrom. */ +/* #undef RECVFROM_TYPE_RETV */ + +/* Define to the type of arg 1 for recv. */ +#define RECV_TYPE_ARG1 int + +/* Define to the type of arg 2 for recv. */ +#define RECV_TYPE_ARG2 void * + +/* Define to the type of arg 3 for recv. */ +#define RECV_TYPE_ARG3 size_t + +/* Define to the type of arg 4 for recv. */ +#define RECV_TYPE_ARG4 unsigned int + +/* Define to the function return type for recv. */ +#define RECV_TYPE_RETV ssize_t + +/* Define as the return type of signal handlers (`int' or `void'). */ +#define RETSIGTYPE void + +/* Define to the type qualifier of arg 5 for select. */ +#define SELECT_QUAL_ARG5 + +/* Define to the type of arg 1 for select. */ +#define SELECT_TYPE_ARG1 int + +/* Define to the type of args 2, 3 and 4 for select. */ +#define SELECT_TYPE_ARG234 fd_set * + +/* Define to the type of arg 5 for select. */ +#define SELECT_TYPE_ARG5 struct timeval * + +/* Define to the function return type for select. */ +#define SELECT_TYPE_RETV int + +/* Define to the type qualifier of arg 2 for send. */ +#define SEND_QUAL_ARG2 const + +/* Define to the type of arg 1 for send. */ +#define SEND_TYPE_ARG1 int + +/* Define to the type of arg 2 for send. */ +#define SEND_TYPE_ARG2 void * + +/* Define to the type of arg 3 for send. */ +#define SEND_TYPE_ARG3 size_t + +/* Define to the type of arg 4 for send. */ +#define SEND_TYPE_ARG4 unsigned int + +/* Define to the function return type for send. */ +#define SEND_TYPE_RETV ssize_t + +/* The size of `int', as computed by sizeof. */ +#define SIZEOF_INT 4 + +/* The size of `long', as computed by sizeof. */ +#define SIZEOF_LONG 4 + +/* The size of `off_t', as computed by sizeof. */ +#define SIZEOF_OFF_T 4 + +/* The size of `short', as computed by sizeof. */ +#define SIZEOF_SHORT 2 + +/* The size of `size_t', as computed by sizeof. */ +#define SIZEOF_SIZE_T 4 + +/* The size of `time_t', as computed by sizeof. */ +#define SIZEOF_TIME_T 4 + +/* The size of `void*', as computed by sizeof. */ +#define SIZEOF_VOIDP 4 + +/* Define to 1 if you have the ANSI C header files. */ +#define STDC_HEADERS 1 + +/* Define to the type of arg 3 for strerror_r. */ +#define STRERROR_R_TYPE_ARG3 size_t + +/* Define to 1 if you can safely include both and . */ +#define TIME_WITH_SYS_TIME 1 + +/* Define to enable c-ares support */ +/* #undef USE_ARES */ + +/* Define to disable non-blocking sockets. */ +/* #undef USE_BLOCKING_SOCKETS */ + +/* if GnuTLS is enabled */ +/* #undef USE_GNUTLS */ + +/* if librtmp is in use */ +/* #undef USE_LIBRTMP */ + +/* if libSSH2 is in use */ +/* #undef USE_LIBSSH2 */ + +/* If you want to build curl with the built-in manual */ +/* #undef USE_MANUAL */ + +/* if NSS is enabled */ +/* #undef USE_NSS */ + +/* Use OpenLDAP-specific code */ +/* #undef USE_OPENLDAP */ + +/* if OpenSSL is in use */ +#define USE_OPENSSL 1 + +/* if PolarSSL is enabled */ +/* #undef USE_POLARSSL */ + +/* if SSL is enabled */ +#define USE_SSLEAY 1 + +/* if you want POSIX threaded DNS lookup */ +/* #undef USE_THREADS_POSIX */ + +/* Define to 1 if you are building a Windows target without large file + support. */ +/* #undef USE_WIN32_LARGE_FILES */ + +/* to enable SSPI support */ +/* #undef USE_WINDOWS_SSPI */ + +/* Define to 1 if using yaSSL in OpenSSL compatibility mode. */ +/* #undef USE_YASSLEMUL */ + +/* Version number of package */ +#define VERSION "7.21.3" + +/* Define to avoid automatic inclusion of winsock.h */ +/* #undef WIN32_LEAN_AND_MEAN */ + +/* Define to 1 if OS is AIX. */ +#ifndef _ALL_SOURCE +/* # undef _ALL_SOURCE */ +#endif + +/* Number of bits in a file offset, on hosts where this is settable. */ +/* #undef _FILE_OFFSET_BITS */ + +/* Define for large files, on AIX-style hosts. */ +/* #undef _LARGE_FILES */ + +/* Define to empty if `const' does not conform to ANSI C. */ +/* #undef const */ + +/* Type to use in place of in_addr_t when system does not provide it. */ +/* #undef in_addr_t */ + +/* Define to `__inline__' or `__inline' if that's what the C compiler + calls it, or to nothing if 'inline' is not supported under any name. */ +#ifndef __cplusplus +/* #undef inline */ +#endif + +/* Define to `unsigned int' if does not define. */ +/* #undef size_t */ + +/* the signed version of size_t */ +/* #undef ssize_t */ diff --git a/mobicore/common/curl/lib/curl_config.h.cmake b/mobicore/common/curl/lib/curl_config.h.cmake new file mode 100644 index 0000000000000000000000000000000000000000..deebe71dc38f51ceef670425c22c92873d69f5ef --- /dev/null +++ b/mobicore/common/curl/lib/curl_config.h.cmake @@ -0,0 +1,953 @@ +/* lib/curl_config.h.in. Generated from configure.ac by autoheader. */ + +/* Define to 1 if you have the $func function. */ +#cmakedefine AS_TR_CPP ${AS_TR_CPP} + +/* when building libcurl itself */ +#cmakedefine BUILDING_LIBCURL ${BUILDING_LIBCURL} + +/* Location of default ca bundle */ +#cmakedefine CURL_CA_BUNDLE ${CURL_CA_BUNDLE} + +/* Location of default ca path */ +#cmakedefine CURL_CA_PATH ${CURL_CA_PATH} + +/* to disable cookies support */ +#cmakedefine CURL_DISABLE_COOKIES ${CURL_DISABLE_COOKIES} + +/* to disable cryptographic authentication */ +#cmakedefine CURL_DISABLE_CRYPTO_AUTH ${CURL_DISABLE_CRYPTO_AUTH} + +/* to disable DICT */ +#cmakedefine CURL_DISABLE_DICT ${CURL_DISABLE_DICT} + +/* to disable FILE */ +#cmakedefine CURL_DISABLE_FILE ${CURL_DISABLE_FILE} + +/* to disable FTP */ +#cmakedefine CURL_DISABLE_FTP ${CURL_DISABLE_FTP} + +/* to disable HTTP */ +#cmakedefine CURL_DISABLE_HTTP ${CURL_DISABLE_HTTP} + +/* to disable LDAP */ +#cmakedefine CURL_DISABLE_LDAP ${CURL_DISABLE_LDAP} + +/* to disable LDAPS */ +#cmakedefine CURL_DISABLE_LDAPS ${CURL_DISABLE_LDAPS} + +/* to disable proxies */ +#cmakedefine CURL_DISABLE_PROXY ${CURL_DISABLE_PROXY} + +/* to disable TELNET */ +#cmakedefine CURL_DISABLE_TELNET ${CURL_DISABLE_TELNET} + +/* to disable TFTP */ +#cmakedefine CURL_DISABLE_TFTP ${CURL_DISABLE_TFTP} + +/* to disable verbose strings */ +#cmakedefine CURL_DISABLE_VERBOSE_STRINGS ${CURL_DISABLE_VERBOSE_STRINGS} + +/* to make a symbol visible */ +#cmakedefine CURL_EXTERN_SYMBOL ${CURL_EXTERN_SYMBOL} +/* Ensure using CURL_EXTERN_SYMBOL is possible */ +#ifndef CURL_EXTERN_SYMBOL +#define CURL_EXTERN_SYMBOL +#endif + +/* to enable hidden symbols */ +#cmakedefine CURL_HIDDEN_SYMBOLS ${CURL_HIDDEN_SYMBOLS} + +/* Use Windows LDAP implementation */ +#cmakedefine CURL_LDAP_WIN ${CURL_LDAP_WIN} + +/* when not building a shared library */ +#cmakedefine CURL_STATICLIB ${CURL_STATICLIB} + +/* Set to explicitly specify we don't want to use thread-safe functions */ +#cmakedefine DISABLED_THREADSAFE ${DISABLED_THREADSAFE} + +/* your Entropy Gathering Daemon socket pathname */ +#cmakedefine EGD_SOCKET ${EGD_SOCKET} + +/* Define if you want to enable IPv6 support */ +#cmakedefine ENABLE_IPV6 ${ENABLE_IPV6} + +/* Define to the type qualifier of arg 1 for getnameinfo. */ +#cmakedefine GETNAMEINFO_QUAL_ARG1 ${GETNAMEINFO_QUAL_ARG1} + +/* Define to the type of arg 1 for getnameinfo. */ +#cmakedefine GETNAMEINFO_TYPE_ARG1 ${GETNAMEINFO_TYPE_ARG1} + +/* Define to the type of arg 2 for getnameinfo. */ +#cmakedefine GETNAMEINFO_TYPE_ARG2 ${GETNAMEINFO_TYPE_ARG2} + +/* Define to the type of args 4 and 6 for getnameinfo. */ +#cmakedefine GETNAMEINFO_TYPE_ARG46 ${GETNAMEINFO_TYPE_ARG46} + +/* Define to the type of arg 7 for getnameinfo. */ +#cmakedefine GETNAMEINFO_TYPE_ARG7 ${GETNAMEINFO_TYPE_ARG7} + +/* Specifies the number of arguments to getservbyport_r */ +#cmakedefine GETSERVBYPORT_R_ARGS ${GETSERVBYPORT_R_ARGS} + +/* Specifies the size of the buffer to pass to getservbyport_r */ +#cmakedefine GETSERVBYPORT_R_BUFSIZE ${GETSERVBYPORT_R_BUFSIZE} + +/* Define to 1 if you have the alarm function. */ +#cmakedefine HAVE_ALARM ${HAVE_ALARM} + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_ALLOCA_H ${HAVE_ALLOCA_H} + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_ARPA_INET_H ${HAVE_ARPA_INET_H} + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_ARPA_TFTP_H ${HAVE_ARPA_TFTP_H} + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_ASSERT_H ${HAVE_ASSERT_H} + +/* Define to 1 if you have the `basename' function. */ +#cmakedefine HAVE_BASENAME ${HAVE_BASENAME} + +/* Define to 1 if bool is an available type. */ +#cmakedefine HAVE_BOOL_T ${HAVE_BOOL_T} + +/* Define to 1 if you have the clock_gettime function and monotonic timer. */ +#cmakedefine HAVE_CLOCK_GETTIME_MONOTONIC ${HAVE_CLOCK_GETTIME_MONOTONIC} + +/* Define to 1 if you have the `closesocket' function. */ +#cmakedefine HAVE_CLOSESOCKET ${HAVE_CLOSESOCKET} + +/* Define to 1 if you have the `CRYPTO_cleanup_all_ex_data' function. */ +#cmakedefine HAVE_CRYPTO_CLEANUP_ALL_EX_DATA ${HAVE_CRYPTO_CLEANUP_ALL_EX_DATA} + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_CRYPTO_H ${HAVE_CRYPTO_H} + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_DES_H ${HAVE_DES_H} + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_DLFCN_H ${HAVE_DLFCN_H} + +/* Define to 1 if you have the `ENGINE_load_builtin_engines' function. */ +#cmakedefine HAVE_ENGINE_LOAD_BUILTIN_ENGINES ${HAVE_ENGINE_LOAD_BUILTIN_ENGINES} + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_ERRNO_H ${HAVE_ERRNO_H} + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_ERR_H ${HAVE_ERR_H} + +/* Define to 1 if you have the fcntl function. */ +#cmakedefine HAVE_FCNTL ${HAVE_FCNTL} + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_FCNTL_H ${HAVE_FCNTL_H} + +/* Define to 1 if you have a working fcntl O_NONBLOCK function. */ +#cmakedefine HAVE_FCNTL_O_NONBLOCK ${HAVE_FCNTL_O_NONBLOCK} + +/* Define to 1 if you have the fdopen function. */ +#cmakedefine HAVE_FDOPEN ${HAVE_FDOPEN} + +/* Define to 1 if you have the `fork' function. */ +#cmakedefine HAVE_FORK ${HAVE_FORK} + +/* Define to 1 if you have the freeaddrinfo function. */ +#cmakedefine HAVE_FREEADDRINFO ${HAVE_FREEADDRINFO} + +/* Define to 1 if you have the freeifaddrs function. */ +#cmakedefine HAVE_FREEIFADDRS ${HAVE_FREEIFADDRS} + +/* Define to 1 if you have the ftruncate function. */ +#cmakedefine HAVE_FTRUNCATE ${HAVE_FTRUNCATE} + +/* Define to 1 if you have a working getaddrinfo function. */ +#cmakedefine HAVE_GETADDRINFO ${HAVE_GETADDRINFO} + +/* Define to 1 if you have the `geteuid' function. */ +#cmakedefine HAVE_GETEUID ${HAVE_GETEUID} + +/* Define to 1 if you have the gethostbyaddr function. */ +#cmakedefine HAVE_GETHOSTBYADDR ${HAVE_GETHOSTBYADDR} + +/* Define to 1 if you have the gethostbyaddr_r function. */ +#cmakedefine HAVE_GETHOSTBYADDR_R ${HAVE_GETHOSTBYADDR_R} + +/* gethostbyaddr_r() takes 5 args */ +#cmakedefine HAVE_GETHOSTBYADDR_R_5 ${HAVE_GETHOSTBYADDR_R_5} + +/* gethostbyaddr_r() takes 7 args */ +#cmakedefine HAVE_GETHOSTBYADDR_R_7 ${HAVE_GETHOSTBYADDR_R_7} + +/* gethostbyaddr_r() takes 8 args */ +#cmakedefine HAVE_GETHOSTBYADDR_R_8 ${HAVE_GETHOSTBYADDR_R_8} + +/* Define to 1 if you have the gethostbyname function. */ +#cmakedefine HAVE_GETHOSTBYNAME ${HAVE_GETHOSTBYNAME} + +/* Define to 1 if you have the gethostbyname_r function. */ +#cmakedefine HAVE_GETHOSTBYNAME_R ${HAVE_GETHOSTBYNAME_R} + +/* gethostbyname_r() takes 3 args */ +#cmakedefine HAVE_GETHOSTBYNAME_R_3 ${HAVE_GETHOSTBYNAME_R_3} + +/* gethostbyname_r() takes 5 args */ +#cmakedefine HAVE_GETHOSTBYNAME_R_5 ${HAVE_GETHOSTBYNAME_R_5} + +/* gethostbyname_r() takes 6 args */ +#cmakedefine HAVE_GETHOSTBYNAME_R_6 ${HAVE_GETHOSTBYNAME_R_6} + +/* Define to 1 if you have the gethostname function. */ +#cmakedefine HAVE_GETHOSTNAME ${HAVE_GETHOSTNAME} + +/* Define to 1 if you have a working getifaddrs function. */ +#cmakedefine HAVE_GETIFADDRS ${HAVE_GETIFADDRS} + +/* Define to 1 if you have the getnameinfo function. */ +#cmakedefine HAVE_GETNAMEINFO ${HAVE_GETNAMEINFO} + +/* Define to 1 if you have the `getpass_r' function. */ +#cmakedefine HAVE_GETPASS_R ${HAVE_GETPASS_R} + +/* Define to 1 if you have the `getppid' function. */ +#cmakedefine HAVE_GETPPID ${HAVE_GETPPID} + +/* Define to 1 if you have the `getprotobyname' function. */ +#cmakedefine HAVE_GETPROTOBYNAME ${HAVE_GETPROTOBYNAME} + +/* Define to 1 if you have the `getpwuid' function. */ +#cmakedefine HAVE_GETPWUID ${HAVE_GETPWUID} + +/* Define to 1 if you have the `getrlimit' function. */ +#cmakedefine HAVE_GETRLIMIT ${HAVE_GETRLIMIT} + +/* Define to 1 if you have the getservbyport_r function. */ +#cmakedefine HAVE_GETSERVBYPORT_R ${HAVE_GETSERVBYPORT_R} + +/* Define to 1 if you have the `gettimeofday' function. */ +#cmakedefine HAVE_GETTIMEOFDAY ${HAVE_GETTIMEOFDAY} + +/* Define to 1 if you have a working glibc-style strerror_r function. */ +#cmakedefine HAVE_GLIBC_STRERROR_R ${HAVE_GLIBC_STRERROR_R} + +/* Define to 1 if you have a working gmtime_r function. */ +#cmakedefine HAVE_GMTIME_R ${HAVE_GMTIME_R} + +/* if you have the gssapi libraries */ +#cmakedefine HAVE_GSSAPI ${HAVE_GSSAPI} + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_GSSAPI_GSSAPI_GENERIC_H ${HAVE_GSSAPI_GSSAPI_GENERIC_H} + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_GSSAPI_GSSAPI_H ${HAVE_GSSAPI_GSSAPI_H} + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_GSSAPI_GSSAPI_KRB5_H ${HAVE_GSSAPI_GSSAPI_KRB5_H} + +/* if you have the GNU gssapi libraries */ +#cmakedefine HAVE_GSSGNU ${HAVE_GSSGNU} + +/* if you have the Heimdal gssapi libraries */ +#cmakedefine HAVE_GSSHEIMDAL ${HAVE_GSSHEIMDAL} + +/* if you have the MIT gssapi libraries */ +#cmakedefine HAVE_GSSMIT ${HAVE_GSSMIT} + +/* Define to 1 if you have the `idna_strerror' function. */ +#cmakedefine HAVE_IDNA_STRERROR ${HAVE_IDNA_STRERROR} + +/* Define to 1 if you have the `idn_free' function. */ +#cmakedefine HAVE_IDN_FREE ${HAVE_IDN_FREE} + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_IDN_FREE_H ${HAVE_IDN_FREE_H} + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_IFADDRS_H ${HAVE_IFADDRS_H} + +/* Define to 1 if you have the `inet_addr' function. */ +#cmakedefine HAVE_INET_ADDR ${HAVE_INET_ADDR} + +/* Define to 1 if you have the inet_ntoa_r function. */ +#cmakedefine HAVE_INET_NTOA_R ${HAVE_INET_NTOA_R} + +/* inet_ntoa_r() takes 2 args */ +#cmakedefine HAVE_INET_NTOA_R_2 ${HAVE_INET_NTOA_R_2} + +/* inet_ntoa_r() takes 3 args */ +#cmakedefine HAVE_INET_NTOA_R_3 ${HAVE_INET_NTOA_R_3} + +/* Define to 1 if you have a IPv6 capable working inet_ntop function. */ +#cmakedefine HAVE_INET_NTOP ${HAVE_INET_NTOP} + +/* Define to 1 if you have a IPv6 capable working inet_pton function. */ +#cmakedefine HAVE_INET_PTON ${HAVE_INET_PTON} + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_INTTYPES_H ${HAVE_INTTYPES_H} + +/* Define to 1 if you have the ioctl function. */ +#cmakedefine HAVE_IOCTL ${HAVE_IOCTL} + +/* Define to 1 if you have the ioctlsocket function. */ +#cmakedefine HAVE_IOCTLSOCKET ${HAVE_IOCTLSOCKET} + +/* Define to 1 if you have the IoctlSocket camel case function. */ +#cmakedefine HAVE_IOCTLSOCKET_CAMEL ${HAVE_IOCTLSOCKET_CAMEL} + +/* Define to 1 if you have a working IoctlSocket camel case FIONBIO function. + */ +#cmakedefine HAVE_IOCTLSOCKET_CAMEL_FIONBIO ${HAVE_IOCTLSOCKET_CAMEL_FIONBIO} + +/* Define to 1 if you have a working ioctlsocket FIONBIO function. */ +#cmakedefine HAVE_IOCTLSOCKET_FIONBIO ${HAVE_IOCTLSOCKET_FIONBIO} + +/* Define to 1 if you have a working ioctl FIONBIO function. */ +#cmakedefine HAVE_IOCTL_FIONBIO ${HAVE_IOCTL_FIONBIO} + +/* Define to 1 if you have a working ioctl SIOCGIFADDR function. */ +#cmakedefine HAVE_IOCTL_SIOCGIFADDR ${HAVE_IOCTL_SIOCGIFADDR} + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_IO_H ${HAVE_IO_H} + +/* if you have the Kerberos4 libraries (including -ldes) */ +#cmakedefine HAVE_KRB4 ${HAVE_KRB4} + +/* Define to 1 if you have the `krb_get_our_ip_for_realm' function. */ +#cmakedefine HAVE_KRB_GET_OUR_IP_FOR_REALM ${HAVE_KRB_GET_OUR_IP_FOR_REALM} + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_KRB_H ${HAVE_KRB_H} + +/* Define to 1 if you have the lber.h header file. */ +#cmakedefine HAVE_LBER_H ${HAVE_LBER_H} + +/* Define to 1 if you have the ldapssl.h header file. */ +#cmakedefine HAVE_LDAPSSL_H ${HAVE_LDAPSSL_H} + +/* Define to 1 if you have the ldap.h header file. */ +#cmakedefine HAVE_LDAP_H ${HAVE_LDAP_H} + +/* Use LDAPS implementation */ +#cmakedefine HAVE_LDAP_SSL ${HAVE_LDAP_SSL} + +/* Define to 1 if you have the ldap_ssl.h header file. */ +#cmakedefine HAVE_LDAP_SSL_H ${HAVE_LDAP_SSL_H} + +/* Define to 1 if you have the `ldap_url_parse' function. */ +#cmakedefine HAVE_LDAP_URL_PARSE ${HAVE_LDAP_URL_PARSE} + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_LIBGEN_H ${HAVE_LIBGEN_H} + +/* Define to 1 if you have the `idn' library (-lidn). */ +#cmakedefine HAVE_LIBIDN ${HAVE_LIBIDN} + +/* Define to 1 if you have the `resolv' library (-lresolv). */ +#cmakedefine HAVE_LIBRESOLV ${HAVE_LIBRESOLV} + +/* Define to 1 if you have the `resolve' library (-lresolve). */ +#cmakedefine HAVE_LIBRESOLVE ${HAVE_LIBRESOLVE} + +/* Define to 1 if you have the `socket' library (-lsocket). */ +#cmakedefine HAVE_LIBSOCKET ${HAVE_LIBSOCKET} + +/* Define to 1 if you have the `ssh2' library (-lssh2). */ +#cmakedefine HAVE_LIBSSH2 ${HAVE_LIBSSH2} + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_LIBSSH2_H ${HAVE_LIBSSH2_H} + +/* Define to 1 if you have the `ssl' library (-lssl). */ +#cmakedefine HAVE_LIBSSL ${HAVE_LIBSSL} + +/* if zlib is available */ +#cmakedefine HAVE_LIBZ ${HAVE_LIBZ} + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_LIMITS_H ${HAVE_LIMITS_H} + +/* if your compiler supports LL */ +#cmakedefine HAVE_LL ${HAVE_LL} + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_LOCALE_H ${HAVE_LOCALE_H} + +/* Define to 1 if you have a working localtime_r function. */ +#cmakedefine HAVE_LOCALTIME_R ${HAVE_LOCALTIME_R} + +/* Define to 1 if the compiler supports the 'long long' data type. */ +#cmakedefine HAVE_LONGLONG ${HAVE_LONGLONG} + +/* Define to 1 if you have the malloc.h header file. */ +#cmakedefine HAVE_MALLOC_H ${HAVE_MALLOC_H} + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_MEMORY_H ${HAVE_MEMORY_H} + +/* Define to 1 if you have the MSG_NOSIGNAL flag. */ +#cmakedefine HAVE_MSG_NOSIGNAL ${HAVE_MSG_NOSIGNAL} + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_NETDB_H ${HAVE_NETDB_H} + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_NETINET_IN_H ${HAVE_NETINET_IN_H} + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_NETINET_TCP_H ${HAVE_NETINET_TCP_H} + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_NET_IF_H ${HAVE_NET_IF_H} + +/* Define to 1 if NI_WITHSCOPEID exists and works. */ +#cmakedefine HAVE_NI_WITHSCOPEID ${HAVE_NI_WITHSCOPEID} + +/* if you have an old MIT gssapi library, lacking GSS_C_NT_HOSTBASED_SERVICE + */ +#cmakedefine HAVE_OLD_GSSMIT ${HAVE_OLD_GSSMIT} + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_OPENSSL_CRYPTO_H ${HAVE_OPENSSL_CRYPTO_H} + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_OPENSSL_ENGINE_H ${HAVE_OPENSSL_ENGINE_H} + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_OPENSSL_ERR_H ${HAVE_OPENSSL_ERR_H} + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_OPENSSL_PEM_H ${HAVE_OPENSSL_PEM_H} + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_OPENSSL_PKCS12_H ${HAVE_OPENSSL_PKCS12_H} + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_OPENSSL_RSA_H ${HAVE_OPENSSL_RSA_H} + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_OPENSSL_SSL_H ${HAVE_OPENSSL_SSL_H} + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_OPENSSL_X509_H ${HAVE_OPENSSL_X509_H} + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_PEM_H ${HAVE_PEM_H} + +/* Define to 1 if you have the `perror' function. */ +#cmakedefine HAVE_PERROR ${HAVE_PERROR} + +/* Define to 1 if you have the `pipe' function. */ +#cmakedefine HAVE_PIPE ${HAVE_PIPE} + +/* if you have the function PK11_CreateGenericObject */ +#cmakedefine HAVE_PK11_CREATEGENERICOBJECT ${HAVE_PK11_CREATEGENERICOBJECT} + +/* Define to 1 if you have a working poll function. */ +#cmakedefine HAVE_POLL ${HAVE_POLL} + +/* If you have a fine poll */ +#cmakedefine HAVE_POLL_FINE ${HAVE_POLL_FINE} + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_POLL_H ${HAVE_POLL_H} + +/* Define to 1 if you have a working POSIX-style strerror_r function. */ +#cmakedefine HAVE_POSIX_STRERROR_R ${HAVE_POSIX_STRERROR_R} + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_PWD_H ${HAVE_PWD_H} + +/* Define to 1 if you have the `RAND_egd' function. */ +#cmakedefine HAVE_RAND_EGD ${HAVE_RAND_EGD} + +/* Define to 1 if you have the `RAND_screen' function. */ +#cmakedefine HAVE_RAND_SCREEN ${HAVE_RAND_SCREEN} + +/* Define to 1 if you have the `RAND_status' function. */ +#cmakedefine HAVE_RAND_STATUS ${HAVE_RAND_STATUS} + +/* Define to 1 if you have the recv function. */ +#cmakedefine HAVE_RECV ${HAVE_RECV} + +/* Define to 1 if you have the recvfrom function. */ +#cmakedefine HAVE_RECVFROM ${HAVE_RECVFROM} + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_RSA_H ${HAVE_RSA_H} + +/* Define to 1 if you have the select function. */ +#cmakedefine HAVE_SELECT ${HAVE_SELECT} + +/* Define to 1 if you have the send function. */ +#cmakedefine HAVE_SEND ${HAVE_SEND} + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_SETJMP_H ${HAVE_SETJMP_H} + +/* Define to 1 if you have the `setlocale' function. */ +#cmakedefine HAVE_SETLOCALE ${HAVE_SETLOCALE} + +/* Define to 1 if you have the `setmode' function. */ +#cmakedefine HAVE_SETMODE ${HAVE_SETMODE} + +/* Define to 1 if you have the `setrlimit' function. */ +#cmakedefine HAVE_SETRLIMIT ${HAVE_SETRLIMIT} + +/* Define to 1 if you have the setsockopt function. */ +#cmakedefine HAVE_SETSOCKOPT ${HAVE_SETSOCKOPT} + +/* Define to 1 if you have a working setsockopt SO_NONBLOCK function. */ +#cmakedefine HAVE_SETSOCKOPT_SO_NONBLOCK ${HAVE_SETSOCKOPT_SO_NONBLOCK} + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_SGTTY_H ${HAVE_SGTTY_H} + +/* Define to 1 if you have the sigaction function. */ +#cmakedefine HAVE_SIGACTION ${HAVE_SIGACTION} + +/* Define to 1 if you have the siginterrupt function. */ +#cmakedefine HAVE_SIGINTERRUPT ${HAVE_SIGINTERRUPT} + +/* Define to 1 if you have the signal function. */ +#cmakedefine HAVE_SIGNAL ${HAVE_SIGNAL} + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_SIGNAL_H ${HAVE_SIGNAL_H} + +/* Define to 1 if you have the sigsetjmp function or macro. */ +#cmakedefine HAVE_SIGSETJMP ${HAVE_SIGSETJMP} + +/* Define to 1 if sig_atomic_t is an available typedef. */ +#cmakedefine HAVE_SIG_ATOMIC_T ${HAVE_SIG_ATOMIC_T} + +/* Define to 1 if sig_atomic_t is already defined as volatile. */ +#cmakedefine HAVE_SIG_ATOMIC_T_VOLATILE ${HAVE_SIG_ATOMIC_T_VOLATILE} + +/* Define to 1 if struct sockaddr_in6 has the sin6_scope_id member */ +#cmakedefine HAVE_SOCKADDR_IN6_SIN6_SCOPE_ID ${HAVE_SOCKADDR_IN6_SIN6_SCOPE_ID} + +/* Define to 1 if you have the `socket' function. */ +#cmakedefine HAVE_SOCKET ${HAVE_SOCKET} + +/* Define this if you have the SPNEGO library fbopenssl */ +#cmakedefine HAVE_SPNEGO ${HAVE_SPNEGO} + +/* Define to 1 if you have the `SSL_get_shutdown' function. */ +#cmakedefine HAVE_SSL_GET_SHUTDOWN ${HAVE_SSL_GET_SHUTDOWN} + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_SSL_H ${HAVE_SSL_H} + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_STDBOOL_H ${HAVE_STDBOOL_H} + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_STDINT_H ${HAVE_STDINT_H} + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_STDIO_H ${HAVE_STDIO_H} + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_STDLIB_H ${HAVE_STDLIB_H} + +/* Define to 1 if you have the strcasecmp function. */ +#cmakedefine HAVE_STRCASECMP ${HAVE_STRCASECMP} + +/* Define to 1 if you have the strcasestr function. */ +#cmakedefine HAVE_STRCASESTR ${HAVE_STRCASESTR} + +/* Define to 1 if you have the strcmpi function. */ +#cmakedefine HAVE_STRCMPI ${HAVE_STRCMPI} + +/* Define to 1 if you have the strdup function. */ +#cmakedefine HAVE_STRDUP ${HAVE_STRDUP} + +/* Define to 1 if you have the strerror_r function. */ +#cmakedefine HAVE_STRERROR_R ${HAVE_STRERROR_R} + +/* Define to 1 if you have the stricmp function. */ +#cmakedefine HAVE_STRICMP ${HAVE_STRICMP} + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_STRINGS_H ${HAVE_STRINGS_H} + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_STRING_H ${HAVE_STRING_H} + +/* Define to 1 if you have the strlcat function. */ +#cmakedefine HAVE_STRLCAT ${HAVE_STRLCAT} + +/* Define to 1 if you have the `strlcpy' function. */ +#cmakedefine HAVE_STRLCPY ${HAVE_STRLCPY} + +/* Define to 1 if you have the strncasecmp function. */ +#cmakedefine HAVE_STRNCASECMP ${HAVE_STRNCASECMP} + +/* Define to 1 if you have the strncmpi function. */ +#cmakedefine HAVE_STRNCMPI ${HAVE_STRNCMPI} + +/* Define to 1 if you have the strnicmp function. */ +#cmakedefine HAVE_STRNICMP ${HAVE_STRNICMP} + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_STROPTS_H ${HAVE_STROPTS_H} + +/* Define to 1 if you have the strstr function. */ +#cmakedefine HAVE_STRSTR ${HAVE_STRSTR} + +/* Define to 1 if you have the strtok_r function. */ +#cmakedefine HAVE_STRTOK_R ${HAVE_STRTOK_R} + +/* Define to 1 if you have the strtoll function. */ +#cmakedefine HAVE_STRTOLL ${HAVE_STRTOLL} + +/* if struct sockaddr_storage is defined */ +#cmakedefine HAVE_STRUCT_SOCKADDR_STORAGE ${HAVE_STRUCT_SOCKADDR_STORAGE} + +/* Define to 1 if you have the timeval struct. */ +#cmakedefine HAVE_STRUCT_TIMEVAL ${HAVE_STRUCT_TIMEVAL} + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_SYS_FILIO_H ${HAVE_SYS_FILIO_H} + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_SYS_IOCTL_H ${HAVE_SYS_IOCTL_H} + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_SYS_PARAM_H ${HAVE_SYS_PARAM_H} + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_SYS_POLL_H ${HAVE_SYS_POLL_H} + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_SYS_RESOURCE_H ${HAVE_SYS_RESOURCE_H} + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_SYS_SELECT_H ${HAVE_SYS_SELECT_H} + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_SYS_SOCKET_H ${HAVE_SYS_SOCKET_H} + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_SYS_SOCKIO_H ${HAVE_SYS_SOCKIO_H} + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_SYS_STAT_H ${HAVE_SYS_STAT_H} + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_SYS_TIME_H ${HAVE_SYS_TIME_H} + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_SYS_TYPES_H ${HAVE_SYS_TYPES_H} + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_SYS_UIO_H ${HAVE_SYS_UIO_H} + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_SYS_UN_H ${HAVE_SYS_UN_H} + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_SYS_UTIME_H ${HAVE_SYS_UTIME_H} + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_TERMIOS_H ${HAVE_TERMIOS_H} + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_TERMIO_H ${HAVE_TERMIO_H} + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_TIME_H ${HAVE_TIME_H} + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_TLD_H ${HAVE_TLD_H} + +/* Define to 1 if you have the `tld_strerror' function. */ +#cmakedefine HAVE_TLD_STRERROR ${HAVE_TLD_STRERROR} + +/* Define to 1 if you have the `uname' function. */ +#cmakedefine HAVE_UNAME ${HAVE_UNAME} + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_UNISTD_H ${HAVE_UNISTD_H} + +/* Define to 1 if you have the `utime' function. */ +#cmakedefine HAVE_UTIME ${HAVE_UTIME} + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_UTIME_H ${HAVE_UTIME_H} + +/* Define to 1 if compiler supports C99 variadic macro style. */ +#cmakedefine HAVE_VARIADIC_MACROS_C99 ${HAVE_VARIADIC_MACROS_C99} + +/* Define to 1 if compiler supports old gcc variadic macro style. */ +#cmakedefine HAVE_VARIADIC_MACROS_GCC ${HAVE_VARIADIC_MACROS_GCC} + +/* Define to 1 if you have the winber.h header file. */ +#cmakedefine HAVE_WINBER_H ${HAVE_WINBER_H} + +/* Define to 1 if you have the windows.h header file. */ +#cmakedefine HAVE_WINDOWS_H ${HAVE_WINDOWS_H} + +/* Define to 1 if you have the winldap.h header file. */ +#cmakedefine HAVE_WINLDAP_H ${HAVE_WINLDAP_H} + +/* Define to 1 if you have the winsock2.h header file. */ +#cmakedefine HAVE_WINSOCK2_H ${HAVE_WINSOCK2_H} + +/* Define to 1 if you have the winsock.h header file. */ +#cmakedefine HAVE_WINSOCK_H ${HAVE_WINSOCK_H} + +/* Define this symbol if your OS supports changing the contents of argv */ +#cmakedefine HAVE_WRITABLE_ARGV ${HAVE_WRITABLE_ARGV} + +/* Define to 1 if you have the writev function. */ +#cmakedefine HAVE_WRITEV ${HAVE_WRITEV} + +/* Define to 1 if you have the ws2tcpip.h header file. */ +#cmakedefine HAVE_WS2TCPIP_H ${HAVE_WS2TCPIP_H} + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_X509_H ${HAVE_X509_H} + +/* Define if you have the header file. */ +#cmakedefine HAVE_PROCESS_H ${HAVE_PROCESS_H} + +/* if you have the zlib.h header file */ +#cmakedefine HAVE_ZLIB_H ${HAVE_ZLIB_H} + +/* Define to the sub-directory in which libtool stores uninstalled libraries. + */ +#cmakedefine LT_OBJDIR ${LT_OBJDIR} + +/* Define to 1 if you are building a native Windows target. */ +#cmakedefine NATIVE_WINDOWS ${NATIVE_WINDOWS} + +/* If you lack a fine basename() prototype */ +#cmakedefine NEED_BASENAME_PROTO ${NEED_BASENAME_PROTO} + +/* Define to 1 if you need the lber.h header file even with ldap.h */ +#cmakedefine NEED_LBER_H ${NEED_LBER_H} + +/* Define to 1 if you need the malloc.h header file even with stdlib.h */ +#cmakedefine NEED_MALLOC_H ${NEED_MALLOC_H} + +/* Define to 1 if _REENTRANT preprocessor symbol must be defined. */ +#cmakedefine NEED_REENTRANT ${NEED_REENTRANT} + +/* cpu-machine-OS */ +#cmakedefine OS ${OS} + +/* Name of package */ +#cmakedefine PACKAGE ${PACKAGE} + +/* Define to the address where bug reports for this package should be sent. */ +#cmakedefine PACKAGE_BUGREPORT ${PACKAGE_BUGREPORT} + +/* Define to the full name of this package. */ +#cmakedefine PACKAGE_NAME ${PACKAGE_NAME} + +/* Define to the full name and version of this package. */ +#cmakedefine PACKAGE_STRING ${PACKAGE_STRING} + +/* Define to the one symbol short name of this package. */ +#cmakedefine PACKAGE_TARNAME ${PACKAGE_TARNAME} + +/* Define to the version of this package. */ +#cmakedefine PACKAGE_VERSION ${PACKAGE_VERSION} + +/* a suitable file to read random data from */ +#cmakedefine RANDOM_FILE "${RANDOM_FILE}" + +/* Define to the type of arg 1 for recvfrom. */ +#cmakedefine RECVFROM_TYPE_ARG1 ${RECVFROM_TYPE_ARG1} + +/* Define to the type pointed by arg 2 for recvfrom. */ +#cmakedefine RECVFROM_TYPE_ARG2 ${RECVFROM_TYPE_ARG2} + +/* Define to 1 if the type pointed by arg 2 for recvfrom is void. */ +#cmakedefine RECVFROM_TYPE_ARG2_IS_VOID ${RECVFROM_TYPE_ARG2_IS_VOID} + +/* Define to the type of arg 3 for recvfrom. */ +#cmakedefine RECVFROM_TYPE_ARG3 ${RECVFROM_TYPE_ARG3} + +/* Define to the type of arg 4 for recvfrom. */ +#cmakedefine RECVFROM_TYPE_ARG4 ${RECVFROM_TYPE_ARG4} + +/* Define to the type pointed by arg 5 for recvfrom. */ +#cmakedefine RECVFROM_TYPE_ARG5 ${RECVFROM_TYPE_ARG5} + +/* Define to 1 if the type pointed by arg 5 for recvfrom is void. */ +#cmakedefine RECVFROM_TYPE_ARG5_IS_VOID ${RECVFROM_TYPE_ARG5_IS_VOID} + +/* Define to the type pointed by arg 6 for recvfrom. */ +#cmakedefine RECVFROM_TYPE_ARG6 ${RECVFROM_TYPE_ARG6} + +/* Define to 1 if the type pointed by arg 6 for recvfrom is void. */ +#cmakedefine RECVFROM_TYPE_ARG6_IS_VOID ${RECVFROM_TYPE_ARG6_IS_VOID} + +/* Define to the function return type for recvfrom. */ +#cmakedefine RECVFROM_TYPE_RETV ${RECVFROM_TYPE_RETV} + +/* Define to the type of arg 1 for recv. */ +#cmakedefine RECV_TYPE_ARG1 ${RECV_TYPE_ARG1} + +/* Define to the type of arg 2 for recv. */ +#cmakedefine RECV_TYPE_ARG2 ${RECV_TYPE_ARG2} + +/* Define to the type of arg 3 for recv. */ +#cmakedefine RECV_TYPE_ARG3 ${RECV_TYPE_ARG3} + +/* Define to the type of arg 4 for recv. */ +#cmakedefine RECV_TYPE_ARG4 ${RECV_TYPE_ARG4} + +/* Define to the function return type for recv. */ +#cmakedefine RECV_TYPE_RETV ${RECV_TYPE_RETV} + +/* Define as the return type of signal handlers (`int' or `void'). */ +#cmakedefine RETSIGTYPE ${RETSIGTYPE} + +/* Define to the type qualifier of arg 5 for select. */ +#cmakedefine SELECT_QUAL_ARG5 ${SELECT_QUAL_ARG5} + +/* Define to the type of arg 1 for select. */ +#cmakedefine SELECT_TYPE_ARG1 ${SELECT_TYPE_ARG1} + +/* Define to the type of args 2, 3 and 4 for select. */ +#cmakedefine SELECT_TYPE_ARG234 ${SELECT_TYPE_ARG234} + +/* Define to the type of arg 5 for select. */ +#cmakedefine SELECT_TYPE_ARG5 ${SELECT_TYPE_ARG5} + +/* Define to the function return type for select. */ +#cmakedefine SELECT_TYPE_RETV ${SELECT_TYPE_RETV} + +/* Define to the type qualifier of arg 2 for send. */ +#cmakedefine SEND_QUAL_ARG2 ${SEND_QUAL_ARG2} + +/* Define to the type of arg 1 for send. */ +#cmakedefine SEND_TYPE_ARG1 ${SEND_TYPE_ARG1} + +/* Define to the type of arg 2 for send. */ +#cmakedefine SEND_TYPE_ARG2 ${SEND_TYPE_ARG2} + +/* Define to the type of arg 3 for send. */ +#cmakedefine SEND_TYPE_ARG3 ${SEND_TYPE_ARG3} + +/* Define to the type of arg 4 for send. */ +#cmakedefine SEND_TYPE_ARG4 ${SEND_TYPE_ARG4} + +/* Define to the function return type for send. */ +#cmakedefine SEND_TYPE_RETV ${SEND_TYPE_RETV} + +/* The size of `int', as computed by sizeof. */ +#cmakedefine SIZEOF_INT ${SIZEOF_INT} + +/* The size of `short', as computed by sizeof. */ +#cmakedefine SIZEOF_SHORT ${SIZEOF_SHORT} + +/* The size of `long', as computed by sizeof. */ +#cmakedefine SIZEOF_LONG ${SIZEOF_LONG} + +/* The size of `off_t', as computed by sizeof. */ +#cmakedefine SIZEOF_OFF_T ${SIZEOF_OFF_T} + +/* The size of `size_t', as computed by sizeof. */ +#cmakedefine SIZEOF_SIZE_T ${SIZEOF_SIZE_T} + +/* The size of `time_t', as computed by sizeof. */ +#cmakedefine SIZEOF_TIME_T ${SIZEOF_TIME_T} + +/* The size of `void*', as computed by sizeof. */ +#cmakedefine SIZEOF_VOIDP ${SIZEOF_VOIDP} + +/* Define to 1 if you have the ANSI C header files. */ +#cmakedefine STDC_HEADERS ${STDC_HEADERS} + +/* Define to the type of arg 3 for strerror_r. */ +#cmakedefine STRERROR_R_TYPE_ARG3 ${STRERROR_R_TYPE_ARG3} + +/* Define to 1 if you can safely include both and . */ +#cmakedefine TIME_WITH_SYS_TIME ${TIME_WITH_SYS_TIME} + +/* Define if you want to enable c-ares support */ +#cmakedefine USE_ARES ${USE_ARES} + +/* Define to disable non-blocking sockets. */ +#cmakedefine USE_BLOCKING_SOCKETS ${USE_BLOCKING_SOCKETS} + +/* if GnuTLS is enabled */ +#cmakedefine USE_GNUTLS ${USE_GNUTLS} + +/* if PolarSSL is enabled */ +#cmakedefine USE_POLARSSL ${USE_POLARSSL} + +/* if libSSH2 is in use */ +#cmakedefine USE_LIBSSH2 ${USE_LIBSSH2} + +/* If you want to build curl with the built-in manual */ +#cmakedefine USE_MANUAL ${USE_MANUAL} + +/* if NSS is enabled */ +#cmakedefine USE_NSS ${USE_NSS} + +/* if OpenSSL is in use */ +#cmakedefine USE_OPENSSL ${USE_OPENSSL} + +/* if SSL is enabled */ +#cmakedefine USE_SSLEAY ${USE_SSLEAY} + +/* Define to 1 if you are building a Windows target without large file + support. */ +#cmakedefine USE_WIN32_LARGE_FILES ${USE_WIN32_LARGE_FILES} + +/* to enable SSPI support */ +#cmakedefine USE_WINDOWS_SSPI ${USE_WINDOWS_SSPI} + +/* Define to 1 if using yaSSL in OpenSSL compatibility mode. */ +#cmakedefine USE_YASSLEMUL ${USE_YASSLEMUL} + +/* Version number of package */ +#cmakedefine VERSION ${VERSION} + +/* Define to avoid automatic inclusion of winsock.h */ +#cmakedefine WIN32_LEAN_AND_MEAN ${WIN32_LEAN_AND_MEAN} + +/* Define to 1 if OS is AIX. */ +#ifndef _ALL_SOURCE +# undef _ALL_SOURCE +#endif + +/* Number of bits in a file offset, on hosts where this is settable. */ +#cmakedefine _FILE_OFFSET_BITS ${_FILE_OFFSET_BITS} + +/* Define for large files, on AIX-style hosts. */ +#cmakedefine _LARGE_FILES ${_LARGE_FILES} + +/* define this if you need it to compile thread-safe code */ +#cmakedefine _THREAD_SAFE ${_THREAD_SAFE} + +/* Define to empty if `const' does not conform to ANSI C. */ +#cmakedefine const ${const} + +/* Type to use in place of in_addr_t when system does not provide it. */ +#cmakedefine in_addr_t ${in_addr_t} + +/* Define to `__inline__' or `__inline' if that's what the C compiler + calls it, or to nothing if 'inline' is not supported under any name. */ +#ifndef __cplusplus +#undef inline +#endif + +/* Define to `unsigned int' if does not define. */ +#cmakedefine size_t ${size_t} + +/* the signed version of size_t */ +#cmakedefine ssize_t ${ssize_t} diff --git a/mobicore/common/curl/lib/curl_config.h.in b/mobicore/common/curl/lib/curl_config.h.in new file mode 100644 index 0000000000000000000000000000000000000000..aaea103f2becd7b9d99629bd8c3659d3f22fb945 --- /dev/null +++ b/mobicore/common/curl/lib/curl_config.h.in @@ -0,0 +1,1021 @@ +/* lib/curl_config.h.in. Generated from configure.ac by autoheader. */ + +/* when building libcurl itself */ +#undef BUILDING_LIBCURL + +/* Location of default ca bundle */ +#undef CURL_CA_BUNDLE + +/* Location of default ca path */ +#undef CURL_CA_PATH + +/* to disable cookies support */ +#undef CURL_DISABLE_COOKIES + +/* to disable cryptographic authentication */ +#undef CURL_DISABLE_CRYPTO_AUTH + +/* to disable DICT */ +#undef CURL_DISABLE_DICT + +/* to disable FILE */ +#undef CURL_DISABLE_FILE + +/* to disable FTP */ +#undef CURL_DISABLE_FTP + +/* to disable Gopher */ +#undef CURL_DISABLE_GOPHER + +/* to disable HTTP */ +#undef CURL_DISABLE_HTTP + +/* to disable IMAP */ +#undef CURL_DISABLE_IMAP + +/* to disable LDAP */ +#undef CURL_DISABLE_LDAP + +/* to disable LDAPS */ +#undef CURL_DISABLE_LDAPS + +/* to disable POP3 */ +#undef CURL_DISABLE_POP3 + +/* to disable proxies */ +#undef CURL_DISABLE_PROXY + +/* to disable RTSP */ +#undef CURL_DISABLE_RTSP + +/* to disable SMTP */ +#undef CURL_DISABLE_SMTP + +/* to disable TELNET */ +#undef CURL_DISABLE_TELNET + +/* to disable TFTP */ +#undef CURL_DISABLE_TFTP + +/* to disable verbose strings */ +#undef CURL_DISABLE_VERBOSE_STRINGS + +/* to make a symbol visible */ +#undef CURL_EXTERN_SYMBOL + +/* to enable hidden symbols */ +#undef CURL_HIDDEN_SYMBOLS + +/* Use Windows LDAP implementation */ +#undef CURL_LDAP_WIN + +/* when not building a shared library */ +#undef CURL_STATICLIB + +/* your Entropy Gathering Daemon socket pathname */ +#undef EGD_SOCKET + +/* Define if you want to enable IPv6 support */ +#undef ENABLE_IPV6 + +/* Define to the type qualifier of arg 1 for getnameinfo. */ +#undef GETNAMEINFO_QUAL_ARG1 + +/* Define to the type of arg 1 for getnameinfo. */ +#undef GETNAMEINFO_TYPE_ARG1 + +/* Define to the type of arg 2 for getnameinfo. */ +#undef GETNAMEINFO_TYPE_ARG2 + +/* Define to the type of args 4 and 6 for getnameinfo. */ +#undef GETNAMEINFO_TYPE_ARG46 + +/* Define to the type of arg 7 for getnameinfo. */ +#undef GETNAMEINFO_TYPE_ARG7 + +/* Specifies the number of arguments to getservbyport_r */ +#undef GETSERVBYPORT_R_ARGS + +/* Specifies the size of the buffer to pass to getservbyport_r */ +#undef GETSERVBYPORT_R_BUFSIZE + +/* Define to 1 if you have the alarm function. */ +#undef HAVE_ALARM + +/* Define to 1 if you have the header file. */ +#undef HAVE_ALLOCA_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_ARPA_INET_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_ARPA_TFTP_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_ASSERT_H + +/* Define to 1 if you have the basename function. */ +#undef HAVE_BASENAME + +/* Define to 1 if bool is an available type. */ +#undef HAVE_BOOL_T + +/* Define to 1 if you have the clock_gettime function and monotonic timer. */ +#undef HAVE_CLOCK_GETTIME_MONOTONIC + +/* Define to 1 if you have the closesocket function. */ +#undef HAVE_CLOSESOCKET + +/* Define to 1 if you have the CloseSocket camel case function. */ +#undef HAVE_CLOSESOCKET_CAMEL + +/* Define to 1 if you have the connect function. */ +#undef HAVE_CONNECT + +/* Define to 1 if you have the `CRYPTO_cleanup_all_ex_data' function. */ +#undef HAVE_CRYPTO_CLEANUP_ALL_EX_DATA + +/* Define to 1 if you have the header file. */ +#undef HAVE_CRYPTO_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_DES_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_DLFCN_H + +/* Define to 1 if you have the `ENGINE_cleanup' function. */ +#undef HAVE_ENGINE_CLEANUP + +/* Define to 1 if you have the `ENGINE_load_builtin_engines' function. */ +#undef HAVE_ENGINE_LOAD_BUILTIN_ENGINES + +/* Define to 1 if you have the header file. */ +#undef HAVE_ERRNO_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_ERR_H + +/* Define to 1 if you have the fcntl function. */ +#undef HAVE_FCNTL + +/* Define to 1 if you have the header file. */ +#undef HAVE_FCNTL_H + +/* Define to 1 if you have a working fcntl O_NONBLOCK function. */ +#undef HAVE_FCNTL_O_NONBLOCK + +/* Define to 1 if you have the fdopen function. */ +#undef HAVE_FDOPEN + +/* Define to 1 if you have the `fork' function. */ +#undef HAVE_FORK + +/* Define to 1 if you have the freeaddrinfo function. */ +#undef HAVE_FREEADDRINFO + +/* Define to 1 if you have the freeifaddrs function. */ +#undef HAVE_FREEIFADDRS + +/* Define to 1 if you have the fsetxattr function. */ +#undef HAVE_FSETXATTR + +/* fsetxattr() takes 5 args */ +#undef HAVE_FSETXATTR_5 + +/* fsetxattr() takes 6 args */ +#undef HAVE_FSETXATTR_6 + +/* Define to 1 if you have the ftruncate function. */ +#undef HAVE_FTRUNCATE + +/* Define to 1 if you have a working getaddrinfo function. */ +#undef HAVE_GETADDRINFO + +/* Define to 1 if the getaddrinfo function is threadsafe. */ +#undef HAVE_GETADDRINFO_THREADSAFE + +/* Define to 1 if you have the `geteuid' function. */ +#undef HAVE_GETEUID + +/* Define to 1 if you have the gethostbyaddr function. */ +#undef HAVE_GETHOSTBYADDR + +/* Define to 1 if you have the gethostbyaddr_r function. */ +#undef HAVE_GETHOSTBYADDR_R + +/* gethostbyaddr_r() takes 5 args */ +#undef HAVE_GETHOSTBYADDR_R_5 + +/* gethostbyaddr_r() takes 7 args */ +#undef HAVE_GETHOSTBYADDR_R_7 + +/* gethostbyaddr_r() takes 8 args */ +#undef HAVE_GETHOSTBYADDR_R_8 + +/* Define to 1 if you have the gethostbyname function. */ +#undef HAVE_GETHOSTBYNAME + +/* Define to 1 if you have the gethostbyname_r function. */ +#undef HAVE_GETHOSTBYNAME_R + +/* gethostbyname_r() takes 3 args */ +#undef HAVE_GETHOSTBYNAME_R_3 + +/* gethostbyname_r() takes 5 args */ +#undef HAVE_GETHOSTBYNAME_R_5 + +/* gethostbyname_r() takes 6 args */ +#undef HAVE_GETHOSTBYNAME_R_6 + +/* Define to 1 if you have the gethostname function. */ +#undef HAVE_GETHOSTNAME + +/* Define to 1 if you have a working getifaddrs function. */ +#undef HAVE_GETIFADDRS + +/* Define to 1 if you have the getnameinfo function. */ +#undef HAVE_GETNAMEINFO + +/* Define to 1 if you have the `getpass_r' function. */ +#undef HAVE_GETPASS_R + +/* Define to 1 if you have the `getppid' function. */ +#undef HAVE_GETPPID + +/* Define to 1 if you have the `getprotobyname' function. */ +#undef HAVE_GETPROTOBYNAME + +/* Define to 1 if you have the `getpwuid' function. */ +#undef HAVE_GETPWUID + +/* Define to 1 if you have the `getrlimit' function. */ +#undef HAVE_GETRLIMIT + +/* Define to 1 if you have the getservbyport_r function. */ +#undef HAVE_GETSERVBYPORT_R + +/* Define to 1 if you have the `gettimeofday' function. */ +#undef HAVE_GETTIMEOFDAY + +/* Define to 1 if you have a working glibc-style strerror_r function. */ +#undef HAVE_GLIBC_STRERROR_R + +/* Define to 1 if you have a working gmtime_r function. */ +#undef HAVE_GMTIME_R + +/* if you have the gssapi libraries */ +#undef HAVE_GSSAPI + +/* Define to 1 if you have the header file. */ +#undef HAVE_GSSAPI_GSSAPI_GENERIC_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_GSSAPI_GSSAPI_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_GSSAPI_GSSAPI_KRB5_H + +/* if you have the GNU gssapi libraries */ +#undef HAVE_GSSGNU + +/* if you have the Heimdal gssapi libraries */ +#undef HAVE_GSSHEIMDAL + +/* if you have the MIT gssapi libraries */ +#undef HAVE_GSSMIT + +/* Define to 1 if you have the `idna_strerror' function. */ +#undef HAVE_IDNA_STRERROR + +/* Define to 1 if you have the `idn_free' function. */ +#undef HAVE_IDN_FREE + +/* Define to 1 if you have the header file. */ +#undef HAVE_IDN_FREE_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_IFADDRS_H + +/* Define to 1 if you have the `inet_addr' function. */ +#undef HAVE_INET_ADDR + +/* Define to 1 if you have the inet_ntoa_r function. */ +#undef HAVE_INET_NTOA_R + +/* inet_ntoa_r() takes 2 args */ +#undef HAVE_INET_NTOA_R_2 + +/* inet_ntoa_r() takes 3 args */ +#undef HAVE_INET_NTOA_R_3 + +/* Define to 1 if you have a IPv6 capable working inet_ntop function. */ +#undef HAVE_INET_NTOP + +/* Define to 1 if you have a IPv6 capable working inet_pton function. */ +#undef HAVE_INET_PTON + +/* Define to 1 if you have the header file. */ +#undef HAVE_INTTYPES_H + +/* Define to 1 if you have the ioctl function. */ +#undef HAVE_IOCTL + +/* Define to 1 if you have the ioctlsocket function. */ +#undef HAVE_IOCTLSOCKET + +/* Define to 1 if you have the IoctlSocket camel case function. */ +#undef HAVE_IOCTLSOCKET_CAMEL + +/* Define to 1 if you have a working IoctlSocket camel case FIONBIO function. + */ +#undef HAVE_IOCTLSOCKET_CAMEL_FIONBIO + +/* Define to 1 if you have a working ioctlsocket FIONBIO function. */ +#undef HAVE_IOCTLSOCKET_FIONBIO + +/* Define to 1 if you have a working ioctl FIONBIO function. */ +#undef HAVE_IOCTL_FIONBIO + +/* Define to 1 if you have a working ioctl SIOCGIFADDR function. */ +#undef HAVE_IOCTL_SIOCGIFADDR + +/* Define to 1 if you have the header file. */ +#undef HAVE_IO_H + +/* if you have the Kerberos4 libraries (including -ldes) */ +#undef HAVE_KRB4 + +/* Define to 1 if you have the `krb_get_our_ip_for_realm' function. */ +#undef HAVE_KRB_GET_OUR_IP_FOR_REALM + +/* Define to 1 if you have the header file. */ +#undef HAVE_KRB_H + +/* Define to 1 if you have the lber.h header file. */ +#undef HAVE_LBER_H + +/* Define to 1 if you have the ldapssl.h header file. */ +#undef HAVE_LDAPSSL_H + +/* Define to 1 if you have the ldap.h header file. */ +#undef HAVE_LDAP_H + +/* Define to 1 if you have the `ldap_init_fd' function. */ +#undef HAVE_LDAP_INIT_FD + +/* Use LDAPS implementation */ +#undef HAVE_LDAP_SSL + +/* Define to 1 if you have the ldap_ssl.h header file. */ +#undef HAVE_LDAP_SSL_H + +/* Define to 1 if you have the `ldap_url_parse' function. */ +#undef HAVE_LDAP_URL_PARSE + +/* Define to 1 if you have the `gcrypt' library (-lgcrypt). */ +#undef HAVE_LIBGCRYPT + +/* Define to 1 if you have the header file. */ +#undef HAVE_LIBGEN_H + +/* Define to 1 if you have the `idn' library (-lidn). */ +#undef HAVE_LIBIDN + +/* Define to 1 if you have the `resolv' library (-lresolv). */ +#undef HAVE_LIBRESOLV + +/* Define to 1 if you have the `resolve' library (-lresolve). */ +#undef HAVE_LIBRESOLVE + +/* Define to 1 if you have the header file. */ +#undef HAVE_LIBRTMP_RTMP_H + +/* Define to 1 if you have the `ssh2' library (-lssh2). */ +#undef HAVE_LIBSSH2 + +/* Define to 1 if you have the `libssh2_exit' function. */ +#undef HAVE_LIBSSH2_EXIT + +/* Define to 1 if you have the header file. */ +#undef HAVE_LIBSSH2_H + +/* Define to 1 if you have the `libssh2_init' function. */ +#undef HAVE_LIBSSH2_INIT + +/* Define to 1 if you have the `libssh2_scp_send64' function. */ +#undef HAVE_LIBSSH2_SCP_SEND64 + +/* Define to 1 if you have the `libssh2_session_handshake' function. */ +#undef HAVE_LIBSSH2_SESSION_HANDSHAKE + +/* Define to 1 if you have the `libssh2_version' function. */ +#undef HAVE_LIBSSH2_VERSION + +/* Define to 1 if you have the `ssl' library (-lssl). */ +#undef HAVE_LIBSSL + +/* if zlib is available */ +#undef HAVE_LIBZ + +/* Define to 1 if you have the header file. */ +#undef HAVE_LIMITS_H + +/* if your compiler supports LL */ +#undef HAVE_LL + +/* Define to 1 if you have the header file. */ +#undef HAVE_LOCALE_H + +/* Define to 1 if you have a working localtime_r function. */ +#undef HAVE_LOCALTIME_R + +/* Define to 1 if the compiler supports the 'long long' data type. */ +#undef HAVE_LONGLONG + +/* Define to 1 if you have the malloc.h header file. */ +#undef HAVE_MALLOC_H + +/* Define to 1 if you have the memory.h header file. */ +#undef HAVE_MEMORY_H + +/* Define to 1 if you have the memrchr function or macro. */ +#undef HAVE_MEMRCHR + +/* Define to 1 if you have the MSG_NOSIGNAL flag. */ +#undef HAVE_MSG_NOSIGNAL + +/* Define to 1 if you have the header file. */ +#undef HAVE_NETDB_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_NETINET_IN_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_NETINET_TCP_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_NET_IF_H + +/* Define to 1 if NI_WITHSCOPEID exists and works. */ +#undef HAVE_NI_WITHSCOPEID + +/* if you have an old MIT gssapi library, lacking GSS_C_NT_HOSTBASED_SERVICE + */ +#undef HAVE_OLD_GSSMIT + +/* Define to 1 if you have the header file. */ +#undef HAVE_OPENSSL_CRYPTO_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_OPENSSL_ENGINE_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_OPENSSL_ERR_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_OPENSSL_PEM_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_OPENSSL_PKCS12_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_OPENSSL_RSA_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_OPENSSL_SSL_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_OPENSSL_X509_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_PEM_H + +/* Define to 1 if you have the `perror' function. */ +#undef HAVE_PERROR + +/* Define to 1 if you have the `pipe' function. */ +#undef HAVE_PIPE + +/* if you have the function PK11_CreateGenericObject */ +#undef HAVE_PK11_CREATEGENERICOBJECT + +/* Define to 1 if you have a working poll function. */ +#undef HAVE_POLL + +/* If you have a fine poll */ +#undef HAVE_POLL_FINE + +/* Define to 1 if you have the header file. */ +#undef HAVE_POLL_H + +/* Define to 1 if you have a working POSIX-style strerror_r function. */ +#undef HAVE_POSIX_STRERROR_R + +/* if you have */ +#undef HAVE_PTHREAD_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_PWD_H + +/* Define to 1 if you have the `RAND_egd' function. */ +#undef HAVE_RAND_EGD + +/* Define to 1 if you have the `RAND_screen' function. */ +#undef HAVE_RAND_SCREEN + +/* Define to 1 if you have the `RAND_status' function. */ +#undef HAVE_RAND_STATUS + +/* Define to 1 if you have the recv function. */ +#undef HAVE_RECV + +/* Define to 1 if you have the recvfrom function. */ +#undef HAVE_RECVFROM + +/* Define to 1 if you have the header file. */ +#undef HAVE_RSA_H + +/* Define to 1 if you have the select function. */ +#undef HAVE_SELECT + +/* Define to 1 if you have the send function. */ +#undef HAVE_SEND + +/* Define to 1 if you have the header file. */ +#undef HAVE_SETJMP_H + +/* Define to 1 if you have the `setlocale' function. */ +#undef HAVE_SETLOCALE + +/* Define to 1 if you have the `setmode' function. */ +#undef HAVE_SETMODE + +/* Define to 1 if you have the `setrlimit' function. */ +#undef HAVE_SETRLIMIT + +/* Define to 1 if you have the setsockopt function. */ +#undef HAVE_SETSOCKOPT + +/* Define to 1 if you have a working setsockopt SO_NONBLOCK function. */ +#undef HAVE_SETSOCKOPT_SO_NONBLOCK + +/* Define to 1 if you have the header file. */ +#undef HAVE_SGTTY_H + +/* Define to 1 if you have the sigaction function. */ +#undef HAVE_SIGACTION + +/* Define to 1 if you have the siginterrupt function. */ +#undef HAVE_SIGINTERRUPT + +/* Define to 1 if you have the signal function. */ +#undef HAVE_SIGNAL + +/* Define to 1 if you have the header file. */ +#undef HAVE_SIGNAL_H + +/* Define to 1 if you have the sigsetjmp function or macro. */ +#undef HAVE_SIGSETJMP + +/* Define to 1 if sig_atomic_t is an available typedef. */ +#undef HAVE_SIG_ATOMIC_T + +/* Define to 1 if sig_atomic_t is already defined as volatile. */ +#undef HAVE_SIG_ATOMIC_T_VOLATILE + +/* Define to 1 if struct sockaddr_in6 has the sin6_scope_id member */ +#undef HAVE_SOCKADDR_IN6_SIN6_SCOPE_ID + +/* Define to 1 if you have the socket function. */ +#undef HAVE_SOCKET + +/* Define to 1 if you have the header file. */ +#undef HAVE_SOCKET_H + +/* Define this if you have the SPNEGO library fbopenssl */ +#undef HAVE_SPNEGO + +/* Define to 1 if you have the `SSL_get_shutdown' function. */ +#undef HAVE_SSL_GET_SHUTDOWN + +/* Define to 1 if you have the header file. */ +#undef HAVE_SSL_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_STDBOOL_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_STDINT_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_STDIO_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_STDLIB_H + +/* Define to 1 if you have the strcasecmp function. */ +#undef HAVE_STRCASECMP + +/* Define to 1 if you have the strcasestr function. */ +#undef HAVE_STRCASESTR + +/* Define to 1 if you have the strcmpi function. */ +#undef HAVE_STRCMPI + +/* Define to 1 if you have the strdup function. */ +#undef HAVE_STRDUP + +/* Define to 1 if you have the strerror_r function. */ +#undef HAVE_STRERROR_R + +/* Define to 1 if you have the stricmp function. */ +#undef HAVE_STRICMP + +/* Define to 1 if you have the header file. */ +#undef HAVE_STRINGS_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_STRING_H + +/* Define to 1 if you have the strlcat function. */ +#undef HAVE_STRLCAT + +/* Define to 1 if you have the `strlcpy' function. */ +#undef HAVE_STRLCPY + +/* Define to 1 if you have the strncasecmp function. */ +#undef HAVE_STRNCASECMP + +/* Define to 1 if you have the strncmpi function. */ +#undef HAVE_STRNCMPI + +/* Define to 1 if you have the strnicmp function. */ +#undef HAVE_STRNICMP + +/* Define to 1 if you have the header file. */ +#undef HAVE_STROPTS_H + +/* Define to 1 if you have the strstr function. */ +#undef HAVE_STRSTR + +/* Define to 1 if you have the strtok_r function. */ +#undef HAVE_STRTOK_R + +/* Define to 1 if you have the strtoll function. */ +#undef HAVE_STRTOLL + +/* if struct sockaddr_storage is defined */ +#undef HAVE_STRUCT_SOCKADDR_STORAGE + +/* Define to 1 if you have the timeval struct. */ +#undef HAVE_STRUCT_TIMEVAL + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_FILIO_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_IOCTL_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_PARAM_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_POLL_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_RESOURCE_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_SELECT_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_SOCKET_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_SOCKIO_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_STAT_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_TIME_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_TYPES_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_UIO_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_UN_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_UTIME_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_XATTR_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_TERMIOS_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_TERMIO_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_TIME_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_TLD_H + +/* Define to 1 if you have the `tld_strerror' function. */ +#undef HAVE_TLD_STRERROR + +/* Define to 1 if you have the `uname' function. */ +#undef HAVE_UNAME + +/* Define to 1 if you have the header file. */ +#undef HAVE_UNISTD_H + +/* Define to 1 if you have the `utime' function. */ +#undef HAVE_UTIME + +/* Define to 1 if you have the header file. */ +#undef HAVE_UTIME_H + +/* Define to 1 if compiler supports C99 variadic macro style. */ +#undef HAVE_VARIADIC_MACROS_C99 + +/* Define to 1 if compiler supports old gcc variadic macro style. */ +#undef HAVE_VARIADIC_MACROS_GCC + +/* Define to 1 if you have the winber.h header file. */ +#undef HAVE_WINBER_H + +/* Define to 1 if you have the windows.h header file. */ +#undef HAVE_WINDOWS_H + +/* Define to 1 if you have the winldap.h header file. */ +#undef HAVE_WINLDAP_H + +/* Define to 1 if you have the winsock2.h header file. */ +#undef HAVE_WINSOCK2_H + +/* Define to 1 if you have the winsock.h header file. */ +#undef HAVE_WINSOCK_H + +/* Define this symbol if your OS supports changing the contents of argv */ +#undef HAVE_WRITABLE_ARGV + +/* Define to 1 if you have the writev function. */ +#undef HAVE_WRITEV + +/* Define to 1 if you have the ws2tcpip.h header file. */ +#undef HAVE_WS2TCPIP_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_X509_H + +/* if you have the zlib.h header file */ +#undef HAVE_ZLIB_H + +/* Define to the sub-directory in which libtool stores uninstalled libraries. + */ +#undef LT_OBJDIR + +/* Define to 1 if you are building a native Windows target. */ +#undef NATIVE_WINDOWS + +/* Define to 1 if you need the lber.h header file even with ldap.h */ +#undef NEED_LBER_H + +/* Define to 1 if you need the malloc.h header file even with stdlib.h */ +#undef NEED_MALLOC_H + +/* Define to 1 if you need the memory.h header file even with stdlib.h */ +#undef NEED_MEMORY_H + +/* Define to 1 if _REENTRANT preprocessor symbol must be defined. */ +#undef NEED_REENTRANT + +/* Define to 1 if _THREAD_SAFE preprocessor symbol must be defined. */ +#undef NEED_THREAD_SAFE + +/* cpu-machine-OS */ +#undef OS + +/* Name of package */ +#undef PACKAGE + +/* Define to the address where bug reports for this package should be sent. */ +#undef PACKAGE_BUGREPORT + +/* Define to the full name of this package. */ +#undef PACKAGE_NAME + +/* Define to the full name and version of this package. */ +#undef PACKAGE_STRING + +/* Define to the one symbol short name of this package. */ +#undef PACKAGE_TARNAME + +/* Define to the home page for this package. */ +#undef PACKAGE_URL + +/* Define to the version of this package. */ +#undef PACKAGE_VERSION + +/* a suitable file to read random data from */ +#undef RANDOM_FILE + +/* Define to the type of arg 1 for recvfrom. */ +#undef RECVFROM_TYPE_ARG1 + +/* Define to the type pointed by arg 2 for recvfrom. */ +#undef RECVFROM_TYPE_ARG2 + +/* Define to 1 if the type pointed by arg 2 for recvfrom is void. */ +#undef RECVFROM_TYPE_ARG2_IS_VOID + +/* Define to the type of arg 3 for recvfrom. */ +#undef RECVFROM_TYPE_ARG3 + +/* Define to the type of arg 4 for recvfrom. */ +#undef RECVFROM_TYPE_ARG4 + +/* Define to the type pointed by arg 5 for recvfrom. */ +#undef RECVFROM_TYPE_ARG5 + +/* Define to 1 if the type pointed by arg 5 for recvfrom is void. */ +#undef RECVFROM_TYPE_ARG5_IS_VOID + +/* Define to the type pointed by arg 6 for recvfrom. */ +#undef RECVFROM_TYPE_ARG6 + +/* Define to 1 if the type pointed by arg 6 for recvfrom is void. */ +#undef RECVFROM_TYPE_ARG6_IS_VOID + +/* Define to the function return type for recvfrom. */ +#undef RECVFROM_TYPE_RETV + +/* Define to the type of arg 1 for recv. */ +#undef RECV_TYPE_ARG1 + +/* Define to the type of arg 2 for recv. */ +#undef RECV_TYPE_ARG2 + +/* Define to the type of arg 3 for recv. */ +#undef RECV_TYPE_ARG3 + +/* Define to the type of arg 4 for recv. */ +#undef RECV_TYPE_ARG4 + +/* Define to the function return type for recv. */ +#undef RECV_TYPE_RETV + +/* Define as the return type of signal handlers (`int' or `void'). */ +#undef RETSIGTYPE + +/* Define to the type qualifier of arg 5 for select. */ +#undef SELECT_QUAL_ARG5 + +/* Define to the type of arg 1 for select. */ +#undef SELECT_TYPE_ARG1 + +/* Define to the type of args 2, 3 and 4 for select. */ +#undef SELECT_TYPE_ARG234 + +/* Define to the type of arg 5 for select. */ +#undef SELECT_TYPE_ARG5 + +/* Define to the function return type for select. */ +#undef SELECT_TYPE_RETV + +/* Define to the type qualifier of arg 2 for send. */ +#undef SEND_QUAL_ARG2 + +/* Define to the type of arg 1 for send. */ +#undef SEND_TYPE_ARG1 + +/* Define to the type of arg 2 for send. */ +#undef SEND_TYPE_ARG2 + +/* Define to the type of arg 3 for send. */ +#undef SEND_TYPE_ARG3 + +/* Define to the type of arg 4 for send. */ +#undef SEND_TYPE_ARG4 + +/* Define to the function return type for send. */ +#undef SEND_TYPE_RETV + +/* The size of `int', as computed by sizeof. */ +#undef SIZEOF_INT + +/* The size of `long', as computed by sizeof. */ +#undef SIZEOF_LONG + +/* The size of `off_t', as computed by sizeof. */ +#undef SIZEOF_OFF_T + +/* The size of `short', as computed by sizeof. */ +#undef SIZEOF_SHORT + +/* The size of `size_t', as computed by sizeof. */ +#undef SIZEOF_SIZE_T + +/* The size of `time_t', as computed by sizeof. */ +#undef SIZEOF_TIME_T + +/* The size of `void*', as computed by sizeof. */ +#undef SIZEOF_VOIDP + +/* Define to 1 if you have the ANSI C header files. */ +#undef STDC_HEADERS + +/* Define to the type of arg 3 for strerror_r. */ +#undef STRERROR_R_TYPE_ARG3 + +/* Define to 1 if you can safely include both and . */ +#undef TIME_WITH_SYS_TIME + +/* Define to enable c-ares support */ +#undef USE_ARES + +/* Define to disable non-blocking sockets. */ +#undef USE_BLOCKING_SOCKETS + +/* if GnuTLS is enabled */ +#undef USE_GNUTLS + +/* if librtmp is in use */ +#undef USE_LIBRTMP + +/* if libSSH2 is in use */ +#undef USE_LIBSSH2 + +/* If you want to build curl with the built-in manual */ +#undef USE_MANUAL + +/* if NSS is enabled */ +#undef USE_NSS + +/* Use OpenLDAP-specific code */ +#undef USE_OPENLDAP + +/* if OpenSSL is in use */ +#undef USE_OPENSSL + +/* if PolarSSL is enabled */ +#undef USE_POLARSSL + +/* if SSL is enabled */ +#undef USE_SSLEAY + +/* if you want POSIX threaded DNS lookup */ +#undef USE_THREADS_POSIX + +/* Define to 1 if you are building a Windows target without large file + support. */ +#undef USE_WIN32_LARGE_FILES + +/* to enable SSPI support */ +#undef USE_WINDOWS_SSPI + +/* Define to 1 if using yaSSL in OpenSSL compatibility mode. */ +#undef USE_YASSLEMUL + +/* Version number of package */ +#undef VERSION + +/* Define to avoid automatic inclusion of winsock.h */ +#undef WIN32_LEAN_AND_MEAN + +/* Define to 1 if OS is AIX. */ +#ifndef _ALL_SOURCE +# undef _ALL_SOURCE +#endif + +/* Number of bits in a file offset, on hosts where this is settable. */ +#undef _FILE_OFFSET_BITS + +/* Define for large files, on AIX-style hosts. */ +#undef _LARGE_FILES + +/* Define to empty if `const' does not conform to ANSI C. */ +#undef const + +/* Type to use in place of in_addr_t when system does not provide it. */ +#undef in_addr_t + +/* Define to `__inline__' or `__inline' if that's what the C compiler + calls it, or to nothing if 'inline' is not supported under any name. */ +#ifndef __cplusplus +#undef inline +#endif + +/* Define to `unsigned int' if does not define. */ +#undef size_t + +/* the signed version of size_t */ +#undef ssize_t diff --git a/mobicore/common/curl/lib/curl_fnmatch.c b/mobicore/common/curl/lib/curl_fnmatch.c new file mode 100644 index 0000000000000000000000000000000000000000..ad4ec1871992df34c7f02a4d85c30caedd72a9b4 --- /dev/null +++ b/mobicore/common/curl/lib/curl_fnmatch.c @@ -0,0 +1,424 @@ +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) 1998 - 2010, Daniel Stenberg, , et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at http://curl.haxx.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ***************************************************************************/ + +#include "setup.h" + +#include "curl_fnmatch.h" + +#define _MPRINTF_REPLACE /* use our functions only */ +#include + +#include "curl_memory.h" +/* The last #include file should be: */ +#include "memdebug.h" + +#define CURLFNM_CHARSET_LEN (sizeof(char) * 256) +#define CURLFNM_CHSET_SIZE (CURLFNM_CHARSET_LEN + 15) + +#define CURLFNM_NEGATE CURLFNM_CHARSET_LEN + +#define CURLFNM_ALNUM (CURLFNM_CHARSET_LEN + 1) +#define CURLFNM_DIGIT (CURLFNM_CHARSET_LEN + 2) +#define CURLFNM_XDIGIT (CURLFNM_CHARSET_LEN + 3) +#define CURLFNM_ALPHA (CURLFNM_CHARSET_LEN + 4) +#define CURLFNM_PRINT (CURLFNM_CHARSET_LEN + 5) +#define CURLFNM_BLANK (CURLFNM_CHARSET_LEN + 6) +#define CURLFNM_LOWER (CURLFNM_CHARSET_LEN + 7) +#define CURLFNM_GRAPH (CURLFNM_CHARSET_LEN + 8) +#define CURLFNM_SPACE (CURLFNM_CHARSET_LEN + 9) +#define CURLFNM_UPPER (CURLFNM_CHARSET_LEN + 10) + +typedef enum { + CURLFNM_LOOP_DEFAULT = 0, + CURLFNM_LOOP_BACKSLASH +} loop_state; + +typedef enum { + CURLFNM_SCHS_DEFAULT = 0, + CURLFNM_SCHS_MAYRANGE, + CURLFNM_SCHS_MAYRANGE2, + CURLFNM_SCHS_RIGHTBR, + CURLFNM_SCHS_RIGHTBRLEFTBR +} setcharset_state; + +typedef enum { + CURLFNM_PKW_INIT = 0, + CURLFNM_PKW_DDOT +} parsekey_state; + +#define SETCHARSET_OK 1 +#define SETCHARSET_FAIL 0 + +static int parsekeyword(unsigned char **pattern, unsigned char *charset) +{ + parsekey_state state = CURLFNM_PKW_INIT; +#define KEYLEN 10 + char keyword[KEYLEN] = { 0 }; + int found = FALSE; + int i; + unsigned char *p = *pattern; + for(i = 0; !found; i++) { + char c = *p++; + if(i >= KEYLEN) + return SETCHARSET_FAIL; + switch(state) { + case CURLFNM_PKW_INIT: + if(ISALPHA(c) && ISLOWER(c)) + keyword[i] = c; + else if(c == ':') + state = CURLFNM_PKW_DDOT; + else + return 0; + break; + case CURLFNM_PKW_DDOT: + if(c == ']') + found = TRUE; + else + return SETCHARSET_FAIL; + } + } +#undef KEYLEN + + *pattern = p; /* move caller's pattern pointer */ + if(strcmp(keyword, "digit") == 0) + charset[CURLFNM_DIGIT] = 1; + else if(strcmp(keyword, "alnum") == 0) + charset[CURLFNM_ALNUM] = 1; + else if(strcmp(keyword, "alpha") == 0) + charset[CURLFNM_ALPHA] = 1; + else if(strcmp(keyword, "xdigit") == 0) + charset[CURLFNM_XDIGIT] = 1; + else if(strcmp(keyword, "print") == 0) + charset[CURLFNM_PRINT] = 1; + else if(strcmp(keyword, "graph") == 0) + charset[CURLFNM_GRAPH] = 1; + else if(strcmp(keyword, "space") == 0) + charset[CURLFNM_SPACE] = 1; + else if(strcmp(keyword, "blank") == 0) + charset[CURLFNM_BLANK] = 1; + else if(strcmp(keyword, "upper") == 0) + charset[CURLFNM_UPPER] = 1; + else if(strcmp(keyword, "lower") == 0) + charset[CURLFNM_LOWER] = 1; + else + return SETCHARSET_FAIL; + return SETCHARSET_OK; +} + +/* returns 1 (true) if pattern is OK, 0 if is bad ("p" is pattern pointer) */ +static int setcharset(unsigned char **p, unsigned char *charset) +{ + setcharset_state state = CURLFNM_SCHS_DEFAULT; + unsigned char rangestart = 0; + unsigned char lastchar = 0; + bool something_found = FALSE; + unsigned char c; + for(;;) { + c = **p; + switch(state) { + case CURLFNM_SCHS_DEFAULT: + if(ISALNUM(c)) { /* ASCII value */ + rangestart = c; + charset[c] = 1; + (*p)++; + state = CURLFNM_SCHS_MAYRANGE; + something_found = TRUE; + } + else if(c == ']') { + if(something_found) + return SETCHARSET_OK; + else + something_found = TRUE; + state = CURLFNM_SCHS_RIGHTBR; + charset[c] = 1; + (*p)++; + } + else if(c == '[') { + char c2 = *((*p)+1); + if(c2 == ':') { /* there has to be a keyword */ + (*p) += 2; + if(parsekeyword(p, charset)) { + state = CURLFNM_SCHS_DEFAULT; + } + else + return SETCHARSET_FAIL; + } + else { + charset[c] = 1; + (*p)++; + } + something_found = TRUE; + } + else if(c == '?' || c == '*') { + something_found = TRUE; + charset[c] = 1; + (*p)++; + } + else if(c == '^' || c == '!') { + if(!something_found) { + if(charset[CURLFNM_NEGATE]) { + charset[c] = 1; + something_found = TRUE; + } + else + charset[CURLFNM_NEGATE] = 1; /* negate charset */ + } + else + charset[c] = 1; + (*p)++; + } + else if(c == '\\') { + c = *(++(*p)); + if(ISPRINT((c))) { + something_found = TRUE; + state = CURLFNM_SCHS_MAYRANGE; + charset[c] = 1; + rangestart = c; + (*p)++; + } + else + return SETCHARSET_FAIL; + } + else if(c == '\0') { + return SETCHARSET_FAIL; + } + else { + charset[c] = 1; + (*p)++; + something_found = TRUE; + } + break; + case CURLFNM_SCHS_MAYRANGE: + if(c == '-') { + charset[c] = 1; + (*p)++; + lastchar = '-'; + state = CURLFNM_SCHS_MAYRANGE2; + } + else if(c == '[') { + state = CURLFNM_SCHS_DEFAULT; + } + else if(ISALNUM(c)) { + charset[c] = 1; + (*p)++; + } + else if(c == '\\') { + c = *(++(*p)); + if(ISPRINT(c)) { + charset[c] = 1; + (*p)++; + } + else + return SETCHARSET_FAIL; + } + else if(c == ']') { + return SETCHARSET_OK; + } + else + return SETCHARSET_FAIL; + break; + case CURLFNM_SCHS_MAYRANGE2: + if(c == '\\') { + c = *(++(*p)); + if(!ISPRINT(c)) + return SETCHARSET_FAIL; + } + if(c == ']') { + return SETCHARSET_OK; + } + else if(c == '\\') { + c = *(++(*p)); + if(ISPRINT(c)) { + charset[c] = 1; + state = CURLFNM_SCHS_DEFAULT; + (*p)++; + } + else + return SETCHARSET_FAIL; + } + if(c >= rangestart) { + if((ISLOWER(c) && ISLOWER(rangestart)) || + (ISDIGIT(c) && ISDIGIT(rangestart)) || + (ISUPPER(c) && ISUPPER(rangestart))) { + charset[lastchar] = 0; + rangestart++; + while(rangestart++ <= c) + charset[rangestart-1] = 1; + (*p)++; + state = CURLFNM_SCHS_DEFAULT; + } + else + return SETCHARSET_FAIL; + } + break; + case CURLFNM_SCHS_RIGHTBR: + if(c == '[') { + state = CURLFNM_SCHS_RIGHTBRLEFTBR; + charset[c] = 1; + (*p)++; + } + else if(c == ']') { + return SETCHARSET_OK; + } + else if(c == '\0') { + return SETCHARSET_FAIL; + } + else if(ISPRINT(c)) { + charset[c] = 1; + (*p)++; + state = CURLFNM_SCHS_DEFAULT; + } + else + /* used 'goto fail' instead of 'return SETCHARSET_FAIL' to avoid a + * nonsense warning 'statement not reached' at end of the fnc when + * compiling on Solaris */ + goto fail; + break; + case CURLFNM_SCHS_RIGHTBRLEFTBR: + if(c == ']') { + return SETCHARSET_OK; + } + else { + state = CURLFNM_SCHS_DEFAULT; + charset[c] = 1; + (*p)++; + } + break; + } + } +fail: + return SETCHARSET_FAIL; +} + +static int loop(const unsigned char *pattern, const unsigned char *string) +{ + loop_state state = CURLFNM_LOOP_DEFAULT; + unsigned char *p = (unsigned char *)pattern; + unsigned char *s = (unsigned char *)string; + unsigned char charset[CURLFNM_CHSET_SIZE] = { 0 }; + int rc = 0; + + for (;;) { + switch(state) { + case CURLFNM_LOOP_DEFAULT: + if(*p == '*') { + while(*(p+1) == '*') /* eliminate multiple stars */ + p++; + if(*s == '\0' && *(p+1) == '\0') + return CURL_FNMATCH_MATCH; + rc = loop(p + 1, s); /* *.txt matches .txt <=> .txt matches .txt */ + if(rc == CURL_FNMATCH_MATCH) + return CURL_FNMATCH_MATCH; + if(*s) /* let the star eat up one character */ + s++; + else + return CURL_FNMATCH_NOMATCH; + } + else if(*p == '?') { + if(ISPRINT(*s)) { + s++; + p++; + } + else if(*s == '\0') + return CURL_FNMATCH_NOMATCH; + else + return CURL_FNMATCH_FAIL; /* cannot deal with other character */ + } + else if(*p == '\0') { + if(*s == '\0') + return CURL_FNMATCH_MATCH; + else + return CURL_FNMATCH_NOMATCH; + } + else if(*p == '\\') { + state = CURLFNM_LOOP_BACKSLASH; + p++; + } + else if(*p == '[') { + unsigned char *pp = p+1; /* cannot handle with pointer to register */ + if(setcharset(&pp, charset)) { + int found = FALSE; + if(charset[(unsigned int)*s]) + found = TRUE; + else if(charset[CURLFNM_ALNUM]) + found = ISALNUM(*s); + else if(charset[CURLFNM_ALPHA]) + found = ISALPHA(*s); + else if(charset[CURLFNM_DIGIT]) + found = ISDIGIT(*s); + else if(charset[CURLFNM_XDIGIT]) + found = ISXDIGIT(*s); + else if(charset[CURLFNM_PRINT]) + found = ISPRINT(*s); + else if(charset[CURLFNM_SPACE]) + found = ISSPACE(*s); + else if(charset[CURLFNM_UPPER]) + found = ISUPPER(*s); + else if(charset[CURLFNM_LOWER]) + found = ISLOWER(*s); + else if(charset[CURLFNM_BLANK]) + found = ISBLANK(*s); + else if(charset[CURLFNM_GRAPH]) + found = ISGRAPH(*s); + + if(charset[CURLFNM_NEGATE]) + found = !found; + + if(found) { + p = pp+1; + s++; + memset(charset, 0, CURLFNM_CHSET_SIZE); + } + else + return CURL_FNMATCH_NOMATCH; + } + else + return CURL_FNMATCH_FAIL; + } + else { + if(*p++ != *s++) + return CURL_FNMATCH_NOMATCH; + } + break; + case CURLFNM_LOOP_BACKSLASH: + if(ISPRINT(*p)) { + if(*p++ == *s++) + state = CURLFNM_LOOP_DEFAULT; + else + return CURL_FNMATCH_NOMATCH; + } + else + return CURL_FNMATCH_FAIL; + break; + } + } +} + +int Curl_fnmatch(void *ptr, const char *pattern, const char *string) +{ + (void)ptr; /* the argument is specified by the curl_fnmatch_callback + prototype, but not used by Curl_fnmatch() */ + if(!pattern || !string) { + return CURL_FNMATCH_FAIL; + } + return loop((unsigned char *)pattern, (unsigned char *)string); +} diff --git a/mobicore/common/curl/lib/curl_fnmatch.h b/mobicore/common/curl/lib/curl_fnmatch.h new file mode 100644 index 0000000000000000000000000000000000000000..6335d0312313a26f3483bb1ab8631e860618f8e2 --- /dev/null +++ b/mobicore/common/curl/lib/curl_fnmatch.h @@ -0,0 +1,44 @@ +#ifndef HEADER_CURL_FNMATCH_H +#define HEADER_CURL_FNMATCH_H +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) 1998 - 2009, Daniel Stenberg, , et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at http://curl.haxx.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ***************************************************************************/ + +#define CURL_FNMATCH_MATCH 0 +#define CURL_FNMATCH_NOMATCH 1 +#define CURL_FNMATCH_FAIL 2 + +/* default pattern matching function + * ================================= + * Implemented with recursive backtracking, if you want to use Curl_fnmatch, + * please note that there is not implemented UTF/UNICODE support. + * + * Implemented features: + * '?' notation, does not match UTF characters + * '*' can also work with UTF string + * [a-zA-Z0-9] enumeration support + * + * keywords: alnum, digit, xdigit, alpha, print, blank, lower, graph, space + * and upper (use as "[[:alnum:]]") + */ +int Curl_fnmatch(void *ptr, const char *pattern, const char *string); + +#endif /* HEADER_CURL_FNMATCH_H */ diff --git a/mobicore/common/curl/lib/curl_gethostname.c b/mobicore/common/curl/lib/curl_gethostname.c new file mode 100644 index 0000000000000000000000000000000000000000..7f0bfed54912fcf07d0cfc90fafb474ed7a3bbb4 --- /dev/null +++ b/mobicore/common/curl/lib/curl_gethostname.c @@ -0,0 +1,81 @@ +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) 1998 - 2010, Daniel Stenberg, , et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at http://curl.haxx.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ***************************************************************************/ + +#include "setup.h" + +#ifdef HAVE_UNISTD_H +# include +#endif + +#include "curl_gethostname.h" + +/* + * Curl_gethostname() is a wrapper around gethostname() which allows + * overriding the host name that the function would normally return. + * This capability is used by the test suite to verify exact matching + * of NTLM authentication, which exercises libcurl's MD4 and DES code. + * + * For libcurl debug enabled builds host name overriding takes place + * when environment variable CURL_GETHOSTNAME is set, using the value + * held by the variable to override returned host name. + * + * For libcurl shared library release builds the test suite preloads + * another shared library named libhostname using the LD_PRELOAD + * mechanism which intercepts, and might override, the gethostname() + * function call. In this case a given platform must support the + * LD_PRELOAD mechanism and additionally have environment variable + * CURL_GETHOSTNAME set in order to override the returned host name. + * + * For libcurl static library release builds no overriding takes place. + */ + +int Curl_gethostname(char *name, GETHOSTNAME_TYPE_ARG2 namelen) { + +#ifndef HAVE_GETHOSTNAME + + /* Allow compilation and return failure when unavailable */ + (void) name; + (void) namelen; + return -1; + +#else + +#ifdef DEBUGBUILD + + /* Override host name when environment variable CURL_GETHOSTNAME is set */ + const char *force_hostname = getenv("CURL_GETHOSTNAME"); + if(force_hostname) { + strncpy(name, force_hostname, namelen); + name[namelen-1] = '\0'; + return 0; + } + +#endif /* DEBUGBUILD */ + + /* The call to system's gethostname() might get intercepted by the + libhostname library when libcurl is built as a non-debug shared + library when running the test suite. */ + return gethostname(name, namelen); + +#endif + +} diff --git a/mobicore/common/curl/lib/curl_gethostname.h b/mobicore/common/curl/lib/curl_gethostname.h new file mode 100644 index 0000000000000000000000000000000000000000..b8ecf88d6ae8b630155f5817432d98c624ad8ef9 --- /dev/null +++ b/mobicore/common/curl/lib/curl_gethostname.h @@ -0,0 +1,27 @@ +#ifndef HEADER_CURL_GETHOSTNAME_H +#define HEADER_CURL_GETHOSTNAME_H +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) 1998 - 2010, Daniel Stenberg, , et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at http://curl.haxx.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ***************************************************************************/ + +int Curl_gethostname(char *name, GETHOSTNAME_TYPE_ARG2 namelen); + +#endif /* HEADER_CURL_GETHOSTNAME_H */ diff --git a/mobicore/common/curl/lib/curl_hmac.h b/mobicore/common/curl/lib/curl_hmac.h new file mode 100644 index 0000000000000000000000000000000000000000..9b65c8c2a1bd569db79e7e4807fc4788f11f7351 --- /dev/null +++ b/mobicore/common/curl/lib/curl_hmac.h @@ -0,0 +1,67 @@ +#ifndef HEADER_CURL_HMAC_H +#define HEADER_CURL_HMAC_H +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) 1998 - 2010, Daniel Stenberg, , et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at http://curl.haxx.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ***************************************************************************/ + +#ifndef CURL_DISABLE_CRYPTO_AUTH + +typedef void (* HMAC_hinit_func)(void * context); +typedef void (* HMAC_hupdate_func)(void * context, + const unsigned char * data, + unsigned int len); +typedef void (* HMAC_hfinal_func)(unsigned char * result, void * context); + + +/* Per-hash function HMAC parameters. */ + +typedef struct { + HMAC_hinit_func hmac_hinit; /* Initialize context procedure. */ + HMAC_hupdate_func hmac_hupdate; /* Update context with data. */ + HMAC_hfinal_func hmac_hfinal; /* Get final result procedure. */ + unsigned int hmac_ctxtsize; /* Context structure size. */ + unsigned int hmac_maxkeylen; /* Maximum key length (bytes). */ + unsigned int hmac_resultlen; /* Result length (bytes). */ +} HMAC_params; + + +/* HMAC computation context. */ + +typedef struct { + const HMAC_params * hmac_hash; /* Hash function definition. */ + void * hmac_hashctxt1; /* Hash function context 1. */ + void * hmac_hashctxt2; /* Hash function context 2. */ +} HMAC_context; + + +/* Prototypes. */ + +HMAC_context * Curl_HMAC_init(const HMAC_params * hashparams, + const unsigned char * key, + unsigned int keylen); +int Curl_HMAC_update(HMAC_context * context, + const unsigned char * data, + unsigned int len); +int Curl_HMAC_final(HMAC_context * context, unsigned char * result); + +#endif + +#endif /* HEADER_CURL_HMAC_H */ diff --git a/mobicore/common/curl/lib/curl_ldap.h b/mobicore/common/curl/lib/curl_ldap.h new file mode 100644 index 0000000000000000000000000000000000000000..3cce4bf7b09d11b35c075d11e6c2c5417c1cab38 --- /dev/null +++ b/mobicore/common/curl/lib/curl_ldap.h @@ -0,0 +1,34 @@ +#ifndef __CURL_LDAP_H +#define __CURL_LDAP_H + +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) 1998 - 2010, Daniel Stenberg, , et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at http://curl.haxx.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ***************************************************************************/ +#ifndef CURL_DISABLE_LDAP +extern const struct Curl_handler Curl_handler_ldap; + +#if (defined(USE_OPENLDAP) && defined(USE_SSL)) || \ + (!defined(USE_OPENLDAP) && defined(HAVE_LDAP_SSL)) +extern const struct Curl_handler Curl_handler_ldaps; +#endif + +#endif +#endif /* __CURL_LDAP_H */ diff --git a/mobicore/common/curl/lib/curl_md4.h b/mobicore/common/curl/lib/curl_md4.h new file mode 100644 index 0000000000000000000000000000000000000000..6b6c16e134c5e6cd714ad83875e8348d2be7dd9d --- /dev/null +++ b/mobicore/common/curl/lib/curl_md4.h @@ -0,0 +1,33 @@ +#ifndef HEADER_CURL_MD4_H +#define HEADER_CURL_MD4_H +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) 1998 - 2010, Daniel Stenberg, , et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at http://curl.haxx.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ***************************************************************************/ + +#include "setup.h" + +/* NSS crypto library does not provide the MD4 hash algorithm, so that we have + * a local implementation of it */ +#ifdef USE_NSS +void Curl_md4it(unsigned char *output, const unsigned char *input, size_t len); +#endif /* USE_NSS */ + +#endif /* HEADER_CURL_MD4_H */ diff --git a/mobicore/common/curl/lib/curl_md5.h b/mobicore/common/curl/lib/curl_md5.h new file mode 100644 index 0000000000000000000000000000000000000000..ddc61e3e529880b151912414d57cf6bd0ae104a5 --- /dev/null +++ b/mobicore/common/curl/lib/curl_md5.h @@ -0,0 +1,34 @@ +#ifndef HEADER_CURL_MD5_H +#define HEADER_CURL_MD5_H +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) 1998 - 2010, Daniel Stenberg, , et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at http://curl.haxx.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ***************************************************************************/ + +#ifndef CURL_DISABLE_CRYPTO_AUTH +#include "curl_hmac.h" + +extern const HMAC_params Curl_HMAC_MD5[1]; + +void Curl_md5it(unsigned char *output, + const unsigned char *input); +#endif + +#endif /* HEADER_CURL_MD5_H */ diff --git a/mobicore/common/curl/lib/curl_memory.h b/mobicore/common/curl/lib/curl_memory.h new file mode 100644 index 0000000000000000000000000000000000000000..e11945823482cfab6be8cca429e7bdff9de7efe0 --- /dev/null +++ b/mobicore/common/curl/lib/curl_memory.h @@ -0,0 +1,49 @@ +#ifndef HEADER_CURL_MEMORY_H +#define HEADER_CURL_MEMORY_H +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) 1998 - 2009, Daniel Stenberg, , et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at http://curl.haxx.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ***************************************************************************/ + +#include /* for the typedefs */ + +extern curl_malloc_callback Curl_cmalloc; +extern curl_free_callback Curl_cfree; +extern curl_realloc_callback Curl_crealloc; +extern curl_strdup_callback Curl_cstrdup; +extern curl_calloc_callback Curl_ccalloc; + +#ifndef CURLDEBUG +/* Only do this define-mania if we're not using the memdebug system, as that + has preference on this magic. */ +#undef strdup +#define strdup(ptr) Curl_cstrdup(ptr) +#undef malloc +#define malloc(size) Curl_cmalloc(size) +#undef calloc +#define calloc(nbelem,size) Curl_ccalloc(nbelem, size) +#undef realloc +#define realloc(ptr,size) Curl_crealloc(ptr, size) +#undef free +#define free(ptr) Curl_cfree(ptr) + +#endif + +#endif /* HEADER_CURL_MEMORY_H */ diff --git a/mobicore/common/curl/lib/curl_memrchr.c b/mobicore/common/curl/lib/curl_memrchr.c new file mode 100644 index 0000000000000000000000000000000000000000..a1e2bf0e583502feff6db0af1b10c558939067f6 --- /dev/null +++ b/mobicore/common/curl/lib/curl_memrchr.c @@ -0,0 +1,62 @@ +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) 1998 - 2009, Daniel Stenberg, , et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at http://curl.haxx.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ***************************************************************************/ + +#include "setup.h" + +#include "curl_memrchr.h" + +#define _MPRINTF_REPLACE /* use our functions only */ +#include + +#include "curl_memory.h" +/* The last #include file should be: */ +#include "memdebug.h" + +#ifndef HAVE_MEMRCHR + +/* + * Curl_memrchr() + * + * Our memrchr() function clone for systems which lack this function. The + * memrchr() function is like the memchr() function, except that it searches + * backwards from the end of the n bytes pointed to by s instead of forward + * from the beginning. + */ + +void * +Curl_memrchr(const void *s, int c, size_t n) +{ + const unsigned char *p = s; + const unsigned char *q = s; + + p += n - 1; + + while (p >= q) { + if (*p == (unsigned char)c) + return (void *)p; + p--; + } + + return NULL; +} + +#endif /* HAVE_MEMRCHR */ diff --git a/mobicore/common/curl/lib/curl_memrchr.h b/mobicore/common/curl/lib/curl_memrchr.h new file mode 100644 index 0000000000000000000000000000000000000000..37061b6082c92eafd0165839879c71bf366e7122 --- /dev/null +++ b/mobicore/common/curl/lib/curl_memrchr.h @@ -0,0 +1,44 @@ +#ifndef HEADER_CURL_MEMRCHR_H +#define HEADER_CURL_MEMRCHR_H +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) 1998 - 2009, Daniel Stenberg, , et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at http://curl.haxx.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ***************************************************************************/ + +#include "setup.h" + +#ifdef HAVE_MEMRCHR + +#ifdef HAVE_STRING_H +# include +#endif +#ifdef HAVE_STRINGS_H +# include +#endif + +#else /* HAVE_MEMRCHR */ + +void *Curl_memrchr(const void *s, int c, size_t n); + +#define memrchr(x,y,z) Curl_memrchr((x),(y),(z)) + +#endif /* HAVE_MEMRCHR */ + +#endif /* HEADER_CURL_MEMRCHR_H */ diff --git a/mobicore/common/curl/lib/curl_rand.c b/mobicore/common/curl/lib/curl_rand.c new file mode 100644 index 0000000000000000000000000000000000000000..047b7f345f3b0f99df751ff3bc313fbda672e1ab --- /dev/null +++ b/mobicore/common/curl/lib/curl_rand.c @@ -0,0 +1,61 @@ +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) 1998 - 2009, Daniel Stenberg, , et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at http://curl.haxx.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ***************************************************************************/ + +#include "setup.h" + +#include + +#include "curl_rand.h" + +#define _MPRINTF_REPLACE /* use our functions only */ +#include + +#include "curl_memory.h" +/* The last #include file should be: */ +#include "memdebug.h" + +/* Private pseudo-random number seed. Unsigned integer >= 32bit. Threads + mutual exclusion is not implemented to acess it since we do not require + high quality random numbers (only used in form boudary generation). */ + +static unsigned int randseed; + +/* Pseudo-random number support. */ + +unsigned int Curl_rand(void) +{ + unsigned int r; + /* Return an unsigned 32-bit pseudo-random number. */ + r = randseed = randseed * 1103515245 + 12345; + return (r << 16) | ((r >> 16) & 0xFFFF); +} + +void Curl_srand(void) +{ + /* Randomize pseudo-random number sequence. */ + + randseed = (unsigned int) time(NULL); + Curl_rand(); + Curl_rand(); + Curl_rand(); +} + diff --git a/mobicore/common/curl/lib/curl_rand.h b/mobicore/common/curl/lib/curl_rand.h new file mode 100644 index 0000000000000000000000000000000000000000..26cfb7f033bc299a4945bb8ba13c32541953fd8f --- /dev/null +++ b/mobicore/common/curl/lib/curl_rand.h @@ -0,0 +1,29 @@ +#ifndef HEADER_CURL_RAND_H +#define HEADER_CURL_RAND_H +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) 1998 - 2009, Daniel Stenberg, , et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at http://curl.haxx.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ***************************************************************************/ + +void Curl_srand(void); + +unsigned int Curl_rand(void); + +#endif /* HEADER_CURL_RAND_H */ diff --git a/mobicore/common/curl/lib/curl_rtmp.c b/mobicore/common/curl/lib/curl_rtmp.c new file mode 100644 index 0000000000000000000000000000000000000000..bc1769e67dec17030372f5f75b617a243523c0ba --- /dev/null +++ b/mobicore/common/curl/lib/curl_rtmp.c @@ -0,0 +1,286 @@ +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) 2010, Howard Chu, + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at http://curl.haxx.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ***************************************************************************/ + +#include "setup.h" + +#ifdef USE_LIBRTMP + +#include "urldata.h" +#include "nonblock.h" /* for curlx_nonblock */ +#include "progress.h" /* for Curl_pgrsSetUploadSize */ +#include "transfer.h" +#include +#include + +#define _MPRINTF_REPLACE /* use our functions only */ +#include + +#include "curl_memory.h" +/* The last #include file should be: */ +#include "memdebug.h" + +#ifdef _WIN32 +#define setsockopt(a,b,c,d,e) (setsockopt)(a,b,c,(const char *)d,(int)e) +#define SET_RCVTIMEO(tv,s) int tv = s*1000 +#else +#define SET_RCVTIMEO(tv,s) struct timeval tv = {s,0} +#endif + +#define DEF_BUFTIME (2*60*60*1000) /* 2 hours */ + +static CURLcode rtmp_setup(struct connectdata *conn); +static CURLcode rtmp_do(struct connectdata *conn, bool *done); +static CURLcode rtmp_done(struct connectdata *conn, CURLcode, bool premature); +static CURLcode rtmp_connect(struct connectdata *conn, bool *done); +static CURLcode rtmp_disconnect(struct connectdata *conn, bool dead_connection); + +static Curl_recv rtmp_recv; +static Curl_send rtmp_send; + +/* + * RTMP protocol handler.h, based on http://rtmpdump.mplayerhq.hu + */ + +const struct Curl_handler Curl_handler_rtmp = { + "RTMP", /* scheme */ + rtmp_setup, /* setup_connection */ + rtmp_do, /* do_it */ + rtmp_done, /* done */ + ZERO_NULL, /* do_more */ + rtmp_connect, /* connect_it */ + ZERO_NULL, /* connecting */ + ZERO_NULL, /* doing */ + ZERO_NULL, /* proto_getsock */ + ZERO_NULL, /* doing_getsock */ + ZERO_NULL, /* perform_getsock */ + rtmp_disconnect, /* disconnect */ + PORT_RTMP, /* defport */ + PROT_RTMP /* protocol */ +}; + +const struct Curl_handler Curl_handler_rtmpt = { + "RTMPT", /* scheme */ + rtmp_setup, /* setup_connection */ + rtmp_do, /* do_it */ + rtmp_done, /* done */ + ZERO_NULL, /* do_more */ + rtmp_connect, /* connect_it */ + ZERO_NULL, /* connecting */ + ZERO_NULL, /* doing */ + ZERO_NULL, /* proto_getsock */ + ZERO_NULL, /* doing_getsock */ + ZERO_NULL, /* perform_getsock */ + rtmp_disconnect, /* disconnect */ + PORT_RTMPT, /* defport */ + PROT_RTMPT /* protocol */ +}; + +const struct Curl_handler Curl_handler_rtmpe = { + "RTMPE", /* scheme */ + rtmp_setup, /* setup_connection */ + rtmp_do, /* do_it */ + rtmp_done, /* done */ + ZERO_NULL, /* do_more */ + rtmp_connect, /* connect_it */ + ZERO_NULL, /* connecting */ + ZERO_NULL, /* doing */ + ZERO_NULL, /* proto_getsock */ + ZERO_NULL, /* doing_getsock */ + ZERO_NULL, /* perform_getsock */ + rtmp_disconnect, /* disconnect */ + PORT_RTMP, /* defport */ + PROT_RTMPE /* protocol */ +}; + +const struct Curl_handler Curl_handler_rtmpte = { + "RTMPTE", /* scheme */ + rtmp_setup, /* setup_connection */ + rtmp_do, /* do_it */ + rtmp_done, /* done */ + ZERO_NULL, /* do_more */ + rtmp_connect, /* connect_it */ + ZERO_NULL, /* connecting */ + ZERO_NULL, /* doing */ + ZERO_NULL, /* proto_getsock */ + ZERO_NULL, /* doing_getsock */ + ZERO_NULL, /* perform_getsock */ + rtmp_disconnect, /* disconnect */ + PORT_RTMPT, /* defport */ + PROT_RTMPTE /* protocol */ +}; + +const struct Curl_handler Curl_handler_rtmps = { + "RTMPS", /* scheme */ + rtmp_setup, /* setup_connection */ + rtmp_do, /* do_it */ + rtmp_done, /* done */ + ZERO_NULL, /* do_more */ + rtmp_connect, /* connect_it */ + ZERO_NULL, /* connecting */ + ZERO_NULL, /* doing */ + ZERO_NULL, /* proto_getsock */ + ZERO_NULL, /* doing_getsock */ + ZERO_NULL, /* perform_getsock */ + rtmp_disconnect, /* disconnect */ + PORT_RTMPS, /* defport */ + PROT_RTMPS /* protocol */ +}; +const struct Curl_handler Curl_handler_rtmpts = { + "RTMPTS", /* scheme */ + rtmp_setup, /* setup_connection */ + rtmp_do, /* do_it */ + rtmp_done, /* done */ + ZERO_NULL, /* do_more */ + rtmp_connect, /* connect_it */ + ZERO_NULL, /* connecting */ + ZERO_NULL, /* doing */ + ZERO_NULL, /* proto_getsock */ + ZERO_NULL, /* doing_getsock */ + ZERO_NULL, /* perform_getsock */ + rtmp_disconnect, /* disconnect */ + PORT_RTMPS, /* defport */ + PROT_RTMPTS /* protocol */ +}; + +static CURLcode rtmp_setup(struct connectdata *conn) +{ + RTMP *r = RTMP_Alloc(); + + if (!r) + return CURLE_OUT_OF_MEMORY; + + RTMP_Init(r); + RTMP_SetBufferMS(r, DEF_BUFTIME); + if (!RTMP_SetupURL(r, conn->data->change.url)) { + RTMP_Free(r); + return CURLE_URL_MALFORMAT; + } + conn->proto.generic = r; + return CURLE_OK; +} + +static CURLcode rtmp_connect(struct connectdata *conn, bool *done) +{ + RTMP *r = conn->proto.generic; + SET_RCVTIMEO(tv,10); + + r->m_sb.sb_socket = conn->sock[FIRSTSOCKET]; + + /* We have to know if it's a write before we send the + * connect request packet + */ + if (conn->data->set.upload) + r->Link.protocol |= RTMP_FEATURE_WRITE; + + /* For plain streams, use the buffer toggle trick to keep data flowing */ + if (!(r->Link.lFlags & RTMP_LF_LIVE) && !(r->Link.protocol & RTMP_FEATURE_HTTP)) + r->Link.lFlags |= RTMP_LF_BUFX; + + curlx_nonblock(r->m_sb.sb_socket, FALSE); + setsockopt(r->m_sb.sb_socket, SOL_SOCKET, SO_RCVTIMEO, (char *)&tv, sizeof(tv)); + + if (!RTMP_Connect1(r, NULL)) + return CURLE_FAILED_INIT; + + /* Clients must send a periodic BytesReceived report to the server */ + r->m_bSendCounter = true; + + *done = TRUE; + conn->recv[FIRSTSOCKET] = rtmp_recv; + conn->send[FIRSTSOCKET] = rtmp_send; + return CURLE_OK; +} + +static CURLcode rtmp_do(struct connectdata *conn, bool *done) +{ + RTMP *r = conn->proto.generic; + + if (!RTMP_ConnectStream(r, 0)) + return CURLE_FAILED_INIT; + + if (conn->data->set.upload) { + Curl_pgrsSetUploadSize(conn->data, conn->data->set.infilesize); + Curl_setup_transfer(conn, -1, -1, FALSE, NULL, FIRSTSOCKET, NULL); + } else + Curl_setup_transfer(conn, FIRSTSOCKET, -1, FALSE, NULL, -1, NULL); + *done = TRUE; + return CURLE_OK; +} + +static CURLcode rtmp_done(struct connectdata *conn, CURLcode status, + bool premature) +{ + (void)conn; /* unused */ + (void)status; /* unused */ + (void)premature; /* unused */ + + return CURLE_OK; +} + +static CURLcode rtmp_disconnect(struct connectdata *conn, + bool dead_connection) +{ + RTMP *r = conn->proto.generic; + (void)dead_connection; + if (r) { + conn->proto.generic = NULL; + RTMP_Close(r); + RTMP_Free(r); + } + return CURLE_OK; +} + +static ssize_t rtmp_recv(struct connectdata *conn, int sockindex, char *buf, + size_t len, CURLcode *err) +{ + RTMP *r = conn->proto.generic; + ssize_t nread; + + (void)sockindex; /* unused */ + + nread = RTMP_Read(r, buf, len); + if (nread < 0) { + if (r->m_read.status == RTMP_READ_COMPLETE || + r->m_read.status == RTMP_READ_EOF) { + conn->data->req.size = conn->data->req.bytecount; + nread = 0; + } else + *err = CURLE_RECV_ERROR; + } + return nread; +} + +static ssize_t rtmp_send(struct connectdata *conn, int sockindex, + const void *buf, size_t len, CURLcode *err) +{ + RTMP *r = conn->proto.generic; + ssize_t num; + + (void)sockindex; /* unused */ + + num = RTMP_Write(r, (char *)buf, len); + if (num < 0) { + *err = CURLE_SEND_ERROR; + } + return num; +} +#endif /* USE_LIBRTMP */ diff --git a/mobicore/common/curl/lib/curl_rtmp.h b/mobicore/common/curl/lib/curl_rtmp.h new file mode 100644 index 0000000000000000000000000000000000000000..4a9e9e60c218aaaa096906f7cbb1191fdaab67ed --- /dev/null +++ b/mobicore/common/curl/lib/curl_rtmp.h @@ -0,0 +1,33 @@ +#ifndef HEADER_CURL_RTMP_H +#define HEADER_CURL_RTMP_H +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) 2010, Howard Chu, + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at http://curl.haxx.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ***************************************************************************/ +#ifdef USE_LIBRTMP +extern const struct Curl_handler Curl_handler_rtmp; +extern const struct Curl_handler Curl_handler_rtmpt; +extern const struct Curl_handler Curl_handler_rtmpe; +extern const struct Curl_handler Curl_handler_rtmpte; +extern const struct Curl_handler Curl_handler_rtmps; +extern const struct Curl_handler Curl_handler_rtmpts; +#endif + +#endif /* HEADER_CURL_RTMP_H */ diff --git a/mobicore/common/curl/lib/curl_sspi.c b/mobicore/common/curl/lib/curl_sspi.c new file mode 100644 index 0000000000000000000000000000000000000000..b985dbceb0a430c56924cae63cbaed52eb5b3239 --- /dev/null +++ b/mobicore/common/curl/lib/curl_sspi.c @@ -0,0 +1,121 @@ +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) 1998 - 2009, Daniel Stenberg, , et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at http://curl.haxx.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ***************************************************************************/ + +#include "setup.h" + +#ifdef USE_WINDOWS_SSPI + +#include + +#include "curl_sspi.h" + +#define _MPRINTF_REPLACE /* use our functions only */ +#include + +#include "curl_memory.h" +/* The last #include file should be: */ +#include "memdebug.h" + + +/* We use our own typedef here since some headers might lack these */ +typedef PSecurityFunctionTableA (APIENTRY *INITSECURITYINTERFACE_FN_A)(VOID); + +/* Handle of security.dll or secur32.dll, depending on Windows version */ +HMODULE s_hSecDll = NULL; + +/* Pointer to SSPI dispatch table */ +PSecurityFunctionTableA s_pSecFn = NULL; + + +/* + * Curl_sspi_global_init() + * + * This is used to load the Security Service Provider Interface (SSPI) + * dynamic link library portably across all Windows versions, without + * the need to directly link libcurl, nor the application using it, at + * build time. + * + * Once this function has been executed, Windows SSPI functions can be + * called through the Security Service Provider Interface dispatch table. + */ + +CURLcode +Curl_sspi_global_init(void) +{ + OSVERSIONINFO osver; + INITSECURITYINTERFACE_FN_A pInitSecurityInterface; + + /* If security interface is not yet initialized try to do this */ + if(s_hSecDll == NULL) { + + /* Find out Windows version */ + memset(&osver, 0, sizeof(osver)); + osver.dwOSVersionInfoSize = sizeof(osver); + if(! GetVersionEx(&osver)) + return CURLE_FAILED_INIT; + + /* Security Service Provider Interface (SSPI) functions are located in + * security.dll on WinNT 4.0 and in secur32.dll on Win9x. Win2K and XP + * have both these DLLs (security.dll forwards calls to secur32.dll) */ + + /* Load SSPI dll into the address space of the calling process */ + if(osver.dwPlatformId == VER_PLATFORM_WIN32_NT + && osver.dwMajorVersion == 4) + s_hSecDll = LoadLibrary("security.dll"); + else + s_hSecDll = LoadLibrary("secur32.dll"); + if(! s_hSecDll) + return CURLE_FAILED_INIT; + + /* Get address of the InitSecurityInterfaceA function from the SSPI dll */ + pInitSecurityInterface = (INITSECURITYINTERFACE_FN_A) + GetProcAddress(s_hSecDll, "InitSecurityInterfaceA"); + if(! pInitSecurityInterface) + return CURLE_FAILED_INIT; + + /* Get pointer to Security Service Provider Interface dispatch table */ + s_pSecFn = pInitSecurityInterface(); + if(! s_pSecFn) + return CURLE_FAILED_INIT; + + } + return CURLE_OK; +} + + +/* + * Curl_sspi_global_cleanup() + * + * This deinitializes the Security Service Provider Interface from libcurl. + */ + +void +Curl_sspi_global_cleanup(void) +{ + if(s_hSecDll) { + FreeLibrary(s_hSecDll); + s_hSecDll = NULL; + s_pSecFn = NULL; + } +} + +#endif /* USE_WINDOWS_SSPI */ diff --git a/mobicore/common/curl/lib/curl_sspi.h b/mobicore/common/curl/lib/curl_sspi.h new file mode 100644 index 0000000000000000000000000000000000000000..221bce128994aa2650fd0c1fa04c1b9188c66dc3 --- /dev/null +++ b/mobicore/common/curl/lib/curl_sspi.h @@ -0,0 +1,73 @@ +#ifndef HEADER_CURL_SSPI_H +#define HEADER_CURL_SSPI_H +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) 1998 - 2010, Daniel Stenberg, , et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at http://curl.haxx.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ***************************************************************************/ + +#include "setup.h" + +#ifdef USE_WINDOWS_SSPI + +#include + +/* + * When including the folowing three headers, it is mandatory to define either + * SECURITY_WIN32 or SECURITY_KERNEL, indicating who is compiling the code. + */ + +#undef SECURITY_WIN32 +#undef SECURITY_KERNEL +#define SECURITY_WIN32 1 +#include +#include +#include + +/* Provide some definitions missing in MinGW's headers */ + +#ifndef SEC_I_CONTEXT_EXPIRED +# define SEC_I_CONTEXT_EXPIRED ((HRESULT)0x00090317L) +#endif +#ifndef SEC_E_BUFFER_TOO_SMALL +# define SEC_E_BUFFER_TOO_SMALL ((HRESULT)0x80090321L) +#endif +#ifndef SEC_E_CONTEXT_EXPIRED +# define SEC_E_CONTEXT_EXPIRED ((HRESULT)0x80090317L) +#endif +#ifndef SEC_E_CRYPTO_SYSTEM_INVALID +# define SEC_E_CRYPTO_SYSTEM_INVALID ((HRESULT)0x80090337L) +#endif +#ifndef SEC_E_MESSAGE_ALTERED +# define SEC_E_MESSAGE_ALTERED ((HRESULT)0x8009030FL) +#endif +#ifndef SEC_E_OUT_OF_SEQUENCE +# define SEC_E_OUT_OF_SEQUENCE ((HRESULT)0x80090310L) +#endif + +CURLcode Curl_sspi_global_init(void); +void Curl_sspi_global_cleanup(void); + +/* Forward-declaration of global variables defined in curl_sspi.c */ + +extern HMODULE s_hSecDll; +extern PSecurityFunctionTableA s_pSecFn; + +#endif /* USE_WINDOWS_SSPI */ +#endif /* HEADER_CURL_SSPI_H */ diff --git a/mobicore/common/curl/lib/curl_threads.c b/mobicore/common/curl/lib/curl_threads.c new file mode 100644 index 0000000000000000000000000000000000000000..fd10bd487505d03d2689164c65a2dfcb1228ac45 --- /dev/null +++ b/mobicore/common/curl/lib/curl_threads.c @@ -0,0 +1,127 @@ +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) 1998 - 2010, Daniel Stenberg, , et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at http://curl.haxx.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ***************************************************************************/ +#include "setup.h" + +#if defined(USE_THREADS_POSIX) +# ifdef HAVE_PTHREAD_H +# include +# endif +#elif defined(USE_THREADS_WIN32) +# ifdef HAVE_PROCESS_H +# include +# endif +#endif + +#include "curl_threads.h" + +#define _MPRINTF_REPLACE /* use our functions only */ +#include + +#include "curl_memory.h" +/* The last #include file should be: */ +#include "memdebug.h" + +#if defined(USE_THREADS_POSIX) + +struct curl_actual_call { + unsigned int (*func)(void *); + void *arg; +}; + +static void *curl_thread_create_thunk(void *arg) +{ + struct curl_actual_call * ac = arg; + unsigned int (*func)(void *) = ac->func; + void *real_arg = ac->arg; + + free(ac); + + (*func)(real_arg); + + return 0; +} + +curl_thread_t Curl_thread_create(unsigned int (*func) (void*), void *arg) +{ + curl_thread_t t; + struct curl_actual_call *ac = malloc(sizeof(struct curl_actual_call)); + if(!ac) + return curl_thread_t_null; + + ac->func = func; + ac->arg = arg; + + if(pthread_create(&t, NULL, curl_thread_create_thunk, ac) != 0) { + free(ac); + return curl_thread_t_null; + } + + return t; +} + +void Curl_thread_destroy(curl_thread_t hnd) +{ + if(hnd != curl_thread_t_null) + pthread_detach(hnd); +} + +int Curl_thread_join(curl_thread_t *hnd) +{ + int ret = (pthread_join(*hnd, NULL) == 0); + + *hnd = curl_thread_t_null; + + return ret; +} + +#elif defined(USE_THREADS_WIN32) + +curl_thread_t Curl_thread_create(unsigned int (CURL_STDCALL *func) (void*), void *arg) +{ +#ifdef _WIN32_WCE + return CreateThread(NULL, 0, func, arg, 0, NULL); +#else + curl_thread_t t; + t = (curl_thread_t)_beginthreadex(NULL, 0, func, arg, 0, NULL); + if((t == 0) || (t == (curl_thread_t)-1L)) + return curl_thread_t_null; + return t; +#endif +} + +void Curl_thread_destroy(curl_thread_t hnd) +{ + CloseHandle(hnd); +} + +int Curl_thread_join(curl_thread_t *hnd) +{ + int ret = (WaitForSingleObject(*hnd, INFINITE) == WAIT_OBJECT_0); + + Curl_thread_destroy(*hnd); + + *hnd = curl_thread_t_null; + + return ret; +} + +#endif /* USE_THREADS_* */ diff --git a/mobicore/common/curl/lib/curl_threads.h b/mobicore/common/curl/lib/curl_threads.h new file mode 100644 index 0000000000000000000000000000000000000000..ba81054a25c6e076d6a258b26780f89cef50fa78 --- /dev/null +++ b/mobicore/common/curl/lib/curl_threads.h @@ -0,0 +1,57 @@ +#ifndef HEADER_CURL_THREADS_H +#define HEADER_CURL_THREADS_H +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) 1998 - 2010, Daniel Stenberg, , et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at http://curl.haxx.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ***************************************************************************/ +#include "setup.h" + +#if defined(USE_THREADS_POSIX) +# define CURL_STDCALL +# define curl_mutex_t pthread_mutex_t +# define curl_thread_t pthread_t +# define curl_thread_t_null (pthread_t)0 +# define Curl_mutex_init(m) pthread_mutex_init(m, NULL) +# define Curl_mutex_acquire(m) pthread_mutex_lock(m) +# define Curl_mutex_release(m) pthread_mutex_unlock(m) +# define Curl_mutex_destroy(m) pthread_mutex_destroy(m) +#elif defined(USE_THREADS_WIN32) +# define CURL_STDCALL __stdcall +# define curl_mutex_t CRITICAL_SECTION +# define curl_thread_t HANDLE +# define curl_thread_t_null (HANDLE)0 +# define Curl_mutex_init(m) InitializeCriticalSection(m) +# define Curl_mutex_acquire(m) EnterCriticalSection(m) +# define Curl_mutex_release(m) LeaveCriticalSection(m) +# define Curl_mutex_destroy(m) DeleteCriticalSection(m) +#endif + +#if defined(USE_THREADS_POSIX) || defined(USE_THREADS_WIN32) + +curl_thread_t Curl_thread_create(unsigned int (CURL_STDCALL *func) (void*), + void *arg); + +void Curl_thread_destroy(curl_thread_t hnd); + +int Curl_thread_join(curl_thread_t *hnd); + +#endif /* USE_THREADS_POSIX || USE_THREADS_WIN32 */ + +#endif /* HEADER_CURL_THREADS_H */ diff --git a/mobicore/common/curl/lib/curlx.h b/mobicore/common/curl/lib/curlx.h new file mode 100644 index 0000000000000000000000000000000000000000..2b7fec58a024388e846461a680bbda08715050f0 --- /dev/null +++ b/mobicore/common/curl/lib/curlx.h @@ -0,0 +1,118 @@ +#ifndef __CURLX_H +#define __CURLX_H +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) 1998 - 2008, Daniel Stenberg, , et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at http://curl.haxx.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ***************************************************************************/ + +/* + * Defines protos and includes all header files that provide the curlx_* + * functions. The curlx_* functions are not part of the libcurl API, but are + * stand-alone functions whose sources can be built and linked by apps if need + * be. + */ + +#include +/* this is still a public header file that provides the curl_mprintf() + functions while they still are offered publicly. They will be made library- + private one day */ + +#include "strequal.h" +/* "strequal.h" provides the strequal protos */ + +#include "strtoofft.h" +/* "strtoofft.h" provides this function: curlx_strtoofft(), returns a + curl_off_t number from a given string. +*/ + +#include "timeval.h" +/* + "timeval.h" sets up a 'struct timeval' even for platforms that otherwise + don't have one and has protos for these functions: + + curlx_tvnow() + curlx_tvdiff() + curlx_tvdiff_secs() +*/ + +#include "nonblock.h" +/* "nonblock.h" provides curlx_nonblock() */ + +#include "warnless.h" +/* "warnless.h" provides functions: + + curlx_ultous() + curlx_ultouc() + curlx_uztosi() +*/ + +/* Now setup curlx_ * names for the functions that are to become curlx_ and + be removed from a future libcurl official API: + curlx_getenv + curlx_mprintf (and its variations) + curlx_strequal + curlx_strnequal + +*/ + +#define curlx_getenv curl_getenv +#define curlx_strequal curl_strequal +#define curlx_strnequal curl_strnequal +#define curlx_raw_equal Curl_raw_equal +#define curlx_mvsnprintf curl_mvsnprintf +#define curlx_msnprintf curl_msnprintf +#define curlx_maprintf curl_maprintf +#define curlx_mvaprintf curl_mvaprintf +#define curlx_msprintf curl_msprintf +#define curlx_mprintf curl_mprintf +#define curlx_mfprintf curl_mfprintf +#define curlx_mvsprintf curl_mvsprintf +#define curlx_mvprintf curl_mvprintf +#define curlx_mvfprintf curl_mvfprintf + +#ifdef ENABLE_CURLX_PRINTF +/* If this define is set, we define all "standard" printf() functions to use + the curlx_* version instead. It makes the source code transparant and + easier to understand/patch. Undefine them first in case _MPRINTF_REPLACE + is set. */ +# undef printf +# undef fprintf +# undef sprintf +# undef snprintf +# undef vprintf +# undef vfprintf +# undef vsprintf +# undef vsnprintf +# undef aprintf +# undef vaprintf + +# define printf curlx_mprintf +# define fprintf curlx_mfprintf +# define sprintf curlx_msprintf +# define snprintf curlx_msnprintf +# define vprintf curlx_mvprintf +# define vfprintf curlx_mvfprintf +# define vsprintf curlx_mvsprintf +# define vsnprintf curlx_mvsnprintf +# define aprintf curlx_maprintf +# define vaprintf curlx_mvaprintf +#endif /* ENABLE_CURLX_PRINTF */ + +#endif /* __CURLX_H */ diff --git a/mobicore/common/curl/lib/dict.c b/mobicore/common/curl/lib/dict.c new file mode 100644 index 0000000000000000000000000000000000000000..d86923a9fdffa9bf2edcc9187b5ed3bb2e95ab98 --- /dev/null +++ b/mobicore/common/curl/lib/dict.c @@ -0,0 +1,300 @@ +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) 1998 - 2010, Daniel Stenberg, , et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at http://curl.haxx.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ***************************************************************************/ + +#include "setup.h" + +#ifndef CURL_DISABLE_DICT + +/* -- WIN32 approved -- */ +#include +#include +#include +#include +#include + +#ifdef WIN32 +#include +#include +#else +#ifdef HAVE_SYS_SOCKET_H +#include +#endif +#include +#ifdef HAVE_SYS_TIME_H +#include +#endif +#ifdef HAVE_UNISTD_H +#include +#endif +#include +#ifdef HAVE_ARPA_INET_H +#include +#endif +#ifdef HAVE_NET_IF_H +#include +#endif +#ifdef HAVE_SYS_IOCTL_H +#include +#endif + +#ifdef HAVE_SYS_PARAM_H +#include +#endif + +#ifdef HAVE_SYS_SELECT_H +#include +#endif + + +#endif + +#include "urldata.h" +#include +#include "transfer.h" +#include "sendf.h" + +#include "progress.h" +#include "strequal.h" +#include "dict.h" +#include "rawstr.h" + +#define _MPRINTF_REPLACE /* use our functions only */ +#include + +/* The last #include file should be: */ +#include "memdebug.h" + + +/* + * Forward declarations. + */ + +static CURLcode dict_do(struct connectdata *conn, bool *done); + +/* + * DICT protocol handler. + */ + +const struct Curl_handler Curl_handler_dict = { + "DICT", /* scheme */ + ZERO_NULL, /* setup_connection */ + dict_do, /* do_it */ + ZERO_NULL, /* done */ + ZERO_NULL, /* do_more */ + ZERO_NULL, /* connect_it */ + ZERO_NULL, /* connecting */ + ZERO_NULL, /* doing */ + ZERO_NULL, /* proto_getsock */ + ZERO_NULL, /* doing_getsock */ + ZERO_NULL, /* perform_getsock */ + ZERO_NULL, /* disconnect */ + PORT_DICT, /* defport */ + PROT_DICT /* protocol */ +}; + +static char *unescape_word(struct SessionHandle *data, const char *inputbuff) +{ + char *newp; + char *dictp; + char *ptr; + int len; + char byte; + int olen=0; + + newp = curl_easy_unescape(data, inputbuff, 0, &len); + if(!newp) + return NULL; + + dictp = malloc(((size_t)len)*2 + 1); /* add one for terminating zero */ + if(dictp) { + /* According to RFC2229 section 2.2, these letters need to be escaped with + \[letter] */ + for(ptr = newp; + (byte = *ptr) != 0; + ptr++) { + if((byte <= 32) || (byte == 127) || + (byte == '\'') || (byte == '\"') || (byte == '\\')) { + dictp[olen++] = '\\'; + } + dictp[olen++] = byte; + } + dictp[olen]=0; + + free(newp); + } + return dictp; +} + +static CURLcode dict_do(struct connectdata *conn, bool *done) +{ + char *word; + char *eword; + char *ppath; + char *database = NULL; + char *strategy = NULL; + char *nthdef = NULL; /* This is not part of the protocol, but required + by RFC 2229 */ + CURLcode result=CURLE_OK; + struct SessionHandle *data=conn->data; + curl_socket_t sockfd = conn->sock[FIRSTSOCKET]; + + char *path = data->state.path; + curl_off_t *bytecount = &data->req.bytecount; + + *done = TRUE; /* unconditionally */ + + if(conn->bits.user_passwd) { + /* AUTH is missing */ + } + + if(Curl_raw_nequal(path, DICT_MATCH, sizeof(DICT_MATCH)-1) || + Curl_raw_nequal(path, DICT_MATCH2, sizeof(DICT_MATCH2)-1) || + Curl_raw_nequal(path, DICT_MATCH3, sizeof(DICT_MATCH3)-1)) { + + word = strchr(path, ':'); + if(word) { + word++; + database = strchr(word, ':'); + if(database) { + *database++ = (char)0; + strategy = strchr(database, ':'); + if(strategy) { + *strategy++ = (char)0; + nthdef = strchr(strategy, ':'); + if(nthdef) { + *nthdef = (char)0; + } + } + } + } + + if((word == NULL) || (*word == (char)0)) { + infof(data, "lookup word is missing"); + word=(char *)"default"; + } + if((database == NULL) || (*database == (char)0)) { + database = (char *)"!"; + } + if((strategy == NULL) || (*strategy == (char)0)) { + strategy = (char *)"."; + } + + eword = unescape_word(data, word); + if(!eword) + return CURLE_OUT_OF_MEMORY; + + result = Curl_sendf(sockfd, conn, + "CLIENT " LIBCURL_NAME " " LIBCURL_VERSION "\r\n" + "MATCH " + "%s " /* database */ + "%s " /* strategy */ + "%s\r\n" /* word */ + "QUIT\r\n", + + database, + strategy, + eword + ); + + free(eword); + + if(result) { + failf(data, "Failed sending DICT request"); + return result; + } + Curl_setup_transfer(conn, FIRSTSOCKET, -1, FALSE, bytecount, + -1, NULL); /* no upload */ + } + else if(Curl_raw_nequal(path, DICT_DEFINE, sizeof(DICT_DEFINE)-1) || + Curl_raw_nequal(path, DICT_DEFINE2, sizeof(DICT_DEFINE2)-1) || + Curl_raw_nequal(path, DICT_DEFINE3, sizeof(DICT_DEFINE3)-1)) { + + word = strchr(path, ':'); + if(word) { + word++; + database = strchr(word, ':'); + if(database) { + *database++ = (char)0; + nthdef = strchr(database, ':'); + if(nthdef) { + *nthdef = (char)0; + } + } + } + + if((word == NULL) || (*word == (char)0)) { + infof(data, "lookup word is missing"); + word=(char *)"default"; + } + if((database == NULL) || (*database == (char)0)) { + database = (char *)"!"; + } + + eword = unescape_word(data, word); + if(!eword) + return CURLE_OUT_OF_MEMORY; + + result = Curl_sendf(sockfd, conn, + "CLIENT " LIBCURL_NAME " " LIBCURL_VERSION "\r\n" + "DEFINE " + "%s " /* database */ + "%s\r\n" /* word */ + "QUIT\r\n", + database, + eword); + + free(eword); + + if(result) { + failf(data, "Failed sending DICT request"); + return result; + } + Curl_setup_transfer(conn, FIRSTSOCKET, -1, FALSE, bytecount, + -1, NULL); /* no upload */ + } + else { + + ppath = strchr(path, '/'); + if(ppath) { + int i; + + ppath++; + for (i = 0; ppath[i]; i++) { + if(ppath[i] == ':') + ppath[i] = ' '; + } + result = Curl_sendf(sockfd, conn, + "CLIENT " LIBCURL_NAME " " LIBCURL_VERSION "\r\n" + "%s\r\n" + "QUIT\r\n", ppath); + if(result) { + failf(data, "Failed sending DICT request"); + return result; + } + + Curl_setup_transfer(conn, FIRSTSOCKET, -1, FALSE, bytecount, -1, NULL); + } + } + + return CURLE_OK; +} +#endif /*CURL_DISABLE_DICT*/ diff --git a/mobicore/common/curl/lib/dict.h b/mobicore/common/curl/lib/dict.h new file mode 100644 index 0000000000000000000000000000000000000000..44fd9d49d538543c4344466b4f4be2fefd74501d --- /dev/null +++ b/mobicore/common/curl/lib/dict.h @@ -0,0 +1,29 @@ +#ifndef HEADER_CURL_DICT_H +#define HEADER_CURL_DICT_H +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) 1998 - 2009, Daniel Stenberg, , et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at http://curl.haxx.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ***************************************************************************/ + +#ifndef CURL_DISABLE_DICT +extern const struct Curl_handler Curl_handler_dict; +#endif + +#endif /* HEADER_CURL_DICT_H */ diff --git a/mobicore/common/curl/lib/easy.c b/mobicore/common/curl/lib/easy.c new file mode 100644 index 0000000000000000000000000000000000000000..6f553475bc4327e93ae2cfc2a583d15b445eadc5 --- /dev/null +++ b/mobicore/common/curl/lib/easy.c @@ -0,0 +1,1145 @@ +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) 1998 - 2010, Daniel Stenberg, , et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at http://curl.haxx.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ***************************************************************************/ + +#include "setup.h" + +/* -- WIN32 approved -- */ +#include +#include +#include +#include +#include +#include + +#include "strequal.h" + +#ifdef WIN32 +#include +#include +#else +#ifdef HAVE_SYS_SOCKET_H +#include +#endif +#ifdef HAVE_NETINET_IN_H +#include +#endif +#ifdef HAVE_SYS_TIME_H +#include +#endif +#ifdef HAVE_UNISTD_H +#include +#endif +#ifdef HAVE_NETDB_H +#include +#endif +#ifdef HAVE_ARPA_INET_H +#include +#endif +#ifdef HAVE_NET_IF_H +#include +#endif +#ifdef HAVE_SYS_IOCTL_H +#include +#endif + +#ifdef HAVE_SYS_PARAM_H +#include +#endif + +#endif /* WIN32 ... */ + +#include "urldata.h" +#include +#include "transfer.h" +#include "sslgen.h" +#include "url.h" +#include "getinfo.h" +#include "hostip.h" +#include "share.h" +#include "strdup.h" +#include "curl_memory.h" +#include "progress.h" +#include "easyif.h" +#include "select.h" +#include "sendf.h" /* for failf function prototype */ +#include "http_ntlm.h" +#include "connect.h" /* for Curl_getconnectinfo */ +#include "slist.h" +#include "curl_rand.h" + +#define _MPRINTF_REPLACE /* use our functions only */ +#include + +#if defined(CURL_DOES_CONVERSIONS) && defined(HAVE_ICONV) +#include +/* set default codesets for iconv */ +#ifndef CURL_ICONV_CODESET_OF_NETWORK +#define CURL_ICONV_CODESET_OF_NETWORK "ISO8859-1" +#endif +#ifndef CURL_ICONV_CODESET_FOR_UTF8 +#define CURL_ICONV_CODESET_FOR_UTF8 "UTF-8" +#endif +#define ICONV_ERROR (size_t)-1 +#endif /* CURL_DOES_CONVERSIONS && HAVE_ICONV */ + +/* The last #include file should be: */ +#include "memdebug.h" + +/* win32_cleanup() is for win32 socket cleanup functionality, the opposite + of win32_init() */ +static void win32_cleanup(void) +{ +#ifdef USE_WINSOCK + WSACleanup(); +#endif +#ifdef USE_WINDOWS_SSPI + Curl_sspi_global_cleanup(); +#endif +} + +/* win32_init() performs win32 socket initialization to properly setup the + stack to allow networking */ +static CURLcode win32_init(void) +{ +#ifdef USE_WINSOCK + WORD wVersionRequested; + WSADATA wsaData; + int res; + +#if defined(ENABLE_IPV6) && (USE_WINSOCK < 2) + Error IPV6_requires_winsock2 +#endif + + wVersionRequested = MAKEWORD(USE_WINSOCK, USE_WINSOCK); + + res = WSAStartup(wVersionRequested, &wsaData); + + if(res != 0) + /* Tell the user that we couldn't find a useable */ + /* winsock.dll. */ + return CURLE_FAILED_INIT; + + /* Confirm that the Windows Sockets DLL supports what we need.*/ + /* Note that if the DLL supports versions greater */ + /* than wVersionRequested, it will still return */ + /* wVersionRequested in wVersion. wHighVersion contains the */ + /* highest supported version. */ + + if( LOBYTE( wsaData.wVersion ) != LOBYTE(wVersionRequested) || + HIBYTE( wsaData.wVersion ) != HIBYTE(wVersionRequested) ) { + /* Tell the user that we couldn't find a useable */ + + /* winsock.dll. */ + WSACleanup(); + return CURLE_FAILED_INIT; + } + /* The Windows Sockets DLL is acceptable. Proceed. */ +#endif + +#ifdef USE_WINDOWS_SSPI + { + CURLcode err = Curl_sspi_global_init(); + if (err != CURLE_OK) + return err; + } +#endif + + return CURLE_OK; +} + +#ifdef USE_LIBIDN +/* + * Initialise use of IDNA library. + * It falls back to ASCII if $CHARSET isn't defined. This doesn't work for + * idna_to_ascii_lz(). + */ +static void idna_init (void) +{ +#ifdef WIN32 + char buf[60]; + UINT cp = GetACP(); + + if(!getenv("CHARSET") && cp > 0) { + snprintf(buf, sizeof(buf), "CHARSET=cp%u", cp); + putenv(buf); + } +#else + /* to do? */ +#endif +} +#endif /* USE_LIBIDN */ + +/* true globals -- for curl_global_init() and curl_global_cleanup() */ +static unsigned int initialized; +static long init_flags; + +/* + * strdup (and other memory functions) is redefined in complicated + * ways, but at this point it must be defined as the system-supplied strdup + * so the callback pointer is initialized correctly. + */ +#if defined(_WIN32_WCE) +#define system_strdup _strdup +#elif !defined(HAVE_STRDUP) +#define system_strdup curlx_strdup +#else +#define system_strdup strdup +#endif + +#if defined(_MSC_VER) && defined(_DLL) && !defined(__POCC__) +# pragma warning(disable:4232) /* MSVC extension, dllimport identity */ +#endif + +#ifndef __SYMBIAN32__ +/* + * If a memory-using function (like curl_getenv) is used before + * curl_global_init() is called, we need to have these pointers set already. + */ +curl_malloc_callback Curl_cmalloc = (curl_malloc_callback)malloc; +curl_free_callback Curl_cfree = (curl_free_callback)free; +curl_realloc_callback Curl_crealloc = (curl_realloc_callback)realloc; +curl_strdup_callback Curl_cstrdup = (curl_strdup_callback)system_strdup; +curl_calloc_callback Curl_ccalloc = (curl_calloc_callback)calloc; +#else +/* + * Symbian OS doesn't support initialization to code in writeable static data. + * Initialization will occur in the curl_global_init() call. + */ +curl_malloc_callback Curl_cmalloc; +curl_free_callback Curl_cfree; +curl_realloc_callback Curl_crealloc; +curl_strdup_callback Curl_cstrdup; +curl_calloc_callback Curl_ccalloc; +#endif + +#if defined(_MSC_VER) && defined(_DLL) && !defined(__POCC__) +# pragma warning(default:4232) /* MSVC extension, dllimport identity */ +#endif + +/** + * curl_global_init() globally initializes cURL given a bitwise set of the + * different features of what to initialize. + */ +CURLcode curl_global_init(long flags) +{ + if(initialized++) + return CURLE_OK; + + /* Setup the default memory functions here (again) */ + Curl_cmalloc = (curl_malloc_callback)malloc; + Curl_cfree = (curl_free_callback)free; + Curl_crealloc = (curl_realloc_callback)realloc; + Curl_cstrdup = (curl_strdup_callback)system_strdup; + Curl_ccalloc = (curl_calloc_callback)calloc; + + if(flags & CURL_GLOBAL_SSL) + if(!Curl_ssl_init()) { + DEBUGF(fprintf(stderr, "Error: Curl_ssl_init failed\n")); + return CURLE_FAILED_INIT; + } + + if(flags & CURL_GLOBAL_WIN32) + if(win32_init() != CURLE_OK) { + DEBUGF(fprintf(stderr, "Error: win32_init failed\n")); + return CURLE_FAILED_INIT; + } + +#ifdef __AMIGA__ + if(!amiga_init()) { + DEBUGF(fprintf(stderr, "Error: amiga_init failed\n")); + return CURLE_FAILED_INIT; + } +#endif + +#ifdef NETWARE + if(netware_init()) { + DEBUGF(fprintf(stderr, "Warning: LONG namespace not available\n")); + } +#endif + +#ifdef USE_LIBIDN + idna_init(); +#endif + +#ifdef CARES_HAVE_ARES_LIBRARY_INIT + if(ares_library_init(ARES_LIB_INIT_ALL)) { + DEBUGF(fprintf(stderr, "Error: ares_library_init failed\n")); + return CURLE_FAILED_INIT; + } +#endif + +#if defined(USE_LIBSSH2) && defined(HAVE_LIBSSH2_INIT) + if(libssh2_init(0)) { + DEBUGF(fprintf(stderr, "Error: libssh2_init failed\n")); + return CURLE_FAILED_INIT; + } +#endif + + init_flags = flags; + + /* Preset pseudo-random number sequence. */ + + Curl_srand(); + + return CURLE_OK; +} + +/* + * curl_global_init_mem() globally initializes cURL and also registers the + * user provided callback routines. + */ +CURLcode curl_global_init_mem(long flags, curl_malloc_callback m, + curl_free_callback f, curl_realloc_callback r, + curl_strdup_callback s, curl_calloc_callback c) +{ + CURLcode code = CURLE_OK; + + /* Invalid input, return immediately */ + if(!m || !f || !r || !s || !c) + return CURLE_FAILED_INIT; + + /* Already initialized, don't do it again */ + if( initialized ) + return CURLE_OK; + + /* Call the actual init function first */ + code = curl_global_init(flags); + if(code == CURLE_OK) { + Curl_cmalloc = m; + Curl_cfree = f; + Curl_cstrdup = s; + Curl_crealloc = r; + Curl_ccalloc = c; + } + + return code; +} + +/** + * curl_global_cleanup() globally cleanups cURL, uses the value of + * "init_flags" to determine what needs to be cleaned up and what doesn't. + */ +void curl_global_cleanup(void) +{ + if(!initialized) + return; + + if(--initialized) + return; + + Curl_global_host_cache_dtor(); + + if(init_flags & CURL_GLOBAL_SSL) + Curl_ssl_cleanup(); + +#ifdef CARES_HAVE_ARES_LIBRARY_CLEANUP + ares_library_cleanup(); +#endif + + if(init_flags & CURL_GLOBAL_WIN32) + win32_cleanup(); + +#ifdef __AMIGA__ + amiga_cleanup(); +#endif + +#if defined(USE_LIBSSH2) && defined(HAVE_LIBSSH2_EXIT) + (void)libssh2_exit(); +#endif + + init_flags = 0; +} + +/* + * curl_easy_init() is the external interface to alloc, setup and init an + * easy handle that is returned. If anything goes wrong, NULL is returned. + */ +CURL *curl_easy_init(void) +{ + CURLcode res; + struct SessionHandle *data; + + /* Make sure we inited the global SSL stuff */ + if(!initialized) { + res = curl_global_init(CURL_GLOBAL_DEFAULT); + if(res) { + /* something in the global init failed, return nothing */ + DEBUGF(fprintf(stderr, "Error: curl_global_init failed\n")); + return NULL; + } + } + + /* We use curl_open() with undefined URL so far */ + res = Curl_open(&data); + if(res != CURLE_OK) { + DEBUGF(fprintf(stderr, "Error: Curl_open failed\n")); + return NULL; + } + + return data; +} + +/* + * curl_easy_setopt() is the external interface for setting options on an + * easy handle. + */ + +#undef curl_easy_setopt +CURLcode curl_easy_setopt(CURL *curl, CURLoption tag, ...) +{ + va_list arg; + struct SessionHandle *data = curl; + CURLcode ret; + + if(!curl) + return CURLE_BAD_FUNCTION_ARGUMENT; + + va_start(arg, tag); + + ret = Curl_setopt(data, tag, arg); + + va_end(arg); + return ret; +} + +#ifdef CURL_MULTIEASY +/*************************************************************************** + * This function is still only for testing purposes. It makes a great way + * to run the full test suite on the multi interface instead of the easy one. + *************************************************************************** + * + * The *new* curl_easy_perform() is the external interface that performs a + * transfer previously setup. + * + * Wrapper-function that: creates a multi handle, adds the easy handle to it, + * runs curl_multi_perform() until the transfer is done, then detaches the + * easy handle, destroys the multi handle and returns the easy handle's return + * code. This will make everything internally use and assume multi interface. + */ +CURLcode curl_easy_perform(CURL *easy) +{ + CURLM *multi; + CURLMcode mcode; + CURLcode code = CURLE_OK; + int still_running; + struct timeval timeout; + int rc; + CURLMsg *msg; + fd_set fdread; + fd_set fdwrite; + fd_set fdexcep; + int maxfd; + + if(!easy) + return CURLE_BAD_FUNCTION_ARGUMENT; + + multi = curl_multi_init(); + if(!multi) + return CURLE_OUT_OF_MEMORY; + + mcode = curl_multi_add_handle(multi, easy); + if(mcode) { + curl_multi_cleanup(multi); + if(mcode == CURLM_OUT_OF_MEMORY) + return CURLE_OUT_OF_MEMORY; + else + return CURLE_FAILED_INIT; + } + + /* we start some action by calling perform right away */ + + do { + while(CURLM_CALL_MULTI_PERFORM == + curl_multi_perform(multi, &still_running)); + + if(!still_running) + break; + + FD_ZERO(&fdread); + FD_ZERO(&fdwrite); + FD_ZERO(&fdexcep); + + /* timeout once per second */ + timeout.tv_sec = 1; + timeout.tv_usec = 0; + + /* Old deprecated style: get file descriptors from the transfers */ + curl_multi_fdset(multi, &fdread, &fdwrite, &fdexcep, &maxfd); + rc = Curl_select(maxfd+1, &fdread, &fdwrite, &fdexcep, &timeout); + + /* The way is to extract the sockets and wait for them without using + select. This whole alternative version should probably rather use the + curl_multi_socket() approach. */ + + if(rc == -1) + /* select error */ + break; + + /* timeout or data to send/receive => loop! */ + } while(still_running); + + msg = curl_multi_info_read(multi, &rc); + if(msg) + code = msg->data.result; + + mcode = curl_multi_remove_handle(multi, easy); + /* what to do if it fails? */ + + mcode = curl_multi_cleanup(multi); + /* what to do if it fails? */ + + return code; +} +#else +/* + * curl_easy_perform() is the external interface that performs a transfer + * previously setup. + */ +CURLcode curl_easy_perform(CURL *curl) +{ + struct SessionHandle *data = (struct SessionHandle *)curl; + + if(!data) + return CURLE_BAD_FUNCTION_ARGUMENT; + + if( ! (data->share && data->share->hostcache) ) { + /* this handle is not using a shared dns cache */ + + if(data->set.global_dns_cache && + (data->dns.hostcachetype != HCACHE_GLOBAL)) { + /* global dns cache was requested but still isn't */ + struct curl_hash *ptr; + + if(data->dns.hostcachetype == HCACHE_PRIVATE) { + /* if the current cache is private, kill it first */ + Curl_hash_destroy(data->dns.hostcache); + data->dns.hostcachetype = HCACHE_NONE; + data->dns.hostcache = NULL; + } + + ptr = Curl_global_host_cache_init(); + if(ptr) { + /* only do this if the global cache init works */ + data->dns.hostcache = ptr; + data->dns.hostcachetype = HCACHE_GLOBAL; + } + } + + if(!data->dns.hostcache) { + data->dns.hostcachetype = HCACHE_PRIVATE; + data->dns.hostcache = Curl_mk_dnscache(); + + if(!data->dns.hostcache) + /* While we possibly could survive and do good without a host cache, + the fact that creating it failed indicates that things are truly + screwed up and we should bail out! */ + return CURLE_OUT_OF_MEMORY; + } + + } + + if(!data->state.connc) { + /* oops, no connection cache, make one up */ + data->state.connc = Curl_mk_connc(CONNCACHE_PRIVATE, -1L); + if(!data->state.connc) + return CURLE_OUT_OF_MEMORY; + } + + return Curl_perform(data); +} +#endif + +/* + * curl_easy_cleanup() is the external interface to cleaning/freeing the given + * easy handle. + */ +void curl_easy_cleanup(CURL *curl) +{ + struct SessionHandle *data = (struct SessionHandle *)curl; + + if(!data) + return; + + Curl_close(data); +} + +/* + * Store a pointed to the multi handle within the easy handle's data struct. + */ +void Curl_easy_addmulti(struct SessionHandle *data, + void *multi) +{ + data->multi = multi; + if(multi == NULL) + /* the association is cleared, mark the easy handle as not used by an + interface */ + data->state.used_interface = Curl_if_none; +} + +void Curl_easy_initHandleData(struct SessionHandle *data) +{ + memset(&data->req, 0, sizeof(struct SingleRequest)); + + data->req.maxdownload = -1; +} + +/* + * curl_easy_getinfo() is an external interface that allows an app to retrieve + * information from a performed transfer and similar. + */ +#undef curl_easy_getinfo +CURLcode curl_easy_getinfo(CURL *curl, CURLINFO info, ...) +{ + va_list arg; + void *paramp; + struct SessionHandle *data = (struct SessionHandle *)curl; + + va_start(arg, info); + paramp = va_arg(arg, void *); + + return Curl_getinfo(data, info, paramp); +} + +/* + * curl_easy_duphandle() is an external interface to allow duplication of a + * given input easy handle. The returned handle will be a new working handle + * with all options set exactly as the input source handle. + */ +CURL *curl_easy_duphandle(CURL *incurl) +{ + struct SessionHandle *data=(struct SessionHandle *)incurl; + + struct SessionHandle *outcurl = calloc(1, sizeof(struct SessionHandle)); + if(NULL == outcurl) + goto fail; + + /* + * We setup a few buffers we need. We should probably make them + * get setup on-demand in the code, as that would probably decrease + * the likeliness of us forgetting to init a buffer here in the future. + */ + outcurl->state.headerbuff = malloc(HEADERSIZE); + if(!outcurl->state.headerbuff) + goto fail; + outcurl->state.headersize = HEADERSIZE; + + /* copy all userdefined values */ + if(Curl_dupset(outcurl, data) != CURLE_OK) + goto fail; + + /* the connection cache is setup on demand */ + outcurl->state.connc = NULL; + + outcurl->state.lastconnect = -1; + + outcurl->progress.flags = data->progress.flags; + outcurl->progress.callback = data->progress.callback; + +#if !defined(CURL_DISABLE_HTTP) && !defined(CURL_DISABLE_COOKIES) + if(data->cookies) { + /* If cookies are enabled in the parent handle, we enable them + in the clone as well! */ + outcurl->cookies = Curl_cookie_init(data, + data->cookies->filename, + outcurl->cookies, + data->set.cookiesession); + if(!outcurl->cookies) + goto fail; + } +#endif /* CURL_DISABLE_HTTP */ + + /* duplicate all values in 'change' */ + +#if !defined(CURL_DISABLE_HTTP) && !defined(CURL_DISABLE_COOKIES) + if(data->change.cookielist) { + outcurl->change.cookielist = + Curl_slist_duplicate(data->change.cookielist); + if(!outcurl->change.cookielist) + goto fail; + } +#endif /* CURL_DISABLE_HTTP */ + + if(data->change.url) { + outcurl->change.url = strdup(data->change.url); + if(!outcurl->change.url) + goto fail; + outcurl->change.url_alloc = TRUE; + } + + if(data->change.referer) { + outcurl->change.referer = strdup(data->change.referer); + if(!outcurl->change.referer) + goto fail; + outcurl->change.referer_alloc = TRUE; + } + +#ifdef USE_ARES + /* If we use ares, we clone the ares channel for the new handle */ + if(ARES_SUCCESS != ares_dup(&outcurl->state.areschannel, + data->state.areschannel)) + goto fail; +#endif + +#if defined(CURL_DOES_CONVERSIONS) && defined(HAVE_ICONV) + outcurl->inbound_cd = iconv_open(CURL_ICONV_CODESET_OF_HOST, + CURL_ICONV_CODESET_OF_NETWORK); + outcurl->outbound_cd = iconv_open(CURL_ICONV_CODESET_OF_NETWORK, + CURL_ICONV_CODESET_OF_HOST); + outcurl->utf8_cd = iconv_open(CURL_ICONV_CODESET_OF_HOST, + CURL_ICONV_CODESET_FOR_UTF8); +#endif + + Curl_easy_initHandleData(outcurl); + + outcurl->magic = CURLEASY_MAGIC_NUMBER; + + /* we reach this point and thus we are OK */ + + return outcurl; + + fail: + + if(outcurl) { + if(outcurl->state.connc && + (outcurl->state.connc->type == CONNCACHE_PRIVATE)) + Curl_rm_connc(outcurl->state.connc); + if(outcurl->state.headerbuff) + free(outcurl->state.headerbuff); +#if !defined(CURL_DISABLE_HTTP) && !defined(CURL_DISABLE_COOKIES) + if(outcurl->change.cookielist) + curl_slist_free_all(outcurl->change.cookielist); +#endif + if(outcurl->change.url) + free(outcurl->change.url); + if(outcurl->change.referer) + free(outcurl->change.referer); + Curl_freeset(outcurl); + free(outcurl); + } + + return NULL; +} + +/* + * curl_easy_reset() is an external interface that allows an app to re- + * initialize a session handle to the default values. + */ +void curl_easy_reset(CURL *curl) +{ + struct SessionHandle *data = (struct SessionHandle *)curl; + + Curl_safefree(data->state.pathbuffer); + data->state.pathbuffer=NULL; + + Curl_safefree(data->state.proto.generic); + data->state.proto.generic=NULL; + + /* zero out UserDefined data: */ + Curl_freeset(data); + memset(&data->set, 0, sizeof(struct UserDefined)); + (void)Curl_init_userdefined(&data->set); + + /* zero out Progress data: */ + memset(&data->progress, 0, sizeof(struct Progress)); + + /* init Handle data */ + Curl_easy_initHandleData(data); + + data->progress.flags |= PGRS_HIDE; + data->state.current_speed = -1; /* init to negative == impossible */ +} + +/* + * curl_easy_pause() allows an application to pause or unpause a specific + * transfer and direction. This function sets the full new state for the + * current connection this easy handle operates on. + * + * NOTE: if you have the receiving paused and you call this function to remove + * the pausing, you may get your write callback called at this point. + * + * Action is a bitmask consisting of CURLPAUSE_* bits in curl/curl.h + */ +CURLcode curl_easy_pause(CURL *curl, int action) +{ + struct SessionHandle *data = (struct SessionHandle *)curl; + struct SingleRequest *k = &data->req; + CURLcode result = CURLE_OK; + + /* first switch off both pause bits */ + int newstate = k->keepon &~ (KEEP_RECV_PAUSE| KEEP_SEND_PAUSE); + + /* set the new desired pause bits */ + newstate |= ((action & CURLPAUSE_RECV)?KEEP_RECV_PAUSE:0) | + ((action & CURLPAUSE_SEND)?KEEP_SEND_PAUSE:0); + + /* put it back in the keepon */ + k->keepon = newstate; + + if(!(newstate & KEEP_RECV_PAUSE) && data->state.tempwrite) { + /* we have a buffer for sending that we now seem to be able to deliver since + the receive pausing is lifted! */ + + /* get the pointer, type and length in local copies since the function may + return PAUSE again and then we'll get a new copy allocted and stored in + the tempwrite variables */ + char *tempwrite = data->state.tempwrite; + char *freewrite = tempwrite; /* store this pointer to free it later */ + size_t tempsize = data->state.tempwritesize; + int temptype = data->state.tempwritetype; + size_t chunklen; + + /* clear tempwrite here just to make sure it gets cleared if there's no + further use of it, and make sure we don't clear it after the function + invoke as it may have been set to a new value by then */ + data->state.tempwrite = NULL; + + /* since the write callback API is define to never exceed + CURL_MAX_WRITE_SIZE bytes in a single call, and since we may in fact + have more data than that in our buffer here, we must loop sending the + data in multiple calls until there's no data left or we get another + pause returned. + + A tricky part is that the function we call will "buffer" the data + itself when it pauses on a particular buffer, so we may need to do some + extra trickery if we get a pause return here. + */ + do { + chunklen = (tempsize > CURL_MAX_WRITE_SIZE)?CURL_MAX_WRITE_SIZE:tempsize; + + result = Curl_client_write(data->state.current_conn, + temptype, tempwrite, chunklen); + if(result) + /* failures abort the loop at once */ + break; + + if(data->state.tempwrite && (tempsize - chunklen)) { + /* Ouch, the reading is again paused and the block we send is now + "cached". If this is the final chunk we can leave it like this, but + if we have more chunks that are cached after this, we need to free + the newly cached one and put back a version that is truly the entire + contents that is saved for later + */ + char *newptr; + + /* note that tempsize is still the size as before the callback was + used, and thus the whole piece of data to keep */ + newptr = realloc(data->state.tempwrite, tempsize); + + if(!newptr) { + free(data->state.tempwrite); /* free old area */ + data->state.tempwrite = NULL; + result = CURLE_OUT_OF_MEMORY; + /* tempwrite will be freed further down */ + break; + } + data->state.tempwrite = newptr; /* store new pointer */ + memcpy(newptr, tempwrite, tempsize); + data->state.tempwritesize = tempsize; /* store new size */ + /* tempwrite will be freed further down */ + break; /* go back to pausing until further notice */ + } + else { + tempsize -= chunklen; /* left after the call above */ + tempwrite += chunklen; /* advance the pointer */ + } + + } while((result == CURLE_OK) && tempsize); + + free(freewrite); /* this is unconditionally no longer used */ + } + + return result; +} + +#ifdef CURL_DOES_CONVERSIONS +/* + * Curl_convert_to_network() is an internal function + * for performing ASCII conversions on non-ASCII platforms. + */ +CURLcode Curl_convert_to_network(struct SessionHandle *data, + char *buffer, size_t length) +{ + CURLcode rc; + + if(data->set.convtonetwork) { + /* use translation callback */ + rc = data->set.convtonetwork(buffer, length); + if(rc != CURLE_OK) { + failf(data, + "CURLOPT_CONV_TO_NETWORK_FUNCTION callback returned %d: %s", + (int)rc, curl_easy_strerror(rc)); + } + return(rc); + } + else { +#ifdef HAVE_ICONV + /* do the translation ourselves */ + char *input_ptr, *output_ptr; + size_t in_bytes, out_bytes, rc; + int error; + + /* open an iconv conversion descriptor if necessary */ + if(data->outbound_cd == (iconv_t)-1) { + data->outbound_cd = iconv_open(CURL_ICONV_CODESET_OF_NETWORK, + CURL_ICONV_CODESET_OF_HOST); + if(data->outbound_cd == (iconv_t)-1) { + error = ERRNO; + failf(data, + "The iconv_open(\"%s\", \"%s\") call failed with errno %i: %s", + CURL_ICONV_CODESET_OF_NETWORK, + CURL_ICONV_CODESET_OF_HOST, + error, strerror(error)); + return CURLE_CONV_FAILED; + } + } + /* call iconv */ + input_ptr = output_ptr = buffer; + in_bytes = out_bytes = length; + rc = iconv(data->outbound_cd, (const char**)&input_ptr, &in_bytes, + &output_ptr, &out_bytes); + if((rc == ICONV_ERROR) || (in_bytes != 0)) { + error = ERRNO; + failf(data, + "The Curl_convert_to_network iconv call failed with errno %i: %s", + error, strerror(error)); + return CURLE_CONV_FAILED; + } +#else + failf(data, "CURLOPT_CONV_TO_NETWORK_FUNCTION callback required"); + return CURLE_CONV_REQD; +#endif /* HAVE_ICONV */ + } + + return CURLE_OK; +} + +/* + * Curl_convert_from_network() is an internal function + * for performing ASCII conversions on non-ASCII platforms. + */ +CURLcode Curl_convert_from_network(struct SessionHandle *data, + char *buffer, size_t length) +{ + CURLcode rc; + + if(data->set.convfromnetwork) { + /* use translation callback */ + rc = data->set.convfromnetwork(buffer, length); + if(rc != CURLE_OK) { + failf(data, + "CURLOPT_CONV_FROM_NETWORK_FUNCTION callback returned %d: %s", + (int)rc, curl_easy_strerror(rc)); + } + return(rc); + } + else { +#ifdef HAVE_ICONV + /* do the translation ourselves */ + char *input_ptr, *output_ptr; + size_t in_bytes, out_bytes, rc; + int error; + + /* open an iconv conversion descriptor if necessary */ + if(data->inbound_cd == (iconv_t)-1) { + data->inbound_cd = iconv_open(CURL_ICONV_CODESET_OF_HOST, + CURL_ICONV_CODESET_OF_NETWORK); + if(data->inbound_cd == (iconv_t)-1) { + error = ERRNO; + failf(data, + "The iconv_open(\"%s\", \"%s\") call failed with errno %i: %s", + CURL_ICONV_CODESET_OF_HOST, + CURL_ICONV_CODESET_OF_NETWORK, + error, strerror(error)); + return CURLE_CONV_FAILED; + } + } + /* call iconv */ + input_ptr = output_ptr = buffer; + in_bytes = out_bytes = length; + rc = iconv(data->inbound_cd, (const char **)&input_ptr, &in_bytes, + &output_ptr, &out_bytes); + if((rc == ICONV_ERROR) || (in_bytes != 0)) { + error = ERRNO; + failf(data, + "The Curl_convert_from_network iconv call failed with errno %i: %s", + error, strerror(error)); + return CURLE_CONV_FAILED; + } +#else + failf(data, "CURLOPT_CONV_FROM_NETWORK_FUNCTION callback required"); + return CURLE_CONV_REQD; +#endif /* HAVE_ICONV */ + } + + return CURLE_OK; +} + +/* + * Curl_convert_from_utf8() is an internal function + * for performing UTF-8 conversions on non-ASCII platforms. + */ +CURLcode Curl_convert_from_utf8(struct SessionHandle *data, + char *buffer, size_t length) +{ + CURLcode rc; + + if(data->set.convfromutf8) { + /* use translation callback */ + rc = data->set.convfromutf8(buffer, length); + if(rc != CURLE_OK) { + failf(data, + "CURLOPT_CONV_FROM_UTF8_FUNCTION callback returned %d: %s", + (int)rc, curl_easy_strerror(rc)); + } + return(rc); + } + else { +#ifdef HAVE_ICONV + /* do the translation ourselves */ + const char *input_ptr; + char *output_ptr; + size_t in_bytes, out_bytes, rc; + int error; + + /* open an iconv conversion descriptor if necessary */ + if(data->utf8_cd == (iconv_t)-1) { + data->utf8_cd = iconv_open(CURL_ICONV_CODESET_OF_HOST, + CURL_ICONV_CODESET_FOR_UTF8); + if(data->utf8_cd == (iconv_t)-1) { + error = ERRNO; + failf(data, + "The iconv_open(\"%s\", \"%s\") call failed with errno %i: %s", + CURL_ICONV_CODESET_OF_HOST, + CURL_ICONV_CODESET_FOR_UTF8, + error, strerror(error)); + return CURLE_CONV_FAILED; + } + } + /* call iconv */ + input_ptr = output_ptr = buffer; + in_bytes = out_bytes = length; + rc = iconv(data->utf8_cd, &input_ptr, &in_bytes, + &output_ptr, &out_bytes); + if((rc == ICONV_ERROR) || (in_bytes != 0)) { + error = ERRNO; + failf(data, + "The Curl_convert_from_utf8 iconv call failed with errno %i: %s", + error, strerror(error)); + return CURLE_CONV_FAILED; + } + if(output_ptr < input_ptr) { + /* null terminate the now shorter output string */ + *output_ptr = 0x00; + } +#else + failf(data, "CURLOPT_CONV_FROM_UTF8_FUNCTION callback required"); + return CURLE_CONV_REQD; +#endif /* HAVE_ICONV */ + } + + return CURLE_OK; +} + +#endif /* CURL_DOES_CONVERSIONS */ + +static CURLcode easy_connection(struct SessionHandle *data, + curl_socket_t *sfd, + struct connectdata **connp) +{ + if(data == NULL) + return CURLE_BAD_FUNCTION_ARGUMENT; + + /* only allow these to be called on handles with CURLOPT_CONNECT_ONLY */ + if(!data->set.connect_only) { + failf(data, "CONNECT_ONLY is required!"); + return CURLE_UNSUPPORTED_PROTOCOL; + } + + *sfd = Curl_getconnectinfo(data, connp); + + if(*sfd == CURL_SOCKET_BAD) { + failf(data, "Failed to get recent socket"); + return CURLE_UNSUPPORTED_PROTOCOL; + } + + return CURLE_OK; +} + +/* + * Receives data from the connected socket. Use after successful + * curl_easy_perform() with CURLOPT_CONNECT_ONLY option. + * Returns CURLE_OK on success, error code on error. + */ +CURLcode curl_easy_recv(CURL *curl, void *buffer, size_t buflen, size_t *n) +{ + curl_socket_t sfd; + CURLcode ret; + ssize_t n1; + struct connectdata *c; + struct SessionHandle *data = (struct SessionHandle *)curl; + + ret = easy_connection(data, &sfd, &c); + if(ret) + return ret; + + *n = 0; + ret = Curl_read(c, sfd, buffer, buflen, &n1); + + if(ret != CURLE_OK) + return ret; + + *n = (size_t)n1; + + return CURLE_OK; +} + +/* + * Sends data over the connected socket. Use after successful + * curl_easy_perform() with CURLOPT_CONNECT_ONLY option. + */ +CURLcode curl_easy_send(CURL *curl, const void *buffer, size_t buflen, + size_t *n) +{ + curl_socket_t sfd; + CURLcode ret; + ssize_t n1; + struct connectdata *c = NULL; + struct SessionHandle *data = (struct SessionHandle *)curl; + + ret = easy_connection(data, &sfd, &c); + if(ret) + return ret; + + *n = 0; + ret = Curl_write(c, sfd, buffer, buflen, &n1); + + if(n1 == -1) + return CURLE_SEND_ERROR; + + /* detect EAGAIN */ + if((CURLE_OK == ret) && (0 == n1)) + return CURLE_AGAIN; + + *n = (size_t)n1; + + return ret; +} diff --git a/mobicore/common/curl/lib/easyif.h b/mobicore/common/curl/lib/easyif.h new file mode 100644 index 0000000000000000000000000000000000000000..8a0a51cc1f753be4bf19d288e7487b0b1ab216df --- /dev/null +++ b/mobicore/common/curl/lib/easyif.h @@ -0,0 +1,39 @@ +#ifndef __EASYIF_H +#define __EASYIF_H +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) 1998 - 2006, Daniel Stenberg, , et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at http://curl.haxx.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ***************************************************************************/ + +/* + * Prototypes for library-wide functions provided by easy.c + */ +void Curl_easy_addmulti(struct SessionHandle *data, void *multi); + +void Curl_easy_initHandleData(struct SessionHandle *data); + +CURLcode Curl_convert_to_network(struct SessionHandle *data, + char *buffer, size_t length); +CURLcode Curl_convert_from_network(struct SessionHandle *data, + char *buffer, size_t length); +CURLcode Curl_convert_from_utf8(struct SessionHandle *data, + char *buffer, size_t length); + +#endif /* __EASYIF_H */ diff --git a/mobicore/common/curl/lib/escape.c b/mobicore/common/curl/lib/escape.c new file mode 100644 index 0000000000000000000000000000000000000000..735e1d8a7f50b25e6132d40f86de61f74407bf2b --- /dev/null +++ b/mobicore/common/curl/lib/escape.c @@ -0,0 +1,213 @@ +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) 1998 - 2010, Daniel Stenberg, , et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at http://curl.haxx.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ***************************************************************************/ + +/* Escape and unescape URL encoding in strings. The functions return a new + * allocated string or NULL if an error occurred. */ + +#include "setup.h" +#include +#include + +#include +#include +#include +#include "curl_memory.h" +/* urldata.h and easyif.h are included for Curl_convert_... prototypes */ +#include "urldata.h" +#include "easyif.h" +#include "warnless.h" + +#define _MPRINTF_REPLACE /* use our functions only */ +#include + +/* The last #include file should be: */ +#include "memdebug.h" + +/* Portable character check (remember EBCDIC). Do not use isalnum() because + its behavior is altered by the current locale. + See http://tools.ietf.org/html/rfc3986#section-2.3 +*/ +static bool Curl_isunreserved(unsigned char in) +{ + switch (in) { + case '0': case '1': case '2': case '3': case '4': + case '5': case '6': case '7': case '8': case '9': + case 'a': case 'b': case 'c': case 'd': case 'e': + case 'f': case 'g': case 'h': case 'i': case 'j': + case 'k': case 'l': case 'm': case 'n': case 'o': + case 'p': case 'q': case 'r': case 's': case 't': + case 'u': case 'v': case 'w': case 'x': case 'y': case 'z': + case 'A': case 'B': case 'C': case 'D': case 'E': + case 'F': case 'G': case 'H': case 'I': case 'J': + case 'K': case 'L': case 'M': case 'N': case 'O': + case 'P': case 'Q': case 'R': case 'S': case 'T': + case 'U': case 'V': case 'W': case 'X': case 'Y': case 'Z': + case '-': case '.': case '_': case '~': + return TRUE; + default: + break; + } + return FALSE; +} + +/* for ABI-compatibility with previous versions */ +char *curl_escape(const char *string, int inlength) +{ + return curl_easy_escape(NULL, string, inlength); +} + +/* for ABI-compatibility with previous versions */ +char *curl_unescape(const char *string, int length) +{ + return curl_easy_unescape(NULL, string, length, NULL); +} + +char *curl_easy_escape(CURL *handle, const char *string, int inlength) +{ + size_t alloc = (inlength?(size_t)inlength:strlen(string))+1; + char *ns; + char *testing_ptr = NULL; + unsigned char in; /* we need to treat the characters unsigned */ + size_t newlen = alloc; + int strindex=0; + size_t length; + +#ifndef CURL_DOES_CONVERSIONS + /* avoid compiler warnings */ + (void)handle; +#endif + ns = malloc(alloc); + if(!ns) + return NULL; + + length = alloc-1; + while(length--) { + in = *string; + + if (Curl_isunreserved(in)) { + /* just copy this */ + ns[strindex++]=in; + } + else { + /* encode it */ + newlen += 2; /* the size grows with two, since this'll become a %XX */ + if(newlen > alloc) { + alloc *= 2; + testing_ptr = realloc(ns, alloc); + if(!testing_ptr) { + free( ns ); + return NULL; + } + else { + ns = testing_ptr; + } + } + +#ifdef CURL_DOES_CONVERSIONS +/* escape sequences are always in ASCII so convert them on non-ASCII hosts */ + if(!handle || + (Curl_convert_to_network(handle, &in, 1) != CURLE_OK)) { + /* Curl_convert_to_network calls failf if unsuccessful */ + free(ns); + return NULL; + } +#endif /* CURL_DOES_CONVERSIONS */ + + snprintf(&ns[strindex], 4, "%%%02X", in); + + strindex+=3; + } + string++; + } + ns[strindex]=0; /* terminate it */ + return ns; +} + +/* + * Unescapes the given URL escaped string of given length. Returns a + * pointer to a malloced string with length given in *olen. + * If length == 0, the length is assumed to be strlen(string). + * If olen == NULL, no output length is stored. + */ +char *curl_easy_unescape(CURL *handle, const char *string, int length, + int *olen) +{ + int alloc = (length?length:(int)strlen(string))+1; + char *ns = malloc(alloc); + unsigned char in; + int strindex=0; + unsigned long hex; + +#ifndef CURL_DOES_CONVERSIONS + /* avoid compiler warnings */ + (void)handle; +#endif + if( !ns ) + return NULL; + + while(--alloc > 0) { + in = *string; + if(('%' == in) && ISXDIGIT(string[1]) && ISXDIGIT(string[2])) { + /* this is two hexadecimal digits following a '%' */ + char hexstr[3]; + char *ptr; + hexstr[0] = string[1]; + hexstr[1] = string[2]; + hexstr[2] = 0; + + hex = strtoul(hexstr, &ptr, 16); + + in = curlx_ultouc(hex); /* this long is never bigger than 255 anyway */ + +#ifdef CURL_DOES_CONVERSIONS +/* escape sequences are always in ASCII so convert them on non-ASCII hosts */ + if(!handle || + (Curl_convert_from_network(handle, &in, 1) != CURLE_OK)) { + /* Curl_convert_from_network calls failf if unsuccessful */ + free(ns); + return NULL; + } +#endif /* CURL_DOES_CONVERSIONS */ + + string+=2; + alloc-=2; + } + + ns[strindex++] = in; + string++; + } + ns[strindex]=0; /* terminate it */ + + if(olen) + /* store output size */ + *olen = strindex; + return ns; +} + +/* For operating systems/environments that use different malloc/free + systems for the app and for this library, we provide a free that uses + the library's memory system */ +void curl_free(void *p) +{ + if(p) + free(p); +} diff --git a/mobicore/common/curl/lib/escape.h b/mobicore/common/curl/lib/escape.h new file mode 100644 index 0000000000000000000000000000000000000000..04b06a973bbc115c480cb3fcef4a8984b74ad0cd --- /dev/null +++ b/mobicore/common/curl/lib/escape.h @@ -0,0 +1,29 @@ +#ifndef __ESCAPE_H +#define __ESCAPE_H + +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) 1998 - 2006, Daniel Stenberg, , et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at http://curl.haxx.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ***************************************************************************/ +/* Escape and unescape URL encoding in strings. The functions return a new + * allocated string or NULL if an error occurred. */ + + +#endif diff --git a/mobicore/common/curl/lib/file.c b/mobicore/common/curl/lib/file.c new file mode 100644 index 0000000000000000000000000000000000000000..8e4ee075ff284de5cced5520642618ececcdad48 --- /dev/null +++ b/mobicore/common/curl/lib/file.c @@ -0,0 +1,584 @@ +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) 1998 - 2010, Daniel Stenberg, , et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at http://curl.haxx.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ***************************************************************************/ + +#include "setup.h" + +#ifndef CURL_DISABLE_FILE +/* -- WIN32 approved -- */ +#include +#include +#include +#include +#include + +#ifdef WIN32 +#include +#include +#include +#else +#ifdef HAVE_SYS_SOCKET_H +#include +#endif +#ifdef HAVE_NETINET_IN_H +#include +#endif +#ifdef HAVE_SYS_TIME_H +#include +#endif +#ifdef HAVE_UNISTD_H +#include +#endif +#ifdef HAVE_NETDB_H +#include +#endif +#ifdef HAVE_ARPA_INET_H +#include +#endif +#ifdef HAVE_NET_IF_H +#include +#endif +#ifdef HAVE_SYS_IOCTL_H +#include +#endif + +#ifdef HAVE_SYS_PARAM_H +#include +#endif + +#ifdef HAVE_FCNTL_H +#include +#endif + +#endif /* WIN32 */ + +#include "strtoofft.h" +#include "urldata.h" +#include +#include "progress.h" +#include "sendf.h" +#include "escape.h" +#include "file.h" +#include "speedcheck.h" +#include "getinfo.h" +#include "transfer.h" +#include "url.h" +#include "curl_memory.h" +#include "parsedate.h" /* for the week day and month names */ + +#define _MPRINTF_REPLACE /* use our functions only */ +#include + +/* The last #include file should be: */ +#include "memdebug.h" + +#if defined(WIN32) || defined(MSDOS) || defined(__EMX__) || defined(__SYMBIAN32__) +#define DOS_FILESYSTEM 1 +#endif + +#ifdef OPEN_NEEDS_ARG3 +# define open_readonly(p,f) open((p),(f),(0)) +#else +# define open_readonly(p,f) open((p),(f)) +#endif + +/* + * Forward declarations. + */ + +static CURLcode file_do(struct connectdata *, bool *done); +static CURLcode file_done(struct connectdata *conn, + CURLcode status, bool premature); +static CURLcode file_connect(struct connectdata *conn, bool *done); + +/* + * FILE scheme handler. + */ + +const struct Curl_handler Curl_handler_file = { + "FILE", /* scheme */ + ZERO_NULL, /* setup_connection */ + file_do, /* do_it */ + file_done, /* done */ + ZERO_NULL, /* do_more */ + file_connect, /* connect_it */ + ZERO_NULL, /* connecting */ + ZERO_NULL, /* doing */ + ZERO_NULL, /* proto_getsock */ + ZERO_NULL, /* doing_getsock */ + ZERO_NULL, /* perform_getsock */ + ZERO_NULL, /* disconnect */ + 0, /* defport */ + PROT_FILE /* protocol */ +}; + + + /* + Check if this is a range download, and if so, set the internal variables + properly. This code is copied from the FTP implementation and might as + well be factored out. + */ +static CURLcode file_range(struct connectdata *conn) +{ + curl_off_t from, to; + curl_off_t totalsize=-1; + char *ptr; + char *ptr2; + struct SessionHandle *data = conn->data; + + if(data->state.use_range && data->state.range) { + from=curlx_strtoofft(data->state.range, &ptr, 0); + while(*ptr && (ISSPACE(*ptr) || (*ptr=='-'))) + ptr++; + to=curlx_strtoofft(ptr, &ptr2, 0); + if(ptr == ptr2) { + /* we didn't get any digit */ + to=-1; + } + if((-1 == to) && (from>=0)) { + /* X - */ + data->state.resume_from = from; + DEBUGF(infof(data, "RANGE %" FORMAT_OFF_T " to end of file\n", + from)); + } + else if(from < 0) { + /* -Y */ + data->req.maxdownload = -from; + data->state.resume_from = from; + DEBUGF(infof(data, "RANGE the last %" FORMAT_OFF_T " bytes\n", + -from)); + } + else { + /* X-Y */ + totalsize = to-from; + data->req.maxdownload = totalsize+1; /* include last byte */ + data->state.resume_from = from; + DEBUGF(infof(data, "RANGE from %" FORMAT_OFF_T + " getting %" FORMAT_OFF_T " bytes\n", + from, data->req.maxdownload)); + } + DEBUGF(infof(data, "range-download from %" FORMAT_OFF_T + " to %" FORMAT_OFF_T ", totally %" FORMAT_OFF_T " bytes\n", + from, to, data->req.maxdownload)); + } + else + data->req.maxdownload = -1; + return CURLE_OK; +} + +/* + * file_connect() gets called from Curl_protocol_connect() to allow us to + * do protocol-specific actions at connect-time. We emulate a + * connect-then-transfer protocol and "connect" to the file here + */ +static CURLcode file_connect(struct connectdata *conn, bool *done) +{ + struct SessionHandle *data = conn->data; + char *real_path = curl_easy_unescape(data, data->state.path, 0, NULL); + struct FILEPROTO *file; + int fd; +#ifdef DOS_FILESYSTEM + int i; + char *actual_path; +#endif + + if(!real_path) + return CURLE_OUT_OF_MEMORY; + + /* If there already is a protocol-specific struct allocated for this + sessionhandle, deal with it */ + Curl_reset_reqproto(conn); + + if(!data->state.proto.file) { + file = calloc(1, sizeof(struct FILEPROTO)); + if(!file) { + free(real_path); + return CURLE_OUT_OF_MEMORY; + } + data->state.proto.file = file; + } + else { + /* file is not a protocol that can deal with "persistancy" */ + file = data->state.proto.file; + Curl_safefree(file->freepath); + if(file->fd != -1) + close(file->fd); + file->path = NULL; + file->freepath = NULL; + file->fd = -1; + } + +#ifdef DOS_FILESYSTEM + /* If the first character is a slash, and there's + something that looks like a drive at the beginning of + the path, skip the slash. If we remove the initial + slash in all cases, paths without drive letters end up + relative to the current directory which isn't how + browsers work. + + Some browsers accept | instead of : as the drive letter + separator, so we do too. + + On other platforms, we need the slash to indicate an + absolute pathname. On Windows, absolute paths start + with a drive letter. + */ + actual_path = real_path; + if((actual_path[0] == '/') && + actual_path[1] && + (actual_path[2] == ':' || actual_path[2] == '|')) + { + actual_path[2] = ':'; + actual_path++; + } + + /* change path separators from '/' to '\\' for DOS, Windows and OS/2 */ + for (i=0; actual_path[i] != '\0'; ++i) + if(actual_path[i] == '/') + actual_path[i] = '\\'; + + fd = open_readonly(actual_path, O_RDONLY|O_BINARY); /* no CR/LF translation */ + file->path = actual_path; +#else + fd = open_readonly(real_path, O_RDONLY); + file->path = real_path; +#endif + file->freepath = real_path; /* free this when done */ + + file->fd = fd; + if(!data->set.upload && (fd == -1)) { + failf(data, "Couldn't open file %s", data->state.path); + file_done(conn, CURLE_FILE_COULDNT_READ_FILE, FALSE); + return CURLE_FILE_COULDNT_READ_FILE; + } + *done = TRUE; + + return CURLE_OK; +} + +static CURLcode file_done(struct connectdata *conn, + CURLcode status, bool premature) +{ + struct FILEPROTO *file = conn->data->state.proto.file; + (void)status; /* not used */ + (void)premature; /* not used */ + Curl_safefree(file->freepath); + + if(file->fd != -1) + close(file->fd); + + return CURLE_OK; +} + +#ifdef DOS_FILESYSTEM +#define DIRSEP '\\' +#else +#define DIRSEP '/' +#endif + +static CURLcode file_upload(struct connectdata *conn) +{ + struct FILEPROTO *file = conn->data->state.proto.file; + const char *dir = strchr(file->path, DIRSEP); + FILE *fp; + CURLcode res=CURLE_OK; + struct SessionHandle *data = conn->data; + char *buf = data->state.buffer; + size_t nread; + size_t nwrite; + curl_off_t bytecount = 0; + struct timeval now = Curl_tvnow(); + struct_stat file_stat; + const char* buf2; + + /* + * Since FILE: doesn't do the full init, we need to provide some extra + * assignments here. + */ + conn->fread_func = data->set.fread_func; + conn->fread_in = data->set.in; + conn->data->req.upload_fromhere = buf; + + if(!dir) + return CURLE_FILE_COULDNT_READ_FILE; /* fix: better error code */ + + if(!dir[1]) + return CURLE_FILE_COULDNT_READ_FILE; /* fix: better error code */ + + if(data->state.resume_from) + fp = fopen( file->path, "ab" ); + else { + int fd; + +#ifdef DOS_FILESYSTEM + fd = open(file->path, O_WRONLY|O_CREAT|O_TRUNC|O_BINARY, + conn->data->set.new_file_perms); +#else + fd = open(file->path, O_WRONLY|O_CREAT|O_TRUNC, + conn->data->set.new_file_perms); +#endif + if(fd < 0) { + failf(data, "Can't open %s for writing", file->path); + return CURLE_WRITE_ERROR; + } + close(fd); + fp = fopen(file->path, "wb"); + } + + if(!fp) { + failf(data, "Can't open %s for writing", file->path); + return CURLE_WRITE_ERROR; + } + + if(-1 != data->set.infilesize) + /* known size of data to "upload" */ + Curl_pgrsSetUploadSize(data, data->set.infilesize); + + /* treat the negative resume offset value as the case of "-" */ + if(data->state.resume_from < 0) { + if(fstat(fileno(fp), &file_stat)) { + fclose(fp); + failf(data, "Can't get the size of %s", file->path); + return CURLE_WRITE_ERROR; + } + else + data->state.resume_from = (curl_off_t)file_stat.st_size; + } + + while(res == CURLE_OK) { + int readcount; + res = Curl_fillreadbuffer(conn, BUFSIZE, &readcount); + if(res) + break; + + if(readcount <= 0) /* fix questionable compare error. curlvms */ + break; + + nread = (size_t)readcount; + + /*skip bytes before resume point*/ + if(data->state.resume_from) { + if( (curl_off_t)nread <= data->state.resume_from ) { + data->state.resume_from -= nread; + nread = 0; + buf2 = buf; + } + else { + buf2 = buf + data->state.resume_from; + nread -= (size_t)data->state.resume_from; + data->state.resume_from = 0; + } + } + else + buf2 = buf; + + /* write the data to the target */ + nwrite = fwrite(buf2, 1, nread, fp); + if(nwrite != nread) { + res = CURLE_SEND_ERROR; + break; + } + + bytecount += nread; + + Curl_pgrsSetUploadCounter(data, bytecount); + + if(Curl_pgrsUpdate(conn)) + res = CURLE_ABORTED_BY_CALLBACK; + else + res = Curl_speedcheck(data, now); + } + if(!res && Curl_pgrsUpdate(conn)) + res = CURLE_ABORTED_BY_CALLBACK; + + fclose(fp); + + return res; +} + +/* + * file_do() is the protocol-specific function for the do-phase, separated + * from the connect-phase above. Other protocols merely setup the transfer in + * the do-phase, to have it done in the main transfer loop but since some + * platforms we support don't allow select()ing etc on file handles (as + * opposed to sockets) we instead perform the whole do-operation in this + * function. + */ +static CURLcode file_do(struct connectdata *conn, bool *done) +{ + /* This implementation ignores the host name in conformance with + RFC 1738. Only local files (reachable via the standard file system) + are supported. This means that files on remotely mounted directories + (via NFS, Samba, NT sharing) can be accessed through a file:// URL + */ + CURLcode res = CURLE_OK; + struct_stat statbuf; /* struct_stat instead of struct stat just to allow the + Windows version to have a different struct without + having to redefine the simple word 'stat' */ + curl_off_t expected_size=0; + bool fstated=FALSE; + ssize_t nread; + size_t bytestoread; + struct SessionHandle *data = conn->data; + char *buf = data->state.buffer; + curl_off_t bytecount = 0; + int fd; + struct timeval now = Curl_tvnow(); + + *done = TRUE; /* unconditionally */ + + Curl_initinfo(data); + Curl_pgrsStartNow(data); + + if(data->set.upload) + return file_upload(conn); + + /* get the fd from the connection phase */ + fd = conn->data->state.proto.file->fd; + + /* VMS: This only works reliable for STREAMLF files */ + if( -1 != fstat(fd, &statbuf)) { + /* we could stat it, then read out the size */ + expected_size = statbuf.st_size; + /* and store the modification time */ + data->info.filetime = (long)statbuf.st_mtime; + fstated = TRUE; + } + + /* If we have selected NOBODY and HEADER, it means that we only want file + information. Which for FILE can't be much more than the file size and + date. */ + if(data->set.opt_no_body && data->set.include_header && fstated) { + CURLcode result; + snprintf(buf, sizeof(data->state.buffer), + "Content-Length: %" FORMAT_OFF_T "\r\n", expected_size); + result = Curl_client_write(conn, CLIENTWRITE_BOTH, buf, 0); + if(result) + return result; + + result = Curl_client_write(conn, CLIENTWRITE_BOTH, + (char *)"Accept-ranges: bytes\r\n", 0); + if(result) + return result; + + if(fstated) { + const struct tm *tm; + time_t filetime = (time_t)statbuf.st_mtime; +#ifdef HAVE_GMTIME_R + struct tm buffer; + tm = (const struct tm *)gmtime_r(&filetime, &buffer); +#else + tm = gmtime(&filetime); +#endif + /* format: "Tue, 15 Nov 1994 12:45:26 GMT" */ + snprintf(buf, BUFSIZE-1, + "Last-Modified: %s, %02d %s %4d %02d:%02d:%02d GMT\r\n", + Curl_wkday[tm->tm_wday?tm->tm_wday-1:6], + tm->tm_mday, + Curl_month[tm->tm_mon], + tm->tm_year + 1900, + tm->tm_hour, + tm->tm_min, + tm->tm_sec); + result = Curl_client_write(conn, CLIENTWRITE_BOTH, buf, 0); + } + /* if we fstat()ed the file, set the file size to make it available post- + transfer */ + if(fstated) + Curl_pgrsSetDownloadSize(data, expected_size); + return result; + } + + /* Check whether file range has been specified */ + file_range(conn); + + /* Adjust the start offset in case we want to get the N last bytes + * of the stream iff the filesize could be determined */ + if(data->state.resume_from < 0) { + if(!fstated) { + failf(data, "Can't get the size of file."); + return CURLE_READ_ERROR; + } + else + data->state.resume_from += (curl_off_t)statbuf.st_size; + } + + if(data->state.resume_from <= expected_size) + expected_size -= data->state.resume_from; + else { + failf(data, "failed to resume file:// transfer"); + return CURLE_BAD_DOWNLOAD_RESUME; + } + + /* A high water mark has been specified so we obey... */ + if (data->req.maxdownload > 0) + expected_size = data->req.maxdownload; + + if(fstated && (expected_size == 0)) + return CURLE_OK; + + /* The following is a shortcut implementation of file reading + this is both more efficient than the former call to download() and + it avoids problems with select() and recv() on file descriptors + in Winsock */ + if(fstated) + Curl_pgrsSetDownloadSize(data, expected_size); + + if(data->state.resume_from) { + if(data->state.resume_from != + lseek(fd, data->state.resume_from, SEEK_SET)) + return CURLE_BAD_DOWNLOAD_RESUME; + } + + Curl_pgrsTime(data, TIMER_STARTTRANSFER); + + while(res == CURLE_OK) { + /* Don't fill a whole buffer if we want less than all data */ + bytestoread = (expected_size < BUFSIZE-1)?(size_t)expected_size:BUFSIZE-1; + nread = read(fd, buf, bytestoread); + + if( nread > 0) + buf[nread] = 0; + + if (nread <= 0 || expected_size == 0) + break; + + bytecount += nread; + expected_size -= nread; + + res = Curl_client_write(conn, CLIENTWRITE_BODY, buf, nread); + if(res) + return res; + + Curl_pgrsSetDownloadCounter(data, bytecount); + + if(Curl_pgrsUpdate(conn)) + res = CURLE_ABORTED_BY_CALLBACK; + else + res = Curl_speedcheck(data, now); + } + if(Curl_pgrsUpdate(conn)) + res = CURLE_ABORTED_BY_CALLBACK; + + return res; +} + +#endif diff --git a/mobicore/common/curl/lib/file.h b/mobicore/common/curl/lib/file.h new file mode 100644 index 0000000000000000000000000000000000000000..5e3bd75647f68a06726ab6b4efe5e2024688b6a3 --- /dev/null +++ b/mobicore/common/curl/lib/file.h @@ -0,0 +1,40 @@ +#ifndef __FILE_H +#define __FILE_H + +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) 1998 - 2009, Daniel Stenberg, , et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at http://curl.haxx.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ***************************************************************************/ + + +/**************************************************************************** + * FILE unique setup + ***************************************************************************/ +struct FILEPROTO { + char *path; /* the path we operate on */ + char *freepath; /* pointer to the allocated block we must free, this might + differ from the 'path' pointer */ + int fd; /* open file descriptor to read from! */ +}; + +#ifndef CURL_DISABLE_FILE +extern const struct Curl_handler Curl_handler_file; +#endif +#endif diff --git a/mobicore/common/curl/lib/fileinfo.c b/mobicore/common/curl/lib/fileinfo.c new file mode 100644 index 0000000000000000000000000000000000000000..f5dbfce4b66f0b8870c07618198475acc368f96c --- /dev/null +++ b/mobicore/common/curl/lib/fileinfo.c @@ -0,0 +1,75 @@ +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) 2010, Daniel Stenberg, , et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at http://curl.haxx.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ***************************************************************************/ + +#include "setup.h" + +#include +#include "strdup.h" +#include "fileinfo.h" + +#define _MPRINTF_REPLACE /* use our functions only */ +#include + +#include "curl_memory.h" +/* The last #include file should be: */ +#include "memdebug.h" + +struct curl_fileinfo *Curl_fileinfo_alloc(void) +{ + struct curl_fileinfo *tmp = malloc(sizeof(struct curl_fileinfo)); + if(!tmp) + return NULL; + memset(tmp, 0, sizeof(struct curl_fileinfo)); + return tmp; +} + +void Curl_fileinfo_dtor(void *user, void *element) +{ + struct curl_fileinfo *finfo = element; + (void) user; + if(!finfo) + return; + + if(finfo->b_data){ + free(finfo->b_data); + } + + free(finfo); +} + +struct curl_fileinfo *Curl_fileinfo_dup(const struct curl_fileinfo *src) +{ + struct curl_fileinfo *ptr = malloc(sizeof(struct curl_fileinfo)); + if(!ptr) + return NULL; + *ptr = *src; + + ptr->b_data = malloc(src->b_size); + if(!ptr->b_data) { + free(ptr); + return NULL; + } + else { + memcpy(ptr->b_data, src->b_data, src->b_size); + return ptr; + } +} diff --git a/mobicore/common/curl/lib/fileinfo.h b/mobicore/common/curl/lib/fileinfo.h new file mode 100644 index 0000000000000000000000000000000000000000..b0e5e59e1285e42caa9d4873bec3129a8e4f654b --- /dev/null +++ b/mobicore/common/curl/lib/fileinfo.h @@ -0,0 +1,33 @@ +#ifndef HEADER_CURL_FILEINFO_H +#define HEADER_CURL_FILEINFO_H +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) 2010, Daniel Stenberg, , et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at http://curl.haxx.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ***************************************************************************/ + +#include + +struct curl_fileinfo *Curl_fileinfo_alloc(void); + +void Curl_fileinfo_dtor(void *, void *); + +struct curl_fileinfo *Curl_fileinfo_dup(const struct curl_fileinfo *src); + +#endif /* HEADER_CURL_FILEINFO_H */ diff --git a/mobicore/common/curl/lib/firefox-db2pem.sh b/mobicore/common/curl/lib/firefox-db2pem.sh new file mode 100644 index 0000000000000000000000000000000000000000..14ac576069f7abbc21cc36c4464a45a906a6d760 --- /dev/null +++ b/mobicore/common/curl/lib/firefox-db2pem.sh @@ -0,0 +1,54 @@ +#!/bin/sh +# *************************************************************************** +# * _ _ ____ _ +# * Project ___| | | | _ \| | +# * / __| | | | |_) | | +# * | (__| |_| | _ <| |___ +# * \___|\___/|_| \_\_____| +# * +# * Copyright (C) 1998 - 2010, Daniel Stenberg, , et al. +# * +# * This software is licensed as described in the file COPYING, which +# * you should have received as part of this distribution. The terms +# * are also available at http://curl.haxx.se/docs/copyright.html. +# * +# * You may opt to use, copy, modify, merge, publish, distribute and/or sell +# * copies of the Software, and permit persons to whom the Software is +# * furnished to do so, under the terms of the COPYING file. +# * +# * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY +# * KIND, either express or implied. +# * +# *************************************************************************** +# This shell script creates a fresh ca-bundle.crt file for use with libcurl. +# It extracts all ca certs it finds in the local Firefox database and converts +# them all into PEM format. +# +db=`ls -1d $HOME/.mozilla/firefox/*default` +out=$1 + +if test -z "$out"; then + out="ca-bundle.crt" # use a sensible default +fi + +currentdate=`date` + +cat >$out <> $out + diff --git a/mobicore/common/curl/lib/formdata.c b/mobicore/common/curl/lib/formdata.c new file mode 100644 index 0000000000000000000000000000000000000000..5ec3e384ed826fa2cca478db9f39b4cc930ae23a --- /dev/null +++ b/mobicore/common/curl/lib/formdata.c @@ -0,0 +1,1730 @@ +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) 1998 - 2010, Daniel Stenberg, , et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at http://curl.haxx.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ***************************************************************************/ + +/* + Debug the form generator stand-alone by compiling this source file with: + + gcc -DHAVE_CONFIG_H -I../ -g -D_FORM_DEBUG -DCURLDEBUG -o formdata \ + -I../include formdata.c strequal.c memdebug.c mprintf.c strerror.c + + (depending on circumstances you may need further externals added) + + run the 'formdata' executable the output should end with: + All Tests seem to have worked ... + and the following parts should be there: + +Content-Disposition: form-data; name="simple_COPYCONTENTS" +value for simple COPYCONTENTS + +Content-Disposition: form-data; name="COPYCONTENTS_+_CONTENTTYPE" +Content-Type: image/gif +value for COPYCONTENTS + CONTENTTYPE + +Content-Disposition: form-data; name="PRNAME_+_NAMELENGTH_+_COPYNAME_+_CONTENTSLENGTH" +vlue for PTRNAME + NAMELENGTH + COPYNAME + CONTENTSLENGTH +(or you might see P^@RNAME and v^@lue at the start) + +Content-Disposition: form-data; name="simple_PTRCONTENTS" +value for simple PTRCONTENTS + +Content-Disposition: form-data; name="PTRCONTENTS_+_CONTENTSLENGTH" +vlue for PTRCONTENTS + CONTENTSLENGTH +(or you might see v^@lue at the start) + +Content-Disposition: form-data; name="PTRCONTENTS_+_CONTENTSLENGTH_+_CONTENTTYPE" +Content-Type: application/octet-stream +vlue for PTRCONTENTS + CONTENTSLENGTH + CONTENTTYPE +(or you might see v^@lue at the start) + +Content-Disposition: form-data; name="FILE1_+_CONTENTTYPE"; filename="formdata.h" +Content-Type: text/html +... + +Content-Disposition: form-data; name="FILE1_+_FILE2" +Content-Type: multipart/mixed, boundary=curlz1s0dkticx49MV1KGcYP5cvfSsz +... +Content-Disposition: attachment; filename="formdata.h" +Content-Type: application/octet-stream +... +Content-Disposition: attachment; filename="Makefile.b32" +Content-Type: application/octet-stream +... + +Content-Disposition: form-data; name="FILE1_+_FILE2_+_FILE3" +Content-Type: multipart/mixed, boundary=curlirkYPmPwu6FrJ1vJ1u1BmtIufh1 +... +Content-Disposition: attachment; filename="formdata.h" +Content-Type: application/octet-stream +... +Content-Disposition: attachment; filename="Makefile.b32" +Content-Type: application/octet-stream +... +Content-Disposition: attachment; filename="formdata.h" +Content-Type: application/octet-stream +... + + +Content-Disposition: form-data; name="ARRAY: FILE1_+_FILE2_+_FILE3" +Content-Type: multipart/mixed, boundary=curlirkYPmPwu6FrJ1vJ1u1BmtIufh1 +... +Content-Disposition: attachment; filename="formdata.h" +Content-Type: application/octet-stream +... +Content-Disposition: attachment; filename="Makefile.b32" +Content-Type: application/octet-stream +... +Content-Disposition: attachment; filename="formdata.h" +Content-Type: application/octet-stream +... + +Content-Disposition: form-data; name="FILECONTENT" +... + + */ + +#include "setup.h" +#include + +/* Length of the random boundary string. */ +#define BOUNDARY_LENGTH 40 + +#if !defined(CURL_DISABLE_HTTP) || defined(USE_SSLEAY) + +#include +#include +#include +#include +#include +#if defined(HAVE_LIBGEN_H) && defined(HAVE_BASENAME) +#include +#endif +#include "urldata.h" /* for struct SessionHandle */ +#include "easyif.h" /* for Curl_convert_... prototypes */ +#include "formdata.h" +#include "curl_rand.h" +#include "strequal.h" +#include "curl_memory.h" +#include "sendf.h" + +#define _MPRINTF_REPLACE /* use our functions only */ +#include + +/* The last #include file should be: */ +#include "memdebug.h" + +#endif /* !defined(CURL_DISABLE_HTTP) || defined(USE_SSLEAY) */ + +#ifndef CURL_DISABLE_HTTP + +#ifndef HAVE_BASENAME +static char *Curl_basename(char *path); +#define basename(x) Curl_basename((x)) +#endif + +static size_t readfromfile(struct Form *form, char *buffer, size_t size); + +/* What kind of Content-Type to use on un-specified files with unrecognized + extensions. */ +#define HTTPPOST_CONTENTTYPE_DEFAULT "application/octet-stream" + +#define FORM_FILE_SEPARATOR ',' +#define FORM_TYPE_SEPARATOR ';' + +/*************************************************************************** + * + * AddHttpPost() + * + * Adds a HttpPost structure to the list, if parent_post is given becomes + * a subpost of parent_post instead of a direct list element. + * + * Returns newly allocated HttpPost on success and NULL if malloc failed. + * + ***************************************************************************/ +static struct curl_httppost * +AddHttpPost(char *name, size_t namelength, + char *value, size_t contentslength, + char *buffer, size_t bufferlength, + char *contenttype, + long flags, + struct curl_slist* contentHeader, + char *showfilename, char *userp, + struct curl_httppost *parent_post, + struct curl_httppost **httppost, + struct curl_httppost **last_post) +{ + struct curl_httppost *post; + post = calloc(1, sizeof(struct curl_httppost)); + if(post) { + post->name = name; + post->namelength = (long)(name?(namelength?namelength:strlen(name)):0); + post->contents = value; + post->contentslength = (long)contentslength; + post->buffer = buffer; + post->bufferlength = (long)bufferlength; + post->contenttype = contenttype; + post->contentheader = contentHeader; + post->showfilename = showfilename; + post->userp = userp, + post->flags = flags; + } + else + return NULL; + + if(parent_post) { + /* now, point our 'more' to the original 'more' */ + post->more = parent_post->more; + + /* then move the original 'more' to point to ourselves */ + parent_post->more = post; + } + else { + /* make the previous point to this */ + if(*last_post) + (*last_post)->next = post; + else + (*httppost) = post; + + (*last_post) = post; + } + return post; +} + +/*************************************************************************** + * + * AddFormInfo() + * + * Adds a FormInfo structure to the list presented by parent_form_info. + * + * Returns newly allocated FormInfo on success and NULL if malloc failed/ + * parent_form_info is NULL. + * + ***************************************************************************/ +static FormInfo * AddFormInfo(char *value, + char *contenttype, + FormInfo *parent_form_info) +{ + FormInfo *form_info; + form_info = calloc(1, sizeof(struct FormInfo)); + if(form_info) { + if(value) + form_info->value = value; + if(contenttype) + form_info->contenttype = contenttype; + form_info->flags = HTTPPOST_FILENAME; + } + else + return NULL; + + if(parent_form_info) { + /* now, point our 'more' to the original 'more' */ + form_info->more = parent_form_info->more; + + /* then move the original 'more' to point to ourselves */ + parent_form_info->more = form_info; + } + else + return NULL; + + return form_info; +} + +/*************************************************************************** + * + * ContentTypeForFilename() + * + * Provides content type for filename if one of the known types (else + * (either the prevtype or the default is returned). + * + * Returns some valid contenttype for filename. + * + ***************************************************************************/ +static const char * ContentTypeForFilename (const char *filename, + const char *prevtype) +{ + const char *contenttype = NULL; + unsigned int i; + /* + * No type was specified, we scan through a few well-known + * extensions and pick the first we match! + */ + struct ContentType { + char extension[6]; + const char *type; + }; + static const struct ContentType ctts[]={ + {".gif", "image/gif"}, + {".jpg", "image/jpeg"}, + {".jpeg", "image/jpeg"}, + {".txt", "text/plain"}, + {".html", "text/html"}, + {".xml", "application/xml"} + }; + + if(prevtype) + /* default to the previously set/used! */ + contenttype = prevtype; + else + contenttype = HTTPPOST_CONTENTTYPE_DEFAULT; + + if(filename) { /* in case a NULL was passed in */ + for(i=0; i= strlen(ctts[i].extension)) { + if(strequal(filename + + strlen(filename) - strlen(ctts[i].extension), + ctts[i].extension)) { + contenttype = ctts[i].type; + break; + } + } + } + } + /* we have a contenttype by now */ + return contenttype; +} + +/*************************************************************************** + * + * memdup() + * + * Copies the 'source' data to a newly allocated buffer buffer (that is + * returned). Uses buffer_length if not null, else uses strlen to determine + * the length of the buffer to be copied + * + * Returns the new pointer or NULL on failure. + * + ***************************************************************************/ +static char *memdup(const char *src, size_t buffer_length) +{ + size_t length; + bool add = FALSE; + char *buffer; + + if(buffer_length) + length = buffer_length; + else if(src) { + length = strlen(src); + add = TRUE; + } + else + /* no length and a NULL src pointer! */ + return strdup(""); + + buffer = malloc(length+add); + if(!buffer) + return NULL; /* fail */ + + memcpy(buffer, src, length); + + /* if length unknown do null termination */ + if(add) + buffer[length] = '\0'; + + return buffer; +} + +/*************************************************************************** + * + * FormAdd() + * + * Stores a formpost parameter and builds the appropriate linked list. + * + * Has two principal functionalities: using files and byte arrays as + * post parts. Byte arrays are either copied or just the pointer is stored + * (as the user requests) while for files only the filename and not the + * content is stored. + * + * While you may have only one byte array for each name, multiple filenames + * are allowed (and because of this feature CURLFORM_END is needed after + * using CURLFORM_FILE). + * + * Examples: + * + * Simple name/value pair with copied contents: + * curl_formadd (&post, &last, CURLFORM_COPYNAME, "name", + * CURLFORM_COPYCONTENTS, "value", CURLFORM_END); + * + * name/value pair where only the content pointer is remembered: + * curl_formadd (&post, &last, CURLFORM_COPYNAME, "name", + * CURLFORM_PTRCONTENTS, ptr, CURLFORM_CONTENTSLENGTH, 10, CURLFORM_END); + * (if CURLFORM_CONTENTSLENGTH is missing strlen () is used) + * + * storing a filename (CONTENTTYPE is optional!): + * curl_formadd (&post, &last, CURLFORM_COPYNAME, "name", + * CURLFORM_FILE, "filename1", CURLFORM_CONTENTTYPE, "plain/text", + * CURLFORM_END); + * + * storing multiple filenames: + * curl_formadd (&post, &last, CURLFORM_COPYNAME, "name", + * CURLFORM_FILE, "filename1", CURLFORM_FILE, "filename2", CURLFORM_END); + * + * Returns: + * CURL_FORMADD_OK on success + * CURL_FORMADD_MEMORY if the FormInfo allocation fails + * CURL_FORMADD_OPTION_TWICE if one option is given twice for one Form + * CURL_FORMADD_NULL if a null pointer was given for a char + * CURL_FORMADD_MEMORY if the allocation of a FormInfo struct failed + * CURL_FORMADD_UNKNOWN_OPTION if an unknown option was used + * CURL_FORMADD_INCOMPLETE if the some FormInfo is not complete (or an error) + * CURL_FORMADD_MEMORY if a HttpPost struct cannot be allocated + * CURL_FORMADD_MEMORY if some allocation for string copying failed. + * CURL_FORMADD_ILLEGAL_ARRAY if an illegal option is used in an array + * + ***************************************************************************/ + +static +CURLFORMcode FormAdd(struct curl_httppost **httppost, + struct curl_httppost **last_post, + va_list params) +{ + FormInfo *first_form, *current_form, *form = NULL; + CURLFORMcode return_value = CURL_FORMADD_OK; + const char *prevtype = NULL; + struct curl_httppost *post = NULL; + CURLformoption option; + struct curl_forms *forms = NULL; + char *array_value=NULL; /* value read from an array */ + + /* This is a state variable, that if TRUE means that we're parsing an + array that we got passed to us. If FALSE we're parsing the input + va_list arguments. */ + bool array_state = FALSE; + + /* + * We need to allocate the first struct to fill in. + */ + first_form = calloc(1, sizeof(struct FormInfo)); + if(!first_form) + return CURL_FORMADD_MEMORY; + + current_form = first_form; + + /* + * Loop through all the options set. Break if we have an error to report. + */ + while(return_value == CURL_FORMADD_OK) { + + /* first see if we have more parts of the array param */ + if( array_state && forms ) { + /* get the upcoming option from the given array */ + option = forms->option; + array_value = (char *)forms->value; + + forms++; /* advance this to next entry */ + if(CURLFORM_END == option) { + /* end of array state */ + array_state = FALSE; + continue; + } + } + else { + /* This is not array-state, get next option */ + option = va_arg(params, CURLformoption); + if(CURLFORM_END == option) + break; + } + + switch (option) { + case CURLFORM_ARRAY: + if(array_state) + /* we don't support an array from within an array */ + return_value = CURL_FORMADD_ILLEGAL_ARRAY; + else { + forms = va_arg(params, struct curl_forms *); + if(forms) + array_state = TRUE; + else + return_value = CURL_FORMADD_NULL; + } + break; + + /* + * Set the Name property. + */ + case CURLFORM_PTRNAME: +#ifdef CURL_DOES_CONVERSIONS + /* treat CURLFORM_PTR like CURLFORM_COPYNAME so we'll + have safe memory for the eventual conversion */ +#else + current_form->flags |= HTTPPOST_PTRNAME; /* fall through */ +#endif + case CURLFORM_COPYNAME: + if(current_form->name) + return_value = CURL_FORMADD_OPTION_TWICE; + else { + char *name = array_state? + array_value:va_arg(params, char *); + if(name) + current_form->name = name; /* store for the moment */ + else + return_value = CURL_FORMADD_NULL; + } + break; + case CURLFORM_NAMELENGTH: + if(current_form->namelength) + return_value = CURL_FORMADD_OPTION_TWICE; + else + current_form->namelength = + array_state?(size_t)array_value:(size_t)va_arg(params, long); + break; + + /* + * Set the contents property. + */ + case CURLFORM_PTRCONTENTS: + current_form->flags |= HTTPPOST_PTRCONTENTS; /* fall through */ + case CURLFORM_COPYCONTENTS: + if(current_form->value) + return_value = CURL_FORMADD_OPTION_TWICE; + else { + char *value = + array_state?array_value:va_arg(params, char *); + if(value) + current_form->value = value; /* store for the moment */ + else + return_value = CURL_FORMADD_NULL; + } + break; + case CURLFORM_CONTENTSLENGTH: + if(current_form->contentslength) + return_value = CURL_FORMADD_OPTION_TWICE; + else + current_form->contentslength = + array_state?(size_t)array_value:(size_t)va_arg(params, long); + break; + + /* Get contents from a given file name */ + case CURLFORM_FILECONTENT: + if(current_form->flags != 0) + return_value = CURL_FORMADD_OPTION_TWICE; + else { + const char *filename = array_state? + array_value:va_arg(params, char *); + if(filename) { + current_form->value = strdup(filename); + if(!current_form->value) + return_value = CURL_FORMADD_MEMORY; + else { + current_form->flags |= HTTPPOST_READFILE; + current_form->value_alloc = TRUE; + } + } + else + return_value = CURL_FORMADD_NULL; + } + break; + + /* We upload a file */ + case CURLFORM_FILE: + { + const char *filename = array_state?array_value: + va_arg(params, char *); + + if(current_form->value) { + if(current_form->flags & HTTPPOST_FILENAME) { + if(filename) { + if((current_form = AddFormInfo(strdup(filename), + NULL, current_form)) == NULL) + return_value = CURL_FORMADD_MEMORY; + } + else + return_value = CURL_FORMADD_NULL; + } + else + return_value = CURL_FORMADD_OPTION_TWICE; + } + else { + if(filename) { + current_form->value = strdup(filename); + if(!current_form->value) + return_value = CURL_FORMADD_MEMORY; + else { + current_form->flags |= HTTPPOST_FILENAME; + current_form->value_alloc = TRUE; + } + } + else + return_value = CURL_FORMADD_NULL; + } + break; + } + + case CURLFORM_BUFFER: + { + const char *filename = array_state?array_value: + va_arg(params, char *); + + if(current_form->value) { + if(current_form->flags & HTTPPOST_BUFFER) { + if(filename) { + if((current_form = AddFormInfo(strdup(filename), + NULL, current_form)) == NULL) + return_value = CURL_FORMADD_MEMORY; + } + else + return_value = CURL_FORMADD_NULL; + } + else + return_value = CURL_FORMADD_OPTION_TWICE; + } + else { + if(filename) { + current_form->value = strdup(filename); + if(!current_form->value) + return_value = CURL_FORMADD_MEMORY; + } + else + return_value = CURL_FORMADD_NULL; + current_form->flags |= HTTPPOST_BUFFER; + } + break; + } + + case CURLFORM_BUFFERPTR: + current_form->flags |= HTTPPOST_PTRBUFFER; + if(current_form->buffer) + return_value = CURL_FORMADD_OPTION_TWICE; + else { + char *buffer = + array_state?array_value:va_arg(params, char *); + if(buffer) + current_form->buffer = buffer; /* store for the moment */ + else + return_value = CURL_FORMADD_NULL; + } + break; + + case CURLFORM_BUFFERLENGTH: + if(current_form->bufferlength) + return_value = CURL_FORMADD_OPTION_TWICE; + else + current_form->bufferlength = + array_state?(size_t)array_value:(size_t)va_arg(params, long); + break; + + case CURLFORM_STREAM: + current_form->flags |= HTTPPOST_CALLBACK; + if(current_form->userp) + return_value = CURL_FORMADD_OPTION_TWICE; + else { + char *userp = + array_state?array_value:va_arg(params, char *); + if(userp) { + current_form->userp = userp; + current_form->value = userp; /* this isn't strictly true but we + derive a value from this later on + and we need this non-NULL to be + accepted as a fine form part */ + } + else + return_value = CURL_FORMADD_NULL; + } + break; + + case CURLFORM_CONTENTTYPE: + { + const char *contenttype = + array_state?array_value:va_arg(params, char *); + if(current_form->contenttype) { + if(current_form->flags & HTTPPOST_FILENAME) { + if(contenttype) { + if((current_form = AddFormInfo(NULL, + strdup(contenttype), + current_form)) == NULL) + return_value = CURL_FORMADD_MEMORY; + } + else + return_value = CURL_FORMADD_NULL; + } + else + return_value = CURL_FORMADD_OPTION_TWICE; + } + else { + if(contenttype) { + current_form->contenttype = strdup(contenttype); + if(!current_form->contenttype) + return_value = CURL_FORMADD_MEMORY; + else + current_form->contenttype_alloc = TRUE; + } + else + return_value = CURL_FORMADD_NULL; + } + break; + } + case CURLFORM_CONTENTHEADER: + { + /* this "cast increases required alignment of target type" but + we consider it OK anyway */ + struct curl_slist* list = array_state? + (struct curl_slist*)array_value: + va_arg(params, struct curl_slist*); + + if( current_form->contentheader ) + return_value = CURL_FORMADD_OPTION_TWICE; + else + current_form->contentheader = list; + + break; + } + case CURLFORM_FILENAME: + { + const char *filename = array_state?array_value: + va_arg(params, char *); + if( current_form->showfilename ) + return_value = CURL_FORMADD_OPTION_TWICE; + else { + current_form->showfilename = strdup(filename); + if(!current_form->showfilename) + return_value = CURL_FORMADD_MEMORY; + else + current_form->showfilename_alloc = TRUE; + } + break; + } + default: + return_value = CURL_FORMADD_UNKNOWN_OPTION; + } + } + + if(CURL_FORMADD_OK == return_value) { + /* go through the list, check for completeness and if everything is + * alright add the HttpPost item otherwise set return_value accordingly */ + + post = NULL; + for(form = first_form; + form != NULL; + form = form->more) { + if( ((!form->name || !form->value) && !post) || + ( (form->contentslength) && + (form->flags & HTTPPOST_FILENAME) ) || + ( (form->flags & HTTPPOST_FILENAME) && + (form->flags & HTTPPOST_PTRCONTENTS) ) || + + ( (!form->buffer) && + (form->flags & HTTPPOST_BUFFER) && + (form->flags & HTTPPOST_PTRBUFFER) ) || + + ( (form->flags & HTTPPOST_READFILE) && + (form->flags & HTTPPOST_PTRCONTENTS) ) + ) { + return_value = CURL_FORMADD_INCOMPLETE; + break; + } + else { + if( ((form->flags & HTTPPOST_FILENAME) || + (form->flags & HTTPPOST_BUFFER)) && + !form->contenttype ) { + /* our contenttype is missing */ + form->contenttype + = strdup(ContentTypeForFilename(form->value, prevtype)); + if(!form->contenttype) { + return_value = CURL_FORMADD_MEMORY; + break; + } + form->contenttype_alloc = TRUE; + } + if( !(form->flags & HTTPPOST_PTRNAME) && + (form == first_form) ) { + /* Note that there's small risk that form->name is NULL here if the + app passed in a bad combo, so we better check for that first. */ + if(form->name) + /* copy name (without strdup; possibly contains null characters) */ + form->name = memdup(form->name, form->namelength); + if(!form->name) { + return_value = CURL_FORMADD_MEMORY; + break; + } + form->name_alloc = TRUE; + } + if( !(form->flags & (HTTPPOST_FILENAME | HTTPPOST_READFILE | + HTTPPOST_PTRCONTENTS | HTTPPOST_PTRBUFFER | + HTTPPOST_CALLBACK)) ) { + /* copy value (without strdup; possibly contains null characters) */ + form->value = memdup(form->value, form->contentslength); + if(!form->value) { + return_value = CURL_FORMADD_MEMORY; + break; + } + form->value_alloc = TRUE; + } + post = AddHttpPost(form->name, form->namelength, + form->value, form->contentslength, + form->buffer, form->bufferlength, + form->contenttype, form->flags, + form->contentheader, form->showfilename, + form->userp, + post, httppost, + last_post); + + if(!post) { + return_value = CURL_FORMADD_MEMORY; + break; + } + + if(form->contenttype) + prevtype = form->contenttype; + } + } + } + + if(return_value) { + /* we return on error, free possibly allocated fields */ + if(!form) + form = current_form; + if(form) { + if(form->name_alloc) + free(form->name); + if(form->value_alloc) + free(form->value); + if(form->contenttype_alloc) + free(form->contenttype); + if(form->showfilename_alloc) + free(form->showfilename); + } + } + + /* always delete the allocated memory before returning */ + form = first_form; + while(form != NULL) { + FormInfo *delete_form; + + delete_form = form; + form = form->more; + free (delete_form); + } + + return return_value; +} + +/* + * curl_formadd() is a public API to add a section to the multipart formpost. + */ + +CURLFORMcode curl_formadd(struct curl_httppost **httppost, + struct curl_httppost **last_post, + ...) +{ + va_list arg; + CURLFORMcode result; + va_start(arg, last_post); + result = FormAdd(httppost, last_post, arg); + va_end(arg); + return result; +} + +/* + * AddFormData() adds a chunk of data to the FormData linked list. + * + * size is incremented by the chunk length, unless it is NULL + */ +static CURLcode AddFormData(struct FormData **formp, + enum formtype type, + const void *line, + size_t length, + curl_off_t *size) +{ + struct FormData *newform = malloc(sizeof(struct FormData)); + if(!newform) + return CURLE_OUT_OF_MEMORY; + newform->next = NULL; + + if(type <= FORM_CONTENT) { + /* we make it easier for plain strings: */ + if(!length) + length = strlen((char *)line); + + newform->line = malloc(length+1); + if(!newform->line) { + free(newform); + return CURLE_OUT_OF_MEMORY; + } + memcpy(newform->line, line, length); + newform->length = length; + newform->line[length]=0; /* zero terminate for easier debugging */ + } + else + /* For callbacks and files we don't have any actual data so we just keep a + pointer to whatever this points to */ + newform->line = (char *)line; + + newform->type = type; + + if(*formp) { + (*formp)->next = newform; + *formp = newform; + } + else + *formp = newform; + + if(size) { + if(type != FORM_FILE) + /* for static content as well as callback data we add the size given + as input argument */ + *size += length; + else { + /* Since this is a file to be uploaded here, add the size of the actual + file */ + if(!strequal("-", newform->line)) { + struct_stat file; + if(!stat(newform->line, &file)) { + *size += file.st_size; + } + } + } + } + return CURLE_OK; +} + +/* + * AddFormDataf() adds printf()-style formatted data to the formdata chain. + */ + +static CURLcode AddFormDataf(struct FormData **formp, + curl_off_t *size, + const char *fmt, ...) +{ + char s[4096]; + va_list ap; + va_start(ap, fmt); + vsnprintf(s, sizeof(s), fmt, ap); + va_end(ap); + + return AddFormData(formp, FORM_DATA, s, 0, size); +} + +/* + * Curl_formclean() is used from http.c, this cleans a built FormData linked + * list + */ +void Curl_formclean(struct FormData **form_ptr) +{ + struct FormData *next, *form; + + form = *form_ptr; + if(!form) + return; + + do { + next=form->next; /* the following form line */ + if(form->type <= FORM_CONTENT) + free(form->line); /* free the line */ + free(form); /* free the struct */ + + } while((form = next) != NULL); /* continue */ + + *form_ptr = NULL; +} + +#ifdef CURL_DOES_CONVERSIONS +/* + * Curl_formcovert() is used from http.c, this converts any + form items that need to be sent in the network encoding. + Returns CURLE_OK on success. + */ +CURLcode Curl_formconvert(struct SessionHandle *data, struct FormData *form) +{ + struct FormData *next; + CURLcode rc; + + if(!form) + return CURLE_OK; + + if(!data) + return CURLE_BAD_FUNCTION_ARGUMENT; + + do { + next=form->next; /* the following form line */ + if(form->type == FORM_DATA) { + rc = Curl_convert_to_network(data, form->line, form->length); + /* Curl_convert_to_network calls failf if unsuccessful */ + if(rc != CURLE_OK) + return rc; + } + } while((form = next) != NULL); /* continue */ + return CURLE_OK; +} +#endif /* CURL_DOES_CONVERSIONS */ + +/* + * curl_formget() + * Serialize a curl_httppost struct. + * Returns 0 on success. + */ +int curl_formget(struct curl_httppost *form, void *arg, + curl_formget_callback append) +{ + CURLcode rc; + curl_off_t size; + struct FormData *data, *ptr; + + rc = Curl_getformdata(NULL, &data, form, NULL, &size); + if(rc != CURLE_OK) + return (int)rc; + + for (ptr = data; ptr; ptr = ptr->next) { + if(ptr->type == FORM_FILE) { + char buffer[8192]; + size_t nread; + struct Form temp; + + Curl_FormInit(&temp, ptr); + + do { + nread = readfromfile(&temp, buffer, sizeof(buffer)); + if((nread == (size_t) -1) || (nread != append(arg, buffer, nread))) { + if(temp.fp) { + fclose(temp.fp); + } + Curl_formclean(&data); + return -1; + } + } while(nread == sizeof(buffer)); + } + else { + if(ptr->length != append(arg, ptr->line, ptr->length)) { + Curl_formclean(&data); + return -1; + } + } + } + Curl_formclean(&data); + return 0; +} + +/* + * curl_formfree() is an external function to free up a whole form post + * chain + */ +void curl_formfree(struct curl_httppost *form) +{ + struct curl_httppost *next; + + if(!form) + /* no form to free, just get out of this */ + return; + + do { + next=form->next; /* the following form line */ + + /* recurse to sub-contents */ + if(form->more) + curl_formfree(form->more); + + if( !(form->flags & HTTPPOST_PTRNAME) && form->name) + free(form->name); /* free the name */ + if( !(form->flags & (HTTPPOST_PTRCONTENTS|HTTPPOST_CALLBACK)) && + form->contents) + free(form->contents); /* free the contents */ + if(form->contenttype) + free(form->contenttype); /* free the content type */ + if(form->showfilename) + free(form->showfilename); /* free the faked file name */ + free(form); /* free the struct */ + + } while((form = next) != NULL); /* continue */ +} + +#ifndef HAVE_BASENAME +/* + (Quote from The Open Group Base Specifications Issue 6 IEEE Std 1003.1, 2004 + Edition) + + The basename() function shall take the pathname pointed to by path and + return a pointer to the final component of the pathname, deleting any + trailing '/' characters. + + If the string pointed to by path consists entirely of the '/' character, + basename() shall return a pointer to the string "/". If the string pointed + to by path is exactly "//", it is implementation-defined whether '/' or "//" + is returned. + + If path is a null pointer or points to an empty string, basename() shall + return a pointer to the string ".". + + The basename() function may modify the string pointed to by path, and may + return a pointer to static storage that may then be overwritten by a + subsequent call to basename(). + + The basename() function need not be reentrant. A function that is not + required to be reentrant is not required to be thread-safe. + +*/ +static char *Curl_basename(char *path) +{ + /* Ignore all the details above for now and make a quick and simple + implementaion here */ + char *s1; + char *s2; + + s1=strrchr(path, '/'); + s2=strrchr(path, '\\'); + + if(s1 && s2) { + path = (s1 > s2? s1 : s2)+1; + } + else if(s1) + path = s1 + 1; + else if(s2) + path = s2 + 1; + + return path; +} +#endif + +static char *strippath(const char *fullfile) +{ + char *filename; + char *base; + filename = strdup(fullfile); /* duplicate since basename() may ruin the + buffer it works on */ + if(!filename) + return NULL; + base = strdup(basename(filename)); + + free(filename); /* free temporary buffer */ + + return base; /* returns an allocated string or NULL ! */ +} + +/* + * Curl_getformdata() converts a linked list of "meta data" into a complete + * (possibly huge) multipart formdata. The input list is in 'post', while the + * output resulting linked lists gets stored in '*finalform'. *sizep will get + * the total size of the whole POST. + * A multipart/form_data content-type is built, unless a custom content-type + * is passed in 'custom_content_type'. + * + * This function will not do a failf() for the potential memory failures but + * should for all other errors it spots. Just note that this function MAY get + * a NULL pointer in the 'data' argument. + */ + +CURLcode Curl_getformdata(struct SessionHandle *data, + struct FormData **finalform, + struct curl_httppost *post, + const char *custom_content_type, + curl_off_t *sizep) +{ + struct FormData *form = NULL; + struct FormData *firstform; + struct curl_httppost *file; + CURLcode result = CURLE_OK; + + curl_off_t size=0; /* support potentially ENORMOUS formposts */ + char *boundary; + char *fileboundary=NULL; + struct curl_slist* curList; + + *finalform=NULL; /* default form is empty */ + + if(!post) + return result; /* no input => no output! */ + + boundary = Curl_FormBoundary(); + if(!boundary) + return CURLE_OUT_OF_MEMORY; + + /* Make the first line of the output */ + result = AddFormDataf(&form, NULL, + "%s; boundary=%s\r\n", + custom_content_type?custom_content_type: + "Content-Type: multipart/form-data", + boundary); + + if(result) { + free(boundary); + return result; + } + /* we DO NOT include that line in the total size of the POST, since it'll be + part of the header! */ + + firstform = form; + + do { + + if(size) { + result = AddFormDataf(&form, &size, "\r\n"); + if(result) + break; + } + + /* boundary */ + result = AddFormDataf(&form, &size, "--%s\r\n", boundary); + if(result) + break; + + /* Maybe later this should be disabled when a custom_content_type is + passed, since Content-Disposition is not meaningful for all multipart + types. + */ + result = AddFormDataf(&form, &size, + "Content-Disposition: form-data; name=\""); + if(result) + break; + + result = AddFormData(&form, FORM_DATA, post->name, post->namelength, + &size); + if(result) + break; + + result = AddFormDataf(&form, &size, "\""); + if(result) + break; + + if(post->more) { + /* If used, this is a link to more file names, we must then do + the magic to include several files with the same field name */ + + fileboundary = Curl_FormBoundary(); + + result = AddFormDataf(&form, &size, + "\r\nContent-Type: multipart/mixed," + " boundary=%s\r\n", + fileboundary); + if(result) + break; + } + + file = post; + + do { + + /* If 'showfilename' is set, that is a faked name passed on to us + to use to in the formpost. If that is not set, the actually used + local file name should be added. */ + + if(post->more) { + /* if multiple-file */ + char *filebasename= NULL; + if(!file->showfilename) { + filebasename = strippath(file->contents); + if(!filebasename) { + Curl_formclean(&firstform); + free(boundary); + return CURLE_OUT_OF_MEMORY; + } + } + + result = AddFormDataf(&form, &size, + "\r\n--%s\r\nContent-Disposition: " + "attachment; filename=\"%s\"", + fileboundary, + (file->showfilename?file->showfilename: + filebasename)); + if(filebasename) + free(filebasename); + if(result) + break; + } + else if(post->flags & (HTTPPOST_FILENAME|HTTPPOST_BUFFER| + HTTPPOST_CALLBACK)) { + /* it should be noted that for the HTTPPOST_FILENAME and + HTTPPOST_CALLBACK cases the ->showfilename struct member is always + assigned at this point */ + char *filebasename= + (!post->showfilename)?strippath(post->contents):NULL; + + result = AddFormDataf(&form, &size, + "; filename=\"%s\"", + (post->showfilename?post->showfilename: + filebasename)); + if(filebasename) + free(filebasename); + + if(result) + break; + } + + if(file->contenttype) { + /* we have a specified type */ + result = AddFormDataf(&form, &size, + "\r\nContent-Type: %s", + file->contenttype); + if(result) + break; + } + + curList = file->contentheader; + while( curList ) { + /* Process the additional headers specified for this form */ + result = AddFormDataf( &form, &size, "\r\n%s", curList->data ); + if(result) + break; + curList = curList->next; + } + if(result) { + Curl_formclean(&firstform); + free(boundary); + return result; + } + + result = AddFormDataf(&form, &size, "\r\n\r\n"); + if(result) + break; + + if((post->flags & HTTPPOST_FILENAME) || + (post->flags & HTTPPOST_READFILE)) { + /* we should include the contents from the specified file */ + FILE *fileread; + + fileread = strequal("-", file->contents)? + stdin:fopen(file->contents, "rb"); /* binary read for win32 */ + + /* + * VMS: This only allows for stream files on VMS. Stream files are + * OK, as are FIXED & VAR files WITHOUT implied CC For implied CC, + * every record needs to have a \n appended & 1 added to SIZE + */ + + if(fileread) { + if(fileread != stdin) { + /* close the file again */ + fclose(fileread); + /* add the file name only - for later reading from this */ + result = AddFormData(&form, FORM_FILE, file->contents, 0, &size); + } + else { + /* When uploading from stdin, we can't know the size of the file, + * thus must read the full file as before. We *could* use chunked + * transfer-encoding, but that only works for HTTP 1.1 and we + * can't be sure we work with such a server. + */ + size_t nread; + char buffer[512]; + while((nread = fread(buffer, 1, sizeof(buffer), fileread)) != 0) { + result = AddFormData(&form, FORM_CONTENT, buffer, nread, &size); + if(result) + break; + } + } + } + else { + if(data) + failf(data, "couldn't open file \"%s\"\n", file->contents); + *finalform = NULL; + result = CURLE_READ_ERROR; + } + } + else if(post->flags & HTTPPOST_BUFFER) + /* include contents of buffer */ + result = AddFormData(&form, FORM_CONTENT, post->buffer, + post->bufferlength, &size); + else if(post->flags & HTTPPOST_CALLBACK) + /* the contents should be read with the callback and the size + is set with the contentslength */ + result = AddFormData(&form, FORM_CALLBACK, post->userp, + post->contentslength, &size); + else + /* include the contents we got */ + result = AddFormData(&form, FORM_CONTENT, post->contents, + post->contentslength, &size); + + file = file->more; + } while(file && !result); /* for each specified file for this field */ + + if(result) { + Curl_formclean(&firstform); + free(boundary); + return result; + } + + if(post->more) { + /* this was a multiple-file inclusion, make a termination file + boundary: */ + result = AddFormDataf(&form, &size, + "\r\n--%s--", + fileboundary); + free(fileboundary); + if(result) + break; + } + + } while((post = post->next) != NULL); /* for each field */ + if(result) { + Curl_formclean(&firstform); + free(boundary); + return result; + } + + /* end-boundary for everything */ + result = AddFormDataf(&form, &size, + "\r\n--%s--\r\n", + boundary); + if(result) { + Curl_formclean(&firstform); + free(boundary); + return result; + } + + *sizep = size; + + free(boundary); + + *finalform=firstform; + + return result; +} + +/* + * Curl_FormInit() inits the struct 'form' points to with the 'formdata' + * and resets the 'sent' counter. + */ +int Curl_FormInit(struct Form *form, struct FormData *formdata ) +{ + if(!formdata) + return 1; /* error */ + + form->data = formdata; + form->sent = 0; + form->fp = NULL; + form->fread_func = ZERO_NULL; + + return 0; +} + +static size_t readfromfile(struct Form *form, char *buffer, + size_t size) +{ + size_t nread; + bool callback = (bool)(form->data->type == FORM_CALLBACK); + + if(callback) + nread = form->fread_func(buffer, 1, size, form->data->line); + else { + if(!form->fp) { + /* this file hasn't yet been opened */ + form->fp = fopen(form->data->line, "rb"); /* b is for binary */ + if(!form->fp) + return (size_t)-1; /* failure */ + } + nread = fread(buffer, 1, size, form->fp); + } + if(!nread || nread > size) { + /* this is the last chunk from the file, move on */ + if(!callback) { + fclose(form->fp); + form->fp = NULL; + } + form->data = form->data->next; + } + + return nread; +} + +/* + * Curl_FormReader() is the fread() emulation function that will be used to + * deliver the formdata to the transfer loop and then sent away to the peer. + */ +size_t Curl_FormReader(char *buffer, + size_t size, + size_t nitems, + FILE *mydata) +{ + struct Form *form; + size_t wantedsize; + size_t gotsize = 0; + + form=(struct Form *)mydata; + + wantedsize = size * nitems; + + if(!form->data) + return 0; /* nothing, error, empty */ + + if((form->data->type == FORM_FILE) || + (form->data->type == FORM_CALLBACK)) { + gotsize = readfromfile(form, buffer, wantedsize); + + if(gotsize) + /* If positive or -1, return. If zero, continue! */ + return gotsize; + } + do { + + if( (form->data->length - form->sent ) > wantedsize - gotsize) { + + memcpy(buffer + gotsize , form->data->line + form->sent, + wantedsize - gotsize); + + form->sent += wantedsize-gotsize; + + return wantedsize; + } + + memcpy(buffer+gotsize, + form->data->line + form->sent, + (form->data->length - form->sent) ); + gotsize += form->data->length - form->sent; + + form->sent = 0; + + form->data = form->data->next; /* advance */ + + } while(form->data && (form->data->type < FORM_CALLBACK)); + /* If we got an empty line and we have more data, we proceed to the next + line immediately to avoid returning zero before we've reached the end. */ + + return gotsize; +} + +/* + * Curl_formpostheader() returns the first line of the formpost, the + * request-header part (which is not part of the request-body like the rest of + * the post). + */ +char *Curl_formpostheader(void *formp, size_t *len) +{ + char *header; + struct Form *form=(struct Form *)formp; + + if(!form->data) + return 0; /* nothing, ERROR! */ + + header = form->data->line; + *len = form->data->length; + + form->data = form->data->next; /* advance */ + + return header; +} + + +#ifdef _FORM_DEBUG +int FormAddTest(const char * errormsg, + struct curl_httppost **httppost, + struct curl_httppost **last_post, + ...) +{ + int result; + va_list arg; + va_start(arg, last_post); + if((result = FormAdd(httppost, last_post, arg))) + fprintf (stderr, "ERROR doing FormAdd ret: %d action: %s\n", result, + errormsg); + va_end(arg); + return result; +} + + +int main(int argc, argv_item_t argv[]) +{ + char name1[] = "simple_COPYCONTENTS"; + char name2[] = "COPYCONTENTS_+_CONTENTTYPE"; + char name3[] = "PTRNAME_+_NAMELENGTH_+_COPYNAME_+_CONTENTSLENGTH"; + char name4[] = "simple_PTRCONTENTS"; + char name5[] = "PTRCONTENTS_+_CONTENTSLENGTH"; + char name6[] = "PTRCONTENTS_+_CONTENTSLENGTH_+_CONTENTTYPE"; + char name7[] = "FILE1_+_CONTENTTYPE"; + char name8[] = "FILE1_+_FILE2"; + char name9[] = "FILE1_+_FILE2_+_FILE3"; + char name10[] = "ARRAY: FILE1_+_FILE2_+_FILE3"; + char name11[] = "FILECONTENT"; + char value1[] = "value for simple COPYCONTENTS"; + char value2[] = "value for COPYCONTENTS + CONTENTTYPE"; + char value3[] = "value for PTRNAME + NAMELENGTH + COPYNAME + CONTENTSLENGTH"; + char value4[] = "value for simple PTRCONTENTS"; + char value5[] = "value for PTRCONTENTS + CONTENTSLENGTH"; + char value6[] = "value for PTRCONTENTS + CONTENTSLENGTH + CONTENTTYPE"; + char value7[] = "formdata.h"; + char value8[] = "Makefile.b32"; + char type2[] = "image/gif"; + char type6[] = "text/plain"; + char type7[] = "text/html"; + int name3length = strlen(name3); + int value3length = strlen(value3); + int value5length = strlen(value5); + int value6length = strlen(value6); + int errors = 0; + CURLcode rc; + curl_off_t size; + size_t nread; + char buffer[4096]; + struct curl_httppost *httppost=NULL; + struct curl_httppost *last_post=NULL; + struct curl_forms forms[4]; + + struct FormData *form; + struct Form formread; + + (void) argc; + (void) argv; + + Curl_srand(); /* Because we do not call curl_global_init() here. */ + + if(FormAddTest("simple COPYCONTENTS test", &httppost, &last_post, + CURLFORM_COPYNAME, name1, CURLFORM_COPYCONTENTS, value1, + CURLFORM_END)) + ++errors; + if(FormAddTest("COPYCONTENTS + CONTENTTYPE test", &httppost, &last_post, + CURLFORM_COPYNAME, name2, CURLFORM_COPYCONTENTS, value2, + CURLFORM_CONTENTTYPE, type2, CURLFORM_END)) + ++errors; + /* make null character at start to check that contentslength works + correctly */ + name3[1] = '\0'; + value3[1] = '\0'; + if(FormAddTest("PTRNAME + NAMELENGTH + COPYNAME + CONTENTSLENGTH test", + &httppost, &last_post, + CURLFORM_PTRNAME, name3, CURLFORM_COPYCONTENTS, value3, + CURLFORM_CONTENTSLENGTH, value3length, + CURLFORM_NAMELENGTH, name3length, CURLFORM_END)) + ++errors; + if(FormAddTest("simple PTRCONTENTS test", &httppost, &last_post, + CURLFORM_COPYNAME, name4, CURLFORM_PTRCONTENTS, value4, + CURLFORM_END)) + ++errors; + /* make null character at start to check that contentslength works + correctly */ + value5[1] = '\0'; + if(FormAddTest("PTRCONTENTS + CONTENTSLENGTH test", &httppost, &last_post, + CURLFORM_COPYNAME, name5, CURLFORM_PTRCONTENTS, value5, + CURLFORM_CONTENTSLENGTH, value5length, CURLFORM_END)) + ++errors; + /* make null character at start to check that contentslength works + correctly */ + value6[1] = '\0'; + if(FormAddTest("PTRCONTENTS + CONTENTSLENGTH + CONTENTTYPE test", + &httppost, &last_post, + CURLFORM_COPYNAME, name6, CURLFORM_PTRCONTENTS, value6, + CURLFORM_CONTENTSLENGTH, value6length, + CURLFORM_CONTENTTYPE, type6, CURLFORM_END)) + ++errors; + if(FormAddTest("FILE + CONTENTTYPE test", &httppost, &last_post, + CURLFORM_COPYNAME, name7, CURLFORM_FILE, value7, + CURLFORM_CONTENTTYPE, type7, CURLFORM_END)) + ++errors; + if(FormAddTest("FILE1 + FILE2 test", &httppost, &last_post, + CURLFORM_COPYNAME, name8, CURLFORM_FILE, value7, + CURLFORM_FILE, value8, CURLFORM_END)) + ++errors; + if(FormAddTest("FILE1 + FILE2 + FILE3 test", &httppost, &last_post, + CURLFORM_COPYNAME, name9, CURLFORM_FILE, value7, + CURLFORM_FILE, value8, CURLFORM_FILE, value7, CURLFORM_END)) + ++errors; + forms[0].option = CURLFORM_FILE; + forms[0].value = value7; + forms[1].option = CURLFORM_FILE; + forms[1].value = value8; + forms[2].option = CURLFORM_FILE; + forms[2].value = value7; + forms[3].option = CURLFORM_END; + if(FormAddTest("FILE1 + FILE2 + FILE3 ARRAY test", &httppost, &last_post, + CURLFORM_COPYNAME, name10, CURLFORM_ARRAY, forms, + CURLFORM_END)) + ++errors; + if(FormAddTest("FILECONTENT test", &httppost, &last_post, + CURLFORM_COPYNAME, name11, CURLFORM_FILECONTENT, value7, + CURLFORM_END)) + ++errors; + + rc = Curl_getformdata(NULL, &form, httppost, NULL, &size); + if(rc != CURLE_OK) { + if(rc != CURLE_READ_ERROR) { + const char *errortext = curl_easy_strerror(rc); + fprintf(stdout, "\n==> Curl_getformdata error: %s\n", errortext); + } + return 0; + } + + Curl_FormInit(&formread, form); + + for(;;) { + nread = Curl_FormReader(buffer, 1, sizeof(buffer), + (FILE *)&formread); + + if(nread < 1) + break; + fwrite(buffer, nread, 1, stdout); + } + + fprintf(stdout, "size: "); + fprintf(stdout, "%" FORMAT_OFF_T, size); + fprintf(stdout, "\n"); + if(errors) + fprintf(stdout, "\n==> %d Test(s) failed!\n", errors); + else + fprintf(stdout, "\nAll Tests seem to have worked (please check output)\n"); + + return 0; +} + +#endif /* _FORM_DEBUG */ + +#else /* CURL_DISABLE_HTTP */ +CURLFORMcode curl_formadd(struct curl_httppost **httppost, + struct curl_httppost **last_post, + ...) +{ + (void)httppost; + (void)last_post; + return CURL_FORMADD_DISABLED; +} + +int curl_formget(struct curl_httppost *form, void *arg, + curl_formget_callback append) +{ + (void) form; + (void) arg; + (void) append; + return CURL_FORMADD_DISABLED; +} + +void curl_formfree(struct curl_httppost *form) +{ + (void)form; + /* does nothing HTTP is disabled */ +} + +#endif /* CURL_DISABLE_HTTP */ + +#if !defined(CURL_DISABLE_HTTP) || defined(USE_SSLEAY) + +/* + * Curl_FormBoundary() creates a suitable boundary string and returns an + * allocated one. This is also used by SSL-code so it must be present even + * if HTTP is disabled! + */ +char *Curl_FormBoundary(void) +{ + char *retstring; + size_t i; + + static const char table16[]="0123456789abcdef"; + + retstring = malloc(BOUNDARY_LENGTH+1); + + if(!retstring) + return NULL; /* failed */ + + strcpy(retstring, "----------------------------"); + + for(i=strlen(retstring); i, et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at http://curl.haxx.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ***************************************************************************/ + +enum formtype { + FORM_DATA, /* form metadata (convert to network encoding if necessary) */ + FORM_CONTENT, /* form content (never convert) */ + FORM_CALLBACK, /* 'line' points to the custom pointer we pass to the callback + */ + FORM_FILE /* 'line' points to a file name we should read from + to create the form data (never convert) */ +}; + +/* plain and simple linked list with lines to send */ +struct FormData { + struct FormData *next; + enum formtype type; + char *line; + size_t length; +}; + +struct Form { + struct FormData *data; /* current form line to send */ + size_t sent; /* number of bytes of the current line that has + already been sent in a previous invoke */ + FILE *fp; /* file to read from */ + curl_read_callback fread_func; /* fread callback pointer */ +}; + +/* used by FormAdd for temporary storage */ +typedef struct FormInfo { + char *name; + bool name_alloc; + size_t namelength; + char *value; + bool value_alloc; + size_t contentslength; + char *contenttype; + bool contenttype_alloc; + long flags; + char *buffer; /* pointer to existing buffer used for file upload */ + size_t bufferlength; + char *showfilename; /* The file name to show. If not set, the actual + file name will be used */ + bool showfilename_alloc; + char *userp; /* pointer for the read callback */ + struct curl_slist* contentheader; + struct FormInfo *more; +} FormInfo; + +int Curl_FormInit(struct Form *form, struct FormData *formdata ); + +CURLcode Curl_getformdata(struct SessionHandle *data, + struct FormData **, + struct curl_httppost *post, + const char *custom_contenttype, + curl_off_t *size); + +/* fread() emulation */ +size_t Curl_FormReader(char *buffer, + size_t size, + size_t nitems, + FILE *mydata); + +/* + * Curl_formpostheader() returns the first line of the formpost, the + * request-header part (which is not part of the request-body like the rest of + * the post). + */ +char *Curl_formpostheader(void *formp, size_t *len); + +char *Curl_FormBoundary(void); + +void Curl_formclean(struct FormData **); + +CURLcode Curl_formconvert(struct SessionHandle *, struct FormData *); + +#endif /* HEADER_CURL_FORMDATA_H */ diff --git a/mobicore/common/curl/lib/ftp.c b/mobicore/common/curl/lib/ftp.c new file mode 100644 index 0000000000000000000000000000000000000000..8e370c5d2943b993b62e89a2f808289c96a1bb45 --- /dev/null +++ b/mobicore/common/curl/lib/ftp.c @@ -0,0 +1,4234 @@ +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) 1998 - 2010, Daniel Stenberg, , et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at http://curl.haxx.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ***************************************************************************/ + +#include "setup.h" + +#ifndef CURL_DISABLE_FTP +#include +#include +#include +#include +#include + +#ifdef HAVE_UNISTD_H +#include +#endif + +#ifdef HAVE_SYS_SOCKET_H +#include +#endif +#ifdef HAVE_NETINET_IN_H +#include +#endif +#ifdef HAVE_ARPA_INET_H +#include +#endif +#ifdef HAVE_UTSNAME_H +#include +#endif +#ifdef HAVE_NETDB_H +#include +#endif +#ifdef __VMS +#include +#include +#endif + +#if (defined(NETWARE) && defined(__NOVELL_LIBC__)) +#undef in_addr_t +#define in_addr_t unsigned long +#endif + +#include +#include "urldata.h" +#include "sendf.h" +#include "easyif.h" /* for Curl_convert_... prototypes */ + +#include "if2ip.h" +#include "hostip.h" +#include "progress.h" +#include "transfer.h" +#include "escape.h" +#include "http.h" /* for HTTP proxy tunnel stuff */ +#include "socks.h" +#include "ftp.h" +#include "fileinfo.h" +#include "ftplistparser.h" + +#if defined(HAVE_KRB4) || defined(HAVE_GSSAPI) +#include "krb4.h" +#endif + +#include "strtoofft.h" +#include "strequal.h" +#include "sslgen.h" +#include "connect.h" +#include "strerror.h" +#include "inet_ntop.h" +#include "inet_pton.h" +#include "select.h" +#include "parsedate.h" /* for the week day and month names */ +#include "sockaddr.h" /* required for Curl_sockaddr_storage */ +#include "multiif.h" +#include "url.h" +#include "rawstr.h" +#include "speedcheck.h" +#include "warnless.h" + +#define _MPRINTF_REPLACE /* use our functions only */ +#include + +#include "curl_memory.h" +/* The last #include file should be: */ +#include "memdebug.h" + +#ifndef NI_MAXHOST +#define NI_MAXHOST 1025 +#endif +#ifndef INET_ADDRSTRLEN +#define INET_ADDRSTRLEN 16 +#endif + +#ifdef CURL_DISABLE_VERBOSE_STRINGS +#define ftp_pasv_verbose(a,b,c,d) do { } while(0) +#endif + +/* Local API functions */ +static CURLcode ftp_sendquote(struct connectdata *conn, + struct curl_slist *quote); +static CURLcode ftp_quit(struct connectdata *conn); +static CURLcode ftp_parse_url_path(struct connectdata *conn); +static CURLcode ftp_regular_transfer(struct connectdata *conn, bool *done); +#ifndef CURL_DISABLE_VERBOSE_STRINGS +static void ftp_pasv_verbose(struct connectdata *conn, + Curl_addrinfo *ai, + char *newhost, /* ascii version */ + int port); +#endif +static CURLcode ftp_state_post_rest(struct connectdata *conn); +static CURLcode ftp_state_post_cwd(struct connectdata *conn); +static CURLcode ftp_state_quote(struct connectdata *conn, + bool init, ftpstate instate); +static CURLcode ftp_nb_type(struct connectdata *conn, + bool ascii, ftpstate newstate); +static int ftp_need_type(struct connectdata *conn, + bool ascii); +static CURLcode ftp_do(struct connectdata *conn, bool *done); +static CURLcode ftp_done(struct connectdata *conn, + CURLcode, bool premature); +static CURLcode ftp_connect(struct connectdata *conn, bool *done); +static CURLcode ftp_disconnect(struct connectdata *conn, bool dead_connection); +static CURLcode ftp_nextconnect(struct connectdata *conn); +static CURLcode ftp_multi_statemach(struct connectdata *conn, bool *done); +static int ftp_getsock(struct connectdata *conn, + curl_socket_t *socks, + int numsocks); +static CURLcode ftp_doing(struct connectdata *conn, + bool *dophase_done); +static CURLcode ftp_setup_connection(struct connectdata * conn); + +static CURLcode init_wc_data(struct connectdata *conn); +static CURLcode wc_statemach(struct connectdata *conn); + +static void wc_data_dtor(void *ptr); + +static CURLcode ftp_state_post_retr_size(struct connectdata *conn, + curl_off_t filesize); + +/* easy-to-use macro: */ +#define FTPSENDF(x,y,z) if((result = Curl_ftpsendf(x,y,z)) != CURLE_OK) \ + return result +#define PPSENDF(x,y,z) if((result = Curl_pp_sendf(x,y,z)) != CURLE_OK) \ + return result + + +/* + * FTP protocol handler. + */ + +const struct Curl_handler Curl_handler_ftp = { + "FTP", /* scheme */ + ftp_setup_connection, /* setup_connection */ + ftp_do, /* do_it */ + ftp_done, /* done */ + ftp_nextconnect, /* do_more */ + ftp_connect, /* connect_it */ + ftp_multi_statemach, /* connecting */ + ftp_doing, /* doing */ + ftp_getsock, /* proto_getsock */ + ftp_getsock, /* doing_getsock */ + ZERO_NULL, /* perform_getsock */ + ftp_disconnect, /* disconnect */ + PORT_FTP, /* defport */ + PROT_FTP /* protocol */ +}; + + +#ifdef USE_SSL +/* + * FTPS protocol handler. + */ + +const struct Curl_handler Curl_handler_ftps = { + "FTPS", /* scheme */ + ftp_setup_connection, /* setup_connection */ + ftp_do, /* do_it */ + ftp_done, /* done */ + ftp_nextconnect, /* do_more */ + ftp_connect, /* connect_it */ + ftp_multi_statemach, /* connecting */ + ftp_doing, /* doing */ + ftp_getsock, /* proto_getsock */ + ftp_getsock, /* doing_getsock */ + ZERO_NULL, /* perform_getsock */ + ftp_disconnect, /* disconnect */ + PORT_FTPS, /* defport */ + PROT_FTP | PROT_FTPS | PROT_SSL /* protocol */ +}; +#endif + +#ifndef CURL_DISABLE_HTTP +/* + * HTTP-proxyed FTP protocol handler. + */ + +static const struct Curl_handler Curl_handler_ftp_proxy = { + "FTP", /* scheme */ + ZERO_NULL, /* setup_connection */ + Curl_http, /* do_it */ + Curl_http_done, /* done */ + ZERO_NULL, /* do_more */ + ZERO_NULL, /* connect_it */ + ZERO_NULL, /* connecting */ + ZERO_NULL, /* doing */ + ZERO_NULL, /* proto_getsock */ + ZERO_NULL, /* doing_getsock */ + ZERO_NULL, /* perform_getsock */ + ZERO_NULL, /* disconnect */ + PORT_FTP, /* defport */ + PROT_HTTP /* protocol */ +}; + + +#ifdef USE_SSL +/* + * HTTP-proxyed FTPS protocol handler. + */ + +static const struct Curl_handler Curl_handler_ftps_proxy = { + "FTPS", /* scheme */ + ZERO_NULL, /* setup_connection */ + Curl_http, /* do_it */ + Curl_http_done, /* done */ + ZERO_NULL, /* do_more */ + ZERO_NULL, /* connect_it */ + ZERO_NULL, /* connecting */ + ZERO_NULL, /* doing */ + ZERO_NULL, /* proto_getsock */ + ZERO_NULL, /* doing_getsock */ + ZERO_NULL, /* perform_getsock */ + ZERO_NULL, /* disconnect */ + PORT_FTPS, /* defport */ + PROT_HTTP /* protocol */ +}; +#endif +#endif + + +/* + * NOTE: back in the old days, we added code in the FTP code that made NOBODY + * requests on files respond with headers passed to the client/stdout that + * looked like HTTP ones. + * + * This approach is not very elegant, it causes confusion and is error-prone. + * It is subject for removal at the next (or at least a future) soname bump. + * Until then you can test the effects of the removal by undefining the + * following define named CURL_FTP_HTTPSTYLE_HEAD. + */ +#define CURL_FTP_HTTPSTYLE_HEAD 1 + +static void freedirs(struct ftp_conn *ftpc) +{ + int i; + if(ftpc->dirs) { + for (i=0; i < ftpc->dirdepth; i++){ + if(ftpc->dirs[i]) { + free(ftpc->dirs[i]); + ftpc->dirs[i]=NULL; + } + } + free(ftpc->dirs); + ftpc->dirs = NULL; + ftpc->dirdepth = 0; + } + if(ftpc->file) { + free(ftpc->file); + ftpc->file = NULL; + } +} + +/* Returns non-zero if the given string contains CR (\r) or LF (\n), + which are not allowed within RFC 959 . + Note: The input string is in the client's encoding which might + not be ASCII, so escape sequences \r & \n must be used instead + of hex values 0x0d & 0x0a. +*/ +static bool isBadFtpString(const char *string) +{ + return (bool)((NULL != strchr(string, '\r')) || + (NULL != strchr(string, '\n'))); +} + +/*********************************************************************** + * + * AllowServerConnect() + * + * When we've issue the PORT command, we have told the server to connect + * to us. This function will sit and wait here until the server has + * connected. + * + */ +static CURLcode AllowServerConnect(struct connectdata *conn) +{ + struct SessionHandle *data = conn->data; + curl_socket_t sock = conn->sock[SECONDARYSOCKET]; + long timeout_ms; + long interval_ms; + curl_socket_t s = CURL_SOCKET_BAD; +#ifdef ENABLE_IPV6 + struct Curl_sockaddr_storage add; +#else + struct sockaddr_in add; +#endif + curl_socklen_t size = (curl_socklen_t) sizeof(add); + + for(;;) { + timeout_ms = Curl_timeleft(conn, NULL, TRUE); + + if(timeout_ms < 0) { + /* if a timeout was already reached, bail out */ + failf(data, "Timeout while waiting for server connect"); + return CURLE_OPERATION_TIMEDOUT; + } + + interval_ms = 1000; /* use 1 second timeout intervals */ + if(timeout_ms < interval_ms) + interval_ms = timeout_ms; + + switch (Curl_socket_ready(sock, CURL_SOCKET_BAD, (int)interval_ms)) { + case -1: /* error */ + /* let's die here */ + failf(data, "Error while waiting for server connect"); + return CURLE_FTP_PORT_FAILED; + case 0: /* timeout */ + break; /* loop */ + default: + /* we have received data here */ + if(0 == getsockname(sock, (struct sockaddr *) &add, &size)) { + size = sizeof(add); + + s=accept(sock, (struct sockaddr *) &add, &size); + } + sclose(sock); /* close the first socket */ + + if(CURL_SOCKET_BAD == s) { + failf(data, "Error accept()ing server connect"); + return CURLE_FTP_PORT_FAILED; + } + infof(data, "Connection accepted from server\n"); + + conn->sock[SECONDARYSOCKET] = s; + curlx_nonblock(s, TRUE); /* enable non-blocking */ + return CURLE_OK; + } /* switch() */ + } + /* never reaches this point */ +} + +/* macro to check for a three-digit ftp status code at the start of the + given string */ +#define STATUSCODE(line) (ISDIGIT(line[0]) && ISDIGIT(line[1]) && \ + ISDIGIT(line[2])) + +/* macro to check for the last line in an FTP server response */ +#define LASTLINE(line) (STATUSCODE(line) && (' ' == line[3])) + +static int ftp_endofresp(struct pingpong *pp, + int *code) +{ + char *line = pp->linestart_resp; + size_t len = pp->nread_resp; + + if((len > 3) && LASTLINE(line)) { + *code = curlx_sltosi(strtol(line, NULL, 10)); + return 1; + } + return 0; +} + +static CURLcode ftp_readresp(curl_socket_t sockfd, + struct pingpong *pp, + int *ftpcode, /* return the ftp-code if done */ + size_t *size) /* size of the response */ +{ + struct connectdata *conn = pp->conn; +#if defined(HAVE_KRB4) || defined(HAVE_GSSAPI) + struct SessionHandle *data = conn->data; + char * const buf = data->state.buffer; +#endif + CURLcode result = CURLE_OK; + int code; + + result = Curl_pp_readresp(sockfd, pp, &code, size); + +#if defined(HAVE_KRB4) || defined(HAVE_GSSAPI) + /* handle the security-oriented responses 6xx ***/ + /* FIXME: some errorchecking perhaps... ***/ + switch(code) { + case 631: + code = Curl_sec_read_msg(conn, buf, PROT_SAFE); + break; + case 632: + code = Curl_sec_read_msg(conn, buf, PROT_PRIVATE); + break; + case 633: + code = Curl_sec_read_msg(conn, buf, PROT_CONFIDENTIAL); + break; + default: + /* normal ftp stuff we pass through! */ + break; + } +#endif + + /* store the latest code for later retrieval */ + conn->data->info.httpcode=code; + + if(ftpcode) + *ftpcode = code; + + if(421 == code) + /* 421 means "Service not available, closing control connection." and FTP + * servers use it to signal that idle session timeout has been exceeded. + * If we ignored the response, it could end up hanging in some cases. */ + return CURLE_OPERATION_TIMEDOUT; + + return result; +} + +/* --- parse FTP server responses --- */ + +/* + * Curl_GetFTPResponse() is a BLOCKING function to read the full response + * from a server after a command. + * + */ + +CURLcode Curl_GetFTPResponse(ssize_t *nreadp, /* return number of bytes read */ + struct connectdata *conn, + int *ftpcode) /* return the ftp-code */ +{ + /* + * We cannot read just one byte per read() and then go back to select() as + * the OpenSSL read() doesn't grok that properly. + * + * Alas, read as much as possible, split up into lines, use the ending + * line in a response or continue reading. */ + + curl_socket_t sockfd = conn->sock[FIRSTSOCKET]; + long timeout; /* timeout in milliseconds */ + long interval_ms; + struct SessionHandle *data = conn->data; + CURLcode result = CURLE_OK; + struct ftp_conn *ftpc = &conn->proto.ftpc; + struct pingpong *pp = &ftpc->pp; + size_t nread; + int cache_skip=0; + int value_to_be_ignored=0; + + if(ftpcode) + *ftpcode = 0; /* 0 for errors */ + else + /* make the pointer point to something for the rest of this function */ + ftpcode = &value_to_be_ignored; + + *nreadp=0; + + while(!*ftpcode && !result) { + /* check and reset timeout value every lap */ + timeout = Curl_pp_state_timeout(pp); + + if(timeout <=0 ) { + failf(data, "FTP response timeout"); + return CURLE_OPERATION_TIMEDOUT; /* already too little time */ + } + + interval_ms = 1000; /* use 1 second timeout intervals */ + if(timeout < interval_ms) + interval_ms = timeout; + + /* + * Since this function is blocking, we need to wait here for input on the + * connection and only then we call the response reading function. We do + * timeout at least every second to make the timeout check run. + * + * A caution here is that the ftp_readresp() function has a cache that may + * contain pieces of a response from the previous invoke and we need to + * make sure we don't just wait for input while there is unhandled data in + * that cache. But also, if the cache is there, we call ftp_readresp() and + * the cache wasn't good enough to continue we must not just busy-loop + * around this function. + * + */ + + if(pp->cache && (cache_skip < 2)) { + /* + * There's a cache left since before. We then skipping the wait for + * socket action, unless this is the same cache like the previous round + * as then the cache was deemed not enough to act on and we then need to + * wait for more data anyway. + */ + } + else { + switch (Curl_socket_ready(sockfd, CURL_SOCKET_BAD, (int)interval_ms)) { + case -1: /* select() error, stop reading */ + failf(data, "FTP response aborted due to select/poll error: %d", + SOCKERRNO); + return CURLE_RECV_ERROR; + + case 0: /* timeout */ + if(Curl_pgrsUpdate(conn)) + return CURLE_ABORTED_BY_CALLBACK; + continue; /* just continue in our loop for the timeout duration */ + + default: /* for clarity */ + break; + } + } + result = ftp_readresp(sockfd, pp, ftpcode, &nread); + if(result) + break; + + if(!nread && pp->cache) + /* bump cache skip counter as on repeated skips we must wait for more + data */ + cache_skip++; + else + /* when we got data or there is no cache left, we reset the cache skip + counter */ + cache_skip=0; + + *nreadp += nread; + + } /* while there's buffer left and loop is requested */ + + pp->pending_resp = FALSE; + + return result; +} + +/* This is the ONLY way to change FTP state! */ +static void state(struct connectdata *conn, + ftpstate newstate) +{ +#if defined(DEBUGBUILD) && !defined(CURL_DISABLE_VERBOSE_STRINGS) + /* for debug purposes */ + static const char * const names[]={ + "STOP", + "WAIT220", + "AUTH", + "USER", + "PASS", + "ACCT", + "PBSZ", + "PROT", + "CCC", + "PWD", + "SYST", + "NAMEFMT", + "QUOTE", + "RETR_PREQUOTE", + "STOR_PREQUOTE", + "POSTQUOTE", + "CWD", + "MKD", + "MDTM", + "TYPE", + "LIST_TYPE", + "RETR_TYPE", + "STOR_TYPE", + "SIZE", + "RETR_SIZE", + "STOR_SIZE", + "REST", + "RETR_REST", + "PORT", + "PRET", + "PASV", + "LIST", + "RETR", + "STOR", + "QUIT" + }; +#endif + struct ftp_conn *ftpc = &conn->proto.ftpc; +#if defined(DEBUGBUILD) && !defined(CURL_DISABLE_VERBOSE_STRINGS) + if(ftpc->state != newstate) + infof(conn->data, "FTP %p state change from %s to %s\n", + ftpc, names[ftpc->state], names[newstate]); +#endif + ftpc->state = newstate; +} + +static CURLcode ftp_state_user(struct connectdata *conn) +{ + CURLcode result; + struct FTP *ftp = conn->data->state.proto.ftp; + /* send USER */ + PPSENDF(&conn->proto.ftpc.pp, "USER %s", ftp->user?ftp->user:""); + + state(conn, FTP_USER); + conn->data->state.ftp_trying_alternative = FALSE; + + return CURLE_OK; +} + +static CURLcode ftp_state_pwd(struct connectdata *conn) +{ + CURLcode result; + + /* send PWD to discover our entry point */ + PPSENDF(&conn->proto.ftpc.pp, "PWD", NULL); + state(conn, FTP_PWD); + + return CURLE_OK; +} + +/* For the FTP "protocol connect" and "doing" phases only */ +static int ftp_getsock(struct connectdata *conn, + curl_socket_t *socks, + int numsocks) +{ + return Curl_pp_getsock(&conn->proto.ftpc.pp, socks, numsocks); +} + +/* This is called after the FTP_QUOTE state is passed. + + ftp_state_cwd() sends the range of CWD commands to the server to change to + the correct directory. It may also need to send MKD commands to create + missing ones, if that option is enabled. +*/ +static CURLcode ftp_state_cwd(struct connectdata *conn) +{ + CURLcode result = CURLE_OK; + struct ftp_conn *ftpc = &conn->proto.ftpc; + + if(ftpc->cwddone) + /* already done and fine */ + result = ftp_state_post_cwd(conn); + else { + ftpc->count2 = 0; /* count2 counts failed CWDs */ + + /* count3 is set to allow a MKD to fail once. In the case when first CWD + fails and then MKD fails (due to another session raced it to create the + dir) this then allows for a second try to CWD to it */ + ftpc->count3 = (conn->data->set.ftp_create_missing_dirs==2)?1:0; + + if(conn->bits.reuse && ftpc->entrypath) { + /* This is a re-used connection. Since we change directory to where the + transfer is taking place, we must first get back to the original dir + where we ended up after login: */ + ftpc->count1 = 0; /* we count this as the first path, then we add one + for all upcoming ones in the ftp->dirs[] array */ + PPSENDF(&conn->proto.ftpc.pp, "CWD %s", ftpc->entrypath); + state(conn, FTP_CWD); + } + else { + if(ftpc->dirdepth) { + ftpc->count1 = 1; + /* issue the first CWD, the rest is sent when the CWD responses are + received... */ + PPSENDF(&conn->proto.ftpc.pp, "CWD %s", ftpc->dirs[ftpc->count1 -1]); + state(conn, FTP_CWD); + } + else { + /* No CWD necessary */ + result = ftp_state_post_cwd(conn); + } + } + } + return result; +} + +typedef enum { + EPRT, + PORT, + DONE +} ftpport; + +static CURLcode ftp_state_use_port(struct connectdata *conn, + ftpport fcmd) /* start with this */ + +{ + CURLcode result = CURLE_OK; + struct ftp_conn *ftpc = &conn->proto.ftpc; + struct SessionHandle *data=conn->data; + curl_socket_t portsock= CURL_SOCKET_BAD; + char myhost[256] = ""; + + struct Curl_sockaddr_storage ss; + Curl_addrinfo *res, *ai; + curl_socklen_t sslen; + char hbuf[NI_MAXHOST]; + struct sockaddr *sa=(struct sockaddr *)&ss; + struct sockaddr_in * const sa4 = (void *)sa; +#ifdef ENABLE_IPV6 + struct sockaddr_in6 * const sa6 = (void *)sa; +#endif + char tmp[1024]; + static const char mode[][5] = { "EPRT", "PORT" }; + int rc; + int error; + char *host=NULL; + char *string_ftpport = data->set.str[STRING_FTPPORT]; + struct Curl_dns_entry *h=NULL; + unsigned short port_min = 0; + unsigned short port_max = 0; + unsigned short port; + + char *addr = NULL; + + /* Step 1, figure out what is requested, + * accepted format : + * (ipv4|ipv6|domain|interface)?(:port(-range)?)? + */ + + if(data->set.str[STRING_FTPPORT] && + (strlen(data->set.str[STRING_FTPPORT]) > 1)) { + +#ifdef ENABLE_IPV6 + size_t addrlen = INET6_ADDRSTRLEN > strlen(string_ftpport) ? + INET6_ADDRSTRLEN : strlen(string_ftpport); +#else + size_t addrlen = INET_ADDRSTRLEN > strlen(string_ftpport) ? + INET_ADDRSTRLEN : strlen(string_ftpport); +#endif + char *ip_start = string_ftpport; + char *ip_end = NULL; + char *port_start = NULL; + char *port_sep = NULL; + + addr = calloc(addrlen+1, 1); + if (!addr) + return CURLE_OUT_OF_MEMORY; + +#ifdef ENABLE_IPV6 + if(*string_ftpport == '[') { + /* [ipv6]:port(-range) */ + ip_start = string_ftpport + 1; + if((ip_end = strchr(string_ftpport, ']')) != NULL ) + strncpy(addr, ip_start, ip_end - ip_start); + } + else +#endif + if( *string_ftpport == ':') { + /* :port */ + ip_end = string_ftpport; + } + else if( (ip_end = strchr(string_ftpport, ':')) != NULL) { + /* either ipv6 or (ipv4|domain|interface):port(-range) */ +#ifdef ENABLE_IPV6 + if(Curl_inet_pton(AF_INET6, string_ftpport, sa6) == 1) { + /* ipv6 */ + port_min = port_max = 0; + strcpy(addr, string_ftpport); + ip_end = NULL; /* this got no port ! */ + } else +#endif + { + /* (ipv4|domain|interface):port(-range) */ + strncpy(addr, string_ftpport, ip_end - ip_start ); + } + } + else + /* ipv4|interface */ + strcpy(addr, string_ftpport); + + /* parse the port */ + if( ip_end != NULL ) { + if((port_start = strchr(ip_end, ':')) != NULL) { + port_min = curlx_ultous(strtoul(port_start+1, NULL, 10)); + if((port_sep = strchr(port_start, '-')) != NULL) { + port_max = curlx_ultous(strtoul(port_sep + 1, NULL, 10)); + } + else + port_max = port_min; + } + } + + /* correct errors like: + * :1234-1230 + * :-4711 , in this case port_min is (unsigned)-1, + * therefore port_min > port_max for all cases + * but port_max = (unsigned)-1 + */ + if(port_min > port_max ) + port_min = port_max = 0; + + + if(*addr != '\0') { + /* attempt to get the address of the given interface name */ + if(!Curl_if2ip(conn->ip_addr->ai_family, addr, + hbuf, sizeof(hbuf))) + /* not an interface, use the given string as host name instead */ + host = addr; + else + host = hbuf; /* use the hbuf for host name */ + }else + /* there was only a port(-range) given, default the host */ + host = NULL; + } /* data->set.ftpport */ + + if(!host) { + /* not an interface and not a host name, get default by extracting + the IP from the control connection */ + + sslen = sizeof(ss); + if(getsockname(conn->sock[FIRSTSOCKET], sa, &sslen)) { + failf(data, "getsockname() failed: %s", + Curl_strerror(conn, SOCKERRNO) ); + if (addr) + free(addr); + return CURLE_FTP_PORT_FAILED; + } + switch(sa->sa_family) + { +#ifdef ENABLE_IPV6 + case AF_INET6: + Curl_inet_ntop(sa->sa_family, &sa6->sin6_addr, hbuf, sizeof(hbuf)); + break; +#endif + default: + Curl_inet_ntop(sa->sa_family, &sa4->sin_addr, hbuf, sizeof(hbuf)); + break; + } + host = hbuf; /* use this host name */ + } + + /* resolv ip/host to ip */ + rc = Curl_resolv(conn, host, 0, &h); + if(rc == CURLRESOLV_PENDING) + (void)Curl_wait_for_resolv(conn, &h); + if(h) { + res = h->addr; + /* when we return from this function, we can forget about this entry + to we can unlock it now already */ + Curl_resolv_unlock(data, h); + } /* (h) */ + else + res = NULL; /* failure! */ + + if (addr) + free(addr); + + if (res == NULL) { + failf(data, "Curl_resolv failed, we can not recover!"); + return CURLE_FTP_PORT_FAILED; + } + + /* step 2, create a socket for the requested address */ + + portsock = CURL_SOCKET_BAD; + error = 0; + for (ai = res; ai; ai = ai->ai_next) { + /* + * Workaround for AIX5 getaddrinfo() problem (it doesn't set ai_socktype): + */ + if(ai->ai_socktype == 0) + ai->ai_socktype = conn->socktype; + + portsock = socket(ai->ai_family, ai->ai_socktype, ai->ai_protocol); + if(portsock == CURL_SOCKET_BAD) { + error = SOCKERRNO; + continue; + } + break; + } + if(!ai) { + failf(data, "socket failure: %s", Curl_strerror(conn, error)); + return CURLE_FTP_PORT_FAILED; + } + + /* step 3, bind to a suitable local address */ + + memcpy(sa, ai->ai_addr, ai->ai_addrlen); + sslen = ai->ai_addrlen; + + for( port = port_min; port <= port_max; ) { + if( sa->sa_family == AF_INET ) + sa4->sin_port = htons(port); +#ifdef ENABLE_IPV6 + else + sa6->sin6_port = htons(port); +#endif + /* Try binding the given address. */ + if(bind(portsock, sa, sslen) ) { + /* It failed. */ + error = SOCKERRNO; + if(error == EADDRNOTAVAIL) { + + /* The requested bind address is not local. Use the address used for + * the control connection instead and restart the port loop + */ + failf(data, "bind(port=%hu) failed: %s", port, + Curl_strerror(conn, error) ); + + sslen = sizeof(ss); + if(getsockname(conn->sock[FIRSTSOCKET], sa, &sslen)) { + failf(data, "getsockname() failed: %s", + Curl_strerror(conn, SOCKERRNO) ); + sclose(portsock); + return CURLE_FTP_PORT_FAILED; + } + port = port_min; + continue; + } + else if(error != EADDRINUSE && error != EACCES) { + failf(data, "bind(port=%hu) failed: %s", port, + Curl_strerror(conn, error) ); + sclose(portsock); + return CURLE_FTP_PORT_FAILED; + } + } + else + break; + + port++; + } + + /* maybe all ports were in use already*/ + if (port > port_max) { + failf(data, "bind() failed, we ran out of ports!"); + sclose(portsock); + return CURLE_FTP_PORT_FAILED; + } + + /* get the name again after the bind() so that we can extract the + port number it uses now */ + sslen = sizeof(ss); + if(getsockname(portsock, (struct sockaddr *)sa, &sslen)) { + failf(data, "getsockname() failed: %s", + Curl_strerror(conn, SOCKERRNO) ); + sclose(portsock); + return CURLE_FTP_PORT_FAILED; + } + + /* step 4, listen on the socket */ + + if(listen(portsock, 1)) { + failf(data, "socket failure: %s", Curl_strerror(conn, SOCKERRNO)); + sclose(portsock); + return CURLE_FTP_PORT_FAILED; + } + + /* step 5, send the proper FTP command */ + + /* get a plain printable version of the numerical address to work with + below */ + Curl_printable_address(ai, myhost, sizeof(myhost)); + +#ifdef ENABLE_IPV6 + if(!conn->bits.ftp_use_eprt && conn->bits.ipv6) + /* EPRT is disabled but we are connected to a IPv6 host, so we ignore the + request and enable EPRT again! */ + conn->bits.ftp_use_eprt = TRUE; +#endif + + for (; fcmd != DONE; fcmd++) { + + if(!conn->bits.ftp_use_eprt && (EPRT == fcmd)) + /* if disabled, goto next */ + continue; + + if((PORT == fcmd) && sa->sa_family != AF_INET) + /* PORT is ipv4 only */ + continue; + + switch (sa->sa_family) { + case AF_INET: + port = ntohs(sa4->sin_port); + break; +#ifdef ENABLE_IPV6 + case AF_INET6: + port = ntohs(sa6->sin6_port); + break; +#endif + default: + continue; /* might as well skip this */ + } + + if(EPRT == fcmd) { + /* + * Two fine examples from RFC2428; + * + * EPRT |1|132.235.1.2|6275| + * + * EPRT |2|1080::8:800:200C:417A|5282| + */ + + result = Curl_pp_sendf(&ftpc->pp, "%s |%d|%s|%hu|", mode[fcmd], + sa->sa_family == AF_INET?1:2, + myhost, port); + if(result) + return result; + break; + } + else if(PORT == fcmd) { + char *source = myhost; + char *dest = tmp; + + /* translate x.x.x.x to x,x,x,x */ + while(source && *source) { + if(*source == '.') + *dest=','; + else + *dest = *source; + dest++; + source++; + } + *dest = 0; + snprintf(dest, 20, ",%d,%d", (int)(port>>8), (int)(port&0xff)); + + result = Curl_pp_sendf(&ftpc->pp, "%s %s", mode[fcmd], tmp); + if(result) + return result; + break; + } + } + + /* store which command was sent */ + ftpc->count1 = fcmd; + + /* we set the secondary socket variable to this for now, it is only so that + the cleanup function will close it in case we fail before the true + secondary stuff is made */ + if(CURL_SOCKET_BAD != conn->sock[SECONDARYSOCKET]) + sclose(conn->sock[SECONDARYSOCKET]); + conn->sock[SECONDARYSOCKET] = portsock; + + /* this tcpconnect assignment below is a hackish work-around to make the + multi interface with active FTP work - as it will not wait for a + (passive) connect in Curl_is_connected(). + + The *proper* fix is to make sure that the active connection from the + server is done in a non-blocking way. Currently, it is still BLOCKING. + */ + conn->bits.tcpconnect = TRUE; + + state(conn, FTP_PORT); + return result; +} + +static CURLcode ftp_state_use_pasv(struct connectdata *conn) +{ + struct ftp_conn *ftpc = &conn->proto.ftpc; + CURLcode result = CURLE_OK; + /* + Here's the excecutive summary on what to do: + + PASV is RFC959, expect: + 227 Entering Passive Mode (a1,a2,a3,a4,p1,p2) + + LPSV is RFC1639, expect: + 228 Entering Long Passive Mode (4,4,a1,a2,a3,a4,2,p1,p2) + + EPSV is RFC2428, expect: + 229 Entering Extended Passive Mode (|||port|) + + */ + + static const char mode[][5] = { "EPSV", "PASV" }; + int modeoff; + +#ifdef PF_INET6 + if(!conn->bits.ftp_use_epsv && conn->bits.ipv6) + /* EPSV is disabled but we are connected to a IPv6 host, so we ignore the + request and enable EPSV again! */ + conn->bits.ftp_use_epsv = TRUE; +#endif + + modeoff = conn->bits.ftp_use_epsv?0:1; + + PPSENDF(&ftpc->pp, "%s", mode[modeoff]); + + ftpc->count1 = modeoff; + state(conn, FTP_PASV); + infof(conn->data, "Connect data stream passively\n"); + + return result; +} + +/* REST is the last command in the chain of commands when a "head"-like + request is made. Thus, if an actual transfer is to be made this is where + we take off for real. */ +static CURLcode ftp_state_post_rest(struct connectdata *conn) +{ + CURLcode result = CURLE_OK; + struct FTP *ftp = conn->data->state.proto.ftp; + struct SessionHandle *data = conn->data; + + if(ftp->transfer != FTPTRANSFER_BODY) { + /* doesn't transfer any data */ + + /* still possibly do PRE QUOTE jobs */ + state(conn, FTP_RETR_PREQUOTE); + result = ftp_state_quote(conn, TRUE, FTP_RETR_PREQUOTE); + } + else if(data->set.ftp_use_port) { + /* We have chosen to use the PORT (or similar) command */ + result = ftp_state_use_port(conn, EPRT); + } + else { + /* We have chosen (this is default) to use the PASV (or similar) command */ + if(data->set.ftp_use_pret) { + /* The user has requested that we send a PRET command + to prepare the server for the upcoming PASV */ + if(!conn->proto.ftpc.file) { + PPSENDF(&conn->proto.ftpc.pp, "PRET %s", + data->set.str[STRING_CUSTOMREQUEST]? + data->set.str[STRING_CUSTOMREQUEST]: + (data->set.ftp_list_only?"NLST":"LIST")); + } + else if(data->set.upload) { + PPSENDF(&conn->proto.ftpc.pp, "PRET STOR %s", conn->proto.ftpc.file); + } + else { + PPSENDF(&conn->proto.ftpc.pp, "PRET RETR %s", conn->proto.ftpc.file); + } + state(conn, FTP_PRET); + } + else { + result = ftp_state_use_pasv(conn); + } + } + return result; +} + +static CURLcode ftp_state_post_size(struct connectdata *conn) +{ + CURLcode result = CURLE_OK; + struct FTP *ftp = conn->data->state.proto.ftp; + struct ftp_conn *ftpc = &conn->proto.ftpc; + + if((ftp->transfer != FTPTRANSFER_BODY) && ftpc->file) { + /* if a "head"-like request is being made (on a file) */ + + /* Determine if server can respond to REST command and therefore + whether it supports range */ + PPSENDF(&conn->proto.ftpc.pp, "REST %d", 0); + + state(conn, FTP_REST); + } + else + result = ftp_state_post_rest(conn); + + return result; +} + +static CURLcode ftp_state_post_type(struct connectdata *conn) +{ + CURLcode result = CURLE_OK; + struct FTP *ftp = conn->data->state.proto.ftp; + struct ftp_conn *ftpc = &conn->proto.ftpc; + + if((ftp->transfer == FTPTRANSFER_INFO) && ftpc->file) { + /* if a "head"-like request is being made (on a file) */ + + /* we know ftpc->file is a valid pointer to a file name */ + PPSENDF(&ftpc->pp, "SIZE %s", ftpc->file); + + state(conn, FTP_SIZE); + } + else + result = ftp_state_post_size(conn); + + return result; +} + +static CURLcode ftp_state_post_listtype(struct connectdata *conn) +{ + CURLcode result = CURLE_OK; + struct SessionHandle *data = conn->data; + + /* If this output is to be machine-parsed, the NLST command might be better + to use, since the LIST command output is not specified or standard in any + way. It has turned out that the NLST list output is not the same on all + servers either... */ + + /* + if FTPFILE_NOCWD was specified, we are currently in + the user's home directory, so we should add the path + as argument for the LIST / NLST / or custom command. + Whether the server will support this, is uncertain. + + The other ftp_filemethods will CWD into dir/dir/ first and + then just do LIST (in that case: nothing to do here) + */ + char *cmd,*lstArg,*slashPos; + + lstArg = NULL; + if((data->set.ftp_filemethod == FTPFILE_NOCWD) && + data->state.path && + data->state.path[0] && + strchr(data->state.path,'/')) { + + lstArg = strdup(data->state.path); + if(!lstArg) + return CURLE_OUT_OF_MEMORY; + + /* Check if path does not end with /, as then we cut off the file part */ + if(lstArg[strlen(lstArg) - 1] != '/') { + + /* chop off the file part if format is dir/dir/file */ + slashPos = strrchr(lstArg,'/'); + if(slashPos) + *(slashPos+1) = '\0'; + } + } + + cmd = aprintf( "%s%s%s", + data->set.str[STRING_CUSTOMREQUEST]? + data->set.str[STRING_CUSTOMREQUEST]: + (data->set.ftp_list_only?"NLST":"LIST"), + lstArg? " ": "", + lstArg? lstArg: "" ); + + if(!cmd) { + if(lstArg) + free(lstArg); + return CURLE_OUT_OF_MEMORY; + } + + PPSENDF(&conn->proto.ftpc.pp, "%s",cmd); + + if(lstArg) + free(lstArg); + + free(cmd); + + state(conn, FTP_LIST); + + return result; +} + +static CURLcode ftp_state_post_retrtype(struct connectdata *conn) +{ + CURLcode result = CURLE_OK; + + /* We've sent the TYPE, now we must send the list of prequote strings */ + + result = ftp_state_quote(conn, TRUE, FTP_RETR_PREQUOTE); + + return result; +} + +static CURLcode ftp_state_post_stortype(struct connectdata *conn) +{ + CURLcode result = CURLE_OK; + + /* We've sent the TYPE, now we must send the list of prequote strings */ + + result = ftp_state_quote(conn, TRUE, FTP_STOR_PREQUOTE); + + return result; +} + +static CURLcode ftp_state_post_mdtm(struct connectdata *conn) +{ + CURLcode result = CURLE_OK; + struct FTP *ftp = conn->data->state.proto.ftp; + struct SessionHandle *data = conn->data; + struct ftp_conn *ftpc = &conn->proto.ftpc; + + /* If we have selected NOBODY and HEADER, it means that we only want file + information. Which in FTP can't be much more than the file size and + date. */ + if(data->set.opt_no_body && ftpc->file && + ftp_need_type(conn, data->set.prefer_ascii)) { + /* The SIZE command is _not_ RFC 959 specified, and therefor many servers + may not support it! It is however the only way we have to get a file's + size! */ + + ftp->transfer = FTPTRANSFER_INFO; + /* this means no actual transfer will be made */ + + /* Some servers return different sizes for different modes, and thus we + must set the proper type before we check the size */ + result = ftp_nb_type(conn, data->set.prefer_ascii, FTP_TYPE); + if(result) + return result; + } + else + result = ftp_state_post_type(conn); + + return result; +} + +/* This is called after the CWD commands have been done in the beginning of + the DO phase */ +static CURLcode ftp_state_post_cwd(struct connectdata *conn) +{ + CURLcode result = CURLE_OK; + struct SessionHandle *data = conn->data; + struct ftp_conn *ftpc = &conn->proto.ftpc; + + /* Requested time of file or time-depended transfer? */ + if((data->set.get_filetime || data->set.timecondition) && ftpc->file) { + + /* we have requested to get the modified-time of the file, this is a white + spot as the MDTM is not mentioned in RFC959 */ + PPSENDF(&ftpc->pp, "MDTM %s", ftpc->file); + + state(conn, FTP_MDTM); + } + else + result = ftp_state_post_mdtm(conn); + + return result; +} + + +/* This is called after the TYPE and possible quote commands have been sent */ +static CURLcode ftp_state_ul_setup(struct connectdata *conn, + bool sizechecked) +{ + CURLcode result = CURLE_OK; + struct FTP *ftp = conn->data->state.proto.ftp; + struct SessionHandle *data = conn->data; + struct ftp_conn *ftpc = &conn->proto.ftpc; + int seekerr = CURL_SEEKFUNC_OK; + + if((data->state.resume_from && !sizechecked) || + ((data->state.resume_from > 0) && sizechecked)) { + /* we're about to continue the uploading of a file */ + /* 1. get already existing file's size. We use the SIZE command for this + which may not exist in the server! The SIZE command is not in + RFC959. */ + + /* 2. This used to set REST. But since we can do append, we + don't another ftp command. We just skip the source file + offset and then we APPEND the rest on the file instead */ + + /* 3. pass file-size number of bytes in the source file */ + /* 4. lower the infilesize counter */ + /* => transfer as usual */ + + if(data->state.resume_from < 0 ) { + /* Got no given size to start from, figure it out */ + PPSENDF(&ftpc->pp, "SIZE %s", ftpc->file); + state(conn, FTP_STOR_SIZE); + return result; + } + + /* enable append */ + data->set.ftp_append = TRUE; + + /* Let's read off the proper amount of bytes from the input. */ + if(conn->seek_func) { + seekerr = conn->seek_func(conn->seek_client, data->state.resume_from, + SEEK_SET); + } + + if(seekerr != CURL_SEEKFUNC_OK) { + if(seekerr != CURL_SEEKFUNC_CANTSEEK) { + failf(data, "Could not seek stream"); + return CURLE_FTP_COULDNT_USE_REST; + } + /* seekerr == CURL_SEEKFUNC_CANTSEEK (can't seek to offset) */ + else { + curl_off_t passed=0; + do { + size_t readthisamountnow = + (data->state.resume_from - passed > CURL_OFF_T_C(BUFSIZE)) ? + BUFSIZE : curlx_sotouz(data->state.resume_from - passed); + + size_t actuallyread = + conn->fread_func(data->state.buffer, 1, readthisamountnow, + conn->fread_in); + + passed += actuallyread; + if((actuallyread == 0) || (actuallyread > readthisamountnow)) { + /* this checks for greater-than only to make sure that the + CURL_READFUNC_ABORT return code still aborts */ + failf(data, "Failed to read data"); + return CURLE_FTP_COULDNT_USE_REST; + } + } while(passed < data->state.resume_from); + } + } + /* now, decrease the size of the read */ + if(data->set.infilesize>0) { + data->set.infilesize -= data->state.resume_from; + + if(data->set.infilesize <= 0) { + infof(data, "File already completely uploaded\n"); + + /* no data to transfer */ + Curl_setup_transfer(conn, -1, -1, FALSE, NULL, -1, NULL); + + /* Set ->transfer so that we won't get any error in + * ftp_done() because we didn't transfer anything! */ + ftp->transfer = FTPTRANSFER_NONE; + + state(conn, FTP_STOP); + return CURLE_OK; + } + } + /* we've passed, proceed as normal */ + } /* resume_from */ + + PPSENDF(&ftpc->pp, data->set.ftp_append?"APPE %s":"STOR %s", + ftpc->file); + + state(conn, FTP_STOR); + + return result; +} + +static CURLcode ftp_state_quote(struct connectdata *conn, + bool init, + ftpstate instate) +{ + CURLcode result = CURLE_OK; + struct SessionHandle *data = conn->data; + struct FTP *ftp = data->state.proto.ftp; + struct ftp_conn *ftpc = &conn->proto.ftpc; + bool quote=FALSE; + struct curl_slist *item; + + switch(instate) { + case FTP_QUOTE: + default: + item = data->set.quote; + break; + case FTP_RETR_PREQUOTE: + case FTP_STOR_PREQUOTE: + item = data->set.prequote; + break; + case FTP_POSTQUOTE: + item = data->set.postquote; + break; + } + + /* + * This state uses: + * 'count1' to iterate over the commands to send + * 'count2' to store wether to allow commands to fail + */ + + if(init) + ftpc->count1 = 0; + else + ftpc->count1++; + + if(item) { + int i = 0; + + /* Skip count1 items in the linked list */ + while((i< ftpc->count1) && item) { + item = item->next; + i++; + } + if(item) { + char *cmd = item->data; + if(cmd[0] == '*') { + cmd++; + ftpc->count2 = 1; /* the sent command is allowed to fail */ + } + else + ftpc->count2 = 0; /* failure means cancel operation */ + + PPSENDF(&ftpc->pp, "%s", cmd); + state(conn, instate); + quote = TRUE; + } + } + + if(!quote) { + /* No more quote to send, continue to ... */ + switch(instate) { + case FTP_QUOTE: + default: + result = ftp_state_cwd(conn); + break; + case FTP_RETR_PREQUOTE: + if(ftp->transfer != FTPTRANSFER_BODY) + state(conn, FTP_STOP); + else { + if(ftpc->known_filesize != -1) { + Curl_pgrsSetDownloadSize(data, ftpc->known_filesize); + result = ftp_state_post_retr_size(conn, ftpc->known_filesize); + } + else { + PPSENDF(&ftpc->pp, "SIZE %s", ftpc->file); + state(conn, FTP_RETR_SIZE); + } + } + break; + case FTP_STOR_PREQUOTE: + result = ftp_state_ul_setup(conn, FALSE); + break; + case FTP_POSTQUOTE: + break; + } + } + + return result; +} + +static CURLcode ftp_state_pasv_resp(struct connectdata *conn, + int ftpcode) +{ + struct ftp_conn *ftpc = &conn->proto.ftpc; + CURLcode result; + struct SessionHandle *data=conn->data; + Curl_addrinfo *conninfo; + struct Curl_dns_entry *addr=NULL; + int rc; + unsigned short connectport; /* the local port connect() should use! */ + unsigned short newport=0; /* remote port */ + bool connected; + + /* newhost must be able to hold a full IP-style address in ASCII, which + in the IPv6 case means 5*8-1 = 39 letters */ +#define NEWHOST_BUFSIZE 48 + char newhost[NEWHOST_BUFSIZE]; + char *str=&data->state.buffer[4]; /* start on the first letter */ + + if((ftpc->count1 == 0) && + (ftpcode == 229)) { + /* positive EPSV response */ + char *ptr = strchr(str, '('); + if(ptr) { + unsigned int num; + char separator[4]; + ptr++; + if(5 == sscanf(ptr, "%c%c%c%u%c", + &separator[0], + &separator[1], + &separator[2], + &num, + &separator[3])) { + const char sep1 = separator[0]; + int i; + + /* The four separators should be identical, or else this is an oddly + formatted reply and we bail out immediately. */ + for(i=1; i<4; i++) { + if(separator[i] != sep1) { + ptr=NULL; /* set to NULL to signal error */ + break; + } + } + if(ptr) { + newport = (unsigned short)(num & 0xffff); + + if(conn->bits.tunnel_proxy || + data->set.proxytype == CURLPROXY_SOCKS5 || + data->set.proxytype == CURLPROXY_SOCKS5_HOSTNAME || + data->set.proxytype == CURLPROXY_SOCKS4 || + data->set.proxytype == CURLPROXY_SOCKS4A) + /* proxy tunnel -> use other host info because ip_addr_str is the + proxy address not the ftp host */ + snprintf(newhost, sizeof(newhost), "%s", conn->host.name); + else + /* use the same IP we are already connected to */ + snprintf(newhost, NEWHOST_BUFSIZE, "%s", conn->ip_addr_str); + } + } + else + ptr=NULL; + } + if(!ptr) { + failf(data, "Weirdly formatted EPSV reply"); + return CURLE_FTP_WEIRD_PASV_REPLY; + } + } + else if((ftpc->count1 == 1) && + (ftpcode == 227)) { + /* positive PASV response */ + int ip[4]; + int port[2]; + + /* + * Scan for a sequence of six comma-separated numbers and use them as + * IP+port indicators. + * + * Found reply-strings include: + * "227 Entering Passive Mode (127,0,0,1,4,51)" + * "227 Data transfer will passively listen to 127,0,0,1,4,51" + * "227 Entering passive mode. 127,0,0,1,4,51" + */ + while(*str) { + if(6 == sscanf(str, "%d,%d,%d,%d,%d,%d", + &ip[0], &ip[1], &ip[2], &ip[3], + &port[0], &port[1])) + break; + str++; + } + + if(!*str) { + failf(data, "Couldn't interpret the 227-response"); + return CURLE_FTP_WEIRD_227_FORMAT; + } + + /* we got OK from server */ + if(data->set.ftp_skip_ip) { + /* told to ignore the remotely given IP but instead use the one we used + for the control connection */ + infof(data, "Skips %d.%d.%d.%d for data connection, uses %s instead\n", + ip[0], ip[1], ip[2], ip[3], + conn->ip_addr_str); + if(conn->bits.tunnel_proxy || + data->set.proxytype == CURLPROXY_SOCKS5 || + data->set.proxytype == CURLPROXY_SOCKS5_HOSTNAME || + data->set.proxytype == CURLPROXY_SOCKS4 || + data->set.proxytype == CURLPROXY_SOCKS4A) + /* proxy tunnel -> use other host info because ip_addr_str is the + proxy address not the ftp host */ + snprintf(newhost, sizeof(newhost), "%s", conn->host.name); + else + snprintf(newhost, sizeof(newhost), "%s", conn->ip_addr_str); + } + else + snprintf(newhost, sizeof(newhost), + "%d.%d.%d.%d", ip[0], ip[1], ip[2], ip[3]); + newport = (unsigned short)(((port[0]<<8) + port[1]) & 0xffff); + } + else if(ftpc->count1 == 0) { + /* EPSV failed, move on to PASV */ + + /* disable it for next transfer */ + conn->bits.ftp_use_epsv = FALSE; + infof(data, "disabling EPSV usage\n"); + + PPSENDF(&ftpc->pp, "PASV", NULL); + ftpc->count1++; + /* remain in the FTP_PASV state */ + return result; + } + else { + failf(data, "Bad PASV/EPSV response: %03d", ftpcode); + return CURLE_FTP_WEIRD_PASV_REPLY; + } + + if(data->set.str[STRING_PROXY] && *data->set.str[STRING_PROXY]) { + /* + * This is a tunnel through a http proxy and we need to connect to the + * proxy again here. + * + * We don't want to rely on a former host lookup that might've expired + * now, instead we remake the lookup here and now! + */ + rc = Curl_resolv(conn, conn->proxy.name, (int)conn->port, &addr); + if(rc == CURLRESOLV_PENDING) + /* BLOCKING, ignores the return code but 'addr' will be NULL in + case of failure */ + (void)Curl_wait_for_resolv(conn, &addr); + + connectport = + (unsigned short)conn->port; /* we connect to the proxy's port */ + + if(!addr) { + failf(data, "Can't resolve proxy host %s:%hu", + conn->proxy.name, connectport); + return CURLE_FTP_CANT_GET_HOST; + } + } + else { + /* normal, direct, ftp connection */ + rc = Curl_resolv(conn, newhost, newport, &addr); + if(rc == CURLRESOLV_PENDING) + /* BLOCKING */ + (void)Curl_wait_for_resolv(conn, &addr); + + connectport = newport; /* we connect to the remote port */ + + if(!addr) { + failf(data, "Can't resolve new host %s:%hu", newhost, connectport); + return CURLE_FTP_CANT_GET_HOST; + } + } + + result = Curl_connecthost(conn, + addr, + &conn->sock[SECONDARYSOCKET], + &conninfo, + &connected); + + Curl_resolv_unlock(data, addr); /* we're done using this address */ + + if(result && ftpc->count1 == 0 && ftpcode == 229) { + infof(data, "got positive EPSV response, but can't connect. " + "Disabling EPSV\n"); + /* disable it for next transfer */ + conn->bits.ftp_use_epsv = FALSE; + data->state.errorbuf = FALSE; /* allow error message to get rewritten */ + PPSENDF(&ftpc->pp, "PASV", NULL); + ftpc->count1++; + /* remain in the FTP_PASV state */ + return result; + } + + if(result) + return result; + + conn->bits.tcpconnect = connected; /* simply TRUE or FALSE */ + + /* + * When this is used from the multi interface, this might've returned with + * the 'connected' set to FALSE and thus we are now awaiting a non-blocking + * connect to connect and we should not be "hanging" here waiting. + */ + + if(data->set.verbose) + /* this just dumps information about this second connection */ + ftp_pasv_verbose(conn, conninfo, newhost, connectport); + + switch(data->set.proxytype) { +#ifndef CURL_DISABLE_PROXY + /* FIX: this MUST wait for a proper connect first if 'connected' is + * FALSE */ + case CURLPROXY_SOCKS5: + case CURLPROXY_SOCKS5_HOSTNAME: + result = Curl_SOCKS5(conn->proxyuser, conn->proxypasswd, newhost, newport, + SECONDARYSOCKET, conn); + break; + case CURLPROXY_SOCKS4: + result = Curl_SOCKS4(conn->proxyuser, newhost, newport, + SECONDARYSOCKET, conn, FALSE); + break; + case CURLPROXY_SOCKS4A: + result = Curl_SOCKS4(conn->proxyuser, newhost, newport, + SECONDARYSOCKET, conn, TRUE); + break; +#endif /* CURL_DISABLE_PROXY */ + case CURLPROXY_HTTP: + case CURLPROXY_HTTP_1_0: + /* do nothing here. handled later. */ + break; + default: + failf(data, "unknown proxytype option given"); + result = CURLE_COULDNT_CONNECT; + break; + } +#if !defined(CURL_DISABLE_HTTP) && !defined(CURL_DISABLE_PROXY) + if(conn->bits.tunnel_proxy && conn->bits.httpproxy) { + /* FIX: this MUST wait for a proper connect first if 'connected' is + * FALSE */ + + /* BLOCKING */ + /* We want "seamless" FTP operations through HTTP proxy tunnel */ + + /* Curl_proxyCONNECT is based on a pointer to a struct HTTP at the member + * conn->proto.http; we want FTP through HTTP and we have to change the + * member temporarily for connecting to the HTTP proxy. After + * Curl_proxyCONNECT we have to set back the member to the original struct + * FTP pointer + */ + struct HTTP http_proxy; + struct FTP *ftp_save = data->state.proto.ftp; + memset(&http_proxy, 0, sizeof(http_proxy)); + data->state.proto.http = &http_proxy; + + result = Curl_proxyCONNECT(conn, SECONDARYSOCKET, newhost, newport); + + data->state.proto.ftp = ftp_save; + + if(CURLE_OK != result) + return result; + } +#endif /* !CURL_DISABLE_HTTP && !CURL_DISABLE_PROXY */ + + state(conn, FTP_STOP); /* this phase is completed */ + + return result; +} + +static CURLcode ftp_state_port_resp(struct connectdata *conn, + int ftpcode) +{ + struct SessionHandle *data = conn->data; + struct ftp_conn *ftpc = &conn->proto.ftpc; + ftpport fcmd = (ftpport)ftpc->count1; + CURLcode result = CURLE_OK; + + if(ftpcode != 200) { + /* the command failed */ + + if(EPRT == fcmd) { + infof(data, "disabling EPRT usage\n"); + conn->bits.ftp_use_eprt = FALSE; + } + fcmd++; + + if(fcmd == DONE) { + failf(data, "Failed to do PORT"); + result = CURLE_FTP_PORT_FAILED; + } + else + /* try next */ + result = ftp_state_use_port(conn, fcmd); + } + else { + infof(data, "Connect data stream actively\n"); + state(conn, FTP_STOP); /* end of DO phase */ + } + + return result; +} + +static CURLcode ftp_state_mdtm_resp(struct connectdata *conn, + int ftpcode) +{ + CURLcode result = CURLE_OK; + struct SessionHandle *data=conn->data; + struct FTP *ftp = data->state.proto.ftp; + struct ftp_conn *ftpc = &conn->proto.ftpc; + + switch(ftpcode) { + case 213: + { + /* we got a time. Format should be: "YYYYMMDDHHMMSS[.sss]" where the + last .sss part is optional and means fractions of a second */ + int year, month, day, hour, minute, second; + char *buf = data->state.buffer; + if(6 == sscanf(buf+4, "%04d%02d%02d%02d%02d%02d", + &year, &month, &day, &hour, &minute, &second)) { + /* we have a time, reformat it */ + time_t secs=time(NULL); + /* using the good old yacc/bison yuck */ + snprintf(buf, sizeof(conn->data->state.buffer), + "%04d%02d%02d %02d:%02d:%02d GMT", + year, month, day, hour, minute, second); + /* now, convert this into a time() value: */ + data->info.filetime = (long)curl_getdate(buf, &secs); + } + +#ifdef CURL_FTP_HTTPSTYLE_HEAD + /* If we asked for a time of the file and we actually got one as well, + we "emulate" a HTTP-style header in our output. */ + + if(data->set.opt_no_body && + ftpc->file && + data->set.get_filetime && + (data->info.filetime>=0) ) { + struct tm *tm; + time_t filetime = (time_t)data->info.filetime; +#ifdef HAVE_GMTIME_R + struct tm buffer; + tm = (struct tm *)gmtime_r(&filetime, &buffer); +#else + tm = gmtime(&filetime); +#endif + /* format: "Tue, 15 Nov 1994 12:45:26" */ + snprintf(buf, BUFSIZE-1, + "Last-Modified: %s, %02d %s %4d %02d:%02d:%02d GMT\r\n", + Curl_wkday[tm->tm_wday?tm->tm_wday-1:6], + tm->tm_mday, + Curl_month[tm->tm_mon], + tm->tm_year + 1900, + tm->tm_hour, + tm->tm_min, + tm->tm_sec); + result = Curl_client_write(conn, CLIENTWRITE_BOTH, buf, 0); + if(result) + return result; + } /* end of a ridiculous amount of conditionals */ +#endif + } + break; + default: + infof(data, "unsupported MDTM reply format\n"); + break; + case 550: /* "No such file or directory" */ + failf(data, "Given file does not exist"); + result = CURLE_FTP_COULDNT_RETR_FILE; + break; + } + + if(data->set.timecondition) { + if((data->info.filetime > 0) && (data->set.timevalue > 0)) { + switch(data->set.timecondition) { + case CURL_TIMECOND_IFMODSINCE: + default: + if(data->info.filetime <= data->set.timevalue) { + infof(data, "The requested document is not new enough\n"); + ftp->transfer = FTPTRANSFER_NONE; /* mark to not transfer data */ + data->info.timecond = TRUE; + state(conn, FTP_STOP); + return CURLE_OK; + } + break; + case CURL_TIMECOND_IFUNMODSINCE: + if(data->info.filetime > data->set.timevalue) { + infof(data, "The requested document is not old enough\n"); + ftp->transfer = FTPTRANSFER_NONE; /* mark to not transfer data */ + data->info.timecond = TRUE; + state(conn, FTP_STOP); + return CURLE_OK; + } + break; + } /* switch */ + } + else { + infof(data, "Skipping time comparison\n"); + } + } + + if(!result) + result = ftp_state_post_mdtm(conn); + + return result; +} + +static CURLcode ftp_state_type_resp(struct connectdata *conn, + int ftpcode, + ftpstate instate) +{ + CURLcode result = CURLE_OK; + struct SessionHandle *data=conn->data; + + if(ftpcode/100 != 2) { + /* "sasserftpd" and "(u)r(x)bot ftpd" both responds with 226 after a + successful 'TYPE I'. While that is not as RFC959 says, it is still a + positive response code and we allow that. */ + failf(data, "Couldn't set desired mode"); + return CURLE_FTP_COULDNT_SET_TYPE; + } + if(ftpcode != 200) + infof(data, "Got a %03d response code instead of the assumed 200\n", + ftpcode); + + if(instate == FTP_TYPE) + result = ftp_state_post_type(conn); + else if(instate == FTP_LIST_TYPE) + result = ftp_state_post_listtype(conn); + else if(instate == FTP_RETR_TYPE) + result = ftp_state_post_retrtype(conn); + else if(instate == FTP_STOR_TYPE) + result = ftp_state_post_stortype(conn); + + return result; +} + +static CURLcode ftp_state_post_retr_size(struct connectdata *conn, + curl_off_t filesize) +{ + CURLcode result = CURLE_OK; + struct SessionHandle *data=conn->data; + struct FTP *ftp = data->state.proto.ftp; + struct ftp_conn *ftpc = &conn->proto.ftpc; + + if(data->set.max_filesize && (filesize > data->set.max_filesize)) { + failf(data, "Maximum file size exceeded"); + return CURLE_FILESIZE_EXCEEDED; + } + ftp->downloadsize = filesize; + + if(data->state.resume_from) { + /* We always (attempt to) get the size of downloads, so it is done before + this even when not doing resumes. */ + if(filesize == -1) { + infof(data, "ftp server doesn't support SIZE\n"); + /* We couldn't get the size and therefore we can't know if there really + is a part of the file left to get, although the server will just + close the connection when we start the connection so it won't cause + us any harm, just not make us exit as nicely. */ + } + else { + /* We got a file size report, so we check that there actually is a + part of the file left to get, or else we go home. */ + if(data->state.resume_from< 0) { + /* We're supposed to download the last abs(from) bytes */ + if(filesize < -data->state.resume_from) { + failf(data, "Offset (%" FORMAT_OFF_T + ") was beyond file size (%" FORMAT_OFF_T ")", + data->state.resume_from, filesize); + return CURLE_BAD_DOWNLOAD_RESUME; + } + /* convert to size to download */ + ftp->downloadsize = -data->state.resume_from; + /* download from where? */ + data->state.resume_from = filesize - ftp->downloadsize; + } + else { + if(filesize < data->state.resume_from) { + failf(data, "Offset (%" FORMAT_OFF_T + ") was beyond file size (%" FORMAT_OFF_T ")", + data->state.resume_from, filesize); + return CURLE_BAD_DOWNLOAD_RESUME; + } + /* Now store the number of bytes we are expected to download */ + ftp->downloadsize = filesize-data->state.resume_from; + } + } + + if(ftp->downloadsize == 0) { + /* no data to transfer */ + Curl_setup_transfer(conn, -1, -1, FALSE, NULL, -1, NULL); + infof(data, "File already completely downloaded\n"); + + /* Set ->transfer so that we won't get any error in ftp_done() + * because we didn't transfer the any file */ + ftp->transfer = FTPTRANSFER_NONE; + state(conn, FTP_STOP); + return CURLE_OK; + } + + /* Set resume file transfer offset */ + infof(data, "Instructs server to resume from offset %" FORMAT_OFF_T + "\n", data->state.resume_from); + + PPSENDF(&ftpc->pp, "REST %" FORMAT_OFF_T, data->state.resume_from); + + state(conn, FTP_RETR_REST); + + } + else { + /* no resume */ + PPSENDF(&ftpc->pp, "RETR %s", ftpc->file); + state(conn, FTP_RETR); + } + + return result; +} + +static CURLcode ftp_state_size_resp(struct connectdata *conn, + int ftpcode, + ftpstate instate) +{ + CURLcode result = CURLE_OK; + struct SessionHandle *data=conn->data; + curl_off_t filesize; + char *buf = data->state.buffer; + + /* get the size from the ascii string: */ + filesize = (ftpcode == 213)?curlx_strtoofft(buf+4, NULL, 0):-1; + + if(instate == FTP_SIZE) { +#ifdef CURL_FTP_HTTPSTYLE_HEAD + if(-1 != filesize) { + snprintf(buf, sizeof(data->state.buffer), + "Content-Length: %" FORMAT_OFF_T "\r\n", filesize); + result = Curl_client_write(conn, CLIENTWRITE_BOTH, buf, 0); + if(result) + return result; + } +#endif + Curl_pgrsSetDownloadSize(data, filesize); + result = ftp_state_post_size(conn); + } + else if(instate == FTP_RETR_SIZE) { + Curl_pgrsSetDownloadSize(data, filesize); + result = ftp_state_post_retr_size(conn, filesize); + } + else if(instate == FTP_STOR_SIZE) { + data->state.resume_from = filesize; + result = ftp_state_ul_setup(conn, TRUE); + } + + return result; +} + +static CURLcode ftp_state_rest_resp(struct connectdata *conn, + int ftpcode, + ftpstate instate) +{ + CURLcode result = CURLE_OK; + struct ftp_conn *ftpc = &conn->proto.ftpc; + + switch(instate) { + case FTP_REST: + default: +#ifdef CURL_FTP_HTTPSTYLE_HEAD + if(ftpcode == 350) { + char buffer[24]= { "Accept-ranges: bytes\r\n" }; + result = Curl_client_write(conn, CLIENTWRITE_BOTH, buffer, 0); + if(result) + return result; + } +#endif + result = ftp_state_post_rest(conn); + break; + + case FTP_RETR_REST: + if(ftpcode != 350) { + failf(conn->data, "Couldn't use REST"); + result = CURLE_FTP_COULDNT_USE_REST; + } + else { + PPSENDF(&ftpc->pp, "RETR %s", ftpc->file); + state(conn, FTP_RETR); + } + break; + } + + return result; +} + +static CURLcode ftp_state_stor_resp(struct connectdata *conn, + int ftpcode) +{ + CURLcode result = CURLE_OK; + struct SessionHandle *data = conn->data; + struct FTP *ftp = data->state.proto.ftp; + + if(ftpcode>=400) { + failf(data, "Failed FTP upload: %0d", ftpcode); + /* oops, we never close the sockets! */ + return CURLE_UPLOAD_FAILED; + } + + if(data->set.ftp_use_port) { + /* BLOCKING */ + /* PORT means we are now awaiting the server to connect to us. */ + result = AllowServerConnect(conn); + if( result ) + return result; + } + + if(conn->ssl[SECONDARYSOCKET].use) { + /* since we only have a plaintext TCP connection here, we must now + do the TLS stuff */ + infof(data, "Doing the SSL/TLS handshake on the data stream\n"); + /* BLOCKING */ + result = Curl_ssl_connect(conn, SECONDARYSOCKET); + if(result) + return result; + } + + *(ftp->bytecountp)=0; + + /* When we know we're uploading a specified file, we can get the file + size prior to the actual upload. */ + + Curl_pgrsSetUploadSize(data, data->set.infilesize); + + /* set the SO_SNDBUF for the secondary socket for those who need it */ + Curl_sndbufset(conn->sock[SECONDARYSOCKET]); + + Curl_setup_transfer(conn, -1, -1, FALSE, NULL, /* no download */ + SECONDARYSOCKET, ftp->bytecountp); + state(conn, FTP_STOP); + + conn->proto.ftpc.pp.pending_resp = TRUE; /* expect a server response */ + + return result; +} + +/* for LIST and RETR responses */ +static CURLcode ftp_state_get_resp(struct connectdata *conn, + int ftpcode, + ftpstate instate) +{ + CURLcode result = CURLE_OK; + struct SessionHandle *data = conn->data; + struct FTP *ftp = data->state.proto.ftp; + char *buf = data->state.buffer; + + if((ftpcode == 150) || (ftpcode == 125)) { + + /* + A; + 150 Opening BINARY mode data connection for /etc/passwd (2241 + bytes). (ok, the file is being transfered) + + B: + 150 Opening ASCII mode data connection for /bin/ls + + C: + 150 ASCII data connection for /bin/ls (137.167.104.91,37445) (0 bytes). + + D: + 150 Opening ASCII mode data connection for /linux/fisk/kpanelrc (0.0.0.0,0) (545 bytes). + + E: + 125 Data connection already open; Transfer starting. */ + + curl_off_t size=-1; /* default unknown size */ + + + /* + * It appears that there are FTP-servers that return size 0 for files when + * SIZE is used on the file while being in BINARY mode. To work around + * that (stupid) behavior, we attempt to parse the RETR response even if + * the SIZE returned size zero. + * + * Debugging help from Salvatore Sorrentino on February 26, 2003. + */ + + if((instate != FTP_LIST) && + !data->set.prefer_ascii && + (ftp->downloadsize < 1)) { + /* + * It seems directory listings either don't show the size or very + * often uses size 0 anyway. ASCII transfers may very well turn out + * that the transfered amount of data is not the same as this line + * tells, why using this number in those cases only confuses us. + * + * Example D above makes this parsing a little tricky */ + char *bytes; + bytes=strstr(buf, " bytes"); + if(bytes--) { + long in=(long)(bytes-buf); + /* this is a hint there is size information in there! ;-) */ + while(--in) { + /* scan for the left parenthesis and break there */ + if('(' == *bytes) + break; + /* skip only digits */ + if(!ISDIGIT(*bytes)) { + bytes=NULL; + break; + } + /* one more estep backwards */ + bytes--; + } + /* if we have nothing but digits: */ + if(bytes++) { + /* get the number! */ + size = curlx_strtoofft(bytes, NULL, 0); + } + } + } + else if(ftp->downloadsize > -1) + size = ftp->downloadsize; + + if(data->set.ftp_use_port) { + /* BLOCKING */ + result = AllowServerConnect(conn); + if( result ) + return result; + } + + if(conn->ssl[SECONDARYSOCKET].use) { + /* since we only have a plaintext TCP connection here, we must now + do the TLS stuff */ + infof(data, "Doing the SSL/TLS handshake on the data stream\n"); + result = Curl_ssl_connect(conn, SECONDARYSOCKET); + if(result) + return result; + } + + if(size > data->req.maxdownload && data->req.maxdownload > 0) + size = data->req.size = data->req.maxdownload; + else if((instate != FTP_LIST) && (data->set.prefer_ascii)) + size = -1; /* kludge for servers that understate ASCII mode file size */ + + infof(data, "Maxdownload = %" FORMAT_OFF_T "\n", data->req.maxdownload); + + if(instate != FTP_LIST) + infof(data, "Getting file with size: %" FORMAT_OFF_T "\n", size); + + /* FTP download: */ + Curl_setup_transfer(conn, SECONDARYSOCKET, size, FALSE, + ftp->bytecountp, -1, NULL); /* no upload here */ + + conn->proto.ftpc.pp.pending_resp = TRUE; /* expect server response */ + state(conn, FTP_STOP); + } + else { + if((instate == FTP_LIST) && (ftpcode == 450)) { + /* simply no matching files in the dir listing */ + ftp->transfer = FTPTRANSFER_NONE; /* don't download anything */ + state(conn, FTP_STOP); /* this phase is over */ + } + else { + failf(data, "RETR response: %03d", ftpcode); + return instate == FTP_RETR && ftpcode == 550? + CURLE_REMOTE_FILE_NOT_FOUND: + CURLE_FTP_COULDNT_RETR_FILE; + } + } + + return result; +} + +/* after USER, PASS and ACCT */ +static CURLcode ftp_state_loggedin(struct connectdata *conn) +{ + CURLcode result = CURLE_OK; + +#ifdef HAVE_KRB4 + if(conn->data->set.krb) { + /* We may need to issue a KAUTH here to have access to the files + * do it if user supplied a password + */ + if(conn->passwd && *conn->passwd) { + /* BLOCKING */ + result = Curl_krb_kauth(conn); + if(result) + return result; + } + } +#endif + if(conn->ssl[FIRSTSOCKET].use) { + /* PBSZ = PROTECTION BUFFER SIZE. + + The 'draft-murray-auth-ftp-ssl' (draft 12, page 7) says: + + Specifically, the PROT command MUST be preceded by a PBSZ + command and a PBSZ command MUST be preceded by a successful + security data exchange (the TLS negotiation in this case) + + ... (and on page 8): + + Thus the PBSZ command must still be issued, but must have a + parameter of '0' to indicate that no buffering is taking place + and the data connection should not be encapsulated. + */ + PPSENDF(&conn->proto.ftpc.pp, "PBSZ %d", 0); + state(conn, FTP_PBSZ); + } + else { + result = ftp_state_pwd(conn); + } + return result; +} + +/* for USER and PASS responses */ +static CURLcode ftp_state_user_resp(struct connectdata *conn, + int ftpcode, + ftpstate instate) +{ + CURLcode result = CURLE_OK; + struct SessionHandle *data = conn->data; + struct FTP *ftp = data->state.proto.ftp; + struct ftp_conn *ftpc = &conn->proto.ftpc; + (void)instate; /* no use for this yet */ + + /* some need password anyway, and others just return 2xx ignored */ + if((ftpcode == 331) && (ftpc->state == FTP_USER)) { + /* 331 Password required for ... + (the server requires to send the user's password too) */ + PPSENDF(&ftpc->pp, "PASS %s", ftp->passwd?ftp->passwd:""); + state(conn, FTP_PASS); + } + else if(ftpcode/100 == 2) { + /* 230 User ... logged in. + (the user logged in with or without password) */ + result = ftp_state_loggedin(conn); + } + else if(ftpcode == 332) { + if(data->set.str[STRING_FTP_ACCOUNT]) { + PPSENDF(&ftpc->pp, "ACCT %s", data->set.str[STRING_FTP_ACCOUNT]); + state(conn, FTP_ACCT); + } + else { + failf(data, "ACCT requested but none available"); + result = CURLE_LOGIN_DENIED; + } + } + else { + /* All other response codes, like: + + 530 User ... access denied + (the server denies to log the specified user) */ + + if(conn->data->set.str[STRING_FTP_ALTERNATIVE_TO_USER] && + !conn->data->state.ftp_trying_alternative) { + /* Ok, USER failed. Let's try the supplied command. */ + PPSENDF(&conn->proto.ftpc.pp, "%s", + conn->data->set.str[STRING_FTP_ALTERNATIVE_TO_USER]); + conn->data->state.ftp_trying_alternative = TRUE; + state(conn, FTP_USER); + result = CURLE_OK; + } + else { + failf(data, "Access denied: %03d", ftpcode); + result = CURLE_LOGIN_DENIED; + } + } + return result; +} + +/* for ACCT response */ +static CURLcode ftp_state_acct_resp(struct connectdata *conn, + int ftpcode) +{ + CURLcode result = CURLE_OK; + struct SessionHandle *data = conn->data; + if(ftpcode != 230) { + failf(data, "ACCT rejected by server: %03d", ftpcode); + result = CURLE_FTP_WEIRD_PASS_REPLY; /* FIX */ + } + else + result = ftp_state_loggedin(conn); + + return result; +} + + +static CURLcode ftp_statemach_act(struct connectdata *conn) +{ + CURLcode result; + curl_socket_t sock = conn->sock[FIRSTSOCKET]; + struct SessionHandle *data=conn->data; + int ftpcode; + struct ftp_conn *ftpc = &conn->proto.ftpc; + struct pingpong *pp = &ftpc->pp; + static const char ftpauth[][4] = { "SSL", "TLS" }; + size_t nread = 0; + + if(pp->sendleft) + return Curl_pp_flushsend(pp); + + /* we read a piece of response */ + result = ftp_readresp(sock, pp, &ftpcode, &nread); + if(result) + return result; + + if(ftpcode) { + /* we have now received a full FTP server response */ + switch(ftpc->state) { + case FTP_WAIT220: + if(ftpcode != 220) { + failf(data, "Got a %03d ftp-server response when 220 was expected", + ftpcode); + return CURLE_FTP_WEIRD_SERVER_REPLY; + } + + /* We have received a 220 response fine, now we proceed. */ +#if defined(HAVE_KRB4) || defined(HAVE_GSSAPI) + if(data->set.krb) { + /* If not anonymous login, try a secure login. Note that this + procedure is still BLOCKING. */ + + Curl_sec_request_prot(conn, "private"); + /* We set private first as default, in case the line below fails to + set a valid level */ + Curl_sec_request_prot(conn, data->set.str[STRING_KRB_LEVEL]); + + if(Curl_sec_login(conn) != CURLE_OK) + infof(data, "Logging in with password in cleartext!\n"); + else + infof(data, "Authentication successful\n"); + } +#endif + + if(data->set.ftp_ssl && !conn->ssl[FIRSTSOCKET].use) { + /* We don't have a SSL/TLS connection yet, but FTPS is + requested. Try a FTPS connection now */ + + ftpc->count3=0; + switch(data->set.ftpsslauth) { + case CURLFTPAUTH_DEFAULT: + case CURLFTPAUTH_SSL: + ftpc->count2 = 1; /* add one to get next */ + ftpc->count1 = 0; + break; + case CURLFTPAUTH_TLS: + ftpc->count2 = -1; /* subtract one to get next */ + ftpc->count1 = 1; + break; + default: + failf(data, "unsupported parameter to CURLOPT_FTPSSLAUTH: %d", + (int)data->set.ftpsslauth); + return CURLE_FAILED_INIT; /* we don't know what to do */ + } + PPSENDF(&ftpc->pp, "AUTH %s", ftpauth[ftpc->count1]); + state(conn, FTP_AUTH); + } + else { + result = ftp_state_user(conn); + if(result) + return result; + } + + break; + + case FTP_AUTH: + /* we have gotten the response to a previous AUTH command */ + + /* RFC2228 (page 5) says: + * + * If the server is willing to accept the named security mechanism, + * and does not require any security data, it must respond with + * reply code 234/334. + */ + + if((ftpcode == 234) || (ftpcode == 334)) { + /* Curl_ssl_connect is BLOCKING */ + result = Curl_ssl_connect(conn, FIRSTSOCKET); + if(CURLE_OK == result) { + conn->protocol |= PROT_FTPS; + conn->ssl[SECONDARYSOCKET].use = FALSE; /* clear-text data */ + result = ftp_state_user(conn); + } + } + else if(ftpc->count3 < 1) { + ftpc->count3++; + ftpc->count1 += ftpc->count2; /* get next attempt */ + result = Curl_pp_sendf(&ftpc->pp, "AUTH %s", ftpauth[ftpc->count1]); + /* remain in this same state */ + } + else { + if(data->set.ftp_ssl > CURLUSESSL_TRY) + /* we failed and CURLUSESSL_CONTROL or CURLUSESSL_ALL is set */ + result = CURLE_USE_SSL_FAILED; + else + /* ignore the failure and continue */ + result = ftp_state_user(conn); + } + + if(result) + return result; + break; + + case FTP_USER: + case FTP_PASS: + result = ftp_state_user_resp(conn, ftpcode, ftpc->state); + break; + + case FTP_ACCT: + result = ftp_state_acct_resp(conn, ftpcode); + break; + + case FTP_PBSZ: + PPSENDF(&ftpc->pp, "PROT %c", + data->set.ftp_ssl == CURLUSESSL_CONTROL ? 'C' : 'P'); + state(conn, FTP_PROT); + + break; + + case FTP_PROT: + if(ftpcode/100 == 2) + /* We have enabled SSL for the data connection! */ + conn->ssl[SECONDARYSOCKET].use = + (bool)(data->set.ftp_ssl != CURLUSESSL_CONTROL); + /* FTP servers typically responds with 500 if they decide to reject + our 'P' request */ + else if(data->set.ftp_ssl > CURLUSESSL_CONTROL) + /* we failed and bails out */ + return CURLE_USE_SSL_FAILED; + + if(data->set.ftp_ccc) { + /* CCC - Clear Command Channel + */ + PPSENDF(&ftpc->pp, "CCC", NULL); + state(conn, FTP_CCC); + } + else { + result = ftp_state_pwd(conn); + if(result) + return result; + } + break; + + case FTP_CCC: + if(ftpcode < 500) { + /* First shut down the SSL layer (note: this call will block) */ + result = Curl_ssl_shutdown(conn, FIRSTSOCKET); + + if(result) { + failf(conn->data, "Failed to clear the command channel (CCC)"); + return result; + } + } + + /* Then continue as normal */ + result = ftp_state_pwd(conn); + if(result) + return result; + break; + + case FTP_PWD: + if(ftpcode == 257) { + char *ptr=&data->state.buffer[4]; /* start on the first letter */ + char *dir; + char *store; + + dir = malloc(nread + 1); + if(!dir) + return CURLE_OUT_OF_MEMORY; + + /* Reply format is like + 257"" and the RFC959 + says + + The directory name can contain any character; embedded + double-quotes should be escaped by double-quotes (the + "quote-doubling" convention). + */ + if('\"' == *ptr) { + /* it started good */ + ptr++; + for (store = dir; *ptr;) { + if('\"' == *ptr) { + if('\"' == ptr[1]) { + /* "quote-doubling" */ + *store = ptr[1]; + ptr++; + } + else { + /* end of path */ + *store = '\0'; /* zero terminate */ + break; /* get out of this loop */ + } + } + else + *store = *ptr; + store++; + ptr++; + } + if(ftpc->entrypath) + free(ftpc->entrypath); + ftpc->entrypath =dir; /* remember this */ + infof(data, "Entry path is '%s'\n", ftpc->entrypath); + /* also save it where getinfo can access it: */ + data->state.most_recent_ftp_entrypath = ftpc->entrypath; + + /* If the path name does not look like an absolute path (i.e.: it + does not start with a '/'), we probably need some server-dependent + adjustments. For example, this is the case when connecting to + an OS400 FTP server: this server supports two name syntaxes, + the default one being incompatible with standard pathes. In + addition, this server switches automatically to the regular path + syntax when one is encountered in a command: this results in + having an entrypath in the wrong syntax when later used in CWD. + The method used here is to check the server OS: we do it only + if the path name looks strange to minimize overhead on other + systems. */ + + if(!ftpc->server_os && ftpc->entrypath[0] != '/') { + PPSENDF(&ftpc->pp, "SYST", NULL); + state(conn, FTP_SYST); + break; + } + } + else { + /* couldn't get the path */ + free(dir); + infof(data, "Failed to figure out path\n"); + } + } + state(conn, FTP_STOP); /* we are done with the CONNECT phase! */ + DEBUGF(infof(data, "protocol connect phase DONE\n")); + break; + + case FTP_SYST: + if(ftpcode == 215) { + char *ptr=&data->state.buffer[4]; /* start on the first letter */ + char *os; + char *store; + + os = malloc(nread + 1); + if(!os) + return CURLE_OUT_OF_MEMORY; + + /* Reply format is like + 215 + */ + while (*ptr == ' ') + ptr++; + for (store = os; *ptr && *ptr != ' ';) + *store++ = *ptr++; + *store = '\0'; /* zero terminate */ + ftpc->server_os = os; + + /* Check for special servers here. */ + + if(strequal(ftpc->server_os, "OS/400")) { + /* Force OS400 name format 1. */ + PPSENDF(&ftpc->pp, "SITE NAMEFMT 1", NULL); + state(conn, FTP_NAMEFMT); + break; + } + else { + /* Nothing special for the target server. */ + } + } + else { + /* Cannot identify server OS. Continue anyway and cross fingers. */ + } + + state(conn, FTP_STOP); /* we are done with the CONNECT phase! */ + DEBUGF(infof(data, "protocol connect phase DONE\n")); + break; + + case FTP_NAMEFMT: + if(ftpcode == 250) { + /* Name format change successful: reload initial path. */ + ftp_state_pwd(conn); + break; + } + + state(conn, FTP_STOP); /* we are done with the CONNECT phase! */ + DEBUGF(infof(data, "protocol connect phase DONE\n")); + break; + + case FTP_QUOTE: + case FTP_POSTQUOTE: + case FTP_RETR_PREQUOTE: + case FTP_STOR_PREQUOTE: + if((ftpcode >= 400) && !ftpc->count2) { + /* failure reponse code, and not allowed to fail */ + failf(conn->data, "QUOT command failed with %03d", ftpcode); + return CURLE_QUOTE_ERROR; + } + result = ftp_state_quote(conn, FALSE, ftpc->state); + if(result) + return result; + + break; + + case FTP_CWD: + if(ftpcode/100 != 2) { + /* failure to CWD there */ + if(conn->data->set.ftp_create_missing_dirs && + ftpc->count1 && !ftpc->count2) { + /* try making it */ + ftpc->count2++; /* counter to prevent CWD-MKD loops */ + PPSENDF(&ftpc->pp, "MKD %s", ftpc->dirs[ftpc->count1 - 1]); + state(conn, FTP_MKD); + } + else { + /* return failure */ + failf(data, "Server denied you to change to the given directory"); + ftpc->cwdfail = TRUE; /* don't remember this path as we failed + to enter it */ + return CURLE_REMOTE_ACCESS_DENIED; + } + } + else { + /* success */ + ftpc->count2=0; + if(++ftpc->count1 <= ftpc->dirdepth) { + /* send next CWD */ + PPSENDF(&ftpc->pp, "CWD %s", ftpc->dirs[ftpc->count1 - 1]); + } + else { + result = ftp_state_post_cwd(conn); + if(result) + return result; + } + } + break; + + case FTP_MKD: + if((ftpcode/100 != 2) && !ftpc->count3--) { + /* failure to MKD the dir */ + failf(data, "Failed to MKD dir: %03d", ftpcode); + return CURLE_REMOTE_ACCESS_DENIED; + } + state(conn, FTP_CWD); + /* send CWD */ + PPSENDF(&ftpc->pp, "CWD %s", ftpc->dirs[ftpc->count1 - 1]); + break; + + case FTP_MDTM: + result = ftp_state_mdtm_resp(conn, ftpcode); + break; + + case FTP_TYPE: + case FTP_LIST_TYPE: + case FTP_RETR_TYPE: + case FTP_STOR_TYPE: + result = ftp_state_type_resp(conn, ftpcode, ftpc->state); + break; + + case FTP_SIZE: + case FTP_RETR_SIZE: + case FTP_STOR_SIZE: + result = ftp_state_size_resp(conn, ftpcode, ftpc->state); + break; + + case FTP_REST: + case FTP_RETR_REST: + result = ftp_state_rest_resp(conn, ftpcode, ftpc->state); + break; + + case FTP_PRET: + if(ftpcode != 200) { + /* there only is this one standard OK return code. */ + failf(data, "PRET command not accepted: %03d", ftpcode); + return CURLE_FTP_PRET_FAILED; + } + result = ftp_state_use_pasv(conn); + break; + + case FTP_PASV: + result = ftp_state_pasv_resp(conn, ftpcode); + break; + + case FTP_PORT: + result = ftp_state_port_resp(conn, ftpcode); + break; + + case FTP_LIST: + case FTP_RETR: + result = ftp_state_get_resp(conn, ftpcode, ftpc->state); + break; + + case FTP_STOR: + result = ftp_state_stor_resp(conn, ftpcode); + break; + + case FTP_QUIT: + /* fallthrough, just stop! */ + default: + /* internal error */ + state(conn, FTP_STOP); + break; + } + } /* if(ftpcode) */ + + return result; +} + + +/* called repeatedly until done from multi.c */ +static CURLcode ftp_multi_statemach(struct connectdata *conn, + bool *done) +{ + struct ftp_conn *ftpc = &conn->proto.ftpc; + CURLcode result = Curl_pp_multi_statemach(&ftpc->pp); + + /* Check for the state outside of the Curl_socket_ready() return code checks + since at times we are in fact already in this state when this function + gets called. */ + *done = (bool)(ftpc->state == FTP_STOP); + + return result; +} + +static CURLcode ftp_easy_statemach(struct connectdata *conn) +{ + struct ftp_conn *ftpc = &conn->proto.ftpc; + struct pingpong *pp = &ftpc->pp; + CURLcode result = CURLE_OK; + + while(ftpc->state != FTP_STOP) { + result = Curl_pp_easy_statemach(pp); + if(result) + break; + } + + return result; +} + +/* + * Allocate and initialize the struct FTP for the current SessionHandle. If + * need be. + */ + +#if defined(__INTEL_COMPILER) && (__INTEL_COMPILER == 910) && \ + defined(__OPTIMIZE__) && defined(__unix__) && defined(__i386__) + /* workaround icc 9.1 optimizer issue */ +#pragma optimize("", off) +#endif + +static CURLcode ftp_init(struct connectdata *conn) +{ + struct FTP *ftp; + + if(NULL == conn->data->state.proto.ftp) { + conn->data->state.proto.ftp = malloc(sizeof(struct FTP)); + if(NULL == conn->data->state.proto.ftp) + return CURLE_OUT_OF_MEMORY; + } + + ftp = conn->data->state.proto.ftp; + + /* get some initial data into the ftp struct */ + ftp->bytecountp = &conn->data->req.bytecount; + ftp->transfer = FTPTRANSFER_BODY; + ftp->downloadsize = 0; + + /* No need to duplicate user+password, the connectdata struct won't change + during a session, but we re-init them here since on subsequent inits + since the conn struct may have changed or been replaced. + */ + ftp->user = conn->user; + ftp->passwd = conn->passwd; + if(TRUE == isBadFtpString(ftp->user)) + return CURLE_URL_MALFORMAT; + if(TRUE == isBadFtpString(ftp->passwd)) + return CURLE_URL_MALFORMAT; + + conn->proto.ftpc.known_filesize = -1; /* unknown size for now */ + + return CURLE_OK; +} + +#if defined(__INTEL_COMPILER) && (__INTEL_COMPILER == 910) && \ + defined(__OPTIMIZE__) && defined(__unix__) && defined(__i386__) + /* workaround icc 9.1 optimizer issue */ +#pragma optimize("", on) +#endif + +/* + * ftp_connect() should do everything that is to be considered a part of + * the connection phase. + * + * The variable 'done' points to will be TRUE if the protocol-layer connect + * phase is done when this function returns, or FALSE is not. When called as + * a part of the easy interface, it will always be TRUE. + */ +static CURLcode ftp_connect(struct connectdata *conn, + bool *done) /* see description above */ +{ + CURLcode result; + struct ftp_conn *ftpc = &conn->proto.ftpc; + struct SessionHandle *data=conn->data; + struct pingpong *pp = &ftpc->pp; + + *done = FALSE; /* default to not done yet */ + + /* If there already is a protocol-specific struct allocated for this + sessionhandle, deal with it */ + Curl_reset_reqproto(conn); + + result = ftp_init(conn); + if(CURLE_OK != result) + return result; + + /* We always support persistant connections on ftp */ + conn->bits.close = FALSE; + + pp->response_time = RESP_TIMEOUT; /* set default response time-out */ + pp->statemach_act = ftp_statemach_act; + pp->endofresp = ftp_endofresp; + pp->conn = conn; + +#if !defined(CURL_DISABLE_HTTP) && !defined(CURL_DISABLE_PROXY) + if(conn->bits.tunnel_proxy && conn->bits.httpproxy) { + /* for FTP over HTTP proxy */ + struct HTTP http_proxy; + struct FTP *ftp_save; + + /* BLOCKING */ + /* We want "seamless" FTP operations through HTTP proxy tunnel */ + + /* Curl_proxyCONNECT is based on a pointer to a struct HTTP at the member + * conn->proto.http; we want FTP through HTTP and we have to change the + * member temporarily for connecting to the HTTP proxy. After + * Curl_proxyCONNECT we have to set back the member to the original struct + * FTP pointer + */ + ftp_save = data->state.proto.ftp; + memset(&http_proxy, 0, sizeof(http_proxy)); + data->state.proto.http = &http_proxy; + + result = Curl_proxyCONNECT(conn, FIRSTSOCKET, + conn->host.name, conn->remote_port); + + data->state.proto.ftp = ftp_save; + + if(CURLE_OK != result) + return result; + } +#endif /* !CURL_DISABLE_HTTP && !CURL_DISABLE_PROXY */ + + if(conn->protocol & PROT_FTPS) { + /* BLOCKING */ + /* FTPS is simply ftp with SSL for the control channel */ + /* now, perform the SSL initialization for this socket */ + result = Curl_ssl_connect(conn, FIRSTSOCKET); + if(result) + return result; + } + + Curl_pp_init(pp); /* init the generic pingpong data */ + + /* When we connect, we start in the state where we await the 220 + response */ + state(conn, FTP_WAIT220); + + if(data->state.used_interface == Curl_if_multi) + result = ftp_multi_statemach(conn, done); + else { + result = ftp_easy_statemach(conn); + if(!result) + *done = TRUE; + } + + return result; +} + +/*********************************************************************** + * + * ftp_done() + * + * The DONE function. This does what needs to be done after a single DO has + * performed. + * + * Input argument is already checked for validity. + */ +static CURLcode ftp_done(struct connectdata *conn, CURLcode status, + bool premature) +{ + struct SessionHandle *data = conn->data; + struct FTP *ftp = data->state.proto.ftp; + struct ftp_conn *ftpc = &conn->proto.ftpc; + struct pingpong *pp = &ftpc->pp; + ssize_t nread; + int ftpcode; + CURLcode result=CURLE_OK; + bool was_ctl_valid = ftpc->ctl_valid; + char *path; + const char *path_to_use = data->state.path; + + if(!ftp) + /* When the easy handle is removed from the multi while libcurl is still + * trying to resolve the host name, it seems that the ftp struct is not + * yet initialized, but the removal action calls Curl_done() which calls + * this function. So we simply return success if no ftp pointer is set. + */ + return CURLE_OK; + + switch(status) { + case CURLE_BAD_DOWNLOAD_RESUME: + case CURLE_FTP_WEIRD_PASV_REPLY: + case CURLE_FTP_PORT_FAILED: + case CURLE_FTP_COULDNT_SET_TYPE: + case CURLE_FTP_COULDNT_RETR_FILE: + case CURLE_UPLOAD_FAILED: + case CURLE_REMOTE_ACCESS_DENIED: + case CURLE_FILESIZE_EXCEEDED: + case CURLE_REMOTE_FILE_NOT_FOUND: + case CURLE_WRITE_ERROR: + /* the connection stays alive fine even though this happened */ + /* fall-through */ + case CURLE_OK: /* doesn't affect the control connection's status */ + if(!premature) { + ftpc->ctl_valid = was_ctl_valid; + break; + } + /* until we cope better with prematurely ended requests, let them + * fallback as if in complete failure */ + default: /* by default, an error means the control connection is + wedged and should not be used anymore */ + ftpc->ctl_valid = FALSE; + ftpc->cwdfail = TRUE; /* set this TRUE to prevent us to remember the + current path, as this connection is going */ + conn->bits.close = TRUE; /* marked for closure */ + result = status; /* use the already set error code */ + break; + } + + /* now store a copy of the directory we are in */ + if(ftpc->prevpath) + free(ftpc->prevpath); + + if(data->set.wildcardmatch) { + if(data->set.chunk_end && ftpc->file) { + data->set.chunk_end(data->wildcard.customptr); + } + ftpc->known_filesize = -1; + } + + /* get the "raw" path */ + path = curl_easy_unescape(data, path_to_use, 0, NULL); + if(!path) { + /* out of memory, but we can limp along anyway (and should try to + * since we're in the out of memory cleanup path) */ + ftpc->prevpath = NULL; /* no path */ + } + else { + size_t flen = ftpc->file?strlen(ftpc->file):0; /* file is "raw" already */ + size_t dlen = strlen(path)-flen; + if(!ftpc->cwdfail) { + if(dlen && (data->set.ftp_filemethod != FTPFILE_NOCWD)) { + ftpc->prevpath = path; + if(flen) + /* if 'path' is not the whole string */ + ftpc->prevpath[dlen]=0; /* terminate */ + } + else { + /* we never changed dir */ + ftpc->prevpath=strdup(""); + free(path); + } + if(ftpc->prevpath) + infof(data, "Remembering we are in dir \"%s\"\n", ftpc->prevpath); + } + else { + ftpc->prevpath = NULL; /* no path */ + free(path); + } + } + /* free the dir tree and file parts */ + freedirs(ftpc); + + /* shut down the socket to inform the server we're done */ + +#ifdef _WIN32_WCE + shutdown(conn->sock[SECONDARYSOCKET],2); /* SD_BOTH */ +#endif + + if(conn->sock[SECONDARYSOCKET] != CURL_SOCKET_BAD) { + if(!result && ftpc->dont_check && data->req.maxdownload > 0) + /* partial download completed */ + result = Curl_pp_sendf(pp, "ABOR"); + + if(conn->ssl[SECONDARYSOCKET].use) { + /* The secondary socket is using SSL so we must close down that part + first before we close the socket for real */ + Curl_ssl_close(conn, SECONDARYSOCKET); + + /* Note that we keep "use" set to TRUE since that (next) connection is + still requested to use SSL */ + } + if(CURL_SOCKET_BAD != conn->sock[SECONDARYSOCKET]) { + sclose(conn->sock[SECONDARYSOCKET]); + conn->sock[SECONDARYSOCKET] = CURL_SOCKET_BAD; + } + } + + if(!result && (ftp->transfer == FTPTRANSFER_BODY) && ftpc->ctl_valid && + pp->pending_resp && !premature) { + /* + * Let's see what the server says about the transfer we just performed, + * but lower the timeout as sometimes this connection has died while the + * data has been transfered. This happens when doing through NATs etc that + * abandon old silent connections. + */ + long old_time = pp->response_time; + + pp->response_time = 60*1000; /* give it only a minute for now */ + pp->response = Curl_tvnow(); /* timeout relative now */ + + result = Curl_GetFTPResponse(&nread, conn, &ftpcode); + + pp->response_time = old_time; /* set this back to previous value */ + + if(!nread && (CURLE_OPERATION_TIMEDOUT == result)) { + failf(data, "control connection looks dead"); + ftpc->ctl_valid = FALSE; /* mark control connection as bad */ + conn->bits.close = TRUE; /* mark for closure */ + } + + if(result) + return result; + + if(ftpc->dont_check && data->req.maxdownload > 0) { + /* we have just sent ABOR and there is no reliable way to check if it was + * successful or not; we have to close the connection now */ + infof(data, "partial download completed, closing connection\n"); + conn->bits.close = TRUE; /* mark for closure */ + return result; + } + + if(!ftpc->dont_check) { + /* 226 Transfer complete, 250 Requested file action okay, completed. */ + if((ftpcode != 226) && (ftpcode != 250)) { + failf(data, "server did not report OK, got %d", ftpcode); + result = CURLE_PARTIAL_FILE; + } + } + } + + if(result || premature) + /* the response code from the transfer showed an error already so no + use checking further */ + ; + else if(data->set.upload) { + if((-1 != data->set.infilesize) && + (data->set.infilesize != *ftp->bytecountp) && + !data->set.crlf && + (ftp->transfer == FTPTRANSFER_BODY)) { + failf(data, "Uploaded unaligned file size (%" FORMAT_OFF_T + " out of %" FORMAT_OFF_T " bytes)", + *ftp->bytecountp, data->set.infilesize); + result = CURLE_PARTIAL_FILE; + } + } + else { + if((-1 != data->req.size) && + (data->req.size != *ftp->bytecountp) && +#ifdef CURL_DO_LINEEND_CONV + /* Most FTP servers don't adjust their file SIZE response for CRLFs, so + * we'll check to see if the discrepancy can be explained by the number + * of CRLFs we've changed to LFs. + */ + ((data->req.size + data->state.crlf_conversions) != + *ftp->bytecountp) && +#endif /* CURL_DO_LINEEND_CONV */ + (data->req.maxdownload != *ftp->bytecountp)) { + failf(data, "Received only partial file: %" FORMAT_OFF_T " bytes", + *ftp->bytecountp); + result = CURLE_PARTIAL_FILE; + } + else if(!ftpc->dont_check && + !*ftp->bytecountp && + (data->req.size>0)) { + failf(data, "No data was received!"); + result = CURLE_FTP_COULDNT_RETR_FILE; + } + } + + /* clear these for next connection */ + ftp->transfer = FTPTRANSFER_BODY; + ftpc->dont_check = FALSE; + + /* Send any post-transfer QUOTE strings? */ + if(!status && !result && !premature && data->set.postquote) + result = ftp_sendquote(conn, data->set.postquote); + + return result; +} + +/*********************************************************************** + * + * ftp_sendquote() + * + * Where a 'quote' means a list of custom commands to send to the server. + * The quote list is passed as an argument. + * + * BLOCKING + */ + +static +CURLcode ftp_sendquote(struct connectdata *conn, struct curl_slist *quote) +{ + struct curl_slist *item; + ssize_t nread; + int ftpcode; + CURLcode result; + struct ftp_conn *ftpc = &conn->proto.ftpc; + struct pingpong *pp = &ftpc->pp; + + item = quote; + while(item) { + if(item->data) { + char *cmd = item->data; + bool acceptfail = FALSE; + + /* if a command starts with an asterisk, which a legal FTP command never + can, the command will be allowed to fail without it causing any + aborts or cancels etc. It will cause libcurl to act as if the command + is successful, whatever the server reponds. */ + + if(cmd[0] == '*') { + cmd++; + acceptfail = TRUE; + } + + FTPSENDF(conn, "%s", cmd); + + pp->response = Curl_tvnow(); /* timeout relative now */ + + result = Curl_GetFTPResponse(&nread, conn, &ftpcode); + if(result) + return result; + + if(!acceptfail && (ftpcode >= 400)) { + failf(conn->data, "QUOT string not accepted: %s", cmd); + return CURLE_QUOTE_ERROR; + } + } + + item = item->next; + } + + return CURLE_OK; +} + +/*********************************************************************** + * + * ftp_need_type() + * + * Returns TRUE if we in the current situation should send TYPE + */ +static int ftp_need_type(struct connectdata *conn, + bool ascii_wanted) +{ + return conn->proto.ftpc.transfertype != (ascii_wanted?'A':'I'); +} + +/*********************************************************************** + * + * ftp_nb_type() + * + * Set TYPE. We only deal with ASCII or BINARY so this function + * sets one of them. + * If the transfer type is not sent, simulate on OK response in newstate + */ +static CURLcode ftp_nb_type(struct connectdata *conn, + bool ascii, ftpstate newstate) +{ + struct ftp_conn *ftpc = &conn->proto.ftpc; + CURLcode result; + char want = (char)(ascii?'A':'I'); + + if(ftpc->transfertype == want) { + state(conn, newstate); + return ftp_state_type_resp(conn, 200, newstate); + } + + PPSENDF(&ftpc->pp, "TYPE %c", want); + state(conn, newstate); + + /* keep track of our current transfer type */ + ftpc->transfertype = want; + return CURLE_OK; +} + +/*************************************************************************** + * + * ftp_pasv_verbose() + * + * This function only outputs some informationals about this second connection + * when we've issued a PASV command before and thus we have connected to a + * possibly new IP address. + * + */ +#ifndef CURL_DISABLE_VERBOSE_STRINGS +static void +ftp_pasv_verbose(struct connectdata *conn, + Curl_addrinfo *ai, + char *newhost, /* ascii version */ + int port) +{ + char buf[256]; + Curl_printable_address(ai, buf, sizeof(buf)); + infof(conn->data, "Connecting to %s (%s) port %d\n", newhost, buf, port); +} +#endif + +/* + Check if this is a range download, and if so, set the internal variables + properly. + */ + +static CURLcode ftp_range(struct connectdata *conn) +{ + curl_off_t from, to; + char *ptr; + char *ptr2; + struct SessionHandle *data = conn->data; + struct ftp_conn *ftpc = &conn->proto.ftpc; + + if(data->state.use_range && data->state.range) { + from=curlx_strtoofft(data->state.range, &ptr, 0); + while(*ptr && (ISSPACE(*ptr) || (*ptr=='-'))) + ptr++; + to=curlx_strtoofft(ptr, &ptr2, 0); + if(ptr == ptr2) { + /* we didn't get any digit */ + to=-1; + } + if((-1 == to) && (from>=0)) { + /* X - */ + data->state.resume_from = from; + DEBUGF(infof(conn->data, "FTP RANGE %" FORMAT_OFF_T " to end of file\n", + from)); + } + else if(from < 0) { + /* -Y */ + data->req.maxdownload = -from; + data->state.resume_from = from; + DEBUGF(infof(conn->data, "FTP RANGE the last %" FORMAT_OFF_T " bytes\n", + -from)); + } + else { + /* X-Y */ + data->req.maxdownload = (to-from)+1; /* include last byte */ + data->state.resume_from = from; + DEBUGF(infof(conn->data, "FTP RANGE from %" FORMAT_OFF_T + " getting %" FORMAT_OFF_T " bytes\n", + from, data->req.maxdownload)); + } + DEBUGF(infof(conn->data, "range-download from %" FORMAT_OFF_T + " to %" FORMAT_OFF_T ", totally %" FORMAT_OFF_T " bytes\n", + from, to, data->req.maxdownload)); + ftpc->dont_check = TRUE; /* dont check for successful transfer */ + } + else + data->req.maxdownload = -1; + return CURLE_OK; +} + + +/* + * ftp_nextconnect() + * + * This function shall be called when the second FTP (data) connection is + * connected. + */ + +static CURLcode ftp_nextconnect(struct connectdata *conn) +{ + struct SessionHandle *data=conn->data; + struct ftp_conn *ftpc = &conn->proto.ftpc; + CURLcode result = CURLE_OK; + + /* the ftp struct is inited in ftp_connect() */ + struct FTP *ftp = data->state.proto.ftp; + + DEBUGF(infof(data, "DO-MORE phase starts\n")); + + if(ftp->transfer <= FTPTRANSFER_INFO) { + /* a transfer is about to take place, or if not a file name was given + so we'll do a SIZE on it later and then we need the right TYPE first */ + + if(data->set.upload) { + result = ftp_nb_type(conn, data->set.prefer_ascii, FTP_STOR_TYPE); + if(result) + return result; + } + else { + /* download */ + ftp->downloadsize = -1; /* unknown as of yet */ + + result = ftp_range(conn); + if(result) + ; + else if(data->set.ftp_list_only || !ftpc->file) { + /* The specified path ends with a slash, and therefore we think this + is a directory that is requested, use LIST. But before that we + need to set ASCII transfer mode. */ + + /* But only if a body transfer was requested. */ + if(ftp->transfer == FTPTRANSFER_BODY) { + result = ftp_nb_type(conn, TRUE, FTP_LIST_TYPE); + if(result) + return result; + } + /* otherwise just fall through */ + } + else { + result = ftp_nb_type(conn, data->set.prefer_ascii, FTP_RETR_TYPE); + if(result) + return result; + } + } + result = ftp_easy_statemach(conn); + } + + if((result == CURLE_OK) && (ftp->transfer != FTPTRANSFER_BODY)) + /* no data to transfer. FIX: it feels like a kludge to have this here + too! */ + Curl_setup_transfer(conn, -1, -1, FALSE, NULL, -1, NULL); + + /* end of transfer */ + DEBUGF(infof(data, "DO-MORE phase ends with %d\n", (int)result)); + + return result; +} + + + +/*********************************************************************** + * + * ftp_perform() + * + * This is the actual DO function for FTP. Get a file/directory according to + * the options previously setup. + */ + +static +CURLcode ftp_perform(struct connectdata *conn, + bool *connected, /* connect status after PASV / PORT */ + bool *dophase_done) +{ + /* this is FTP and no proxy */ + CURLcode result=CURLE_OK; + + DEBUGF(infof(conn->data, "DO phase starts\n")); + + if(conn->data->set.opt_no_body) { + /* requested no body means no transfer... */ + struct FTP *ftp = conn->data->state.proto.ftp; + ftp->transfer = FTPTRANSFER_INFO; + } + + + *dophase_done = FALSE; /* not done yet */ + + /* start the first command in the DO phase */ + result = ftp_state_quote(conn, TRUE, FTP_QUOTE); + if(result) + return result; + + /* run the state-machine */ + if(conn->data->state.used_interface == Curl_if_multi) + result = ftp_multi_statemach(conn, dophase_done); + else { + result = ftp_easy_statemach(conn); + *dophase_done = TRUE; /* with the easy interface we are done here */ + } + *connected = conn->bits.tcpconnect; + + if(*dophase_done) + DEBUGF(infof(conn->data, "DO phase is complete\n")); + + return result; +} + +static void wc_data_dtor(void *ptr) +{ + struct ftp_wc_tmpdata *tmp = ptr; + if(tmp) + Curl_ftp_parselist_data_free(&tmp->parser); + Curl_safefree(tmp); +} + +static CURLcode init_wc_data(struct connectdata *conn) +{ + char *last_slash; + char *path = conn->data->state.path; + struct WildcardData *wildcard = &(conn->data->wildcard); + CURLcode ret = CURLE_OK; + struct ftp_wc_tmpdata *ftp_tmp; + + last_slash = strrchr(conn->data->state.path, '/'); + if(last_slash) { + last_slash++; + if(last_slash[0] == '\0') { + wildcard->state = CURLWC_CLEAN; + ret = ftp_parse_url_path(conn); + return ret; + } + else { + wildcard->pattern = strdup(last_slash); + if (!wildcard->pattern) + return CURLE_OUT_OF_MEMORY; + last_slash[0] = '\0'; /* cut file from path */ + } + } + else { /* there is only 'wildcard pattern' or nothing */ + if(path[0]) { + wildcard->pattern = strdup(path); + if (!wildcard->pattern) + return CURLE_OUT_OF_MEMORY; + path[0] = '\0'; + } + else { /* only list */ + wildcard->state = CURLWC_CLEAN; + ret = ftp_parse_url_path(conn); + return ret; + } + } + + /* program continues only if URL is not ending with slash, allocate needed + resources for wildcard transfer */ + + /* allocate ftp protocol specific temporary wildcard data */ + ftp_tmp = malloc(sizeof(struct ftp_wc_tmpdata)); + if(!ftp_tmp) { + return CURLE_OUT_OF_MEMORY; + } + + /* INITIALIZE parselist structure */ + ftp_tmp->parser = Curl_ftp_parselist_data_alloc(); + if(!ftp_tmp->parser) { + free(ftp_tmp); + return CURLE_OUT_OF_MEMORY; + } + + wildcard->tmp = ftp_tmp; /* put it to the WildcardData tmp pointer */ + wildcard->tmp_dtor = wc_data_dtor; + + /* wildcard does not support NOCWD option (assert it?) */ + if(conn->data->set.ftp_filemethod == FTPFILE_NOCWD) + conn->data->set.ftp_filemethod = FTPFILE_MULTICWD; + + /* try to parse ftp url */ + ret = ftp_parse_url_path(conn); + if(ret) { + return ret; + } + + /* backup old write_function */ + ftp_tmp->backup.write_function = conn->data->set.fwrite_func; + /* parsing write function (callback included directly from ftplistparser.c) */ + conn->data->set.fwrite_func = Curl_ftp_parselist; + /* backup old file descriptor */ + ftp_tmp->backup.file_descriptor = conn->data->set.out; + /* let the writefunc callback know what curl pointer is working with */ + conn->data->set.out = conn; + + wildcard->path = strdup(conn->data->state.path); + if(!wildcard->path) { + return CURLE_OUT_OF_MEMORY; + } + + infof(conn->data, "Wildcard - Parsing started\n"); + return CURLE_OK; +} + +/* This is called recursively */ +static CURLcode wc_statemach(struct connectdata *conn) +{ + struct WildcardData * const wildcard = &(conn->data->wildcard); + CURLcode ret = CURLE_OK; + + switch (wildcard->state) { + case CURLWC_INIT: + ret = init_wc_data(conn); + if(wildcard->state == CURLWC_CLEAN) + /* only listing! */ + break; + else + wildcard->state = ret ? CURLWC_ERROR : CURLWC_MATCHING; + break; + + case CURLWC_MATCHING: { + /* In this state is LIST response successfully parsed, so lets restore + previous WRITEFUNCTION callback and WRITEDATA pointer */ + struct ftp_wc_tmpdata *ftp_tmp = wildcard->tmp; + conn->data->set.fwrite_func = ftp_tmp->backup.write_function; + conn->data->set.out = ftp_tmp->backup.file_descriptor; + wildcard->state = CURLWC_DOWNLOADING; + + if(Curl_ftp_parselist_geterror(ftp_tmp->parser)) { + /* error found in LIST parsing */ + wildcard->state = CURLWC_CLEAN; + return wc_statemach(conn); + } + else if(wildcard->filelist->size == 0) { + /* no corresponding file */ + wildcard->state = CURLWC_CLEAN; + return CURLE_REMOTE_FILE_NOT_FOUND; + } + return wc_statemach(conn); + } + + case CURLWC_DOWNLOADING: { + /* filelist has at least one file, lets get first one */ + struct ftp_conn *ftpc = &conn->proto.ftpc; + struct curl_fileinfo *finfo = wildcard->filelist->head->ptr; + char *tmp_path = malloc(strlen(conn->data->state.path) + + strlen(finfo->filename) + 1); + if(!tmp_path) { + return CURLE_OUT_OF_MEMORY; + } + + tmp_path[0] = 0; + /* make full path to matched file */ + strcat(tmp_path, wildcard->path); + strcat(tmp_path, finfo->filename); + /* switch default "state.pathbuffer" and tmp_path, good to see + ftp_parse_url_path function to understand this trick */ + if(conn->data->state.pathbuffer) + free(conn->data->state.pathbuffer); + conn->data->state.pathbuffer = tmp_path; + conn->data->state.path = tmp_path; + + infof(conn->data, "Wildcard - START of \"%s\"\n", finfo->filename); + if(conn->data->set.chunk_bgn) { + long userresponse = conn->data->set.chunk_bgn( + finfo, wildcard->customptr, (int)wildcard->filelist->size); + switch(userresponse) { + case CURL_CHUNK_BGN_FUNC_SKIP: + infof(conn->data, "Wildcard - \"%s\" skipped by user\n", + finfo->filename); + wildcard->state = CURLWC_SKIP; + return wc_statemach(conn); + case CURL_CHUNK_BGN_FUNC_FAIL: + return CURLE_CHUNK_FAILED; + } + } + + if(finfo->filetype != CURLFILETYPE_FILE) { + wildcard->state = CURLWC_SKIP; + return wc_statemach(conn); + } + + if(finfo->flags & CURLFINFOFLAG_KNOWN_SIZE) + ftpc->known_filesize = finfo->size; + + ret = ftp_parse_url_path(conn); + if(ret) { + return ret; + } + + /* we don't need the Curl_fileinfo of first file anymore */ + Curl_llist_remove(wildcard->filelist, wildcard->filelist->head, NULL); + + if(wildcard->filelist->size == 0) { /* remains only one file to down. */ + wildcard->state = CURLWC_CLEAN; + /* after that will be ftp_do called once again and no transfer + will be done because of CURLWC_CLEAN state */ + return CURLE_OK; + } + } break; + + case CURLWC_SKIP: { + if(conn->data->set.chunk_end) + conn->data->set.chunk_end(conn->data->wildcard.customptr); + Curl_llist_remove(wildcard->filelist, wildcard->filelist->head, NULL); + wildcard->state = (wildcard->filelist->size == 0) ? + CURLWC_CLEAN : CURLWC_DOWNLOADING; + return wc_statemach(conn); + } + + case CURLWC_CLEAN: { + struct ftp_wc_tmpdata *ftp_tmp = wildcard->tmp; + ret = CURLE_OK; + if(ftp_tmp) { + ret = Curl_ftp_parselist_geterror(ftp_tmp->parser); + } + wildcard->state = ret ? CURLWC_ERROR : CURLWC_DONE; + } break; + + case CURLWC_DONE: + case CURLWC_ERROR: + break; + } + + return ret; +} + +/*********************************************************************** + * + * ftp_do() + * + * This function is registered as 'curl_do' function. It decodes the path + * parts etc as a wrapper to the actual DO function (ftp_perform). + * + * The input argument is already checked for validity. + */ +static CURLcode ftp_do(struct connectdata *conn, bool *done) +{ + CURLcode retcode = CURLE_OK; + + *done = FALSE; /* default to false */ + + /* + Since connections can be re-used between SessionHandles, this might be a + connection already existing but on a fresh SessionHandle struct so we must + make sure we have a good 'struct FTP' to play with. For new connections, + the struct FTP is allocated and setup in the ftp_connect() function. + */ + Curl_reset_reqproto(conn); + retcode = ftp_init(conn); + if(retcode) + return retcode; + + if(conn->data->set.wildcardmatch) { + retcode = wc_statemach(conn); + if(conn->data->wildcard.state == CURLWC_SKIP || + conn->data->wildcard.state == CURLWC_DONE) { + /* do not call ftp_regular_transfer */ + return CURLE_OK; + } + if(retcode) /* error, loop or skipping the file */ + return retcode; + } + else { /* no wildcard FSM needed */ + retcode = ftp_parse_url_path(conn); + if(retcode) + return retcode; + } + + retcode = ftp_regular_transfer(conn, done); + + return retcode; +} + + +CURLcode Curl_ftpsendf(struct connectdata *conn, + const char *fmt, ...) +{ + ssize_t bytes_written; +#define SBUF_SIZE 1024 + char s[SBUF_SIZE]; + size_t write_len; + char *sptr=s; + CURLcode res = CURLE_OK; +#if defined(HAVE_KRB4) || defined(HAVE_GSSAPI) + enum protection_level data_sec = conn->data_prot; +#endif + + va_list ap; + va_start(ap, fmt); + vsnprintf(s, SBUF_SIZE-3, fmt, ap); + va_end(ap); + + strcat(s, "\r\n"); /* append a trailing CRLF */ + + bytes_written=0; + write_len = strlen(s); + +#ifdef CURL_DOES_CONVERSIONS + res = Curl_convert_to_network(conn->data, s, write_len); + /* Curl_convert_to_network calls failf if unsuccessful */ + if(res != CURLE_OK) { + return(res); + } +#endif /* CURL_DOES_CONVERSIONS */ + + for(;;) { +#if defined(HAVE_KRB4) || defined(HAVE_GSSAPI) + conn->data_prot = PROT_CMD; +#endif + res = Curl_write(conn, conn->sock[FIRSTSOCKET], sptr, write_len, + &bytes_written); +#if defined(HAVE_KRB4) || defined(HAVE_GSSAPI) + DEBUGASSERT(data_sec > PROT_NONE && data_sec < PROT_LAST); + conn->data_prot = data_sec; +#endif + + if(CURLE_OK != res) + break; + + if(conn->data->set.verbose) + Curl_debug(conn->data, CURLINFO_HEADER_OUT, + sptr, (size_t)bytes_written, conn); + + if(bytes_written != (ssize_t)write_len) { + write_len -= bytes_written; + sptr += bytes_written; + } + else + break; + } + + return res; +} + +/*********************************************************************** + * + * ftp_quit() + * + * This should be called before calling sclose() on an ftp control connection + * (not data connections). We should then wait for the response from the + * server before returning. The calling code should then try to close the + * connection. + * + */ +static CURLcode ftp_quit(struct connectdata *conn) +{ + CURLcode result = CURLE_OK; + + if(conn->proto.ftpc.ctl_valid) { + PPSENDF(&conn->proto.ftpc.pp, "QUIT", NULL); + state(conn, FTP_QUIT); + + result = ftp_easy_statemach(conn); + } + + return result; +} + +/*********************************************************************** + * + * ftp_disconnect() + * + * Disconnect from an FTP server. Cleanup protocol-specific per-connection + * resources. BLOCKING. + */ +static CURLcode ftp_disconnect(struct connectdata *conn, bool dead_connection) +{ + struct ftp_conn *ftpc= &conn->proto.ftpc; + struct pingpong *pp = &ftpc->pp; + + /* We cannot send quit unconditionally. If this connection is stale or + bad in any way, sending quit and waiting around here will make the + disconnect wait in vain and cause more problems than we need to. + + ftp_quit() will check the state of ftp->ctl_valid. If it's ok it + will try to send the QUIT command, otherwise it will just return. + */ + if(dead_connection) + ftpc->ctl_valid = FALSE; + + /* The FTP session may or may not have been allocated/setup at this point! */ + (void)ftp_quit(conn); /* ignore errors on the QUIT */ + + if(ftpc->entrypath) { + struct SessionHandle *data = conn->data; + if(data->state.most_recent_ftp_entrypath == ftpc->entrypath) { + data->state.most_recent_ftp_entrypath = NULL; + } + free(ftpc->entrypath); + ftpc->entrypath = NULL; + } + + freedirs(ftpc); + if(ftpc->prevpath) { + free(ftpc->prevpath); + ftpc->prevpath = NULL; + } + if(ftpc->server_os) { + free(ftpc->server_os); + ftpc->server_os = NULL; + } + + Curl_pp_disconnect(pp); + +#if defined(HAVE_KRB4) || defined(HAVE_GSSAPI) + Curl_sec_end(conn); +#endif + + return CURLE_OK; +} + +/*********************************************************************** + * + * ftp_parse_url_path() + * + * Parse the URL path into separate path components. + * + */ +static +CURLcode ftp_parse_url_path(struct connectdata *conn) +{ + struct SessionHandle *data = conn->data; + /* the ftp struct is already inited in ftp_connect() */ + struct FTP *ftp = data->state.proto.ftp; + struct ftp_conn *ftpc = &conn->proto.ftpc; + const char *slash_pos; /* position of the first '/' char in curpos */ + const char *path_to_use = data->state.path; + const char *cur_pos; + const char *filename = NULL; + + cur_pos = path_to_use; /* current position in path. point at the begin + of next path component */ + + ftpc->ctl_valid = FALSE; + ftpc->cwdfail = FALSE; + + switch(data->set.ftp_filemethod) { + case FTPFILE_NOCWD: + /* fastest, but less standard-compliant */ + + /* + The best time to check whether the path is a file or directory is right + here. so: + + the first condition in the if() right here, is there just in case + someone decides to set path to NULL one day + */ + if(data->state.path && + data->state.path[0] && + (data->state.path[strlen(data->state.path) - 1] != '/') ) + filename = data->state.path; /* this is a full file path */ + /* + ftpc->file is not used anywhere other than for operations on a file. + In other words, never for directory operations. + So we can safely leave filename as NULL here and use it as a + argument in dir/file decisions. + */ + break; + + case FTPFILE_SINGLECWD: + /* get the last slash */ + if(!path_to_use[0]) { + /* no dir, no file */ + ftpc->dirdepth = 0; + break; + } + slash_pos=strrchr(cur_pos, '/'); + if(slash_pos || !*cur_pos) { + ftpc->dirs = calloc(1, sizeof(ftpc->dirs[0])); + if(!ftpc->dirs) + return CURLE_OUT_OF_MEMORY; + + ftpc->dirs[0] = curl_easy_unescape(conn->data, slash_pos ? cur_pos : "/", + slash_pos?(int)(slash_pos-cur_pos):1, + NULL); + if(!ftpc->dirs[0]) { + freedirs(ftpc); + return CURLE_OUT_OF_MEMORY; + } + ftpc->dirdepth = 1; /* we consider it to be a single dir */ + filename = slash_pos ? slash_pos+1 : cur_pos; /* rest is file name */ + } + else + filename = cur_pos; /* this is a file name only */ + break; + + default: /* allow pretty much anything */ + case FTPFILE_MULTICWD: + ftpc->dirdepth = 0; + ftpc->diralloc = 5; /* default dir depth to allocate */ + ftpc->dirs = calloc(ftpc->diralloc, sizeof(ftpc->dirs[0])); + if(!ftpc->dirs) + return CURLE_OUT_OF_MEMORY; + + /* we have a special case for listing the root dir only */ + if(strequal(path_to_use, "/")) { + cur_pos++; /* make it point to the zero byte */ + ftpc->dirs[0] = strdup("/"); + ftpc->dirdepth++; + } + else { + /* parse the URL path into separate path components */ + while((slash_pos = strchr(cur_pos, '/')) != NULL) { + /* 1 or 0 pointer offset to indicate absolute directory */ + ssize_t absolute_dir = ((cur_pos - data->state.path > 0) && + (ftpc->dirdepth == 0))?1:0; + + /* seek out the next path component */ + if(slash_pos-cur_pos) { + /* we skip empty path components, like "x//y" since the FTP command + CWD requires a parameter and a non-existant parameter a) doesn't + work on many servers and b) has no effect on the others. */ + int len = (int)(slash_pos - cur_pos + absolute_dir); + ftpc->dirs[ftpc->dirdepth] = + curl_easy_unescape(conn->data, cur_pos - absolute_dir, len, NULL); + if(!ftpc->dirs[ftpc->dirdepth]) { /* run out of memory ... */ + failf(data, "no memory"); + freedirs(ftpc); + return CURLE_OUT_OF_MEMORY; + } + if(isBadFtpString(ftpc->dirs[ftpc->dirdepth])) { + free(ftpc->dirs[ftpc->dirdepth]); + freedirs(ftpc); + return CURLE_URL_MALFORMAT; + } + } + else { + cur_pos = slash_pos + 1; /* jump to the rest of the string */ + continue; + } + + cur_pos = slash_pos + 1; /* jump to the rest of the string */ + if(++ftpc->dirdepth >= ftpc->diralloc) { + /* enlarge array */ + char *bigger; + ftpc->diralloc *= 2; /* double the size each time */ + bigger = realloc(ftpc->dirs, ftpc->diralloc * sizeof(ftpc->dirs[0])); + if(!bigger) { + freedirs(ftpc); + return CURLE_OUT_OF_MEMORY; + } + ftpc->dirs = (char **)bigger; + } + } + } + filename = cur_pos; /* the rest is the file name */ + break; + } /* switch */ + + if(filename && *filename) { + ftpc->file = curl_easy_unescape(conn->data, filename, 0, NULL); + if(NULL == ftpc->file) { + freedirs(ftpc); + failf(data, "no memory"); + return CURLE_OUT_OF_MEMORY; + } + if(isBadFtpString(ftpc->file)) { + freedirs(ftpc); + return CURLE_URL_MALFORMAT; + } + } + else + ftpc->file=NULL; /* instead of point to a zero byte, we make it a NULL + pointer */ + + if(data->set.upload && !ftpc->file && (ftp->transfer == FTPTRANSFER_BODY)) { + /* We need a file name when uploading. Return error! */ + failf(data, "Uploading to a URL without a file name!"); + return CURLE_URL_MALFORMAT; + } + + ftpc->cwddone = FALSE; /* default to not done */ + + if(ftpc->prevpath) { + /* prevpath is "raw" so we convert the input path before we compare the + strings */ + int dlen; + char *path = curl_easy_unescape(conn->data, data->state.path, 0, &dlen); + if(!path) { + freedirs(ftpc); + return CURLE_OUT_OF_MEMORY; + } + + dlen -= ftpc->file?(int)strlen(ftpc->file):0; + if((dlen == (int)strlen(ftpc->prevpath)) && + strnequal(path, ftpc->prevpath, dlen)) { + infof(data, "Request has same path as previous transfer\n"); + ftpc->cwddone = TRUE; + } + free(path); + } + + return CURLE_OK; +} + +/* call this when the DO phase has completed */ +static CURLcode ftp_dophase_done(struct connectdata *conn, + bool connected) +{ + CURLcode result = CURLE_OK; + struct FTP *ftp = conn->data->state.proto.ftp; + struct ftp_conn *ftpc = &conn->proto.ftpc; + + if(connected) + result = ftp_nextconnect(conn); + + if(result && (conn->sock[SECONDARYSOCKET] != CURL_SOCKET_BAD)) { + /* Failure detected, close the second socket if it was created already */ + sclose(conn->sock[SECONDARYSOCKET]); + conn->sock[SECONDARYSOCKET] = CURL_SOCKET_BAD; + return result; + } + + if(ftp->transfer != FTPTRANSFER_BODY) + /* no data to transfer */ + Curl_setup_transfer(conn, -1, -1, FALSE, NULL, -1, NULL); + else if(!connected) + /* since we didn't connect now, we want do_more to get called */ + conn->bits.do_more = TRUE; + + ftpc->ctl_valid = TRUE; /* seems good */ + + return result; +} + +/* called from multi.c while DOing */ +static CURLcode ftp_doing(struct connectdata *conn, + bool *dophase_done) +{ + CURLcode result; + result = ftp_multi_statemach(conn, dophase_done); + + if(*dophase_done) { + result = ftp_dophase_done(conn, FALSE /* not connected */); + + DEBUGF(infof(conn->data, "DO phase is complete\n")); + } + return result; +} + +/*********************************************************************** + * + * ftp_regular_transfer() + * + * The input argument is already checked for validity. + * + * Performs all commands done before a regular transfer between a local and a + * remote host. + * + * ftp->ctl_valid starts out as FALSE, and gets set to TRUE if we reach the + * ftp_done() function without finding any major problem. + */ +static +CURLcode ftp_regular_transfer(struct connectdata *conn, + bool *dophase_done) +{ + CURLcode result=CURLE_OK; + bool connected=FALSE; + struct SessionHandle *data = conn->data; + struct ftp_conn *ftpc = &conn->proto.ftpc; + data->req.size = -1; /* make sure this is unknown at this point */ + + Curl_pgrsSetUploadCounter(data, 0); + Curl_pgrsSetDownloadCounter(data, 0); + Curl_pgrsSetUploadSize(data, 0); + Curl_pgrsSetDownloadSize(data, 0); + + ftpc->ctl_valid = TRUE; /* starts good */ + + result = ftp_perform(conn, + &connected, /* have we connected after PASV/PORT */ + dophase_done); /* all commands in the DO-phase done? */ + + if(CURLE_OK == result) { + + if(!*dophase_done) + /* the DO phase has not completed yet */ + return CURLE_OK; + + result = ftp_dophase_done(conn, connected); + if(result) + return result; + } + else + freedirs(ftpc); + + return result; +} + +static CURLcode ftp_setup_connection(struct connectdata * conn) +{ + struct SessionHandle *data = conn->data; + char * type; + char command; + + if(conn->bits.httpproxy && !data->set.tunnel_thru_httpproxy) { + /* Unless we have asked to tunnel ftp operations through the proxy, we + switch and use HTTP operations only */ +#ifndef CURL_DISABLE_HTTP + if(conn->handler == &Curl_handler_ftp) + conn->handler = &Curl_handler_ftp_proxy; + else { +#ifdef USE_SSL + conn->handler = &Curl_handler_ftps_proxy; +#else + failf(data, "FTPS not supported!"); + return CURLE_UNSUPPORTED_PROTOCOL; +#endif + } + /* + * We explicitly mark this connection as persistent here as we're doing + * FTP over HTTP and thus we accidentally avoid setting this value + * otherwise. + */ + conn->bits.close = FALSE; +#else + failf(data, "FTP over http proxy requires HTTP support built-in!"); + return CURLE_UNSUPPORTED_PROTOCOL; +#endif + } + + data->state.path++; /* don't include the initial slash */ + data->state.slash_removed = TRUE; /* we've skipped the slash */ + + /* FTP URLs support an extension like ";type=" that + * we'll try to get now! */ + type = strstr(data->state.path, ";type="); + + if(!type) + type = strstr(conn->host.rawalloc, ";type="); + + if(type) { + *type = 0; /* it was in the middle of the hostname */ + command = Curl_raw_toupper(type[6]); + conn->bits.type_set = TRUE; + + switch (command) { + case 'A': /* ASCII mode */ + data->set.prefer_ascii = TRUE; + break; + + case 'D': /* directory mode */ + data->set.ftp_list_only = TRUE; + break; + + case 'I': /* binary mode */ + default: + /* switch off ASCII */ + data->set.prefer_ascii = FALSE; + break; + } + } + + return CURLE_OK; +} + +#endif /* CURL_DISABLE_FTP */ diff --git a/mobicore/common/curl/lib/ftp.h b/mobicore/common/curl/lib/ftp.h new file mode 100644 index 0000000000000000000000000000000000000000..d8ef34823722df6adcccda4e1350f579fce35b8a --- /dev/null +++ b/mobicore/common/curl/lib/ftp.h @@ -0,0 +1,153 @@ +#ifndef HEADER_CURL_FTP_H +#define HEADER_CURL_FTP_H +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) 1998 - 2010, Daniel Stenberg, , et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at http://curl.haxx.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ***************************************************************************/ + +#include "pingpong.h" + +#ifndef CURL_DISABLE_FTP +extern const struct Curl_handler Curl_handler_ftp; + +#ifdef USE_SSL +extern const struct Curl_handler Curl_handler_ftps; +#endif + +CURLcode Curl_ftpsendf(struct connectdata *, const char *fmt, ...); +CURLcode Curl_GetFTPResponse(ssize_t *nread, struct connectdata *conn, + int *ftpcode); +#endif /* CURL_DISABLE_FTP */ + +/**************************************************************************** + * FTP unique setup + ***************************************************************************/ +typedef enum { + FTP_STOP, /* do nothing state, stops the state machine */ + FTP_WAIT220, /* waiting for the initial 220 response immediately after + a connect */ + FTP_AUTH, + FTP_USER, + FTP_PASS, + FTP_ACCT, + FTP_PBSZ, + FTP_PROT, + FTP_CCC, + FTP_PWD, + FTP_SYST, + FTP_NAMEFMT, + FTP_QUOTE, /* waiting for a response to a command sent in a quote list */ + FTP_RETR_PREQUOTE, + FTP_STOR_PREQUOTE, + FTP_POSTQUOTE, + FTP_CWD, /* change dir */ + FTP_MKD, /* if the dir didn't exist */ + FTP_MDTM, /* to figure out the datestamp */ + FTP_TYPE, /* to set type when doing a head-like request */ + FTP_LIST_TYPE, /* set type when about to do a dir list */ + FTP_RETR_TYPE, /* set type when about to RETR a file */ + FTP_STOR_TYPE, /* set type when about to STOR a file */ + FTP_SIZE, /* get the remote file's size for head-like request */ + FTP_RETR_SIZE, /* get the remote file's size for RETR */ + FTP_STOR_SIZE, /* get the size for (resumed) STOR */ + FTP_REST, /* when used to check if the server supports it in head-like */ + FTP_RETR_REST, /* when asking for "resume" in for RETR */ + FTP_PORT, /* generic state for PORT, LPRT and EPRT, check count1 */ + FTP_PRET, /* generic state for PRET RETR, PRET STOR and PRET LIST/NLST */ + FTP_PASV, /* generic state for PASV and EPSV, check count1 */ + FTP_LIST, /* generic state for LIST, NLST or a custom list command */ + FTP_RETR, + FTP_STOR, /* generic state for STOR and APPE */ + FTP_QUIT, + FTP_LAST /* never used */ +} ftpstate; + +struct ftp_parselist_data; /* defined later in ftplistparser.c */ + +struct ftp_wc_tmpdata { + struct ftp_parselist_data *parser; + + struct { + curl_write_callback write_function; + FILE *file_descriptor; + } backup; +}; + +typedef enum { + FTPFILE_MULTICWD = 1, /* as defined by RFC1738 */ + FTPFILE_NOCWD = 2, /* use SIZE / RETR / STOR on the full path */ + FTPFILE_SINGLECWD = 3 /* make one CWD, then SIZE / RETR / STOR on the file */ +} curl_ftpfile; + +typedef enum { + FTPTRANSFER_BODY, /* yes do transfer a body */ + FTPTRANSFER_INFO, /* do still go through to get info/headers */ + FTPTRANSFER_NONE, /* don't get anything and don't get info */ + FTPTRANSFER_LAST /* end of list marker, never used */ +} curl_ftptransfer; + +/* This FTP struct is used in the SessionHandle. All FTP data that is + connection-oriented must be in FTP_conn to properly deal with the fact that + perhaps the SessionHandle is changed between the times the connection is + used. */ +struct FTP { + curl_off_t *bytecountp; + char *user; /* user name string */ + char *passwd; /* password string */ + + /* transfer a file/body or not, done as a typedefed enum just to make + debuggers display the full symbol and not just the numerical value */ + curl_ftptransfer transfer; + curl_off_t downloadsize; +}; + + +/* ftp_conn is used for struct connection-oriented data in the connectdata + struct */ +struct ftp_conn { + struct pingpong pp; + char *entrypath; /* the PWD reply when we logged on */ + char **dirs; /* realloc()ed array for path components */ + int dirdepth; /* number of entries used in the 'dirs' array */ + int diralloc; /* number of entries allocated for the 'dirs' array */ + char *file; /* decoded file */ + bool dont_check; /* Set to TRUE to prevent the final (post-transfer) + file size and 226/250 status check. It should still + read the line, just ignore the result. */ + bool ctl_valid; /* Tells Curl_ftp_quit() whether or not to do anything. If + the connection has timed out or been closed, this + should be FALSE when it gets to Curl_ftp_quit() */ + bool cwddone; /* if it has been determined that the proper CWD combo + already has been done */ + bool cwdfail; /* set TRUE if a CWD command fails, as then we must prevent + caching the current directory */ + char *prevpath; /* conn->path from the previous transfer */ + char transfertype; /* set by ftp_transfertype for use by Curl_client_write()a + and others (A/I or zero) */ + int count1; /* general purpose counter for the state machine */ + int count2; /* general purpose counter for the state machine */ + int count3; /* general purpose counter for the state machine */ + ftpstate state; /* always use ftp.c:state() to change state! */ + char * server_os; /* The target server operating system. */ + curl_off_t known_filesize; /* file size is different from -1, if wildcard + LIST parsing was done and wc_statemach set it */ +}; + +#endif /* HEADER_CURL_FTP_H */ diff --git a/mobicore/common/curl/lib/ftplistparser.c b/mobicore/common/curl/lib/ftplistparser.c new file mode 100644 index 0000000000000000000000000000000000000000..c59ea7e162274a3395016d2f0b845781a2eb722a --- /dev/null +++ b/mobicore/common/curl/lib/ftplistparser.c @@ -0,0 +1,1045 @@ +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) 1998 - 2010, Daniel Stenberg, , et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at http://curl.haxx.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ***************************************************************************/ + +/** + * Now implemented: + * + * 1) UNIX version 1 + * drwxr-xr-x 1 user01 ftp 512 Jan 29 23:32 prog + * 2) UNIX version 2 + * drwxr-xr-x 1 user01 ftp 512 Jan 29 1997 prog + * 3) UNIX version 3 + * drwxr-xr-x 1 1 1 512 Jan 29 23:32 prog + * 4) UNIX symlink + * lrwxr-xr-x 1 user01 ftp 512 Jan 29 23:32 prog -> prog2000 + * 5) DOS style + * 01-29-97 11:32PM prog + */ + +#include "setup.h" + +#include + +#include "ftplistparser.h" +#include "curl_fnmatch.h" + +#include "urldata.h" +#include "ftp.h" +#include "fileinfo.h" +#include "llist.h" +#include "strtoofft.h" +#include "rawstr.h" +#include "ftp.h" + +#define _MPRINTF_REPLACE /* use our functions only */ +#include + +#include "curl_memory.h" +/* The last #include file should be: */ +#include "memdebug.h" + +/* allocs buffer which will contain one line of LIST command response */ +#define FTP_BUFFER_ALLOCSIZE 160 + +typedef enum { + PL_UNIX_TOTALSIZE = 0, + PL_UNIX_FILETYPE, + PL_UNIX_PERMISSION, + PL_UNIX_HLINKS, + PL_UNIX_USER, + PL_UNIX_GROUP, + PL_UNIX_SIZE, + PL_UNIX_TIME, + PL_UNIX_FILENAME, + PL_UNIX_SYMLINK +} pl_unix_mainstate; + +typedef union { + enum { + PL_UNIX_TOTALSIZE_INIT = 0, + PL_UNIX_TOTALSIZE_READING + } total_dirsize; + + enum { + PL_UNIX_HLINKS_PRESPACE = 0, + PL_UNIX_HLINKS_NUMBER + } hlinks; + + enum { + PL_UNIX_USER_PRESPACE = 0, + PL_UNIX_USER_PARSING + } user; + + enum { + PL_UNIX_GROUP_PRESPACE = 0, + PL_UNIX_GROUP_NAME + } group; + + enum { + PL_UNIX_SIZE_PRESPACE = 0, + PL_UNIX_SIZE_NUMBER + } size; + + enum { + PL_UNIX_TIME_PREPART1 = 0, + PL_UNIX_TIME_PART1, + PL_UNIX_TIME_PREPART2, + PL_UNIX_TIME_PART2, + PL_UNIX_TIME_PREPART3, + PL_UNIX_TIME_PART3 + } time; + + enum { + PL_UNIX_FILENAME_PRESPACE = 0, + PL_UNIX_FILENAME_NAME, + PL_UNIX_FILENAME_WINDOWSEOL + } filename; + + enum { + PL_UNIX_SYMLINK_PRESPACE = 0, + PL_UNIX_SYMLINK_NAME, + PL_UNIX_SYMLINK_PRETARGET1, + PL_UNIX_SYMLINK_PRETARGET2, + PL_UNIX_SYMLINK_PRETARGET3, + PL_UNIX_SYMLINK_PRETARGET4, + PL_UNIX_SYMLINK_TARGET, + PL_UNIX_SYMLINK_WINDOWSEOL + } symlink; +} pl_unix_substate; + +typedef enum { + PL_WINNT_DATE = 0, + PL_WINNT_TIME, + PL_WINNT_DIRORSIZE, + PL_WINNT_FILENAME +} pl_winNT_mainstate; + +typedef union { + enum { + PL_WINNT_TIME_PRESPACE = 0, + PL_WINNT_TIME_TIME + } time; + enum { + PL_WINNT_DIRORSIZE_PRESPACE = 0, + PL_WINNT_DIRORSIZE_CONTENT + } dirorsize; + enum { + PL_WINNT_FILENAME_PRESPACE = 0, + PL_WINNT_FILENAME_CONTENT, + PL_WINNT_FILENAME_WINEOL + } filename; +} pl_winNT_substate; + +/* This struct is used in wildcard downloading - for parsing LIST response */ +struct ftp_parselist_data { + enum { + OS_TYPE_UNKNOWN = 0, + OS_TYPE_UNIX, + OS_TYPE_WIN_NT + } os_type; + + union { + struct { + pl_unix_mainstate main; + pl_unix_substate sub; + } UNIX; + + struct { + pl_winNT_mainstate main; + pl_winNT_substate sub; + } NT; + } state; + + CURLcode error; + struct curl_fileinfo *file_data; + unsigned int item_length; + size_t item_offset; + struct { + size_t filename; + size_t user; + size_t group; + size_t time; + size_t perm; + size_t symlink_target; + } offsets; +}; + +struct ftp_parselist_data *Curl_ftp_parselist_data_alloc(void) +{ + return calloc(1, sizeof(struct ftp_parselist_data)); +} + + +void Curl_ftp_parselist_data_free(struct ftp_parselist_data **pl_data) +{ + if(*pl_data) + free(*pl_data); + *pl_data = NULL; +} + + +CURLcode Curl_ftp_parselist_geterror(struct ftp_parselist_data *pl_data) +{ + return pl_data->error; +} + + +#define FTP_LP_MALFORMATED_PERM 0x01000000 + +static int ftp_pl_get_permission(const char *str) +{ + int permissions = 0; + /* USER */ + if(str[0] == 'r') + permissions |= 1 << 8; + else if(str[0] != '-') + permissions |= FTP_LP_MALFORMATED_PERM; + if(str[1] == 'w') + permissions |= 1 << 7; + else if(str[1] != '-') + permissions |= FTP_LP_MALFORMATED_PERM; + + if(str[2] == 'x') + permissions |= 1 << 6; + else if(str[2] == 's') { + permissions |= 1 << 6; + permissions |= 1 << 11; + } + else if(str[2] == 'S') + permissions |= 1 << 11; + else if(str[2] != '-') + permissions |= FTP_LP_MALFORMATED_PERM; + /* GROUP */ + if(str[3] == 'r') + permissions |= 1 << 5; + else if(str[3] != '-') + permissions |= FTP_LP_MALFORMATED_PERM; + if(str[4] == 'w') + permissions |= 1 << 4; + else if(str[4] != '-') + permissions |= FTP_LP_MALFORMATED_PERM; + if(str[5] == 'x') + permissions |= 1 << 3; + else if(str[5] == 's') { + permissions |= 1 << 3; + permissions |= 1 << 10; + } + else if(str[5] == 'S') + permissions |= 1 << 10; + else if(str[5] != '-') + permissions |= FTP_LP_MALFORMATED_PERM; + /* others */ + if(str[6] == 'r') + permissions |= 1 << 2; + else if(str[6] != '-') + permissions |= FTP_LP_MALFORMATED_PERM; + if(str[7] == 'w') + permissions |= 1 << 1; + else if(str[7] != '-') + permissions |= FTP_LP_MALFORMATED_PERM; + if(str[8] == 'x') + permissions |= 1; + else if(str[8] == 't') { + permissions |= 1; + permissions |= 1 << 9; + } + else if(str[8] == 'T') + permissions |= 1 << 9; + else if(str[8] != '-') + permissions |= FTP_LP_MALFORMATED_PERM; + + return permissions; +} + +static void PL_ERROR(struct connectdata *conn, CURLcode err) +{ + struct ftp_wc_tmpdata *tmpdata = conn->data->wildcard.tmp; + struct ftp_parselist_data *parser = tmpdata->parser; + if(parser->file_data) + Curl_fileinfo_dtor(NULL, parser->file_data); + parser->file_data = NULL; + parser->error = err; +} + +static bool ftp_pl_gettime(struct ftp_parselist_data *parser, char *string) +{ + (void)parser; + (void)string; + /* TODO + * There could be possible parse timestamp from server. Leaving unimplemented + * for now. + * If you want implement this, please add CURLFINFOFLAG_KNOWN_TIME flag to + * parser->file_data->flags + * + * Ftp servers are giving usually these formats: + * Apr 11 1998 (unknown time.. set it to 00:00:00?) + * Apr 11 12:21 (unknown year -> set it to NOW() time?) + * 08-05-09 02:49PM (ms-dos format) + * 20100421092538 -> for MLST/MLSD response + */ + + return FALSE; +} + +static CURLcode ftp_pl_insert_finfo(struct connectdata *conn, + struct curl_fileinfo *finfo) +{ + curl_fnmatch_callback compare; + struct WildcardData *wc = &conn->data->wildcard; + struct ftp_wc_tmpdata *tmpdata = wc->tmp; + struct curl_llist *llist = wc->filelist; + struct ftp_parselist_data *parser = tmpdata->parser; + bool add = TRUE; + + /* move finfo pointers to b_data */ + char *str = finfo->b_data; + finfo->filename = str + parser->offsets.filename; + finfo->strings.group = parser->offsets.group ? + str + parser->offsets.group : NULL; + finfo->strings.perm = parser->offsets.perm ? + str + parser->offsets.perm : NULL; + finfo->strings.target = parser->offsets.symlink_target ? + str + parser->offsets.symlink_target : NULL; + finfo->strings.time = str + parser->offsets.time; + finfo->strings.user = parser->offsets.user ? + str + parser->offsets.user : NULL; + + /* get correct fnmatch callback */ + compare = conn->data->set.fnmatch; + if(!compare) + compare = Curl_fnmatch; + + /* filter pattern-corresponding filenames */ + if(compare(conn->data->set.fnmatch_data, wc->pattern, finfo->filename) == 0) { + /* discard symlink which is containing multiple " -> " */ + if((finfo->filetype == CURLFILETYPE_SYMLINK) && finfo->strings.target && + (strstr(finfo->strings.target, " -> "))) { + add = FALSE; + } + } + else { + add = FALSE; + } + + if(add) { + if(!Curl_llist_insert_next(llist, llist->tail, finfo)) { + Curl_fileinfo_dtor(NULL, finfo); + tmpdata->parser->file_data = NULL; + return CURLE_OUT_OF_MEMORY; + } + } + else { + Curl_fileinfo_dtor(NULL, finfo); + } + + tmpdata->parser->file_data = NULL; + return CURLE_OK; +} + +size_t Curl_ftp_parselist(char *buffer, size_t size, size_t nmemb, + void *connptr) +{ + size_t bufflen = size*nmemb; + struct connectdata *conn = (struct connectdata *)connptr; + struct ftp_wc_tmpdata *tmpdata = conn->data->wildcard.tmp; + struct ftp_parselist_data *parser = tmpdata->parser; + struct curl_fileinfo *finfo; + unsigned long i = 0; + CURLcode rc; + + if(parser->error) { /* error in previous call */ + /* scenario: + * 1. call => OK.. + * 2. call => OUT_OF_MEMORY (or other error) + * 3. (last) call => is skipped RIGHT HERE and the error is hadled later + * in wc_statemach() + */ + return bufflen; + } + + if(parser->os_type == OS_TYPE_UNKNOWN && bufflen > 0) { + /* considering info about FILE response format */ + parser->os_type = (buffer[0] >= '0' && buffer[0] <= '9') ? + OS_TYPE_WIN_NT : OS_TYPE_UNIX; + } + + while(i < bufflen) { /* FSM */ + + char c = buffer[i]; + if(!parser->file_data) { /* tmp file data is not allocated yet */ + parser->file_data = Curl_fileinfo_alloc(); + if(!parser->file_data) { + parser->error = CURLE_OUT_OF_MEMORY; + return bufflen; + } + parser->file_data->b_data = malloc(FTP_BUFFER_ALLOCSIZE); + if(!parser->file_data->b_data) { + PL_ERROR(conn, CURLE_OUT_OF_MEMORY); + return bufflen; + } + parser->file_data->b_size = FTP_BUFFER_ALLOCSIZE; + parser->item_offset = 0; + parser->item_length = 0; + } + + finfo = parser->file_data; + finfo->b_data[finfo->b_used++] = c; + + if(finfo->b_used >= finfo->b_size - 1) { + /* if it is important, extend buffer space for file data */ + char *tmp = realloc(finfo->b_data, + finfo->b_size + FTP_BUFFER_ALLOCSIZE); + if(tmp) { + finfo->b_size += FTP_BUFFER_ALLOCSIZE; + finfo->b_data = tmp; + } + else { + Curl_fileinfo_dtor(NULL, parser->file_data); + parser->file_data = NULL; + parser->error = CURLE_OUT_OF_MEMORY; + PL_ERROR(conn, CURLE_OUT_OF_MEMORY); + return bufflen; + } + } + + switch (parser->os_type) { + case OS_TYPE_UNIX: + switch (parser->state.UNIX.main) { + case PL_UNIX_TOTALSIZE: + switch(parser->state.UNIX.sub.total_dirsize) { + case PL_UNIX_TOTALSIZE_INIT: + if(c == 't') { + parser->state.UNIX.sub.total_dirsize = PL_UNIX_TOTALSIZE_READING; + parser->item_length++; + } + else { + parser->state.UNIX.main = PL_UNIX_FILETYPE; + /* start FSM again not considering size of directory */ + finfo->b_used = 0; + i--; + } + break; + case PL_UNIX_TOTALSIZE_READING: + parser->item_length++; + if(c == '\r') { + parser->item_length--; + finfo->b_used--; + } + else if(c == '\n') { + finfo->b_data[parser->item_length - 1] = 0; + if(strncmp("total ", finfo->b_data, 6) == 0) { + char *endptr = NULL; + /* here we can deal with directory size */ + curlx_strtoofft(finfo->b_data+6, &endptr, 10); + if(*endptr != 0) { + PL_ERROR(conn, CURLE_FTP_BAD_FILE_LIST); + return bufflen; + } + else { + parser->state.UNIX.main = PL_UNIX_FILETYPE; + finfo->b_used = 0; + } + } + else { + PL_ERROR(conn, CURLE_FTP_BAD_FILE_LIST); + return bufflen; + } + } + break; + } + break; + case PL_UNIX_FILETYPE: + switch (c) { + case '-': + finfo->filetype = CURLFILETYPE_FILE; + break; + case 'd': + finfo->filetype = CURLFILETYPE_DIRECTORY; + break; + case 'l': + finfo->filetype = CURLFILETYPE_SYMLINK; + break; + case 'p': + finfo->filetype = CURLFILETYPE_NAMEDPIPE; + break; + case 's': + finfo->filetype = CURLFILETYPE_SOCKET; + break; + case 'c': + finfo->filetype = CURLFILETYPE_DEVICE_CHAR; + break; + case 'b': + finfo->filetype = CURLFILETYPE_DEVICE_BLOCK; + break; + case 'D': + finfo->filetype = CURLFILETYPE_DOOR; + break; + default: + PL_ERROR(conn, CURLE_FTP_BAD_FILE_LIST); + return bufflen; + } + parser->state.UNIX.main = PL_UNIX_PERMISSION; + parser->item_length = 0; + parser->item_offset = 1; + break; + case PL_UNIX_PERMISSION: + parser->item_length++; + if(parser->item_length <= 9) { + if(!strchr("rwx-tTsS", c)) { + PL_ERROR(conn, CURLE_FTP_BAD_FILE_LIST); + return bufflen; + } + } + else if(parser->item_length == 10) { + unsigned int perm; + if(c != ' ') { + PL_ERROR(conn, CURLE_FTP_BAD_FILE_LIST); + return bufflen; + } + finfo->b_data[10] = 0; /* terminate permissions */ + perm = ftp_pl_get_permission(finfo->b_data + parser->item_offset); + if(perm & FTP_LP_MALFORMATED_PERM) { + PL_ERROR(conn, CURLE_FTP_BAD_FILE_LIST); + return bufflen; + } + parser->file_data->flags |= CURLFINFOFLAG_KNOWN_PERM; + parser->file_data->perm = perm; + parser->offsets.perm = parser->item_offset; + + parser->item_length = 0; + parser->state.UNIX.main = PL_UNIX_HLINKS; + parser->state.UNIX.sub.hlinks = PL_UNIX_HLINKS_PRESPACE; + } + break; + case PL_UNIX_HLINKS: + switch(parser->state.UNIX.sub.hlinks) { + case PL_UNIX_HLINKS_PRESPACE: + if(c != ' ') { + if(c >= '0' && c <= '9') { + parser->item_offset = finfo->b_used - 1; + parser->item_length = 1; + parser->state.UNIX.sub.hlinks = PL_UNIX_HLINKS_NUMBER; + } + else { + PL_ERROR(conn, CURLE_FTP_BAD_FILE_LIST); + return bufflen; + } + } + break; + case PL_UNIX_HLINKS_NUMBER: + parser->item_length ++; + if(c == ' ') { + char *p; + long int hlinks; + finfo->b_data[parser->item_offset + parser->item_length - 1] = 0; + hlinks = strtol(finfo->b_data + parser->item_offset, &p, 10); + if(p[0] == '\0' && hlinks != LONG_MAX && hlinks != LONG_MIN) { + parser->file_data->flags |= CURLFINFOFLAG_KNOWN_HLINKCOUNT; + parser->file_data->hardlinks = hlinks; + } + parser->item_length = 0; + parser->item_offset = 0; + parser->state.UNIX.main = PL_UNIX_USER; + parser->state.UNIX.sub.user = PL_UNIX_USER_PRESPACE; + } + else if(c < '0' || c > '9') { + PL_ERROR(conn, CURLE_FTP_BAD_FILE_LIST); + return bufflen; + } + break; + } + break; + case PL_UNIX_USER: + switch(parser->state.UNIX.sub.user) { + case PL_UNIX_USER_PRESPACE: + if(c != ' ') { + parser->item_offset = finfo->b_used - 1; + parser->item_length = 1; + parser->state.UNIX.sub.user = PL_UNIX_USER_PARSING; + } + break; + case PL_UNIX_USER_PARSING: + parser->item_length++; + if(c == ' ') { + finfo->b_data[parser->item_offset + parser->item_length - 1] = 0; + parser->offsets.user = parser->item_offset; + parser->state.UNIX.main = PL_UNIX_GROUP; + parser->state.UNIX.sub.group = PL_UNIX_GROUP_PRESPACE; + parser->item_offset = 0; + parser->item_length = 0; + } + break; + } + break; + case PL_UNIX_GROUP: + switch(parser->state.UNIX.sub.group) { + case PL_UNIX_GROUP_PRESPACE: + if(c != ' ') { + parser->item_offset = finfo->b_used - 1; + parser->item_length = 1; + parser->state.UNIX.sub.group = PL_UNIX_GROUP_NAME; + } + break; + case PL_UNIX_GROUP_NAME: + parser->item_length++; + if(c == ' ') { + finfo->b_data[parser->item_offset + parser->item_length - 1] = 0; + parser->offsets.group = parser->item_offset; + parser->state.UNIX.main = PL_UNIX_SIZE; + parser->state.UNIX.sub.size = PL_UNIX_SIZE_PRESPACE; + parser->item_offset = 0; + parser->item_length = 0; + } + break; + } + break; + case PL_UNIX_SIZE: + switch(parser->state.UNIX.sub.size) { + case PL_UNIX_SIZE_PRESPACE: + if(c != ' ') { + if(c >= '0' && c <= '9') { + parser->item_offset = finfo->b_used - 1; + parser->item_length = 1; + parser->state.UNIX.sub.size = PL_UNIX_SIZE_NUMBER; + } + else { + PL_ERROR(conn, CURLE_FTP_BAD_FILE_LIST); + return bufflen; + } + } + break; + case PL_UNIX_SIZE_NUMBER: + parser->item_length++; + if(c == ' ') { + char *p; + curl_off_t fsize; + finfo->b_data[parser->item_offset + parser->item_length - 1] = 0; + fsize = curlx_strtoofft(finfo->b_data+parser->item_offset, &p, 10); + if(p[0] == '\0' && fsize != CURL_OFF_T_MAX && + fsize != CURL_OFF_T_MIN) { + parser->file_data->flags |= CURLFINFOFLAG_KNOWN_SIZE; + parser->file_data->size = fsize; + } + parser->item_length = 0; + parser->item_offset = 0; + parser->state.UNIX.main = PL_UNIX_TIME; + parser->state.UNIX.sub.time = PL_UNIX_TIME_PREPART1; + } + else if (!ISDIGIT(c)) { + PL_ERROR(conn, CURLE_FTP_BAD_FILE_LIST); + return bufflen; + } + break; + } + break; + case PL_UNIX_TIME: + switch(parser->state.UNIX.sub.time) { + case PL_UNIX_TIME_PREPART1: + if(c != ' ') { + if(ISALNUM(c)) { + parser->item_offset = finfo->b_used -1; + parser->item_length = 1; + parser->state.UNIX.sub.time = PL_UNIX_TIME_PART1; + } + else { + PL_ERROR(conn, CURLE_FTP_BAD_FILE_LIST); + return bufflen; + } + } + break; + case PL_UNIX_TIME_PART1: + parser->item_length++; + if(c == ' ') { + parser->state.UNIX.sub.time = PL_UNIX_TIME_PREPART2; + } + else if(!ISALNUM(c) && c != '.') { + PL_ERROR(conn, CURLE_FTP_BAD_FILE_LIST); + return bufflen; + } + break; + case PL_UNIX_TIME_PREPART2: + parser->item_length++; + if(c != ' ') { + if(ISALNUM(c)) { + parser->state.UNIX.sub.time = PL_UNIX_TIME_PART2; + } + else { + PL_ERROR(conn, CURLE_FTP_BAD_FILE_LIST); + return bufflen; + } + } + break; + case PL_UNIX_TIME_PART2: + parser->item_length++; + if(c == ' ') { + parser->state.UNIX.sub.time = PL_UNIX_TIME_PREPART3; + } + else if(!ISALNUM(c) && c != '.') { + PL_ERROR(conn, CURLE_FTP_BAD_FILE_LIST); + return bufflen; + } + break; + case PL_UNIX_TIME_PREPART3: + parser->item_length++; + if(c != ' ') { + if(ISALNUM(c)) { + parser->state.UNIX.sub.time = PL_UNIX_TIME_PART3; + } + else { + PL_ERROR(conn, CURLE_FTP_BAD_FILE_LIST); + return bufflen; + } + } + break; + case PL_UNIX_TIME_PART3: + parser->item_length++; + if(c == ' ') { + finfo->b_data[parser->item_offset + parser->item_length -1] = 0; + parser->offsets.time = parser->item_offset; + if(ftp_pl_gettime(parser, finfo->b_data + parser->item_offset)) { + parser->file_data->flags |= CURLFINFOFLAG_KNOWN_TIME; + } + if(finfo->filetype == CURLFILETYPE_SYMLINK) { + parser->state.UNIX.main = PL_UNIX_SYMLINK; + parser->state.UNIX.sub.symlink = PL_UNIX_SYMLINK_PRESPACE; + } + else { + parser->state.UNIX.main = PL_UNIX_FILENAME; + parser->state.UNIX.sub.filename = PL_UNIX_FILENAME_PRESPACE; + } + } + else if(!ISALNUM(c) && c != '.' && c != ':') { + PL_ERROR(conn, CURLE_FTP_BAD_FILE_LIST); + return bufflen; + } + break; + } + break; + case PL_UNIX_FILENAME: + switch(parser->state.UNIX.sub.filename) { + case PL_UNIX_FILENAME_PRESPACE: + if(c != ' ') { + parser->item_offset = finfo->b_used - 1; + parser->item_length = 1; + parser->state.UNIX.sub.filename = PL_UNIX_FILENAME_NAME; + } + break; + case PL_UNIX_FILENAME_NAME: + parser->item_length++; + if(c == '\r') { + parser->item_length--; + parser->state.UNIX.sub.filename = PL_UNIX_FILENAME_WINDOWSEOL; + } + else if(c == '\n') { + finfo->b_data[parser->item_offset + parser->item_length - 1] = 0; + parser->offsets.filename = parser->item_offset; + parser->state.UNIX.main = PL_UNIX_FILETYPE; + rc = ftp_pl_insert_finfo(conn, finfo); + if(rc) { + PL_ERROR(conn, rc); + return bufflen; + } + } + break; + case PL_UNIX_FILENAME_WINDOWSEOL: + if(c == '\n') { + finfo->b_data[parser->item_offset + parser->item_length] = 0; + parser->offsets.filename = parser->item_offset; + parser->state.UNIX.main = PL_UNIX_FILETYPE; + rc = ftp_pl_insert_finfo(conn, finfo); + if(rc) { + PL_ERROR(conn, rc); + return bufflen; + } + } + else { + PL_ERROR(conn, CURLE_FTP_BAD_FILE_LIST); + return bufflen; + } + break; + } + break; + case PL_UNIX_SYMLINK: + switch(parser->state.UNIX.sub.symlink) { + case PL_UNIX_SYMLINK_PRESPACE: + if(c != ' ') { + parser->item_offset = finfo->b_used - 1; + parser->item_length = 1; + parser->state.UNIX.sub.symlink = PL_UNIX_SYMLINK_NAME; + } + break; + case PL_UNIX_SYMLINK_NAME: + parser->item_length++; + if(c == ' ') { + parser->state.UNIX.sub.symlink = PL_UNIX_SYMLINK_PRETARGET1; + } + else if(c == '\r' || c == '\n') { + PL_ERROR(conn, CURLE_FTP_BAD_FILE_LIST); + return bufflen; + } + break; + case PL_UNIX_SYMLINK_PRETARGET1: + parser->item_length++; + if(c == '-') { + parser->state.UNIX.sub.symlink = PL_UNIX_SYMLINK_PRETARGET2; + } + else if(c == '\r' || c == '\n') { + PL_ERROR(conn, CURLE_FTP_BAD_FILE_LIST); + return bufflen; + } + else { + parser->state.UNIX.sub.symlink = PL_UNIX_SYMLINK_NAME; + } + break; + case PL_UNIX_SYMLINK_PRETARGET2: + parser->item_length++; + if(c == '>') { + parser->state.UNIX.sub.symlink = PL_UNIX_SYMLINK_PRETARGET3; + } + else if(c == '\r' || c == '\n') { + PL_ERROR(conn, CURLE_FTP_BAD_FILE_LIST); + return bufflen; + } + else { + parser->state.UNIX.sub.symlink = PL_UNIX_SYMLINK_NAME; + } + break; + case PL_UNIX_SYMLINK_PRETARGET3: + parser->item_length++; + if(c == ' ') { + parser->state.UNIX.sub.symlink = PL_UNIX_SYMLINK_PRETARGET4; + /* now place where is symlink following */ + finfo->b_data[parser->item_offset + parser->item_length - 4] = 0; + parser->offsets.filename = parser->item_offset; + parser->item_length = 0; + parser->item_offset = 0; + } + else if(c == '\r' || c == '\n') { + PL_ERROR(conn, CURLE_FTP_BAD_FILE_LIST); + return bufflen; + } + else { + parser->state.UNIX.sub.symlink = PL_UNIX_SYMLINK_NAME; + } + break; + case PL_UNIX_SYMLINK_PRETARGET4: + if(c != '\r' && c != '\n') { + parser->state.UNIX.sub.symlink = PL_UNIX_SYMLINK_TARGET; + parser->item_offset = finfo->b_used - 1; + parser->item_length = 1; + } + else { + PL_ERROR(conn, CURLE_FTP_BAD_FILE_LIST); + return bufflen; + } + break; + case PL_UNIX_SYMLINK_TARGET: + parser->item_length ++; + if(c == '\r') { + parser->item_length --; + parser->state.UNIX.sub.symlink = PL_UNIX_SYMLINK_WINDOWSEOL; + } + else if(c == '\n') { + finfo->b_data[parser->item_offset + parser->item_length - 1] = 0; + parser->offsets.symlink_target = parser->item_offset; + rc = ftp_pl_insert_finfo(conn, finfo); + if(rc) { + PL_ERROR(conn, rc); + return bufflen; + } + parser->state.UNIX.main = PL_UNIX_FILETYPE; + } + break; + case PL_UNIX_SYMLINK_WINDOWSEOL: + if(c == '\n') { + finfo->b_data[parser->item_offset + parser->item_length - 1] = 0; + parser->offsets.symlink_target = parser->item_offset; + rc = ftp_pl_insert_finfo(conn, finfo); + if(rc) { + PL_ERROR(conn, rc); + return bufflen; + } + parser->state.UNIX.main = PL_UNIX_FILETYPE; + } + else { + PL_ERROR(conn, CURLE_FTP_BAD_FILE_LIST); + return bufflen; + } + break; + } + break; + } + break; + case OS_TYPE_WIN_NT: + switch(parser->state.NT.main) { + case PL_WINNT_DATE: + parser->item_length++; + if(parser->item_length < 9) { + if(!strchr("0123456789-", c)) { /* only simple control */ + PL_ERROR(conn, CURLE_FTP_BAD_FILE_LIST); + return bufflen; + } + } + else if(parser->item_length == 9) { + if(c == ' ') { + parser->state.NT.main = PL_WINNT_TIME; + parser->state.NT.sub.time = PL_WINNT_TIME_PRESPACE; + } + else { + PL_ERROR(conn, CURLE_FTP_BAD_FILE_LIST); + return bufflen; + } + } + else { + PL_ERROR(conn, CURLE_FTP_BAD_FILE_LIST); + return bufflen; + } + break; + case PL_WINNT_TIME: + parser->item_length++; + switch(parser->state.NT.sub.time) { + case PL_WINNT_TIME_PRESPACE: + if(!ISSPACE(c)) { + parser->state.NT.sub.time = PL_WINNT_TIME_TIME; + } + break; + case PL_WINNT_TIME_TIME: + if(c == ' ') { + parser->offsets.time = parser->item_offset; + finfo->b_data[parser->item_offset + parser->item_length -1] = 0; + parser->state.NT.main = PL_WINNT_DIRORSIZE; + parser->state.NT.sub.dirorsize = PL_WINNT_DIRORSIZE_PRESPACE; + parser->item_length = 0; + } + else if(!strchr("APM0123456789:", c)) { + PL_ERROR(conn, CURLE_FTP_BAD_FILE_LIST); + return bufflen; + } + break; + } + break; + case PL_WINNT_DIRORSIZE: + switch(parser->state.NT.sub.dirorsize) { + case PL_WINNT_DIRORSIZE_PRESPACE: + if(c == ' ') { + + } + else { + parser->item_offset = finfo->b_used - 1; + parser->item_length = 1; + parser->state.NT.sub.dirorsize = PL_WINNT_DIRORSIZE_CONTENT; + } + break; + case PL_WINNT_DIRORSIZE_CONTENT: + parser->item_length ++; + if(c == ' ') { + finfo->b_data[parser->item_offset + parser->item_length - 1] = 0; + if(strcmp("", finfo->b_data + parser->item_offset) == 0) { + finfo->filetype = CURLFILETYPE_DIRECTORY; + finfo->size = 0; + } + else { + char *endptr; + finfo->size = curlx_strtoofft(finfo->b_data + parser->item_offset, + &endptr, 10); + if(!*endptr) { + if(finfo->size == CURL_OFF_T_MAX || + finfo->size == CURL_OFF_T_MIN) { + if(errno == ERANGE) { + PL_ERROR(conn, CURLE_FTP_BAD_FILE_LIST); + return bufflen; + } + } + } + else { + PL_ERROR(conn, CURLE_FTP_BAD_FILE_LIST); + return bufflen; + } + /* correct file type */ + parser->file_data->filetype = CURLFILETYPE_FILE; + } + + parser->file_data->flags |= CURLFINFOFLAG_KNOWN_SIZE; + parser->item_length = 0; + parser->state.NT.main = PL_WINNT_FILENAME; + parser->state.NT.sub.filename = PL_WINNT_FILENAME_PRESPACE; + } + break; + } + break; + case PL_WINNT_FILENAME: + switch (parser->state.NT.sub.filename) { + case PL_WINNT_FILENAME_PRESPACE: + if(c != ' ') { + parser->item_offset = finfo->b_used -1; + parser->item_length = 1; + parser->state.NT.sub.filename = PL_WINNT_FILENAME_CONTENT; + } + break; + case PL_WINNT_FILENAME_CONTENT: + parser->item_length++; + if(c == '\r') { + parser->state.NT.sub.filename = PL_WINNT_FILENAME_WINEOL; + finfo->b_data[finfo->b_used - 1] = 0; + } + else if(c == '\n') { + parser->offsets.filename = parser->item_offset; + finfo->b_data[finfo->b_used - 1] = 0; + parser->offsets.filename = parser->item_offset; + rc = ftp_pl_insert_finfo(conn, finfo); + if(rc) { + PL_ERROR(conn, rc); + return bufflen; + } + parser->state.NT.main = PL_WINNT_DATE; + parser->state.NT.sub.filename = PL_WINNT_FILENAME_PRESPACE; + } + break; + case PL_WINNT_FILENAME_WINEOL: + if(c == '\n') { + parser->offsets.filename = parser->item_offset; + rc = ftp_pl_insert_finfo(conn, finfo); + if(rc) { + PL_ERROR(conn, rc); + return bufflen; + } + parser->state.NT.main = PL_WINNT_DATE; + parser->state.NT.sub.filename = PL_WINNT_FILENAME_PRESPACE; + } + else { + PL_ERROR(conn, CURLE_FTP_BAD_FILE_LIST); + return bufflen; + } + break; + } + break; + } + break; + default: + return bufflen+1; + } + + i++; + } + + return bufflen; +} diff --git a/mobicore/common/curl/lib/ftplistparser.h b/mobicore/common/curl/lib/ftplistparser.h new file mode 100644 index 0000000000000000000000000000000000000000..67a06c296d68d432549aae57baa9495da4a09b52 --- /dev/null +++ b/mobicore/common/curl/lib/ftplistparser.h @@ -0,0 +1,39 @@ +#ifndef HEADER_CURL_FTPLISTPARSER_H +#define HEADER_CURL_FTPLISTPARSER_H +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) 1998 - 2010, Daniel Stenberg, , et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at http://curl.haxx.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ***************************************************************************/ + +#include + +/* WRITEFUNCTION callback for parsing LIST responses */ +size_t Curl_ftp_parselist(char *buffer, size_t size, size_t nmemb, + void *connptr); + +struct ftp_parselist_data; /* defined inside ftplibparser.c */ + +CURLcode Curl_ftp_parselist_geterror(struct ftp_parselist_data *pl_data); + +struct ftp_parselist_data *Curl_ftp_parselist_data_alloc(void); + +void Curl_ftp_parselist_data_free(struct ftp_parselist_data **pl_data); + +#endif /* HEADER_CURL_FTPLISTPARSER_H */ diff --git a/mobicore/common/curl/lib/getenv.c b/mobicore/common/curl/lib/getenv.c new file mode 100644 index 0000000000000000000000000000000000000000..36fbb75832efaa3de9a3c4b325369880310b5756 --- /dev/null +++ b/mobicore/common/curl/lib/getenv.c @@ -0,0 +1,65 @@ +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) 1998 - 2009, Daniel Stenberg, , et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at http://curl.haxx.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ***************************************************************************/ + +#include "setup.h" + +#include +#include +#include + +#ifdef __VMS +#include +#endif + +#include +#include "curl_memory.h" + +#include "memdebug.h" + +static +char *GetEnv(const char *variable) +{ +#ifdef _WIN32_WCE + return NULL; +#else +#ifdef WIN32 + char env[MAX_PATH]; /* MAX_PATH is from windef.h */ + char *temp = getenv(variable); + env[0] = '\0'; + if(temp != NULL) + ExpandEnvironmentStrings(temp, env, sizeof(env)); + return (env[0] != '\0')?strdup(env):NULL; +#else + char *env = getenv(variable); +#ifdef __VMS + if(env && strcmp("HOME",variable) == 0) + env = decc_translate_vms(env); +#endif + return (env && env[0])?strdup(env):NULL; +#endif +#endif +} + +char *curl_getenv(const char *v) +{ + return GetEnv(v); +} diff --git a/mobicore/common/curl/lib/getinfo.c b/mobicore/common/curl/lib/getinfo.c new file mode 100644 index 0000000000000000000000000000000000000000..946686281979d8e90857658d379d1a0db128b03f --- /dev/null +++ b/mobicore/common/curl/lib/getinfo.c @@ -0,0 +1,283 @@ +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) 1998 - 2010, Daniel Stenberg, , et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at http://curl.haxx.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ***************************************************************************/ + +#include "setup.h" + +#include + +#include "urldata.h" +#include "getinfo.h" + +#include +#include +#include +#include +#include "curl_memory.h" +#include "sslgen.h" +#include "connect.h" /* Curl_getconnectinfo() */ +#include "progress.h" + +/* Make this the last #include */ +#include "memdebug.h" + +/* + * This is supposed to be called in the beginning of a perform() session + * and should reset all session-info variables + */ +CURLcode Curl_initinfo(struct SessionHandle *data) +{ + struct Progress *pro = &data->progress; + struct PureInfo *info =&data->info; + + pro->t_nslookup = 0; + pro->t_connect = 0; + pro->t_pretransfer = 0; + pro->t_starttransfer = 0; + pro->timespent = 0; + pro->t_redirect = 0; + + info->httpcode = 0; + info->httpversion=0; + info->filetime=-1; /* -1 is an illegal time and thus means unknown */ + + if(info->contenttype) + free(info->contenttype); + info->contenttype = NULL; + + info->header_size = 0; + info->request_size = 0; + info->numconnects = 0; + + info->conn_primary_ip[0] = '\0'; + info->conn_local_ip[0] = '\0'; + info->conn_primary_port = 0; + info->conn_local_port = 0; + + return CURLE_OK; +} + +CURLcode Curl_getinfo(struct SessionHandle *data, CURLINFO info, ...) +{ + va_list arg; + long *param_longp=NULL; + double *param_doublep=NULL; + char **param_charp=NULL; + struct curl_slist **param_slistp=NULL; + int type; + curl_socket_t sockfd; + + union { + struct curl_certinfo * to_certinfo; + struct curl_slist * to_slist; + } ptr; + + if(!data) + return CURLE_BAD_FUNCTION_ARGUMENT; + + va_start(arg, info); + + type = CURLINFO_TYPEMASK & (int)info; + switch(type) { + case CURLINFO_STRING: + param_charp = va_arg(arg, char **); + if(NULL == param_charp) + return CURLE_BAD_FUNCTION_ARGUMENT; + break; + case CURLINFO_LONG: + param_longp = va_arg(arg, long *); + if(NULL == param_longp) + return CURLE_BAD_FUNCTION_ARGUMENT; + break; + case CURLINFO_DOUBLE: + param_doublep = va_arg(arg, double *); + if(NULL == param_doublep) + return CURLE_BAD_FUNCTION_ARGUMENT; + break; + case CURLINFO_SLIST: + param_slistp = va_arg(arg, struct curl_slist **); + if(NULL == param_slistp) + return CURLE_BAD_FUNCTION_ARGUMENT; + break; + default: + return CURLE_BAD_FUNCTION_ARGUMENT; + } + + switch(info) { + case CURLINFO_EFFECTIVE_URL: + *param_charp = data->change.url?data->change.url:(char *)""; + break; + case CURLINFO_RESPONSE_CODE: + *param_longp = data->info.httpcode; + break; + case CURLINFO_HTTP_CONNECTCODE: + *param_longp = data->info.httpproxycode; + break; + case CURLINFO_FILETIME: + *param_longp = data->info.filetime; + break; + case CURLINFO_HEADER_SIZE: + *param_longp = data->info.header_size; + break; + case CURLINFO_REQUEST_SIZE: + *param_longp = data->info.request_size; + break; + case CURLINFO_TOTAL_TIME: + *param_doublep = data->progress.timespent; + break; + case CURLINFO_NAMELOOKUP_TIME: + *param_doublep = data->progress.t_nslookup; + break; + case CURLINFO_CONNECT_TIME: + *param_doublep = data->progress.t_connect; + break; + case CURLINFO_APPCONNECT_TIME: + *param_doublep = data->progress.t_appconnect; + break; + case CURLINFO_PRETRANSFER_TIME: + *param_doublep = data->progress.t_pretransfer; + break; + case CURLINFO_STARTTRANSFER_TIME: + *param_doublep = data->progress.t_starttransfer; + break; + case CURLINFO_SIZE_UPLOAD: + *param_doublep = (double)data->progress.uploaded; + break; + case CURLINFO_SIZE_DOWNLOAD: + *param_doublep = (double)data->progress.downloaded; + break; + case CURLINFO_SPEED_DOWNLOAD: + *param_doublep = (double)data->progress.dlspeed; + break; + case CURLINFO_SPEED_UPLOAD: + *param_doublep = (double)data->progress.ulspeed; + break; + case CURLINFO_SSL_VERIFYRESULT: + *param_longp = data->set.ssl.certverifyresult; + break; + case CURLINFO_CONTENT_LENGTH_DOWNLOAD: + *param_doublep = (data->progress.flags & PGRS_DL_SIZE_KNOWN)? + (double)data->progress.size_dl:-1; + break; + case CURLINFO_CONTENT_LENGTH_UPLOAD: + *param_doublep = (data->progress.flags & PGRS_UL_SIZE_KNOWN)? + (double)data->progress.size_ul:-1; + break; + case CURLINFO_REDIRECT_TIME: + *param_doublep = data->progress.t_redirect; + break; + case CURLINFO_REDIRECT_COUNT: + *param_longp = data->set.followlocation; + break; + case CURLINFO_CONTENT_TYPE: + *param_charp = data->info.contenttype; + break; + case CURLINFO_PRIVATE: + *param_charp = (char *) data->set.private_data; + break; + case CURLINFO_HTTPAUTH_AVAIL: + *param_longp = data->info.httpauthavail; + break; + case CURLINFO_PROXYAUTH_AVAIL: + *param_longp = data->info.proxyauthavail; + break; + case CURLINFO_OS_ERRNO: + *param_longp = data->state.os_errno; + break; + case CURLINFO_NUM_CONNECTS: + *param_longp = data->info.numconnects; + break; + case CURLINFO_SSL_ENGINES: + *param_slistp = Curl_ssl_engines_list(data); + break; + case CURLINFO_COOKIELIST: + *param_slistp = Curl_cookie_list(data); + break; + case CURLINFO_FTP_ENTRY_PATH: + /* Return the entrypath string from the most recent connection. + This pointer was copied from the connectdata structure by FTP. + The actual string may be free()ed by subsequent libcurl calls so + it must be copied to a safer area before the next libcurl call. + Callers must never free it themselves. */ + *param_charp = data->state.most_recent_ftp_entrypath; + break; + case CURLINFO_LASTSOCKET: + sockfd = Curl_getconnectinfo(data, NULL); + + /* note: this is not a good conversion for systems with 64 bit sockets and + 32 bit longs */ + if(sockfd != CURL_SOCKET_BAD) + *param_longp = (long)sockfd; + else + /* this interface is documented to return -1 in case of badness, which + may not be the same as the CURL_SOCKET_BAD value */ + *param_longp = -1; + break; + case CURLINFO_REDIRECT_URL: + /* Return the URL this request would have been redirected to if that + option had been enabled! */ + *param_charp = data->info.wouldredirect; + break; + case CURLINFO_PRIMARY_IP: + /* Return the ip address of the most recent (primary) connection */ + *param_charp = data->info.conn_primary_ip; + break; + case CURLINFO_PRIMARY_PORT: + /* Return the (remote) port of the most recent (primary) connection */ + *param_longp = data->info.conn_primary_port; + break; + case CURLINFO_LOCAL_IP: + /* Return the source/local ip address of the most recent (primary) + connection */ + *param_charp = data->info.conn_local_ip; + break; + case CURLINFO_LOCAL_PORT: + /* Return the local port of the most recent (primary) connection */ + *param_longp = data->info.conn_local_port; + break; + case CURLINFO_CERTINFO: + /* Return the a pointer to the certinfo struct. Not really an slist + pointer but we can pretend it is here */ + ptr.to_certinfo = &data->info.certs; + *param_slistp = ptr.to_slist; + break; + case CURLINFO_CONDITION_UNMET: + /* return if the condition prevented the document to get transfered */ + *param_longp = data->info.timecond; + break; + case CURLINFO_RTSP_SESSION_ID: + *param_charp = data->set.str[STRING_RTSP_SESSION_ID]; + break; + case CURLINFO_RTSP_CLIENT_CSEQ: + *param_longp = data->state.rtsp_next_client_CSeq; + break; + case CURLINFO_RTSP_SERVER_CSEQ: + *param_longp = data->state.rtsp_next_server_CSeq; + break; + case CURLINFO_RTSP_CSEQ_RECV: + *param_longp = data->state.rtsp_CSeq_recv; + break; + + default: + return CURLE_BAD_FUNCTION_ARGUMENT; + } + return CURLE_OK; +} diff --git a/mobicore/common/curl/lib/getinfo.h b/mobicore/common/curl/lib/getinfo.h new file mode 100644 index 0000000000000000000000000000000000000000..3879ff73a86543ae172cb17f998809938c1aa843 --- /dev/null +++ b/mobicore/common/curl/lib/getinfo.h @@ -0,0 +1,27 @@ +#ifndef HEADER_CURL_GETINFO_H +#define HEADER_CURL_GETINFO_H +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) 1998 - 2010, Daniel Stenberg, , et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at http://curl.haxx.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ***************************************************************************/ +CURLcode Curl_getinfo(struct SessionHandle *data, CURLINFO info, ...); +CURLcode Curl_initinfo(struct SessionHandle *data); + +#endif /* HEADER_CURL_GETINFO_H */ diff --git a/mobicore/common/curl/lib/gopher.c b/mobicore/common/curl/lib/gopher.c new file mode 100644 index 0000000000000000000000000000000000000000..3d8fcffda530534fe85549e32c0cdb753915a202 --- /dev/null +++ b/mobicore/common/curl/lib/gopher.c @@ -0,0 +1,209 @@ +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) 1998 - 2010, Daniel Stenberg, , et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at http://curl.haxx.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ***************************************************************************/ + +#include "setup.h" + +#ifndef CURL_DISABLE_GOPHER + +/* -- WIN32 approved -- */ +#include +#include +#include +#include +#include + +#ifdef WIN32 +#include +#include +#else +#ifdef HAVE_SYS_SOCKET_H +#include +#endif +#include +#ifdef HAVE_SYS_TIME_H +#include +#endif +#ifdef HAVE_UNISTD_H +#include +#endif +#include +#ifdef HAVE_ARPA_INET_H +#include +#endif +#ifdef HAVE_NET_IF_H +#include +#endif +#ifdef HAVE_SYS_IOCTL_H +#include +#endif + +#ifdef HAVE_SYS_PARAM_H +#include +#endif + +#ifdef HAVE_SYS_SELECT_H +#include +#endif + + +#endif + +#include "urldata.h" +#include +#include "transfer.h" +#include "sendf.h" + +#include "progress.h" +#include "strequal.h" +#include "gopher.h" +#include "rawstr.h" +#include "select.h" +#include "url.h" +#include "warnless.h" + +#define _MPRINTF_REPLACE /* use our functions only */ +#include + +/* The last #include file should be: */ +#include "memdebug.h" + + +/* + * Forward declarations. + */ + +static CURLcode gopher_do(struct connectdata *conn, bool *done); + +/* + * Gopher protocol handler. + * This is also a nice simple template to build off for simple + * connect-command-download protocols. + */ + +const struct Curl_handler Curl_handler_gopher = { + "GOPHER", /* scheme */ + ZERO_NULL, /* setup_connection */ + gopher_do, /* do_it */ + ZERO_NULL, /* done */ + ZERO_NULL, /* do_more */ + ZERO_NULL, /* connect_it */ + ZERO_NULL, /* connecting */ + ZERO_NULL, /* doing */ + ZERO_NULL, /* proto_getsock */ + ZERO_NULL, /* doing_getsock */ + ZERO_NULL, /* perform_getsock */ + ZERO_NULL, /* disconnect */ + PORT_GOPHER, /* defport */ + PROT_GOPHER /* protocol */ +}; + +static CURLcode gopher_do(struct connectdata *conn, bool *done) +{ + CURLcode result=CURLE_OK; + struct SessionHandle *data=conn->data; + curl_socket_t sockfd = conn->sock[FIRSTSOCKET]; + + curl_off_t *bytecount = &data->req.bytecount; + char *path = data->state.path; + char *sel; + char *sel_org = NULL; + ssize_t amount, k; + + *done = TRUE; /* unconditionally */ + + /* Create selector. Degenerate cases: / and /1 => convert to "" */ + if (strlen(path) <= 2) + sel = (char *)""; + else { + char *newp; + size_t j, i; + int len; + + /* Otherwise, drop / and the first character (i.e., item type) ... */ + newp = path; + newp+=2; + + /* ... then turn ? into TAB for search servers, Veronica, etc. ... */ + j = strlen(newp); + for(i=0; i, et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at http://curl.haxx.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ***************************************************************************/ + +#ifndef CURL_DISABLE_GOPHER +extern const struct Curl_handler Curl_handler_gopher; +#endif + +#endif /* HEADER_CURL_GOPHER_H */ diff --git a/mobicore/common/curl/lib/gtls.c b/mobicore/common/curl/lib/gtls.c new file mode 100644 index 0000000000000000000000000000000000000000..845dbbb12fb92a58646db8b2799628268eb83ccd --- /dev/null +++ b/mobicore/common/curl/lib/gtls.c @@ -0,0 +1,959 @@ +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) 1998 - 2010, Daniel Stenberg, , et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at http://curl.haxx.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ***************************************************************************/ + +/* + * Source file for all GnuTLS-specific code for the TLS/SSL layer. No code + * but sslgen.c should ever call or use these functions. + * + * Note: don't use the GnuTLS' *_t variable type names in this source code, + * since they were not present in 1.0.X. + */ + +#include "setup.h" +#ifdef USE_GNUTLS +#include +#include +#include + +#include +#include +#include +#ifdef HAVE_SYS_SOCKET_H +#include +#endif + +#include "urldata.h" +#include "sendf.h" +#include "inet_pton.h" +#include "gtls.h" +#include "sslgen.h" +#include "parsedate.h" +#include "connect.h" /* for the connect timeout */ +#include "select.h" +#include "rawstr.h" + +#define _MPRINTF_REPLACE /* use our functions only */ +#include +#include "curl_memory.h" +/* The last #include file should be: */ +#include "memdebug.h" + +/* + Some hackish cast macros based on: + http://library.gnome.org/devel/glib/unstable/glib-Type-Conversion-Macros.html +*/ +#ifndef GNUTLS_POINTER_TO_INT_CAST +#define GNUTLS_POINTER_TO_INT_CAST(p) ((int) (long) (p)) +#endif +#ifndef GNUTLS_INT_TO_POINTER_CAST +#define GNUTLS_INT_TO_POINTER_CAST(i) ((void*) (long) (i)) +#endif + +/* Enable GnuTLS debugging by defining GTLSDEBUG */ +/*#define GTLSDEBUG */ + +#ifdef GTLSDEBUG +static void tls_log_func(int level, const char *str) +{ + fprintf(stderr, "|<%d>| %s", level, str); +} +#endif +static bool gtls_inited = FALSE; + +/* + * Custom push and pull callback functions used by GNU TLS to read and write + * to the socket. These functions are simple wrappers to send() and recv() + * (although here using the sread/swrite macros as defined by setup_once.h). + * We use custom functions rather than the GNU TLS defaults because it allows + * us to get specific about the fourth "flags" argument, and to use arbitrary + * private data with gnutls_transport_set_ptr if we wish. + * + * When these custom push and pull callbacks fail, GNU TLS checks its own + * session-specific error variable, and when not set also its own global + * errno variable, in order to take appropriate action. GNU TLS does not + * require that the transport is actually a socket. This implies that for + * Windows builds these callbacks should ideally set the session-specific + * error variable using function gnutls_transport_set_errno or as a last + * resort global errno variable using gnutls_transport_set_global_errno, + * with a transport agnostic error value. This implies that some winsock + * error translation must take place in these callbacks. + */ + +#ifdef USE_WINSOCK +# define gtls_EINTR 4 +# define gtls_EIO 5 +# define gtls_EAGAIN 11 +static int gtls_mapped_sockerrno(void) +{ + switch(SOCKERRNO) { + case WSAEWOULDBLOCK: + return gtls_EAGAIN; + case WSAEINTR: + return gtls_EINTR; + default: + break; + } + return gtls_EIO; +} +#endif + +static ssize_t Curl_gtls_push(void *s, const void *buf, size_t len) +{ + ssize_t ret = swrite(GNUTLS_POINTER_TO_INT_CAST(s), buf, len); +#ifdef USE_WINSOCK + if(ret < 0) + gnutls_transport_set_global_errno(gtls_mapped_sockerrno()); +#endif + return ret; +} + +static ssize_t Curl_gtls_pull(void *s, void *buf, size_t len) +{ + ssize_t ret = sread(GNUTLS_POINTER_TO_INT_CAST(s), buf, len); +#ifdef USE_WINSOCK + if(ret < 0) + gnutls_transport_set_global_errno(gtls_mapped_sockerrno()); +#endif + return ret; +} + +/* Curl_gtls_init() + * + * Global GnuTLS init, called from Curl_ssl_init(). This calls functions that + * are not thread-safe and thus this function itself is not thread-safe and + * must only be called from within curl_global_init() to keep the thread + * situation under control! + */ +int Curl_gtls_init(void) +{ + int ret = 1; + if(!gtls_inited) { + ret = gnutls_global_init()?0:1; +#ifdef GTLSDEBUG + gnutls_global_set_log_function(tls_log_func); + gnutls_global_set_log_level(2); +#endif + gtls_inited = TRUE; + } + return ret; +} + +int Curl_gtls_cleanup(void) +{ + if(gtls_inited) { + gnutls_global_deinit(); + gtls_inited = FALSE; + } + return 1; +} + +static void showtime(struct SessionHandle *data, + const char *text, + time_t stamp) +{ + struct tm *tm; +#ifdef HAVE_GMTIME_R + struct tm buffer; + tm = (struct tm *)gmtime_r(&stamp, &buffer); +#else + tm = gmtime(&stamp); +#endif + snprintf(data->state.buffer, + BUFSIZE, + "\t %s: %s, %02d %s %4d %02d:%02d:%02d GMT\n", + text, + Curl_wkday[tm->tm_wday?tm->tm_wday-1:6], + tm->tm_mday, + Curl_month[tm->tm_mon], + tm->tm_year + 1900, + tm->tm_hour, + tm->tm_min, + tm->tm_sec); + infof(data, "%s", data->state.buffer); +} + +static gnutls_datum load_file (const char *file) +{ + FILE *f; + gnutls_datum loaded_file = { NULL, 0 }; + long filelen; + void *ptr; + + if (!(f = fopen(file, "r"))) + return loaded_file; + if (fseek(f, 0, SEEK_END) != 0 + || (filelen = ftell(f)) < 0 + || fseek(f, 0, SEEK_SET) != 0 + || !(ptr = malloc((size_t)filelen))) + goto out; + if (fread(ptr, 1, (size_t)filelen, f) < (size_t)filelen) { + free(ptr); + goto out; + } + + loaded_file.data = ptr; + loaded_file.size = (unsigned int)filelen; +out: + fclose(f); + return loaded_file; +} + +static void unload_file(gnutls_datum data) { + free(data.data); +} + + +/* this function does a SSL/TLS (re-)handshake */ +static CURLcode handshake(struct connectdata *conn, + int sockindex, + bool duringconnect, + bool nonblocking) +{ + struct SessionHandle *data = conn->data; + struct ssl_connect_data *connssl = &conn->ssl[sockindex]; + gnutls_session session = conn->ssl[sockindex].session; + curl_socket_t sockfd = conn->sock[sockindex]; + long timeout_ms; + int rc; + int what; + + for(;;) { + /* check allowed time left */ + timeout_ms = Curl_timeleft(conn, NULL, duringconnect); + + if(timeout_ms < 0) { + /* no need to continue if time already is up */ + failf(data, "SSL connection timeout"); + return CURLE_OPERATION_TIMEDOUT; + } + + /* if ssl is expecting something, check if it's available. */ + if(connssl->connecting_state == ssl_connect_2_reading + || connssl->connecting_state == ssl_connect_2_writing) { + + curl_socket_t writefd = ssl_connect_2_writing== + connssl->connecting_state?sockfd:CURL_SOCKET_BAD; + curl_socket_t readfd = ssl_connect_2_reading== + connssl->connecting_state?sockfd:CURL_SOCKET_BAD; + + what = Curl_socket_ready(readfd, writefd, + nonblocking?0:(int)timeout_ms?1000:timeout_ms); + if(what < 0) { + /* fatal error */ + failf(data, "select/poll on SSL socket, errno: %d", SOCKERRNO); + return CURLE_SSL_CONNECT_ERROR; + } + else if(0 == what) { + if(nonblocking) + return CURLE_OK; + else if(timeout_ms) { + /* timeout */ + failf(data, "SSL connection timeout at %ld", timeout_ms); + return CURLE_OPERATION_TIMEDOUT; + } + } + /* socket is readable or writable */ + } + + rc = gnutls_handshake(session); + + if((rc == GNUTLS_E_AGAIN) || (rc == GNUTLS_E_INTERRUPTED)) { + connssl->connecting_state = + gnutls_record_get_direction(session)? + ssl_connect_2_writing:ssl_connect_2_reading; + if(nonblocking) + return CURLE_OK; + } + else if (rc < 0) { + failf(data, "gnutls_handshake() failed: %s", gnutls_strerror(rc)); + return CURLE_SSL_CONNECT_ERROR; + } + else { + /* Reset our connect state machine */ + connssl->connecting_state = ssl_connect_1; + return CURLE_OK; + } + } +} + +static gnutls_x509_crt_fmt do_file_type(const char *type) +{ + if(!type || !type[0]) + return GNUTLS_X509_FMT_PEM; + if(Curl_raw_equal(type, "PEM")) + return GNUTLS_X509_FMT_PEM; + if(Curl_raw_equal(type, "DER")) + return GNUTLS_X509_FMT_DER; + return -1; +} + +static CURLcode +gtls_connect_step1(struct connectdata *conn, + int sockindex) +{ + static const int cert_type_priority[] = { GNUTLS_CRT_X509, 0 }; + struct SessionHandle *data = conn->data; + gnutls_session session; + int rc; + void *ssl_sessionid; + size_t ssl_idsize; + bool sni = TRUE; /* default is SNI enabled */ +#ifdef ENABLE_IPV6 + struct in6_addr addr; +#else + struct in_addr addr; +#endif + + if(conn->ssl[sockindex].state == ssl_connection_complete) + /* to make us tolerant against being called more than once for the + same connection */ + return CURLE_OK; + + if(!gtls_inited) + Curl_gtls_init(); + + /* GnuTLS only supports SSLv3 and TLSv1 */ + if(data->set.ssl.version == CURL_SSLVERSION_SSLv2) { + failf(data, "GnuTLS does not support SSLv2"); + return CURLE_SSL_CONNECT_ERROR; + } + else if(data->set.ssl.version == CURL_SSLVERSION_SSLv3) + sni = FALSE; /* SSLv3 has no SNI */ + + /* allocate a cred struct */ + rc = gnutls_certificate_allocate_credentials(&conn->ssl[sockindex].cred); + if(rc != GNUTLS_E_SUCCESS) { + failf(data, "gnutls_cert_all_cred() failed: %s", gnutls_strerror(rc)); + return CURLE_SSL_CONNECT_ERROR; + } + + if(data->set.ssl.CAfile) { + /* set the trusted CA cert bundle file */ + gnutls_certificate_set_verify_flags(conn->ssl[sockindex].cred, + GNUTLS_VERIFY_ALLOW_X509_V1_CA_CRT); + + rc = gnutls_certificate_set_x509_trust_file(conn->ssl[sockindex].cred, + data->set.ssl.CAfile, + GNUTLS_X509_FMT_PEM); + if(rc < 0) { + infof(data, "error reading ca cert file %s (%s)\n", + data->set.ssl.CAfile, gnutls_strerror(rc)); + if(data->set.ssl.verifypeer) + return CURLE_SSL_CACERT_BADFILE; + } + else + infof(data, "found %d certificates in %s\n", + rc, data->set.ssl.CAfile); + } + + if(data->set.ssl.CRLfile) { + /* set the CRL list file */ + rc = gnutls_certificate_set_x509_crl_file(conn->ssl[sockindex].cred, + data->set.ssl.CRLfile, + GNUTLS_X509_FMT_PEM); + if(rc < 0) { + failf(data, "error reading crl file %s (%s)\n", + data->set.ssl.CRLfile, gnutls_strerror(rc)); + return CURLE_SSL_CRL_BADFILE; + } + else + infof(data, "found %d CRL in %s\n", + rc, data->set.ssl.CRLfile); + } + + /* Initialize TLS session as a client */ + rc = gnutls_init(&conn->ssl[sockindex].session, GNUTLS_CLIENT); + if(rc != GNUTLS_E_SUCCESS) { + failf(data, "gnutls_init() failed: %d", rc); + return CURLE_SSL_CONNECT_ERROR; + } + + /* convenient assign */ + session = conn->ssl[sockindex].session; + + if ((0 == Curl_inet_pton(AF_INET, conn->host.name, &addr)) && +#ifdef ENABLE_IPV6 + (0 == Curl_inet_pton(AF_INET6, conn->host.name, &addr)) && +#endif + sni && + (gnutls_server_name_set(session, GNUTLS_NAME_DNS, conn->host.name, + strlen(conn->host.name)) < 0)) + infof(data, "WARNING: failed to configure server name indication (SNI) " + "TLS extension\n"); + + /* Use default priorities */ + rc = gnutls_set_default_priority(session); + if(rc != GNUTLS_E_SUCCESS) + return CURLE_SSL_CONNECT_ERROR; + + if(data->set.ssl.version == CURL_SSLVERSION_SSLv3) { + static const int protocol_priority[] = { GNUTLS_SSL3, 0 }; + gnutls_protocol_set_priority(session, protocol_priority); + if(rc != GNUTLS_E_SUCCESS) + return CURLE_SSL_CONNECT_ERROR; + } + + /* Sets the priority on the certificate types supported by gnutls. Priority + is higher for types specified before others. After specifying the types + you want, you must append a 0. */ + rc = gnutls_certificate_type_set_priority(session, cert_type_priority); + if(rc != GNUTLS_E_SUCCESS) + return CURLE_SSL_CONNECT_ERROR; + + if(data->set.str[STRING_CERT]) { + if( gnutls_certificate_set_x509_key_file( + conn->ssl[sockindex].cred, + data->set.str[STRING_CERT], + data->set.str[STRING_KEY] ? + data->set.str[STRING_KEY] : data->set.str[STRING_CERT], + do_file_type(data->set.str[STRING_CERT_TYPE]) ) != GNUTLS_E_SUCCESS) { + failf(data, "error reading X.509 key or certificate file"); + return CURLE_SSL_CONNECT_ERROR; + } + } + + /* put the credentials to the current session */ + rc = gnutls_credentials_set(session, GNUTLS_CRD_CERTIFICATE, + conn->ssl[sockindex].cred); + + /* set the connection handle (file descriptor for the socket) */ + gnutls_transport_set_ptr(session, + GNUTLS_INT_TO_POINTER_CAST(conn->sock[sockindex])); + + /* register callback functions to send and receive data. */ + gnutls_transport_set_push_function(session, Curl_gtls_push); + gnutls_transport_set_pull_function(session, Curl_gtls_pull); + + /* lowat must be set to zero when using custom push and pull functions. */ + gnutls_transport_set_lowat(session, 0); + + /* This might be a reconnect, so we check for a session ID in the cache + to speed up things */ + + if(!Curl_ssl_getsessionid(conn, &ssl_sessionid, &ssl_idsize)) { + /* we got a session id, use it! */ + gnutls_session_set_data(session, ssl_sessionid, ssl_idsize); + + /* Informational message */ + infof (data, "SSL re-using session ID\n"); + } + + return CURLE_OK; +} + +static Curl_recv gtls_recv; +static Curl_send gtls_send; + +static CURLcode +gtls_connect_step3(struct connectdata *conn, + int sockindex) +{ + unsigned int cert_list_size; + const gnutls_datum *chainp; + unsigned int verify_status; + gnutls_x509_crt x509_cert,x509_issuer; + gnutls_datum issuerp; + char certbuf[256]; /* big enough? */ + size_t size; + unsigned int algo; + unsigned int bits; + time_t certclock; + const char *ptr; + struct SessionHandle *data = conn->data; + gnutls_session session = conn->ssl[sockindex].session; + int rc; + int incache; + void *ssl_sessionid; + + /* This function will return the peer's raw certificate (chain) as sent by + the peer. These certificates are in raw format (DER encoded for + X.509). In case of a X.509 then a certificate list may be present. The + first certificate in the list is the peer's certificate, following the + issuer's certificate, then the issuer's issuer etc. */ + + chainp = gnutls_certificate_get_peers(session, &cert_list_size); + if(!chainp) { + if(data->set.ssl.verifypeer || + data->set.ssl.verifyhost || + data->set.ssl.issuercert) { + failf(data, "failed to get server cert"); + return CURLE_PEER_FAILED_VERIFICATION; + } + infof(data, "\t common name: WARNING couldn't obtain\n"); + } + + if(data->set.ssl.verifypeer) { + /* This function will try to verify the peer's certificate and return its + status (trusted, invalid etc.). The value of status should be one or + more of the gnutls_certificate_status_t enumerated elements bitwise + or'd. To avoid denial of service attacks some default upper limits + regarding the certificate key size and chain size are set. To override + them use gnutls_certificate_set_verify_limits(). */ + + rc = gnutls_certificate_verify_peers2(session, &verify_status); + if(rc < 0) { + failf(data, "server cert verify failed: %d", rc); + return CURLE_SSL_CONNECT_ERROR; + } + + /* verify_status is a bitmask of gnutls_certificate_status bits */ + if(verify_status & GNUTLS_CERT_INVALID) { + if(data->set.ssl.verifypeer) { + failf(data, "server certificate verification failed. CAfile: %s " + "CRLfile: %s", data->set.ssl.CAfile?data->set.ssl.CAfile:"none", + data->set.ssl.CRLfile?data->set.ssl.CRLfile:"none"); + return CURLE_SSL_CACERT; + } + else + infof(data, "\t server certificate verification FAILED\n"); + } + else + infof(data, "\t server certificate verification OK\n"); + } + else + infof(data, "\t server certificate verification SKIPPED\n"); + + /* initialize an X.509 certificate structure. */ + gnutls_x509_crt_init(&x509_cert); + + /* convert the given DER or PEM encoded Certificate to the native + gnutls_x509_crt_t format */ + gnutls_x509_crt_import(x509_cert, chainp, GNUTLS_X509_FMT_DER); + + if (data->set.ssl.issuercert) { + gnutls_x509_crt_init(&x509_issuer); + issuerp = load_file(data->set.ssl.issuercert); + gnutls_x509_crt_import(x509_issuer, &issuerp, GNUTLS_X509_FMT_PEM); + rc = gnutls_x509_crt_check_issuer(x509_cert,x509_issuer); + unload_file(issuerp); + if (rc <= 0) { + failf(data, "server certificate issuer check failed (IssuerCert: %s)", + data->set.ssl.issuercert?data->set.ssl.issuercert:"none"); + return CURLE_SSL_ISSUER_ERROR; + } + infof(data,"\t server certificate issuer check OK (Issuer Cert: %s)\n", + data->set.ssl.issuercert?data->set.ssl.issuercert:"none"); + } + + size=sizeof(certbuf); + rc = gnutls_x509_crt_get_dn_by_oid(x509_cert, GNUTLS_OID_X520_COMMON_NAME, + 0, /* the first and only one */ + FALSE, + certbuf, + &size); + if(rc) { + infof(data, "error fetching CN from cert:%s\n", + gnutls_strerror(rc)); + } + + /* This function will check if the given certificate's subject matches the + given hostname. This is a basic implementation of the matching described + in RFC2818 (HTTPS), which takes into account wildcards, and the subject + alternative name PKIX extension. Returns non zero on success, and zero on + failure. */ + rc = gnutls_x509_crt_check_hostname(x509_cert, conn->host.name); + + if(!rc) { + if(data->set.ssl.verifyhost > 1) { + failf(data, "SSL: certificate subject name (%s) does not match " + "target host name '%s'", certbuf, conn->host.dispname); + gnutls_x509_crt_deinit(x509_cert); + return CURLE_PEER_FAILED_VERIFICATION; + } + else + infof(data, "\t common name: %s (does not match '%s')\n", + certbuf, conn->host.dispname); + } + else + infof(data, "\t common name: %s (matched)\n", certbuf); + + /* Check for time-based validity */ + certclock = gnutls_x509_crt_get_expiration_time(x509_cert); + + if(certclock == (time_t)-1) { + failf(data, "server cert expiration date verify failed"); + return CURLE_SSL_CONNECT_ERROR; + } + + if(certclock < time(NULL)) { + if(data->set.ssl.verifypeer) { + failf(data, "server certificate expiration date has passed."); + return CURLE_PEER_FAILED_VERIFICATION; + } + else + infof(data, "\t server certificate expiration date FAILED\n"); + } + else + infof(data, "\t server certificate expiration date OK\n"); + + certclock = gnutls_x509_crt_get_activation_time(x509_cert); + + if(certclock == (time_t)-1) { + failf(data, "server cert activation date verify failed"); + return CURLE_SSL_CONNECT_ERROR; + } + + if(certclock > time(NULL)) { + if(data->set.ssl.verifypeer) { + failf(data, "server certificate not activated yet."); + return CURLE_PEER_FAILED_VERIFICATION; + } + else + infof(data, "\t server certificate activation date FAILED\n"); + } + else + infof(data, "\t server certificate activation date OK\n"); + + /* Show: + + - ciphers used + - subject + - start date + - expire date + - common name + - issuer + + */ + + /* public key algorithm's parameters */ + algo = gnutls_x509_crt_get_pk_algorithm(x509_cert, &bits); + infof(data, "\t certificate public key: %s\n", + gnutls_pk_algorithm_get_name(algo)); + + /* version of the X.509 certificate. */ + infof(data, "\t certificate version: #%d\n", + gnutls_x509_crt_get_version(x509_cert)); + + + size = sizeof(certbuf); + gnutls_x509_crt_get_dn(x509_cert, certbuf, &size); + infof(data, "\t subject: %s\n", certbuf); + + certclock = gnutls_x509_crt_get_activation_time(x509_cert); + showtime(data, "start date", certclock); + + certclock = gnutls_x509_crt_get_expiration_time(x509_cert); + showtime(data, "expire date", certclock); + + size = sizeof(certbuf); + gnutls_x509_crt_get_issuer_dn(x509_cert, certbuf, &size); + infof(data, "\t issuer: %s\n", certbuf); + + gnutls_x509_crt_deinit(x509_cert); + + /* compression algorithm (if any) */ + ptr = gnutls_compression_get_name(gnutls_compression_get(session)); + /* the *_get_name() says "NULL" if GNUTLS_COMP_NULL is returned */ + infof(data, "\t compression: %s\n", ptr); + + /* the name of the cipher used. ie 3DES. */ + ptr = gnutls_cipher_get_name(gnutls_cipher_get(session)); + infof(data, "\t cipher: %s\n", ptr); + + /* the MAC algorithms name. ie SHA1 */ + ptr = gnutls_mac_get_name(gnutls_mac_get(session)); + infof(data, "\t MAC: %s\n", ptr); + + conn->ssl[sockindex].state = ssl_connection_complete; + conn->recv[sockindex] = gtls_recv; + conn->send[sockindex] = gtls_send; + + { + /* we always unconditionally get the session id here, as even if we + already got it from the cache and asked to use it in the connection, it + might've been rejected and then a new one is in use now and we need to + detect that. */ + void *connect_sessionid; + size_t connect_idsize; + + /* get the session ID data size */ + gnutls_session_get_data(session, NULL, &connect_idsize); + connect_sessionid = malloc(connect_idsize); /* get a buffer for it */ + + if(connect_sessionid) { + /* extract session ID to the allocated buffer */ + gnutls_session_get_data(session, connect_sessionid, &connect_idsize); + + incache = !(Curl_ssl_getsessionid(conn, &ssl_sessionid, NULL)); + if (incache) { + /* there was one before in the cache, so instead of risking that the + previous one was rejected, we just kill that and store the new */ + Curl_ssl_delsessionid(conn, ssl_sessionid); + } + + /* store this session id */ + return Curl_ssl_addsessionid(conn, connect_sessionid, connect_idsize); + } + } + + return CURLE_OK; +} + + +/* + * This function is called after the TCP connect has completed. Setup the TLS + * layer and do all necessary magic. + */ +/* We use connssl->connecting_state to keep track of the connection status; + there are three states: 'ssl_connect_1' (not started yet or complete), + 'ssl_connect_2_reading' (waiting for data from server), and + 'ssl_connect_2_writing' (waiting to be able to write). + */ +static CURLcode +gtls_connect_common(struct connectdata *conn, + int sockindex, + bool nonblocking, + bool *done) +{ + int rc; + struct ssl_connect_data *connssl = &conn->ssl[sockindex]; + + /* Initiate the connection, if not already done */ + if(ssl_connect_1==connssl->connecting_state) { + rc = gtls_connect_step1 (conn, sockindex); + if(rc) + return rc; + } + + rc = handshake(conn, sockindex, TRUE, nonblocking); + if(rc) + /* handshake() sets its own error message with failf() */ + return rc; + + /* Finish connecting once the handshake is done */ + if(ssl_connect_1==connssl->connecting_state) { + rc = gtls_connect_step3(conn, sockindex); + if(rc) + return rc; + } + + *done = ssl_connect_1==connssl->connecting_state; + + return CURLE_OK; +} + +CURLcode +Curl_gtls_connect_nonblocking(struct connectdata *conn, + int sockindex, + bool *done) +{ + return gtls_connect_common(conn, sockindex, TRUE, done); +} + +CURLcode +Curl_gtls_connect(struct connectdata *conn, + int sockindex) + +{ + CURLcode retcode; + bool done = FALSE; + + retcode = gtls_connect_common(conn, sockindex, FALSE, &done); + if(retcode) + return retcode; + + DEBUGASSERT(done); + + return CURLE_OK; +} + +static ssize_t gtls_send(struct connectdata *conn, + int sockindex, + const void *mem, + size_t len, + CURLcode *curlcode) +{ + ssize_t rc = gnutls_record_send(conn->ssl[sockindex].session, mem, len); + + if(rc < 0 ) { + *curlcode = (rc == GNUTLS_E_AGAIN) + ? CURLE_AGAIN + : CURLE_SEND_ERROR; + + rc = -1; + } + + return rc; +} + +void Curl_gtls_close_all(struct SessionHandle *data) +{ + /* FIX: make the OpenSSL code more generic and use parts of it here */ + (void)data; +} + +static void close_one(struct connectdata *conn, + int idx) +{ + if(conn->ssl[idx].session) { + gnutls_bye(conn->ssl[idx].session, GNUTLS_SHUT_RDWR); + gnutls_deinit(conn->ssl[idx].session); + conn->ssl[idx].session = NULL; + } + if(conn->ssl[idx].cred) { + gnutls_certificate_free_credentials(conn->ssl[idx].cred); + conn->ssl[idx].cred = NULL; + } +} + +void Curl_gtls_close(struct connectdata *conn, int sockindex) +{ + close_one(conn, sockindex); +} + +/* + * This function is called to shut down the SSL layer but keep the + * socket open (CCC - Clear Command Channel) + */ +int Curl_gtls_shutdown(struct connectdata *conn, int sockindex) +{ + ssize_t result; + int retval = 0; + struct SessionHandle *data = conn->data; + int done = 0; + char buf[120]; + + /* This has only been tested on the proftpd server, and the mod_tls code + sends a close notify alert without waiting for a close notify alert in + response. Thus we wait for a close notify alert from the server, but + we do not send one. Let's hope other servers do the same... */ + + if(data->set.ftp_ccc == CURLFTPSSL_CCC_ACTIVE) + gnutls_bye(conn->ssl[sockindex].session, GNUTLS_SHUT_WR); + + if(conn->ssl[sockindex].session) { + while(!done) { + int what = Curl_socket_ready(conn->sock[sockindex], + CURL_SOCKET_BAD, SSL_SHUTDOWN_TIMEOUT); + if(what > 0) { + /* Something to read, let's do it and hope that it is the close + notify alert from the server */ + result = gnutls_record_recv(conn->ssl[sockindex].session, + buf, sizeof(buf)); + switch(result) { + case 0: + /* This is the expected response. There was no data but only + the close notify alert */ + done = 1; + break; + case GNUTLS_E_AGAIN: + case GNUTLS_E_INTERRUPTED: + infof(data, "GNUTLS_E_AGAIN || GNUTLS_E_INTERRUPTED\n"); + break; + default: + retval = -1; + done = 1; + break; + } + } + else if(0 == what) { + /* timeout */ + failf(data, "SSL shutdown timeout"); + done = 1; + break; + } + else { + /* anything that gets here is fatally bad */ + failf(data, "select/poll on SSL socket, errno: %d", SOCKERRNO); + retval = -1; + done = 1; + } + } + gnutls_deinit(conn->ssl[sockindex].session); + } + gnutls_certificate_free_credentials(conn->ssl[sockindex].cred); + + conn->ssl[sockindex].cred = NULL; + conn->ssl[sockindex].session = NULL; + + return retval; +} + +static ssize_t gtls_recv(struct connectdata *conn, /* connection data */ + int num, /* socketindex */ + char *buf, /* store read data here */ + size_t buffersize, /* max amount to read */ + CURLcode *curlcode) +{ + ssize_t ret; + + ret = gnutls_record_recv(conn->ssl[num].session, buf, buffersize); + if((ret == GNUTLS_E_AGAIN) || (ret == GNUTLS_E_INTERRUPTED)) { + *curlcode = CURLE_AGAIN; + return -1; + } + + if(ret == GNUTLS_E_REHANDSHAKE) { + /* BLOCKING call, this is bad but a work-around for now. Fixing this "the + proper way" takes a whole lot of work. */ + CURLcode rc = handshake(conn, num, FALSE, FALSE); + if(rc) + /* handshake() writes error message on its own */ + *curlcode = rc; + else + *curlcode = CURLE_AGAIN; /* then return as if this was a wouldblock */ + return -1; + } + + if(ret < 0) { + failf(conn->data, "GnuTLS recv error (%d): %s", + (int)ret, gnutls_strerror((int)ret)); + *curlcode = CURLE_RECV_ERROR; + return -1; + } + + return ret; +} + +void Curl_gtls_session_free(void *ptr) +{ + free(ptr); +} + +size_t Curl_gtls_version(char *buffer, size_t size) +{ + return snprintf(buffer, size, "GnuTLS/%s", gnutls_check_version(NULL)); +} + +int Curl_gtls_seed(struct SessionHandle *data) +{ + /* we have the "SSL is seeded" boolean static to prevent multiple + time-consuming seedings in vain */ + static bool ssl_seeded = FALSE; + + /* Quickly add a bit of entropy */ + gcry_fast_random_poll(); + + if(!ssl_seeded || data->set.str[STRING_SSL_RANDOM_FILE] || + data->set.str[STRING_SSL_EGDSOCKET]) { + + /* TODO: to a good job seeding the RNG + This may involve the gcry_control function and these options: + GCRYCTL_SET_RANDOM_SEED_FILE + GCRYCTL_SET_RNDEGD_SOCKET + */ + ssl_seeded = TRUE; + } + return 0; +} + +#endif /* USE_GNUTLS */ diff --git a/mobicore/common/curl/lib/gtls.h b/mobicore/common/curl/lib/gtls.h new file mode 100644 index 0000000000000000000000000000000000000000..51e0af1f5a5276e7e4b5af1b28f1ca7553a5f644 --- /dev/null +++ b/mobicore/common/curl/lib/gtls.h @@ -0,0 +1,63 @@ +#ifndef __GTLS_H +#define __GTLS_H +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) 1998 - 2010, Daniel Stenberg, , et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at http://curl.haxx.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ***************************************************************************/ + +#ifdef USE_GNUTLS + +int Curl_gtls_init(void); +int Curl_gtls_cleanup(void); +CURLcode Curl_gtls_connect(struct connectdata *conn, int sockindex); +CURLcode Curl_gtls_connect_nonblocking(struct connectdata *conn, + int sockindex, + bool *done); + +/* tell GnuTLS to close down all open information regarding connections (and + thus session ID caching etc) */ +void Curl_gtls_close_all(struct SessionHandle *data); + + /* close a SSL connection */ +void Curl_gtls_close(struct connectdata *conn, int sockindex); + +void Curl_gtls_session_free(void *ptr); +size_t Curl_gtls_version(char *buffer, size_t size); +int Curl_gtls_shutdown(struct connectdata *conn, int sockindex); +int Curl_gtls_seed(struct SessionHandle *data); + +/* API setup for GnuTLS */ +#define curlssl_init Curl_gtls_init +#define curlssl_cleanup Curl_gtls_cleanup +#define curlssl_connect Curl_gtls_connect +#define curlssl_connect_nonblocking Curl_gtls_connect_nonblocking +#define curlssl_session_free(x) Curl_gtls_session_free(x) +#define curlssl_close_all Curl_gtls_close_all +#define curlssl_close Curl_gtls_close +#define curlssl_shutdown(x,y) Curl_gtls_shutdown(x,y) +#define curlssl_set_engine(x,y) (x=x, y=y, CURLE_FAILED_INIT) +#define curlssl_set_engine_default(x) (x=x, CURLE_FAILED_INIT) +#define curlssl_engines_list(x) (x=x, (struct curl_slist *)NULL) +#define curlssl_version Curl_gtls_version +#define curlssl_check_cxn(x) (x=x, -1) +#define curlssl_data_pending(x,y) (x=x, y=y, 0) + +#endif /* USE_GNUTLS */ +#endif diff --git a/mobicore/common/curl/lib/hash.c b/mobicore/common/curl/lib/hash.c new file mode 100644 index 0000000000000000000000000000000000000000..cdcd26017951e885585bf4cd3f6289a587cdab40 --- /dev/null +++ b/mobicore/common/curl/lib/hash.c @@ -0,0 +1,339 @@ +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) 1998 - 2009, Daniel Stenberg, , et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at http://curl.haxx.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ***************************************************************************/ + +#include "setup.h" + +#include +#include + +#include "hash.h" +#include "llist.h" + +#define _MPRINTF_REPLACE /* use our functions only */ +#include + +#include "curl_memory.h" +/* The last #include file should be: */ +#include "memdebug.h" + +static void +hash_element_dtor(void *user, void *element) +{ + struct curl_hash *h = (struct curl_hash *) user; + struct curl_hash_element *e = (struct curl_hash_element *) element; + + if(e->key) + free(e->key); + + if(e->ptr) + h->dtor(e->ptr); + + free(e); +} + +/* return 1 on error, 0 is fine */ +int +Curl_hash_init(struct curl_hash *h, + int slots, + hash_function hfunc, + comp_function comparator, + curl_hash_dtor dtor) +{ + int i; + + if(!slots || !hfunc || !comparator ||!dtor) { + return 1; /* failure */ + } + + h->hash_func = hfunc; + h->comp_func = comparator; + h->dtor = dtor; + h->size = 0; + h->slots = slots; + + h->table = malloc(slots * sizeof(struct curl_llist *)); + if(h->table) { + for (i = 0; i < slots; ++i) { + h->table[i] = Curl_llist_alloc((curl_llist_dtor) hash_element_dtor); + if(!h->table[i]) { + while(i--) + Curl_llist_destroy(h->table[i], NULL); + free(h->table); + return 1; /* failure */ + } + } + return 0; /* fine */ + } + else + return 1; /* failure */ +} + +struct curl_hash * +Curl_hash_alloc(int slots, + hash_function hfunc, + comp_function comparator, + curl_hash_dtor dtor) +{ + struct curl_hash *h; + + if(!slots || !hfunc || !comparator ||!dtor) { + return NULL; /* failure */ + } + + h = malloc(sizeof(struct curl_hash)); + if(h) { + if(Curl_hash_init(h, slots, hfunc, comparator, dtor)) { + /* failure */ + free(h); + h = NULL; + } + } + + return h; +} + + + +static struct curl_hash_element * +mk_hash_element(const void *key, size_t key_len, const void *p) +{ + struct curl_hash_element *he = malloc(sizeof(struct curl_hash_element)); + + if(he) { + void *dupkey = malloc(key_len); + if(dupkey) { + /* copy the key */ + memcpy(dupkey, key, key_len); + + he->key = dupkey; + he->key_len = key_len; + he->ptr = (void *) p; + } + else { + /* failed to duplicate the key, free memory and fail */ + free(he); + he = NULL; + } + } + return he; +} + +#define FETCH_LIST(x,y,z) x->table[x->hash_func(y, z, x->slots)] + +/* Insert the data in the hash. If there already was a match in the hash, + that data is replaced. */ +void * +Curl_hash_add(struct curl_hash *h, void *key, size_t key_len, void *p) +{ + struct curl_hash_element *he; + struct curl_llist_element *le; + struct curl_llist *l = FETCH_LIST (h, key, key_len); + + for (le = l->head; le; le = le->next) { + he = (struct curl_hash_element *) le->ptr; + if(h->comp_func(he->key, he->key_len, key, key_len)) { + Curl_llist_remove(l, le, (void *)h); + --h->size; + break; + } + } + + he = mk_hash_element(key, key_len, p); + if(he) { + if(Curl_llist_insert_next(l, l->tail, he)) { + ++h->size; + return p; /* return the new entry */ + } + /* + * Couldn't insert it, destroy the 'he' element and the key again. We + * don't call hash_element_dtor() since that would also call the + * "destructor" for the actual data 'p'. When we fail, we shall not touch + * that data. + */ + free(he->key); + free(he); + } + + return NULL; /* failure */ +} + +/* remove the identified hash entry, returns non-zero on failure */ +int Curl_hash_delete(struct curl_hash *h, void *key, size_t key_len) +{ + struct curl_llist_element *le; + struct curl_hash_element *he; + struct curl_llist *l = FETCH_LIST(h, key, key_len); + + for (le = l->head; le; le = le->next) { + he = le->ptr; + if(h->comp_func(he->key, he->key_len, key, key_len)) { + Curl_llist_remove(l, le, (void *) h); + return 0; + } + } + return 1; +} + +void * +Curl_hash_pick(struct curl_hash *h, void *key, size_t key_len) +{ + struct curl_llist_element *le; + struct curl_hash_element *he; + struct curl_llist *l = FETCH_LIST(h, key, key_len); + + for (le = l->head; le; le = le->next) { + he = le->ptr; + if(h->comp_func(he->key, he->key_len, key, key_len)) { + return he->ptr; + } + } + + return NULL; +} + +#if defined(DEBUGBUILD) && defined(AGGRESIVE_TEST) +void +Curl_hash_apply(curl_hash *h, void *user, + void (*cb)(void *user, void *ptr)) +{ + struct curl_llist_element *le; + int i; + + for (i = 0; i < h->slots; ++i) { + for (le = (h->table[i])->head; + le; + le = le->next) { + curl_hash_element *el = le->ptr; + cb(user, el->ptr); + } + } +} +#endif + +void +Curl_hash_clean(struct curl_hash *h) +{ + int i; + + for (i = 0; i < h->slots; ++i) { + Curl_llist_destroy(h->table[i], (void *) h); + h->table[i] = NULL; + } + + free(h->table); +} + +void +Curl_hash_clean_with_criterium(struct curl_hash *h, void *user, + int (*comp)(void *, void *)) +{ + struct curl_llist_element *le; + struct curl_llist_element *lnext; + struct curl_llist *list; + int i; + + for (i = 0; i < h->slots; ++i) { + list = h->table[i]; + le = list->head; /* get first list entry */ + while(le) { + struct curl_hash_element *he = le->ptr; + lnext = le->next; + /* ask the callback function if we shall remove this entry or not */ + if(comp(user, he->ptr)) { + Curl_llist_remove(list, le, (void *) h); + --h->size; /* one less entry in the hash now */ + } + le = lnext; + } + } +} + +void +Curl_hash_destroy(struct curl_hash *h) +{ + if(!h) + return; + + Curl_hash_clean(h); + + free(h); +} + +size_t Curl_hash_str(void* key, size_t key_length, size_t slots_num) +{ + const char* key_str = (const char *) key; + const char *end = key_str + key_length; + unsigned long h = 5381; + + while(key_str < end) { + h += h << 5; + h ^= (unsigned long) *key_str++; + } + + return (h % slots_num); +} + +size_t Curl_str_key_compare(void*k1, size_t key1_len, void*k2, size_t key2_len) +{ + char *key1 = (char *)k1; + char *key2 = (char *)k2; + + if(key1_len == key2_len && + *key1 == *key2 && + memcmp(key1, key2, key1_len) == 0) { + return 1; + } + + return 0; +} + +#if 0 /* useful function for debugging hashes and their contents */ +void Curl_hash_print(struct curl_hash *h, + void (*func)(void *)) +{ + int i; + struct curl_llist_element *le; + struct curl_llist *list; + struct curl_hash_element *he; + if(!h) + return; + + fprintf(stderr, "=Hash dump=\n"); + + for (i = 0; i < h->slots; i++) { + list = h->table[i]; + le = list->head; /* get first list entry */ + if(le) { + fprintf(stderr, "index %d:", i); + while(le) { + he = le->ptr; + if(func) + func(he->ptr); + else + fprintf(stderr, " [%p]", he->ptr); + le = le->next; + } + fprintf(stderr, "\n"); + } + } +} +#endif diff --git a/mobicore/common/curl/lib/hash.h b/mobicore/common/curl/lib/hash.h new file mode 100644 index 0000000000000000000000000000000000000000..993aaedd2b691dd7534de11e109bb50f4b62fb14 --- /dev/null +++ b/mobicore/common/curl/lib/hash.h @@ -0,0 +1,92 @@ +#ifndef __HASH_H +#define __HASH_H +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) 1998 - 2007, Daniel Stenberg, , et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at http://curl.haxx.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ***************************************************************************/ + +#include "setup.h" + +#include + +#include "llist.h" + +/* Hash function prototype */ +typedef size_t (*hash_function) (void* key, + size_t key_length, + size_t slots_num); + +/* + Comparator function prototype. Compares two keys. +*/ +typedef size_t (*comp_function) (void* key1, + size_t key1_len, + void*key2, + size_t key2_len); + +typedef void (*curl_hash_dtor)(void *); + +struct curl_hash { + struct curl_llist **table; + + /* Hash function to be used for this hash table */ + hash_function hash_func; + + /* Comparator function to compare keys */ + comp_function comp_func; + curl_hash_dtor dtor; + int slots; + size_t size; +}; + +struct curl_hash_element { + void *ptr; + char *key; + size_t key_len; +}; + + +int Curl_hash_init(struct curl_hash *h, + int slots, + hash_function hfunc, + comp_function comparator, + curl_hash_dtor dtor); + +struct curl_hash *Curl_hash_alloc(int slots, + hash_function hfunc, + comp_function comparator, + curl_hash_dtor dtor); + +void *Curl_hash_add(struct curl_hash *h, void *key, size_t key_len, void *p); +int Curl_hash_delete(struct curl_hash *h, void *key, size_t key_len); +void *Curl_hash_pick(struct curl_hash *, void * key, size_t key_len); +void Curl_hash_apply(struct curl_hash *h, void *user, + void (*cb)(void *user, void *ptr)); +int Curl_hash_count(struct curl_hash *h); +void Curl_hash_clean(struct curl_hash *h); +void Curl_hash_clean_with_criterium(struct curl_hash *h, void *user, + int (*comp)(void *, void *)); +void Curl_hash_destroy(struct curl_hash *h); + +size_t Curl_hash_str(void* key, size_t key_length, size_t slots_num); +size_t Curl_str_key_compare(void*k1, size_t key1_len, void*k2, + size_t key2_len); + +#endif diff --git a/mobicore/common/curl/lib/hmac.c b/mobicore/common/curl/lib/hmac.c new file mode 100644 index 0000000000000000000000000000000000000000..8cb5f2eaa1b5bd21c60f6f899723f9e054e9bae5 --- /dev/null +++ b/mobicore/common/curl/lib/hmac.c @@ -0,0 +1,131 @@ +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) 1998 - 2010, Daniel Stenberg, , et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at http://curl.haxx.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + * RFC2104 Keyed-Hashing for Message Authentication + * + ***************************************************************************/ + +#include "setup.h" + +#ifndef CURL_DISABLE_CRYPTO_AUTH + +#include "curl_hmac.h" + +#define _MPRINTF_REPLACE /* use our functions only */ +#include + +#include "curl_memory.h" +/* The last #include file should be: */ +#include "memdebug.h" + +/* + * Generic HMAC algorithm. + * + * This module computes HMAC digests based on any hash function. Parameters + * and computing procedures are set-up dynamically at HMAC computation + * context initialisation. + */ + +static const unsigned char hmac_ipad = 0x36; +static const unsigned char hmac_opad = 0x5C; + + + +HMAC_context * +Curl_HMAC_init(const HMAC_params * hashparams, + const unsigned char * key, + unsigned int keylen) +{ + size_t i; + HMAC_context * ctxt; + unsigned char * hkey; + unsigned char b; + + /* Create HMAC context. */ + i = sizeof *ctxt + 2 * hashparams->hmac_ctxtsize + hashparams->hmac_resultlen; + ctxt = malloc(i); + + if(!ctxt) + return ctxt; + + ctxt->hmac_hash = hashparams; + ctxt->hmac_hashctxt1 = (void *) (ctxt + 1); + ctxt->hmac_hashctxt2 = (void *) ((char *) ctxt->hmac_hashctxt1 + + hashparams->hmac_ctxtsize); + + /* If the key is too long, replace it by its hash digest. */ + if(keylen > hashparams->hmac_maxkeylen) { + (*hashparams->hmac_hinit)(ctxt->hmac_hashctxt1); + (*hashparams->hmac_hupdate)(ctxt->hmac_hashctxt1, key, keylen); + hkey = (unsigned char *) ctxt->hmac_hashctxt2 + hashparams->hmac_ctxtsize; + (*hashparams->hmac_hfinal)(hkey, ctxt->hmac_hashctxt1); + key = hkey; + keylen = hashparams->hmac_resultlen; + } + + /* Prime the two hash contexts with the modified key. */ + (*hashparams->hmac_hinit)(ctxt->hmac_hashctxt1); + (*hashparams->hmac_hinit)(ctxt->hmac_hashctxt2); + + for (i = 0; i < keylen; i++) { + b = (unsigned char)(*key ^ hmac_ipad); + (*hashparams->hmac_hupdate)(ctxt->hmac_hashctxt1, &b, 1); + b = (unsigned char)(*key++ ^ hmac_opad); + (*hashparams->hmac_hupdate)(ctxt->hmac_hashctxt2, &b, 1); + } + + for (; i < hashparams->hmac_maxkeylen; i++) { + (*hashparams->hmac_hupdate)(ctxt->hmac_hashctxt1, &hmac_ipad, 1); + (*hashparams->hmac_hupdate)(ctxt->hmac_hashctxt2, &hmac_opad, 1); + } + + /* Done, return pointer to HMAC context. */ + return ctxt; +} + +int Curl_HMAC_update(HMAC_context * ctxt, + const unsigned char * data, + unsigned int len) +{ + /* Update first hash calculation. */ + (*ctxt->hmac_hash->hmac_hupdate)(ctxt->hmac_hashctxt1, data, len); + return 0; +} + + +int Curl_HMAC_final(HMAC_context * ctxt, unsigned char * result) +{ + const HMAC_params * hashparams = ctxt->hmac_hash; + + /* Do not get result if called with a null parameter: only release storage. */ + + if(!result) + result = (unsigned char *) ctxt->hmac_hashctxt2 + + ctxt->hmac_hash->hmac_ctxtsize; + + (*hashparams->hmac_hfinal)(result, ctxt->hmac_hashctxt1); + (*hashparams->hmac_hupdate)(ctxt->hmac_hashctxt2, + result, hashparams->hmac_resultlen); + (*hashparams->hmac_hfinal)(result, ctxt->hmac_hashctxt2); + free((char *) ctxt); + return 0; +} + +#endif /* CURL_DISABLE_CRYPTO_AUTH */ diff --git a/mobicore/common/curl/lib/hostares.c b/mobicore/common/curl/lib/hostares.c new file mode 100644 index 0000000000000000000000000000000000000000..97cb27ab91e67a45d7b07277b2a1e8c8e7682e2d --- /dev/null +++ b/mobicore/common/curl/lib/hostares.c @@ -0,0 +1,413 @@ +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) 1998 - 2010, Daniel Stenberg, , et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at http://curl.haxx.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ***************************************************************************/ + +#include "setup.h" + +#include + +#ifdef HAVE_LIMITS_H +#include +#endif +#ifdef HAVE_SYS_SOCKET_H +#include +#endif +#ifdef HAVE_NETINET_IN_H +#include +#endif +#ifdef HAVE_NETDB_H +#include +#endif +#ifdef HAVE_ARPA_INET_H +#include +#endif +#ifdef HAVE_STDLIB_H +#include /* required for free() prototypes */ +#endif +#ifdef HAVE_UNISTD_H +#include /* for the close() proto */ +#endif +#ifdef __VMS +#include +#include +#include +#endif + +#ifdef HAVE_PROCESS_H +#include +#endif + +#if (defined(NETWARE) && defined(__NOVELL_LIBC__)) +#undef in_addr_t +#define in_addr_t unsigned long +#endif + +#include "urldata.h" +#include "sendf.h" +#include "hostip.h" +#include "hash.h" +#include "share.h" +#include "strerror.h" +#include "url.h" +#include "multiif.h" +#include "inet_pton.h" +#include "connect.h" +#include "select.h" +#include "progress.h" + +#define _MPRINTF_REPLACE /* use our functions only */ +#include + +#include "curl_memory.h" +/* The last #include file should be: */ +#include "memdebug.h" + +/*********************************************************************** + * Only for ares-enabled builds + **********************************************************************/ + +#ifdef CURLRES_ARES + +/* + * Curl_resolv_fdset() is called when someone from the outside world (using + * curl_multi_fdset()) wants to get our fd_set setup and we're talking with + * ares. The caller must make sure that this function is only called when we + * have a working ares channel. + * + * Returns: CURLE_OK always! + */ + +int Curl_resolv_getsock(struct connectdata *conn, + curl_socket_t *socks, + int numsocks) + +{ + struct timeval maxtime; + struct timeval timebuf; + struct timeval *timeout; + int max = ares_getsock(conn->data->state.areschannel, + (ares_socket_t *)socks, numsocks); + + + maxtime.tv_sec = CURL_TIMEOUT_RESOLVE; + maxtime.tv_usec = 0; + + timeout = ares_timeout(conn->data->state.areschannel, &maxtime, &timebuf); + + Curl_expire(conn->data, + (timeout->tv_sec * 1000) + (timeout->tv_usec/1000)); + + return max; +} + +/* + * waitperform() + * + * 1) Ask ares what sockets it currently plays with, then + * 2) wait for the timeout period to check for action on ares' sockets. + * 3) tell ares to act on all the sockets marked as "with action" + * + * return number of sockets it worked on + */ + +static int waitperform(struct connectdata *conn, int timeout_ms) +{ + struct SessionHandle *data = conn->data; + int nfds; + int bitmask; + ares_socket_t socks[ARES_GETSOCK_MAXNUM]; + struct pollfd pfd[ARES_GETSOCK_MAXNUM]; + int i; + int num = 0; + + bitmask = ares_getsock(data->state.areschannel, socks, ARES_GETSOCK_MAXNUM); + + for(i=0; i < ARES_GETSOCK_MAXNUM; i++) { + pfd[i].events = 0; + pfd[i].revents = 0; + if(ARES_GETSOCK_READABLE(bitmask, i)) { + pfd[i].fd = socks[i]; + pfd[i].events |= POLLRDNORM|POLLIN; + } + if(ARES_GETSOCK_WRITABLE(bitmask, i)) { + pfd[i].fd = socks[i]; + pfd[i].events |= POLLWRNORM|POLLOUT; + } + if(pfd[i].events != 0) + num++; + else + break; + } + + if(num) + nfds = Curl_poll(pfd, num, timeout_ms); + else + nfds = 0; + + if(!nfds) + /* Call ares_process() unconditonally here, even if we simply timed out + above, as otherwise the ares name resolve won't timeout! */ + ares_process_fd(data->state.areschannel, ARES_SOCKET_BAD, ARES_SOCKET_BAD); + else { + /* move through the descriptors and ask for processing on them */ + for(i=0; i < num; i++) + ares_process_fd(data->state.areschannel, + pfd[i].revents & (POLLRDNORM|POLLIN)? + pfd[i].fd:ARES_SOCKET_BAD, + pfd[i].revents & (POLLWRNORM|POLLOUT)? + pfd[i].fd:ARES_SOCKET_BAD); + } + return nfds; +} + +/* + * Curl_is_resolved() is called repeatedly to check if a previous name resolve + * request has completed. It should also make sure to time-out if the + * operation seems to take too long. + * + * Returns normal CURLcode errors. + */ +CURLcode Curl_is_resolved(struct connectdata *conn, + struct Curl_dns_entry **dns) +{ + struct SessionHandle *data = conn->data; + + *dns = NULL; + + waitperform(conn, 0); + + if(conn->async.done) { + /* we're done, kill the ares handle */ + if(!conn->async.dns) { + failf(data, "Could not resolve host: %s (%s)", conn->host.dispname, + ares_strerror(conn->async.status)); + return CURLE_COULDNT_RESOLVE_HOST; + } + *dns = conn->async.dns; + } + + return CURLE_OK; +} + +/* + * Curl_wait_for_resolv() waits for a resolve to finish. This function should + * be avoided since using this risk getting the multi interface to "hang". + * + * If 'entry' is non-NULL, make it point to the resolved dns entry + * + * Returns CURLE_COULDNT_RESOLVE_HOST if the host was not resolved, and + * CURLE_OPERATION_TIMEDOUT if a time-out occurred. + */ +CURLcode Curl_wait_for_resolv(struct connectdata *conn, + struct Curl_dns_entry **entry) +{ + CURLcode rc=CURLE_OK; + struct SessionHandle *data = conn->data; + long timeout; + struct timeval now = Curl_tvnow(); + + timeout = Curl_timeleft(conn, &now, TRUE); + if(!timeout) + timeout = CURL_TIMEOUT_RESOLVE * 1000; /* default name resolve timeout */ + + /* Wait for the name resolve query to complete. */ + for(;;) { + struct timeval *tvp, tv, store; + long timediff; + int itimeout; + int timeout_ms; + + itimeout = (timeout > (long)INT_MAX) ? INT_MAX : (int)timeout; + + store.tv_sec = itimeout/1000; + store.tv_usec = (itimeout%1000)*1000; + + tvp = ares_timeout(data->state.areschannel, &store, &tv); + + /* use the timeout period ares returned to us above if less than one + second is left, otherwise just use 1000ms to make sure the progress + callback gets called frequent enough */ + if(!tvp->tv_sec) + timeout_ms = (int)(tvp->tv_usec/1000); + else + timeout_ms = 1000; + + waitperform(conn, timeout_ms); + + if(conn->async.done) + break; + + if(Curl_pgrsUpdate(conn)) { + rc = CURLE_ABORTED_BY_CALLBACK; + timeout = -1; /* trigger the cancel below */ + } + else { + struct timeval now2 = Curl_tvnow(); + timediff = Curl_tvdiff(now2, now); /* spent time */ + timeout -= timediff?timediff:1; /* always deduct at least 1 */ + now = now2; /* for next loop */ + } + if(timeout < 0) { + /* our timeout, so we cancel the ares operation */ + ares_cancel(data->state.areschannel); + break; + } + } + + /* Operation complete, if the lookup was successful we now have the entry + in the cache. */ + + if(entry) + *entry = conn->async.dns; + + if(!conn->async.dns) { + /* a name was not resolved */ + if((timeout < 0) || (conn->async.status == ARES_ETIMEOUT)) { + if (conn->bits.httpproxy) { + failf(data, "Resolving proxy timed out: %s", conn->proxy.dispname); + rc = CURLE_COULDNT_RESOLVE_PROXY; + } + else { + failf(data, "Resolving host timed out: %s", conn->host.dispname); + rc = CURLE_COULDNT_RESOLVE_HOST; + } + } + else if(conn->async.done) { + if (conn->bits.httpproxy) { + failf(data, "Could not resolve proxy: %s (%s)", conn->proxy.dispname, + ares_strerror(conn->async.status)); + rc = CURLE_COULDNT_RESOLVE_PROXY; + } + else { + failf(data, "Could not resolve host: %s (%s)", conn->host.dispname, + ares_strerror(conn->async.status)); + rc = CURLE_COULDNT_RESOLVE_HOST; + } + } + else + rc = CURLE_OPERATION_TIMEDOUT; + + /* close the connection, since we can't return failure here without + cleaning up this connection properly */ + conn->bits.close = TRUE; + } + + return rc; +} + +/* + * ares_query_completed_cb() is the callback that ares will call when + * the host query initiated by ares_gethostbyname() from Curl_getaddrinfo(), + * when using ares, is completed either successfully or with failure. + */ +static void ares_query_completed_cb(void *arg, /* (struct connectdata *) */ + int status, +#ifdef HAVE_CARES_CALLBACK_TIMEOUTS + int timeouts, +#endif + struct hostent *hostent) +{ + struct connectdata *conn = (struct connectdata *)arg; + struct Curl_addrinfo * ai = NULL; + +#ifdef HAVE_CARES_CALLBACK_TIMEOUTS + (void)timeouts; /* ignored */ +#endif + + if (status == CURL_ASYNC_SUCCESS) { + ai = Curl_he2ai(hostent, conn->async.port); + } + + (void)Curl_addrinfo_callback(arg, status, ai); +} + +/* + * Curl_getaddrinfo() - when using ares + * + * Returns name information about the given hostname and port number. If + * successful, the 'hostent' is returned and the forth argument will point to + * memory we need to free after use. That memory *MUST* be freed with + * Curl_freeaddrinfo(), nothing else. + */ +Curl_addrinfo *Curl_getaddrinfo(struct connectdata *conn, + const char *hostname, + int port, + int *waitp) +{ + char *bufp; + struct SessionHandle *data = conn->data; + struct in_addr in; + int family = PF_INET; +#ifdef ENABLE_IPV6 /* CURLRES_IPV6 */ + struct in6_addr in6; +#endif /* CURLRES_IPV6 */ + + *waitp = 0; /* default to synchronous response */ + + /* First check if this is an IPv4 address string */ + if(Curl_inet_pton(AF_INET, hostname, &in) > 0) { + /* This is a dotted IP address 123.123.123.123-style */ + return Curl_ip2addr(AF_INET, &in, hostname, port); + } + +#ifdef ENABLE_IPV6 /* CURLRES_IPV6 */ + /* Otherwise, check if this is an IPv6 address string */ + if (Curl_inet_pton (AF_INET6, hostname, &in6) > 0) { + /* This must be an IPv6 address literal. */ + return Curl_ip2addr(AF_INET6, &in6, hostname, port); + } + + switch(conn->ip_version) { + default: +#if ARES_VERSION >= 0x010601 + family = PF_UNSPEC; /* supported by c-ares since 1.6.1, so for older + c-ares versions this just falls through and defaults + to PF_INET */ + break; +#endif + case CURL_IPRESOLVE_V4: + family = PF_INET; + break; + case CURL_IPRESOLVE_V6: + family = PF_INET6; + break; + } +#endif /* CURLRES_IPV6 */ + + bufp = strdup(hostname); + + if(bufp) { + Curl_safefree(conn->async.hostname); + conn->async.hostname = bufp; + conn->async.port = port; + conn->async.done = FALSE; /* not done */ + conn->async.status = 0; /* clear */ + conn->async.dns = NULL; /* clear */ + + /* areschannel is already setup in the Curl_open() function */ + ares_gethostbyname(data->state.areschannel, hostname, family, + (ares_host_callback)ares_query_completed_cb, conn); + + *waitp = 1; /* expect asynchronous response */ + } + return NULL; /* no struct yet */ +} +#endif /* CURLRES_ARES */ diff --git a/mobicore/common/curl/lib/hostasyn.c b/mobicore/common/curl/lib/hostasyn.c new file mode 100644 index 0000000000000000000000000000000000000000..127b8d332017c781e0a617429babd0e29b6f400b --- /dev/null +++ b/mobicore/common/curl/lib/hostasyn.c @@ -0,0 +1,129 @@ +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) 1998 - 2009, Daniel Stenberg, , et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at http://curl.haxx.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ***************************************************************************/ + +#include "setup.h" + +#include + +#ifdef HAVE_SYS_SOCKET_H +#include +#endif +#ifdef HAVE_NETINET_IN_H +#include +#endif +#ifdef HAVE_NETDB_H +#include +#endif +#ifdef HAVE_ARPA_INET_H +#include +#endif +#ifdef HAVE_STDLIB_H +#include /* required for free() prototypes */ +#endif +#ifdef HAVE_UNISTD_H +#include /* for the close() proto */ +#endif +#ifdef __VMS +#include +#include +#include +#endif + +#ifdef HAVE_PROCESS_H +#include +#endif + +#include "urldata.h" +#include "sendf.h" +#include "hostip.h" +#include "hash.h" +#include "share.h" +#include "strerror.h" +#include "url.h" + +#define _MPRINTF_REPLACE /* use our functions only */ +#include + +#include "curl_memory.h" +/* The last #include file should be: */ +#include "memdebug.h" + +/*********************************************************************** + * Only for builds using asynchronous name resolves + **********************************************************************/ +#ifdef CURLRES_ASYNCH + +/* + * Curl_addrinfo_callback() gets called by ares, gethostbyname_thread() + * or getaddrinfo_thread() when we got the name resolved (or not!). + * + * If the status argument is CURL_ASYNC_SUCCESS, this function takes + * ownership of the Curl_addrinfo passed, storing the resolved data + * in the DNS cache. + * + * The storage operation locks and unlocks the DNS cache. + */ +CURLcode Curl_addrinfo_callback(struct connectdata * conn, + int status, + struct Curl_addrinfo *ai) +{ + struct Curl_dns_entry *dns = NULL; + CURLcode rc = CURLE_OK; + + conn->async.status = status; + + if(CURL_ASYNC_SUCCESS == status) { + if(ai) { + struct SessionHandle *data = conn->data; + + if(data->share) + Curl_share_lock(data, CURL_LOCK_DATA_DNS, CURL_LOCK_ACCESS_SINGLE); + + dns = Curl_cache_addr(data, ai, + conn->async.hostname, + conn->async.port); + if(!dns) { + /* failed to store, cleanup and return error */ + Curl_freeaddrinfo(ai); + rc = CURLE_OUT_OF_MEMORY; + } + + if(data->share) + Curl_share_unlock(data, CURL_LOCK_DATA_DNS); + } + else + rc = CURLE_OUT_OF_MEMORY; + } + + conn->async.dns = dns; + + /* Set async.done TRUE last in this function since it may be used multi- + threaded and once this is TRUE the other thread may read fields from the + async struct */ + conn->async.done = TRUE; + + /* ipv4: The input hostent struct will be freed by ares when we return from + this function */ + return rc; +} + +#endif /* CURLRES_ASYNCH */ diff --git a/mobicore/common/curl/lib/hostip.c b/mobicore/common/curl/lib/hostip.c new file mode 100644 index 0000000000000000000000000000000000000000..3db5b4967ea18fad55ecdc8baadb827c75abc26c --- /dev/null +++ b/mobicore/common/curl/lib/hostip.c @@ -0,0 +1,724 @@ +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) 1998 - 2010, Daniel Stenberg, , et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at http://curl.haxx.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ***************************************************************************/ + +#include "setup.h" + +#include + +#ifdef HAVE_SYS_SOCKET_H +#include +#endif +#ifdef HAVE_NETINET_IN_H +#include +#endif +#ifdef HAVE_NETDB_H +#include +#endif +#ifdef HAVE_ARPA_INET_H +#include +#endif +#ifdef HAVE_STDLIB_H +#include /* required for free() prototypes */ +#endif +#ifdef HAVE_UNISTD_H +#include /* for the close() proto */ +#endif +#ifdef __VMS +#include +#include +#include +#endif + +#ifdef HAVE_SETJMP_H +#include +#endif +#ifdef HAVE_SIGNAL_H +#include +#endif + +#ifdef HAVE_PROCESS_H +#include +#endif + +#include "urldata.h" +#include "sendf.h" +#include "hostip.h" +#include "hash.h" +#include "share.h" +#include "strerror.h" +#include "url.h" +#include "inet_ntop.h" +#include "warnless.h" + +#define _MPRINTF_REPLACE /* use our functions only */ +#include + +#include "curl_memory.h" +/* The last #include file should be: */ +#include "memdebug.h" + +#if defined(CURLRES_SYNCH) && \ + defined(HAVE_ALARM) && defined(SIGALRM) && defined(HAVE_SIGSETJMP) +/* alarm-based timeouts can only be used with all the dependencies satisfied */ +#define USE_ALARM_TIMEOUT +#endif + +/* + * hostip.c explained + * ================== + * + * The main COMPILE-TIME DEFINES to keep in mind when reading the host*.c + * source file are these: + * + * CURLRES_IPV6 - this host has getaddrinfo() and family, and thus we use + * that. The host may not be able to resolve IPv6, but we don't really have to + * take that into account. Hosts that aren't IPv6-enabled have CURLRES_IPV4 + * defined. + * + * CURLRES_ARES - is defined if libcurl is built to use c-ares for + * asynchronous name resolves. This can be Windows or *nix. + * + * CURLRES_THREADED - is defined if libcurl is built to run under (native) + * Windows, and then the name resolve will be done in a new thread, and the + * supported API will be the same as for ares-builds. + * + * If any of the two previous are defined, CURLRES_ASYNCH is defined too. If + * libcurl is not built to use an asynchronous resolver, CURLRES_SYNCH is + * defined. + * + * The host*.c sources files are split up like this: + * + * hostip.c - method-independent resolver functions and utility functions + * hostasyn.c - functions for asynchronous name resolves + * hostsyn.c - functions for synchronous name resolves + * hostares.c - functions for ares-using name resolves + * hostthre.c - functions for threaded name resolves + * hostip4.c - ipv4-specific functions + * hostip6.c - ipv6-specific functions + * + * The hostip.h is the united header file for all this. It defines the + * CURLRES_* defines based on the config*.h and setup.h defines. + */ + +/* These two symbols are for the global DNS cache */ +static struct curl_hash hostname_cache; +static int host_cache_initialized; + +static void freednsentry(void *freethis); + +/* + * Curl_global_host_cache_init() initializes and sets up a global DNS cache. + * Global DNS cache is general badness. Do not use. This will be removed in + * a future version. Use the share interface instead! + * + * Returns a struct curl_hash pointer on success, NULL on failure. + */ +struct curl_hash *Curl_global_host_cache_init(void) +{ + int rc = 0; + if(!host_cache_initialized) { + rc = Curl_hash_init(&hostname_cache, 7, Curl_hash_str, + Curl_str_key_compare, freednsentry); + if(!rc) + host_cache_initialized = 1; + } + return rc?NULL:&hostname_cache; +} + +/* + * Destroy and cleanup the global DNS cache + */ +void Curl_global_host_cache_dtor(void) +{ + if(host_cache_initialized) { + Curl_hash_clean(&hostname_cache); + host_cache_initialized = 0; + } +} + +/* + * Return # of adresses in a Curl_addrinfo struct + */ +int Curl_num_addresses(const Curl_addrinfo *addr) +{ + int i = 0; + while(addr) { + addr = addr->ai_next; + i++; + } + return i; +} + +/* + * Curl_printable_address() returns a printable version of the 1st address + * given in the 'ai' argument. The result will be stored in the buf that is + * bufsize bytes big. + * + * If the conversion fails, it returns NULL. + */ +const char * +Curl_printable_address(const Curl_addrinfo *ai, char *buf, size_t bufsize) +{ + const struct sockaddr_in *sa4; + const struct in_addr *ipaddr4; +#ifdef ENABLE_IPV6 + const struct sockaddr_in6 *sa6; + const struct in6_addr *ipaddr6; +#endif + + switch (ai->ai_family) { + case AF_INET: + sa4 = (const void *)ai->ai_addr; + ipaddr4 = &sa4->sin_addr; + return Curl_inet_ntop(ai->ai_family, (const void *)ipaddr4, buf, + bufsize); +#ifdef ENABLE_IPV6 + case AF_INET6: + sa6 = (const void *)ai->ai_addr; + ipaddr6 = &sa6->sin6_addr; + return Curl_inet_ntop(ai->ai_family, (const void *)ipaddr6, buf, + bufsize); +#endif + default: + break; + } + return NULL; +} + +/* + * Return a hostcache id string for the providing host + port, to be used by + * the DNS caching. + */ +static char * +create_hostcache_id(const char *server, int port) +{ + /* create and return the new allocated entry */ + return aprintf("%s:%d", server, port); +} + +struct hostcache_prune_data { + long cache_timeout; + time_t now; +}; + +/* + * This function is set as a callback to be called for every entry in the DNS + * cache when we want to prune old unused entries. + * + * Returning non-zero means remove the entry, return 0 to keep it in the + * cache. + */ +static int +hostcache_timestamp_remove(void *datap, void *hc) +{ + struct hostcache_prune_data *data = + (struct hostcache_prune_data *) datap; + struct Curl_dns_entry *c = (struct Curl_dns_entry *) hc; + + return (data->now - c->timestamp >= data->cache_timeout); +} + +/* + * Prune the DNS cache. This assumes that a lock has already been taken. + */ +static void +hostcache_prune(struct curl_hash *hostcache, long cache_timeout, time_t now) +{ + struct hostcache_prune_data user; + + user.cache_timeout = cache_timeout; + user.now = now; + + Curl_hash_clean_with_criterium(hostcache, + (void *) &user, + hostcache_timestamp_remove); +} + +/* + * Library-wide function for pruning the DNS cache. This function takes and + * returns the appropriate locks. + */ +void Curl_hostcache_prune(struct SessionHandle *data) +{ + time_t now; + + if((data->set.dns_cache_timeout == -1) || !data->dns.hostcache) + /* cache forever means never prune, and NULL hostcache means + we can't do it */ + return; + + if(data->share) + Curl_share_lock(data, CURL_LOCK_DATA_DNS, CURL_LOCK_ACCESS_SINGLE); + + time(&now); + + /* Remove outdated and unused entries from the hostcache */ + hostcache_prune(data->dns.hostcache, + data->set.dns_cache_timeout, + now); + + if(data->share) + Curl_share_unlock(data, CURL_LOCK_DATA_DNS); +} + +/* + * Check if the entry should be pruned. Assumes a locked cache. + */ +static int +remove_entry_if_stale(struct SessionHandle *data, struct Curl_dns_entry *dns) +{ + struct hostcache_prune_data user; + + if( !dns || (data->set.dns_cache_timeout == -1) || !data->dns.hostcache) + /* cache forever means never prune, and NULL hostcache means + we can't do it */ + return 0; + + time(&user.now); + user.cache_timeout = data->set.dns_cache_timeout; + + if( !hostcache_timestamp_remove(&user,dns) ) + return 0; + + Curl_hash_clean_with_criterium(data->dns.hostcache, + (void *) &user, + hostcache_timestamp_remove); + + return 1; +} + + +#ifdef HAVE_SIGSETJMP +/* Beware this is a global and unique instance. This is used to store the + return address that we can jump back to from inside a signal handler. This + is not thread-safe stuff. */ +sigjmp_buf curl_jmpenv; +#endif + + +/* + * Curl_cache_addr() stores a 'Curl_addrinfo' struct in the DNS cache. + * + * When calling Curl_resolv() has resulted in a response with a returned + * address, we call this function to store the information in the dns + * cache etc + * + * Returns the Curl_dns_entry entry pointer or NULL if the storage failed. + */ +struct Curl_dns_entry * +Curl_cache_addr(struct SessionHandle *data, + Curl_addrinfo *addr, + const char *hostname, + int port) +{ + char *entry_id; + size_t entry_len; + struct Curl_dns_entry *dns; + struct Curl_dns_entry *dns2; + + /* Create an entry id, based upon the hostname and port */ + entry_id = create_hostcache_id(hostname, port); + /* If we can't create the entry id, fail */ + if(!entry_id) + return NULL; + entry_len = strlen(entry_id); + + /* Create a new cache entry */ + dns = calloc(1, sizeof(struct Curl_dns_entry)); + if(!dns) { + free(entry_id); + return NULL; + } + + dns->inuse = 0; /* init to not used */ + dns->addr = addr; /* this is the address(es) */ + time(&dns->timestamp); + if(dns->timestamp == 0) + dns->timestamp = 1; /* zero indicates that entry isn't in hash table */ + + /* Store the resolved data in our DNS cache. */ + dns2 = Curl_hash_add(data->dns.hostcache, entry_id, entry_len+1, + (void *)dns); + if(!dns2) { + free(dns); + free(entry_id); + return NULL; + } + + dns = dns2; + dns->inuse++; /* mark entry as in-use */ + + /* free the allocated entry_id */ + free(entry_id); + + return dns; +} + +/* + * Curl_resolv() is the main name resolve function within libcurl. It resolves + * a name and returns a pointer to the entry in the 'entry' argument (if one + * is provided). This function might return immediately if we're using asynch + * resolves. See the return codes. + * + * The cache entry we return will get its 'inuse' counter increased when this + * function is used. You MUST call Curl_resolv_unlock() later (when you're + * done using this struct) to decrease the counter again. + * + * In debug mode, we specifically test for an interface name "LocalHost" + * and resolve "localhost" instead as a means to permit test cases + * to connect to a local test server with any host name. + * + * Return codes: + * + * CURLRESOLV_ERROR (-1) = error, no pointer + * CURLRESOLV_RESOLVED (0) = OK, pointer provided + * CURLRESOLV_PENDING (1) = waiting for response, no pointer + */ + +int Curl_resolv(struct connectdata *conn, + const char *hostname, + int port, + struct Curl_dns_entry **entry) +{ + char *entry_id = NULL; + struct Curl_dns_entry *dns = NULL; + size_t entry_len; + struct SessionHandle *data = conn->data; + CURLcode result; + int rc = CURLRESOLV_ERROR; /* default to failure */ + + *entry = NULL; + + /* Create an entry id, based upon the hostname and port */ + entry_id = create_hostcache_id(hostname, port); + /* If we can't create the entry id, fail */ + if(!entry_id) + return rc; + + entry_len = strlen(entry_id); + + if(data->share) + Curl_share_lock(data, CURL_LOCK_DATA_DNS, CURL_LOCK_ACCESS_SINGLE); + + /* See if its already in our dns cache */ + dns = Curl_hash_pick(data->dns.hostcache, entry_id, entry_len+1); + + /* free the allocated entry_id again */ + free(entry_id); + + /* See whether the returned entry is stale. Done before we release lock */ + if( remove_entry_if_stale(data, dns) ) + dns = NULL; /* the memory deallocation is being handled by the hash */ + + if(dns) { + dns->inuse++; /* we use it! */ + rc = CURLRESOLV_RESOLVED; + } + + if(data->share) + Curl_share_unlock(data, CURL_LOCK_DATA_DNS); + + if(!dns) { + /* The entry was not in the cache. Resolve it to IP address */ + + Curl_addrinfo *addr; + int respwait; + + /* Check what IP specifics the app has requested and if we can provide it. + * If not, bail out. */ + if(!Curl_ipvalid(conn)) + return CURLRESOLV_ERROR; + + /* If Curl_getaddrinfo() returns NULL, 'respwait' might be set to a + non-zero value indicating that we need to wait for the response to the + resolve call */ + addr = Curl_getaddrinfo(conn, +#ifdef DEBUGBUILD + (data->set.str[STRING_DEVICE] + && !strcmp(data->set.str[STRING_DEVICE], + "LocalHost"))?"localhost": +#endif + hostname, port, &respwait); + + if(!addr) { + if(respwait) { + /* the response to our resolve call will come asynchronously at + a later time, good or bad */ + /* First, check that we haven't received the info by now */ + result = Curl_is_resolved(conn, &dns); + if(result) /* error detected */ + return CURLRESOLV_ERROR; + if(dns) + rc = CURLRESOLV_RESOLVED; /* pointer provided */ + else + rc = CURLRESOLV_PENDING; /* no info yet */ + } + } + else { + if(data->share) + Curl_share_lock(data, CURL_LOCK_DATA_DNS, CURL_LOCK_ACCESS_SINGLE); + + /* we got a response, store it in the cache */ + dns = Curl_cache_addr(data, addr, hostname, port); + + if(data->share) + Curl_share_unlock(data, CURL_LOCK_DATA_DNS); + + if(!dns) + /* returned failure, bail out nicely */ + Curl_freeaddrinfo(addr); + else + rc = CURLRESOLV_RESOLVED; + } + } + + *entry = dns; + + return rc; +} + +#ifdef USE_ALARM_TIMEOUT +/* + * This signal handler jumps back into the main libcurl code and continues + * execution. This effectively causes the remainder of the application to run + * within a signal handler which is nonportable and could lead to problems. + */ +static +RETSIGTYPE alarmfunc(int sig) +{ + /* this is for "-ansi -Wall -pedantic" to stop complaining! (rabe) */ + (void)sig; + siglongjmp(curl_jmpenv, 1); + return; +} +#endif /* USE_ALARM_TIMEOUT */ + +/* + * Curl_resolv_timeout() is the same as Curl_resolv() but specifies a + * timeout. This function might return immediately if we're using asynch + * resolves. See the return codes. + * + * The cache entry we return will get its 'inuse' counter increased when this + * function is used. You MUST call Curl_resolv_unlock() later (when you're + * done using this struct) to decrease the counter again. + * + * If built with a synchronous resolver and use of signals is not + * disabled by the application, then a nonzero timeout will cause a + * timeout after the specified number of milliseconds. Otherwise, timeout + * is ignored. + * + * Return codes: + * + * CURLRESOLV_TIMEDOUT(-2) = warning, time too short or previous alarm expired + * CURLRESOLV_ERROR (-1) = error, no pointer + * CURLRESOLV_RESOLVED (0) = OK, pointer provided + * CURLRESOLV_PENDING (1) = waiting for response, no pointer + */ + +int Curl_resolv_timeout(struct connectdata *conn, + const char *hostname, + int port, + struct Curl_dns_entry **entry, + long timeoutms) +{ +#ifdef USE_ALARM_TIMEOUT +#ifdef HAVE_SIGACTION + struct sigaction keep_sigact; /* store the old struct here */ + volatile bool keep_copysig = FALSE; /* wether old sigact has been saved */ + struct sigaction sigact; +#else +#ifdef HAVE_SIGNAL + void (*keep_sigact)(int); /* store the old handler here */ +#endif /* HAVE_SIGNAL */ +#endif /* HAVE_SIGACTION */ + volatile long timeout; + volatile unsigned int prev_alarm = 0; + struct SessionHandle *data = conn->data; +#endif /* USE_ALARM_TIMEOUT */ + int rc; + + *entry = NULL; + +#ifdef USE_ALARM_TIMEOUT + if (data->set.no_signal) + /* Ignore the timeout when signals are disabled */ + timeout = 0; + else + timeout = timeoutms; + + if(!timeout) + /* USE_ALARM_TIMEOUT defined, but no timeout actually requested */ + return Curl_resolv(conn, hostname, port, entry); + + if(timeout < 1000) + /* The alarm() function only provides integer second resolution, so if + we want to wait less than one second we must bail out already now. */ + return CURLRESOLV_TIMEDOUT; + + /************************************************************* + * Set signal handler to catch SIGALRM + * Store the old value to be able to set it back later! + *************************************************************/ +#ifdef HAVE_SIGACTION + sigaction(SIGALRM, NULL, &sigact); + keep_sigact = sigact; + keep_copysig = TRUE; /* yes, we have a copy */ + sigact.sa_handler = alarmfunc; +#ifdef SA_RESTART + /* HPUX doesn't have SA_RESTART but defaults to that behaviour! */ + sigact.sa_flags &= ~SA_RESTART; +#endif + /* now set the new struct */ + sigaction(SIGALRM, &sigact, NULL); +#else /* HAVE_SIGACTION */ + /* no sigaction(), revert to the much lamer signal() */ +#ifdef HAVE_SIGNAL + keep_sigact = signal(SIGALRM, alarmfunc); +#endif +#endif /* HAVE_SIGACTION */ + + /* alarm() makes a signal get sent when the timeout fires off, and that + will abort system calls */ + prev_alarm = alarm(curlx_sltoui(timeout/1000L)); + + /* This allows us to time-out from the name resolver, as the timeout + will generate a signal and we will siglongjmp() from that here. + This technique has problems (see alarmfunc). + This should be the last thing we do before calling Curl_resolv(), + as otherwise we'd have to worry about variables that get modified + before we invoke Curl_resolv() (and thus use "volatile"). */ + if(sigsetjmp(curl_jmpenv, 1)) { + /* this is coming from a siglongjmp() after an alarm signal */ + failf(data, "name lookup timed out"); + rc = CURLRESOLV_ERROR; + goto clean_up; + } + +#else +#ifndef CURLRES_ASYNCH + if(timeoutms) + infof(conn->data, "timeout on name lookup is not supported\n"); +#else + (void)timeoutms; /* timeoutms not used with an async resolver */ +#endif +#endif /* USE_ALARM_TIMEOUT */ + + /* Perform the actual name resolution. This might be interrupted by an + * alarm if it takes too long. + */ + rc = Curl_resolv(conn, hostname, port, entry); + +#ifdef USE_ALARM_TIMEOUT +clean_up: + + if(!prev_alarm) + /* deactivate a possibly active alarm before uninstalling the handler */ + alarm(0); + +#ifdef HAVE_SIGACTION + if(keep_copysig) { + /* we got a struct as it looked before, now put that one back nice + and clean */ + sigaction(SIGALRM, &keep_sigact, NULL); /* put it back */ + } +#else +#ifdef HAVE_SIGNAL + /* restore the previous SIGALRM handler */ + signal(SIGALRM, keep_sigact); +#endif +#endif /* HAVE_SIGACTION */ + + /* switch back the alarm() to either zero or to what it was before minus + the time we spent until now! */ + if(prev_alarm) { + /* there was an alarm() set before us, now put it back */ + unsigned long elapsed_ms = Curl_tvdiff(Curl_tvnow(), conn->created); + + /* the alarm period is counted in even number of seconds */ + unsigned long alarm_set = prev_alarm - elapsed_ms/1000; + + if(!alarm_set || + ((alarm_set >= 0x80000000) && (prev_alarm < 0x80000000)) ) { + /* if the alarm time-left reached zero or turned "negative" (counted + with unsigned values), we should fire off a SIGALRM here, but we + won't, and zero would be to switch it off so we never set it to + less than 1! */ + alarm(1); + rc = CURLRESOLV_TIMEDOUT; + failf(data, "Previous alarm fired off!"); + } + else + alarm((unsigned int)alarm_set); + } +#endif /* USE_ALARM_TIMEOUT */ + + return rc; +} + +/* + * Curl_resolv_unlock() unlocks the given cached DNS entry. When this has been + * made, the struct may be destroyed due to pruning. It is important that only + * one unlock is made for each Curl_resolv() call. + */ +void Curl_resolv_unlock(struct SessionHandle *data, struct Curl_dns_entry *dns) +{ + DEBUGASSERT(dns && (dns->inuse>0)); + + if(data->share) + Curl_share_lock(data, CURL_LOCK_DATA_DNS, CURL_LOCK_ACCESS_SINGLE); + + dns->inuse--; + /* only free if nobody is using AND it is not in hostcache (timestamp == + 0) */ + if (dns->inuse == 0 && dns->timestamp == 0) { + Curl_freeaddrinfo(dns->addr); + free(dns); + } + + if(data->share) + Curl_share_unlock(data, CURL_LOCK_DATA_DNS); +} + +/* + * File-internal: free a cache dns entry. + */ +static void freednsentry(void *freethis) +{ + struct Curl_dns_entry *p = (struct Curl_dns_entry *) freethis; + + /* mark the entry as not in hostcache */ + p->timestamp = 0; + if (p->inuse == 0) { + Curl_freeaddrinfo(p->addr); + free(p); + } +} + +/* + * Curl_mk_dnscache() creates a new DNS cache and returns the handle for it. + */ +struct curl_hash *Curl_mk_dnscache(void) +{ + return Curl_hash_alloc(7, Curl_hash_str, Curl_str_key_compare, freednsentry); +} + + diff --git a/mobicore/common/curl/lib/hostip.h b/mobicore/common/curl/lib/hostip.h new file mode 100644 index 0000000000000000000000000000000000000000..2f8d4b56c9cd43172c3679af6239cb3adc893a35 --- /dev/null +++ b/mobicore/common/curl/lib/hostip.h @@ -0,0 +1,219 @@ +#ifndef HEADER_CURL_HOSTIP_H +#define HEADER_CURL_HOSTIP_H +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) 1998 - 2010, Daniel Stenberg, , et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at http://curl.haxx.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ***************************************************************************/ + +#include "setup.h" +#include "hash.h" +#include "curl_addrinfo.h" + +#ifdef HAVE_SETJMP_H +#include +#endif + +#ifdef NETWARE +#undef in_addr_t +#define in_addr_t unsigned long +#endif + +/* + * Comfortable CURLRES_* definitions are included from setup.h + */ + +#ifdef USE_ARES +#include +#endif + +/* Allocate enough memory to hold the full name information structs and + * everything. OSF1 is known to require at least 8872 bytes. The buffer + * required for storing all possible aliases and IP numbers is according to + * Stevens' Unix Network Programming 2nd edition, p. 304: 8192 bytes! + */ +#define CURL_HOSTENT_SIZE 9000 + +#define CURL_TIMEOUT_RESOLVE 300 /* when using asynch methods, we allow this + many seconds for a name resolve */ + +#ifdef CURLRES_ARES +#define CURL_ASYNC_SUCCESS ARES_SUCCESS +#if ARES_VERSION >= 0x010500 +/* c-ares 1.5.0 or later, the callback proto is modified */ +#define HAVE_CARES_CALLBACK_TIMEOUTS 1 +#endif +#else +#define CURL_ASYNC_SUCCESS CURLE_OK +#define ares_cancel(x) do {} while(0) +#define ares_destroy(x) do {} while(0) +#endif + +struct addrinfo; +struct hostent; +struct SessionHandle; +struct connectdata; + +/* + * Curl_global_host_cache_init() initializes and sets up a global DNS cache. + * Global DNS cache is general badness. Do not use. This will be removed in + * a future version. Use the share interface instead! + * + * Returns a struct curl_hash pointer on success, NULL on failure. + */ +struct curl_hash *Curl_global_host_cache_init(void); +void Curl_global_host_cache_dtor(void); + +struct Curl_dns_entry { + Curl_addrinfo *addr; + /* timestamp == 0 -- entry not in hostcache + timestamp != 0 -- entry is in hostcache */ + time_t timestamp; + long inuse; /* use-counter, make very sure you decrease this + when you're done using the address you received */ +}; + +/* + * Curl_resolv() returns an entry with the info for the specified host + * and port. + * + * The returned data *MUST* be "unlocked" with Curl_resolv_unlock() after + * use, or we'll leak memory! + */ +/* return codes */ +#define CURLRESOLV_TIMEDOUT -2 +#define CURLRESOLV_ERROR -1 +#define CURLRESOLV_RESOLVED 0 +#define CURLRESOLV_PENDING 1 +int Curl_resolv(struct connectdata *conn, const char *hostname, + int port, struct Curl_dns_entry **dnsentry); +int Curl_resolv_timeout(struct connectdata *conn, const char *hostname, + int port, struct Curl_dns_entry **dnsentry, + long timeoutms); + +/* + * Curl_ipvalid() checks what CURL_IPRESOLVE_* requirements that might've + * been set and returns TRUE if they are OK. + */ +bool Curl_ipvalid(struct connectdata *conn); + +/* + * Curl_getaddrinfo() is the generic low-level name resolve API within this + * source file. There are several versions of this function - for different + * name resolve layers (selected at build-time). They all take this same set + * of arguments + */ +Curl_addrinfo *Curl_getaddrinfo(struct connectdata *conn, + const char *hostname, + int port, + int *waitp); + +CURLcode Curl_is_resolved(struct connectdata *conn, + struct Curl_dns_entry **dns); +CURLcode Curl_wait_for_resolv(struct connectdata *conn, + struct Curl_dns_entry **dnsentry); + +/* Curl_resolv_getsock() is a generic function that exists in multiple + versions depending on what name resolve technology we've built to use. The + function is called from the multi_getsock() function. 'sock' is a pointer + to an array to hold the file descriptors, with 'numsock' being the size of + that array (in number of entries). This function is supposed to return + bitmask indicating what file descriptors (referring to array indexes in the + 'sock' array) to wait for, read/write. */ +int Curl_resolv_getsock(struct connectdata *conn, curl_socket_t *sock, + int numsocks); + +/* unlock a previously resolved dns entry */ +void Curl_resolv_unlock(struct SessionHandle *data, + struct Curl_dns_entry *dns); + +/* for debugging purposes only: */ +void Curl_scan_cache_used(void *user, void *ptr); + +/* make a new dns cache and return the handle */ +struct curl_hash *Curl_mk_dnscache(void); + +/* prune old entries from the DNS cache */ +void Curl_hostcache_prune(struct SessionHandle *data); + +/* Return # of adresses in a Curl_addrinfo struct */ +int Curl_num_addresses (const Curl_addrinfo *addr); + +#if defined(CURLDEBUG) && defined(HAVE_GETNAMEINFO) +int curl_dogetnameinfo(GETNAMEINFO_QUAL_ARG1 GETNAMEINFO_TYPE_ARG1 sa, + GETNAMEINFO_TYPE_ARG2 salen, + char *host, GETNAMEINFO_TYPE_ARG46 hostlen, + char *serv, GETNAMEINFO_TYPE_ARG46 servlen, + GETNAMEINFO_TYPE_ARG7 flags, + int line, const char *source); +#endif + +/* IPv4 threadsafe resolve function used for synch and asynch builds */ +Curl_addrinfo *Curl_ipv4_resolve_r(const char * hostname, int port); + +/* + * Curl_addrinfo_callback() is used when we build with any asynch specialty. + * Handles end of async request processing. Inserts ai into hostcache when + * status is CURL_ASYNC_SUCCESS. Twiddles fields in conn to indicate async + * request completed wether successfull or failed. + */ +CURLcode Curl_addrinfo_callback(struct connectdata *conn, + int status, + Curl_addrinfo *ai); + +/* + * Curl_printable_address() returns a printable version of the 1st address + * given in the 'ip' argument. The result will be stored in the buf that is + * bufsize bytes big. + */ +const char *Curl_printable_address(const Curl_addrinfo *ip, + char *buf, size_t bufsize); + +/* + * Curl_cache_addr() stores a 'Curl_addrinfo' struct in the DNS cache. + * + * Returns the Curl_dns_entry entry pointer or NULL if the storage failed. + */ +struct Curl_dns_entry * +Curl_cache_addr(struct SessionHandle *data, Curl_addrinfo *addr, + const char *hostname, int port); + +/* + * Curl_destroy_thread_data() cleans up async resolver data. + * Complementary of ares_destroy. + */ +struct Curl_async; /* forward-declaration */ +void Curl_destroy_thread_data(struct Curl_async *async); + +#ifndef INADDR_NONE +#define CURL_INADDR_NONE (in_addr_t) ~0 +#else +#define CURL_INADDR_NONE INADDR_NONE +#endif + +#ifdef HAVE_SIGSETJMP +/* Forward-declaration of variable defined in hostip.c. Beware this + * is a global and unique instance. This is used to store the return + * address that we can jump back to from inside a signal handler. + * This is not thread-safe stuff. + */ +extern sigjmp_buf curl_jmpenv; +#endif + +#endif /* HEADER_CURL_HOSTIP_H */ diff --git a/mobicore/common/curl/lib/hostip4.c b/mobicore/common/curl/lib/hostip4.c new file mode 100644 index 0000000000000000000000000000000000000000..6dc5257656e235e324d613bda62eeeeca2df0999 --- /dev/null +++ b/mobicore/common/curl/lib/hostip4.c @@ -0,0 +1,319 @@ +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) 1998 - 2010, Daniel Stenberg, , et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at http://curl.haxx.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ***************************************************************************/ + +#include "setup.h" + +#include +#include + +#ifdef HAVE_SYS_SOCKET_H +#include +#endif +#ifdef HAVE_NETINET_IN_H +#include +#endif +#ifdef HAVE_NETDB_H +#include +#endif +#ifdef HAVE_ARPA_INET_H +#include +#endif +#ifdef HAVE_STDLIB_H +#include /* required for free() prototypes */ +#endif +#ifdef HAVE_UNISTD_H +#include /* for the close() proto */ +#endif +#ifdef __VMS +#include +#include +#include +#endif + +#ifdef HAVE_PROCESS_H +#include +#endif + +#include "urldata.h" +#include "sendf.h" +#include "hostip.h" +#include "hash.h" +#include "share.h" +#include "strerror.h" +#include "url.h" +#include "inet_pton.h" + +#define _MPRINTF_REPLACE /* use our functions only */ +#include + +#include "curl_memory.h" +/* The last #include file should be: */ +#include "memdebug.h" + +/*********************************************************************** + * Only for plain-ipv4 builds + **********************************************************************/ +#ifdef CURLRES_IPV4 /* plain ipv4 code coming up */ +/* + * Curl_ipvalid() checks what CURL_IPRESOLVE_* requirements that might've + * been set and returns TRUE if they are OK. + */ +bool Curl_ipvalid(struct connectdata *conn) +{ + if(conn->ip_version == CURL_IPRESOLVE_V6) + /* an ipv6 address was requested and we can't get/use one */ + return FALSE; + + return TRUE; /* OK, proceed */ +} + +#ifdef CURLRES_SYNCH +/* + * Curl_getaddrinfo() - the ipv4 synchronous version. + * + * The original code to this function was from the Dancer source code, written + * by Bjorn Reese, it has since been patched and modified considerably. + * + * gethostbyname_r() is the thread-safe version of the gethostbyname() + * function. When we build for plain IPv4, we attempt to use this + * function. There are _three_ different gethostbyname_r() versions, and we + * detect which one this platform supports in the configure script and set up + * the HAVE_GETHOSTBYNAME_R_3, HAVE_GETHOSTBYNAME_R_5 or + * HAVE_GETHOSTBYNAME_R_6 defines accordingly. Note that HAVE_GETADDRBYNAME + * has the corresponding rules. This is primarily on *nix. Note that some unix + * flavours have thread-safe versions of the plain gethostbyname() etc. + * + */ +Curl_addrinfo *Curl_getaddrinfo(struct connectdata *conn, + const char *hostname, + int port, + int *waitp) +{ + Curl_addrinfo *ai = NULL; + +#ifdef CURL_DISABLE_VERBOSE_STRINGS + (void)conn; +#endif + + *waitp = 0; /* synchronous response only */ + + ai = Curl_ipv4_resolve_r(hostname, port); + if(!ai) + infof(conn->data, "Curl_ipv4_resolve_r failed for %s\n", hostname); + + return ai; +} +#endif /* CURLRES_SYNCH */ +#endif /* CURLRES_IPV4 */ + +/* + * Curl_ipv4_resolve_r() - ipv4 threadsafe resolver function. + * + * This is used for both synchronous and asynchronous resolver builds, + * implying that only threadsafe code and function calls may be used. + * + */ +Curl_addrinfo *Curl_ipv4_resolve_r(const char *hostname, + int port) +{ +#if !defined(HAVE_GETADDRINFO_THREADSAFE) && defined(HAVE_GETHOSTBYNAME_R_3) + int res; +#endif + Curl_addrinfo *ai = NULL; + struct hostent *h = NULL; + struct in_addr in; + struct hostent *buf = NULL; + + if(Curl_inet_pton(AF_INET, hostname, &in) > 0) + /* This is a dotted IP address 123.123.123.123-style */ + return Curl_ip2addr(AF_INET, &in, hostname, port); + +#if defined(HAVE_GETADDRINFO_THREADSAFE) + else { + struct addrinfo hints; + char sbuf[NI_MAXSERV]; + char *sbufptr = NULL; + + memset(&hints, 0, sizeof(hints)); + hints.ai_family = PF_INET; + hints.ai_socktype = SOCK_STREAM; + if(port) { + snprintf(sbuf, sizeof(sbuf), "%d", port); + sbufptr = sbuf; + } + + (void)Curl_getaddrinfo_ex(hostname, sbufptr, &hints, &ai); + +#elif defined(HAVE_GETHOSTBYNAME_R) + /* + * gethostbyname_r() is the preferred resolve function for many platforms. + * Since there are three different versions of it, the following code is + * somewhat #ifdef-ridden. + */ + else { + int h_errnop; + + buf = calloc(1, CURL_HOSTENT_SIZE); + if(!buf) + return NULL; /* major failure */ + /* + * The clearing of the buffer is a workaround for a gethostbyname_r bug in + * qnx nto and it is also _required_ for some of these functions on some + * platforms. + */ + +#if defined(HAVE_GETHOSTBYNAME_R_5) + /* Solaris, IRIX and more */ + h = gethostbyname_r(hostname, + (struct hostent *)buf, + (char *)buf + sizeof(struct hostent), + CURL_HOSTENT_SIZE - sizeof(struct hostent), + &h_errnop); + + /* If the buffer is too small, it returns NULL and sets errno to + * ERANGE. The errno is thread safe if this is compiled with + * -D_REENTRANT as then the 'errno' variable is a macro defined to get + * used properly for threads. + */ + + if(h) { + ; + } + else +#elif defined(HAVE_GETHOSTBYNAME_R_6) + /* Linux */ + + (void)gethostbyname_r(hostname, + (struct hostent *)buf, + (char *)buf + sizeof(struct hostent), + CURL_HOSTENT_SIZE - sizeof(struct hostent), + &h, /* DIFFERENCE */ + &h_errnop); + /* Redhat 8, using glibc 2.2.93 changed the behavior. Now all of a + * sudden this function returns EAGAIN if the given buffer size is too + * small. Previous versions are known to return ERANGE for the same + * problem. + * + * This wouldn't be such a big problem if older versions wouldn't + * sometimes return EAGAIN on a common failure case. Alas, we can't + * assume that EAGAIN *or* ERANGE means ERANGE for any given version of + * glibc. + * + * For now, we do that and thus we may call the function repeatedly and + * fail for older glibc versions that return EAGAIN, until we run out of + * buffer size (step_size grows beyond CURL_HOSTENT_SIZE). + * + * If anyone has a better fix, please tell us! + * + * ------------------------------------------------------------------- + * + * On October 23rd 2003, Dan C dug up more details on the mysteries of + * gethostbyname_r() in glibc: + * + * In glibc 2.2.5 the interface is different (this has also been + * discovered in glibc 2.1.1-6 as shipped by Redhat 6). What I can't + * explain, is that tests performed on glibc 2.2.4-34 and 2.2.4-32 + * (shipped/upgraded by Redhat 7.2) don't show this behavior! + * + * In this "buggy" version, the return code is -1 on error and 'errno' + * is set to the ERANGE or EAGAIN code. Note that 'errno' is not a + * thread-safe variable. + */ + + if(!h) /* failure */ +#elif defined(HAVE_GETHOSTBYNAME_R_3) + /* AIX, Digital Unix/Tru64, HPUX 10, more? */ + + /* For AIX 4.3 or later, we don't use gethostbyname_r() at all, because of + * the plain fact that it does not return unique full buffers on each + * call, but instead several of the pointers in the hostent structs will + * point to the same actual data! This have the unfortunate down-side that + * our caching system breaks down horribly. Luckily for us though, AIX 4.3 + * and more recent versions have a "completely thread-safe"[*] libc where + * all the data is stored in thread-specific memory areas making calls to + * the plain old gethostbyname() work fine even for multi-threaded + * programs. + * + * This AIX 4.3 or later detection is all made in the configure script. + * + * Troels Walsted Hansen helped us work this out on March 3rd, 2003. + * + * [*] = much later we've found out that it isn't at all "completely + * thread-safe", but at least the gethostbyname() function is. + */ + + if(CURL_HOSTENT_SIZE >= + (sizeof(struct hostent)+sizeof(struct hostent_data))) { + + /* August 22nd, 2000: Albert Chin-A-Young brought an updated version + * that should work! September 20: Richard Prescott worked on the buffer + * size dilemma. + */ + + res = gethostbyname_r(hostname, + (struct hostent *)buf, + (struct hostent_data *)((char *)buf + + sizeof(struct hostent))); + h_errnop = SOCKERRNO; /* we don't deal with this, but set it anyway */ + } + else + res = -1; /* failure, too smallish buffer size */ + + if(!res) { /* success */ + + h = buf; /* result expected in h */ + + /* This is the worst kind of the different gethostbyname_r() interfaces. + * Since we don't know how big buffer this particular lookup required, + * we can't realloc down the huge alloc without doing closer analysis of + * the returned data. Thus, we always use CURL_HOSTENT_SIZE for every + * name lookup. Fixing this would require an extra malloc() and then + * calling Curl_addrinfo_copy() that subsequent realloc()s down the new + * memory area to the actually used amount. + */ + } + else +#endif /* HAVE_...BYNAME_R_5 || HAVE_...BYNAME_R_6 || HAVE_...BYNAME_R_3 */ + { + h = NULL; /* set return code to NULL */ + free(buf); + } +#else /* HAVE_GETADDRINFO_THREADSAFE || HAVE_GETHOSTBYNAME_R */ + /* + * Here is code for platforms that don't have a thread safe + * getaddrinfo() nor gethostbyname_r() function or for which + * gethostbyname() is the preferred one. + */ + else { + h = gethostbyname((void*)hostname); +#endif /* HAVE_GETADDRINFO_THREADSAFE || HAVE_GETHOSTBYNAME_R */ + } + + if(h) { + ai = Curl_he2ai(h, port); + + if(buf) /* used a *_r() function */ + free(buf); + } + + return ai; +} diff --git a/mobicore/common/curl/lib/hostip6.c b/mobicore/common/curl/lib/hostip6.c new file mode 100644 index 0000000000000000000000000000000000000000..ca0280790a5b814b5cd472a9bb0760ac9f25a210 --- /dev/null +++ b/mobicore/common/curl/lib/hostip6.c @@ -0,0 +1,233 @@ +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) 1998 - 2010, Daniel Stenberg, , et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at http://curl.haxx.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ***************************************************************************/ + +#include "setup.h" + +#include + +#ifdef HAVE_SYS_SOCKET_H +#include +#endif +#ifdef HAVE_NETINET_IN_H +#include +#endif +#ifdef HAVE_NETDB_H +#include +#endif +#ifdef HAVE_ARPA_INET_H +#include +#endif +#ifdef HAVE_STDLIB_H +#include /* required for free() prototypes */ +#endif +#ifdef HAVE_UNISTD_H +#include /* for the close() proto */ +#endif +#ifdef __VMS +#include +#include +#include +#endif + +#ifdef HAVE_PROCESS_H +#include +#endif + +#include "urldata.h" +#include "sendf.h" +#include "hostip.h" +#include "hash.h" +#include "share.h" +#include "strerror.h" +#include "url.h" +#include "inet_pton.h" +#include "connect.h" + +#define _MPRINTF_REPLACE /* use our functions only */ +#include + +#include "curl_memory.h" +/* The last #include file should be: */ +#include "memdebug.h" + +/*********************************************************************** + * Only for ipv6-enabled builds + **********************************************************************/ +#ifdef CURLRES_IPV6 + + +#if defined(CURLDEBUG) && defined(HAVE_GETNAMEINFO) +/* These are strictly for memory tracing and are using the same style as the + * family otherwise present in memdebug.c. I put these ones here since they + * require a bunch of structs I didn't wanna include in memdebug.c + */ + +/* + * For CURLRES_ARS, this should be written using ares_gethostbyaddr() + * (ignoring the fact c-ares doesn't return 'serv'). + */ + +int curl_dogetnameinfo(GETNAMEINFO_QUAL_ARG1 GETNAMEINFO_TYPE_ARG1 sa, + GETNAMEINFO_TYPE_ARG2 salen, + char *host, GETNAMEINFO_TYPE_ARG46 hostlen, + char *serv, GETNAMEINFO_TYPE_ARG46 servlen, + GETNAMEINFO_TYPE_ARG7 flags, + int line, const char *source) +{ + int res = (getnameinfo)(sa, salen, + host, hostlen, + serv, servlen, + flags); + if(0 == res) + /* success */ + curl_memlog("GETNAME %s:%d getnameinfo()\n", + source, line); + else + curl_memlog("GETNAME %s:%d getnameinfo() failed = %d\n", + source, line, res); + return res; +} +#endif /* defined(CURLDEBUG) && defined(HAVE_GETNAMEINFO) */ + +/* + * Curl_ipvalid() checks what CURL_IPRESOLVE_* requirements that might've + * been set and returns TRUE if they are OK. + */ +bool Curl_ipvalid(struct connectdata *conn) +{ + if(conn->ip_version == CURL_IPRESOLVE_V6) { + /* see if we have an IPv6 stack */ + curl_socket_t s = socket(PF_INET6, SOCK_DGRAM, 0); + if(s == CURL_SOCKET_BAD) + /* an ipv6 address was requested and we can't get/use one */ + return FALSE; + sclose(s); + } + return TRUE; +} + +#if defined(CURLRES_SYNCH) + +#ifdef DEBUG_ADDRINFO +static void dump_addrinfo(struct connectdata *conn, const Curl_addrinfo *ai) +{ + printf("dump_addrinfo:\n"); + for ( ; ai; ai = ai->ai_next) { + char buf[INET6_ADDRSTRLEN]; + + printf(" fam %2d, CNAME %s, ", + ai->ai_family, ai->ai_canonname ? ai->ai_canonname : ""); + if(Curl_printable_address(ai, buf, sizeof(buf))) + printf("%s\n", buf); + else + printf("failed; %s\n", Curl_strerror(conn, SOCKERRNO)); + } +} +#else +#define dump_addrinfo(x,y) +#endif + +/* + * Curl_getaddrinfo() when built ipv6-enabled (non-threading and + * non-ares version). + * + * Returns name information about the given hostname and port number. If + * successful, the 'addrinfo' is returned and the forth argument will point to + * memory we need to free after use. That memory *MUST* be freed with + * Curl_freeaddrinfo(), nothing else. + */ +Curl_addrinfo *Curl_getaddrinfo(struct connectdata *conn, + const char *hostname, + int port, + int *waitp) +{ + struct addrinfo hints; + Curl_addrinfo *res; + int error; + char sbuf[NI_MAXSERV]; + char *sbufptr = NULL; + char addrbuf[128]; + int pf; + struct SessionHandle *data = conn->data; + + *waitp = 0; /* synchronous response only */ + + /* + * Check if a limited name resolve has been requested. + */ + switch(conn->ip_version) { + case CURL_IPRESOLVE_V4: + pf = PF_INET; + break; + case CURL_IPRESOLVE_V6: + pf = PF_INET6; + break; + default: + pf = PF_UNSPEC; + break; + } + + if (pf != PF_INET) { + /* see if we have an IPv6 stack */ + curl_socket_t s = socket(PF_INET6, SOCK_DGRAM, 0); + if(s == CURL_SOCKET_BAD) { + /* Some non-IPv6 stacks have been found to make very slow name resolves + * when PF_UNSPEC is used, so thus we switch to a mere PF_INET lookup if + * the stack seems to be a non-ipv6 one. */ + + pf = PF_INET; + } + else { + /* This seems to be an IPv6-capable stack, use PF_UNSPEC for the widest + * possible checks. And close the socket again. + */ + sclose(s); + } + } + + memset(&hints, 0, sizeof(hints)); + hints.ai_family = pf; + hints.ai_socktype = conn->socktype; + + if((1 == Curl_inet_pton(AF_INET, hostname, addrbuf)) || + (1 == Curl_inet_pton(AF_INET6, hostname, addrbuf))) { + /* the given address is numerical only, prevent a reverse lookup */ + hints.ai_flags = AI_NUMERICHOST; + } + + if(port) { + snprintf(sbuf, sizeof(sbuf), "%d", port); + sbufptr=sbuf; + } + error = Curl_getaddrinfo_ex(hostname, sbufptr, &hints, &res); + if(error) { + infof(data, "getaddrinfo(3) failed for %s:%d\n", hostname, port); + return NULL; + } + + dump_addrinfo(conn, res); + + return res; +} +#endif /* CURLRES_SYNCH */ +#endif /* CURLRES_IPV6 */ + diff --git a/mobicore/common/curl/lib/hostsyn.c b/mobicore/common/curl/lib/hostsyn.c new file mode 100644 index 0000000000000000000000000000000000000000..b68e4702ea729fd299f2bbd9fbbb3d468c33398e --- /dev/null +++ b/mobicore/common/curl/lib/hostsyn.c @@ -0,0 +1,123 @@ +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) 1998 - 2009, Daniel Stenberg, , et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at http://curl.haxx.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ***************************************************************************/ + +#include "setup.h" + +#include + +#ifdef HAVE_SYS_SOCKET_H +#include +#endif +#ifdef HAVE_NETINET_IN_H +#include +#endif +#ifdef HAVE_NETDB_H +#include +#endif +#ifdef HAVE_ARPA_INET_H +#include +#endif +#ifdef HAVE_STDLIB_H +#include /* required for free() prototypes */ +#endif +#ifdef HAVE_UNISTD_H +#include /* for the close() proto */ +#endif +#ifdef __VMS +#include +#include +#include +#endif + +#ifdef HAVE_PROCESS_H +#include +#endif + +#include "urldata.h" +#include "sendf.h" +#include "hostip.h" +#include "hash.h" +#include "share.h" +#include "strerror.h" +#include "url.h" + +#define _MPRINTF_REPLACE /* use our functions only */ +#include + +#include "curl_memory.h" +/* The last #include file should be: */ +#include "memdebug.h" + +/*********************************************************************** + * Only for builds using synchronous name resolves + **********************************************************************/ +#ifdef CURLRES_SYNCH + +/* + * Curl_wait_for_resolv() for synch-builds. Curl_resolv() can never return + * wait==TRUE, so this function will never be called. If it still gets called, + * we return failure at once. + * + * We provide this function only to allow multi.c to remain unaware if we are + * doing asynch resolves or not. + */ +CURLcode Curl_wait_for_resolv(struct connectdata *conn, + struct Curl_dns_entry **entry) +{ + (void)conn; + *entry=NULL; + return CURLE_COULDNT_RESOLVE_HOST; +} + +/* + * This function will never be called when synch-built. If it still gets + * called, we return failure at once. + * + * We provide this function only to allow multi.c to remain unaware if we are + * doing asynch resolves or not. + */ +CURLcode Curl_is_resolved(struct connectdata *conn, + struct Curl_dns_entry **dns) +{ + (void)conn; + *dns = NULL; + + return CURLE_COULDNT_RESOLVE_HOST; +} + +/* + * We just return OK, this function is never actually used for synch builds. + * It is present here to keep #ifdefs out from multi.c + */ + +int Curl_resolv_getsock(struct connectdata *conn, + curl_socket_t *sock, + int numsocks) +{ + (void)conn; + (void)sock; + (void)numsocks; + + return 0; /* no bits since we don't use any socks */ +} + +#endif /* truly sync */ diff --git a/mobicore/common/curl/lib/hostthre.c b/mobicore/common/curl/lib/hostthre.c new file mode 100644 index 0000000000000000000000000000000000000000..d45a8993cb3a1845501f707ff067a57001f76d5a --- /dev/null +++ b/mobicore/common/curl/lib/hostthre.c @@ -0,0 +1,579 @@ +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) 1998 - 2010, Daniel Stenberg, , et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at http://curl.haxx.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ***************************************************************************/ + +#include "setup.h" + +#include +#include + +#ifdef HAVE_SYS_SOCKET_H +#include +#endif +#ifdef HAVE_NETINET_IN_H +#include +#endif +#ifdef HAVE_NETDB_H +#include +#endif +#ifdef HAVE_ARPA_INET_H +#include +#endif +#ifdef HAVE_STDLIB_H +#include /* required for free() prototypes */ +#endif +#ifdef HAVE_UNISTD_H +#include /* for the close() proto */ +#endif +#ifdef __VMS +#include +#include +#include +#endif + +#if defined(USE_THREADS_POSIX) +# ifdef HAVE_PTHREAD_H +# include +# endif +#elif defined(USE_THREADS_WIN32) +# ifdef HAVE_PROCESS_H +# include +# endif +#endif + +#if (defined(NETWARE) && defined(__NOVELL_LIBC__)) +#undef in_addr_t +#define in_addr_t unsigned long +#endif + +#include "urldata.h" +#include "sendf.h" +#include "hostip.h" +#include "hash.h" +#include "share.h" +#include "strerror.h" +#include "url.h" +#include "multiif.h" +#include "inet_pton.h" +#include "inet_ntop.h" +#include "curl_threads.h" + +#define _MPRINTF_REPLACE /* use our functions only */ +#include + +#include "curl_memory.h" +/* The last #include file should be: */ +#include "memdebug.h" + +/*********************************************************************** + * Only for threaded name resolves builds + **********************************************************************/ +#ifdef CURLRES_THREADED + +/* This function is used to init a threaded resolve */ +static bool init_resolve_thread(struct connectdata *conn, + const char *hostname, int port, + const struct addrinfo *hints); + + +/* Data for synchronization between resolver thread and its parent */ +struct thread_sync_data { + curl_mutex_t * mtx; + int done; + + char * hostname; /* hostname to resolve, Curl_async.hostname + duplicate */ + int port; + int sock_error; + Curl_addrinfo *res; +#ifdef HAVE_GETADDRINFO + struct addrinfo hints; +#endif +}; + +struct thread_data { + curl_thread_t thread_hnd; + curl_socket_t dummy_sock; + unsigned int poll_interval; + int interval_end; + struct thread_sync_data tsd; +}; + +static struct thread_sync_data * conn_thread_sync_data(struct connectdata *conn) +{ + return &(((struct thread_data *)conn->async.os_specific)->tsd); +} + +#define CONN_THREAD_SYNC_DATA(conn) &(((conn)->async.os_specific)->tsd); + +/* Destroy resolver thread synchronization data */ +static +void destroy_thread_sync_data(struct thread_sync_data * tsd) +{ + if (tsd->mtx) { + Curl_mutex_destroy(tsd->mtx); + free(tsd->mtx); + } + + if(tsd->hostname) + free(tsd->hostname); + + if (tsd->res) + Curl_freeaddrinfo(tsd->res); + + memset(tsd,0,sizeof(*tsd)); +} + +/* Initialize resolver thread synchronization data */ +static +int init_thread_sync_data(struct thread_sync_data * tsd, + const char * hostname, + int port, + const struct addrinfo *hints) +{ + memset(tsd, 0, sizeof(*tsd)); + + tsd->port = port; +#ifdef CURLRES_IPV6 + DEBUGASSERT(hints); + tsd->hints = *hints; +#else + (void) hints; +#endif + + tsd->mtx = malloc(sizeof(curl_mutex_t)); + if (tsd->mtx == NULL) goto err_exit; + + Curl_mutex_init(tsd->mtx); + + tsd->sock_error = CURL_ASYNC_SUCCESS; + + /* Copying hostname string because original can be destroyed by parent + * thread during gethostbyname execution. + */ + tsd->hostname = strdup(hostname); + if (!tsd->hostname) goto err_exit; + + return 1; + + err_exit: + /* Memory allocation failed */ + destroy_thread_sync_data(tsd); + return 0; +} + +static int getaddrinfo_complete(struct connectdata *conn) +{ + struct thread_sync_data *tsd = conn_thread_sync_data(conn); + int rc; + + rc = Curl_addrinfo_callback(conn, tsd->sock_error, tsd->res); + /* The tsd->res structure has been copied to async.dns and perhaps the DNS cache. + Set our copy to NULL so destroy_thread_sync_data doesn't free it. + */ + tsd->res = NULL; + + return rc; +} + + +#ifdef HAVE_GETADDRINFO + +/* + * getaddrinfo_thread() resolves a name and then exits. + * + * For builds without ARES, but with ENABLE_IPV6, create a resolver thread + * and wait on it. + */ +static unsigned int CURL_STDCALL getaddrinfo_thread (void *arg) +{ + struct thread_sync_data *tsd = (struct thread_sync_data*)arg; + char service [NI_MAXSERV]; + int rc; + + snprintf(service, sizeof(service), "%d", tsd->port); + + rc = Curl_getaddrinfo_ex(tsd->hostname, service, &tsd->hints, &tsd->res); + + if (rc != 0) { + tsd->sock_error = SOCKERRNO; + if (tsd->sock_error == 0) + tsd->sock_error = ENOMEM; + } + + Curl_mutex_acquire(tsd->mtx); + tsd->done = 1; + Curl_mutex_release(tsd->mtx); + + return 0; +} + +#else /* HAVE_GETADDRINFO */ + +/* + * gethostbyname_thread() resolves a name and then exits. + */ +static unsigned int CURL_STDCALL gethostbyname_thread (void *arg) +{ + struct thread_sync_data *tsd = (struct thread_sync_data *)arg; + + tsd->res = Curl_ipv4_resolve_r(tsd->hostname, tsd->port); + + if (!tsd->res) { + tsd->sock_error = SOCKERRNO; + if (tsd->sock_error == 0) + tsd->sock_error = ENOMEM; + } + + Curl_mutex_acquire(tsd->mtx); + tsd->done = 1; + Curl_mutex_release(tsd->mtx); + + return 0; +} + +#endif /* HAVE_GETADDRINFO */ + +/* + * Curl_destroy_thread_data() cleans up async resolver data and thread handle. + * Complementary of ares_destroy. + */ +void Curl_destroy_thread_data (struct Curl_async *async) +{ + if(async->hostname) + free(async->hostname); + + if(async->os_specific) { + struct thread_data *td = (struct thread_data*) async->os_specific; + + if (td->dummy_sock != CURL_SOCKET_BAD) + sclose(td->dummy_sock); + + if (td->thread_hnd != curl_thread_t_null) + Curl_thread_join(&td->thread_hnd); + + destroy_thread_sync_data(&td->tsd); + + free(async->os_specific); + } + async->hostname = NULL; + async->os_specific = NULL; +} + +/* + * init_resolve_thread() starts a new thread that performs the actual + * resolve. This function returns before the resolve is done. + * + * Returns FALSE in case of failure, otherwise TRUE. + */ +static bool init_resolve_thread (struct connectdata *conn, + const char *hostname, int port, + const struct addrinfo *hints) +{ + struct thread_data *td = calloc(1, sizeof(struct thread_data)); + int err = ENOMEM; + + conn->async.os_specific = (void*) td; + if(!td) + goto err_exit; + + conn->async.port = port; + conn->async.done = FALSE; + conn->async.status = 0; + conn->async.dns = NULL; + td->dummy_sock = CURL_SOCKET_BAD; + td->thread_hnd = curl_thread_t_null; + + if (!init_thread_sync_data(&td->tsd, hostname, port, hints)) + goto err_exit; + + Curl_safefree(conn->async.hostname); + conn->async.hostname = strdup(hostname); + if(!conn->async.hostname) + goto err_exit; + +#ifdef WIN32 + /* This socket is only to keep Curl_resolv_fdset() and select() happy; + * should never become signalled for read since it's unbound but + * Windows needs at least 1 socket in select(). + */ + td->dummy_sock = socket(AF_INET, SOCK_DGRAM, 0); + if (td->dummy_sock == CURL_SOCKET_BAD) + goto err_exit; +#endif + +#ifdef HAVE_GETADDRINFO + td->thread_hnd = Curl_thread_create(getaddrinfo_thread, &td->tsd); +#else + td->thread_hnd = Curl_thread_create(gethostbyname_thread, &td->tsd); +#endif + + if(!td->thread_hnd) { +#ifndef _WIN32_WCE + err = errno; +#endif + goto err_exit; + } + + return TRUE; + + err_exit: + Curl_destroy_thread_data(&conn->async); + + SET_ERRNO(err); + + return FALSE; +} + + +/* + * Curl_wait_for_resolv() waits for a resolve to finish. This function should + * be avoided since using this risk getting the multi interface to "hang". + * + * If 'entry' is non-NULL, make it point to the resolved dns entry + * + * This is the version for resolves-in-a-thread. + */ +CURLcode Curl_wait_for_resolv(struct connectdata *conn, + struct Curl_dns_entry **entry) +{ + struct thread_data *td = (struct thread_data*) conn->async.os_specific; + struct SessionHandle *data = conn->data; + CURLcode rc = CURLE_OK; + + DEBUGASSERT(conn && td); + + /* wait for the thread to resolve the name */ + if (Curl_thread_join(&td->thread_hnd)) { + rc = getaddrinfo_complete(conn); + } else { + DEBUGASSERT(0); + } + + conn->async.done = TRUE; + + if(entry) + *entry = conn->async.dns; + + if(!conn->async.dns) { + /* a name was not resolved */ + if (conn->bits.httpproxy) { + failf(data, "Could not resolve proxy: %s; %s", + conn->async.hostname, Curl_strerror(conn, conn->async.status)); + rc = CURLE_COULDNT_RESOLVE_PROXY; + } else { + failf(data, "Could not resolve host: %s; %s", + conn->async.hostname, Curl_strerror(conn, conn->async.status)); + rc = CURLE_COULDNT_RESOLVE_HOST; + } + } + + Curl_destroy_thread_data(&conn->async); + + if(!conn->async.dns) + conn->bits.close = TRUE; + + return (rc); +} + +/* + * Curl_is_resolved() is called repeatedly to check if a previous name resolve + * request has completed. It should also make sure to time-out if the + * operation seems to take too long. + */ +CURLcode Curl_is_resolved(struct connectdata *conn, + struct Curl_dns_entry **entry) +{ + struct SessionHandle *data = conn->data; + struct thread_data *td = (struct thread_data*) conn->async.os_specific; + int done = 0; + + *entry = NULL; + + if (!td) { + DEBUGASSERT(td); + return CURLE_COULDNT_RESOLVE_HOST; + } + + Curl_mutex_acquire(td->tsd.mtx); + done = td->tsd.done; + Curl_mutex_release(td->tsd.mtx); + + if (done) { + getaddrinfo_complete(conn); + Curl_destroy_thread_data(&conn->async); + + if(!conn->async.dns) { + failf(data, "Could not resolve host: %s; %s", + conn->host.name, Curl_strerror(conn, conn->async.status)); + return CURLE_COULDNT_RESOLVE_HOST; + } + *entry = conn->async.dns; + } else { + /* poll for name lookup done with exponential backoff up to 250ms */ + int elapsed = Curl_tvdiff(Curl_tvnow(), data->progress.t_startsingle); + if (elapsed < 0) + elapsed = 0; + + if (td->poll_interval == 0) + /* Start at 1ms poll interval */ + td->poll_interval = 1; + else if (elapsed >= td->interval_end) + /* Back-off exponentially if last interval expired */ + td->poll_interval *= 2; + + if (td->poll_interval > 250) + td->poll_interval = 250; + + td->interval_end = elapsed + td->poll_interval; + Curl_expire(conn->data, td->poll_interval); + } + + return CURLE_OK; +} + +int Curl_resolv_getsock(struct connectdata *conn, + curl_socket_t *socks, + int numsocks) +{ + const struct thread_data *td = + (const struct thread_data *) conn->async.os_specific; + + if(td && td->dummy_sock != CURL_SOCKET_BAD) { + if(numsocks) { + /* return one socket waiting for readable, even though this is just + a dummy */ + socks[0] = td->dummy_sock; + return GETSOCK_READSOCK(0); + } + } + return 0; +} + +#ifndef HAVE_GETADDRINFO +/* + * Curl_getaddrinfo() - for platforms without getaddrinfo + */ +Curl_addrinfo *Curl_getaddrinfo(struct connectdata *conn, + const char *hostname, + int port, + int *waitp) +{ + struct in_addr in; + + *waitp = 0; /* default to synchronous response */ + + if(Curl_inet_pton(AF_INET, hostname, &in) > 0) + /* This is a dotted IP address 123.123.123.123-style */ + return Curl_ip2addr(AF_INET, &in, hostname, port); + + /* fire up a new resolver thread! */ + if(init_resolve_thread(conn, hostname, port, NULL)) { + *waitp = 1; /* expect asynchronous response */ + return NULL; + } + + /* fall-back to blocking version */ + return Curl_ipv4_resolve_r(hostname, port); +} + +#else /* !HAVE_GETADDRINFO */ + +/* + * Curl_getaddrinfo() - for getaddrinfo + */ +Curl_addrinfo *Curl_getaddrinfo(struct connectdata *conn, + const char *hostname, + int port, + int *waitp) +{ + struct addrinfo hints; + Curl_addrinfo *res; + int error; + char sbuf[NI_MAXSERV]; + int pf = PF_INET; + struct SessionHandle *data = conn->data; + + *waitp = 0; /* default to synchronous response */ + +#ifndef CURLRES_IPV4 + /* + * Check if a limited name resolve has been requested. + */ + switch(conn->ip_version) { + case CURL_IPRESOLVE_V4: + pf = PF_INET; + break; + case CURL_IPRESOLVE_V6: + pf = PF_INET6; + break; + default: + pf = PF_UNSPEC; + break; + } + + if (pf != PF_INET) { + /* see if we have an IPv6 stack */ + curl_socket_t s = socket(PF_INET6, SOCK_DGRAM, 0); + if(s == CURL_SOCKET_BAD) { + /* Some non-IPv6 stacks have been found to make very slow name resolves + * when PF_UNSPEC is used, so thus we switch to a mere PF_INET lookup if + * the stack seems to be a non-ipv6 one. */ + + pf = PF_INET; + } + else { + /* This seems to be an IPv6-capable stack, use PF_UNSPEC for the widest + * possible checks. And close the socket again. + */ + sclose(s); + } + } +#endif /* !CURLRES_IPV4 */ + + memset(&hints, 0, sizeof(hints)); + hints.ai_family = pf; + hints.ai_socktype = conn->socktype; + + snprintf(sbuf, sizeof(sbuf), "%d", port); + + /* fire up a new resolver thread! */ + if(init_resolve_thread(conn, hostname, port, &hints)) { + *waitp = 1; /* expect asynchronous response */ + return NULL; + } + + /* fall-back to blocking version */ + infof(data, "init_resolve_thread() failed for %s; %s\n", + hostname, Curl_strerror(conn, ERRNO)); + + error = Curl_getaddrinfo_ex(hostname, sbuf, &hints, &res); + if(error) { + infof(data, "getaddrinfo() failed for %s:%d; %s\n", + hostname, port, Curl_strerror(conn, SOCKERRNO)); + return NULL; + } + return res; +} + +#endif /* !HAVE_GETADDRINFO */ + +#endif /* CURLRES_THREADED */ diff --git a/mobicore/common/curl/lib/http.c b/mobicore/common/curl/lib/http.c new file mode 100644 index 0000000000000000000000000000000000000000..e35437f1ed44e0f60d91bf43e9729e401dac58a7 --- /dev/null +++ b/mobicore/common/curl/lib/http.c @@ -0,0 +1,3779 @@ +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) 1998 - 2010, Daniel Stenberg, , et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at http://curl.haxx.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ***************************************************************************/ + +#include "setup.h" + +#ifndef CURL_DISABLE_HTTP +/* -- WIN32 approved -- */ +#include +#include +#include +#include +#include + +#ifdef WIN32 +#include +#include +#else +#ifdef HAVE_SYS_SOCKET_H +#include +#endif +#ifdef HAVE_NETINET_IN_H +#include +#endif +#ifdef HAVE_SYS_TIME_H +#include +#endif + +#ifdef HAVE_TIME_H +#ifdef TIME_WITH_SYS_TIME +#include +#endif +#endif + +#ifdef HAVE_UNISTD_H +#include +#endif +#ifdef HAVE_NETDB_H +#include +#endif +#ifdef HAVE_ARPA_INET_H +#include +#endif +#ifdef HAVE_NET_IF_H +#include +#endif +#ifdef HAVE_SYS_IOCTL_H +#include +#endif + +#ifdef HAVE_SYS_PARAM_H +#include +#endif + +#endif + +#include "urldata.h" +#include +#include "transfer.h" +#include "sendf.h" +#include "easyif.h" /* for Curl_convert_... prototypes */ +#include "formdata.h" +#include "progress.h" +#include "curl_base64.h" +#include "cookie.h" +#include "strequal.h" +#include "sslgen.h" +#include "http_digest.h" +#include "http_ntlm.h" +#include "http_negotiate.h" +#include "url.h" +#include "share.h" +#include "hostip.h" +#include "http.h" +#include "curl_memory.h" +#include "select.h" +#include "parsedate.h" /* for the week day and month names */ +#include "strtoofft.h" +#include "multiif.h" +#include "rawstr.h" +#include "content_encoding.h" +#include "rtsp.h" +#include "warnless.h" + +#define _MPRINTF_REPLACE /* use our functions only */ +#include + +/* The last #include file should be: */ +#include "memdebug.h" + +/* Default proxy timeout in milliseconds */ +#define PROXY_TIMEOUT (3600*1000) + +/* + * Forward declarations. + */ + +static int http_getsock_do(struct connectdata *conn, + curl_socket_t *socks, + int numsocks); +#ifdef USE_SSL +static CURLcode https_connecting(struct connectdata *conn, bool *done); +static int https_getsock(struct connectdata *conn, + curl_socket_t *socks, + int numsocks); +#else +#define https_connecting(x,y) CURLE_COULDNT_CONNECT +#endif + +/* + * HTTP handler interface. + */ +const struct Curl_handler Curl_handler_http = { + "HTTP", /* scheme */ + ZERO_NULL, /* setup_connection */ + Curl_http, /* do_it */ + Curl_http_done, /* done */ + ZERO_NULL, /* do_more */ + Curl_http_connect, /* connect_it */ + ZERO_NULL, /* connecting */ + ZERO_NULL, /* doing */ + ZERO_NULL, /* proto_getsock */ + http_getsock_do, /* doing_getsock */ + ZERO_NULL, /* perform_getsock */ + ZERO_NULL, /* disconnect */ + PORT_HTTP, /* defport */ + PROT_HTTP, /* protocol */ +}; + +#ifdef USE_SSL +/* + * HTTPS handler interface. + */ +const struct Curl_handler Curl_handler_https = { + "HTTPS", /* scheme */ + ZERO_NULL, /* setup_connection */ + Curl_http, /* do_it */ + Curl_http_done, /* done */ + ZERO_NULL, /* do_more */ + Curl_http_connect, /* connect_it */ + https_connecting, /* connecting */ + ZERO_NULL, /* doing */ + https_getsock, /* proto_getsock */ + http_getsock_do, /* doing_getsock */ + ZERO_NULL, /* perform_getsock */ + ZERO_NULL, /* disconnect */ + PORT_HTTPS, /* defport */ + PROT_HTTP | PROT_HTTPS | PROT_SSL /* protocol */ +}; +#endif + + +/* + * checkheaders() checks the linked list of custom HTTP headers for a + * particular header (prefix). + * + * Returns a pointer to the first matching header or NULL if none matched. + */ +char *Curl_checkheaders(struct SessionHandle *data, const char *thisheader) +{ + struct curl_slist *head; + size_t thislen = strlen(thisheader); + + for(head = data->set.headers; head; head=head->next) { + if(Curl_raw_nequal(head->data, thisheader, thislen)) + return head->data; + } + return NULL; +} + +/* + * Strip off leading and trailing whitespace from the value in the + * given HTTP header line and return a strdupped copy. Returns NULL in + * case of allocation failure. Returns an empty string if the header value + * consists entirely of whitespace. + */ +char *Curl_copy_header_value(const char *h) +{ + const char *start; + const char *end; + char *value; + size_t len; + + DEBUGASSERT(h); + + /* Find the end of the header name */ + while (*h && (*h != ':')) + ++h; + + if (*h) + /* Skip over colon */ + ++h; + + /* Find the first non-space letter */ + start = h; + while(*start && ISSPACE(*start)) + start++; + + /* data is in the host encoding so + use '\r' and '\n' instead of 0x0d and 0x0a */ + end = strchr(start, '\r'); + if(!end) + end = strchr(start, '\n'); + if(!end) + end = strchr(start, '\0'); + if(!end) + return NULL; + + /* skip all trailing space letters */ + while((end > start) && ISSPACE(*end)) + end--; + + /* get length of the type */ + len = end-start+1; + + value = malloc(len + 1); + if(!value) + return NULL; + + memcpy(value, start, len); + value[len] = 0; /* zero terminate */ + + return value; +} + +/* + * http_output_basic() sets up an Authorization: header (or the proxy version) + * for HTTP Basic authentication. + * + * Returns CURLcode. + */ +static CURLcode http_output_basic(struct connectdata *conn, bool proxy) +{ + char *authorization; + struct SessionHandle *data=conn->data; + char **userp; + const char *user; + const char *pwd; + + if(proxy) { + userp = &conn->allocptr.proxyuserpwd; + user = conn->proxyuser; + pwd = conn->proxypasswd; + } + else { + userp = &conn->allocptr.userpwd; + user = conn->user; + pwd = conn->passwd; + } + + snprintf(data->state.buffer, sizeof(data->state.buffer), "%s:%s", user, pwd); + if(Curl_base64_encode(data, data->state.buffer, + strlen(data->state.buffer), + &authorization) > 0) { + if(*userp) + free(*userp); + *userp = aprintf( "%sAuthorization: Basic %s\r\n", + proxy?"Proxy-":"", + authorization); + free(authorization); + if(!*userp) + return CURLE_OUT_OF_MEMORY; + } + else + return CURLE_OUT_OF_MEMORY; + return CURLE_OK; +} + +/* pickoneauth() selects the most favourable authentication method from the + * ones available and the ones we want. + * + * return TRUE if one was picked + */ +static bool pickoneauth(struct auth *pick) +{ + bool picked; + /* only deal with authentication we want */ + long avail = pick->avail & pick->want; + picked = TRUE; + + /* The order of these checks is highly relevant, as this will be the order + of preference in case of the existence of multiple accepted types. */ + if(avail & CURLAUTH_GSSNEGOTIATE) + pick->picked = CURLAUTH_GSSNEGOTIATE; + else if(avail & CURLAUTH_DIGEST) + pick->picked = CURLAUTH_DIGEST; + else if(avail & CURLAUTH_NTLM) + pick->picked = CURLAUTH_NTLM; + else if(avail & CURLAUTH_BASIC) + pick->picked = CURLAUTH_BASIC; + else { + pick->picked = CURLAUTH_PICKNONE; /* we select to use nothing */ + picked = FALSE; + } + pick->avail = CURLAUTH_NONE; /* clear it here */ + + return picked; +} + +/* + * Curl_http_perhapsrewind() + * + * If we are doing POST or PUT { + * If we have more data to send { + * If we are doing NTLM { + * Keep sending since we must not disconnect + * } + * else { + * If there is more than just a little data left to send, close + * the current connection by force. + * } + * } + * If we have sent any data { + * If we don't have track of all the data { + * call app to tell it to rewind + * } + * else { + * rewind internally so that the operation can restart fine + * } + * } + * } + */ +CURLcode Curl_http_perhapsrewind(struct connectdata *conn) +{ + struct SessionHandle *data = conn->data; + struct HTTP *http = data->state.proto.http; + curl_off_t bytessent; + curl_off_t expectsend = -1; /* default is unknown */ + + if(!http || !(conn->protocol & PROT_HTTP)) + /* If this is still NULL, we have not reach very far and we can + safely skip this rewinding stuff, or this is attempted to get used + when HTTP isn't activated */ + return CURLE_OK; + + switch(data->set.httpreq) { + case HTTPREQ_GET: + case HTTPREQ_HEAD: + return CURLE_OK; + default: + break; + } + + bytessent = http->writebytecount; + + if(conn->bits.authneg) + /* This is a state where we are known to be negotiating and we don't send + any data then. */ + expectsend = 0; + else { + /* figure out how much data we are expected to send */ + switch(data->set.httpreq) { + case HTTPREQ_POST: + if(data->set.postfieldsize != -1) + expectsend = data->set.postfieldsize; + else if(data->set.postfields) + expectsend = (curl_off_t)strlen(data->set.postfields); + break; + case HTTPREQ_PUT: + if(data->set.infilesize != -1) + expectsend = data->set.infilesize; + break; + case HTTPREQ_POST_FORM: + expectsend = http->postsize; + break; + default: + break; + } + } + + conn->bits.rewindaftersend = FALSE; /* default */ + + if((expectsend == -1) || (expectsend > bytessent)) { + /* There is still data left to send */ + if((data->state.authproxy.picked == CURLAUTH_NTLM) || + (data->state.authhost.picked == CURLAUTH_NTLM)) { + if(((expectsend - bytessent) < 2000) || + (conn->ntlm.state != NTLMSTATE_NONE)) { + /* The NTLM-negotiation has started *OR* there is just a little (<2K) + data left to send, keep on sending. */ + + /* rewind data when completely done sending! */ + if(!conn->bits.authneg) + conn->bits.rewindaftersend = TRUE; + + return CURLE_OK; + } + if(conn->bits.close) + /* this is already marked to get closed */ + return CURLE_OK; + + infof(data, "NTLM send, close instead of sending %" FORMAT_OFF_T + " bytes\n", (curl_off_t)(expectsend - bytessent)); + } + + /* This is not NTLM or NTLM with many bytes left to send: close + */ + conn->bits.close = TRUE; + data->req.size = 0; /* don't download any more than 0 bytes */ + + /* There still is data left to send, but this connection is marked for + closure so we can safely do the rewind right now */ + } + + if(bytessent) + /* we rewind now at once since if we already sent something */ + return Curl_readrewind(conn); + + return CURLE_OK; +} + +/* + * Curl_http_auth_act() gets called when all HTTP headers have been received + * and it checks what authentication methods that are available and decides + * which one (if any) to use. It will set 'newurl' if an auth method was + * picked. + */ + +CURLcode Curl_http_auth_act(struct connectdata *conn) +{ + struct SessionHandle *data = conn->data; + bool pickhost = FALSE; + bool pickproxy = FALSE; + CURLcode code = CURLE_OK; + + if(100 <= data->req.httpcode && 199 >= data->req.httpcode) + /* this is a transient response code, ignore */ + return CURLE_OK; + + if(data->state.authproblem) + return data->set.http_fail_on_error?CURLE_HTTP_RETURNED_ERROR:CURLE_OK; + + if(conn->bits.user_passwd && + ((data->req.httpcode == 401) || + (conn->bits.authneg && data->req.httpcode < 300))) { + pickhost = pickoneauth(&data->state.authhost); + if(!pickhost) + data->state.authproblem = TRUE; + } + if(conn->bits.proxy_user_passwd && + ((data->req.httpcode == 407) || + (conn->bits.authneg && data->req.httpcode < 300))) { + pickproxy = pickoneauth(&data->state.authproxy); + if(!pickproxy) + data->state.authproblem = TRUE; + } + + if(pickhost || pickproxy) { + /* In case this is GSS auth, the newurl field is already allocated so + we must make sure to free it before allocating a new one. As figured + out in bug #2284386 */ + Curl_safefree(data->req.newurl); + data->req.newurl = strdup(data->change.url); /* clone URL */ + if(!data->req.newurl) + return CURLE_OUT_OF_MEMORY; + + if((data->set.httpreq != HTTPREQ_GET) && + (data->set.httpreq != HTTPREQ_HEAD) && + !conn->bits.rewindaftersend) { + code = Curl_http_perhapsrewind(conn); + if(code) + return code; + } + } + + else if((data->req.httpcode < 300) && + (!data->state.authhost.done) && + conn->bits.authneg) { + /* no (known) authentication available, + authentication is not "done" yet and + no authentication seems to be required and + we didn't try HEAD or GET */ + if((data->set.httpreq != HTTPREQ_GET) && + (data->set.httpreq != HTTPREQ_HEAD)) { + data->req.newurl = strdup(data->change.url); /* clone URL */ + if(!data->req.newurl) + return CURLE_OUT_OF_MEMORY; + data->state.authhost.done = TRUE; + } + } + if(Curl_http_should_fail(conn)) { + failf (data, "The requested URL returned error: %d", + data->req.httpcode); + code = CURLE_HTTP_RETURNED_ERROR; + } + + return code; +} + + +/* + * Output the correct authentication header depending on the auth type + * and whether or not it is to a proxy. + */ +static CURLcode +output_auth_headers(struct connectdata *conn, + struct auth *authstatus, + const char *request, + const char *path, + bool proxy) +{ + struct SessionHandle *data = conn->data; + const char *auth=NULL; + CURLcode result = CURLE_OK; +#ifdef HAVE_GSSAPI + struct negotiatedata *negdata = proxy? + &data->state.proxyneg:&data->state.negotiate; +#endif + +#ifdef CURL_DISABLE_CRYPTO_AUTH + (void)request; + (void)path; +#endif + +#ifdef HAVE_GSSAPI + if((authstatus->picked == CURLAUTH_GSSNEGOTIATE) && + negdata->context && !GSS_ERROR(negdata->status)) { + auth="GSS-Negotiate"; + result = Curl_output_negotiate(conn, proxy); + if(result) + return result; + authstatus->done = TRUE; + negdata->state = GSS_AUTHSENT; + } + else +#endif +#ifdef USE_NTLM + if(authstatus->picked == CURLAUTH_NTLM) { + auth="NTLM"; + result = Curl_output_ntlm(conn, proxy); + if(result) + return result; + } + else +#endif +#ifndef CURL_DISABLE_CRYPTO_AUTH + if(authstatus->picked == CURLAUTH_DIGEST) { + auth="Digest"; + result = Curl_output_digest(conn, + proxy, + (const unsigned char *)request, + (const unsigned char *)path); + if(result) + return result; + } + else +#endif + if(authstatus->picked == CURLAUTH_BASIC) { + /* Basic */ + if((proxy && conn->bits.proxy_user_passwd && + !Curl_checkheaders(data, "Proxy-authorization:")) || + (!proxy && conn->bits.user_passwd && + !Curl_checkheaders(data, "Authorization:"))) { + auth="Basic"; + result = http_output_basic(conn, proxy); + if(result) + return result; + } + /* NOTE: this function should set 'done' TRUE, as the other auth + functions work that way */ + authstatus->done = TRUE; + } + + if(auth) { + infof(data, "%s auth using %s with user '%s'\n", + proxy?"Proxy":"Server", auth, + proxy?(conn->proxyuser?conn->proxyuser:""): + (conn->user?conn->user:"")); + authstatus->multi = (bool)(!authstatus->done); + } + else + authstatus->multi = FALSE; + + return CURLE_OK; +} + +/** + * Curl_http_output_auth() setups the authentication headers for the + * host/proxy and the correct authentication + * method. conn->data->state.authdone is set to TRUE when authentication is + * done. + * + * @param conn all information about the current connection + * @param request pointer to the request keyword + * @param path pointer to the requested path + * @param proxytunnel boolean if this is the request setting up a "proxy + * tunnel" + * + * @returns CURLcode + */ +static CURLcode +http_output_auth(struct connectdata *conn, + const char *request, + const char *path, + bool proxytunnel) /* TRUE if this is the request setting + up the proxy tunnel */ +{ + CURLcode result = CURLE_OK; + struct SessionHandle *data = conn->data; + struct auth *authhost; + struct auth *authproxy; + + DEBUGASSERT(data); + + authhost = &data->state.authhost; + authproxy = &data->state.authproxy; + + if((conn->bits.httpproxy && conn->bits.proxy_user_passwd) || + conn->bits.user_passwd) + /* continue please */ ; + else { + authhost->done = TRUE; + authproxy->done = TRUE; + return CURLE_OK; /* no authentication with no user or password */ + } + + if(authhost->want && !authhost->picked) + /* The app has selected one or more methods, but none has been picked + so far by a server round-trip. Then we set the picked one to the + want one, and if this is one single bit it'll be used instantly. */ + authhost->picked = authhost->want; + + if(authproxy->want && !authproxy->picked) + /* The app has selected one or more methods, but none has been picked so + far by a proxy round-trip. Then we set the picked one to the want one, + and if this is one single bit it'll be used instantly. */ + authproxy->picked = authproxy->want; + +#ifndef CURL_DISABLE_PROXY + /* Send proxy authentication header if needed */ + if(conn->bits.httpproxy && + (conn->bits.tunnel_proxy == proxytunnel)) { + result = output_auth_headers(conn, authproxy, request, path, TRUE); + if(result) + return result; + } + else +#else + (void)proxytunnel; +#endif /* CURL_DISABLE_PROXY */ + /* we have no proxy so let's pretend we're done authenticating + with it */ + authproxy->done = TRUE; + + /* To prevent the user+password to get sent to other than the original + host due to a location-follow, we do some weirdo checks here */ + if(!data->state.this_is_a_follow || + conn->bits.netrc || + !data->state.first_host || + data->set.http_disable_hostname_check_before_authentication || + Curl_raw_equal(data->state.first_host, conn->host.name)) { + result = output_auth_headers(conn, authhost, request, path, FALSE); + } + else + authhost->done = TRUE; + + return result; +} + + +/* + * Curl_http_input_auth() deals with Proxy-Authenticate: and WWW-Authenticate: + * headers. They are dealt with both in the transfer.c main loop and in the + * proxy CONNECT loop. + */ + +CURLcode Curl_http_input_auth(struct connectdata *conn, + int httpcode, + const char *header) /* the first non-space */ +{ + /* + * This resource requires authentication + */ + struct SessionHandle *data = conn->data; + + long *availp; + const char *start; + struct auth *authp; + + if(httpcode == 407) { + start = header+strlen("Proxy-authenticate:"); + availp = &data->info.proxyauthavail; + authp = &data->state.authproxy; + } + else { + start = header+strlen("WWW-Authenticate:"); + availp = &data->info.httpauthavail; + authp = &data->state.authhost; + } + + /* pass all white spaces */ + while(*start && ISSPACE(*start)) + start++; + + /* + * Here we check if we want the specific single authentication (using ==) and + * if we do, we initiate usage of it. + * + * If the provided authentication is wanted as one out of several accepted + * types (using &), we OR this authentication type to the authavail + * variable. + * + * Note: + * + * ->picked is first set to the 'want' value (one or more bits) before the + * request is sent, and then it is again set _after_ all response 401/407 + * headers have been received but then only to a single preferred method + * (bit). + * + */ + +#ifdef HAVE_GSSAPI + if(checkprefix("GSS-Negotiate", start) || + checkprefix("Negotiate", start)) { + int neg; + *availp |= CURLAUTH_GSSNEGOTIATE; + authp->avail |= CURLAUTH_GSSNEGOTIATE; + + if(data->state.negotiate.state == GSS_AUTHSENT) { + /* if we sent GSS authentication in the outgoing request and we get this + back, we're in trouble */ + infof(data, "Authentication problem. Ignoring this.\n"); + data->state.authproblem = TRUE; + } + else { + neg = Curl_input_negotiate(conn, (bool)(httpcode == 407), start); + if(neg == 0) { + DEBUGASSERT(!data->req.newurl); + data->req.newurl = strdup(data->change.url); + if(!data->req.newurl) + return CURLE_OUT_OF_MEMORY; + data->state.authproblem = FALSE; + /* we received GSS auth info and we dealt with it fine */ + data->state.negotiate.state = GSS_AUTHRECV; + } + else { + data->state.authproblem = TRUE; + } + } + } + else +#endif +#ifdef USE_NTLM + /* NTLM support requires the SSL crypto libs */ + if(checkprefix("NTLM", start)) { + *availp |= CURLAUTH_NTLM; + authp->avail |= CURLAUTH_NTLM; + if(authp->picked == CURLAUTH_NTLM) { + /* NTLM authentication is picked and activated */ + CURLntlm ntlm = + Curl_input_ntlm(conn, (bool)(httpcode == 407), start); + + if(CURLNTLM_BAD != ntlm) + data->state.authproblem = FALSE; + else { + infof(data, "Authentication problem. Ignoring this.\n"); + data->state.authproblem = TRUE; + } + } + } + else +#endif +#ifndef CURL_DISABLE_CRYPTO_AUTH + if(checkprefix("Digest", start)) { + if((authp->avail & CURLAUTH_DIGEST) != 0) { + infof(data, "Ignoring duplicate digest auth header.\n"); + } + else { + CURLdigest dig; + *availp |= CURLAUTH_DIGEST; + authp->avail |= CURLAUTH_DIGEST; + + /* We call this function on input Digest headers even if Digest + * authentication isn't activated yet, as we need to store the + * incoming data from this header in case we are gonna use Digest. */ + dig = Curl_input_digest(conn, (bool)(httpcode == 407), start); + + if(CURLDIGEST_FINE != dig) { + infof(data, "Authentication problem. Ignoring this.\n"); + data->state.authproblem = TRUE; + } + } + } + else +#endif + if(checkprefix("Basic", start)) { + *availp |= CURLAUTH_BASIC; + authp->avail |= CURLAUTH_BASIC; + if(authp->picked == CURLAUTH_BASIC) { + /* We asked for Basic authentication but got a 40X back + anyway, which basically means our name+password isn't + valid. */ + authp->avail = CURLAUTH_NONE; + infof(data, "Authentication problem. Ignoring this.\n"); + data->state.authproblem = TRUE; + } + } + + return CURLE_OK; +} + +/** + * Curl_http_should_fail() determines whether an HTTP response has gotten us + * into an error state or not. + * + * @param conn all information about the current connection + * + * @retval 0 communications should continue + * + * @retval 1 communications should not continue + */ +int Curl_http_should_fail(struct connectdata *conn) +{ + struct SessionHandle *data; + int httpcode; + + DEBUGASSERT(conn); + data = conn->data; + DEBUGASSERT(data); + + httpcode = data->req.httpcode; + + /* + ** If we haven't been asked to fail on error, + ** don't fail. + */ + if(!data->set.http_fail_on_error) + return 0; + + /* + ** Any code < 400 is never terminal. + */ + if(httpcode < 400) + return 0; + + if(data->state.resume_from && + (data->set.httpreq==HTTPREQ_GET) && + (httpcode == 416)) { + /* "Requested Range Not Satisfiable", just proceed and + pretend this is no error */ + return 0; + } + + /* + ** Any code >= 400 that's not 401 or 407 is always + ** a terminal error + */ + if((httpcode != 401) && + (httpcode != 407)) + return 1; + + /* + ** All we have left to deal with is 401 and 407 + */ + DEBUGASSERT((httpcode == 401) || (httpcode == 407)); + + /* + ** Examine the current authentication state to see if this + ** is an error. The idea is for this function to get + ** called after processing all the headers in a response + ** message. So, if we've been to asked to authenticate a + ** particular stage, and we've done it, we're OK. But, if + ** we're already completely authenticated, it's not OK to + ** get another 401 or 407. + ** + ** It is possible for authentication to go stale such that + ** the client needs to reauthenticate. Once that info is + ** available, use it here. + */ +#if 0 /* set to 1 when debugging this functionality */ + infof(data,"%s: authstage = %d\n",__FUNCTION__,data->state.authstage); + infof(data,"%s: authwant = 0x%08x\n",__FUNCTION__,data->state.authwant); + infof(data,"%s: authavail = 0x%08x\n",__FUNCTION__,data->state.authavail); + infof(data,"%s: httpcode = %d\n",__FUNCTION__,k->httpcode); + infof(data,"%s: authdone = %d\n",__FUNCTION__,data->state.authdone); + infof(data,"%s: newurl = %s\n",__FUNCTION__,data->req.newurl ? + data->req.newurl : "(null)"); + infof(data,"%s: authproblem = %d\n",__FUNCTION__,data->state.authproblem); +#endif + + /* + ** Either we're not authenticating, or we're supposed to + ** be authenticating something else. This is an error. + */ + if((httpcode == 401) && !conn->bits.user_passwd) + return TRUE; + if((httpcode == 407) && !conn->bits.proxy_user_passwd) + return TRUE; + + return data->state.authproblem; +} + +/* + * readmoredata() is a "fread() emulation" to provide POST and/or request + * data. It is used when a huge POST is to be made and the entire chunk wasn't + * sent in the first send(). This function will then be called from the + * transfer.c loop when more data is to be sent to the peer. + * + * Returns the amount of bytes it filled the buffer with. + */ +static size_t readmoredata(char *buffer, + size_t size, + size_t nitems, + void *userp) +{ + struct connectdata *conn = (struct connectdata *)userp; + struct HTTP *http = conn->data->state.proto.http; + size_t fullsize = size * nitems; + + if(0 == http->postsize) + /* nothing to return */ + return 0; + + /* make sure that a HTTP request is never sent away chunked! */ + conn->data->req.forbidchunk = (bool)(http->sending == HTTPSEND_REQUEST); + + if(http->postsize <= (curl_off_t)fullsize) { + memcpy(buffer, http->postdata, (size_t)http->postsize); + fullsize = (size_t)http->postsize; + + if(http->backup.postsize) { + /* move backup data into focus and continue on that */ + http->postdata = http->backup.postdata; + http->postsize = http->backup.postsize; + conn->fread_func = http->backup.fread_func; + conn->fread_in = http->backup.fread_in; + + http->sending++; /* move one step up */ + + http->backup.postsize=0; + } + else + http->postsize = 0; + + return fullsize; + } + + memcpy(buffer, http->postdata, fullsize); + http->postdata += fullsize; + http->postsize -= fullsize; + + return fullsize; +} + +/* ------------------------------------------------------------------------- */ +/* add_buffer functions */ + +/* + * Curl_add_buffer_init() sets up and returns a fine buffer struct + */ +Curl_send_buffer *Curl_add_buffer_init(void) +{ + return calloc(1, sizeof(Curl_send_buffer)); +} + +/* + * Curl_add_buffer_send() sends a header buffer and frees all associated + * memory. Body data may be appended to the header data if desired. + * + * Returns CURLcode + */ +CURLcode Curl_add_buffer_send(Curl_send_buffer *in, + struct connectdata *conn, + + /* add the number of sent bytes to this + counter */ + long *bytes_written, + + /* how much of the buffer contains body data */ + size_t included_body_bytes, + int socketindex) + +{ + ssize_t amount; + CURLcode res; + char *ptr; + size_t size; + struct HTTP *http = conn->data->state.proto.http; + size_t sendsize; + curl_socket_t sockfd; + size_t headersize; + + DEBUGASSERT(socketindex <= SECONDARYSOCKET); + + sockfd = conn->sock[socketindex]; + + /* The looping below is required since we use non-blocking sockets, but due + to the circumstances we will just loop and try again and again etc */ + + ptr = in->buffer; + size = in->size_used; + + headersize = size - included_body_bytes; /* the initial part that isn't body + is header */ + + DEBUGASSERT(size > included_body_bytes); + +#ifdef CURL_DOES_CONVERSIONS + res = Curl_convert_to_network(conn->data, ptr, headersize); + /* Curl_convert_to_network calls failf if unsuccessful */ + if(res != CURLE_OK) { + /* conversion failed, free memory and return to the caller */ + if(in->buffer) + free(in->buffer); + free(in); + return res; + } +#endif /* CURL_DOES_CONVERSIONS */ + + if(conn->protocol & PROT_HTTPS) { + /* We never send more than CURL_MAX_WRITE_SIZE bytes in one single chunk + when we speak HTTPS, as if only a fraction of it is sent now, this data + needs to fit into the normal read-callback buffer later on and that + buffer is using this size. + */ + + sendsize= (size > CURL_MAX_WRITE_SIZE)?CURL_MAX_WRITE_SIZE:size; + + /* OpenSSL is very picky and we must send the SAME buffer pointer to the + library when we attempt to re-send this buffer. Sending the same data + is not enough, we must use the exact same address. For this reason, we + must copy the data to the uploadbuffer first, since that is the buffer + we will be using if this send is retried later. + */ + memcpy(conn->data->state.uploadbuffer, ptr, sendsize); + ptr = conn->data->state.uploadbuffer; + } + else + sendsize = size; + + res = Curl_write(conn, sockfd, ptr, sendsize, &amount); + + if(CURLE_OK == res) { + /* + * Note that we may not send the entire chunk at once, and we have a set + * number of data bytes at the end of the big buffer (out of which we may + * only send away a part). + */ + /* how much of the header that was sent */ + size_t headlen = (size_t)amount>headersize?headersize:(size_t)amount; + size_t bodylen = amount - headlen; + + if(conn->data->set.verbose) { + /* this data _may_ contain binary stuff */ + Curl_debug(conn->data, CURLINFO_HEADER_OUT, ptr, headlen, conn); + if((size_t)amount > headlen) { + /* there was body data sent beyond the initial header part, pass that + on to the debug callback too */ + Curl_debug(conn->data, CURLINFO_DATA_OUT, + ptr+headlen, bodylen, conn); + } + } + if(bodylen) + /* since we sent a piece of the body here, up the byte counter for it + accordingly */ + http->writebytecount += bodylen; + + /* 'amount' can never be a very large value here so typecasting it so a + signed 31 bit value should not cause problems even if ssize_t is + 64bit */ + *bytes_written += (long)amount; + + if(http) { + if((size_t)amount != size) { + /* The whole request could not be sent in one system call. We must + queue it up and send it later when we get the chance. We must not + loop here and wait until it might work again. */ + + size -= amount; + + ptr = in->buffer + amount; + + /* backup the currently set pointers */ + http->backup.fread_func = conn->fread_func; + http->backup.fread_in = conn->fread_in; + http->backup.postdata = http->postdata; + http->backup.postsize = http->postsize; + + /* set the new pointers for the request-sending */ + conn->fread_func = (curl_read_callback)readmoredata; + conn->fread_in = (void *)conn; + http->postdata = ptr; + http->postsize = (curl_off_t)size; + + http->send_buffer = in; + http->sending = HTTPSEND_REQUEST; + + return CURLE_OK; + } + http->sending = HTTPSEND_BODY; + /* the full buffer was sent, clean up and return */ + } + else { + if((size_t)amount != size) + /* We have no continue-send mechanism now, fail. This can only happen + when this function is used from the CONNECT sending function. We + currently (stupidly) assume that the whole request is always sent + away in the first single chunk. + + This needs FIXing. + */ + return CURLE_SEND_ERROR; + else + conn->writechannel_inuse = FALSE; + } + } + if(in->buffer) + free(in->buffer); + free(in); + + return res; +} + + +/* + * add_bufferf() add the formatted input to the buffer. + */ +CURLcode Curl_add_bufferf(Curl_send_buffer *in, const char *fmt, ...) +{ + char *s; + va_list ap; + va_start(ap, fmt); + s = vaprintf(fmt, ap); /* this allocs a new string to append */ + va_end(ap); + + if(s) { + CURLcode result = Curl_add_buffer(in, s, strlen(s)); + free(s); + return result; + } + /* If we failed, we cleanup the whole buffer and return error */ + if(in->buffer) + free(in->buffer); + free(in); + return CURLE_OUT_OF_MEMORY; +} + +/* + * add_buffer() appends a memory chunk to the existing buffer + */ +CURLcode Curl_add_buffer(Curl_send_buffer *in, const void *inptr, size_t size) +{ + char *new_rb; + size_t new_size; + + if(~size < in->size_used) { + /* If resulting used size of send buffer would wrap size_t, cleanup + the whole buffer and return error. Otherwise the required buffer + size will fit into a single allocatable memory chunk */ + Curl_safefree(in->buffer); + free(in); + return CURLE_OUT_OF_MEMORY; + } + + if(!in->buffer || + ((in->size_used + size) > (in->size_max - 1))) { + + /* If current buffer size isn't enough to hold the result, use a + buffer size that doubles the required size. If this new size + would wrap size_t, then just use the largest possible one */ + + if((size > (size_t)-1/2) || (in->size_used > (size_t)-1/2) || + (~(size*2) < (in->size_used*2))) + new_size = (size_t)-1; + else + new_size = (in->size_used+size)*2; + + if(in->buffer) + /* we have a buffer, enlarge the existing one */ + new_rb = realloc(in->buffer, new_size); + else + /* create a new buffer */ + new_rb = malloc(new_size); + + if(!new_rb) { + /* If we failed, we cleanup the whole buffer and return error */ + Curl_safefree(in->buffer); + free(in); + return CURLE_OUT_OF_MEMORY; + } + + in->buffer = new_rb; + in->size_max = new_size; + } + memcpy(&in->buffer[in->size_used], inptr, size); + + in->size_used += size; + + return CURLE_OK; +} + +/* end of the add_buffer functions */ +/* ------------------------------------------------------------------------- */ + + + +/* + * Curl_compareheader() + * + * Returns TRUE if 'headerline' contains the 'header' with given 'content'. + * Pass headers WITH the colon. + */ +bool +Curl_compareheader(const char *headerline, /* line to check */ + const char *header, /* header keyword _with_ colon */ + const char *content) /* content string to find */ +{ + /* RFC2616, section 4.2 says: "Each header field consists of a name followed + * by a colon (":") and the field value. Field names are case-insensitive. + * The field value MAY be preceded by any amount of LWS, though a single SP + * is preferred." */ + + size_t hlen = strlen(header); + size_t clen; + size_t len; + const char *start; + const char *end; + + if(!Curl_raw_nequal(headerline, header, hlen)) + return FALSE; /* doesn't start with header */ + + /* pass the header */ + start = &headerline[hlen]; + + /* pass all white spaces */ + while(*start && ISSPACE(*start)) + start++; + + /* find the end of the header line */ + end = strchr(start, '\r'); /* lines end with CRLF */ + if(!end) { + /* in case there's a non-standard compliant line here */ + end = strchr(start, '\n'); + + if(!end) + /* hm, there's no line ending here, use the zero byte! */ + end = strchr(start, '\0'); + } + + len = end-start; /* length of the content part of the input line */ + clen = strlen(content); /* length of the word to find */ + + /* find the content string in the rest of the line */ + for(;len>=clen;len--, start++) { + if(Curl_raw_nequal(start, content, clen)) + return TRUE; /* match! */ + } + + return FALSE; /* no match */ +} + +#ifndef CURL_DISABLE_PROXY +/* + * Curl_proxyCONNECT() requires that we're connected to a HTTP proxy. This + * function will issue the necessary commands to get a seamless tunnel through + * this proxy. After that, the socket can be used just as a normal socket. + * + * This badly needs to be rewritten. CONNECT should be sent and dealt with + * like any ordinary HTTP request, and not specially crafted like this. This + * function only remains here like this for now since the rewrite is a bit too + * much work to do at the moment. + * + * This function is BLOCKING which is nasty for all multi interface using apps. + */ + +CURLcode Curl_proxyCONNECT(struct connectdata *conn, + int sockindex, + const char *hostname, + unsigned short remote_port) +{ + int subversion=0; + struct SessionHandle *data=conn->data; + struct SingleRequest *k = &data->req; + CURLcode result; + long timeout = + data->set.timeout?data->set.timeout:PROXY_TIMEOUT; /* in milliseconds */ + curl_socket_t tunnelsocket = conn->sock[sockindex]; + curl_off_t cl=0; + bool closeConnection = FALSE; + bool chunked_encoding = FALSE; + long check; + +#define SELECT_OK 0 +#define SELECT_ERROR 1 +#define SELECT_TIMEOUT 2 + int error = SELECT_OK; + + conn->bits.proxy_connect_closed = FALSE; + + do { + if(!conn->bits.tunnel_connecting) { /* BEGIN CONNECT PHASE */ + char *host_port; + Curl_send_buffer *req_buffer; + + infof(data, "Establish HTTP proxy tunnel to %s:%hu\n", + hostname, remote_port); + + if(data->req.newurl) { + /* This only happens if we've looped here due to authentication + reasons, and we don't really use the newly cloned URL here + then. Just free() it. */ + free(data->req.newurl); + data->req.newurl = NULL; + } + + /* initialize a dynamic send-buffer */ + req_buffer = Curl_add_buffer_init(); + + if(!req_buffer) + return CURLE_OUT_OF_MEMORY; + + host_port = aprintf("%s:%hu", hostname, remote_port); + if(!host_port) { + free(req_buffer); + return CURLE_OUT_OF_MEMORY; + } + + /* Setup the proxy-authorization header, if any */ + result = http_output_auth(conn, "CONNECT", host_port, TRUE); + + if(CURLE_OK == result) { + char *host=(char *)""; + const char *proxyconn=""; + const char *useragent=""; + const char *http = (conn->proxytype == CURLPROXY_HTTP_1_0) ? + "1.0" : "1.1"; + + if(!Curl_checkheaders(data, "Host:")) { + host = aprintf("Host: %s\r\n", host_port); + if(!host) { + free(req_buffer); + free(host_port); + return CURLE_OUT_OF_MEMORY; + } + } + if(!Curl_checkheaders(data, "Proxy-Connection:")) + proxyconn = "Proxy-Connection: Keep-Alive\r\n"; + + if(!Curl_checkheaders(data, "User-Agent:") && + data->set.str[STRING_USERAGENT]) + useragent = conn->allocptr.uagent; + + /* Send the connect request to the proxy */ + /* BLOCKING */ + result = + Curl_add_bufferf(req_buffer, + "CONNECT %s:%hu HTTP/%s\r\n" + "%s" /* Host: */ + "%s" /* Proxy-Authorization */ + "%s" /* User-Agent */ + "%s", /* Proxy-Connection */ + hostname, remote_port, http, + host, + conn->allocptr.proxyuserpwd? + conn->allocptr.proxyuserpwd:"", + useragent, + proxyconn); + + if(host && *host) + free(host); + + if(CURLE_OK == result) + result = Curl_add_custom_headers(conn, req_buffer); + + if(CURLE_OK == result) + /* CRLF terminate the request */ + result = Curl_add_bufferf(req_buffer, "\r\n"); + + if(CURLE_OK == result) { + /* Now send off the request */ + result = Curl_add_buffer_send(req_buffer, conn, + &data->info.request_size, 0, sockindex); + } + req_buffer = NULL; + if(result) + failf(data, "Failed sending CONNECT to proxy"); + } + free(host_port); + Curl_safefree(req_buffer); + if(result) + return result; + + conn->bits.tunnel_connecting = TRUE; + } /* END CONNECT PHASE */ + + /* now we've issued the CONNECT and we're waiting to hear back - + we try not to block here in multi-mode because that might be a LONG + wait if the proxy cannot connect-through to the remote host. */ + + /* if timeout is requested, find out how much remaining time we have */ + check = timeout - /* timeout time */ + Curl_tvdiff(Curl_tvnow(), conn->now); /* spent time */ + if(check <= 0) { + failf(data, "Proxy CONNECT aborted due to timeout"); + return CURLE_RECV_ERROR; + } + + /* if we're in multi-mode and we would block, return instead for a retry */ + if(Curl_if_multi == data->state.used_interface) { + if(0 == Curl_socket_ready(tunnelsocket, CURL_SOCKET_BAD, 0)) + /* return so we'll be called again polling-style */ + return CURLE_OK; + else { + DEBUGF(infof(data, + "Multi mode finished polling for response from " + "proxy CONNECT.")); + } + } + else { + DEBUGF(infof(data, "Easy mode waiting response from proxy CONNECT.")); + } + + /* at this point, either: + 1) we're in easy-mode and so it's okay to block waiting for a CONNECT + response + 2) we're in multi-mode and we didn't block - it's either an error or we + now have some data waiting. + In any case, the tunnel_connecting phase is over. */ + conn->bits.tunnel_connecting = FALSE; + + { /* BEGIN NEGOTIATION PHASE */ + size_t nread; /* total size read */ + int perline; /* count bytes per line */ + int keepon=TRUE; + ssize_t gotbytes; + char *ptr; + char *line_start; + + ptr=data->state.buffer; + line_start = ptr; + + nread=0; + perline=0; + keepon=TRUE; + + while((nreadnow); /* spent time */ + if(check <= 0) { + failf(data, "Proxy CONNECT aborted due to timeout"); + error = SELECT_TIMEOUT; /* already too little time */ + break; + } + + /* loop every second at least, less if the timeout is near */ + switch (Curl_socket_ready(tunnelsocket, CURL_SOCKET_BAD, + check<1000L?(int)check:1000)) { + case -1: /* select() error, stop reading */ + error = SELECT_ERROR; + failf(data, "Proxy CONNECT aborted due to select/poll error"); + break; + case 0: /* timeout */ + break; + default: + DEBUGASSERT(ptr+BUFSIZE-nread <= data->state.buffer+BUFSIZE+1); + result = Curl_read(conn, tunnelsocket, ptr, BUFSIZE-nread, &gotbytes); + if(result==CURLE_AGAIN) + continue; /* go loop yourself */ + else if(result) + keepon = FALSE; + else if(gotbytes <= 0) { + keepon = FALSE; + if(data->set.proxyauth && data->state.authproxy.avail) { + /* proxy auth was requested and there was proxy auth available, + then deem this as "mere" proxy disconnect */ + conn->bits.proxy_connect_closed = TRUE; + } + else { + error = SELECT_ERROR; + failf(data, "Proxy CONNECT aborted"); + } + } + else { + /* + * We got a whole chunk of data, which can be anything from one + * byte to a set of lines and possibly just a piece of the last + * line. + */ + int i; + + nread += gotbytes; + + if(keepon > TRUE) { + /* This means we are currently ignoring a response-body */ + + nread = 0; /* make next read start over in the read buffer */ + ptr=data->state.buffer; + if(cl) { + /* A Content-Length based body: simply count down the counter + and make sure to break out of the loop when we're done! */ + cl -= gotbytes; + if(cl<=0) { + keepon = FALSE; + break; + } + } + else { + /* chunked-encoded body, so we need to do the chunked dance + properly to know when the end of the body is reached */ + CHUNKcode r; + ssize_t tookcareof=0; + + /* now parse the chunked piece of data so that we can + properly tell when the stream ends */ + r = Curl_httpchunk_read(conn, ptr, gotbytes, &tookcareof); + if(r == CHUNKE_STOP) { + /* we're done reading chunks! */ + infof(data, "chunk reading DONE\n"); + keepon = FALSE; + } + else + infof(data, "Read %zd bytes of chunk, continue\n", + tookcareof); + } + } + else + for(i = 0; i < gotbytes; ptr++, i++) { + perline++; /* amount of bytes in this line so far */ + if(*ptr == 0x0a) { + char letter; + int writetype; + +#ifdef CURL_DOES_CONVERSIONS + /* convert from the network encoding */ + result = Curl_convert_from_network(data, line_start, + perline); + /* Curl_convert_from_network calls failf if unsuccessful */ + if(result) + return result; +#endif /* CURL_DOES_CONVERSIONS */ + + /* output debug if that is requested */ + if(data->set.verbose) + Curl_debug(data, CURLINFO_HEADER_IN, + line_start, (size_t)perline, conn); + + /* send the header to the callback */ + writetype = CLIENTWRITE_HEADER; + if(data->set.include_header) + writetype |= CLIENTWRITE_BODY; + + result = Curl_client_write(conn, writetype, line_start, + perline); + if(result) + return result; + + /* Newlines are CRLF, so the CR is ignored as the line isn't + really terminated until the LF comes. Treat a following CR + as end-of-headers as well.*/ + + if(('\r' == line_start[0]) || + ('\n' == line_start[0])) { + /* end of response-headers from the proxy */ + nread = 0; /* make next read start over in the read + buffer */ + ptr=data->state.buffer; + if((407 == k->httpcode) && !data->state.authproblem) { + /* If we get a 407 response code with content length + when we have no auth problem, we must ignore the + whole response-body */ + keepon = 2; + + if(cl) { + + infof(data, "Ignore %" FORMAT_OFF_T + " bytes of response-body\n", cl); + /* remove the remaining chunk of what we already + read */ + cl -= (gotbytes - i); + + if(cl<=0) + /* if the whole thing was already read, we are done! + */ + keepon=FALSE; + } + else if(chunked_encoding) { + CHUNKcode r; + /* We set ignorebody true here since the chunked + decoder function will acknowledge that. Pay + attention so that this is cleared again when this + function returns! */ + k->ignorebody = TRUE; + infof(data, "%zd bytes of chunk left\n", gotbytes-i); + + if(line_start[1] == '\n') { + /* this can only be a LF if the letter at index 0 + was a CR */ + line_start++; + i++; + } + + /* now parse the chunked piece of data so that we can + properly tell when the stream ends */ + r = Curl_httpchunk_read(conn, line_start+1, + gotbytes -i, &gotbytes); + if(r == CHUNKE_STOP) { + /* we're done reading chunks! */ + infof(data, "chunk reading DONE\n"); + keepon = FALSE; + } + else + infof(data, "Read %zd bytes of chunk, continue\n", + gotbytes); + } + else { + /* without content-length or chunked encoding, we + can't keep the connection alive since the close is + the end signal so we bail out at once instead */ + keepon=FALSE; + } + } + else + keepon = FALSE; + break; /* breaks out of for-loop, not switch() */ + } + + /* keep a backup of the position we are about to blank */ + letter = line_start[perline]; + line_start[perline]=0; /* zero terminate the buffer */ + if((checkprefix("WWW-Authenticate:", line_start) && + (401 == k->httpcode)) || + (checkprefix("Proxy-authenticate:", line_start) && + (407 == k->httpcode))) { + result = Curl_http_input_auth(conn, k->httpcode, + line_start); + if(result) + return result; + } + else if(checkprefix("Content-Length:", line_start)) { + cl = curlx_strtoofft(line_start + + strlen("Content-Length:"), NULL, 10); + } + else if(Curl_compareheader(line_start, + "Connection:", "close")) + closeConnection = TRUE; + else if(Curl_compareheader(line_start, + "Transfer-Encoding:", + "chunked")) { + infof(data, "CONNECT responded chunked\n"); + chunked_encoding = TRUE; + /* init our chunky engine */ + Curl_httpchunk_init(conn); + } + else if(Curl_compareheader(line_start, + "Proxy-Connection:", "close")) + closeConnection = TRUE; + else if(2 == sscanf(line_start, "HTTP/1.%d %d", + &subversion, + &k->httpcode)) { + /* store the HTTP code from the proxy */ + data->info.httpproxycode = k->httpcode; + } + /* put back the letter we blanked out before */ + line_start[perline]= letter; + + perline=0; /* line starts over here */ + line_start = ptr+1; /* this skips the zero byte we wrote */ + } + } + } + break; + } /* switch */ + if(Curl_pgrsUpdate(conn)) + return CURLE_ABORTED_BY_CALLBACK; + } /* while there's buffer left and loop is requested */ + + if(error) + return CURLE_RECV_ERROR; + + if(data->info.httpproxycode != 200) { + /* Deal with the possibly already received authenticate + headers. 'newurl' is set to a new URL if we must loop. */ + result = Curl_http_auth_act(conn); + if(result) + return result; + + if(conn->bits.close) + /* the connection has been marked for closure, most likely in the + Curl_http_auth_act() function and thus we can kill it at once + below + */ + closeConnection = TRUE; + } + + if(closeConnection && data->req.newurl) { + /* Connection closed by server. Don't use it anymore */ + sclose(conn->sock[sockindex]); + conn->sock[sockindex] = CURL_SOCKET_BAD; + break; + } + } /* END NEGOTIATION PHASE */ + } while(data->req.newurl); + + if(200 != data->req.httpcode) { + failf(data, "Received HTTP code %d from proxy after CONNECT", + data->req.httpcode); + + if(closeConnection && data->req.newurl) + conn->bits.proxy_connect_closed = TRUE; + + return CURLE_RECV_ERROR; + } + + /* If a proxy-authorization header was used for the proxy, then we should + make sure that it isn't accidentally used for the document request + after we've connected. So let's free and clear it here. */ + Curl_safefree(conn->allocptr.proxyuserpwd); + conn->allocptr.proxyuserpwd = NULL; + + data->state.authproxy.done = TRUE; + + infof (data, "Proxy replied OK to CONNECT request\n"); + data->req.ignorebody = FALSE; /* put it (back) to non-ignore state */ + return CURLE_OK; +} +#endif /* CURL_DISABLE_PROXY */ + +/* + * Curl_http_connect() performs HTTP stuff to do at connect-time, called from + * the generic Curl_connect(). + */ +CURLcode Curl_http_connect(struct connectdata *conn, bool *done) +{ + struct SessionHandle *data; + CURLcode result; + + data=conn->data; + + /* We default to persistent connections. We set this already in this connect + function to make the re-use checks properly be able to check this bit. */ + conn->bits.close = FALSE; + +#ifndef CURL_DISABLE_PROXY + /* If we are not using a proxy and we want a secure connection, perform SSL + * initialization & connection now. If using a proxy with https, then we + * must tell the proxy to CONNECT to the host we want to talk to. Only + * after the connect has occurred, can we start talking SSL + */ + if(conn->bits.tunnel_proxy && conn->bits.httpproxy) { + + /* either SSL over proxy, or explicitly asked for */ + result = Curl_proxyCONNECT(conn, FIRSTSOCKET, + conn->host.name, + conn->remote_port); + if(CURLE_OK != result) + return result; + } + + if(conn->bits.tunnel_connecting) { + /* nothing else to do except wait right now - we're not done here. */ + return CURLE_OK; + } +#endif /* CURL_DISABLE_PROXY */ + + if(conn->protocol & PROT_HTTPS) { + /* perform SSL initialization */ + if(data->state.used_interface == Curl_if_multi) { + result = https_connecting(conn, done); + if(result) + return result; + } + else { + /* BLOCKING */ + result = Curl_ssl_connect(conn, FIRSTSOCKET); + if(result) + return result; + *done = TRUE; + } + } + else { + *done = TRUE; + } + + return CURLE_OK; +} + +/* this returns the socket to wait for in the DO and DOING state for the multi + interface and then we're always _sending_ a request and thus we wait for + the single socket to become writable only */ +static int http_getsock_do(struct connectdata *conn, + curl_socket_t *socks, + int numsocks) +{ + /* write mode */ + (void)numsocks; /* unused, we trust it to be at least 1 */ + socks[0] = conn->sock[FIRSTSOCKET]; + return GETSOCK_WRITESOCK(0); +} + +#ifdef USE_SSL +static CURLcode https_connecting(struct connectdata *conn, bool *done) +{ + CURLcode result; + DEBUGASSERT((conn) && (conn->protocol & PROT_HTTPS)); + + /* perform SSL initialization for this socket */ + result = Curl_ssl_connect_nonblocking(conn, FIRSTSOCKET, done); + if(result) + conn->bits.close = TRUE; /* a failed connection is marked for closure + to prevent (bad) re-use or similar */ + return result; +} +#endif + +#if defined(USE_SSLEAY) || defined(USE_GNUTLS) +/* This function is for OpenSSL and GnuTLS only. It should be made to query + the generic SSL layer instead. */ +static int https_getsock(struct connectdata *conn, + curl_socket_t *socks, + int numsocks) +{ + if(conn->protocol & PROT_HTTPS) { + struct ssl_connect_data *connssl = &conn->ssl[FIRSTSOCKET]; + + if(!numsocks) + return GETSOCK_BLANK; + + if(connssl->connecting_state == ssl_connect_2_writing) { + /* write mode */ + socks[0] = conn->sock[FIRSTSOCKET]; + return GETSOCK_WRITESOCK(0); + } + else if(connssl->connecting_state == ssl_connect_2_reading) { + /* read mode */ + socks[0] = conn->sock[FIRSTSOCKET]; + return GETSOCK_READSOCK(0); + } + } + return CURLE_OK; +} +#else +#ifdef USE_NSS +static int https_getsock(struct connectdata *conn, + curl_socket_t *socks, + int numsocks) +{ + (void)conn; + (void)socks; + (void)numsocks; + return GETSOCK_BLANK; +} +#else +#ifdef USE_QSOSSL +static int https_getsock(struct connectdata *conn, + curl_socket_t *socks, + int numsocks) +{ + (void)conn; + (void)socks; + (void)numsocks; + return GETSOCK_BLANK; +} +#else +#ifdef USE_POLARSSL +static int https_getsock(struct connectdata *conn, + curl_socket_t *socks, + int numsocks) +{ + (void)conn; + (void)socks; + (void)numsocks; + return GETSOCK_BLANK; +} +#endif +#endif +#endif +#endif + +/* + * Curl_http_done() gets called from Curl_done() after a single HTTP request + * has been performed. + */ + +CURLcode Curl_http_done(struct connectdata *conn, + CURLcode status, bool premature) +{ + struct SessionHandle *data = conn->data; + struct HTTP *http =data->state.proto.http; + (void)premature; /* not used */ + + Curl_unencode_cleanup(conn); + + /* set the proper values (possibly modified on POST) */ + conn->fread_func = data->set.fread_func; /* restore */ + conn->fread_in = data->set.in; /* restore */ + conn->seek_func = data->set.seek_func; /* restore */ + conn->seek_client = data->set.seek_client; /* restore */ + + if(http == NULL) + return CURLE_OK; + + if(http->send_buffer) { + Curl_send_buffer *buff = http->send_buffer; + + free(buff->buffer); + free(buff); + http->send_buffer = NULL; /* clear the pointer */ + } + + if(HTTPREQ_POST_FORM == data->set.httpreq) { + data->req.bytecount = http->readbytecount + http->writebytecount; + + Curl_formclean(&http->sendit); /* Now free that whole lot */ + if(http->form.fp) { + /* a file being uploaded was left opened, close it! */ + fclose(http->form.fp); + http->form.fp = NULL; + } + } + else if(HTTPREQ_PUT == data->set.httpreq) + data->req.bytecount = http->readbytecount + http->writebytecount; + + if(status != CURLE_OK) + return (status); + + if(!premature && /* this check is pointless when DONE is called before the + entire operation is complete */ + !conn->bits.retry && + ((http->readbytecount + + data->req.headerbytecount - + data->req.deductheadercount)) <= 0) { + /* If this connection isn't simply closed to be retried, AND nothing was + read from the HTTP server (that counts), this can't be right so we + return an error here */ + failf(data, "Empty reply from server"); + return CURLE_GOT_NOTHING; + } + + return CURLE_OK; +} + + +/* Determine if we should use HTTP 1.1 for this request. Reasons to avoid it + are if the user specifically requested HTTP 1.0, if the server we are + connected to only supports 1.0, or if any server previously contacted to + handle this request only supports 1.0. */ +static bool use_http_1_1(const struct SessionHandle *data, + const struct connectdata *conn) +{ + return (bool)((data->set.httpversion == CURL_HTTP_VERSION_1_1) || + ((data->set.httpversion != CURL_HTTP_VERSION_1_0) && + ((conn->httpversion == 11) || + ((conn->httpversion != 10) && + (data->state.httpversion != 10))))); +} + +/* check and possibly add an Expect: header */ +static CURLcode expect100(struct SessionHandle *data, + struct connectdata *conn, + Curl_send_buffer *req_buffer) +{ + CURLcode result = CURLE_OK; + const char *ptr; + data->state.expect100header = FALSE; /* default to false unless it is set + to TRUE below */ + if(use_http_1_1(data, conn)) { + /* if not doing HTTP 1.0 or disabled explicitly, we add a Expect: + 100-continue to the headers which actually speeds up post operations + (as there is one packet coming back from the web server) */ + ptr = Curl_checkheaders(data, "Expect:"); + if (ptr) { + data->state.expect100header = + Curl_compareheader(ptr, "Expect:", "100-continue"); + } + else { + result = Curl_add_bufferf(req_buffer, + "Expect: 100-continue\r\n"); + if(result == CURLE_OK) + data->state.expect100header = TRUE; + } + } + return result; +} + +CURLcode Curl_add_custom_headers(struct connectdata *conn, + Curl_send_buffer *req_buffer) +{ + char *ptr; + struct curl_slist *headers=conn->data->set.headers; + + while(headers) { + ptr = strchr(headers->data, ':'); + if(ptr) { + /* we require a colon for this to be a true header */ + + ptr++; /* pass the colon */ + while(*ptr && ISSPACE(*ptr)) + ptr++; + + if(*ptr) { + /* only send this if the contents was non-blank */ + + if(conn->allocptr.host && + /* a Host: header was sent already, don't pass on any custom Host: + header as that will produce *two* in the same request! */ + checkprefix("Host:", headers->data)) + ; + else if(conn->data->set.httpreq == HTTPREQ_POST_FORM && + /* this header (extended by formdata.c) is sent later */ + checkprefix("Content-Type:", headers->data)) + ; + else if(conn->bits.authneg && + /* while doing auth neg, don't allow the custom length since + we will force length zero then */ + checkprefix("Content-Length", headers->data)) + ; + else { + CURLcode result = Curl_add_bufferf(req_buffer, "%s\r\n", + headers->data); + if(result) + return result; + } + } + } + headers = headers->next; + } + return CURLE_OK; +} + +CURLcode Curl_add_timecondition(struct SessionHandle *data, + Curl_send_buffer *req_buffer) +{ + struct tm *tm; + char *buf = data->state.buffer; + CURLcode result = CURLE_OK; + + /* The If-Modified-Since header family should have their times set in + * GMT as RFC2616 defines: "All HTTP date/time stamps MUST be + * represented in Greenwich Mean Time (GMT), without exception. For the + * purposes of HTTP, GMT is exactly equal to UTC (Coordinated Universal + * Time)." (see page 20 of RFC2616). + */ + +#ifdef HAVE_GMTIME_R + /* thread-safe version */ + struct tm keeptime; + tm = (struct tm *)gmtime_r(&data->set.timevalue, &keeptime); +#else + tm = gmtime(&data->set.timevalue); +#endif + + /* format: "Tue, 15 Nov 1994 12:45:26 GMT" */ + snprintf(buf, BUFSIZE-1, + "%s, %02d %s %4d %02d:%02d:%02d GMT", + Curl_wkday[tm->tm_wday?tm->tm_wday-1:6], + tm->tm_mday, + Curl_month[tm->tm_mon], + tm->tm_year + 1900, + tm->tm_hour, + tm->tm_min, + tm->tm_sec); + + switch(data->set.timecondition) { + case CURL_TIMECOND_IFMODSINCE: + default: + result = Curl_add_bufferf(req_buffer, + "If-Modified-Since: %s\r\n", buf); + break; + case CURL_TIMECOND_IFUNMODSINCE: + result = Curl_add_bufferf(req_buffer, + "If-Unmodified-Since: %s\r\n", buf); + break; + case CURL_TIMECOND_LASTMOD: + result = Curl_add_bufferf(req_buffer, + "Last-Modified: %s\r\n", buf); + break; + } + + return result; +} + +/* + * Curl_http() gets called from the generic Curl_do() function when a HTTP + * request is to be performed. This creates and sends a properly constructed + * HTTP request. + */ +CURLcode Curl_http(struct connectdata *conn, bool *done) +{ + struct SessionHandle *data=conn->data; + CURLcode result=CURLE_OK; + struct HTTP *http; + const char *ppath = data->state.path; + bool paste_ftp_userpwd = FALSE; + char ftp_typecode[sizeof("/;type=?")] = ""; + const char *host = conn->host.name; + const char *te = ""; /* transfer-encoding */ + const char *ptr; + const char *request; + Curl_HttpReq httpreq = data->set.httpreq; + char *addcookies = NULL; + curl_off_t included_body = 0; + const char *httpstring; + Curl_send_buffer *req_buffer; + curl_off_t postsize; /* off_t type to be able to hold a large file size */ + int seekerr = CURL_SEEKFUNC_OK; + + /* Always consider the DO phase done after this function call, even if there + may be parts of the request that is not yet sent, since we can deal with + the rest of the request in the PERFORM phase. */ + *done = TRUE; + + /* If there already is a protocol-specific struct allocated for this + sessionhandle, deal with it */ + Curl_reset_reqproto(conn); + + if(!data->state.proto.http) { + /* Only allocate this struct if we don't already have it! */ + + http = calloc(1, sizeof(struct HTTP)); + if(!http) + return CURLE_OUT_OF_MEMORY; + data->state.proto.http = http; + } + else + http = data->state.proto.http; + + if(!data->state.this_is_a_follow) { + /* this is not a followed location, get the original host name */ + if(data->state.first_host) + /* Free to avoid leaking memory on multiple requests*/ + free(data->state.first_host); + + data->state.first_host = strdup(conn->host.name); + if(!data->state.first_host) + return CURLE_OUT_OF_MEMORY; + } + + if( (conn->protocol&(PROT_HTTP|PROT_FTP)) && + data->set.upload) { + httpreq = HTTPREQ_PUT; + } + + /* Now set the 'request' pointer to the proper request string */ + if(data->set.str[STRING_CUSTOMREQUEST]) + request = data->set.str[STRING_CUSTOMREQUEST]; + else { + if(data->set.opt_no_body) + request = "HEAD"; + else { + DEBUGASSERT((httpreq > HTTPREQ_NONE) && (httpreq < HTTPREQ_LAST)); + switch(httpreq) { + case HTTPREQ_POST: + case HTTPREQ_POST_FORM: + request = "POST"; + break; + case HTTPREQ_PUT: + request = "PUT"; + break; + default: /* this should never happen */ + case HTTPREQ_GET: + request = "GET"; + break; + case HTTPREQ_HEAD: + request = "HEAD"; + break; + } + } + } + + /* The User-Agent string might have been allocated in url.c already, because + it might have been used in the proxy connect, but if we have got a header + with the user-agent string specified, we erase the previously made string + here. */ + if(Curl_checkheaders(data, "User-Agent:") && conn->allocptr.uagent) { + free(conn->allocptr.uagent); + conn->allocptr.uagent=NULL; + } + + /* setup the authentication headers */ + result = http_output_auth(conn, request, ppath, FALSE); + if(result) + return result; + + if((data->state.authhost.multi || data->state.authproxy.multi) && + (httpreq != HTTPREQ_GET) && + (httpreq != HTTPREQ_HEAD)) { + /* Auth is required and we are not authenticated yet. Make a PUT or POST + with content-length zero as a "probe". */ + conn->bits.authneg = TRUE; + } + else + conn->bits.authneg = FALSE; + + Curl_safefree(conn->allocptr.ref); + if(data->change.referer && !Curl_checkheaders(data, "Referer:")) + conn->allocptr.ref = aprintf("Referer: %s\r\n", data->change.referer); + else + conn->allocptr.ref = NULL; + + if(data->set.str[STRING_COOKIE] && !Curl_checkheaders(data, "Cookie:")) + addcookies = data->set.str[STRING_COOKIE]; + + if(!Curl_checkheaders(data, "Accept-Encoding:") && + data->set.str[STRING_ENCODING]) { + Curl_safefree(conn->allocptr.accept_encoding); + conn->allocptr.accept_encoding = + aprintf("Accept-Encoding: %s\r\n", data->set.str[STRING_ENCODING]); + if(!conn->allocptr.accept_encoding) + return CURLE_OUT_OF_MEMORY; + } + + ptr = Curl_checkheaders(data, "Transfer-Encoding:"); + if(ptr) { + /* Some kind of TE is requested, check if 'chunked' is chosen */ + data->req.upload_chunky = + Curl_compareheader(ptr, "Transfer-Encoding:", "chunked"); + } + else { + if((conn->protocol&PROT_HTTP) && + data->set.upload && + (data->set.infilesize == -1)) { + if(conn->bits.authneg) + /* don't enable chunked during auth neg */ + ; + else if(use_http_1_1(data, conn)) { + /* HTTP, upload, unknown file size and not HTTP 1.0 */ + data->req.upload_chunky = TRUE; + } + else { + failf(data, "Chunky upload is not supported by HTTP 1.0"); + return CURLE_UPLOAD_FAILED; + } + } + else { + /* else, no chunky upload */ + data->req.upload_chunky = FALSE; + } + + if(data->req.upload_chunky) + te = "Transfer-Encoding: chunked\r\n"; + } + + Curl_safefree(conn->allocptr.host); + + ptr = Curl_checkheaders(data, "Host:"); + if(ptr && (!data->state.this_is_a_follow || + Curl_raw_equal(data->state.first_host, conn->host.name))) { +#if !defined(CURL_DISABLE_COOKIES) + /* If we have a given custom Host: header, we extract the host name in + order to possibly use it for cookie reasons later on. We only allow the + custom Host: header if this is NOT a redirect, as setting Host: in the + redirected request is being out on thin ice. Except if the host name + is the same as the first one! */ + char *cookiehost = Curl_copy_header_value(ptr); + if (!cookiehost) + return CURLE_OUT_OF_MEMORY; + if (!*cookiehost) + /* ignore empty data */ + free(cookiehost); + else { + char *colon = strchr(cookiehost, ':'); + if (colon) + *colon = 0; /* The host must not include an embedded port number */ + Curl_safefree(conn->allocptr.cookiehost); + conn->allocptr.cookiehost = cookiehost; + } +#endif + + conn->allocptr.host = NULL; + } + else { + /* When building Host: headers, we must put the host name within + [brackets] if the host name is a plain IPv6-address. RFC2732-style. */ + + if(((conn->protocol&PROT_HTTPS) && (conn->remote_port == PORT_HTTPS)) || + (!(conn->protocol&PROT_HTTPS) && (conn->remote_port == PORT_HTTP)) ) + /* if(HTTPS on port 443) OR (non-HTTPS on port 80) then don't include + the port number in the host string */ + conn->allocptr.host = aprintf("Host: %s%s%s\r\n", + conn->bits.ipv6_ip?"[":"", + host, + conn->bits.ipv6_ip?"]":""); + else + conn->allocptr.host = aprintf("Host: %s%s%s:%hu\r\n", + conn->bits.ipv6_ip?"[":"", + host, + conn->bits.ipv6_ip?"]":"", + conn->remote_port); + + if(!conn->allocptr.host) + /* without Host: we can't make a nice request */ + return CURLE_OUT_OF_MEMORY; + } + +#ifndef CURL_DISABLE_PROXY + if(conn->bits.httpproxy && !conn->bits.tunnel_proxy) { + /* Using a proxy but does not tunnel through it */ + + /* The path sent to the proxy is in fact the entire URL. But if the remote + host is a IDN-name, we must make sure that the request we produce only + uses the encoded host name! */ + if(conn->host.dispname != conn->host.name) { + char *url = data->change.url; + ptr = strstr(url, conn->host.dispname); + if(ptr) { + /* This is where the display name starts in the URL, now replace this + part with the encoded name. TODO: This method of replacing the host + name is rather crude as I believe there's a slight risk that the + user has entered a user name or password that contain the host name + string. */ + size_t currlen = strlen(conn->host.dispname); + size_t newlen = strlen(conn->host.name); + size_t urllen = strlen(url); + + char *newurl; + + newurl = malloc(urllen + newlen - currlen + 1); + if(newurl) { + /* copy the part before the host name */ + memcpy(newurl, url, ptr - url); + /* append the new host name instead of the old */ + memcpy(newurl + (ptr - url), conn->host.name, newlen); + /* append the piece after the host name */ + memcpy(newurl + newlen + (ptr - url), + ptr + currlen, /* copy the trailing zero byte too */ + urllen - (ptr-url) - currlen + 1); + if(data->change.url_alloc) + free(data->change.url); + data->change.url = newurl; + data->change.url_alloc = TRUE; + } + else + return CURLE_OUT_OF_MEMORY; + } + } + ppath = data->change.url; + if(checkprefix("ftp://", ppath)) { + if (data->set.proxy_transfer_mode) { + /* when doing ftp, append ;type= if not present */ + char *type = strstr(ppath, ";type="); + if(type && type[6] && type[7] == 0) { + switch (Curl_raw_toupper(type[6])) { + case 'A': + case 'D': + case 'I': + break; + default: + type = NULL; + } + } + if(!type) { + char *p = ftp_typecode; + /* avoid sending invalid URLs like ftp://example.com;type=i if the + * user specified ftp://example.com without the slash */ + if (!*data->state.path && ppath[strlen(ppath) - 1] != '/') { + *p++ = '/'; + } + snprintf(p, sizeof(ftp_typecode) - 1, ";type=%c", + data->set.prefer_ascii ? 'a' : 'i'); + } + } + if (conn->bits.user_passwd && !conn->bits.userpwd_in_url) + paste_ftp_userpwd = TRUE; + } + } +#endif /* CURL_DISABLE_PROXY */ + + if(HTTPREQ_POST_FORM == httpreq) { + /* we must build the whole post sequence first, so that we have a size of + the whole transfer before we start to send it */ + result = Curl_getformdata(data, &http->sendit, data->set.httppost, + Curl_checkheaders(data, "Content-Type:"), + &http->postsize); + if(result) + return result; + } + + http->p_accept = Curl_checkheaders(data, "Accept:")?NULL:"Accept: */*\r\n"; + + if(( (HTTPREQ_POST == httpreq) || + (HTTPREQ_POST_FORM == httpreq) || + (HTTPREQ_PUT == httpreq) ) && + data->state.resume_from) { + /********************************************************************** + * Resuming upload in HTTP means that we PUT or POST and that we have + * got a resume_from value set. The resume value has already created + * a Range: header that will be passed along. We need to "fast forward" + * the file the given number of bytes and decrease the assume upload + * file size before we continue this venture in the dark lands of HTTP. + *********************************************************************/ + + if(data->state.resume_from < 0 ) { + /* + * This is meant to get the size of the present remote-file by itself. + * We don't support this now. Bail out! + */ + data->state.resume_from = 0; + } + + if(data->state.resume_from && !data->state.this_is_a_follow) { + /* do we still game? */ + + /* Now, let's read off the proper amount of bytes from the + input. */ + if(conn->seek_func) { + seekerr = conn->seek_func(conn->seek_client, data->state.resume_from, + SEEK_SET); + } + + if(seekerr != CURL_SEEKFUNC_OK) { + if(seekerr != CURL_SEEKFUNC_CANTSEEK) { + failf(data, "Could not seek stream"); + return CURLE_READ_ERROR; + } + /* when seekerr == CURL_SEEKFUNC_CANTSEEK (can't seek to offset) */ + else { + curl_off_t passed=0; + do { + size_t readthisamountnow = + (data->state.resume_from - passed > CURL_OFF_T_C(BUFSIZE)) ? + BUFSIZE : curlx_sotouz(data->state.resume_from - passed); + + size_t actuallyread = + data->set.fread_func(data->state.buffer, 1, readthisamountnow, + data->set.in); + + passed += actuallyread; + if((actuallyread == 0) || (actuallyread > readthisamountnow)) { + /* this checks for greater-than only to make sure that the + CURL_READFUNC_ABORT return code still aborts */ + failf(data, "Could only read %" FORMAT_OFF_T + " bytes from the input", + passed); + return CURLE_READ_ERROR; + } + } while(passed < data->state.resume_from); + } + } + + /* now, decrease the size of the read */ + if(data->set.infilesize>0) { + data->set.infilesize -= data->state.resume_from; + + if(data->set.infilesize <= 0) { + failf(data, "File already completely uploaded"); + return CURLE_PARTIAL_FILE; + } + } + /* we've passed, proceed as normal */ + } + } + if(data->state.use_range) { + /* + * A range is selected. We use different headers whether we're downloading + * or uploading and we always let customized headers override our internal + * ones if any such are specified. + */ + if(((httpreq == HTTPREQ_GET) || (httpreq == HTTPREQ_HEAD)) && + !Curl_checkheaders(data, "Range:")) { + /* if a line like this was already allocated, free the previous one */ + if(conn->allocptr.rangeline) + free(conn->allocptr.rangeline); + conn->allocptr.rangeline = aprintf("Range: bytes=%s\r\n", + data->state.range); + } + else if((httpreq != HTTPREQ_GET) && + !Curl_checkheaders(data, "Content-Range:")) { + + /* if a line like this was already allocated, free the previous one */ + if(conn->allocptr.rangeline) + free(conn->allocptr.rangeline); + + if(data->set.set_resume_from < 0) { + /* Upload resume was asked for, but we don't know the size of the + remote part so we tell the server (and act accordingly) that we + upload the whole file (again) */ + conn->allocptr.rangeline = + aprintf("Content-Range: bytes 0-%" FORMAT_OFF_T + "/%" FORMAT_OFF_T "\r\n", + data->set.infilesize - 1, data->set.infilesize); + + } + else if(data->state.resume_from) { + /* This is because "resume" was selected */ + curl_off_t total_expected_size= + data->state.resume_from + data->set.infilesize; + conn->allocptr.rangeline = + aprintf("Content-Range: bytes %s%" FORMAT_OFF_T + "/%" FORMAT_OFF_T "\r\n", + data->state.range, total_expected_size-1, + total_expected_size); + } + else { + /* Range was selected and then we just pass the incoming range and + append total size */ + conn->allocptr.rangeline = + aprintf("Content-Range: bytes %s/%" FORMAT_OFF_T "\r\n", + data->state.range, data->set.infilesize); + } + if(!conn->allocptr.rangeline) + return CURLE_OUT_OF_MEMORY; + } + } + + /* Use 1.1 unless the user specifically asked for 1.0 or the server only + supports 1.0 */ + httpstring= use_http_1_1(data, conn)?"1.1":"1.0"; + + /* initialize a dynamic send-buffer */ + req_buffer = Curl_add_buffer_init(); + + if(!req_buffer) + return CURLE_OUT_OF_MEMORY; + + /* add the main request stuff */ + /* GET/HEAD/POST/PUT */ + result = Curl_add_bufferf(req_buffer, "%s ", request); + if (result) + return result; + + /* url */ + if (paste_ftp_userpwd) + result = Curl_add_bufferf(req_buffer, "ftp://%s:%s@%s", + conn->user, conn->passwd, + ppath + sizeof("ftp://") - 1); + else + result = Curl_add_buffer(req_buffer, ppath, strlen(ppath)); + if (result) + return result; + + result = Curl_add_bufferf(req_buffer, + "%s" /* ftp typecode (;type=x) */ + " HTTP/%s\r\n" /* HTTP version */ + "%s" /* proxyuserpwd */ + "%s" /* userpwd */ + "%s" /* range */ + "%s" /* user agent */ + "%s" /* host */ + "%s" /* accept */ + "%s" /* accept-encoding */ + "%s" /* referer */ + "%s" /* Proxy-Connection */ + "%s",/* transfer-encoding */ + + ftp_typecode, + httpstring, + conn->allocptr.proxyuserpwd? + conn->allocptr.proxyuserpwd:"", + conn->allocptr.userpwd?conn->allocptr.userpwd:"", + (data->state.use_range && conn->allocptr.rangeline)? + conn->allocptr.rangeline:"", + (data->set.str[STRING_USERAGENT] && + *data->set.str[STRING_USERAGENT] && conn->allocptr.uagent)? + conn->allocptr.uagent:"", + (conn->allocptr.host?conn->allocptr.host:""), /* Host: host */ + http->p_accept?http->p_accept:"", + (data->set.str[STRING_ENCODING] && + *data->set.str[STRING_ENCODING] && + conn->allocptr.accept_encoding)? + conn->allocptr.accept_encoding:"", + (data->change.referer && conn->allocptr.ref)? + conn->allocptr.ref:"" /* Referer: */, + (conn->bits.httpproxy && + !conn->bits.tunnel_proxy && + !Curl_checkheaders(data, "Proxy-Connection:"))? + "Proxy-Connection: Keep-Alive\r\n":"", + te + ); + + /* + * Free userpwd now --- cannot reuse this for Negotiate and possibly NTLM + * with basic and digest, it will be freed anyway by the next request + */ + + Curl_safefree (conn->allocptr.userpwd); + conn->allocptr.userpwd = NULL; + + if(result) + return result; + +#if !defined(CURL_DISABLE_COOKIES) + if(data->cookies || addcookies) { + struct Cookie *co=NULL; /* no cookies from start */ + int count=0; + + if(data->cookies) { + Curl_share_lock(data, CURL_LOCK_DATA_COOKIE, CURL_LOCK_ACCESS_SINGLE); + co = Curl_cookie_getlist(data->cookies, + conn->allocptr.cookiehost? + conn->allocptr.cookiehost:host, + data->state.path, + (bool)(conn->protocol&PROT_HTTPS?TRUE:FALSE)); + Curl_share_unlock(data, CURL_LOCK_DATA_COOKIE); + } + if(co) { + struct Cookie *store=co; + /* now loop through all cookies that matched */ + while(co) { + if(co->value) { + if(0 == count) { + result = Curl_add_bufferf(req_buffer, "Cookie: "); + if(result) + break; + } + result = Curl_add_bufferf(req_buffer, + "%s%s=%s", count?"; ":"", + co->name, co->value); + if(result) + break; + count++; + } + co = co->next; /* next cookie please */ + } + Curl_cookie_freelist(store, FALSE); /* free the cookie list */ + } + if(addcookies && (CURLE_OK == result)) { + if(!count) + result = Curl_add_bufferf(req_buffer, "Cookie: "); + if(CURLE_OK == result) { + result = Curl_add_bufferf(req_buffer, "%s%s", + count?"; ":"", + addcookies); + count++; + } + } + if(count && (CURLE_OK == result)) + result = Curl_add_buffer(req_buffer, "\r\n", 2); + + if(result) + return result; + } +#endif + + if(data->set.timecondition) { + result = Curl_add_timecondition(data, req_buffer); + if(result) + return result; + } + + result = Curl_add_custom_headers(conn, req_buffer); + if(result) + return result; + + http->postdata = NULL; /* nothing to post at this point */ + Curl_pgrsSetUploadSize(data, 0); /* upload size is 0 atm */ + + /* If 'authdone' is FALSE, we must not set the write socket index to the + Curl_transfer() call below, as we're not ready to actually upload any + data yet. */ + + switch(httpreq) { + + case HTTPREQ_POST_FORM: + if(!http->sendit || conn->bits.authneg) { + /* nothing to post! */ + result = Curl_add_bufferf(req_buffer, "Content-Length: 0\r\n\r\n"); + if(result) + return result; + + result = Curl_add_buffer_send(req_buffer, conn, + &data->info.request_size, 0, FIRSTSOCKET); + if(result) + failf(data, "Failed sending POST request"); + else + /* setup variables for the upcoming transfer */ + Curl_setup_transfer(conn, FIRSTSOCKET, -1, TRUE, &http->readbytecount, + -1, NULL); + break; + } + + if(Curl_FormInit(&http->form, http->sendit)) { + failf(data, "Internal HTTP POST error!"); + return CURLE_HTTP_POST_ERROR; + } + + /* Get the currently set callback function pointer and store that in the + form struct since we might want the actual user-provided callback later + on. The conn->fread_func pointer itself will be changed for the + multipart case to the function that returns a multipart formatted + stream. */ + http->form.fread_func = conn->fread_func; + + /* Set the read function to read from the generated form data */ + conn->fread_func = (curl_read_callback)Curl_FormReader; + conn->fread_in = &http->form; + + http->sending = HTTPSEND_BODY; + + if(!data->req.upload_chunky) { + /* only add Content-Length if not uploading chunked */ + result = Curl_add_bufferf(req_buffer, + "Content-Length: %" FORMAT_OFF_T "\r\n", + http->postsize); + if(result) + return result; + } + + result = expect100(data, conn, req_buffer); + if(result) + return result; + + { + + /* Get Content-Type: line from Curl_formpostheader. + */ + char *contentType; + size_t linelength=0; + contentType = Curl_formpostheader((void *)&http->form, + &linelength); + if(!contentType) { + failf(data, "Could not get Content-Type header line!"); + return CURLE_HTTP_POST_ERROR; + } + + result = Curl_add_buffer(req_buffer, contentType, linelength); + if(result) + return result; + } + + /* make the request end in a true CRLF */ + result = Curl_add_buffer(req_buffer, "\r\n", 2); + if(result) + return result; + + /* set upload size to the progress meter */ + Curl_pgrsSetUploadSize(data, http->postsize); + + /* fire away the whole request to the server */ + result = Curl_add_buffer_send(req_buffer, conn, + &data->info.request_size, 0, FIRSTSOCKET); + if(result) + failf(data, "Failed sending POST request"); + else + /* setup variables for the upcoming transfer */ + Curl_setup_transfer(conn, FIRSTSOCKET, -1, TRUE, + &http->readbytecount, FIRSTSOCKET, + &http->writebytecount); + + if(result) { + Curl_formclean(&http->sendit); /* free that whole lot */ + return result; + } +#ifdef CURL_DOES_CONVERSIONS +/* time to convert the form data... */ + result = Curl_formconvert(data, http->sendit); + if(result) { + Curl_formclean(&http->sendit); /* free that whole lot */ + return result; + } +#endif /* CURL_DOES_CONVERSIONS */ + break; + + case HTTPREQ_PUT: /* Let's PUT the data to the server! */ + + if(conn->bits.authneg) + postsize = 0; + else + postsize = data->set.infilesize; + + if((postsize != -1) && !data->req.upload_chunky) { + /* only add Content-Length if not uploading chunked */ + result = Curl_add_bufferf(req_buffer, + "Content-Length: %" FORMAT_OFF_T "\r\n", + postsize ); + if(result) + return result; + } + + result = expect100(data, conn, req_buffer); + if(result) + return result; + + result = Curl_add_buffer(req_buffer, "\r\n", 2); /* end of headers */ + if(result) + return result; + + /* set the upload size to the progress meter */ + Curl_pgrsSetUploadSize(data, postsize); + + /* this sends the buffer and frees all the buffer resources */ + result = Curl_add_buffer_send(req_buffer, conn, + &data->info.request_size, 0, FIRSTSOCKET); + if(result) + failf(data, "Failed sending PUT request"); + else + /* prepare for transfer */ + Curl_setup_transfer(conn, FIRSTSOCKET, -1, TRUE, + &http->readbytecount, postsize?FIRSTSOCKET:-1, + postsize?&http->writebytecount:NULL); + if(result) + return result; + break; + + case HTTPREQ_POST: + /* this is the simple POST, using x-www-form-urlencoded style */ + + if(conn->bits.authneg) + postsize = 0; + else { + /* figure out the size of the postfields */ + postsize = (data->set.postfieldsize != -1)? + data->set.postfieldsize: + (data->set.postfields? (curl_off_t)strlen(data->set.postfields):-1); + } + if(!data->req.upload_chunky) { + /* We only set Content-Length and allow a custom Content-Length if + we don't upload data chunked, as RFC2616 forbids us to set both + kinds of headers (Transfer-Encoding: chunked and Content-Length) */ + + if(conn->bits.authneg || !Curl_checkheaders(data, "Content-Length:")) { + /* we allow replacing this header if not during auth negotiation, + although it isn't very wise to actually set your own */ + result = Curl_add_bufferf(req_buffer, + "Content-Length: %" FORMAT_OFF_T"\r\n", + postsize); + if(result) + return result; + } + } + + if(!Curl_checkheaders(data, "Content-Type:")) { + result = Curl_add_bufferf(req_buffer, + "Content-Type: application/" + "x-www-form-urlencoded\r\n"); + if(result) + return result; + } + + /* For really small posts we don't use Expect: headers at all, and for + the somewhat bigger ones we allow the app to disable it. Just make + sure that the expect100header is always set to the preferred value + here. */ + ptr = Curl_checkheaders(data, "Expect:"); + if(ptr) { + data->state.expect100header = + Curl_compareheader(ptr, "Expect:", "100-continue"); + } + else if(postsize > TINY_INITIAL_POST_SIZE || postsize < 0) { + result = expect100(data, conn, req_buffer); + if(result) + return result; + } + else + data->state.expect100header = FALSE; + + if(data->set.postfields) { + + if(!data->state.expect100header && + (postsize < MAX_INITIAL_POST_SIZE)) { + /* if we don't use expect: 100 AND + postsize is less than MAX_INITIAL_POST_SIZE + + then append the post data to the HTTP request header. This limit + is no magic limit but only set to prevent really huge POSTs to + get the data duplicated with malloc() and family. */ + + result = Curl_add_buffer(req_buffer, "\r\n", 2); /* end of headers! */ + if(result) + return result; + + if(!data->req.upload_chunky) { + /* We're not sending it 'chunked', append it to the request + already now to reduce the number if send() calls */ + result = Curl_add_buffer(req_buffer, data->set.postfields, + (size_t)postsize); + included_body = postsize; + } + else { + /* Append the POST data chunky-style */ + result = Curl_add_bufferf(req_buffer, "%x\r\n", (int)postsize); + if(CURLE_OK == result) + result = Curl_add_buffer(req_buffer, data->set.postfields, + (size_t)postsize); + if(CURLE_OK == result) + result = Curl_add_buffer(req_buffer, + "\x0d\x0a\x30\x0d\x0a\x0d\x0a", 7); + /* CR LF 0 CR LF CR LF */ + included_body = postsize + 7; + } + if(result) + return result; + /* Make sure the progress information is accurate */ + Curl_pgrsSetUploadSize(data, postsize); + } + else { + /* A huge POST coming up, do data separate from the request */ + http->postsize = postsize; + http->postdata = data->set.postfields; + + http->sending = HTTPSEND_BODY; + + conn->fread_func = (curl_read_callback)readmoredata; + conn->fread_in = (void *)conn; + + /* set the upload size to the progress meter */ + Curl_pgrsSetUploadSize(data, http->postsize); + + result = Curl_add_buffer(req_buffer, "\r\n", 2); /* end of headers! */ + if(result) + return result; + } + } + else { + result = Curl_add_buffer(req_buffer, "\r\n", 2); /* end of headers! */ + if(result) + return result; + + if(data->req.upload_chunky && conn->bits.authneg) { + /* Chunky upload is selected and we're negotiating auth still, send + end-of-data only */ + result = Curl_add_buffer(req_buffer, + "\x0d\x0a\x30\x0d\x0a\x0d\x0a", 7); + /* CR LF 0 CR LF CR LF */ + if(result) + return result; + } + + else if(data->set.postfieldsize) { + /* set the upload size to the progress meter */ + Curl_pgrsSetUploadSize(data, postsize?postsize:-1); + + /* set the pointer to mark that we will send the post body using the + read callback, but only if we're not in authenticate + negotiation */ + if(!conn->bits.authneg) { + http->postdata = (char *)&http->postdata; + http->postsize = postsize; + } + } + } + /* issue the request */ + result = Curl_add_buffer_send(req_buffer, conn, &data->info.request_size, + (size_t)included_body, FIRSTSOCKET); + + if(result) + failf(data, "Failed sending HTTP POST request"); + else + Curl_setup_transfer(conn, FIRSTSOCKET, -1, TRUE, + &http->readbytecount, http->postdata?FIRSTSOCKET:-1, + http->postdata?&http->writebytecount:NULL); + break; + + default: + result = Curl_add_buffer(req_buffer, "\r\n", 2); + if(result) + return result; + + /* issue the request */ + result = Curl_add_buffer_send(req_buffer, conn, + &data->info.request_size, 0, FIRSTSOCKET); + + if(result) + failf(data, "Failed sending HTTP request"); + else + /* HTTP GET/HEAD download: */ + Curl_setup_transfer(conn, FIRSTSOCKET, -1, TRUE, &http->readbytecount, + http->postdata?FIRSTSOCKET:-1, + http->postdata?&http->writebytecount:NULL); + } + if(result) + return result; + + if(http->writebytecount) { + /* if a request-body has been sent off, we make sure this progress is noted + properly */ + Curl_pgrsSetUploadCounter(data, http->writebytecount); + if(Curl_pgrsUpdate(conn)) + result = CURLE_ABORTED_BY_CALLBACK; + } + + return result; +} + +/* + * checkhttpprefix() + * + * Returns TRUE if member of the list matches prefix of string + */ +static bool +checkhttpprefix(struct SessionHandle *data, + const char *s) +{ + struct curl_slist *head = data->set.http200aliases; + bool rc = FALSE; +#ifdef CURL_DOES_CONVERSIONS + /* convert from the network encoding using a scratch area */ + char *scratch = strdup(s); + if(NULL == scratch) { + failf (data, "Failed to allocate memory for conversion!"); + return FALSE; /* can't return CURLE_OUT_OF_MEMORY so return FALSE */ + } + if(CURLE_OK != Curl_convert_from_network(data, scratch, strlen(s)+1)) { + /* Curl_convert_from_network calls failf if unsuccessful */ + free(scratch); + return FALSE; /* can't return CURLE_foobar so return FALSE */ + } + s = scratch; +#endif /* CURL_DOES_CONVERSIONS */ + + while(head) { + if(checkprefix(head->data, s)) { + rc = TRUE; + break; + } + head = head->next; + } + + if((rc != TRUE) && (checkprefix("HTTP/", s))) { + rc = TRUE; + } + +#ifdef CURL_DOES_CONVERSIONS + free(scratch); +#endif /* CURL_DOES_CONVERSIONS */ + return rc; +} + +#ifndef CURL_DISABLE_RTSP +static bool +checkrtspprefix(struct SessionHandle *data, + const char *s) +{ + +#ifdef CURL_DOES_CONVERSIONS + /* convert from the network encoding using a scratch area */ + char *scratch = strdup(s); + if(NULL == scratch) { + failf (data, "Failed to allocate memory for conversion!"); + return FALSE; /* can't return CURLE_OUT_OF_MEMORY so return FALSE */ + } + if(CURLE_OK != Curl_convert_from_network(data, scratch, strlen(s)+1)) { + /* Curl_convert_from_network calls failf if unsuccessful */ + free(scratch); + return FALSE; /* can't return CURLE_foobar so return FALSE */ + } + s = scratch; +#else + (void)data; /* unused */ +#endif /* CURL_DOES_CONVERSIONS */ + if(checkprefix("RTSP/", s)) + return TRUE; + else + return FALSE; +} +#endif /* CURL_DISABLE_RTSP */ + +static bool +checkprotoprefix(struct SessionHandle *data, struct connectdata *conn, + const char *s) +{ +#ifndef CURL_DISABLE_RTSP + if(conn->protocol & PROT_RTSP) + return checkrtspprefix(data, s); +#else + (void)conn; +#endif /* CURL_DISABLE_RTSP */ + + return checkhttpprefix(data, s); +} + +/* + * header_append() copies a chunk of data to the end of the already received + * header. We make sure that the full string fit in the allocated header + * buffer, or else we enlarge it. + */ +static CURLcode header_append(struct SessionHandle *data, + struct SingleRequest *k, + size_t length) +{ + if(k->hbuflen + length >= data->state.headersize) { + /* We enlarge the header buffer as it is too small */ + char *newbuff; + size_t hbufp_index; + size_t newsize; + + if(k->hbuflen + length > CURL_MAX_HTTP_HEADER) { + /* The reason to have a max limit for this is to avoid the risk of a bad + server feeding libcurl with a never-ending header that will cause + reallocs infinitely */ + failf (data, "Avoided giant realloc for header (max is %d)!", + CURL_MAX_HTTP_HEADER); + return CURLE_OUT_OF_MEMORY; + } + + newsize=CURLMAX((k->hbuflen+ length)*3/2, data->state.headersize*2); + hbufp_index = k->hbufp - data->state.headerbuff; + newbuff = realloc(data->state.headerbuff, newsize); + if(!newbuff) { + failf (data, "Failed to alloc memory for big header!"); + return CURLE_OUT_OF_MEMORY; + } + data->state.headersize=newsize; + data->state.headerbuff = newbuff; + k->hbufp = data->state.headerbuff + hbufp_index; + } + memcpy(k->hbufp, k->str_start, length); + k->hbufp += length; + k->hbuflen += length; + *k->hbufp = 0; + + return CURLE_OK; +} + + +/* + * Read any HTTP header lines from the server and pass them to the client app. + */ +CURLcode Curl_http_readwrite_headers(struct SessionHandle *data, + struct connectdata *conn, + ssize_t *nread, + bool *stop_reading) +{ + CURLcode result; + struct SingleRequest *k = &data->req; + + /* header line within buffer loop */ + do { + size_t rest_length; + size_t full_length; + int writetype; + + /* str_start is start of line within buf */ + k->str_start = k->str; + + /* data is in network encoding so use 0x0a instead of '\n' */ + k->end_ptr = memchr(k->str_start, 0x0a, *nread); + + if(!k->end_ptr) { + /* Not a complete header line within buffer, append the data to + the end of the headerbuff. */ + result = header_append(data, k, *nread); + if(result) + return result; + + if(!k->headerline && (k->hbuflen>5)) { + /* make a first check that this looks like a protocol header */ + if(!checkprotoprefix(data, conn, data->state.headerbuff)) { + /* this is not the beginning of a protocol first header line */ + k->header = FALSE; + k->badheader = HEADER_ALLBAD; + break; + } + } + + break; /* read more and try again */ + } + + /* decrease the size of the remaining (supposed) header line */ + rest_length = (k->end_ptr - k->str)+1; + *nread -= (ssize_t)rest_length; + + k->str = k->end_ptr + 1; /* move past new line */ + + full_length = k->str - k->str_start; + + result = header_append(data, k, full_length); + if(result) + return result; + + k->end_ptr = k->hbufp; + k->p = data->state.headerbuff; + + /**** + * We now have a FULL header line that p points to + *****/ + + if(!k->headerline) { + /* the first read header */ + if((k->hbuflen>5) && + !checkprotoprefix(data, conn, data->state.headerbuff)) { + /* this is not the beginning of a protocol first header line */ + k->header = FALSE; + if(*nread) + /* since there's more, this is a partial bad header */ + k->badheader = HEADER_PARTHEADER; + else { + /* this was all we read so it's all a bad header */ + k->badheader = HEADER_ALLBAD; + *nread = (ssize_t)rest_length; + } + break; + } + } + + /* headers are in network encoding so + use 0x0a and 0x0d instead of '\n' and '\r' */ + if((0x0a == *k->p) || (0x0d == *k->p)) { + size_t headerlen; + /* Zero-length header line means end of headers! */ + +#ifdef CURL_DOES_CONVERSIONS + if(0x0d == *k->p) { + *k->p = '\r'; /* replace with CR in host encoding */ + k->p++; /* pass the CR byte */ + } + if(0x0a == *k->p) { + *k->p = '\n'; /* replace with LF in host encoding */ + k->p++; /* pass the LF byte */ + } +#else + if('\r' == *k->p) + k->p++; /* pass the \r byte */ + if('\n' == *k->p) + k->p++; /* pass the \n byte */ +#endif /* CURL_DOES_CONVERSIONS */ + + if(100 <= k->httpcode && 199 >= k->httpcode) { + /* + * We have made a HTTP PUT or POST and this is 1.1-lingo + * that tells us that the server is OK with this and ready + * to receive the data. + * However, we'll get more headers now so we must get + * back into the header-parsing state! + */ + k->header = TRUE; + k->headerline = 0; /* restart the header line counter */ + + /* if we did wait for this do enable write now! */ + if(k->exp100) { + k->exp100 = EXP100_SEND_DATA; + k->keepon |= KEEP_SEND; + } + } + else { + k->header = FALSE; /* no more header to parse! */ + + if((k->size == -1) && !k->chunk && !conn->bits.close && + (conn->httpversion >= 11) && !(conn->protocol & PROT_RTSP)) { + /* On HTTP 1.1, when connection is not to get closed, but no + Content-Length nor Content-Encoding chunked have been + received, according to RFC2616 section 4.4 point 5, we + assume that the server will close the connection to + signal the end of the document. */ + infof(data, "no chunk, no close, no size. Assume close to " + "signal end\n"); + conn->bits.close = TRUE; + } + } + + if(417 == k->httpcode) { + /* + * we got: "417 Expectation Failed" this means: + * we have made a HTTP call and our Expect Header + * seems to cause a problem => abort the write operations + * (or prevent them from starting). + */ + k->exp100 = EXP100_FAILED; + k->keepon &= ~KEEP_SEND; + } + + /* + * When all the headers have been parsed, see if we should give + * up and return an error. + */ + if(Curl_http_should_fail(conn)) { + failf (data, "The requested URL returned error: %d", + k->httpcode); + return CURLE_HTTP_RETURNED_ERROR; + } + + /* now, only output this if the header AND body are requested: + */ + writetype = CLIENTWRITE_HEADER; + if(data->set.include_header) + writetype |= CLIENTWRITE_BODY; + + headerlen = k->p - data->state.headerbuff; + + result = Curl_client_write(conn, writetype, + data->state.headerbuff, + headerlen); + if(result) + return result; + + data->info.header_size += (long)headerlen; + data->req.headerbytecount += (long)headerlen; + + data->req.deductheadercount = + (100 <= k->httpcode && 199 >= k->httpcode)?data->req.headerbytecount:0; + + if(!*stop_reading) { + /* Curl_http_auth_act() checks what authentication methods + * that are available and decides which one (if any) to + * use. It will set 'newurl' if an auth method was picked. */ + result = Curl_http_auth_act(conn); + + if(result) + return result; + + if(conn->bits.rewindaftersend) { + /* We rewind after a complete send, so thus we continue + sending now */ + infof(data, "Keep sending data to get tossed away!\n"); + k->keepon |= KEEP_SEND; + } + } + + if(!k->header) { + /* + * really end-of-headers. + * + * If we requested a "no body", this is a good time to get + * out and return home. + */ + if(data->set.opt_no_body) + *stop_reading = TRUE; + else { + /* If we know the expected size of this document, we set the + maximum download size to the size of the expected + document or else, we won't know when to stop reading! + + Note that we set the download maximum even if we read a + "Connection: close" header, to make sure that + "Content-Length: 0" still prevents us from attempting to + read the (missing) response-body. + */ + /* According to RFC2616 section 4.4, we MUST ignore + Content-Length: headers if we are now receiving data + using chunked Transfer-Encoding. + */ + if(k->chunk) + k->maxdownload = k->size = -1; + } + if(-1 != k->size) { + /* We do this operation even if no_body is true, since this + data might be retrieved later with curl_easy_getinfo() + and its CURLINFO_CONTENT_LENGTH_DOWNLOAD option. */ + + Curl_pgrsSetDownloadSize(data, k->size); + k->maxdownload = k->size; + } + + /* If max download size is *zero* (nothing) we already + have nothing and can safely return ok now! */ + if(0 == k->maxdownload) + *stop_reading = TRUE; + + if(*stop_reading) { + /* we make sure that this socket isn't read more now */ + k->keepon &= ~KEEP_RECV; + } + + if(data->set.verbose) + Curl_debug(data, CURLINFO_HEADER_IN, + k->str_start, headerlen, conn); + break; /* exit header line loop */ + } + + /* We continue reading headers, so reset the line-based + header parsing variables hbufp && hbuflen */ + k->hbufp = data->state.headerbuff; + k->hbuflen = 0; + continue; + } + + /* + * Checks for special headers coming up. + */ + + if(!k->headerline++) { + /* This is the first header, it MUST be the error code line + or else we consider this to be the body right away! */ + int httpversion_major; + int rtspversion_major; + int nc = 0; +#ifdef CURL_DOES_CONVERSIONS +#define HEADER1 scratch +#define SCRATCHSIZE 21 + CURLcode res; + char scratch[SCRATCHSIZE+1]; /* "HTTP/major.minor 123" */ + /* We can't really convert this yet because we + don't know if it's the 1st header line or the body. + So we do a partial conversion into a scratch area, + leaving the data at k->p as-is. + */ + strncpy(&scratch[0], k->p, SCRATCHSIZE); + scratch[SCRATCHSIZE] = 0; /* null terminate */ + res = Curl_convert_from_network(data, + &scratch[0], + SCRATCHSIZE); + if(CURLE_OK != res) { + /* Curl_convert_from_network calls failf if unsuccessful */ + return res; + } +#else +#define HEADER1 k->p /* no conversion needed, just use k->p */ +#endif /* CURL_DOES_CONVERSIONS */ + + if(conn->protocol & PROT_HTTP) { + nc = sscanf(HEADER1, + " HTTP/%d.%d %3d", + &httpversion_major, + &conn->httpversion, + &k->httpcode); + if(nc==3) { + conn->httpversion += 10 * httpversion_major; + } + else { + /* this is the real world, not a Nirvana + NCSA 1.5.x returns this crap when asked for HTTP/1.1 + */ + nc=sscanf(HEADER1, " HTTP %3d", &k->httpcode); + conn->httpversion = 10; + + /* If user has set option HTTP200ALIASES, + compare header line against list of aliases + */ + if(!nc) { + if(checkhttpprefix(data, k->p)) { + nc = 1; + k->httpcode = 200; + conn->httpversion = 10; + } + } + } + } + else if(conn->protocol & PROT_RTSP) { + nc = sscanf(HEADER1, + " RTSP/%d.%d %3d", + &rtspversion_major, + &conn->rtspversion, + &k->httpcode); + if(nc==3) { + conn->rtspversion += 10 * rtspversion_major; + conn->httpversion = 11; /* For us, RTSP acts like HTTP 1.1 */ + } + else { + /* TODO: do we care about the other cases here? */ + nc = 0; + } + } + + if(nc) { + data->info.httpcode = k->httpcode; + + data->info.httpversion = conn->httpversion; + if (!data->state.httpversion || + data->state.httpversion > conn->httpversion) + /* store the lowest server version we encounter */ + data->state.httpversion = conn->httpversion; + + /* + * This code executes as part of processing the header. As a + * result, it's not totally clear how to interpret the + * response code yet as that depends on what other headers may + * be present. 401 and 407 may be errors, but may be OK + * depending on how authentication is working. Other codes + * are definitely errors, so give up here. + */ + if(data->set.http_fail_on_error && (k->httpcode >= 400) && + ((k->httpcode != 401) || !conn->bits.user_passwd) && + ((k->httpcode != 407) || !conn->bits.proxy_user_passwd) ) { + + if(data->state.resume_from && + (data->set.httpreq==HTTPREQ_GET) && + (k->httpcode == 416)) { + /* "Requested Range Not Satisfiable", just proceed and + pretend this is no error */ + } + else { + /* serious error, go home! */ + failf (data, "The requested URL returned error: %d", + k->httpcode); + return CURLE_HTTP_RETURNED_ERROR; + } + } + + if(conn->httpversion == 10) { + /* Default action for HTTP/1.0 must be to close, unless + we get one of those fancy headers that tell us the + server keeps it open for us! */ + infof(data, "HTTP 1.0, assume close after body\n"); + conn->bits.close = TRUE; + } + else if(conn->httpversion >= 11 && + !conn->bits.close) { + /* If HTTP version is >= 1.1 and connection is persistent + server supports pipelining. */ + DEBUGF(infof(data, + "HTTP 1.1 or later with persistent connection, " + "pipelining supported\n")); + conn->server_supports_pipelining = TRUE; + } + + switch(k->httpcode) { + case 204: + /* (quote from RFC2616, section 10.2.5): The server has + * fulfilled the request but does not need to return an + * entity-body ... The 204 response MUST NOT include a + * message-body, and thus is always terminated by the first + * empty line after the header fields. */ + /* FALLTHROUGH */ + case 304: + /* (quote from RFC2616, section 10.3.5): The 304 response + * MUST NOT contain a message-body, and thus is always + * terminated by the first empty line after the header + * fields. */ + if(data->set.timecondition) + data->info.timecond = TRUE; + k->size=0; + k->maxdownload=0; + k->ignorecl = TRUE; /* ignore Content-Length headers */ + break; + default: + /* nothing */ + break; + } + } + else { + k->header = FALSE; /* this is not a header line */ + break; + } + } + +#ifdef CURL_DOES_CONVERSIONS + /* convert from the network encoding */ + result = Curl_convert_from_network(data, k->p, strlen(k->p)); + if(CURLE_OK != result) { + return(result); + } + /* Curl_convert_from_network calls failf if unsuccessful */ +#endif /* CURL_DOES_CONVERSIONS */ + + /* Check for Content-Length: header lines to get size */ + if(!k->ignorecl && !data->set.ignorecl && + checkprefix("Content-Length:", k->p)) { + curl_off_t contentlength = curlx_strtoofft(k->p+15, NULL, 10); + if(data->set.max_filesize && + contentlength > data->set.max_filesize) { + failf(data, "Maximum file size exceeded"); + return CURLE_FILESIZE_EXCEEDED; + } + if(contentlength >= 0) { + k->size = contentlength; + k->maxdownload = k->size; + /* we set the progress download size already at this point + just to make it easier for apps/callbacks to extract this + info as soon as possible */ + Curl_pgrsSetDownloadSize(data, k->size); + } + else { + /* Negative Content-Length is really odd, and we know it + happens for example when older Apache servers send large + files */ + conn->bits.close = TRUE; + infof(data, "Negative content-length: %" FORMAT_OFF_T + ", closing after transfer\n", contentlength); + } + } + /* check for Content-Type: header lines to get the MIME-type */ + else if(checkprefix("Content-Type:", k->p)) { + char *contenttype = Curl_copy_header_value(k->p); + if (!contenttype) + return CURLE_OUT_OF_MEMORY; + if (!*contenttype) + /* ignore empty data */ + free(contenttype); + else { + Curl_safefree(data->info.contenttype); + data->info.contenttype = contenttype; + } + } + else if((conn->httpversion == 10) && + conn->bits.httpproxy && + Curl_compareheader(k->p, + "Proxy-Connection:", "keep-alive")) { + /* + * When a HTTP/1.0 reply comes when using a proxy, the + * 'Proxy-Connection: keep-alive' line tells us the + * connection will be kept alive for our pleasure. + * Default action for 1.0 is to close. + */ + conn->bits.close = FALSE; /* don't close when done */ + infof(data, "HTTP/1.0 proxy connection set to keep alive!\n"); + } + else if((conn->httpversion == 11) && + conn->bits.httpproxy && + Curl_compareheader(k->p, + "Proxy-Connection:", "close")) { + /* + * We get a HTTP/1.1 response from a proxy and it says it'll + * close down after this transfer. + */ + conn->bits.close = TRUE; /* close when done */ + infof(data, "HTTP/1.1 proxy connection set close!\n"); + } + else if((conn->httpversion == 10) && + Curl_compareheader(k->p, "Connection:", "keep-alive")) { + /* + * A HTTP/1.0 reply with the 'Connection: keep-alive' line + * tells us the connection will be kept alive for our + * pleasure. Default action for 1.0 is to close. + * + * [RFC2068, section 19.7.1] */ + conn->bits.close = FALSE; /* don't close when done */ + infof(data, "HTTP/1.0 connection set to keep alive!\n"); + } + else if(Curl_compareheader(k->p, "Connection:", "close")) { + /* + * [RFC 2616, section 8.1.2.1] + * "Connection: close" is HTTP/1.1 language and means that + * the connection will close when this request has been + * served. + */ + conn->bits.close = TRUE; /* close when done */ + } + else if(Curl_compareheader(k->p, "Transfer-Encoding:", "chunked") && + !(conn->protocol & PROT_RTSP)) { + /* + * [RFC 2616, section 3.6.1] A 'chunked' transfer encoding + * means that the server will send a series of "chunks". Each + * chunk starts with line with info (including size of the + * coming block) (terminated with CRLF), then a block of data + * with the previously mentioned size. There can be any amount + * of chunks, and a chunk-data set to zero signals the + * end-of-chunks. */ + k->chunk = TRUE; /* chunks coming our way */ + + /* init our chunky engine */ + Curl_httpchunk_init(conn); + } + else if(checkprefix("Content-Encoding:", k->p) && + data->set.str[STRING_ENCODING]) { + /* + * Process Content-Encoding. Look for the values: identity, + * gzip, deflate, compress, x-gzip and x-compress. x-gzip and + * x-compress are the same as gzip and compress. (Sec 3.5 RFC + * 2616). zlib cannot handle compress. However, errors are + * handled further down when the response body is processed + */ + char *start; + + /* Find the first non-space letter */ + start = k->p + 17; + while(*start && ISSPACE(*start)) + start++; + + /* Record the content-encoding for later use */ + if(checkprefix("identity", start)) + k->content_encoding = IDENTITY; + else if(checkprefix("deflate", start)) + k->content_encoding = DEFLATE; + else if(checkprefix("gzip", start) + || checkprefix("x-gzip", start)) + k->content_encoding = GZIP; + else if(checkprefix("compress", start) + || checkprefix("x-compress", start)) + k->content_encoding = COMPRESS; + } + else if(checkprefix("Content-Range:", k->p)) { + /* Content-Range: bytes [num]- + Content-Range: bytes: [num]- + Content-Range: [num]- + + The second format was added since Sun's webserver + JavaWebServer/1.1.1 obviously sends the header this way! + The third added since some servers use that! + */ + + char *ptr = k->p + 14; + + /* Move forward until first digit */ + while(*ptr && !ISDIGIT(*ptr)) + ptr++; + + k->offset = curlx_strtoofft(ptr, NULL, 10); + + if(data->state.resume_from == k->offset) + /* we asked for a resume and we got it */ + k->content_range = TRUE; + } +#if !defined(CURL_DISABLE_COOKIES) + else if(data->cookies && + checkprefix("Set-Cookie:", k->p)) { + Curl_share_lock(data, CURL_LOCK_DATA_COOKIE, + CURL_LOCK_ACCESS_SINGLE); + Curl_cookie_add(data, + data->cookies, TRUE, k->p+11, + /* If there is a custom-set Host: name, use it + here, or else use real peer host name. */ + conn->allocptr.cookiehost? + conn->allocptr.cookiehost:conn->host.name, + data->state.path); + Curl_share_unlock(data, CURL_LOCK_DATA_COOKIE); + } +#endif + else if(checkprefix("Last-Modified:", k->p) && + (data->set.timecondition || data->set.get_filetime) ) { + time_t secs=time(NULL); + k->timeofdoc = curl_getdate(k->p+strlen("Last-Modified:"), + &secs); + if(data->set.get_filetime) + data->info.filetime = (long)k->timeofdoc; + } + else if((checkprefix("WWW-Authenticate:", k->p) && + (401 == k->httpcode)) || + (checkprefix("Proxy-authenticate:", k->p) && + (407 == k->httpcode))) { + result = Curl_http_input_auth(conn, k->httpcode, k->p); + if(result) + return result; + } + else if((k->httpcode >= 300 && k->httpcode < 400) && + checkprefix("Location:", k->p)) { + /* this is the URL that the server advises us to use instead */ + char *location = Curl_copy_header_value(k->p); + if (!location) + return CURLE_OUT_OF_MEMORY; + if (!*location) + /* ignore empty data */ + free(location); + else { + DEBUGASSERT(!data->req.location); + data->req.location = location; + + if(data->set.http_follow_location) { + DEBUGASSERT(!data->req.newurl); + data->req.newurl = strdup(data->req.location); /* clone */ + if(!data->req.newurl) + return CURLE_OUT_OF_MEMORY; + + /* some cases of POST and PUT etc needs to rewind the data + stream at this point */ + result = Curl_http_perhapsrewind(conn); + if(result) + return result; + } + } + } +#ifndef CURL_DISABLE_RTSP + else if(conn->protocol & PROT_RTSP) { + result = Curl_rtsp_parseheader(conn, k->p); + if(result) + return result; + } +#endif + /* + * End of header-checks. Write them to the client. + */ + + writetype = CLIENTWRITE_HEADER; + if(data->set.include_header) + writetype |= CLIENTWRITE_BODY; + + if(data->set.verbose) + Curl_debug(data, CURLINFO_HEADER_IN, + k->p, (size_t)k->hbuflen, conn); + + result = Curl_client_write(conn, writetype, k->p, k->hbuflen); + if(result) + return result; + + data->info.header_size += (long)k->hbuflen; + data->req.headerbytecount += (long)k->hbuflen; + + /* reset hbufp pointer && hbuflen */ + k->hbufp = data->state.headerbuff; + k->hbuflen = 0; + } + while(!*stop_reading && *k->str); /* header line within buffer */ + + /* We might have reached the end of the header part here, but + there might be a non-header part left in the end of the read + buffer. */ + + return CURLE_OK; +} + +#endif /* CURL_DISABLE_HTTP */ diff --git a/mobicore/common/curl/lib/http.h b/mobicore/common/curl/lib/http.h new file mode 100644 index 0000000000000000000000000000000000000000..3007c319f7521c45ad0c6da65bdb9f5e0606fd99 --- /dev/null +++ b/mobicore/common/curl/lib/http.h @@ -0,0 +1,161 @@ +#ifndef __HTTP_H +#define __HTTP_H + +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) 1998 - 2010, Daniel Stenberg, , et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at http://curl.haxx.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ***************************************************************************/ +#ifndef CURL_DISABLE_HTTP + +extern const struct Curl_handler Curl_handler_http; + +#ifdef USE_SSL +extern const struct Curl_handler Curl_handler_https; +#endif + +bool Curl_compareheader(const char *headerline, /* line to check */ + const char *header, /* header keyword _with_ colon */ + const char *content); /* content string to find */ + +char *Curl_checkheaders(struct SessionHandle *data, const char *thisheader); + +char *Curl_copy_header_value(const char *h); + + +/* ------------------------------------------------------------------------- */ +/* + * The add_buffer series of functions are used to build one large memory chunk + * from repeated function invokes. Used so that the entire HTTP request can + * be sent in one go. + */ +struct Curl_send_buffer { + char *buffer; + size_t size_max; + size_t size_used; +}; +typedef struct Curl_send_buffer Curl_send_buffer; + +Curl_send_buffer *Curl_add_buffer_init(void); +CURLcode Curl_add_bufferf(Curl_send_buffer *in, const char *fmt, ...); +CURLcode Curl_add_buffer(Curl_send_buffer *in, const void *inptr, size_t size); +CURLcode Curl_add_buffer_send(Curl_send_buffer *in, + struct connectdata *conn, + long *bytes_written, + size_t included_body_bytes, + int socketindex); + +CURLcode Curl_add_timecondition(struct SessionHandle *data, + Curl_send_buffer *buf); +CURLcode Curl_add_custom_headers(struct connectdata *conn, + Curl_send_buffer *req_buffer); + + +/* ftp can use this as well */ +CURLcode Curl_proxyCONNECT(struct connectdata *conn, + int tunnelsocket, + const char *hostname, unsigned short remote_port); + +/* protocol-specific functions set up to be called by the main engine */ +CURLcode Curl_http(struct connectdata *conn, bool *done); +CURLcode Curl_http_done(struct connectdata *, CURLcode, bool premature); +CURLcode Curl_http_connect(struct connectdata *conn, bool *done); + +/* The following functions are defined in http_chunks.c */ +void Curl_httpchunk_init(struct connectdata *conn); +CHUNKcode Curl_httpchunk_read(struct connectdata *conn, char *datap, + ssize_t length, ssize_t *wrote); + +/* These functions are in http.c */ +void Curl_http_auth_stage(struct SessionHandle *data, int stage); +CURLcode Curl_http_input_auth(struct connectdata *conn, + int httpcode, const char *header); +CURLcode Curl_http_auth_act(struct connectdata *conn); +CURLcode Curl_http_perhapsrewind(struct connectdata *conn); + +int Curl_http_should_fail(struct connectdata *conn); + +/* If only the PICKNONE bit is set, there has been a round-trip and we + selected to use no auth at all. Ie, we actively select no auth, as opposed + to not having one selected. The other CURLAUTH_* defines are present in the + public curl/curl.h header. */ +#define CURLAUTH_PICKNONE (1<<30) /* don't use auth */ + +/* MAX_INITIAL_POST_SIZE indicates the number of bytes that will make the POST + data get included in the initial data chunk sent to the server. If the + data is larger than this, it will automatically get split up in multiple + system calls. + + This value used to be fairly big (100K), but we must take into account that + if the server rejects the POST due for authentication reasons, this data + will always be uncondtionally sent and thus it may not be larger than can + always be afforded to send twice. + + It must not be greater than 64K to work on VMS. +*/ +#ifndef MAX_INITIAL_POST_SIZE +#define MAX_INITIAL_POST_SIZE (64*1024) +#endif + +#ifndef TINY_INITIAL_POST_SIZE +#define TINY_INITIAL_POST_SIZE 1024 +#endif + +#endif /* CURL_DISABLE_HTTP */ + +/**************************************************************************** + * HTTP unique setup + ***************************************************************************/ +struct HTTP { + struct FormData *sendit; + curl_off_t postsize; /* off_t to handle large file sizes */ + const char *postdata; + + const char *p_pragma; /* Pragma: string */ + const char *p_accept; /* Accept: string */ + curl_off_t readbytecount; + curl_off_t writebytecount; + + /* For FORM posting */ + struct Form form; + + struct back { + curl_read_callback fread_func; /* backup storage for fread pointer */ + void *fread_in; /* backup storage for fread_in pointer */ + const char *postdata; + curl_off_t postsize; + } backup; + + enum { + HTTPSEND_NADA, /* init */ + HTTPSEND_REQUEST, /* sending a request */ + HTTPSEND_BODY, /* sending body */ + HTTPSEND_LAST /* never use this */ + } sending; + + void *send_buffer; /* used if the request couldn't be sent in one chunk, + points to an allocated send_buffer struct */ +}; + +CURLcode Curl_http_readwrite_headers(struct SessionHandle *data, + struct connectdata *conn, + ssize_t *nread, + bool *stop_reading); + +#endif diff --git a/mobicore/common/curl/lib/http_chunks.c b/mobicore/common/curl/lib/http_chunks.c new file mode 100644 index 0000000000000000000000000000000000000000..56d8248ffb9949914bff481f64f77d99b8b3410e --- /dev/null +++ b/mobicore/common/curl/lib/http_chunks.c @@ -0,0 +1,406 @@ +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) 1998 - 2010, Daniel Stenberg, , et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at http://curl.haxx.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ***************************************************************************/ +#include "setup.h" + +#ifndef CURL_DISABLE_HTTP +/* -- WIN32 approved -- */ +#include +#include +#include +#include +#include + +#include "urldata.h" /* it includes http_chunks.h */ +#include "sendf.h" /* for the client write stuff */ + +#include "content_encoding.h" +#include "http.h" +#include "curl_memory.h" +#include "easyif.h" /* for Curl_convert_to_network prototype */ + +#define _MPRINTF_REPLACE /* use our functions only */ +#include + +/* The last #include file should be: */ +#include "memdebug.h" + +/* + * Chunk format (simplified): + * + * [ chunk extension ] CRLF + * CRLF + * + * Highlights from RFC2616 section 3.6 say: + + The chunked encoding modifies the body of a message in order to + transfer it as a series of chunks, each with its own size indicator, + followed by an OPTIONAL trailer containing entity-header fields. This + allows dynamically produced content to be transferred along with the + information necessary for the recipient to verify that it has + received the full message. + + Chunked-Body = *chunk + last-chunk + trailer + CRLF + + chunk = chunk-size [ chunk-extension ] CRLF + chunk-data CRLF + chunk-size = 1*HEX + last-chunk = 1*("0") [ chunk-extension ] CRLF + + chunk-extension= *( ";" chunk-ext-name [ "=" chunk-ext-val ] ) + chunk-ext-name = token + chunk-ext-val = token | quoted-string + chunk-data = chunk-size(OCTET) + trailer = *(entity-header CRLF) + + The chunk-size field is a string of hex digits indicating the size of + the chunk. The chunked encoding is ended by any chunk whose size is + zero, followed by the trailer, which is terminated by an empty line. + + */ + +/* Check for an ASCII hex digit. + We avoid the use of isxdigit to accommodate non-ASCII hosts. */ +static bool Curl_isxdigit(char digit) +{ + return (bool)( (digit >= 0x30 && digit <= 0x39) /* 0-9 */ + || (digit >= 0x41 && digit <= 0x46) /* A-F */ + || (digit >= 0x61 && digit <= 0x66) ); /* a-f */ +} + +void Curl_httpchunk_init(struct connectdata *conn) +{ + struct Curl_chunker *chunk = &conn->chunk; + chunk->hexindex=0; /* start at 0 */ + chunk->dataleft=0; /* no data left yet! */ + chunk->state = CHUNK_HEX; /* we get hex first! */ +} + +/* + * chunk_read() returns a OK for normal operations, or a positive return code + * for errors. STOP means this sequence of chunks is complete. The 'wrote' + * argument is set to tell the caller how many bytes we actually passed to the + * client (for byte-counting and whatever). + * + * The states and the state-machine is further explained in the header file. + * + * This function always uses ASCII hex values to accommodate non-ASCII hosts. + * For example, 0x0d and 0x0a are used instead of '\r' and '\n'. + */ +CHUNKcode Curl_httpchunk_read(struct connectdata *conn, + char *datap, + ssize_t datalen, + ssize_t *wrotep) +{ + CURLcode result=CURLE_OK; + struct SessionHandle *data = conn->data; + struct Curl_chunker *ch = &conn->chunk; + struct SingleRequest *k = &data->req; + size_t piece; + size_t length = (size_t)datalen; + size_t *wrote = (size_t *)wrotep; + + *wrote = 0; /* nothing's written yet */ + + /* the original data is written to the client, but we go on with the + chunk read process, to properly calculate the content length*/ + if(data->set.http_te_skip && !k->ignorebody) { + result = Curl_client_write(conn, CLIENTWRITE_BODY, datap, datalen); + if(result) + return CHUNKE_WRITE_ERROR; + } + + while(length) { + switch(ch->state) { + case CHUNK_HEX: + if(Curl_isxdigit(*datap)) { + if(ch->hexindex < MAXNUM_SIZE) { + ch->hexbuffer[ch->hexindex] = *datap; + datap++; + length--; + ch->hexindex++; + } + else { + return CHUNKE_TOO_LONG_HEX; /* longer hex than we support */ + } + } + else { + if(0 == ch->hexindex) { + /* This is illegal data, we received junk where we expected + a hexadecimal digit. */ + return CHUNKE_ILLEGAL_HEX; + } + /* length and datap are unmodified */ + ch->hexbuffer[ch->hexindex]=0; +#ifdef CURL_DOES_CONVERSIONS + /* convert to host encoding before calling strtoul */ + result = Curl_convert_from_network(conn->data, + ch->hexbuffer, + ch->hexindex); + if(result != CURLE_OK) { + /* Curl_convert_from_network calls failf if unsuccessful */ + /* Treat it as a bad hex character */ + return(CHUNKE_ILLEGAL_HEX); + } +#endif /* CURL_DOES_CONVERSIONS */ + ch->datasize=strtoul(ch->hexbuffer, NULL, 16); + ch->state = CHUNK_POSTHEX; + } + break; + + case CHUNK_POSTHEX: + /* In this state, we're waiting for CRLF to arrive. We support + this to allow so called chunk-extensions to show up here + before the CRLF comes. */ + if(*datap == 0x0d) + ch->state = CHUNK_CR; + length--; + datap++; + break; + + case CHUNK_CR: + /* waiting for the LF */ + if(*datap == 0x0a) { + /* we're now expecting data to come, unless size was zero! */ + if(0 == ch->datasize) { + ch->state = CHUNK_TRAILER; /* now check for trailers */ + conn->trlPos=0; + } + else { + ch->state = CHUNK_DATA; + } + } + else + /* previously we got a fake CR, go back to CR waiting! */ + ch->state = CHUNK_CR; + datap++; + length--; + break; + + case CHUNK_DATA: + /* we get pure and fine data + + We expect another 'datasize' of data. We have 'length' right now, + it can be more or less than 'datasize'. Get the smallest piece. + */ + piece = (ch->datasize >= length)?length:ch->datasize; + + /* Write the data portion available */ +#ifdef HAVE_LIBZ + switch (conn->data->set.http_ce_skip? + IDENTITY : data->req.content_encoding) { + case IDENTITY: +#endif + if(!k->ignorebody) { + if( !data->set.http_te_skip ) + result = Curl_client_write(conn, CLIENTWRITE_BODY, datap, + piece); + else + result = CURLE_OK; + } +#ifdef HAVE_LIBZ + break; + + case DEFLATE: + /* update data->req.keep.str to point to the chunk data. */ + data->req.str = datap; + result = Curl_unencode_deflate_write(conn, &data->req, + (ssize_t)piece); + break; + + case GZIP: + /* update data->req.keep.str to point to the chunk data. */ + data->req.str = datap; + result = Curl_unencode_gzip_write(conn, &data->req, + (ssize_t)piece); + break; + + case COMPRESS: + default: + failf (conn->data, + "Unrecognized content encoding type. " + "libcurl understands `identity', `deflate' and `gzip' " + "content encodings."); + return CHUNKE_BAD_ENCODING; + } +#endif + + if(result) + return CHUNKE_WRITE_ERROR; + + *wrote += piece; + + ch->datasize -= piece; /* decrease amount left to expect */ + datap += piece; /* move read pointer forward */ + length -= piece; /* decrease space left in this round */ + + if(0 == ch->datasize) + /* end of data this round, we now expect a trailing CRLF */ + ch->state = CHUNK_POSTCR; + break; + + case CHUNK_POSTCR: + if(*datap == 0x0d) { + ch->state = CHUNK_POSTLF; + datap++; + length--; + } + else + return CHUNKE_BAD_CHUNK; + + break; + + case CHUNK_POSTLF: + if(*datap == 0x0a) { + /* + * The last one before we go back to hex state and start all + * over. + */ + Curl_httpchunk_init(conn); + datap++; + length--; + } + else + return CHUNKE_BAD_CHUNK; + + break; + + case CHUNK_TRAILER: + if(*datap == 0x0d) { + /* this is the end of a trailer, but if the trailer was zero bytes + there was no trailer and we move on */ + + if(conn->trlPos) { + /* we allocate trailer with 3 bytes extra room to fit this */ + conn->trailer[conn->trlPos++]=0x0d; + conn->trailer[conn->trlPos++]=0x0a; + conn->trailer[conn->trlPos]=0; + +#ifdef CURL_DOES_CONVERSIONS + /* Convert to host encoding before calling Curl_client_write */ + result = Curl_convert_from_network(conn->data, + conn->trailer, + conn->trlPos); + if(result != CURLE_OK) + /* Curl_convert_from_network calls failf if unsuccessful */ + /* Treat it as a bad chunk */ + return CHUNKE_BAD_CHUNK; + +#endif /* CURL_DOES_CONVERSIONS */ + if(!data->set.http_te_skip) { + result = Curl_client_write(conn, CLIENTWRITE_HEADER, + conn->trailer, conn->trlPos); + if(result) + return CHUNKE_WRITE_ERROR; + } + conn->trlPos=0; + ch->state = CHUNK_TRAILER_CR; + } + else { + /* no trailer, we're on the final CRLF pair */ + ch->state = CHUNK_TRAILER_POSTCR; + break; /* don't advance the pointer */ + } + } + else { + /* conn->trailer is assumed to be freed in url.c on a + connection basis */ + if(conn->trlPos >= conn->trlMax) { + /* we always allocate three extra bytes, just because when the full + header has been received we append CRLF\0 */ + char *ptr; + if(conn->trlMax) { + conn->trlMax *= 2; + ptr = realloc(conn->trailer, conn->trlMax + 3); + } + else { + conn->trlMax=128; + ptr = malloc(conn->trlMax + 3); + } + if(!ptr) + return CHUNKE_OUT_OF_MEMORY; + conn->trailer = ptr; + } + conn->trailer[conn->trlPos++]=*datap; + } + datap++; + length--; + break; + + case CHUNK_TRAILER_CR: + if(*datap == 0x0a) { + ch->state = CHUNK_TRAILER_POSTCR; + datap++; + length--; + } + else + return CHUNKE_BAD_CHUNK; + break; + + case CHUNK_TRAILER_POSTCR: + /* We enter this state when a CR should arrive so we expect to + have to first pass a CR before we wait for LF */ + if(*datap != 0x0d) { + /* not a CR then it must be another header in the trailer */ + ch->state = CHUNK_TRAILER; + break; + } + datap++; + length--; + /* now wait for the final LF */ + ch->state = CHUNK_STOP; + break; + + case CHUNK_STOPCR: + /* Read the final CRLF that ends all chunk bodies */ + + if(*datap == 0x0d) { + ch->state = CHUNK_STOP; + datap++; + length--; + } + else + return CHUNKE_BAD_CHUNK; + break; + + case CHUNK_STOP: + if(*datap == 0x0a) { + length--; + + /* Record the length of any data left in the end of the buffer + even if there's no more chunks to read */ + + ch->dataleft = length; + return CHUNKE_STOP; /* return stop */ + } + else + return CHUNKE_BAD_CHUNK; + + default: + return CHUNKE_STATE_ERROR; + } + } + return CHUNKE_OK; +} +#endif /* CURL_DISABLE_HTTP */ diff --git a/mobicore/common/curl/lib/http_chunks.h b/mobicore/common/curl/lib/http_chunks.h new file mode 100644 index 0000000000000000000000000000000000000000..6056e188c9c18b313f28300848eace0c465108a5 --- /dev/null +++ b/mobicore/common/curl/lib/http_chunks.h @@ -0,0 +1,107 @@ +#ifndef __HTTP_CHUNKS_H +#define __HTTP_CHUNKS_H +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) 1998 - 2007, Daniel Stenberg, , et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at http://curl.haxx.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ***************************************************************************/ +/* + * The longest possible hexadecimal number we support in a chunked transfer. + * Weird enough, RFC2616 doesn't set a maximum size! Since we use strtoul() + * to convert it, we "only" support 2^32 bytes chunk data. + */ +#define MAXNUM_SIZE 16 + +typedef enum { + CHUNK_FIRST, /* never use */ + + /* In this we await and buffer all hexadecimal digits until we get one + that isn't a hexadecimal digit. When done, we go POSTHEX */ + CHUNK_HEX, + + /* We have received the hexadecimal digit and we eat all characters until + we get a CRLF pair. When we see a CR we go to the CR state. */ + CHUNK_POSTHEX, + + /* A single CR has been found and we should get a LF right away in this + state or we go back to POSTHEX. When LF is received, we go to DATA. + If the size given was zero, we set state to STOP and return. */ + CHUNK_CR, + + /* We eat the amount of data specified. When done, we move on to the + POST_CR state. */ + CHUNK_DATA, + + /* POSTCR should get a CR and nothing else, then move to POSTLF */ + CHUNK_POSTCR, + + /* POSTLF should get a LF and nothing else, then move back to HEX as the + CRLF combination marks the end of a chunk */ + CHUNK_POSTLF, + + /* Each Chunk body should end with a CRLF. Read a CR and nothing else, + then move to CHUNK_STOP */ + CHUNK_STOPCR, + + /* This is mainly used to really mark that we're out of the game. + NOTE: that there's a 'dataleft' field in the struct that will tell how + many bytes that were not passed to the client in the end of the last + buffer! */ + CHUNK_STOP, + + /* At this point optional trailer headers can be found, unless the next line + is CRLF */ + CHUNK_TRAILER, + + /* A trailer CR has been found - next state is CHUNK_TRAILER_POSTCR. + Next char must be a LF */ + CHUNK_TRAILER_CR, + + /* A trailer LF must be found now, otherwise CHUNKE_BAD_CHUNK will be + signalled If this is an empty trailer CHUNKE_STOP will be signalled. + Otherwise the trailer will be broadcasted via Curl_client_write() and the + next state will be CHUNK_TRAILER */ + CHUNK_TRAILER_POSTCR, + + CHUNK_LAST /* never use */ + +} ChunkyState; + +typedef enum { + CHUNKE_STOP = -1, + CHUNKE_OK = 0, + CHUNKE_TOO_LONG_HEX = 1, + CHUNKE_ILLEGAL_HEX, + CHUNKE_BAD_CHUNK, + CHUNKE_WRITE_ERROR, + CHUNKE_STATE_ERROR, + CHUNKE_BAD_ENCODING, + CHUNKE_OUT_OF_MEMORY, + CHUNKE_LAST +} CHUNKcode; + +struct Curl_chunker { + char hexbuffer[ MAXNUM_SIZE + 1]; + int hexindex; + ChunkyState state; + size_t datasize; + size_t dataleft; /* untouched data amount at the end of the last buffer */ +}; + +#endif diff --git a/mobicore/common/curl/lib/http_digest.c b/mobicore/common/curl/lib/http_digest.c new file mode 100644 index 0000000000000000000000000000000000000000..45d8aeba8e68f267ed7a639ca2991e613edde1c0 --- /dev/null +++ b/mobicore/common/curl/lib/http_digest.c @@ -0,0 +1,584 @@ +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) 1998 - 2010, Daniel Stenberg, , et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at http://curl.haxx.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ***************************************************************************/ +#include "setup.h" + +#if !defined(CURL_DISABLE_HTTP) && !defined(CURL_DISABLE_CRYPTO_AUTH) +/* -- WIN32 approved -- */ +#include +#include +#include +#include +#include + +#include "urldata.h" +#include "sendf.h" +#include "rawstr.h" +#include "curl_base64.h" +#include "curl_md5.h" +#include "http_digest.h" +#include "strtok.h" +#include "url.h" /* for Curl_safefree() */ +#include "curl_memory.h" +#include "easyif.h" /* included for Curl_convert_... prototypes */ + +#define _MPRINTF_REPLACE /* use our functions only */ +#include + +/* The last #include file should be: */ +#include "memdebug.h" + +#define MAX_VALUE_LENGTH 256 +#define MAX_CONTENT_LENGTH 1024 + +/* + * Return 0 on success and then the buffers are filled in fine. + * + * Non-zero means failure to parse. + */ +static int get_pair(const char *str, char *value, char *content, + const char **endptr) +{ + int c; + bool starts_with_quote = FALSE; + bool escape = FALSE; + + for(c=MAX_VALUE_LENGTH-1; (*str && (*str != '=') && c--); ) + *value++ = *str++; + *value=0; + + if('=' != *str++) + /* eek, no match */ + return 1; + + if('\"' == *str) { + /* this starts with a quote so it must end with one as well! */ + str++; + starts_with_quote = TRUE; + } + + for(c=MAX_CONTENT_LENGTH-1; *str && c--; str++) { + switch(*str) { + case '\\': + if(!escape) { + /* possibly the start of an escaped quote */ + escape = TRUE; + *content++ = '\\'; /* even though this is an escape character, we still + store it as-is in the target buffer */ + continue; + } + break; + case ',': + if(!starts_with_quote) { + /* this signals the end of the content if we didn't get a starting quote + and then we do "sloppy" parsing */ + c=0; /* the end */ + continue; + } + break; + case '\r': + case '\n': + /* end of string */ + c=0; + continue; + case '\"': + if(!escape && starts_with_quote) { + /* end of string */ + c=0; + continue; + } + break; + } + escape = FALSE; + *content++ = *str; + } + *content=0; + + *endptr = str; + + return 0; /* all is fine! */ +} + +/* Test example headers: + +WWW-Authenticate: Digest realm="testrealm", nonce="1053604598" +Proxy-Authenticate: Digest realm="testrealm", nonce="1053604598" + +*/ + +CURLdigest Curl_input_digest(struct connectdata *conn, + bool proxy, + const char *header) /* rest of the *-authenticate: + header */ +{ + char *token = NULL; + char *tmp = NULL; + bool foundAuth = FALSE; + bool foundAuthInt = FALSE; + struct SessionHandle *data=conn->data; + bool before = FALSE; /* got a nonce before */ + struct digestdata *d; + + if(proxy) { + d = &data->state.proxydigest; + } + else { + d = &data->state.digest; + } + + /* skip initial whitespaces */ + while(*header && ISSPACE(*header)) + header++; + + if(checkprefix("Digest", header)) { + header += strlen("Digest"); + + /* If we already have received a nonce, keep that in mind */ + if(d->nonce) + before = TRUE; + + /* clear off any former leftovers and init to defaults */ + Curl_digest_cleanup_one(d); + + for(;;) { + char value[MAX_VALUE_LENGTH]; + char content[MAX_CONTENT_LENGTH]; + + while(*header && ISSPACE(*header)) + header++; + + /* extract a value=content pair */ + if(!get_pair(header, value, content, &header)) { + if(Curl_raw_equal(value, "nonce")) { + d->nonce = strdup(content); + if(!d->nonce) + return CURLDIGEST_NOMEM; + } + else if(Curl_raw_equal(value, "stale")) { + if(Curl_raw_equal(content, "true")) { + d->stale = TRUE; + d->nc = 1; /* we make a new nonce now */ + } + } + else if(Curl_raw_equal(value, "realm")) { + d->realm = strdup(content); + if(!d->realm) + return CURLDIGEST_NOMEM; + } + else if(Curl_raw_equal(value, "opaque")) { + d->opaque = strdup(content); + if(!d->opaque) + return CURLDIGEST_NOMEM; + } + else if(Curl_raw_equal(value, "qop")) { + char *tok_buf; + /* tokenize the list and choose auth if possible, use a temporary + clone of the buffer since strtok_r() ruins it */ + tmp = strdup(content); + if(!tmp) + return CURLDIGEST_NOMEM; + token = strtok_r(tmp, ",", &tok_buf); + while(token != NULL) { + if(Curl_raw_equal(token, "auth")) { + foundAuth = TRUE; + } + else if(Curl_raw_equal(token, "auth-int")) { + foundAuthInt = TRUE; + } + token = strtok_r(NULL, ",", &tok_buf); + } + free(tmp); + /*select only auth o auth-int. Otherwise, ignore*/ + if(foundAuth) { + d->qop = strdup("auth"); + if(!d->qop) + return CURLDIGEST_NOMEM; + } + else if(foundAuthInt) { + d->qop = strdup("auth-int"); + if(!d->qop) + return CURLDIGEST_NOMEM; + } + } + else if(Curl_raw_equal(value, "algorithm")) { + d->algorithm = strdup(content); + if(!d->algorithm) + return CURLDIGEST_NOMEM; + if(Curl_raw_equal(content, "MD5-sess")) + d->algo = CURLDIGESTALGO_MD5SESS; + else if(Curl_raw_equal(content, "MD5")) + d->algo = CURLDIGESTALGO_MD5; + else + return CURLDIGEST_BADALGO; + } + else { + /* unknown specifier, ignore it! */ + } + } + else + break; /* we're done here */ + + /* pass all additional spaces here */ + while(*header && ISSPACE(*header)) + header++; + if(',' == *header) + /* allow the list to be comma-separated */ + header++; + } + /* We had a nonce since before, and we got another one now without + 'stale=true'. This means we provided bad credentials in the previous + request */ + if(before && !d->stale) + return CURLDIGEST_BAD; + + /* We got this header without a nonce, that's a bad Digest line! */ + if(!d->nonce) + return CURLDIGEST_BAD; + } + else + /* else not a digest, get out */ + return CURLDIGEST_NONE; + + return CURLDIGEST_FINE; +} + +/* convert md5 chunk to RFC2617 (section 3.1.3) -suitable ascii string*/ +static void md5_to_ascii(unsigned char *source, /* 16 bytes */ + unsigned char *dest) /* 33 bytes */ +{ + int i; + for(i=0; i<16; i++) + snprintf((char *)&dest[i*2], 3, "%02x", source[i]); +} + +CURLcode Curl_output_digest(struct connectdata *conn, + bool proxy, + const unsigned char *request, + const unsigned char *uripath) +{ + /* We have a Digest setup for this, use it! Now, to get all the details for + this sorted out, I must urge you dear friend to read up on the RFC2617 + section 3.2.2, */ + unsigned char md5buf[16]; /* 16 bytes/128 bits */ + unsigned char request_digest[33]; + unsigned char *md5this; + unsigned char *ha1; + unsigned char ha2[33];/* 32 digits and 1 zero byte */ + char cnoncebuf[7]; + char *cnonce; + char *tmp = NULL; + struct timeval now; + + char **allocuserpwd; + const char *userp; + const char *passwdp; + struct auth *authp; + + struct SessionHandle *data = conn->data; + struct digestdata *d; +#ifdef CURL_DOES_CONVERSIONS + CURLcode rc; +/* The CURL_OUTPUT_DIGEST_CONV macro below is for non-ASCII machines. + It converts digest text to ASCII so the MD5 will be correct for + what ultimately goes over the network. +*/ +#define CURL_OUTPUT_DIGEST_CONV(a, b) \ + rc = Curl_convert_to_network(a, (char *)b, strlen((const char*)b)); \ + if(rc != CURLE_OK) { \ + free(b); \ + return rc; \ + } +#else +#define CURL_OUTPUT_DIGEST_CONV(a, b) +#endif /* CURL_DOES_CONVERSIONS */ + + if(proxy) { + d = &data->state.proxydigest; + allocuserpwd = &conn->allocptr.proxyuserpwd; + userp = conn->proxyuser; + passwdp = conn->proxypasswd; + authp = &data->state.authproxy; + } + else { + d = &data->state.digest; + allocuserpwd = &conn->allocptr.userpwd; + userp = conn->user; + passwdp = conn->passwd; + authp = &data->state.authhost; + } + + if(*allocuserpwd) { + Curl_safefree(*allocuserpwd); + *allocuserpwd = NULL; + } + + /* not set means empty */ + if(!userp) + userp=""; + + if(!passwdp) + passwdp=""; + + if(!d->nonce) { + authp->done = FALSE; + return CURLE_OK; + } + authp->done = TRUE; + + if(!d->nc) + d->nc = 1; + + if(!d->cnonce) { + /* Generate a cnonce */ + now = Curl_tvnow(); + snprintf(cnoncebuf, sizeof(cnoncebuf), "%06ld", (long)now.tv_sec); + if(Curl_base64_encode(data, cnoncebuf, strlen(cnoncebuf), &cnonce)) + d->cnonce = cnonce; + else + return CURLE_OUT_OF_MEMORY; + } + + /* + if the algorithm is "MD5" or unspecified (which then defaults to MD5): + + A1 = unq(username-value) ":" unq(realm-value) ":" passwd + + if the algorithm is "MD5-sess" then: + + A1 = H( unq(username-value) ":" unq(realm-value) ":" passwd ) + ":" unq(nonce-value) ":" unq(cnonce-value) + */ + + md5this = (unsigned char *) + aprintf("%s:%s:%s", userp, d->realm, passwdp); + if(!md5this) + return CURLE_OUT_OF_MEMORY; + + CURL_OUTPUT_DIGEST_CONV(data, md5this); /* convert on non-ASCII machines */ + Curl_md5it(md5buf, md5this); + free(md5this); /* free this again */ + + ha1 = malloc(33); /* 32 digits and 1 zero byte */ + if(!ha1) + return CURLE_OUT_OF_MEMORY; + + md5_to_ascii(md5buf, ha1); + + if(d->algo == CURLDIGESTALGO_MD5SESS) { + /* nonce and cnonce are OUTSIDE the hash */ + tmp = aprintf("%s:%s:%s", ha1, d->nonce, d->cnonce); + if(!tmp) + return CURLE_OUT_OF_MEMORY; + CURL_OUTPUT_DIGEST_CONV(data, tmp); /* convert on non-ASCII machines */ + Curl_md5it(md5buf, (unsigned char *)tmp); + free(tmp); /* free this again */ + md5_to_ascii(md5buf, ha1); + } + + /* + If the "qop" directive's value is "auth" or is unspecified, then A2 is: + + A2 = Method ":" digest-uri-value + + If the "qop" value is "auth-int", then A2 is: + + A2 = Method ":" digest-uri-value ":" H(entity-body) + + (The "Method" value is the HTTP request method as specified in section + 5.1.1 of RFC 2616) + */ + + /* So IE browsers < v7 cut off the URI part at the query part when they + evaluate the MD5 and some (IIS?) servers work with them so we may need to + do the Digest IE-style. Note that the different ways cause different MD5 + sums to get sent. + + Apache servers can be set to do the Digest IE-style automatically using + the BrowserMatch feature: + http://httpd.apache.org/docs/2.2/mod/mod_auth_digest.html#msie + + Further details on Digest implementation differences: + http://www.fngtps.com/2006/09/http-authentication + */ + if(authp->iestyle && ((tmp = strchr((char *)uripath, '?')) != NULL)) { + md5this = (unsigned char *)aprintf("%s:%.*s", request, + (int)(tmp - (char *)uripath), uripath); + } + else + md5this = (unsigned char *)aprintf("%s:%s", request, uripath); + + if(!md5this) { + free(ha1); + return CURLE_OUT_OF_MEMORY; + } + + if(d->qop && Curl_raw_equal(d->qop, "auth-int")) { + /* We don't support auth-int at the moment. I can't see a easy way to get + entity-body here */ + /* TODO: Append H(entity-body)*/ + } + CURL_OUTPUT_DIGEST_CONV(data, md5this); /* convert on non-ASCII machines */ + Curl_md5it(md5buf, md5this); + free(md5this); /* free this again */ + md5_to_ascii(md5buf, ha2); + + if(d->qop) { + md5this = (unsigned char *)aprintf("%s:%s:%08x:%s:%s:%s", + ha1, + d->nonce, + d->nc, + d->cnonce, + d->qop, + ha2); + } + else { + md5this = (unsigned char *)aprintf("%s:%s:%s", + ha1, + d->nonce, + ha2); + } + free(ha1); + if(!md5this) + return CURLE_OUT_OF_MEMORY; + + CURL_OUTPUT_DIGEST_CONV(data, md5this); /* convert on non-ASCII machines */ + Curl_md5it(md5buf, md5this); + free(md5this); /* free this again */ + md5_to_ascii(md5buf, request_digest); + + /* for test case 64 (snooped from a Mozilla 1.3a request) + + Authorization: Digest username="testuser", realm="testrealm", \ + nonce="1053604145", uri="/64", response="c55f7f30d83d774a3d2dcacf725abaca" + */ + + if(d->qop) { + *allocuserpwd = + aprintf( "%sAuthorization: Digest " + "username=\"%s\", " + "realm=\"%s\", " + "nonce=\"%s\", " + "uri=\"%s\", " + "cnonce=\"%s\", " + "nc=%08x, " + "qop=\"%s\", " + "response=\"%s\"", + proxy?"Proxy-":"", + userp, + d->realm, + d->nonce, + uripath, /* this is the PATH part of the URL */ + d->cnonce, + d->nc, + d->qop, + request_digest); + + if(Curl_raw_equal(d->qop, "auth")) + d->nc++; /* The nc (from RFC) has to be a 8 hex digit number 0 padded + which tells to the server how many times you are using the + same nonce in the qop=auth mode. */ + } + else { + *allocuserpwd = + aprintf( "%sAuthorization: Digest " + "username=\"%s\", " + "realm=\"%s\", " + "nonce=\"%s\", " + "uri=\"%s\", " + "response=\"%s\"", + proxy?"Proxy-":"", + userp, + d->realm, + d->nonce, + uripath, /* this is the PATH part of the URL */ + request_digest); + } + if(!*allocuserpwd) + return CURLE_OUT_OF_MEMORY; + + /* Add optional fields */ + if(d->opaque) { + /* append opaque */ + tmp = aprintf("%s, opaque=\"%s\"", *allocuserpwd, d->opaque); + if(!tmp) + return CURLE_OUT_OF_MEMORY; + free(*allocuserpwd); + *allocuserpwd = tmp; + } + + if(d->algorithm) { + /* append algorithm */ + tmp = aprintf("%s, algorithm=\"%s\"", *allocuserpwd, d->algorithm); + if(!tmp) + return CURLE_OUT_OF_MEMORY; + free(*allocuserpwd); + *allocuserpwd = tmp; + } + + /* append CRLF + zero (3 bytes) to the userpwd header */ + tmp = realloc(*allocuserpwd, strlen(*allocuserpwd) + 3); + if(!tmp) + return CURLE_OUT_OF_MEMORY; + strcat(tmp, "\r\n"); + *allocuserpwd = tmp; + + return CURLE_OK; +} + +void Curl_digest_cleanup_one(struct digestdata *d) +{ + if(d->nonce) + free(d->nonce); + d->nonce = NULL; + + if(d->cnonce) + free(d->cnonce); + d->cnonce = NULL; + + if(d->realm) + free(d->realm); + d->realm = NULL; + + if(d->opaque) + free(d->opaque); + d->opaque = NULL; + + if(d->qop) + free(d->qop); + d->qop = NULL; + + if(d->algorithm) + free(d->algorithm); + d->algorithm = NULL; + + d->nc = 0; + d->algo = CURLDIGESTALGO_MD5; /* default algorithm */ + d->stale = FALSE; /* default means normal, not stale */ +} + + +void Curl_digest_cleanup(struct SessionHandle *data) +{ + Curl_digest_cleanup_one(&data->state.digest); + Curl_digest_cleanup_one(&data->state.proxydigest); +} + +#endif diff --git a/mobicore/common/curl/lib/http_digest.h b/mobicore/common/curl/lib/http_digest.h new file mode 100644 index 0000000000000000000000000000000000000000..8c96378d62426075528197db2ca97d26a76028e9 --- /dev/null +++ b/mobicore/common/curl/lib/http_digest.h @@ -0,0 +1,57 @@ +#ifndef __HTTP_DIGEST_H +#define __HTTP_DIGEST_H +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) 1998 - 2006, Daniel Stenberg, , et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at http://curl.haxx.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ***************************************************************************/ + +typedef enum { + CURLDIGEST_NONE, /* not a digest */ + CURLDIGEST_BAD, /* a digest, but one we don't like */ + CURLDIGEST_BADALGO, /* unsupported algorithm requested */ + CURLDIGEST_NOMEM, + CURLDIGEST_FINE, /* a digest we act on */ + + CURLDIGEST_LAST /* last entry in this enum, don't use */ +} CURLdigest; + +enum { + CURLDIGESTALGO_MD5, + CURLDIGESTALGO_MD5SESS +}; + +/* this is for digest header input */ +CURLdigest Curl_input_digest(struct connectdata *conn, + bool proxy, const char *header); + +/* this is for creating digest header output */ +CURLcode Curl_output_digest(struct connectdata *conn, + bool proxy, + const unsigned char *request, + const unsigned char *uripath); +void Curl_digest_cleanup_one(struct digestdata *dig); + +#if !defined(CURL_DISABLE_HTTP) && !defined(CURL_DISABLE_CRYPTO_AUTH) +void Curl_digest_cleanup(struct SessionHandle *data); +#else +#define Curl_digest_cleanup(x) do {} while(0) +#endif + +#endif diff --git a/mobicore/common/curl/lib/http_negotiate.c b/mobicore/common/curl/lib/http_negotiate.c new file mode 100644 index 0000000000000000000000000000000000000000..80b0b507d43efb5f87f9a37c16b7675744f29581 --- /dev/null +++ b/mobicore/common/curl/lib/http_negotiate.c @@ -0,0 +1,369 @@ +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) 1998 - 2010, Daniel Stenberg, , et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at http://curl.haxx.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ***************************************************************************/ +#include "setup.h" + +#ifdef HAVE_GSSAPI +#ifdef HAVE_OLD_GSSMIT +#define GSS_C_NT_HOSTBASED_SERVICE gss_nt_service_name +#endif + +#ifndef CURL_DISABLE_HTTP + /* -- WIN32 approved -- */ +#include +#include +#include +#include +#include + +#include "urldata.h" +#include "sendf.h" +#include "rawstr.h" +#include "curl_base64.h" +#include "http_negotiate.h" +#include "curl_memory.h" + +#ifdef HAVE_SPNEGO +# include +# ifdef USE_SSLEAY +# ifdef USE_OPENSSL +# include +# else +# include +# endif +# else +# error "Can't compile SPNEGO support without OpenSSL." +# endif +#endif + +#define _MPRINTF_REPLACE /* use our functions only */ +#include + +/* The last #include file should be: */ +#include "memdebug.h" + +static int +get_gss_name(struct connectdata *conn, bool proxy, gss_name_t *server) +{ + struct negotiatedata *neg_ctx = proxy?&conn->data->state.proxyneg: + &conn->data->state.negotiate; + OM_uint32 major_status, minor_status; + gss_buffer_desc token = GSS_C_EMPTY_BUFFER; + char name[2048]; + const char* service; + + /* GSSAPI implementation by Globus (known as GSI) requires the name to be + of form "/" instead of @ (ie. slash instead + of at-sign). Also GSI servers are often identified as 'host' not 'khttp'. + Change following lines if you want to use GSI */ + + /* IIS uses the @ form but uses 'http' as the service name */ + + if(neg_ctx->gss) + service = "KHTTP"; + else + service = "HTTP"; + + token.length = strlen(service) + 1 + strlen(proxy ? conn->proxy.name : + conn->host.name) + 1; + if(token.length + 1 > sizeof(name)) + return EMSGSIZE; + + snprintf(name, sizeof(name), "%s@%s", service, proxy ? conn->proxy.name : + conn->host.name); + + token.value = (void *) name; + major_status = gss_import_name(&minor_status, + &token, + GSS_C_NT_HOSTBASED_SERVICE, + server); + + return GSS_ERROR(major_status) ? -1 : 0; +} + +static void +log_gss_error(struct connectdata *conn, OM_uint32 error_status, const char *prefix) +{ + OM_uint32 maj_stat, min_stat; + OM_uint32 msg_ctx = 0; + gss_buffer_desc status_string; + char buf[1024]; + size_t len; + + snprintf(buf, sizeof(buf), "%s", prefix); + len = strlen(buf); + do { + maj_stat = gss_display_status(&min_stat, + error_status, + GSS_C_MECH_CODE, + GSS_C_NO_OID, + &msg_ctx, + &status_string); + if(sizeof(buf) > len + status_string.length + 1) { + snprintf(buf + len, sizeof(buf) - len, + ": %s", (char*) status_string.value); + len += status_string.length; + } + gss_release_buffer(&min_stat, &status_string); + } while(!GSS_ERROR(maj_stat) && msg_ctx != 0); + + infof(conn->data, "%s", buf); +} + +/* returning zero (0) means success, everything else is treated as "failure" + with no care exactly what the failure was */ +int Curl_input_negotiate(struct connectdata *conn, bool proxy, + const char *header) +{ + struct negotiatedata *neg_ctx = proxy?&conn->data->state.proxyneg: + &conn->data->state.negotiate; + OM_uint32 major_status, minor_status, minor_status2; + gss_buffer_desc input_token = GSS_C_EMPTY_BUFFER; + gss_buffer_desc output_token = GSS_C_EMPTY_BUFFER; + int ret; + size_t len, rawlen; + bool gss; + const char* protocol; + + while(*header && ISSPACE(*header)) + header++; + if(checkprefix("GSS-Negotiate", header)) { + protocol = "GSS-Negotiate"; + gss = TRUE; + } + else if(checkprefix("Negotiate", header)) { + protocol = "Negotiate"; + gss = FALSE; + } + else + return -1; + + if(neg_ctx->context) { + if(neg_ctx->gss != gss) { + return -1; + } + } + else { + neg_ctx->protocol = protocol; + neg_ctx->gss = gss; + } + + if(neg_ctx->context && neg_ctx->status == GSS_S_COMPLETE) { + /* We finished succesfully our part of authentication, but server + * rejected it (since we're again here). Exit with an error since we + * can't invent anything better */ + Curl_cleanup_negotiate(conn->data); + return -1; + } + + if(neg_ctx->server_name == NULL && + (ret = get_gss_name(conn, proxy, &neg_ctx->server_name))) + return ret; + + header += strlen(neg_ctx->protocol); + while(*header && ISSPACE(*header)) + header++; + + len = strlen(header); + if(len > 0) { + rawlen = Curl_base64_decode(header, + (unsigned char **)&input_token.value); + if(rawlen == 0) + return -1; + input_token.length = rawlen; + +#ifdef HAVE_SPNEGO /* Handle SPNEGO */ + if(checkprefix("Negotiate", header)) { + ASN1_OBJECT * object = NULL; + int rc = 1; + unsigned char * spnegoToken = NULL; + size_t spnegoTokenLength = 0; + unsigned char * mechToken = NULL; + size_t mechTokenLength = 0; + + if(input_token.value == NULL) + return CURLE_OUT_OF_MEMORY; + + spnegoToken = malloc(input_token.length); + if(spnegoToken == NULL) + return CURLE_OUT_OF_MEMORY; + + spnegoTokenLength = input_token.length; + + object = OBJ_txt2obj ("1.2.840.113554.1.2.2", 1); + if(!parseSpnegoTargetToken(spnegoToken, + spnegoTokenLength, + NULL, + NULL, + &mechToken, + &mechTokenLength, + NULL, + NULL)) { + free(spnegoToken); + spnegoToken = NULL; + infof(conn->data, "Parse SPNEGO Target Token failed\n"); + } + else { + free(input_token.value); + input_token.value = malloc(mechTokenLength); + if (input_token.value == NULL) + return CURLE_OUT_OF_MEMORY; + + memcpy(input_token.value, mechToken,mechTokenLength); + input_token.length = mechTokenLength; + free(mechToken); + mechToken = NULL; + infof(conn->data, "Parse SPNEGO Target Token succeeded\n"); + } + } +#endif + } + + major_status = gss_init_sec_context(&minor_status, + GSS_C_NO_CREDENTIAL, + &neg_ctx->context, + neg_ctx->server_name, + GSS_C_NO_OID, + GSS_C_DELEG_FLAG, + 0, + GSS_C_NO_CHANNEL_BINDINGS, + &input_token, + NULL, + &output_token, + NULL, + NULL); + if(input_token.length > 0) + gss_release_buffer(&minor_status2, &input_token); + neg_ctx->status = major_status; + if(GSS_ERROR(major_status)) { + /* Curl_cleanup_negotiate(conn->data) ??? */ + log_gss_error(conn, minor_status, + "gss_init_sec_context() failed: "); + return -1; + } + + if(output_token.length == 0) { + return -1; + } + + neg_ctx->output_token = output_token; + /* conn->bits.close = FALSE; */ + + return 0; +} + + +CURLcode Curl_output_negotiate(struct connectdata *conn, bool proxy) +{ + struct negotiatedata *neg_ctx = proxy?&conn->data->state.proxyneg: + &conn->data->state.negotiate; + char *encoded = NULL; + size_t len; + char *userp; + +#ifdef HAVE_SPNEGO /* Handle SPNEGO */ + if(checkprefix("Negotiate", neg_ctx->protocol)) { + ASN1_OBJECT * object = NULL; + int rc = 1; + unsigned char * spnegoToken = NULL; + size_t spnegoTokenLength = 0; + unsigned char * responseToken = NULL; + size_t responseTokenLength = 0; + + responseToken = malloc(neg_ctx->output_token.length); + if( responseToken == NULL) + return CURLE_OUT_OF_MEMORY; + memcpy(responseToken, neg_ctx->output_token.value, + neg_ctx->output_token.length); + responseTokenLength = neg_ctx->output_token.length; + + object=OBJ_txt2obj ("1.2.840.113554.1.2.2", 1); + if(!makeSpnegoInitialToken (object, + responseToken, + responseTokenLength, + &spnegoToken, + &spnegoTokenLength)) { + free(responseToken); + responseToken = NULL; + infof(conn->data, "Make SPNEGO Initial Token failed\n"); + } + else { + free(responseToken); + responseToken = NULL; + free(neg_ctx->output_token.value); + neg_ctx->output_token.value = malloc(spnegoTokenLength); + if(neg_ctx->output_token.value == NULL) { + free(spnegoToken); + spnegoToken = NULL; + return CURLE_OUT_OF_MEMORY; + } + memcpy(neg_ctx->output_token.value, spnegoToken,spnegoTokenLength); + neg_ctx->output_token.length = spnegoTokenLength; + free(spnegoToken); + spnegoToken = NULL; + infof(conn->data, "Make SPNEGO Initial Token succeeded\n"); + } + } +#endif + len = Curl_base64_encode(conn->data, + neg_ctx->output_token.value, + neg_ctx->output_token.length, + &encoded); + + if(len == 0) + return CURLE_OUT_OF_MEMORY; + + userp = aprintf("%sAuthorization: %s %s\r\n", proxy ? "Proxy-" : "", + neg_ctx->protocol, encoded); + + if(proxy) + conn->allocptr.proxyuserpwd = userp; + else + conn->allocptr.userpwd = userp; + free(encoded); + Curl_cleanup_negotiate (conn->data); + return (userp == NULL) ? CURLE_OUT_OF_MEMORY : CURLE_OK; +} + +static void cleanup(struct negotiatedata *neg_ctx) +{ + OM_uint32 minor_status; + if(neg_ctx->context != GSS_C_NO_CONTEXT) + gss_delete_sec_context(&minor_status, &neg_ctx->context, GSS_C_NO_BUFFER); + + if(neg_ctx->output_token.length != 0) + gss_release_buffer(&minor_status, &neg_ctx->output_token); + + if(neg_ctx->server_name != GSS_C_NO_NAME) + gss_release_name(&minor_status, &neg_ctx->server_name); + + memset(neg_ctx, 0, sizeof(*neg_ctx)); +} + +void Curl_cleanup_negotiate(struct SessionHandle *data) +{ + cleanup(&data->state.negotiate); + cleanup(&data->state.proxyneg); +} + + +#endif +#endif diff --git a/mobicore/common/curl/lib/http_negotiate.h b/mobicore/common/curl/lib/http_negotiate.h new file mode 100644 index 0000000000000000000000000000000000000000..35501f0447a98777a1a6cfc28e6034ec824aeb33 --- /dev/null +++ b/mobicore/common/curl/lib/http_negotiate.h @@ -0,0 +1,38 @@ +#ifndef HEADER_CURL_HTTP_NEGOTIATE_H +#define HEADER_CURL_HTTP_NEGOTIATE_H +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) 1998 - 2010, Daniel Stenberg, , et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at http://curl.haxx.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ***************************************************************************/ + +#ifdef HAVE_GSSAPI + +/* this is for Negotiate header input */ +int Curl_input_negotiate(struct connectdata *conn, bool proxy, + const char *header); + +/* this is for creating Negotiate header output */ +CURLcode Curl_output_negotiate(struct connectdata *conn, bool proxy); + +void Curl_cleanup_negotiate(struct SessionHandle *data); + +#endif /* HAVE_GSSAPI */ + +#endif /* HEADER_CURL_HTTP_NEGOTIATE_H */ diff --git a/mobicore/common/curl/lib/http_ntlm.c b/mobicore/common/curl/lib/http_ntlm.c new file mode 100644 index 0000000000000000000000000000000000000000..f5b696a69ed3e964ac40941eaf7a9a1ee3ff0bc2 --- /dev/null +++ b/mobicore/common/curl/lib/http_ntlm.c @@ -0,0 +1,1305 @@ +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) 1998 - 2009, Daniel Stenberg, , et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at http://curl.haxx.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ***************************************************************************/ +#include "setup.h" + +/* NTLM details: + + http://davenport.sourceforge.net/ntlm.html + http://www.innovation.ch/java/ntlm.html + + Another implementation: + http://lxr.mozilla.org/mozilla/source/security/manager/ssl/src/nsNTLMAuthModule.cpp + +*/ + +#ifndef CURL_DISABLE_HTTP +#ifdef USE_NTLM + +#define DEBUG_ME 0 + +/* -- WIN32 approved -- */ +#include +#include +#include +#include +#include + +#ifdef HAVE_UNISTD_H +#include +#endif + +#if (defined(NETWARE) && !defined(__NOVELL_LIBC__)) +#include +#endif + +#include "urldata.h" +#include "easyif.h" /* for Curl_convert_... prototypes */ +#include "sendf.h" +#include "rawstr.h" +#include "curl_base64.h" +#include "http_ntlm.h" +#include "url.h" +#include "curl_gethostname.h" +#include "curl_memory.h" + +#define _MPRINTF_REPLACE /* use our functions only */ +#include + +/* "NTLMSSP" signature is always in ASCII regardless of the platform */ +#define NTLMSSP_SIGNATURE "\x4e\x54\x4c\x4d\x53\x53\x50" + +#ifdef USE_SSLEAY +#include "ssluse.h" +# ifdef USE_OPENSSL +# include +# ifndef OPENSSL_NO_MD4 +# include +# endif +# include +# include +# include +# else +# include +# ifndef OPENSSL_NO_MD4 +# include +# endif +# include +# include +# include +# endif + +#if OPENSSL_VERSION_NUMBER < 0x00907001L +#define DES_key_schedule des_key_schedule +#define DES_cblock des_cblock +#define DES_set_odd_parity des_set_odd_parity +#define DES_set_key des_set_key +#define DES_ecb_encrypt des_ecb_encrypt + +/* This is how things were done in the old days */ +#define DESKEY(x) x +#define DESKEYARG(x) x +#else +/* Modern version */ +#define DESKEYARG(x) *x +#define DESKEY(x) &x +#endif + +#ifdef OPENSSL_NO_MD4 +/* This requires MD4, but OpenSSL was compiled without it */ +#define USE_NTRESPONSES 0 +#define USE_NTLM2SESSION 0 +#endif + +#elif defined(USE_GNUTLS) + +#include "gtls.h" +#include + +#define MD5_DIGEST_LENGTH 16 +#define MD4_DIGEST_LENGTH 16 + +#elif defined(USE_NSS) + +#include "curl_md4.h" +#include "nssg.h" +#include +#include +#include +#define MD5_DIGEST_LENGTH MD5_LENGTH + +#elif defined(USE_WINDOWS_SSPI) + +#include "curl_sspi.h" + +#else +# error "Can't compile NTLM support without a crypto library." +#endif + +/* The last #include file should be: */ +#include "memdebug.h" + +#ifndef USE_NTRESPONSES +/* Define this to make the type-3 message include the NT response message */ +#define USE_NTRESPONSES 1 + +/* Define this to make the type-3 message include the NTLM2Session response + message, requires USE_NTRESPONSES. */ +#define USE_NTLM2SESSION 1 +#endif + +#ifndef USE_WINDOWS_SSPI +/* this function converts from the little endian format used in the incoming + package to whatever endian format we're using natively */ +static unsigned int readint_le(unsigned char *buf) /* must point to a + 4 bytes buffer*/ +{ + return ((unsigned int)buf[0]) | ((unsigned int)buf[1] << 8) | + ((unsigned int)buf[2] << 16) | ((unsigned int)buf[3] << 24); +} +#endif + +#if DEBUG_ME +# define DEBUG_OUT(x) x +static void print_flags(FILE *handle, unsigned long flags) +{ + if(flags & NTLMFLAG_NEGOTIATE_UNICODE) + fprintf(handle, "NTLMFLAG_NEGOTIATE_UNICODE "); + if(flags & NTLMFLAG_NEGOTIATE_OEM) + fprintf(handle, "NTLMFLAG_NEGOTIATE_OEM "); + if(flags & NTLMFLAG_REQUEST_TARGET) + fprintf(handle, "NTLMFLAG_REQUEST_TARGET "); + if(flags & (1<<3)) + fprintf(handle, "NTLMFLAG_UNKNOWN_3 "); + if(flags & NTLMFLAG_NEGOTIATE_SIGN) + fprintf(handle, "NTLMFLAG_NEGOTIATE_SIGN "); + if(flags & NTLMFLAG_NEGOTIATE_SEAL) + fprintf(handle, "NTLMFLAG_NEGOTIATE_SEAL "); + if(flags & NTLMFLAG_NEGOTIATE_DATAGRAM_STYLE) + fprintf(handle, "NTLMFLAG_NEGOTIATE_DATAGRAM_STYLE "); + if(flags & NTLMFLAG_NEGOTIATE_LM_KEY) + fprintf(handle, "NTLMFLAG_NEGOTIATE_LM_KEY "); + if(flags & NTLMFLAG_NEGOTIATE_NETWARE) + fprintf(handle, "NTLMFLAG_NEGOTIATE_NETWARE "); + if(flags & NTLMFLAG_NEGOTIATE_NTLM_KEY) + fprintf(handle, "NTLMFLAG_NEGOTIATE_NTLM_KEY "); + if(flags & (1<<10)) + fprintf(handle, "NTLMFLAG_UNKNOWN_10 "); + if(flags & NTLMFLAG_NEGOTIATE_ANONYMOUS) + fprintf(handle, "NTLMFLAG_NEGOTIATE_ANONYMOUS "); + if(flags & NTLMFLAG_NEGOTIATE_DOMAIN_SUPPLIED) + fprintf(handle, "NTLMFLAG_NEGOTIATE_DOMAIN_SUPPLIED "); + if(flags & NTLMFLAG_NEGOTIATE_WORKSTATION_SUPPLIED) + fprintf(handle, "NTLMFLAG_NEGOTIATE_WORKSTATION_SUPPLIED "); + if(flags & NTLMFLAG_NEGOTIATE_LOCAL_CALL) + fprintf(handle, "NTLMFLAG_NEGOTIATE_LOCAL_CALL "); + if(flags & NTLMFLAG_NEGOTIATE_ALWAYS_SIGN) + fprintf(handle, "NTLMFLAG_NEGOTIATE_ALWAYS_SIGN "); + if(flags & NTLMFLAG_TARGET_TYPE_DOMAIN) + fprintf(handle, "NTLMFLAG_TARGET_TYPE_DOMAIN "); + if(flags & NTLMFLAG_TARGET_TYPE_SERVER) + fprintf(handle, "NTLMFLAG_TARGET_TYPE_SERVER "); + if(flags & NTLMFLAG_TARGET_TYPE_SHARE) + fprintf(handle, "NTLMFLAG_TARGET_TYPE_SHARE "); + if(flags & NTLMFLAG_NEGOTIATE_NTLM2_KEY) + fprintf(handle, "NTLMFLAG_NEGOTIATE_NTLM2_KEY "); + if(flags & NTLMFLAG_REQUEST_INIT_RESPONSE) + fprintf(handle, "NTLMFLAG_REQUEST_INIT_RESPONSE "); + if(flags & NTLMFLAG_REQUEST_ACCEPT_RESPONSE) + fprintf(handle, "NTLMFLAG_REQUEST_ACCEPT_RESPONSE "); + if(flags & NTLMFLAG_REQUEST_NONNT_SESSION_KEY) + fprintf(handle, "NTLMFLAG_REQUEST_NONNT_SESSION_KEY "); + if(flags & NTLMFLAG_NEGOTIATE_TARGET_INFO) + fprintf(handle, "NTLMFLAG_NEGOTIATE_TARGET_INFO "); + if(flags & (1<<24)) + fprintf(handle, "NTLMFLAG_UNKNOWN_24 "); + if(flags & (1<<25)) + fprintf(handle, "NTLMFLAG_UNKNOWN_25 "); + if(flags & (1<<26)) + fprintf(handle, "NTLMFLAG_UNKNOWN_26 "); + if(flags & (1<<27)) + fprintf(handle, "NTLMFLAG_UNKNOWN_27 "); + if(flags & (1<<28)) + fprintf(handle, "NTLMFLAG_UNKNOWN_28 "); + if(flags & NTLMFLAG_NEGOTIATE_128) + fprintf(handle, "NTLMFLAG_NEGOTIATE_128 "); + if(flags & NTLMFLAG_NEGOTIATE_KEY_EXCHANGE) + fprintf(handle, "NTLMFLAG_NEGOTIATE_KEY_EXCHANGE "); + if(flags & NTLMFLAG_NEGOTIATE_56) + fprintf(handle, "NTLMFLAG_NEGOTIATE_56 "); +} + +static void print_hex(FILE *handle, const char *buf, size_t len) +{ + const char *p = buf; + fprintf(stderr, "0x"); + while(len-- > 0) + fprintf(stderr, "%02.2x", (unsigned int)*p++); +} +#else +# define DEBUG_OUT(x) +#endif + +/* + (*) = A "security buffer" is a triplet consisting of two shorts and one + long: + + 1. a 'short' containing the length of the buffer in bytes + 2. a 'short' containing the allocated space for the buffer in bytes + 3. a 'long' containing the offset to the start of the buffer from the + beginning of the NTLM message, in bytes. +*/ + + +CURLntlm Curl_input_ntlm(struct connectdata *conn, + bool proxy, /* if proxy or not */ + const char *header) /* rest of the www-authenticate: + header */ +{ + /* point to the correct struct with this */ + struct ntlmdata *ntlm; +#ifndef USE_WINDOWS_SSPI + static const char type2_marker[] = { 0x02, 0x00, 0x00, 0x00 }; +#endif + +#ifdef USE_NSS + if(CURLE_OK != Curl_nss_force_init(conn->data)) + return CURLNTLM_BAD; +#endif + + ntlm = proxy?&conn->proxyntlm:&conn->ntlm; + + /* skip initial whitespaces */ + while(*header && ISSPACE(*header)) + header++; + + if(checkprefix("NTLM", header)) { + header += strlen("NTLM"); + + while(*header && ISSPACE(*header)) + header++; + + if(*header) { + /* We got a type-2 message here: + + Index Description Content + 0 NTLMSSP Signature Null-terminated ASCII "NTLMSSP" + (0x4e544c4d53535000) + 8 NTLM Message Type long (0x02000000) + 12 Target Name security buffer(*) + 20 Flags long + 24 Challenge 8 bytes + (32) Context (optional) 8 bytes (two consecutive longs) + (40) Target Information (optional) security buffer(*) + 32 (48) start of data block + */ + size_t size; + unsigned char *buffer; + size = Curl_base64_decode(header, &buffer); + if(!buffer) + return CURLNTLM_BAD; + + ntlm->state = NTLMSTATE_TYPE2; /* we got a type-2 */ + +#ifdef USE_WINDOWS_SSPI + ntlm->type_2 = malloc(size+1); + if(ntlm->type_2 == NULL) { + free(buffer); + return CURLE_OUT_OF_MEMORY; + } + ntlm->n_type_2 = size; + memcpy(ntlm->type_2, buffer, size); +#else + ntlm->flags = 0; + + if((size < 32) || + (memcmp(buffer, NTLMSSP_SIGNATURE, 8) != 0) || + (memcmp(buffer+8, type2_marker, sizeof(type2_marker)) != 0)) { + /* This was not a good enough type-2 message */ + free(buffer); + return CURLNTLM_BAD; + } + + ntlm->flags = readint_le(&buffer[20]); + memcpy(ntlm->nonce, &buffer[24], 8); + + DEBUG_OUT({ + fprintf(stderr, "**** TYPE2 header flags=0x%08.8lx ", ntlm->flags); + print_flags(stderr, ntlm->flags); + fprintf(stderr, "\n nonce="); + print_hex(stderr, (char *)ntlm->nonce, 8); + fprintf(stderr, "\n****\n"); + fprintf(stderr, "**** Header %s\n ", header); + }); +#endif + free(buffer); + } + else { + if(ntlm->state >= NTLMSTATE_TYPE1) + return CURLNTLM_BAD; + + ntlm->state = NTLMSTATE_TYPE1; /* we should sent away a type-1 */ + } + } + return CURLNTLM_FINE; +} + +#ifndef USE_WINDOWS_SSPI + +#ifdef USE_SSLEAY +/* + * Turns a 56 bit key into the 64 bit, odd parity key and sets the key. The + * key schedule ks is also set. + */ +static void setup_des_key(const unsigned char *key_56, + DES_key_schedule DESKEYARG(ks)) +{ + DES_cblock key; + + key[0] = key_56[0]; + key[1] = (unsigned char)(((key_56[0] << 7) & 0xFF) | (key_56[1] >> 1)); + key[2] = (unsigned char)(((key_56[1] << 6) & 0xFF) | (key_56[2] >> 2)); + key[3] = (unsigned char)(((key_56[2] << 5) & 0xFF) | (key_56[3] >> 3)); + key[4] = (unsigned char)(((key_56[3] << 4) & 0xFF) | (key_56[4] >> 4)); + key[5] = (unsigned char)(((key_56[4] << 3) & 0xFF) | (key_56[5] >> 5)); + key[6] = (unsigned char)(((key_56[5] << 2) & 0xFF) | (key_56[6] >> 6)); + key[7] = (unsigned char) ((key_56[6] << 1) & 0xFF); + + DES_set_odd_parity(&key); + DES_set_key(&key, ks); +} + +#else /* defined(USE_SSLEAY) */ + +/* + * Turns a 56 bit key into the 64 bit, odd parity key. Used by GnuTLS and NSS. + */ +static void extend_key_56_to_64(const unsigned char *key_56, char *key) +{ + key[0] = key_56[0]; + key[1] = (unsigned char)(((key_56[0] << 7) & 0xFF) | (key_56[1] >> 1)); + key[2] = (unsigned char)(((key_56[1] << 6) & 0xFF) | (key_56[2] >> 2)); + key[3] = (unsigned char)(((key_56[2] << 5) & 0xFF) | (key_56[3] >> 3)); + key[4] = (unsigned char)(((key_56[3] << 4) & 0xFF) | (key_56[4] >> 4)); + key[5] = (unsigned char)(((key_56[4] << 3) & 0xFF) | (key_56[5] >> 5)); + key[6] = (unsigned char)(((key_56[5] << 2) & 0xFF) | (key_56[6] >> 6)); + key[7] = (unsigned char) ((key_56[6] << 1) & 0xFF); +} + +#if defined(USE_GNUTLS) + +/* + * Turns a 56 bit key into the 64 bit, odd parity key and sets the key. + */ +static void setup_des_key(const unsigned char *key_56, + gcry_cipher_hd_t *des) +{ + char key[8]; + extend_key_56_to_64(key_56, key); + gcry_cipher_setkey(*des, key, 8); +} + +#elif defined(USE_NSS) + +/* + * Expands a 56 bit key KEY_56 to 64 bit and encrypts 64 bit of data, using + * the expanded key. The caller is responsible for giving 64 bit of valid + * data is IN and (at least) 64 bit large buffer as OUT. + */ +static bool encrypt_des(const unsigned char *in, unsigned char *out, + const unsigned char *key_56) +{ + const CK_MECHANISM_TYPE mech = CKM_DES_ECB; /* DES cipher in ECB mode */ + PK11SlotInfo *slot = NULL; + char key[8]; /* expanded 64 bit key */ + SECItem key_item; + PK11SymKey *symkey = NULL; + SECItem *param = NULL; + PK11Context *ctx = NULL; + int out_len; /* not used, required by NSS */ + bool rv = FALSE; + + /* use internal slot for DES encryption (requires NSS to be initialized) */ + slot = PK11_GetInternalKeySlot(); + if(!slot) + return FALSE; + + /* expand the 56 bit key to 64 bit and wrap by NSS */ + extend_key_56_to_64(key_56, key); + key_item.data = (unsigned char *)key; + key_item.len = /* hard-wired */ 8; + symkey = PK11_ImportSymKey(slot, mech, PK11_OriginUnwrap, CKA_ENCRYPT, + &key_item, NULL); + if(!symkey) + goto fail; + + /* create DES encryption context */ + param = PK11_ParamFromIV(mech, /* no IV in ECB mode */ NULL); + if(!param) + goto fail; + ctx = PK11_CreateContextBySymKey(mech, CKA_ENCRYPT, symkey, param); + if(!ctx) + goto fail; + + /* perform the encryption */ + if(SECSuccess == PK11_CipherOp(ctx, out, &out_len, /* outbuflen */ 8, + (unsigned char *)in, /* inbuflen */ 8) + && SECSuccess == PK11_Finalize(ctx)) + rv = /* all OK */ TRUE; + +fail: + /* cleanup */ + if(ctx) + PK11_DestroyContext(ctx, PR_TRUE); + if(symkey) + PK11_FreeSymKey(symkey); + if(param) + SECITEM_FreeItem(param, PR_TRUE); + PK11_FreeSlot(slot); + return rv; +} + +#endif /* defined(USE_NSS) */ + +#endif /* defined(USE_SSLEAY) */ + + /* + * takes a 21 byte array and treats it as 3 56-bit DES keys. The + * 8 byte plaintext is encrypted with each key and the resulting 24 + * bytes are stored in the results array. + */ +static void lm_resp(const unsigned char *keys, + const unsigned char *plaintext, + unsigned char *results) +{ +#ifdef USE_SSLEAY + DES_key_schedule ks; + + setup_des_key(keys, DESKEY(ks)); + DES_ecb_encrypt((DES_cblock*) plaintext, (DES_cblock*) results, + DESKEY(ks), DES_ENCRYPT); + + setup_des_key(keys+7, DESKEY(ks)); + DES_ecb_encrypt((DES_cblock*) plaintext, (DES_cblock*) (results+8), + DESKEY(ks), DES_ENCRYPT); + + setup_des_key(keys+14, DESKEY(ks)); + DES_ecb_encrypt((DES_cblock*) plaintext, (DES_cblock*) (results+16), + DESKEY(ks), DES_ENCRYPT); +#elif defined(USE_GNUTLS) + gcry_cipher_hd_t des; + + gcry_cipher_open(&des, GCRY_CIPHER_DES, GCRY_CIPHER_MODE_ECB, 0); + setup_des_key(keys, &des); + gcry_cipher_encrypt(des, results, 8, plaintext, 8); + gcry_cipher_close(des); + + gcry_cipher_open(&des, GCRY_CIPHER_DES, GCRY_CIPHER_MODE_ECB, 0); + setup_des_key(keys+7, &des); + gcry_cipher_encrypt(des, results+8, 8, plaintext, 8); + gcry_cipher_close(des); + + gcry_cipher_open(&des, GCRY_CIPHER_DES, GCRY_CIPHER_MODE_ECB, 0); + setup_des_key(keys+14, &des); + gcry_cipher_encrypt(des, results+16, 8, plaintext, 8); + gcry_cipher_close(des); +#elif defined(USE_NSS) + encrypt_des(plaintext, results, keys); + encrypt_des(plaintext, results+8, keys+7); + encrypt_des(plaintext, results+16, keys+14); +#endif +} + + +/* + * Set up lanmanager hashed password + */ +static void mk_lm_hash(struct SessionHandle *data, + const char *password, + unsigned char *lmbuffer /* 21 bytes */) +{ + unsigned char pw[14]; + static const unsigned char magic[] = { + 0x4B, 0x47, 0x53, 0x21, 0x40, 0x23, 0x24, 0x25 /* i.e. KGS!@#$% */ + }; + size_t len = CURLMIN(strlen(password), 14); + + Curl_strntoupper((char *)pw, password, len); + memset(&pw[len], 0, 14-len); + +#ifdef CURL_DOES_CONVERSIONS + /* + * The LanManager hashed password needs to be created using the + * password in the network encoding not the host encoding. + */ + if(data) + Curl_convert_to_network(data, (char *)pw, 14); +#else + (void)data; +#endif + + { + /* Create LanManager hashed password. */ + +#ifdef USE_SSLEAY + DES_key_schedule ks; + + setup_des_key(pw, DESKEY(ks)); + DES_ecb_encrypt((DES_cblock *)magic, (DES_cblock *)lmbuffer, + DESKEY(ks), DES_ENCRYPT); + + setup_des_key(pw+7, DESKEY(ks)); + DES_ecb_encrypt((DES_cblock *)magic, (DES_cblock *)(lmbuffer+8), + DESKEY(ks), DES_ENCRYPT); +#elif defined(USE_GNUTLS) + gcry_cipher_hd_t des; + + gcry_cipher_open(&des, GCRY_CIPHER_DES, GCRY_CIPHER_MODE_ECB, 0); + setup_des_key(pw, &des); + gcry_cipher_encrypt(des, lmbuffer, 8, magic, 8); + gcry_cipher_close(des); + + gcry_cipher_open(&des, GCRY_CIPHER_DES, GCRY_CIPHER_MODE_ECB, 0); + setup_des_key(pw+7, &des); + gcry_cipher_encrypt(des, lmbuffer+8, 8, magic, 8); + gcry_cipher_close(des); +#elif defined(USE_NSS) + encrypt_des(magic, lmbuffer, pw); + encrypt_des(magic, lmbuffer+8, pw+7); +#endif + + memset(lmbuffer + 16, 0, 21 - 16); + } +} + +#if USE_NTRESPONSES +static void ascii_to_unicode_le(unsigned char *dest, const char *src, + size_t srclen) +{ + size_t i; + for (i=0; itype_2) { + free(ntlm->type_2); + ntlm->type_2 = NULL; + } + if(ntlm->has_handles) { + s_pSecFn->DeleteSecurityContext(&ntlm->c_handle); + s_pSecFn->FreeCredentialsHandle(&ntlm->handle); + ntlm->has_handles = 0; + } + if(ntlm->p_identity) { + if(ntlm->identity.User) free(ntlm->identity.User); + if(ntlm->identity.Password) free(ntlm->identity.Password); + if(ntlm->identity.Domain) free(ntlm->identity.Domain); + ntlm->p_identity = NULL; + } +} + +#endif + +#define SHORTPAIR(x) ((x) & 0xff), (((x) >> 8) & 0xff) +#define LONGQUARTET(x) ((x) & 0xff), (((x) >> 8)&0xff), \ + (((x) >>16)&0xff), (((x)>>24) & 0xff) + +#define HOSTNAME_MAX 1024 + +/* this is for creating ntlm header output */ +CURLcode Curl_output_ntlm(struct connectdata *conn, + bool proxy) +{ + const char *domain=""; /* empty */ + char host [HOSTNAME_MAX+ 1] = ""; /* empty */ +#ifndef USE_WINDOWS_SSPI + size_t domlen = strlen(domain); + size_t hostlen = strlen(host); + size_t hostoff; /* host name offset */ + size_t domoff; /* domain name offset */ +#endif + size_t size; + char *base64=NULL; + unsigned char ntlmbuf[1024]; /* enough, unless the user+host+domain is very + long */ + + /* point to the address of the pointer that holds the string to sent to the + server, which is for a plain host or for a HTTP proxy */ + char **allocuserpwd; + + /* point to the name and password for this */ + const char *userp; + const char *passwdp; + /* point to the correct struct with this */ + struct ntlmdata *ntlm; + struct auth *authp; + + DEBUGASSERT(conn); + DEBUGASSERT(conn->data); + +#ifdef USE_NSS + if(CURLE_OK != Curl_nss_force_init(conn->data)) + return CURLE_OUT_OF_MEMORY; +#endif + + if(proxy) { + allocuserpwd = &conn->allocptr.proxyuserpwd; + userp = conn->proxyuser; + passwdp = conn->proxypasswd; + ntlm = &conn->proxyntlm; + authp = &conn->data->state.authproxy; + } + else { + allocuserpwd = &conn->allocptr.userpwd; + userp = conn->user; + passwdp = conn->passwd; + ntlm = &conn->ntlm; + authp = &conn->data->state.authhost; + } + authp->done = FALSE; + + /* not set means empty */ + if(!userp) + userp=""; + + if(!passwdp) + passwdp=""; + +#ifdef USE_WINDOWS_SSPI + if (s_hSecDll == NULL) { + /* not thread safe and leaks - use curl_global_init() to avoid */ + CURLcode err = Curl_sspi_global_init(); + if (s_hSecDll == NULL) + return err; + } +#endif + + switch(ntlm->state) { + case NTLMSTATE_TYPE1: + default: /* for the weird cases we (re)start here */ +#ifdef USE_WINDOWS_SSPI + { + SecBuffer buf; + SecBufferDesc desc; + SECURITY_STATUS status; + ULONG attrs; + const char *user; + int domlen; + TimeStamp tsDummy; /* For Windows 9x compatibility of SPPI calls */ + + ntlm_sspi_cleanup(ntlm); + + user = strchr(userp, '\\'); + if(!user) + user = strchr(userp, '/'); + + if(user) { + domain = userp; + domlen = user - userp; + user++; + } + else { + user = userp; + domain = ""; + domlen = 0; + } + + if(user && *user) { + /* note: initialize all of this before doing the mallocs so that + * it can be cleaned up later without leaking memory. + */ + ntlm->p_identity = &ntlm->identity; + memset(ntlm->p_identity, 0, sizeof(*ntlm->p_identity)); + if((ntlm->identity.User = (unsigned char *)strdup(user)) == NULL) + return CURLE_OUT_OF_MEMORY; + ntlm->identity.UserLength = strlen(user); + if((ntlm->identity.Password = (unsigned char *)strdup(passwdp)) == NULL) + return CURLE_OUT_OF_MEMORY; + ntlm->identity.PasswordLength = strlen(passwdp); + if((ntlm->identity.Domain = malloc(domlen+1)) == NULL) + return CURLE_OUT_OF_MEMORY; + strncpy((char *)ntlm->identity.Domain, domain, domlen); + ntlm->identity.Domain[domlen] = '\0'; + ntlm->identity.DomainLength = domlen; + ntlm->identity.Flags = SEC_WINNT_AUTH_IDENTITY_ANSI; + } + else { + ntlm->p_identity = NULL; + } + + if(s_pSecFn->AcquireCredentialsHandleA( + NULL, (char *)"NTLM", SECPKG_CRED_OUTBOUND, NULL, ntlm->p_identity, + NULL, NULL, &ntlm->handle, &tsDummy + ) != SEC_E_OK) { + return CURLE_OUT_OF_MEMORY; + } + + desc.ulVersion = SECBUFFER_VERSION; + desc.cBuffers = 1; + desc.pBuffers = &buf; + buf.cbBuffer = sizeof(ntlmbuf); + buf.BufferType = SECBUFFER_TOKEN; + buf.pvBuffer = ntlmbuf; + + status = s_pSecFn->InitializeSecurityContextA(&ntlm->handle, NULL, + (char *) host, + ISC_REQ_CONFIDENTIALITY | + ISC_REQ_REPLAY_DETECT | + ISC_REQ_CONNECTION, + 0, SECURITY_NETWORK_DREP, + NULL, 0, + &ntlm->c_handle, &desc, + &attrs, &tsDummy); + + if(status == SEC_I_COMPLETE_AND_CONTINUE || + status == SEC_I_CONTINUE_NEEDED) { + s_pSecFn->CompleteAuthToken(&ntlm->c_handle, &desc); + } + else if(status != SEC_E_OK) { + s_pSecFn->FreeCredentialsHandle(&ntlm->handle); + return CURLE_RECV_ERROR; + } + + ntlm->has_handles = 1; + size = buf.cbBuffer; + } +#else + hostoff = 0; + domoff = hostoff + hostlen; /* This is 0: remember that host and domain + are empty */ + + /* Create and send a type-1 message: + + Index Description Content + 0 NTLMSSP Signature Null-terminated ASCII "NTLMSSP" + (0x4e544c4d53535000) + 8 NTLM Message Type long (0x01000000) + 12 Flags long + 16 Supplied Domain security buffer(*) + 24 Supplied Workstation security buffer(*) + 32 start of data block + + */ +#if USE_NTLM2SESSION +#define NTLM2FLAG NTLMFLAG_NEGOTIATE_NTLM2_KEY +#else +#define NTLM2FLAG 0 +#endif + snprintf((char *)ntlmbuf, sizeof(ntlmbuf), NTLMSSP_SIGNATURE "%c" + "\x01%c%c%c" /* 32-bit type = 1 */ + "%c%c%c%c" /* 32-bit NTLM flag field */ + "%c%c" /* domain length */ + "%c%c" /* domain allocated space */ + "%c%c" /* domain name offset */ + "%c%c" /* 2 zeroes */ + "%c%c" /* host length */ + "%c%c" /* host allocated space */ + "%c%c" /* host name offset */ + "%c%c" /* 2 zeroes */ + "%s" /* host name */ + "%s", /* domain string */ + 0, /* trailing zero */ + 0,0,0, /* part of type-1 long */ + + LONGQUARTET( + NTLMFLAG_NEGOTIATE_OEM| + NTLMFLAG_REQUEST_TARGET| + NTLMFLAG_NEGOTIATE_NTLM_KEY| + NTLM2FLAG| + NTLMFLAG_NEGOTIATE_ALWAYS_SIGN + ), + SHORTPAIR(domlen), + SHORTPAIR(domlen), + SHORTPAIR(domoff), + 0,0, + SHORTPAIR(hostlen), + SHORTPAIR(hostlen), + SHORTPAIR(hostoff), + 0,0, + host /* this is empty */, domain /* this is empty */); + + /* initial packet length */ + size = 32 + hostlen + domlen; +#endif + + DEBUG_OUT({ + fprintf(stderr, "**** TYPE1 header flags=0x%02.2x%02.2x%02.2x%02.2x 0x%08.8x ", + LONGQUARTET(NTLMFLAG_NEGOTIATE_OEM| + NTLMFLAG_REQUEST_TARGET| + NTLMFLAG_NEGOTIATE_NTLM_KEY| + NTLM2FLAG| + NTLMFLAG_NEGOTIATE_ALWAYS_SIGN), + NTLMFLAG_NEGOTIATE_OEM| + NTLMFLAG_REQUEST_TARGET| + NTLMFLAG_NEGOTIATE_NTLM_KEY| + NTLM2FLAG| + NTLMFLAG_NEGOTIATE_ALWAYS_SIGN); + print_flags(stderr, + NTLMFLAG_NEGOTIATE_OEM| + NTLMFLAG_REQUEST_TARGET| + NTLMFLAG_NEGOTIATE_NTLM_KEY| + NTLM2FLAG| + NTLMFLAG_NEGOTIATE_ALWAYS_SIGN); + fprintf(stderr, "\n****\n"); + }); + + /* now size is the size of the base64 encoded package size */ + size = Curl_base64_encode(NULL, (char *)ntlmbuf, size, &base64); + + if(size >0 ) { + Curl_safefree(*allocuserpwd); + *allocuserpwd = aprintf("%sAuthorization: NTLM %s\r\n", + proxy?"Proxy-":"", + base64); + DEBUG_OUT(fprintf(stderr, "**** Header %s\n ", *allocuserpwd)); + free(base64); + } + else + return CURLE_OUT_OF_MEMORY; /* FIX TODO */ + + break; + + case NTLMSTATE_TYPE2: + /* We received the type-2 message already, create a type-3 message: + + Index Description Content + 0 NTLMSSP Signature Null-terminated ASCII "NTLMSSP" + (0x4e544c4d53535000) + 8 NTLM Message Type long (0x03000000) + 12 LM/LMv2 Response security buffer(*) + 20 NTLM/NTLMv2 Response security buffer(*) + 28 Domain Name security buffer(*) + 36 User Name security buffer(*) + 44 Workstation Name security buffer(*) + (52) Session Key (optional) security buffer(*) + (60) Flags (optional) long + 52 (64) start of data block + + */ + + { +#ifdef USE_WINDOWS_SSPI + SecBuffer type_2, type_3; + SecBufferDesc type_2_desc, type_3_desc; + SECURITY_STATUS status; + ULONG attrs; + TimeStamp tsDummy; /* For Windows 9x compatibility of SPPI calls */ + + type_2_desc.ulVersion = type_3_desc.ulVersion = SECBUFFER_VERSION; + type_2_desc.cBuffers = type_3_desc.cBuffers = 1; + type_2_desc.pBuffers = &type_2; + type_3_desc.pBuffers = &type_3; + + type_2.BufferType = SECBUFFER_TOKEN; + type_2.pvBuffer = ntlm->type_2; + type_2.cbBuffer = ntlm->n_type_2; + type_3.BufferType = SECBUFFER_TOKEN; + type_3.pvBuffer = ntlmbuf; + type_3.cbBuffer = sizeof(ntlmbuf); + + status = s_pSecFn->InitializeSecurityContextA(&ntlm->handle, &ntlm->c_handle, + (char *) host, + ISC_REQ_CONFIDENTIALITY | + ISC_REQ_REPLAY_DETECT | + ISC_REQ_CONNECTION, + 0, SECURITY_NETWORK_DREP, &type_2_desc, + 0, &ntlm->c_handle, &type_3_desc, + &attrs, &tsDummy); + + if(status != SEC_E_OK) + return CURLE_RECV_ERROR; + + size = type_3.cbBuffer; + + ntlm_sspi_cleanup(ntlm); + +#else + int lmrespoff; + unsigned char lmresp[24]; /* fixed-size */ +#if USE_NTRESPONSES + int ntrespoff; + unsigned char ntresp[24]; /* fixed-size */ +#endif + size_t useroff; + const char *user; + size_t userlen; + + user = strchr(userp, '\\'); + if(!user) + user = strchr(userp, '/'); + + if(user) { + domain = userp; + domlen = (user - domain); + user++; + } + else + user = userp; + userlen = strlen(user); + + if(Curl_gethostname(host, HOSTNAME_MAX)) { + infof(conn->data, "gethostname() failed, continuing without!"); + hostlen = 0; + } + else { + /* If the workstation if configured with a full DNS name (i.e. + * workstation.somewhere.net) gethostname() returns the fully qualified + * name, which NTLM doesn't like. + */ + char *dot = strchr(host, '.'); + if(dot) + *dot = '\0'; + hostlen = strlen(host); + } + +#if USE_NTLM2SESSION + /* We don't support NTLM2 if we don't have USE_NTRESPONSES */ + if(ntlm->flags & NTLMFLAG_NEGOTIATE_NTLM2_KEY) { + unsigned char ntbuffer[0x18]; + unsigned char tmp[0x18]; + unsigned char md5sum[MD5_DIGEST_LENGTH]; + unsigned char entropy[8]; + + /* Need to create 8 bytes random data */ +#ifdef USE_SSLEAY + MD5_CTX MD5pw; + Curl_ossl_seed(conn->data); /* Initiate the seed if not already done */ + RAND_bytes(entropy,8); +#elif defined(USE_GNUTLS) + gcry_md_hd_t MD5pw; + Curl_gtls_seed(conn->data); /* Initiate the seed if not already done */ + gcry_randomize(entropy, 8, GCRY_STRONG_RANDOM); +#elif defined(USE_NSS) + PK11Context *MD5pw; + unsigned int outlen; + Curl_nss_seed(conn->data); /* Initiate the seed if not already done */ + PK11_GenerateRandom(entropy, 8); +#endif + + /* 8 bytes random data as challenge in lmresp */ + memcpy(lmresp,entropy,8); + /* Pad with zeros */ + memset(lmresp+8,0,0x10); + + /* Fill tmp with challenge(nonce?) + entropy */ + memcpy(tmp,&ntlm->nonce[0],8); + memcpy(tmp+8,entropy,8); + +#ifdef USE_SSLEAY + MD5_Init(&MD5pw); + MD5_Update(&MD5pw, tmp, 16); + MD5_Final(md5sum, &MD5pw); +#elif defined(USE_GNUTLS) + gcry_md_open(&MD5pw, GCRY_MD_MD5, 0); + gcry_md_write(MD5pw, tmp, MD5_DIGEST_LENGTH); + memcpy(md5sum, gcry_md_read (MD5pw, 0), MD5_DIGEST_LENGTH); + gcry_md_close(MD5pw); +#elif defined(USE_NSS) + MD5pw = PK11_CreateDigestContext(SEC_OID_MD5); + PK11_DigestOp(MD5pw, tmp, 16); + PK11_DigestFinal(MD5pw, md5sum, &outlen, MD5_DIGEST_LENGTH); + PK11_DestroyContext(MD5pw, PR_TRUE); +#endif + + /* We shall only use the first 8 bytes of md5sum, + but the des code in lm_resp only encrypt the first 8 bytes */ + if(mk_nt_hash(conn->data, passwdp, ntbuffer) == CURLE_OUT_OF_MEMORY) + return CURLE_OUT_OF_MEMORY; + lm_resp(ntbuffer, md5sum, ntresp); + + /* End of NTLM2 Session code */ + } + else +#endif + { + +#if USE_NTRESPONSES + unsigned char ntbuffer[0x18]; +#endif + unsigned char lmbuffer[0x18]; + +#if USE_NTRESPONSES + if(mk_nt_hash(conn->data, passwdp, ntbuffer) == CURLE_OUT_OF_MEMORY) + return CURLE_OUT_OF_MEMORY; + lm_resp(ntbuffer, &ntlm->nonce[0], ntresp); +#endif + + mk_lm_hash(conn->data, passwdp, lmbuffer); + lm_resp(lmbuffer, &ntlm->nonce[0], lmresp); + /* A safer but less compatible alternative is: + * lm_resp(ntbuffer, &ntlm->nonce[0], lmresp); + * See http://davenport.sourceforge.net/ntlm.html#ntlmVersion2 */ + } + + lmrespoff = 64; /* size of the message header */ +#if USE_NTRESPONSES + ntrespoff = lmrespoff + 0x18; + domoff = ntrespoff + 0x18; +#else + domoff = lmrespoff + 0x18; +#endif + useroff = domoff + domlen; + hostoff = useroff + userlen; + + /* + * In the case the server sets the flag NTLMFLAG_NEGOTIATE_UNICODE, we + * need to filter it off because libcurl doesn't UNICODE encode the + * strings it packs into the NTLM authenticate packet. + */ + ntlm->flags &= ~NTLMFLAG_NEGOTIATE_UNICODE; + + /* Create the big type-3 message binary blob */ + size = snprintf((char *)ntlmbuf, sizeof(ntlmbuf), + NTLMSSP_SIGNATURE "%c" + "\x03%c%c%c" /* type-3, 32 bits */ + + "%c%c" /* LanManager length */ + "%c%c" /* LanManager allocated space */ + "%c%c" /* LanManager offset */ + "%c%c" /* 2 zeroes */ + + "%c%c" /* NT-response length */ + "%c%c" /* NT-response allocated space */ + "%c%c" /* NT-response offset */ + "%c%c" /* 2 zeroes */ + + "%c%c" /* domain length */ + "%c%c" /* domain allocated space */ + "%c%c" /* domain name offset */ + "%c%c" /* 2 zeroes */ + + "%c%c" /* user length */ + "%c%c" /* user allocated space */ + "%c%c" /* user offset */ + "%c%c" /* 2 zeroes */ + + "%c%c" /* host length */ + "%c%c" /* host allocated space */ + "%c%c" /* host offset */ + "%c%c" /* 2 zeroes */ + + "%c%c" /* session key length (unknown purpose) */ + "%c%c" /* session key allocated space (unknown purpose) */ + "%c%c" /* session key offset (unknown purpose) */ + "%c%c" /* 2 zeroes */ + + "%c%c%c%c" /* flags */ + + /* domain string */ + /* user string */ + /* host string */ + /* LanManager response */ + /* NT response */ + , + 0, /* zero termination */ + 0,0,0, /* type-3 long, the 24 upper bits */ + + SHORTPAIR(0x18), /* LanManager response length, twice */ + SHORTPAIR(0x18), + SHORTPAIR(lmrespoff), + 0x0, 0x0, + +#if USE_NTRESPONSES + SHORTPAIR(0x18), /* NT-response length, twice */ + SHORTPAIR(0x18), + SHORTPAIR(ntrespoff), + 0x0, 0x0, +#else + 0x0, 0x0, + 0x0, 0x0, + 0x0, 0x0, + 0x0, 0x0, +#endif + SHORTPAIR(domlen), + SHORTPAIR(domlen), + SHORTPAIR(domoff), + 0x0, 0x0, + + SHORTPAIR(userlen), + SHORTPAIR(userlen), + SHORTPAIR(useroff), + 0x0, 0x0, + + SHORTPAIR(hostlen), + SHORTPAIR(hostlen), + SHORTPAIR(hostoff), + 0x0, 0x0, + + 0x0, 0x0, + 0x0, 0x0, + 0x0, 0x0, + 0x0, 0x0, + + LONGQUARTET(ntlm->flags)); + DEBUGASSERT(size==64); + + DEBUGASSERT(size == (size_t)lmrespoff); + /* We append the binary hashes */ + if(size < (sizeof(ntlmbuf) - 0x18)) { + memcpy(&ntlmbuf[size], lmresp, 0x18); + size += 0x18; + } + + DEBUG_OUT({ + fprintf(stderr, "**** TYPE3 header lmresp="); + print_hex(stderr, (char *)&ntlmbuf[lmrespoff], 0x18); + }); + +#if USE_NTRESPONSES + if(size < (sizeof(ntlmbuf) - 0x18)) { + DEBUGASSERT(size == (size_t)ntrespoff); + memcpy(&ntlmbuf[size], ntresp, 0x18); + size += 0x18; + } + + DEBUG_OUT({ + fprintf(stderr, "\n ntresp="); + print_hex(stderr, (char *)&ntlmbuf[ntrespoff], 0x18); + }); + +#endif + + DEBUG_OUT({ + fprintf(stderr, "\n flags=0x%02.2x%02.2x%02.2x%02.2x 0x%08.8x ", + LONGQUARTET(ntlm->flags), ntlm->flags); + print_flags(stderr, ntlm->flags); + fprintf(stderr, "\n****\n"); + }); + + + /* Make sure that the domain, user and host strings fit in the target + buffer before we copy them there. */ + if(size + userlen + domlen + hostlen >= sizeof(ntlmbuf)) { + failf(conn->data, "user + domain + host name too big"); + return CURLE_OUT_OF_MEMORY; + } + + DEBUGASSERT(size == domoff); + memcpy(&ntlmbuf[size], domain, domlen); + size += domlen; + + DEBUGASSERT(size == useroff); + memcpy(&ntlmbuf[size], user, userlen); + size += userlen; + + DEBUGASSERT(size == hostoff); + memcpy(&ntlmbuf[size], host, hostlen); + size += hostlen; + +#ifdef CURL_DOES_CONVERSIONS + /* convert domain, user, and host to ASCII but leave the rest as-is */ + if(CURLE_OK != Curl_convert_to_network(conn->data, + (char *)&ntlmbuf[domoff], + size-domoff)) { + return CURLE_CONV_FAILED; + } +#endif /* CURL_DOES_CONVERSIONS */ + +#endif + + /* convert the binary blob into base64 */ + size = Curl_base64_encode(NULL, (char *)ntlmbuf, size, &base64); + + if(size >0 ) { + Curl_safefree(*allocuserpwd); + *allocuserpwd = aprintf("%sAuthorization: NTLM %s\r\n", + proxy?"Proxy-":"", + base64); + DEBUG_OUT(fprintf(stderr, "**** %s\n ", *allocuserpwd)); + free(base64); + } + else + return CURLE_OUT_OF_MEMORY; /* FIX TODO */ + + ntlm->state = NTLMSTATE_TYPE3; /* we sent a type-3 */ + authp->done = TRUE; + } + break; + + case NTLMSTATE_TYPE3: + /* connection is already authenticated, + * don't send a header in future requests */ + if(*allocuserpwd) { + free(*allocuserpwd); + *allocuserpwd=NULL; + } + authp->done = TRUE; + break; + } + + return CURLE_OK; +} + + +void +Curl_ntlm_cleanup(struct connectdata *conn) +{ +#ifdef USE_WINDOWS_SSPI + ntlm_sspi_cleanup(&conn->ntlm); + ntlm_sspi_cleanup(&conn->proxyntlm); +#else + (void)conn; +#endif +} + + +#endif /* USE_NTLM */ +#endif /* !CURL_DISABLE_HTTP */ diff --git a/mobicore/common/curl/lib/http_ntlm.h b/mobicore/common/curl/lib/http_ntlm.h new file mode 100644 index 0000000000000000000000000000000000000000..c7422d7012106c1aa0c1964e10787e58ebe93a07 --- /dev/null +++ b/mobicore/common/curl/lib/http_ntlm.h @@ -0,0 +1,149 @@ +#ifndef __HTTP_NTLM_H +#define __HTTP_NTLM_H +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) 1998 - 2009, Daniel Stenberg, , et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at http://curl.haxx.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ***************************************************************************/ + +typedef enum { + CURLNTLM_NONE, /* not a ntlm */ + CURLNTLM_BAD, /* an ntlm, but one we don't like */ + CURLNTLM_FIRST, /* the first 401-reply we got with NTLM */ + CURLNTLM_FINE, /* an ntlm we act on */ + + CURLNTLM_LAST /* last entry in this enum, don't use */ +} CURLntlm; + +/* this is for ntlm header input */ +CURLntlm Curl_input_ntlm(struct connectdata *conn, bool proxy, + const char *header); + +/* this is for creating ntlm header output */ +CURLcode Curl_output_ntlm(struct connectdata *conn, bool proxy); + +void Curl_ntlm_cleanup(struct connectdata *conn); +#ifndef USE_NTLM +#define Curl_ntlm_cleanup(x) +#endif + +/* Flag bits definitions based on http://davenport.sourceforge.net/ntlm.html */ + +#define NTLMFLAG_NEGOTIATE_UNICODE (1<<0) +/* Indicates that Unicode strings are supported for use in security buffer + data. */ + +#define NTLMFLAG_NEGOTIATE_OEM (1<<1) +/* Indicates that OEM strings are supported for use in security buffer data. */ + +#define NTLMFLAG_REQUEST_TARGET (1<<2) +/* Requests that the server's authentication realm be included in the Type 2 + message. */ + +/* unknown (1<<3) */ +#define NTLMFLAG_NEGOTIATE_SIGN (1<<4) +/* Specifies that authenticated communication between the client and server + should carry a digital signature (message integrity). */ + +#define NTLMFLAG_NEGOTIATE_SEAL (1<<5) +/* Specifies that authenticated communication between the client and server + should be encrypted (message confidentiality). */ + +#define NTLMFLAG_NEGOTIATE_DATAGRAM_STYLE (1<<6) +/* Indicates that datagram authentication is being used. */ + +#define NTLMFLAG_NEGOTIATE_LM_KEY (1<<7) +/* Indicates that the LAN Manager session key should be used for signing and + sealing authenticated communications. */ + +#define NTLMFLAG_NEGOTIATE_NETWARE (1<<8) +/* unknown purpose */ + +#define NTLMFLAG_NEGOTIATE_NTLM_KEY (1<<9) +/* Indicates that NTLM authentication is being used. */ + +/* unknown (1<<10) */ + +#define NTLMFLAG_NEGOTIATE_ANONYMOUS (1<<11) +/* Sent by the client in the Type 3 message to indicate that an anonymous + context has been established. This also affects the response fields. */ + +#define NTLMFLAG_NEGOTIATE_DOMAIN_SUPPLIED (1<<12) +/* Sent by the client in the Type 1 message to indicate that a desired + authentication realm is included in the message. */ + +#define NTLMFLAG_NEGOTIATE_WORKSTATION_SUPPLIED (1<<13) +/* Sent by the client in the Type 1 message to indicate that the client + workstation's name is included in the message. */ + +#define NTLMFLAG_NEGOTIATE_LOCAL_CALL (1<<14) +/* Sent by the server to indicate that the server and client are on the same + machine. Implies that the client may use a pre-established local security + context rather than responding to the challenge. */ + +#define NTLMFLAG_NEGOTIATE_ALWAYS_SIGN (1<<15) +/* Indicates that authenticated communication between the client and server + should be signed with a "dummy" signature. */ + +#define NTLMFLAG_TARGET_TYPE_DOMAIN (1<<16) +/* Sent by the server in the Type 2 message to indicate that the target + authentication realm is a domain. */ + +#define NTLMFLAG_TARGET_TYPE_SERVER (1<<17) +/* Sent by the server in the Type 2 message to indicate that the target + authentication realm is a server. */ + +#define NTLMFLAG_TARGET_TYPE_SHARE (1<<18) +/* Sent by the server in the Type 2 message to indicate that the target + authentication realm is a share. Presumably, this is for share-level + authentication. Usage is unclear. */ + +#define NTLMFLAG_NEGOTIATE_NTLM2_KEY (1<<19) +/* Indicates that the NTLM2 signing and sealing scheme should be used for + protecting authenticated communications. */ + +#define NTLMFLAG_REQUEST_INIT_RESPONSE (1<<20) +/* unknown purpose */ + +#define NTLMFLAG_REQUEST_ACCEPT_RESPONSE (1<<21) +/* unknown purpose */ + +#define NTLMFLAG_REQUEST_NONNT_SESSION_KEY (1<<22) +/* unknown purpose */ + +#define NTLMFLAG_NEGOTIATE_TARGET_INFO (1<<23) +/* Sent by the server in the Type 2 message to indicate that it is including a + Target Information block in the message. */ + +/* unknown (1<24) */ +/* unknown (1<25) */ +/* unknown (1<26) */ +/* unknown (1<27) */ +/* unknown (1<28) */ + +#define NTLMFLAG_NEGOTIATE_128 (1<<29) +/* Indicates that 128-bit encryption is supported. */ + +#define NTLMFLAG_NEGOTIATE_KEY_EXCHANGE (1<<30) +/* Indicates that the client will provide an encrypted master key in + the "Session Key" field of the Type 3 message. */ + +#define NTLMFLAG_NEGOTIATE_56 (1<<31) +/* Indicates that 56-bit encryption is supported. */ +#endif diff --git a/mobicore/common/curl/lib/if2ip.c b/mobicore/common/curl/lib/if2ip.c new file mode 100644 index 0000000000000000000000000000000000000000..19504d1fd5000c2b4b5035aa9b3fe7ef9929c32e --- /dev/null +++ b/mobicore/common/curl/lib/if2ip.c @@ -0,0 +1,160 @@ +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) 1998 - 2009, Daniel Stenberg, , et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at http://curl.haxx.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ***************************************************************************/ + +#include "setup.h" + +#ifdef HAVE_UNISTD_H +# include +#endif +#ifdef HAVE_SYS_SOCKET_H +# include +#endif +#ifdef HAVE_NETINET_IN_H +# include +#endif +#ifdef HAVE_ARPA_INET_H +# include +#endif +#ifdef HAVE_NET_IF_H +# include +#endif +#ifdef HAVE_SYS_IOCTL_H +# include +#endif +#ifdef HAVE_NETDB_H +# include +#endif +#ifdef HAVE_SYS_SOCKIO_H +# include +#endif +#ifdef HAVE_IFADDRS_H +# include +#endif +#ifdef HAVE_STROPTS_H +# include +#endif +#ifdef __VMS +# include +#endif + +#include "inet_ntop.h" +#include "strequal.h" +#include "if2ip.h" + +#define _MPRINTF_REPLACE /* use our functions only */ +#include + +#include "curl_memory.h" +/* The last #include file should be: */ +#include "memdebug.h" + +/* ------------------------------------------------------------------ */ + +#if defined(HAVE_GETIFADDRS) + +char *Curl_if2ip(int af, const char *interface, char *buf, int buf_size) +{ + struct ifaddrs *iface, *head; + char *ip=NULL; + + if (getifaddrs(&head) >= 0) { + for (iface=head; iface != NULL; iface=iface->ifa_next) { + if ((iface->ifa_addr != NULL) && + (iface->ifa_addr->sa_family == af) && + curl_strequal(iface->ifa_name, interface)) { + void *addr; + char scope[12]=""; +#ifdef ENABLE_IPV6 + if (af == AF_INET6) { + unsigned int scopeid = 0; + addr = &((struct sockaddr_in6 *)iface->ifa_addr)->sin6_addr; +#ifdef HAVE_SOCKADDR_IN6_SIN6_SCOPE_ID + /* Include the scope of this interface as part of the address */ + scopeid = ((struct sockaddr_in6 *)iface->ifa_addr)->sin6_scope_id; +#endif + if (scopeid) + snprintf(scope, sizeof(scope), "%%%u", scopeid); + } + else +#endif + addr = &((struct sockaddr_in *)iface->ifa_addr)->sin_addr; + ip = (char *) Curl_inet_ntop(af, addr, buf, buf_size); + strlcat(buf, scope, buf_size); + break; + } + } + freeifaddrs(head); + } + return ip; +} + +#elif defined(HAVE_IOCTL_SIOCGIFADDR) + +char *Curl_if2ip(int af, const char *interface, char *buf, int buf_size) +{ + struct ifreq req; + struct in_addr in; + struct sockaddr_in *s; + curl_socket_t dummy; + size_t len; + char *ip; + + if(!interface || (af != AF_INET)) + return NULL; + + len = strlen(interface); + if(len >= sizeof(req.ifr_name)) + return NULL; + + dummy = socket(AF_INET, SOCK_STREAM, 0); + if(CURL_SOCKET_BAD == dummy) + return NULL; + + memset(&req, 0, sizeof(req)); + memcpy(req.ifr_name, interface, len+1); + req.ifr_addr.sa_family = AF_INET; + + if(ioctl(dummy, SIOCGIFADDR, &req) < 0) { + sclose(dummy); + return NULL; + } + + s = (struct sockaddr_in *)&req.ifr_addr; + memcpy(&in, &s->sin_addr, sizeof(in)); + ip = (char *) Curl_inet_ntop(s->sin_family, &in, buf, buf_size); + + sclose(dummy); + return ip; +} + +#else + +char *Curl_if2ip(int af, const char *interf, char *buf, int buf_size) +{ + (void) af; + (void) interf; + (void) buf; + (void) buf_size; + return NULL; +} + +#endif diff --git a/mobicore/common/curl/lib/if2ip.h b/mobicore/common/curl/lib/if2ip.h new file mode 100644 index 0000000000000000000000000000000000000000..cdf2638aed4cae29816fd74c4362f5361fa28f8b --- /dev/null +++ b/mobicore/common/curl/lib/if2ip.h @@ -0,0 +1,65 @@ +#ifndef __IF2IP_H +#define __IF2IP_H +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) 1998 - 2005, Daniel Stenberg, , et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at http://curl.haxx.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ***************************************************************************/ +#include "setup.h" + +extern char *Curl_if2ip(int af, const char *interf, char *buf, int buf_size); + +#ifdef __INTERIX +#include + +/* Nedelcho Stanev's work-around for SFU 3.0 */ +struct ifreq { +#define IFNAMSIZ 16 +#define IFHWADDRLEN 6 + union { + char ifrn_name[IFNAMSIZ]; /* if name, e.g. "en0" */ + } ifr_ifrn; + + union { + struct sockaddr ifru_addr; + struct sockaddr ifru_broadaddr; + struct sockaddr ifru_netmask; + struct sockaddr ifru_hwaddr; + short ifru_flags; + int ifru_metric; + int ifru_mtu; + } ifr_ifru; +}; + +/* This define was added by Daniel to avoid an extra #ifdef INTERIX in the + C code. */ + +#define ifr_name ifr_ifrn.ifrn_name /* interface name */ +#define ifr_addr ifr_ifru.ifru_addr /* address */ +#define ifr_broadaddr ifr_ifru.ifru_broadaddr /* broadcast address */ +#define ifr_netmask ifr_ifru.ifru_netmask /* interface net mask */ +#define ifr_flags ifr_ifru.ifru_flags /* flags */ +#define ifr_hwaddr ifr_ifru.ifru_hwaddr /* MAC address */ +#define ifr_metric ifr_ifru.ifru_metric /* metric */ +#define ifr_mtu ifr_ifru.ifru_mtu /* mtu */ + +#define SIOCGIFADDR _IOW('s', 102, struct ifreq) /* Get if addr */ +#endif /* interix */ + +#endif diff --git a/mobicore/common/curl/lib/imap.c b/mobicore/common/curl/lib/imap.c new file mode 100644 index 0000000000000000000000000000000000000000..9c39625b32f97de2574f44b50f2a4a3eb99c59bf --- /dev/null +++ b/mobicore/common/curl/lib/imap.c @@ -0,0 +1,1028 @@ +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) 1998 - 2010, Daniel Stenberg, , et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at http://curl.haxx.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + * RFC3501 IMAPv4 protocol + * RFC5092 IMAP URL Scheme + * + ***************************************************************************/ + +#include "setup.h" + +#ifndef CURL_DISABLE_IMAP +#include +#include +#include +#include +#include + +#ifdef HAVE_UNISTD_H +#include +#endif + +#ifdef HAVE_SYS_SOCKET_H +#include +#endif +#ifdef HAVE_NETINET_IN_H +#include +#endif +#ifdef HAVE_ARPA_INET_H +#include +#endif +#ifdef HAVE_UTSNAME_H +#include +#endif +#ifdef HAVE_NETDB_H +#include +#endif +#ifdef __VMS +#include +#include +#endif + +#if (defined(NETWARE) && defined(__NOVELL_LIBC__)) +#undef in_addr_t +#define in_addr_t unsigned long +#endif + +#include +#include "urldata.h" +#include "sendf.h" +#include "easyif.h" /* for Curl_convert_... prototypes */ + +#include "if2ip.h" +#include "hostip.h" +#include "progress.h" +#include "transfer.h" +#include "escape.h" +#include "http.h" /* for HTTP proxy tunnel stuff */ +#include "socks.h" +#include "imap.h" + +#include "strtoofft.h" +#include "strequal.h" +#include "sslgen.h" +#include "connect.h" +#include "strerror.h" +#include "select.h" +#include "multiif.h" +#include "url.h" +#include "rawstr.h" +#include "strtoofft.h" + +#define _MPRINTF_REPLACE /* use our functions only */ +#include + +#include "curl_memory.h" +/* The last #include file should be: */ +#include "memdebug.h" + +/* Local API functions */ +static CURLcode imap_parse_url_path(struct connectdata *conn); +static CURLcode imap_regular_transfer(struct connectdata *conn, bool *done); +static CURLcode imap_do(struct connectdata *conn, bool *done); +static CURLcode imap_done(struct connectdata *conn, + CURLcode, bool premature); +static CURLcode imap_connect(struct connectdata *conn, bool *done); +static CURLcode imap_disconnect(struct connectdata *conn, bool dead_connection); +static CURLcode imap_multi_statemach(struct connectdata *conn, bool *done); +static int imap_getsock(struct connectdata *conn, + curl_socket_t *socks, + int numsocks); +static CURLcode imap_doing(struct connectdata *conn, + bool *dophase_done); +static CURLcode imap_setup_connection(struct connectdata * conn); + +/* + * IMAP protocol handler. + */ + +const struct Curl_handler Curl_handler_imap = { + "IMAP", /* scheme */ + imap_setup_connection, /* setup_connection */ + imap_do, /* do_it */ + imap_done, /* done */ + ZERO_NULL, /* do_more */ + imap_connect, /* connect_it */ + imap_multi_statemach, /* connecting */ + imap_doing, /* doing */ + imap_getsock, /* proto_getsock */ + imap_getsock, /* doing_getsock */ + ZERO_NULL, /* perform_getsock */ + imap_disconnect, /* disconnect */ + PORT_IMAP, /* defport */ + PROT_IMAP /* protocol */ +}; + + +#ifdef USE_SSL +/* + * IMAPS protocol handler. + */ + +const struct Curl_handler Curl_handler_imaps = { + "IMAPS", /* scheme */ + imap_setup_connection, /* setup_connection */ + imap_do, /* do_it */ + imap_done, /* done */ + ZERO_NULL, /* do_more */ + imap_connect, /* connect_it */ + imap_multi_statemach, /* connecting */ + imap_doing, /* doing */ + imap_getsock, /* proto_getsock */ + imap_getsock, /* doing_getsock */ + ZERO_NULL, /* perform_getsock */ + imap_disconnect, /* disconnect */ + PORT_IMAPS, /* defport */ + PROT_IMAP | PROT_IMAPS | PROT_SSL /* protocol */ +}; +#endif + +#ifndef CURL_DISABLE_HTTP +/* + * HTTP-proxyed IMAP protocol handler. + */ + +static const struct Curl_handler Curl_handler_imap_proxy = { + "IMAP", /* scheme */ + ZERO_NULL, /* setup_connection */ + Curl_http, /* do_it */ + Curl_http_done, /* done */ + ZERO_NULL, /* do_more */ + ZERO_NULL, /* connect_it */ + ZERO_NULL, /* connecting */ + ZERO_NULL, /* doing */ + ZERO_NULL, /* proto_getsock */ + ZERO_NULL, /* doing_getsock */ + ZERO_NULL, /* perform_getsock */ + ZERO_NULL, /* disconnect */ + PORT_IMAP, /* defport */ + PROT_HTTP /* protocol */ +}; + + +#ifdef USE_SSL +/* + * HTTP-proxyed IMAPS protocol handler. + */ + +static const struct Curl_handler Curl_handler_imaps_proxy = { + "IMAPS", /* scheme */ + ZERO_NULL, /* setup_connection */ + Curl_http, /* do_it */ + Curl_http_done, /* done */ + ZERO_NULL, /* do_more */ + ZERO_NULL, /* connect_it */ + ZERO_NULL, /* connecting */ + ZERO_NULL, /* doing */ + ZERO_NULL, /* proto_getsock */ + ZERO_NULL, /* doing_getsock */ + ZERO_NULL, /* perform_getsock */ + ZERO_NULL, /* disconnect */ + PORT_IMAPS, /* defport */ + PROT_HTTP /* protocol */ +}; +#endif +#endif + +/*********************************************************************** + * + * imapsendf() + * + * Sends the formated string as an IMAP command to a server + * + * NOTE: we build the command in a fixed-length buffer, which sets length + * restrictions on the command! + * + * Designed to never block. + */ +static CURLcode imapsendf(struct connectdata *conn, + const char *idstr, /* id to wait for at the + completion of this command */ + const char *fmt, ...) +{ + CURLcode res; + struct imap_conn *imapc = &conn->proto.imapc; + va_list ap; + va_start(ap, fmt); + + imapc->idstr = idstr; /* this is the thing */ + + res = Curl_pp_vsendf(&imapc->pp, fmt, ap); + + va_end(ap); + + return res; +} + +static const char *getcmdid(struct connectdata *conn) +{ + static const char * const ids[]= { + "A", + "B", + "C", + "D" + }; + + struct imap_conn *imapc = &conn->proto.imapc; + + /* get the next id, but wrap at end of table */ + imapc->cmdid = (int)((imapc->cmdid+1) % (sizeof(ids)/sizeof(ids[0]))); + + return ids[imapc->cmdid]; +} + +/* For the IMAP "protocol connect" and "doing" phases only */ +static int imap_getsock(struct connectdata *conn, + curl_socket_t *socks, + int numsocks) +{ + return Curl_pp_getsock(&conn->proto.imapc.pp, socks, numsocks); +} + +/* fucntion that checks for an imap status code at the start of the + given string */ +static int imap_endofresp(struct pingpong *pp, int *resp) +{ + char *line = pp->linestart_resp; + size_t len = pp->nread_resp; + struct imap_conn *imapc = &pp->conn->proto.imapc; + const char *id = imapc->idstr; + size_t id_len = strlen(id); + + if(len >= id_len + 3) { + if(!memcmp(id, line, id_len) && (line[id_len] == ' ') ) { + /* end of response */ + *resp = line[id_len+1]; /* O, N or B */ + return TRUE; + } + else if((imapc->state == IMAP_FETCH) && + !memcmp("* ", line, 2) ) { + /* FETCH response we're interested in */ + *resp = '*'; + return TRUE; + } + } + return FALSE; /* nothing for us */ +} + +/* This is the ONLY way to change IMAP state! */ +static void state(struct connectdata *conn, + imapstate newstate) +{ +#if defined(DEBUGBUILD) && !defined(CURL_DISABLE_VERBOSE_STRINGS) + /* for debug purposes */ + static const char * const names[]={ + "STOP", + "SERVERGREET", + "LOGIN", + "STARTTLS", + "SELECT", + "FETCH", + "LOGOUT", + /* LAST */ + }; +#endif + struct imap_conn *imapc = &conn->proto.imapc; +#if defined(DEBUGBUILD) && !defined(CURL_DISABLE_VERBOSE_STRINGS) + if(imapc->state != newstate) + infof(conn->data, "IMAP %p state change from %s to %s\n", + imapc, names[imapc->state], names[newstate]); +#endif + imapc->state = newstate; +} + +static CURLcode imap_state_login(struct connectdata *conn) +{ + CURLcode result; + struct FTP *imap = conn->data->state.proto.imap; + const char *str; + + str = getcmdid(conn); + + /* send USER and password */ + result = imapsendf(conn, str, "%s LOGIN %s %s", str, + imap->user?imap->user:"", + imap->passwd?imap->passwd:""); + if(result) + return result; + + state(conn, IMAP_LOGIN); + + return CURLE_OK; +} + +/* for STARTTLS responses */ +static CURLcode imap_state_starttls_resp(struct connectdata *conn, + int imapcode, + imapstate instate) +{ + CURLcode result = CURLE_OK; + struct SessionHandle *data = conn->data; + (void)instate; /* no use for this yet */ + + if(imapcode != 'O') { + failf(data, "STARTTLS denied. %c", imapcode); + result = CURLE_LOGIN_DENIED; + } + else { + /* Curl_ssl_connect is BLOCKING */ + result = Curl_ssl_connect(conn, FIRSTSOCKET); + if(CURLE_OK == result) { + conn->protocol |= PROT_IMAPS; + result = imap_state_login(conn); + } + } + state(conn, IMAP_STOP); + return result; +} + +/* for LOGIN responses */ +static CURLcode imap_state_login_resp(struct connectdata *conn, + int imapcode, + imapstate instate) +{ + CURLcode result = CURLE_OK; + struct SessionHandle *data = conn->data; + (void)instate; /* no use for this yet */ + + if(imapcode != 'O') { + failf(data, "Access denied. %c", imapcode); + result = CURLE_LOGIN_DENIED; + } + + state(conn, IMAP_STOP); + return result; +} + +/* for the (first line of) FETCH BODY[TEXT] response */ +static CURLcode imap_state_fetch_resp(struct connectdata *conn, + int imapcode, + imapstate instate) +{ + CURLcode result = CURLE_OK; + struct SessionHandle *data = conn->data; + struct imap_conn *imapc = &conn->proto.imapc; + struct FTP *imap = data->state.proto.imap; + struct pingpong *pp = &imapc->pp; + const char *ptr = data->state.buffer; + (void)instate; /* no use for this yet */ + + if('*' != imapcode) { + Curl_pgrsSetDownloadSize(data, 0); + state(conn, IMAP_STOP); + return CURLE_OK; + } + + /* Something like this comes "* 1 FETCH (BODY[TEXT] {2021}\r" */ + while(*ptr && (*ptr != '{')) + ptr++; + + if(*ptr == '{') { + curl_off_t filesize = curlx_strtoofft(ptr+1, NULL, 10); + if(filesize) + Curl_pgrsSetDownloadSize(data, filesize); + + infof(data, "Found %" FORMAT_OFF_TU " bytes to download\n", filesize); + + if(pp->cache) { + /* At this point there is a bunch of data in the header "cache" that is + actually body content, send it as body and then skip it. Do note + that there may even be additional "headers" after the body. */ + size_t chunk = pp->cache_size; + + if(chunk > (size_t)filesize) + /* the conversion from curl_off_t to size_t is always fine here */ + chunk = (size_t)filesize; + + result = Curl_client_write(conn, CLIENTWRITE_BODY, pp->cache, chunk); + if(result) + return result; + + filesize -= chunk; + + /* we've now used parts of or the entire cache */ + if(pp->cache_size > chunk) { + /* part of, move the trailing data to the start and reduce the size */ + memmove(pp->cache, pp->cache+chunk, + pp->cache_size - chunk); + pp->cache_size -= chunk; + } + else { + /* cache is drained */ + free(pp->cache); + pp->cache = NULL; + pp->cache_size = 0; + } + } + + infof(data, "Filesize left: %" FORMAT_OFF_T "\n", filesize); + + if(!filesize) + /* the entire data is already transfered! */ + Curl_setup_transfer(conn, -1, -1, FALSE, NULL, -1, NULL); + else + /* IMAP download */ + Curl_setup_transfer(conn, FIRSTSOCKET, filesize, FALSE, + imap->bytecountp, -1, NULL); /* no upload here */ + + data->req.maxdownload = filesize; + } + else + /* We don't know how to parse this line */ + result = CURLE_FTP_WEIRD_SERVER_REPLY; /* TODO: fix this code */ + + state(conn, IMAP_STOP); + return result; +} + +/* start the DO phase */ +static CURLcode imap_select(struct connectdata *conn) +{ + CURLcode result = CURLE_OK; + struct imap_conn *imapc = &conn->proto.imapc; + const char *str; + + str = getcmdid(conn); + + result = imapsendf(conn, str, "%s SELECT %s", str, + imapc->mailbox?imapc->mailbox:""); + if(result) + return result; + + state(conn, IMAP_SELECT); + return result; +} + +static CURLcode imap_fetch(struct connectdata *conn) +{ + CURLcode result = CURLE_OK; + const char *str; + + str = getcmdid(conn); + + /* TODO: make this select the correct mail + * Use "1 body[text]" to get the full mail body of mail 1 + */ + result = imapsendf(conn, str, "%s FETCH 1 BODY[TEXT]", str); + if(result) + return result; + + /* + * When issued, the server will respond with a single line similar to + * '* 1 FETCH (BODY[TEXT] {2021}' + * + * Identifying the fetch and how many bytes of contents we can expect. We + * must extract that number before continuing to "download as usual". + */ + + state(conn, IMAP_FETCH); + return result; +} + +/* for SELECT responses */ +static CURLcode imap_state_select_resp(struct connectdata *conn, + int imapcode, + imapstate instate) +{ + CURLcode result = CURLE_OK; + struct SessionHandle *data = conn->data; + (void)instate; /* no use for this yet */ + + if(imapcode != 'O') { + failf(data, "Select failed"); + result = CURLE_LOGIN_DENIED; + } + else + result = imap_fetch(conn); + return result; +} + +static CURLcode imap_statemach_act(struct connectdata *conn) +{ + CURLcode result; + curl_socket_t sock = conn->sock[FIRSTSOCKET]; + struct SessionHandle *data=conn->data; + int imapcode; + struct imap_conn *imapc = &conn->proto.imapc; + struct pingpong *pp = &imapc->pp; + size_t nread = 0; + + if(pp->sendleft) + return Curl_pp_flushsend(pp); + + /* we read a piece of response */ + result = Curl_pp_readresp(sock, pp, &imapcode, &nread); + if(result) + return result; + + if(imapcode) + /* we have now received a full IMAP server response */ + switch(imapc->state) { + case IMAP_SERVERGREET: + if(imapcode != 'O') { + failf(data, "Got unexpected imap-server response"); + return CURLE_FTP_WEIRD_SERVER_REPLY; + } + + if(data->set.ftp_ssl && !conn->ssl[FIRSTSOCKET].use) { + /* We don't have a SSL/TLS connection yet, but SSL is requested. Switch + to TLS connection now */ + const char *str; + + str = getcmdid(conn); + result = imapsendf(conn, str, "%s STARTTLS", str); + state(conn, IMAP_STARTTLS); + } + else + result = imap_state_login(conn); + if(result) + return result; + break; + + case IMAP_LOGIN: + result = imap_state_login_resp(conn, imapcode, imapc->state); + break; + + case IMAP_STARTTLS: + result = imap_state_starttls_resp(conn, imapcode, imapc->state); + break; + + case IMAP_FETCH: + result = imap_state_fetch_resp(conn, imapcode, imapc->state); + break; + + case IMAP_SELECT: + result = imap_state_select_resp(conn, imapcode, imapc->state); + break; + + case IMAP_LOGOUT: + /* fallthrough, just stop! */ + default: + /* internal error */ + state(conn, IMAP_STOP); + break; + } + + return result; +} + +/* called repeatedly until done from multi.c */ +static CURLcode imap_multi_statemach(struct connectdata *conn, + bool *done) +{ + struct imap_conn *imapc = &conn->proto.imapc; + CURLcode result = Curl_pp_multi_statemach(&imapc->pp); + + *done = (bool)(imapc->state == IMAP_STOP); + + return result; +} + +static CURLcode imap_easy_statemach(struct connectdata *conn) +{ + struct imap_conn *imapc = &conn->proto.imapc; + struct pingpong *pp = &imapc->pp; + CURLcode result = CURLE_OK; + + while(imapc->state != IMAP_STOP) { + result = Curl_pp_easy_statemach(pp); + if(result) + break; + } + + return result; +} + +/* + * Allocate and initialize the struct IMAP for the current SessionHandle. If + * need be. + */ +static CURLcode imap_init(struct connectdata *conn) +{ + struct SessionHandle *data = conn->data; + struct FTP *imap = data->state.proto.imap; + if(!imap) { + imap = data->state.proto.imap = calloc(sizeof(struct FTP), 1); + if(!imap) + return CURLE_OUT_OF_MEMORY; + } + + /* get some initial data into the imap struct */ + imap->bytecountp = &data->req.bytecount; + + /* No need to duplicate user+password, the connectdata struct won't change + during a session, but we re-init them here since on subsequent inits + since the conn struct may have changed or been replaced. + */ + imap->user = conn->user; + imap->passwd = conn->passwd; + + return CURLE_OK; +} + +/* + * imap_connect() should do everything that is to be considered a part of + * the connection phase. + * + * The variable 'done' points to will be TRUE if the protocol-layer connect + * phase is done when this function returns, or FALSE is not. When called as + * a part of the easy interface, it will always be TRUE. + */ +static CURLcode imap_connect(struct connectdata *conn, + bool *done) /* see description above */ +{ + CURLcode result; + struct imap_conn *imapc = &conn->proto.imapc; + struct SessionHandle *data=conn->data; + struct pingpong *pp = &imapc->pp; + + *done = FALSE; /* default to not done yet */ + + /* If there already is a protocol-specific struct allocated for this + sessionhandle, deal with it */ + Curl_reset_reqproto(conn); + + result = imap_init(conn); + if(CURLE_OK != result) + return result; + + /* We always support persistant connections on imap */ + conn->bits.close = FALSE; + + pp->response_time = RESP_TIMEOUT; /* set default response time-out */ + pp->statemach_act = imap_statemach_act; + pp->endofresp = imap_endofresp; + pp->conn = conn; + +#if !defined(CURL_DISABLE_HTTP) && !defined(CURL_DISABLE_PROXY) + if(conn->bits.tunnel_proxy && conn->bits.httpproxy) { + /* for IMAP over HTTP proxy */ + struct HTTP http_proxy; + struct FTP *imap_save; + + /* BLOCKING */ + /* We want "seamless" IMAP operations through HTTP proxy tunnel */ + + /* Curl_proxyCONNECT is based on a pointer to a struct HTTP at the member + * conn->proto.http; we want IMAP through HTTP and we have to change the + * member temporarily for connecting to the HTTP proxy. After + * Curl_proxyCONNECT we have to set back the member to the original struct + * IMAP pointer + */ + imap_save = data->state.proto.imap; + memset(&http_proxy, 0, sizeof(http_proxy)); + data->state.proto.http = &http_proxy; + + result = Curl_proxyCONNECT(conn, FIRSTSOCKET, + conn->host.name, conn->remote_port); + + data->state.proto.imap = imap_save; + + if(CURLE_OK != result) + return result; + } +#endif /* !CURL_DISABLE_HTTP && !CURL_DISABLE_PROXY */ + + if(conn->protocol & PROT_IMAPS) { + /* BLOCKING */ + /* IMAPS is simply imap with SSL for the control channel */ + /* now, perform the SSL initialization for this socket */ + result = Curl_ssl_connect(conn, FIRSTSOCKET); + if(result) + return result; + } + + Curl_pp_init(pp); /* init generic pingpong data */ + + /* When we connect, we start in the state where we await the server greeting + response */ + state(conn, IMAP_SERVERGREET); + imapc->idstr = "*"; /* we start off waiting for a '*' response */ + + if(data->state.used_interface == Curl_if_multi) + result = imap_multi_statemach(conn, done); + else { + result = imap_easy_statemach(conn); + if(!result) + *done = TRUE; + } + + return result; +} + +/*********************************************************************** + * + * imap_done() + * + * The DONE function. This does what needs to be done after a single DO has + * performed. + * + * Input argument is already checked for validity. + */ +static CURLcode imap_done(struct connectdata *conn, CURLcode status, + bool premature) +{ + struct SessionHandle *data = conn->data; + struct FTP *imap = data->state.proto.imap; + CURLcode result=CURLE_OK; + (void)premature; + + if(!imap) + /* When the easy handle is removed from the multi while libcurl is still + * trying to resolve the host name, it seems that the imap struct is not + * yet initialized, but the removal action calls Curl_done() which calls + * this function. So we simply return success if no imap pointer is set. + */ + return CURLE_OK; + + if(status) { + conn->bits.close = TRUE; /* marked for closure */ + result = status; /* use the already set error code */ + } + + /* clear these for next connection */ + imap->transfer = FTPTRANSFER_BODY; + + return result; +} + +/*********************************************************************** + * + * imap_perform() + * + * This is the actual DO function for IMAP. Get a file/directory according to + * the options previously setup. + */ + +static +CURLcode imap_perform(struct connectdata *conn, + bool *connected, /* connect status after PASV / PORT */ + bool *dophase_done) +{ + /* this is IMAP and no proxy */ + CURLcode result=CURLE_OK; + + DEBUGF(infof(conn->data, "DO phase starts\n")); + + if(conn->data->set.opt_no_body) { + /* requested no body means no transfer... */ + struct FTP *imap = conn->data->state.proto.imap; + imap->transfer = FTPTRANSFER_INFO; + } + + *dophase_done = FALSE; /* not done yet */ + + /* start the first command in the DO phase */ + result = imap_select(conn); + if(result) + return result; + + /* run the state-machine */ + if(conn->data->state.used_interface == Curl_if_multi) + result = imap_multi_statemach(conn, dophase_done); + else { + result = imap_easy_statemach(conn); + *dophase_done = TRUE; /* with the easy interface we are done here */ + } + *connected = conn->bits.tcpconnect; + + if(*dophase_done) + DEBUGF(infof(conn->data, "DO phase is complete\n")); + + return result; +} + +/*********************************************************************** + * + * imap_do() + * + * This function is registered as 'curl_do' function. It decodes the path + * parts etc as a wrapper to the actual DO function (imap_perform). + * + * The input argument is already checked for validity. + */ +static CURLcode imap_do(struct connectdata *conn, bool *done) +{ + CURLcode retcode = CURLE_OK; + + *done = FALSE; /* default to false */ + + /* + Since connections can be re-used between SessionHandles, this might be a + connection already existing but on a fresh SessionHandle struct so we must + make sure we have a good 'struct IMAP' to play with. For new connections, + the struct IMAP is allocated and setup in the imap_connect() function. + */ + Curl_reset_reqproto(conn); + retcode = imap_init(conn); + if(retcode) + return retcode; + + retcode = imap_parse_url_path(conn); + if(retcode) + return retcode; + + retcode = imap_regular_transfer(conn, done); + + return retcode; +} + +/*********************************************************************** + * + * imap_logout() + * + * This should be called before calling sclose(). We should then wait for the + * response from the server before returning. The calling code should then try + * to close the connection. + * + */ +static CURLcode imap_logout(struct connectdata *conn) +{ + CURLcode result = CURLE_OK; + const char *str; + + str = getcmdid(conn); + + result = imapsendf(conn, str, "%s LOGOUT", str, NULL); + if(result) + return result; + state(conn, IMAP_LOGOUT); + + result = imap_easy_statemach(conn); + + return result; +} + +/*********************************************************************** + * + * imap_disconnect() + * + * Disconnect from an IMAP server. Cleanup protocol-specific per-connection + * resources. BLOCKING. + */ +static CURLcode imap_disconnect(struct connectdata *conn, bool dead_connection) +{ + struct imap_conn *imapc= &conn->proto.imapc; + + /* The IMAP session may or may not have been allocated/setup at this + point! */ + if(!dead_connection && imapc->pp.conn) + (void)imap_logout(conn); /* ignore errors on the LOGOUT */ + + Curl_pp_disconnect(&imapc->pp); + + Curl_safefree(imapc->mailbox); + + return CURLE_OK; +} + +/*********************************************************************** + * + * imap_parse_url_path() + * + * Parse the URL path into separate path components. + * + */ +static CURLcode imap_parse_url_path(struct connectdata *conn) +{ + /* the imap struct is already inited in imap_connect() */ + struct imap_conn *imapc = &conn->proto.imapc; + struct SessionHandle *data = conn->data; + const char *path = data->state.path; + int len; + + if(!*path) + path = "INBOX"; + + /* url decode the path and use this mailbox */ + imapc->mailbox = curl_easy_unescape(data, path, 0, &len); + if(!imapc->mailbox) + return CURLE_OUT_OF_MEMORY; + + return CURLE_OK; +} + +/* call this when the DO phase has completed */ +static CURLcode imap_dophase_done(struct connectdata *conn, + bool connected) +{ + struct FTP *imap = conn->data->state.proto.imap; + (void)connected; + + if(imap->transfer != FTPTRANSFER_BODY) + /* no data to transfer */ + Curl_setup_transfer(conn, -1, -1, FALSE, NULL, -1, NULL); + + return CURLE_OK; +} + +/* called from multi.c while DOing */ +static CURLcode imap_doing(struct connectdata *conn, + bool *dophase_done) +{ + CURLcode result; + result = imap_multi_statemach(conn, dophase_done); + + if(*dophase_done) { + result = imap_dophase_done(conn, FALSE /* not connected */); + + DEBUGF(infof(conn->data, "DO phase is complete\n")); + } + return result; +} + +/*********************************************************************** + * + * imap_regular_transfer() + * + * The input argument is already checked for validity. + * + * Performs all commands done before a regular transfer between a local and a + * remote host. + * + */ +static +CURLcode imap_regular_transfer(struct connectdata *conn, + bool *dophase_done) +{ + CURLcode result=CURLE_OK; + bool connected=FALSE; + struct SessionHandle *data = conn->data; + data->req.size = -1; /* make sure this is unknown at this point */ + + Curl_pgrsSetUploadCounter(data, 0); + Curl_pgrsSetDownloadCounter(data, 0); + Curl_pgrsSetUploadSize(data, 0); + Curl_pgrsSetDownloadSize(data, 0); + + result = imap_perform(conn, + &connected, /* have we connected after PASV/PORT */ + dophase_done); /* all commands in the DO-phase done? */ + + if(CURLE_OK == result) { + + if(!*dophase_done) + /* the DO phase has not completed yet */ + return CURLE_OK; + + result = imap_dophase_done(conn, connected); + if(result) + return result; + } + + return result; +} + +static CURLcode imap_setup_connection(struct connectdata * conn) +{ + struct SessionHandle *data = conn->data; + + if(conn->bits.httpproxy && !data->set.tunnel_thru_httpproxy) { + /* Unless we have asked to tunnel imap operations through the proxy, we + switch and use HTTP operations only */ +#ifndef CURL_DISABLE_HTTP + if(conn->handler == &Curl_handler_imap) + conn->handler = &Curl_handler_imap_proxy; + else { +#ifdef USE_SSL + conn->handler = &Curl_handler_imaps_proxy; +#else + failf(data, "IMAPS not supported!"); + return CURLE_UNSUPPORTED_PROTOCOL; +#endif + } + /* + * We explicitly mark this connection as persistent here as we're doing + * IMAP over HTTP and thus we accidentally avoid setting this value + * otherwise. + */ + conn->bits.close = FALSE; +#else + failf(data, "IMAP over http proxy requires HTTP support built-in!"); + return CURLE_UNSUPPORTED_PROTOCOL; +#endif + } + + data->state.path++; /* don't include the initial slash */ + + return CURLE_OK; +} + +#endif /* CURL_DISABLE_IMAP */ diff --git a/mobicore/common/curl/lib/imap.h b/mobicore/common/curl/lib/imap.h new file mode 100644 index 0000000000000000000000000000000000000000..2f0b62a61464a4c942642d29018f77747c922b63 --- /dev/null +++ b/mobicore/common/curl/lib/imap.h @@ -0,0 +1,55 @@ +#ifndef __IMAP_H +#define __IMAP_H +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) 2009, Daniel Stenberg, , et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at http://curl.haxx.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ***************************************************************************/ + +#include "pingpong.h" + +/**************************************************************************** + * IMAP unique setup + ***************************************************************************/ +typedef enum { + IMAP_STOP, /* do nothing state, stops the state machine */ + IMAP_SERVERGREET, /* waiting for the initial greeting immediately after + a connect */ + IMAP_LOGIN, + IMAP_STARTTLS, + IMAP_SELECT, + IMAP_FETCH, + IMAP_LOGOUT, + IMAP_LAST /* never used */ +} imapstate; + +/* imap_conn is used for struct connection-oriented data in the connectdata + struct */ +struct imap_conn { + struct pingpong pp; + char *mailbox; /* what to FETCH */ + imapstate state; /* always use imap.c:state() to change state! */ + int cmdid; /* id number/index */ + const char *idstr; /* pointer to a string for which to wait for as id */ +}; + +extern const struct Curl_handler Curl_handler_imap; +extern const struct Curl_handler Curl_handler_imaps; + +#endif /* __IMAP_H */ diff --git a/mobicore/common/curl/lib/inet_ntop.c b/mobicore/common/curl/lib/inet_ntop.c new file mode 100644 index 0000000000000000000000000000000000000000..26867f4d26bc98c3a437cc44d354e1ff9feff50d --- /dev/null +++ b/mobicore/common/curl/lib/inet_ntop.c @@ -0,0 +1,216 @@ +/* + * Copyright (C) 1996-2001 Internet Software Consortium. + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM + * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL + * INTERNET SOFTWARE CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, + * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING + * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, + * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION + * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ +/* + * Original code by Paul Vixie. "curlified" by Gisle Vanem. + */ + +#include "setup.h" + +#ifndef HAVE_INET_NTOP + +#ifdef HAVE_SYS_PARAM_H +#include +#endif +#ifdef HAVE_SYS_SOCKET_H +#include +#endif +#ifdef HAVE_NETINET_IN_H +#include +#endif +#ifdef HAVE_ARPA_INET_H +#include +#endif +#include +#include + +#define _MPRINTF_REPLACE /* use our functions only */ +#include + +#include "inet_ntop.h" + +#define IN6ADDRSZ 16 +#define INADDRSZ 4 +#define INT16SZ 2 + +/* + * Format an IPv4 address, more or less like inet_ntoa(). + * + * Returns `dst' (as a const) + * Note: + * - uses no statics + * - takes a unsigned char* not an in_addr as input + */ +static char *inet_ntop4 (const unsigned char *src, char *dst, size_t size) +{ + char tmp[sizeof "255.255.255.255"]; + size_t len; + + DEBUGASSERT(size >= 16); + + tmp[0] = '\0'; + (void)snprintf(tmp, sizeof(tmp), "%d.%d.%d.%d", + ((int)((unsigned char)src[0])) & 0xff, + ((int)((unsigned char)src[1])) & 0xff, + ((int)((unsigned char)src[2])) & 0xff, + ((int)((unsigned char)src[3])) & 0xff); + + len = strlen(tmp); + if(len == 0 || len >= size) + { + SET_ERRNO(ENOSPC); + return (NULL); + } + strcpy(dst, tmp); + return dst; +} + +#ifdef ENABLE_IPV6 +/* + * Convert IPv6 binary address into presentation (printable) format. + */ +static char *inet_ntop6 (const unsigned char *src, char *dst, size_t size) +{ + /* + * Note that int32_t and int16_t need only be "at least" large enough + * to contain a value of the specified size. On some systems, like + * Crays, there is no such thing as an integer variable with 16 bits. + * Keep this in mind if you think this function should have been coded + * to use pointer overlays. All the world's not a VAX. + */ + char tmp[sizeof("ffff:ffff:ffff:ffff:ffff:ffff:255.255.255.255")]; + char *tp; + struct { + long base; + long len; + } best, cur; + unsigned long words[IN6ADDRSZ / INT16SZ]; + int i; + + /* Preprocess: + * Copy the input (bytewise) array into a wordwise array. + * Find the longest run of 0x00's in src[] for :: shorthanding. + */ + memset(words, '\0', sizeof(words)); + for (i = 0; i < IN6ADDRSZ; i++) + words[i/2] |= (src[i] << ((1 - (i % 2)) << 3)); + + best.base = -1; + cur.base = -1; + best.len = 0; + cur.len = 0; + + for (i = 0; i < (IN6ADDRSZ / INT16SZ); i++) + { + if(words[i] == 0) + { + if(cur.base == -1) + cur.base = i, cur.len = 1; + else + cur.len++; + } + else if(cur.base != -1) + { + if(best.base == -1 || cur.len > best.len) + best = cur; + cur.base = -1; + } + } + if((cur.base != -1) && (best.base == -1 || cur.len > best.len)) + best = cur; + if(best.base != -1 && best.len < 2) + best.base = -1; + + /* Format the result. + */ + tp = tmp; + for (i = 0; i < (IN6ADDRSZ / INT16SZ); i++) + { + /* Are we inside the best run of 0x00's? + */ + if(best.base != -1 && i >= best.base && i < (best.base + best.len)) + { + if(i == best.base) + *tp++ = ':'; + continue; + } + + /* Are we following an initial run of 0x00s or any real hex? + */ + if(i != 0) + *tp++ = ':'; + + /* Is this address an encapsulated IPv4? + */ + if(i == 6 && best.base == 0 && + (best.len == 6 || (best.len == 5 && words[5] == 0xffff))) + { + if(!inet_ntop4(src+12, tp, sizeof(tmp) - (tp - tmp))) + { + SET_ERRNO(ENOSPC); + return (NULL); + } + tp += strlen(tp); + break; + } + tp += snprintf(tp, 5, "%lx", words[i]); + } + + /* Was it a trailing run of 0x00's? + */ + if(best.base != -1 && (best.base + best.len) == (IN6ADDRSZ / INT16SZ)) + *tp++ = ':'; + *tp++ = '\0'; + + /* Check for overflow, copy, and we're done. + */ + if((size_t)(tp - tmp) > size) + { + SET_ERRNO(ENOSPC); + return (NULL); + } + strcpy(dst, tmp); + return dst; +} +#endif /* ENABLE_IPV6 */ + +/* + * Convert a network format address to presentation format. + * + * Returns pointer to presentation format address (`buf'). + * Returns NULL on error and errno set with the specific + * error, EAFNOSUPPORT or ENOSPC. + * + * On Windows we store the error in the thread errno, not + * in the winsock error code. This is to avoid loosing the + * actual last winsock error. So use macro ERRNO to fetch the + * errno this funtion sets when returning NULL, not SOCKERRNO. + */ +char *Curl_inet_ntop(int af, const void *src, char *buf, size_t size) +{ + switch (af) { + case AF_INET: + return inet_ntop4((const unsigned char*)src, buf, size); +#ifdef ENABLE_IPV6 + case AF_INET6: + return inet_ntop6((const unsigned char*)src, buf, size); +#endif + default: + SET_ERRNO(EAFNOSUPPORT); + return NULL; + } +} +#endif /* HAVE_INET_NTOP */ diff --git a/mobicore/common/curl/lib/inet_ntop.h b/mobicore/common/curl/lib/inet_ntop.h new file mode 100644 index 0000000000000000000000000000000000000000..8db9775c8f1aa6fa1a06c3c28630f410cd4bb856 --- /dev/null +++ b/mobicore/common/curl/lib/inet_ntop.h @@ -0,0 +1,37 @@ +#ifndef __INET_NTOP_H +#define __INET_NTOP_H +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) 1998 - 2009, Daniel Stenberg, , et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at http://curl.haxx.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ***************************************************************************/ + +#include "setup.h" + +char *Curl_inet_ntop(int af, const void *addr, char *buf, size_t size); + +#ifdef HAVE_INET_NTOP +#ifdef HAVE_ARPA_INET_H +#include +#endif +#define Curl_inet_ntop(af,addr,buf,size) \ + inet_ntop(af,addr,buf,(curl_socklen_t)size) +#endif + +#endif /* __INET_NTOP_H */ diff --git a/mobicore/common/curl/lib/inet_pton.c b/mobicore/common/curl/lib/inet_pton.c new file mode 100644 index 0000000000000000000000000000000000000000..967e30fb117f8368f92e7889dd6384320b67765e --- /dev/null +++ b/mobicore/common/curl/lib/inet_pton.c @@ -0,0 +1,239 @@ +/* This is from the BIND 4.9.4 release, modified to compile by itself */ + +/* Copyright (c) 1996 by Internet Software Consortium. + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS + * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE + * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL + * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR + * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS + * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS + * SOFTWARE. + */ + +#include "setup.h" + +#ifndef HAVE_INET_PTON + +#ifdef HAVE_SYS_PARAM_H +#include +#endif +#ifdef HAVE_SYS_SOCKET_H +#include +#endif +#ifdef HAVE_NETINET_IN_H +#include +#endif +#ifdef HAVE_ARPA_INET_H +#include +#endif +#include +#include + +#include "inet_pton.h" + +#define IN6ADDRSZ 16 +#define INADDRSZ 4 +#define INT16SZ 2 + +/* + * WARNING: Don't even consider trying to compile this on a system where + * sizeof(int) < 4. sizeof(int) > 4 is fine; all the world's not a VAX. + */ + +static int inet_pton4(const char *src, unsigned char *dst); +#ifdef ENABLE_IPV6 +static int inet_pton6(const char *src, unsigned char *dst); +#endif + +/* int + * inet_pton(af, src, dst) + * convert from presentation format (which usually means ASCII printable) + * to network format (which is usually some kind of binary format). + * return: + * 1 if the address was valid for the specified address family + * 0 if the address wasn't valid (`dst' is untouched in this case) + * -1 if some other error occurred (`dst' is untouched in this case, too) + * notice: + * On Windows we store the error in the thread errno, not + * in the winsock error code. This is to avoid loosing the + * actual last winsock error. So use macro ERRNO to fetch the + * errno this funtion sets when returning (-1), not SOCKERRNO. + * author: + * Paul Vixie, 1996. + */ +int +Curl_inet_pton(int af, const char *src, void *dst) +{ + switch (af) { + case AF_INET: + return (inet_pton4(src, (unsigned char *)dst)); +#ifdef ENABLE_IPV6 + case AF_INET6: + return (inet_pton6(src, (unsigned char *)dst)); +#endif + default: + SET_ERRNO(EAFNOSUPPORT); + return (-1); + } + /* NOTREACHED */ +} + +/* int + * inet_pton4(src, dst) + * like inet_aton() but without all the hexadecimal and shorthand. + * return: + * 1 if `src' is a valid dotted quad, else 0. + * notice: + * does not touch `dst' unless it's returning 1. + * author: + * Paul Vixie, 1996. + */ +static int +inet_pton4(const char *src, unsigned char *dst) +{ + static const char digits[] = "0123456789"; + int saw_digit, octets, ch; + unsigned char tmp[INADDRSZ], *tp; + + saw_digit = 0; + octets = 0; + tp = tmp; + *tp = 0; + while((ch = *src++) != '\0') { + const char *pch; + + if((pch = strchr(digits, ch)) != NULL) { + unsigned int val = *tp * 10 + (unsigned int)(pch - digits); + + if(saw_digit && *tp == 0) + return (0); + if(val > 255) + return (0); + *tp = (unsigned char)val; + if(! saw_digit) { + if(++octets > 4) + return (0); + saw_digit = 1; + } + } + else if(ch == '.' && saw_digit) { + if(octets == 4) + return (0); + *++tp = 0; + saw_digit = 0; + } + else + return (0); + } + if(octets < 4) + return (0); + memcpy(dst, tmp, INADDRSZ); + return (1); +} + +#ifdef ENABLE_IPV6 +/* int + * inet_pton6(src, dst) + * convert presentation level address to network order binary form. + * return: + * 1 if `src' is a valid [RFC1884 2.2] address, else 0. + * notice: + * (1) does not touch `dst' unless it's returning 1. + * (2) :: in a full address is silently ignored. + * credit: + * inspired by Mark Andrews. + * author: + * Paul Vixie, 1996. + */ +static int +inet_pton6(const char *src, unsigned char *dst) +{ + static const char xdigits_l[] = "0123456789abcdef", + xdigits_u[] = "0123456789ABCDEF"; + unsigned char tmp[IN6ADDRSZ], *tp, *endp, *colonp; + const char *xdigits, *curtok; + int ch, saw_xdigit; + size_t val; + + memset((tp = tmp), 0, IN6ADDRSZ); + endp = tp + IN6ADDRSZ; + colonp = NULL; + /* Leading :: requires some special handling. */ + if(*src == ':') + if(*++src != ':') + return (0); + curtok = src; + saw_xdigit = 0; + val = 0; + while((ch = *src++) != '\0') { + const char *pch; + + if((pch = strchr((xdigits = xdigits_l), ch)) == NULL) + pch = strchr((xdigits = xdigits_u), ch); + if(pch != NULL) { + val <<= 4; + val |= (pch - xdigits); + if(++saw_xdigit > 4) + return (0); + continue; + } + if(ch == ':') { + curtok = src; + if(!saw_xdigit) { + if(colonp) + return (0); + colonp = tp; + continue; + } + if(tp + INT16SZ > endp) + return (0); + *tp++ = (unsigned char) (val >> 8) & 0xff; + *tp++ = (unsigned char) val & 0xff; + saw_xdigit = 0; + val = 0; + continue; + } + if(ch == '.' && ((tp + INADDRSZ) <= endp) && + inet_pton4(curtok, tp) > 0) { + tp += INADDRSZ; + saw_xdigit = 0; + break; /* '\0' was seen by inet_pton4(). */ + } + return (0); + } + if(saw_xdigit) { + if(tp + INT16SZ > endp) + return (0); + *tp++ = (unsigned char) (val >> 8) & 0xff; + *tp++ = (unsigned char) val & 0xff; + } + if(colonp != NULL) { + /* + * Since some memmove()'s erroneously fail to handle + * overlapping regions, we'll do the shift by hand. + */ + const ssize_t n = tp - colonp; + ssize_t i; + + if(tp == endp) + return (0); + for (i = 1; i <= n; i++) { + *(endp - i) = *(colonp + n - i); + *(colonp + n - i) = 0; + } + tp = endp; + } + if(tp != endp) + return (0); + memcpy(dst, tmp, IN6ADDRSZ); + return (1); +} +#endif /* ENABLE_IPV6 */ + +#endif /* HAVE_INET_PTON */ diff --git a/mobicore/common/curl/lib/inet_pton.h b/mobicore/common/curl/lib/inet_pton.h new file mode 100644 index 0000000000000000000000000000000000000000..d53fddff88d0210ba7b137026159773ec88a5442 --- /dev/null +++ b/mobicore/common/curl/lib/inet_pton.h @@ -0,0 +1,36 @@ +#ifndef __INET_PTON_H +#define __INET_PTON_H +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) 1998 - 2005, Daniel Stenberg, , et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at http://curl.haxx.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ***************************************************************************/ + +#include "setup.h" + +int Curl_inet_pton(int, const char *, void *); + +#ifdef HAVE_INET_PTON +#ifdef HAVE_ARPA_INET_H +#include +#endif +#define Curl_inet_pton(x,y,z) inet_pton(x,y,z) +#endif + +#endif /* __INET_PTON_H */ diff --git a/mobicore/common/curl/lib/krb4.c b/mobicore/common/curl/lib/krb4.c new file mode 100644 index 0000000000000000000000000000000000000000..2895cedaa3ffa97099670915c11fb97c62c8c120 --- /dev/null +++ b/mobicore/common/curl/lib/krb4.c @@ -0,0 +1,431 @@ +/* This source code was modified by Martin Hedenfalk for + * use in Curl. Martin's latest changes were done 2000-09-18. + * + * It has since been patched away like a madman by Daniel Stenberg to make it + * better applied to curl conditions, and to make it not use globals, pollute + * name space and more. + * + * Copyright (c) 1995, 1996, 1997, 1998, 1999 Kungliga Tekniska Hgskolan + * (Royal Institute of Technology, Stockholm, Sweden). + * Copyright (c) 2004 - 2010 Daniel Stenberg + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of the Institute nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + */ + +#include "setup.h" + +#ifndef CURL_DISABLE_FTP +#ifdef HAVE_KRB4 + +#include +#ifdef HAVE_NETDB_H +#include +#endif +#include +#include +#include + +#ifdef HAVE_UNISTD_H +#include /* for getpid() */ +#endif + +#include "urldata.h" +#include "curl_base64.h" +#include "ftp.h" +#include "sendf.h" +#include "krb4.h" +#include "inet_ntop.h" +#include "curl_memory.h" + +/* The last #include file should be: */ +#include "memdebug.h" + +#define LOCAL_ADDR (&conn->local_addr) +#define REMOTE_ADDR conn->ip_addr->ai_addr +#define myctladdr LOCAL_ADDR +#define hisctladdr REMOTE_ADDR + +struct krb4_data { + des_cblock key; + des_key_schedule schedule; + char name[ANAME_SZ]; + char instance[INST_SZ]; + char realm[REALM_SZ]; +}; + +#ifndef HAVE_STRLCPY +/* if it ever goes non-static, make it Curl_ prefixed! */ +static size_t +strlcpy (char *dst, const char *src, size_t dst_sz) +{ + size_t n; + char *p; + + for (p = dst, n = 0; + n + 1 < dst_sz && *src != '\0'; + ++p, ++src, ++n) + *p = *src; + *p = '\0'; + if(*src == '\0') + return n; + else + return n + strlen (src); +} +#else +size_t strlcpy (char *dst, const char *src, size_t dst_sz); +#endif + +static int +krb4_check_prot(void *app_data, int level) +{ + app_data = NULL; /* prevent compiler warning */ + if(level == PROT_CONFIDENTIAL) + return -1; + return 0; +} + +static int +krb4_decode(void *app_data, void *buf, int len, int level, + struct connectdata *conn) +{ + MSG_DAT m; + int e; + struct krb4_data *d = app_data; + + if(level == PROT_SAFE) + e = krb_rd_safe(buf, len, &d->key, + (struct sockaddr_in *)REMOTE_ADDR, + (struct sockaddr_in *)LOCAL_ADDR, &m); + else + e = krb_rd_priv(buf, len, d->schedule, &d->key, + (struct sockaddr_in *)REMOTE_ADDR, + (struct sockaddr_in *)LOCAL_ADDR, &m); + if(e) { + struct SessionHandle *data = conn->data; + infof(data, "krb4_decode: %s\n", krb_get_err_text(e)); + return -1; + } + memmove(buf, m.app_data, m.app_length); + return m.app_length; +} + +static int +krb4_overhead(void *app_data, int level, int len) +{ + /* no arguments are used, just init them to prevent compiler warnings */ + app_data = NULL; + level = 0; + len = 0; + return 31; +} + +static int +krb4_encode(void *app_data, const void *from, int length, int level, void **to, + struct connectdata *conn) +{ + struct krb4_data *d = app_data; + *to = malloc(length + 31); + if(!*to) + return -1; + if(level == PROT_SAFE) + /* NOTE that the void* cast is safe, krb_mk_safe/priv don't modify the + * input buffer + */ + return krb_mk_safe((void*)from, *to, length, &d->key, + (struct sockaddr_in *)LOCAL_ADDR, + (struct sockaddr_in *)REMOTE_ADDR); + else if(level == PROT_PRIVATE) + return krb_mk_priv((void*)from, *to, length, d->schedule, &d->key, + (struct sockaddr_in *)LOCAL_ADDR, + (struct sockaddr_in *)REMOTE_ADDR); + else + return -1; +} + +static int +mk_auth(struct krb4_data *d, KTEXT adat, + const char *service, char *host, int checksum) +{ + int ret; + CREDENTIALS cred; + char sname[SNAME_SZ], inst[INST_SZ], realm[REALM_SZ]; + + strlcpy(sname, service, sizeof(sname)); + strlcpy(inst, krb_get_phost(host), sizeof(inst)); + strlcpy(realm, krb_realmofhost(host), sizeof(realm)); + ret = krb_mk_req(adat, sname, inst, realm, checksum); + if(ret) + return ret; + strlcpy(sname, service, sizeof(sname)); + strlcpy(inst, krb_get_phost(host), sizeof(inst)); + strlcpy(realm, krb_realmofhost(host), sizeof(realm)); + ret = krb_get_cred(sname, inst, realm, &cred); + memmove(&d->key, &cred.session, sizeof(des_cblock)); + des_key_sched(&d->key, d->schedule); + memset(&cred, 0, sizeof(cred)); + return ret; +} + +#ifdef HAVE_KRB_GET_OUR_IP_FOR_REALM +int krb_get_our_ip_for_realm(char *, struct in_addr *); +#endif + +static int +krb4_auth(void *app_data, struct connectdata *conn) +{ + int ret; + char *p; + unsigned char *ptr; + size_t len; + KTEXT_ST adat; + MSG_DAT msg_data; + int checksum; + u_int32_t cs; + struct krb4_data *d = app_data; + char *host = conn->host.name; + ssize_t nread; + int l = sizeof(conn->local_addr); + struct SessionHandle *data = conn->data; + CURLcode result; + + if(getsockname(conn->sock[FIRSTSOCKET], + (struct sockaddr *)LOCAL_ADDR, &l) < 0) + perror("getsockname()"); + + checksum = getpid(); + ret = mk_auth(d, &adat, "ftp", host, checksum); + if(ret == KDC_PR_UNKNOWN) + ret = mk_auth(d, &adat, "rcmd", host, checksum); + if(ret) { + infof(data, "%s\n", krb_get_err_text(ret)); + return AUTH_CONTINUE; + } + +#ifdef HAVE_KRB_GET_OUR_IP_FOR_REALM + if(krb_get_config_bool("nat_in_use")) { + struct sockaddr_in *localaddr = (struct sockaddr_in *)LOCAL_ADDR; + struct in_addr natAddr; + + if(krb_get_our_ip_for_realm(krb_realmofhost(host), + &natAddr) != KSUCCESS + && krb_get_our_ip_for_realm(NULL, &natAddr) != KSUCCESS) + infof(data, "Can't get address for realm %s\n", + krb_realmofhost(host)); + else { + if(natAddr.s_addr != localaddr->sin_addr.s_addr) { + char addr_buf[128]; + if(Curl_inet_ntop(AF_INET, natAddr, addr_buf, sizeof(addr_buf))) + infof(data, "Using NAT IP address (%s) for kerberos 4\n", addr_buf); + localaddr->sin_addr = natAddr; + } + } + } +#endif + + if(Curl_base64_encode(conn->data, (char *)adat.dat, adat.length, &p) < 1) { + Curl_failf(data, "Out of memory base64-encoding"); + return AUTH_CONTINUE; + } + + result = Curl_ftpsendf(conn, "ADAT %s", p); + + free(p); + + if(result) + return -2; + + if(Curl_GetFTPResponse(&nread, conn, NULL)) + return -1; + + if(data->state.buffer[0] != '2'){ + Curl_failf(data, "Server didn't accept auth data"); + return AUTH_ERROR; + } + + p = strstr(data->state.buffer, "ADAT="); + if(!p) { + Curl_failf(data, "Remote host didn't send adat reply"); + return AUTH_ERROR; + } + p += 5; + len = Curl_base64_decode(p, &ptr); + if(len > sizeof(adat.dat)-1) { + free(ptr); + len=0; + } + if(!len || !ptr) { + Curl_failf(data, "Failed to decode base64 from server"); + return AUTH_ERROR; + } + memcpy((char *)adat.dat, ptr, len); + free(ptr); + adat.length = len; + ret = krb_rd_safe(adat.dat, adat.length, &d->key, + (struct sockaddr_in *)hisctladdr, + (struct sockaddr_in *)myctladdr, &msg_data); + if(ret) { + Curl_failf(data, "Error reading reply from server: %s", + krb_get_err_text(ret)); + return AUTH_ERROR; + } + krb_get_int(msg_data.app_data, &cs, 4, 0); + if(cs - checksum != 1) { + Curl_failf(data, "Bad checksum returned from server"); + return AUTH_ERROR; + } + return AUTH_OK; +} + +struct Curl_sec_client_mech Curl_krb4_client_mech = { + "KERBEROS_V4", + sizeof(struct krb4_data), + NULL, /* init */ + krb4_auth, + NULL, /* end */ + krb4_check_prot, + krb4_overhead, + krb4_encode, + krb4_decode +}; + +static enum protection_level +krb4_set_command_prot(struct connectdata *conn, enum protection_level level) +{ + enum protection_level old = conn->command_prot; + DEBUGASSERT(level > PROT_NONE && level < PROT_LAST); + conn->command_prot = level; + return old; +} + +CURLcode Curl_krb_kauth(struct connectdata *conn) +{ + des_cblock key; + des_key_schedule schedule; + KTEXT_ST tkt, tktcopy; + char *name; + char *p; + char passwd[100]; + size_t tmp; + ssize_t nread; + enum protection_level save; + CURLcode result; + unsigned char *ptr; + + save = krb4_set_command_prot(conn, PROT_PRIVATE); + + result = Curl_ftpsendf(conn, "SITE KAUTH %s", conn->user); + + if(result) + return result; + + result = Curl_GetFTPResponse(&nread, conn, NULL); + if(result) + return result; + + if(conn->data->state.buffer[0] != '3'){ + krb4_set_command_prot(conn, save); + return CURLE_FTP_WEIRD_SERVER_REPLY; + } + + p = strstr(conn->data->state.buffer, "T="); + if(!p) { + Curl_failf(conn->data, "Bad reply from server"); + krb4_set_command_prot(conn, save); + return CURLE_FTP_WEIRD_SERVER_REPLY; + } + + p += 2; + tmp = Curl_base64_decode(p, &ptr); + if(tmp >= sizeof(tkt.dat)) { + free(ptr); + tmp=0; + } + if(!tmp || !ptr) { + Curl_failf(conn->data, "Failed to decode base64 in reply"); + krb4_set_command_prot(conn, save); + return CURLE_FTP_WEIRD_SERVER_REPLY; + } + memcpy((char *)tkt.dat, ptr, tmp); + free(ptr); + tkt.length = tmp; + tktcopy.length = tkt.length; + + p = strstr(conn->data->state.buffer, "P="); + if(!p) { + Curl_failf(conn->data, "Bad reply from server"); + krb4_set_command_prot(conn, save); + return CURLE_FTP_WEIRD_SERVER_REPLY; + } + name = p + 2; + for(; *p && *p != ' ' && *p != '\r' && *p != '\n'; p++); + *p = 0; + + des_string_to_key (conn->passwd, &key); + des_key_sched(&key, schedule); + + des_pcbc_encrypt((void *)tkt.dat, (void *)tktcopy.dat, + tkt.length, + schedule, &key, DES_DECRYPT); + if(strcmp ((char*)tktcopy.dat + 8, + KRB_TICKET_GRANTING_TICKET) != 0) { + afs_string_to_key(passwd, + krb_realmofhost(conn->host.name), + &key); + des_key_sched(&key, schedule); + des_pcbc_encrypt((void *)tkt.dat, (void *)tktcopy.dat, + tkt.length, + schedule, &key, DES_DECRYPT); + } + memset(key, 0, sizeof(key)); + memset(schedule, 0, sizeof(schedule)); + memset(passwd, 0, sizeof(passwd)); + if(Curl_base64_encode(conn->data, (char *)tktcopy.dat, tktcopy.length, &p) + < 1) { + failf(conn->data, "Out of memory base64-encoding."); + krb4_set_command_prot(conn, save); + return CURLE_OUT_OF_MEMORY; + } + memset (tktcopy.dat, 0, tktcopy.length); + + result = Curl_ftpsendf(conn, "SITE KAUTH %s %s", name, p); + free(p); + if(result) + return result; + + result = Curl_GetFTPResponse(&nread, conn, NULL); + if(result) + return result; + krb4_set_command_prot(conn, save); + + return CURLE_OK; +} + +#endif /* HAVE_KRB4 */ +#endif /* CURL_DISABLE_FTP */ diff --git a/mobicore/common/curl/lib/krb4.h b/mobicore/common/curl/lib/krb4.h new file mode 100644 index 0000000000000000000000000000000000000000..b3b5ea76329224213a0e75d36e2e95569d7004d0 --- /dev/null +++ b/mobicore/common/curl/lib/krb4.h @@ -0,0 +1,55 @@ +#ifndef __KRB4_H +#define __KRB4_H +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) 1998 - 2010, Daniel Stenberg, , et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at http://curl.haxx.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ***************************************************************************/ + +struct Curl_sec_client_mech { + const char *name; + size_t size; + int (*init)(void *); + int (*auth)(void *, struct connectdata *); + void (*end)(void *); + int (*check_prot)(void *, int); + int (*overhead)(void *, int, int); + int (*encode)(void *, const void*, int, int, void**, struct connectdata *); + int (*decode)(void *, void*, int, int, struct connectdata *); +}; + + +#define AUTH_OK 0 +#define AUTH_CONTINUE 1 +#define AUTH_ERROR 2 + +#ifdef HAVE_KRB4 +extern struct Curl_sec_client_mech Curl_krb4_client_mech; +#endif +#ifdef HAVE_GSSAPI +extern struct Curl_sec_client_mech Curl_krb5_client_mech; +#endif + +CURLcode Curl_krb_kauth(struct connectdata *conn); +int Curl_sec_read_msg (struct connectdata *conn, char *, enum protection_level); +void Curl_sec_end (struct connectdata *); +CURLcode Curl_sec_login (struct connectdata *); +int Curl_sec_request_prot (struct connectdata *conn, const char *level); + +#endif diff --git a/mobicore/common/curl/lib/krb5.c b/mobicore/common/curl/lib/krb5.c new file mode 100644 index 0000000000000000000000000000000000000000..cedab1657ecc2c3a561f7a3c8bf2880fab51f863 --- /dev/null +++ b/mobicore/common/curl/lib/krb5.c @@ -0,0 +1,349 @@ +/* GSSAPI/krb5 support for FTP - loosely based on old krb4.c + * + * Copyright (c) 1995, 1996, 1997, 1998, 1999, 2010 Kungliga Tekniska Hgskolan + * (Royal Institute of Technology, Stockholm, Sweden). + * Copyright (c) 2004 - 2009 Daniel Stenberg + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of the Institute nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. */ + +#include "setup.h" + +#ifndef CURL_DISABLE_FTP +#ifdef HAVE_GSSAPI + +#ifdef HAVE_OLD_GSSMIT +#define GSS_C_NT_HOSTBASED_SERVICE gss_nt_service_name +#endif + +#include +#ifdef HAVE_NETDB_H +#include +#endif +#include + +#ifdef HAVE_GSSGNU +# include +#elif defined HAVE_GSSMIT + /* MIT style */ +# include +# include +# include +#else + /* Heimdal-style */ +# include +#endif + +#include "urldata.h" +#include "curl_base64.h" +#include "ftp.h" +#include "sendf.h" +#include "krb4.h" +#include "curl_memory.h" + +#define _MPRINTF_REPLACE /* use our functions only */ +#include + +/* The last #include file should be: */ +#include "memdebug.h" + +#define LOCAL_ADDR (&conn->local_addr) +#define REMOTE_ADDR conn->ip_addr->ai_addr + +static int +krb5_init(void *app_data) +{ + gss_ctx_id_t *context = app_data; + /* Make sure our context is initialized for krb5_end. */ + *context = GSS_C_NO_CONTEXT; + return 0; +} + +static int +krb5_check_prot(void *app_data, int level) +{ + (void)app_data; /* unused */ + if(level == PROT_CONFIDENTIAL) + return -1; + return 0; +} + +static int +krb5_decode(void *app_data, void *buf, int len, int level, + struct connectdata *conn) +{ + gss_ctx_id_t *context = app_data; + OM_uint32 maj, min; + gss_buffer_desc enc, dec; + + /* shut gcc up */ + level = 0; + conn = NULL; + + enc.value = buf; + enc.length = len; + maj = gss_unseal(&min, *context, &enc, &dec, NULL, NULL); + if(maj != GSS_S_COMPLETE) { + if(len >= 4) + strcpy(buf, "599 "); + return -1; + } + + memcpy(buf, dec.value, dec.length); + len = dec.length; + gss_release_buffer(&min, &dec); + + return len; +} + +static int +krb5_overhead(void *app_data, int level, int len) +{ + /* no arguments are used, just init them to prevent compiler warnings */ + app_data = NULL; + level = 0; + len = 0; + return 0; +} + +static int +krb5_encode(void *app_data, const void *from, int length, int level, void **to, + struct connectdata *conn) +{ + gss_ctx_id_t *context = app_data; + gss_buffer_desc dec, enc; + OM_uint32 maj, min; + int state; + int len; + + /* shut gcc up */ + conn = NULL; + + /* NOTE that the cast is safe, neither of the krb5, gnu gss and heimdal + * libraries modify the input buffer in gss_seal() + */ + dec.value = (void*)from; + dec.length = length; + maj = gss_seal(&min, *context, + level == PROT_PRIVATE, + GSS_C_QOP_DEFAULT, + &dec, &state, &enc); + + if(maj != GSS_S_COMPLETE) + return -1; + + /* malloc a new buffer, in case gss_release_buffer doesn't work as expected */ + *to = malloc(enc.length); + if(!*to) + return -1; + memcpy(*to, enc.value, enc.length); + len = enc.length; + gss_release_buffer(&min, &enc); + return len; +} + +static int +krb5_auth(void *app_data, struct connectdata *conn) +{ + int ret = AUTH_OK; + char *p; + const char *host = conn->host.name; + ssize_t nread; + curl_socklen_t l = sizeof(conn->local_addr); + struct SessionHandle *data = conn->data; + CURLcode result; + const char *service = "ftp", *srv_host = "host"; + gss_buffer_desc input_buffer, output_buffer, _gssresp, *gssresp; + OM_uint32 maj, min; + gss_name_t gssname; + gss_ctx_id_t *context = app_data; + struct gss_channel_bindings_struct chan; + + if(getsockname(conn->sock[FIRSTSOCKET], + (struct sockaddr *)LOCAL_ADDR, &l) < 0) + perror("getsockname()"); + + chan.initiator_addrtype = GSS_C_AF_INET; + chan.initiator_address.length = l - 4; + chan.initiator_address.value = + &((struct sockaddr_in *)LOCAL_ADDR)->sin_addr.s_addr; + chan.acceptor_addrtype = GSS_C_AF_INET; + chan.acceptor_address.length = l - 4; + chan.acceptor_address.value = + &((struct sockaddr_in *)REMOTE_ADDR)->sin_addr.s_addr; + chan.application_data.length = 0; + chan.application_data.value = NULL; + + /* this loop will execute twice (once for service, once for host) */ + while(1) { + /* this really shouldn't be repeated here, but can't help it */ + if(service == srv_host) { + result = Curl_ftpsendf(conn, "AUTH GSSAPI"); + + if(result) + return -2; + if(Curl_GetFTPResponse(&nread, conn, NULL)) + return -1; + + if(data->state.buffer[0] != '3') + return -1; + } + + input_buffer.value = data->state.buffer; + input_buffer.length = snprintf(input_buffer.value, BUFSIZE, "%s@%s", + service, host); + maj = gss_import_name(&min, &input_buffer, GSS_C_NT_HOSTBASED_SERVICE, + &gssname); + if(maj != GSS_S_COMPLETE) { + gss_release_name(&min, &gssname); + if(service == srv_host) { + Curl_failf(data, "Error importing service name %s", input_buffer.value); + return AUTH_ERROR; + } + service = srv_host; + continue; + } + /* We pass NULL as |output_name_type| to avoid a leak. */ + gss_display_name(&min, gssname, &output_buffer, NULL); + Curl_infof(data, "Trying against %s\n", output_buffer.value); + gssresp = GSS_C_NO_BUFFER; + *context = GSS_C_NO_CONTEXT; + + do { + /* Release the buffer at each iteration to avoid leaking: the first time + we are releasing the memory from gss_display_name. The last item is + taken care by a final gss_release_buffer. */ + gss_release_buffer(&min, &output_buffer); + ret = AUTH_OK; + maj = gss_init_sec_context(&min, + GSS_C_NO_CREDENTIAL, + context, + gssname, + GSS_C_NO_OID, + GSS_C_MUTUAL_FLAG | GSS_C_REPLAY_FLAG, + 0, + &chan, + gssresp, + NULL, + &output_buffer, + NULL, + NULL); + + if(gssresp) { + free(_gssresp.value); + gssresp = NULL; + } + + if(GSS_ERROR(maj)) { + Curl_infof(data, "Error creating security context\n"); + ret = AUTH_ERROR; + break; + } + + if(output_buffer.length != 0) { + if(Curl_base64_encode(data, (char *)output_buffer.value, + output_buffer.length, &p) < 1) { + Curl_infof(data, "Out of memory base64-encoding\n"); + ret = AUTH_CONTINUE; + break; + } + + result = Curl_ftpsendf(conn, "ADAT %s", p); + + free(p); + + if(result) { + ret = -2; + break; + } + + if(Curl_GetFTPResponse(&nread, conn, NULL)) { + ret = -1; + break; + } + + if(data->state.buffer[0] != '2' && data->state.buffer[0] != '3'){ + Curl_infof(data, "Server didn't accept auth data\n"); + ret = AUTH_ERROR; + break; + } + + p = data->state.buffer + 4; + p = strstr(p, "ADAT="); + if(p) { + _gssresp.length = Curl_base64_decode(p + 5, (unsigned char **) + &_gssresp.value); + if(_gssresp.length < 1) { + Curl_failf(data, "Out of memory base64-encoding\n"); + ret = AUTH_CONTINUE; + break; + } + } + + gssresp = &_gssresp; + } + } while(maj == GSS_S_CONTINUE_NEEDED); + + gss_release_name(&min, &gssname); + gss_release_buffer(&min, &output_buffer); + + if(gssresp) + free(_gssresp.value); + + if(ret == AUTH_OK || service == srv_host) + return ret; + + service = srv_host; + } + return ret; +} + +static void krb5_end(void *app_data) +{ + OM_uint32 maj, min; + gss_ctx_id_t *context = app_data; + if (*context != GSS_C_NO_CONTEXT) { + maj = gss_delete_sec_context(&min, context, GSS_C_NO_BUFFER); + DEBUGASSERT(maj == GSS_S_COMPLETE); + } +} + +struct Curl_sec_client_mech Curl_krb5_client_mech = { + "GSSAPI", + sizeof(gss_ctx_id_t), + krb5_init, + krb5_auth, + krb5_end, + krb5_check_prot, + krb5_overhead, + krb5_encode, + krb5_decode +}; + +#endif /* HAVE_GSSAPI */ +#endif /* CURL_DISABLE_FTP */ diff --git a/mobicore/common/curl/lib/ldap.c b/mobicore/common/curl/lib/ldap.c new file mode 100644 index 0000000000000000000000000000000000000000..529e45212732f7940c7af60dba60ae9555f7d110 --- /dev/null +++ b/mobicore/common/curl/lib/ldap.c @@ -0,0 +1,722 @@ +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) 1998 - 2010, Daniel Stenberg, , et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at http://curl.haxx.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ***************************************************************************/ + +#include "setup.h" + +#if !defined(CURL_DISABLE_LDAP) && !defined(USE_OPENLDAP) + +/* + * Notice that USE_OPENLDAP is only a source code selection switch. When + * libcurl is built with USE_OPENLDAP defined the libcurl source code that + * gets compiled is the code from openldap.c, otherwise the code that gets + * compiled is the code from ldap.c. + * + * When USE_OPENLDAP is defined a recent version of the OpenLDAP library + * might be required for compilation and runtime. In order to use ancient + * OpenLDAP library versions, USE_OPENLDAP shall not be defined. + */ + +/* -- WIN32 approved -- */ +#include +#include +#include +#include +#include +#include + +#ifdef CURL_LDAP_WIN /* Use Windows LDAP implementation. */ +# include +# ifndef LDAP_VENDOR_NAME +# error Your Platform SDK is NOT sufficient for LDAP support! Update your Platform SDK, or disable LDAP support! +# else +# include +# endif +#else +# define LDAP_DEPRECATED 1 /* Be sure ldap_init() is defined. */ +# ifdef HAVE_LBER_H +# include +# endif +# include +# if (defined(HAVE_LDAP_SSL) && defined(HAVE_LDAP_SSL_H)) +# include +# endif /* HAVE_LDAP_SSL && HAVE_LDAP_SSL_H */ +#endif + +#ifdef HAVE_UNISTD_H +# include +#endif + +#include "urldata.h" +#include +#include "sendf.h" +#include "escape.h" +#include "progress.h" +#include "transfer.h" +#include "strequal.h" +#include "strtok.h" +#include "curl_ldap.h" +#include "curl_memory.h" +#include "curl_base64.h" +#include "rawstr.h" + +#define _MPRINTF_REPLACE /* use our functions only */ +#include + +#include "memdebug.h" + +#ifndef HAVE_LDAP_URL_PARSE + +/* Use our own implementation. */ + +typedef struct { + char *lud_host; + int lud_port; + char *lud_dn; + char **lud_attrs; + int lud_scope; + char *lud_filter; + char **lud_exts; +} CURL_LDAPURLDesc; + +#undef LDAPURLDesc +#define LDAPURLDesc CURL_LDAPURLDesc + +static int _ldap_url_parse (const struct connectdata *conn, + LDAPURLDesc **ludp); +static void _ldap_free_urldesc (LDAPURLDesc *ludp); + +#undef ldap_free_urldesc +#define ldap_free_urldesc _ldap_free_urldesc +#endif + +#ifdef DEBUG_LDAP + #define LDAP_TRACE(x) do { \ + _ldap_trace ("%u: ", __LINE__); \ + _ldap_trace x; \ + } while(0) + + static void _ldap_trace (const char *fmt, ...); +#else + #define LDAP_TRACE(x) ((void)0) +#endif + + +static CURLcode Curl_ldap(struct connectdata *conn, bool *done); + +/* + * LDAP protocol handler. + */ + +const struct Curl_handler Curl_handler_ldap = { + "LDAP", /* scheme */ + ZERO_NULL, /* setup_connection */ + Curl_ldap, /* do_it */ + ZERO_NULL, /* done */ + ZERO_NULL, /* do_more */ + ZERO_NULL, /* connect_it */ + ZERO_NULL, /* connecting */ + ZERO_NULL, /* doing */ + ZERO_NULL, /* proto_getsock */ + ZERO_NULL, /* doing_getsock */ + ZERO_NULL, /* perform_getsock */ + ZERO_NULL, /* disconnect */ + PORT_LDAP, /* defport */ + PROT_LDAP /* protocol */ +}; + +#ifdef HAVE_LDAP_SSL +/* + * LDAPS protocol handler. + */ + +const struct Curl_handler Curl_handler_ldaps = { + "LDAPS", /* scheme */ + ZERO_NULL, /* setup_connection */ + Curl_ldap, /* do_it */ + ZERO_NULL, /* done */ + ZERO_NULL, /* do_more */ + ZERO_NULL, /* connect_it */ + ZERO_NULL, /* connecting */ + ZERO_NULL, /* doing */ + ZERO_NULL, /* proto_getsock */ + ZERO_NULL, /* doing_getsock */ + ZERO_NULL, /* perform_getsock */ + ZERO_NULL, /* disconnect */ + PORT_LDAPS, /* defport */ + PROT_LDAP | PROT_SSL /* protocol */ +}; +#endif + + +static CURLcode Curl_ldap(struct connectdata *conn, bool *done) +{ + CURLcode status = CURLE_OK; + int rc = 0; + LDAP *server = NULL; + LDAPURLDesc *ludp = NULL; + LDAPMessage *result = NULL; + LDAPMessage *entryIterator; + int num = 0; + struct SessionHandle *data=conn->data; + int ldap_proto = LDAP_VERSION3; + int ldap_ssl = 0; + char *val_b64; + size_t val_b64_sz; + curl_off_t dlsize=0; +#ifdef LDAP_OPT_NETWORK_TIMEOUT + struct timeval ldap_timeout = {10,0}; /* 10 sec connection/search timeout */ +#endif + + *done = TRUE; /* unconditionally */ + infof(data, "LDAP local: LDAP Vendor = %s ; LDAP Version = %d\n", + LDAP_VENDOR_NAME, LDAP_VENDOR_VERSION); + infof(data, "LDAP local: %s\n", data->change.url); + +#ifdef HAVE_LDAP_URL_PARSE + rc = ldap_url_parse(data->change.url, &ludp); +#else + rc = _ldap_url_parse(conn, &ludp); +#endif + if(rc != 0) { + failf(data, "LDAP local: %s", ldap_err2string(rc)); + status = CURLE_LDAP_INVALID_URL; + goto quit; + } + + /* Get the URL scheme ( either ldap or ldaps ) */ + if(conn->protocol & PROT_SSL) + ldap_ssl = 1; + infof(data, "LDAP local: trying to establish %s connection\n", + ldap_ssl ? "encrypted" : "cleartext"); + +#ifdef LDAP_OPT_NETWORK_TIMEOUT + ldap_set_option(NULL, LDAP_OPT_NETWORK_TIMEOUT, &ldap_timeout); +#endif + ldap_set_option(NULL, LDAP_OPT_PROTOCOL_VERSION, &ldap_proto); + + if(ldap_ssl) { +#ifdef HAVE_LDAP_SSL +#ifdef CURL_LDAP_WIN + /* Win32 LDAP SDK doesnt support insecure mode without CA! */ + server = ldap_sslinit(conn->host.name, (int)conn->port, 1); + ldap_set_option(server, LDAP_OPT_SSL, LDAP_OPT_ON); +#else + int ldap_option; + char* ldap_ca = data->set.str[STRING_SSL_CAFILE]; +#if defined(CURL_HAS_NOVELL_LDAPSDK) + rc = ldapssl_client_init(NULL, NULL); + if(rc != LDAP_SUCCESS) { + failf(data, "LDAP local: ldapssl_client_init %s", ldap_err2string(rc)); + status = CURLE_SSL_CERTPROBLEM; + goto quit; + } + if(data->set.ssl.verifypeer) { + /* Novell SDK supports DER or BASE64 files. */ + int cert_type = LDAPSSL_CERT_FILETYPE_B64; + if((data->set.str[STRING_CERT_TYPE]) && + (Curl_raw_equal(data->set.str[STRING_CERT_TYPE], "DER"))) + cert_type = LDAPSSL_CERT_FILETYPE_DER; + if(!ldap_ca) { + failf(data, "LDAP local: ERROR %s CA cert not set!", + (cert_type == LDAPSSL_CERT_FILETYPE_DER ? "DER" : "PEM")); + status = CURLE_SSL_CERTPROBLEM; + goto quit; + } + infof(data, "LDAP local: using %s CA cert '%s'\n", + (cert_type == LDAPSSL_CERT_FILETYPE_DER ? "DER" : "PEM"), + ldap_ca); + rc = ldapssl_add_trusted_cert(ldap_ca, cert_type); + if(rc != LDAP_SUCCESS) { + failf(data, "LDAP local: ERROR setting %s CA cert: %s", + (cert_type == LDAPSSL_CERT_FILETYPE_DER ? "DER" : "PEM"), + ldap_err2string(rc)); + status = CURLE_SSL_CERTPROBLEM; + goto quit; + } + ldap_option = LDAPSSL_VERIFY_SERVER; + } else { + ldap_option = LDAPSSL_VERIFY_NONE; + } + rc = ldapssl_set_verify_mode(ldap_option); + if(rc != LDAP_SUCCESS) { + failf(data, "LDAP local: ERROR setting cert verify mode: %s", + ldap_err2string(rc)); + status = CURLE_SSL_CERTPROBLEM; + goto quit; + } + server = ldapssl_init(conn->host.name, (int)conn->port, 1); + if(server == NULL) { + failf(data, "LDAP local: Cannot connect to %s:%hu", + conn->host.name, conn->port); + status = CURLE_COULDNT_CONNECT; + goto quit; + } +#elif defined(LDAP_OPT_X_TLS) + if(data->set.ssl.verifypeer) { + /* OpenLDAP SDK supports BASE64 files. */ + if((data->set.str[STRING_CERT_TYPE]) && + (!Curl_raw_equal(data->set.str[STRING_CERT_TYPE], "PEM"))) { + failf(data, "LDAP local: ERROR OpenLDAP does only support PEM cert-type!"); + status = CURLE_SSL_CERTPROBLEM; + goto quit; + } + if(!ldap_ca) { + failf(data, "LDAP local: ERROR PEM CA cert not set!"); + status = CURLE_SSL_CERTPROBLEM; + goto quit; + } + infof(data, "LDAP local: using PEM CA cert: %s\n", ldap_ca); + rc = ldap_set_option(NULL, LDAP_OPT_X_TLS_CACERTFILE, ldap_ca); + if(rc != LDAP_SUCCESS) { + failf(data, "LDAP local: ERROR setting PEM CA cert: %s", + ldap_err2string(rc)); + status = CURLE_SSL_CERTPROBLEM; + goto quit; + } + ldap_option = LDAP_OPT_X_TLS_DEMAND; + } else { + ldap_option = LDAP_OPT_X_TLS_NEVER; + } + rc = ldap_set_option(NULL, LDAP_OPT_X_TLS_REQUIRE_CERT, &ldap_option); + if(rc != LDAP_SUCCESS) { + failf(data, "LDAP local: ERROR setting cert verify mode: %s", + ldap_err2string(rc)); + status = CURLE_SSL_CERTPROBLEM; + goto quit; + } + server = ldap_init(conn->host.name, (int)conn->port); + if(server == NULL) { + failf(data, "LDAP local: Cannot connect to %s:%hu", + conn->host.name, conn->port); + status = CURLE_COULDNT_CONNECT; + goto quit; + } + ldap_option = LDAP_OPT_X_TLS_HARD; + rc = ldap_set_option(server, LDAP_OPT_X_TLS, &ldap_option); + if(rc != LDAP_SUCCESS) { + failf(data, "LDAP local: ERROR setting SSL/TLS mode: %s", + ldap_err2string(rc)); + status = CURLE_SSL_CERTPROBLEM; + goto quit; + } +/* + rc = ldap_start_tls_s(server, NULL, NULL); + if(rc != LDAP_SUCCESS) { + failf(data, "LDAP local: ERROR starting SSL/TLS mode: %s", + ldap_err2string(rc)); + status = CURLE_SSL_CERTPROBLEM; + goto quit; + } +*/ +#else + /* we should probably never come up to here since configure + should check in first place if we can support LDAP SSL/TLS */ + failf(data, "LDAP local: SSL/TLS not supported with this version " + "of the OpenLDAP toolkit\n"); + status = CURLE_SSL_CERTPROBLEM; + goto quit; +#endif +#endif +#endif /* CURL_LDAP_USE_SSL */ + } else { + server = ldap_init(conn->host.name, (int)conn->port); + if(server == NULL) { + failf(data, "LDAP local: Cannot connect to %s:%hu", + conn->host.name, conn->port); + status = CURLE_COULDNT_CONNECT; + goto quit; + } + } +#ifdef CURL_LDAP_WIN + ldap_set_option(server, LDAP_OPT_PROTOCOL_VERSION, &ldap_proto); +#endif + + rc = ldap_simple_bind_s(server, + conn->bits.user_passwd ? conn->user : NULL, + conn->bits.user_passwd ? conn->passwd : NULL); + if(!ldap_ssl && rc != 0) { + ldap_proto = LDAP_VERSION2; + ldap_set_option(server, LDAP_OPT_PROTOCOL_VERSION, &ldap_proto); + rc = ldap_simple_bind_s(server, + conn->bits.user_passwd ? conn->user : NULL, + conn->bits.user_passwd ? conn->passwd : NULL); + } + if(rc != 0) { + failf(data, "LDAP local: ldap_simple_bind_s %s", ldap_err2string(rc)); + status = CURLE_LDAP_CANNOT_BIND; + goto quit; + } + + rc = ldap_search_s(server, ludp->lud_dn, ludp->lud_scope, + ludp->lud_filter, ludp->lud_attrs, 0, &result); + + if(rc != 0 && rc != LDAP_SIZELIMIT_EXCEEDED) { + failf(data, "LDAP remote: %s", ldap_err2string(rc)); + status = CURLE_LDAP_SEARCH_FAILED; + goto quit; + } + + for(num = 0, entryIterator = ldap_first_entry(server, result); + entryIterator; + entryIterator = ldap_next_entry(server, entryIterator), num++) + { + BerElement *ber = NULL; + char *attribute; /*! suspicious that this isn't 'const' */ + char *dn = ldap_get_dn(server, entryIterator); + int i; + + Curl_client_write(conn, CLIENTWRITE_BODY, (char *)"DN: ", 4); + Curl_client_write(conn, CLIENTWRITE_BODY, (char *)dn, 0); + Curl_client_write(conn, CLIENTWRITE_BODY, (char *)"\n", 1); + + dlsize += strlen(dn)+5; + + for (attribute = ldap_first_attribute(server, entryIterator, &ber); + attribute; + attribute = ldap_next_attribute(server, entryIterator, ber)) + { + BerValue **vals = ldap_get_values_len(server, entryIterator, attribute); + + if(vals != NULL) + { + for (i = 0; (vals[i] != NULL); i++) + { + Curl_client_write(conn, CLIENTWRITE_BODY, (char *)"\t", 1); + Curl_client_write(conn, CLIENTWRITE_BODY, (char *) attribute, 0); + Curl_client_write(conn, CLIENTWRITE_BODY, (char *)": ", 2); + dlsize += strlen(attribute)+3; + + if((strlen(attribute) > 7) && + (strcmp(";binary", + (char *)attribute + + (strlen((char *)attribute) - 7)) == 0)) { + /* Binary attribute, encode to base64. */ + val_b64_sz = Curl_base64_encode(data, + vals[i]->bv_val, + vals[i]->bv_len, + &val_b64); + if(val_b64_sz > 0) { + Curl_client_write(conn, CLIENTWRITE_BODY, val_b64, val_b64_sz); + free(val_b64); + dlsize += val_b64_sz; + } + } + else { + Curl_client_write(conn, CLIENTWRITE_BODY, vals[i]->bv_val, + vals[i]->bv_len); + dlsize += vals[i]->bv_len; + } + Curl_client_write(conn, CLIENTWRITE_BODY, (char *)"\n", 0); + dlsize++; + } + + /* Free memory used to store values */ + ldap_value_free_len(vals); + } + Curl_client_write(conn, CLIENTWRITE_BODY, (char *)"\n", 1); + dlsize++; + Curl_pgrsSetDownloadCounter(data, dlsize); + ldap_memfree(attribute); + } + ldap_memfree(dn); + if(ber) + ber_free(ber, 0); + } + +quit: + if(result) { + ldap_msgfree(result); + LDAP_TRACE (("Received %d entries\n", num)); + } + if(rc == LDAP_SIZELIMIT_EXCEEDED) + infof(data, "There are more than %d entries\n", num); + if(ludp) + ldap_free_urldesc(ludp); + if(server) + ldap_unbind_s(server); +#if defined(HAVE_LDAP_SSL) && defined(CURL_HAS_NOVELL_LDAPSDK) + if(ldap_ssl) + ldapssl_client_deinit(); +#endif /* HAVE_LDAP_SSL && CURL_HAS_NOVELL_LDAPSDK */ + + /* no data to transfer */ + Curl_setup_transfer(conn, -1, -1, FALSE, NULL, -1, NULL); + conn->bits.close = TRUE; + + return status; +} + +#ifdef DEBUG_LDAP +static void _ldap_trace (const char *fmt, ...) +{ + static int do_trace = -1; + va_list args; + + if(do_trace == -1) { + const char *env = getenv("CURL_TRACE"); + do_trace = (env && strtol(env, NULL, 10) > 0); + } + if(!do_trace) + return; + + va_start (args, fmt); + vfprintf (stderr, fmt, args); + va_end (args); +} +#endif + +#ifndef HAVE_LDAP_URL_PARSE + +/* + * Return scope-value for a scope-string. + */ +static int str2scope (const char *p) +{ + if(strequal(p, "one")) + return LDAP_SCOPE_ONELEVEL; + if(strequal(p, "onetree")) + return LDAP_SCOPE_ONELEVEL; + if(strequal(p, "base")) + return LDAP_SCOPE_BASE; + if(strequal(p, "sub")) + return LDAP_SCOPE_SUBTREE; + if(strequal( p, "subtree")) + return LDAP_SCOPE_SUBTREE; + return (-1); +} + +/* + * Split 'str' into strings separated by commas. + * Note: res[] points into 'str'. + */ +static char **split_str (char *str) +{ + char **res, *lasts, *s; + int i; + + for (i = 2, s = strchr(str,','); s; i++) + s = strchr(++s,','); + + res = calloc(i, sizeof(char*)); + if(!res) + return NULL; + + for (i = 0, s = strtok_r(str, ",", &lasts); s; + s = strtok_r(NULL, ",", &lasts), i++) + res[i] = s; + return res; +} + +/* + * Unescape the LDAP-URL components + */ +static bool unescape_elements (void *data, LDAPURLDesc *ludp) +{ + int i; + + if(ludp->lud_filter) { + ludp->lud_filter = curl_easy_unescape(data, ludp->lud_filter, 0, NULL); + if(!ludp->lud_filter) + return (FALSE); + } + + for (i = 0; ludp->lud_attrs && ludp->lud_attrs[i]; i++) { + ludp->lud_attrs[i] = curl_easy_unescape(data, ludp->lud_attrs[i], 0, NULL); + if(!ludp->lud_attrs[i]) + return (FALSE); + } + + for (i = 0; ludp->lud_exts && ludp->lud_exts[i]; i++) { + ludp->lud_exts[i] = curl_easy_unescape(data, ludp->lud_exts[i], 0, NULL); + if(!ludp->lud_exts[i]) + return (FALSE); + } + + if(ludp->lud_dn) { + char *dn = ludp->lud_dn; + char *new_dn = curl_easy_unescape(data, dn, 0, NULL); + + free(dn); + ludp->lud_dn = new_dn; + if(!new_dn) + return (FALSE); + } + return (TRUE); +} + +/* + * Break apart the pieces of an LDAP URL. + * Syntax: + * ldap://:/???? + * + * already known from 'conn->host.name'. + * already known from 'conn->remote_port'. + * extract the rest from 'conn->data->state.path+1'. All fields are optional. + * e.g. + * ldap://:/??? + * yields ludp->lud_dn = "". + * + * Defined in RFC4516 section 2. + */ +static int _ldap_url_parse2 (const struct connectdata *conn, LDAPURLDesc *ludp) +{ + char *p, *q; + int i; + + if(!conn->data || + !conn->data->state.path || + conn->data->state.path[0] != '/' || + !checkprefix("LDAP", conn->data->change.url)) + return LDAP_INVALID_SYNTAX; + + ludp->lud_scope = LDAP_SCOPE_BASE; + ludp->lud_port = conn->remote_port; + ludp->lud_host = conn->host.name; + + /* parse DN (Distinguished Name). + */ + ludp->lud_dn = strdup(conn->data->state.path+1); + if(!ludp->lud_dn) + return LDAP_NO_MEMORY; + + p = strchr(ludp->lud_dn, '?'); + LDAP_TRACE (("DN '%.*s'\n", p ? (size_t)(p-ludp->lud_dn) : + strlen(ludp->lud_dn), ludp->lud_dn)); + + if(!p) + goto success; + + *p++ = '\0'; + + /* parse attributes. skip "??". + */ + q = strchr(p, '?'); + if(q) + *q++ = '\0'; + + if(*p && *p != '?') { + ludp->lud_attrs = split_str(p); + if(!ludp->lud_attrs) + return LDAP_NO_MEMORY; + + for (i = 0; ludp->lud_attrs[i]; i++) + LDAP_TRACE (("attr[%d] '%s'\n", i, ludp->lud_attrs[i])); + } + + p = q; + if(!p) + goto success; + + /* parse scope. skip "??" + */ + q = strchr(p, '?'); + if(q) + *q++ = '\0'; + + if(*p && *p != '?') { + ludp->lud_scope = str2scope(p); + if(ludp->lud_scope == -1) + return LDAP_INVALID_SYNTAX; + LDAP_TRACE (("scope %d\n", ludp->lud_scope)); + } + + p = q; + if(!p) + goto success; + + /* parse filter + */ + q = strchr(p, '?'); + if(q) + *q++ = '\0'; + if(!*p) + return LDAP_INVALID_SYNTAX; + + ludp->lud_filter = p; + LDAP_TRACE (("filter '%s'\n", ludp->lud_filter)); + + p = q; + if(!p) + goto success; + + /* parse extensions + */ + ludp->lud_exts = split_str(p); + if(!ludp->lud_exts) + return LDAP_NO_MEMORY; + + for (i = 0; ludp->lud_exts[i]; i++) + LDAP_TRACE (("exts[%d] '%s'\n", i, ludp->lud_exts[i])); + + success: + if(!unescape_elements(conn->data, ludp)) + return LDAP_NO_MEMORY; + return LDAP_SUCCESS; +} + +static int _ldap_url_parse (const struct connectdata *conn, + LDAPURLDesc **ludpp) +{ + LDAPURLDesc *ludp = calloc(1, sizeof(*ludp)); + int rc; + + *ludpp = NULL; + if(!ludp) + return LDAP_NO_MEMORY; + + rc = _ldap_url_parse2 (conn, ludp); + if(rc != LDAP_SUCCESS) { + _ldap_free_urldesc(ludp); + ludp = NULL; + } + *ludpp = ludp; + return (rc); +} + +static void _ldap_free_urldesc (LDAPURLDesc *ludp) +{ + int i; + + if(!ludp) + return; + + if(ludp->lud_dn) + free(ludp->lud_dn); + + if(ludp->lud_filter) + free(ludp->lud_filter); + + if(ludp->lud_attrs) { + for (i = 0; ludp->lud_attrs[i]; i++) + free(ludp->lud_attrs[i]); + free(ludp->lud_attrs); + } + + if(ludp->lud_exts) { + for (i = 0; ludp->lud_exts[i]; i++) + free(ludp->lud_exts[i]); + free(ludp->lud_exts); + } + free (ludp); +} +#endif /* !HAVE_LDAP_URL_PARSE */ +#endif /* !CURL_DISABLE_LDAP && !USE_OPENLDAP */ diff --git a/mobicore/common/curl/lib/libcurl.imp b/mobicore/common/curl/lib/libcurl.imp new file mode 100644 index 0000000000000000000000000000000000000000..74943afa7f776f05c6b43efc4eb4648da634c976 --- /dev/null +++ b/mobicore/common/curl/lib/libcurl.imp @@ -0,0 +1,51 @@ +# +# Definition file for the NLM version of the LIBCURL library from curl +# +# (LIBCURL) + curl_easy_cleanup, + curl_easy_escape, + curl_easy_unescape, + curl_easy_getinfo, + curl_easy_init, + curl_easy_pause, + curl_easy_perform, + curl_easy_setopt, + curl_escape, + curl_unescape, + curl_formfree, + curl_getdate, + curl_getenv, + curl_global_cleanup, + curl_global_init, + curl_slist_append, + curl_slist_free_all, + curl_version, + curl_maprintf, + curl_mfprintf, + curl_mprintf, + curl_msprintf, + curl_msnprintf, + curl_mvfprintf, + curl_mvsnprintf, + curl_strequal, + curl_strnequal, + curl_easy_duphandle, + curl_formadd, + curl_multi_init, + curl_multi_add_handle, + curl_multi_remove_handle, + curl_multi_fdset, + curl_multi_perform, + curl_multi_cleanup, + curl_multi_info_read, + curl_free, + curl_version_info, + curl_share_init, + curl_share_setopt, + curl_share_cleanup, + curl_global_init_mem, + curl_easy_strerror, + curl_multi_strerror, + curl_share_strerror, + curl_easy_reset + diff --git a/mobicore/common/curl/lib/libcurl.plist b/mobicore/common/curl/lib/libcurl.plist new file mode 100644 index 0000000000000000000000000000000000000000..7c3c3555008fcc0e05d3c3981ae25dc230b060d6 --- /dev/null +++ b/mobicore/common/curl/lib/libcurl.plist @@ -0,0 +1,35 @@ + + + + + CFBundleInfoDictionaryVersion + 6.0 + + CFBundleDevelopmentRegion + English + + CFBundleExecutable + curl + + CFBundleIdentifier + com.libcurl.libcurl + + CFBundleVersion + 7.21.3 + + CFBundleName + libcurl + + CFBundlePackageType + FMWK + + CFBundleSignature + ???? + + CFBundleShortVersionString + libcurl 7.21.3 + + CFBundleGetInfoString + libcurl.plist 7.21.3 + + \ No newline at end of file diff --git a/mobicore/common/curl/lib/libcurl.rc b/mobicore/common/curl/lib/libcurl.rc new file mode 100644 index 0000000000000000000000000000000000000000..47b944ac86dc17f8931bf814be992760b881eaff --- /dev/null +++ b/mobicore/common/curl/lib/libcurl.rc @@ -0,0 +1,63 @@ +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) 1998 - 2009, Daniel Stenberg, , et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at http://curl.haxx.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ***************************************************************************/ +#include +#include "../include/curl/curlver.h" + +LANGUAGE 0x09,0x01 + +#define RC_VERSION LIBCURL_VERSION_MAJOR, LIBCURL_VERSION_MINOR, LIBCURL_VERSION_PATCH, 0 + +VS_VERSION_INFO VERSIONINFO + FILEVERSION RC_VERSION + PRODUCTVERSION RC_VERSION + FILEFLAGSMASK 0x3fL +#if defined(DEBUGBUILD) || defined(_DEBUG) + FILEFLAGS 1 +#else + FILEFLAGS 0 +#endif + FILEOS VOS__WINDOWS32 + FILETYPE VFT_DLL + FILESUBTYPE 0x0L + +BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "040904b0" + BEGIN + VALUE "CompanyName", "The cURL library, http://curl.haxx.se/\0" + VALUE "FileDescription", "libcurl Shared Library\0" + VALUE "FileVersion", LIBCURL_VERSION "\0" + VALUE "InternalName", "libcurl\0" + VALUE "OriginalFilename", "libcurl.dll\0" + VALUE "ProductName", "The cURL library\0" + VALUE "ProductVersion", LIBCURL_VERSION "\0" + VALUE "LegalCopyright", " " LIBCURL_COPYRIGHT "\0" + VALUE "License", "http://curl.haxx.se/docs/copyright.html\0" + END + END + + BLOCK "VarFileInfo" + BEGIN + VALUE "Translation", 0x409, 1200 + END +END diff --git a/mobicore/common/curl/lib/libcurl.vcproj b/mobicore/common/curl/lib/libcurl.vcproj new file mode 100644 index 0000000000000000000000000000000000000000..d4cd99ae894a424c71161778fbaa8aad7299f0f0 --- /dev/null +++ b/mobicore/common/curl/lib/libcurl.vcproj @@ -0,0 +1,291 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/mobicore/common/curl/lib/llist.c b/mobicore/common/curl/lib/llist.c new file mode 100644 index 0000000000000000000000000000000000000000..71238fa731306e88d0f3d46c0f5d5c3a1ff212a2 --- /dev/null +++ b/mobicore/common/curl/lib/llist.c @@ -0,0 +1,198 @@ +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) 1998 - 2010, Daniel Stenberg, , et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at http://curl.haxx.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ***************************************************************************/ + +#include "setup.h" + +#include +#include + +#include "llist.h" +#include "curl_memory.h" + +/* this must be the last include file */ +#include "memdebug.h" + +static void +llist_init(struct curl_llist *l, curl_llist_dtor dtor) +{ + l->size = 0; + l->dtor = dtor; + l->head = NULL; + l->tail = NULL; +} + +struct curl_llist * +Curl_llist_alloc(curl_llist_dtor dtor) +{ + struct curl_llist *list; + + list = malloc(sizeof(struct curl_llist)); + if(NULL == list) + return NULL; + + llist_init(list, dtor); + + return list; +} + +/* + * Curl_llist_insert_next() + * + * Inserts a new list element after the given one 'e'. If the given existing + * entry is NULL and the list already has elements, the new one will be + * inserted first in the list. + * + * Returns: 1 on success and 0 on failure. + */ +int +Curl_llist_insert_next(struct curl_llist *list, struct curl_llist_element *e, + const void *p) +{ + struct curl_llist_element *ne = malloc(sizeof(struct curl_llist_element)); + if(!ne) + return 0; + + ne->ptr = (void *) p; + if(list->size == 0) { + list->head = ne; + list->head->prev = NULL; + list->head->next = NULL; + list->tail = ne; + } + else { + /* if 'e' is NULL here, we insert the new element first in the list */ + ne->next = e?e->next:list->head; + ne->prev = e; + if(!e) { + list->head->prev = ne; + list->head = ne; + } + else if(e->next) { + e->next->prev = ne; + } + else { + list->tail = ne; + } + if(e) + e->next = ne; + } + + ++list->size; + + return 1; +} + +int +Curl_llist_remove(struct curl_llist *list, struct curl_llist_element *e, + void *user) +{ + if(e == NULL || list->size == 0) + return 1; + + if(e == list->head) { + list->head = e->next; + + if(list->head == NULL) + list->tail = NULL; + else + e->next->prev = NULL; + } else { + e->prev->next = e->next; + if(!e->next) + list->tail = e->prev; + else + e->next->prev = e->prev; + } + + list->dtor(user, e->ptr); + + free(e); + --list->size; + + return 1; +} + +void +Curl_llist_destroy(struct curl_llist *list, void *user) +{ + if(list) { + while(list->size > 0) + Curl_llist_remove(list, list->tail, user); + + free(list); + } +} + +size_t +Curl_llist_count(struct curl_llist *list) +{ + return list->size; +} + +int Curl_llist_move(struct curl_llist *list, struct curl_llist_element *e, + struct curl_llist *to_list, struct curl_llist_element *to_e) +{ + /* Remove element from list */ + if(e == NULL || list->size == 0) + return 0; + + if(e == list->head) { + list->head = e->next; + + if(list->head == NULL) + list->tail = NULL; + else + e->next->prev = NULL; + } + else { + e->prev->next = e->next; + if(!e->next) + list->tail = e->prev; + else + e->next->prev = e->prev; + } + + --list->size; + + /* Add element to to_list after to_e */ + if(to_list->size == 0) { + to_list->head = e; + to_list->head->prev = NULL; + to_list->head->next = NULL; + to_list->tail = e; + } + else { + e->next = to_e->next; + e->prev = to_e; + if(to_e->next) { + to_e->next->prev = e; + } + else { + to_list->tail = e; + } + to_e->next = e; + } + + ++to_list->size; + + return 1; +} diff --git a/mobicore/common/curl/lib/llist.h b/mobicore/common/curl/lib/llist.h new file mode 100644 index 0000000000000000000000000000000000000000..c33912a4babb9205922b0271e4c5cbffabadf9a3 --- /dev/null +++ b/mobicore/common/curl/lib/llist.h @@ -0,0 +1,56 @@ +#ifndef __LLIST_H +#define __LLIST_H +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) 1998 - 2010, Daniel Stenberg, , et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at http://curl.haxx.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ***************************************************************************/ + +#include "setup.h" +#include + +typedef void (*curl_llist_dtor)(void *, void *); + +struct curl_llist_element { + void *ptr; + + struct curl_llist_element *prev; + struct curl_llist_element *next; +}; + +struct curl_llist { + struct curl_llist_element *head; + struct curl_llist_element *tail; + + curl_llist_dtor dtor; + + size_t size; +}; + +struct curl_llist *Curl_llist_alloc(curl_llist_dtor); +int Curl_llist_insert_next(struct curl_llist *, struct curl_llist_element *, + const void *); +int Curl_llist_remove(struct curl_llist *, struct curl_llist_element *, + void *); +size_t Curl_llist_count(struct curl_llist *); +void Curl_llist_destroy(struct curl_llist *, void *); +int Curl_llist_move(struct curl_llist *, struct curl_llist_element *, + struct curl_llist *, struct curl_llist_element *); + +#endif diff --git a/mobicore/common/curl/lib/makefile.amiga b/mobicore/common/curl/lib/makefile.amiga new file mode 100644 index 0000000000000000000000000000000000000000..7b7fa8fab30cdd368b9fc00af9bf76655d860a27 --- /dev/null +++ b/mobicore/common/curl/lib/makefile.amiga @@ -0,0 +1,22 @@ +# +# libcurl Makefile for AmigaOS ... +# + +# change the follow to where you have the AmiTCP SDK v4.3 includes: + +ATCPSDKI= /GG/netinclude + + +CC = m68k-amigaos-gcc +CFLAGS = -I$(ATCPSDKI) -m68020-60 -O2 -msoft-float -noixemul -g -I. -I../include -W -Wall + +include Makefile.inc +CSOURCES += amigaos.c +OBJS = $(CSOURCES:.c=.o) + +all: $(OBJS) + ar cru libcurl.a $(OBJS) + ranlib libcurl.a + +install: + $(INSTALL) -c ./libcurl.a /lib/libcurl.a diff --git a/mobicore/common/curl/lib/makefile.dj b/mobicore/common/curl/lib/makefile.dj new file mode 100644 index 0000000000000000000000000000000000000000..d9f159d3d92417df703069a333898dc0b2de859e --- /dev/null +++ b/mobicore/common/curl/lib/makefile.dj @@ -0,0 +1,49 @@ +# +# Adapted for djgpp2 / Watt-32 / DOS by +# Gisle Vanem +# + +DEPEND_PREREQ = curl_config.h +TOPDIR = .. + +include ../packages/DOS/common.dj +include Makefile.inc + +OBJECTS := $(patsubst %.c,$(OBJ_DIR)/%.o,$(strip $(CSOURCES))) + +CURL_LIB = libcurl.a + +# NOTE: if ../include/curl/curlbuild.h is missing, you're probably building +# this from a git checkout and then you need to run buildconf.bat first. + +all: $(OBJ_DIR) curl_config.h $(CURL_LIB) + +$(CURL_LIB): $(OBJECTS) + ar rs $@ $? + +curl_config.h: config-dos.h + $(COPY) $^ $@ + +# clean generated files +# +genclean: + - $(DELETE) curl_config.h + +# clean object files and subdir +# +objclean: genclean + - $(DELETE) $(OBJ_DIR)$(DS)*.o + - $(RMDIR) $(OBJ_DIR) + +# clean without removing built library +# +clean: objclean + - $(DELETE) depend.dj + +# clean everything +# +realclean vclean: clean + - $(DELETE) $(CURL_LIB) + +-include depend.dj + diff --git a/mobicore/common/curl/lib/md4.c b/mobicore/common/curl/lib/md4.c new file mode 100644 index 0000000000000000000000000000000000000000..ecf3bfcd8e1a16c5fb3badd8eded911ac62a935e --- /dev/null +++ b/mobicore/common/curl/lib/md4.c @@ -0,0 +1,281 @@ +/*- + Copyright (C) 1990-2, RSA Data Security, Inc. All rights reserved. + + License to copy and use this software is granted provided that it + is identified as the "RSA Data Security, Inc. MD4 Message-Digest + Algorithm" in all material mentioning or referencing this software + or this function. + + License is also granted to make and use derivative works provided + that such works are identified as "derived from the RSA Data + Security, Inc. MD4 Message-Digest Algorithm" in all material + mentioning or referencing the derived work. + + RSA Data Security, Inc. makes no representations concerning either + the merchantability of this software or the suitability of this + software for any particular purpose. It is provided "as is" + without express or implied warranty of any kind. + + These notices must be retained in any copies of any part of this + documentation and/or software. + */ + +#include "setup.h" + +/* NSS crypto library does not provide the MD4 hash algorithm, so that we have + * a local implementation of it */ +#ifdef USE_NSS + +#include "curl_md4.h" +#include + +typedef unsigned int UINT4; + +typedef struct MD4Context { + UINT4 state[4]; /* state (ABCD) */ + UINT4 count[2]; /* number of bits, modulo 2^64 (lsb first) */ + unsigned char buffer[64]; /* input buffer */ +} MD4_CTX; + +/* Constants for MD4Transform routine. + */ +#define S11 3 +#define S12 7 +#define S13 11 +#define S14 19 +#define S21 3 +#define S22 5 +#define S23 9 +#define S24 13 +#define S31 3 +#define S32 9 +#define S33 11 +#define S34 15 + +static void MD4Transform(UINT4 [4], const unsigned char [64]); +static void Encode(unsigned char *, UINT4 *, unsigned int); +static void Decode(UINT4 *, const unsigned char *, unsigned int); + +static unsigned char PADDING[64] = { + 0x80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 +}; + +/* F, G and H are basic MD4 functions. + */ +#define F(x, y, z) (((x) & (y)) | ((~x) & (z))) +#define G(x, y, z) (((x) & (y)) | ((x) & (z)) | ((y) & (z))) +#define H(x, y, z) ((x) ^ (y) ^ (z)) + +/* ROTATE_LEFT rotates x left n bits. + */ +#define ROTATE_LEFT(x, n) (((x) << (n)) | ((x) >> (32-(n)))) + +/* FF, GG and HH are transformations for rounds 1, 2 and 3 */ +/* Rotation is separate from addition to prevent recomputation */ +#define FF(a, b, c, d, x, s) { \ + (a) += F ((b), (c), (d)) + (x); \ + (a) = ROTATE_LEFT ((a), (s)); \ + } +#define GG(a, b, c, d, x, s) { \ + (a) += G ((b), (c), (d)) + (x) + (UINT4)0x5a827999; \ + (a) = ROTATE_LEFT ((a), (s)); \ + } +#define HH(a, b, c, d, x, s) { \ + (a) += H ((b), (c), (d)) + (x) + (UINT4)0x6ed9eba1; \ + (a) = ROTATE_LEFT ((a), (s)); \ + } + +/* MD4 initialization. Begins an MD4 operation, writing a new context. + */ +static void MD4Init(MD4_CTX *context) +{ + context->count[0] = context->count[1] = 0; + + /* Load magic initialization constants. + */ + context->state[0] = 0x67452301; + context->state[1] = 0xefcdab89; + context->state[2] = 0x98badcfe; + context->state[3] = 0x10325476; +} + +/* MD4 block update operation. Continues an MD4 message-digest + operation, processing another message block, and updating the + context. + */ +static void MD4Update(MD4_CTX *context, const unsigned char *input, + unsigned int inputLen) +{ + unsigned int i, bufindex, partLen; + + /* Compute number of bytes mod 64 */ + bufindex = (unsigned int)((context->count[0] >> 3) & 0x3F); + /* Update number of bits */ + if ((context->count[0] += ((UINT4)inputLen << 3)) + < ((UINT4)inputLen << 3)) + context->count[1]++; + context->count[1] += ((UINT4)inputLen >> 29); + + partLen = 64 - bufindex; + /* Transform as many times as possible. + */ + if (inputLen >= partLen) { + memcpy(&context->buffer[bufindex], input, partLen); + MD4Transform (context->state, context->buffer); + + for (i = partLen; i + 63 < inputLen; i += 64) + MD4Transform (context->state, &input[i]); + + bufindex = 0; + } + else + i = 0; + + /* Buffer remaining input */ + memcpy(&context->buffer[bufindex], &input[i], inputLen-i); +} + +/* MD4 padding. */ +static void MD4Pad(MD4_CTX *context) +{ + unsigned char bits[8]; + unsigned int bufindex, padLen; + + /* Save number of bits */ + Encode (bits, context->count, 8); + + /* Pad out to 56 mod 64. + */ + bufindex = (unsigned int)((context->count[0] >> 3) & 0x3f); + padLen = (bufindex < 56) ? (56 - bufindex) : (120 - bufindex); + MD4Update (context, PADDING, padLen); + + /* Append length (before padding) */ + MD4Update (context, bits, 8); +} + +/* MD4 finalization. Ends an MD4 message-digest operation, writing the + the message digest and zeroizing the context. + */ +static void MD4Final (unsigned char digest[16], MD4_CTX *context) +{ + /* Do padding */ + MD4Pad (context); + + /* Store state in digest */ + Encode (digest, context->state, 16); + + /* Zeroize sensitive information. + */ + memset(context, 0, sizeof(*context)); +} + +/* MD4 basic transformation. Transforms state based on block. + */ +static void MD4Transform (UINT4 state[4], const unsigned char block[64]) +{ + UINT4 a = state[0], b = state[1], c = state[2], d = state[3], x[16]; + + Decode (x, block, 64); + + /* Round 1 */ + FF (a, b, c, d, x[ 0], S11); /* 1 */ + FF (d, a, b, c, x[ 1], S12); /* 2 */ + FF (c, d, a, b, x[ 2], S13); /* 3 */ + FF (b, c, d, a, x[ 3], S14); /* 4 */ + FF (a, b, c, d, x[ 4], S11); /* 5 */ + FF (d, a, b, c, x[ 5], S12); /* 6 */ + FF (c, d, a, b, x[ 6], S13); /* 7 */ + FF (b, c, d, a, x[ 7], S14); /* 8 */ + FF (a, b, c, d, x[ 8], S11); /* 9 */ + FF (d, a, b, c, x[ 9], S12); /* 10 */ + FF (c, d, a, b, x[10], S13); /* 11 */ + FF (b, c, d, a, x[11], S14); /* 12 */ + FF (a, b, c, d, x[12], S11); /* 13 */ + FF (d, a, b, c, x[13], S12); /* 14 */ + FF (c, d, a, b, x[14], S13); /* 15 */ + FF (b, c, d, a, x[15], S14); /* 16 */ + + /* Round 2 */ + GG (a, b, c, d, x[ 0], S21); /* 17 */ + GG (d, a, b, c, x[ 4], S22); /* 18 */ + GG (c, d, a, b, x[ 8], S23); /* 19 */ + GG (b, c, d, a, x[12], S24); /* 20 */ + GG (a, b, c, d, x[ 1], S21); /* 21 */ + GG (d, a, b, c, x[ 5], S22); /* 22 */ + GG (c, d, a, b, x[ 9], S23); /* 23 */ + GG (b, c, d, a, x[13], S24); /* 24 */ + GG (a, b, c, d, x[ 2], S21); /* 25 */ + GG (d, a, b, c, x[ 6], S22); /* 26 */ + GG (c, d, a, b, x[10], S23); /* 27 */ + GG (b, c, d, a, x[14], S24); /* 28 */ + GG (a, b, c, d, x[ 3], S21); /* 29 */ + GG (d, a, b, c, x[ 7], S22); /* 30 */ + GG (c, d, a, b, x[11], S23); /* 31 */ + GG (b, c, d, a, x[15], S24); /* 32 */ + + /* Round 3 */ + HH (a, b, c, d, x[ 0], S31); /* 33 */ + HH (d, a, b, c, x[ 8], S32); /* 34 */ + HH (c, d, a, b, x[ 4], S33); /* 35 */ + HH (b, c, d, a, x[12], S34); /* 36 */ + HH (a, b, c, d, x[ 2], S31); /* 37 */ + HH (d, a, b, c, x[10], S32); /* 38 */ + HH (c, d, a, b, x[ 6], S33); /* 39 */ + HH (b, c, d, a, x[14], S34); /* 40 */ + HH (a, b, c, d, x[ 1], S31); /* 41 */ + HH (d, a, b, c, x[ 9], S32); /* 42 */ + HH (c, d, a, b, x[ 5], S33); /* 43 */ + HH (b, c, d, a, x[13], S34); /* 44 */ + HH (a, b, c, d, x[ 3], S31); /* 45 */ + HH (d, a, b, c, x[11], S32); /* 46 */ + HH (c, d, a, b, x[ 7], S33); /* 47 */ + HH (b, c, d, a, x[15], S34); /* 48 */ + + state[0] += a; + state[1] += b; + state[2] += c; + state[3] += d; + + /* Zeroize sensitive information. + */ + memset(x, 0, sizeof(x)); +} + +/* Encodes input (UINT4) into output (unsigned char). Assumes len is + a multiple of 4. + */ +static void Encode(unsigned char *output, UINT4 *input, unsigned int len) +{ + unsigned int i, j; + + for (i = 0, j = 0; j < len; i++, j += 4) { + output[j] = (unsigned char)(input[i] & 0xff); + output[j+1] = (unsigned char)((input[i] >> 8) & 0xff); + output[j+2] = (unsigned char)((input[i] >> 16) & 0xff); + output[j+3] = (unsigned char)((input[i] >> 24) & 0xff); + } +} + +/* Decodes input (unsigned char) into output (UINT4). Assumes len is + a multiple of 4. + */ +static void Decode (UINT4 *output, const unsigned char *input, unsigned int len) +{ + unsigned int i, j; + + for (i = 0, j = 0; j < len; i++, j += 4) + output[i] = ((UINT4)input[j]) | (((UINT4)input[j+1]) << 8) | + (((UINT4)input[j+2]) << 16) | (((UINT4)input[j+3]) << 24); +} + +void Curl_md4it(unsigned char *output, const unsigned char *input, size_t len) +{ + MD4_CTX ctx; + MD4Init(&ctx); + MD4Update(&ctx, input, (unsigned int)len); + MD4Final(output, &ctx); +} +#endif /* USE_NSS */ diff --git a/mobicore/common/curl/lib/md5.c b/mobicore/common/curl/lib/md5.c new file mode 100644 index 0000000000000000000000000000000000000000..b3912c583e9cf3ce0ce939a93ced8512f4c56143 --- /dev/null +++ b/mobicore/common/curl/lib/md5.c @@ -0,0 +1,395 @@ +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) 1998 - 2010, Daniel Stenberg, , et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at http://curl.haxx.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ***************************************************************************/ + +#include "setup.h" + +#ifndef CURL_DISABLE_CRYPTO_AUTH + +#include + +#include "curl_md5.h" +#include "curl_hmac.h" + +#ifdef USE_GNUTLS + +#include + +typedef gcry_md_hd_t MD5_CTX; + +static void MD5_Init(MD5_CTX * ctx) +{ + gcry_md_open(ctx, GCRY_MD_MD5, 0); +} + +static void MD5_Update(MD5_CTX * ctx, + const unsigned char * input, + unsigned int inputLen) +{ + gcry_md_write(*ctx, input, inputLen); +} + +static void MD5_Final(unsigned char digest[16], MD5_CTX * ctx) +{ + memcpy(digest, gcry_md_read(*ctx, 0), 16); + gcry_md_close(*ctx); +} + +#else + +#ifdef USE_SSLEAY +/* When OpenSSL is available we use the MD5-function from OpenSSL */ + +# ifdef USE_OPENSSL +# include +# else +# include +# endif + +#else /* USE_SSLEAY */ +/* When OpenSSL is not available we use this code segment */ + +/* Copyright (C) 1991-2, RSA Data Security, Inc. Created 1991. All +rights reserved. + +License to copy and use this software is granted provided that it +is identified as the "RSA Data Security, Inc. MD5 Message-Digest +Algorithm" in all material mentioning or referencing this software +or this function. + +License is also granted to make and use derivative works provided +that such works are identified as "derived from the RSA Data +Security, Inc. MD5 Message-Digest Algorithm" in all material +mentioning or referencing the derived work. + +RSA Data Security, Inc. makes no representations concerning either +the merchantability of this software or the suitability of this +software for any particular purpose. It is provided "as is" +without express or implied warranty of any kind. + +These notices must be retained in any copies of any part of this +documentation and/or software. + */ + +/* UINT4 defines a four byte word */ +typedef unsigned int UINT4; + +/* MD5 context. */ +struct md5_ctx { + UINT4 state[4]; /* state (ABCD) */ + UINT4 count[2]; /* number of bits, modulo 2^64 (lsb first) */ + unsigned char buffer[64]; /* input buffer */ +}; + +typedef struct md5_ctx MD5_CTX; + +static void MD5_Init(struct md5_ctx *); +static void MD5_Update(struct md5_ctx *, const unsigned char *, unsigned int); +static void MD5_Final(unsigned char [16], struct md5_ctx *); + +/* Constants for MD5Transform routine. + */ + +#define S11 7 +#define S12 12 +#define S13 17 +#define S14 22 +#define S21 5 +#define S22 9 +#define S23 14 +#define S24 20 +#define S31 4 +#define S32 11 +#define S33 16 +#define S34 23 +#define S41 6 +#define S42 10 +#define S43 15 +#define S44 21 + +static void MD5Transform(UINT4 [4], const unsigned char [64]); +static void Encode(unsigned char *, UINT4 *, unsigned int); +static void Decode(UINT4 *, const unsigned char *, unsigned int); + +static const unsigned char PADDING[64] = { + 0x80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 +}; + +/* F, G, H and I are basic MD5 functions. + */ +#define F(x, y, z) (((x) & (y)) | ((~x) & (z))) +#define G(x, y, z) (((x) & (z)) | ((y) & (~z))) +#define H(x, y, z) ((x) ^ (y) ^ (z)) +#define I(x, y, z) ((y) ^ ((x) | (~z))) + +/* ROTATE_LEFT rotates x left n bits. + */ +#define ROTATE_LEFT(x, n) (((x) << (n)) | ((x) >> (32-(n)))) + +/* FF, GG, HH, and II transformations for rounds 1, 2, 3, and 4. +Rotation is separate from addition to prevent recomputation. + */ +#define FF(a, b, c, d, x, s, ac) { \ + (a) += F ((b), (c), (d)) + (x) + (UINT4)(ac); \ + (a) = ROTATE_LEFT ((a), (s)); \ + (a) += (b); \ + } +#define GG(a, b, c, d, x, s, ac) { \ + (a) += G ((b), (c), (d)) + (x) + (UINT4)(ac); \ + (a) = ROTATE_LEFT ((a), (s)); \ + (a) += (b); \ + } +#define HH(a, b, c, d, x, s, ac) { \ + (a) += H ((b), (c), (d)) + (x) + (UINT4)(ac); \ + (a) = ROTATE_LEFT ((a), (s)); \ + (a) += (b); \ + } +#define II(a, b, c, d, x, s, ac) { \ + (a) += I ((b), (c), (d)) + (x) + (UINT4)(ac); \ + (a) = ROTATE_LEFT ((a), (s)); \ + (a) += (b); \ + } + +/* MD5 initialization. Begins an MD5 operation, writing a new context. + */ +static void MD5_Init(struct md5_ctx *context) +{ + context->count[0] = context->count[1] = 0; + /* Load magic initialization constants. */ + context->state[0] = 0x67452301; + context->state[1] = 0xefcdab89; + context->state[2] = 0x98badcfe; + context->state[3] = 0x10325476; +} + +/* MD5 block update operation. Continues an MD5 message-digest + operation, processing another message block, and updating the + context. + */ +static void MD5_Update (struct md5_ctx *context, /* context */ + const unsigned char *input, /* input block */ + unsigned int inputLen) /* length of input block */ +{ + unsigned int i, bufindex, partLen; + + /* Compute number of bytes mod 64 */ + bufindex = (unsigned int)((context->count[0] >> 3) & 0x3F); + + /* Update number of bits */ + if((context->count[0] += ((UINT4)inputLen << 3)) + < ((UINT4)inputLen << 3)) + context->count[1]++; + context->count[1] += ((UINT4)inputLen >> 29); + + partLen = 64 - bufindex; + + /* Transform as many times as possible. */ + if(inputLen >= partLen) { + memcpy(&context->buffer[bufindex], input, partLen); + MD5Transform(context->state, context->buffer); + + for (i = partLen; i + 63 < inputLen; i += 64) + MD5Transform(context->state, &input[i]); + + bufindex = 0; + } + else + i = 0; + + /* Buffer remaining input */ + memcpy(&context->buffer[bufindex], &input[i], inputLen-i); +} + +/* MD5 finalization. Ends an MD5 message-digest operation, writing the + the message digest and zeroizing the context. +*/ +static void MD5_Final(unsigned char digest[16], /* message digest */ + struct md5_ctx *context) /* context */ +{ + unsigned char bits[8]; + unsigned int count, padLen; + + /* Save number of bits */ + Encode (bits, context->count, 8); + + /* Pad out to 56 mod 64. */ + count = (unsigned int)((context->count[0] >> 3) & 0x3f); + padLen = (count < 56) ? (56 - count) : (120 - count); + MD5_Update (context, PADDING, padLen); + + /* Append length (before padding) */ + MD5_Update (context, bits, 8); + + /* Store state in digest */ + Encode (digest, context->state, 16); + + /* Zeroize sensitive information. */ + memset ((void *)context, 0, sizeof (*context)); +} + +/* MD5 basic transformation. Transforms state based on block. */ +static void MD5Transform(UINT4 state[4], + const unsigned char block[64]) +{ + UINT4 a = state[0], b = state[1], c = state[2], d = state[3], x[16]; + + Decode (x, block, 64); + + /* Round 1 */ + FF (a, b, c, d, x[ 0], S11, 0xd76aa478); /* 1 */ + FF (d, a, b, c, x[ 1], S12, 0xe8c7b756); /* 2 */ + FF (c, d, a, b, x[ 2], S13, 0x242070db); /* 3 */ + FF (b, c, d, a, x[ 3], S14, 0xc1bdceee); /* 4 */ + FF (a, b, c, d, x[ 4], S11, 0xf57c0faf); /* 5 */ + FF (d, a, b, c, x[ 5], S12, 0x4787c62a); /* 6 */ + FF (c, d, a, b, x[ 6], S13, 0xa8304613); /* 7 */ + FF (b, c, d, a, x[ 7], S14, 0xfd469501); /* 8 */ + FF (a, b, c, d, x[ 8], S11, 0x698098d8); /* 9 */ + FF (d, a, b, c, x[ 9], S12, 0x8b44f7af); /* 10 */ + FF (c, d, a, b, x[10], S13, 0xffff5bb1); /* 11 */ + FF (b, c, d, a, x[11], S14, 0x895cd7be); /* 12 */ + FF (a, b, c, d, x[12], S11, 0x6b901122); /* 13 */ + FF (d, a, b, c, x[13], S12, 0xfd987193); /* 14 */ + FF (c, d, a, b, x[14], S13, 0xa679438e); /* 15 */ + FF (b, c, d, a, x[15], S14, 0x49b40821); /* 16 */ + + /* Round 2 */ + GG (a, b, c, d, x[ 1], S21, 0xf61e2562); /* 17 */ + GG (d, a, b, c, x[ 6], S22, 0xc040b340); /* 18 */ + GG (c, d, a, b, x[11], S23, 0x265e5a51); /* 19 */ + GG (b, c, d, a, x[ 0], S24, 0xe9b6c7aa); /* 20 */ + GG (a, b, c, d, x[ 5], S21, 0xd62f105d); /* 21 */ + GG (d, a, b, c, x[10], S22, 0x2441453); /* 22 */ + GG (c, d, a, b, x[15], S23, 0xd8a1e681); /* 23 */ + GG (b, c, d, a, x[ 4], S24, 0xe7d3fbc8); /* 24 */ + GG (a, b, c, d, x[ 9], S21, 0x21e1cde6); /* 25 */ + GG (d, a, b, c, x[14], S22, 0xc33707d6); /* 26 */ + GG (c, d, a, b, x[ 3], S23, 0xf4d50d87); /* 27 */ + GG (b, c, d, a, x[ 8], S24, 0x455a14ed); /* 28 */ + GG (a, b, c, d, x[13], S21, 0xa9e3e905); /* 29 */ + GG (d, a, b, c, x[ 2], S22, 0xfcefa3f8); /* 30 */ + GG (c, d, a, b, x[ 7], S23, 0x676f02d9); /* 31 */ + GG (b, c, d, a, x[12], S24, 0x8d2a4c8a); /* 32 */ + + /* Round 3 */ + HH (a, b, c, d, x[ 5], S31, 0xfffa3942); /* 33 */ + HH (d, a, b, c, x[ 8], S32, 0x8771f681); /* 34 */ + HH (c, d, a, b, x[11], S33, 0x6d9d6122); /* 35 */ + HH (b, c, d, a, x[14], S34, 0xfde5380c); /* 36 */ + HH (a, b, c, d, x[ 1], S31, 0xa4beea44); /* 37 */ + HH (d, a, b, c, x[ 4], S32, 0x4bdecfa9); /* 38 */ + HH (c, d, a, b, x[ 7], S33, 0xf6bb4b60); /* 39 */ + HH (b, c, d, a, x[10], S34, 0xbebfbc70); /* 40 */ + HH (a, b, c, d, x[13], S31, 0x289b7ec6); /* 41 */ + HH (d, a, b, c, x[ 0], S32, 0xeaa127fa); /* 42 */ + HH (c, d, a, b, x[ 3], S33, 0xd4ef3085); /* 43 */ + HH (b, c, d, a, x[ 6], S34, 0x4881d05); /* 44 */ + HH (a, b, c, d, x[ 9], S31, 0xd9d4d039); /* 45 */ + HH (d, a, b, c, x[12], S32, 0xe6db99e5); /* 46 */ + HH (c, d, a, b, x[15], S33, 0x1fa27cf8); /* 47 */ + HH (b, c, d, a, x[ 2], S34, 0xc4ac5665); /* 48 */ + + /* Round 4 */ + II (a, b, c, d, x[ 0], S41, 0xf4292244); /* 49 */ + II (d, a, b, c, x[ 7], S42, 0x432aff97); /* 50 */ + II (c, d, a, b, x[14], S43, 0xab9423a7); /* 51 */ + II (b, c, d, a, x[ 5], S44, 0xfc93a039); /* 52 */ + II (a, b, c, d, x[12], S41, 0x655b59c3); /* 53 */ + II (d, a, b, c, x[ 3], S42, 0x8f0ccc92); /* 54 */ + II (c, d, a, b, x[10], S43, 0xffeff47d); /* 55 */ + II (b, c, d, a, x[ 1], S44, 0x85845dd1); /* 56 */ + II (a, b, c, d, x[ 8], S41, 0x6fa87e4f); /* 57 */ + II (d, a, b, c, x[15], S42, 0xfe2ce6e0); /* 58 */ + II (c, d, a, b, x[ 6], S43, 0xa3014314); /* 59 */ + II (b, c, d, a, x[13], S44, 0x4e0811a1); /* 60 */ + II (a, b, c, d, x[ 4], S41, 0xf7537e82); /* 61 */ + II (d, a, b, c, x[11], S42, 0xbd3af235); /* 62 */ + II (c, d, a, b, x[ 2], S43, 0x2ad7d2bb); /* 63 */ + II (b, c, d, a, x[ 9], S44, 0xeb86d391); /* 64 */ + + state[0] += a; + state[1] += b; + state[2] += c; + state[3] += d; + + /* Zeroize sensitive information. */ + memset((void *)x, 0, sizeof (x)); +} + +/* Encodes input (UINT4) into output (unsigned char). Assumes len is + a multiple of 4. + */ +static void Encode (unsigned char *output, + UINT4 *input, + unsigned int len) +{ + unsigned int i, j; + + for (i = 0, j = 0; j < len; i++, j += 4) { + output[j] = (unsigned char)(input[i] & 0xff); + output[j+1] = (unsigned char)((input[i] >> 8) & 0xff); + output[j+2] = (unsigned char)((input[i] >> 16) & 0xff); + output[j+3] = (unsigned char)((input[i] >> 24) & 0xff); + } +} + +/* Decodes input (unsigned char) into output (UINT4). Assumes len is + a multiple of 4. +*/ +static void Decode (UINT4 *output, + const unsigned char *input, + unsigned int len) +{ + unsigned int i, j; + + for (i = 0, j = 0; j < len; i++, j += 4) + output[i] = ((UINT4)input[j]) | (((UINT4)input[j+1]) << 8) | + (((UINT4)input[j+2]) << 16) | (((UINT4)input[j+3]) << 24); +} + +#endif /* USE_SSLEAY */ + +#endif /* USE_GNUTLS */ + +const HMAC_params Curl_HMAC_MD5[] = { + { + (HMAC_hinit_func) MD5_Init, /* Hash initialization function. */ + (HMAC_hupdate_func) MD5_Update, /* Hash update function. */ + (HMAC_hfinal_func) MD5_Final, /* Hash computation end function. */ + sizeof(MD5_CTX), /* Size of hash context structure. */ + 64, /* Maximum key length. */ + 16 /* Result size. */ + } +}; + + +void Curl_md5it(unsigned char *outbuffer, /* 16 bytes */ + const unsigned char *input) +{ + MD5_CTX ctx; + MD5_Init(&ctx); + MD5_Update(&ctx, input, (unsigned int)strlen((char *)input)); + MD5_Final(outbuffer, &ctx); +} + +#endif /* CURL_DISABLE_CRYPTO_AUTH */ diff --git a/mobicore/common/curl/lib/memdebug.c b/mobicore/common/curl/lib/memdebug.c new file mode 100644 index 0000000000000000000000000000000000000000..69e204b6a735f5ffb67da3fc182736b3998573fc --- /dev/null +++ b/mobicore/common/curl/lib/memdebug.c @@ -0,0 +1,394 @@ +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) 1998 - 2010, Daniel Stenberg, , et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at http://curl.haxx.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ***************************************************************************/ + +#include "setup.h" + +#ifdef CURLDEBUG +#include + +#ifdef HAVE_SYS_SOCKET_H +#include +#endif + +#define _MPRINTF_REPLACE +#include +#include "urldata.h" +#include +#include +#include +#include + +#ifdef HAVE_UNISTD_H +#include +#endif + +#define MEMDEBUG_NODEFINES /* don't redefine the standard functions */ +#include "curl_memory.h" +#include "memdebug.h" + +#ifndef HAVE_ASSERT_H +# define assert(x) do { } while (0) +#endif + +struct memdebug { + size_t size; + union { + double d; + void * p; + } mem[1]; + /* I'm hoping this is the thing with the strictest alignment + * requirements. That also means we waste some space :-( */ +}; + +/* + * Note that these debug functions are very simple and they are meant to + * remain so. For advanced analysis, record a log file and write perl scripts + * to analyze them! + * + * Don't use these with multithreaded test programs! + */ + +#define logfile curl_debuglogfile +FILE *curl_debuglogfile = NULL; +static bool memlimit = FALSE; /* enable memory limit */ +static long memsize = 0; /* set number of mallocs allowed */ + +/* this sets the log file name */ +void curl_memdebug(const char *logname) +{ + if(!logfile) { + if(logname) + logfile = fopen(logname, "w"); + else + logfile = stderr; +#ifdef MEMDEBUG_LOG_SYNC + /* Flush the log file after every line so the log isn't lost in a crash */ + setvbuf(logfile, (char *)NULL, _IOLBF, 0); +#endif + } +} + +/* This function sets the number of malloc() calls that should return + successfully! */ +void curl_memlimit(long limit) +{ + if(!memlimit) { + memlimit = TRUE; + memsize = limit; + } +} + +/* returns TRUE if this isn't allowed! */ +static bool countcheck(const char *func, int line, const char *source) +{ + /* if source is NULL, then the call is made internally and this check + should not be made */ + if(memlimit && source) { + if(!memsize) { + if(source) { + /* log to file */ + curl_memlog("LIMIT %s:%d %s reached memlimit\n", + source, line, func); + /* log to stderr also */ + fprintf(stderr, "LIMIT %s:%d %s reached memlimit\n", + source, line, func); + } + SET_ERRNO(ENOMEM); + return TRUE; /* RETURN ERROR! */ + } + else + memsize--; /* countdown */ + + /* log the countdown */ + if(source) + curl_memlog("LIMIT %s:%d %ld ALLOCS left\n", + source, line, memsize); + + } + + return FALSE; /* allow this */ +} + +void *curl_domalloc(size_t wantedsize, int line, const char *source) +{ + struct memdebug *mem; + size_t size; + + assert(wantedsize != 0); + + if(countcheck("malloc", line, source)) + return NULL; + + /* alloc at least 64 bytes */ + size = sizeof(struct memdebug)+wantedsize; + + mem = (Curl_cmalloc)(size); + if(mem) { + /* fill memory with junk */ + memset(mem->mem, 0xA5, wantedsize); + mem->size = wantedsize; + } + + if(source) + curl_memlog("MEM %s:%d malloc(%zd) = %p\n", + source, line, wantedsize, mem ? mem->mem : 0); + return (mem ? mem->mem : NULL); +} + +void *curl_docalloc(size_t wanted_elements, size_t wanted_size, + int line, const char *source) +{ + struct memdebug *mem; + size_t size, user_size; + + assert(wanted_elements != 0); + assert(wanted_size != 0); + + if(countcheck("calloc", line, source)) + return NULL; + + /* alloc at least 64 bytes */ + user_size = wanted_size * wanted_elements; + size = sizeof(struct memdebug) + user_size; + + mem = (Curl_cmalloc)(size); + if(mem) { + /* fill memory with zeroes */ + memset(mem->mem, 0, user_size); + mem->size = user_size; + } + + if(source) + curl_memlog("MEM %s:%d calloc(%zu,%zu) = %p\n", + source, line, wanted_elements, wanted_size, mem?mem->mem:0); + return (mem ? mem->mem : NULL); +} + +char *curl_dostrdup(const char *str, int line, const char *source) +{ + char *mem; + size_t len; + + assert(str != NULL); + + if(countcheck("strdup", line, source)) + return NULL; + + len=strlen(str)+1; + + mem=curl_domalloc(len, 0, NULL); /* NULL prevents logging */ + if(mem) + memcpy(mem, str, len); + + if(source) + curl_memlog("MEM %s:%d strdup(%p) (%zu) = %p\n", + source, line, str, len, mem); + + return mem; +} + +/* We provide a realloc() that accepts a NULL as pointer, which then + performs a malloc(). In order to work with ares. */ +void *curl_dorealloc(void *ptr, size_t wantedsize, + int line, const char *source) +{ + struct memdebug *mem=NULL; + + size_t size = sizeof(struct memdebug)+wantedsize; + + assert(wantedsize != 0); + + if(countcheck("realloc", line, source)) + return NULL; + +#ifdef __INTEL_COMPILER +# pragma warning(push) +# pragma warning(disable:1684) + /* 1684: conversion from pointer to same-sized integral type */ +#endif + + if(ptr) + mem = (void *)((char *)ptr - offsetof(struct memdebug, mem)); + +#ifdef __INTEL_COMPILER +# pragma warning(pop) +#endif + + mem = (Curl_crealloc)(mem, size); + if(source) + curl_memlog("MEM %s:%d realloc(%p, %zu) = %p\n", + source, line, ptr, wantedsize, mem?mem->mem:NULL); + + if(mem) { + mem->size = wantedsize; + return mem->mem; + } + + return NULL; +} + +void curl_dofree(void *ptr, int line, const char *source) +{ + struct memdebug *mem; + + assert(ptr != NULL); + +#ifdef __INTEL_COMPILER +# pragma warning(push) +# pragma warning(disable:1684) + /* 1684: conversion from pointer to same-sized integral type */ +#endif + + mem = (void *)((char *)ptr - offsetof(struct memdebug, mem)); + +#ifdef __INTEL_COMPILER +# pragma warning(pop) +#endif + + /* destroy */ + memset(mem->mem, 0x13, mem->size); + + /* free for real */ + (Curl_cfree)(mem); + + if(source) + curl_memlog("MEM %s:%d free(%p)\n", source, line, ptr); +} + +curl_socket_t curl_socket(int domain, int type, int protocol, + int line, const char *source) +{ + const char *fmt = (sizeof(curl_socket_t) == sizeof(int)) ? + "FD %s:%d socket() = %d\n" : + (sizeof(curl_socket_t) == sizeof(long)) ? + "FD %s:%d socket() = %ld\n" : + "FD %s:%d socket() = %zd\n" ; + + curl_socket_t sockfd = socket(domain, type, protocol); + if(source && (sockfd != CURL_SOCKET_BAD)) + curl_memlog(fmt, source, line, sockfd); + return sockfd; +} + +curl_socket_t curl_accept(curl_socket_t s, void *saddr, void *saddrlen, + int line, const char *source) +{ + const char *fmt = (sizeof(curl_socket_t) == sizeof(int)) ? + "FD %s:%d accept() = %d\n" : + (sizeof(curl_socket_t) == sizeof(long)) ? + "FD %s:%d accept() = %ld\n" : + "FD %s:%d accept() = %zd\n" ; + + struct sockaddr *addr = (struct sockaddr *)saddr; + curl_socklen_t *addrlen = (curl_socklen_t *)saddrlen; + curl_socket_t sockfd = accept(s, addr, addrlen); + if(source && (sockfd != CURL_SOCKET_BAD)) + curl_memlog(fmt, source, line, sockfd); + return sockfd; +} + +/* separate function to allow libcurl to mark a "faked" close */ +void curl_mark_sclose(curl_socket_t sockfd, int line, const char *source) +{ + const char *fmt = (sizeof(curl_socket_t) == sizeof(int)) ? + "FD %s:%d sclose(%d)\n" : + (sizeof(curl_socket_t) == sizeof(long)) ? + "FD %s:%d sclose(%ld)\n" : + "FD %s:%d sclose(%zd)\n" ; + + if(source) + curl_memlog(fmt, source, line, sockfd); +} + +/* this is our own defined way to close sockets on *ALL* platforms */ +int curl_sclose(curl_socket_t sockfd, int line, const char *source) +{ + int res=sclose(sockfd); + curl_mark_sclose(sockfd, line, source); + return res; +} + +FILE *curl_fopen(const char *file, const char *mode, + int line, const char *source) +{ + FILE *res=fopen(file, mode); + if(source) + curl_memlog("FILE %s:%d fopen(\"%s\",\"%s\") = %p\n", + source, line, file, mode, res); + return res; +} + +#ifdef HAVE_FDOPEN +FILE *curl_fdopen(int filedes, const char *mode, + int line, const char *source) +{ + FILE *res=fdopen(filedes, mode); + if(source) + curl_memlog("FILE %s:%d fdopen(\"%d\",\"%s\") = %p\n", + source, line, filedes, mode, res); + return res; +} +#endif + +int curl_fclose(FILE *file, int line, const char *source) +{ + int res; + + assert(file != NULL); + + res=fclose(file); + if(source) + curl_memlog("FILE %s:%d fclose(%p)\n", + source, line, file); + return res; +} + +#define LOGLINE_BUFSIZE 1024 + +/* this does the writting to the memory tracking log file */ +void curl_memlog(const char *format, ...) +{ + char *buf; + int nchars; + va_list ap; + + if(!logfile) + return; + + buf = (Curl_cmalloc)(LOGLINE_BUFSIZE); + if(!buf) + return; + + va_start(ap, format); + nchars = vsnprintf(buf, LOGLINE_BUFSIZE, format, ap); + va_end(ap); + + if(nchars > LOGLINE_BUFSIZE - 1) + nchars = LOGLINE_BUFSIZE - 1; + + if(nchars > 0) + fwrite(buf, 1, nchars, logfile); + + (Curl_cfree)(buf); +} + +#endif /* CURLDEBUG */ diff --git a/mobicore/common/curl/lib/memdebug.h b/mobicore/common/curl/lib/memdebug.h new file mode 100644 index 0000000000000000000000000000000000000000..56b9f12b2c7da5f4d51e558b9779d43819c7fdfc --- /dev/null +++ b/mobicore/common/curl/lib/memdebug.h @@ -0,0 +1,139 @@ +#ifdef CURLDEBUG +#ifndef _CURL_MEMDEBUG_H +#define _CURL_MEMDEBUG_H +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) 1998 - 2010, Daniel Stenberg, , et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at http://curl.haxx.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ***************************************************************************/ + +/* + * CAUTION: this header is designed to work when included by the app-side + * as well as the library. Do not mix with library internals! + */ + +#include "setup.h" + +#include + +#ifdef HAVE_SYS_TYPES_H +#include +#endif + +#ifdef HAVE_SYS_SOCKET_H +#include +#endif +#include + +#define logfile curl_debuglogfile + +extern FILE *logfile; + +/* memory functions */ +CURL_EXTERN void *curl_domalloc(size_t size, int line, const char *source); +CURL_EXTERN void *curl_docalloc(size_t elements, size_t size, int line, const char *source); +CURL_EXTERN void *curl_dorealloc(void *ptr, size_t size, int line, const char *source); +CURL_EXTERN void curl_dofree(void *ptr, int line, const char *source); +CURL_EXTERN char *curl_dostrdup(const char *str, int line, const char *source); +CURL_EXTERN void curl_memdebug(const char *logname); +CURL_EXTERN void curl_memlimit(long limit); +CURL_EXTERN void curl_memlog(const char *format, ...); + +/* file descriptor manipulators */ +CURL_EXTERN curl_socket_t curl_socket(int domain, int type, int protocol, + int line , const char *source); +CURL_EXTERN void curl_mark_sclose(curl_socket_t sockfd, + int line , const char *source); +CURL_EXTERN int curl_sclose(curl_socket_t sockfd, + int line , const char *source); +CURL_EXTERN curl_socket_t curl_accept(curl_socket_t s, void *a, void *alen, + int line, const char *source); + +/* FILE functions */ +CURL_EXTERN FILE *curl_fopen(const char *file, const char *mode, int line, + const char *source); +#ifdef HAVE_FDOPEN +CURL_EXTERN FILE *curl_fdopen(int filedes, const char *mode, int line, + const char *source); +#endif +CURL_EXTERN int curl_fclose(FILE *file, int line, const char *source); + +#ifndef MEMDEBUG_NODEFINES + +/* Set this symbol on the command-line, recompile all lib-sources */ +#undef strdup +#define strdup(ptr) curl_dostrdup(ptr, __LINE__, __FILE__) +#define malloc(size) curl_domalloc(size, __LINE__, __FILE__) +#define calloc(nbelem,size) curl_docalloc(nbelem, size, __LINE__, __FILE__) +#define realloc(ptr,size) curl_dorealloc(ptr, size, __LINE__, __FILE__) +#define free(ptr) curl_dofree(ptr, __LINE__, __FILE__) + +#define socket(domain,type,protocol)\ + curl_socket(domain,type,protocol,__LINE__,__FILE__) +#undef accept /* for those with accept as a macro */ +#define accept(sock,addr,len)\ + curl_accept(sock,addr,len,__LINE__,__FILE__) + +#ifdef HAVE_GETADDRINFO +#if defined(getaddrinfo) && defined(__osf__) +/* OSF/1 and Tru64 have getaddrinfo as a define already, so we cannot define + our macro as for other platforms. Instead, we redefine the new name they + define getaddrinfo to become! */ +#define ogetaddrinfo(host,serv,hint,res) \ + curl_dogetaddrinfo(host,serv,hint,res,__LINE__,__FILE__) +#else +#undef getaddrinfo +#define getaddrinfo(host,serv,hint,res) \ + curl_dogetaddrinfo(host,serv,hint,res,__LINE__,__FILE__) +#endif +#endif /* HAVE_GETADDRINFO */ + +#ifdef HAVE_GETNAMEINFO +#undef getnameinfo +#define getnameinfo(sa,salen,host,hostlen,serv,servlen,flags) \ + curl_dogetnameinfo(sa,salen,host,hostlen,serv,servlen,flags, __LINE__, \ + __FILE__) +#endif /* HAVE_GETNAMEINFO */ + +#ifdef HAVE_FREEADDRINFO +#undef freeaddrinfo +#define freeaddrinfo(data) \ + curl_dofreeaddrinfo(data,__LINE__,__FILE__) +#endif /* HAVE_FREEADDRINFO */ + +/* sclose is probably already defined, redefine it! */ +#undef sclose +#define sclose(sockfd) curl_sclose(sockfd,__LINE__,__FILE__) + +#define fake_sclose(sockfd) curl_mark_sclose(sockfd,__LINE__,__FILE__) + +#undef fopen +#define fopen(file,mode) curl_fopen(file,mode,__LINE__,__FILE__) +#undef fdopen +#define fdopen(file,mode) curl_fdopen(file,mode,__LINE__,__FILE__) +#define fclose(file) curl_fclose(file,__LINE__,__FILE__) + +#endif /* MEMDEBUG_NODEFINES */ + +#endif /* _CURL_MEMDEBUG_H */ +#endif /* CURLDEBUG */ + +#ifndef fake_sclose +#define fake_sclose(x) +#endif diff --git a/mobicore/common/curl/lib/mk-ca-bundle.pl b/mobicore/common/curl/lib/mk-ca-bundle.pl new file mode 100644 index 0000000000000000000000000000000000000000..3586dc4682c834d861a3b1d43868ccca16096bb9 --- /dev/null +++ b/mobicore/common/curl/lib/mk-ca-bundle.pl @@ -0,0 +1,186 @@ +#!/usr/bin/perl -w +# *************************************************************************** +# * _ _ ____ _ +# * Project ___| | | | _ \| | +# * / __| | | | |_) | | +# * | (__| |_| | _ <| |___ +# * \___|\___/|_| \_\_____| +# * +# * Copyright (C) 1998 - 2010, Daniel Stenberg, , et al. +# * +# * This software is licensed as described in the file COPYING, which +# * you should have received as part of this distribution. The terms +# * are also available at http://curl.haxx.se/docs/copyright.html. +# * +# * You may opt to use, copy, modify, merge, publish, distribute and/or sell +# * copies of the Software, and permit persons to whom the Software is +# * furnished to do so, under the terms of the COPYING file. +# * +# * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY +# * KIND, either express or implied. +# * +# *************************************************************************** +# This Perl script creates a fresh ca-bundle.crt file for use with libcurl. +# It downloads certdata.txt from Mozilla's source tree (see URL below), +# then parses certdata.txt and extracts CA Root Certificates into PEM format. +# These are then processed with the OpenSSL commandline tool to produce the +# final ca-bundle.crt file. +# The script is based on the parse-certs script written by Roland Krikava. +# This Perl script works on almost any platform since its only external +# dependency is the OpenSSL commandline tool for optional text listing. +# Hacked by Guenter Knauf. +# +use Getopt::Std; +use MIME::Base64; +use LWP::UserAgent; +use strict; +use vars qw($opt_b $opt_h $opt_i $opt_l $opt_n $opt_q $opt_t $opt_u $opt_v); + +my $url = 'http://mxr.mozilla.org/seamonkey/source/security/nss/lib/ckfw/builtins/certdata.txt?raw=1'; +# If the OpenSSL commandline is not in search path you can configure it here! +my $openssl = 'openssl'; + +my $version = '1.14'; + +getopts('bhilnqtuv'); + +if ($opt_i) { + print ("=" x 78 . "\n"); + print "Script Version : $version\n"; + print "Perl Version : $]\n"; + print "Operating System Name : $^O\n"; + print "Getopt::Std.pm Version : ${Getopt::Std::VERSION}\n"; + print "MIME::Base64.pm Version : ${MIME::Base64::VERSION}\n"; + print "LWP::UserAgent.pm Version : ${LWP::UserAgent::VERSION}\n"; + print "LWP.pm Version : ${LWP::VERSION}\n"; + print ("=" x 78 . "\n"); +} + +$0 =~ s/\\/\//g; +$0 = substr($0, rindex($0, '/') + 1); +if ($opt_h) { + printf("Usage:\t%s [-b] [-i] [-l] [-n] [-q] [-t] [-u] [-v] []\n", $0); + print "\t-b\tbackup an existing version of ca-bundle.crt\n"; + print "\t-i\tprint version info about used modules\n"; + print "\t-l\tprint license info about certdata.txt\n"; + print "\t-n\tno download of certdata.txt (to use existing)\n"; + print "\t-q\tbe really quiet (no progress output at all)\n"; + print "\t-t\tinclude plain text listing of certificates\n"; + print "\t-u\tunlink (remove) certdata.txt after processing\n"; + print "\t-v\tbe verbose and print out processed CAs\n"; + exit; +} + +my $crt = $ARGV[0] || 'ca-bundle.crt'; +my $txt = substr($url, rindex($url, '/') + 1); +$txt =~ s/\?.*//; + +if (!$opt_n || !-e $txt) { + print "Downloading '$txt' ...\n" if (!$opt_q); + my $ua = new LWP::UserAgent(agent => "$0/$version"); + my $req = new HTTP::Request('GET', $url); + my $res = $ua->request($req); + if ($res->is_success) { + open(TXT,">$txt") or die "Couldn't open $txt: $!"; + print TXT $res->content . "\n"; + close(TXT) or die "Couldn't close $txt: $!"; + } else { + die $res->status_line; + } +} + +if ($opt_b && -e $crt) { + my $bk = 1; + while (-e "$crt.~${bk}~") { + $bk++; + } + rename $crt, "$crt.~${bk}~"; +} + +my $format = $opt_t ? "plain text and " : ""; +my $currentdate = scalar gmtime() . " UTC"; +open(CRT,">$crt") or die "Couldn't open $crt: $!"; +print CRT <) { + if (/\*\*\*\*\* BEGIN LICENSE BLOCK \*\*\*\*\*/) { + open(CRT, ">>$crt") or die "Couldn't open $crt: $!"; + print CRT; + print if ($opt_l); + while () { + print CRT; + print if ($opt_l); + last if (/\*\*\*\*\* END LICENSE BLOCK \*\*\*\*\*/); + } + close(CRT) or die "Couldn't close $crt: $!"; + } + next if /^#|^\s*$/; + chomp; + if (/^CVS_ID\s+\"(.*)\"/) { + open(CRT, ">>$crt") or die "Couldn't open $crt: $!"; + print CRT "# $1\n"; + close(CRT) or die "Couldn't close $crt: $!"; + } + if (/^CKA_LABEL\s+[A-Z0-9]+\s+\"(.*)\"/) { + $caname = $1; + } + if (/^CKA_VALUE MULTILINE_OCTAL/) { + my $data; + while () { + last if (/^END/); + chomp; + my @octets = split(/\\/); + shift @octets; + for (@octets) { + $data .= chr(oct); + } + } + my $pem = "-----BEGIN CERTIFICATE-----\n" + . MIME::Base64::encode($data) + . "-----END CERTIFICATE-----\n"; + open(CRT, ">>$crt") or die "Couldn't open $crt: $!"; + print CRT "\n$caname\n"; + print CRT ("=" x length($caname) . "\n"); + if (!$opt_t) { + print CRT $pem; + } + close(CRT) or die "Couldn't close $crt: $!"; + if ($opt_t) { + open(TMP, "|$openssl x509 -md5 -fingerprint -text -inform PEM >> $crt") or die "Couldn't open openssl pipe: $!"; + print TMP $pem; + close(TMP) or die "Couldn't close openssl pipe: $!"; + } + print "Parsing: $caname\n" if ($opt_v); + $certnum ++; + } +} +close(TXT) or die "Couldn't close $txt: $!"; +unlink $txt if ($opt_u); +print "Done ($certnum CA certs processed).\n" if (!$opt_q); + +exit; + + diff --git a/mobicore/common/curl/lib/mk-ca-bundle.vbs b/mobicore/common/curl/lib/mk-ca-bundle.vbs new file mode 100644 index 0000000000000000000000000000000000000000..5a4b4ed9193aca1314792ed14ed03360b8b5a275 --- /dev/null +++ b/mobicore/common/curl/lib/mk-ca-bundle.vbs @@ -0,0 +1,271 @@ +'*************************************************************************** +'* _ _ ____ _ +'* Project ___| | | | _ \| | +'* / __| | | | |_) | | +'* | (__| |_| | _ <| |___ +'* \___|\___/|_| \_\_____| +'* +'* Copyright (C) 1998 - 2010, Daniel Stenberg, , et al. +'* +'* This software is licensed as described in the file COPYING, which +'* you should have received as part of this distribution. The terms +'* are also available at http://curl.haxx.se/docs/copyright.html. +'* +'* You may opt to use, copy, modify, merge, publish, distribute and/or sell +'* copies of the Software, and permit persons to whom the Software is +'* furnished to do so, under the terms of the COPYING file. +'* +'* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY +'* KIND, either express or implied. +'* +'*************************************************************************** +'* Script to fetch certdata.txt from Mozilla.org site and create a +'* ca-bundle.crt for use with OpenSSL / libcurl / libcurl bindings +'* Requires WinHttp.WinHttpRequest.5.1 and ADODB.Stream which are part of +'* W2000 SP3 or later, WXP SP1 or later, W2003 Server SP1 or later. +'* Hacked by Guenter Knauf +'*************************************************************************** +Option Explicit +Const myVersion = "0.3.5" + +Const myUrl = "http://mxr.mozilla.org/firefox/source/security/nss/lib/ckfw/builtins/certdata.txt?raw=1" + +Const myOpenssl = "openssl.exe" + +Const myCdSavF = FALSE ' Flag: save downloaded data to file certdata.txt +Const myCaBakF = TRUE ' Flag: backup existing ca-bundle certificate +Const myAskLiF = TRUE ' Flag: display certdata.txt license agreement +Const myAskTiF = TRUE ' Flag: ask to include certificate text info + +'******************* Nothing to configure below! ******************* +Dim objShell, objNetwork, objFSO, objHttp +Dim myBase, mySelf, myFh, myTmpFh, myCdData, myCdFile, myCaFile, myTmpName, myBakNum, myOptTxt, i +Set objNetwork = WScript.CreateObject("WScript.Network") +Set objShell = WScript.CreateObject("WScript.Shell") +Set objFSO = WScript.CreateObject("Scripting.FileSystemObject") +Set objHttp = WScript.CreateObject("WinHttp.WinHttpRequest.5.1") +If objHttp Is Nothing Then Set objHttp = WScript.CreateObject("WinHttp.WinHttpRequest") +myBase = Left(WScript.ScriptFullName, InstrRev(WScript.ScriptFullName, "\")) +mySelf = Left(WScript.ScriptName, InstrRev(WScript.ScriptName, ".") - 1) & " " & myVersion +myCdFile = Mid(myUrl, InstrRev(myUrl, "/") + 1, InstrRev(myUrl, "?") - InstrRev(myUrl, "/") - 1) +myCaFile = "ca-bundle.crt" +myTmpName = InputBox("Enter output filename:", mySelf, myCaFile) +If Not (myTmpName = "") Then + myCaFile = myTmpName +End If +' Lets ignore SSL invalid cert errors +objHttp.Option(4) = 256 + 512 + 4096 + 8192 +objHttp.SetTimeouts 0, 5000, 10000, 10000 +objHttp.Open "GET", myUrl, FALSE +objHttp.setRequestHeader "User-Agent", WScript.ScriptName & "/" & myVersion +objHttp.Send "" +If Not (objHttp.statusText = "OK") Then + MsgBox("Failed to download '" & myCdFile & "': " & objHttp.statusText), vbCritical, mySelf + WScript.Quit 1 +End If +' Convert data from ResponseBody instead of using ResponseText because of UTF-8 +myCdData = ConvertBinaryData(objHttp.ResponseBody) +Set objHttp = Nothing +' Write received data to file if enabled +If (myCdSavF = TRUE) Then + Set myFh = objFSO.OpenTextFile(myCdFile, 2, TRUE) + myFh.Write myCdData + myFh.Close +End If +' Backup exitsing ca-bundle certificate file +If (myCaBakF = TRUE) Then + If objFSO.FileExists(myCaFile) Then + Dim myBakFile, b + b = 1 + myBakFile = myCaFile & ".~" & b & "~" + While objFSO.FileExists(myBakFile) + b = b + 1 + myBakFile = myCaFile & ".~" & b & "~" + Wend + Set myTmpFh = objFSO.GetFile(myCaFile) + myTmpFh.Move myBakFile + End If +End If +If (myAskTiF = TRUE) Then + If (6 = objShell.PopUp("Do you want to include text information about each certificate?" & vbLf & _ + "(requires OpenSSL commandline in current directory or in search path)",, _ + mySelf, vbQuestion + vbYesNo + vbDefaultButton2)) Then + myOptTxt = TRUE + Else + myOptTxt = FALSE + End If +End If +' Process the received data +Dim myLines, myPattern, myInsideCert, myInsideLicense, myLicenseText, myNumCerts +Dim myLabel, myOctets, myData, myPem, myRev, j +myData = "" +myLines = Split(myCdData, vbLf, -1) +Set myFh = objFSO.OpenTextFile(myCaFile, 2, TRUE) +myFh.Write "##" & vbLf +myFh.Write "## " & myCaFile & " -- Bundle of CA Root Certificates" & vbLf +myFh.Write "##" & vbLf +myFh.Write "## Converted at: " & Now & vbLf +myFh.Write "##" & vbLf +myFh.Write "## This is a bundle of X.509 certificates of public Certificate Authorities" & vbLf +myFh.Write "## (CA). These were automatically extracted from Mozilla's root certificates" & vbLf +myFh.Write "## file (certdata.txt). This file can be found in the mozilla source tree:" & vbLf +myFh.Write "## '/mozilla/security/nss/lib/ckfw/builtins/certdata.txt'" & vbLf +myFh.Write "##" & vbLf +myFh.Write "## It contains the certificates in PEM format and therefore" & vbLf +myFh.Write "## can be directly used with curl / libcurl / php_curl, or with" & vbLf +myFh.Write "## an Apache+mod_ssl webserver for SSL client authentication." & vbLf +myFh.Write "## Just configure this file as the SSLCACertificateFile." & vbLf +myFh.Write "##" & vbLf +myFh.Write vbLf +For i = 0 To UBound(myLines) + If InstrRev(myLines(i), "CKA_LABEL ") Then + myPattern = "^CKA_LABEL\s+[A-Z0-9]+\s+""(.+?)""" + myLabel = RegExprFirst(myPattern, myLines(i)) + End If + If (myInsideCert = TRUE) Then + If InstrRev(myLines(i), "END") Then + myInsideCert = FALSE + myFh.Write myLabel & vbLf + myFh.Write String(Len(myLabel), "=") & vbLf + myPem = "-----BEGIN CERTIFICATE-----" & vbLf & _ + Base64Encode(myData) & vbLf & _ + "-----END CERTIFICATE-----" & vbLf + If (myOptTxt = FALSE) Then + myFh.Write myPem & vbLf + Else + Dim myCmd, myRval, myTmpIn, myTmpOut + myTmpIn = objFSO.GetSpecialFolder(2).Path & "\" & objFSO.GetTempName + myTmpOut = objFSO.GetSpecialFolder(2).Path & "\" & objFSO.GetTempName + Set myTmpFh = objFSO.OpenTextFile(myTmpIn, 2, TRUE) + myTmpFh.Write myPem + myTmpFh.Close + myCmd = myOpenssl & " x509 -md5 -fingerprint -text -inform PEM" & _ + " -in " & myTmpIn & " -out " & myTmpOut + myRval = objShell.Run (myCmd, 0, TRUE) + objFSO.DeleteFile myTmpIn, TRUE + If Not (myRval = 0) Then + MsgBox("Failed to process PEM cert with OpenSSL commandline!"), vbCritical, mySelf + objFSO.DeleteFile myTmpOut, TRUE + WScript.Quit 3 + End If + Set myTmpFh = objFSO.OpenTextFile(myTmpOut, 1) + myFh.Write myTmpFh.ReadAll & vbLf + myTmpFh.Close + objFSO.DeleteFile myTmpOut, TRUE + End If + myData = "" + myNumCerts = myNumCerts + 1 + Else + myOctets = Split(myLines(i), "\") + For j = 1 To UBound(myOctets) + myData = myData & Chr(CByte("&o" & myOctets(j))) + Next + End If + End If + If InstrRev(myLines(i), "CVS_ID ") Then + myPattern = "^CVS_ID\s+""(.+?)""" + myRev = RegExprFirst(myPattern, myLines(i)) + myFh.Write "# " & myRev & vbLf & vbLf + End If + If InstrRev(myLines(i), "CKA_VALUE MULTILINE_OCTAL") Then + myInsideCert = TRUE + End If + If InstrRev(myLines(i), "***** BEGIN LICENSE BLOCK *****") Then + myInsideLicense = TRUE + End If + If (myInsideLicense = TRUE) Then + myFh.Write myLines(i) & vbLf + myLicenseText = myLicenseText & Mid(myLines(i), 2) & vbLf + End If + If InstrRev(myLines(i), "***** END LICENSE BLOCK *****") Then + myInsideLicense = FALSE + If (myAskLiF = TRUE) Then + If Not (6 = objShell.PopUp(myLicenseText & vbLf & _ + "Do you agree to the license shown above (required to proceed) ?",, _ + mySelf, vbQuestion + vbYesNo + vbDefaultButton1)) Then + myFh.Close + objFSO.DeleteFile myCaFile, TRUE + WScript.Quit 2 + End If + End If + End If +Next +myFh.Close +objShell.PopUp "Done (" & myNumCerts & " CA certs processed).", 20, mySelf, vbInformation +WScript.Quit 0 + +Function ConvertBinaryData(arrBytes) + Dim objStream + Set objStream = CreateObject("ADODB.Stream") + objStream.Open + objStream.Type = 1 + objStream.Write arrBytes + objStream.Position = 0 + objStream.Type = 2 + objStream.Charset = "ascii" + ConvertBinaryData = objStream.ReadText + Set objStream = Nothing +End Function + +Function RegExprFirst(SearchPattern, TheString) + Dim objRegExp, Matches ' create variables. + Set objRegExp = New RegExp ' create a regular expression. + objRegExp.Pattern = SearchPattern ' sets the search pattern. + objRegExp.IgnoreCase = TRUE ' set to ignores case. + objRegExp.Global = TRUE ' set to gloabal search. + Set Matches = objRegExp.Execute(TheString) ' do the search. + If (Matches.Count) Then + RegExprFirst = Matches(0).SubMatches(0) ' return first match. + Else + RegExprFirst = "" + End If + Set objRegExp = Nothing +End Function + +Function Base64Encode(inData) + Const Base64 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/" + Dim cOut, sOut, I + + 'For each group of 3 bytes + For I = 1 To Len(inData) Step 3 + Dim nGroup, pOut, sGroup + + 'Create one long from this 3 bytes. + nGroup = &H10000 * Asc(Mid(inData, I, 1)) + _ + &H100 * MyASC(Mid(inData, I + 1, 1)) + _ + MyASC(Mid(inData, I + 2, 1)) + + 'Oct splits the long To 8 groups with 3 bits + nGroup = Oct(nGroup) + + 'Add leading zeros + nGroup = String(8 - Len(nGroup), "0") & nGroup + + 'Convert To base64 + pOut = Mid(Base64, CLng("&o" & Mid(nGroup, 1, 2)) + 1, 1) & _ + Mid(Base64, CLng("&o" & Mid(nGroup, 3, 2)) + 1, 1) & _ + Mid(Base64, CLng("&o" & Mid(nGroup, 5, 2)) + 1, 1) & _ + Mid(Base64, CLng("&o" & Mid(nGroup, 7, 2)) + 1, 1) + + 'Add the part To OutPut string + sOut = sOut + pOut + + 'Add a new line For Each 76 chars In dest (76*3/4 = 57) + If (I < Len(inData) - 2) Then + If (I + 2) Mod 57 = 0 Then sOut = sOut & vbLf + End If + Next + Select Case Len(inData) Mod 3 + Case 1: '8 bit final + sOut = Left(sOut, Len(sOut) - 2) & "==" + Case 2: '16 bit final + sOut = Left(sOut, Len(sOut) - 1) & "=" + End Select + Base64Encode = sOut +End Function + +Function MyASC(OneChar) + If OneChar = "" Then MyASC = 0 Else MyASC = Asc(OneChar) +End Function + + diff --git a/mobicore/common/curl/lib/mprintf.c b/mobicore/common/curl/lib/mprintf.c new file mode 100644 index 0000000000000000000000000000000000000000..536c0c247cebfc6e1ba398eac98c27c265e4757b --- /dev/null +++ b/mobicore/common/curl/lib/mprintf.c @@ -0,0 +1,1246 @@ +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) 1999 - 2010, Daniel Stenberg, , et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at http://curl.haxx.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + * + * Purpose: + * A merge of Bjorn Reese's format() function and Daniel's dsprintf() + * 1.0. A full blooded printf() clone with full support for $ + * everywhere (parameters, widths and precisions) including variabled + * sized parameters (like doubles, long longs, long doubles and even + * void * in 64-bit architectures). + * + * Current restrictions: + * - Max 128 parameters + * - No 'long double' support. + * + * If you ever want truly portable and good *printf() clones, the project that + * took on from here is named 'Trio' and you find more details on the trio web + * page at http://daniel.haxx.se/trio/ + */ + +#include "setup.h" +#include +#include +#include +#include +#include + +#if defined(DJGPP) && (DJGPP_MINOR < 4) +#undef _MPRINTF_REPLACE /* don't use x_was_used() here */ +#endif + +#include + +#include "curl_memory.h" +/* The last #include file should be: */ +#include "memdebug.h" + +#ifndef SIZEOF_LONG_DOUBLE +#define SIZEOF_LONG_DOUBLE 0 +#endif + +/* + * If SIZEOF_SIZE_T has not been defined, default to the size of long. + */ + +#ifndef SIZEOF_SIZE_T +# define SIZEOF_SIZE_T CURL_SIZEOF_LONG +#endif + +#ifdef HAVE_LONGLONG +# define LONG_LONG_TYPE long long +# define HAVE_LONG_LONG_TYPE +#else +# if defined(_MSC_VER) && (_MSC_VER >= 900) && (_INTEGRAL_MAX_BITS >= 64) +# define LONG_LONG_TYPE __int64 +# define HAVE_LONG_LONG_TYPE +# else +# undef LONG_LONG_TYPE +# undef HAVE_LONG_LONG_TYPE +# endif +#endif + +/* + * Max integer data types that mprintf.c is capable + */ + +#ifdef HAVE_LONG_LONG_TYPE +# define mp_intmax_t LONG_LONG_TYPE +# define mp_uintmax_t unsigned LONG_LONG_TYPE +#else +# define mp_intmax_t long +# define mp_uintmax_t unsigned long +#endif + +#define BUFFSIZE 256 /* buffer for long-to-str and float-to-str calcs */ +#define MAX_PARAMETERS 128 /* lame static limit */ + +#ifdef __AMIGA__ +# undef FORMAT_INT +#endif + +/* Lower-case digits. */ +static const char lower_digits[] = "0123456789abcdefghijklmnopqrstuvwxyz"; + +/* Upper-case digits. */ +static const char upper_digits[] = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"; + +#define OUTCHAR(x) \ + do{ \ + if(stream((unsigned char)(x), (FILE *)data) != -1) \ + done++; \ + else \ + return done; /* return immediately on failure */ \ + } while(0) + +/* Data type to read from the arglist */ +typedef enum { + FORMAT_UNKNOWN = 0, + FORMAT_STRING, + FORMAT_PTR, + FORMAT_INT, + FORMAT_INTPTR, + FORMAT_LONG, + FORMAT_LONGLONG, + FORMAT_DOUBLE, + FORMAT_LONGDOUBLE, + FORMAT_WIDTH /* For internal use */ +} FormatType; + +/* convertion and display flags */ +enum { + FLAGS_NEW = 0, + FLAGS_SPACE = 1<<0, + FLAGS_SHOWSIGN = 1<<1, + FLAGS_LEFT = 1<<2, + FLAGS_ALT = 1<<3, + FLAGS_SHORT = 1<<4, + FLAGS_LONG = 1<<5, + FLAGS_LONGLONG = 1<<6, + FLAGS_LONGDOUBLE = 1<<7, + FLAGS_PAD_NIL = 1<<8, + FLAGS_UNSIGNED = 1<<9, + FLAGS_OCTAL = 1<<10, + FLAGS_HEX = 1<<11, + FLAGS_UPPER = 1<<12, + FLAGS_WIDTH = 1<<13, /* '*' or '*$' used */ + FLAGS_WIDTHPARAM = 1<<14, /* width PARAMETER was specified */ + FLAGS_PREC = 1<<15, /* precision was specified */ + FLAGS_PRECPARAM = 1<<16, /* precision PARAMETER was specified */ + FLAGS_CHAR = 1<<17, /* %c story */ + FLAGS_FLOATE = 1<<18, /* %e or %E */ + FLAGS_FLOATG = 1<<19 /* %g or %G */ +}; + +typedef struct { + FormatType type; + int flags; + long width; /* width OR width parameter number */ + long precision; /* precision OR precision parameter number */ + union { + char *str; + void *ptr; + union { + mp_intmax_t as_signed; + mp_uintmax_t as_unsigned; + } num; + double dnum; + } data; +} va_stack_t; + +struct nsprintf { + char *buffer; + size_t length; + size_t max; +}; + +struct asprintf { + char *buffer; /* allocated buffer */ + size_t len; /* length of string */ + size_t alloc; /* length of alloc */ + int fail; /* (!= 0) if an alloc has failed and thus + the output is not the complete data */ +}; + +static long dprintf_DollarString(char *input, char **end) +{ + int number=0; + while(ISDIGIT(*input)) { + number *= 10; + number += *input-'0'; + input++; + } + if(number && ('$'==*input++)) { + *end = input; + return number; + } + return 0; +} + +static int dprintf_IsQualifierNoDollar(char c) +{ + switch (c) { + case '-': case '+': case ' ': case '#': case '.': + case '0': case '1': case '2': case '3': case '4': + case '5': case '6': case '7': case '8': case '9': + case 'h': case 'l': case 'L': case 'z': case 'q': + case '*': case 'O': + return 1; /* true */ + default: + return 0; /* false */ + } +} + +#ifdef DPRINTF_DEBUG2 +static void dprintf_Pass1Report(va_stack_t *vto, int max) +{ + int i; + char buffer[256]; + int bit; + int flags; + + for(i=0; i max_param) + max_param = this_param; + + /* + * The parameter with number 'i' should be used. Next, we need + * to get SIZE and TYPE of the parameter. Add the information + * to our array. + */ + + width = 0; + precision = 0; + + /* Handle the flags */ + + while(dprintf_IsQualifierNoDollar(*fmt)) { + switch (*fmt++) { + case ' ': + flags |= FLAGS_SPACE; + break; + case '+': + flags |= FLAGS_SHOWSIGN; + break; + case '-': + flags |= FLAGS_LEFT; + flags &= ~FLAGS_PAD_NIL; + break; + case '#': + flags |= FLAGS_ALT; + break; + case '.': + flags |= FLAGS_PREC; + if('*' == *fmt) { + /* The precision is picked from a specified parameter */ + + flags |= FLAGS_PRECPARAM; + fmt++; + param_num++; + + i = dprintf_DollarString(fmt, &fmt); + if(i) + precision = i; + else + precision = param_num; + + if(precision > max_param) + max_param = precision; + } + else { + flags |= FLAGS_PREC; + precision = strtol(fmt, &fmt, 10); + } + break; + case 'h': + flags |= FLAGS_SHORT; + break; + case 'l': + if(flags & FLAGS_LONG) + flags |= FLAGS_LONGLONG; + else + flags |= FLAGS_LONG; + break; + case 'L': + flags |= FLAGS_LONGDOUBLE; + break; + case 'q': + flags |= FLAGS_LONGLONG; + break; + case 'z': + /* the code below generates a warning if -Wunreachable-code is + used */ +#if (SIZEOF_SIZE_T > CURL_SIZEOF_LONG) + flags |= FLAGS_LONGLONG; +#else + flags |= FLAGS_LONG; +#endif + break; + case 'O': +#if (CURL_SIZEOF_CURL_OFF_T > CURL_SIZEOF_LONG) + flags |= FLAGS_LONGLONG; +#else + flags |= FLAGS_LONG; +#endif + break; + case '0': + if(!(flags & FLAGS_LEFT)) + flags |= FLAGS_PAD_NIL; + /* FALLTHROUGH */ + case '1': case '2': case '3': case '4': + case '5': case '6': case '7': case '8': case '9': + flags |= FLAGS_WIDTH; + width = strtol(fmt-1, &fmt, 10); + break; + case '*': /* Special case */ + flags |= FLAGS_WIDTHPARAM; + param_num++; + + i = dprintf_DollarString(fmt, &fmt); + if(i) + width = i; + else + width = param_num; + if(width > max_param) + max_param=width; + break; + default: + break; + } + } /* switch */ + + /* Handle the specifier */ + + i = this_param - 1; + + switch (*fmt) { + case 'S': + flags |= FLAGS_ALT; + /* FALLTHROUGH */ + case 's': + vto[i].type = FORMAT_STRING; + break; + case 'n': + vto[i].type = FORMAT_INTPTR; + break; + case 'p': + vto[i].type = FORMAT_PTR; + break; + case 'd': case 'i': + vto[i].type = FORMAT_INT; + break; + case 'u': + vto[i].type = FORMAT_INT; + flags |= FLAGS_UNSIGNED; + break; + case 'o': + vto[i].type = FORMAT_INT; + flags |= FLAGS_OCTAL; + break; + case 'x': + vto[i].type = FORMAT_INT; + flags |= FLAGS_HEX; + break; + case 'X': + vto[i].type = FORMAT_INT; + flags |= FLAGS_HEX|FLAGS_UPPER; + break; + case 'c': + vto[i].type = FORMAT_INT; + flags |= FLAGS_CHAR; + break; + case 'f': + vto[i].type = FORMAT_DOUBLE; + break; + case 'e': + vto[i].type = FORMAT_DOUBLE; + flags |= FLAGS_FLOATE; + break; + case 'E': + vto[i].type = FORMAT_DOUBLE; + flags |= FLAGS_FLOATE|FLAGS_UPPER; + break; + case 'g': + vto[i].type = FORMAT_DOUBLE; + flags |= FLAGS_FLOATG; + break; + case 'G': + vto[i].type = FORMAT_DOUBLE; + flags |= FLAGS_FLOATG|FLAGS_UPPER; + break; + default: + vto[i].type = FORMAT_UNKNOWN; + break; + } /* switch */ + + vto[i].flags = flags; + vto[i].width = width; + vto[i].precision = precision; + + if(flags & FLAGS_WIDTHPARAM) { + /* we have the width specified from a parameter, so we make that + parameter's info setup properly */ + vto[i].width = width - 1; + i = width - 1; + vto[i].type = FORMAT_WIDTH; + vto[i].flags = FLAGS_NEW; + vto[i].precision = vto[i].width = 0; /* can't use width or precision + of width! */ + } + if(flags & FLAGS_PRECPARAM) { + /* we have the precision specified from a parameter, so we make that + parameter's info setup properly */ + vto[i].precision = precision - 1; + i = precision - 1; + vto[i].type = FORMAT_WIDTH; + vto[i].flags = FLAGS_NEW; + vto[i].precision = vto[i].width = 0; /* can't use width or precision + of width! */ + } + *endpos++ = fmt + 1; /* end of this sequence */ + } + } + +#ifdef DPRINTF_DEBUG2 + dprintf_Pass1Report(vto, max_param); +#endif + + /* Read the arg list parameters into our data list */ + for (i=0; i$ sequence */ + param=dprintf_DollarString(f, &f); + + if(!param) + param = param_num; + else + --param; + + param_num++; /* increase this always to allow "%2$s %1$s %s" and then the + third %s will pick the 3rd argument */ + + p = &vto[param]; + + /* pick up the specified width */ + if(p->flags & FLAGS_WIDTHPARAM) + width = (long)vto[p->width].data.num.as_signed; + else + width = p->width; + + /* pick up the specified precision */ + if(p->flags & FLAGS_PRECPARAM) { + prec = (long)vto[p->precision].data.num.as_signed; + param_num++; /* since the precision is extraced from a parameter, we + must skip that to get to the next one properly */ + } + else if(p->flags & FLAGS_PREC) + prec = p->precision; + else + prec = -1; + + is_alt = (p->flags & FLAGS_ALT) ? 1 : 0; + + switch (p->type) { + case FORMAT_INT: + num = p->data.num.as_unsigned; + if(p->flags & FLAGS_CHAR) { + /* Character. */ + if(!(p->flags & FLAGS_LEFT)) + while(--width > 0) + OUTCHAR(' '); + OUTCHAR((char) num); + if(p->flags & FLAGS_LEFT) + while(--width > 0) + OUTCHAR(' '); + break; + } + if(p->flags & FLAGS_UNSIGNED) { + /* Decimal unsigned integer. */ + base = 10; + goto unsigned_number; + } + if(p->flags & FLAGS_OCTAL) { + /* Octal unsigned integer. */ + base = 8; + goto unsigned_number; + } + if(p->flags & FLAGS_HEX) { + /* Hexadecimal unsigned integer. */ + + digits = (p->flags & FLAGS_UPPER)? upper_digits : lower_digits; + base = 16; + goto unsigned_number; + } + + /* Decimal integer. */ + base = 10; + + is_neg = (p->data.num.as_signed < (mp_intmax_t)0) ? 1 : 0; + if(is_neg) { + /* signed_num might fail to hold absolute negative minimum by 1 */ + signed_num = p->data.num.as_signed + (mp_intmax_t)1; + signed_num = -signed_num; + num = (mp_uintmax_t)signed_num; + num += (mp_uintmax_t)1; + } + + goto number; + + unsigned_number: + /* Unsigned number of base BASE. */ + is_neg = 0; + + number: + /* Number of base BASE. */ + { + char *workend = &work[sizeof(work) - 1]; + char *w; + + /* Supply a default precision if none was given. */ + if(prec == -1) + prec = 1; + + /* Put the number in WORK. */ + w = workend; + while(num > 0) { + *w-- = digits[num % base]; + num /= base; + } + width -= (long)(workend - w); + prec -= (long)(workend - w); + + if(is_alt && base == 8 && prec <= 0) { + *w-- = '0'; + --width; + } + + if(prec > 0) { + width -= prec; + while(prec-- > 0) + *w-- = '0'; + } + + if(is_alt && base == 16) + width -= 2; + + if(is_neg || (p->flags & FLAGS_SHOWSIGN) || (p->flags & FLAGS_SPACE)) + --width; + + if(!(p->flags & FLAGS_LEFT) && !(p->flags & FLAGS_PAD_NIL)) + while(width-- > 0) + OUTCHAR(' '); + + if(is_neg) + OUTCHAR('-'); + else if(p->flags & FLAGS_SHOWSIGN) + OUTCHAR('+'); + else if(p->flags & FLAGS_SPACE) + OUTCHAR(' '); + + if(is_alt && base == 16) { + OUTCHAR('0'); + if(p->flags & FLAGS_UPPER) + OUTCHAR('X'); + else + OUTCHAR('x'); + } + + if(!(p->flags & FLAGS_LEFT) && (p->flags & FLAGS_PAD_NIL)) + while(width-- > 0) + OUTCHAR('0'); + + /* Write the number. */ + while(++w <= workend) { + OUTCHAR(*w); + } + + if(p->flags & FLAGS_LEFT) + while(width-- > 0) + OUTCHAR(' '); + } + break; + + case FORMAT_STRING: + /* String. */ + { + static const char null[] = "(nil)"; + const char *str; + size_t len; + + str = (char *) p->data.str; + if( str == NULL) { + /* Write null[] if there's space. */ + if(prec == -1 || prec >= (long) sizeof(null) - 1) { + str = null; + len = sizeof(null) - 1; + /* Disable quotes around (nil) */ + p->flags &= (~FLAGS_ALT); + } + else { + str = ""; + len = 0; + } + } + else + len = strlen(str); + + if(prec != -1 && (size_t) prec < len) + len = (size_t)prec; + width -= (long)len; + + if(p->flags & FLAGS_ALT) + OUTCHAR('"'); + + if(!(p->flags&FLAGS_LEFT)) + while(width-- > 0) + OUTCHAR(' '); + + while(len-- > 0) + OUTCHAR(*str++); + if(p->flags&FLAGS_LEFT) + while(width-- > 0) + OUTCHAR(' '); + + if(p->flags & FLAGS_ALT) + OUTCHAR('"'); + } + break; + + case FORMAT_PTR: + /* Generic pointer. */ + { + void *ptr; + ptr = (void *) p->data.ptr; + if(ptr != NULL) { + /* If the pointer is not NULL, write it as a %#x spec. */ + base = 16; + digits = (p->flags & FLAGS_UPPER)? upper_digits : lower_digits; + is_alt = 1; + num = (size_t) ptr; + is_neg = 0; + goto number; + } + else { + /* Write "(nil)" for a nil pointer. */ + static const char strnil[] = "(nil)"; + const char *point; + + width -= (long)(sizeof(strnil) - 1); + if(p->flags & FLAGS_LEFT) + while(width-- > 0) + OUTCHAR(' '); + for (point = strnil; *point != '\0'; ++point) + OUTCHAR(*point); + if(! (p->flags & FLAGS_LEFT)) + while(width-- > 0) + OUTCHAR(' '); + } + } + break; + + case FORMAT_DOUBLE: + { + char formatbuf[32]="%"; + char *fptr; + size_t left = sizeof(formatbuf)-strlen(formatbuf); + int len; + + width = -1; + if(p->flags & FLAGS_WIDTH) + width = p->width; + else if(p->flags & FLAGS_WIDTHPARAM) + width = (long)vto[p->width].data.num.as_signed; + + prec = -1; + if(p->flags & FLAGS_PREC) + prec = p->precision; + else if(p->flags & FLAGS_PRECPARAM) + prec = (long)vto[p->precision].data.num.as_signed; + + if(p->flags & FLAGS_LEFT) + strcat(formatbuf, "-"); + if(p->flags & FLAGS_SHOWSIGN) + strcat(formatbuf, "+"); + if(p->flags & FLAGS_SPACE) + strcat(formatbuf, " "); + if(p->flags & FLAGS_ALT) + strcat(formatbuf, "#"); + + fptr=&formatbuf[strlen(formatbuf)]; + + if(width >= 0) { + /* RECURSIVE USAGE */ + len = curl_msnprintf(fptr, left, "%ld", width); + fptr += len; + left -= len; + } + if(prec >= 0) { + /* RECURSIVE USAGE */ + len = curl_msnprintf(fptr, left, ".%ld", prec); + fptr += len; + } + if(p->flags & FLAGS_LONG) + *fptr++ = 'l'; + + if(p->flags & FLAGS_FLOATE) + *fptr++ = (char)((p->flags & FLAGS_UPPER) ? 'E':'e'); + else if(p->flags & FLAGS_FLOATG) + *fptr++ = (char)((p->flags & FLAGS_UPPER) ? 'G' : 'g'); + else + *fptr++ = 'f'; + + *fptr = 0; /* and a final zero termination */ + + /* NOTE NOTE NOTE!! Not all sprintf() implementations returns number + of output characters */ + (sprintf)(work, formatbuf, p->data.dnum); + + for(fptr=work; *fptr; fptr++) + OUTCHAR(*fptr); + } + break; + + case FORMAT_INTPTR: + /* Answer the count of characters written. */ +#ifdef HAVE_LONG_LONG_TYPE + if(p->flags & FLAGS_LONGLONG) + *(LONG_LONG_TYPE *) p->data.ptr = (LONG_LONG_TYPE)done; + else +#endif + if(p->flags & FLAGS_LONG) + *(long *) p->data.ptr = (long)done; + else if(!(p->flags & FLAGS_SHORT)) + *(int *) p->data.ptr = (int)done; + else + *(short *) p->data.ptr = (short)done; + break; + + default: + break; + } + f = *end++; /* goto end of %-code */ + + } + return done; +} + +/* fputc() look-alike */ +static int addbyter(int output, FILE *data) +{ + struct nsprintf *infop=(struct nsprintf *)data; + unsigned char outc = (unsigned char)output; + + if(infop->length < infop->max) { + /* only do this if we haven't reached max length yet */ + infop->buffer[0] = outc; /* store */ + infop->buffer++; /* increase pointer */ + infop->length++; /* we are now one byte larger */ + return outc; /* fputc() returns like this on success */ + } + return -1; +} + +int curl_mvsnprintf(char *buffer, size_t maxlength, const char *format, + va_list ap_save) +{ + int retcode; + struct nsprintf info; + + info.buffer = buffer; + info.length = 0; + info.max = maxlength; + + retcode = dprintf_formatf(&info, addbyter, format, ap_save); + if(info.max) { + /* we terminate this with a zero byte */ + if(info.max == info.length) + /* we're at maximum, scrap the last letter */ + info.buffer[-1] = 0; + else + info.buffer[0] = 0; + } + return retcode; +} + +int curl_msnprintf(char *buffer, size_t maxlength, const char *format, ...) +{ + int retcode; + va_list ap_save; /* argument pointer */ + va_start(ap_save, format); + retcode = curl_mvsnprintf(buffer, maxlength, format, ap_save); + va_end(ap_save); + return retcode; +} + +/* fputc() look-alike */ +static int alloc_addbyter(int output, FILE *data) +{ + struct asprintf *infop=(struct asprintf *)data; + unsigned char outc = (unsigned char)output; + + if(!infop->buffer) { + infop->buffer = malloc(32); + if(!infop->buffer) { + infop->fail = 1; + return -1; /* fail */ + } + infop->alloc = 32; + infop->len =0; + } + else if(infop->len+1 >= infop->alloc) { + char *newptr; + + newptr = realloc(infop->buffer, infop->alloc*2); + + if(!newptr) { + infop->fail = 1; + return -1; /* fail */ + } + infop->buffer = newptr; + infop->alloc *= 2; + } + + infop->buffer[ infop->len ] = outc; + + infop->len++; + + return outc; /* fputc() returns like this on success */ +} + +char *curl_maprintf(const char *format, ...) +{ + va_list ap_save; /* argument pointer */ + int retcode; + struct asprintf info; + + info.buffer = NULL; + info.len = 0; + info.alloc = 0; + info.fail = 0; + + va_start(ap_save, format); + retcode = dprintf_formatf(&info, alloc_addbyter, format, ap_save); + va_end(ap_save); + if((-1 == retcode) || info.fail) { + if(info.alloc) + free(info.buffer); + return NULL; + } + if(info.alloc) { + info.buffer[info.len] = 0; /* we terminate this with a zero byte */ + return info.buffer; + } + else + return strdup(""); +} + +char *curl_mvaprintf(const char *format, va_list ap_save) +{ + int retcode; + struct asprintf info; + + info.buffer = NULL; + info.len = 0; + info.alloc = 0; + info.fail = 0; + + retcode = dprintf_formatf(&info, alloc_addbyter, format, ap_save); + if((-1 == retcode) || info.fail) { + if(info.alloc) + free(info.buffer); + return NULL; + } + + if(info.alloc) { + info.buffer[info.len] = 0; /* we terminate this with a zero byte */ + return info.buffer; + } + else + return strdup(""); +} + +static int storebuffer(int output, FILE *data) +{ + char **buffer = (char **)data; + unsigned char outc = (unsigned char)output; + **buffer = outc; + (*buffer)++; + return outc; /* act like fputc() ! */ +} + +int curl_msprintf(char *buffer, const char *format, ...) +{ + va_list ap_save; /* argument pointer */ + int retcode; + va_start(ap_save, format); + retcode = dprintf_formatf(&buffer, storebuffer, format, ap_save); + va_end(ap_save); + *buffer=0; /* we terminate this with a zero byte */ + return retcode; +} + +int curl_mprintf(const char *format, ...) +{ + int retcode; + va_list ap_save; /* argument pointer */ + va_start(ap_save, format); + + retcode = dprintf_formatf(stdout, fputc, format, ap_save); + va_end(ap_save); + return retcode; +} + +int curl_mfprintf(FILE *whereto, const char *format, ...) +{ + int retcode; + va_list ap_save; /* argument pointer */ + va_start(ap_save, format); + retcode = dprintf_formatf(whereto, fputc, format, ap_save); + va_end(ap_save); + return retcode; +} + +int curl_mvsprintf(char *buffer, const char *format, va_list ap_save) +{ + int retcode; + retcode = dprintf_formatf(&buffer, storebuffer, format, ap_save); + *buffer=0; /* we terminate this with a zero byte */ + return retcode; +} + +int curl_mvprintf(const char *format, va_list ap_save) +{ + return dprintf_formatf(stdout, fputc, format, ap_save); +} + +int curl_mvfprintf(FILE *whereto, const char *format, va_list ap_save) +{ + return dprintf_formatf(whereto, fputc, format, ap_save); +} + +#ifdef DPRINTF_DEBUG +int main() +{ + char buffer[129]; + char *ptr; +#ifdef HAVE_LONG_LONG_TYPE + LONG_LONG_TYPE one=99; + LONG_LONG_TYPE two=100; + LONG_LONG_TYPE test = 0x1000000000LL; + curl_mprintf("%lld %lld %lld\n", one, two, test); +#endif + + curl_mprintf("%3d %5d\n", 10, 1998); + + ptr=curl_maprintf("test this then baby %s%s%s%s%s%s %d %d %d loser baby get a kiss in yer face now!", "", "pretty long string pretty long string pretty long string pretty long string pretty long string", "/", "/", "/", "pretty long string", 1998, 1999, 2001); + + puts(ptr); + + memset(ptr, 55, strlen(ptr)+1); + + free(ptr); + +#if 1 + curl_mprintf(buffer, "%s %s %d", "daniel", "stenberg", 19988); + puts(buffer); + + curl_mfprintf(stderr, "%s %#08x\n", "dummy", 65); + + printf("%s %#08x\n", "dummy", 65); + { + double tryout = 3.14156592; + curl_mprintf(buffer, "%.2g %G %f %e %E", tryout, tryout, tryout, tryout, tryout); + puts(buffer); + printf("%.2g %G %f %e %E\n", tryout, tryout, tryout, tryout, tryout); + } +#endif + + return 0; +} + +#endif diff --git a/mobicore/common/curl/lib/msvcproj.foot b/mobicore/common/curl/lib/msvcproj.foot new file mode 100644 index 0000000000000000000000000000000000000000..8ce4ca0afbdebd1c4478c3476c4841ec2f753033 --- /dev/null +++ b/mobicore/common/curl/lib/msvcproj.foot @@ -0,0 +1,11 @@ + +# Begin Group "Resource Files" + +# PROP Default_Filter "" +# Begin Source File + +SOURCE=.\libcurl.rc +# End Source File +# End Group +# End Target +# End Project diff --git a/mobicore/common/curl/lib/msvcproj.head b/mobicore/common/curl/lib/msvcproj.head new file mode 100644 index 0000000000000000000000000000000000000000..5714ef74520c74914e207ad61a468efa3f46b1c4 --- /dev/null +++ b/mobicore/common/curl/lib/msvcproj.head @@ -0,0 +1,147 @@ +# Microsoft Developer Studio Project File - Name="libcurl" - Package Owner=<4> +# Microsoft Developer Studio Generated Build File, Format Version 6.00 +# ** DO NOT EDIT ** + +# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102 +# TARGTYPE "Win32 (x86) Static Library" 0x0104 + +CFG=libcurl - Win32 LIB Debug +!MESSAGE This is not a valid makefile. To build this project using NMAKE, +!MESSAGE use the Export Makefile command and run +!MESSAGE +!MESSAGE NMAKE /f "libcurl.mak". +!MESSAGE +!MESSAGE You can specify a configuration when running NMAKE +!MESSAGE by defining the macro CFG on the command line. For example: +!MESSAGE +!MESSAGE NMAKE /f "libcurl.mak" CFG="libcurl - Win32 LIB Debug" +!MESSAGE +!MESSAGE Possible choices for configuration are: +!MESSAGE +!MESSAGE "libcurl - Win32 DLL Debug" (based on "Win32 (x86) Dynamic-Link Library") +!MESSAGE "libcurl - Win32 DLL Release" (based on "Win32 (x86) Dynamic-Link Library") +!MESSAGE "libcurl - Win32 LIB Debug" (based on "Win32 (x86) Static Library") +!MESSAGE "libcurl - Win32 LIB Release" (based on "Win32 (x86) Static Library") +!MESSAGE + +# Begin Project +# PROP AllowPerConfigDependencies 0 +# PROP Scc_ProjName "" +# PROP Scc_LocalPath "" + +!IF "$(CFG)" == "libcurl - Win32 DLL Debug" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir "DLL-Debug" +# PROP BASE Intermediate_Dir "DLL-Debug" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "DLL-Debug" +# PROP Intermediate_Dir "DLL-Debug" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +CPP=cl.exe +# ADD BASE CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "." /I "..\include" /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "BUILDING_LIBCURL" /FD /GZ /c +# ADD CPP /nologo /MDd /W3 /Gm /GX /Zi /Od /I "." /I "..\include" /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "BUILDING_LIBCURL" /FD /GZ /c +MTL=midl.exe +# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 +# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 +RSC=rc.exe +# ADD BASE RSC /l 0x409 /d "_DEBUG" +# ADD RSC /l 0x409 /d "_DEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib ws2_32.lib wldap32.lib /nologo /dll /incremental:no /map /debug /machine:I386 /out:"DLL-Debug/libcurld.dll" /implib:"DLL-Debug/libcurld_imp.lib" /pdbtype:sept +# ADD LINK32 kernel32.lib ws2_32.lib wldap32.lib /nologo /dll /incremental:no /map /debug /machine:I386 /out:"DLL-Debug/libcurld.dll" /implib:"DLL-Debug/libcurld_imp.lib" /pdbtype:sept + +!ELSEIF "$(CFG)" == "libcurl - Win32 DLL Release" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "DLL-Release" +# PROP BASE Intermediate_Dir "DLL-Release" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "DLL-Release" +# PROP Intermediate_Dir "DLL-Release" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +CPP=cl.exe +# ADD BASE CPP /nologo /MD /W3 /GX /O2 /I "." /I "..\include" /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "BUILDING_LIBCURL" /FD /c +# ADD CPP /nologo /MD /W3 /GX /O2 /I "." /I "..\include" /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "BUILDING_LIBCURL" /FD /c +MTL=midl.exe +# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 +# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 +RSC=rc.exe +# ADD BASE RSC /l 0x409 /d "NDEBUG" +# ADD RSC /l 0x409 /d "NDEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib ws2_32.lib wldap32.lib /nologo /dll /pdb:none /machine:I386 /out:"DLL-Release/libcurl.dll" /implib:"DLL-Release/libcurl_imp.lib" +# ADD LINK32 kernel32.lib ws2_32.lib wldap32.lib /nologo /dll /pdb:none /machine:I386 /out:"DLL-Release/libcurl.dll" /implib:"DLL-Release/libcurl_imp.lib" + +!ELSEIF "$(CFG)" == "libcurl - Win32 LIB Debug" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir "LIB-Debug" +# PROP BASE Intermediate_Dir "LIB-Debug" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "LIB-Debug" +# PROP Intermediate_Dir "LIB-Debug" +# PROP Target_Dir "" +CPP=cl.exe +# ADD BASE CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "." /I "..\include" /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "BUILDING_LIBCURL" /D "CURL_STATICLIB" /FD /GZ /c +# ADD CPP /nologo /MDd /W3 /Gm /GX /Zi /Od /I "." /I "..\include" /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "BUILDING_LIBCURL" /D "CURL_STATICLIB" /FD /GZ /c +RSC=rc.exe +# ADD BASE RSC /l 0x409 /d "_DEBUG" +# ADD RSC /l 0x409 /d "_DEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LIB32=link.exe -lib +# ADD BASE LIB32 /nologo /out:"LIB-Debug/libcurld.lib" /machine:I386 +# ADD LIB32 /nologo /out:"LIB-Debug/libcurld.lib" /machine:I386 + +!ELSEIF "$(CFG)" == "libcurl - Win32 LIB Release" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "LIB-Release" +# PROP BASE Intermediate_Dir "LIB-Release" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "LIB-Release" +# PROP Intermediate_Dir "LIB-Release" +# PROP Target_Dir "" +CPP=cl.exe +# ADD BASE CPP /nologo /MD /W3 /GX /O2 /I "." /I "..\include" /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "BUILDING_LIBCURL" /D "CURL_STATICLIB" /FD /c +# ADD CPP /nologo /MD /W3 /GX /O2 /I "." /I "..\include" /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "BUILDING_LIBCURL" /D "CURL_STATICLIB" /FD /c +RSC=rc.exe +# ADD BASE RSC /l 0x409 /d "NDEBUG" +# ADD RSC /l 0x409 /d "NDEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LIB32=link.exe -lib +# ADD BASE LIB32 /nologo /out:"LIB-Release/libcurl.lib" /machine:I386 +# ADD LIB32 /nologo /out:"LIB-Release/libcurl.lib" /machine:I386 + +!ENDIF + +# Begin Target + +# Name "libcurl - Win32 DLL Debug" +# Name "libcurl - Win32 DLL Release" +# Name "libcurl - Win32 LIB Debug" +# Name "libcurl - Win32 LIB Release" diff --git a/mobicore/common/curl/lib/multi.c b/mobicore/common/curl/lib/multi.c new file mode 100644 index 0000000000000000000000000000000000000000..ff4bf861b2179b7e2bfac5ba4b1ada4fb3081dd9 --- /dev/null +++ b/mobicore/common/curl/lib/multi.c @@ -0,0 +1,2786 @@ +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) 1998 - 2010, Daniel Stenberg, , et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at http://curl.haxx.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ***************************************************************************/ + +#include "setup.h" + +#ifdef HAVE_SYS_SOCKET_H +#include +#endif +#ifdef HAVE_UNISTD_H +#include +#endif + +#include + +#include "urldata.h" +#include "transfer.h" +#include "url.h" +#include "connect.h" +#include "progress.h" +#include "easyif.h" +#include "multiif.h" +#include "sendf.h" +#include "timeval.h" +#include "http.h" +#include "warnless.h" + +#define _MPRINTF_REPLACE /* use our functions only */ +#include + +#include "curl_memory.h" +/* The last #include file should be: */ +#include "memdebug.h" + +/* + CURL_SOCKET_HASH_TABLE_SIZE should be a prime number. Increasing it from 97 + to 911 takes on a 32-bit machine 4 x 804 = 3211 more bytes. Still, every + CURL handle takes 45-50 K memory, therefore this 3K are not significant. +*/ +#ifndef CURL_SOCKET_HASH_TABLE_SIZE +#define CURL_SOCKET_HASH_TABLE_SIZE 911 +#endif + +struct Curl_message { + /* the 'CURLMsg' is the part that is visible to the external user */ + struct CURLMsg extmsg; +}; + +/* NOTE: if you add a state here, add the name to the statename[] array as + well! +*/ +typedef enum { + CURLM_STATE_INIT, /* 0 - start in this state */ + CURLM_STATE_CONNECT, /* 1 - resolve/connect has been sent off */ + CURLM_STATE_WAITRESOLVE, /* 2 - awaiting the resolve to finalize */ + CURLM_STATE_WAITCONNECT, /* 3 - awaiting the connect to finalize */ + CURLM_STATE_WAITPROXYCONNECT, /* 4 - awaiting proxy CONNECT to finalize */ + CURLM_STATE_PROTOCONNECT, /* 5 - completing the protocol-specific connect + phase */ + CURLM_STATE_WAITDO, /* 6 - wait for our turn to send the request */ + CURLM_STATE_DO, /* 7 - start send off the request (part 1) */ + CURLM_STATE_DOING, /* 8 - sending off the request (part 1) */ + CURLM_STATE_DO_MORE, /* 9 - send off the request (part 2) */ + CURLM_STATE_DO_DONE, /* 10 - done sending off request */ + CURLM_STATE_WAITPERFORM, /* 11 - wait for our turn to read the response */ + CURLM_STATE_PERFORM, /* 12 - transfer data */ + CURLM_STATE_TOOFAST, /* 13 - wait because limit-rate exceeded */ + CURLM_STATE_DONE, /* 14 - post data transfer operation */ + CURLM_STATE_COMPLETED, /* 15 - operation complete */ + CURLM_STATE_MSGSENT, /* 16 - the operation complete message is sent */ + CURLM_STATE_LAST /* 17 - not a true state, never use this */ +} CURLMstate; + +/* we support N sockets per easy handle. Set the corresponding bit to what + action we should wait for */ +#define MAX_SOCKSPEREASYHANDLE 5 +#define GETSOCK_READABLE (0x00ff) +#define GETSOCK_WRITABLE (0xff00) + +struct closure { + struct closure *next; /* a simple one-way list of structs */ + struct SessionHandle *easy_handle; +}; + +struct Curl_one_easy { + /* first, two fields for the linked list of these */ + struct Curl_one_easy *next; + struct Curl_one_easy *prev; + + struct SessionHandle *easy_handle; /* the easy handle for this unit */ + struct connectdata *easy_conn; /* the "unit's" connection */ + + CURLMstate state; /* the handle's state */ + CURLcode result; /* previous result */ + + struct Curl_message msg; /* A single posted message. */ + + /* Array with the plain socket numbers this handle takes care of, in no + particular order. Note that all sockets are added to the sockhash, where + the state etc are also kept. This array is mostly used to detect when a + socket is to be removed from the hash. See singlesocket(). */ + curl_socket_t sockets[MAX_SOCKSPEREASYHANDLE]; + int numsocks; +}; + +#define CURL_MULTI_HANDLE 0x000bab1e + +#define GOOD_MULTI_HANDLE(x) \ + ((x)&&(((struct Curl_multi *)(x))->type == CURL_MULTI_HANDLE)) +#define GOOD_EASY_HANDLE(x) \ + (((struct SessionHandle *)(x))->magic == CURLEASY_MAGIC_NUMBER) + +/* This is the struct known as CURLM on the outside */ +struct Curl_multi { + /* First a simple identifier to easier detect if a user mix up + this multi handle with an easy handle. Set this to CURL_MULTI_HANDLE. */ + long type; + + /* We have a linked list with easy handles */ + struct Curl_one_easy easy; + + int num_easy; /* amount of entries in the linked list above. */ + int num_alive; /* amount of easy handles that are added but have not yet + reached COMPLETE state */ + + struct curl_llist *msglist; /* a list of messages from completed transfers */ + + /* callback function and user data pointer for the *socket() API */ + curl_socket_callback socket_cb; + void *socket_userp; + + /* Hostname cache */ + struct curl_hash *hostcache; + + /* timetree points to the splay-tree of time nodes to figure out expire + times of all currently set timers */ + struct Curl_tree *timetree; + + /* 'sockhash' is the lookup hash for socket descriptor => easy handles (note + the pluralis form, there can be more than one easy handle waiting on the + same actual socket) */ + struct curl_hash *sockhash; + + /* Whether pipelining is enabled for this multi handle */ + bool pipelining_enabled; + + /* shared connection cache */ + struct conncache *connc; + long maxconnects; /* if >0, a fixed limit of the maximum number of entries + we're allowed to grow the connection cache to */ + + /* list of easy handles kept around for doing nice connection closures */ + struct closure *closure; + + /* timer callback and user data pointer for the *socket() API */ + curl_multi_timer_callback timer_cb; + void *timer_userp; + struct timeval timer_lastcall; /* the fixed time for the timeout for the + previous callback */ +}; + +static void multi_connc_remove_handle(struct Curl_multi *multi, + struct SessionHandle *data); +static void singlesocket(struct Curl_multi *multi, + struct Curl_one_easy *easy); +static CURLMcode add_closure(struct Curl_multi *multi, + struct SessionHandle *data); +static int update_timer(struct Curl_multi *multi); + +static CURLcode addHandleToSendOrPendPipeline(struct SessionHandle *handle, + struct connectdata *conn); +static int checkPendPipeline(struct connectdata *conn); +static void moveHandleFromSendToRecvPipeline(struct SessionHandle *handle, + struct connectdata *conn); +static void moveHandleFromRecvToDonePipeline(struct SessionHandle *handle, + struct connectdata *conn); +static bool isHandleAtHead(struct SessionHandle *handle, + struct curl_llist *pipeline); +static CURLMcode add_next_timeout(struct timeval now, + struct Curl_multi *multi, + struct SessionHandle *d); + +#ifdef DEBUGBUILD +static const char * const statename[]={ + "INIT", + "CONNECT", + "WAITRESOLVE", + "WAITCONNECT", + "WAITPROXYCONNECT", + "PROTOCONNECT", + "WAITDO", + "DO", + "DOING", + "DO_MORE", + "DO_DONE", + "WAITPERFORM", + "PERFORM", + "TOOFAST", + "DONE", + "COMPLETED", + "MSGSENT", +}; +#endif + +static void multi_freetimeout(void *a, void *b); + +/* always use this function to change state, to make debugging easier */ +static void multistate(struct Curl_one_easy *easy, CURLMstate state) +{ +#ifdef DEBUGBUILD + long connectindex = -5000; +#endif + CURLMstate oldstate = easy->state; + + if(oldstate == state) + /* don't bother when the new state is the same as the old state */ + return; + + easy->state = state; + +#ifdef DEBUGBUILD + if(easy->easy_conn) { + if(easy->state > CURLM_STATE_CONNECT && + easy->state < CURLM_STATE_COMPLETED) + connectindex = easy->easy_conn->connectindex; + + infof(easy->easy_handle, + "STATE: %s => %s handle %p; (connection #%ld) \n", + statename[oldstate], statename[easy->state], + (char *)easy, connectindex); + } +#endif + if(state == CURLM_STATE_COMPLETED) + /* changing to COMPLETED means there's one less easy handle 'alive' */ + easy->easy_handle->multi->num_alive--; +} + +/* + * We add one of these structs to the sockhash for a particular socket + */ + +struct Curl_sh_entry { + struct SessionHandle *easy; + time_t timestamp; + int action; /* what action READ/WRITE this socket waits for */ + curl_socket_t socket; /* mainly to ease debugging */ + void *socketp; /* settable by users with curl_multi_assign() */ +}; +/* bits for 'action' having no bits means this socket is not expecting any + action */ +#define SH_READ 1 +#define SH_WRITE 2 + +/* make sure this socket is present in the hash for this handle */ +static struct Curl_sh_entry *sh_addentry(struct curl_hash *sh, + curl_socket_t s, + struct SessionHandle *data) +{ + struct Curl_sh_entry *there = + Curl_hash_pick(sh, (char *)&s, sizeof(curl_socket_t)); + struct Curl_sh_entry *check; + + if(there) + /* it is present, return fine */ + return there; + + /* not present, add it */ + check = calloc(1, sizeof(struct Curl_sh_entry)); + if(!check) + return NULL; /* major failure */ + check->easy = data; + check->socket = s; + + /* make/add new hash entry */ + if(NULL == Curl_hash_add(sh, (char *)&s, sizeof(curl_socket_t), check)) { + free(check); + return NULL; /* major failure */ + } + + return check; /* things are good in sockhash land */ +} + + +/* delete the given socket + handle from the hash */ +static void sh_delentry(struct curl_hash *sh, curl_socket_t s) +{ + struct Curl_sh_entry *there = + Curl_hash_pick(sh, (char *)&s, sizeof(curl_socket_t)); + + if(there) { + /* this socket is in the hash */ + /* We remove the hash entry. (This'll end up in a call to + sh_freeentry().) */ + Curl_hash_delete(sh, (char *)&s, sizeof(curl_socket_t)); + } +} + +/* + * free a sockhash entry + */ +static void sh_freeentry(void *freethis) +{ + struct Curl_sh_entry *p = (struct Curl_sh_entry *) freethis; + + if(p) + free(p); +} + +static size_t fd_key_compare(void*k1, size_t k1_len, void*k2, size_t k2_len) +{ + (void) k1_len; (void) k2_len; + + return (*((int* ) k1)) == (*((int* ) k2)); +} + +static size_t hash_fd(void* key, size_t key_length, size_t slots_num) +{ + int fd = * ((int* ) key); + (void) key_length; + + return (fd % (int)slots_num); +} + +/* + * sh_init() creates a new socket hash and returns the handle for it. + * + * Quote from README.multi_socket: + * + * "Some tests at 7000 and 9000 connections showed that the socket hash lookup + * is somewhat of a bottle neck. Its current implementation may be a bit too + * limiting. It simply has a fixed-size array, and on each entry in the array + * it has a linked list with entries. So the hash only checks which list to + * scan through. The code I had used so for used a list with merely 7 slots + * (as that is what the DNS hash uses) but with 7000 connections that would + * make an average of 1000 nodes in each list to run through. I upped that to + * 97 slots (I believe a prime is suitable) and noticed a significant speed + * increase. I need to reconsider the hash implementation or use a rather + * large default value like this. At 9000 connections I was still below 10us + * per call." + * + */ +static struct curl_hash *sh_init(void) +{ + return Curl_hash_alloc(CURL_SOCKET_HASH_TABLE_SIZE, hash_fd, fd_key_compare, + sh_freeentry); +} + +/* + * multi_addmsg() + * + * Called when a transfer is completed. Adds the given msg pointer to + * the list kept in the multi handle. + */ +static CURLMcode multi_addmsg(struct Curl_multi *multi, + struct Curl_message *msg) +{ + if(!Curl_llist_insert_next(multi->msglist, multi->msglist->tail, msg)) + return CURLM_OUT_OF_MEMORY; + + return CURLM_OK; +} + +/* + * multi_freeamsg() + * + * Callback used by the llist system when a single list entry is destroyed. + */ +static void multi_freeamsg(void *a, void *b) +{ + (void)a; + (void)b; +} + + +CURLM *curl_multi_init(void) +{ + struct Curl_multi *multi = calloc(1, sizeof(struct Curl_multi)); + + if(!multi) + return NULL; + + multi->type = CURL_MULTI_HANDLE; + + multi->hostcache = Curl_mk_dnscache(); + if(!multi->hostcache) + goto error; + + multi->sockhash = sh_init(); + if(!multi->sockhash) + goto error; + + multi->connc = Curl_mk_connc(CONNCACHE_MULTI, -1L); + if(!multi->connc) + goto error; + + multi->msglist = Curl_llist_alloc(multi_freeamsg); + if(!multi->msglist) + goto error; + + /* Let's make the doubly-linked list a circular list. This makes + the linked list code simpler and allows inserting at the end + with less work (we didn't keep a tail pointer before). */ + multi->easy.next = &multi->easy; + multi->easy.prev = &multi->easy; + + return (CURLM *) multi; + + error: + if(multi->sockhash) + Curl_hash_destroy(multi->sockhash); + if(multi->hostcache) + Curl_hash_destroy(multi->hostcache); + if(multi->connc) + Curl_rm_connc(multi->connc); + + free(multi); + return NULL; +} + +CURLMcode curl_multi_add_handle(CURLM *multi_handle, + CURL *easy_handle) +{ + struct Curl_multi *multi=(struct Curl_multi *)multi_handle; + struct Curl_one_easy *easy; + struct closure *cl; + struct closure *prev=NULL; + struct SessionHandle *data = easy_handle; + + /* First, make some basic checks that the CURLM handle is a good handle */ + if(!GOOD_MULTI_HANDLE(multi)) + return CURLM_BAD_HANDLE; + + /* Verify that we got a somewhat good easy handle too */ + if(!GOOD_EASY_HANDLE(easy_handle)) + return CURLM_BAD_EASY_HANDLE; + + /* Prevent users to add the same handle more than once! */ + if(((struct SessionHandle *)easy_handle)->multi) + /* possibly we should create a new unique error code for this condition */ + return CURLM_BAD_EASY_HANDLE; + + data->state.timeoutlist = Curl_llist_alloc(multi_freetimeout); + if(!data->state.timeoutlist) + return CURLM_OUT_OF_MEMORY; + + /* Now, time to add an easy handle to the multi stack */ + easy = calloc(1, sizeof(struct Curl_one_easy)); + if(!easy) + return CURLM_OUT_OF_MEMORY; + + cl = multi->closure; + while(cl) { + struct closure *next = cl->next; + if(cl->easy_handle == (struct SessionHandle *)easy_handle) { + /* remove this handle from the closure list */ + free(cl); + if(prev) + prev->next = next; + else + multi->closure = next; + break; /* no need to continue since this handle can only be present once + in the list */ + } + prev = cl; + cl = next; + } + + /* set the easy handle */ + easy->easy_handle = easy_handle; + multistate(easy, CURLM_STATE_INIT); + + /* set the back pointer to one_easy to assist in removal */ + easy->easy_handle->multi_pos = easy; + + /* for multi interface connections, we share DNS cache automatically if the + easy handle's one is currently private. */ + if(easy->easy_handle->dns.hostcache && + (easy->easy_handle->dns.hostcachetype == HCACHE_PRIVATE)) { + Curl_hash_destroy(easy->easy_handle->dns.hostcache); + easy->easy_handle->dns.hostcache = NULL; + easy->easy_handle->dns.hostcachetype = HCACHE_NONE; + } + + if(!easy->easy_handle->dns.hostcache || + (easy->easy_handle->dns.hostcachetype == HCACHE_NONE)) { + easy->easy_handle->dns.hostcache = multi->hostcache; + easy->easy_handle->dns.hostcachetype = HCACHE_MULTI; + } + + if(easy->easy_handle->state.connc) { + if(easy->easy_handle->state.connc->type == CONNCACHE_PRIVATE) { + /* kill old private version */ + Curl_rm_connc(easy->easy_handle->state.connc); + /* point out our shared one instead */ + easy->easy_handle->state.connc = multi->connc; + } + /* else it is already using multi? */ + } + else + /* point out our shared one */ + easy->easy_handle->state.connc = multi->connc; + + /* Make sure the type is setup correctly */ + easy->easy_handle->state.connc->type = CONNCACHE_MULTI; + + /* This adds the new entry at the back of the list + to try and maintain a FIFO queue so the pipelined + requests are in order. */ + + /* We add this new entry last in the list. We make our 'next' point to the + 'first' struct and our 'prev' point to the previous 'prev' */ + easy->next = &multi->easy; + easy->prev = multi->easy.prev; + + /* make 'easy' the last node in the chain */ + multi->easy.prev = easy; + + /* if there was a prev node, make sure its 'next' pointer links to + the new node */ + easy->prev->next = easy; + + Curl_easy_addmulti(easy_handle, multi_handle); + + /* make the SessionHandle struct refer back to this struct */ + easy->easy_handle->set.one_easy = easy; + + /* Set the timeout for this handle to expire really soon so that it will + be taken care of even when this handle is added in the midst of operation + when only the curl_multi_socket() API is used. During that flow, only + sockets that time-out or have actions will be dealt with. Since this + handle has no action yet, we make sure it times out to get things to + happen. */ + Curl_expire(easy->easy_handle, 1); + + /* increase the node-counter */ + multi->num_easy++; + + if((multi->num_easy * 4) > multi->connc->num) { + /* We want the connection cache to have plenty room. Before we supported + the shared cache every single easy handle had 5 entries in their cache + by default. */ + long newmax = multi->num_easy * 4; + + if(multi->maxconnects && (multi->maxconnects < newmax)) + /* don't grow beyond the allowed size */ + newmax = multi->maxconnects; + + if(newmax > multi->connc->num) { + /* we only do this is we can in fact grow the cache */ + CURLcode res = Curl_ch_connc(easy_handle, multi->connc, newmax); + if(res != CURLE_OK) { + /* FIXME: may need to do more cleanup here */ + curl_multi_remove_handle(multi_handle, easy_handle); + return CURLM_OUT_OF_MEMORY; + } + } + } + + /* increase the alive-counter */ + multi->num_alive++; + + /* A somewhat crude work-around for a little glitch in update_timer() that + happens if the lastcall time is set to the same time when the handle is + removed as when the next handle is added, as then the check in + update_timer() that prevents calling the application multiple times with + the same timer infor will not trigger and then the new handle's timeout + will not be notified to the app. + + The work-around is thus simply to clear the 'lastcall' variable to force + update_timer() to always trigger a callback to the app when a new easy + handle is added */ + memset(&multi->timer_lastcall, 0, sizeof(multi->timer_lastcall)); + + update_timer(multi); + return CURLM_OK; +} + +#if 0 +/* Debug-function, used like this: + * + * Curl_hash_print(multi->sockhash, debug_print_sock_hash); + * + * Enable the hash print function first by editing hash.c + */ +static void debug_print_sock_hash(void *p) +{ + struct Curl_sh_entry *sh = (struct Curl_sh_entry *)p; + + fprintf(stderr, " [easy %p/magic %x/socket %d]", + (void *)sh->easy, sh->easy->magic, (int)sh->socket); +} +#endif + +CURLMcode curl_multi_remove_handle(CURLM *multi_handle, + CURL *curl_handle) +{ + struct Curl_multi *multi=(struct Curl_multi *)multi_handle; + struct Curl_one_easy *easy; + struct SessionHandle *data = curl_handle; + + /* First, make some basic checks that the CURLM handle is a good handle */ + if(!GOOD_MULTI_HANDLE(multi)) + return CURLM_BAD_HANDLE; + + /* Verify that we got a somewhat good easy handle too */ + if(!GOOD_EASY_HANDLE(curl_handle)) + return CURLM_BAD_EASY_HANDLE; + + /* pick-up from the 'curl_handle' the kept position in the list */ + easy = data->multi_pos; + + if(easy) { + bool premature = (bool)(easy->state < CURLM_STATE_COMPLETED); + bool easy_owns_conn = (bool)(easy->easy_conn && + (easy->easy_conn->data == easy->easy_handle)); + + /* If the 'state' is not INIT or COMPLETED, we might need to do something + nice to put the easy_handle in a good known state when this returns. */ + if(premature) + /* this handle is "alive" so we need to count down the total number of + alive connections when this is removed */ + multi->num_alive--; + + if(easy->easy_conn && + (easy->easy_conn->send_pipe->size + + easy->easy_conn->recv_pipe->size > 1) && + easy->state > CURLM_STATE_WAITDO && + easy->state < CURLM_STATE_COMPLETED) { + /* If the handle is in a pipeline and has started sending off its + request but not received its reponse yet, we need to close + connection. */ + easy->easy_conn->bits.close = TRUE; + /* Set connection owner so that Curl_done() closes it. + We can sefely do this here since connection is killed. */ + easy->easy_conn->data = easy->easy_handle; + } + + /* The timer must be shut down before easy->multi is set to NULL, + else the timenode will remain in the splay tree after + curl_easy_cleanup is called. */ + Curl_expire(easy->easy_handle, 0); + + /* destroy the timeout list that is held in the easy handle */ + if(data->state.timeoutlist) { + Curl_llist_destroy(data->state.timeoutlist, NULL); + data->state.timeoutlist = NULL; + } + + if(easy->easy_handle->dns.hostcachetype == HCACHE_MULTI) { + /* clear out the usage of the shared DNS cache */ + easy->easy_handle->dns.hostcache = NULL; + easy->easy_handle->dns.hostcachetype = HCACHE_NONE; + } + + if(easy->easy_conn) { + + /* we must call Curl_done() here (if we still "own it") so that we don't + leave a half-baked one around */ + if (easy_owns_conn) { + + /* Curl_done() clears the conn->data field to lose the association + between the easy handle and the connection + + Note that this ignores the return code simply because there's + nothing really useful to do with it anyway! */ + (void)Curl_done(&easy->easy_conn, easy->result, premature); + + if(easy->easy_conn) + /* the connection is still alive, set back the association to enable + the check below to trigger TRUE */ + easy->easy_conn->data = easy->easy_handle; + } + else + /* Clear connection pipelines, if Curl_done above was not called */ + Curl_getoff_all_pipelines(easy->easy_handle, easy->easy_conn); + } + + /* figure out if the easy handle is used by one or more connections in the + cache */ + multi_connc_remove_handle(multi, easy->easy_handle); + + if(easy->easy_handle->state.connc->type == CONNCACHE_MULTI) { + /* if this was using the shared connection cache we clear the pointer + to that since we're not part of that handle anymore */ + easy->easy_handle->state.connc = NULL; + + /* Since we return the connection back to the communal connection pool + we mark the last connection as inaccessible */ + easy->easy_handle->state.lastconnect = -1; + + /* Modify the connectindex since this handle can't point to the + connection cache anymore. + + TODO: consider if this is really what we want. The connection cache + is within the multi handle and that owns the connections so we should + not need to touch connections like this when we just remove an easy + handle... + */ + if(easy->easy_conn && easy_owns_conn && + (easy->easy_conn->send_pipe->size + + easy->easy_conn->recv_pipe->size == 0)) + easy->easy_conn->connectindex = -1; + } + + /* change state without using multistate(), only to make singlesocket() do + what we want */ + easy->state = CURLM_STATE_COMPLETED; + singlesocket(multi, easy); /* to let the application know what sockets + that vanish with this handle */ + + Curl_easy_addmulti(easy->easy_handle, NULL); /* clear the association + to this multi handle */ + + { + /* make sure there's no pending message in the queue sent from this easy + handle */ + struct curl_llist_element *e; + + for(e = multi->msglist->head; e; e = e->next) { + struct Curl_message *msg = e->ptr; + + if(msg->extmsg.easy_handle == easy->easy_handle) { + Curl_llist_remove(multi->msglist, e, NULL); + /* there can only be one from this specific handle */ + break; + } + } + } + + /* make the previous node point to our next */ + if(easy->prev) + easy->prev->next = easy->next; + /* make our next point to our previous node */ + if(easy->next) + easy->next->prev = easy->prev; + + easy->easy_handle->set.one_easy = NULL; /* detached */ + + /* Null the position in the controlling structure */ + easy->easy_handle->multi_pos = NULL; + + /* NOTE NOTE NOTE + We do not touch the easy handle here! */ + free(easy); + + multi->num_easy--; /* one less to care about now */ + + update_timer(multi); + return CURLM_OK; + } + else + return CURLM_BAD_EASY_HANDLE; /* twasn't found */ +} + +bool Curl_multi_canPipeline(const struct Curl_multi* multi) +{ + return multi->pipelining_enabled; +} + +void Curl_multi_handlePipeBreak(struct SessionHandle *data) +{ + struct Curl_one_easy *one_easy = data->set.one_easy; + + if(one_easy) + one_easy->easy_conn = NULL; +} + +static int waitconnect_getsock(struct connectdata *conn, + curl_socket_t *sock, + int numsocks) +{ + if(!numsocks) + return GETSOCK_BLANK; + + sock[0] = conn->sock[FIRSTSOCKET]; + + /* when we've sent a CONNECT to a proxy, we should rather wait for the + socket to become readable to be able to get the response headers */ + if(conn->bits.tunnel_connecting) + return GETSOCK_READSOCK(0); + + return GETSOCK_WRITESOCK(0); +} + +static int domore_getsock(struct connectdata *conn, + curl_socket_t *sock, + int numsocks) +{ + if(!numsocks) + return GETSOCK_BLANK; + + /* When in DO_MORE state, we could be either waiting for us + to connect to a remote site, or we could wait for that site + to connect to us. It makes a difference in the way: if we + connect to the site we wait for the socket to become writable, if + the site connects to us we wait for it to become readable */ + sock[0] = conn->sock[SECONDARYSOCKET]; + + return GETSOCK_WRITESOCK(0); +} + +/* returns bitmapped flags for this handle and its sockets */ +static int multi_getsock(struct Curl_one_easy *easy, + curl_socket_t *socks, /* points to numsocks number + of sockets */ + int numsocks) +{ + /* If the pipe broke, or if there's no connection left for this easy handle, + then we MUST bail out now with no bitmask set. The no connection case can + happen when this is called from curl_multi_remove_handle() => + singlesocket() => multi_getsock(). + */ + if(easy->easy_handle->state.pipe_broke || !easy->easy_conn) + return 0; + + if(easy->state > CURLM_STATE_CONNECT && + easy->state < CURLM_STATE_COMPLETED) { + /* Set up ownership correctly */ + easy->easy_conn->data = easy->easy_handle; + } + + switch(easy->state) { + default: +#if 0 /* switch back on these cases to get the compiler to check for all enums + to be present */ + case CURLM_STATE_TOOFAST: /* returns 0, so will not select. */ + case CURLM_STATE_COMPLETED: + case CURLM_STATE_MSGSENT: + case CURLM_STATE_INIT: + case CURLM_STATE_CONNECT: + case CURLM_STATE_WAITDO: + case CURLM_STATE_DONE: + case CURLM_STATE_LAST: + /* this will get called with CURLM_STATE_COMPLETED when a handle is + removed */ +#endif + return 0; + + case CURLM_STATE_WAITRESOLVE: + return Curl_resolv_getsock(easy->easy_conn, socks, numsocks); + + case CURLM_STATE_PROTOCONNECT: + return Curl_protocol_getsock(easy->easy_conn, socks, numsocks); + + case CURLM_STATE_DO: + case CURLM_STATE_DOING: + return Curl_doing_getsock(easy->easy_conn, socks, numsocks); + + case CURLM_STATE_WAITPROXYCONNECT: + case CURLM_STATE_WAITCONNECT: + return waitconnect_getsock(easy->easy_conn, socks, numsocks); + + case CURLM_STATE_DO_MORE: + return domore_getsock(easy->easy_conn, socks, numsocks); + + case CURLM_STATE_DO_DONE: /* since is set after DO is completed, we switch + to waiting for the same as the *PERFORM states */ + case CURLM_STATE_PERFORM: + case CURLM_STATE_WAITPERFORM: + return Curl_single_getsock(easy->easy_conn, socks, numsocks); + } + +} + +CURLMcode curl_multi_fdset(CURLM *multi_handle, + fd_set *read_fd_set, fd_set *write_fd_set, + fd_set *exc_fd_set, int *max_fd) +{ + /* Scan through all the easy handles to get the file descriptors set. + Some easy handles may not have connected to the remote host yet, + and then we must make sure that is done. */ + struct Curl_multi *multi=(struct Curl_multi *)multi_handle; + struct Curl_one_easy *easy; + int this_max_fd=-1; + curl_socket_t sockbunch[MAX_SOCKSPEREASYHANDLE]; + int bitmap; + int i; + (void)exc_fd_set; /* not used */ + + if(!GOOD_MULTI_HANDLE(multi)) + return CURLM_BAD_HANDLE; + + easy=multi->easy.next; + while(easy != &multi->easy) { + bitmap = multi_getsock(easy, sockbunch, MAX_SOCKSPEREASYHANDLE); + + for(i=0; i< MAX_SOCKSPEREASYHANDLE; i++) { + curl_socket_t s = CURL_SOCKET_BAD; + + if(bitmap & GETSOCK_READSOCK(i)) { + FD_SET(sockbunch[i], read_fd_set); + s = sockbunch[i]; + } + if(bitmap & GETSOCK_WRITESOCK(i)) { + FD_SET(sockbunch[i], write_fd_set); + s = sockbunch[i]; + } + if(s == CURL_SOCKET_BAD) + /* this socket is unused, break out of loop */ + break; + else { + if((int)s > this_max_fd) + this_max_fd = (int)s; + } + } + + easy = easy->next; /* check next handle */ + } + + *max_fd = this_max_fd; + + return CURLM_OK; +} + +static CURLMcode multi_runsingle(struct Curl_multi *multi, + struct timeval now, + struct Curl_one_easy *easy) +{ + struct Curl_message *msg = NULL; + bool connected; + bool async; + bool protocol_connect = FALSE; + bool dophase_done; + bool done = FALSE; + CURLMcode result = CURLM_OK; + struct SingleRequest *k; + struct SessionHandle *data; + long timeout_ms; + + if(!GOOD_EASY_HANDLE(easy->easy_handle)) + return CURLM_BAD_EASY_HANDLE; + + data = easy->easy_handle; + + do { + /* this is a do-while loop just to allow a break to skip to the end + of it */ + bool disconnect_conn = FALSE; + + /* Handle the case when the pipe breaks, i.e., the connection + we're using gets cleaned up and we're left with nothing. */ + if(data->state.pipe_broke) { + infof(data, "Pipe broke: handle 0x%p, url = %s\n", + easy, data->state.path); + + if(easy->state < CURLM_STATE_COMPLETED) { + /* Head back to the CONNECT state */ + multistate(easy, CURLM_STATE_CONNECT); + result = CURLM_CALL_MULTI_PERFORM; + easy->result = CURLE_OK; + } + + data->state.pipe_broke = FALSE; + easy->easy_conn = NULL; + break; + } + + if(easy->easy_conn && easy->state > CURLM_STATE_CONNECT && + easy->state < CURLM_STATE_COMPLETED) + /* Make sure we set the connection's current owner */ + easy->easy_conn->data = data; + + if(easy->easy_conn && + (easy->state >= CURLM_STATE_CONNECT) && + (easy->state < CURLM_STATE_COMPLETED)) { + /* we need to wait for the connect state as only then is the start time + stored, but we must not check already completed handles */ + + timeout_ms = Curl_timeleft(easy->easy_conn, &now, + (easy->state <= CURLM_STATE_WAITDO)? + TRUE:FALSE); + + if(timeout_ms < 0) { + /* Handle timed out */ + if(easy->state == CURLM_STATE_WAITRESOLVE) + failf(data, "Resolving timed out after %ld milliseconds", + Curl_tvdiff(now, data->progress.t_startsingle)); + else if(easy->state == CURLM_STATE_WAITCONNECT) + failf(data, "Connection timed out after %ld milliseconds", + Curl_tvdiff(now, data->progress.t_startsingle)); + else { + k = &data->req; + failf(data, "Operation timed out after %ld milliseconds with %" + FORMAT_OFF_T " out of %" FORMAT_OFF_T " bytes received", + Curl_tvdiff(now, data->progress.t_startsingle), k->bytecount, + k->size); + } + easy->result = CURLE_OPERATION_TIMEDOUT; + multistate(easy, CURLM_STATE_COMPLETED); + break; + } + } + + switch(easy->state) { + case CURLM_STATE_INIT: + /* init this transfer. */ + easy->result=Curl_pretransfer(data); + + if(CURLE_OK == easy->result) { + /* after init, go CONNECT */ + multistate(easy, CURLM_STATE_CONNECT); + result = CURLM_CALL_MULTI_PERFORM; + + data->state.used_interface = Curl_if_multi; + } + break; + + case CURLM_STATE_CONNECT: + /* Connect. We get a connection identifier filled in. */ + Curl_pgrsTime(data, TIMER_STARTSINGLE); + easy->result = Curl_connect(data, &easy->easy_conn, + &async, &protocol_connect); + + if(CURLE_OK == easy->result) { + /* Add this handle to the send or pend pipeline */ + easy->result = addHandleToSendOrPendPipeline(data, + easy->easy_conn); + if(CURLE_OK == easy->result) { + if(async) + /* We're now waiting for an asynchronous name lookup */ + multistate(easy, CURLM_STATE_WAITRESOLVE); + else { + /* after the connect has been sent off, go WAITCONNECT unless the + protocol connect is already done and we can go directly to + WAITDO or DO! */ + result = CURLM_CALL_MULTI_PERFORM; + + if(protocol_connect) + multistate(easy, multi->pipelining_enabled? + CURLM_STATE_WAITDO:CURLM_STATE_DO); + else { +#ifndef CURL_DISABLE_HTTP + if(easy->easy_conn->bits.tunnel_connecting) + multistate(easy, CURLM_STATE_WAITPROXYCONNECT); + else +#endif + multistate(easy, CURLM_STATE_WAITCONNECT); + } + } + } + } + break; + + case CURLM_STATE_WAITRESOLVE: + /* awaiting an asynch name resolve to complete */ + { + struct Curl_dns_entry *dns = NULL; + + /* check if we have the name resolved by now */ + easy->result = Curl_is_resolved(easy->easy_conn, &dns); + + if(dns) { + /* Update sockets here. Mainly because the socket(s) may have been + closed and the application thus needs to be told, even if it is + likely that the same socket(s) will again be used further down. */ + singlesocket(multi, easy); + + /* Perform the next step in the connection phase, and then move on + to the WAITCONNECT state */ + easy->result = Curl_async_resolved(easy->easy_conn, + &protocol_connect); + + if(CURLE_OK != easy->result) + /* if Curl_async_resolved() returns failure, the connection struct + is already freed and gone */ + easy->easy_conn = NULL; /* no more connection */ + else { + /* call again please so that we get the next socket setup */ + result = CURLM_CALL_MULTI_PERFORM; + if(protocol_connect) + multistate(easy, multi->pipelining_enabled? + CURLM_STATE_WAITDO:CURLM_STATE_DO); + else { +#ifndef CURL_DISABLE_HTTP + if(easy->easy_conn->bits.tunnel_connecting) + multistate(easy, CURLM_STATE_WAITPROXYCONNECT); + else +#endif + multistate(easy, CURLM_STATE_WAITCONNECT); + } + } + } + + if(CURLE_OK != easy->result) { + /* failure detected */ + disconnect_conn = TRUE; + break; + } + } + break; + +#ifndef CURL_DISABLE_HTTP + case CURLM_STATE_WAITPROXYCONNECT: + /* this is HTTP-specific, but sending CONNECT to a proxy is HTTP... */ + easy->result = Curl_http_connect(easy->easy_conn, &protocol_connect); + + if(easy->easy_conn->bits.proxy_connect_closed) { + /* reset the error buffer */ + if(data->set.errorbuffer) + data->set.errorbuffer[0] = '\0'; + data->state.errorbuf = FALSE; + + easy->result = CURLE_OK; + result = CURLM_CALL_MULTI_PERFORM; + multistate(easy, CURLM_STATE_CONNECT); + } + else if (CURLE_OK == easy->result) { + if(!easy->easy_conn->bits.tunnel_connecting) + multistate(easy, CURLM_STATE_WAITCONNECT); + } + break; +#endif + + case CURLM_STATE_WAITCONNECT: + /* awaiting a completion of an asynch connect */ + easy->result = Curl_is_connected(easy->easy_conn, + FIRSTSOCKET, + &connected); + if(connected) { + /* see if we need to do any proxy magic first once we connected */ + easy->result = Curl_connected_proxy(easy->easy_conn); + + if(!easy->result) + /* if everything is still fine we do the protocol-specific connect + setup */ + easy->result = Curl_protocol_connect(easy->easy_conn, + &protocol_connect); + } + + if(CURLE_OK != easy->result) { + /* failure detected */ + /* Just break, the cleaning up is handled all in one place */ + disconnect_conn = TRUE; + break; + } + + if(connected) { + if(!protocol_connect) { + /* We have a TCP connection, but 'protocol_connect' may be false + and then we continue to 'STATE_PROTOCONNECT'. If protocol + connect is TRUE, we move on to STATE_DO. + BUT if we are using a proxy we must change to WAITPROXYCONNECT + */ +#ifndef CURL_DISABLE_HTTP + if(easy->easy_conn->bits.tunnel_connecting) + multistate(easy, CURLM_STATE_WAITPROXYCONNECT); + else +#endif + multistate(easy, CURLM_STATE_PROTOCONNECT); + + } + else + /* after the connect has completed, go WAITDO or DO */ + multistate(easy, multi->pipelining_enabled? + CURLM_STATE_WAITDO:CURLM_STATE_DO); + + result = CURLM_CALL_MULTI_PERFORM; + } + break; + + case CURLM_STATE_PROTOCONNECT: + /* protocol-specific connect phase */ + easy->result = Curl_protocol_connecting(easy->easy_conn, + &protocol_connect); + if((easy->result == CURLE_OK) && protocol_connect) { + /* after the connect has completed, go WAITDO or DO */ + multistate(easy, multi->pipelining_enabled? + CURLM_STATE_WAITDO:CURLM_STATE_DO); + result = CURLM_CALL_MULTI_PERFORM; + } + else if(easy->result) { + /* failure detected */ + Curl_posttransfer(data); + Curl_done(&easy->easy_conn, easy->result, FALSE); + disconnect_conn = TRUE; + } + break; + + case CURLM_STATE_WAITDO: + /* Wait for our turn to DO when we're pipelining requests */ +#ifdef DEBUGBUILD + infof(data, "Conn %ld send pipe %zu inuse %d athead %d\n", + easy->easy_conn->connectindex, + easy->easy_conn->send_pipe->size, + easy->easy_conn->writechannel_inuse?1:0, + isHandleAtHead(data, + easy->easy_conn->send_pipe)?1:0); +#endif + if(!easy->easy_conn->writechannel_inuse && + isHandleAtHead(data, + easy->easy_conn->send_pipe)) { + /* Grab the channel */ + easy->easy_conn->writechannel_inuse = TRUE; + multistate(easy, CURLM_STATE_DO); + result = CURLM_CALL_MULTI_PERFORM; + } + break; + + case CURLM_STATE_DO: + if(data->set.connect_only) { + /* keep connection open for application to use the socket */ + easy->easy_conn->bits.close = FALSE; + multistate(easy, CURLM_STATE_DONE); + easy->result = CURLE_OK; + result = CURLM_OK; + } + else { + /* Perform the protocol's DO action */ + easy->result = Curl_do(&easy->easy_conn, + &dophase_done); + + if(CURLE_OK == easy->result) { + if(!dophase_done) { + /* some steps needed for wildcard matching */ + if(data->set.wildcardmatch) { + struct WildcardData *wc = &data->wildcard; + if(wc->state == CURLWC_DONE || wc->state == CURLWC_SKIP) { + /* skip some states if it is important */ + Curl_done(&easy->easy_conn, CURLE_OK, FALSE); + multistate(easy, CURLM_STATE_DONE); + result = CURLM_CALL_MULTI_PERFORM; + break; + } + } + /* DO was not completed in one function call, we must continue + DOING... */ + multistate(easy, CURLM_STATE_DOING); + result = CURLM_OK; + } + + /* after DO, go DO_DONE... or DO_MORE */ + else if(easy->easy_conn->bits.do_more) { + /* we're supposed to do more, but we need to sit down, relax + and wait a little while first */ + multistate(easy, CURLM_STATE_DO_MORE); + result = CURLM_OK; + } + else { + /* we're done with the DO, now DO_DONE */ + multistate(easy, CURLM_STATE_DO_DONE); + result = CURLM_CALL_MULTI_PERFORM; + } + } + else if ((CURLE_SEND_ERROR == easy->result) && + easy->easy_conn->bits.reuse) { + /* + * In this situation, a connection that we were trying to use + * may have unexpectedly died. If possible, send the connection + * back to the CONNECT phase so we can try again. + */ + char *newurl = NULL; + followtype follow=FOLLOW_NONE; + CURLcode drc; + bool retry = FALSE; + + drc = Curl_retry_request(easy->easy_conn, &newurl); + if(drc) { + /* a failure here pretty much implies an out of memory */ + easy->result = drc; + disconnect_conn = TRUE; + } + else + retry = (bool)(newurl?TRUE:FALSE); + + Curl_posttransfer(data); + drc = Curl_done(&easy->easy_conn, easy->result, FALSE); + + /* When set to retry the connection, we must to go back to + * the CONNECT state */ + if(retry) { + if ((drc == CURLE_OK) || (drc == CURLE_SEND_ERROR)) { + follow = FOLLOW_RETRY; + drc = Curl_follow(data, newurl, follow); + if(drc == CURLE_OK) { + multistate(easy, CURLM_STATE_CONNECT); + result = CURLM_CALL_MULTI_PERFORM; + easy->result = CURLE_OK; + } + else { + /* Follow failed */ + easy->result = drc; + free(newurl); + } + } + else { + /* done didn't return OK or SEND_ERROR */ + easy->result = drc; + free(newurl); + } + } + else { + /* Have error handler disconnect conn if we can't retry */ + disconnect_conn = TRUE; + } + } + else { + /* failure detected */ + Curl_posttransfer(data); + Curl_done(&easy->easy_conn, easy->result, FALSE); + disconnect_conn = TRUE; + } + } + break; + + case CURLM_STATE_DOING: + /* we continue DOING until the DO phase is complete */ + easy->result = Curl_protocol_doing(easy->easy_conn, + &dophase_done); + if(CURLE_OK == easy->result) { + if(dophase_done) { + /* after DO, go PERFORM... or DO_MORE */ + if(easy->easy_conn->bits.do_more) { + /* we're supposed to do more, but we need to sit down, relax + and wait a little while first */ + multistate(easy, CURLM_STATE_DO_MORE); + result = CURLM_OK; + } + else { + /* we're done with the DO, now DO_DONE */ + multistate(easy, CURLM_STATE_DO_DONE); + result = CURLM_CALL_MULTI_PERFORM; + } + } /* dophase_done */ + } + else { + /* failure detected */ + Curl_posttransfer(data); + Curl_done(&easy->easy_conn, easy->result, FALSE); + disconnect_conn = TRUE; + } + break; + + case CURLM_STATE_DO_MORE: + /* Ready to do more? */ + easy->result = Curl_is_connected(easy->easy_conn, + SECONDARYSOCKET, + &connected); + if(connected) { + /* + * When we are connected, DO MORE and then go DO_DONE + */ + easy->result = Curl_do_more(easy->easy_conn); + + /* No need to remove ourselves from the send pipeline here since that + is done for us in Curl_done() */ + + if(CURLE_OK == easy->result) { + multistate(easy, CURLM_STATE_DO_DONE); + result = CURLM_CALL_MULTI_PERFORM; + } + else { + /* failure detected */ + Curl_posttransfer(data); + Curl_done(&easy->easy_conn, easy->result, FALSE); + disconnect_conn = TRUE; + } + } + break; + + case CURLM_STATE_DO_DONE: + /* Move ourselves from the send to recv pipeline */ + moveHandleFromSendToRecvPipeline(data, easy->easy_conn); + /* Check if we can move pending requests to send pipe */ + checkPendPipeline(easy->easy_conn); + multistate(easy, CURLM_STATE_WAITPERFORM); + result = CURLM_CALL_MULTI_PERFORM; + break; + + case CURLM_STATE_WAITPERFORM: + /* Wait for our turn to PERFORM */ + if(!easy->easy_conn->readchannel_inuse && + isHandleAtHead(data, + easy->easy_conn->recv_pipe)) { + /* Grab the channel */ + easy->easy_conn->readchannel_inuse = TRUE; + multistate(easy, CURLM_STATE_PERFORM); + result = CURLM_CALL_MULTI_PERFORM; + } +#ifdef DEBUGBUILD + else { + infof(data, "Conn %ld recv pipe %zu inuse %d athead %d\n", + easy->easy_conn->connectindex, + easy->easy_conn->recv_pipe->size, + easy->easy_conn->readchannel_inuse?1:0, + isHandleAtHead(data, + easy->easy_conn->recv_pipe)?1:0); + } +#endif + break; + + case CURLM_STATE_TOOFAST: /* limit-rate exceeded in either direction */ + /* if both rates are within spec, resume transfer */ + if( ( (data->set.max_send_speed == 0) || + (data->progress.ulspeed < data->set.max_send_speed )) && + ( (data->set.max_recv_speed == 0) || + (data->progress.dlspeed < data->set.max_recv_speed) ) ) + multistate(easy, CURLM_STATE_PERFORM); + break; + + case CURLM_STATE_PERFORM: + /* check if over send speed */ + if( (data->set.max_send_speed > 0) && + (data->progress.ulspeed > data->set.max_send_speed) ) { + int buffersize; + + multistate(easy, CURLM_STATE_TOOFAST); + + /* calculate upload rate-limitation timeout. */ + buffersize = (int)(data->set.buffer_size ? + data->set.buffer_size : BUFSIZE); + timeout_ms = Curl_sleep_time(data->set.max_send_speed, + data->progress.ulspeed, buffersize); + Curl_expire(data, timeout_ms); + break; + } + + /* check if over recv speed */ + if( (data->set.max_recv_speed > 0) && + (data->progress.dlspeed > data->set.max_recv_speed) ) { + int buffersize; + + multistate(easy, CURLM_STATE_TOOFAST); + + /* Calculate download rate-limitation timeout. */ + buffersize = (int)(data->set.buffer_size ? + data->set.buffer_size : BUFSIZE); + timeout_ms = Curl_sleep_time(data->set.max_recv_speed, + data->progress.dlspeed, buffersize); + Curl_expire(data, timeout_ms); + break; + } + + /* read/write data if it is ready to do so */ + easy->result = Curl_readwrite(easy->easy_conn, &done); + + k = &data->req; + + if(!(k->keepon & KEEP_RECV)) { + /* We're done receiving */ + easy->easy_conn->readchannel_inuse = FALSE; + } + + if(!(k->keepon & KEEP_SEND)) { + /* We're done sending */ + easy->easy_conn->writechannel_inuse = FALSE; + } + + if(easy->result) { + /* The transfer phase returned error, we mark the connection to get + * closed to prevent being re-used. This is because we can't possibly + * know if the connection is in a good shape or not now. Unless it is + * a protocol which uses two "channels" like FTP, as then the error + * happened in the data connection. + */ + if(!(easy->easy_conn->protocol & PROT_DUALCHANNEL)) + easy->easy_conn->bits.close = TRUE; + + Curl_posttransfer(data); + Curl_done(&easy->easy_conn, easy->result, FALSE); + } + else if(TRUE == done) { + char *newurl = NULL; + bool retry = FALSE; + followtype follow=FOLLOW_NONE; + + easy->result = Curl_retry_request(easy->easy_conn, &newurl); + if(!easy->result) + retry = (bool)(newurl?TRUE:FALSE); + + /* call this even if the readwrite function returned error */ + Curl_posttransfer(data); + + /* we're no longer receving */ + moveHandleFromRecvToDonePipeline(data, + easy->easy_conn); + + /* expire the new receiving pipeline head */ + if(easy->easy_conn->recv_pipe->head) + Curl_expire(easy->easy_conn->recv_pipe->head->ptr, 1); + + /* Check if we can move pending requests to send pipe */ + checkPendPipeline(easy->easy_conn); + + /* When we follow redirects or is set to retry the connection, we must + to go back to the CONNECT state */ + if(data->req.newurl || retry) { + if(!retry) { + /* if the URL is a follow-location and not just a retried request + then figure out the URL here */ + newurl = data->req.newurl; + data->req.newurl = NULL; + follow = FOLLOW_REDIR; + } + else + follow = FOLLOW_RETRY; + easy->result = Curl_done(&easy->easy_conn, CURLE_OK, FALSE); + if(easy->result == CURLE_OK) + easy->result = Curl_follow(data, newurl, follow); + if(CURLE_OK == easy->result) { + multistate(easy, CURLM_STATE_CONNECT); + result = CURLM_CALL_MULTI_PERFORM; + } + else if(newurl) + /* Since we "took it", we are in charge of freeing this on + failure */ + free(newurl); + } + else { + /* after the transfer is done, go DONE */ + + /* but first check to see if we got a location info even though we're + not following redirects */ + if (data->req.location) { + newurl = data->req.location; + data->req.location = NULL; + easy->result = Curl_follow(data, newurl, FOLLOW_FAKE); + if (easy->result) + free(newurl); + } + + multistate(easy, CURLM_STATE_DONE); + result = CURLM_CALL_MULTI_PERFORM; + } + } + + break; + + case CURLM_STATE_DONE: + + if(easy->easy_conn) { + /* Remove ourselves from the receive and done pipelines. Handle + should be on one of these lists, depending upon how we got here. */ + Curl_removeHandleFromPipeline(data, + easy->easy_conn->recv_pipe); + Curl_removeHandleFromPipeline(data, + easy->easy_conn->done_pipe); + /* Check if we can move pending requests to send pipe */ + checkPendPipeline(easy->easy_conn); + + if(easy->easy_conn->bits.stream_was_rewound) { + /* This request read past its response boundary so we quickly let + the other requests consume those bytes since there is no + guarantee that the socket will become active again */ + result = CURLM_CALL_MULTI_PERFORM; + } + + /* post-transfer command */ + easy->result = Curl_done(&easy->easy_conn, CURLE_OK, FALSE); + /* + * If there are other handles on the pipeline, Curl_done won't set + * easy_conn to NULL. In such a case, curl_multi_remove_handle() can + * access free'd data, if the connection is free'd and the handle + * removed before we perform the processing in CURLM_STATE_COMPLETED + */ + if (easy->easy_conn) + easy->easy_conn = NULL; + } + + if(data->set.wildcardmatch) { + if(data->wildcard.state != CURLWC_DONE) { + /* if a wildcard is set and we are not ending -> lets start again + with CURLM_STATE_INIT */ + result = CURLM_CALL_MULTI_PERFORM; + multistate(easy, CURLM_STATE_INIT); + break; + } + } + + /* after we have DONE what we're supposed to do, go COMPLETED, and + it doesn't matter what the Curl_done() returned! */ + multistate(easy, CURLM_STATE_COMPLETED); + + break; + + case CURLM_STATE_COMPLETED: + /* this is a completed transfer, it is likely to still be connected */ + + /* This node should be delinked from the list now and we should post + an information message that we are complete. */ + + /* Important: reset the conn pointer so that we don't point to memory + that could be freed anytime */ + easy->easy_conn = NULL; + + Curl_expire(data, 0); /* stop all timers */ + break; + + case CURLM_STATE_MSGSENT: + return CURLM_OK; /* do nothing */ + + default: + return CURLM_INTERNAL_ERROR; + } + + if(CURLM_STATE_COMPLETED > easy->state) { + if(CURLE_OK != easy->result) { + /* + * If an error was returned, and we aren't in completed state now, + * then we go to completed and consider this transfer aborted. + */ + + /* NOTE: no attempt to disconnect connections must be made + in the case blocks above - cleanup happens only here */ + + data->state.pipe_broke = FALSE; + + if(easy->easy_conn) { + /* if this has a connection, unsubscribe from the pipelines */ + easy->easy_conn->writechannel_inuse = FALSE; + easy->easy_conn->readchannel_inuse = FALSE; + Curl_removeHandleFromPipeline(data, + easy->easy_conn->send_pipe); + Curl_removeHandleFromPipeline(data, + easy->easy_conn->recv_pipe); + Curl_removeHandleFromPipeline(data, + easy->easy_conn->done_pipe); + /* Check if we can move pending requests to send pipe */ + checkPendPipeline(easy->easy_conn); + } + + if(disconnect_conn) { + /* disconnect properly */ + Curl_disconnect(easy->easy_conn, /* dead_connection */ FALSE); + + /* This is where we make sure that the easy_conn pointer is reset. + We don't have to do this in every case block above where a + failure is detected */ + easy->easy_conn = NULL; + } + + multistate(easy, CURLM_STATE_COMPLETED); + } + /* if there's still a connection to use, call the progress function */ + else if(easy->easy_conn && Curl_pgrsUpdate(easy->easy_conn)) + easy->result = CURLE_ABORTED_BY_CALLBACK; + } + } while(0); + + if(CURLM_STATE_COMPLETED == easy->state) { + if(data->dns.hostcachetype == HCACHE_MULTI) { + /* clear out the usage of the shared DNS cache */ + data->dns.hostcache = NULL; + data->dns.hostcachetype = HCACHE_NONE; + } + + /* now fill in the Curl_message with this info */ + msg = &easy->msg; + + msg->extmsg.msg = CURLMSG_DONE; + msg->extmsg.easy_handle = data; + msg->extmsg.data.result = easy->result; + + result = multi_addmsg(multi, msg); + + multistate(easy, CURLM_STATE_MSGSENT); + } + + return result; +} + + +CURLMcode curl_multi_perform(CURLM *multi_handle, int *running_handles) +{ + struct Curl_multi *multi=(struct Curl_multi *)multi_handle; + struct Curl_one_easy *easy; + CURLMcode returncode=CURLM_OK; + struct Curl_tree *t; + struct timeval now = Curl_tvnow(); + + if(!GOOD_MULTI_HANDLE(multi)) + return CURLM_BAD_HANDLE; + + easy=multi->easy.next; + while(easy != &multi->easy) { + CURLMcode result; + struct WildcardData *wc = &easy->easy_handle->wildcard; + + if(easy->easy_handle->set.wildcardmatch) { + if(!wc->filelist) { + CURLcode ret = Curl_wildcard_init(wc); /* init wildcard structures */ + if(ret) + return CURLM_OUT_OF_MEMORY; + } + } + + do + result = multi_runsingle(multi, now, easy); + while (CURLM_CALL_MULTI_PERFORM == result); + + if(easy->easy_handle->set.wildcardmatch) { + /* destruct wildcard structures if it is needed */ + if(wc->state == CURLWC_DONE || result) + Curl_wildcard_dtor(wc); + } + + if(result) + returncode = result; + + easy = easy->next; /* operate on next handle */ + } + + /* + * Simply remove all expired timers from the splay since handles are dealt + * with unconditionally by this function and curl_multi_timeout() requires + * that already passed/handled expire times are removed from the splay. + * + * It is important that the 'now' value is set at the entry of this function + * and not for the current time as it may have ticked a little while since + * then and then we risk this loop to remove timers that actually have not + * been handled! + */ + do { + multi->timetree = Curl_splaygetbest(now, multi->timetree, &t); + if(t) + /* the removed may have another timeout in queue */ + (void)add_next_timeout(now, multi, t->payload); + + } while(t); + + *running_handles = multi->num_alive; + + if( CURLM_OK >= returncode ) + update_timer(multi); + + return returncode; +} + +CURLMcode curl_multi_cleanup(CURLM *multi_handle) +{ + struct Curl_multi *multi=(struct Curl_multi *)multi_handle; + struct Curl_one_easy *easy; + struct Curl_one_easy *nexteasy; + int i; + struct closure *cl; + struct closure *n; + + if(GOOD_MULTI_HANDLE(multi)) { + multi->type = 0; /* not good anymore */ + Curl_hash_destroy(multi->hostcache); + Curl_hash_destroy(multi->sockhash); + multi->hostcache = NULL; + multi->sockhash = NULL; + + /* go over all connections that have close actions */ + for(i=0; i< multi->connc->num; i++) { + if(multi->connc->connects[i] && + multi->connc->connects[i]->protocol & PROT_CLOSEACTION) { + Curl_disconnect(multi->connc->connects[i], /* dead_connection */ FALSE); + multi->connc->connects[i] = NULL; + } + } + /* now walk through the list of handles we kept around only to be + able to close connections "properly" */ + cl = multi->closure; + while(cl) { + cl->easy_handle->state.shared_conn = NULL; /* no more shared */ + if(cl->easy_handle->state.closed) + /* close handle only if curl_easy_cleanup() already has been called + for this easy handle */ + Curl_close(cl->easy_handle); + n = cl->next; + free(cl); + cl= n; + } + + Curl_rm_connc(multi->connc); + + /* remove the pending list of messages */ + Curl_llist_destroy(multi->msglist, NULL); + + /* remove all easy handles */ + easy = multi->easy.next; + while(easy != &multi->easy) { + nexteasy=easy->next; + if(easy->easy_handle->dns.hostcachetype == HCACHE_MULTI) { + /* clear out the usage of the shared DNS cache */ + easy->easy_handle->dns.hostcache = NULL; + easy->easy_handle->dns.hostcachetype = HCACHE_NONE; + } + + /* Clear the pointer to the connection cache */ + easy->easy_handle->state.connc = NULL; + + Curl_easy_addmulti(easy->easy_handle, NULL); /* clear the association */ + + free(easy); + easy = nexteasy; + } + + free(multi); + + return CURLM_OK; + } + else + return CURLM_BAD_HANDLE; +} + +/* + * curl_multi_info_read() + * + * This function is the primary way for a multi/multi_socket application to + * figure out if a transfer has ended. We MUST make this function as fast as + * possible as it will be polled frequently and we MUST NOT scan any lists in + * here to figure out things. We must scale fine to thousands of handles and + * beyond. The current design is fully O(1). + */ + +CURLMsg *curl_multi_info_read(CURLM *multi_handle, int *msgs_in_queue) +{ + struct Curl_multi *multi=(struct Curl_multi *)multi_handle; + struct Curl_message *msg; + + *msgs_in_queue = 0; /* default to none */ + + if(GOOD_MULTI_HANDLE(multi) && Curl_llist_count(multi->msglist)) { + /* there is one or more messages in the list */ + struct curl_llist_element *e; + + /* extract the head of the list to return */ + e = multi->msglist->head; + + msg = e->ptr; + + /* remove the extracted entry */ + Curl_llist_remove(multi->msglist, e, NULL); + + *msgs_in_queue = curlx_uztosi(Curl_llist_count(multi->msglist)); + + return &msg->extmsg; + } + else + return NULL; +} + +/* + * singlesocket() checks what sockets we deal with and their "action state" + * and if we have a different state in any of those sockets from last time we + * call the callback accordingly. + */ +static void singlesocket(struct Curl_multi *multi, + struct Curl_one_easy *easy) +{ + curl_socket_t socks[MAX_SOCKSPEREASYHANDLE]; + int i; + struct Curl_sh_entry *entry; + curl_socket_t s; + int num; + unsigned int curraction; + struct Curl_one_easy *easy_by_hash; + bool remove_sock_from_hash; + + for(i=0; i< MAX_SOCKSPEREASYHANDLE; i++) + socks[i] = CURL_SOCKET_BAD; + + /* Fill in the 'current' struct with the state as it is now: what sockets to + supervise and for what actions */ + curraction = multi_getsock(easy, socks, MAX_SOCKSPEREASYHANDLE); + + /* We have 0 .. N sockets already and we get to know about the 0 .. M + sockets we should have from now on. Detect the differences, remove no + longer supervised ones and add new ones */ + + /* walk over the sockets we got right now */ + for(i=0; (i< MAX_SOCKSPEREASYHANDLE) && + (curraction & (GETSOCK_READSOCK(i) | GETSOCK_WRITESOCK(i))); + i++) { + int action = CURL_POLL_NONE; + + s = socks[i]; + + /* get it from the hash */ + entry = Curl_hash_pick(multi->sockhash, (char *)&s, sizeof(s)); + + if(curraction & GETSOCK_READSOCK(i)) + action |= CURL_POLL_IN; + if(curraction & GETSOCK_WRITESOCK(i)) + action |= CURL_POLL_OUT; + + if(entry) { + /* yeps, already present so check if it has the same action set */ + if(entry->action == action) + /* same, continue */ + continue; + } + else { + /* this is a socket we didn't have before, add it! */ + entry = sh_addentry(multi->sockhash, s, easy->easy_handle); + if(!entry) + /* fatal */ + return; + } + + /* we know (entry != NULL) at this point, see the logic above */ + multi->socket_cb(easy->easy_handle, + s, + action, + multi->socket_userp, + entry->socketp); + + entry->action = action; /* store the current action state */ + } + + num = i; /* number of sockets */ + + /* when we've walked over all the sockets we should have right now, we must + make sure to detect sockets that are removed */ + for(i=0; i< easy->numsocks; i++) { + int j; + s = easy->sockets[i]; + for(j=0; jsockhash, (char *)&s, sizeof(s)); + if(entry) { + /* check if the socket to be removed serves a connection which has + other easy-s in a pipeline. In this case the socket should not be + removed. */ + struct connectdata *easy_conn; + + easy_by_hash = entry->easy->multi_pos; + easy_conn = easy_by_hash->easy_conn; + if(easy_conn) { + if (easy_conn->recv_pipe && easy_conn->recv_pipe->size > 1) { + /* the handle should not be removed from the pipe yet */ + remove_sock_from_hash = FALSE; + + /* Update the sockhash entry to instead point to the next in line + for the recv_pipe, or the first (in case this particular easy + isn't already) */ + if (entry->easy == easy->easy_handle) { + if (isHandleAtHead(easy->easy_handle, easy_conn->recv_pipe)) + entry->easy = easy_conn->recv_pipe->head->next->ptr; + else + entry->easy = easy_conn->recv_pipe->head->ptr; + } + } + if (easy_conn->send_pipe && easy_conn->send_pipe->size > 1) { + /* the handle should not be removed from the pipe yet */ + remove_sock_from_hash = FALSE; + + /* Update the sockhash entry to instead point to the next in line + for the send_pipe, or the first (in case this particular easy + isn't already) */ + if (entry->easy == easy->easy_handle) { + if (isHandleAtHead(easy->easy_handle, easy_conn->send_pipe)) + entry->easy = easy_conn->send_pipe->head->next->ptr; + else + entry->easy = easy_conn->send_pipe->head->ptr; + } + } + /* Don't worry about overwriting recv_pipe head with send_pipe_head, + when action will be asked on the socket (see multi_socket()), the + head of the correct pipe will be taken according to the + action. */ + } + } + else + /* just a precaution, this socket really SHOULD be in the hash already + but in case it isn't, we don't have to tell the app to remove it + either since it never got to know about it */ + remove_sock_from_hash = FALSE; + + if (remove_sock_from_hash) { + multi->socket_cb(easy->easy_handle, + s, + CURL_POLL_REMOVE, + multi->socket_userp, + entry ? entry->socketp : NULL); + sh_delentry(multi->sockhash, s); + } + + } + } + + memcpy(easy->sockets, socks, num*sizeof(curl_socket_t)); + easy->numsocks = num; +} + +/* + * add_next_timeout() + * + * Each SessionHandle has a list of timeouts. The add_next_timeout() is called + * when it has just been removed from the splay tree because the timeout has + * expired. This function is then to advance in the list to pick the next + * timeout to use (skip the already expired ones) and add this node back to + * the splay tree again. + * + * The splay tree only has each sessionhandle as a single node and the nearest + * timeout is used to sort it on. + */ +static CURLMcode add_next_timeout(struct timeval now, + struct Curl_multi *multi, + struct SessionHandle *d) +{ + struct timeval *tv = &d->state.expiretime; + struct curl_llist *list = d->state.timeoutlist; + struct curl_llist_element *e; + + /* move over the timeout list for this specific handle and remove all + timeouts that are now passed tense and store the next pending + timeout in *tv */ + for(e = list->head; e; ) { + struct curl_llist_element *n = e->next; + long diff = curlx_tvdiff(*(struct timeval *)e->ptr, now); + if(diff <= 0) + /* remove outdated entry */ + Curl_llist_remove(list, e, NULL); + else + /* the list is sorted so get out on the first mismatch */ + break; + e = n; + } + if(!list->size) { + /* clear the expire times within the handles that we remove from the + splay tree */ + tv->tv_sec = 0; + tv->tv_usec = 0; + } + else { + e = list->head; + /* copy the first entry to 'tv' */ + memcpy(tv, e->ptr, sizeof(*tv)); + + /* remove first entry from list */ + Curl_llist_remove(list, e, NULL); + + /* insert this node again into the splay */ + multi->timetree = Curl_splayinsert(*tv, multi->timetree, + &d->state.timenode); + } + return CURLM_OK; +} + + +static CURLMcode multi_socket(struct Curl_multi *multi, + bool checkall, + curl_socket_t s, + int ev_bitmask, + int *running_handles) +{ + CURLMcode result = CURLM_OK; + struct SessionHandle *data = NULL; + struct Curl_tree *t; + struct timeval now = Curl_tvnow(); + + if(checkall) { + struct Curl_one_easy *easyp; + /* *perform() deals with running_handles on its own */ + result = curl_multi_perform(multi, running_handles); + + /* walk through each easy handle and do the socket state change magic + and callbacks */ + easyp=multi->easy.next; + while(easyp != &multi->easy) { + singlesocket(multi, easyp); + easyp = easyp->next; + } + + /* or should we fall-through and do the timer-based stuff? */ + return result; + } + else if(s != CURL_SOCKET_TIMEOUT) { + + struct Curl_sh_entry *entry = + Curl_hash_pick(multi->sockhash, (char *)&s, sizeof(s)); + + if(!entry) + /* Unmatched socket, we can't act on it but we ignore this fact. In + real-world tests it has been proved that libevent can in fact give + the application actions even though the socket was just previously + asked to get removed, so thus we better survive stray socket actions + and just move on. */ + ; + else { + data = entry->easy; + + if(data->magic != CURLEASY_MAGIC_NUMBER) + /* bad bad bad bad bad bad bad */ + return CURLM_INTERNAL_ERROR; + + /* If the pipeline is enabled, take the handle which is in the head of + the pipeline. If we should write into the socket, take the send_pipe + head. If we should read from the socket, take the recv_pipe head. */ + if(data->set.one_easy->easy_conn) { + if ((ev_bitmask & CURL_POLL_OUT) && + data->set.one_easy->easy_conn->send_pipe && + data->set.one_easy->easy_conn->send_pipe->head) + data = data->set.one_easy->easy_conn->send_pipe->head->ptr; + else if ((ev_bitmask & CURL_POLL_IN) && + data->set.one_easy->easy_conn->recv_pipe && + data->set.one_easy->easy_conn->recv_pipe->head) + data = data->set.one_easy->easy_conn->recv_pipe->head->ptr; + } + + if(data->set.one_easy->easy_conn) /* set socket event bitmask */ + data->set.one_easy->easy_conn->cselect_bits = ev_bitmask; + + do + result = multi_runsingle(multi, now, data->set.one_easy); + while (CURLM_CALL_MULTI_PERFORM == result); + + if(data->set.one_easy->easy_conn) + data->set.one_easy->easy_conn->cselect_bits = 0; + + if(CURLM_OK >= result) + /* get the socket(s) and check if the state has been changed since + last */ + singlesocket(multi, data->set.one_easy); + + /* Now we fall-through and do the timer-based stuff, since we don't want + to force the user to have to deal with timeouts as long as at least + one connection in fact has traffic. */ + + data = NULL; /* set data to NULL again to avoid calling + multi_runsingle() in case there's no need to */ + } + } + + now.tv_usec += 40000; /* compensate for bad precision timers that might've + triggered too early */ + if(now.tv_usec >= 1000000) { + now.tv_sec++; + now.tv_usec -= 1000000; + } + + /* + * The loop following here will go on as long as there are expire-times left + * to process in the splay and 'data' will be re-assigned for every expired + * handle we deal with. + */ + do { + /* the first loop lap 'data' can be NULL */ + if(data) { + do + result = multi_runsingle(multi, now, data->set.one_easy); + while (CURLM_CALL_MULTI_PERFORM == result); + + if(CURLM_OK >= result) + /* get the socket(s) and check if the state has been changed since + last */ + singlesocket(multi, data->set.one_easy); + } + + /* Check if there's one (more) expired timer to deal with! This function + extracts a matching node if there is one */ + + multi->timetree = Curl_splaygetbest(now, multi->timetree, &t); + if(t) { + data = t->payload; /* assign this for next loop */ + (void)add_next_timeout(now, multi, t->payload); + } + + } while(t); + + *running_handles = multi->num_alive; + return result; +} + +#undef curl_multi_setopt +CURLMcode curl_multi_setopt(CURLM *multi_handle, + CURLMoption option, ...) +{ + struct Curl_multi *multi=(struct Curl_multi *)multi_handle; + CURLMcode res = CURLM_OK; + va_list param; + + if(!GOOD_MULTI_HANDLE(multi)) + return CURLM_BAD_HANDLE; + + va_start(param, option); + + switch(option) { + case CURLMOPT_SOCKETFUNCTION: + multi->socket_cb = va_arg(param, curl_socket_callback); + break; + case CURLMOPT_SOCKETDATA: + multi->socket_userp = va_arg(param, void *); + break; + case CURLMOPT_PIPELINING: + multi->pipelining_enabled = (bool)(0 != va_arg(param, long)); + break; + case CURLMOPT_TIMERFUNCTION: + multi->timer_cb = va_arg(param, curl_multi_timer_callback); + break; + case CURLMOPT_TIMERDATA: + multi->timer_userp = va_arg(param, void *); + break; + case CURLMOPT_MAXCONNECTS: + multi->maxconnects = va_arg(param, long); + break; + default: + res = CURLM_UNKNOWN_OPTION; + break; + } + va_end(param); + return res; +} + +/* we define curl_multi_socket() in the public multi.h header */ +#undef curl_multi_socket + +CURLMcode curl_multi_socket(CURLM *multi_handle, curl_socket_t s, + int *running_handles) +{ + CURLMcode result = multi_socket((struct Curl_multi *)multi_handle, FALSE, s, + 0, running_handles); + if(CURLM_OK >= result) + update_timer((struct Curl_multi *)multi_handle); + return result; +} + +CURLMcode curl_multi_socket_action(CURLM *multi_handle, curl_socket_t s, + int ev_bitmask, int *running_handles) +{ + CURLMcode result = multi_socket((struct Curl_multi *)multi_handle, FALSE, s, + ev_bitmask, running_handles); + if(CURLM_OK >= result) + update_timer((struct Curl_multi *)multi_handle); + return result; +} + +CURLMcode curl_multi_socket_all(CURLM *multi_handle, int *running_handles) + +{ + CURLMcode result = multi_socket((struct Curl_multi *)multi_handle, + TRUE, CURL_SOCKET_BAD, 0, running_handles); + if(CURLM_OK >= result) + update_timer((struct Curl_multi *)multi_handle); + return result; +} + +static CURLMcode multi_timeout(struct Curl_multi *multi, + long *timeout_ms) +{ + static struct timeval tv_zero = {0,0}; + + if(multi->timetree) { + /* we have a tree of expire times */ + struct timeval now = Curl_tvnow(); + + /* splay the lowest to the bottom */ + multi->timetree = Curl_splay(tv_zero, multi->timetree); + + if(Curl_splaycomparekeys(multi->timetree->key, now) > 0) { + /* some time left before expiration */ + *timeout_ms = curlx_tvdiff(multi->timetree->key, now); + if(!*timeout_ms) + /* + * Since we only provide millisecond resolution on the returned value + * and the diff might be less than one millisecond here, we don't + * return zero as that may cause short bursts of busyloops on fast + * processors while the diff is still present but less than one + * millisecond! instead we return 1 until the time is ripe. + */ + *timeout_ms=1; + } + else + /* 0 means immediately */ + *timeout_ms = 0; + } + else + *timeout_ms = -1; + + return CURLM_OK; +} + +CURLMcode curl_multi_timeout(CURLM *multi_handle, + long *timeout_ms) +{ + struct Curl_multi *multi=(struct Curl_multi *)multi_handle; + + /* First, make some basic checks that the CURLM handle is a good handle */ + if(!GOOD_MULTI_HANDLE(multi)) + return CURLM_BAD_HANDLE; + + return multi_timeout(multi, timeout_ms); +} + +/* + * Tell the application it should update its timers, if it subscribes to the + * update timer callback. + */ +static int update_timer(struct Curl_multi *multi) +{ + long timeout_ms; + + if(!multi->timer_cb) + return 0; + if(multi_timeout(multi, &timeout_ms)) { + return -1; + } + if( timeout_ms < 0 ) { + static const struct timeval none={0,0}; + if(Curl_splaycomparekeys(none, multi->timer_lastcall)) { + multi->timer_lastcall = none; + /* there's no timeout now but there was one previously, tell the app to + disable it */ + return multi->timer_cb((CURLM*)multi, -1, multi->timer_userp); + } + return 0; + } + + /* When multi_timeout() is done, multi->timetree points to the node with the + * timeout we got the (relative) time-out time for. We can thus easily check + * if this is the same (fixed) time as we got in a previous call and then + * avoid calling the callback again. */ + if(Curl_splaycomparekeys(multi->timetree->key, multi->timer_lastcall) == 0) + return 0; + + multi->timer_lastcall = multi->timetree->key; + + return multi->timer_cb((CURLM*)multi, timeout_ms, multi->timer_userp); +} + +static CURLcode addHandleToSendOrPendPipeline(struct SessionHandle *handle, + struct connectdata *conn) +{ + size_t pipeLen = conn->send_pipe->size + conn->recv_pipe->size; + struct curl_llist_element *sendhead = conn->send_pipe->head; + struct curl_llist *pipeline; + CURLcode rc; + + if(!Curl_isPipeliningEnabled(handle) || + pipeLen == 0) + pipeline = conn->send_pipe; + else { + if(conn->server_supports_pipelining && + pipeLen < MAX_PIPELINE_LENGTH) + pipeline = conn->send_pipe; + else + pipeline = conn->pend_pipe; + } + + rc = Curl_addHandleToPipeline(handle, pipeline); + + if (pipeline == conn->send_pipe && sendhead != conn->send_pipe->head) { + /* this is a new one as head, expire it */ + conn->writechannel_inuse = FALSE; /* not in use yet */ + infof(conn->data, "%p is at send pipe head!\n", + conn->send_pipe->head->ptr); + Curl_expire(conn->send_pipe->head->ptr, 1); + } + + return rc; +} + +static int checkPendPipeline(struct connectdata *conn) +{ + int result = 0; + struct curl_llist_element *sendhead = conn->send_pipe->head; + + size_t pipeLen = conn->send_pipe->size + conn->recv_pipe->size; + if (conn->server_supports_pipelining || pipeLen == 0) { + struct curl_llist_element *curr = conn->pend_pipe->head; + const size_t maxPipeLen = + conn->server_supports_pipelining ? MAX_PIPELINE_LENGTH : 1; + + while(pipeLen < maxPipeLen && curr) { + Curl_llist_move(conn->pend_pipe, curr, + conn->send_pipe, conn->send_pipe->tail); + Curl_pgrsTime(curr->ptr, TIMER_PRETRANSFER); + ++result; /* count how many handles we moved */ + curr = conn->pend_pipe->head; + ++pipeLen; + } + } + + if (result) { + conn->now = Curl_tvnow(); + /* something moved, check for a new send pipeline leader */ + if(sendhead != conn->send_pipe->head) { + /* this is a new one as head, expire it */ + conn->writechannel_inuse = FALSE; /* not in use yet */ + infof(conn->data, "%p is at send pipe head!\n", + conn->send_pipe->head->ptr); + Curl_expire(conn->send_pipe->head->ptr, 1); + } + } + + return result; +} + +/* Move this transfer from the sending list to the receiving list. + + Pay special attention to the new sending list "leader" as it needs to get + checked to update what sockets it acts on. + +*/ +static void moveHandleFromSendToRecvPipeline(struct SessionHandle *handle, + struct connectdata *conn) +{ + struct curl_llist_element *curr; + + curr = conn->send_pipe->head; + while(curr) { + if(curr->ptr == handle) { + Curl_llist_move(conn->send_pipe, curr, + conn->recv_pipe, conn->recv_pipe->tail); + + if(conn->send_pipe->head) { + /* Since there's a new easy handle at the start of the send pipeline, + set its timeout value to 1ms to make it trigger instantly */ + conn->writechannel_inuse = FALSE; /* not used now */ + infof(conn->data, "%p is at send pipe head B!\n", + conn->send_pipe->head->ptr); + Curl_expire(conn->send_pipe->head->ptr, 1); + } + + /* The receiver's list is not really interesting here since either this + handle is now first in the list and we'll deal with it soon, or + another handle is already first and thus is already taken care of */ + + break; /* we're done! */ + } + curr = curr->next; + } +} + +static void moveHandleFromRecvToDonePipeline(struct SessionHandle *handle, + struct connectdata *conn) +{ + struct curl_llist_element *curr; + + curr = conn->recv_pipe->head; + while(curr) { + if(curr->ptr == handle) { + Curl_llist_move(conn->recv_pipe, curr, + conn->done_pipe, conn->done_pipe->tail); + break; + } + curr = curr->next; + } +} +static bool isHandleAtHead(struct SessionHandle *handle, + struct curl_llist *pipeline) +{ + struct curl_llist_element *curr = pipeline->head; + if(curr) + return (bool)(curr->ptr == handle); + + return FALSE; +} + +/* + * multi_freetimeout() + * + * Callback used by the llist system when a single timeout list entry is + * destroyed. + */ +static void multi_freetimeout(void *user, void *entryptr) +{ + (void)user; + + /* the entry was plain malloc()'ed */ + free(entryptr); +} + +/* + * multi_addtimeout() + * + * Add a timestamp to the list of timeouts. Keep the list sorted so that head + * of list is always the timeout nearest in time. + * + */ +static CURLMcode +multi_addtimeout(struct curl_llist *timeoutlist, + struct timeval *stamp) +{ + struct curl_llist_element *e; + struct timeval *timedup; + struct curl_llist_element *prev = NULL; + + timedup = malloc(sizeof(*timedup)); + if(!timedup) + return CURLM_OUT_OF_MEMORY; + + /* copy the timestamp */ + memcpy(timedup, stamp, sizeof(*timedup)); + + if(Curl_llist_count(timeoutlist)) { + /* find the correct spot in the list */ + for(e = timeoutlist->head; e; e = e->next) { + struct timeval *checktime = e->ptr; + long diff = curlx_tvdiff(*checktime, *timedup); + if(diff > 0) + break; + prev = e; + } + + } + /* else + this is the first timeout on the list */ + + if(!Curl_llist_insert_next(timeoutlist, prev, timedup)) { + free(timedup); + return CURLM_OUT_OF_MEMORY; + } + + return CURLM_OK; +} + +/* + * Curl_expire() + * + * given a number of milliseconds from now to use to set the 'act before + * this'-time for the transfer, to be extracted by curl_multi_timeout() + * + * Note that the timeout will be added to a queue of timeouts if it defines a + * moment in time that is later than the current head of queue. + * + * Pass zero to clear all timeout values for this handle. +*/ +void Curl_expire(struct SessionHandle *data, long milli) +{ + struct Curl_multi *multi = data->multi; + struct timeval *nowp = &data->state.expiretime; + int rc; + + /* this is only interesting for multi-interface using libcurl, and only + while there is still a multi interface struct remaining! */ + if(!multi) + return; + + if(!milli) { + /* No timeout, clear the time data. */ + if(nowp->tv_sec || nowp->tv_usec) { + /* Since this is an cleared time, we must remove the previous entry from + the splay tree */ + struct curl_llist *list = data->state.timeoutlist; + + rc = Curl_splayremovebyaddr(multi->timetree, + &data->state.timenode, + &multi->timetree); + if(rc) + infof(data, "Internal error clearing splay node = %d\n", rc); + + /* flush the timeout list too */ + while(list->size > 0) + Curl_llist_remove(list, list->tail, NULL); + + infof(data, "Expire cleared\n"); + nowp->tv_sec = 0; + nowp->tv_usec = 0; + } + } + else { + struct timeval set; + + set = Curl_tvnow(); + set.tv_sec += milli/1000; + set.tv_usec += (milli%1000)*1000; + + if(set.tv_usec >= 1000000) { + set.tv_sec++; + set.tv_usec -= 1000000; + } + + if(nowp->tv_sec || nowp->tv_usec) { + /* This means that the struct is added as a node in the splay tree. + Compare if the new time is earlier, and only remove-old/add-new if it + is. */ + long diff = curlx_tvdiff(set, *nowp); + if(diff > 0) { + /* the new expire time was later so just add it to the queue + and get out */ + multi_addtimeout(data->state.timeoutlist, &set); + return; + } + + /* the new time is newer than the presently set one, so add the current + to the queue and update the head */ + multi_addtimeout(data->state.timeoutlist, nowp); + + /* Since this is an updated time, we must remove the previous entry from + the splay tree first and then re-add the new value */ + rc = Curl_splayremovebyaddr(multi->timetree, + &data->state.timenode, + &multi->timetree); + if(rc) + infof(data, "Internal error removing splay node = %d\n", rc); + } + + *nowp = set; + data->state.timenode.payload = data; + multi->timetree = Curl_splayinsert(*nowp, + multi->timetree, + &data->state.timenode); + } +#if 0 + Curl_splayprint(multi->timetree, 0, TRUE); +#endif +} + +CURLMcode curl_multi_assign(CURLM *multi_handle, + curl_socket_t s, void *hashp) +{ + struct Curl_sh_entry *there = NULL; + struct Curl_multi *multi = (struct Curl_multi *)multi_handle; + + if(s != CURL_SOCKET_BAD) + there = Curl_hash_pick(multi->sockhash, (char *)&s, sizeof(curl_socket_t)); + + if(!there) + return CURLM_BAD_SOCKET; + + there->socketp = hashp; + + return CURLM_OK; +} + +static void multi_connc_remove_handle(struct Curl_multi *multi, + struct SessionHandle *data) +{ + /* a connection in the connection cache pointing to the given 'data' ? */ + int i; + + for(i=0; i< multi->connc->num; i++) { + struct connectdata * conn = multi->connc->connects[i]; + + if(conn && conn->data == data) { + /* If this easy_handle was the last one in charge for one or more + connections in the shared connection cache, we might need to keep + this handle around until either A) the connection is closed and + killed properly, or B) another easy_handle uses the connection. + + The reason why we need to have a easy_handle associated with a live + connection is simply that some connections will need a handle to get + closed down properly. Currently, the only connections that need to + keep a easy_handle handle around are using FTP(S). Such connections + have the PROT_CLOSEACTION bit set. + + Thus, we need to check for all connections in the shared cache that + points to this handle and are using PROT_CLOSEACTION. If there's any, + we need to add this handle to the list of "easy handles kept around + for nice connection closures". + */ + + if(conn->protocol & PROT_CLOSEACTION) { + /* this handle is still being used by a shared connection and + thus we leave it around for now */ + if(add_closure(multi, data) == CURLM_OK) + data->state.shared_conn = multi; + else { + /* out of memory - so much for graceful shutdown */ + Curl_disconnect(conn, /* dead_connection */ FALSE); + multi->connc->connects[i] = NULL; + } + } + else + /* disconect the easy handle from the connection since the connection + will now remain but this easy handle is going */ + conn->data = NULL; + } + } +} + +/* Add the given data pointer to the list of 'closure handles' that are kept + around only to be able to close some connections nicely - just make sure + that this handle isn't already added, like for the cases when an easy + handle is removed, added and removed again... */ +static CURLMcode add_closure(struct Curl_multi *multi, + struct SessionHandle *data) +{ + struct closure *cl = multi->closure; + struct closure *p = NULL; + bool add = TRUE; + + /* Before adding, scan through all the other currently kept handles and see + if there are any connections still referring to them and kill them if + not. */ + while(cl) { + struct closure *n; + bool inuse = FALSE; + int i; + + for(i=0; i< multi->connc->num; i++) { + if(multi->connc->connects[i] && + (multi->connc->connects[i]->data == cl->easy_handle)) { + inuse = TRUE; + break; + } + } + + n = cl->next; + + if(!inuse) { + /* cl->easy_handle is now killable */ + + /* unmark it as not having a connection around that uses it anymore */ + cl->easy_handle->state.shared_conn= NULL; + + if(cl->easy_handle->state.closed) { + infof(data, "Delayed kill of easy handle %p\n", cl->easy_handle); + /* close handle only if curl_easy_cleanup() already has been called + for this easy handle */ + Curl_close(cl->easy_handle); + } + if(p) + p->next = n; + else + multi->closure = n; + free(cl); + } else { + if(cl->easy_handle == data) + add = FALSE; + + p = cl; + } + + cl = n; + } + + if (add) { + cl = calloc(1, sizeof(struct closure)); + if(!cl) + return CURLM_OUT_OF_MEMORY; + + cl->easy_handle = data; + cl->next = multi->closure; + multi->closure = cl; + } + + return CURLM_OK; +} + +#ifdef DEBUGBUILD +void Curl_multi_dump(const struct Curl_multi *multi_handle) +{ + struct Curl_multi *multi=(struct Curl_multi *)multi_handle; + struct Curl_one_easy *easy; + int i; + fprintf(stderr, "* Multi status: %d handles, %d alive\n", + multi->num_easy, multi->num_alive); + for(easy=multi->easy.next; easy != &multi->easy; easy = easy->next) { + if(easy->state < CURLM_STATE_COMPLETED) { + /* only display handles that are not completed */ + fprintf(stderr, "handle %p, state %s, %d sockets\n", + (void *)easy->easy_handle, + statename[easy->state], easy->numsocks); + for(i=0; i < easy->numsocks; i++) { + curl_socket_t s = easy->sockets[i]; + struct Curl_sh_entry *entry = + Curl_hash_pick(multi->sockhash, (char *)&s, sizeof(s)); + + fprintf(stderr, "%d ", (int)s); + if(!entry) { + fprintf(stderr, "INTERNAL CONFUSION\n"); + continue; + } + fprintf(stderr, "[%s %s] ", + entry->action&CURL_POLL_IN?"RECVING":"", + entry->action&CURL_POLL_OUT?"SENDING":""); + } + if(easy->numsocks) + fprintf(stderr, "\n"); + } + } +} +#endif diff --git a/mobicore/common/curl/lib/multiif.h b/mobicore/common/curl/lib/multiif.h new file mode 100644 index 0000000000000000000000000000000000000000..76918181e4715b989a9de46c5a8d834840c0d451 --- /dev/null +++ b/mobicore/common/curl/lib/multiif.h @@ -0,0 +1,53 @@ +#ifndef __MULTIIF_H +#define __MULTIIF_H +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) 1998 - 2010, Daniel Stenberg, , et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at http://curl.haxx.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ***************************************************************************/ + +/* + * Prototypes for library-wide functions provided by multi.c + */ +void Curl_expire(struct SessionHandle *data, long milli); + +bool Curl_multi_canPipeline(const struct Curl_multi* multi); +void Curl_multi_handlePipeBreak(struct SessionHandle *data); + +/* the write bits start at bit 16 for the *getsock() bitmap */ +#define GETSOCK_WRITEBITSTART 16 + +#define GETSOCK_BLANK 0 /* no bits set */ + +/* set the bit for the given sock number to make the bitmap for writable */ +#define GETSOCK_WRITESOCK(x) (1 << (GETSOCK_WRITEBITSTART + (x))) + +/* set the bit for the given sock number to make the bitmap for readable */ +#define GETSOCK_READSOCK(x) (1 << (x)) + +#ifdef DEBUGBUILD + /* + * Curl_multi_dump is not a stable public function, this is only meant to + * allow easier tracking of the internal handle's state and what sockets + * they use. Only for research and development DEBUGBUILD enabled builds. + */ +void Curl_multi_dump(const struct Curl_multi *multi_handle); +#endif + +#endif /* __MULTIIF_H */ diff --git a/mobicore/common/curl/lib/netrc.c b/mobicore/common/curl/lib/netrc.c new file mode 100644 index 0000000000000000000000000000000000000000..e9443253e9c2087a3aeadb67f6993ac2d35af131 --- /dev/null +++ b/mobicore/common/curl/lib/netrc.c @@ -0,0 +1,245 @@ +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) 1998 - 2010, Daniel Stenberg, , et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at http://curl.haxx.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ***************************************************************************/ + +#include "setup.h" + +#include +#include +#include + +#ifdef HAVE_UNISTD_H +#include +#endif +#ifdef HAVE_PWD_H +#include +#endif +#ifdef __VMS +#include +#endif + +#include +#include "netrc.h" + +#include "strequal.h" +#include "strtok.h" +#include "curl_memory.h" +#include "rawstr.h" + +#define _MPRINTF_REPLACE /* use our functions only */ +#include + +/* The last #include file should be: */ +#include "memdebug.h" + +/* Debug this single source file with: + 'make netrc' then run './netrc'! + + Oh, make sure you have a .netrc file too ;-) + */ + +/* Get user and password from .netrc when given a machine name */ + +enum { + NOTHING, + HOSTFOUND, /* the 'machine' keyword was found */ + HOSTCOMPLETE, /* the machine name following the keyword was found too */ + HOSTVALID, /* this is "our" machine! */ + + HOSTEND /* LAST enum */ +}; + +/* make sure we have room for at least this size: */ +#define LOGINSIZE 64 +#define PASSWORDSIZE 64 + +/* returns -1 on failure, 0 if the host is found, 1 is the host isn't found */ +int Curl_parsenetrc(const char *host, + char *login, + char *password, + char *netrcfile) +{ + FILE *file; + int retcode=1; + int specific_login = (login[0] != 0); + char *home = NULL; + bool home_alloc = FALSE; + bool netrc_alloc = FALSE; + int state=NOTHING; + + char state_login=0; /* Found a login keyword */ + char state_password=0; /* Found a password keyword */ + int state_our_login=FALSE; /* With specific_login, found *our* login name */ + +#define NETRC DOT_CHAR "netrc" + +#ifdef DEBUGBUILD + { + /* This is a hack to allow testing. + * If compiled with --enable-debug and CURL_DEBUG_NETRC is defined, + * then it's the path to a substitute .netrc for testing purposes *only* */ + + char *override = curl_getenv("CURL_DEBUG_NETRC"); + + if(override) { + fprintf(stderr, "NETRC: overridden " NETRC " file: %s\n", override); + netrcfile = override; + netrc_alloc = TRUE; + } + } +#endif /* DEBUGBUILD */ + if(!netrcfile) { + home = curl_getenv("HOME"); /* portable environment reader */ + if(home) { + home_alloc = TRUE; +#if defined(HAVE_GETPWUID) && defined(HAVE_GETEUID) + } + else { + struct passwd *pw; + pw= getpwuid(geteuid()); + if(pw) { +#ifdef __VMS + home = decc_translate_vms(pw->pw_dir); +#else + home = pw->pw_dir; +#endif + } +#endif + } + + if(!home) + return -1; + + netrcfile = curl_maprintf("%s%s%s", home, DIR_CHAR, NETRC); + if(!netrcfile) { + if(home_alloc) + free(home); + return -1; + } + netrc_alloc = TRUE; + } + + file = fopen(netrcfile, "r"); + if(file) { + char *tok; + char *tok_buf; + bool done=FALSE; + char netrcbuffer[256]; + int netrcbuffsize = (int)sizeof(netrcbuffer); + + while(!done && fgets(netrcbuffer, netrcbuffsize, file)) { + tok=strtok_r(netrcbuffer, " \t\n", &tok_buf); + while(!done && tok) { + + if(login[0] && password[0]) { + done=TRUE; + break; + } + + switch(state) { + case NOTHING: + if(Curl_raw_equal("machine", tok)) { + /* the next tok is the machine name, this is in itself the + delimiter that starts the stuff entered for this machine, + after this we need to search for 'login' and + 'password'. */ + state=HOSTFOUND; + } + break; + case HOSTFOUND: + if(Curl_raw_equal(host, tok)) { + /* and yes, this is our host! */ + state=HOSTVALID; +#ifdef _NETRC_DEBUG + fprintf(stderr, "HOST: %s\n", tok); +#endif + retcode=0; /* we did find our host */ + } + else + /* not our host */ + state=NOTHING; + break; + case HOSTVALID: + /* we are now parsing sub-keywords concerning "our" host */ + if(state_login) { + if(specific_login) { + state_our_login = Curl_raw_equal(login, tok); + } + else { + strncpy(login, tok, LOGINSIZE-1); +#ifdef _NETRC_DEBUG + fprintf(stderr, "LOGIN: %s\n", login); +#endif + } + state_login=0; + } + else if(state_password) { + if(state_our_login || !specific_login) { + strncpy(password, tok, PASSWORDSIZE-1); +#ifdef _NETRC_DEBUG + fprintf(stderr, "PASSWORD: %s\n", password); +#endif + } + state_password=0; + } + else if(Curl_raw_equal("login", tok)) + state_login=1; + else if(Curl_raw_equal("password", tok)) + state_password=1; + else if(Curl_raw_equal("machine", tok)) { + /* ok, there's machine here go => */ + state = HOSTFOUND; + state_our_login = FALSE; + } + break; + } /* switch (state) */ + + tok = strtok_r(NULL, " \t\n", &tok_buf); + } /* while(tok) */ + } /* while fgets() */ + + fclose(file); + } + + if(home_alloc) + free(home); + if(netrc_alloc) + free(netrcfile); + + return retcode; +} + +#ifdef _NETRC_DEBUG +int main(int argc, argv_item_t argv[]) +{ + char login[64]=""; + char password[64]=""; + + if(argc<2) + return -1; + + if(0 == ParseNetrc(argv[1], login, password)) { + printf("HOST: %s LOGIN: %s PASSWORD: %s\n", + argv[1], login, password); + } +} + +#endif diff --git a/mobicore/common/curl/lib/netrc.h b/mobicore/common/curl/lib/netrc.h new file mode 100644 index 0000000000000000000000000000000000000000..5406d4c5ddb8c54254683def7d77dbd8a893a6d0 --- /dev/null +++ b/mobicore/common/curl/lib/netrc.h @@ -0,0 +1,34 @@ +#ifndef HEADER_CURL_NETRC_H +#define HEADER_CURL_NETRC_H +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) 1998 - 2010, Daniel Stenberg, , et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at http://curl.haxx.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ***************************************************************************/ +int Curl_parsenetrc(const char *host, + char *login, + char *password, + char *filename); + /* Assume: password[0]=0, host[0] != 0. + * If login[0] = 0, search for login and password within a machine section + * in the netrc. + * If login[0] != 0, search for password within machine and login. + */ + +#endif /* HEADER_CURL_NETRC_H */ diff --git a/mobicore/common/curl/lib/nonblock.c b/mobicore/common/curl/lib/nonblock.c new file mode 100644 index 0000000000000000000000000000000000000000..cd819506cb6025e9affbb1d5551000a5ece3ddda --- /dev/null +++ b/mobicore/common/curl/lib/nonblock.c @@ -0,0 +1,101 @@ +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) 1998 - 2009, Daniel Stenberg, , et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at http://curl.haxx.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ***************************************************************************/ + +#include "setup.h" + +#ifdef HAVE_SYS_SOCKET_H +#include +#endif +#ifdef HAVE_SYS_IOCTL_H +#include +#endif +#ifdef HAVE_UNISTD_H +#include +#endif +#ifdef HAVE_FCNTL_H +#include +#endif +#ifdef HAVE_STDLIB_H +#include +#endif + +#if (defined(HAVE_IOCTL_FIONBIO) && defined(NETWARE)) +#include +#endif +#ifdef __VMS +#include +#include +#endif + +#include "nonblock.h" + +/* + * curlx_nonblock() set the given socket to either blocking or non-blocking + * mode based on the 'nonblock' boolean argument. This function is highly + * portable. + */ +int curlx_nonblock(curl_socket_t sockfd, /* operate on this */ + int nonblock /* TRUE or FALSE */) +{ +#if defined(USE_BLOCKING_SOCKETS) + + return 0; /* returns success */ + +#elif defined(HAVE_FCNTL_O_NONBLOCK) + + /* most recent unix versions */ + int flags; + flags = fcntl(sockfd, F_GETFL, 0); + if(FALSE != nonblock) + return fcntl(sockfd, F_SETFL, flags | O_NONBLOCK); + else + return fcntl(sockfd, F_SETFL, flags & (~O_NONBLOCK)); + +#elif defined(HAVE_IOCTL_FIONBIO) + + /* older unix versions */ + int flags; + flags = nonblock; + return ioctl(sockfd, FIONBIO, &flags); + +#elif defined(HAVE_IOCTLSOCKET_FIONBIO) + + /* Windows */ + unsigned long flags; + flags = nonblock; + return ioctlsocket(sockfd, FIONBIO, &flags); + +#elif defined(HAVE_IOCTLSOCKET_CAMEL_FIONBIO) + + /* Amiga */ + return IoctlSocket(sockfd, FIONBIO, (long)nonblock); + +#elif defined(HAVE_SETSOCKOPT_SO_NONBLOCK) + + /* BeOS */ + long b = nonblock ? 1 : 0; + return setsockopt(sockfd, SOL_SOCKET, SO_NONBLOCK, &b, sizeof(b)); + +#else +# error "no non-blocking method was found/used/set" +#endif +} diff --git a/mobicore/common/curl/lib/nonblock.h b/mobicore/common/curl/lib/nonblock.h new file mode 100644 index 0000000000000000000000000000000000000000..adcd2c15e70319540c02d67245dacbcb72051015 --- /dev/null +++ b/mobicore/common/curl/lib/nonblock.h @@ -0,0 +1,30 @@ +#ifndef __NONBLOCK_H +#define __NONBLOCK_H +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) 1998 - 2009, Daniel Stenberg, , et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at http://curl.haxx.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ***************************************************************************/ + +#include /* for curl_socket_t */ + +int curlx_nonblock(curl_socket_t sockfd, /* operate on this */ + int nonblock /* TRUE or FALSE */); + +#endif diff --git a/mobicore/common/curl/lib/nss.c b/mobicore/common/curl/lib/nss.c new file mode 100644 index 0000000000000000000000000000000000000000..6d3f12c033aaec34d294b6884a09149d4dab5ffb --- /dev/null +++ b/mobicore/common/curl/lib/nss.c @@ -0,0 +1,1481 @@ +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) 1998 - 2010, Daniel Stenberg, , et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at http://curl.haxx.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ***************************************************************************/ + +/* + * Source file for all NSS-specific code for the TLS/SSL layer. No code + * but sslgen.c should ever call or use these functions. + */ + +#include "setup.h" + +#include +#include +#include +#ifdef HAVE_SYS_SOCKET_H +#include +#endif + +#include "urldata.h" +#include "sendf.h" +#include "formdata.h" /* for the boundary function */ +#include "url.h" /* for the ssl config check function */ +#include "connect.h" +#include "strequal.h" +#include "select.h" +#include "sslgen.h" + +#define _MPRINTF_REPLACE /* use the internal *printf() functions */ +#include + +#ifdef USE_NSS + +#include "nssg.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "curl_memory.h" +#include "rawstr.h" +#include "easyif.h" /* for Curl_convert_from_utf8 prototype */ + +/* The last #include file should be: */ +#include "memdebug.h" + +#define SSL_DIR "/etc/pki/nssdb" + +/* enough to fit the string "PEM Token #[0|1]" */ +#define SLOTSIZE 13 + +PRFileDesc *PR_ImportTCPSocket(PRInt32 osfd); + +PRLock * nss_initlock = NULL; +PRLock * nss_crllock = NULL; + +volatile int initialized = 0; + +typedef struct { + const char *name; + int num; + PRInt32 version; /* protocol version valid for this cipher */ +} cipher_s; + +#define PK11_SETATTRS(x,id,v,l) (x)->type = (id); \ + (x)->pValue=(v); (x)->ulValueLen = (l) + +#define CERT_NewTempCertificate __CERT_NewTempCertificate + +enum sslversion { SSL2 = 1, SSL3 = 2, TLS = 4 }; + +#define NUM_OF_CIPHERS sizeof(cipherlist)/sizeof(cipherlist[0]) +static const cipher_s cipherlist[] = { + /* SSL2 cipher suites */ + {"rc4", SSL_EN_RC4_128_WITH_MD5, SSL2}, + {"rc4-md5", SSL_EN_RC4_128_WITH_MD5, SSL2}, + {"rc4export", SSL_EN_RC4_128_EXPORT40_WITH_MD5, SSL2}, + {"rc2", SSL_EN_RC2_128_CBC_WITH_MD5, SSL2}, + {"rc2export", SSL_EN_RC2_128_CBC_EXPORT40_WITH_MD5, SSL2}, + {"des", SSL_EN_DES_64_CBC_WITH_MD5, SSL2}, + {"desede3", SSL_EN_DES_192_EDE3_CBC_WITH_MD5, SSL2}, + /* SSL3/TLS cipher suites */ + {"rsa_rc4_128_md5", SSL_RSA_WITH_RC4_128_MD5, SSL3 | TLS}, + {"rsa_rc4_128_sha", SSL_RSA_WITH_RC4_128_SHA, SSL3 | TLS}, + {"rsa_3des_sha", SSL_RSA_WITH_3DES_EDE_CBC_SHA, SSL3 | TLS}, + {"rsa_des_sha", SSL_RSA_WITH_DES_CBC_SHA, SSL3 | TLS}, + {"rsa_rc4_40_md5", SSL_RSA_EXPORT_WITH_RC4_40_MD5, SSL3 | TLS}, + {"rsa_rc2_40_md5", SSL_RSA_EXPORT_WITH_RC2_CBC_40_MD5, SSL3 | TLS}, + {"rsa_null_md5", SSL_RSA_WITH_NULL_MD5, SSL3 | TLS}, + {"rsa_null_sha", SSL_RSA_WITH_NULL_SHA, SSL3 | TLS}, + {"fips_3des_sha", SSL_RSA_FIPS_WITH_3DES_EDE_CBC_SHA, SSL3 | TLS}, + {"fips_des_sha", SSL_RSA_FIPS_WITH_DES_CBC_SHA, SSL3 | TLS}, + {"fortezza", SSL_FORTEZZA_DMS_WITH_FORTEZZA_CBC_SHA, SSL3 | TLS}, + {"fortezza_rc4_128_sha", SSL_FORTEZZA_DMS_WITH_RC4_128_SHA, SSL3 | TLS}, + {"fortezza_null", SSL_FORTEZZA_DMS_WITH_NULL_SHA, SSL3 | TLS}, + /* TLS 1.0: Exportable 56-bit Cipher Suites. */ + {"rsa_des_56_sha", TLS_RSA_EXPORT1024_WITH_DES_CBC_SHA, SSL3 | TLS}, + {"rsa_rc4_56_sha", TLS_RSA_EXPORT1024_WITH_RC4_56_SHA, SSL3 | TLS}, + /* AES ciphers. */ + {"rsa_aes_128_sha", TLS_RSA_WITH_AES_128_CBC_SHA, SSL3 | TLS}, + {"rsa_aes_256_sha", TLS_RSA_WITH_AES_256_CBC_SHA, SSL3 | TLS}, +#ifdef NSS_ENABLE_ECC + /* ECC ciphers. */ + {"ecdh_ecdsa_null_sha", TLS_ECDH_ECDSA_WITH_NULL_SHA, TLS}, + {"ecdh_ecdsa_rc4_128_sha", TLS_ECDH_ECDSA_WITH_RC4_128_SHA, TLS}, + {"ecdh_ecdsa_3des_sha", TLS_ECDH_ECDSA_WITH_3DES_EDE_CBC_SHA, TLS}, + {"ecdh_ecdsa_aes_128_sha", TLS_ECDH_ECDSA_WITH_AES_128_CBC_SHA, TLS}, + {"ecdh_ecdsa_aes_256_sha", TLS_ECDH_ECDSA_WITH_AES_256_CBC_SHA, TLS}, + {"ecdhe_ecdsa_null_sha", TLS_ECDHE_ECDSA_WITH_NULL_SHA, TLS}, + {"ecdhe_ecdsa_rc4_128_sha", TLS_ECDHE_ECDSA_WITH_RC4_128_SHA, TLS}, + {"ecdhe_ecdsa_3des_sha", TLS_ECDHE_ECDSA_WITH_3DES_EDE_CBC_SHA, TLS}, + {"ecdhe_ecdsa_aes_128_sha", TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA, TLS}, + {"ecdhe_ecdsa_aes_256_sha", TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA, TLS}, + {"ecdh_rsa_null_sha", TLS_ECDH_RSA_WITH_NULL_SHA, TLS}, + {"ecdh_rsa_128_sha", TLS_ECDH_RSA_WITH_RC4_128_SHA, TLS}, + {"ecdh_rsa_3des_sha", TLS_ECDH_RSA_WITH_3DES_EDE_CBC_SHA, TLS}, + {"ecdh_rsa_aes_128_sha", TLS_ECDH_RSA_WITH_AES_128_CBC_SHA, TLS}, + {"ecdh_rsa_aes_256_sha", TLS_ECDH_RSA_WITH_AES_256_CBC_SHA, TLS}, + {"echde_rsa_null", TLS_ECDHE_RSA_WITH_NULL_SHA, TLS}, + {"ecdhe_rsa_rc4_128_sha", TLS_ECDHE_RSA_WITH_RC4_128_SHA, TLS}, + {"ecdhe_rsa_3des_sha", TLS_ECDHE_RSA_WITH_3DES_EDE_CBC_SHA, TLS}, + {"ecdhe_rsa_aes_128_sha", TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA, TLS}, + {"ecdhe_rsa_aes_256_sha", TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA, TLS}, + {"ecdh_anon_null_sha", TLS_ECDH_anon_WITH_NULL_SHA, TLS}, + {"ecdh_anon_rc4_128sha", TLS_ECDH_anon_WITH_RC4_128_SHA, TLS}, + {"ecdh_anon_3des_sha", TLS_ECDH_anon_WITH_3DES_EDE_CBC_SHA, TLS}, + {"ecdh_anon_aes_128_sha", TLS_ECDH_anon_WITH_AES_128_CBC_SHA, TLS}, + {"ecdh_anon_aes_256_sha", TLS_ECDH_anon_WITH_AES_256_CBC_SHA, TLS}, +#endif +}; + +/* following ciphers are new in NSS 3.4 and not enabled by default, therefore + they are enabled explicitly */ +static const int enable_ciphers_by_default[] = { + TLS_DHE_DSS_WITH_AES_128_CBC_SHA, + TLS_DHE_DSS_WITH_AES_256_CBC_SHA, + TLS_DHE_RSA_WITH_AES_128_CBC_SHA, + TLS_DHE_RSA_WITH_AES_256_CBC_SHA, + TLS_RSA_WITH_AES_128_CBC_SHA, + TLS_RSA_WITH_AES_256_CBC_SHA, + SSL_NULL_WITH_NULL_NULL +}; + +#ifdef HAVE_PK11_CREATEGENERICOBJECT +static const char* pem_library = "libnsspem.so"; +#endif +SECMODModule* mod = NULL; + +static SECStatus set_ciphers(struct SessionHandle *data, PRFileDesc * model, + char *cipher_list) +{ + unsigned int i; + PRBool cipher_state[NUM_OF_CIPHERS]; + PRBool found; + char *cipher; + SECStatus rv; + + /* First disable all ciphers. This uses a different max value in case + * NSS adds more ciphers later we don't want them available by + * accident + */ + for(i=0; icacert[slotID] = PK11_CreateGenericObject(slot, theTemplate, 4, + PR_FALSE /* isPerm */); + + PK11_FreeSlot(slot); + + if(ssl->cacert[slotID] == NULL) { + free(nickname); + return 0; + } +#else + /* We don't have PK11_CreateGenericObject but a file-based cert was passed + * in. We need to fail. + */ + return 0; +#endif + + done: + /* Double-check that the certificate or nickname requested exists in + * either the token or the NSS certificate database. + */ + if(!cacert) { + cert = PK11_FindCertFromNickname((char *)nickname, NULL); + + /* An invalid nickname was passed in */ + if(cert == NULL) { + free(nickname); + PR_SetError(SEC_ERROR_UNKNOWN_CERT, 0); + return 0; + } + + CERT_DestroyCertificate(cert); + } + + free(nickname); + + return 1; +} + +/* add given CRL to cache if it is not already there */ +static SECStatus nss_cache_crl(SECItem *crlDER) +{ + CERTCertDBHandle *db = CERT_GetDefaultCertDB(); + CERTSignedCrl *crl = SEC_FindCrlByDERCert(db, crlDER, 0); + if(crl) { + /* CRL already cached */ + SEC_DestroyCrl(crl); + SECITEM_FreeItem(crlDER, PR_FALSE); + return SECSuccess; + } + + /* acquire lock before call of CERT_CacheCRL() */ + PR_Lock(nss_crllock); + if(SECSuccess != CERT_CacheCRL(db, crlDER)) { + /* unable to cache CRL */ + PR_Unlock(nss_crllock); + SECITEM_FreeItem(crlDER, PR_FALSE); + return SECFailure; + } + + /* we need to clear session cache, so that the CRL could take effect */ + SSL_ClearSessionCache(); + PR_Unlock(nss_crllock); + return SECSuccess; +} + +static SECStatus nss_load_crl(const char* crlfilename) +{ + PRFileDesc *infile; + PRFileInfo info; + SECItem filedata = { 0, NULL, 0 }; + SECItem crlDER = { 0, NULL, 0 }; + char *body; + + infile = PR_Open(crlfilename, PR_RDONLY, 0); + if(!infile) + return SECFailure; + + if(PR_SUCCESS != PR_GetOpenFileInfo(infile, &info)) + goto fail; + + if(!SECITEM_AllocItem(NULL, &filedata, info.size + /* zero ended */ 1)) + goto fail; + + if(info.size != PR_Read(infile, filedata.data, info.size)) + goto fail; + + /* place a trailing zero right after the visible data */ + body = (char*)filedata.data; + body[--filedata.len] = '\0'; + + body = strstr(body, "-----BEGIN"); + if(body) { + /* assume ASCII */ + char *trailer; + char *begin = PORT_Strchr(body, '\n'); + if(!begin) + begin = PORT_Strchr(body, '\r'); + if(!begin) + goto fail; + + trailer = strstr(++begin, "-----END"); + if(!trailer) + goto fail; + + /* retrieve DER from ASCII */ + *trailer = '\0'; + if(ATOB_ConvertAsciiToItem(&crlDER, begin)) + goto fail; + + SECITEM_FreeItem(&filedata, PR_FALSE); + } + else + /* assume DER */ + crlDER = filedata; + + PR_Close(infile); + return nss_cache_crl(&crlDER); + +fail: + PR_Close(infile); + SECITEM_FreeItem(&filedata, PR_FALSE); + return SECFailure; +} + +static int nss_load_key(struct connectdata *conn, int sockindex, + char *key_file) +{ +#ifdef HAVE_PK11_CREATEGENERICOBJECT + PK11SlotInfo * slot = NULL; + CK_ATTRIBUTE *attrs; + CK_ATTRIBUTE theTemplate[20]; + CK_BBOOL cktrue = CK_TRUE; + CK_OBJECT_CLASS objClass = CKO_PRIVATE_KEY; + CK_SLOT_ID slotID; + char slotname[SLOTSIZE]; + struct ssl_connect_data *sslconn = &conn->ssl[sockindex]; + + attrs = theTemplate; + + /* FIXME: grok the various file types */ + + slotID = 1; /* hardcoded for now */ + + snprintf(slotname, sizeof(slotname), "PEM Token #%ld", slotID); + slot = PK11_FindSlotByName(slotname); + + if(!slot) + return 0; + + PK11_SETATTRS(attrs, CKA_CLASS, &objClass, sizeof(objClass) ); attrs++; + PK11_SETATTRS(attrs, CKA_TOKEN, &cktrue, sizeof(CK_BBOOL) ); attrs++; + PK11_SETATTRS(attrs, CKA_LABEL, (unsigned char *)key_file, + strlen(key_file)+1); attrs++; + + /* When adding an encrypted key the PKCS#11 will be set as removed */ + sslconn->key = PK11_CreateGenericObject(slot, theTemplate, 3, + PR_FALSE /* isPerm */); + if(sslconn->key == NULL) { + PR_SetError(SEC_ERROR_BAD_KEY, 0); + return 0; + } + + /* This will force the token to be seen as re-inserted */ + SECMOD_WaitForAnyTokenEvent(mod, 0, 0); + PK11_IsPresent(slot); + + /* parg is initialized in nss_Init_Tokens() */ + if(PK11_Authenticate(slot, PR_TRUE, + conn->data->set.str[STRING_KEY_PASSWD]) != SECSuccess) { + + PK11_FreeSlot(slot); + return 0; + } + PK11_FreeSlot(slot); + + return 1; +#else + /* If we don't have PK11_CreateGenericObject then we can't load a file-based + * key. + */ + (void)conn; /* unused */ + (void)key_file; /* unused */ + return 0; +#endif +} + +static int display_error(struct connectdata *conn, PRInt32 err, + const char *filename) +{ + switch(err) { + case SEC_ERROR_BAD_PASSWORD: + failf(conn->data, "Unable to load client key: Incorrect password"); + return 1; + case SEC_ERROR_UNKNOWN_CERT: + failf(conn->data, "Unable to load certificate %s", filename); + return 1; + default: + break; + } + return 0; /* The caller will print a generic error */ +} + +static int cert_stuff(struct connectdata *conn, + int sockindex, char *cert_file, char *key_file) +{ + struct SessionHandle *data = conn->data; + int rv = 0; + + if(cert_file) { + rv = nss_load_cert(&conn->ssl[sockindex], cert_file, PR_FALSE); + if(!rv) { + if(!display_error(conn, PR_GetError(), cert_file)) + failf(data, "Unable to load client cert %d.", PR_GetError()); + return 0; + } + } + if(key_file || (is_file(cert_file))) { + if(key_file) + rv = nss_load_key(conn, sockindex, key_file); + else + /* In case the cert file also has the key */ + rv = nss_load_key(conn, sockindex, cert_file); + if(!rv) { + if(!display_error(conn, PR_GetError(), key_file)) + failf(data, "Unable to load client key %d.", PR_GetError()); + + return 0; + } + } + return 1; +} + +static char * nss_get_password(PK11SlotInfo * slot, PRBool retry, void *arg) +{ + (void)slot; /* unused */ + if(retry || NULL == arg) + return NULL; + else + return (char *)PORT_Strdup((char *)arg); +} + +static SECStatus BadCertHandler(void *arg, PRFileDesc *sock) +{ + SECStatus success = SECSuccess; + struct connectdata *conn = (struct connectdata *)arg; + PRErrorCode err = PR_GetError(); + CERTCertificate *cert = NULL; + char *subject, *subject_cn, *issuer; + + if(conn->data->set.ssl.certverifyresult!=0) + return success; + + conn->data->set.ssl.certverifyresult=err; + cert = SSL_PeerCertificate(sock); + subject = CERT_NameToAscii(&cert->subject); + subject_cn = CERT_GetCommonName(&cert->subject); + issuer = CERT_NameToAscii(&cert->issuer); + CERT_DestroyCertificate(cert); + + switch(err) { + case SEC_ERROR_CA_CERT_INVALID: + infof(conn->data, "Issuer certificate is invalid: '%s'\n", issuer); + if(conn->data->set.ssl.verifypeer) + success = SECFailure; + break; + case SEC_ERROR_UNTRUSTED_ISSUER: + if(conn->data->set.ssl.verifypeer) + success = SECFailure; + infof(conn->data, "Certificate is signed by an untrusted issuer: '%s'\n", + issuer); + break; + case SSL_ERROR_BAD_CERT_DOMAIN: + if(conn->data->set.ssl.verifyhost) { + failf(conn->data, "SSL: certificate subject name '%s' does not match " + "target host name '%s'", subject_cn, conn->host.dispname); + success = SECFailure; + } else { + infof(conn->data, "warning: SSL: certificate subject name '%s' does not " + "match target host name '%s'\n", subject_cn, conn->host.dispname); + } + break; + case SEC_ERROR_EXPIRED_CERTIFICATE: + if(conn->data->set.ssl.verifypeer) + success = SECFailure; + infof(conn->data, "Remote Certificate has expired.\n"); + break; + case SEC_ERROR_UNKNOWN_ISSUER: + if(conn->data->set.ssl.verifypeer) + success = SECFailure; + infof(conn->data, "Peer's certificate issuer is not recognized: '%s'\n", + issuer); + break; + default: + if(conn->data->set.ssl.verifypeer) + success = SECFailure; + infof(conn->data, "Bad certificate received. Subject = '%s', " + "Issuer = '%s'\n", subject, issuer); + break; + } + if(success == SECSuccess) + infof(conn->data, "SSL certificate verify ok.\n"); + PR_Free(subject); + PR_Free(subject_cn); + PR_Free(issuer); + + return success; +} + +/** + * Inform the application that the handshake is complete. + */ +static SECStatus HandshakeCallback(PRFileDesc *sock, void *arg) +{ + (void)sock; + (void)arg; + return SECSuccess; +} + +static void display_cert_info(struct SessionHandle *data, + CERTCertificate *cert) +{ + char *subject, *issuer, *common_name; + PRExplodedTime printableTime; + char timeString[256]; + PRTime notBefore, notAfter; + + subject = CERT_NameToAscii(&cert->subject); + issuer = CERT_NameToAscii(&cert->issuer); + common_name = CERT_GetCommonName(&cert->subject); + infof(data, "\tsubject: %s\n", subject); + + CERT_GetCertTimes(cert, ¬Before, ¬After); + PR_ExplodeTime(notBefore, PR_GMTParameters, &printableTime); + PR_FormatTime(timeString, 256, "%b %d %H:%M:%S %Y GMT", &printableTime); + infof(data, "\tstart date: %s\n", timeString); + PR_ExplodeTime(notAfter, PR_GMTParameters, &printableTime); + PR_FormatTime(timeString, 256, "%b %d %H:%M:%S %Y GMT", &printableTime); + infof(data, "\texpire date: %s\n", timeString); + infof(data, "\tcommon name: %s\n", common_name); + infof(data, "\tissuer: %s\n", issuer); + + PR_Free(subject); + PR_Free(issuer); + PR_Free(common_name); +} + +static void display_conn_info(struct connectdata *conn, PRFileDesc *sock) +{ + SSLChannelInfo channel; + SSLCipherSuiteInfo suite; + CERTCertificate *cert; + + if(SSL_GetChannelInfo(sock, &channel, sizeof channel) == + SECSuccess && channel.length == sizeof channel && + channel.cipherSuite) { + if(SSL_GetCipherSuiteInfo(channel.cipherSuite, + &suite, sizeof suite) == SECSuccess) { + infof(conn->data, "SSL connection using %s\n", suite.cipherSuiteName); + } + } + + infof(conn->data, "Server certificate:\n"); + + cert = SSL_PeerCertificate(sock); + display_cert_info(conn->data, cert); + CERT_DestroyCertificate(cert); + + return; +} + +/** + * + * Check that the Peer certificate's issuer certificate matches the one found + * by issuer_nickname. This is not exactly the way OpenSSL and GNU TLS do the + * issuer check, so we provide comments that mimic the OpenSSL + * X509_check_issued function (in x509v3/v3_purp.c) + */ +static SECStatus check_issuer_cert(PRFileDesc *sock, + char *issuer_nickname) +{ + CERTCertificate *cert,*cert_issuer,*issuer; + SECStatus res=SECSuccess; + void *proto_win = NULL; + + /* + PRArenaPool *tmpArena = NULL; + CERTAuthKeyID *authorityKeyID = NULL; + SECITEM *caname = NULL; + */ + + cert = SSL_PeerCertificate(sock); + cert_issuer = CERT_FindCertIssuer(cert,PR_Now(),certUsageObjectSigner); + + proto_win = SSL_RevealPinArg(sock); + issuer = NULL; + issuer = PK11_FindCertFromNickname(issuer_nickname, proto_win); + + if ((!cert_issuer) || (!issuer)) + res = SECFailure; + else if (SECITEM_CompareItem(&cert_issuer->derCert, + &issuer->derCert)!=SECEqual) + res = SECFailure; + + CERT_DestroyCertificate(cert); + CERT_DestroyCertificate(issuer); + CERT_DestroyCertificate(cert_issuer); + return res; +} + +/** + * + * Callback to pick the SSL client certificate. + */ +static SECStatus SelectClientCert(void *arg, PRFileDesc *sock, + struct CERTDistNamesStr *caNames, + struct CERTCertificateStr **pRetCert, + struct SECKEYPrivateKeyStr **pRetKey) +{ + static const char pem_nickname[] = "PEM Token #1"; + const char *pem_slotname = pem_nickname; + + struct ssl_connect_data *connssl = (struct ssl_connect_data *)arg; + struct SessionHandle *data = connssl->data; + const char *nickname = connssl->client_nickname; + + if (mod && nickname && + 0 == strncmp(nickname, pem_nickname, /* length of "PEM Token" */ 9)) { + + /* use the cert/key provided by PEM reader */ + PK11SlotInfo *slot; + void *proto_win = SSL_RevealPinArg(sock); + *pRetKey = NULL; + + *pRetCert = PK11_FindCertFromNickname(nickname, proto_win); + if (NULL == *pRetCert) { + failf(data, "NSS: client certificate not found: %s", nickname); + return SECFailure; + } + + slot = PK11_FindSlotByName(pem_slotname); + if (NULL == slot) { + failf(data, "NSS: PK11 slot not found: %s", pem_slotname); + return SECFailure; + } + + *pRetKey = PK11_FindPrivateKeyFromCert(slot, *pRetCert, NULL); + PK11_FreeSlot(slot); + if (NULL == *pRetKey) { + failf(data, "NSS: private key not found for certificate: %s", nickname); + return SECFailure; + } + + infof(data, "NSS: client certificate: %s\n", nickname); + display_cert_info(data, *pRetCert); + return SECSuccess; + } + + /* use the default NSS hook */ + if (SECSuccess != NSS_GetClientAuthData((void *)nickname, sock, caNames, + pRetCert, pRetKey) + || NULL == *pRetCert) { + + if (NULL == nickname) + failf(data, "NSS: client certificate not found (nickname not " + "specified)"); + else + failf(data, "NSS: client certificate not found: %s", nickname); + + return SECFailure; + } + + /* get certificate nickname if any */ + nickname = (*pRetCert)->nickname; + if (NULL == nickname) + nickname = "[unknown]"; + + if (NULL == *pRetKey) { + failf(data, "NSS: private key not found for certificate: %s", nickname); + return SECFailure; + } + + infof(data, "NSS: using client certificate: %s\n", nickname); + display_cert_info(data, *pRetCert); + return SECSuccess; +} + +/* This function is supposed to decide, which error codes should be used + * to conclude server is TLS intolerant. + * + * taken from xulrunner - nsNSSIOLayer.cpp + */ +static PRBool +isTLSIntoleranceError(PRInt32 err) +{ + switch (err) { + case SSL_ERROR_BAD_MAC_ALERT: + case SSL_ERROR_BAD_MAC_READ: + case SSL_ERROR_HANDSHAKE_FAILURE_ALERT: + case SSL_ERROR_HANDSHAKE_UNEXPECTED_ALERT: + case SSL_ERROR_CLIENT_KEY_EXCHANGE_FAILURE: + case SSL_ERROR_ILLEGAL_PARAMETER_ALERT: + case SSL_ERROR_NO_CYPHER_OVERLAP: + case SSL_ERROR_BAD_SERVER: + case SSL_ERROR_BAD_BLOCK_PADDING: + case SSL_ERROR_UNSUPPORTED_VERSION: + case SSL_ERROR_PROTOCOL_VERSION_ALERT: + case SSL_ERROR_RX_MALFORMED_FINISHED: + case SSL_ERROR_BAD_HANDSHAKE_HASH_VALUE: + case SSL_ERROR_DECODE_ERROR_ALERT: + case SSL_ERROR_RX_UNKNOWN_ALERT: + return PR_TRUE; + default: + return PR_FALSE; + } +} + +static CURLcode init_nss(struct SessionHandle *data) +{ + char *cert_dir; + struct_stat st; + if(initialized) + return CURLE_OK; + + /* First we check if $SSL_DIR points to a valid dir */ + cert_dir = getenv("SSL_DIR"); + if(cert_dir) { + if((stat(cert_dir, &st) != 0) || + (!S_ISDIR(st.st_mode))) { + cert_dir = NULL; + } + } + + /* Now we check if the default location is a valid dir */ + if(!cert_dir) { + if((stat(SSL_DIR, &st) == 0) && + (S_ISDIR(st.st_mode))) { + cert_dir = (char *)SSL_DIR; + } + } + + if(!NSS_IsInitialized()) { + SECStatus rv; + initialized = 1; + infof(data, "Initializing NSS with certpath: %s\n", + cert_dir ? cert_dir : "none"); + if(!cert_dir) { + rv = NSS_NoDB_Init(NULL); + } + else { + char *certpath = + PR_smprintf("%s%s", NSS_VersionCheck("3.12.0") ? "sql:" : "", cert_dir); + rv = NSS_Initialize(certpath, "", "", "", NSS_INIT_READONLY); + PR_smprintf_free(certpath); + } + if(rv != SECSuccess) { + infof(data, "Unable to initialize NSS database\n"); + initialized = 0; + return CURLE_SSL_CACERT_BADFILE; + } + } + + if(num_enabled_ciphers() == 0) + NSS_SetDomesticPolicy(); + + return CURLE_OK; +} + +/** + * Global SSL init + * + * @retval 0 error initializing SSL + * @retval 1 SSL initialized successfully + */ +int Curl_nss_init(void) +{ + /* curl_global_init() is not thread-safe so this test is ok */ + if (nss_initlock == NULL) { + PR_Init(PR_USER_THREAD, PR_PRIORITY_NORMAL, 256); + nss_initlock = PR_NewLock(); + nss_crllock = PR_NewLock(); + } + + /* We will actually initialize NSS later */ + + return 1; +} + +CURLcode Curl_nss_force_init(struct SessionHandle *data) +{ + CURLcode rv; + if(!nss_initlock) { + failf(data, "unable to initialize NSS, curl_global_init() should have been " + "called with CURL_GLOBAL_SSL or CURL_GLOBAL_ALL"); + return CURLE_OUT_OF_MEMORY; + } + + PR_Lock(nss_initlock); + rv = init_nss(data); + PR_Unlock(nss_initlock); + return rv; +} + +/* Global cleanup */ +void Curl_nss_cleanup(void) +{ + /* This function isn't required to be threadsafe and this is only done + * as a safety feature. + */ + PR_Lock(nss_initlock); + if (initialized) { + /* Free references to client certificates held in the SSL session cache. + * Omitting this hampers destruction of the security module owning + * the certificates. */ + SSL_ClearSessionCache(); + + if(mod && SECSuccess == SECMOD_UnloadUserModule(mod)) { + SECMOD_DestroyModule(mod); + mod = NULL; + } + NSS_Shutdown(); + } + PR_Unlock(nss_initlock); + + PR_DestroyLock(nss_initlock); + PR_DestroyLock(nss_crllock); + nss_initlock = NULL; + + initialized = 0; +} + +/* + * This function uses SSL_peek to determine connection status. + * + * Return codes: + * 1 means the connection is still in place + * 0 means the connection has been closed + * -1 means the connection status is unknown + */ +int +Curl_nss_check_cxn(struct connectdata *conn) +{ + int rc; + char buf; + + rc = + PR_Recv(conn->ssl[FIRSTSOCKET].handle, (void *)&buf, 1, PR_MSG_PEEK, + PR_SecondsToInterval(1)); + if(rc > 0) + return 1; /* connection still in place */ + + if(rc == 0) + return 0; /* connection has been closed */ + + return -1; /* connection status unknown */ +} + +/* + * This function is called when an SSL connection is closed. + */ +void Curl_nss_close(struct connectdata *conn, int sockindex) +{ + struct ssl_connect_data *connssl = &conn->ssl[sockindex]; + + if(connssl->handle) { + PR_Close(connssl->handle); + + /* NSS closes the socket we previously handed to it, so we must mark it + as closed to avoid double close */ + fake_sclose(conn->sock[sockindex]); + conn->sock[sockindex] = CURL_SOCKET_BAD; + if(connssl->client_nickname != NULL) { + free(connssl->client_nickname); + connssl->client_nickname = NULL; + } +#ifdef HAVE_PK11_CREATEGENERICOBJECT + if(connssl->key) + (void)PK11_DestroyGenericObject(connssl->key); + if(connssl->cacert[1]) + (void)PK11_DestroyGenericObject(connssl->cacert[1]); + if(connssl->cacert[0]) + (void)PK11_DestroyGenericObject(connssl->cacert[0]); +#endif + connssl->handle = NULL; + } +} + +/* + * This function is called when the 'data' struct is going away. Close + * down everything and free all resources! + */ +int Curl_nss_close_all(struct SessionHandle *data) +{ + (void)data; + return 0; +} + +/* handle client certificate related errors if any; return false otherwise */ +static bool handle_cc_error(PRInt32 err, struct SessionHandle *data) +{ + switch(err) { + case SSL_ERROR_BAD_CERT_ALERT: + failf(data, "SSL error: SSL_ERROR_BAD_CERT_ALERT"); + return true; + + case SSL_ERROR_REVOKED_CERT_ALERT: + failf(data, "SSL error: SSL_ERROR_REVOKED_CERT_ALERT"); + return true; + + case SSL_ERROR_EXPIRED_CERT_ALERT: + failf(data, "SSL error: SSL_ERROR_EXPIRED_CERT_ALERT"); + return true; + + default: + return false; + } +} + +static Curl_recv nss_recv; +static Curl_send nss_send; + +CURLcode Curl_nss_connect(struct connectdata *conn, int sockindex) +{ + PRInt32 err; + PRFileDesc *model = NULL; + PRBool ssl2 = PR_FALSE; + PRBool ssl3 = PR_FALSE; + PRBool tlsv1 = PR_FALSE; + struct SessionHandle *data = conn->data; + curl_socket_t sockfd = conn->sock[sockindex]; + struct ssl_connect_data *connssl = &conn->ssl[sockindex]; + int curlerr; + const int *cipher_to_enable; + PRSocketOptionData sock_opt; + long time_left; + PRUint32 timeout; + + if (connssl->state == ssl_connection_complete) + return CURLE_OK; + + connssl->data = data; + +#ifdef HAVE_PK11_CREATEGENERICOBJECT + connssl->cacert[0] = NULL; + connssl->cacert[1] = NULL; + connssl->key = NULL; +#endif + + /* FIXME. NSS doesn't support multiple databases open at the same time. */ + PR_Lock(nss_initlock); + curlerr = init_nss(conn->data); + if(CURLE_OK != curlerr) { + PR_Unlock(nss_initlock); + goto error; + } + + curlerr = CURLE_SSL_CONNECT_ERROR; + +#ifdef HAVE_PK11_CREATEGENERICOBJECT + if(!mod) { + char *configstring = aprintf("library=%s name=PEM", pem_library); + if(!configstring) { + PR_Unlock(nss_initlock); + goto error; + } + mod = SECMOD_LoadUserModule(configstring, NULL, PR_FALSE); + free(configstring); + + if(!mod || !mod->loaded) { + if(mod) { + SECMOD_DestroyModule(mod); + mod = NULL; + } + infof(data, "WARNING: failed to load NSS PEM library %s. Using " + "OpenSSL PEM certificates will not work.\n", pem_library); + } + } +#endif + + PK11_SetPasswordFunc(nss_get_password); + PR_Unlock(nss_initlock); + + model = PR_NewTCPSocket(); + if(!model) + goto error; + model = SSL_ImportFD(NULL, model); + + /* make the socket nonblocking */ + sock_opt.option = PR_SockOpt_Nonblocking; + sock_opt.value.non_blocking = PR_TRUE; + if(PR_SetSocketOption(model, &sock_opt) != SECSuccess) + goto error; + + if(SSL_OptionSet(model, SSL_SECURITY, PR_TRUE) != SECSuccess) + goto error; + if(SSL_OptionSet(model, SSL_HANDSHAKE_AS_SERVER, PR_FALSE) != SECSuccess) + goto error; + if(SSL_OptionSet(model, SSL_HANDSHAKE_AS_CLIENT, PR_TRUE) != SECSuccess) + goto error; + + switch (data->set.ssl.version) { + default: + case CURL_SSLVERSION_DEFAULT: + ssl3 = PR_TRUE; + if (data->state.ssl_connect_retry) + infof(data, "TLS disabled due to previous handshake failure\n"); + else + tlsv1 = PR_TRUE; + break; + case CURL_SSLVERSION_TLSv1: + tlsv1 = PR_TRUE; + break; + case CURL_SSLVERSION_SSLv2: + ssl2 = PR_TRUE; + break; + case CURL_SSLVERSION_SSLv3: + ssl3 = PR_TRUE; + break; + } + + if(SSL_OptionSet(model, SSL_ENABLE_SSL2, ssl2) != SECSuccess) + goto error; + if(SSL_OptionSet(model, SSL_ENABLE_SSL3, ssl3) != SECSuccess) + goto error; + if(SSL_OptionSet(model, SSL_ENABLE_TLS, tlsv1) != SECSuccess) + goto error; + + if(SSL_OptionSet(model, SSL_V2_COMPATIBLE_HELLO, ssl2) != SECSuccess) + goto error; + + /* reset the flag to avoid an infinite loop */ + data->state.ssl_connect_retry = FALSE; + + /* enable all ciphers from enable_ciphers_by_default */ + cipher_to_enable = enable_ciphers_by_default; + while (SSL_NULL_WITH_NULL_NULL != *cipher_to_enable) { + if (SSL_CipherPrefSet(model, *cipher_to_enable, PR_TRUE) != SECSuccess) { + curlerr = CURLE_SSL_CIPHER; + goto error; + } + cipher_to_enable++; + } + + if(data->set.ssl.cipher_list) { + if(set_ciphers(data, model, data->set.ssl.cipher_list) != SECSuccess) { + curlerr = CURLE_SSL_CIPHER; + goto error; + } + } + + if(data->set.ssl.verifyhost == 1) + infof(data, "warning: ignoring unsupported value (1) of ssl.verifyhost\n"); + + data->set.ssl.certverifyresult=0; /* not checked yet */ + if(SSL_BadCertHook(model, (SSLBadCertHandler) BadCertHandler, conn) + != SECSuccess) { + goto error; + } + if(SSL_HandshakeCallback(model, (SSLHandshakeCallback) HandshakeCallback, + NULL) != SECSuccess) + goto error; + + if(!data->set.ssl.verifypeer) + /* skip the verifying of the peer */ + ; + else if(data->set.ssl.CAfile) { + int rc = nss_load_cert(&conn->ssl[sockindex], data->set.ssl.CAfile, + PR_TRUE); + if(!rc) { + curlerr = CURLE_SSL_CACERT_BADFILE; + goto error; + } + } + else if(data->set.ssl.CApath) { + struct_stat st; + PRDir *dir; + PRDirEntry *entry; + + if(stat(data->set.ssl.CApath, &st) == -1) { + curlerr = CURLE_SSL_CACERT_BADFILE; + goto error; + } + + if(S_ISDIR(st.st_mode)) { + int rc; + + dir = PR_OpenDir(data->set.ssl.CApath); + do { + entry = PR_ReadDir(dir, PR_SKIP_BOTH | PR_SKIP_HIDDEN); + + if(entry) { + char fullpath[PATH_MAX]; + + snprintf(fullpath, sizeof(fullpath), "%s/%s", data->set.ssl.CApath, + entry->name); + rc = nss_load_cert(&conn->ssl[sockindex], fullpath, PR_TRUE); + /* FIXME: check this return value! */ + } + /* This is purposefully tolerant of errors so non-PEM files + * can be in the same directory */ + } while(entry != NULL); + PR_CloseDir(dir); + } + } + infof(data, + " CAfile: %s\n" + " CApath: %s\n", + data->set.ssl.CAfile ? data->set.ssl.CAfile : "none", + data->set.ssl.CApath ? data->set.ssl.CApath : "none"); + + if (data->set.ssl.CRLfile) { + if(SECSuccess != nss_load_crl(data->set.ssl.CRLfile)) { + curlerr = CURLE_SSL_CRL_BADFILE; + goto error; + } + infof(data, + " CRLfile: %s\n", + data->set.ssl.CRLfile ? data->set.ssl.CRLfile : "none"); + } + + if(data->set.str[STRING_CERT]) { + bool nickname_alloc = FALSE; + char *nickname = fmt_nickname(data->set.str[STRING_CERT], &nickname_alloc); + if(!nickname) + return CURLE_OUT_OF_MEMORY; + + if(!cert_stuff(conn, sockindex, data->set.str[STRING_CERT], + data->set.str[STRING_KEY])) { + /* failf() is already done in cert_stuff() */ + if(nickname_alloc) + free(nickname); + return CURLE_SSL_CERTPROBLEM; + } + + /* this "takes over" the pointer to the allocated name or makes a + dup of it */ + connssl->client_nickname = nickname_alloc?nickname:strdup(nickname); + if(!connssl->client_nickname) + return CURLE_OUT_OF_MEMORY; + + } + else + connssl->client_nickname = NULL; + + if(SSL_GetClientAuthDataHook(model, SelectClientCert, + (void *)connssl) != SECSuccess) { + curlerr = CURLE_SSL_CERTPROBLEM; + goto error; + } + + /* Import our model socket onto the existing file descriptor */ + connssl->handle = PR_ImportTCPSocket(sockfd); + connssl->handle = SSL_ImportFD(model, connssl->handle); + if(!connssl->handle) + goto error; + + PR_Close(model); /* We don't need this any more */ + model = NULL; + + /* This is the password associated with the cert that we're using */ + if (data->set.str[STRING_KEY_PASSWD]) { + SSL_SetPKCS11PinArg(connssl->handle, data->set.str[STRING_KEY_PASSWD]); + } + + /* Force handshake on next I/O */ + SSL_ResetHandshake(connssl->handle, /* asServer */ PR_FALSE); + + SSL_SetURL(connssl->handle, conn->host.name); + + /* check timeout situation */ + time_left = Curl_timeleft(conn, NULL, TRUE); + if(time_left < 0L) { + failf(data, "timed out before SSL handshake"); + goto error; + } + timeout = PR_MillisecondsToInterval((PRUint32) time_left); + + /* Force the handshake now */ + if(SSL_ForceHandshakeWithTimeout(connssl->handle, timeout) != SECSuccess) { + if(conn->data->set.ssl.certverifyresult == SSL_ERROR_BAD_CERT_DOMAIN) + curlerr = CURLE_PEER_FAILED_VERIFICATION; + else if(conn->data->set.ssl.certverifyresult!=0) + curlerr = CURLE_SSL_CACERT; + goto error; + } + + connssl->state = ssl_connection_complete; + conn->recv[sockindex] = nss_recv; + conn->send[sockindex] = nss_send; + + display_conn_info(conn, connssl->handle); + + if (data->set.str[STRING_SSL_ISSUERCERT]) { + SECStatus ret; + bool nickname_alloc = FALSE; + char *nickname = fmt_nickname(data->set.str[STRING_SSL_ISSUERCERT], + &nickname_alloc); + + if(!nickname) + return CURLE_OUT_OF_MEMORY; + + ret = check_issuer_cert(connssl->handle, nickname); + + if(nickname_alloc) + free(nickname); + + if(SECFailure == ret) { + infof(data,"SSL certificate issuer check failed\n"); + curlerr = CURLE_SSL_ISSUER_ERROR; + goto error; + } + else { + infof(data, "SSL certificate issuer check ok\n"); + } + } + + return CURLE_OK; + + error: + /* reset the flag to avoid an infinite loop */ + data->state.ssl_connect_retry = FALSE; + + err = PR_GetError(); + if(handle_cc_error(err, data)) + curlerr = CURLE_SSL_CERTPROBLEM; + else + infof(data, "NSS error %d\n", err); + + if(model) + PR_Close(model); + + if (ssl3 && tlsv1 && isTLSIntoleranceError(err)) { + /* schedule reconnect through Curl_retry_request() */ + data->state.ssl_connect_retry = TRUE; + infof(data, "Error in TLS handshake, trying SSLv3...\n"); + return CURLE_OK; + } + + return curlerr; +} + +static ssize_t nss_send(struct connectdata *conn, /* connection data */ + int sockindex, /* socketindex */ + const void *mem, /* send this data */ + size_t len, /* amount to write */ + CURLcode *curlcode) +{ + int rc; + + rc = PR_Send(conn->ssl[sockindex].handle, mem, (int)len, 0, -1); + + if(rc < 0) { + PRInt32 err = PR_GetError(); + if(err == PR_WOULD_BLOCK_ERROR) + *curlcode = CURLE_AGAIN; + else if(handle_cc_error(err, conn->data)) + *curlcode = CURLE_SSL_CERTPROBLEM; + else { + failf(conn->data, "SSL write: error %d", err); + *curlcode = CURLE_SEND_ERROR; + } + return -1; + } + return rc; /* number of bytes */ +} + +static ssize_t nss_recv(struct connectdata * conn, /* connection data */ + int num, /* socketindex */ + char *buf, /* store read data here */ + size_t buffersize, /* max amount to read */ + CURLcode *curlcode) +{ + ssize_t nread; + + nread = PR_Recv(conn->ssl[num].handle, buf, (int)buffersize, 0, -1); + if(nread < 0) { + /* failed SSL read */ + PRInt32 err = PR_GetError(); + + if(err == PR_WOULD_BLOCK_ERROR) + *curlcode = CURLE_AGAIN; + else if(handle_cc_error(err, conn->data)) + *curlcode = CURLE_SSL_CERTPROBLEM; + else { + failf(conn->data, "SSL read: errno %d", err); + *curlcode = CURLE_RECV_ERROR; + } + return -1; + } + return nread; +} + +size_t Curl_nss_version(char *buffer, size_t size) +{ + return snprintf(buffer, size, "NSS/%s", NSS_VERSION); +} + +int Curl_nss_seed(struct SessionHandle *data) +{ + /* TODO: implement? */ + (void) data; + return 0; +} + +#endif /* USE_NSS */ diff --git a/mobicore/common/curl/lib/nssg.h b/mobicore/common/curl/lib/nssg.h new file mode 100644 index 0000000000000000000000000000000000000000..f9cc46ae2ff1baa5bd449c47da233f6972c775bc --- /dev/null +++ b/mobicore/common/curl/lib/nssg.h @@ -0,0 +1,71 @@ +#ifndef __NSSG_H +#define __NSSG_H +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) 1998 - 2010, Daniel Stenberg, , et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at http://curl.haxx.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ***************************************************************************/ + +#ifdef USE_NSS +/* + * This header should only be needed to get included by sslgen.c and nss.c + */ + +#include "urldata.h" +CURLcode Curl_nss_connect(struct connectdata *conn, int sockindex); +CURLcode Curl_nss_connect_nonblocking(struct connectdata *conn, + int sockindex, + bool *done); +/* close a SSL connection */ +void Curl_nss_close(struct connectdata *conn, int sockindex); + +/* tell NSS to close down all open information regarding connections (and + thus session ID caching etc) */ +int Curl_nss_close_all(struct SessionHandle *data); + +int Curl_nss_init(void); +void Curl_nss_cleanup(void); + +size_t Curl_nss_version(char *buffer, size_t size); +int Curl_nss_check_cxn(struct connectdata *cxn); +int Curl_nss_seed(struct SessionHandle *data); + +/* initialize NSS library if not already */ +CURLcode Curl_nss_force_init(struct SessionHandle *data); + +/* API setup for NSS */ +#define curlssl_init Curl_nss_init +#define curlssl_cleanup Curl_nss_cleanup +#define curlssl_connect Curl_nss_connect + +/* NSS has its own session ID cache */ +#define curlssl_session_free(x) +#define curlssl_close_all Curl_nss_close_all +#define curlssl_close Curl_nss_close +/* NSS has no shutdown function provided and thus always fail */ +#define curlssl_shutdown(x,y) (x=x, y=y, 1) +#define curlssl_set_engine(x,y) (x=x, y=y, CURLE_FAILED_INIT) +#define curlssl_set_engine_default(x) (x=x, CURLE_FAILED_INIT) +#define curlssl_engines_list(x) (x=x, (struct curl_slist *)NULL) +#define curlssl_version Curl_nss_version +#define curlssl_check_cxn(x) Curl_nss_check_cxn(x) +#define curlssl_data_pending(x,y) (x=x, y=y, 0) + +#endif /* USE_NSS */ +#endif diff --git a/mobicore/common/curl/lib/nwlib.c b/mobicore/common/curl/lib/nwlib.c new file mode 100644 index 0000000000000000000000000000000000000000..f9c8a4298a57f16d119ddfd5936e18ae9f54fe2f --- /dev/null +++ b/mobicore/common/curl/lib/nwlib.c @@ -0,0 +1,327 @@ +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) 1998 - 2009, Daniel Stenberg, , et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at http://curl.haxx.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ***************************************************************************/ + +#ifdef NETWARE /* Novell NetWare */ + +#include + +#ifdef __NOVELL_LIBC__ +/* For native LibC-based NLM we need to register as a real lib. */ +#include +#include +#include +#include +#include +#include +#include + + +typedef struct +{ + int _errno; + void *twentybytes; +} libthreaddata_t; + +typedef struct +{ + int x; + int y; + int z; + void *tenbytes; + NXKey_t perthreadkey; /* if -1, no key obtained... */ + NXMutex_t *lock; +} libdata_t; + +int gLibId = -1; +void *gLibHandle = (void *) NULL; +rtag_t gAllocTag = (rtag_t) NULL; +NXMutex_t *gLibLock = (NXMutex_t *) NULL; + +/* internal library function prototypes... */ +int DisposeLibraryData ( void * ); +void DisposeThreadData ( void * ); +int GetOrSetUpData ( int id, libdata_t **data, libthreaddata_t **threaddata ); + + +int _NonAppStart( void *NLMHandle, + void *errorScreen, + const char *cmdLine, + const char *loadDirPath, + size_t uninitializedDataLength, + void *NLMFileHandle, + int (*readRoutineP)( int conn, + void *fileHandle, size_t offset, + size_t nbytes, + size_t *bytesRead, + void *buffer ), + size_t customDataOffset, + size_t customDataSize, + int messageCount, + const char **messages ) +{ + NX_LOCK_INFO_ALLOC(liblock, "Per-Application Data Lock", 0); + +#ifndef __GNUC__ +#pragma unused(cmdLine) +#pragma unused(loadDirPath) +#pragma unused(uninitializedDataLength) +#pragma unused(NLMFileHandle) +#pragma unused(readRoutineP) +#pragma unused(customDataOffset) +#pragma unused(customDataSize) +#pragma unused(messageCount) +#pragma unused(messages) +#endif + +/* +** Here we process our command line, post errors (to the error screen), +** perform initializations and anything else we need to do before being able +** to accept calls into us. If we succeed, we return non-zero and the NetWare +** Loader will leave us up, otherwise we fail to load and get dumped. +*/ + gAllocTag = AllocateResourceTag(NLMHandle, + " memory allocations", + AllocSignature); + + if(!gAllocTag) { + OutputToScreen(errorScreen, "Unable to allocate resource tag for " + "library memory allocations.\n"); + return -1; + } + + gLibId = register_library(DisposeLibraryData); + + if(gLibId < -1) { + OutputToScreen(errorScreen, "Unable to register library with kernel.\n"); + return -1; + } + + gLibHandle = NLMHandle; + + gLibLock = NXMutexAlloc(0, 0, &liblock); + + if(!gLibLock) { + OutputToScreen(errorScreen, "Unable to allocate library data lock.\n"); + return -1; + } + + return 0; +} + +/* +** Here we clean up any resources we allocated. Resource tags is a big part +** of what we created, but NetWare doesn't ask us to free those. +*/ +void _NonAppStop( void ) +{ + (void) unregister_library(gLibId); + NXMutexFree(gLibLock); +} + +/* +** This function cannot be the first in the file for if the file is linked +** first, then the check-unload function's offset will be nlmname.nlm+0 +** which is how to tell that there isn't one. When the check function is +** first in the linked objects, it is ambiguous. For this reason, we will +** put it inside this file after the stop function. +** +** Here we check to see if it's alright to ourselves to be unloaded. If not, +** we return a non-zero value. Right now, there isn't any reason not to allow +** it. +*/ +int _NonAppCheckUnload( void ) +{ + return 0; +} + +int GetOrSetUpData(int id, libdata_t **appData, + libthreaddata_t **threadData ) +{ + int err; + libdata_t *app_data; + libthreaddata_t *thread_data; + NXKey_t key; + NX_LOCK_INFO_ALLOC(liblock, "Application Data Lock", 0); + + err = 0; + thread_data = (libthreaddata_t *) NULL; + +/* +** Attempt to get our data for the application calling us. This is where we +** store whatever application-specific information we need to carry in support +** of calling applications. +*/ + app_data = (libdata_t *) get_app_data(id); + + if(!app_data) { +/* +** This application hasn't called us before; set up application AND per-thread +** data. Of course, just in case a thread from this same application is calling +** us simultaneously, we better lock our application data-creation mutex. We +** also need to recheck for data after we acquire the lock because WE might be +** that other thread that was too late to create the data and the first thread +** in will have created it. +*/ + NXLock(gLibLock); + + if(!(app_data = (libdata_t *) get_app_data(id))) { + app_data = malloc(sizeof(libdata_t)); + + if(app_data) { + memset(app_data, 0, sizeof(libdata_t)); + + app_data->tenbytes = malloc(10); + app_data->lock = NXMutexAlloc(0, 0, &liblock); + + if(!app_data->tenbytes || !app_data->lock) { + if(app_data->lock) + NXMutexFree(app_data->lock); + + free(app_data); + app_data = (libdata_t *) NULL; + err = ENOMEM; + } + + if(app_data) { +/* +** Here we burn in the application data that we were trying to get by calling +** get_app_data(). Next time we call the first function, we'll get this data +** we're just now setting. We also go on here to establish the per-thread data +** for the calling thread, something we'll have to do on each application +** thread the first time it calls us. +*/ + err = set_app_data(gLibId, app_data); + + if(err) { + free(app_data); + app_data = (libdata_t *) NULL; + err = ENOMEM; + } + else { + /* create key for thread-specific data... */ + err = NXKeyCreate(DisposeThreadData, (void *) NULL, &key); + + if(err) /* (no more keys left?) */ + key = -1; + + app_data->perthreadkey = key; + } + } + } + } + + NXUnlock(gLibLock); + } + + if(app_data) { + key = app_data->perthreadkey; + + if(key != -1 /* couldn't create a key? no thread data */ + && !(err = NXKeyGetValue(key, (void **) &thread_data)) + && !thread_data) { +/* +** Allocate the per-thread data for the calling thread. Regardless of whether +** there was already application data or not, this may be the first call by a +** a new thread. The fact that we allocation 20 bytes on a pointer is not very +** important, this just helps to demonstrate that we can have arbitrarily +** complex per-thread data. +*/ + thread_data = malloc(sizeof(libthreaddata_t)); + + if(thread_data) { + thread_data->_errno = 0; + thread_data->twentybytes = malloc(20); + + if(!thread_data->twentybytes) { + free(thread_data); + thread_data = (libthreaddata_t *) NULL; + err = ENOMEM; + } + + if((err = NXKeySetValue(key, thread_data))) { + free(thread_data->twentybytes); + free(thread_data); + thread_data = (libthreaddata_t *) NULL; + } + } + } + } + + if(appData) + *appData = app_data; + + if(threadData) + *threadData = thread_data; + + return err; +} + +int DisposeLibraryData( void *data ) +{ + if(data) { + void *tenbytes = ((libdata_t *) data)->tenbytes; + + if(tenbytes) + free(tenbytes); + + free(data); + } + + return 0; +} + +void DisposeThreadData( void *data ) +{ + if(data) { + void *twentybytes = ((libthreaddata_t *) data)->twentybytes; + + if(twentybytes) + free(twentybytes); + + free(data); + } +} + +#else /* __NOVELL_LIBC__ */ +/* For native CLib-based NLM seems we can do a bit more simple. */ +#include + +int main ( void ) +{ + /* initialize any globals here... */ + + /* do this if any global initializing was done + SynchronizeStart(); + */ + ExitThread (TSR_THREAD, 0); + return 0; +} + +#endif /* __NOVELL_LIBC__ */ + +#else /* NETWARE */ + +#ifdef __POCC__ +# pragma warn(disable:2024) /* Disable warning #2024: Empty input file */ +#endif + +#endif /* NETWARE */ diff --git a/mobicore/common/curl/lib/nwos.c b/mobicore/common/curl/lib/nwos.c new file mode 100644 index 0000000000000000000000000000000000000000..ac365124fda8b3a98e4a9c46bb9dacd949a1680c --- /dev/null +++ b/mobicore/common/curl/lib/nwos.c @@ -0,0 +1,95 @@ +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) 1998 - 2009, Daniel Stenberg, , et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at http://curl.haxx.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ***************************************************************************/ + +#ifdef NETWARE /* Novell NetWare */ + +#include + +#ifdef __NOVELL_LIBC__ +/* For native LibC-based NLM we need to do nothing. */ +int netware_init ( void ) +{ + return 0; +} + +#else /* __NOVELL_LIBC__ */ + +/* For native CLib-based NLM we need to initialize the LONG namespace. */ +#include +#include +#include +#include +/* Make the CLIB Ctx stuff link */ +#include +NETDB_DEFINE_CONTEXT +/* Make the CLIB Inet stuff link */ +#include +#include +NETINET_DEFINE_CONTEXT + +int netware_init ( void ) +{ + int rc = 0; + unsigned int myHandle = GetNLMHandle(); + /* import UnAugmentAsterisk dynamically for NW4.x compatibility */ + void (*pUnAugmentAsterisk)(int) = (void(*)(int)) + ImportSymbol(myHandle, "UnAugmentAsterisk"); + /* import UseAccurateCaseForPaths dynamically for NW3.x compatibility */ + void (*pUseAccurateCaseForPaths)(int) = (void(*)(int)) + ImportSymbol(myHandle, "UseAccurateCaseForPaths"); + if(pUnAugmentAsterisk) + pUnAugmentAsterisk(1); + if(pUseAccurateCaseForPaths) + pUseAccurateCaseForPaths(1); + UnimportSymbol(myHandle, "UnAugmentAsterisk"); + UnimportSymbol(myHandle, "UseAccurateCaseForPaths"); + /* set long name space */ + if((SetCurrentNameSpace(4) == 255)) { + rc = 1; + } + if((SetTargetNameSpace(4) == 255)) { + rc = rc + 2; + } + return rc; +} + +/* dummy function to satisfy newer prelude */ +int __init_environment ( void ) +{ + return 0; +} + +/* dummy function to satisfy newer prelude */ +int __deinit_environment ( void ) +{ + return 0; +} + +#endif /* __NOVELL_LIBC__ */ + +#else /* NETWARE */ + +#ifdef __POCC__ +# pragma warn(disable:2024) /* Disable warning #2024: Empty input file */ +#endif + +#endif /* NETWARE */ diff --git a/mobicore/common/curl/lib/openldap.c b/mobicore/common/curl/lib/openldap.c new file mode 100644 index 0000000000000000000000000000000000000000..7010da6c224937ee6c151a0d6681a73a2134ab61 --- /dev/null +++ b/mobicore/common/curl/lib/openldap.c @@ -0,0 +1,638 @@ +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) 2010, Howard Chu, + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at http://curl.haxx.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ***************************************************************************/ + +#include "setup.h" + +#if !defined(CURL_DISABLE_LDAP) && defined(USE_OPENLDAP) + +/* + * Notice that USE_OPENLDAP is only a source code selection switch. When + * libcurl is built with USE_OPENLDAP defined the libcurl source code that + * gets compiled is the code from openldap.c, otherwise the code that gets + * compiled is the code from ldap.c. + * + * When USE_OPENLDAP is defined a recent version of the OpenLDAP library + * might be required for compilation and runtime. In order to use ancient + * OpenLDAP library versions, USE_OPENLDAP shall not be defined. + */ + +#include + +#include "urldata.h" +#include +#include "sendf.h" +#include "sslgen.h" +#include "transfer.h" +#include "curl_ldap.h" +#include "curl_memory.h" +#include "curl_base64.h" + +#define _MPRINTF_REPLACE /* use our functions only */ +#include + +#include "memdebug.h" + +#ifndef _LDAP_PVT_H +extern int ldap_pvt_url_scheme2proto(const char *); +extern int ldap_init_fd(ber_socket_t fd, int proto, const char *url, LDAP **ld); +#endif + +static CURLcode ldap_setup(struct connectdata *conn); +static CURLcode ldap_do(struct connectdata *conn, bool *done); +static CURLcode ldap_done(struct connectdata *conn, CURLcode, bool); +static CURLcode ldap_connect(struct connectdata *conn, bool *done); +static CURLcode ldap_connecting(struct connectdata *conn, bool *done); +static CURLcode ldap_disconnect(struct connectdata *conn, bool dead_connection); + +static Curl_recv ldap_recv; + +/* + * LDAP protocol handler. + */ + +const struct Curl_handler Curl_handler_ldap = { + "LDAP", /* scheme */ + ldap_setup, /* setup_connection */ + ldap_do, /* do_it */ + ldap_done, /* done */ + ZERO_NULL, /* do_more */ + ldap_connect, /* connect_it */ + ldap_connecting, /* connecting */ + ZERO_NULL, /* doing */ + ZERO_NULL, /* proto_getsock */ + ZERO_NULL, /* doing_getsock */ + ZERO_NULL, /* perform_getsock */ + ldap_disconnect, /* disconnect */ + PORT_LDAP, /* defport */ + PROT_LDAP /* protocol */ +}; + +#ifdef USE_SSL +/* + * LDAPS protocol handler. + */ + +const struct Curl_handler Curl_handler_ldaps = { + "LDAPS", /* scheme */ + ldap_setup, /* setup_connection */ + ldap_do, /* do_it */ + ldap_done, /* done */ + ZERO_NULL, /* do_more */ + ldap_connect, /* connect_it */ + ldap_connecting, /* connecting */ + ZERO_NULL, /* doing */ + ZERO_NULL, /* proto_getsock */ + ZERO_NULL, /* doing_getsock */ + ZERO_NULL, /* perform_getsock */ + ldap_disconnect, /* disconnect */ + PORT_LDAPS, /* defport */ + PROT_LDAP | PROT_SSL /* protocol */ +}; +#endif + +static const char *url_errs[] = { + "success", + "out of memory", + "bad parameter", + "unrecognized scheme", + "unbalanced delimiter", + "bad URL", + "bad host or port", + "bad or missing attributes", + "bad or missing scope", + "bad or missing filter", + "bad or missing extensions" +}; + +typedef struct ldapconninfo { + LDAP *ld; + Curl_recv *recv; /* for stacking SSL handler */ + Curl_send *send; + int proto; + int msgid; + bool ssldone; + bool sslinst; + bool didbind; +} ldapconninfo; + +typedef struct ldapreqinfo { + int msgid; + int nument; +} ldapreqinfo; + +static CURLcode ldap_setup(struct connectdata *conn) +{ + ldapconninfo *li; + LDAPURLDesc *lud; + struct SessionHandle *data=conn->data; + int rc, proto; + CURLcode status; + + rc = ldap_url_parse(data->change.url, &lud); + if (rc != LDAP_URL_SUCCESS) { + const char *msg = "url parsing problem"; + status = CURLE_URL_MALFORMAT; + if (rc > LDAP_URL_SUCCESS && rc <= LDAP_URL_ERR_BADEXTS) { + if (rc == LDAP_URL_ERR_MEM) + status = CURLE_OUT_OF_MEMORY; + msg = url_errs[rc]; + } + failf(conn->data, "LDAP local: %s", msg); + return status; + } + proto = ldap_pvt_url_scheme2proto(lud->lud_scheme); + ldap_free_urldesc(lud); + + li = calloc(1, sizeof(ldapconninfo)); + li->proto = proto; + conn->proto.generic = li; + conn->bits.close = FALSE; + /* TODO: + * - provide option to choose SASL Binds instead of Simple + */ + return CURLE_OK; +} + +#ifdef USE_SSL +static Sockbuf_IO ldapsb_tls; +#endif + +static CURLcode ldap_connect(struct connectdata *conn, bool *done) +{ + ldapconninfo *li = conn->proto.generic; + struct SessionHandle *data=conn->data; + int rc, proto = LDAP_VERSION3; + char hosturl[1024], *ptr; + + strcpy(hosturl, "ldap"); + ptr = hosturl+4; + if (conn->protocol & PROT_SSL) + *ptr++ = 's'; + snprintf(ptr, sizeof(hosturl)-(ptr-hosturl), "://%s:%d", + conn->host.name, conn->remote_port); + + rc = ldap_init_fd(conn->sock[FIRSTSOCKET], li->proto, hosturl, &li->ld); + if (rc) { + failf(data, "LDAP local: Cannot connect to %s, %s", + hosturl, ldap_err2string(rc)); + return CURLE_COULDNT_CONNECT; + } + + ldap_set_option(li->ld, LDAP_OPT_PROTOCOL_VERSION, &proto); + +#if !defined(CURL_DISABLE_HTTP) && !defined(CURL_DISABLE_PROXY) + if(conn->bits.tunnel_proxy && conn->bits.httpproxy) { + /* for LDAP over HTTP proxy */ + struct HTTP http_proxy; + ldapconninfo *li_save; + CURLcode result; + + /* BLOCKING */ + /* We want "seamless" LDAP operations through HTTP proxy tunnel */ + + /* Curl_proxyCONNECT is based on a pointer to a struct HTTP at the member + * conn->proto.http; we want LDAP through HTTP and we have to change the + * member temporarily for connecting to the HTTP proxy. After + * Curl_proxyCONNECT we have to set back the member to the original struct + * LDAP pointer + */ + li_save = data->state.proto.generic; + memset(&http_proxy, 0, sizeof(http_proxy)); + data->state.proto.http = &http_proxy; + result = Curl_proxyCONNECT(conn, FIRSTSOCKET, + conn->host.name, conn->remote_port); + + data->state.proto.generic = li_save; + + if(CURLE_OK != result) + return result; + } +#endif /* !CURL_DISABLE_HTTP && !CURL_DISABLE_PROXY */ + +#ifdef USE_SSL + if (conn->protocol & PROT_SSL) { + CURLcode res; + if (data->state.used_interface == Curl_if_easy) { + res = Curl_ssl_connect(conn, FIRSTSOCKET); + if (res) + return res; + li->ssldone = TRUE; + } else { + res = Curl_ssl_connect_nonblocking(conn, FIRSTSOCKET, &li->ssldone); + if (res) + return res; + } + } +#endif + + if (data->state.used_interface == Curl_if_easy) + return ldap_connecting(conn, done); + + return CURLE_OK; +} + +static CURLcode ldap_connecting(struct connectdata *conn, bool *done) +{ + ldapconninfo *li = conn->proto.generic; + struct SessionHandle *data=conn->data; + LDAPMessage *result = NULL; + struct timeval tv = {0,1}, *tvp; + int rc, err; + char *info = NULL; + +#ifdef USE_SSL + if (conn->protocol & PROT_SSL) { + /* Is the SSL handshake complete yet? */ + if (!li->ssldone) { + CURLcode res = Curl_ssl_connect_nonblocking(conn, FIRSTSOCKET, &li->ssldone); + if (res || !li->ssldone) + return res; + } + /* Have we installed the libcurl SSL handlers into the sockbuf yet? */ + if (!li->sslinst) { + Sockbuf *sb; + ldap_get_option(li->ld, LDAP_OPT_SOCKBUF, &sb); + ber_sockbuf_add_io(sb, &ldapsb_tls, LBER_SBIOD_LEVEL_TRANSPORT, conn); + li->sslinst = TRUE; + li->recv = conn->recv[FIRSTSOCKET]; + li->send = conn->send[FIRSTSOCKET]; + } + } +#endif + + if (data->state.used_interface == Curl_if_easy) + tvp = NULL; /* let ldap_result block indefinitely */ + else + tvp = &tv; + +retry: + if (!li->didbind) { + char *binddn; + struct berval passwd; + + if (conn->bits.user_passwd) { + binddn = conn->user; + passwd.bv_val = conn->passwd; + passwd.bv_len = strlen(passwd.bv_val); + } else { + binddn = NULL; + passwd.bv_val = NULL; + passwd.bv_len = 0; + } + rc = ldap_sasl_bind(li->ld, binddn, LDAP_SASL_SIMPLE, &passwd, + NULL, NULL, &li->msgid); + if (rc) + return CURLE_LDAP_CANNOT_BIND; + li->didbind = TRUE; + if (tvp) + return CURLE_OK; + } + + rc = ldap_result(li->ld, li->msgid, LDAP_MSG_ONE, tvp, &result); + if (rc < 0) { + failf(data, "LDAP local: bind ldap_result %s", ldap_err2string(rc)); + return CURLE_LDAP_CANNOT_BIND; + } + if (rc == 0) { + /* timed out */ + return CURLE_OK; + } + rc = ldap_parse_result(li->ld, result, &err, NULL, &info, NULL, NULL, 1); + if (rc) { + failf(data, "LDAP local: bind ldap_parse_result %s", ldap_err2string(rc)); + return CURLE_LDAP_CANNOT_BIND; + } + /* Try to fallback to LDAPv2? */ + if (err == LDAP_PROTOCOL_ERROR) { + int proto; + ldap_get_option(li->ld, LDAP_OPT_PROTOCOL_VERSION, &proto); + if (proto == LDAP_VERSION3) { + ldap_memfree(info); + proto = LDAP_VERSION2; + ldap_set_option(li->ld, LDAP_OPT_PROTOCOL_VERSION, &proto); + li->didbind = FALSE; + goto retry; + } + } + + if (err) { + failf(data, "LDAP remote: bind failed %s %s", ldap_err2string(rc), + info ? info : ""); + return CURLE_LOGIN_DENIED; + } + conn->recv[FIRSTSOCKET] = ldap_recv; + *done = TRUE; + return CURLE_OK; +} + +static CURLcode ldap_disconnect(struct connectdata *conn, bool dead_connection) +{ + ldapconninfo *li = conn->proto.generic; + (void) dead_connection; + + if (li) { + if (li->ld) { + ldap_unbind_ext(li->ld, NULL, NULL); + li->ld = NULL; + } + conn->proto.generic = NULL; + free(li); + } + return CURLE_OK; +} + +static CURLcode ldap_do(struct connectdata *conn, bool *done) +{ + ldapconninfo *li = conn->proto.generic; + ldapreqinfo *lr; + CURLcode status = CURLE_OK; + int rc = 0; + LDAPURLDesc *ludp = NULL; + int msgid; + struct SessionHandle *data=conn->data; + + conn->bits.close = FALSE; + + infof(data, "LDAP local: %s\n", data->change.url); + + rc = ldap_url_parse(data->change.url, &ludp); + if (rc != LDAP_URL_SUCCESS) { + const char *msg = "url parsing problem"; + status = CURLE_URL_MALFORMAT; + if (rc > LDAP_URL_SUCCESS && rc <= LDAP_URL_ERR_BADEXTS) { + if (rc == LDAP_URL_ERR_MEM) + status = CURLE_OUT_OF_MEMORY; + msg = url_errs[rc]; + } + failf(conn->data, "LDAP local: %s", msg); + return status; + } + + rc = ldap_search_ext(li->ld, ludp->lud_dn, ludp->lud_scope, + ludp->lud_filter, ludp->lud_attrs, 0, + NULL, NULL, NULL, 0, &msgid); + ldap_free_urldesc(ludp); + if (rc != LDAP_SUCCESS) { + failf(data, "LDAP local: ldap_search_ext %s", ldap_err2string(rc)); + return CURLE_LDAP_SEARCH_FAILED; + } + lr = calloc(1,sizeof(ldapreqinfo)); + lr->msgid = msgid; + data->state.proto.generic = lr; + Curl_setup_transfer(conn, FIRSTSOCKET, -1, FALSE, NULL, -1, NULL); + *done = TRUE; + return CURLE_OK; +} + +static CURLcode ldap_done(struct connectdata *conn, CURLcode res, + bool premature) +{ + ldapreqinfo *lr = conn->data->state.proto.generic; + (void)res; + (void)premature; + + if (lr) { + /* if there was a search in progress, abandon it */ + if (lr->msgid) { + ldapconninfo *li = conn->proto.generic; + ldap_abandon_ext(li->ld, lr->msgid, NULL, NULL); + lr->msgid = 0; + } + conn->data->state.proto.generic = NULL; + free(lr); + } + return CURLE_OK; +} + +static ssize_t ldap_recv(struct connectdata *conn, int sockindex, char *buf, + size_t len, CURLcode *err) +{ + ldapconninfo *li = conn->proto.generic; + struct SessionHandle *data=conn->data; + ldapreqinfo *lr = data->state.proto.generic; + int rc, ret; + LDAPMessage *result = NULL; + LDAPMessage *ent; + BerElement *ber = NULL; + struct timeval tv = {0,1}; + (void)len; + (void)buf; + (void)sockindex; + + rc = ldap_result(li->ld, lr->msgid, LDAP_MSG_RECEIVED, &tv, &result); + if (rc < 0) { + failf(data, "LDAP local: search ldap_result %s", ldap_err2string(rc)); + *err = CURLE_RECV_ERROR; + return -1; + } + + *err = CURLE_AGAIN; + ret = -1; + + /* timed out */ + if (result == NULL) + return ret; + + for (ent = ldap_first_message(li->ld, result); ent; + ent = ldap_next_message(li->ld, ent)) { + struct berval bv, *bvals, **bvp = &bvals; + int binary = 0, msgtype; + + msgtype = ldap_msgtype(ent); + if (msgtype == LDAP_RES_SEARCH_RESULT) { + int code; + char *info = NULL; + rc = ldap_parse_result(li->ld, ent, &code, NULL, &info, NULL, NULL, 0); + if (rc) { + failf(data, "LDAP local: search ldap_parse_result %s", ldap_err2string(rc)); + *err = CURLE_LDAP_SEARCH_FAILED; + } else if (code && code != LDAP_SIZELIMIT_EXCEEDED) { + failf(data, "LDAP remote: search failed %s %s", ldap_err2string(rc), + info ? info : ""); + *err = CURLE_LDAP_SEARCH_FAILED; + } else { + /* successful */ + if (code == LDAP_SIZELIMIT_EXCEEDED) + infof(data, "There are more than %d entries\n", lr->nument); + data->req.size = data->req.bytecount; + *err = CURLE_OK; + ret = 0; + } + lr->msgid = 0; + ldap_memfree(info); + break; + } else if (msgtype != LDAP_RES_SEARCH_ENTRY) { + continue; + } + + lr->nument++; + rc = ldap_get_dn_ber(li->ld, ent, &ber, &bv); + Curl_client_write(conn, CLIENTWRITE_BODY, (char *)"DN: ", 4); + Curl_client_write(conn, CLIENTWRITE_BODY, (char *)bv.bv_val, bv.bv_len); + Curl_client_write(conn, CLIENTWRITE_BODY, (char *)"\n", 1); + data->req.bytecount += bv.bv_len + 5; + + for (rc = ldap_get_attribute_ber(li->ld, ent, ber, &bv, bvp); + rc == LDAP_SUCCESS; + rc = ldap_get_attribute_ber(li->ld, ent, ber, &bv, bvp)) { + int i; + + if (bv.bv_val == NULL) break; + + if (bv.bv_len > 7 && !strncmp(bv.bv_val + bv.bv_len - 7, ";binary", 7)) + binary = 1; + else + binary = 0; + + for (i=0; bvals[i].bv_val != NULL; i++) { + int binval = 0; + Curl_client_write(conn, CLIENTWRITE_BODY, (char *)"\t", 1); + Curl_client_write(conn, CLIENTWRITE_BODY, (char *)bv.bv_val, bv.bv_len); + Curl_client_write(conn, CLIENTWRITE_BODY, (char *)":", 1); + data->req.bytecount += bv.bv_len + 2; + + if (!binary) { + /* check for leading or trailing whitespace */ + if (ISSPACE(bvals[i].bv_val[0]) || + ISSPACE(bvals[i].bv_val[bvals[i].bv_len-1])) { + binval = 1; + } else { + /* check for unprintable characters */ + unsigned int j; + for (j=0; jreq.bytecount += 2; + if(val_b64_sz > 0) { + Curl_client_write(conn, CLIENTWRITE_BODY, val_b64, val_b64_sz); + free(val_b64); + data->req.bytecount += val_b64_sz; + } + } else { + Curl_client_write(conn, CLIENTWRITE_BODY, (char *)" ", 1); + Curl_client_write(conn, CLIENTWRITE_BODY, bvals[i].bv_val, + bvals[i].bv_len); + data->req.bytecount += bvals[i].bv_len + 1; + } + Curl_client_write(conn, CLIENTWRITE_BODY, (char *)"\n", 0); + data->req.bytecount++; + } + ber_memfree(bvals); + Curl_client_write(conn, CLIENTWRITE_BODY, (char *)"\n", 0); + data->req.bytecount++; + } + Curl_client_write(conn, CLIENTWRITE_BODY, (char *)"\n", 0); + data->req.bytecount++; + ber_free(ber, 0); + } + ldap_msgfree(result); + return ret; +} + +#ifdef USE_SSL +static int +ldapsb_tls_setup(Sockbuf_IO_Desc *sbiod, void *arg) +{ + sbiod->sbiod_pvt = arg; + return 0; +} + +static int +ldapsb_tls_remove(Sockbuf_IO_Desc *sbiod) +{ + sbiod->sbiod_pvt = NULL; + return 0; +} + +/* We don't need to do anything because libcurl does it already */ +static int +ldapsb_tls_close(Sockbuf_IO_Desc *sbiod) +{ + (void)sbiod; + return 0; +} + +static int +ldapsb_tls_ctrl(Sockbuf_IO_Desc *sbiod, int opt, void *arg) +{ + (void)arg; + if (opt == LBER_SB_OPT_DATA_READY) { + struct connectdata *conn = sbiod->sbiod_pvt; + return Curl_ssl_data_pending(conn, FIRSTSOCKET); + } + return 0; +} + +static ber_slen_t +ldapsb_tls_read(Sockbuf_IO_Desc *sbiod, void *buf, ber_len_t len) +{ + struct connectdata *conn = sbiod->sbiod_pvt; + ldapconninfo *li = conn->proto.generic; + ber_slen_t ret; + CURLcode err = CURLE_RECV_ERROR; + + ret = li->recv(conn, FIRSTSOCKET, buf, len, &err); + if (ret < 0 && err == CURLE_AGAIN) { + SET_SOCKERRNO(EWOULDBLOCK); + } + return ret; +} + +static ber_slen_t +ldapsb_tls_write(Sockbuf_IO_Desc *sbiod, void *buf, ber_len_t len) +{ + struct connectdata *conn = sbiod->sbiod_pvt; + ldapconninfo *li = conn->proto.generic; + ber_slen_t ret; + CURLcode err = CURLE_SEND_ERROR; + + ret = li->send(conn, FIRSTSOCKET, buf, len, &err); + if (ret < 0 && err == CURLE_AGAIN) { + SET_SOCKERRNO(EWOULDBLOCK); + } + return ret; +} + +static Sockbuf_IO ldapsb_tls = +{ + ldapsb_tls_setup, + ldapsb_tls_remove, + ldapsb_tls_ctrl, + ldapsb_tls_read, + ldapsb_tls_write, + ldapsb_tls_close +}; +#endif /* USE_SSL */ + +#endif /* !CURL_DISABLE_LDAP && USE_OPENLDAP */ diff --git a/mobicore/common/curl/lib/parsedate.c b/mobicore/common/curl/lib/parsedate.c new file mode 100644 index 0000000000000000000000000000000000000000..3e003db31d6983e4ba538972cf96e19d2d8914c6 --- /dev/null +++ b/mobicore/common/curl/lib/parsedate.c @@ -0,0 +1,516 @@ +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) 1998 - 2010, Daniel Stenberg, , et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at http://curl.haxx.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ***************************************************************************/ +/* + A brief summary of the date string formats this parser groks: + + RFC 2616 3.3.1 + + Sun, 06 Nov 1994 08:49:37 GMT ; RFC 822, updated by RFC 1123 + Sunday, 06-Nov-94 08:49:37 GMT ; RFC 850, obsoleted by RFC 1036 + Sun Nov 6 08:49:37 1994 ; ANSI C's asctime() format + + we support dates without week day name: + + 06 Nov 1994 08:49:37 GMT + 06-Nov-94 08:49:37 GMT + Nov 6 08:49:37 1994 + + without the time zone: + + 06 Nov 1994 08:49:37 + 06-Nov-94 08:49:37 + + weird order: + + 1994 Nov 6 08:49:37 (GNU date fails) + GMT 08:49:37 06-Nov-94 Sunday + 94 6 Nov 08:49:37 (GNU date fails) + + time left out: + + 1994 Nov 6 + 06-Nov-94 + Sun Nov 6 94 + + unusual separators: + + 1994.Nov.6 + Sun/Nov/6/94/GMT + + commonly used time zone names: + + Sun, 06 Nov 1994 08:49:37 CET + 06 Nov 1994 08:49:37 EST + + time zones specified using RFC822 style: + + Sun, 12 Sep 2004 15:05:58 -0700 + Sat, 11 Sep 2004 21:32:11 +0200 + + compact numerical date strings: + + 20040912 15:05:58 -0700 + 20040911 +0200 + +*/ +#include "setup.h" +#include +#include +#include + +#ifdef HAVE_STDLIB_H +#include /* for strtol() */ +#endif + +#include +#include "rawstr.h" +#include "warnless.h" +#include "parsedate.h" + +const char * const Curl_wkday[] = +{"Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"}; +static const char * const weekday[] = +{ "Monday", "Tuesday", "Wednesday", "Thursday", + "Friday", "Saturday", "Sunday" }; +const char * const Curl_month[]= +{ "Jan", "Feb", "Mar", "Apr", "May", "Jun", + "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" }; + +struct tzinfo { + char name[5]; + int offset; /* +/- in minutes */ +}; + +/* Here's a bunch of frequently used time zone names. These were supported + by the old getdate parser. */ +#define tDAYZONE -60 /* offset for daylight savings time */ +static const struct tzinfo tz[]= { + {"GMT", 0}, /* Greenwich Mean */ + {"UTC", 0}, /* Universal (Coordinated) */ + {"WET", 0}, /* Western European */ + {"BST", 0 tDAYZONE}, /* British Summer */ + {"WAT", 60}, /* West Africa */ + {"AST", 240}, /* Atlantic Standard */ + {"ADT", 240 tDAYZONE}, /* Atlantic Daylight */ + {"EST", 300}, /* Eastern Standard */ + {"EDT", 300 tDAYZONE}, /* Eastern Daylight */ + {"CST", 360}, /* Central Standard */ + {"CDT", 360 tDAYZONE}, /* Central Daylight */ + {"MST", 420}, /* Mountain Standard */ + {"MDT", 420 tDAYZONE}, /* Mountain Daylight */ + {"PST", 480}, /* Pacific Standard */ + {"PDT", 480 tDAYZONE}, /* Pacific Daylight */ + {"YST", 540}, /* Yukon Standard */ + {"YDT", 540 tDAYZONE}, /* Yukon Daylight */ + {"HST", 600}, /* Hawaii Standard */ + {"HDT", 600 tDAYZONE}, /* Hawaii Daylight */ + {"CAT", 600}, /* Central Alaska */ + {"AHST", 600}, /* Alaska-Hawaii Standard */ + {"NT", 660}, /* Nome */ + {"IDLW", 720}, /* International Date Line West */ + {"CET", -60}, /* Central European */ + {"MET", -60}, /* Middle European */ + {"MEWT", -60}, /* Middle European Winter */ + {"MEST", -60 tDAYZONE}, /* Middle European Summer */ + {"CEST", -60 tDAYZONE}, /* Central European Summer */ + {"MESZ", -60 tDAYZONE}, /* Middle European Summer */ + {"FWT", -60}, /* French Winter */ + {"FST", -60 tDAYZONE}, /* French Summer */ + {"EET", -120}, /* Eastern Europe, USSR Zone 1 */ + {"WAST", -420}, /* West Australian Standard */ + {"WADT", -420 tDAYZONE}, /* West Australian Daylight */ + {"CCT", -480}, /* China Coast, USSR Zone 7 */ + {"JST", -540}, /* Japan Standard, USSR Zone 8 */ + {"EAST", -600}, /* Eastern Australian Standard */ + {"EADT", -600 tDAYZONE}, /* Eastern Australian Daylight */ + {"GST", -600}, /* Guam Standard, USSR Zone 9 */ + {"NZT", -720}, /* New Zealand */ + {"NZST", -720}, /* New Zealand Standard */ + {"NZDT", -720 tDAYZONE}, /* New Zealand Daylight */ + {"IDLE", -720}, /* International Date Line East */ + /* Next up: Military timezone names. RFC822 allowed these, but (as noted in + RFC 1123) had their signs wrong. Here we use the correct signs to match + actual military usage. + */ + {"A", +1 * 60}, /* Alpha */ + {"B", +2 * 60}, /* Bravo */ + {"C", +3 * 60}, /* Charlie */ + {"D", +4 * 60}, /* Delta */ + {"E", +5 * 60}, /* Echo */ + {"F", +6 * 60}, /* Foxtrot */ + {"G", +7 * 60}, /* Golf */ + {"H", +8 * 60}, /* Hotel */ + {"I", +9 * 60}, /* India */ + /* "J", Juliet is not used as a timezone, to indicate the observer's local time */ + {"K", +10 * 60}, /* Kilo */ + {"L", +11 * 60}, /* Lima */ + {"M", +12 * 60}, /* Mike */ + {"N", -1 * 60}, /* November */ + {"O", -2 * 60}, /* Oscar */ + {"P", -3 * 60}, /* Papa */ + {"Q", -4 * 60}, /* Quebec */ + {"R", -5 * 60}, /* Romeo */ + {"S", -6 * 60}, /* Sierra */ + {"T", -7 * 60}, /* Tango */ + {"U", -8 * 60}, /* Uniform */ + {"V", -9 * 60}, /* Victor */ + {"W", -10 * 60}, /* Whiskey */ + {"X", -11 * 60}, /* X-ray */ + {"Y", -12 * 60}, /* Yankee */ + {"Z", 0}, /* Zulu, zero meridian, a.k.a. UTC */ +}; + +/* returns: + -1 no day + 0 monday - 6 sunday +*/ + +static int checkday(const char *check, size_t len) +{ + int i; + const char * const *what; + bool found= FALSE; + if(len > 3) + what = &weekday[0]; + else + what = &Curl_wkday[0]; + for(i=0; i<7; i++) { + if(Curl_raw_equal(check, what[0])) { + found=TRUE; + break; + } + what++; + } + return found?i:-1; +} + +static int checkmonth(const char *check) +{ + int i; + const char * const *what; + bool found= FALSE; + + what = &Curl_month[0]; + for(i=0; i<12; i++) { + if(Curl_raw_equal(check, what[0])) { + found=TRUE; + break; + } + what++; + } + return found?i:-1; /* return the offset or -1, no real offset is -1 */ +} + +/* return the time zone offset between GMT and the input one, in number + of seconds or -1 if the timezone wasn't found/legal */ + +static int checktz(const char *check) +{ + unsigned int i; + const struct tzinfo *what; + bool found= FALSE; + + what = tz; + for(i=0; i< sizeof(tz)/sizeof(tz[0]); i++) { + if(Curl_raw_equal(check, what->name)) { + found=TRUE; + break; + } + what++; + } + return found?what->offset*60:-1; +} + +static void skip(const char **date) +{ + /* skip everything that aren't letters or digits */ + while(**date && !ISALNUM(**date)) + (*date)++; +} + +enum assume { + DATE_MDAY, + DATE_YEAR, + DATE_TIME +}; + +/* this is a clone of 'struct tm' but with all fields we don't need or use + cut out */ +struct my_tm { + int tm_sec; + int tm_min; + int tm_hour; + int tm_mday; + int tm_mon; + int tm_year; +}; + +/* struct tm to time since epoch in GMT time zone. + * This is similar to the standard mktime function but for GMT only, and + * doesn't suffer from the various bugs and portability problems that + * some systems' implementations have. + */ +static time_t my_timegm(struct my_tm *tm) +{ + static const int month_days_cumulative [12] = + { 0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334 }; + int month, year, leap_days; + + if(tm->tm_year < 70) + /* we don't support years before 1970 as they will cause this function + to return a negative value */ + return -1; + + year = tm->tm_year + 1900; + month = tm->tm_mon; + if (month < 0) { + year += (11 - month) / 12; + month = 11 - (11 - month) % 12; + } + else if (month >= 12) { + year -= month / 12; + month = month % 12; + } + + leap_days = year - (tm->tm_mon <= 1); + leap_days = ((leap_days / 4) - (leap_days / 100) + (leap_days / 400) + - (1969 / 4) + (1969 / 100) - (1969 / 400)); + + return ((((time_t) (year - 1970) * 365 + + leap_days + month_days_cumulative [month] + tm->tm_mday - 1) * 24 + + tm->tm_hour) * 60 + tm->tm_min) * 60 + tm->tm_sec; +} + +/* + * Curl_parsedate() + * + * Returns: + * + * PARSEDATE_OK - a fine conversion + * PARSEDATE_FAIL - failed to convert + * PARSEDATE_LATER - time overflow at the far end of time_t + * PARSEDATE_SOONER - time underflow at the low end of time_t + */ + +int Curl_parsedate(const char *date, time_t *output) +{ + time_t t = 0; + int wdaynum=-1; /* day of the week number, 0-6 (mon-sun) */ + int monnum=-1; /* month of the year number, 0-11 */ + int mdaynum=-1; /* day of month, 1 - 31 */ + int hournum=-1; + int minnum=-1; + int secnum=-1; + int yearnum=-1; + int tzoff=-1; + struct my_tm tm; + enum assume dignext = DATE_MDAY; + const char *indate = date; /* save the original pointer */ + int part = 0; /* max 6 parts */ + + while(*date && (part < 6)) { + bool found=FALSE; + + skip(&date); + + if(ISALPHA(*date)) { + /* a name coming up */ + char buf[32]=""; + size_t len; + sscanf(date, "%31[ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz]", + buf); + len = strlen(buf); + + if(wdaynum == -1) { + wdaynum = checkday(buf, len); + if(wdaynum != -1) + found = TRUE; + } + if(!found && (monnum == -1)) { + monnum = checkmonth(buf); + if(monnum != -1) + found = TRUE; + } + + if(!found && (tzoff == -1)) { + /* this just must be a time zone string */ + tzoff = checktz(buf); + if(tzoff != -1) + found = TRUE; + } + + if(!found) + return PARSEDATE_FAIL; /* bad string */ + + date += len; + } + else if(ISDIGIT(*date)) { + /* a digit */ + int val; + char *end; + if((secnum == -1) && + (3 == sscanf(date, "%02d:%02d:%02d", &hournum, &minnum, &secnum))) { + /* time stamp! */ + date += 8; + } + else if((secnum == -1) && + (2 == sscanf(date, "%02d:%02d", &hournum, &minnum))) { + /* time stamp without seconds */ + date += 5; + secnum = 0; + } + else { + val = curlx_sltosi(strtol(date, &end, 10)); + + if((tzoff == -1) && + ((end - date) == 4) && + (val <= 1400) && + (indate< date) && + ((date[-1] == '+' || date[-1] == '-'))) { + /* four digits and a value less than or equal to 1400 (to take into + account all sorts of funny time zone diffs) and it is preceeded + with a plus or minus. This is a time zone indication. 1400 is + picked since +1300 is frequently used and +1400 is mentioned as + an edge number in the document "ISO C 200X Proposal: Timezone + Functions" at http://david.tribble.com/text/c0xtimezone.html If + anyone has a more authoritative source for the exact maximum time + zone offsets, please speak up! */ + found = TRUE; + tzoff = (val/100 * 60 + val%100)*60; + + /* the + and - prefix indicates the local time compared to GMT, + this we need ther reversed math to get what we want */ + tzoff = date[-1]=='+'?-tzoff:tzoff; + } + + if(((end - date) == 8) && + (yearnum == -1) && + (monnum == -1) && + (mdaynum == -1)) { + /* 8 digits, no year, month or day yet. This is YYYYMMDD */ + found = TRUE; + yearnum = val/10000; + monnum = (val%10000)/100-1; /* month is 0 - 11 */ + mdaynum = val%100; + } + + if(!found && (dignext == DATE_MDAY) && (mdaynum == -1)) { + if((val > 0) && (val<32)) { + mdaynum = val; + found = TRUE; + } + dignext = DATE_YEAR; + } + + if(!found && (dignext == DATE_YEAR) && (yearnum == -1)) { + yearnum = val; + found = TRUE; + if(yearnum < 1900) { + if(yearnum > 70) + yearnum += 1900; + else + yearnum += 2000; + } + if(mdaynum == -1) + dignext = DATE_MDAY; + } + + if(!found) + return PARSEDATE_FAIL; + + date = end; + } + } + + part++; + } + + if(-1 == secnum) + secnum = minnum = hournum = 0; /* no time, make it zero */ + + if((-1 == mdaynum) || + (-1 == monnum) || + (-1 == yearnum)) + /* lacks vital info, fail */ + return PARSEDATE_FAIL; + +#if SIZEOF_TIME_T < 5 + /* 32 bit time_t can only hold dates to the beginning of 2038 */ + if(yearnum > 2037) { + *output = 0x7fffffff; + return PARSEDATE_LATER; + } +#endif + + if(yearnum < 1970) { + *output = 0; + return PARSEDATE_SOONER; + } + + tm.tm_sec = secnum; + tm.tm_min = minnum; + tm.tm_hour = hournum; + tm.tm_mday = mdaynum; + tm.tm_mon = monnum; + tm.tm_year = yearnum - 1900; + + /* my_timegm() returns a time_t. time_t is often 32 bits, even on many + architectures that feature 64 bit 'long'. + + Some systems have 64 bit time_t and deal with years beyond 2038. However, + even on some of the systems with 64 bit time_t mktime() returns -1 for + dates beyond 03:14:07 UTC, January 19, 2038. (Such as AIX 5100-06) + */ + t = my_timegm(&tm); + + /* time zone adjust (cast t to int to compare to negative one) */ + if(-1 != (int)t) { + + /* Add the time zone diff between local time zone and GMT. */ + long delta = (long)(tzoff!=-1?tzoff:0); + + if((delta>0) && (t + delta < t)) + return -1; /* time_t overflow */ + + t += delta; + } + + *output = t; + + return PARSEDATE_OK; +} + +time_t curl_getdate(const char *p, const time_t *now) +{ + time_t parsed; + int rc = Curl_parsedate(p, &parsed); + (void)now; /* legacy argument from the past that we ignore */ + + switch(rc) { + case PARSEDATE_OK: + case PARSEDATE_LATER: + case PARSEDATE_SOONER: + return parsed; + } + /* everything else is fail */ + return -1; +} diff --git a/mobicore/common/curl/lib/parsedate.h b/mobicore/common/curl/lib/parsedate.h new file mode 100644 index 0000000000000000000000000000000000000000..e1bf5441f6d2de5bb8e41accea45dd2307b7104f --- /dev/null +++ b/mobicore/common/curl/lib/parsedate.h @@ -0,0 +1,46 @@ +#ifndef __CURL_PARSEDATE_H +#define __CURL_PARSEDATE_H +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) 1998 - 2009, Daniel Stenberg, , et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at http://curl.haxx.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ***************************************************************************/ + +extern const char * const Curl_wkday[7]; +extern const char * const Curl_month[12]; + +/* + * Curl_parsedate() + * + * Returns: + * + * PARSEDATE_OK - a fine conversion + * PARSEDATE_FAIL - failed to convert + * PARSEDATE_LATER - time overflow at the far end of time_t + * PARSEDATE_SOONER - time underflow at the low end of time_t + */ + +int Curl_parsedate(const char *date, time_t *output); + +#define PARSEDATE_OK 0 +#define PARSEDATE_FAIL -1 +#define PARSEDATE_LATER 1 +#define PARSEDATE_SOONER 2 + +#endif diff --git a/mobicore/common/curl/lib/pingpong.c b/mobicore/common/curl/lib/pingpong.c new file mode 100644 index 0000000000000000000000000000000000000000..81f804f8e8b23161ecc70c497c4e50658c1053c9 --- /dev/null +++ b/mobicore/common/curl/lib/pingpong.c @@ -0,0 +1,540 @@ +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) 1998 - 2010, Daniel Stenberg, , et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at http://curl.haxx.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + * 'pingpong' is for generic back-and-forth support functions used by FTP, + * IMAP, POP3, SMTP and whatever more that likes them. + * + ***************************************************************************/ + +#include "setup.h" + +#include "urldata.h" +#include "sendf.h" +#include "select.h" +#include "progress.h" +#include "speedcheck.h" +#include "pingpong.h" +#include "multiif.h" + +#define _MPRINTF_REPLACE /* use our functions only */ +#include + +#include "curl_memory.h" +/* The last #include file should be: */ +#include "memdebug.h" + +#ifdef USE_PINGPONG + +/* Returns timeout in ms. 0 or negative number means the timeout has already + triggered */ +long Curl_pp_state_timeout(struct pingpong *pp) +{ + struct connectdata *conn = pp->conn; + struct SessionHandle *data=conn->data; + long timeout_ms; /* in milliseconds */ + long timeout2_ms; /* in milliseconds */ + long response_time= (data->set.server_response_timeout)? + data->set.server_response_timeout: pp->response_time; + + /* if CURLOPT_SERVER_RESPONSE_TIMEOUT is set, use that to determine + remaining time, or use pp->response because SERVER_RESPONSE_TIMEOUT is + supposed to govern the response for any given server response, not for + the time from connect to the given server response. */ + + /* Without a requested timeout, we only wait 'response_time' seconds for the + full response to arrive before we bail out */ + timeout_ms = response_time - + Curl_tvdiff(Curl_tvnow(), pp->response); /* spent time */ + + if(data->set.timeout) { + /* if timeout is requested, find out how much remaining time we have */ + timeout2_ms = data->set.timeout - /* timeout time */ + Curl_tvdiff(Curl_tvnow(), conn->now); /* spent time */ + + /* pick the lowest number */ + timeout_ms = CURLMIN(timeout_ms, timeout2_ms); + } + + return timeout_ms; +} + + +/* + * Curl_pp_multi_statemach() + * + * called repeatedly until done when the multi interface is used. + */ +CURLcode Curl_pp_multi_statemach(struct pingpong *pp) +{ + struct connectdata *conn = pp->conn; + curl_socket_t sock = conn->sock[FIRSTSOCKET]; + int rc; + struct SessionHandle *data=conn->data; + CURLcode result = CURLE_OK; + long timeout_ms = Curl_pp_state_timeout(pp); + + if(timeout_ms <= 0) { + failf(data, "server response timeout"); + return CURLE_OPERATION_TIMEDOUT; + } + + rc = Curl_socket_ready(pp->sendleft?CURL_SOCKET_BAD:sock, /* reading */ + pp->sendleft?sock:CURL_SOCKET_BAD, /* writing */ + 0); + + if(rc == -1) { + failf(data, "select/poll error"); + return CURLE_OUT_OF_MEMORY; + } + else if(rc != 0) + result = pp->statemach_act(conn); + + /* if rc == 0, then select() timed out */ + + return result; +} + +/* + * Curl_pp_easy_statemach() + * + * called repeatedly until done when the easy interface is used. + */ +CURLcode Curl_pp_easy_statemach(struct pingpong *pp) +{ + struct connectdata *conn = pp->conn; + curl_socket_t sock = conn->sock[FIRSTSOCKET]; + int rc; + long interval_ms; + long timeout_ms = Curl_pp_state_timeout(pp); + struct SessionHandle *data=conn->data; + CURLcode result; + + if(timeout_ms <=0 ) { + failf(data, "server response timeout"); + return CURLE_OPERATION_TIMEDOUT; /* already too little time */ + } + + interval_ms = 1000; /* use 1 second timeout intervals */ + if(timeout_ms < interval_ms) + interval_ms = timeout_ms; + + rc = Curl_socket_ready(pp->sendleft?CURL_SOCKET_BAD:sock, /* reading */ + pp->sendleft?sock:CURL_SOCKET_BAD, /* writing */ + (int)interval_ms); + + if(Curl_pgrsUpdate(conn)) + result = CURLE_ABORTED_BY_CALLBACK; + else + result = Curl_speedcheck(data, Curl_tvnow()); + + if(result) + ; + else if(rc == -1) { + failf(data, "select/poll error"); + result = CURLE_OUT_OF_MEMORY; + } + else if(rc) + result = pp->statemach_act(conn); + + return result; +} + +/* initialize stuff to prepare for reading a fresh new response */ +void Curl_pp_init(struct pingpong *pp) +{ + struct connectdata *conn = pp->conn; + pp->nread_resp = 0; + pp->linestart_resp = conn->data->state.buffer; + pp->pending_resp = TRUE; + pp->response = Curl_tvnow(); /* start response time-out now! */ +} + + + +/*********************************************************************** + * + * Curl_pp_sendfv() + * + * Send the formated string as a command to a pingpong server. Note that + * the string should not have any CRLF appended, as this function will + * append the necessary things itself. + * + * NOTE: we build the command in a fixed-length buffer, which sets length + * restrictions on the command! + * + * made to never block + */ +CURLcode Curl_pp_vsendf(struct pingpong *pp, + const char *fmt, + va_list args) +{ + ssize_t bytes_written; +/* may still not be big enough for some krb5 tokens */ +#define SBUF_SIZE 1024 + char s[SBUF_SIZE]; + size_t write_len; + char *sptr=s; + CURLcode res = CURLE_OK; + struct connectdata *conn = pp->conn; + struct SessionHandle *data = conn->data; + +#if defined(HAVE_KRB4) || defined(HAVE_GSSAPI) + enum protection_level data_sec = conn->data_prot; +#endif + + vsnprintf(s, SBUF_SIZE-3, fmt, args); + + strcat(s, "\r\n"); /* append a trailing CRLF */ + + bytes_written=0; + write_len = strlen(s); + + Curl_pp_init(pp); + +#ifdef CURL_DOES_CONVERSIONS + res = Curl_convert_to_network(data, s, write_len); + /* Curl_convert_to_network calls failf if unsuccessful */ + if(res != CURLE_OK) { + return res; + } +#endif /* CURL_DOES_CONVERSIONS */ + +#if defined(HAVE_KRB4) || defined(HAVE_GSSAPI) + conn->data_prot = PROT_CMD; +#endif + res = Curl_write(conn, conn->sock[FIRSTSOCKET], sptr, write_len, + &bytes_written); +#if defined(HAVE_KRB4) || defined(HAVE_GSSAPI) + DEBUGASSERT(data_sec > PROT_NONE && data_sec < PROT_LAST); + conn->data_prot = data_sec; +#endif + + if(CURLE_OK != res) + return res; + + if(conn->data->set.verbose) + Curl_debug(conn->data, CURLINFO_HEADER_OUT, + sptr, (size_t)bytes_written, conn); + + if(bytes_written != (ssize_t)write_len) { + /* the whole chunk was not sent, store the rest of the data */ + write_len -= bytes_written; + sptr += bytes_written; + pp->sendthis = malloc(write_len); + if(pp->sendthis) { + memcpy(pp->sendthis, sptr, write_len); + pp->sendsize = pp->sendleft = write_len; + } + else { + failf(data, "out of memory"); + res = CURLE_OUT_OF_MEMORY; + } + } + else + pp->response = Curl_tvnow(); + + return res; +} + + +/*********************************************************************** + * + * Curl_pp_sendf() + * + * Send the formated string as a command to a pingpong server. Note that + * the string should not have any CRLF appended, as this function will + * append the necessary things itself. + * + * NOTE: we build the command in a fixed-length buffer, which sets length + * restrictions on the command! + * + * made to never block + */ +CURLcode Curl_pp_sendf(struct pingpong *pp, + const char *fmt, ...) +{ + CURLcode res; + va_list ap; + va_start(ap, fmt); + + res = Curl_pp_vsendf(pp, fmt, ap); + + va_end(ap); + + return res; +} + +/* + * Curl_pp_readresp() + * + * Reads a piece of a server response. + */ +CURLcode Curl_pp_readresp(curl_socket_t sockfd, + struct pingpong *pp, + int *code, /* return the server code if done */ + size_t *size) /* size of the response */ +{ + ssize_t perline; /* count bytes per line */ + bool keepon=TRUE; + ssize_t gotbytes; + char *ptr; + struct connectdata *conn = pp->conn; + struct SessionHandle *data = conn->data; + char * const buf = data->state.buffer; + CURLcode result = CURLE_OK; + + *code = 0; /* 0 for errors or not done */ + *size = 0; + + ptr=buf + pp->nread_resp; + + /* number of bytes in the current line, so far */ + perline = (ssize_t)(ptr-pp->linestart_resp); + + keepon=TRUE; + + while((pp->nread_respcache) { + /* we had data in the "cache", copy that instead of doing an actual + * read + * + * ftp->cache_size is cast to int here. This should be safe, + * because it would have been populated with something of size + * int to begin with, even though its datatype may be larger + * than an int. + */ + DEBUGASSERT((ptr+pp->cache_size) <= (buf+BUFSIZE+1)); + memcpy(ptr, pp->cache, pp->cache_size); + gotbytes = (ssize_t)pp->cache_size; + free(pp->cache); /* free the cache */ + pp->cache = NULL; /* clear the pointer */ + pp->cache_size = 0; /* zero the size just in case */ + } + else { + int res; +#if defined(HAVE_KRB4) || defined(HAVE_GSSAPI) + enum protection_level prot = conn->data_prot; + conn->data_prot = PROT_CLEAR; +#endif + DEBUGASSERT((ptr+BUFSIZE-pp->nread_resp) <= (buf+BUFSIZE+1)); + res = Curl_read(conn, sockfd, ptr, BUFSIZE-pp->nread_resp, + &gotbytes); +#if defined(HAVE_KRB4) || defined(HAVE_GSSAPI) + DEBUGASSERT(prot > PROT_NONE && prot < PROT_LAST); + conn->data_prot = prot; +#endif + if(res == CURLE_AGAIN) + return CURLE_OK; /* return */ + +#ifdef CURL_DOES_CONVERSIONS + if((res == CURLE_OK) && (gotbytes > 0)) { + /* convert from the network encoding */ + res = Curl_convert_from_network(data, ptr, gotbytes); + /* Curl_convert_from_network calls failf if unsuccessful */ + } +#endif /* CURL_DOES_CONVERSIONS */ + + if(CURLE_OK != res) { + result = (CURLcode)res; /* Set outer result variable to this error. */ + keepon = FALSE; + } + } + + if(!keepon) + ; + else if(gotbytes <= 0) { + keepon = FALSE; + result = CURLE_RECV_ERROR; + failf(data, "response reading failed"); + } + else { + /* we got a whole chunk of data, which can be anything from one + * byte to a set of lines and possible just a piece of the last + * line */ + ssize_t i; + ssize_t clipamount = 0; + bool restart = FALSE; + + data->req.headerbytecount += (long)gotbytes; + + pp->nread_resp += gotbytes; + for(i = 0; i < gotbytes; ptr++, i++) { + perline++; + if(*ptr=='\n') { + /* a newline is CRLF in ftp-talk, so the CR is ignored as + the line isn't really terminated until the LF comes */ + + /* output debug output if that is requested */ +#if defined(HAVE_KRB4) || defined(HAVE_GSSAPI) + if(!conn->sec_complete) +#endif + if(data->set.verbose) + Curl_debug(data, CURLINFO_HEADER_IN, + pp->linestart_resp, (size_t)perline, conn); + + /* + * We pass all response-lines to the callback function registered + * for "headers". The response lines can be seen as a kind of + * headers. + */ + result = Curl_client_write(conn, CLIENTWRITE_HEADER, + pp->linestart_resp, perline); + if(result) + return result; + + if(pp->endofresp(pp, code)) { + /* This is the end of the last line, copy the last line to the + start of the buffer and zero terminate, for old times sake (and + krb4)! */ + char *meow; + int n; + for(meow=pp->linestart_resp, n=0; meowlinestart_resp = ptr+1; /* advance pointer */ + i++; /* skip this before getting out */ + + *size = pp->nread_resp; /* size of the response */ + pp->nread_resp = 0; /* restart */ + break; + } + perline=0; /* line starts over here */ + pp->linestart_resp = ptr+1; + } + } + + if(!keepon && (i != gotbytes)) { + /* We found the end of the response lines, but we didn't parse the + full chunk of data we have read from the server. We therefore need + to store the rest of the data to be checked on the next invoke as + it may actually contain another end of response already! */ + clipamount = gotbytes - i; + restart = TRUE; + } + else if(keepon) { + + if((perline == gotbytes) && (gotbytes > BUFSIZE/2)) { + /* We got an excessive line without newlines and we need to deal + with it. We keep the first bytes of the line then we throw + away the rest. */ + infof(data, "Excessive server response line length received, %zd bytes." + " Stripping\n", gotbytes); + restart = TRUE; + + /* we keep 40 bytes since all our pingpong protocols are only + interested in the first piece */ + clipamount = 40; + } + else if(pp->nread_resp > BUFSIZE/2) { + /* We got a large chunk of data and there's potentially still trailing + data to take care of, so we put any such part in the "cache", clear + the buffer to make space and restart. */ + clipamount = perline; + restart = TRUE; + } + } + else if(i == gotbytes) + restart = TRUE; + + if(clipamount) { + pp->cache_size = clipamount; + pp->cache = malloc(pp->cache_size); + if(pp->cache) + memcpy(pp->cache, pp->linestart_resp, pp->cache_size); + else + return CURLE_OUT_OF_MEMORY; + } + if(restart) { + /* now reset a few variables to start over nicely from the start of + the big buffer */ + pp->nread_resp = 0; /* start over from scratch in the buffer */ + ptr = pp->linestart_resp = buf; + perline = 0; + } + + } /* there was data */ + + } /* while there's buffer left and loop is requested */ + + pp->pending_resp = FALSE; + + return result; +} + +int Curl_pp_getsock(struct pingpong *pp, + curl_socket_t *socks, + int numsocks) +{ + struct connectdata *conn = pp->conn; + + if(!numsocks) + return GETSOCK_BLANK; + + socks[0] = conn->sock[FIRSTSOCKET]; + + if(pp->sendleft) { + /* write mode */ + return GETSOCK_WRITESOCK(0); + } + + /* read mode */ + return GETSOCK_READSOCK(0); +} + +CURLcode Curl_pp_flushsend(struct pingpong *pp) +{ + /* we have a piece of a command still left to send */ + struct connectdata *conn = pp->conn; + ssize_t written; + CURLcode result = CURLE_OK; + curl_socket_t sock = conn->sock[FIRSTSOCKET]; + + result = Curl_write(conn, sock, pp->sendthis + pp->sendsize - + pp->sendleft, pp->sendleft, &written); + if(result) + return result; + + if(written != (ssize_t)pp->sendleft) { + /* only a fraction was sent */ + pp->sendleft -= written; + } + else { + free(pp->sendthis); + pp->sendthis=NULL; + pp->sendleft = pp->sendsize = 0; + pp->response = Curl_tvnow(); + } + return CURLE_OK; +} + +CURLcode Curl_pp_disconnect(struct pingpong *pp) +{ + if(pp->cache) { + free(pp->cache); + pp->cache = NULL; + } + return CURLE_OK; +} + + + +#endif diff --git a/mobicore/common/curl/lib/pingpong.h b/mobicore/common/curl/lib/pingpong.h new file mode 100644 index 0000000000000000000000000000000000000000..cbbff8f3ee8120fe04315787e7f8eda109b8095a --- /dev/null +++ b/mobicore/common/curl/lib/pingpong.h @@ -0,0 +1,147 @@ +#ifndef __PINGPONG_H +#define __PINGPONG_H +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) 1998 - 2010, Daniel Stenberg, , et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at http://curl.haxx.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ***************************************************************************/ + +#include + +#include "setup.h" + +#if !defined(CURL_DISABLE_IMAP) || !defined(CURL_DISABLE_FTP) || \ + !defined(CURL_DISABLE_POP3) || !defined(CURL_DISABLE_SMTP) +#define USE_PINGPONG +#endif + +/* forward-declaration, this is defined in urldata.h */ +struct connectdata; + +/* + * 'pingpong' is the generic struct used for protocols doing server<->client + * conversations in a back-and-forth style such as FTP, IMAP, POP3, SMTP etc. + * + * It holds response cache and non-blocking sending data. + */ +struct pingpong { + char *cache; /* data cache between getresponse()-calls */ + size_t cache_size; /* size of cache in bytes */ + size_t nread_resp; /* number of bytes currently read of a server response */ + char *linestart_resp; /* line start pointer for the server response + reader function */ + bool pending_resp; /* set TRUE when a server response is pending or in + progress, and is cleared once the last response is + read */ + char *sendthis; /* allocated pointer to a buffer that is to be sent to the + server */ + size_t sendleft; /* number of bytes left to send from the sendthis buffer */ + size_t sendsize; /* total size of the sendthis buffer */ + struct timeval response; /* set to Curl_tvnow() when a command has been sent + off, used to time-out response reading */ + long response_time; /* When no timeout is given, this is the amount of + milliseconds we await for a server response. */ + + struct connectdata *conn; /* points to the connectdata struct that this + belongs to */ + + /* Function pointers the protocols MUST implement and provide for the + pingpong layer to function */ + + CURLcode (*statemach_act)(struct connectdata *conn); + + int (*endofresp)(struct pingpong *pp, int *code); +}; + +/* + * Curl_pp_multi_statemach() + * + * called repeatedly until done when the multi interface is used. + */ +CURLcode Curl_pp_multi_statemach(struct pingpong *pp); + +/* + * Curl_pp_easy_statemach() + * + * called repeatedly until done when the easy interface is used. + */ +CURLcode Curl_pp_easy_statemach(struct pingpong *pp); + + +/* initialize stuff to prepare for reading a fresh new response */ +void Curl_pp_init(struct pingpong *pp); + +/* Returns timeout in ms. 0 or negative number means the timeout has already + triggered */ +long Curl_pp_state_timeout(struct pingpong *pp); + + +/*********************************************************************** + * + * Curl_pp_sendf() + * + * Send the formated string as a command to a pingpong server. Note that + * the string should not have any CRLF appended, as this function will + * append the necessary things itself. + * + * NOTE: we build the command in a fixed-length buffer, which sets length + * restrictions on the command! + * + * made to never block + */ +CURLcode Curl_pp_sendf(struct pingpong *pp, + const char *fmt, ...); + +/*********************************************************************** + * + * Curl_pp_vsendf() + * + * Send the formated string as a command to a pingpong server. Note that + * the string should not have any CRLF appended, as this function will + * append the necessary things itself. + * + * NOTE: we build the command in a fixed-length buffer, which sets length + * restrictions on the command! + * + * made to never block + */ +CURLcode Curl_pp_vsendf(struct pingpong *pp, + const char *fmt, + va_list args); + +/* + * Curl_pp_readresp() + * + * Reads a piece of a server response. + */ +CURLcode Curl_pp_readresp(curl_socket_t sockfd, + struct pingpong *pp, + int *code, /* return the server code if done */ + size_t *size); /* size of the response */ + + +CURLcode Curl_pp_flushsend(struct pingpong *pp); + +/* call this when a pingpong connection is disconnected */ +CURLcode Curl_pp_disconnect(struct pingpong *pp); + +int Curl_pp_getsock(struct pingpong *pp, curl_socket_t *socks, + int numsocks); + +#endif /* __PINGPONG_H */ diff --git a/mobicore/common/curl/lib/polarssl.c b/mobicore/common/curl/lib/polarssl.c new file mode 100644 index 0000000000000000000000000000000000000000..bed76354a48a08afe88084442a033199766ff3c0 --- /dev/null +++ b/mobicore/common/curl/lib/polarssl.c @@ -0,0 +1,375 @@ +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) 2010, Hoi-Ho Chan, + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at http://curl.haxx.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ***************************************************************************/ + +/* + * Source file for all PolarSSL-specific code for the TLS/SSL layer. No code + * but sslgen.c should ever call or use these functions. + * + */ + +#include "setup.h" +#ifdef USE_POLARSSL + +#include +#include +#include +#ifdef HAVE_SYS_SOCKET_H +#include +#endif + +#include +#include +#include +#include +#include + +#include "urldata.h" +#include "sendf.h" +#include "inet_pton.h" +#include "polarssl.h" +#include "sslgen.h" +#include "parsedate.h" +#include "connect.h" /* for the connect timeout */ +#include "select.h" +#include "rawstr.h" + +#define _MPRINTF_REPLACE /* use our functions only */ +#include +#include "curl_memory.h" +/* The last #include file should be: */ +#include "memdebug.h" + +/* Define this to enable lots of debugging for PolarSSL */ +#undef POLARSSL_DEBUG + +#ifdef POLARSSL_DEBUG +static void polarssl_debug(void *context, int level, char *line) +{ + struct SessionHandle *data = NULL; + + if(!context) + return; + + data = (struct SessionHandle *)context; + + infof(data, "%s", line); +} +#else +#endif + +static Curl_recv polarssl_recv; +static Curl_send polarssl_send; + +/* + * This function loads all the client/CA certificates and CRLs. Setup the TLS + * layer and do all necessary magic. + */ +CURLcode +Curl_polarssl_connect(struct connectdata *conn, + int sockindex) +{ + struct SessionHandle *data = conn->data; + bool sni = TRUE; /* default is SNI enabled */ + int ret = -1; +#ifdef ENABLE_IPV6 + struct in6_addr addr; +#else + struct in_addr addr; +#endif + void *old_session = NULL; + size_t old_session_size = 0; + char buffer[1024]; + + if(conn->ssl[sockindex].state == ssl_connection_complete) + return CURLE_OK; + + /* PolarSSL only supports SSLv3 and TLSv1 */ + if(data->set.ssl.version == CURL_SSLVERSION_SSLv2) { + failf(data, "PolarSSL does not support SSLv2"); + return CURLE_SSL_CONNECT_ERROR; + } else if(data->set.ssl.version == CURL_SSLVERSION_SSLv3) { + sni = FALSE; /* SSLv3 has no SNI */ + } + + havege_init(&conn->ssl[sockindex].hs); + + /* Load the trusted CA */ + memset(&conn->ssl[sockindex].cacert, 0, sizeof(x509_cert)); + + if(data->set.str[STRING_SSL_CAFILE]) { + ret = x509parse_crtfile(&conn->ssl[sockindex].cacert, + data->set.str[STRING_SSL_CAFILE]); + + if(ret) { + failf(data, "Error reading ca cert file %s: -0x%04X", + data->set.str[STRING_SSL_CAFILE], -ret); + + if(data->set.ssl.verifypeer) + return CURLE_SSL_CACERT_BADFILE; + } + } + + /* Load the client certificate */ + memset(&conn->ssl[sockindex].clicert, 0, sizeof(x509_cert)); + + if(data->set.str[STRING_CERT]) { + ret = x509parse_crtfile(&conn->ssl[sockindex].clicert, + data->set.str[STRING_CERT]); + + if(ret) { + failf(data, "Error reading client cert file %s: -0x%04X", + data->set.str[STRING_CERT], -ret); + return CURLE_SSL_CERTPROBLEM; + } + } + + /* Load the client private key */ + if(data->set.str[STRING_KEY]) { + ret = x509parse_keyfile(&conn->ssl[sockindex].rsa, + data->set.str[STRING_KEY], + data->set.str[STRING_KEY_PASSWD]); + + if(ret) { + failf(data, "Error reading private key %s: -0x%04X", + data->set.str[STRING_KEY], -ret); + return CURLE_SSL_CERTPROBLEM; + } + } + + /* Load the CRL */ + memset(&conn->ssl[sockindex].crl, 0, sizeof(x509_crl)); + + if(data->set.str[STRING_SSL_CRLFILE]) { + ret = x509parse_crlfile(&conn->ssl[sockindex].crl, + data->set.str[STRING_SSL_CRLFILE]); + + if(ret) { + failf(data, "Error reading CRL file %s: -0x%04X", + data->set.str[STRING_SSL_CRLFILE], -ret); + return CURLE_SSL_CRL_BADFILE; + } + } + + infof(data, "PolarSSL: Connected to %s:%d\n", + conn->host.name, conn->remote_port); + + havege_init(&conn->ssl[sockindex].hs); + + if(ssl_init(&conn->ssl[sockindex].ssl)) { + failf(data, "PolarSSL: ssl_init failed"); + return CURLE_SSL_CONNECT_ERROR; + } + + ssl_set_endpoint(&conn->ssl[sockindex].ssl, SSL_IS_CLIENT); + ssl_set_authmode(&conn->ssl[sockindex].ssl, SSL_VERIFY_OPTIONAL); + + ssl_set_rng(&conn->ssl[sockindex].ssl, havege_rand, + &conn->ssl[sockindex].hs); + ssl_set_bio(&conn->ssl[sockindex].ssl, + net_recv, &conn->sock[sockindex], + net_send, &conn->sock[sockindex]); + + ssl_set_ciphers(&conn->ssl[sockindex].ssl, ssl_default_ciphers); + + if(!Curl_ssl_getsessionid(conn, &old_session, &old_session_size)) { + memcpy(&conn->ssl[sockindex].ssn, old_session, old_session_size); + infof(data, "PolarSSL re-using session\n"); + } + + ssl_set_session(&conn->ssl[sockindex].ssl, 1, 600, + &conn->ssl[sockindex].ssn); + + ssl_set_ca_chain(&conn->ssl[sockindex].ssl, + &conn->ssl[sockindex].cacert, + &conn->ssl[sockindex].crl, + conn->host.name); + + ssl_set_own_cert(&conn->ssl[sockindex].ssl, + &conn->ssl[sockindex].clicert, &conn->ssl[sockindex].rsa); + + if(!Curl_inet_pton(AF_INET, conn->host.name, &addr) && +#ifdef ENABLE_IPV6 + !Curl_inet_pton(AF_INET6, conn->host.name, &addr) && +#endif + sni && ssl_set_hostname(&conn->ssl[sockindex].ssl, conn->host.name)) { + infof(data, "WARNING: failed to configure " + "server name indication (SNI) TLS extension\n"); + } + + infof(data, "PolarSSL: performing SSL/TLS handshake...\n"); + +#ifdef POLARSSL_DEBUG + ssl_set_dbg(&conn->ssl[sockindex].ssl, polarssl_debug, data); +#endif + + for(;;) { + if (!(ret = ssl_handshake(&conn->ssl[sockindex].ssl))) { + break; + } else if(ret != POLARSSL_ERR_NET_TRY_AGAIN) { + failf(data, "ssl_handshake returned -0x%04X", -ret); + return CURLE_SSL_CONNECT_ERROR; + } else { + /* wait for data from server... */ + long timeout_ms = Curl_timeleft(conn, NULL, TRUE); + + if(timeout_ms < 0) { + failf(data, "SSL connection timeout"); + return CURLE_OPERATION_TIMEDOUT; + } + + switch(Curl_socket_ready(conn->sock[sockindex], + CURL_SOCKET_BAD, timeout_ms)) { + case 0: + failf(data, "SSL handshake timeout"); + return CURLE_OPERATION_TIMEDOUT; + break; + case CURL_CSELECT_IN: + continue; + break; + default: + return CURLE_SSL_CONNECT_ERROR; + break; + } + } + } + + infof(data, "PolarSSL: Handshake complete, cipher is %s\n", + ssl_get_cipher(&conn->ssl[sockindex].ssl)); + + ret = ssl_get_verify_result(&conn->ssl[sockindex].ssl); + + if(ret && data->set.ssl.verifypeer) { + if(ret & BADCERT_EXPIRED) + failf(data, "Cert verify failed: BADCERT_EXPIRED\n"); + + if(ret & BADCERT_REVOKED) + failf(data, "Cert verify failed: BADCERT_REVOKED"); + + if(ret & BADCERT_CN_MISMATCH) + failf(data, "Cert verify failed: BADCERT_CN_MISMATCH"); + + if(ret & BADCERT_NOT_TRUSTED) + failf(data, "Cert verify failed: BADCERT_NOT_TRUSTED"); + + return CURLE_SSL_CACERT; + } + + if(conn->ssl[sockindex].ssl.peer_cert) { + /* If the session was resumed, there will be no peer certs */ + memset(buffer, 0, sizeof(buffer)); + + if(x509parse_cert_info(buffer, sizeof(buffer), (char *)"* ", + conn->ssl[sockindex].ssl.peer_cert) != -1) + infof(data, "Dumping cert info:\n%s\n", buffer); + } + + conn->ssl[sockindex].state = ssl_connection_complete; + conn->recv[sockindex] = polarssl_recv; + conn->send[sockindex] = polarssl_send; + + /* Save the current session data for possible re-use */ + { + void *new_session = malloc(sizeof(conn->ssl[sockindex].ssn)); + + if(new_session) { + memcpy(new_session, &conn->ssl[sockindex].ssn, + sizeof(conn->ssl[sockindex].ssn)); + + if(old_session) + Curl_ssl_delsessionid(conn, old_session); + + return Curl_ssl_addsessionid(conn, new_session, + sizeof(conn->ssl[sockindex].ssn)); + } + } + + return CURLE_OK; +} + +static ssize_t polarssl_send(struct connectdata *conn, + int sockindex, + const void *mem, + size_t len, + CURLcode *curlcode) +{ + int ret = -1; + + ret = ssl_write(&conn->ssl[sockindex].ssl, + (unsigned char *)mem, len); + + if(ret < 0) { + *curlcode = (ret == POLARSSL_ERR_NET_TRY_AGAIN) ? + CURLE_AGAIN : CURLE_SEND_ERROR; + ret = -1; + } + + return ret; +} + +void Curl_polarssl_close_all(struct SessionHandle *data) +{ + (void)data; +} + +void Curl_polarssl_close(struct connectdata *conn, int sockindex) +{ + rsa_free(&conn->ssl[sockindex].rsa); + x509_free(&conn->ssl[sockindex].clicert); + x509_free(&conn->ssl[sockindex].cacert); + x509_crl_free(&conn->ssl[sockindex].crl); + ssl_free(&conn->ssl[sockindex].ssl); +} + +static ssize_t polarssl_recv(struct connectdata *conn, + int num, + char *buf, + size_t buffersize, + CURLcode *curlcode) +{ + int ret = -1; + ssize_t len = -1; + + memset(buf, 0, buffersize); + ret = ssl_read(&conn->ssl[num].ssl, (unsigned char *)buf, buffersize); + + if(ret <= 0) { + *curlcode = (ret == POLARSSL_ERR_NET_TRY_AGAIN) ? + CURLE_AGAIN : CURLE_RECV_ERROR; + return -1; + } + + len = ret; + + return len; +} + +void Curl_polarssl_session_free(void *ptr) +{ + free(ptr); +} + +size_t Curl_polarssl_version(char *buffer, size_t size) +{ + return snprintf(buffer, size, "PolarSSL"); +} + +#endif diff --git a/mobicore/common/curl/lib/polarssl.h b/mobicore/common/curl/lib/polarssl.h new file mode 100644 index 0000000000000000000000000000000000000000..964af1728c5a6006718721d1841df7093230a4bd --- /dev/null +++ b/mobicore/common/curl/lib/polarssl.h @@ -0,0 +1,57 @@ +#ifndef HEADER_CURL_POLARSSL_H +#define HEADER_CURL_POLARSSL_H +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) 2010, Hoi-Ho Chan, + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at http://curl.haxx.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + * $Id: polarssl.h,v 1.10 2009-02-12 20:48:43 danf Exp $ + ***************************************************************************/ + +#ifdef USE_POLARSSL + +CURLcode Curl_polarssl_connect(struct connectdata *conn, int sockindex); + +/* tell PolarSSL to close down all open information regarding connections (and + thus session ID caching etc) */ +void Curl_polarssl_close_all(struct SessionHandle *data); + + /* close a SSL connection */ +void Curl_polarssl_close(struct connectdata *conn, int sockindex); + +void Curl_polarssl_session_free(void *ptr); +size_t Curl_polarssl_version(char *buffer, size_t size); +int Curl_polarssl_shutdown(struct connectdata *conn, int sockindex); + +/* API setup for PolarSSL */ +#define curlssl_init() (1) +#define curlssl_cleanup() +#define curlssl_connect Curl_polarssl_connect +#define curlssl_session_free(x) Curl_polarssl_session_free(x) +#define curlssl_close_all Curl_polarssl_close_all +#define curlssl_close Curl_polarssl_close +#define curlssl_shutdown(x,y) 0 +#define curlssl_set_engine(x,y) (x=x, y=y, CURLE_FAILED_INIT) +#define curlssl_set_engine_default(x) (x=x, CURLE_FAILED_INIT) +#define curlssl_engines_list(x) (x=x, (struct curl_slist *)NULL) +#define curlssl_version Curl_polarssl_version +#define curlssl_check_cxn(x) (x=x, -1) +#define curlssl_data_pending(x,y) (x=x, y=y, 0) + +#endif /* USE_POLARSSL */ +#endif /* HEADER_CURL_POLARSSL_H */ diff --git a/mobicore/common/curl/lib/pop3.c b/mobicore/common/curl/lib/pop3.c new file mode 100644 index 0000000000000000000000000000000000000000..9f6744363be32886bd40c186ffbe980c1b60ffca --- /dev/null +++ b/mobicore/common/curl/lib/pop3.c @@ -0,0 +1,1023 @@ +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) 1998 - 2010, Daniel Stenberg, , et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at http://curl.haxx.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + * RFC1939 POP3 protocol + * RFC2384 POP URL Scheme + * RFC2595 Using TLS with IMAP, POP3 and ACAP + * + ***************************************************************************/ + +#include "setup.h" + +#ifndef CURL_DISABLE_POP3 +#include +#include +#include +#include +#include + +#ifdef HAVE_UNISTD_H +#include +#endif + +#ifdef HAVE_SYS_SOCKET_H +#include +#endif +#ifdef HAVE_NETINET_IN_H +#include +#endif +#ifdef HAVE_ARPA_INET_H +#include +#endif +#ifdef HAVE_UTSNAME_H +#include +#endif +#ifdef HAVE_NETDB_H +#include +#endif +#ifdef __VMS +#include +#include +#endif + +#if (defined(NETWARE) && defined(__NOVELL_LIBC__)) +#undef in_addr_t +#define in_addr_t unsigned long +#endif + +#include +#include "urldata.h" +#include "sendf.h" +#include "easyif.h" /* for Curl_convert_... prototypes */ + +#include "if2ip.h" +#include "hostip.h" +#include "progress.h" +#include "transfer.h" +#include "escape.h" +#include "http.h" /* for HTTP proxy tunnel stuff */ +#include "socks.h" +#include "pop3.h" + +#include "strtoofft.h" +#include "strequal.h" +#include "sslgen.h" +#include "connect.h" +#include "strerror.h" +#include "select.h" +#include "multiif.h" +#include "url.h" +#include "rawstr.h" +#include "strtoofft.h" + +#define _MPRINTF_REPLACE /* use our functions only */ +#include + +#include "curl_memory.h" +/* The last #include file should be: */ +#include "memdebug.h" + +/* Local API functions */ +static CURLcode pop3_parse_url_path(struct connectdata *conn); +static CURLcode pop3_regular_transfer(struct connectdata *conn, bool *done); +static CURLcode pop3_do(struct connectdata *conn, bool *done); +static CURLcode pop3_done(struct connectdata *conn, + CURLcode, bool premature); +static CURLcode pop3_connect(struct connectdata *conn, bool *done); +static CURLcode pop3_disconnect(struct connectdata *conn, bool dead_connection); +static CURLcode pop3_multi_statemach(struct connectdata *conn, bool *done); +static int pop3_getsock(struct connectdata *conn, + curl_socket_t *socks, + int numsocks); +static CURLcode pop3_doing(struct connectdata *conn, + bool *dophase_done); +static CURLcode pop3_setup_connection(struct connectdata * conn); + +/* + * POP3 protocol handler. + */ + +const struct Curl_handler Curl_handler_pop3 = { + "POP3", /* scheme */ + pop3_setup_connection, /* setup_connection */ + pop3_do, /* do_it */ + pop3_done, /* done */ + ZERO_NULL, /* do_more */ + pop3_connect, /* connect_it */ + pop3_multi_statemach, /* connecting */ + pop3_doing, /* doing */ + pop3_getsock, /* proto_getsock */ + pop3_getsock, /* doing_getsock */ + ZERO_NULL, /* perform_getsock */ + pop3_disconnect, /* disconnect */ + PORT_POP3, /* defport */ + PROT_POP3 /* protocol */ +}; + + +#ifdef USE_SSL +/* + * POP3S protocol handler. + */ + +const struct Curl_handler Curl_handler_pop3s = { + "POP3S", /* scheme */ + pop3_setup_connection, /* setup_connection */ + pop3_do, /* do_it */ + pop3_done, /* done */ + ZERO_NULL, /* do_more */ + pop3_connect, /* connect_it */ + pop3_multi_statemach, /* connecting */ + pop3_doing, /* doing */ + pop3_getsock, /* proto_getsock */ + pop3_getsock, /* doing_getsock */ + ZERO_NULL, /* perform_getsock */ + pop3_disconnect, /* disconnect */ + PORT_POP3S, /* defport */ + PROT_POP3 | PROT_POP3S | PROT_SSL /* protocol */ +}; +#endif + +#ifndef CURL_DISABLE_HTTP +/* + * HTTP-proxyed POP3 protocol handler. + */ + +static const struct Curl_handler Curl_handler_pop3_proxy = { + "POP3", /* scheme */ + ZERO_NULL, /* setup_connection */ + Curl_http, /* do_it */ + Curl_http_done, /* done */ + ZERO_NULL, /* do_more */ + ZERO_NULL, /* connect_it */ + ZERO_NULL, /* connecting */ + ZERO_NULL, /* doing */ + ZERO_NULL, /* proto_getsock */ + ZERO_NULL, /* doing_getsock */ + ZERO_NULL, /* perform_getsock */ + ZERO_NULL, /* disconnect */ + PORT_POP3, /* defport */ + PROT_HTTP /* protocol */ +}; + + +#ifdef USE_SSL +/* + * HTTP-proxyed POP3S protocol handler. + */ + +static const struct Curl_handler Curl_handler_pop3s_proxy = { + "POP3S", /* scheme */ + ZERO_NULL, /* setup_connection */ + Curl_http, /* do_it */ + Curl_http_done, /* done */ + ZERO_NULL, /* do_more */ + ZERO_NULL, /* connect_it */ + ZERO_NULL, /* connecting */ + ZERO_NULL, /* doing */ + ZERO_NULL, /* proto_getsock */ + ZERO_NULL, /* doing_getsock */ + ZERO_NULL, /* perform_getsock */ + ZERO_NULL, /* disconnect */ + PORT_POP3S, /* defport */ + PROT_HTTP /* protocol */ +}; +#endif +#endif + + +/* function that checks for a pop3 status code at the start of the given + string */ +static int pop3_endofresp(struct pingpong *pp, + int *resp) +{ + char *line = pp->linestart_resp; + size_t len = pp->nread_resp; + + if( ((len >= 3) && !memcmp("+OK", line, 3)) || + ((len >= 4) && !memcmp("-ERR", line, 4)) ) { + *resp=line[1]; /* O or E */ + return TRUE; + } + + return FALSE; /* nothing for us */ +} + +/* This is the ONLY way to change POP3 state! */ +static void state(struct connectdata *conn, + pop3state newstate) +{ +#if defined(DEBUGBUILD) && !defined(CURL_DISABLE_VERBOSE_STRINGS) + /* for debug purposes */ + static const char * const names[]={ + "STOP", + "SERVERGREET", + "USER", + "PASS", + "STARTTLS", + "LIST", + "RETR", + "QUIT", + /* LAST */ + }; +#endif + struct pop3_conn *pop3c = &conn->proto.pop3c; +#if defined(DEBUGBUILD) && !defined(CURL_DISABLE_VERBOSE_STRINGS) + if(pop3c->state != newstate) + infof(conn->data, "POP3 %p state change from %s to %s\n", + pop3c, names[pop3c->state], names[newstate]); +#endif + pop3c->state = newstate; +} + +static CURLcode pop3_state_user(struct connectdata *conn) +{ + CURLcode result; + struct FTP *pop3 = conn->data->state.proto.pop3; + + /* send USER */ + result = Curl_pp_sendf(&conn->proto.pop3c.pp, "USER %s", + pop3->user?pop3->user:""); + if(result) + return result; + + state(conn, POP3_USER); + + return CURLE_OK; +} + +/* For the POP3 "protocol connect" and "doing" phases only */ +static int pop3_getsock(struct connectdata *conn, + curl_socket_t *socks, + int numsocks) +{ + return Curl_pp_getsock(&conn->proto.pop3c.pp, socks, numsocks); +} + +/* for STARTTLS responses */ +static CURLcode pop3_state_starttls_resp(struct connectdata *conn, + int pop3code, + pop3state instate) +{ + CURLcode result = CURLE_OK; + struct SessionHandle *data = conn->data; + (void)instate; /* no use for this yet */ + + if(pop3code != 'O') { + failf(data, "STARTTLS denied. %c", pop3code); + result = CURLE_LOGIN_DENIED; + } + else { + /* Curl_ssl_connect is BLOCKING */ + result = Curl_ssl_connect(conn, FIRSTSOCKET); + if(CURLE_OK == result) { + conn->protocol |= PROT_POP3S; + result = pop3_state_user(conn); + } + } + state(conn, POP3_STOP); + return result; +} + +/* for USER responses */ +static CURLcode pop3_state_user_resp(struct connectdata *conn, + int pop3code, + pop3state instate) +{ + CURLcode result = CURLE_OK; + struct SessionHandle *data = conn->data; + struct FTP *pop3 = data->state.proto.pop3; + + (void)instate; /* no use for this yet */ + + if(pop3code != 'O') { + failf(data, "Access denied. %c", pop3code); + result = CURLE_LOGIN_DENIED; + } + else + /* send PASS */ + result = Curl_pp_sendf(&conn->proto.pop3c.pp, "PASS %s", + pop3->passwd?pop3->passwd:""); + if(result) + return result; + + state(conn, POP3_PASS); + return result; +} + +/* for PASS responses */ +static CURLcode pop3_state_pass_resp(struct connectdata *conn, + int pop3code, + pop3state instate) +{ + CURLcode result = CURLE_OK; + struct SessionHandle *data = conn->data; + (void)instate; /* no use for this yet */ + + if(pop3code != 'O') { + failf(data, "Access denied. %c", pop3code); + result = CURLE_LOGIN_DENIED; + } + + state(conn, POP3_STOP); + return result; +} + +/* for the retr response */ +static CURLcode pop3_state_retr_resp(struct connectdata *conn, + int pop3code, + pop3state instate) +{ + CURLcode result = CURLE_OK; + struct SessionHandle *data = conn->data; + struct FTP *pop3 = data->state.proto.pop3; + struct pop3_conn *pop3c = &conn->proto.pop3c; + struct pingpong *pp = &pop3c->pp; + + (void)instate; /* no use for this yet */ + + if('O' != pop3code) { + state(conn, POP3_STOP); + return CURLE_RECV_ERROR; + } + + /* POP3 download */ + Curl_setup_transfer(conn, FIRSTSOCKET, -1, FALSE, + pop3->bytecountp, -1, NULL); /* no upload here */ + + if(pp->cache) { + /* At this point there is a bunch of data in the header "cache" that is + actually body content, send it as body and then skip it. Do note + that there may even be additional "headers" after the body. */ + + /* we may get the EOB already here! */ + result = Curl_pop3_write(conn, pp->cache, pp->cache_size); + if(result) + return result; + + /* cache is drained */ + free(pp->cache); + pp->cache = NULL; + pp->cache_size = 0; + } + + state(conn, POP3_STOP); + return result; +} + + +/* for the list response */ +static CURLcode pop3_state_list_resp(struct connectdata *conn, + int pop3code, + pop3state instate) +{ + CURLcode result = CURLE_OK; + struct SessionHandle *data = conn->data; + struct FTP *pop3 = data->state.proto.pop3; + struct pop3_conn *pop3c = &conn->proto.pop3c; + struct pingpong *pp = &pop3c->pp; + + (void)instate; /* no use for this yet */ + + if('O' != pop3code) { + state(conn, POP3_STOP); + return CURLE_RECV_ERROR; + } + + /* POP3 download */ + Curl_setup_transfer(conn, FIRSTSOCKET, -1, FALSE, pop3->bytecountp, + -1, NULL); /* no upload here */ + + if(pp->cache) { + /* cache holds the email ID listing */ + + /* we may get the EOB already here! */ + result = Curl_pop3_write(conn, pp->cache, pp->cache_size); + if(result) + return result; + + /* cache is drained */ + free(pp->cache); + pp->cache = NULL; + pp->cache_size = 0; + } + + state(conn, POP3_STOP); + return result; +} + +/* start the DO phase for RETR */ +static CURLcode pop3_retr(struct connectdata *conn) +{ + CURLcode result = CURLE_OK; + struct pop3_conn *pop3c = &conn->proto.pop3c; + + result = Curl_pp_sendf(&conn->proto.pop3c.pp, "RETR %s", pop3c->mailbox); + if(result) + return result; + + state(conn, POP3_RETR); + return result; +} + +/* start the DO phase for LIST */ +static CURLcode pop3_list(struct connectdata *conn) +{ + CURLcode result = CURLE_OK; + struct pop3_conn *pop3c = &conn->proto.pop3c; + + result = Curl_pp_sendf(&conn->proto.pop3c.pp, "LIST %s", pop3c->mailbox); + if(result) + return result; + + state(conn, POP3_LIST); + return result; +} + +static CURLcode pop3_statemach_act(struct connectdata *conn) +{ + CURLcode result; + curl_socket_t sock = conn->sock[FIRSTSOCKET]; + struct SessionHandle *data=conn->data; + int pop3code; + struct pop3_conn *pop3c = &conn->proto.pop3c; + struct pingpong *pp = &pop3c->pp; + size_t nread = 0; + + if(pp->sendleft) + return Curl_pp_flushsend(pp); + + /* we read a piece of response */ + result = Curl_pp_readresp(sock, pp, &pop3code, &nread); + if(result) + return result; + + if(pop3code) { + /* we have now received a full POP3 server response */ + switch(pop3c->state) { + case POP3_SERVERGREET: + if(pop3code != 'O') { + failf(data, "Got unexpected pop3-server response"); + return CURLE_FTP_WEIRD_SERVER_REPLY; + } + + if(data->set.ftp_ssl && !conn->ssl[FIRSTSOCKET].use) { + /* We don't have a SSL/TLS connection yet, but SSL is requested. Switch + to TLS connection now */ + result = Curl_pp_sendf(&pop3c->pp, "STARTTLS", NULL); + state(conn, POP3_STARTTLS); + } + else + result = pop3_state_user(conn); + if(result) + return result; + break; + + case POP3_USER: + result = pop3_state_user_resp(conn, pop3code, pop3c->state); + break; + + case POP3_PASS: + result = pop3_state_pass_resp(conn, pop3code, pop3c->state); + break; + + case POP3_STARTTLS: + result = pop3_state_starttls_resp(conn, pop3code, pop3c->state); + break; + + case POP3_RETR: + result = pop3_state_retr_resp(conn, pop3code, pop3c->state); + break; + + case POP3_LIST: + result = pop3_state_list_resp(conn, pop3code, pop3c->state); + break; + + case POP3_QUIT: + /* fallthrough, just stop! */ + default: + /* internal error */ + state(conn, POP3_STOP); + break; + } + } + return result; +} + +/* called repeatedly until done from multi.c */ +static CURLcode pop3_multi_statemach(struct connectdata *conn, bool *done) +{ + struct pop3_conn *pop3c = &conn->proto.pop3c; + CURLcode result = Curl_pp_multi_statemach(&pop3c->pp); + + *done = (bool)(pop3c->state == POP3_STOP); + + return result; +} + +static CURLcode pop3_easy_statemach(struct connectdata *conn) +{ + struct pop3_conn *pop3c = &conn->proto.pop3c; + struct pingpong *pp = &pop3c->pp; + CURLcode result = CURLE_OK; + + while(pop3c->state != POP3_STOP) { + result = Curl_pp_easy_statemach(pp); + if(result) + break; + } + + return result; +} + +/* + * Allocate and initialize the struct POP3 for the current SessionHandle. If + * need be. + */ +static CURLcode pop3_init(struct connectdata *conn) +{ + struct SessionHandle *data = conn->data; + struct FTP *pop3 = data->state.proto.pop3; + if(!pop3) { + pop3 = data->state.proto.pop3 = calloc(sizeof(struct FTP), 1); + if(!pop3) + return CURLE_OUT_OF_MEMORY; + } + + /* get some initial data into the pop3 struct */ + pop3->bytecountp = &data->req.bytecount; + + /* No need to duplicate user+password, the connectdata struct won't change + during a session, but we re-init them here since on subsequent inits + since the conn struct may have changed or been replaced. + */ + pop3->user = conn->user; + pop3->passwd = conn->passwd; + + return CURLE_OK; +} + +/* + * pop3_connect() should do everything that is to be considered a part of + * the connection phase. + * + * The variable 'done' points to will be TRUE if the protocol-layer connect + * phase is done when this function returns, or FALSE is not. When called as + * a part of the easy interface, it will always be TRUE. + */ +static CURLcode pop3_connect(struct connectdata *conn, + bool *done) /* see description above */ +{ + CURLcode result; + struct pop3_conn *pop3c = &conn->proto.pop3c; + struct SessionHandle *data=conn->data; + struct pingpong *pp = &pop3c->pp; + + *done = FALSE; /* default to not done yet */ + + /* If there already is a protocol-specific struct allocated for this + sessionhandle, deal with it */ + Curl_reset_reqproto(conn); + + result = pop3_init(conn); + if(CURLE_OK != result) + return result; + + /* We always support persistant connections on pop3 */ + conn->bits.close = FALSE; + + pp->response_time = RESP_TIMEOUT; /* set default response time-out */ + pp->statemach_act = pop3_statemach_act; + pp->endofresp = pop3_endofresp; + pp->conn = conn; + +#if !defined(CURL_DISABLE_HTTP) && !defined(CURL_DISABLE_PROXY) + if(conn->bits.tunnel_proxy && conn->bits.httpproxy) { + /* for POP3 over HTTP proxy */ + struct HTTP http_proxy; + struct FTP *pop3_save; + + /* BLOCKING */ + /* We want "seamless" POP3 operations through HTTP proxy tunnel */ + + /* Curl_proxyCONNECT is based on a pointer to a struct HTTP at the member + * conn->proto.http; we want POP3 through HTTP and we have to change the + * member temporarily for connecting to the HTTP proxy. After + * Curl_proxyCONNECT we have to set back the member to the original struct + * POP3 pointer + */ + pop3_save = data->state.proto.pop3; + memset(&http_proxy, 0, sizeof(http_proxy)); + data->state.proto.http = &http_proxy; + + result = Curl_proxyCONNECT(conn, FIRSTSOCKET, + conn->host.name, conn->remote_port); + + data->state.proto.pop3 = pop3_save; + + if(CURLE_OK != result) + return result; + } +#endif /* !CURL_DISABLE_HTTP && !CURL_DISABLE_PROXY */ + + if(conn->protocol & PROT_POP3S) { + /* BLOCKING */ + /* POP3S is simply pop3 with SSL for the control channel */ + /* now, perform the SSL initialization for this socket */ + result = Curl_ssl_connect(conn, FIRSTSOCKET); + if(result) + return result; + } + + Curl_pp_init(pp); /* init the response reader stuff */ + + /* When we connect, we start in the state where we await the server greet + response */ + state(conn, POP3_SERVERGREET); + + if(data->state.used_interface == Curl_if_multi) + result = pop3_multi_statemach(conn, done); + else { + result = pop3_easy_statemach(conn); + if(!result) + *done = TRUE; + } + + return result; +} + +/*********************************************************************** + * + * pop3_done() + * + * The DONE function. This does what needs to be done after a single DO has + * performed. + * + * Input argument is already checked for validity. + */ +static CURLcode pop3_done(struct connectdata *conn, CURLcode status, + bool premature) +{ + struct SessionHandle *data = conn->data; + struct FTP *pop3 = data->state.proto.pop3; + CURLcode result=CURLE_OK; + (void)premature; + + if(!pop3) + /* When the easy handle is removed from the multi while libcurl is still + * trying to resolve the host name, it seems that the pop3 struct is not + * yet initialized, but the removal action calls Curl_done() which calls + * this function. So we simply return success if no pop3 pointer is set. + */ + return CURLE_OK; + + if(status) { + conn->bits.close = TRUE; /* marked for closure */ + result = status; /* use the already set error code */ + } + + /* clear these for next connection */ + pop3->transfer = FTPTRANSFER_BODY; + + return result; +} + +/*********************************************************************** + * + * pop3_perform() + * + * This is the actual DO function for POP3. Get a file/directory according to + * the options previously setup. + */ + +static +CURLcode pop3_perform(struct connectdata *conn, + bool *connected, /* connect status after PASV / PORT */ + bool *dophase_done) +{ + /* this is POP3 and no proxy */ + CURLcode result=CURLE_OK; + struct pop3_conn *pop3c = &conn->proto.pop3c; + + DEBUGF(infof(conn->data, "DO phase starts\n")); + + if(conn->data->set.opt_no_body) { + /* requested no body means no transfer... */ + struct FTP *pop3 = conn->data->state.proto.pop3; + pop3->transfer = FTPTRANSFER_INFO; + } + + *dophase_done = FALSE; /* not done yet */ + + /* start the first command in the DO phase */ + /* If mailbox is empty, then assume user wants listing for mail IDs, + * otherwise, attempt to retrieve the mail-id stored in mailbox + */ + if (strlen(pop3c->mailbox)) + result = pop3_retr(conn); + else + result = pop3_list(conn); + if(result) + return result; + + /* run the state-machine */ + if(conn->data->state.used_interface == Curl_if_multi) + result = pop3_multi_statemach(conn, dophase_done); + else { + result = pop3_easy_statemach(conn); + *dophase_done = TRUE; /* with the easy interface we are done here */ + } + *connected = conn->bits.tcpconnect; + + if(*dophase_done) + DEBUGF(infof(conn->data, "DO phase is complete\n")); + + return result; +} + +/*********************************************************************** + * + * pop3_do() + * + * This function is registered as 'curl_do' function. It decodes the path + * parts etc as a wrapper to the actual DO function (pop3_perform). + * + * The input argument is already checked for validity. + */ +static CURLcode pop3_do(struct connectdata *conn, bool *done) +{ + CURLcode retcode = CURLE_OK; + + *done = FALSE; /* default to false */ + + /* + Since connections can be re-used between SessionHandles, this might be a + connection already existing but on a fresh SessionHandle struct so we must + make sure we have a good 'struct POP3' to play with. For new connections, + the struct POP3 is allocated and setup in the pop3_connect() function. + */ + Curl_reset_reqproto(conn); + retcode = pop3_init(conn); + if(retcode) + return retcode; + + retcode = pop3_parse_url_path(conn); + if(retcode) + return retcode; + + retcode = pop3_regular_transfer(conn, done); + + return retcode; +} + +/*********************************************************************** + * + * pop3_quit() + * + * This should be called before calling sclose(). We should then wait for the + * response from the server before returning. The calling code should then try + * to close the connection. + * + */ +static CURLcode pop3_quit(struct connectdata *conn) +{ + CURLcode result = CURLE_OK; + + result = Curl_pp_sendf(&conn->proto.pop3c.pp, "QUIT", NULL); + if(result) + return result; + state(conn, POP3_QUIT); + + result = pop3_easy_statemach(conn); + + return result; +} + +/*********************************************************************** + * + * pop3_disconnect() + * + * Disconnect from an POP3 server. Cleanup protocol-specific per-connection + * resources. BLOCKING. + */ +static CURLcode pop3_disconnect(struct connectdata *conn, bool dead_connection) +{ + struct pop3_conn *pop3c= &conn->proto.pop3c; + + /* We cannot send quit unconditionally. If this connection is stale or + bad in any way, sending quit and waiting around here will make the + disconnect wait in vain and cause more problems than we need to. + */ + + /* The POP3 session may or may not have been allocated/setup at this + point! */ + if(!dead_connection && pop3c->pp.conn) + (void)pop3_quit(conn); /* ignore errors on the LOGOUT */ + + + Curl_pp_disconnect(&pop3c->pp); + + return CURLE_OK; +} + +/*********************************************************************** + * + * pop3_parse_url_path() + * + * Parse the URL path into separate path components. + * + */ +static CURLcode pop3_parse_url_path(struct connectdata *conn) +{ + /* the pop3 struct is already inited in pop3_connect() */ + struct pop3_conn *pop3c = &conn->proto.pop3c; + struct SessionHandle *data = conn->data; + const char *path = data->state.path; + + /* url decode the path and use this mailbox */ + pop3c->mailbox = curl_easy_unescape(data, path, 0, NULL); + if (!pop3c->mailbox) + return CURLE_OUT_OF_MEMORY; + + return CURLE_OK; +} + +/* call this when the DO phase has completed */ +static CURLcode pop3_dophase_done(struct connectdata *conn, + bool connected) +{ + struct FTP *pop3 = conn->data->state.proto.pop3; + struct pop3_conn *pop3c = &conn->proto.pop3c; + (void)connected; + + if(pop3->transfer != FTPTRANSFER_BODY) + /* no data to transfer */ + Curl_setup_transfer(conn, -1, -1, FALSE, NULL, -1, NULL); + + free(pop3c->mailbox); + + return CURLE_OK; +} + +/* called from multi.c while DOing */ +static CURLcode pop3_doing(struct connectdata *conn, + bool *dophase_done) +{ + CURLcode result; + result = pop3_multi_statemach(conn, dophase_done); + + if(*dophase_done) { + result = pop3_dophase_done(conn, FALSE /* not connected */); + + DEBUGF(infof(conn->data, "DO phase is complete\n")); + } + return result; +} + +/*********************************************************************** + * + * pop3_regular_transfer() + * + * The input argument is already checked for validity. + * + * Performs all commands done before a regular transfer between a local and a + * remote host. + * + */ +static +CURLcode pop3_regular_transfer(struct connectdata *conn, + bool *dophase_done) +{ + CURLcode result=CURLE_OK; + bool connected=FALSE; + struct SessionHandle *data = conn->data; + data->req.size = -1; /* make sure this is unknown at this point */ + + Curl_pgrsSetUploadCounter(data, 0); + Curl_pgrsSetDownloadCounter(data, 0); + Curl_pgrsSetUploadSize(data, 0); + Curl_pgrsSetDownloadSize(data, 0); + + result = pop3_perform(conn, + &connected, /* have we connected after PASV/PORT */ + dophase_done); /* all commands in the DO-phase done? */ + + if(CURLE_OK == result) { + + if(!*dophase_done) + /* the DO phase has not completed yet */ + return CURLE_OK; + + result = pop3_dophase_done(conn, connected); + if(result) + return result; + } + + return result; +} + +static CURLcode pop3_setup_connection(struct connectdata * conn) +{ + struct SessionHandle *data = conn->data; + + if(conn->bits.httpproxy && !data->set.tunnel_thru_httpproxy) { + /* Unless we have asked to tunnel pop3 operations through the proxy, we + switch and use HTTP operations only */ +#ifndef CURL_DISABLE_HTTP + if(conn->handler == &Curl_handler_pop3) + conn->handler = &Curl_handler_pop3_proxy; + else { +#ifdef USE_SSL + conn->handler = &Curl_handler_pop3s_proxy; +#else + failf(data, "POP3S not supported!"); + return CURLE_UNSUPPORTED_PROTOCOL; +#endif + } + /* + * We explicitly mark this connection as persistent here as we're doing + * POP3 over HTTP and thus we accidentally avoid setting this value + * otherwise. + */ + conn->bits.close = FALSE; +#else + failf(data, "POP3 over http proxy requires HTTP support built-in!"); + return CURLE_UNSUPPORTED_PROTOCOL; +#endif + } + + data->state.path++; /* don't include the initial slash */ + + return CURLE_OK; +} + +/* this is the 5-bytes End-Of-Body marker for POP3 */ +#define POP3_EOB "\x0d\x0a\x2e\x0d\x0a" +#define POP3_EOB_LEN 5 + +/* + * This function scans the body after the end-of-body and writes everything + * until the end is found. + */ +CURLcode Curl_pop3_write(struct connectdata *conn, + char *str, + size_t nread) +{ + /* This code could be made into a special function in the handler struct. */ + CURLcode result; + struct SessionHandle *data = conn->data; + struct SingleRequest *k = &data->req; + + /* Detect the end-of-body marker, which is 5 bytes: + 0d 0a 2e 0d 0a. This marker can of course be spread out + over up to 5 different data chunks. Deal with it! */ + struct pop3_conn *pop3c = &conn->proto.pop3c; + size_t checkmax = (nread >= POP3_EOB_LEN?POP3_EOB_LEN:nread); + size_t checkleft = POP3_EOB_LEN-pop3c->eob; + size_t check = (checkmax >= checkleft?checkleft:checkmax); + + if(!memcmp(POP3_EOB, &str[nread - check], check)) { + /* substring match */ + pop3c->eob += check; + if(pop3c->eob == POP3_EOB_LEN) { + /* full match, the transfer is done! */ + str[nread - check] = '\0'; + nread -= check; + k->keepon &= ~KEEP_RECV; + pop3c->eob = 0; + } + } + else if(pop3c->eob) { + /* not a match, but we matched a piece before so we must now + send that part as body first, before we move on and send + this buffer */ + result = Curl_client_write(conn, CLIENTWRITE_BODY, + (char *)POP3_EOB, pop3c->eob); + if(result) + return result; + pop3c->eob = 0; + } + + result = Curl_client_write(conn, CLIENTWRITE_BODY, str, nread); + + return result; +} + +#endif /* CURL_DISABLE_POP3 */ diff --git a/mobicore/common/curl/lib/pop3.h b/mobicore/common/curl/lib/pop3.h new file mode 100644 index 0000000000000000000000000000000000000000..337421cac695a70af4f32fb613d631cd71e85149 --- /dev/null +++ b/mobicore/common/curl/lib/pop3.h @@ -0,0 +1,62 @@ +#ifndef __POP3_H +#define __POP3_H +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) 2009, Daniel Stenberg, , et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at http://curl.haxx.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ***************************************************************************/ + +/**************************************************************************** + * POP3 unique setup + ***************************************************************************/ +typedef enum { + POP3_STOP, /* do nothing state, stops the state machine */ + POP3_SERVERGREET, /* waiting for the initial greeting immediately after + a connect */ + POP3_USER, + POP3_PASS, + POP3_STARTTLS, + POP3_LIST, + POP3_RETR, + POP3_QUIT, + POP3_LAST /* never used */ +} pop3state; + +/* pop3_conn is used for struct connection-oriented data in the connectdata + struct */ +struct pop3_conn { + struct pingpong pp; + char *mailbox; /* what to RETR */ + size_t eob; /* number of bytes of the EOB (End Of Body) that has been + received thus far */ + pop3state state; /* always use pop3.c:state() to change state! */ +}; + +extern const struct Curl_handler Curl_handler_pop3; +extern const struct Curl_handler Curl_handler_pop3s; + +/* + * This function scans the body after the end-of-body and writes everything + * until the end is found. + */ +CURLcode Curl_pop3_write(struct connectdata *conn, + char *str, + size_t nread); + +#endif /* __POP3_H */ diff --git a/mobicore/common/curl/lib/progress.c b/mobicore/common/curl/lib/progress.c new file mode 100644 index 0000000000000000000000000000000000000000..e0758f2a83b653380fa63e4155b01e5e7db3440c --- /dev/null +++ b/mobicore/common/curl/lib/progress.c @@ -0,0 +1,448 @@ +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) 1998 - 2009, Daniel Stenberg, , et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at http://curl.haxx.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ***************************************************************************/ + +#include "setup.h" + +#include "urldata.h" +#include "sendf.h" +#include "progress.h" + +#define _MPRINTF_REPLACE /* use our functions only */ +#include + +/* Provide a string that is 2 + 1 + 2 + 1 + 2 = 8 letters long (plus the zero + byte) */ +static void time2str(char *r, curl_off_t seconds) +{ + curl_off_t d, h, m, s; + if(seconds <= 0) { + strcpy(r, "--:--:--"); + return; + } + h = seconds / CURL_OFF_T_C(3600); + if(h <= CURL_OFF_T_C(99)) { + m = (seconds - (h*CURL_OFF_T_C(3600))) / CURL_OFF_T_C(60); + s = (seconds - (h*CURL_OFF_T_C(3600))) - (m*CURL_OFF_T_C(60)); + snprintf(r, 9, "%2" FORMAT_OFF_T ":%02" FORMAT_OFF_T ":%02" FORMAT_OFF_T, + h, m, s); + } + else { + /* this equals to more than 99 hours, switch to a more suitable output + format to fit within the limits. */ + d = seconds / CURL_OFF_T_C(86400); + h = (seconds - (d*CURL_OFF_T_C(86400))) / CURL_OFF_T_C(3600); + if(d <= CURL_OFF_T_C(999)) + snprintf(r, 9, "%3" FORMAT_OFF_T "d %02" FORMAT_OFF_T "h", d, h); + else + snprintf(r, 9, "%7" FORMAT_OFF_T "d", d); + } +} + +/* The point of this function would be to return a string of the input data, + but never longer than 5 columns (+ one zero byte). + Add suffix k, M, G when suitable... */ +static char *max5data(curl_off_t bytes, char *max5) +{ +#define ONE_KILOBYTE CURL_OFF_T_C(1024) +#define ONE_MEGABYTE (CURL_OFF_T_C(1024) * ONE_KILOBYTE) +#define ONE_GIGABYTE (CURL_OFF_T_C(1024) * ONE_MEGABYTE) +#define ONE_TERABYTE (CURL_OFF_T_C(1024) * ONE_GIGABYTE) +#define ONE_PETABYTE (CURL_OFF_T_C(1024) * ONE_TERABYTE) + + if(bytes < CURL_OFF_T_C(100000)) + snprintf(max5, 6, "%5" FORMAT_OFF_T, bytes); + + else if(bytes < CURL_OFF_T_C(10000) * ONE_KILOBYTE) + snprintf(max5, 6, "%4" FORMAT_OFF_T "k", bytes/ONE_KILOBYTE); + + else if(bytes < CURL_OFF_T_C(100) * ONE_MEGABYTE) + /* 'XX.XM' is good as long as we're less than 100 megs */ + snprintf(max5, 6, "%2" FORMAT_OFF_T ".%0" FORMAT_OFF_T "M", + bytes/ONE_MEGABYTE, + (bytes%ONE_MEGABYTE) / (ONE_MEGABYTE/CURL_OFF_T_C(10)) ); + +#if (CURL_SIZEOF_CURL_OFF_T > 4) + + else if(bytes < CURL_OFF_T_C(10000) * ONE_MEGABYTE) + /* 'XXXXM' is good until we're at 10000MB or above */ + snprintf(max5, 6, "%4" FORMAT_OFF_T "M", bytes/ONE_MEGABYTE); + + else if(bytes < CURL_OFF_T_C(100) * ONE_GIGABYTE) + /* 10000 MB - 100 GB, we show it as XX.XG */ + snprintf(max5, 6, "%2" FORMAT_OFF_T ".%0" FORMAT_OFF_T "G", + bytes/ONE_GIGABYTE, + (bytes%ONE_GIGABYTE) / (ONE_GIGABYTE/CURL_OFF_T_C(10)) ); + + else if(bytes < CURL_OFF_T_C(10000) * ONE_GIGABYTE) + /* up to 10000GB, display without decimal: XXXXG */ + snprintf(max5, 6, "%4" FORMAT_OFF_T "G", bytes/ONE_GIGABYTE); + + else if(bytes < CURL_OFF_T_C(10000) * ONE_TERABYTE) + /* up to 10000TB, display without decimal: XXXXT */ + snprintf(max5, 6, "%4" FORMAT_OFF_T "T", bytes/ONE_TERABYTE); + + else + /* up to 10000PB, display without decimal: XXXXP */ + snprintf(max5, 6, "%4" FORMAT_OFF_T "P", bytes/ONE_PETABYTE); + + /* 16384 petabytes (16 exabytes) is the maximum a 64 bit unsigned number + can hold, but our data type is signed so 8192PB will be the maximum. */ + +#else + + else + snprintf(max5, 6, "%4" FORMAT_OFF_T "M", bytes/ONE_MEGABYTE); + +#endif + + return max5; +} + +/* + + New proposed interface, 9th of February 2000: + + pgrsStartNow() - sets start time + pgrsSetDownloadSize(x) - known expected download size + pgrsSetUploadSize(x) - known expected upload size + pgrsSetDownloadCounter() - amount of data currently downloaded + pgrsSetUploadCounter() - amount of data currently uploaded + pgrsUpdate() - show progress + pgrsDone() - transfer complete + +*/ + +void Curl_pgrsDone(struct connectdata *conn) +{ + struct SessionHandle *data = conn->data; + data->progress.lastshow=0; + Curl_pgrsUpdate(conn); /* the final (forced) update */ + + data->progress.speeder_c = 0; /* reset the progress meter display */ +} + +/* reset all times except redirect */ +void Curl_pgrsResetTimes(struct SessionHandle *data) +{ + data->progress.t_nslookup = 0.0; + data->progress.t_connect = 0.0; + data->progress.t_pretransfer = 0.0; + data->progress.t_starttransfer = 0.0; +} + +void Curl_pgrsTime(struct SessionHandle *data, timerid timer) +{ + switch(timer) { + default: + case TIMER_NONE: + /* mistake filter */ + break; + case TIMER_STARTSINGLE: + /* This is set at the start of a single fetch */ + data->progress.t_startsingle = Curl_tvnow(); + break; + + case TIMER_NAMELOOKUP: + data->progress.t_nslookup = + Curl_tvdiff_secs(Curl_tvnow(), data->progress.t_startsingle); + break; + case TIMER_CONNECT: + data->progress.t_connect = + Curl_tvdiff_secs(Curl_tvnow(), data->progress.t_startsingle); + break; + case TIMER_APPCONNECT: + data->progress.t_appconnect = + Curl_tvdiff_secs(Curl_tvnow(), data->progress.t_startsingle); + break; + case TIMER_PRETRANSFER: + data->progress.t_pretransfer = + Curl_tvdiff_secs(Curl_tvnow(), data->progress.t_startsingle); + break; + case TIMER_STARTTRANSFER: + data->progress.t_starttransfer = + Curl_tvdiff_secs(Curl_tvnow(), data->progress.t_startsingle); + break; + case TIMER_POSTRANSFER: + /* this is the normal end-of-transfer thing */ + break; + case TIMER_REDIRECT: + data->progress.t_redirect = + Curl_tvdiff_secs(Curl_tvnow(), data->progress.start); + break; + } +} + +void Curl_pgrsStartNow(struct SessionHandle *data) +{ + data->progress.speeder_c = 0; /* reset the progress meter display */ + data->progress.start = Curl_tvnow(); +} + +void Curl_pgrsSetDownloadCounter(struct SessionHandle *data, curl_off_t size) +{ + data->progress.downloaded = size; +} + +void Curl_pgrsSetUploadCounter(struct SessionHandle *data, curl_off_t size) +{ + data->progress.uploaded = size; +} + +void Curl_pgrsSetDownloadSize(struct SessionHandle *data, curl_off_t size) +{ + data->progress.size_dl = size; + if(size >= 0) + data->progress.flags |= PGRS_DL_SIZE_KNOWN; + else + data->progress.flags &= ~PGRS_DL_SIZE_KNOWN; +} + +void Curl_pgrsSetUploadSize(struct SessionHandle *data, curl_off_t size) +{ + data->progress.size_ul = size; + if(size >= 0) + data->progress.flags |= PGRS_UL_SIZE_KNOWN; + else + data->progress.flags &= ~PGRS_UL_SIZE_KNOWN; +} + +int Curl_pgrsUpdate(struct connectdata *conn) +{ + struct timeval now; + int result; + char max5[6][10]; + curl_off_t dlpercen=0; + curl_off_t ulpercen=0; + curl_off_t total_percen=0; + curl_off_t total_transfer; + curl_off_t total_expected_transfer; + curl_off_t timespent; + struct SessionHandle *data = conn->data; + int nowindex = data->progress.speeder_c% CURR_TIME; + int checkindex; + int countindex; /* amount of seconds stored in the speeder array */ + char time_left[10]; + char time_total[10]; + char time_spent[10]; + curl_off_t ulestimate=0; + curl_off_t dlestimate=0; + curl_off_t total_estimate; + bool shownow=FALSE; + + now = Curl_tvnow(); /* what time is it */ + + /* The time spent so far (from the start) */ + data->progress.timespent = + (double)(now.tv_sec - data->progress.start.tv_sec) + + (double)(now.tv_usec - data->progress.start.tv_usec)/1000000.0; + timespent = (curl_off_t)data->progress.timespent; + + /* The average download speed this far */ + data->progress.dlspeed = (curl_off_t) + ((double)data->progress.downloaded/ + (data->progress.timespent>0?data->progress.timespent:1)); + + /* The average upload speed this far */ + data->progress.ulspeed = (curl_off_t) + ((double)data->progress.uploaded/ + (data->progress.timespent>0?data->progress.timespent:1)); + + /* Calculations done at most once a second, unless end is reached */ + if(data->progress.lastshow != (long)now.tv_sec) { + shownow = TRUE; + + data->progress.lastshow = now.tv_sec; + + /* Let's do the "current speed" thing, which should use the fastest + of the dl/ul speeds. Store the faster speed at entry 'nowindex'. */ + data->progress.speeder[ nowindex ] = + data->progress.downloaded>data->progress.uploaded? + data->progress.downloaded:data->progress.uploaded; + + /* remember the exact time for this moment */ + data->progress.speeder_time [ nowindex ] = now; + + /* advance our speeder_c counter, which is increased every time we get + here and we expect it to never wrap as 2^32 is a lot of seconds! */ + data->progress.speeder_c++; + + /* figure out how many index entries of data we have stored in our speeder + array. With N_ENTRIES filled in, we have about N_ENTRIES-1 seconds of + transfer. Imagine, after one second we have filled in two entries, + after two seconds we've filled in three entries etc. */ + countindex = ((data->progress.speeder_c>=CURR_TIME)? + CURR_TIME:data->progress.speeder_c) - 1; + + /* first of all, we don't do this if there's no counted seconds yet */ + if(countindex) { + long span_ms; + + /* Get the index position to compare with the 'nowindex' position. + Get the oldest entry possible. While we have less than CURR_TIME + entries, the first entry will remain the oldest. */ + checkindex = (data->progress.speeder_c>=CURR_TIME)? + data->progress.speeder_c%CURR_TIME:0; + + /* Figure out the exact time for the time span */ + span_ms = Curl_tvdiff(now, + data->progress.speeder_time[checkindex]); + if(0 == span_ms) + span_ms=1; /* at least one millisecond MUST have passed */ + + /* Calculate the average speed the last 'span_ms' milliseconds */ + { + curl_off_t amount = data->progress.speeder[nowindex]- + data->progress.speeder[checkindex]; + + if(amount > CURL_OFF_T_C(4294967) /* 0xffffffff/1000 */) + /* the 'amount' value is bigger than would fit in 32 bits if + multiplied with 1000, so we use the double math for this */ + data->progress.current_speed = (curl_off_t) + ((double)amount/((double)span_ms/1000.0)); + else + /* the 'amount' value is small enough to fit within 32 bits even + when multiplied with 1000 */ + data->progress.current_speed = amount*CURL_OFF_T_C(1000)/span_ms; + } + } + else + /* the first second we use the main average */ + data->progress.current_speed = + (data->progress.ulspeed>data->progress.dlspeed)? + data->progress.ulspeed:data->progress.dlspeed; + + } /* Calculations end */ + + if(!(data->progress.flags & PGRS_HIDE)) { + + /* progress meter has not been shut off */ + + if(data->set.fprogress) { + /* There's a callback set, so we call that instead of writing + anything ourselves. This really is the way to go. */ + result= data->set.fprogress(data->set.progress_client, + (double)data->progress.size_dl, + (double)data->progress.downloaded, + (double)data->progress.size_ul, + (double)data->progress.uploaded); + if(result) + failf(data, "Callback aborted"); + return result; + } + + if(!shownow) + /* only show the internal progress meter once per second */ + return 0; + + /* If there's no external callback set, use internal code to show + progress */ + + if(!(data->progress.flags & PGRS_HEADERS_OUT)) { + if(data->state.resume_from) { + fprintf(data->set.err, + "** Resuming transfer from byte position %" FORMAT_OFF_T "\n", + data->state.resume_from); + } + fprintf(data->set.err, + " %% Total %% Received %% Xferd Average Speed Time Time Time Current\n" + " Dload Upload Total Spent Left Speed\n"); + data->progress.flags |= PGRS_HEADERS_OUT; /* headers are shown */ + } + + /* Figure out the estimated time of arrival for the upload */ + if((data->progress.flags & PGRS_UL_SIZE_KNOWN) && + (data->progress.ulspeed > CURL_OFF_T_C(0))) { + ulestimate = data->progress.size_ul / data->progress.ulspeed; + + if(data->progress.size_ul > CURL_OFF_T_C(10000)) + ulpercen = data->progress.uploaded / + (data->progress.size_ul/CURL_OFF_T_C(100)); + else if(data->progress.size_ul > CURL_OFF_T_C(0)) + ulpercen = (data->progress.uploaded*100) / + data->progress.size_ul; + } + + /* ... and the download */ + if((data->progress.flags & PGRS_DL_SIZE_KNOWN) && + (data->progress.dlspeed > CURL_OFF_T_C(0))) { + dlestimate = data->progress.size_dl / data->progress.dlspeed; + + if(data->progress.size_dl > CURL_OFF_T_C(10000)) + dlpercen = data->progress.downloaded / + (data->progress.size_dl/CURL_OFF_T_C(100)); + else if(data->progress.size_dl > CURL_OFF_T_C(0)) + dlpercen = (data->progress.downloaded*100) / + data->progress.size_dl; + } + + /* Now figure out which of them is slower and use that one for the + total estimate! */ + total_estimate = ulestimate>dlestimate?ulestimate:dlestimate; + + /* create the three time strings */ + time2str(time_left, total_estimate > 0?(total_estimate - timespent):0); + time2str(time_total, total_estimate); + time2str(time_spent, timespent); + + /* Get the total amount of data expected to get transfered */ + total_expected_transfer = + (data->progress.flags & PGRS_UL_SIZE_KNOWN? + data->progress.size_ul:data->progress.uploaded)+ + (data->progress.flags & PGRS_DL_SIZE_KNOWN? + data->progress.size_dl:data->progress.downloaded); + + /* We have transfered this much so far */ + total_transfer = data->progress.downloaded + data->progress.uploaded; + + /* Get the percentage of data transfered so far */ + if(total_expected_transfer > CURL_OFF_T_C(10000)) + total_percen = total_transfer / + (total_expected_transfer/CURL_OFF_T_C(100)); + else if(total_expected_transfer > CURL_OFF_T_C(0)) + total_percen = (total_transfer*100) / total_expected_transfer; + + fprintf(data->set.err, + "\r" + "%3" FORMAT_OFF_T " %s " + "%3" FORMAT_OFF_T " %s " + "%3" FORMAT_OFF_T " %s %s %s %s %s %s %s", + total_percen, /* 3 letters */ /* total % */ + max5data(total_expected_transfer, max5[2]), /* total size */ + dlpercen, /* 3 letters */ /* rcvd % */ + max5data(data->progress.downloaded, max5[0]), /* rcvd size */ + ulpercen, /* 3 letters */ /* xfer % */ + max5data(data->progress.uploaded, max5[1]), /* xfer size */ + max5data(data->progress.dlspeed, max5[3]), /* avrg dl speed */ + max5data(data->progress.ulspeed, max5[4]), /* avrg ul speed */ + time_total, /* 8 letters */ /* total time */ + time_spent, /* 8 letters */ /* time spent */ + time_left, /* 8 letters */ /* time left */ + max5data(data->progress.current_speed, max5[5]) /* current speed */ + ); + + /* we flush the output stream to make it appear as soon as possible */ + fflush(data->set.err); + + } /* !(data->progress.flags & PGRS_HIDE) */ + + return 0; +} diff --git a/mobicore/common/curl/lib/progress.h b/mobicore/common/curl/lib/progress.h new file mode 100644 index 0000000000000000000000000000000000000000..95944f0ba26297fab5df9dfe7f993ac3debbbfa6 --- /dev/null +++ b/mobicore/common/curl/lib/progress.h @@ -0,0 +1,70 @@ +#ifndef __PROGRESS_H +#define __PROGRESS_H +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) 1998 - 2008, Daniel Stenberg, , et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at http://curl.haxx.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ***************************************************************************/ + +#include "timeval.h" + + +typedef enum { + TIMER_NONE, + TIMER_NAMELOOKUP, + TIMER_CONNECT, + TIMER_APPCONNECT, + TIMER_PRETRANSFER, + TIMER_STARTTRANSFER, + TIMER_POSTRANSFER, + TIMER_STARTSINGLE, + TIMER_REDIRECT, + TIMER_LAST /* must be last */ +} timerid; + +void Curl_pgrsDone(struct connectdata *); +void Curl_pgrsStartNow(struct SessionHandle *data); +void Curl_pgrsSetDownloadSize(struct SessionHandle *data, curl_off_t size); +void Curl_pgrsSetUploadSize(struct SessionHandle *data, curl_off_t size); +void Curl_pgrsSetDownloadCounter(struct SessionHandle *data, curl_off_t size); +void Curl_pgrsSetUploadCounter(struct SessionHandle *data, curl_off_t size); +int Curl_pgrsUpdate(struct connectdata *); +void Curl_pgrsResetTimes(struct SessionHandle *data); +void Curl_pgrsTime(struct SessionHandle *data, timerid timer); + + +/* Don't show progress for sizes smaller than: */ +#define LEAST_SIZE_PROGRESS BUFSIZE + +#define PROGRESS_DOWNLOAD (1<<0) +#define PROGRESS_UPLOAD (1<<1) +#define PROGRESS_DOWN_AND_UP (PROGRESS_UPLOAD | PROGRESS_DOWNLOAD) + +#define PGRS_SHOW_DL (1<<0) +#define PGRS_SHOW_UL (1<<1) +#define PGRS_DONE_DL (1<<2) +#define PGRS_DONE_UL (1<<3) +#define PGRS_HIDE (1<<4) +#define PGRS_UL_SIZE_KNOWN (1<<5) +#define PGRS_DL_SIZE_KNOWN (1<<6) + +#define PGRS_HEADERS_OUT (1<<7) /* set when the headers have been written */ + + +#endif /* __PROGRESS_H */ diff --git a/mobicore/common/curl/lib/qssl.c b/mobicore/common/curl/lib/qssl.c new file mode 100644 index 0000000000000000000000000000000000000000..dd4f911d1b5606773241b1d4b210fd38e55706da --- /dev/null +++ b/mobicore/common/curl/lib/qssl.c @@ -0,0 +1,501 @@ +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) 1998 - 2010, Daniel Stenberg, , et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at http://curl.haxx.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ***************************************************************************/ + +#include "setup.h" + +#ifdef USE_QSOSSL +#include +#include +#include +#ifdef HAVE_LIMITS_H +# include +#endif + +#include +#include "urldata.h" +#include "sendf.h" +#include "qssl.h" +#include "sslgen.h" +#include "connect.h" /* for the connect timeout */ +#include "select.h" +#include "curl_memory.h" +/* The last #include file should be: */ +#include "memdebug.h" + + +int Curl_qsossl_init(void) + +{ + /* Nothing to do here. We must have connection data to initialize ssl, so + * defer. + */ + + return 1; +} + + +void Curl_qsossl_cleanup(void) + +{ + /* Nothing to do. */ +} + + +static CURLcode Curl_qsossl_init_session(struct SessionHandle * data) + +{ + int rc; + char * certname; + SSLInit initstr; + SSLInitApp initappstr; + + /* Initialize the job for SSL according to the current parameters. + * QsoSSL offers two ways to do it: SSL_Init_Application() that uses an + * application identifier to select certificates in the main certificate + * store, and SSL_Init() that uses named keyring files and a password. + * It is not possible to have different keyrings for the CAs and the + * local certificate. We thus use the certificate name to identify the + * keyring if given, else the CA file name. + * If the key file name is given, it is taken as the password for the + * keyring in certificate file. + * We first try to SSL_Init_Application(), then SSL_Init() if it failed. + */ + + certname = data->set.str[STRING_CERT]; + + if(!certname) { + certname = data->set.str[STRING_SSL_CAFILE]; + + if(!certname) + return CURLE_OK; /* Use previous setup. */ + } + + memset((char *) &initappstr, 0, sizeof initappstr); + initappstr.applicationID = certname; + initappstr.applicationIDLen = strlen(certname); + initappstr.protocol = SSL_VERSION_CURRENT; /* TLSV1 compat. SSLV[23]. */ + initappstr.sessionType = SSL_REGISTERED_AS_CLIENT; + rc = SSL_Init_Application(&initappstr); + + if(rc == SSL_ERROR_NOT_REGISTERED) { + initstr.keyringFileName = certname; + initstr.keyringPassword = data->set.str[STRING_KEY]; + initstr.cipherSuiteList = NULL; /* Use default. */ + initstr.cipherSuiteListLen = 0; + rc = SSL_Init(&initstr); + } + + switch (rc) { + + case 0: /* No error. */ + break; + + case SSL_ERROR_IO: + failf(data, "SSL_Init() I/O error: %s", strerror(errno)); + return CURLE_SSL_CONNECT_ERROR; + + case SSL_ERROR_BAD_CIPHER_SUITE: + return CURLE_SSL_CIPHER; + + case SSL_ERROR_KEYPASSWORD_EXPIRED: + case SSL_ERROR_NOT_REGISTERED: + return CURLE_SSL_CONNECT_ERROR; + + case SSL_ERROR_NO_KEYRING: + return CURLE_SSL_CACERT; + + case SSL_ERROR_CERT_EXPIRED: + return CURLE_SSL_CERTPROBLEM; + + default: + failf(data, "SSL_Init(): %s", SSL_Strerror(rc, NULL)); + return CURLE_SSL_CONNECT_ERROR; + } + + return CURLE_OK; +} + + +static CURLcode Curl_qsossl_create(struct connectdata * conn, int sockindex) + +{ + SSLHandle * h; + struct ssl_connect_data * connssl = &conn->ssl[sockindex]; + + h = SSL_Create(conn->sock[sockindex], SSL_ENCRYPT); + + if(!h) { + failf(conn->data, "SSL_Create() I/O error: %s", strerror(errno)); + return CURLE_SSL_CONNECT_ERROR; + } + + connssl->handle = h; + return CURLE_OK; +} + + +static int Curl_qsossl_trap_cert(SSLHandle * h) + +{ + return 1; /* Accept certificate. */ +} + + +static CURLcode Curl_qsossl_handshake(struct connectdata * conn, int sockindex) + +{ + int rc; + struct SessionHandle * data = conn->data; + struct ssl_connect_data * connssl = &conn->ssl[sockindex]; + SSLHandle * h = connssl->handle; + long timeout_ms; + + h->exitPgm = NULL; + + if(!data->set.ssl.verifyhost) + h->exitPgm = Curl_qsossl_trap_cert; + + /* figure out how long time we should wait at maximum */ + timeout_ms = Curl_timeleft(conn, NULL, TRUE); + + if(timeout_ms < 0) { + /* time-out, bail out, go home */ + failf(data, "Connection time-out"); + return CURLE_OPERATION_TIMEDOUT; + } + + /* SSL_Handshake() timeout resolution is second, so round up. */ + h->timeout = (timeout_ms + 1000 - 1) / 1000; + + /* Set-up protocol. */ + + switch (data->set.ssl.version) { + + default: + case CURL_SSLVERSION_DEFAULT: + h->protocol = SSL_VERSION_CURRENT; /* TLSV1 compat. SSLV[23]. */ + break; + + case CURL_SSLVERSION_TLSv1: + h->protocol = TLS_VERSION_1; + break; + + case CURL_SSLVERSION_SSLv2: + h->protocol = SSL_VERSION_2; + break; + + case CURL_SSLVERSION_SSLv3: + h->protocol = SSL_VERSION_3; + break; + } + + rc = SSL_Handshake(h, SSL_HANDSHAKE_AS_CLIENT); + + switch (rc) { + + case 0: /* No error. */ + break; + + case SSL_ERROR_BAD_CERTIFICATE: + case SSL_ERROR_BAD_CERT_SIG: + case SSL_ERROR_NOT_TRUSTED_ROOT: + return CURLE_PEER_FAILED_VERIFICATION; + + case SSL_ERROR_BAD_CIPHER_SUITE: + case SSL_ERROR_NO_CIPHERS: + return CURLE_SSL_CIPHER; + + case SSL_ERROR_CERTIFICATE_REJECTED: + case SSL_ERROR_CERT_EXPIRED: + case SSL_ERROR_NO_CERTIFICATE: + return CURLE_SSL_CERTPROBLEM; + + case SSL_ERROR_IO: + failf(data, "SSL_Handshake() I/O error: %s", strerror(errno)); + return CURLE_SSL_CONNECT_ERROR; + + default: + failf(data, "SSL_Handshake(): %s", SSL_Strerror(rc, NULL)); + return CURLE_SSL_CONNECT_ERROR; + } + + return CURLE_OK; +} + + +static Curl_recv qsossl_recv; +static Curl_send qsossl_send; + +CURLcode Curl_qsossl_connect(struct connectdata * conn, int sockindex) + +{ + struct SessionHandle * data = conn->data; + struct ssl_connect_data * connssl = &conn->ssl[sockindex]; + int rc; + + rc = Curl_qsossl_init_session(data); + + if(rc == CURLE_OK) { + rc = Curl_qsossl_create(conn, sockindex); + + if(rc == CURLE_OK) + rc = Curl_qsossl_handshake(conn, sockindex); + else { + SSL_Destroy(connssl->handle); + connssl->handle = NULL; + connssl->use = FALSE; + connssl->state = ssl_connection_none; + } + } + if (rc == CURLE_OK) { + connssl->state = ssl_connection_complete; + conn->recv[sockindex] = qsossl_recv; + conn->send[sockindex] = qsossl_send; + } + + return rc; +} + + +static int Curl_qsossl_close_one(struct ssl_connect_data * conn, + struct SessionHandle * data) + +{ + int rc; + + if(!conn->handle) + return 0; + + rc = SSL_Destroy(conn->handle); + + if(rc) { + if(rc == SSL_ERROR_IO) { + failf(data, "SSL_Destroy() I/O error: %s", strerror(errno)); + return -1; + } + + /* An SSL error. */ + failf(data, "SSL_Destroy() returned error %s", SSL_Strerror(rc, NULL)); + return -1; + } + + conn->handle = NULL; + return 0; +} + + +void Curl_qsossl_close(struct connectdata *conn, int sockindex) + +{ + struct SessionHandle *data = conn->data; + struct ssl_connect_data *connssl = &conn->ssl[sockindex]; + + if(connssl->use) + (void) Curl_qsossl_close_one(connssl, data); +} + + +int Curl_qsossl_close_all(struct SessionHandle * data) + +{ + /* Unimplemented. */ + (void) data; + return 0; +} + + +int Curl_qsossl_shutdown(struct connectdata * conn, int sockindex) + +{ + struct ssl_connect_data * connssl = &conn->ssl[sockindex]; + struct SessionHandle *data = conn->data; + ssize_t nread; + int what; + int rc; + char buf[120]; + + if(!connssl->handle) + return 0; + + if(data->set.ftp_ccc != CURLFTPSSL_CCC_ACTIVE) + return 0; + + if(Curl_qsossl_close_one(connssl, data)) + return -1; + + rc = 0; + + what = Curl_socket_ready(conn->sock[sockindex], + CURL_SOCKET_BAD, SSL_SHUTDOWN_TIMEOUT); + + for (;;) { + if(what < 0) { + /* anything that gets here is fatally bad */ + failf(data, "select/poll on SSL socket, errno: %d", SOCKERRNO); + rc = -1; + break; + } + + if(!what) { /* timeout */ + failf(data, "SSL shutdown timeout"); + break; + } + + /* Something to read, let's do it and hope that it is the close + notify alert from the server. No way to SSL_Read now, so use read(). */ + + nread = read(conn->sock[sockindex], buf, sizeof(buf)); + + if(nread < 0) { + failf(data, "read: %s", strerror(errno)); + rc = -1; + } + + if(nread <= 0) + break; + + what = Curl_socket_ready(conn->sock[sockindex], CURL_SOCKET_BAD, 0); + } + + return rc; +} + + +static ssize_t qsossl_send(struct connectdata * conn, int sockindex, + const void * mem, size_t len, CURLcode * curlcode) + +{ + /* SSL_Write() is said to return 'int' while write() and send() returns + 'size_t' */ + int rc; + + rc = SSL_Write(conn->ssl[sockindex].handle, (void *) mem, (int) len); + + if(rc < 0) { + switch(rc) { + + case SSL_ERROR_BAD_STATE: + /* The operation did not complete; the same SSL I/O function + should be called again later. This is basicly an EWOULDBLOCK + equivalent. */ + *curlcode = CURLE_AGAIN; + return -1; + + case SSL_ERROR_IO: + switch (errno) { + case EWOULDBLOCK: + case EINTR: + *curlcode = CURLE_AGAIN; + return -1; + } + + failf(conn->data, "SSL_Write() I/O error: %s", strerror(errno)); + *curlcode = CURLE_SEND_ERROR; + return -1; + } + + /* An SSL error. */ + failf(conn->data, "SSL_Write() returned error %s", + SSL_Strerror(rc, NULL)); + *curlcode = CURLE_SEND_ERROR; + return -1; + } + + return (ssize_t) rc; /* number of bytes */ +} + + +static ssize_t qsossl_recv(struct connectdata * conn, int num, char * buf, + size_t buffersize, CURLcode * curlcode) + +{ + char error_buffer[120]; /* OpenSSL documents that this must be at + least 120 bytes long. */ + unsigned long sslerror; + int buffsize; + int nread; + + buffsize = (buffersize > (size_t)INT_MAX) ? INT_MAX : (int)buffersize; + nread = SSL_Read(conn->ssl[num].handle, buf, buffsize); + + if(nread < 0) { + /* failed SSL_read */ + + switch (nread) { + + case SSL_ERROR_BAD_STATE: + /* there's data pending, re-invoke SSL_Read(). */ + *curlcode = CURLE_AGAIN; + return -1; + + case SSL_ERROR_IO: + switch (errno) { + case EWOULDBLOCK: + *curlcode = CURLE_AGAIN; + return -1; + } + + failf(conn->data, "SSL_Read() I/O error: %s", strerror(errno)); + *curlcode = CURLE_RECV_ERROR; + return -1; + + default: + failf(conn->data, "SSL read error: %s", SSL_Strerror(nread, NULL)); + *curlcode = CURLE_RECV_ERROR; + return -1; + } + } + return (ssize_t) nread; +} + + +size_t Curl_qsossl_version(char * buffer, size_t size) + +{ + strncpy(buffer, "IBM OS/400 SSL", size); + return strlen(buffer); +} + + +int Curl_qsossl_check_cxn(struct connectdata * cxn) + +{ + int err; + int errlen; + + /* The only thing that can be tested here is at the socket level. */ + + if(!cxn->ssl[FIRSTSOCKET].handle) + return 0; /* connection has been closed */ + + err = 0; + errlen = sizeof err; + + if(getsockopt(cxn->sock[FIRSTSOCKET], SOL_SOCKET, SO_ERROR, + (unsigned char *) &err, &errlen) || + errlen != sizeof err || err) + return 0; /* connection has been closed */ + + return -1; /* connection status unknown */ +} + +#endif /* USE_QSOSSL */ diff --git a/mobicore/common/curl/lib/qssl.h b/mobicore/common/curl/lib/qssl.h new file mode 100644 index 0000000000000000000000000000000000000000..45190e6238fea25a94d6401ebe8d029f2fd2e761 --- /dev/null +++ b/mobicore/common/curl/lib/qssl.h @@ -0,0 +1,59 @@ +#ifndef __QSSL_H +#define __QSSL_H +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) 1998 - 2008, Daniel Stenberg, , et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at http://curl.haxx.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ***************************************************************************/ + +/* + * This header should only be needed to get included by sslgen.c and qssl.c + */ + +#include "urldata.h" + +#ifdef USE_QSOSSL +int Curl_qsossl_init(void); +void Curl_qsossl_cleanup(void); +CURLcode Curl_qsossl_connect(struct connectdata * conn, int sockindex); +void Curl_qsossl_close(struct connectdata *conn, int sockindex); +int Curl_qsossl_close_all(struct SessionHandle * data); +int Curl_qsossl_shutdown(struct connectdata * conn, int sockindex); + +size_t Curl_qsossl_version(char * buffer, size_t size); +int Curl_qsossl_check_cxn(struct connectdata * cxn); + +/* API setup for QsoSSL */ +#define curlssl_init Curl_qsossl_init +#define curlssl_cleanup Curl_qsossl_cleanup +#define curlssl_connect Curl_qsossl_connect + +/* No session handling for QsoSSL */ +#define curlssl_session_free(x) +#define curlssl_close_all Curl_qsossl_close_all +#define curlssl_close Curl_qsossl_close +#define curlssl_shutdown(x,y) Curl_qsossl_shutdown(x,y) +#define curlssl_set_engine(x,y) CURLE_FAILED_INIT +#define curlssl_set_engine_default(x) CURLE_FAILED_INIT +#define curlssl_engines_list(x) NULL +#define curlssl_version Curl_qsossl_version +#define curlssl_check_cxn(x) Curl_qsossl_check_cxn(x) +#define curlssl_data_pending(x,y) 0 +#endif /* USE_QSOSSL */ +#endif diff --git a/mobicore/common/curl/lib/rawstr.c b/mobicore/common/curl/lib/rawstr.c new file mode 100644 index 0000000000000000000000000000000000000000..f3b302dc1729bd20f68467d9e22e1435ca20bcd7 --- /dev/null +++ b/mobicore/common/curl/lib/rawstr.c @@ -0,0 +1,142 @@ +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) 1998 - 2009, Daniel Stenberg, , et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at http://curl.haxx.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ***************************************************************************/ + +#include "setup.h" + +#include "rawstr.h" + +/* Portable, consistent toupper (remember EBCDIC). Do not use toupper() because + its behavior is altered by the current locale. */ +char Curl_raw_toupper(char in) +{ + switch (in) { + case 'a': + return 'A'; + case 'b': + return 'B'; + case 'c': + return 'C'; + case 'd': + return 'D'; + case 'e': + return 'E'; + case 'f': + return 'F'; + case 'g': + return 'G'; + case 'h': + return 'H'; + case 'i': + return 'I'; + case 'j': + return 'J'; + case 'k': + return 'K'; + case 'l': + return 'L'; + case 'm': + return 'M'; + case 'n': + return 'N'; + case 'o': + return 'O'; + case 'p': + return 'P'; + case 'q': + return 'Q'; + case 'r': + return 'R'; + case 's': + return 'S'; + case 't': + return 'T'; + case 'u': + return 'U'; + case 'v': + return 'V'; + case 'w': + return 'W'; + case 'x': + return 'X'; + case 'y': + return 'Y'; + case 'z': + return 'Z'; + } + return in; +} + +/* + * Curl_raw_equal() is for doing "raw" case insensitive strings. This is meant + * to be locale independent and only compare strings we know are safe for + * this. See http://daniel.haxx.se/blog/2008/10/15/strcasecmp-in-turkish/ for + * some further explanation to why this function is necessary. + * + * The function is capable of comparing a-z case insensitively even for + * non-ascii. + */ + +int Curl_raw_equal(const char *first, const char *second) +{ + while(*first && *second) { + if(Curl_raw_toupper(*first) != Curl_raw_toupper(*second)) + /* get out of the loop as soon as they don't match */ + break; + first++; + second++; + } + /* we do the comparison here (possibly again), just to make sure that if the + loop above is skipped because one of the strings reached zero, we must not + return this as a successful match */ + return (Curl_raw_toupper(*first) == Curl_raw_toupper(*second)); +} + +int Curl_raw_nequal(const char *first, const char *second, size_t max) +{ + while(*first && *second && max) { + if(Curl_raw_toupper(*first) != Curl_raw_toupper(*second)) { + break; + } + max--; + first++; + second++; + } + if(0 == max) + return 1; /* they are equal this far */ + + return Curl_raw_toupper(*first) == Curl_raw_toupper(*second); +} + +/* Copy an upper case version of the string from src to dest. The + * strings may overlap. No more than n characters of the string are copied + * (including any NUL) and the destination string will NOT be + * NUL-terminated if that limit is reached. + */ +void Curl_strntoupper(char *dest, const char *src, size_t n) +{ + if (n < 1) + return; + + do { + *dest++ = Curl_raw_toupper(*src); + } while (*src++ && --n); +} diff --git a/mobicore/common/curl/lib/rawstr.h b/mobicore/common/curl/lib/rawstr.h new file mode 100644 index 0000000000000000000000000000000000000000..7e9747a7973cf61a0c4257cdcacb1ae9381f46a3 --- /dev/null +++ b/mobicore/common/curl/lib/rawstr.h @@ -0,0 +1,44 @@ +#ifndef __RAWSTR_H +#define __RAWSTR_H +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) 1998 - 2009, Daniel Stenberg, , et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at http://curl.haxx.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ***************************************************************************/ + +#include + +/* + * Curl_raw_equal() is for doing "raw" case insensitive strings. This is meant + * to be locale independent and only compare strings we know are safe for + * this. + * + * The function is capable of comparing a-z case insensitively even for non-ascii. + */ +int Curl_raw_equal(const char *first, const char *second); +int Curl_raw_nequal(const char *first, const char *second, size_t max); + +char Curl_raw_toupper(char in); + +/* checkprefix() is a shorter version of the above, used when the first + argument is zero-byte terminated */ +#define checkprefix(a,b) Curl_raw_nequal(a,b,strlen(a)) + +#endif +void Curl_strntoupper(char *dest, const char *src, size_t n); diff --git a/mobicore/common/curl/lib/rtsp.c b/mobicore/common/curl/lib/rtsp.c new file mode 100644 index 0000000000000000000000000000000000000000..066e10fe3a7d868d838289bb5f70ca628144f2fd --- /dev/null +++ b/mobicore/common/curl/lib/rtsp.c @@ -0,0 +1,753 @@ +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) 1998 - 2010, Daniel Stenberg, , et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at http://curl.haxx.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ***************************************************************************/ + +#include "setup.h" + +#ifndef CURL_DISABLE_RTSP + +#include "urldata.h" +#include +#include "transfer.h" +#include "sendf.h" +#include "easyif.h" /* for Curl_convert_... prototypes */ +#include "multiif.h" +#include "http.h" +#include "url.h" +#include "progress.h" +#include "rtsp.h" +#include "rawstr.h" +#include "curl_memory.h" + +#define _MPRINTF_REPLACE /* use our functions only */ +#include + +/* The last #include file should be: */ +#include "memdebug.h" + +/* + * TODO (general) + * -incoming server requests + * -server CSeq counter + * -digest authentication + * -connect thru proxy + * -pipelining? + */ + + +#define RTP_PKT_CHANNEL(p) ((int)((unsigned char)((p)[1]))) + +#define RTP_PKT_LENGTH(p) ((((int)((unsigned char)((p)[2]))) << 8) | \ + ((int)((unsigned char)((p)[3])))) + +static int rtsp_getsock_do(struct connectdata *conn, + curl_socket_t *socks, + int numsocks); + +/* this returns the socket to wait for in the DO and DOING state for the multi + interface and then we're always _sending_ a request and thus we wait for + the single socket to become writable only */ +static int rtsp_getsock_do(struct connectdata *conn, + curl_socket_t *socks, + int numsocks) +{ + /* write mode */ + (void)numsocks; /* unused, we trust it to be at least 1 */ + socks[0] = conn->sock[FIRSTSOCKET]; + return GETSOCK_WRITESOCK(0); +} + +static +CURLcode rtp_client_write(struct connectdata *conn, char *ptr, size_t len); + + +/* + * RTSP handler interface. + */ +const struct Curl_handler Curl_handler_rtsp = { + "RTSP", /* scheme */ + ZERO_NULL, /* setup_connection */ + Curl_rtsp, /* do_it */ + Curl_rtsp_done, /* done */ + ZERO_NULL, /* do_more */ + Curl_rtsp_connect, /* connect_it */ + ZERO_NULL, /* connecting */ + ZERO_NULL, /* doing */ + ZERO_NULL, /* proto_getsock */ + rtsp_getsock_do, /* doing_getsock */ + ZERO_NULL, /* perform_getsock */ + Curl_rtsp_disconnect, /* disconnect */ + PORT_RTSP, /* defport */ + PROT_RTSP, /* protocol */ +}; + +CURLcode Curl_rtsp_connect(struct connectdata *conn, bool *done) +{ + CURLcode httpStatus; + struct SessionHandle *data = conn->data; + + httpStatus = Curl_http_connect(conn, done); + + /* Initialize the CSeq if not already done */ + if(data->state.rtsp_next_client_CSeq == 0) + data->state.rtsp_next_client_CSeq = 1; + if(data->state.rtsp_next_server_CSeq == 0) + data->state.rtsp_next_server_CSeq = 1; + + conn->proto.rtspc.rtp_channel = -1; + + return httpStatus; +} + +CURLcode Curl_rtsp_disconnect(struct connectdata *conn, bool dead_connection) +{ + (void) dead_connection; + Curl_safefree(conn->proto.rtspc.rtp_buf); + return CURLE_OK; +} + + +CURLcode Curl_rtsp_done(struct connectdata *conn, + CURLcode status, bool premature) +{ + struct SessionHandle *data = conn->data; + struct RTSP *rtsp = data->state.proto.rtsp; + CURLcode httpStatus; + long CSeq_sent; + long CSeq_recv; + + /* Bypass HTTP empty-reply checks on receive */ + if(data->set.rtspreq == RTSPREQ_RECEIVE) + premature = TRUE; + + httpStatus = Curl_http_done(conn, status, premature); + + if(rtsp) { + /* Check the sequence numbers */ + CSeq_sent = rtsp->CSeq_sent; + CSeq_recv = rtsp->CSeq_recv; + if((data->set.rtspreq != RTSPREQ_RECEIVE) && (CSeq_sent != CSeq_recv)) { + failf(data, "The CSeq of this request %ld did not match the response %ld", + CSeq_sent, CSeq_recv); + return CURLE_RTSP_CSEQ_ERROR; + } + else if(data->set.rtspreq == RTSPREQ_RECEIVE && + (conn->proto.rtspc.rtp_channel == -1)) { + infof(data, "Got an RTP Receive with a CSeq of %ld\n", CSeq_recv); + /* TODO CPC: Server -> Client logic here */ + } + } + + return httpStatus; +} + +CURLcode Curl_rtsp(struct connectdata *conn, bool *done) +{ + struct SessionHandle *data = conn->data; + CURLcode result=CURLE_OK; + Curl_RtspReq rtspreq = data->set.rtspreq; + struct RTSP *rtsp; + struct HTTP *http; + Curl_send_buffer *req_buffer; + curl_off_t postsize = 0; /* for ANNOUNCE and SET_PARAMETER */ + curl_off_t putsize = 0; /* for ANNOUNCE and SET_PARAMETER */ + + const char *p_request = NULL; + const char *p_session_id = NULL; + const char *p_accept = NULL; + const char *p_accept_encoding = NULL; + const char *p_range = NULL; + const char *p_referrer = NULL; + const char *p_stream_uri = NULL; + const char *p_transport = NULL; + const char *p_uagent = NULL; + + *done = TRUE; + + Curl_reset_reqproto(conn); + + if(!data->state.proto.rtsp) { + /* Only allocate this struct if we don't already have it! */ + + rtsp = calloc(1, sizeof(struct RTSP)); + if(!rtsp) + return CURLE_OUT_OF_MEMORY; + data->state.proto.rtsp = rtsp; + } + else { + rtsp = data->state.proto.rtsp; + } + + http = &(rtsp->http_wrapper); + /* Assert that no one has changed the RTSP struct in an evil way */ + DEBUGASSERT((void *)http == (void *)rtsp); + + rtsp->CSeq_sent = data->state.rtsp_next_client_CSeq; + rtsp->CSeq_recv = 0; + + /* Setup the 'p_request' pointer to the proper p_request string + * Since all RTSP requests are included here, there is no need to + * support custom requests like HTTP. + **/ + DEBUGASSERT((rtspreq > RTSPREQ_NONE && rtspreq < RTSPREQ_LAST)); + data->set.opt_no_body = TRUE; /* most requests don't contain a body */ + switch(rtspreq) { + case RTSPREQ_NONE: + failf(data, "Got invalid RTSP request: RTSPREQ_NONE"); + return CURLE_BAD_FUNCTION_ARGUMENT; + case RTSPREQ_OPTIONS: + p_request = "OPTIONS"; + break; + case RTSPREQ_DESCRIBE: + p_request = "DESCRIBE"; + data->set.opt_no_body = FALSE; + break; + case RTSPREQ_ANNOUNCE: + p_request = "ANNOUNCE"; + break; + case RTSPREQ_SETUP: + p_request = "SETUP"; + break; + case RTSPREQ_PLAY: + p_request = "PLAY"; + break; + case RTSPREQ_PAUSE: + p_request = "PAUSE"; + break; + case RTSPREQ_TEARDOWN: + p_request = "TEARDOWN"; + break; + case RTSPREQ_GET_PARAMETER: + /* GET_PARAMETER's no_body status is determined later */ + p_request = "GET_PARAMETER"; + break; + case RTSPREQ_SET_PARAMETER: + p_request = "SET_PARAMETER"; + break; + case RTSPREQ_RECORD: + p_request = "RECORD"; + break; + case RTSPREQ_RECEIVE: + p_request = ""; + /* Treat interleaved RTP as body*/ + data->set.opt_no_body = FALSE; + break; + case RTSPREQ_LAST: + failf(data, "Got invalid RTSP request: RTSPREQ_LAST"); + return CURLE_BAD_FUNCTION_ARGUMENT; + } + + if(rtspreq == RTSPREQ_RECEIVE) { + Curl_setup_transfer(conn, FIRSTSOCKET, -1, TRUE, + &http->readbytecount, -1, NULL); + + return result; + } + + p_session_id = data->set.str[STRING_RTSP_SESSION_ID]; + if(!p_session_id && + (rtspreq & ~(RTSPREQ_OPTIONS | RTSPREQ_DESCRIBE | RTSPREQ_SETUP))) { + failf(data, "Refusing to issue an RTSP request [%s] without a session ID.", + p_request ? p_request : ""); + return CURLE_BAD_FUNCTION_ARGUMENT; + } + + /* TODO: auth? */ + /* TODO: proxy? */ + + /* Stream URI. Default to server '*' if not specified */ + if(data->set.str[STRING_RTSP_STREAM_URI]) { + p_stream_uri = data->set.str[STRING_RTSP_STREAM_URI]; + } + else { + p_stream_uri = "*"; + } + + /* Transport Header for SETUP requests */ + p_transport = Curl_checkheaders(data, "Transport:"); + if(rtspreq == RTSPREQ_SETUP && !p_transport) { + /* New Transport: setting? */ + if(data->set.str[STRING_RTSP_TRANSPORT]) { + Curl_safefree(conn->allocptr.rtsp_transport); + + conn->allocptr.rtsp_transport = + aprintf("Transport: %s\r\n", + data->set.str[STRING_RTSP_TRANSPORT]); + if(!conn->allocptr.rtsp_transport) + return CURLE_OUT_OF_MEMORY; + } + else { + failf(data, + "Refusing to issue an RTSP SETUP without a Transport: header."); + return CURLE_BAD_FUNCTION_ARGUMENT; + } + + p_transport = conn->allocptr.rtsp_transport; + } + + /* Accept Headers for DESCRIBE requests */ + if(rtspreq == RTSPREQ_DESCRIBE) { + /* Accept Header */ + p_accept = Curl_checkheaders(data, "Accept:")? + NULL:"Accept: application/sdp\r\n"; + + /* Accept-Encoding header */ + if(!Curl_checkheaders(data, "Accept-Encoding:") && + data->set.str[STRING_ENCODING]) { + Curl_safefree(conn->allocptr.accept_encoding); + conn->allocptr.accept_encoding = + aprintf("Accept-Encoding: %s\r\n", data->set.str[STRING_ENCODING]); + + if(!conn->allocptr.accept_encoding) + return CURLE_OUT_OF_MEMORY; + + p_accept_encoding = conn->allocptr.accept_encoding; + } + } + + /* The User-Agent string might have been allocated in url.c already, because + it might have been used in the proxy connect, but if we have got a header + with the user-agent string specified, we erase the previously made string + here. */ + if(Curl_checkheaders(data, "User-Agent:") && conn->allocptr.uagent) { + Curl_safefree(conn->allocptr.uagent); + conn->allocptr.uagent = NULL; + } + else if(!Curl_checkheaders(data, "User-Agent:") && + data->set.str[STRING_USERAGENT]) { + p_uagent = conn->allocptr.uagent; + } + + /* Referrer */ + Curl_safefree(conn->allocptr.ref); + if(data->change.referer && !Curl_checkheaders(data, "Referer:")) + conn->allocptr.ref = aprintf("Referer: %s\r\n", data->change.referer); + else + conn->allocptr.ref = NULL; + + p_referrer = conn->allocptr.ref; + + /* + * Range Header + * Only applies to PLAY, PAUSE, RECORD + * + * Go ahead and use the Range stuff supplied for HTTP + */ + if(data->state.use_range && + (rtspreq & (RTSPREQ_PLAY | RTSPREQ_PAUSE | RTSPREQ_RECORD))) { + + /* Check to see if there is a range set in the custom headers */ + if(!Curl_checkheaders(data, "Range:") && data->state.range) { + Curl_safefree(conn->allocptr.rangeline); + conn->allocptr.rangeline = aprintf("Range: %s\r\n", data->state.range); + p_range = conn->allocptr.rangeline; + } + } + + /* + * Sanity check the custom headers + */ + if(Curl_checkheaders(data, "CSeq:")) { + failf(data, "CSeq cannot be set as a custom header."); + return CURLE_RTSP_CSEQ_ERROR; + } + if(Curl_checkheaders(data, "Session:")) { + failf(data, "Session ID cannot be set as a custom header."); + return CURLE_BAD_FUNCTION_ARGUMENT; + } + + /* Initialize a dynamic send buffer */ + req_buffer = Curl_add_buffer_init(); + + if(!req_buffer) + return CURLE_OUT_OF_MEMORY; + + result = + Curl_add_bufferf(req_buffer, + "%s %s RTSP/1.0\r\n" /* Request Stream-URI RTSP/1.0 */ + "CSeq: %ld\r\n", /* CSeq */ + (p_request ? p_request : ""), p_stream_uri, + rtsp->CSeq_sent); + if(result) + return result; + + /* + * Rather than do a normal alloc line, keep the session_id unformatted + * to make comparison easier + */ + if(p_session_id) { + result = Curl_add_bufferf(req_buffer, "Session: %s\r\n", p_session_id); + if(result) + return result; + } + + /* + * Shared HTTP-like options + */ + result = Curl_add_bufferf(req_buffer, + "%s" /* transport */ + "%s" /* accept */ + "%s" /* accept-encoding */ + "%s" /* range */ + "%s" /* referrer */ + "%s" /* user-agent */ + , + p_transport ? p_transport : "", + p_accept ? p_accept : "", + p_accept_encoding ? p_accept_encoding : "", + p_range ? p_range : "", + p_referrer ? p_referrer : "", + p_uagent ? p_uagent : ""); + if(result) + return result; + + if((rtspreq == RTSPREQ_SETUP) || (rtspreq == RTSPREQ_DESCRIBE)) { + result = Curl_add_timecondition(data, req_buffer); + if(result) + return result; + } + + result = Curl_add_custom_headers(conn, req_buffer); + if(result) + return result; + + if(rtspreq == RTSPREQ_ANNOUNCE || + rtspreq == RTSPREQ_SET_PARAMETER || + rtspreq == RTSPREQ_GET_PARAMETER) { + + if(data->set.upload) { + putsize = data->set.infilesize; + data->set.httpreq = HTTPREQ_PUT; + + } + else { + postsize = (data->set.postfieldsize != -1)? + data->set.postfieldsize: + (data->set.postfields? (curl_off_t)strlen(data->set.postfields):0); + data->set.httpreq = HTTPREQ_POST; + } + + if(putsize > 0 || postsize > 0) { + /* As stated in the http comments, it is probably not wise to + * actually set a custom Content-Length in the headers */ + if(!Curl_checkheaders(data, "Content-Length:")) { + result = Curl_add_bufferf(req_buffer, + "Content-Length: %" FORMAT_OFF_T"\r\n", + (data->set.upload ? putsize : postsize)); + if(result) + return result; + } + + if(rtspreq == RTSPREQ_SET_PARAMETER || + rtspreq == RTSPREQ_GET_PARAMETER) { + if(!Curl_checkheaders(data, "Content-Type:")) { + result = Curl_add_bufferf(req_buffer, + "Content-Type: text/parameters\r\n"); + if(result) + return result; + } + } + + if(rtspreq == RTSPREQ_ANNOUNCE) { + if(!Curl_checkheaders(data, "Content-Type:")) { + result = Curl_add_bufferf(req_buffer, + "Content-Type: application/sdp\r\n"); + if(result) + return result; + } + } + + data->state.expect100header = FALSE; /* RTSP posts are simple/small */ + } else if(rtspreq == RTSPREQ_GET_PARAMETER) { + /* Check for an empty GET_PARAMETER (heartbeat) request */ + data->set.httpreq = HTTPREQ_HEAD; + data->set.opt_no_body = TRUE; + } + } + + /* RTSP never allows chunked transfer */ + data->req.forbidchunk = TRUE; + /* Finish the request buffer */ + result = Curl_add_buffer(req_buffer, "\r\n", 2); + if(result) + return result; + + if(postsize > 0) { + result = Curl_add_buffer(req_buffer, data->set.postfields, + (size_t)postsize); + if(result) + return result; + } + + /* issue the request */ + result = Curl_add_buffer_send(req_buffer, conn, + &data->info.request_size, 0, FIRSTSOCKET); + if(result) { + failf(data, "Failed sending RTSP request"); + return result; + } + + Curl_setup_transfer(conn, FIRSTSOCKET, -1, TRUE, &http->readbytecount, + putsize?FIRSTSOCKET:-1, + putsize?&http->writebytecount:NULL); + + /* Increment the CSeq on success */ + data->state.rtsp_next_client_CSeq++; + + if(http->writebytecount) { + /* if a request-body has been sent off, we make sure this progress is + noted properly */ + Curl_pgrsSetUploadCounter(data, http->writebytecount); + if(Curl_pgrsUpdate(conn)) + result = CURLE_ABORTED_BY_CALLBACK; + } + + return result; +} + +CURLcode Curl_rtsp_rtp_readwrite(struct SessionHandle *data, + struct connectdata *conn, + ssize_t *nread, + bool *readmore) { + struct SingleRequest *k = &data->req; + struct rtsp_conn *rtspc = &(conn->proto.rtspc); + + char *rtp; /* moving pointer to rtp data */ + ssize_t rtp_dataleft; /* how much data left to parse in this round */ + char *scratch; + CURLcode result; + + if(rtspc->rtp_buf) { + /* There was some leftover data the last time. Merge buffers */ + char *newptr = realloc(rtspc->rtp_buf, rtspc->rtp_bufsize + *nread); + if(!newptr) { + Curl_safefree(rtspc->rtp_buf); + rtspc->rtp_buf = NULL; + rtspc->rtp_bufsize = 0; + return CURLE_OUT_OF_MEMORY; + } + rtspc->rtp_buf = newptr; + memcpy(rtspc->rtp_buf + rtspc->rtp_bufsize, k->str, *nread); + rtspc->rtp_bufsize += *nread; + rtp = rtspc->rtp_buf; + rtp_dataleft = rtspc->rtp_bufsize; + } + else { + /* Just parse the request buffer directly */ + rtp = k->str; + rtp_dataleft = *nread; + } + + while((rtp_dataleft > 0) && + (rtp[0] == '$')) { + if(rtp_dataleft > 4) { + int rtp_length; + + /* Parse the header */ + /* The channel identifier immediately follows and is 1 byte */ + rtspc->rtp_channel = RTP_PKT_CHANNEL(rtp); + + /* The length is two bytes */ + rtp_length = RTP_PKT_LENGTH(rtp); + + if(rtp_dataleft < rtp_length + 4) { + /* Need more - incomplete payload*/ + *readmore = TRUE; + break; + } + else { + /* We have the full RTP interleaved packet + * Write out the header including the leading '$' */ + DEBUGF(infof(data, "RTP write channel %d rtp_length %d\n", + rtspc->rtp_channel, rtp_length)); + result = rtp_client_write(conn, &rtp[0], rtp_length + 4); + if(result) { + failf(data, "Got an error writing an RTP packet"); + *readmore = FALSE; + Curl_safefree(rtspc->rtp_buf); + rtspc->rtp_buf = NULL; + rtspc->rtp_bufsize = 0; + return result; + } + + /* Move forward in the buffer */ + rtp_dataleft -= rtp_length + 4; + rtp += rtp_length + 4; + + if(data->set.rtspreq == RTSPREQ_RECEIVE) { + /* If we are in a passive receive, give control back + * to the app as often as we can. + */ + k->keepon &= ~KEEP_RECV; + } + } + } + else { + /* Need more - incomplete header */ + *readmore = TRUE; + break; + } + } + + if(rtp_dataleft != 0 && rtp[0] == '$') { + DEBUGF(infof(data, "RTP Rewinding %zu %s\n", rtp_dataleft, + *readmore ? "(READMORE)" : "")); + + /* Store the incomplete RTP packet for a "rewind" */ + scratch = malloc(rtp_dataleft); + if(!scratch) { + Curl_safefree(rtspc->rtp_buf); + rtspc->rtp_buf = NULL; + rtspc->rtp_bufsize = 0; + return CURLE_OUT_OF_MEMORY; + } + memcpy(scratch, rtp, rtp_dataleft); + Curl_safefree(rtspc->rtp_buf); + rtspc->rtp_buf = scratch; + rtspc->rtp_bufsize = rtp_dataleft; + + /* As far as the transfer is concerned, this data is consumed */ + *nread = 0; + return CURLE_OK; + } + else { + /* Fix up k->str to point just after the last RTP packet */ + k->str += *nread - rtp_dataleft; + + /* either all of the data has been read or... + * rtp now points at the next byte to parse + */ + if(rtp_dataleft > 0) + DEBUGASSERT(k->str[0] == rtp[0]); + + DEBUGASSERT(rtp_dataleft <= *nread); /* sanity check */ + + *nread = rtp_dataleft; + } + + /* If we get here, we have finished with the leftover/merge buffer */ + Curl_safefree(rtspc->rtp_buf); + rtspc->rtp_buf = NULL; + rtspc->rtp_bufsize = 0; + + return CURLE_OK; +} + +static +CURLcode rtp_client_write(struct connectdata *conn, char *ptr, size_t len) +{ + struct SessionHandle *data = conn->data; + size_t wrote; + curl_write_callback writeit; + + if(len == 0) { + failf (data, "Cannot write a 0 size RTP packet."); + return CURLE_WRITE_ERROR; + } + + writeit = data->set.fwrite_rtp?data->set.fwrite_rtp:data->set.fwrite_func; + wrote = writeit(ptr, 1, len, data->set.rtp_out); + + if(CURL_WRITEFUNC_PAUSE == wrote) { + failf (data, "Cannot pause RTP"); + return CURLE_WRITE_ERROR; + } + + if(wrote != len) { + failf (data, "Failed writing RTP data"); + return CURLE_WRITE_ERROR; + } + + return CURLE_OK; +} + +CURLcode Curl_rtsp_parseheader(struct connectdata *conn, + char *header) +{ + struct SessionHandle *data = conn->data; + long CSeq = 0; + + if(checkprefix("CSeq:", header)) { + /* Store the received CSeq. Match is verified in rtsp_done */ + int nc; + char *temp = strdup(header); + if(!temp) + return CURLE_OUT_OF_MEMORY; + Curl_strntoupper(temp, temp, sizeof(temp)); + nc = sscanf(temp, "CSEQ: %ld", &CSeq); + free(temp); + if(nc == 1) { + data->state.proto.rtsp->CSeq_recv = CSeq; /* mark the request */ + data->state.rtsp_CSeq_recv = CSeq; /* update the handle */ + } + else { + failf(data, "Unable to read the CSeq header: [%s]", header); + return CURLE_RTSP_CSEQ_ERROR; + } + } + else if(checkprefix("Session:", header)) { + char *start; + + /* Find the first non-space letter */ + start = header + 9; + while(*start && ISSPACE(*start)) + start++; + + if(!*start) { + failf(data, "Got a blank Session ID"); + } + else if(data->set.str[STRING_RTSP_SESSION_ID]) { + /* If the Session ID is set, then compare */ + if(strncmp(start, data->set.str[STRING_RTSP_SESSION_ID], + strlen(data->set.str[STRING_RTSP_SESSION_ID])) != 0) { + failf(data, "Got RTSP Session ID Line [%s], but wanted ID [%s]", + start, data->set.str[STRING_RTSP_SESSION_ID]); + return CURLE_RTSP_SESSION_ERROR; + } + } + else { + /* If the Session ID is not set, and we find it in a response, then + set it */ + + /* The session ID can be an alphanumeric or a 'safe' character + * + * RFC 2326 15.1 Base Syntax: + * safe = "\$" | "-" | "_" | "." | "+" + * */ + char *end = start; + while(*end && + (ISALNUM(*end) || *end == '-' || *end == '_' || *end == '.' || + *end == '+' || + (*end == '\\' && *(end + 1) && *(end + 1) == '$' && (++end, 1)))) + end++; + + /* Copy the id substring into a new buffer */ + data->set.str[STRING_RTSP_SESSION_ID] = malloc(end - start + 1); + if(data->set.str[STRING_RTSP_SESSION_ID] == NULL) + return CURLE_OUT_OF_MEMORY; + memcpy(data->set.str[STRING_RTSP_SESSION_ID], start, end - start); + (data->set.str[STRING_RTSP_SESSION_ID])[end - start] = '\0'; + } + } + return CURLE_OK; +} + +#endif /* CURL_DISABLE_RTSP */ diff --git a/mobicore/common/curl/lib/rtsp.h b/mobicore/common/curl/lib/rtsp.h new file mode 100644 index 0000000000000000000000000000000000000000..82e07068d535e6b1f33b2fdf457033c02e8bab32 --- /dev/null +++ b/mobicore/common/curl/lib/rtsp.h @@ -0,0 +1,82 @@ +#ifndef __RTSP_H_ +#define __RTSP_H_ + +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) 1998 - 2010, Daniel Stenberg, , et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at http://curl.haxx.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ***************************************************************************/ +#ifndef CURL_DISABLE_RTSP + +extern const struct Curl_handler Curl_handler_rtsp; + +/* + * Parse and write out any available RTP data. + * + * nread: amount of data left after k->str. will be modified if RTP + * data is parsed and k->str is moved up + * readmore: whether or not the RTP parser needs more data right away + */ +CURLcode Curl_rtsp_rtp_readwrite(struct SessionHandle *data, + struct connectdata *conn, + ssize_t *nread, + bool *readmore); + + +/* protocol-specific functions set up to be called by the main engine */ +CURLcode Curl_rtsp(struct connectdata *conn, bool *done); +CURLcode Curl_rtsp_done(struct connectdata *conn, CURLcode, bool premature); +CURLcode Curl_rtsp_connect(struct connectdata *conn, bool *done); +CURLcode Curl_rtsp_disconnect(struct connectdata *conn, bool dead_connection); + +CURLcode Curl_rtsp_parseheader(struct connectdata *conn, char *header); + +#endif /* CURL_DISABLE_RTSP */ + +/* + * RTSP Connection data + * + * Currently, only used for tracking incomplete RTP data reads + */ +struct rtsp_conn { + char *rtp_buf; + ssize_t rtp_bufsize; + int rtp_channel; +}; + +/**************************************************************************** + * RTSP unique setup + ***************************************************************************/ +struct RTSP { + /* + * http_wrapper MUST be the first element of this structure for the wrap + * logic to work. In this way, we get a cheap polymorphism because + * &(data->state.proto.rtsp) == &(data->state.proto.http) per the C spec + * + * HTTP functions can safely treat this as an HTTP struct, but RTSP aware + * functions can also index into the later elements. + */ + struct HTTP http_wrapper; /*wrap HTTP to do the heavy lifting */ + + long CSeq_sent; /* CSeq of this request */ + long CSeq_recv; /* CSeq received */ +}; + + +#endif /* __RTSP_H_ */ diff --git a/mobicore/common/curl/lib/security.c b/mobicore/common/curl/lib/security.c new file mode 100644 index 0000000000000000000000000000000000000000..1aa280682c7c0eadf7ab92a350b00917e0e7400b --- /dev/null +++ b/mobicore/common/curl/lib/security.c @@ -0,0 +1,591 @@ +/* This source code was modified by Martin Hedenfalk for + * use in Curl. His latest changes were done 2000-09-18. + * + * It has since been patched and modified a lot by Daniel Stenberg + * to make it better applied to curl conditions, and to make + * it not use globals, pollute name space and more. This source code awaits a + * rewrite to work around the paragraph 2 in the BSD licenses as explained + * below. + * + * Copyright (c) 1998, 1999 Kungliga Tekniska Hgskolan + * (Royal Institute of Technology, Stockholm, Sweden). + * + * Copyright (C) 2001 - 2010, Daniel Stenberg, , et al. + * + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of the Institute nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. */ + +#include "setup.h" + +#ifndef CURL_DISABLE_FTP +#if defined(HAVE_KRB4) || defined(HAVE_GSSAPI) + +#include +#include + +#ifdef HAVE_NETDB_H +#include +#endif + +#ifdef HAVE_UNISTD_H +#include +#endif + +#include "urldata.h" +#include "curl_base64.h" +#include "curl_memory.h" +#include "krb4.h" +#include "ftp.h" +#include "sendf.h" +#include "rawstr.h" + +/* The last #include file should be: */ +#include "memdebug.h" + +static const struct { + enum protection_level level; + const char *name; +} level_names[] = { + { PROT_CLEAR, "clear" }, + { PROT_SAFE, "safe" }, + { PROT_CONFIDENTIAL, "confidential" }, + { PROT_PRIVATE, "private" } +}; + +static enum protection_level +name_to_level(const char *name) +{ + int i; + for(i = 0; i < (int)sizeof(level_names)/(int)sizeof(level_names[0]); i++) + if(checkprefix(name, level_names[i].name)) + return level_names[i].level; + return PROT_NONE; +} + +/* Convert a protocol |level| to its char representation. + We take an int to catch programming mistakes. */ +static char level_to_char(int level) { + switch(level) { + case PROT_CLEAR: + return 'C'; + case PROT_SAFE: + return 'S'; + case PROT_CONFIDENTIAL: + return 'E'; + case PROT_PRIVATE: + return 'P'; + case PROT_CMD: + /* Fall through */ + default: + /* Those 2 cases should not be reached! */ + break; + } + DEBUGASSERT(0); + /* Default to the most secure alternative. */ + return 'P'; +} + +static const struct Curl_sec_client_mech * const mechs[] = { +#if defined(HAVE_GSSAPI) + &Curl_krb5_client_mech, +#endif +#if defined(HAVE_KRB4) + &Curl_krb4_client_mech, +#endif + NULL +}; + +/* Send an FTP command defined by |message| and the optional arguments. The + function returns the ftp_code. If an error occurs, -1 is returned. */ +static int ftp_send_command(struct connectdata *conn, const char *message, ...) +{ + int ftp_code; + ssize_t nread; + va_list args; + char print_buffer[50]; + + va_start(args, message); + vsnprintf(print_buffer, sizeof(print_buffer), message, args); + va_end(args); + + if(Curl_ftpsendf(conn, print_buffer) != CURLE_OK) { + ftp_code = -1; + } + else { + if(Curl_GetFTPResponse(&nread, conn, &ftp_code) != CURLE_OK) + ftp_code = -1; + } + + (void)nread; /* Unused */ + return ftp_code; +} + +/* Read |len| from the socket |fd| and store it in |to|. Return a CURLcode + saying whether an error occured or CURLE_OK if |len| was read. */ +static CURLcode +socket_read(curl_socket_t fd, void *to, size_t len) +{ + char *to_p = to; + CURLcode code; + ssize_t nread; + + while(len > 0) { + code = Curl_read_plain(fd, to_p, len, &nread); + if(code == CURLE_OK) { + len -= nread; + to_p += nread; + } + else { + /* FIXME: We are doing a busy wait */ + if(code == CURLE_AGAIN) + continue; + return code; + } + } + return CURLE_OK; +} + + +/* Write |len| bytes from the buffer |to| to the socket |fd|. Return a + CURLcode saying whether an error occured or CURLE_OK if |len| was + written. */ +static CURLcode +socket_write(struct connectdata *conn, curl_socket_t fd, const void *to, + size_t len) +{ + const char *to_p = to; + CURLcode code; + ssize_t written; + + while(len > 0) { + code = Curl_write_plain(conn, fd, to_p, len, &written); + if(code == CURLE_OK) { + len -= written; + to_p += written; + } + else { + /* FIXME: We are doing a busy wait */ + if(code == CURLE_AGAIN) + continue; + return code; + } + } + return CURLE_OK; +} + +static CURLcode read_data(struct connectdata *conn, + curl_socket_t fd, + struct krb4buffer *buf) +{ + int len; + void* tmp; + CURLcode ret; + + ret = socket_read(fd, &len, sizeof(len)); + if (ret != CURLE_OK) + return ret; + + len = ntohl(len); + tmp = realloc(buf->data, len); + if (tmp == NULL) + return CURLE_OUT_OF_MEMORY; + + buf->data = tmp; + ret = socket_read(fd, buf->data, len); + if (ret != CURLE_OK) + return ret; + buf->size = conn->mech->decode(conn->app_data, buf->data, len, + conn->data_prot, conn); + buf->index = 0; + return CURLE_OK; +} + +static size_t +buffer_read(struct krb4buffer *buf, void *data, size_t len) +{ + if(buf->size - buf->index < len) + len = buf->size - buf->index; + memcpy(data, (char*)buf->data + buf->index, len); + buf->index += len; + return len; +} + +/* Matches Curl_recv signature */ +static ssize_t sec_recv(struct connectdata *conn, int sockindex, + char *buffer, size_t len, CURLcode *err) +{ + size_t bytes_read; + size_t total_read = 0; + curl_socket_t fd = conn->sock[sockindex]; + + *err = CURLE_OK; + + /* Handle clear text response. */ + if(conn->sec_complete == 0 || conn->data_prot == PROT_CLEAR) + return read(fd, buffer, len); + + if(conn->in_buffer.eof_flag) { + conn->in_buffer.eof_flag = 0; + return 0; + } + + bytes_read = buffer_read(&conn->in_buffer, buffer, len); + len -= bytes_read; + total_read += bytes_read; + buffer += bytes_read; + + while(len > 0) { + if(read_data(conn, fd, &conn->in_buffer) != CURLE_OK) + return -1; + if(conn->in_buffer.size == 0) { + if(bytes_read > 0) + conn->in_buffer.eof_flag = 1; + return bytes_read; + } + bytes_read = buffer_read(&conn->in_buffer, buffer, len); + len -= bytes_read; + total_read += bytes_read; + buffer += bytes_read; + } + /* FIXME: Check for overflow */ + return total_read; +} + +/* Send |length| bytes from |from| to the |fd| socket taking care of encoding + and negociating with the server. |from| can be NULL. */ +/* FIXME: We don't check for errors nor report any! */ +static void do_sec_send(struct connectdata *conn, curl_socket_t fd, + const char *from, int length) +{ + size_t bytes; + size_t htonl_bytes; + char *buffer; + char *cmd_buffer; + enum protection_level prot_level = conn->data_prot; + bool iscmd = prot_level == PROT_CMD; + + DEBUGASSERT(prot_level > PROT_NONE && prot_level < PROT_LAST); + + if(iscmd) { + if(!strncmp(from, "PASS ", 5) || !strncmp(from, "ACCT ", 5)) + prot_level = PROT_PRIVATE; + else + prot_level = conn->command_prot; + } + bytes = conn->mech->encode(conn->app_data, from, length, prot_level, + (void**)&buffer, conn); + if(iscmd) { + bytes = Curl_base64_encode(conn->data, buffer, bytes, &cmd_buffer); + if(bytes > 0) { + static const char *enc = "ENC "; + static const char *mic = "MIC "; + if(prot_level == PROT_PRIVATE) + socket_write(conn, fd, enc, 4); + else + socket_write(conn, fd, mic, 4); + + socket_write(conn, fd, cmd_buffer, bytes); + socket_write(conn, fd, "\r\n", 2); + infof(conn->data, "Send: %s%s\n", prot_level == PROT_PRIVATE?enc:mic, + cmd_buffer); + free(cmd_buffer); + } + } + else { + htonl_bytes = htonl(bytes); + socket_write(conn, fd, &htonl_bytes, sizeof(htonl_bytes)); + socket_write(conn, fd, buffer, bytes); + } + free(buffer); +} + +static ssize_t sec_write(struct connectdata *conn, curl_socket_t fd, + const char *buffer, size_t length) +{ + /* FIXME: Check for overflow */ + ssize_t len = conn->buffer_size; + int tx = 0; + + len -= conn->mech->overhead(conn->app_data, conn->data_prot, len); + if(len <= 0) + len = length; + while(length) { + if(len >= 0 || length < (size_t)len) { + /* FIXME: Check for overflow. */ + len = length; + } + do_sec_send(conn, fd, buffer, len); + length -= len; + buffer += len; + tx += len; + } + return tx; +} + +/* Matches Curl_send signature */ +static ssize_t sec_send(struct connectdata *conn, int sockindex, + const void *buffer, size_t len, CURLcode *err) +{ + curl_socket_t fd = conn->sock[sockindex]; + *err = CURLE_OK; + return sec_write(conn, fd, buffer, len); +} + +int Curl_sec_read_msg(struct connectdata *conn, char *buffer, + enum protection_level level) +{ + /* decoded_len should be size_t or ssize_t but conn->mech->decode returns an + int */ + int decoded_len; + char *buf; + int ret_code; + + DEBUGASSERT(level > PROT_NONE && level < PROT_LAST); + + decoded_len = Curl_base64_decode(buffer + 4, (unsigned char **)&buf); + if(decoded_len <= 0) { + free(buf); + return -1; + } + + decoded_len = conn->mech->decode(conn->app_data, buf, decoded_len, + level, conn); + if(decoded_len <= 0) { + free(buf); + return -1; + } + + if(conn->data->set.verbose) { + buf[decoded_len] = '\n'; + Curl_debug(conn->data, CURLINFO_HEADER_IN, buf, decoded_len + 1, conn); + } + + buf[decoded_len] = '\0'; + DEBUGASSERT(decoded_len > 3); + if(buf[3] == '-') + ret_code = 0; + else { + /* Check for error? */ + sscanf(buf, "%d", &ret_code); + } + + if(buf[decoded_len - 1] == '\n') + buf[decoded_len - 1] = '\0'; + /* FIXME: Is |buffer| length always greater than |decoded_len|? */ + strcpy(buffer, buf); + free(buf); + return ret_code; +} + +/* FIXME: The error code returned here is never checked. */ +static int sec_set_protection_level(struct connectdata *conn) +{ + int code; + char* pbsz; + static unsigned int buffer_size = 1 << 20; /* 1048576 */ + enum protection_level level = conn->request_data_prot; + + DEBUGASSERT(level > PROT_NONE && level < PROT_LAST); + + if(!conn->sec_complete) { + infof(conn->data, "Trying to change the protection level after the" + "completion of the data exchange.\n"); + return -1; + } + + /* Bail out if we try to set up the same level */ + if(conn->data_prot == level) + return 0; + + if(level) { + code = ftp_send_command(conn, "PBSZ %u", buffer_size); + if(code < 0) + return -1; + + if(code/100 != 2) { + failf(conn->data, "Failed to set the protection's buffer size."); + return -1; + } + conn->buffer_size = buffer_size; + + pbsz = strstr(conn->data->state.buffer, "PBSZ="); + if(pbsz) { + /* FIXME: Checks for errors in sscanf? */ + sscanf(pbsz, "PBSZ=%u", &buffer_size); + if(buffer_size < conn->buffer_size) + conn->buffer_size = buffer_size; + } + } + + /* Now try to negiociate the protection level. */ + code = ftp_send_command(conn, "PROT %c", level_to_char(level)); + + if(code < 0) + return -1; + + if(code/100 != 2) { + failf(conn->data, "Failed to set the protection level."); + return -1; + } + + conn->data_prot = level; + if(level == PROT_PRIVATE) + conn->command_prot = level; + + return 0; +} + +int +Curl_sec_request_prot(struct connectdata *conn, const char *level) +{ + enum protection_level l = name_to_level(level); + if(l == PROT_NONE) + return -1; + DEBUGASSERT(l > PROT_NONE && l < PROT_LAST); + conn->request_data_prot = l; + return 0; +} + +static CURLcode choose_mech(struct connectdata *conn) +{ + int ret; + struct SessionHandle *data = conn->data; + const struct Curl_sec_client_mech * const *mech; + void *tmp_allocation; + const char *mech_name; + + for(mech = mechs; (*mech); ++mech) { + mech_name = (*mech)->name; + /* We have no mechanism with a NULL name but keep this check */ + DEBUGASSERT(mech_name != NULL); + if(mech_name == NULL) { + infof(data, "Skipping mechanism with empty name (%p)\n", mech); + continue; + } + tmp_allocation = realloc(conn->app_data, (*mech)->size); + if(tmp_allocation == NULL) { + failf(data, "Failed realloc of size %u", (*mech)->size); + mech = NULL; + return CURLE_OUT_OF_MEMORY; + } + conn->app_data = tmp_allocation; + + if((*mech)->init) { + ret = (*mech)->init(conn->app_data); + if(ret != 0) { + infof(data, "Failed initialization for %s. Skipping it.\n", mech_name); + continue; + } + } + + infof(data, "Trying mechanism %s...\n", mech_name); + ret = ftp_send_command(conn, "AUTH %s", mech_name); + if(ret < 0) + /* FIXME: This error is too generic but it is OK for now. */ + return CURLE_COULDNT_CONNECT; + + if(ret/100 != 3) { + switch(ret) { + case 504: + infof(data, "Mechanism %s is not supported by the server (server " + "returned ftp code: 504).\n", mech_name); + break; + case 534: + infof(data, "Mechanism %s was rejected by the server (server returned " + "ftp code: 534).\n", mech_name); + break; + default: + if(ret/100 == 5) { + infof(data, "The server does not support the security extensions.\n"); + return CURLE_USE_SSL_FAILED; + } + break; + } + continue; + } + + /* Authenticate */ + ret = (*mech)->auth(conn->app_data, conn); + + if(ret == AUTH_CONTINUE) + continue; + else if(ret != AUTH_OK) { + /* Mechanism has dumped the error to stderr, don't error here. */ + return -1; + } + DEBUGASSERT(ret == AUTH_OK); + + conn->mech = *mech; + conn->sec_complete = 1; + conn->recv[FIRSTSOCKET] = sec_recv; + conn->send[FIRSTSOCKET] = sec_send; + conn->recv[SECONDARYSOCKET] = sec_recv; + conn->send[SECONDARYSOCKET] = sec_send; + conn->command_prot = PROT_SAFE; + /* Set the requested protection level */ + /* BLOCKING */ + (void)sec_set_protection_level(conn); + break; + } + + return mech != NULL ? CURLE_OK : CURLE_FAILED_INIT; +} + +CURLcode +Curl_sec_login(struct connectdata *conn) +{ + return choose_mech(conn); +} + + +void +Curl_sec_end(struct connectdata *conn) +{ + if(conn->mech != NULL && conn->mech->end) + conn->mech->end(conn->app_data); + if(conn->app_data) { + free(conn->app_data); + conn->app_data = NULL; + } + if(conn->in_buffer.data) { + free(conn->in_buffer.data); + conn->in_buffer.data = NULL; + conn->in_buffer.size = 0; + conn->in_buffer.index = 0; + /* FIXME: Is this really needed? */ + conn->in_buffer.eof_flag = 0; + } + conn->sec_complete = 0; + conn->data_prot = PROT_CLEAR; + conn->mech = NULL; +} + +#endif /* HAVE_KRB4 || HAVE_GSSAPI */ + +#endif /* CURL_DISABLE_FTP */ diff --git a/mobicore/common/curl/lib/select.c b/mobicore/common/curl/lib/select.c new file mode 100644 index 0000000000000000000000000000000000000000..e6882da7ac56680549b5a9f6a6cc1dd60682bc0d --- /dev/null +++ b/mobicore/common/curl/lib/select.c @@ -0,0 +1,506 @@ +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) 1998 - 2009, Daniel Stenberg, , et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at http://curl.haxx.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ***************************************************************************/ + +#include "setup.h" + +#ifdef HAVE_SYS_SELECT_H +#include +#endif +#ifdef HAVE_SYS_TIME_H +#include +#endif + +#if !defined(HAVE_SELECT) && !defined(HAVE_POLL_FINE) +#error "We can't compile without select() or poll() support." +#endif + +#if defined(__BEOS__) && !defined(__HAIKU__) +/* BeOS has FD_SET defined in socket.h */ +#include +#endif + +#ifdef MSDOS +#include /* delay() */ +#endif + +#include + +#include "urldata.h" +#include "connect.h" +#include "select.h" + +/* Winsock and TPF sockets are not in range [0..FD_SETSIZE-1] */ + +#if defined(USE_WINSOCK) || defined(TPF) +#define VERIFY_SOCK(x) do { } while(0) +#else +#define VALID_SOCK(s) (((s) >= 0) && ((s) < FD_SETSIZE)) +#define VERIFY_SOCK(x) do { \ + if(!VALID_SOCK(x)) { \ + SET_SOCKERRNO(EINVAL); \ + return -1; \ + } \ +} while(0) +#endif + +/* Convenience local macros */ + +#define elapsed_ms (int)curlx_tvdiff(curlx_tvnow(), initial_tv) + +#ifdef CURL_ACKNOWLEDGE_EINTR +#define error_not_EINTR (1) +#else +#define error_not_EINTR (error != EINTR) +#endif + +/* + * Internal function used for waiting a specific amount of ms + * in Curl_socket_ready() and Curl_poll() when no file descriptor + * is provided to wait on, just being used to delay execution. + * WinSock select() and poll() timeout mechanisms need a valid + * socket descriptor in a not null file descriptor set to work. + * Waiting indefinitely with this function is not allowed, a + * zero or negative timeout value will return immediately. + * Timeout resolution, accuracy, as well as maximum supported + * value is system dependent, neither factor is a citical issue + * for the intended use of this function in the library. + * On non-DOS and non-Winsock platforms, when compiled with + * CURL_ACKNOWLEDGE_EINTR defined, EINTR condition is honored + * and function might exit early without awaiting full timeout, + * otherwise EINTR will be ignored and full timeout will elapse. + * + * Return values: + * -1 = system call error, invalid timeout value, or interrupted + * 0 = specified timeout has elapsed + */ +static int wait_ms(int timeout_ms) +{ +#if !defined(MSDOS) && !defined(USE_WINSOCK) +#ifndef HAVE_POLL_FINE + struct timeval pending_tv; +#endif + struct timeval initial_tv; + int pending_ms; + int error; +#endif + int r = 0; + + if(!timeout_ms) + return 0; + if(timeout_ms < 0) { + SET_SOCKERRNO(EINVAL); + return -1; + } +#if defined(MSDOS) + delay(timeout_ms); +#elif defined(USE_WINSOCK) + Sleep(timeout_ms); +#else + pending_ms = timeout_ms; + initial_tv = curlx_tvnow(); + do { +#if defined(HAVE_POLL_FINE) + r = poll(NULL, 0, pending_ms); +#else + pending_tv.tv_sec = pending_ms / 1000; + pending_tv.tv_usec = (pending_ms % 1000) * 1000; + r = select(0, NULL, NULL, NULL, &pending_tv); +#endif /* HAVE_POLL_FINE */ + if(r != -1) + break; + error = SOCKERRNO; + if(error && error_not_EINTR) + break; + pending_ms = timeout_ms - elapsed_ms; + if(pending_ms <= 0) + break; + } while(r == -1); +#endif /* USE_WINSOCK */ + if(r) + r = -1; + return r; +} + +/* + * This is an internal function used for waiting for read or write + * events on a pair of file descriptors. It uses poll() when a fine + * poll() is available, in order to avoid limits with FD_SETSIZE, + * otherwise select() is used. An error is returned if select() is + * being used and a file descriptor is too large for FD_SETSIZE. + * A negative timeout value makes this function wait indefinitely, + * unles no valid file descriptor is given, when this happens the + * negative timeout is ignored and the function times out immediately. + * When compiled with CURL_ACKNOWLEDGE_EINTR defined, EINTR condition + * is honored and function might exit early without awaiting timeout, + * otherwise EINTR will be ignored. + * + * Return values: + * -1 = system call error or fd >= FD_SETSIZE + * 0 = timeout + * CURL_CSELECT_IN | CURL_CSELECT_OUT | CURL_CSELECT_ERR + */ +int Curl_socket_ready(curl_socket_t readfd, curl_socket_t writefd, + int timeout_ms) +{ +#ifdef HAVE_POLL_FINE + struct pollfd pfd[2]; + int num; +#else + struct timeval pending_tv; + struct timeval *ptimeout; + fd_set fds_read; + fd_set fds_write; + fd_set fds_err; + curl_socket_t maxfd; +#endif + struct timeval initial_tv = {0,0}; + int pending_ms = 0; + int error; + int r; + int ret; + + if((readfd == CURL_SOCKET_BAD) && (writefd == CURL_SOCKET_BAD)) { + r = wait_ms(timeout_ms); + return r; + } + + /* Avoid initial timestamp, avoid curlx_tvnow() call, when elapsed + time in this function does not need to be measured. This happens + when function is called with a zero timeout or a negative timeout + value indicating a blocking call should be performed. */ + + if(timeout_ms > 0) { + pending_ms = timeout_ms; + initial_tv = curlx_tvnow(); + } + +#ifdef HAVE_POLL_FINE + + num = 0; + if(readfd != CURL_SOCKET_BAD) { + pfd[num].fd = readfd; + pfd[num].events = POLLRDNORM|POLLIN|POLLRDBAND|POLLPRI; + pfd[num].revents = 0; + num++; + } + if(writefd != CURL_SOCKET_BAD) { + pfd[num].fd = writefd; + pfd[num].events = POLLWRNORM|POLLOUT; + pfd[num].revents = 0; + num++; + } + + do { + if(timeout_ms < 0) + pending_ms = -1; + else if(!timeout_ms) + pending_ms = 0; + r = poll(pfd, num, pending_ms); + if(r != -1) + break; + error = SOCKERRNO; + if(error && error_not_EINTR) + break; + if(timeout_ms > 0) { + pending_ms = timeout_ms - elapsed_ms; + if(pending_ms <= 0) + break; + } + } while(r == -1); + + if(r < 0) + return -1; + if(r == 0) + return 0; + + ret = 0; + num = 0; + if(readfd != CURL_SOCKET_BAD) { + if(pfd[num].revents & (POLLRDNORM|POLLIN|POLLERR|POLLHUP)) + ret |= CURL_CSELECT_IN; + if(pfd[num].revents & (POLLRDBAND|POLLPRI|POLLNVAL)) + ret |= CURL_CSELECT_ERR; + num++; + } + if(writefd != CURL_SOCKET_BAD) { + if(pfd[num].revents & (POLLWRNORM|POLLOUT)) + ret |= CURL_CSELECT_OUT; + if(pfd[num].revents & (POLLERR|POLLHUP|POLLNVAL)) + ret |= CURL_CSELECT_ERR; + } + + return ret; + +#else /* HAVE_POLL_FINE */ + + FD_ZERO(&fds_err); + maxfd = (curl_socket_t)-1; + + FD_ZERO(&fds_read); + if(readfd != CURL_SOCKET_BAD) { + VERIFY_SOCK(readfd); + FD_SET(readfd, &fds_read); + FD_SET(readfd, &fds_err); + maxfd = readfd; + } + + FD_ZERO(&fds_write); + if(writefd != CURL_SOCKET_BAD) { + VERIFY_SOCK(writefd); + FD_SET(writefd, &fds_write); + FD_SET(writefd, &fds_err); + if(writefd > maxfd) + maxfd = writefd; + } + + ptimeout = (timeout_ms < 0) ? NULL : &pending_tv; + + do { + if(timeout_ms > 0) { + pending_tv.tv_sec = pending_ms / 1000; + pending_tv.tv_usec = (pending_ms % 1000) * 1000; + } + else if(!timeout_ms) { + pending_tv.tv_sec = 0; + pending_tv.tv_usec = 0; + } + r = select((int)maxfd + 1, &fds_read, &fds_write, &fds_err, ptimeout); + if(r != -1) + break; + error = SOCKERRNO; + if(error && error_not_EINTR) + break; + if(timeout_ms > 0) { + pending_ms = timeout_ms - elapsed_ms; + if(pending_ms <= 0) + break; + } + } while(r == -1); + + if(r < 0) + return -1; + if(r == 0) + return 0; + + ret = 0; + if(readfd != CURL_SOCKET_BAD) { + if(FD_ISSET(readfd, &fds_read)) + ret |= CURL_CSELECT_IN; + if(FD_ISSET(readfd, &fds_err)) + ret |= CURL_CSELECT_ERR; + } + if(writefd != CURL_SOCKET_BAD) { + if(FD_ISSET(writefd, &fds_write)) + ret |= CURL_CSELECT_OUT; + if(FD_ISSET(writefd, &fds_err)) + ret |= CURL_CSELECT_ERR; + } + + return ret; + +#endif /* HAVE_POLL_FINE */ + +} + +/* + * This is a wrapper around poll(). If poll() does not exist, then + * select() is used instead. An error is returned if select() is + * being used and a file descriptor is too large for FD_SETSIZE. + * A negative timeout value makes this function wait indefinitely, + * unles no valid file descriptor is given, when this happens the + * negative timeout is ignored and the function times out immediately. + * When compiled with CURL_ACKNOWLEDGE_EINTR defined, EINTR condition + * is honored and function might exit early without awaiting timeout, + * otherwise EINTR will be ignored. + * + * Return values: + * -1 = system call error or fd >= FD_SETSIZE + * 0 = timeout + * N = number of structures with non zero revent fields + */ +int Curl_poll(struct pollfd ufds[], unsigned int nfds, int timeout_ms) +{ +#ifndef HAVE_POLL_FINE + struct timeval pending_tv; + struct timeval *ptimeout; + fd_set fds_read; + fd_set fds_write; + fd_set fds_err; + curl_socket_t maxfd; +#endif + struct timeval initial_tv = {0,0}; + bool fds_none = TRUE; + unsigned int i; + int pending_ms = 0; + int error; + int r; + + if(ufds) { + for (i = 0; i < nfds; i++) { + if(ufds[i].fd != CURL_SOCKET_BAD) { + fds_none = FALSE; + break; + } + } + } + if(fds_none) { + r = wait_ms(timeout_ms); + return r; + } + + /* Avoid initial timestamp, avoid curlx_tvnow() call, when elapsed + time in this function does not need to be measured. This happens + when function is called with a zero timeout or a negative timeout + value indicating a blocking call should be performed. */ + + if(timeout_ms > 0) { + pending_ms = timeout_ms; + initial_tv = curlx_tvnow(); + } + +#ifdef HAVE_POLL_FINE + + do { + if(timeout_ms < 0) + pending_ms = -1; + else if(!timeout_ms) + pending_ms = 0; + r = poll(ufds, nfds, pending_ms); + if(r != -1) + break; + error = SOCKERRNO; + if(error && error_not_EINTR) + break; + if(timeout_ms > 0) { + pending_ms = timeout_ms - elapsed_ms; + if(pending_ms <= 0) + break; + } + } while(r == -1); + + if(r < 0) + return -1; + if(r == 0) + return 0; + + for (i = 0; i < nfds; i++) { + if(ufds[i].fd == CURL_SOCKET_BAD) + continue; + if(ufds[i].revents & POLLHUP) + ufds[i].revents |= POLLIN; + if(ufds[i].revents & POLLERR) + ufds[i].revents |= (POLLIN|POLLOUT); + } + +#else /* HAVE_POLL_FINE */ + + FD_ZERO(&fds_read); + FD_ZERO(&fds_write); + FD_ZERO(&fds_err); + maxfd = (curl_socket_t)-1; + + for (i = 0; i < nfds; i++) { + ufds[i].revents = 0; + if(ufds[i].fd == CURL_SOCKET_BAD) + continue; + VERIFY_SOCK(ufds[i].fd); + if(ufds[i].events & (POLLIN|POLLOUT|POLLPRI| + POLLRDNORM|POLLWRNORM|POLLRDBAND)) { + if(ufds[i].fd > maxfd) + maxfd = ufds[i].fd; + if(ufds[i].events & (POLLRDNORM|POLLIN)) + FD_SET(ufds[i].fd, &fds_read); + if(ufds[i].events & (POLLWRNORM|POLLOUT)) + FD_SET(ufds[i].fd, &fds_write); + if(ufds[i].events & (POLLRDBAND|POLLPRI)) + FD_SET(ufds[i].fd, &fds_err); + } + } + + ptimeout = (timeout_ms < 0) ? NULL : &pending_tv; + + do { + if(timeout_ms > 0) { + pending_tv.tv_sec = pending_ms / 1000; + pending_tv.tv_usec = (pending_ms % 1000) * 1000; + } + else if(!timeout_ms) { + pending_tv.tv_sec = 0; + pending_tv.tv_usec = 0; + } + r = select((int)maxfd + 1, &fds_read, &fds_write, &fds_err, ptimeout); + if(r != -1) + break; + error = SOCKERRNO; + if(error && error_not_EINTR) + break; + if(timeout_ms > 0) { + pending_ms = timeout_ms - elapsed_ms; + if(pending_ms <= 0) + break; + } + } while(r == -1); + + if(r < 0) + return -1; + if(r == 0) + return 0; + + r = 0; + for (i = 0; i < nfds; i++) { + ufds[i].revents = 0; + if(ufds[i].fd == CURL_SOCKET_BAD) + continue; + if(FD_ISSET(ufds[i].fd, &fds_read)) + ufds[i].revents |= POLLIN; + if(FD_ISSET(ufds[i].fd, &fds_write)) + ufds[i].revents |= POLLOUT; + if(FD_ISSET(ufds[i].fd, &fds_err)) + ufds[i].revents |= POLLPRI; + if(ufds[i].revents != 0) + r++; + } + +#endif /* HAVE_POLL_FINE */ + + return r; +} + +#ifdef TPF +/* + * This is a replacement for select() on the TPF platform. + * It is used whenever libcurl calls select(). + * The call below to tpf_process_signals() is required because + * TPF's select calls are not signal interruptible. + * + * Return values are the same as select's. + */ +int tpf_select_libcurl(int maxfds, fd_set* reads, fd_set* writes, + fd_set* excepts, struct timeval* tv) +{ + int rc; + + rc = tpf_select_bsd(maxfds, reads, writes, excepts, tv); + tpf_process_signals(); + return(rc); +} +#endif /* TPF */ diff --git a/mobicore/common/curl/lib/select.h b/mobicore/common/curl/lib/select.h new file mode 100644 index 0000000000000000000000000000000000000000..e431e5f07be23fbf0947e31f74d0a62c943f2304 --- /dev/null +++ b/mobicore/common/curl/lib/select.h @@ -0,0 +1,97 @@ +#ifndef __SELECT_H +#define __SELECT_H +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) 1998 - 2008, Daniel Stenberg, , et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at http://curl.haxx.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ***************************************************************************/ + +#include "setup.h" + +#ifdef HAVE_SYS_POLL_H +#include +#elif defined(HAVE_POLL_H) +#include +#endif + +/* + * poll() function on Windows Vista and later is called WSAPoll() + */ + +#if defined(USE_WINSOCK) && (USE_WINSOCK > 1) && \ + defined(_WIN32_WINNT) && (_WIN32_WINNT >= 0x0600) +# undef HAVE_POLL +# define HAVE_POLL 1 +# undef HAVE_POLL_FINE +# define HAVE_POLL_FINE 1 +# define poll(x,y,z) WSAPoll((x),(y),(z)) +# if defined(_MSC_VER) && defined(POLLRDNORM) +# undef POLLPRI +# define POLLPRI POLLRDBAND +# define HAVE_STRUCT_POLLFD 1 +# endif +#endif + +/* + * Definition of pollfd struct and constants for platforms lacking them. + */ + +#if !defined(HAVE_STRUCT_POLLFD) && \ + !defined(HAVE_SYS_POLL_H) && \ + !defined(HAVE_POLL_H) + +#define POLLIN 0x01 +#define POLLPRI 0x02 +#define POLLOUT 0x04 +#define POLLERR 0x08 +#define POLLHUP 0x10 +#define POLLNVAL 0x20 + +struct pollfd +{ + curl_socket_t fd; + short events; + short revents; +}; + +#endif + +#ifndef POLLRDNORM +#define POLLRDNORM POLLIN +#endif + +#ifndef POLLWRNORM +#define POLLWRNORM POLLOUT +#endif + +#ifndef POLLRDBAND +#define POLLRDBAND POLLPRI +#endif + +int Curl_socket_ready(curl_socket_t readfd, curl_socket_t writefd, + int timeout_ms); + +int Curl_poll(struct pollfd ufds[], unsigned int nfds, int timeout_ms); + +#ifdef TPF +int tpf_select_libcurl(int maxfds, fd_set* reads, fd_set* writes, + fd_set* excepts, struct timeval* tv); +#endif + +#endif /* __SELECT_H */ diff --git a/mobicore/common/curl/lib/sendf.c b/mobicore/common/curl/lib/sendf.c new file mode 100644 index 0000000000000000000000000000000000000000..d04371f84e4402ae985fc9c29c75a7739d72644f --- /dev/null +++ b/mobicore/common/curl/lib/sendf.c @@ -0,0 +1,700 @@ +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) 1998 - 2010, Daniel Stenberg, , et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at http://curl.haxx.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ***************************************************************************/ + +#include "setup.h" + +#include +#include +#include +#include + +#ifdef HAVE_SYS_SOCKET_H +#include /* required for send() & recv() prototypes */ +#endif + +#ifdef HAVE_UNISTD_H +#include +#endif + +#include +#include "urldata.h" +#include "sendf.h" +#include "connect.h" +#include "sslgen.h" +#include "ssh.h" +#include "multiif.h" +#include "rtsp.h" + +#define _MPRINTF_REPLACE /* use the internal *printf() functions */ +#include + +/* the krb4 functions only exists for FTP and if krb4 or gssapi is defined */ +#if !defined(CURL_DISABLE_FTP) && (defined(HAVE_KRB4) || defined(HAVE_GSSAPI)) +#include "krb4.h" +#else +#define Curl_sec_send(a,b,c,d) -1 +#define Curl_sec_read(a,b,c,d) -1 +#endif + +#include +#include "curl_memory.h" +#include "strerror.h" +#include "easyif.h" /* for the Curl_convert_from_network prototype */ +/* The last #include file should be: */ +#include "memdebug.h" + +#ifdef CURL_DO_LINEEND_CONV +/* + * convert_lineends() changes CRLF (\r\n) end-of-line markers to a single LF + * (\n), with special processing for CRLF sequences that are split between two + * blocks of data. Remaining, bare CRs are changed to LFs. The possibly new + * size of the data is returned. + */ +static size_t convert_lineends(struct SessionHandle *data, + char *startPtr, size_t size) +{ + char *inPtr, *outPtr; + + /* sanity check */ + if((startPtr == NULL) || (size < 1)) { + return(size); + } + + if(data->state.prev_block_had_trailing_cr == TRUE) { + /* The previous block of incoming data + had a trailing CR, which was turned into a LF. */ + if(*startPtr == '\n') { + /* This block of incoming data starts with the + previous block's LF so get rid of it */ + memmove(startPtr, startPtr+1, size-1); + size--; + /* and it wasn't a bare CR but a CRLF conversion instead */ + data->state.crlf_conversions++; + } + data->state.prev_block_had_trailing_cr = FALSE; /* reset the flag */ + } + + /* find 1st CR, if any */ + inPtr = outPtr = memchr(startPtr, '\r', size); + if(inPtr) { + /* at least one CR, now look for CRLF */ + while(inPtr < (startPtr+size-1)) { + /* note that it's size-1, so we'll never look past the last byte */ + if(memcmp(inPtr, "\r\n", 2) == 0) { + /* CRLF found, bump past the CR and copy the NL */ + inPtr++; + *outPtr = *inPtr; + /* keep track of how many CRLFs we converted */ + data->state.crlf_conversions++; + } + else { + if(*inPtr == '\r') { + /* lone CR, move LF instead */ + *outPtr = '\n'; + } + else { + /* not a CRLF nor a CR, just copy whatever it is */ + *outPtr = *inPtr; + } + } + outPtr++; + inPtr++; + } /* end of while loop */ + + if(inPtr < startPtr+size) { + /* handle last byte */ + if(*inPtr == '\r') { + /* deal with a CR at the end of the buffer */ + *outPtr = '\n'; /* copy a NL instead */ + /* note that a CRLF might be split across two blocks */ + data->state.prev_block_had_trailing_cr = TRUE; + } + else { + /* copy last byte */ + *outPtr = *inPtr; + } + outPtr++; + } + if(outPtr < startPtr+size) + /* tidy up by null terminating the now shorter data */ + *outPtr = '\0'; + + return(outPtr - startPtr); + } + return(size); +} +#endif /* CURL_DO_LINEEND_CONV */ + +/* Curl_infof() is for info message along the way */ + +void Curl_infof(struct SessionHandle *data, const char *fmt, ...) +{ + if(data && data->set.verbose) { + va_list ap; + size_t len; + char print_buffer[2048 + 1]; + va_start(ap, fmt); + vsnprintf(print_buffer, sizeof(print_buffer), fmt, ap); + va_end(ap); + len = strlen(print_buffer); + Curl_debug(data, CURLINFO_TEXT, print_buffer, len, NULL); + } +} + +/* Curl_failf() is for messages stating why we failed. + * The message SHALL NOT include any LF or CR. + */ + +void Curl_failf(struct SessionHandle *data, const char *fmt, ...) +{ + va_list ap; + size_t len; + va_start(ap, fmt); + + vsnprintf(data->state.buffer, BUFSIZE, fmt, ap); + + if(data->set.errorbuffer && !data->state.errorbuf) { + snprintf(data->set.errorbuffer, CURL_ERROR_SIZE, "%s", data->state.buffer); + data->state.errorbuf = TRUE; /* wrote error string */ + } + if(data->set.verbose) { + len = strlen(data->state.buffer); + if(len < BUFSIZE - 1) { + data->state.buffer[len] = '\n'; + data->state.buffer[++len] = '\0'; + } + Curl_debug(data, CURLINFO_TEXT, data->state.buffer, len, NULL); + } + + va_end(ap); +} + +/* Curl_sendf() sends formated data to the server */ +CURLcode Curl_sendf(curl_socket_t sockfd, struct connectdata *conn, + const char *fmt, ...) +{ + struct SessionHandle *data = conn->data; + ssize_t bytes_written; + size_t write_len; + CURLcode res = CURLE_OK; + char *s; + char *sptr; + va_list ap; + va_start(ap, fmt); + s = vaprintf(fmt, ap); /* returns an allocated string */ + va_end(ap); + if(!s) + return CURLE_OUT_OF_MEMORY; /* failure */ + + bytes_written=0; + write_len = strlen(s); + sptr = s; + + for(;;) { + /* Write the buffer to the socket */ + res = Curl_write(conn, sockfd, sptr, write_len, &bytes_written); + + if(CURLE_OK != res) + break; + + if(data->set.verbose) + Curl_debug(data, CURLINFO_DATA_OUT, sptr, (size_t)bytes_written, conn); + + if((size_t)bytes_written != write_len) { + /* if not all was written at once, we must advance the pointer, decrease + the size left and try again! */ + write_len -= bytes_written; + sptr += bytes_written; + } + else + break; + } + + free(s); /* free the output string */ + + return res; +} + +/* + * Curl_write() is an internal write function that sends data to the + * server. Works with plain sockets, SCP, SSL or kerberos. + * + * If the write would block (CURLE_AGAIN), we return CURLE_OK and + * (*written == 0). Otherwise we return regular CURLcode value. + */ +CURLcode Curl_write(struct connectdata *conn, + curl_socket_t sockfd, + const void *mem, + size_t len, + ssize_t *written) +{ + ssize_t bytes_written; + CURLcode curlcode = CURLE_OK; + int num = (sockfd == conn->sock[SECONDARYSOCKET]); + + bytes_written = conn->send[num](conn, num, mem, len, &curlcode); + + *written = bytes_written; + if(bytes_written >= 0) + /* we completely ignore the curlcode value when subzero is not returned */ + return CURLE_OK; + + /* handle CURLE_AGAIN or a send failure */ + switch(curlcode) { + case CURLE_AGAIN: + *written = 0; + return CURLE_OK; + + case CURLE_OK: + /* general send failure */ + return CURLE_SEND_ERROR; + + default: + /* we got a specific curlcode, forward it */ + return (CURLcode)curlcode; + } +} + +ssize_t Curl_send_plain(struct connectdata *conn, int num, + const void *mem, size_t len, CURLcode *code) +{ + curl_socket_t sockfd = conn->sock[num]; + ssize_t bytes_written = swrite(sockfd, mem, len); + + *code = CURLE_OK; + if(-1 == bytes_written) { + int err = SOCKERRNO; + + if( +#ifdef WSAEWOULDBLOCK + /* This is how Windows does it */ + (WSAEWOULDBLOCK == err) +#else + /* errno may be EWOULDBLOCK or on some systems EAGAIN when it returned + due to its inability to send off data without blocking. We therefor + treat both error codes the same here */ + (EWOULDBLOCK == err) || (EAGAIN == err) || (EINTR == err) +#endif + ) { + /* this is just a case of EWOULDBLOCK */ + bytes_written=0; + *code = CURLE_AGAIN; + } else { + failf(conn->data, "Send failure: %s", + Curl_strerror(conn, err)); + conn->data->state.os_errno = err; + *code = CURLE_SEND_ERROR; + } + } + return bytes_written; +} + +/* + * Curl_write_plain() is an internal write function that sends data to the + * server using plain sockets only. Otherwise meant to have the exact same + * proto as Curl_write() + */ +CURLcode Curl_write_plain(struct connectdata *conn, + curl_socket_t sockfd, + const void *mem, + size_t len, + ssize_t *written) +{ + ssize_t bytes_written; + CURLcode retcode; + int num = (sockfd == conn->sock[SECONDARYSOCKET]); + + bytes_written = Curl_send_plain(conn, num, mem, len, &retcode); + + *written = bytes_written; + + return retcode; +} + +ssize_t Curl_recv_plain(struct connectdata *conn, int num, char *buf, + size_t len, CURLcode *code) +{ + curl_socket_t sockfd = conn->sock[num]; + ssize_t nread = sread(sockfd, buf, len); + + *code = CURLE_OK; + if(-1 == nread) { + int err = SOCKERRNO; + + if( +#ifdef WSAEWOULDBLOCK + /* This is how Windows does it */ + (WSAEWOULDBLOCK == err) +#else + /* errno may be EWOULDBLOCK or on some systems EAGAIN when it returned + due to its inability to send off data without blocking. We therefor + treat both error codes the same here */ + (EWOULDBLOCK == err) || (EAGAIN == err) || (EINTR == err) +#endif + ) { + /* this is just a case of EWOULDBLOCK */ + *code = CURLE_AGAIN; + } else { + failf(conn->data, "Recv failure: %s", + Curl_strerror(conn, err)); + conn->data->state.os_errno = err; + *code = CURLE_RECV_ERROR; + } + } + return nread; +} + +static CURLcode pausewrite(struct SessionHandle *data, + int type, /* what type of data */ + const char *ptr, + size_t len) +{ + /* signalled to pause sending on this connection, but since we have data + we want to send we need to dup it to save a copy for when the sending + is again enabled */ + struct SingleRequest *k = &data->req; + char *dupl = malloc(len); + if(!dupl) + return CURLE_OUT_OF_MEMORY; + + memcpy(dupl, ptr, len); + + /* store this information in the state struct for later use */ + data->state.tempwrite = dupl; + data->state.tempwritesize = len; + data->state.tempwritetype = type; + + /* mark the connection as RECV paused */ + k->keepon |= KEEP_RECV_PAUSE; + + DEBUGF(infof(data, "Pausing with %zu bytes in buffer for type %02x\n", + len, type)); + + return CURLE_OK; +} + + +/* Curl_client_write() sends data to the write callback(s) + + The bit pattern defines to what "streams" to write to. Body and/or header. + The defines are in sendf.h of course. + + If CURL_DO_LINEEND_CONV is enabled, data is converted IN PLACE to the + local character encoding. This is a problem and should be changed in + the future to leave the original data alone. + */ +CURLcode Curl_client_write(struct connectdata *conn, + int type, + char *ptr, + size_t len) +{ + struct SessionHandle *data = conn->data; + size_t wrote; + + if(0 == len) + len = strlen(ptr); + + /* If reading is actually paused, we're forced to append this chunk of data + to the already held data, but only if it is the same type as otherwise it + can't work and it'll return error instead. */ + if(data->req.keepon & KEEP_RECV_PAUSE) { + size_t newlen; + char *newptr; + if(type != data->state.tempwritetype) + /* major internal confusion */ + return CURLE_RECV_ERROR; + + DEBUGASSERT(data->state.tempwrite); + + /* figure out the new size of the data to save */ + newlen = len + data->state.tempwritesize; + /* allocate the new memory area */ + newptr = realloc(data->state.tempwrite, newlen); + if(!newptr) + return CURLE_OUT_OF_MEMORY; + /* copy the new data to the end of the new area */ + memcpy(newptr + data->state.tempwritesize, ptr, len); + /* update the pointer and the size */ + data->state.tempwrite = newptr; + data->state.tempwritesize = newlen; + + return CURLE_OK; + } + + if(type & CLIENTWRITE_BODY) { + if((conn->protocol&PROT_FTP) && conn->proto.ftpc.transfertype == 'A') { +#ifdef CURL_DOES_CONVERSIONS + /* convert from the network encoding */ + size_t rc; + rc = Curl_convert_from_network(data, ptr, len); + /* Curl_convert_from_network calls failf if unsuccessful */ + if(rc != CURLE_OK) + return rc; +#endif /* CURL_DOES_CONVERSIONS */ + +#ifdef CURL_DO_LINEEND_CONV + /* convert end-of-line markers */ + len = convert_lineends(data, ptr, len); +#endif /* CURL_DO_LINEEND_CONV */ + } + /* If the previous block of data ended with CR and this block of data is + just a NL, then the length might be zero */ + if(len) { + wrote = data->set.fwrite_func(ptr, 1, len, data->set.out); + } + else { + wrote = len; + } + + if(CURL_WRITEFUNC_PAUSE == wrote) + return pausewrite(data, type, ptr, len); + + if(wrote != len) { + failf(data, "Failed writing body (%zu != %zu)", wrote, len); + return CURLE_WRITE_ERROR; + } + } + + if((type & CLIENTWRITE_HEADER) && + (data->set.fwrite_header || data->set.writeheader) ) { + /* + * Write headers to the same callback or to the especially setup + * header callback function (added after version 7.7.1). + */ + curl_write_callback writeit= + data->set.fwrite_header?data->set.fwrite_header:data->set.fwrite_func; + + /* Note: The header is in the host encoding + regardless of the ftp transfer mode (ASCII/Image) */ + + wrote = writeit(ptr, 1, len, data->set.writeheader); + if(CURL_WRITEFUNC_PAUSE == wrote) + /* here we pass in the HEADER bit only since if this was body as well + then it was passed already and clearly that didn't trigger the pause, + so this is saved for later with the HEADER bit only */ + return pausewrite(data, CLIENTWRITE_HEADER, ptr, len); + + if(wrote != len) { + failf (data, "Failed writing header"); + return CURLE_WRITE_ERROR; + } + } + + return CURLE_OK; +} + +CURLcode Curl_read_plain(curl_socket_t sockfd, + char *buf, + size_t bytesfromsocket, + ssize_t *n) +{ + ssize_t nread = sread(sockfd, buf, bytesfromsocket); + + if(-1 == nread) { + int err = SOCKERRNO; +#ifdef USE_WINSOCK + if(WSAEWOULDBLOCK == err) +#else + if((EWOULDBLOCK == err) || (EAGAIN == err) || (EINTR == err)) +#endif + return CURLE_AGAIN; + else + return CURLE_RECV_ERROR; + } + + /* we only return number of bytes read when we return OK */ + *n = nread; + return CURLE_OK; +} + +/* + * Internal read-from-socket function. This is meant to deal with plain + * sockets, SSL sockets and kerberos sockets. + * + * Returns a regular CURLcode value. + */ +CURLcode Curl_read(struct connectdata *conn, /* connection data */ + curl_socket_t sockfd, /* read from this socket */ + char *buf, /* store read data here */ + size_t sizerequested, /* max amount to read */ + ssize_t *n) /* amount bytes read */ +{ + CURLcode curlcode = CURLE_RECV_ERROR; + ssize_t nread = 0; + size_t bytesfromsocket = 0; + char *buffertofill = NULL; + bool pipelining = (bool)(conn->data->multi && + Curl_multi_canPipeline(conn->data->multi)); + + /* Set 'num' to 0 or 1, depending on which socket that has been sent here. + If it is the second socket, we set num to 1. Otherwise to 0. This lets + us use the correct ssl handle. */ + int num = (sockfd == conn->sock[SECONDARYSOCKET]); + + *n=0; /* reset amount to zero */ + + /* If session can pipeline, check connection buffer */ + if(pipelining) { + size_t bytestocopy = CURLMIN(conn->buf_len - conn->read_pos, + sizerequested); + + /* Copy from our master buffer first if we have some unread data there*/ + if(bytestocopy > 0) { + memcpy(buf, conn->master_buffer + conn->read_pos, bytestocopy); + conn->read_pos += bytestocopy; + conn->bits.stream_was_rewound = FALSE; + + *n = (ssize_t)bytestocopy; + return CURLE_OK; + } + /* If we come here, it means that there is no data to read from the buffer, + * so we read from the socket */ + bytesfromsocket = CURLMIN(sizerequested, BUFSIZE * sizeof (char)); + buffertofill = conn->master_buffer; + } + else { + bytesfromsocket = CURLMIN((long)sizerequested, + conn->data->set.buffer_size ? + conn->data->set.buffer_size : BUFSIZE); + buffertofill = buf; + } + + nread = conn->recv[num](conn, num, buffertofill, bytesfromsocket, &curlcode); + if(nread < 0) + return curlcode; + + if(pipelining) { + memcpy(buf, conn->master_buffer, nread); + conn->buf_len = nread; + conn->read_pos = nread; + } + + *n += nread; + + return CURLE_OK; +} + +/* return 0 on success */ +static int showit(struct SessionHandle *data, curl_infotype type, + char *ptr, size_t size) +{ + static const char s_infotype[CURLINFO_END][3] = { + "* ", "< ", "> ", "{ ", "} ", "{ ", "} " }; + +#ifdef CURL_DOES_CONVERSIONS + char buf[BUFSIZE+1]; + size_t conv_size = 0; + + switch(type) { + case CURLINFO_HEADER_OUT: + /* assume output headers are ASCII */ + /* copy the data into my buffer so the original is unchanged */ + if(size > BUFSIZE) { + size = BUFSIZE; /* truncate if necessary */ + buf[BUFSIZE] = '\0'; + } + conv_size = size; + memcpy(buf, ptr, size); + /* Special processing is needed for this block if it + * contains both headers and data (separated by CRLFCRLF). + * We want to convert just the headers, leaving the data as-is. + */ + if(size > 4) { + size_t i; + for(i = 0; i < size-4; i++) { + if(memcmp(&buf[i], "\x0d\x0a\x0d\x0a", 4) == 0) { + /* convert everthing through this CRLFCRLF but no further */ + conv_size = i + 4; + break; + } + } + } + + Curl_convert_from_network(data, buf, conv_size); + /* Curl_convert_from_network calls failf if unsuccessful */ + /* we might as well continue even if it fails... */ + ptr = buf; /* switch pointer to use my buffer instead */ + break; + default: + /* leave everything else as-is */ + break; + } +#endif /* CURL_DOES_CONVERSIONS */ + + if(data->set.fdebug) + return (*data->set.fdebug)(data, type, ptr, size, + data->set.debugdata); + + switch(type) { + case CURLINFO_TEXT: + case CURLINFO_HEADER_OUT: + case CURLINFO_HEADER_IN: + fwrite(s_infotype[type], 2, 1, data->set.err); + fwrite(ptr, size, 1, data->set.err); +#ifdef CURL_DOES_CONVERSIONS + if(size != conv_size) { + /* we had untranslated data so we need an explicit newline */ + fwrite("\n", 1, 1, data->set.err); + } +#endif + break; + default: /* nada */ + break; + } + return 0; +} + +int Curl_debug(struct SessionHandle *data, curl_infotype type, + char *ptr, size_t size, + struct connectdata *conn) +{ + int rc; + if(data->set.printhost && conn && conn->host.dispname) { + char buffer[160]; + const char *t=NULL; + const char *w="Data"; + switch (type) { + case CURLINFO_HEADER_IN: + w = "Header"; + case CURLINFO_DATA_IN: + t = "from"; + break; + case CURLINFO_HEADER_OUT: + w = "Header"; + case CURLINFO_DATA_OUT: + t = "to"; + break; + default: + break; + } + + if(t) { + snprintf(buffer, sizeof(buffer), "[%s %s %s]", w, t, + conn->host.dispname); + rc = showit(data, CURLINFO_TEXT, buffer, strlen(buffer)); + if(rc) + return rc; + } + } + rc = showit(data, type, ptr, size); + return rc; +} diff --git a/mobicore/common/curl/lib/sendf.h b/mobicore/common/curl/lib/sendf.h new file mode 100644 index 0000000000000000000000000000000000000000..8f0ea24d7886890373082eca88f4654577628d63 --- /dev/null +++ b/mobicore/common/curl/lib/sendf.h @@ -0,0 +1,90 @@ +#ifndef HEADER_CURL_SENDF_H +#define HEADER_CURL_SENDF_H +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) 1998 - 2010, Daniel Stenberg, , et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at http://curl.haxx.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ***************************************************************************/ + +#include "setup.h" + +CURLcode Curl_sendf(curl_socket_t sockfd, struct connectdata *, + const char *fmt, ...); +void Curl_infof(struct SessionHandle *, const char *fmt, ...); +void Curl_failf(struct SessionHandle *, const char *fmt, ...); + +#if defined(CURL_DISABLE_VERBOSE_STRINGS) + +#if defined(HAVE_VARIADIC_MACROS_C99) +#define infof(...) do { } while (0) +#elif defined(HAVE_VARIADIC_MACROS_GCC) +#define infof(x...) do { } while (0) +#else +#define infof (void) +#endif + +#else /* CURL_DISABLE_VERBOSE_STRINGS */ + +#define infof Curl_infof + +#endif /* CURL_DISABLE_VERBOSE_STRINGS */ + +#define failf Curl_failf + +#define CLIENTWRITE_BODY (1<<0) +#define CLIENTWRITE_HEADER (1<<1) +#define CLIENTWRITE_BOTH (CLIENTWRITE_BODY|CLIENTWRITE_HEADER) + +CURLcode Curl_client_write(struct connectdata *conn, int type, char *ptr, + size_t len); + +/* internal read-function, does plain socket only */ +CURLcode Curl_read_plain(curl_socket_t sockfd, + char *buf, + size_t bytesfromsocket, + ssize_t *n); + +ssize_t Curl_recv_plain(struct connectdata *conn, int num, char *buf, + size_t len, CURLcode *code); +ssize_t Curl_send_plain(struct connectdata *conn, int num, + const void *mem, size_t len, CURLcode *code); + +/* internal read-function, does plain socket, SSL and krb4 */ +CURLcode Curl_read(struct connectdata *conn, curl_socket_t sockfd, + char *buf, size_t buffersize, + ssize_t *n); +/* internal write-function, does plain socket, SSL, SCP, SFTP and krb4 */ +CURLcode Curl_write(struct connectdata *conn, + curl_socket_t sockfd, + const void *mem, size_t len, + ssize_t *written); + +/* internal write-function, does plain sockets ONLY */ +CURLcode Curl_write_plain(struct connectdata *conn, + curl_socket_t sockfd, + const void *mem, size_t len, + ssize_t *written); + +/* the function used to output verbose information */ +int Curl_debug(struct SessionHandle *handle, curl_infotype type, + char *data, size_t size, + struct connectdata *conn); + + +#endif /* HEADER_CURL_SENDF_H */ diff --git a/mobicore/common/curl/lib/setup-os400.h b/mobicore/common/curl/lib/setup-os400.h new file mode 100644 index 0000000000000000000000000000000000000000..cdeefe3ddb4eaeab22d6064536aecff35d4e834b --- /dev/null +++ b/mobicore/common/curl/lib/setup-os400.h @@ -0,0 +1,140 @@ +#ifndef HEADER_CURL_SETUP_OS400_H +#define HEADER_CURL_SETUP_OS400_H +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) 1998 - 2010, Daniel Stenberg, , et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at http://curl.haxx.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ***************************************************************************/ + + +/* OS/400 netdb.h does not define NI_MAXHOST. */ +#define NI_MAXHOST 1025 + +/* OS/400 netdb.h does not define NI_MAXSERV. */ +#define NI_MAXSERV 32 + +/* No OS/400 header file defines u_int32_t. */ +typedef unsigned long u_int32_t; + + +/* System API wrapper prototypes and definitions to support ASCII parameters. */ + +#include +#include +#include +#include + +extern int Curl_getaddrinfo_a(const char * nodename, const char * servname, + const struct addrinfo * hints, + struct addrinfo * * res); +#define getaddrinfo Curl_getaddrinfo_a + + +extern int Curl_getnameinfo_a(const struct sockaddr * sa, + curl_socklen_t salen, + char * nodename, curl_socklen_t nodenamelen, + char * servname, curl_socklen_t servnamelen, + int flags); +#define getnameinfo Curl_getnameinfo_a + + +/* SSL wrappers. */ + +extern int Curl_SSL_Init_Application_a(SSLInitApp * init_app); +#define SSL_Init_Application Curl_SSL_Init_Application_a + + +extern int Curl_SSL_Init_a(SSLInit * init); +#define SSL_Init Curl_SSL_Init_a + + +extern char * Curl_SSL_Strerror_a(int sslreturnvalue, SSLErrorMsg * serrmsgp); +#define SSL_Strerror Curl_SSL_Strerror_a + + +/* GSSAPI wrappers. */ + +extern OM_uint32 Curl_gss_import_name_a(OM_uint32 * minor_status, + gss_buffer_t in_name, + gss_OID in_name_type, + gss_name_t * out_name); +#define gss_import_name Curl_gss_import_name_a + + +extern OM_uint32 Curl_gss_display_status_a(OM_uint32 * minor_status, + OM_uint32 status_value, + int status_type, gss_OID mech_type, + gss_msg_ctx_t * message_context, + gss_buffer_t status_string); +#define gss_display_status Curl_gss_display_status_a + + +extern OM_uint32 Curl_gss_init_sec_context_a(OM_uint32 * minor_status, + gss_cred_id_t cred_handle, + gss_ctx_id_t * context_handle, + gss_name_t target_name, + gss_OID mech_type, + gss_flags_t req_flags, + OM_uint32 time_req, + gss_channel_bindings_t + input_chan_bindings, + gss_buffer_t input_token, + gss_OID * actual_mech_type, + gss_buffer_t output_token, + gss_flags_t * ret_flags, + OM_uint32 * time_rec); +#define gss_init_sec_context Curl_gss_init_sec_context_a + + +extern OM_uint32 Curl_gss_delete_sec_context_a(OM_uint32 * minor_status, + gss_ctx_id_t * context_handle, + gss_buffer_t output_token); +#define gss_delete_sec_context Curl_gss_delete_sec_context_a + +/* LDAP wrappers. */ + +#define BerValue struct berval + +#define ldap_url_parse ldap_url_parse_utf8 +#define ldap_init Curl_ldap_init_a +#define ldap_simple_bind_s Curl_ldap_simple_bind_s_a +#define ldap_search_s Curl_ldap_search_s_a +#define ldap_get_values_len Curl_ldap_get_values_len_a +#define ldap_err2string Curl_ldap_err2string_a +#define ldap_get_dn Curl_ldap_get_dn_a +#define ldap_first_attribute Curl_ldap_first_attribute_a +#define ldap_next_attribute Curl_ldap_next_attribute_a + +/* Some socket functions must be wrapped to process textual addresses + like AF_UNIX. */ + +extern int Curl_os400_connect(int sd, struct sockaddr * destaddr, int addrlen); +extern int Curl_os400_bind(int sd, struct sockaddr * localaddr, int addrlen); +extern int Curl_os400_sendto(int sd, char * buffer, int buflen, int flags, + struct sockaddr * dstaddr, int addrlen); +extern int Curl_os400_recvfrom(int sd, char * buffer, int buflen, int flags, + struct sockaddr * fromaddr, int * addrlen); + +#define connect Curl_os400_connect +#define bind Curl_os400_bind +#define sendto Curl_os400_sendto +#define recvfrom Curl_os400_recvfrom + + +#endif /* HEADER_CURL_SETUP_OS400_H */ diff --git a/mobicore/common/curl/lib/setup.h b/mobicore/common/curl/lib/setup.h new file mode 100644 index 0000000000000000000000000000000000000000..cc016c9cd37457b9dc2a1be823f4103a79823e3c --- /dev/null +++ b/mobicore/common/curl/lib/setup.h @@ -0,0 +1,568 @@ +#ifndef HEADER_CURL_LIB_SETUP_H +#define HEADER_CURL_LIB_SETUP_H +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) 1998 - 2010, Daniel Stenberg, , et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at http://curl.haxx.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ***************************************************************************/ + +/* + * Define WIN32 when build target is Win32 API + */ + +#if (defined(_WIN32) || defined(__WIN32__)) && !defined(WIN32) && !defined(__SYMBIAN32__) +#define WIN32 +#endif + +/* + * Include configuration script results or hand-crafted + * configuration file for platforms which lack config tool. + */ + +#ifdef HAVE_CONFIG_H + +#include "curl_config.h" + +#else /* HAVE_CONFIG_H */ + +#ifdef _WIN32_WCE +# include "config-win32ce.h" +#else +# ifdef WIN32 +# include "config-win32.h" +# endif +#endif + +#if defined(macintosh) && defined(__MRC__) +# include "config-mac.h" +#endif + +#ifdef __AMIGA__ +# include "amigaos.h" +#endif + +#ifdef __SYMBIAN32__ +# include "config-symbian.h" +#endif + +#ifdef __OS400__ +# include "config-os400.h" +#endif + +#ifdef TPF +# include "config-tpf.h" +#endif + +#ifdef __VXWORKS__ +# include "config-vxworks.h" +#endif + +#endif /* HAVE_CONFIG_H */ + +/* ================================================================ */ +/* Definition of preprocessor macros/symbols which modify compiler */ +/* behavior or generated code characteristics must be done here, */ +/* as appropriate, before any system header file is included. It is */ +/* also possible to have them defined in the config file included */ +/* before this point. As a result of all this we frown inclusion of */ +/* system header files in our config files, avoid this at any cost. */ +/* ================================================================ */ + +/* + * AIX 4.3 and newer needs _THREAD_SAFE defined to build + * proper reentrant code. Others may also need it. + */ + +#ifdef NEED_THREAD_SAFE +# ifndef _THREAD_SAFE +# define _THREAD_SAFE +# endif +#endif + +/* + * Tru64 needs _REENTRANT set for a few function prototypes and + * things to appear in the system header files. Unixware needs it + * to build proper reentrant code. Others may also need it. + */ + +#ifdef NEED_REENTRANT +# ifndef _REENTRANT +# define _REENTRANT +# endif +#endif + +/* ================================================================ */ +/* If you need to include a system header file for your platform, */ +/* please, do it beyond the point further indicated in this file. */ +/* ================================================================ */ + +/* + * libcurl's external interface definitions are also used internally, + * and might also include required system header files to define them. + */ + +#include + +/* + * Compile time sanity checks must also be done when building the library. + */ + +#include + +/* + * Ensure that no one is using the old SIZEOF_CURL_OFF_T macro + */ + +#ifdef SIZEOF_CURL_OFF_T +# error "SIZEOF_CURL_OFF_T shall not be defined!" + Error Compilation_aborted_SIZEOF_CURL_OFF_T_shall_not_be_defined +#endif + +/* + * Set up internal curl_off_t formatting string directives for + * exclusive use with libcurl's internal *printf functions. + */ + +#ifdef FORMAT_OFF_T +# error "FORMAT_OFF_T shall not be defined before this point!" + Error Compilation_aborted_FORMAT_OFF_T_already_defined +#endif + +#ifdef FORMAT_OFF_TU +# error "FORMAT_OFF_TU shall not be defined before this point!" + Error Compilation_aborted_FORMAT_OFF_TU_already_defined +#endif + +#if (CURL_SIZEOF_CURL_OFF_T > CURL_SIZEOF_LONG) +# define FORMAT_OFF_T "lld" +# define FORMAT_OFF_TU "llu" +#else +# define FORMAT_OFF_T "ld" +# define FORMAT_OFF_TU "lu" +#endif + +/* + * Disable other protocols when http is the only one desired. + */ + +#ifdef HTTP_ONLY +# define CURL_DISABLE_TFTP +# define CURL_DISABLE_FTP +# define CURL_DISABLE_LDAP +# define CURL_DISABLE_TELNET +# define CURL_DISABLE_DICT +# define CURL_DISABLE_FILE +# define CURL_DISABLE_RTSP +#endif + +/* + * When http is disabled rtsp is not supported. + */ + +#if defined(CURL_DISABLE_HTTP) && !defined(CURL_DISABLE_RTSP) +# define CURL_DISABLE_RTSP +#endif + +/* ================================================================ */ +/* No system header file shall be included in this file before this */ +/* point. The only allowed ones are those included from curlbuild.h */ +/* ================================================================ */ + +/* + * OS/400 setup file includes some system headers. + */ + +#ifdef __OS400__ +# include "setup-os400.h" +#endif + +/* + * Include header files for windows builds before redefining anything. + * Use this preprocessor block only to include or exclude windows.h, + * winsock2.h, ws2tcpip.h or winsock.h. Any other windows thing belongs + * to any other further and independent block. Under Cygwin things work + * just as under linux (e.g. ) and the winsock headers should + * never be included when __CYGWIN__ is defined. configure script takes + * care of this, not defining HAVE_WINDOWS_H, HAVE_WINSOCK_H, HAVE_WINSOCK2_H, + * neither HAVE_WS2TCPIP_H when __CYGWIN__ is defined. + */ + +#ifdef HAVE_WINDOWS_H +# ifndef WIN32_LEAN_AND_MEAN +# define WIN32_LEAN_AND_MEAN +# endif +# include +# ifdef HAVE_WINSOCK2_H +# include +# ifdef HAVE_WS2TCPIP_H +# include +# endif +# else +# ifdef HAVE_WINSOCK_H +# include +# endif +# endif +#endif + +/* + * Define USE_WINSOCK to 2 if we have and use WINSOCK2 API, else + * define USE_WINSOCK to 1 if we have and use WINSOCK API, else + * undefine USE_WINSOCK. + */ + +#undef USE_WINSOCK + +#ifdef HAVE_WINSOCK2_H +# define USE_WINSOCK 2 +#else +# ifdef HAVE_WINSOCK_H +# define USE_WINSOCK 1 +# endif +#endif + +#ifdef HAVE_EXTRA_STRICMP_H +# include +#endif + +#ifdef HAVE_EXTRA_STRDUP_H +# include +#endif + +#ifdef TPF +# include /* for bzero, strcasecmp, and strncasecmp */ +# include /* for strcpy and strlen */ +# include /* for rand and srand */ +# include /* for select and ioctl*/ +# include /* for in_addr_t definition */ +# include /* for tpf_process_signals */ + /* change which select is used for libcurl */ +# define select(a,b,c,d,e) tpf_select_libcurl(a,b,c,d,e) +#endif + +#ifdef __VXWORKS__ +# include /* for generic BSD socket functions */ +# include /* for basic I/O interface functions */ +#endif + +#include +#ifdef HAVE_ASSERT_H +#include +#endif +#include + +#ifdef __TANDEM /* for nsr-tandem-nsk systems */ +#include +#endif + +#ifndef STDC_HEADERS /* no standard C headers! */ +#include +#endif + +#ifdef __POCC__ +# include +# include +# define sys_nerr EILSEQ +#endif + +/* + * Salford-C kludge section (mostly borrowed from wxWidgets). + */ +#ifdef __SALFORDC__ + #pragma suppress 353 /* Possible nested comments */ + #pragma suppress 593 /* Define not used */ + #pragma suppress 61 /* enum has no name */ + #pragma suppress 106 /* unnamed, unused parameter */ + #include +#endif + +/* + * Large file (>2Gb) support using WIN32 functions. + */ + +#ifdef USE_WIN32_LARGE_FILES +# include +# include +# include +# define lseek(fdes,offset,whence) _lseeki64(fdes, offset, whence) +# define fstat(fdes,stp) _fstati64(fdes, stp) +# define stat(fname,stp) _stati64(fname, stp) +# define struct_stat struct _stati64 +# define LSEEK_ERROR (__int64)-1 +#endif + +/* + * Small file (<2Gb) support using WIN32 functions. + */ + +#ifdef USE_WIN32_SMALL_FILES +# include +# include +# include +# define lseek(fdes,offset,whence) _lseek(fdes, (long)offset, whence) +# define fstat(fdes,stp) _fstat(fdes, stp) +# define stat(fname,stp) _stat(fname, stp) +# define struct_stat struct _stat +# define LSEEK_ERROR (long)-1 +#endif + +#ifndef struct_stat +# define struct_stat struct stat +#endif + +#ifndef LSEEK_ERROR +# define LSEEK_ERROR (off_t)-1 +#endif + +/* + * Default sizeof(off_t) in case it hasn't been defined in config file. + */ + +#ifndef SIZEOF_OFF_T +# if defined(__VMS) && !defined(__VAX) +# if defined(_LARGEFILE) +# define SIZEOF_OFF_T 8 +# endif +# elif defined(__OS400__) && defined(__ILEC400__) +# if defined(_LARGE_FILES) +# define SIZEOF_OFF_T 8 +# endif +# elif defined(__MVS__) && defined(__IBMC__) +# if defined(_LP64) || defined(_LARGE_FILES) +# define SIZEOF_OFF_T 8 +# endif +# elif defined(__370__) && defined(__IBMC__) +# if defined(_LP64) || defined(_LARGE_FILES) +# define SIZEOF_OFF_T 8 +# endif +# endif +# ifndef SIZEOF_OFF_T +# define SIZEOF_OFF_T 4 +# endif +#endif + +/* + * Arg 2 type for gethostname in case it hasn't been defined in config file. + */ + +#ifndef GETHOSTNAME_TYPE_ARG2 +# ifdef USE_WINSOCK +# define GETHOSTNAME_TYPE_ARG2 int +# else +# define GETHOSTNAME_TYPE_ARG2 size_t +# endif +#endif + +/* Below we define some functions. They should + + 4. set the SIGALRM signal timeout + 5. set dir/file naming defines + */ + +#ifdef WIN32 + +# define DIR_CHAR "\\" +# define DOT_CHAR "_" + +#else /* WIN32 */ + +# ifdef MSDOS /* Watt-32 */ + +# include +# define select(n,r,w,x,t) select_s(n,r,w,x,t) +# define ioctl(x,y,z) ioctlsocket(x,y,(char *)(z)) +# include +# ifdef word +# undef word +# endif +# ifdef byte +# undef byte +# endif + +# endif /* MSDOS */ + +# ifdef __minix + /* Minix 3 versions up to at least 3.1.3 are missing these prototypes */ + extern char * strtok_r(char *s, const char *delim, char **last); + extern struct tm * gmtime_r(const time_t * const timep, struct tm *tmp); +# endif + +# define DIR_CHAR "/" +# ifndef DOT_CHAR +# define DOT_CHAR "." +# endif + +# ifdef MSDOS +# undef DOT_CHAR +# define DOT_CHAR "_" +# endif + +# ifndef fileno /* sunos 4 have this as a macro! */ + int fileno( FILE *stream); +# endif + +#endif /* WIN32 */ + +/* + * msvc 6.0 requires PSDK in order to have INET6_ADDRSTRLEN + * defined in ws2tcpip.h as well as to provide IPv6 support. + */ + +#if defined(_MSC_VER) && !defined(__POCC__) +# if !defined(HAVE_WS2TCPIP_H) || \ + ((_MSC_VER < 1300) && !defined(INET6_ADDRSTRLEN)) +# undef HAVE_GETADDRINFO_THREADSAFE +# undef HAVE_FREEADDRINFO +# undef HAVE_GETADDRINFO +# undef HAVE_GETNAMEINFO +# undef ENABLE_IPV6 +# endif +#endif + +/* ---------------------------------------------------------------- */ +/* resolver specialty compile-time defines */ +/* CURLRES_* defines to use in the host*.c sources */ +/* ---------------------------------------------------------------- */ + +/* + * lcc-win32 doesn't have _beginthreadex(), lacks threads support. + */ + +#if defined(__LCC__) && defined(WIN32) +# undef USE_THREADS_POSIX +# undef USE_THREADS_WIN32 +#endif + +/* + * MSVC threads support requires a multi-threaded runtime library. + * _beginthreadex() is not available in single-threaded ones. + */ + +#if defined(_MSC_VER) && !defined(__POCC__) && !defined(_MT) +# undef USE_THREADS_POSIX +# undef USE_THREADS_WIN32 +#endif + +/* + * Mutually exclusive CURLRES_* definitions. + */ + +#ifdef USE_ARES +# define CURLRES_ASYNCH +# define CURLRES_ARES +#elif defined(USE_THREADS_POSIX) || defined(USE_THREADS_WIN32) +# define CURLRES_ASYNCH +# define CURLRES_THREADED +#else +# define CURLRES_SYNCH +#endif + +#ifdef ENABLE_IPV6 +# define CURLRES_IPV6 +#else +# define CURLRES_IPV4 +#endif + +/* ---------------------------------------------------------------- */ + +/* + * When using WINSOCK, TELNET protocol requires WINSOCK2 API. + */ + +#if defined(USE_WINSOCK) && (USE_WINSOCK != 2) +# define CURL_DISABLE_TELNET 1 +#endif + +/* + * msvc 6.0 does not have struct sockaddr_storage and + * does not define IPPROTO_ESP in winsock2.h. But both + * are available if PSDK is properly installed. + */ + +#if defined(_MSC_VER) && !defined(__POCC__) +# if !defined(HAVE_WINSOCK2_H) || ((_MSC_VER < 1300) && !defined(IPPROTO_ESP)) +# undef HAVE_STRUCT_SOCKADDR_STORAGE +# endif +#endif + +/* + * Intentionally fail to build when using msvc 6.0 without PSDK installed. + * The brave of heart can circumvent this, defining ALLOW_MSVC6_WITHOUT_PSDK + * in lib/config-win32.h although absolutely discouraged and unsupported. + */ + +#if defined(_MSC_VER) && !defined(__POCC__) +# if !defined(HAVE_WINDOWS_H) || ((_MSC_VER < 1300) && !defined(_FILETIME_)) +# if !defined(ALLOW_MSVC6_WITHOUT_PSDK) +# error MSVC 6.0 requires "February 2003 Platform SDK" a.k.a. "Windows Server 2003 PSDK" +# else +# define CURL_DISABLE_LDAP 1 +# endif +# endif +#endif + +#ifdef NETWARE +int netware_init(void); +#ifndef __NOVELL_LIBC__ +#include +#include +#endif +#endif + +#if defined(HAVE_LIBIDN) && defined(HAVE_TLD_H) +/* The lib was present and the tld.h header (which is missing in libidn 0.3.X + but we only work with libidn 0.4.1 or later) */ +#define USE_LIBIDN +#endif + +#ifndef SIZEOF_TIME_T +/* assume default size of time_t to be 32 bit */ +#define SIZEOF_TIME_T 4 +#endif + +#define LIBIDN_REQUIRED_VERSION "0.4.1" + +#if defined(USE_GNUTLS) || defined(USE_SSLEAY) || defined(USE_NSS) || defined(USE_QSOSSL) || defined(USE_POLARSSL) +#define USE_SSL /* SSL support has been enabled */ +#endif + +#if !defined(CURL_DISABLE_HTTP) && !defined(CURL_DISABLE_NTLM) +#if defined(USE_SSLEAY) || defined(USE_WINDOWS_SSPI) || defined(USE_GNUTLS) || defined(USE_NSS) +#define USE_NTLM +#endif +#endif + +/* non-configure builds may define CURL_WANTS_CA_BUNDLE_ENV */ +#if defined(CURL_WANTS_CA_BUNDLE_ENV) && !defined(CURL_CA_BUNDLE) +#define CURL_CA_BUNDLE getenv("CURL_CA_BUNDLE") +#endif + +/* Define S_ISREG if not defined by system headers, f.e. MSVC */ +#if !defined(S_ISREG) && defined(S_IFMT) && defined(S_IFREG) +#define S_ISREG(m) (((m) & S_IFMT) == S_IFREG) +#endif + +/* + * Include macros and defines that should only be processed once. + */ + +#ifndef __SETUP_ONCE_H +#include "setup_once.h" +#endif + +#endif /* HEADER_CURL_LIB_SETUP_H */ diff --git a/mobicore/common/curl/lib/setup_once.h b/mobicore/common/curl/lib/setup_once.h new file mode 100644 index 0000000000000000000000000000000000000000..85e78e8d81d3f6ef0bb54d1f9fed382f6ae06b23 --- /dev/null +++ b/mobicore/common/curl/lib/setup_once.h @@ -0,0 +1,493 @@ +#ifndef __SETUP_ONCE_H +#define __SETUP_ONCE_H +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) 1998 - 2010, Daniel Stenberg, , et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at http://curl.haxx.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ***************************************************************************/ + + +/******************************************************************** + * NOTICE * + * ======== * + * * + * Content of header files lib/setup_once.h and ares/setup_once.h * + * must be kept in sync. Modify the other one if you change this. * + * * + ********************************************************************/ + + +/* + * Inclusion of common header files. + */ + +#include +#include +#include +#include +#include +#include + +#ifdef HAVE_SYS_TYPES_H +#include +#endif + +#ifdef NEED_MALLOC_H +#include +#endif + +#ifdef NEED_MEMORY_H +#include +#endif + +#ifdef HAVE_SYS_STAT_H +#include +#endif + +#ifdef HAVE_SYS_TIME_H +#include +#ifdef TIME_WITH_SYS_TIME +#include +#endif +#else +#ifdef HAVE_TIME_H +#include +#endif +#endif + +#ifdef WIN32 +#include +#include +#endif + +#ifdef HAVE_STDBOOL_H +#include +#endif + + +/* + * Definition of timeval struct for platforms that don't have it. + */ + +#ifndef HAVE_STRUCT_TIMEVAL +struct timeval { + long tv_sec; + long tv_usec; +}; +#endif + + +/* + * If we have the MSG_NOSIGNAL define, make sure we use + * it as the fourth argument of function send() + */ + +#ifdef HAVE_MSG_NOSIGNAL +#define SEND_4TH_ARG MSG_NOSIGNAL +#else +#define SEND_4TH_ARG 0 +#endif + + +#if defined(__minix) +/* Minix doesn't support recv on TCP sockets */ +#define sread(x,y,z) (ssize_t)read((RECV_TYPE_ARG1)(x), \ + (RECV_TYPE_ARG2)(y), \ + (RECV_TYPE_ARG3)(z)) + +#elif defined(HAVE_RECV) +/* + * The definitions for the return type and arguments types + * of functions recv() and send() belong and come from the + * configuration file. Do not define them in any other place. + * + * HAVE_RECV is defined if you have a function named recv() + * which is used to read incoming data from sockets. If your + * function has another name then don't define HAVE_RECV. + * + * If HAVE_RECV is defined then RECV_TYPE_ARG1, RECV_TYPE_ARG2, + * RECV_TYPE_ARG3, RECV_TYPE_ARG4 and RECV_TYPE_RETV must also + * be defined. + * + * HAVE_SEND is defined if you have a function named send() + * which is used to write outgoing data on a connected socket. + * If yours has another name then don't define HAVE_SEND. + * + * If HAVE_SEND is defined then SEND_TYPE_ARG1, SEND_QUAL_ARG2, + * SEND_TYPE_ARG2, SEND_TYPE_ARG3, SEND_TYPE_ARG4 and + * SEND_TYPE_RETV must also be defined. + */ + +#if !defined(RECV_TYPE_ARG1) || \ + !defined(RECV_TYPE_ARG2) || \ + !defined(RECV_TYPE_ARG3) || \ + !defined(RECV_TYPE_ARG4) || \ + !defined(RECV_TYPE_RETV) + /* */ + Error Missing_definition_of_return_and_arguments_types_of_recv + /* */ +#else +#define sread(x,y,z) (ssize_t)recv((RECV_TYPE_ARG1)(x), \ + (RECV_TYPE_ARG2)(y), \ + (RECV_TYPE_ARG3)(z), \ + (RECV_TYPE_ARG4)(0)) +#endif +#else /* HAVE_RECV */ +#ifndef sread + /* */ + Error Missing_definition_of_macro_sread + /* */ +#endif +#endif /* HAVE_RECV */ + + +#if defined(__minix) +/* Minix doesn't support send on TCP sockets */ +#define swrite(x,y,z) (ssize_t)write((SEND_TYPE_ARG1)(x), \ + (SEND_TYPE_ARG2)(y), \ + (SEND_TYPE_ARG3)(z)) + +#elif defined(HAVE_SEND) +#if !defined(SEND_TYPE_ARG1) || \ + !defined(SEND_QUAL_ARG2) || \ + !defined(SEND_TYPE_ARG2) || \ + !defined(SEND_TYPE_ARG3) || \ + !defined(SEND_TYPE_ARG4) || \ + !defined(SEND_TYPE_RETV) + /* */ + Error Missing_definition_of_return_and_arguments_types_of_send + /* */ +#else +#define swrite(x,y,z) (ssize_t)send((SEND_TYPE_ARG1)(x), \ + (SEND_TYPE_ARG2)(y), \ + (SEND_TYPE_ARG3)(z), \ + (SEND_TYPE_ARG4)(SEND_4TH_ARG)) +#endif +#else /* HAVE_SEND */ +#ifndef swrite + /* */ + Error Missing_definition_of_macro_swrite + /* */ +#endif +#endif /* HAVE_SEND */ + + +#if 0 +#if defined(HAVE_RECVFROM) +/* + * Currently recvfrom is only used on udp sockets. + */ +#if !defined(RECVFROM_TYPE_ARG1) || \ + !defined(RECVFROM_TYPE_ARG2) || \ + !defined(RECVFROM_TYPE_ARG3) || \ + !defined(RECVFROM_TYPE_ARG4) || \ + !defined(RECVFROM_TYPE_ARG5) || \ + !defined(RECVFROM_TYPE_ARG6) || \ + !defined(RECVFROM_TYPE_RETV) + /* */ + Error Missing_definition_of_return_and_arguments_types_of_recvfrom + /* */ +#else +#define sreadfrom(s,b,bl,f,fl) (ssize_t)recvfrom((RECVFROM_TYPE_ARG1) (s), \ + (RECVFROM_TYPE_ARG2 *)(b), \ + (RECVFROM_TYPE_ARG3) (bl), \ + (RECVFROM_TYPE_ARG4) (0), \ + (RECVFROM_TYPE_ARG5 *)(f), \ + (RECVFROM_TYPE_ARG6 *)(fl)) +#endif +#else /* HAVE_RECVFROM */ +#ifndef sreadfrom + /* */ + Error Missing_definition_of_macro_sreadfrom + /* */ +#endif +#endif /* HAVE_RECVFROM */ + + +#ifdef RECVFROM_TYPE_ARG6_IS_VOID +# define RECVFROM_ARG6_T int +#else +# define RECVFROM_ARG6_T RECVFROM_TYPE_ARG6 +#endif +#endif /* if 0 */ + + +/* + * Function-like macro definition used to close a socket. + */ + +#if defined(HAVE_CLOSESOCKET) +# define sclose(x) closesocket((x)) +#elif defined(HAVE_CLOSESOCKET_CAMEL) +# define sclose(x) CloseSocket((x)) +#else +# define sclose(x) close((x)) +#endif + + +/* + * Uppercase macro versions of ANSI/ISO is*() functions/macros which + * avoid negative number inputs with argument byte codes > 127. + */ + +#define ISSPACE(x) (isspace((int) ((unsigned char)x))) +#define ISDIGIT(x) (isdigit((int) ((unsigned char)x))) +#define ISALNUM(x) (isalnum((int) ((unsigned char)x))) +#define ISXDIGIT(x) (isxdigit((int) ((unsigned char)x))) +#define ISGRAPH(x) (isgraph((int) ((unsigned char)x))) +#define ISALPHA(x) (isalpha((int) ((unsigned char)x))) +#define ISPRINT(x) (isprint((int) ((unsigned char)x))) +#define ISUPPER(x) (isupper((int) ((unsigned char)x))) +#define ISLOWER(x) (islower((int) ((unsigned char)x))) + +#define ISBLANK(x) (int)((((unsigned char)x) == ' ') || \ + (((unsigned char)x) == '\t')) + + +/* + * 'bool' exists on platforms with , i.e. C99 platforms. + * On non-C99 platforms there's no bool, so define an enum for that. + * On C99 platforms 'false' and 'true' also exist. Enum uses a + * global namespace though, so use bool_false and bool_true. + */ + +#ifndef HAVE_BOOL_T + typedef enum { + bool_false = 0, + bool_true = 1 + } bool; + +/* + * Use a define to let 'true' and 'false' use those enums. There + * are currently no use of true and false in libcurl proper, but + * there are some in the examples. This will cater for any later + * code happening to use true and false. + */ +# define false bool_false +# define true bool_true +# define HAVE_BOOL_T +#endif + + +/* + * Redefine TRUE and FALSE too, to catch current use. With this + * change, 'bool found = 1' will give a warning on MIPSPro, but + * 'bool found = TRUE' will not. Change tested on IRIX/MIPSPro, + * AIX 5.1/Xlc, Tru64 5.1/cc, w/make test too. + */ + +#ifndef TRUE +#define TRUE true +#endif +#ifndef FALSE +#define FALSE false +#endif + + +/* + * Typedef to 'int' if sig_atomic_t is not an available 'typedefed' type. + */ + +#ifndef HAVE_SIG_ATOMIC_T +typedef int sig_atomic_t; +#define HAVE_SIG_ATOMIC_T +#endif + + +/* + * Convenience SIG_ATOMIC_T definition + */ + +#ifdef HAVE_SIG_ATOMIC_T_VOLATILE +#define SIG_ATOMIC_T static sig_atomic_t +#else +#define SIG_ATOMIC_T static volatile sig_atomic_t +#endif + + +/* + * Default return type for signal handlers. + */ + +#ifndef RETSIGTYPE +#define RETSIGTYPE void +#endif + + +/* + * Macro used to include code only in debug builds. + */ + +#ifdef DEBUGBUILD +#define DEBUGF(x) x +#else +#define DEBUGF(x) do { } while (0) +#endif + + +/* + * Macro used to include assertion code only in debug builds. + */ + +#if defined(DEBUGBUILD) && defined(HAVE_ASSERT_H) +#define DEBUGASSERT(x) assert(x) +#else +#define DEBUGASSERT(x) do { } while (0) +#endif + + +/* + * Macro SOCKERRNO / SET_SOCKERRNO() returns / sets the *socket-related* errno + * (or equivalent) on this platform to hide platform details to code using it. + */ + +#ifdef USE_WINSOCK +#define SOCKERRNO ((int)WSAGetLastError()) +#define SET_SOCKERRNO(x) (WSASetLastError((int)(x))) +#else +#define SOCKERRNO (errno) +#define SET_SOCKERRNO(x) (errno = (x)) +#endif + + +/* + * Macro ERRNO / SET_ERRNO() returns / sets the NOT *socket-related* errno + * (or equivalent) on this platform to hide platform details to code using it. + */ + +#ifdef WIN32 +#define ERRNO ((int)GetLastError()) +#define SET_ERRNO(x) (SetLastError((DWORD)(x))) +#else +#define ERRNO (errno) +#define SET_ERRNO(x) (errno = (x)) +#endif + + +/* + * Portable error number symbolic names defined to Winsock error codes. + */ + +#ifdef USE_WINSOCK +#undef EBADF /* override definition in errno.h */ +#define EBADF WSAEBADF +#undef EINTR /* override definition in errno.h */ +#define EINTR WSAEINTR +#undef EINVAL /* override definition in errno.h */ +#define EINVAL WSAEINVAL +#undef EWOULDBLOCK /* override definition in errno.h */ +#define EWOULDBLOCK WSAEWOULDBLOCK +#undef EINPROGRESS /* override definition in errno.h */ +#define EINPROGRESS WSAEINPROGRESS +#undef EALREADY /* override definition in errno.h */ +#define EALREADY WSAEALREADY +#undef ENOTSOCK /* override definition in errno.h */ +#define ENOTSOCK WSAENOTSOCK +#undef EDESTADDRREQ /* override definition in errno.h */ +#define EDESTADDRREQ WSAEDESTADDRREQ +#undef EMSGSIZE /* override definition in errno.h */ +#define EMSGSIZE WSAEMSGSIZE +#undef EPROTOTYPE /* override definition in errno.h */ +#define EPROTOTYPE WSAEPROTOTYPE +#undef ENOPROTOOPT /* override definition in errno.h */ +#define ENOPROTOOPT WSAENOPROTOOPT +#undef EPROTONOSUPPORT /* override definition in errno.h */ +#define EPROTONOSUPPORT WSAEPROTONOSUPPORT +#define ESOCKTNOSUPPORT WSAESOCKTNOSUPPORT +#undef EOPNOTSUPP /* override definition in errno.h */ +#define EOPNOTSUPP WSAEOPNOTSUPP +#define EPFNOSUPPORT WSAEPFNOSUPPORT +#undef EAFNOSUPPORT /* override definition in errno.h */ +#define EAFNOSUPPORT WSAEAFNOSUPPORT +#undef EADDRINUSE /* override definition in errno.h */ +#define EADDRINUSE WSAEADDRINUSE +#undef EADDRNOTAVAIL /* override definition in errno.h */ +#define EADDRNOTAVAIL WSAEADDRNOTAVAIL +#undef ENETDOWN /* override definition in errno.h */ +#define ENETDOWN WSAENETDOWN +#undef ENETUNREACH /* override definition in errno.h */ +#define ENETUNREACH WSAENETUNREACH +#undef ENETRESET /* override definition in errno.h */ +#define ENETRESET WSAENETRESET +#undef ECONNABORTED /* override definition in errno.h */ +#define ECONNABORTED WSAECONNABORTED +#undef ECONNRESET /* override definition in errno.h */ +#define ECONNRESET WSAECONNRESET +#undef ENOBUFS /* override definition in errno.h */ +#define ENOBUFS WSAENOBUFS +#undef EISCONN /* override definition in errno.h */ +#define EISCONN WSAEISCONN +#undef ENOTCONN /* override definition in errno.h */ +#define ENOTCONN WSAENOTCONN +#define ESHUTDOWN WSAESHUTDOWN +#define ETOOMANYREFS WSAETOOMANYREFS +#undef ETIMEDOUT /* override definition in errno.h */ +#define ETIMEDOUT WSAETIMEDOUT +#undef ECONNREFUSED /* override definition in errno.h */ +#define ECONNREFUSED WSAECONNREFUSED +#undef ELOOP /* override definition in errno.h */ +#define ELOOP WSAELOOP +#ifndef ENAMETOOLONG /* possible previous definition in errno.h */ +#define ENAMETOOLONG WSAENAMETOOLONG +#endif +#define EHOSTDOWN WSAEHOSTDOWN +#undef EHOSTUNREACH /* override definition in errno.h */ +#define EHOSTUNREACH WSAEHOSTUNREACH +#ifndef ENOTEMPTY /* possible previous definition in errno.h */ +#define ENOTEMPTY WSAENOTEMPTY +#endif +#define EPROCLIM WSAEPROCLIM +#define EUSERS WSAEUSERS +#define EDQUOT WSAEDQUOT +#define ESTALE WSAESTALE +#define EREMOTE WSAEREMOTE +#endif + + +/* + * Actually use __32_getpwuid() on 64-bit VMS builds for getpwuid() + */ + +#if defined(__VMS) && \ + defined(__INITIAL_POINTER_SIZE) && (__INITIAL_POINTER_SIZE == 64) +#define getpwuid __32_getpwuid +#endif + + +/* + * Macro argv_item_t hides platform details to code using it. + */ + +#ifdef __VMS +#define argv_item_t __char_ptr32 +#else +#define argv_item_t char * +#endif + + +/* + * We use this ZERO_NULL to avoid picky compiler warnings, + * when assigning a NULL pointer to a function pointer var. + */ + +#define ZERO_NULL 0 + + +#endif /* __SETUP_ONCE_H */ + diff --git a/mobicore/common/curl/lib/share.c b/mobicore/common/curl/lib/share.c new file mode 100644 index 0000000000000000000000000000000000000000..e6b8e7a1f3775a3511923c23bd7c744858a8414f --- /dev/null +++ b/mobicore/common/curl/lib/share.c @@ -0,0 +1,218 @@ +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) 1998 - 2009, Daniel Stenberg, , et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at http://curl.haxx.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ***************************************************************************/ + +#include "setup.h" +#include +#include +#include +#include +#include "urldata.h" +#include "share.h" +#include "curl_memory.h" + +/* The last #include file should be: */ +#include "memdebug.h" + +CURLSH * +curl_share_init(void) +{ + struct Curl_share *share = calloc(1, sizeof(struct Curl_share)); + if(share) + share->specifier |= (1<dirty) + /* don't allow setting options while one or more handles are already + using this share */ + return CURLSHE_IN_USE; + + va_start(param, option); + + switch(option) { + case CURLSHOPT_SHARE: + /* this is a type this share will share */ + type = va_arg(param, int); + share->specifier |= (1<hostcache) { + share->hostcache = Curl_mk_dnscache(); + if(!share->hostcache) + return CURLSHE_NOMEM; + } + break; + +#if !defined(CURL_DISABLE_HTTP) && !defined(CURL_DISABLE_COOKIES) + case CURL_LOCK_DATA_COOKIE: + if(!share->cookies) { + share->cookies = Curl_cookie_init(NULL, NULL, NULL, TRUE ); + if(!share->cookies) + return CURLSHE_NOMEM; + } + break; +#endif /* CURL_DISABLE_HTTP */ + + case CURL_LOCK_DATA_SSL_SESSION: /* not supported (yet) */ + case CURL_LOCK_DATA_CONNECT: /* not supported (yet) */ + + default: + return CURLSHE_BAD_OPTION; + } + break; + + case CURLSHOPT_UNSHARE: + /* this is a type this share will no longer share */ + type = va_arg(param, int); + share->specifier &= ~(1<hostcache) { + Curl_hash_destroy(share->hostcache); + share->hostcache = NULL; + } + break; + +#if !defined(CURL_DISABLE_HTTP) && !defined(CURL_DISABLE_COOKIES) + case CURL_LOCK_DATA_COOKIE: + if(share->cookies) { + Curl_cookie_cleanup(share->cookies); + share->cookies = NULL; + } + break; +#endif /* CURL_DISABLE_HTTP */ + + case CURL_LOCK_DATA_SSL_SESSION: + break; + + case CURL_LOCK_DATA_CONNECT: + break; + + default: + return CURLSHE_BAD_OPTION; + } + break; + + case CURLSHOPT_LOCKFUNC: + lockfunc = va_arg(param, curl_lock_function); + share->lockfunc = lockfunc; + break; + + case CURLSHOPT_UNLOCKFUNC: + unlockfunc = va_arg(param, curl_unlock_function); + share->unlockfunc = unlockfunc; + break; + + case CURLSHOPT_USERDATA: + ptr = va_arg(param, void *); + share->clientdata = ptr; + break; + + default: + return CURLSHE_BAD_OPTION; + } + + return CURLSHE_OK; +} + +CURLSHcode +curl_share_cleanup(CURLSH *sh) +{ + struct Curl_share *share = (struct Curl_share *)sh; + + if(share == NULL) + return CURLSHE_INVALID; + + if(share->lockfunc) + share->lockfunc(NULL, CURL_LOCK_DATA_SHARE, CURL_LOCK_ACCESS_SINGLE, + share->clientdata); + + if(share->dirty) { + if(share->unlockfunc) + share->unlockfunc(NULL, CURL_LOCK_DATA_SHARE, share->clientdata); + return CURLSHE_IN_USE; + } + + if(share->hostcache) { + Curl_hash_destroy(share->hostcache); + share->hostcache = NULL; + } + +#if !defined(CURL_DISABLE_HTTP) && !defined(CURL_DISABLE_COOKIES) + if(share->cookies) + Curl_cookie_cleanup(share->cookies); +#endif /* CURL_DISABLE_HTTP */ + + if(share->unlockfunc) + share->unlockfunc(NULL, CURL_LOCK_DATA_SHARE, share->clientdata); + free(share); + + return CURLSHE_OK; +} + + +CURLSHcode +Curl_share_lock(struct SessionHandle *data, curl_lock_data type, + curl_lock_access accesstype) +{ + struct Curl_share *share = data->share; + + if(share == NULL) + return CURLSHE_INVALID; + + if(share->specifier & (1<lockfunc) /* only call this if set! */ + share->lockfunc(data, type, accesstype, share->clientdata); + } + /* else if we don't share this, pretend successful lock */ + + return CURLSHE_OK; +} + +CURLSHcode +Curl_share_unlock(struct SessionHandle *data, curl_lock_data type) +{ + struct Curl_share *share = data->share; + + if(share == NULL) + return CURLSHE_INVALID; + + if(share->specifier & (1<unlockfunc) /* only call this if set! */ + share->unlockfunc (data, type, share->clientdata); + } + + return CURLSHE_OK; +} diff --git a/mobicore/common/curl/lib/share.h b/mobicore/common/curl/lib/share.h new file mode 100644 index 0000000000000000000000000000000000000000..ea8e233d2d17ae2df75fefe57024c4416d2a8389 --- /dev/null +++ b/mobicore/common/curl/lib/share.h @@ -0,0 +1,55 @@ +#ifndef __CURL_SHARE_H +#define __CURL_SHARE_H + +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) 1998 - 2005, Daniel Stenberg, , et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at http://curl.haxx.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ***************************************************************************/ + +#include "setup.h" +#include +#include "cookie.h" + +/* SalfordC says "A structure member may not be volatile". Hence: + */ +#ifdef __SALFORDC__ +#define CURL_VOLATILE +#else +#define CURL_VOLATILE volatile +#endif + +/* this struct is libcurl-private, don't export details */ +struct Curl_share { + unsigned int specifier; + CURL_VOLATILE unsigned int dirty; + + curl_lock_function lockfunc; + curl_unlock_function unlockfunc; + void *clientdata; + + struct curl_hash *hostcache; + struct CookieInfo *cookies; +}; + +CURLSHcode Curl_share_lock (struct SessionHandle *, curl_lock_data, + curl_lock_access); +CURLSHcode Curl_share_unlock (struct SessionHandle *, curl_lock_data); + +#endif /* __CURL_SHARE_H */ diff --git a/mobicore/common/curl/lib/slist.c b/mobicore/common/curl/lib/slist.c new file mode 100644 index 0000000000000000000000000000000000000000..7c0f67b1c923c7365b8a892b843992fa79865228 --- /dev/null +++ b/mobicore/common/curl/lib/slist.c @@ -0,0 +1,135 @@ +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) 1998 - 2009, Daniel Stenberg, , et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at http://curl.haxx.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ***************************************************************************/ + +#include "setup.h" + +#include +#include +#include + +#include +#include "curl_memory.h" +#include "slist.h" + +/* The last #include file should be: */ +#include "memdebug.h" + +/* returns last node in linked list */ +static struct curl_slist *slist_get_last(struct curl_slist *list) +{ + struct curl_slist *item; + + /* if caller passed us a NULL, return now */ + if(!list) + return NULL; + + /* loop through to find the last item */ + item = list; + while(item->next) { + item = item->next; + } + return item; +} + +/* + * curl_slist_append() appends a string to the linked list. It always returns + * the address of the first record, so that you can use this function as an + * initialization function as well as an append function. If you find this + * bothersome, then simply create a separate _init function and call it + * appropriately from within the program. + */ +struct curl_slist *curl_slist_append(struct curl_slist *list, + const char *data) +{ + struct curl_slist *last; + struct curl_slist *new_item; + + new_item = malloc(sizeof(struct curl_slist)); + if(new_item) { + char *dupdata = strdup(data); + if(dupdata) { + new_item->next = NULL; + new_item->data = dupdata; + } + else { + free(new_item); + return NULL; + } + } + else + return NULL; + + if(list) { + last = slist_get_last(list); + last->next = new_item; + return list; + } + + /* if this is the first item, then new_item *is* the list */ + return new_item; +} + +/* + * Curl_slist_duplicate() duplicates a linked list. It always returns the + * address of the first record of the cloned list or NULL in case of an + * error (or if the input list was NULL). + */ +struct curl_slist *Curl_slist_duplicate(struct curl_slist *inlist) +{ + struct curl_slist *outlist = NULL; + struct curl_slist *tmp; + + while(inlist) { + tmp = curl_slist_append(outlist, inlist->data); + + if (!tmp) { + curl_slist_free_all(outlist); + return NULL; + } + + outlist = tmp; + inlist = inlist->next; + } + return outlist; +} + +/* be nice and clean up resources */ +void curl_slist_free_all(struct curl_slist *list) +{ + struct curl_slist *next; + struct curl_slist *item; + + if(!list) + return; + + item = list; + do { + next = item->next; + + if(item->data) { + free(item->data); + } + free(item); + item = next; + } while(next); +} + diff --git a/mobicore/common/curl/lib/slist.h b/mobicore/common/curl/lib/slist.h new file mode 100644 index 0000000000000000000000000000000000000000..161b1509e517f35fcf91bae21902bd3b7a4c687e --- /dev/null +++ b/mobicore/common/curl/lib/slist.h @@ -0,0 +1,32 @@ +#ifndef __SLIST_H +#define __SLIST_H +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) 1998 - 2009, Daniel Stenberg, , et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at http://curl.haxx.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ***************************************************************************/ + +/* + * Curl_slist_duplicate() duplicates a linked list. It always returns the + * address of the first record of the cloned list or NULL in case of an + * error (or if the input list was NULL). + */ +struct curl_slist *Curl_slist_duplicate(struct curl_slist *inlist); + +#endif /* __SLIST_H */ diff --git a/mobicore/common/curl/lib/smtp.c b/mobicore/common/curl/lib/smtp.c new file mode 100644 index 0000000000000000000000000000000000000000..82621a42b7c86c952bfa893a007ee905d461f490 --- /dev/null +++ b/mobicore/common/curl/lib/smtp.c @@ -0,0 +1,1508 @@ +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) 1998 - 2010, Daniel Stenberg, , et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at http://curl.haxx.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + * RFC2821 SMTP protocol + * RFC3207 SMTP over TLS + * RFC4954 SMTP Authentication + * RFC2195 CRAM-MD5 authentication + * RFC4616 PLAIN authentication + * + ***************************************************************************/ + +#include "setup.h" + +#ifndef CURL_DISABLE_SMTP +#include +#include +#include +#include +#include + +#ifdef HAVE_UNISTD_H +#include +#endif + +#ifdef HAVE_SYS_SOCKET_H +#include +#endif +#ifdef HAVE_NETINET_IN_H +#include +#endif +#ifdef HAVE_ARPA_INET_H +#include +#endif +#ifdef HAVE_UTSNAME_H +#include +#endif +#ifdef HAVE_NETDB_H +#include +#endif +#ifdef __VMS +#include +#include +#endif + +#if (defined(NETWARE) && defined(__NOVELL_LIBC__)) +#undef in_addr_t +#define in_addr_t unsigned long +#endif + +#include +#include "urldata.h" +#include "sendf.h" +#include "easyif.h" /* for Curl_convert_... prototypes */ + +#include "if2ip.h" +#include "hostip.h" +#include "progress.h" +#include "transfer.h" +#include "escape.h" +#include "http.h" /* for HTTP proxy tunnel stuff */ +#include "socks.h" +#include "smtp.h" + +#include "strtoofft.h" +#include "strequal.h" +#include "sslgen.h" +#include "connect.h" +#include "strerror.h" +#include "select.h" +#include "multiif.h" +#include "url.h" +#include "rawstr.h" +#include "strtoofft.h" +#include "curl_base64.h" +#include "curl_md5.h" +#include "curl_hmac.h" +#include "curl_gethostname.h" +#include "warnless.h" + +#define _MPRINTF_REPLACE /* use our functions only */ +#include + +#include "curl_memory.h" +/* The last #include file should be: */ +#include "memdebug.h" + +/* Local API functions */ +static CURLcode smtp_regular_transfer(struct connectdata *conn, bool *done); +static CURLcode smtp_do(struct connectdata *conn, bool *done); +static CURLcode smtp_done(struct connectdata *conn, + CURLcode, bool premature); +static CURLcode smtp_connect(struct connectdata *conn, bool *done); +static CURLcode smtp_disconnect(struct connectdata *conn, bool dead_connection); +static CURLcode smtp_multi_statemach(struct connectdata *conn, bool *done); +static int smtp_getsock(struct connectdata *conn, + curl_socket_t *socks, + int numsocks); +static CURLcode smtp_doing(struct connectdata *conn, + bool *dophase_done); +static CURLcode smtp_setup_connection(struct connectdata * conn); + + +/* + * SMTP protocol handler. + */ + +const struct Curl_handler Curl_handler_smtp = { + "SMTP", /* scheme */ + smtp_setup_connection, /* setup_connection */ + smtp_do, /* do_it */ + smtp_done, /* done */ + ZERO_NULL, /* do_more */ + smtp_connect, /* connect_it */ + smtp_multi_statemach, /* connecting */ + smtp_doing, /* doing */ + smtp_getsock, /* proto_getsock */ + smtp_getsock, /* doing_getsock */ + ZERO_NULL, /* perform_getsock */ + smtp_disconnect, /* disconnect */ + PORT_SMTP, /* defport */ + PROT_SMTP /* protocol */ +}; + + +#ifdef USE_SSL +/* + * SMTPS protocol handler. + */ + +const struct Curl_handler Curl_handler_smtps = { + "SMTPS", /* scheme */ + smtp_setup_connection, /* setup_connection */ + smtp_do, /* do_it */ + smtp_done, /* done */ + ZERO_NULL, /* do_more */ + smtp_connect, /* connect_it */ + smtp_multi_statemach, /* connecting */ + smtp_doing, /* doing */ + smtp_getsock, /* proto_getsock */ + smtp_getsock, /* doing_getsock */ + ZERO_NULL, /* perform_getsock */ + smtp_disconnect, /* disconnect */ + PORT_SMTPS, /* defport */ + PROT_SMTP | PROT_SMTPS | PROT_SSL /* protocol */ +}; +#endif + +#ifndef CURL_DISABLE_HTTP +/* + * HTTP-proxyed SMTP protocol handler. + */ + +static const struct Curl_handler Curl_handler_smtp_proxy = { + "SMTP", /* scheme */ + ZERO_NULL, /* setup_connection */ + Curl_http, /* do_it */ + Curl_http_done, /* done */ + ZERO_NULL, /* do_more */ + ZERO_NULL, /* connect_it */ + ZERO_NULL, /* connecting */ + ZERO_NULL, /* doing */ + ZERO_NULL, /* proto_getsock */ + ZERO_NULL, /* doing_getsock */ + ZERO_NULL, /* perform_getsock */ + ZERO_NULL, /* disconnect */ + PORT_SMTP, /* defport */ + PROT_HTTP /* protocol */ +}; + + +#ifdef USE_SSL +/* + * HTTP-proxyed SMTPS protocol handler. + */ + +static const struct Curl_handler Curl_handler_smtps_proxy = { + "SMTPS", /* scheme */ + ZERO_NULL, /* setup_connection */ + Curl_http, /* do_it */ + Curl_http_done, /* done */ + ZERO_NULL, /* do_more */ + ZERO_NULL, /* connect_it */ + ZERO_NULL, /* connecting */ + ZERO_NULL, /* doing */ + ZERO_NULL, /* proto_getsock */ + ZERO_NULL, /* doing_getsock */ + ZERO_NULL, /* perform_getsock */ + ZERO_NULL, /* disconnect */ + PORT_SMTPS, /* defport */ + PROT_HTTP /* protocol */ +}; +#endif +#endif + + +/* Function that checks for an ending smtp status code at the start of the + given string. + As a side effect, it also flags allowed authentication mechanisms according + to EHLO AUTH response. */ +static int smtp_endofresp(struct pingpong *pp, int *resp) +{ + char *line = pp->linestart_resp; + size_t len = pp->nread_resp; + struct connectdata *conn = pp->conn; + struct smtp_conn *smtpc = &conn->proto.smtpc; + int result; + size_t wordlen; + + if(len < 4 || !ISDIGIT(line[0]) || !ISDIGIT(line[1]) || !ISDIGIT(line[2])) + return FALSE; /* Nothing for us. */ + + if((result = (line[3] == ' ')) != 0) + *resp = curlx_sltosi(strtol(line, NULL, 10)); + + line += 4; + len -= 4; + + if(smtpc->state == SMTP_EHLO && len >= 5 && !memcmp(line, "AUTH ", 5)) { + line += 5; + len -= 5; + + for (;;) { + while (len && + (*line == ' ' || *line == '\t' || + *line == '\r' || *line == '\n')) { + line++; + len--; + } + + if(!len) + break; + + for (wordlen = 0; wordlen < len && line[wordlen] != ' ' && + line[wordlen] != '\t' && line[wordlen] != '\r' && + line[wordlen] != '\n';) + wordlen++; + + if(wordlen == 5 && !memcmp(line, "LOGIN", 5)) + smtpc->authmechs |= SMTP_AUTH_LOGIN; + else if(wordlen == 5 && !memcmp(line, "PLAIN", 5)) + smtpc->authmechs |= SMTP_AUTH_PLAIN; + else if(wordlen == 8 && !memcmp(line, "CRAM-MD5", 8)) + smtpc->authmechs |= SMTP_AUTH_CRAM_MD5; + else if(wordlen == 10 && !memcmp(line, "DIGEST-MD5", 10)) + smtpc->authmechs |= SMTP_AUTH_DIGEST_MD5; + else if(wordlen == 6 && !memcmp(line, "GSSAPI", 6)) + smtpc->authmechs |= SMTP_AUTH_GSSAPI; + else if(wordlen == 8 && !memcmp(line, "EXTERNAL", 8)) + smtpc->authmechs |= SMTP_AUTH_EXTERNAL; + + line += wordlen; + len -= wordlen; + } + } + + return result; +} + +/* This is the ONLY way to change SMTP state! */ +static void state(struct connectdata *conn, + smtpstate newstate) +{ + struct smtp_conn *smtpc = &conn->proto.smtpc; +#if defined(DEBUGBUILD) && !defined(CURL_DISABLE_VERBOSE_STRINGS) + /* for debug purposes */ + static const char * const names[]={ + "STOP", + "SERVERGREET", + "EHLO", + "HELO", + "STARTTLS", + "AUTHPLAIN", + "AUTHLOGIN", + "AUTHPASSWD", + "AUTHCRAM", + "AUTH", + "MAIL", + "RCPT", + "DATA", + "POSTDATA", + "QUIT", + /* LAST */ + }; + if(smtpc->state != newstate) + infof(conn->data, "SMTP %p state change from %s to %s\n", + smtpc, names[smtpc->state], names[newstate]); +#endif + smtpc->state = newstate; +} + +static CURLcode smtp_state_ehlo(struct connectdata *conn) +{ + CURLcode result; + struct smtp_conn *smtpc = &conn->proto.smtpc; + + smtpc->authmechs = 0; /* No known authentication mechanisms yet. */ + + /* send EHLO */ + result = Curl_pp_sendf(&smtpc->pp, "EHLO %s", smtpc->domain); + + if(result) + return result; + + state(conn, SMTP_EHLO); + return CURLE_OK; +} + +static CURLcode smtp_state_helo(struct connectdata *conn) +{ + CURLcode result; + struct smtp_conn *smtpc = &conn->proto.smtpc; + + /* send HELO */ + result = Curl_pp_sendf(&smtpc->pp, "HELO %s", smtpc->domain); + + if(result) + return result; + + state(conn, SMTP_HELO); + return CURLE_OK; +} + +static size_t smtp_auth_plain_data(struct connectdata * conn, char * * outptr) +{ + char plainauth[2 * MAX_CURL_USER_LENGTH + MAX_CURL_PASSWORD_LENGTH]; + size_t ulen; + size_t plen; + + ulen = strlen(conn->user); + plen = strlen(conn->passwd); + + if(2 * ulen + plen + 2 > sizeof plainauth) + return 0; + + memcpy(plainauth, conn->user, ulen); + plainauth[ulen] = '\0'; + memcpy(plainauth + ulen + 1, conn->user, ulen); + plainauth[2 * ulen + 1] = '\0'; + memcpy(plainauth + 2 * ulen + 2, conn->passwd, plen); + return Curl_base64_encode(conn->data, plainauth, 2 * ulen + plen + 2, outptr); +} + +static size_t smtp_auth_login_user(struct connectdata * conn, char * * outptr) +{ + size_t ulen; + + ulen = strlen(conn->user); + + if(!ulen) { + *outptr = strdup("="); + return *outptr? 1: 0; + } + + return Curl_base64_encode(conn->data, conn->user, ulen, outptr); +} + +static CURLcode smtp_authenticate(struct connectdata *conn) +{ + CURLcode result = CURLE_OK; + struct smtp_conn *smtpc = &conn->proto.smtpc; + char * initresp; + const char * mech; + size_t l; + smtpstate state1; + smtpstate state2; + + if(!conn->bits.user_passwd) + state(conn, SMTP_STOP); /* End of connect phase. */ + else { + initresp = (char *) NULL; + l = 1; + + /* Check supported authentication mechanisms by decreasing order of + preference. */ + mech = (const char *) NULL; /* Avoid compiler warnings. */ + state1 = SMTP_STOP; + state2 = SMTP_STOP; + +#ifndef CURL_DISABLE_CRYPTO_AUTH + if(smtpc->authmechs & SMTP_AUTH_CRAM_MD5) { + mech = "CRAM-MD5"; + state1 = SMTP_AUTHCRAM; + } + else +#endif + if(smtpc->authmechs & SMTP_AUTH_PLAIN) { + mech = "PLAIN"; + state1 = SMTP_AUTHPLAIN; + state2 = SMTP_AUTH; + l = smtp_auth_plain_data(conn, &initresp); + } + else if(smtpc->authmechs & SMTP_AUTH_LOGIN) { + mech = "LOGIN"; + state1 = SMTP_AUTHLOGIN; + state2 = SMTP_AUTHPASSWD; + l = smtp_auth_login_user(conn, &initresp); + } + else { + infof(conn->data, "No known auth mechanisms supported!\n"); + result = CURLE_LOGIN_DENIED; /* Other mechanisms not supported. */ + } + + if(!result) { + if(!l) + result = CURLE_OUT_OF_MEMORY; + else if(initresp && + l + strlen(mech) <= 512 - 8) { /* AUTH ... */ + result = Curl_pp_sendf(&smtpc->pp, "AUTH %s %s", mech, initresp); + free(initresp); + + if(!result) + state(conn, state2); + } + else { + Curl_safefree(initresp); + + result = Curl_pp_sendf(&smtpc->pp, "AUTH %s", mech); + + if(!result) + state(conn, state1); + } + } + } + + return result; +} + +/* For the SMTP "protocol connect" and "doing" phases only */ +static int smtp_getsock(struct connectdata *conn, + curl_socket_t *socks, + int numsocks) +{ + return Curl_pp_getsock(&conn->proto.smtpc.pp, socks, numsocks); +} + +/* for STARTTLS responses */ +static CURLcode smtp_state_starttls_resp(struct connectdata *conn, + int smtpcode, + smtpstate instate) +{ + CURLcode result = CURLE_OK; + struct SessionHandle *data = conn->data; + (void)instate; /* no use for this yet */ + + if(smtpcode != 220) { + if(data->set.ftp_ssl != CURLUSESSL_TRY) { + failf(data, "STARTTLS denied. %c", smtpcode); + result = CURLE_LOGIN_DENIED; + } + else + result = smtp_authenticate(conn); + } + else { + /* Curl_ssl_connect is BLOCKING */ + result = Curl_ssl_connect(conn, FIRSTSOCKET); + if(CURLE_OK == result) { + conn->protocol |= PROT_SMTPS; + result = smtp_state_ehlo(conn); + } + } + return result; +} + +/* for EHLO responses */ +static CURLcode smtp_state_ehlo_resp(struct connectdata *conn, + int smtpcode, + smtpstate instate) +{ + CURLcode result = CURLE_OK; + struct SessionHandle *data = conn->data; + + (void)instate; /* no use for this yet */ + + if(smtpcode/100 != 2) { + if((data->set.ftp_ssl <= CURLUSESSL_TRY || conn->ssl[FIRSTSOCKET].use) && + !conn->bits.user_passwd) + result = smtp_state_helo(conn); + else { + failf(data, "Access denied: %d", smtpcode); + result = CURLE_LOGIN_DENIED; + } + } + else if(data->set.ftp_ssl && !conn->ssl[FIRSTSOCKET].use) { + /* We don't have a SSL/TLS connection yet, but SSL is requested. Switch + to TLS connection now */ + result = Curl_pp_sendf(&conn->proto.smtpc.pp, "STARTTLS"); + state(conn, SMTP_STARTTLS); + } + else + result = smtp_authenticate(conn); + + return result; +} + +/* for HELO responses */ +static CURLcode smtp_state_helo_resp(struct connectdata *conn, + int smtpcode, + smtpstate instate) +{ + CURLcode result = CURLE_OK; + struct SessionHandle *data = conn->data; + + (void)instate; /* no use for this yet */ + + if(smtpcode/100 != 2) { + failf(data, "Access denied: %d", smtpcode); + result = CURLE_LOGIN_DENIED; + } + else { + /* end the connect phase */ + state(conn, SMTP_STOP); + } + return result; +} + +/* for AUTH PLAIN (without initial response) responses */ +static CURLcode smtp_state_authplain_resp(struct connectdata *conn, + int smtpcode, + smtpstate instate) +{ + CURLcode result = CURLE_OK; + struct SessionHandle *data = conn->data; + size_t l; + char * plainauth; + + (void)instate; /* no use for this yet */ + + if(smtpcode != 334) { + failf(data, "Access denied: %d", smtpcode); + result = CURLE_LOGIN_DENIED; + } + else { + l = smtp_auth_plain_data(conn, &plainauth); + + if(!l) + result = CURLE_OUT_OF_MEMORY; + else { + result = Curl_pp_sendf(&conn->proto.smtpc.pp, "%s", plainauth); + free(plainauth); + + if(!result) + state(conn, SMTP_AUTH); + } + } + + return result; +} + +/* for AUTH LOGIN (without initial response) responses */ +static CURLcode smtp_state_authlogin_resp(struct connectdata *conn, + int smtpcode, + smtpstate instate) +{ + CURLcode result = CURLE_OK; + struct SessionHandle *data = conn->data; + size_t l; + char * authuser; + + (void)instate; /* no use for this yet */ + + if(smtpcode != 334) { + failf(data, "Access denied: %d", smtpcode); + result = CURLE_LOGIN_DENIED; + } + else { + l = smtp_auth_login_user(conn, &authuser); + + if(!l) + result = CURLE_OUT_OF_MEMORY; + else { + result = Curl_pp_sendf(&conn->proto.smtpc.pp, "%s", authuser); + free(authuser); + + if(!result) + state(conn, SMTP_AUTHPASSWD); + } + } + + return result; +} + +/* for responses to user entry of AUTH LOGIN. */ +static CURLcode smtp_state_authpasswd_resp(struct connectdata *conn, + int smtpcode, + smtpstate instate) +{ + CURLcode result = CURLE_OK; + struct SessionHandle *data = conn->data; + size_t plen; + size_t l; + char *authpasswd; + + (void)instate; /* no use for this yet */ + + if(smtpcode != 334) { + failf(data, "Access denied: %d", smtpcode); + result = CURLE_LOGIN_DENIED; + } + else { + plen = strlen(conn->passwd); + + if(!plen) + result = Curl_pp_sendf(&conn->proto.smtpc.pp, "="); + else { + l = Curl_base64_encode(data, conn->passwd, plen, &authpasswd); + + if(!l) + result = CURLE_OUT_OF_MEMORY; + else { + result = Curl_pp_sendf(&conn->proto.smtpc.pp, "%s", authpasswd); + free(authpasswd); + + if(!result) + state(conn, SMTP_AUTH); + } + } + } + + return result; +} + +#ifndef CURL_DISABLE_CRYPTO_AUTH + +/* for AUTH CRAM-MD5 responses. */ +static CURLcode smtp_state_authcram_resp(struct connectdata *conn, + int smtpcode, + smtpstate instate) +{ + CURLcode result = CURLE_OK; + struct SessionHandle *data = conn->data; + char * chlg64 = data->state.buffer; + unsigned char * chlg; + size_t chlglen; + size_t l; + char * rplyb64; + HMAC_context * ctxt; + unsigned char digest[16]; + char reply[MAX_CURL_USER_LENGTH + 32 /* 2 * size of MD5 digest */ + 1]; + + (void)instate; /* no use for this yet */ + + if(smtpcode != 334) { + failf(data, "Access denied: %d", smtpcode); + return CURLE_LOGIN_DENIED; + } + + /* Get the challenge. */ + for (chlg64 += 4; *chlg64 == ' ' || *chlg64 == '\t'; chlg64++) + ; + + chlg = (unsigned char *) NULL; + chlglen = 0; + + if(*chlg64 != '=') { + for (l = strlen(chlg64); l--;) + if(chlg64[l] != '\r' && chlg64[l] != '\n' && chlg64[l] != ' ' && + chlg64[l] != '\t') + break; + + if(++l) { + chlg64[l] = '\0'; + + chlglen = Curl_base64_decode(chlg64, &chlg); + if(!chlglen) + return CURLE_OUT_OF_MEMORY; + } + } + + /* Compute digest. */ + ctxt = Curl_HMAC_init(Curl_HMAC_MD5, + (const unsigned char *) conn->passwd, + (unsigned int)(strlen(conn->passwd))); + + if(!ctxt) { + if(chlg) + free(chlg); + + return CURLE_OUT_OF_MEMORY; + } + + if(chlglen > 0) + Curl_HMAC_update(ctxt, chlg, (unsigned int)(chlglen)); + + if(chlg) + free(chlg); + + Curl_HMAC_final(ctxt, digest); + + /* Prepare the reply. */ + snprintf(reply, sizeof reply, + "%s %02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x", + conn->user, digest[0], digest[1], digest[2], digest[3], digest[4], digest[5], + digest[6], digest[7], digest[8], digest[9], digest[10], digest[11], + digest[12], digest[13], digest[14], digest[15]); + + /* Encode it to base64 and send it. */ + l = Curl_base64_encode(data, reply, 0, &rplyb64); + + if(!l) + result = CURLE_OUT_OF_MEMORY; + else { + result = Curl_pp_sendf(&conn->proto.smtpc.pp, "%s", rplyb64); + free(rplyb64); + + if(!result) + state(conn, SMTP_AUTH); + } + + return result; +} + +#endif + +/* for final responses to AUTH sequences. */ +static CURLcode smtp_state_auth_resp(struct connectdata *conn, + int smtpcode, + smtpstate instate) +{ + CURLcode result = CURLE_OK; + struct SessionHandle *data = conn->data; + + (void)instate; /* no use for this yet */ + + if(smtpcode != 235) { + failf(data, "Authentication failed: %d", smtpcode); + result = CURLE_LOGIN_DENIED; + } + else + state(conn, SMTP_STOP); /* End of connect phase. */ + + return result; +} + +/* start the DO phase */ +static CURLcode smtp_mail(struct connectdata *conn) +{ + CURLcode result = CURLE_OK; + struct SessionHandle *data = conn->data; + + /* send MAIL */ + result = Curl_pp_sendf(&conn->proto.smtpc.pp, "MAIL FROM:%s", + data->set.str[STRING_MAIL_FROM]); + if(result) + return result; + + state(conn, SMTP_MAIL); + return result; +} + +static CURLcode smtp_rcpt_to(struct connectdata *conn) +{ + CURLcode result = CURLE_OK; + struct smtp_conn *smtpc = &conn->proto.smtpc; + + /* send RCPT TO */ + if(smtpc->rcpt) { + if(smtpc->rcpt->data[0] == '<') + result = Curl_pp_sendf(&conn->proto.smtpc.pp, "RCPT TO:%s", + smtpc->rcpt->data); + else + result = Curl_pp_sendf(&conn->proto.smtpc.pp, "RCPT TO:<%s>", + smtpc->rcpt->data); + if(!result) + state(conn, SMTP_RCPT); + } + return result; +} + +/* for MAIL responses */ +static CURLcode smtp_state_mail_resp(struct connectdata *conn, + int smtpcode, + smtpstate instate) +{ + CURLcode result = CURLE_OK; + struct SessionHandle *data = conn->data; + (void)instate; /* no use for this yet */ + + if(smtpcode/100 != 2) { + failf(data, "Access denied: %d", smtpcode); + result = CURLE_LOGIN_DENIED; + state(conn, SMTP_STOP); + } + else { + struct smtp_conn *smtpc = &conn->proto.smtpc; + smtpc->rcpt = data->set.mail_rcpt; + + result = smtp_rcpt_to(conn); + } + + return result; +} + +/* for RCPT responses */ +static CURLcode smtp_state_rcpt_resp(struct connectdata *conn, + int smtpcode, + smtpstate instate) +{ + CURLcode result = CURLE_OK; + struct SessionHandle *data = conn->data; + (void)instate; /* no use for this yet */ + + if(smtpcode/100 != 2) { + failf(data, "Access denied: %d", smtpcode); + result = CURLE_LOGIN_DENIED; + state(conn, SMTP_STOP); + } + else { + struct smtp_conn *smtpc = &conn->proto.smtpc; + + if(smtpc->rcpt) { + smtpc->rcpt = smtpc->rcpt->next; + result = smtp_rcpt_to(conn); + + /* if we failed or still is in RCPT sending, return */ + if(result || smtpc->rcpt) + return result; + } + + /* send DATA */ + result = Curl_pp_sendf(&conn->proto.smtpc.pp, "DATA"); + if(result) + return result; + + state(conn, SMTP_DATA); + } + return result; +} + +/* for the DATA response */ +static CURLcode smtp_state_data_resp(struct connectdata *conn, + int smtpcode, + smtpstate instate) +{ + struct SessionHandle *data = conn->data; + struct FTP *smtp = data->state.proto.smtp; + + (void)instate; /* no use for this yet */ + + if(smtpcode != 354) { + state(conn, SMTP_STOP); + return CURLE_RECV_ERROR; + } + + /* SMTP upload */ + Curl_setup_transfer(conn, -1, -1, FALSE, NULL, /* no download */ + FIRSTSOCKET, smtp->bytecountp); + + state(conn, SMTP_STOP); + return CURLE_OK; +} + +/* for the POSTDATA response, which is received after the entire DATA + part has been sent off to the server */ +static CURLcode smtp_state_postdata_resp(struct connectdata *conn, + int smtpcode, + smtpstate instate) +{ + CURLcode result = CURLE_OK; + + (void)instate; /* no use for this yet */ + + if(smtpcode != 250) + result = CURLE_RECV_ERROR; + + state(conn, SMTP_STOP); + return result; +} + +static CURLcode smtp_statemach_act(struct connectdata *conn) +{ + CURLcode result; + curl_socket_t sock = conn->sock[FIRSTSOCKET]; + struct SessionHandle *data=conn->data; + int smtpcode; + struct smtp_conn *smtpc = &conn->proto.smtpc; + struct pingpong *pp = &smtpc->pp; + size_t nread = 0; + + if(pp->sendleft) + /* we have a piece of a command still left to send */ + return Curl_pp_flushsend(pp); + + /* we read a piece of response */ + result = Curl_pp_readresp(sock, pp, &smtpcode, &nread); + if(result) + return result; + + if(smtpcode) { + /* we have now received a full SMTP server response */ + switch(smtpc->state) { + case SMTP_SERVERGREET: + if(smtpcode/100 != 2) { + failf(data, "Got unexpected smtp-server response: %d", smtpcode); + return CURLE_FTP_WEIRD_SERVER_REPLY; + } + + result = smtp_state_ehlo(conn); + if(result) + return result; + break; + + case SMTP_EHLO: + result = smtp_state_ehlo_resp(conn, smtpcode, smtpc->state); + break; + + case SMTP_HELO: + result = smtp_state_helo_resp(conn, smtpcode, smtpc->state); + break; + + case SMTP_STARTTLS: + result = smtp_state_starttls_resp(conn, smtpcode, smtpc->state); + break; + + case SMTP_AUTHPLAIN: + result = smtp_state_authplain_resp(conn, smtpcode, smtpc->state); + break; + + case SMTP_AUTHLOGIN: + result = smtp_state_authlogin_resp(conn, smtpcode, smtpc->state); + break; + + case SMTP_AUTHPASSWD: + result = smtp_state_authpasswd_resp(conn, smtpcode, smtpc->state); + break; + +#ifndef CURL_DISABLE_CRYPTO_AUTH + case SMTP_AUTHCRAM: + result = smtp_state_authcram_resp(conn, smtpcode, smtpc->state); + break; +#endif + + case SMTP_AUTH: + result = smtp_state_auth_resp(conn, smtpcode, smtpc->state); + break; + + case SMTP_MAIL: + result = smtp_state_mail_resp(conn, smtpcode, smtpc->state); + break; + + case SMTP_RCPT: + result = smtp_state_rcpt_resp(conn, smtpcode, smtpc->state); + break; + + case SMTP_DATA: + result = smtp_state_data_resp(conn, smtpcode, smtpc->state); + break; + + case SMTP_POSTDATA: + result = smtp_state_postdata_resp(conn, smtpcode, smtpc->state); + break; + + case SMTP_QUIT: + /* fallthrough, just stop! */ + default: + /* internal error */ + state(conn, SMTP_STOP); + break; + } + } + return result; +} + +/* called repeatedly until done from multi.c */ +static CURLcode smtp_multi_statemach(struct connectdata *conn, + bool *done) +{ + struct smtp_conn *smtpc = &conn->proto.smtpc; + CURLcode result = Curl_pp_multi_statemach(&smtpc->pp); + + *done = (bool)(smtpc->state == SMTP_STOP); + + return result; +} + +static CURLcode smtp_easy_statemach(struct connectdata *conn) +{ + struct smtp_conn *smtpc = &conn->proto.smtpc; + struct pingpong *pp = &smtpc->pp; + CURLcode result = CURLE_OK; + + while(smtpc->state != SMTP_STOP) { + result = Curl_pp_easy_statemach(pp); + if(result) + break; + } + + return result; +} + +/* + * Allocate and initialize the struct SMTP for the current SessionHandle. If + * need be. + */ +static CURLcode smtp_init(struct connectdata *conn) +{ + struct SessionHandle *data = conn->data; + struct FTP *smtp = data->state.proto.smtp; + if(!smtp) { + smtp = data->state.proto.smtp = calloc(sizeof(struct FTP), 1); + if(!smtp) + return CURLE_OUT_OF_MEMORY; + } + + /* get some initial data into the smtp struct */ + smtp->bytecountp = &data->req.bytecount; + + /* No need to duplicate user+password, the connectdata struct won't change + during a session, but we re-init them here since on subsequent inits + since the conn struct may have changed or been replaced. + */ + smtp->user = conn->user; + smtp->passwd = conn->passwd; + + return CURLE_OK; +} + +/* + * smtp_connect() should do everything that is to be considered a part of + * the connection phase. + * + * The variable 'done' points to will be TRUE if the protocol-layer connect + * phase is done when this function returns, or FALSE is not. When called as + * a part of the easy interface, it will always be TRUE. + */ +static CURLcode smtp_connect(struct connectdata *conn, + bool *done) /* see description above */ +{ + CURLcode result; + struct smtp_conn *smtpc = &conn->proto.smtpc; + struct SessionHandle *data=conn->data; + struct pingpong *pp=&smtpc->pp; + const char *path = conn->data->state.path; + int len; + char localhost[1024 + 1]; + + *done = FALSE; /* default to not done yet */ + + /* If there already is a protocol-specific struct allocated for this + sessionhandle, deal with it */ + Curl_reset_reqproto(conn); + + result = smtp_init(conn); + if(CURLE_OK != result) + return result; + + /* We always support persistant connections on smtp */ + conn->bits.close = FALSE; + + pp->response_time = RESP_TIMEOUT; /* set default response time-out */ + pp->statemach_act = smtp_statemach_act; + pp->endofresp = smtp_endofresp; + pp->conn = conn; + +#if !defined(CURL_DISABLE_HTTP) && !defined(CURL_DISABLE_PROXY) + if(conn->bits.tunnel_proxy && conn->bits.httpproxy) { + /* for SMTP over HTTP proxy */ + struct HTTP http_proxy; + struct FTP *smtp_save; + + /* BLOCKING */ + /* We want "seamless" SMTP operations through HTTP proxy tunnel */ + + /* Curl_proxyCONNECT is based on a pointer to a struct HTTP at the member + * conn->proto.http; we want SMTP through HTTP and we have to change the + * member temporarily for connecting to the HTTP proxy. After + * Curl_proxyCONNECT we have to set back the member to the original struct + * SMTP pointer + */ + smtp_save = data->state.proto.smtp; + memset(&http_proxy, 0, sizeof(http_proxy)); + data->state.proto.http = &http_proxy; + + result = Curl_proxyCONNECT(conn, FIRSTSOCKET, + conn->host.name, conn->remote_port); + + data->state.proto.smtp = smtp_save; + + if(CURLE_OK != result) + return result; + } +#endif /* !CURL_DISABLE_HTTP && !CURL_DISABLE_PROXY */ + + if(conn->protocol & PROT_SMTPS) { + /* BLOCKING */ + /* SMTPS is simply smtp with SSL for the control channel */ + /* now, perform the SSL initialization for this socket */ + result = Curl_ssl_connect(conn, FIRSTSOCKET); + if(result) + return result; + } + + Curl_pp_init(pp); /* init the response reader stuff */ + + pp->response_time = RESP_TIMEOUT; /* set default response time-out */ + pp->statemach_act = smtp_statemach_act; + pp->endofresp = smtp_endofresp; + pp->conn = conn; + + if(!*path) { + if(!Curl_gethostname(localhost, sizeof localhost)) + path = localhost; + else + path = "localhost"; + } + + /* url decode the path and use it as domain with EHLO */ + smtpc->domain = curl_easy_unescape(conn->data, path, 0, &len); + if(!smtpc->domain) + return CURLE_OUT_OF_MEMORY; + + /* When we connect, we start in the state where we await the server greeting + */ + state(conn, SMTP_SERVERGREET); + + if(data->state.used_interface == Curl_if_multi) + result = smtp_multi_statemach(conn, done); + else { + result = smtp_easy_statemach(conn); + if(!result) + *done = TRUE; + } + + return result; +} + +/*********************************************************************** + * + * smtp_done() + * + * The DONE function. This does what needs to be done after a single DO has + * performed. + * + * Input argument is already checked for validity. + */ +static CURLcode smtp_done(struct connectdata *conn, CURLcode status, + bool premature) +{ + struct SessionHandle *data = conn->data; + struct FTP *smtp = data->state.proto.smtp; + CURLcode result=CURLE_OK; + ssize_t bytes_written; + (void)premature; + + if(!smtp) + /* When the easy handle is removed from the multi while libcurl is still + * trying to resolve the host name, it seems that the smtp struct is not + * yet initialized, but the removal action calls Curl_done() which calls + * this function. So we simply return success if no smtp pointer is set. + */ + return CURLE_OK; + + if(status) { + conn->bits.close = TRUE; /* marked for closure */ + result = status; /* use the already set error code */ + } + else + /* TODO: make this work even when the socket is EWOULDBLOCK in this call! */ + + /* write to socket (send away data) */ + result = Curl_write(conn, + conn->writesockfd, /* socket to send to */ + SMTP_EOB, /* buffer pointer */ + SMTP_EOB_LEN, /* buffer size */ + &bytes_written); /* actually sent away */ + + + if(status == CURLE_OK) { + struct smtp_conn *smtpc = &conn->proto.smtpc; + struct pingpong *pp= &smtpc->pp; + pp->response = Curl_tvnow(); /* timeout relative now */ + + state(conn, SMTP_POSTDATA); + /* run the state-machine + + TODO: when the multi interface is used, this _really_ should be using + the smtp_multi_statemach function but we have no general support for + non-blocking DONE operations, not in the multi state machine and with + Curl_done() invokes on several places in the code! + */ + result = smtp_easy_statemach(conn); + } + + /* clear these for next connection */ + smtp->transfer = FTPTRANSFER_BODY; + + return result; +} + +/*********************************************************************** + * + * smtp_perform() + * + * This is the actual DO function for SMTP. Get a file/directory according to + * the options previously setup. + */ + +static +CURLcode smtp_perform(struct connectdata *conn, + bool *connected, /* connect status after PASV / PORT */ + bool *dophase_done) +{ + /* this is SMTP and no proxy */ + CURLcode result=CURLE_OK; + + DEBUGF(infof(conn->data, "DO phase starts\n")); + + if(conn->data->set.opt_no_body) { + /* requested no body means no transfer... */ + struct FTP *smtp = conn->data->state.proto.smtp; + smtp->transfer = FTPTRANSFER_INFO; + } + + *dophase_done = FALSE; /* not done yet */ + + /* start the first command in the DO phase */ + result = smtp_mail(conn); + if(result) + return result; + + /* run the state-machine */ + if(conn->data->state.used_interface == Curl_if_multi) + result = smtp_multi_statemach(conn, dophase_done); + else { + result = smtp_easy_statemach(conn); + *dophase_done = TRUE; /* with the easy interface we are done here */ + } + *connected = conn->bits.tcpconnect; + + if(*dophase_done) + DEBUGF(infof(conn->data, "DO phase is complete\n")); + + return result; +} + +/*********************************************************************** + * + * smtp_do() + * + * This function is registered as 'curl_do' function. It decodes the path + * parts etc as a wrapper to the actual DO function (smtp_perform). + * + * The input argument is already checked for validity. + */ +static CURLcode smtp_do(struct connectdata *conn, bool *done) +{ + CURLcode retcode = CURLE_OK; + + *done = FALSE; /* default to false */ + + /* + Since connections can be re-used between SessionHandles, this might be a + connection already existing but on a fresh SessionHandle struct so we must + make sure we have a good 'struct SMTP' to play with. For new connections, + the struct SMTP is allocated and setup in the smtp_connect() function. + */ + Curl_reset_reqproto(conn); + retcode = smtp_init(conn); + if(retcode) + return retcode; + + retcode = smtp_regular_transfer(conn, done); + + return retcode; +} + +/*********************************************************************** + * + * smtp_quit() + * + * This should be called before calling sclose(). We should then wait for the + * response from the server before returning. The calling code should then try + * to close the connection. + * + */ +static CURLcode smtp_quit(struct connectdata *conn) +{ + CURLcode result = CURLE_OK; + + result = Curl_pp_sendf(&conn->proto.smtpc.pp, "QUIT"); + if(result) + return result; + state(conn, SMTP_QUIT); + + result = smtp_easy_statemach(conn); + + return result; +} + +/*********************************************************************** + * + * smtp_disconnect() + * + * Disconnect from an SMTP server. Cleanup protocol-specific per-connection + * resources. BLOCKING. + */ +static CURLcode smtp_disconnect(struct connectdata *conn, bool dead_connection) +{ + struct smtp_conn *smtpc= &conn->proto.smtpc; + + /* We cannot send quit unconditionally. If this connection is stale or + bad in any way, sending quit and waiting around here will make the + disconnect wait in vain and cause more problems than we need to. + */ + + /* The SMTP session may or may not have been allocated/setup at this + point! */ + if(!dead_connection && smtpc->pp.conn) + (void)smtp_quit(conn); /* ignore errors on the LOGOUT */ + + Curl_pp_disconnect(&smtpc->pp); + + /* This won't already be freed in some error cases */ + Curl_safefree(smtpc->domain); + smtpc->domain = NULL; + + return CURLE_OK; +} + +/* call this when the DO phase has completed */ +static CURLcode smtp_dophase_done(struct connectdata *conn, + bool connected) +{ + struct FTP *smtp = conn->data->state.proto.smtp; + struct smtp_conn *smtpc= &conn->proto.smtpc; + (void)connected; + + if(smtp->transfer != FTPTRANSFER_BODY) + /* no data to transfer */ + Curl_setup_transfer(conn, -1, -1, FALSE, NULL, -1, NULL); + + free(smtpc->domain); + smtpc->domain = NULL; + + return CURLE_OK; +} + +/* called from multi.c while DOing */ +static CURLcode smtp_doing(struct connectdata *conn, + bool *dophase_done) +{ + CURLcode result; + result = smtp_multi_statemach(conn, dophase_done); + + if(*dophase_done) { + result = smtp_dophase_done(conn, FALSE /* not connected */); + + DEBUGF(infof(conn->data, "DO phase is complete\n")); + } + return result; +} + +/*********************************************************************** + * + * smtp_regular_transfer() + * + * The input argument is already checked for validity. + * + * Performs all commands done before a regular transfer between a local and a + * remote host. + */ +static +CURLcode smtp_regular_transfer(struct connectdata *conn, + bool *dophase_done) +{ + CURLcode result=CURLE_OK; + bool connected=FALSE; + struct SessionHandle *data = conn->data; + data->req.size = -1; /* make sure this is unknown at this point */ + + Curl_pgrsSetUploadCounter(data, 0); + Curl_pgrsSetDownloadCounter(data, 0); + Curl_pgrsSetUploadSize(data, 0); + Curl_pgrsSetDownloadSize(data, 0); + + result = smtp_perform(conn, + &connected, /* have we connected after PASV/PORT */ + dophase_done); /* all commands in the DO-phase done? */ + + if(CURLE_OK == result) { + + if(!*dophase_done) + /* the DO phase has not completed yet */ + return CURLE_OK; + + result = smtp_dophase_done(conn, connected); + if(result) + return result; + } + + return result; +} + +static CURLcode smtp_setup_connection(struct connectdata * conn) +{ + struct SessionHandle *data = conn->data; + + if(conn->bits.httpproxy && !data->set.tunnel_thru_httpproxy) { + /* Unless we have asked to tunnel smtp operations through the proxy, we + switch and use HTTP operations only */ +#ifndef CURL_DISABLE_HTTP + if(conn->handler == &Curl_handler_smtp) + conn->handler = &Curl_handler_smtp_proxy; + else { +#ifdef USE_SSL + conn->handler = &Curl_handler_smtps_proxy; +#else + failf(data, "SMTPS not supported!"); + return CURLE_UNSUPPORTED_PROTOCOL; +#endif + } + /* + * We explicitly mark this connection as persistent here as we're doing + * SMTP over HTTP and thus we accidentally avoid setting this value + * otherwise. + */ + conn->bits.close = FALSE; +#else + failf(data, "SMTP over http proxy requires HTTP support built-in!"); + return CURLE_UNSUPPORTED_PROTOCOL; +#endif + } + + data->state.path++; /* don't include the initial slash */ + + return CURLE_OK; +} + +CURLcode Curl_smtp_escape_eob(struct connectdata *conn, ssize_t nread) +{ + /* When sending SMTP payload, we must detect CRLF.CRLF sequences in + * the data and make sure it is sent as CRLF..CRLF instead, as + * otherwise it will wrongly be detected as end of data by the server. + */ + ssize_t i; + ssize_t si; + struct smtp_conn *smtpc = &conn->proto.smtpc; + struct SessionHandle *data = conn->data; + + if(data->state.scratch == NULL) + data->state.scratch = malloc(2*BUFSIZE); + if(data->state.scratch == NULL) { + failf (data, "Failed to alloc scratch buffer!"); + return CURLE_OUT_OF_MEMORY; + } + /* This loop can be improved by some kind of Boyer-Moore style of + approach but that is saved for later... */ + for(i = 0, si = 0; i < nread; i++, si++) { + ssize_t left = nread - i; + + if(left>= (ssize_t)(SMTP_EOB_LEN-smtpc->eob)) { + if(!memcmp(SMTP_EOB+smtpc->eob, &data->req.upload_fromhere[i], + SMTP_EOB_LEN-smtpc->eob)) { + /* It matched, copy the replacement data to the target buffer + instead. Note that the replacement does not contain the + trailing CRLF but we instead continue to match on that one + to deal with repeated sequences. Like CRLF.CRLF.CRLF etc + */ + memcpy(&data->state.scratch[si], SMTP_EOB_REPL, + SMTP_EOB_REPL_LEN); + si+=SMTP_EOB_REPL_LEN-1; /* minus one since the for() increments + it */ + i+=SMTP_EOB_LEN-smtpc->eob-1-2; + smtpc->eob = 0; /* start over */ + continue; + } + } + else if(!memcmp(SMTP_EOB+smtpc->eob, &data->req.upload_fromhere[i], + left)) { + /* the last piece of the data matches the EOB so we can't send that + until we know the rest of it */ + smtpc->eob += left; + break; + } + + data->state.scratch[si] = data->req.upload_fromhere[i]; + } /* for() */ + + if(si != nread) { + /* only use the new buffer if we replaced something */ + nread = si; + + /* upload from the new (replaced) buffer instead */ + data->req.upload_fromhere = data->state.scratch; + + /* set the new amount too */ + data->req.upload_present = nread; + } + return CURLE_OK; +} + +#endif /* CURL_DISABLE_SMTP */ diff --git a/mobicore/common/curl/lib/smtp.h b/mobicore/common/curl/lib/smtp.h new file mode 100644 index 0000000000000000000000000000000000000000..417fd52e5484afd3e35d4c1c207b2ecc5720b875 --- /dev/null +++ b/mobicore/common/curl/lib/smtp.h @@ -0,0 +1,83 @@ +#ifndef __SMTP_H +#define __SMTP_H +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) 2009 - 2010, Daniel Stenberg, , et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at http://curl.haxx.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ***************************************************************************/ + +#include "pingpong.h" + +/**************************************************************************** + * SMTP unique setup + ***************************************************************************/ +typedef enum { + SMTP_STOP, /* do nothing state, stops the state machine */ + SMTP_SERVERGREET, /* waiting for the initial greeting immediately after + a connect */ + SMTP_EHLO, + SMTP_HELO, + SMTP_STARTTLS, + SMTP_AUTHPLAIN, + SMTP_AUTHLOGIN, + SMTP_AUTHPASSWD, + SMTP_AUTHCRAM, + SMTP_AUTH, + SMTP_MAIL, /* MAIL FROM */ + SMTP_RCPT, /* RCPT TO */ + SMTP_DATA, + SMTP_POSTDATA, + SMTP_QUIT, + SMTP_LAST /* never used */ +} smtpstate; + +/* smtp_conn is used for struct connection-oriented data in the connectdata + struct */ +struct smtp_conn { + struct pingpong pp; + char *domain; /* what to send in the EHLO */ + size_t eob; /* number of bytes of the EOB (End Of Body) that has been + received thus far */ + unsigned int authmechs; /* Accepted authentication methods. */ + smtpstate state; /* always use smtp.c:state() to change state! */ + struct curl_slist *rcpt; +}; + +/* Authentication mechanism flags. */ +#define SMTP_AUTH_LOGIN 0x0001 +#define SMTP_AUTH_PLAIN 0x0002 +#define SMTP_AUTH_CRAM_MD5 0x0004 +#define SMTP_AUTH_DIGEST_MD5 0x0008 +#define SMTP_AUTH_GSSAPI 0x0010 +#define SMTP_AUTH_EXTERNAL 0x0020 + +extern const struct Curl_handler Curl_handler_smtp; +extern const struct Curl_handler Curl_handler_smtps; + +/* this is the 5-bytes End-Of-Body marker for SMTP */ +#define SMTP_EOB "\x0d\x0a\x2e\x0d\x0a" +#define SMTP_EOB_LEN 5 + +/* if found in data, replace it with this string instead */ +#define SMTP_EOB_REPL "\x0d\x0a\x2e\x2e" +#define SMTP_EOB_REPL_LEN 4 + +CURLcode Curl_smtp_escape_eob(struct connectdata *conn, ssize_t nread); + +#endif /* __SMTP_H */ diff --git a/mobicore/common/curl/lib/sockaddr.h b/mobicore/common/curl/lib/sockaddr.h new file mode 100644 index 0000000000000000000000000000000000000000..c69411b52f85611ce255c0b0966cd40f1bf38fa8 --- /dev/null +++ b/mobicore/common/curl/lib/sockaddr.h @@ -0,0 +1,37 @@ +#ifndef __SOCKADDR_H +#define __SOCKADDR_H +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) 1998 - 2009, Daniel Stenberg, , et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at http://curl.haxx.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ***************************************************************************/ + +#include "setup.h" + +#ifdef HAVE_STRUCT_SOCKADDR_STORAGE +struct Curl_sockaddr_storage { + struct sockaddr_storage buffer; +}; +#else +struct Curl_sockaddr_storage { + char buffer[256]; /* this should be big enough to fit a lot */ +}; +#endif + +#endif /* __SOCKADDR_H */ diff --git a/mobicore/common/curl/lib/socks.c b/mobicore/common/curl/lib/socks.c new file mode 100644 index 0000000000000000000000000000000000000000..7b5740be425f707b3e6bc6dba99fcde4c374259a --- /dev/null +++ b/mobicore/common/curl/lib/socks.c @@ -0,0 +1,733 @@ +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) 1998 - 2010, Daniel Stenberg, , et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at http://curl.haxx.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ***************************************************************************/ + +#include "setup.h" + +#if !defined(CURL_DISABLE_PROXY) || defined(USE_WINDOWS_SSPI) +#include + +#ifdef HAVE_STDLIB_H +#include +#endif +#ifdef HAVE_SYS_SOCKET_H +#include +#endif +#ifdef HAVE_NETINET_IN_H +#include +#endif +#ifdef HAVE_ARPA_INET_H +#include +#endif + +#include "urldata.h" +#include "sendf.h" +#include "strequal.h" +#include "select.h" +#include "connect.h" +#include "timeval.h" +#include "socks.h" + +/* The last #include file should be: */ +#include "memdebug.h" + +/* + * Helper read-from-socket functions. Does the same as Curl_read() but it + * blocks until all bytes amount of buffersize will be read. No more, no less. + * + * This is STUPID BLOCKING behaviour which we frown upon, but right now this + * is what we have... + */ +int Curl_blockread_all(struct connectdata *conn, /* connection data */ + curl_socket_t sockfd, /* read from this socket */ + char *buf, /* store read data here */ + ssize_t buffersize, /* max amount to read */ + ssize_t *n, /* amount bytes read */ + long conn_timeout) /* timeout for data wait + relative to + conn->created */ +{ + ssize_t nread; + ssize_t allread = 0; + int result; + struct timeval tvnow; + long conntime; + *n = 0; + for(;;) { + tvnow = Curl_tvnow(); + /* calculating how long connection is establishing */ + conntime = Curl_tvdiff(tvnow, conn->created); + if(conntime > conn_timeout) { + /* we already got the timeout */ + result = CURLE_OPERATION_TIMEDOUT; + break; + } + if(Curl_socket_ready(sockfd, CURL_SOCKET_BAD, + (int)(conn_timeout - conntime)) <= 0) { + result = ~CURLE_OK; + break; + } + result = Curl_read_plain(sockfd, buf, buffersize, &nread); + if(CURLE_AGAIN == result) + continue; + else if(result) + break; + + if(buffersize == nread) { + allread += nread; + *n = allread; + result = CURLE_OK; + break; + } + if(!nread) { + result = ~CURLE_OK; + break; + } + + buffersize -= nread; + buf += nread; + allread += nread; + } + return result; +} + +/* +* This function logs in to a SOCKS4 proxy and sends the specifics to the final +* destination server. +* +* Reference : +* http://socks.permeo.com/protocol/socks4.protocol +* +* Note : +* Set protocol4a=true for "SOCKS 4A (Simple Extension to SOCKS 4 Protocol)" +* Nonsupport "Identification Protocol (RFC1413)" +*/ +CURLcode Curl_SOCKS4(const char *proxy_name, + const char *hostname, + int remote_port, + int sockindex, + struct connectdata *conn, + bool protocol4a) +{ +#define SOCKS4REQLEN 262 + unsigned char socksreq[SOCKS4REQLEN]; /* room for SOCKS4 request incl. user + id */ + int result; + CURLcode code; + curl_socket_t sock = conn->sock[sockindex]; + long timeout; + struct SessionHandle *data = conn->data; + + /* get timeout */ + timeout = Curl_timeleft(conn, NULL, TRUE); + + if(timeout < 0) { + /* time-out, bail out, go home */ + failf(data, "Connection time-out"); + return CURLE_OPERATION_TIMEDOUT; + } + + curlx_nonblock(sock, FALSE); + + /* + * Compose socks4 request + * + * Request format + * + * +----+----+----+----+----+----+----+----+----+----+....+----+ + * | VN | CD | DSTPORT | DSTIP | USERID |NULL| + * +----+----+----+----+----+----+----+----+----+----+....+----+ + * # of bytes: 1 1 2 4 variable 1 + */ + + socksreq[0] = 4; /* version (SOCKS4) */ + socksreq[1] = 1; /* connect */ + *((unsigned short*)&socksreq[2]) = htons((unsigned short)remote_port); + + /* DNS resolve only for SOCKS4, not SOCKS4a */ + if (!protocol4a) { + struct Curl_dns_entry *dns; + Curl_addrinfo *hp=NULL; + int rc; + + rc = Curl_resolv(conn, hostname, remote_port, &dns); + + if(rc == CURLRESOLV_ERROR) + return CURLE_COULDNT_RESOLVE_PROXY; + + if(rc == CURLRESOLV_PENDING) + /* ignores the return code, but 'dns' remains NULL on failure */ + (void)Curl_wait_for_resolv(conn, &dns); + + /* + * We cannot use 'hostent' as a struct that Curl_resolv() returns. It + * returns a Curl_addrinfo pointer that may not always look the same. + */ + if(dns) + hp=dns->addr; + if(hp) { + char buf[64]; + unsigned short ip[4]; + Curl_printable_address(hp, buf, sizeof(buf)); + + if(4 == sscanf( buf, "%hu.%hu.%hu.%hu", + &ip[0], &ip[1], &ip[2], &ip[3])) { + /* Set DSTIP */ + socksreq[4] = (unsigned char)ip[0]; + socksreq[5] = (unsigned char)ip[1]; + socksreq[6] = (unsigned char)ip[2]; + socksreq[7] = (unsigned char)ip[3]; + } + else + hp = NULL; /* fail! */ + + Curl_resolv_unlock(data, dns); /* not used anymore from now on */ + + } + if(!hp) { + failf(data, "Failed to resolve \"%s\" for SOCKS4 connect.", + hostname); + return CURLE_COULDNT_RESOLVE_HOST; + } + } + + /* + * This is currently not supporting "Identification Protocol (RFC1413)". + */ + socksreq[8] = 0; /* ensure empty userid is NUL-terminated */ + if(proxy_name) + strlcat((char*)socksreq + 8, proxy_name, sizeof(socksreq) - 8); + + /* + * Make connection + */ + { + ssize_t actualread; + ssize_t written; + ssize_t hostnamelen = 0; + int packetsize = 9 + + (int)strlen((char*)socksreq + 8); /* size including NUL */ + + /* If SOCKS4a, set special invalid IP address 0.0.0.x */ + if (protocol4a) { + socksreq[4] = 0; + socksreq[5] = 0; + socksreq[6] = 0; + socksreq[7] = 1; + /* If still enough room in buffer, also append hostname */ + hostnamelen = (ssize_t)strlen(hostname) + 1; /* length including NUL */ + if (packetsize + hostnamelen <= SOCKS4REQLEN) + strcpy((char*)socksreq + packetsize, hostname); + else + hostnamelen = 0; /* Flag: hostname did not fit in buffer */ + } + + /* Send request */ + code = Curl_write_plain(conn, sock, (char *)socksreq, + packetsize + hostnamelen, + &written); + if((code != CURLE_OK) || (written != packetsize + hostnamelen)) { + failf(data, "Failed to send SOCKS4 connect request."); + return CURLE_COULDNT_CONNECT; + } + if (protocol4a && hostnamelen == 0) { + /* SOCKS4a with very long hostname - send that name separately */ + hostnamelen = (ssize_t)strlen(hostname) + 1; + code = Curl_write_plain(conn, sock, (char *)hostname, hostnamelen, + &written); + if((code != CURLE_OK) || (written != hostnamelen)) { + failf(data, "Failed to send SOCKS4 connect request."); + return CURLE_COULDNT_CONNECT; + } + } + + packetsize = 8; /* receive data size */ + + /* Receive response */ + result = Curl_blockread_all(conn, sock, (char *)socksreq, packetsize, + &actualread, timeout); + if((result != CURLE_OK) || (actualread != packetsize)) { + failf(data, "Failed to receive SOCKS4 connect request ack."); + return CURLE_COULDNT_CONNECT; + } + + /* + * Response format + * + * +----+----+----+----+----+----+----+----+ + * | VN | CD | DSTPORT | DSTIP | + * +----+----+----+----+----+----+----+----+ + * # of bytes: 1 1 2 4 + * + * VN is the version of the reply code and should be 0. CD is the result + * code with one of the following values: + * + * 90: request granted + * 91: request rejected or failed + * 92: request rejected because SOCKS server cannot connect to + * identd on the client + * 93: request rejected because the client program and identd + * report different user-ids + */ + + /* wrong version ? */ + if(socksreq[0] != 0) { + failf(data, + "SOCKS4 reply has wrong version, version should be 4."); + return CURLE_COULDNT_CONNECT; + } + + /* Result */ + switch(socksreq[1]) + { + case 90: + if (protocol4a) + infof(data, "SOCKS4a request granted.\n"); + else + infof(data, "SOCKS4 request granted.\n"); + break; + case 91: + failf(data, + "Can't complete SOCKS4 connection to %d.%d.%d.%d:%d. (%d)" + ", request rejected or failed.", + (unsigned char)socksreq[4], (unsigned char)socksreq[5], + (unsigned char)socksreq[6], (unsigned char)socksreq[7], + (unsigned int)ntohs(*(unsigned short*)(&socksreq[8])), + socksreq[1]); + return CURLE_COULDNT_CONNECT; + case 92: + failf(data, + "Can't complete SOCKS4 connection to %d.%d.%d.%d:%d. (%d)" + ", request rejected because SOCKS server cannot connect to " + "identd on the client.", + (unsigned char)socksreq[4], (unsigned char)socksreq[5], + (unsigned char)socksreq[6], (unsigned char)socksreq[7], + (unsigned int)ntohs(*(unsigned short*)(&socksreq[8])), + socksreq[1]); + return CURLE_COULDNT_CONNECT; + case 93: + failf(data, + "Can't complete SOCKS4 connection to %d.%d.%d.%d:%d. (%d)" + ", request rejected because the client program and identd " + "report different user-ids.", + (unsigned char)socksreq[4], (unsigned char)socksreq[5], + (unsigned char)socksreq[6], (unsigned char)socksreq[7], + (unsigned int)ntohs(*(unsigned short*)(&socksreq[8])), + socksreq[1]); + return CURLE_COULDNT_CONNECT; + default: + failf(data, + "Can't complete SOCKS4 connection to %d.%d.%d.%d:%d. (%d)" + ", Unknown.", + (unsigned char)socksreq[4], (unsigned char)socksreq[5], + (unsigned char)socksreq[6], (unsigned char)socksreq[7], + (unsigned int)ntohs(*(unsigned short*)(&socksreq[8])), + socksreq[1]); + return CURLE_COULDNT_CONNECT; + } + } + + curlx_nonblock(sock, TRUE); + + return CURLE_OK; /* Proxy was successful! */ +} + +/* + * This function logs in to a SOCKS5 proxy and sends the specifics to the final + * destination server. + */ +CURLcode Curl_SOCKS5(const char *proxy_name, + const char *proxy_password, + const char *hostname, + int remote_port, + int sockindex, + struct connectdata *conn) +{ + /* + According to the RFC1928, section "6. Replies". This is what a SOCK5 + replies: + + +----+-----+-------+------+----------+----------+ + |VER | REP | RSV | ATYP | BND.ADDR | BND.PORT | + +----+-----+-------+------+----------+----------+ + | 1 | 1 | X'00' | 1 | Variable | 2 | + +----+-----+-------+------+----------+----------+ + + Where: + + o VER protocol version: X'05' + o REP Reply field: + o X'00' succeeded + */ + + unsigned char socksreq[600]; /* room for large user/pw (255 max each) */ + ssize_t actualread; + ssize_t written; + int result; + CURLcode code; + curl_socket_t sock = conn->sock[sockindex]; + struct SessionHandle *data = conn->data; + long timeout; + bool socks5_resolve_local = (bool)(data->set.proxytype == CURLPROXY_SOCKS5); + const size_t hostname_len = strlen(hostname); + ssize_t packetsize = 0; + + /* RFC1928 chapter 5 specifies max 255 chars for domain name in packet */ + if(!socks5_resolve_local && hostname_len > 255) + { + infof(conn->data,"SOCKS5: server resolving disabled for hostnames of " + "length > 255 [actual len=%zu]\n", hostname_len); + socks5_resolve_local = TRUE; + } + + /* get timeout */ + timeout = Curl_timeleft(conn, NULL, TRUE); + + if(timeout < 0) { + /* time-out, bail out, go home */ + failf(data, "Connection time-out"); + return CURLE_OPERATION_TIMEDOUT; + } + + curlx_nonblock(sock, TRUE); + + /* wait until socket gets connected */ + result = Curl_socket_ready(CURL_SOCKET_BAD, sock, (int)timeout); + + if(-1 == result) { + failf(conn->data, "SOCKS5: no connection here"); + return CURLE_COULDNT_CONNECT; + } + else if(0 == result) { + failf(conn->data, "SOCKS5: connection timeout"); + return CURLE_OPERATION_TIMEDOUT; + } + + if(result & CURL_CSELECT_ERR) { + failf(conn->data, "SOCKS5: error occured during connection"); + return CURLE_COULDNT_CONNECT; + } + + socksreq[0] = 5; /* version */ +#if defined(HAVE_GSSAPI) || defined(USE_WINDOWS_SSPI) + socksreq[1] = (char)(proxy_name ? 3 : 2); /* number of methods (below) */ + socksreq[2] = 0; /* no authentication */ + socksreq[3] = 1; /* gssapi */ + socksreq[4] = 2; /* username/password */ +#else + socksreq[1] = (char)(proxy_name ? 2 : 1); /* number of methods (below) */ + socksreq[2] = 0; /* no authentication */ + socksreq[3] = 2; /* username/password */ +#endif + + curlx_nonblock(sock, FALSE); + + code = Curl_write_plain(conn, sock, (char *)socksreq, (2 + (int)socksreq[1]), + &written); + if((code != CURLE_OK) || (written != (2 + (int)socksreq[1]))) { + failf(data, "Unable to send initial SOCKS5 request."); + return CURLE_COULDNT_CONNECT; + } + + curlx_nonblock(sock, TRUE); + + result = Curl_socket_ready(sock, CURL_SOCKET_BAD, (int)timeout); + + if(-1 == result) { + failf(conn->data, "SOCKS5 nothing to read"); + return CURLE_COULDNT_CONNECT; + } + else if(0 == result) { + failf(conn->data, "SOCKS5 read timeout"); + return CURLE_OPERATION_TIMEDOUT; + } + + if(result & CURL_CSELECT_ERR) { + failf(conn->data, "SOCKS5 read error occured"); + return CURLE_RECV_ERROR; + } + + curlx_nonblock(sock, FALSE); + + result=Curl_blockread_all(conn, sock, (char *)socksreq, 2, &actualread, + timeout); + if((result != CURLE_OK) || (actualread != 2)) { + failf(data, "Unable to receive initial SOCKS5 response."); + return CURLE_COULDNT_CONNECT; + } + + if(socksreq[0] != 5) { + failf(data, "Received invalid version in initial SOCKS5 response."); + return CURLE_COULDNT_CONNECT; + } + if(socksreq[1] == 0) { + /* Nothing to do, no authentication needed */ + ; + } +#if defined(HAVE_GSSAPI) || defined(USE_WINDOWS_SSPI) + else if(socksreq[1] == 1) { + code = Curl_SOCKS5_gssapi_negotiate(sockindex, conn); + if(code != CURLE_OK) { + failf(data, "Unable to negotiate SOCKS5 gssapi context."); + return CURLE_COULDNT_CONNECT; + } + } +#endif + else if(socksreq[1] == 2) { + /* Needs user name and password */ + size_t userlen, pwlen; + int len; + if(proxy_name && proxy_password) { + userlen = strlen(proxy_name); + pwlen = strlen(proxy_password); + } + else { + userlen = 0; + pwlen = 0; + } + + /* username/password request looks like + * +----+------+----------+------+----------+ + * |VER | ULEN | UNAME | PLEN | PASSWD | + * +----+------+----------+------+----------+ + * | 1 | 1 | 1 to 255 | 1 | 1 to 255 | + * +----+------+----------+------+----------+ + */ + len = 0; + socksreq[len++] = 1; /* username/pw subnegotiation version */ + socksreq[len++] = (unsigned char) userlen; + if(proxy_name && userlen) + memcpy(socksreq + len, proxy_name, userlen); + len += (int)userlen; + socksreq[len++] = (unsigned char) pwlen; + if(proxy_password && pwlen) + memcpy(socksreq + len, proxy_password, pwlen); + len += (int)pwlen; + + code = Curl_write_plain(conn, sock, (char *)socksreq, len, &written); + if((code != CURLE_OK) || (len != written)) { + failf(data, "Failed to send SOCKS5 sub-negotiation request."); + return CURLE_COULDNT_CONNECT; + } + + result=Curl_blockread_all(conn, sock, (char *)socksreq, 2, &actualread, + timeout); + if((result != CURLE_OK) || (actualread != 2)) { + failf(data, "Unable to receive SOCKS5 sub-negotiation response."); + return CURLE_COULDNT_CONNECT; + } + + /* ignore the first (VER) byte */ + if(socksreq[1] != 0) { /* status */ + failf(data, "User was rejected by the SOCKS5 server (%d %d).", + socksreq[0], socksreq[1]); + return CURLE_COULDNT_CONNECT; + } + + /* Everything is good so far, user was authenticated! */ + } + else { + /* error */ +#if defined(HAVE_GSSAPI) || defined(USE_WINDOWS_SSPI) + if(socksreq[1] == 255) { +#else + if(socksreq[1] == 1) { + failf(data, + "SOCKS5 GSSAPI per-message authentication is not supported."); + return CURLE_COULDNT_CONNECT; + } + else if(socksreq[1] == 255) { +#endif + if(!proxy_name || !*proxy_name) { + failf(data, + "No authentication method was acceptable. (It is quite likely" + " that the SOCKS5 server wanted a username/password, since none" + " was supplied to the server on this connection.)"); + } + else { + failf(data, "No authentication method was acceptable."); + } + return CURLE_COULDNT_CONNECT; + } + else { + failf(data, + "Undocumented SOCKS5 mode attempted to be used by server."); + return CURLE_COULDNT_CONNECT; + } + } + + /* Authentication is complete, now specify destination to the proxy */ + socksreq[0] = 5; /* version (SOCKS5) */ + socksreq[1] = 1; /* connect */ + socksreq[2] = 0; /* must be zero */ + + if(!socks5_resolve_local) { + packetsize = (ssize_t)(5 + hostname_len + 2); + + socksreq[3] = 3; /* ATYP: domain name = 3 */ + socksreq[4] = (char) hostname_len; /* address length */ + memcpy(&socksreq[5], hostname, hostname_len); /* address bytes w/o NULL */ + + *((unsigned short*)&socksreq[hostname_len+5]) = + htons((unsigned short)remote_port); + } + else { + struct Curl_dns_entry *dns; + Curl_addrinfo *hp=NULL; + int rc = Curl_resolv(conn, hostname, remote_port, &dns); + + packetsize = 10; + + socksreq[3] = 1; /* IPv4 = 1 */ + + if(rc == CURLRESOLV_ERROR) + return CURLE_COULDNT_RESOLVE_HOST; + + if(rc == CURLRESOLV_PENDING) { + /* this requires that we're in "wait for resolve" state */ + code = Curl_wait_for_resolv(conn, &dns); + if(code != CURLE_OK) + return code; + } + + /* + * We cannot use 'hostent' as a struct that Curl_resolv() returns. It + * returns a Curl_addrinfo pointer that may not always look the same. + */ + if(dns) + hp=dns->addr; + if(hp) { + char buf[64]; + unsigned short ip[4]; + Curl_printable_address(hp, buf, sizeof(buf)); + + if(4 == sscanf( buf, "%hu.%hu.%hu.%hu", + &ip[0], &ip[1], &ip[2], &ip[3])) { + socksreq[4] = (unsigned char)ip[0]; + socksreq[5] = (unsigned char)ip[1]; + socksreq[6] = (unsigned char)ip[2]; + socksreq[7] = (unsigned char)ip[3]; + } + else + hp = NULL; /* fail! */ + + Curl_resolv_unlock(data, dns); /* not used anymore from now on */ + } + if(!hp) { + failf(data, "Failed to resolve \"%s\" for SOCKS5 connect.", + hostname); + return CURLE_COULDNT_RESOLVE_HOST; + } + + *((unsigned short*)&socksreq[8]) = htons((unsigned short)remote_port); + } + +#if defined(HAVE_GSSAPI) || defined(USE_WINDOWS_SSPI) + if(conn->socks5_gssapi_enctype) { + failf(data, "SOCKS5 gssapi protection not yet implemented."); + } else +#endif + code = Curl_write_plain(conn, sock, (char *)socksreq, packetsize, &written); + if((code != CURLE_OK) || (written != packetsize)) { + failf(data, "Failed to send SOCKS5 connect request."); + return CURLE_COULDNT_CONNECT; + } + + packetsize = 10; /* minimum packet size is 10 */ + +#if defined(HAVE_GSSAPI) || defined(USE_WINDOWS_SSPI) + if(conn->socks5_gssapi_enctype) { + failf(data, "SOCKS5 gssapi protection not yet implemented."); + } else +#endif + result = Curl_blockread_all(conn, sock, (char *)socksreq, packetsize, + &actualread, timeout); + if((result != CURLE_OK) || (actualread != packetsize)) { + failf(data, "Failed to receive SOCKS5 connect request ack."); + return CURLE_COULDNT_CONNECT; + } + + if(socksreq[0] != 5) { /* version */ + failf(data, + "SOCKS5 reply has wrong version, version should be 5."); + return CURLE_COULDNT_CONNECT; + } + if(socksreq[1] != 0) { /* Anything besides 0 is an error */ + failf(data, + "Can't complete SOCKS5 connection to %d.%d.%d.%d:%d. (%d)", + (unsigned char)socksreq[4], (unsigned char)socksreq[5], + (unsigned char)socksreq[6], (unsigned char)socksreq[7], + (unsigned int)ntohs(*(unsigned short*)(&socksreq[8])), + socksreq[1]); + return CURLE_COULDNT_CONNECT; + } + + /* Fix: in general, returned BND.ADDR is variable length parameter by RFC + 1928, so the reply packet should be read until the end to avoid errors at + subsequent protocol level. + + +----+-----+-------+------+----------+----------+ + |VER | REP | RSV | ATYP | BND.ADDR | BND.PORT | + +----+-----+-------+------+----------+----------+ + | 1 | 1 | X'00' | 1 | Variable | 2 | + +----+-----+-------+------+----------+----------+ + + ATYP: + o IP v4 address: X'01', BND.ADDR = 4 byte + o domain name: X'03', BND.ADDR = [ 1 byte length, string ] + o IP v6 address: X'04', BND.ADDR = 16 byte + */ + + /* Calculate real packet size */ + if(socksreq[3] == 3) { + /* domain name */ + int addrlen = (int) socksreq[4]; + packetsize = 5 + addrlen + 2; + } + else if(socksreq[3] == 4) { + /* IPv6 */ + packetsize = 4 + 16 + 2; + } + + /* At this point we already read first 10 bytes */ +#if defined(HAVE_GSSAPI) || defined(USE_WINDOWS_SSPI) + if(!conn->socks5_gssapi_enctype) { + /* decrypt_gssapi_blockread already read the whole packet */ +#endif + if(packetsize > 10) { + packetsize -= 10; + result = Curl_blockread_all(conn, sock, (char *)&socksreq[10], + packetsize, &actualread, timeout); + if((result != CURLE_OK) || (actualread != packetsize)) { + failf(data, "Failed to receive SOCKS5 connect request ack."); + return CURLE_COULDNT_CONNECT; + } + } +#if defined(HAVE_GSSAPI) || defined(USE_WINDOWS_SSPI) + } +#endif + + curlx_nonblock(sock, TRUE); + return CURLE_OK; /* Proxy was successful! */ +} + +#endif /* CURL_DISABLE_PROXY */ + diff --git a/mobicore/common/curl/lib/socks.h b/mobicore/common/curl/lib/socks.h new file mode 100644 index 0000000000000000000000000000000000000000..2bea66bf696ce35e4bd799a2c564923988f55063 --- /dev/null +++ b/mobicore/common/curl/lib/socks.h @@ -0,0 +1,69 @@ +#ifndef __SOCKS_H +#define __SOCKS_H +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) 1998 - 2009, Daniel Stenberg, , et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at http://curl.haxx.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ***************************************************************************/ + +/* + * Helper read-from-socket functions. Does the same as Curl_read() but it + * blocks until all bytes amount of buffersize will be read. No more, no less. + * + * This is STUPID BLOCKING behaviour which we frown upon, but right now this + * is what we have... + */ +int Curl_blockread_all(struct connectdata *conn, + curl_socket_t sockfd, + char *buf, + ssize_t buffersize, + ssize_t *n, + long conn_timeout); + +/* + * This function logs in to a SOCKS4(a) proxy and sends the specifics to the + * final destination server. + */ +CURLcode Curl_SOCKS4(const char *proxy_name, + const char *hostname, + int remote_port, + int sockindex, + struct connectdata *conn, + bool protocol4a); + +/* + * This function logs in to a SOCKS5 proxy and sends the specifics to the + * final destination server. + */ +CURLcode Curl_SOCKS5(const char *proxy_name, + const char *proxy_password, + const char *hostname, + int remote_port, + int sockindex, + struct connectdata *conn); + +#if defined(HAVE_GSSAPI) || defined(USE_WINDOWS_SSPI) +/* + * This function handles the sockss5 gssapie negotiation and initialisation + */ +CURLcode Curl_SOCKS5_gssapi_negotiate(int sockindex, + struct connectdata *conn); +#endif + +#endif /* __SOCKS_H */ diff --git a/mobicore/common/curl/lib/socks_gssapi.c b/mobicore/common/curl/lib/socks_gssapi.c new file mode 100644 index 0000000000000000000000000000000000000000..1ff6f6010952857f5fa34cb282c78d9bb66b8c6b --- /dev/null +++ b/mobicore/common/curl/lib/socks_gssapi.c @@ -0,0 +1,548 @@ +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) 2009, Markus Moeller, + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at http://curl.haxx.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ***************************************************************************/ + +#include "setup.h" + +#ifndef CURL_DISABLE_PROXY + +#ifdef HAVE_GSSAPI +#ifdef HAVE_OLD_GSSMIT +#define GSS_C_NT_HOSTBASED_SERVICE gss_nt_service_name +#endif +#ifndef gss_nt_service_name +#define gss_nt_service_name GSS_C_NT_HOSTBASED_SERVICE +#endif +#include + +#ifdef HAVE_STDLIB_H +#include +#endif + +#include "urldata.h" +#include "sendf.h" +#include "connect.h" +#include "timeval.h" +#include "socks.h" + +static gss_ctx_id_t gss_context = GSS_C_NO_CONTEXT; + +#define _MPRINTF_REPLACE /* use our functions only */ +#include + +#include "curl_memory.h" +/* The last #include file should be: */ +#include "memdebug.h" + +/* + * Helper gssapi error functions. + */ +static int check_gss_err(struct SessionHandle *data, + OM_uint32 major_status, + OM_uint32 minor_status, + const char* function) +{ + if(GSS_ERROR(major_status)) { + OM_uint32 maj_stat,min_stat; + OM_uint32 msg_ctx = 0; + gss_buffer_desc status_string; + char buf[1024]; + size_t len; + + len = 0; + msg_ctx = 0; + while(!msg_ctx) { + /* convert major status code (GSS-API error) to text */ + maj_stat = gss_display_status(&min_stat, major_status, + GSS_C_GSS_CODE, + GSS_C_NULL_OID, + &msg_ctx, &status_string); + if(maj_stat == GSS_S_COMPLETE) { + if(sizeof(buf) > len + status_string.length + 1) { + strcpy(buf+len, (char*) status_string.value); + len += status_string.length; + } + gss_release_buffer(&min_stat, &status_string); + break; + } + gss_release_buffer(&min_stat, &status_string); + } + if(sizeof(buf) > len + 3) { + strcpy(buf+len, ".\n"); + len += 2; + } + msg_ctx = 0; + while(!msg_ctx) { + /* convert minor status code (underlying routine error) to text */ + maj_stat = gss_display_status(&min_stat, minor_status, + GSS_C_MECH_CODE, + GSS_C_NULL_OID, + &msg_ctx, &status_string); + if(maj_stat == GSS_S_COMPLETE) { + if(sizeof(buf) > len + status_string.length) { + strcpy(buf+len, (char*) status_string.value); + len += status_string.length; + } + gss_release_buffer(&min_stat, &status_string); + break; + } + gss_release_buffer(&min_stat, &status_string); + } + failf(data, "GSSAPI error: %s failed:\n%s\n", function, buf); + return(1); + } + + return(0); +} + +CURLcode Curl_SOCKS5_gssapi_negotiate(int sockindex, + struct connectdata *conn) +{ + struct SessionHandle *data = conn->data; + curl_socket_t sock = conn->sock[sockindex]; + CURLcode code; + ssize_t actualread; + ssize_t written; + int result; + long timeout; + OM_uint32 gss_major_status, gss_minor_status, gss_status; + OM_uint32 gss_ret_flags; + int gss_conf_state, gss_enc; + gss_buffer_desc service = GSS_C_EMPTY_BUFFER; + gss_buffer_desc gss_send_token = GSS_C_EMPTY_BUFFER; + gss_buffer_desc gss_recv_token = GSS_C_EMPTY_BUFFER; + gss_buffer_desc gss_w_token = GSS_C_EMPTY_BUFFER; + gss_buffer_desc* gss_token = GSS_C_NO_BUFFER; + gss_name_t server = GSS_C_NO_NAME; + gss_name_t gss_client_name = GSS_C_NO_NAME; + u_short us_length; + char *user=NULL; + unsigned char socksreq[4]; /* room for gssapi exchange header only */ + char *serviceptr = data->set.str[STRING_SOCKS5_GSSAPI_SERVICE]; + + /* get timeout */ + timeout = Curl_timeleft(conn, NULL, TRUE); + + /* GSSAPI request looks like + * +----+------+-----+----------------+ + * |VER | MTYP | LEN | TOKEN | + * +----+------+----------------------+ + * | 1 | 1 | 2 | up to 2^16 - 1 | + * +----+------+-----+----------------+ + */ + + /* prepare service name */ + if (strchr(serviceptr,'/')) { + service.value = malloc(strlen(serviceptr)); + if(!service.value) + return CURLE_OUT_OF_MEMORY; + service.length = strlen(serviceptr); + memcpy(service.value, serviceptr, service.length); + + gss_major_status = gss_import_name(&gss_minor_status, &service, + (gss_OID) GSS_C_NULL_OID, &server); + } + else { + service.value = malloc(strlen(serviceptr) +strlen(conn->proxy.name)+2); + if(!service.value) + return CURLE_OUT_OF_MEMORY; + service.length = strlen(serviceptr) +strlen(conn->proxy.name)+1; + snprintf(service.value, service.length+1, "%s@%s", + serviceptr, conn->proxy.name); + + gss_major_status = gss_import_name(&gss_minor_status, &service, + gss_nt_service_name, &server); + } + + gss_release_buffer(&gss_status, &service); /* clear allocated memory */ + + if(check_gss_err(data,gss_major_status, + gss_minor_status,"gss_import_name()")) { + failf(data, "Failed to create service name."); + gss_release_name(&gss_status, &server); + return CURLE_COULDNT_CONNECT; + } + + /* As long as we need to keep sending some context info, and there's no */ + /* errors, keep sending it... */ + for(;;) { + gss_major_status = gss_init_sec_context(&gss_minor_status, + GSS_C_NO_CREDENTIAL, + &gss_context, server, + GSS_C_NULL_OID, + GSS_C_MUTUAL_FLAG | + GSS_C_REPLAY_FLAG, + 0, + NULL, + gss_token, + NULL, + &gss_send_token, + &gss_ret_flags, + NULL); + + if(gss_token != GSS_C_NO_BUFFER) + gss_release_buffer(&gss_status, &gss_recv_token); + if(check_gss_err(data,gss_major_status, + gss_minor_status,"gss_init_sec_context")) { + gss_release_name(&gss_status, &server); + gss_release_buffer(&gss_status, &gss_recv_token); + gss_release_buffer(&gss_status, &gss_send_token); + gss_delete_sec_context(&gss_status, &gss_context, NULL); + failf(data, "Failed to initial GSSAPI token."); + return CURLE_COULDNT_CONNECT; + } + + if(gss_send_token.length != 0) { + socksreq[0] = 1; /* gssapi subnegotiation version */ + socksreq[1] = 1; /* authentication message type */ + us_length = htons((short)gss_send_token.length); + memcpy(socksreq+2,&us_length,sizeof(short)); + + code = Curl_write_plain(conn, sock, (char *)socksreq, 4, &written); + if((code != CURLE_OK) || (4 != written)) { + failf(data, "Failed to send GSSAPI authentication request."); + gss_release_name(&gss_status, &server); + gss_release_buffer(&gss_status, &gss_recv_token); + gss_release_buffer(&gss_status, &gss_send_token); + gss_delete_sec_context(&gss_status, &gss_context, NULL); + return CURLE_COULDNT_CONNECT; + } + + code = Curl_write_plain(conn, sock, (char *)gss_send_token.value, + gss_send_token.length, &written); + + if((code != CURLE_OK) || ((ssize_t)gss_send_token.length != written)) { + failf(data, "Failed to send GSSAPI authentication token."); + gss_release_name(&gss_status, &server); + gss_release_buffer(&gss_status, &gss_recv_token); + gss_release_buffer(&gss_status, &gss_send_token); + gss_delete_sec_context(&gss_status, &gss_context, NULL); + return CURLE_COULDNT_CONNECT; + } + + } + + gss_release_buffer(&gss_status, &gss_send_token); + gss_release_buffer(&gss_status, &gss_recv_token); + if(gss_major_status != GSS_S_CONTINUE_NEEDED) break; + + /* analyse response */ + + /* GSSAPI response looks like + * +----+------+-----+----------------+ + * |VER | MTYP | LEN | TOKEN | + * +----+------+----------------------+ + * | 1 | 1 | 2 | up to 2^16 - 1 | + * +----+------+-----+----------------+ + */ + + result=Curl_blockread_all(conn, sock, (char *)socksreq, 4, + &actualread, timeout); + if(result != CURLE_OK || actualread != 4) { + failf(data, "Failed to receive GSSAPI authentication response."); + gss_release_name(&gss_status, &server); + gss_delete_sec_context(&gss_status, &gss_context, NULL); + return CURLE_COULDNT_CONNECT; + } + + /* ignore the first (VER) byte */ + if(socksreq[1] == 255) { /* status / message type */ + failf(data, "User was rejected by the SOCKS5 server (%d %d).", + socksreq[0], socksreq[1]); + gss_release_name(&gss_status, &server); + gss_delete_sec_context(&gss_status, &gss_context, NULL); + return CURLE_COULDNT_CONNECT; + } + + if(socksreq[1] != 1) { /* status / messgae type */ + failf(data, "Invalid GSSAPI authentication response type (%d %d).", + socksreq[0], socksreq[1]); + gss_release_name(&gss_status, &server); + gss_delete_sec_context(&gss_status, &gss_context, NULL); + return CURLE_COULDNT_CONNECT; + } + + memcpy(&us_length, socksreq+2, sizeof(short)); + us_length = ntohs(us_length); + + gss_recv_token.length=us_length; + gss_recv_token.value=malloc(us_length); + if(!gss_recv_token.value) { + failf(data, + "Could not allocate memory for GSSAPI authentication " + "response token."); + gss_release_name(&gss_status, &server); + gss_delete_sec_context(&gss_status, &gss_context, NULL); + return CURLE_OUT_OF_MEMORY; + } + + result=Curl_blockread_all(conn, sock, (char *)gss_recv_token.value, + gss_recv_token.length, + &actualread, timeout); + + if(result != CURLE_OK || actualread != us_length) { + failf(data, "Failed to receive GSSAPI authentication token."); + gss_release_name(&gss_status, &server); + gss_release_buffer(&gss_status, &gss_recv_token); + gss_delete_sec_context(&gss_status, &gss_context, NULL); + return CURLE_COULDNT_CONNECT; + } + + gss_token = &gss_recv_token; + } + + gss_release_name(&gss_status, &server); + + /* Everything is good so far, user was authenticated! */ + gss_major_status = gss_inquire_context (&gss_minor_status, gss_context, + &gss_client_name, NULL, NULL, NULL, + NULL, NULL, NULL); + if(check_gss_err(data,gss_major_status, + gss_minor_status,"gss_inquire_context")) { + gss_delete_sec_context(&gss_status, &gss_context, NULL); + gss_release_name(&gss_status, &gss_client_name); + failf(data, "Failed to determine user name."); + return CURLE_COULDNT_CONNECT; + } + gss_major_status = gss_display_name(&gss_minor_status, gss_client_name, + &gss_send_token, NULL); + if(check_gss_err(data,gss_major_status, + gss_minor_status,"gss_display_name")) { + gss_delete_sec_context(&gss_status, &gss_context, NULL); + gss_release_name(&gss_status, &gss_client_name); + gss_release_buffer(&gss_status, &gss_send_token); + failf(data, "Failed to determine user name."); + return CURLE_COULDNT_CONNECT; + } + user=malloc(gss_send_token.length+1); + if(!user) { + gss_delete_sec_context(&gss_status, &gss_context, NULL); + gss_release_name(&gss_status, &gss_client_name); + gss_release_buffer(&gss_status, &gss_send_token); + return CURLE_OUT_OF_MEMORY; + } + + memcpy(user, gss_send_token.value, gss_send_token.length); + user[gss_send_token.length] = '\0'; + gss_release_name(&gss_status, &gss_client_name); + gss_release_buffer(&gss_status, &gss_send_token); + infof(data, "SOCKS5 server authencticated user %s with gssapi.\n",user); + free(user); + user=NULL; + + /* Do encryption */ + socksreq[0] = 1; /* gssapi subnegotiation version */ + socksreq[1] = 2; /* encryption message type */ + + gss_enc = 0; /* no data protection */ + /* do confidentiality protection if supported */ + if(gss_ret_flags & GSS_C_CONF_FLAG) + gss_enc = 2; + /* else do integrity protection */ + else if(gss_ret_flags & GSS_C_INTEG_FLAG) + gss_enc = 1; + + infof(data, "SOCKS5 server supports gssapi %s data protection.\n", + (gss_enc==0)?"no":((gss_enc==1)?"integrity":"confidentiality")); + /* force for the moment to no data protection */ + gss_enc = 0; + /* + * Sending the encryption type in clear seems wrong. It should be + * protected with gss_seal()/gss_wrap(). See RFC1961 extract below + * The NEC reference implementations on which this is based is + * therefore at fault + * + * +------+------+------+.......................+ + * + ver | mtyp | len | token | + * +------+------+------+.......................+ + * + 0x01 | 0x02 | 0x02 | up to 2^16 - 1 octets | + * +------+------+------+.......................+ + * + * Where: + * + * - "ver" is the protocol version number, here 1 to represent the + * first version of the SOCKS/GSS-API protocol + * + * - "mtyp" is the message type, here 2 to represent a protection + * -level negotiation message + * + * - "len" is the length of the "token" field in octets + * + * - "token" is the GSS-API encapsulated protection level + * + * The token is produced by encapsulating an octet containing the + * required protection level using gss_seal()/gss_wrap() with conf_req + * set to FALSE. The token is verified using gss_unseal()/ + * gss_unwrap(). + * + */ + if(data->set.socks5_gssapi_nec) { + us_length = htons((short)1); + memcpy(socksreq+2,&us_length,sizeof(short)); + } + else { + gss_send_token.length = 1; + gss_send_token.value = malloc(1); + if(!gss_send_token.value) { + gss_delete_sec_context(&gss_status, &gss_context, NULL); + return CURLE_OUT_OF_MEMORY; + } + memcpy(gss_send_token.value, &gss_enc, 1); + + gss_major_status = gss_wrap(&gss_minor_status, gss_context, 0, + GSS_C_QOP_DEFAULT, &gss_send_token, + &gss_conf_state, &gss_w_token); + + if(check_gss_err(data,gss_major_status,gss_minor_status,"gss_wrap")) { + gss_release_buffer(&gss_status, &gss_send_token); + gss_release_buffer(&gss_status, &gss_w_token); + gss_delete_sec_context(&gss_status, &gss_context, NULL); + failf(data, "Failed to wrap GSSAPI encryption value into token."); + return CURLE_COULDNT_CONNECT; + } + gss_release_buffer(&gss_status, &gss_send_token); + + us_length = htons((short)gss_w_token.length); + memcpy(socksreq+2,&us_length,sizeof(short)); + } + + code = Curl_write_plain(conn, sock, (char *)socksreq, 4, &written); + if((code != CURLE_OK) || (4 != written)) { + failf(data, "Failed to send GSSAPI encryption request."); + gss_release_buffer(&gss_status, &gss_w_token); + gss_delete_sec_context(&gss_status, &gss_context, NULL); + return CURLE_COULDNT_CONNECT; + } + + if(data->set.socks5_gssapi_nec) { + memcpy(socksreq, &gss_enc, 1); + code = Curl_write_plain(conn, sock, socksreq, 1, &written); + if((code != CURLE_OK) || ( 1 != written)) { + failf(data, "Failed to send GSSAPI encryption type."); + gss_delete_sec_context(&gss_status, &gss_context, NULL); + return CURLE_COULDNT_CONNECT; + } + } else { + code = Curl_write_plain(conn, sock, (char *)gss_w_token.value, + gss_w_token.length, &written); + if((code != CURLE_OK) || ((ssize_t)gss_w_token.length != written)) { + failf(data, "Failed to send GSSAPI encryption type."); + gss_release_buffer(&gss_status, &gss_w_token); + gss_delete_sec_context(&gss_status, &gss_context, NULL); + return CURLE_COULDNT_CONNECT; + } + gss_release_buffer(&gss_status, &gss_w_token); + } + + result=Curl_blockread_all(conn, sock, (char *)socksreq, 4, + &actualread, timeout); + if(result != CURLE_OK || actualread != 4) { + failf(data, "Failed to receive GSSAPI encryption response."); + gss_delete_sec_context(&gss_status, &gss_context, NULL); + return CURLE_COULDNT_CONNECT; + } + + /* ignore the first (VER) byte */ + if(socksreq[1] == 255) { /* status / message type */ + failf(data, "User was rejected by the SOCKS5 server (%d %d).", + socksreq[0], socksreq[1]); + gss_delete_sec_context(&gss_status, &gss_context, NULL); + return CURLE_COULDNT_CONNECT; + } + + if(socksreq[1] != 2) { /* status / messgae type */ + failf(data, "Invalid GSSAPI encryption response type (%d %d).", + socksreq[0], socksreq[1]); + gss_delete_sec_context(&gss_status, &gss_context, NULL); + return CURLE_COULDNT_CONNECT; + } + + memcpy(&us_length, socksreq+2, sizeof(short)); + us_length = ntohs(us_length); + + gss_recv_token.length= us_length; + gss_recv_token.value=malloc(gss_recv_token.length); + if(!gss_recv_token.value) { + gss_delete_sec_context(&gss_status, &gss_context, NULL); + return CURLE_OUT_OF_MEMORY; + } + result=Curl_blockread_all(conn, sock, (char *)gss_recv_token.value, + gss_recv_token.length, + &actualread, timeout); + + if(result != CURLE_OK || actualread != us_length) { + failf(data, "Failed to receive GSSAPI encryptrion type."); + gss_release_buffer(&gss_status, &gss_recv_token); + gss_delete_sec_context(&gss_status, &gss_context, NULL); + return CURLE_COULDNT_CONNECT; + } + + if(!data->set.socks5_gssapi_nec) { + gss_major_status = gss_unwrap(&gss_minor_status, gss_context, + &gss_recv_token, &gss_w_token, + 0, GSS_C_QOP_DEFAULT); + + if(check_gss_err(data,gss_major_status,gss_minor_status,"gss_unwrap")) { + gss_release_buffer(&gss_status, &gss_recv_token); + gss_release_buffer(&gss_status, &gss_w_token); + gss_delete_sec_context(&gss_status, &gss_context, NULL); + failf(data, "Failed to unwrap GSSAPI encryption value into token."); + return CURLE_COULDNT_CONNECT; + } + gss_release_buffer(&gss_status, &gss_recv_token); + + if(gss_w_token.length != 1) { + failf(data, "Invalid GSSAPI encryption response length (%d).", + gss_w_token.length); + gss_release_buffer(&gss_status, &gss_w_token); + gss_delete_sec_context(&gss_status, &gss_context, NULL); + return CURLE_COULDNT_CONNECT; + } + + memcpy(socksreq,gss_w_token.value,gss_w_token.length); + gss_release_buffer(&gss_status, &gss_w_token); + } + else { + if(gss_recv_token.length != 1) { + failf(data, "Invalid GSSAPI encryption response length (%d).", + gss_recv_token.length); + gss_release_buffer(&gss_status, &gss_recv_token); + gss_delete_sec_context(&gss_status, &gss_context, NULL); + return CURLE_COULDNT_CONNECT; + } + + memcpy(socksreq,gss_recv_token.value,gss_recv_token.length); + gss_release_buffer(&gss_status, &gss_recv_token); + } + + infof(data, "SOCKS5 access with%s protection granted.\n", + (socksreq[0]==0)?"out gssapi data": + ((socksreq[0]==1)?" gssapi integrity":" gssapi confidentiality")); + + conn->socks5_gssapi_enctype = socksreq[0]; + if(socksreq[0] == 0) + gss_delete_sec_context(&gss_status, &gss_context, NULL); + + return CURLE_OK; +} +#endif + +#endif /* CURL_DISABLE_PROXY */ diff --git a/mobicore/common/curl/lib/socks_sspi.c b/mobicore/common/curl/lib/socks_sspi.c new file mode 100644 index 0000000000000000000000000000000000000000..e9fd551ccbfe476dca1fb416675d58c2eed6f18d --- /dev/null +++ b/mobicore/common/curl/lib/socks_sspi.c @@ -0,0 +1,696 @@ +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) 2009, Markus Moeller, + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at http://curl.haxx.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ***************************************************************************/ + + +#include "setup.h" + +#ifdef USE_WINDOWS_SSPI + +#include + +#ifdef HAVE_STDLIB_H +#include +#endif + +#include "urldata.h" +#include "sendf.h" +#include "connect.h" +#include "timeval.h" +#include "socks.h" +#include "curl_sspi.h" + +#define _MPRINTF_REPLACE /* use the internal *printf() functions */ +#include + +#include "curl_memory.h" +/* The last #include file should be: */ +#include "memdebug.h" + +/* + * Definitions required from ntsecapi.h are directly provided below this point + * to avoid including ntsecapi.h due to a conflict with OpenSSL's safestack.h + */ +#define KERB_WRAP_NO_ENCRYPT 0x80000001 + +/* + * Helper sspi error functions. + */ +static int check_sspi_err(struct SessionHandle *data, + SECURITY_STATUS major_status, + SECURITY_STATUS minor_status, + const char* function) +{ + const char *txt; + (void)minor_status; + + if(major_status != SEC_E_OK && + major_status != SEC_I_COMPLETE_AND_CONTINUE && + major_status != SEC_I_COMPLETE_NEEDED && + major_status != SEC_I_CONTINUE_NEEDED) { + failf(data, "SSPI error: %s failed: %d\n", function, major_status); + switch (major_status) { + case SEC_I_COMPLETE_AND_CONTINUE: + txt="SEC_I_COMPLETE_AND_CONTINUE"; + break; + case SEC_I_COMPLETE_NEEDED: + txt="SEC_I_COMPLETE_NEEDED"; + break; + case SEC_I_CONTINUE_NEEDED: + txt="SEC_I_CONTINUE_NEEDED"; + break; + case SEC_I_CONTEXT_EXPIRED: + txt="SEC_I_CONTEXT_EXPIRED"; + break; + case SEC_I_INCOMPLETE_CREDENTIALS: + txt="SEC_I_INCOMPLETE_CREDENTIALS"; + break; + case SEC_I_RENEGOTIATE: + txt="SEC_I_RENEGOTIATE"; + break; + case SEC_E_BUFFER_TOO_SMALL: + txt="SEC_E_BUFFER_TOO_SMALL"; + break; + case SEC_E_CONTEXT_EXPIRED: + txt="SEC_E_CONTEXT_EXPIRED"; + break; + case SEC_E_CRYPTO_SYSTEM_INVALID: + txt="SEC_E_CRYPTO_SYSTEM_INVALID"; + break; + case SEC_E_INCOMPLETE_MESSAGE: + txt="SEC_E_INCOMPLETE_MESSAGE"; + break; + case SEC_E_INSUFFICIENT_MEMORY: + txt="SEC_E_INSUFFICIENT_MEMORY"; + break; + case SEC_E_INTERNAL_ERROR: + txt="SEC_E_INTERNAL_ERROR"; + break; + case SEC_E_INVALID_HANDLE: + txt="SEC_E_INVALID_HANDLE"; + break; + case SEC_E_INVALID_TOKEN: + txt="SEC_E_INVALID_TOKEN"; + break; + case SEC_E_LOGON_DENIED: + txt="SEC_E_LOGON_DENIED"; + break; + case SEC_E_MESSAGE_ALTERED: + txt="SEC_E_MESSAGE_ALTERED"; + break; + case SEC_E_NO_AUTHENTICATING_AUTHORITY: + txt="SEC_E_NO_AUTHENTICATING_AUTHORITY"; + break; + case SEC_E_NO_CREDENTIALS: + txt="SEC_E_NO_CREDENTIALS"; + break; + case SEC_E_NOT_OWNER: + txt="SEC_E_NOT_OWNER"; + break; + case SEC_E_OUT_OF_SEQUENCE: + txt="SEC_E_OUT_OF_SEQUENCE"; + break; + case SEC_E_QOP_NOT_SUPPORTED: + txt="SEC_E_QOP_NOT_SUPPORTED"; + break; + case SEC_E_SECPKG_NOT_FOUND: + txt="SEC_E_SECPKG_NOT_FOUND"; + break; + case SEC_E_TARGET_UNKNOWN: + txt="SEC_E_TARGET_UNKNOWN"; + break; + case SEC_E_UNKNOWN_CREDENTIALS: + txt="SEC_E_UNKNOWN_CREDENTIALS"; + break; + case SEC_E_UNSUPPORTED_FUNCTION: + txt="SEC_E_UNSUPPORTED_FUNCTION"; + break; + case SEC_E_WRONG_PRINCIPAL: + txt="SEC_E_WRONG_PRINCIPAL"; + break; + default: + txt="Unknown error"; + + } + failf(data, "SSPI error: %s failed: %s\n", function, txt); + return 1; + } + return 0; +} + +/* This is the SSPI-using version of this function */ +CURLcode Curl_SOCKS5_gssapi_negotiate(int sockindex, + struct connectdata *conn) +{ + struct SessionHandle *data = conn->data; + curl_socket_t sock = conn->sock[sockindex]; + CURLcode code; + ssize_t actualread; + ssize_t written; + int result; + long timeout; + /* Needs GSSAPI authentication */ + SECURITY_STATUS sspi_major_status, sspi_minor_status=0; + unsigned long sspi_ret_flags=0; + int gss_enc; + SecBuffer sspi_send_token, sspi_recv_token, sspi_w_token[3]; + SecBufferDesc input_desc, output_desc, wrap_desc; + SecPkgContext_Sizes sspi_sizes; + CredHandle cred_handle; + CtxtHandle sspi_context; + PCtxtHandle context_handle = NULL; + SecPkgCredentials_Names names; + TimeStamp expiry; + char *service_name=NULL; + u_short us_length; + ULONG qop; + unsigned char socksreq[4]; /* room for gssapi exchange header only */ + char *service = data->set.str[STRING_SOCKS5_GSSAPI_SERVICE]; + + /* get timeout */ + timeout = Curl_timeleft(conn, NULL, TRUE); + + /* GSSAPI request looks like + * +----+------+-----+----------------+ + * |VER | MTYP | LEN | TOKEN | + * +----+------+----------------------+ + * | 1 | 1 | 2 | up to 2^16 - 1 | + * +----+------+-----+----------------+ + */ + + /* prepare service name */ + if (strchr(service, '/')) { + service_name = malloc(strlen(service)); + if(!service_name) + return CURLE_OUT_OF_MEMORY; + memcpy(service_name, service, strlen(service)); + } + else { + service_name = malloc(strlen(service) + strlen(conn->proxy.name) + 2); + if(!service_name) + return CURLE_OUT_OF_MEMORY; + snprintf(service_name,strlen(service) +strlen(conn->proxy.name)+2,"%s/%s", + service,conn->proxy.name); + } + + input_desc.cBuffers = 1; + input_desc.pBuffers = &sspi_recv_token; + input_desc.ulVersion = SECBUFFER_VERSION; + + sspi_recv_token.BufferType = SECBUFFER_TOKEN; + sspi_recv_token.cbBuffer = 0; + sspi_recv_token.pvBuffer = NULL; + + output_desc.cBuffers = 1; + output_desc.pBuffers = &sspi_send_token; + output_desc.ulVersion = SECBUFFER_VERSION; + + sspi_send_token.BufferType = SECBUFFER_TOKEN; + sspi_send_token.cbBuffer = 0; + sspi_send_token.pvBuffer = NULL; + + wrap_desc.cBuffers = 3; + wrap_desc.pBuffers = sspi_w_token; + wrap_desc.ulVersion = SECBUFFER_VERSION; + + cred_handle.dwLower = 0; + cred_handle.dwUpper = 0; + + sspi_major_status = s_pSecFn->AcquireCredentialsHandleA( NULL, + (char *)"Kerberos", + SECPKG_CRED_OUTBOUND, + NULL, + NULL, + NULL, + NULL, + &cred_handle, + &expiry); + + if(check_sspi_err(data, sspi_major_status,sspi_minor_status, + "AcquireCredentialsHandleA") ) { + failf(data, "Failed to acquire credentials."); + free(service_name); + service_name=NULL; + s_pSecFn->FreeCredentialsHandle(&cred_handle); + return CURLE_COULDNT_CONNECT; + } + + /* As long as we need to keep sending some context info, and there's no */ + /* errors, keep sending it... */ + for(;;) { + + sspi_major_status = s_pSecFn->InitializeSecurityContextA( + &cred_handle, + context_handle, + service_name, + ISC_REQ_MUTUAL_AUTH | + ISC_REQ_ALLOCATE_MEMORY | + ISC_REQ_CONFIDENTIALITY | + ISC_REQ_REPLAY_DETECT, + 0, + SECURITY_NATIVE_DREP, + &input_desc, + 0, + &sspi_context, + &output_desc, + &sspi_ret_flags, + &expiry); + + if(sspi_recv_token.pvBuffer) { + s_pSecFn->FreeContextBuffer(sspi_recv_token.pvBuffer); + sspi_recv_token.pvBuffer = NULL; + sspi_recv_token.cbBuffer = 0; + } + + if(check_sspi_err(data,sspi_major_status,sspi_minor_status, + "InitializeSecurityContextA") ){ + free(service_name); + service_name=NULL; + s_pSecFn->FreeCredentialsHandle(&cred_handle); + s_pSecFn->DeleteSecurityContext(&sspi_context); + s_pSecFn->FreeContextBuffer(sspi_recv_token.pvBuffer); + failf(data, "Failed to initialise security context."); + return CURLE_COULDNT_CONNECT; + } + + if(sspi_send_token.cbBuffer != 0) { + socksreq[0] = 1; /* gssapi subnegotiation version */ + socksreq[1] = 1; /* authentication message type */ + us_length = htons((short)sspi_send_token.cbBuffer); + memcpy(socksreq+2, &us_length, sizeof(short)); + + code = Curl_write_plain(conn, sock, (char *)socksreq, 4, &written); + if((code != CURLE_OK) || (4 != written)) { + failf(data, "Failed to send SSPI authentication request."); + free(service_name); + service_name=NULL; + s_pSecFn->FreeContextBuffer(sspi_send_token.pvBuffer); + s_pSecFn->FreeContextBuffer(sspi_recv_token.pvBuffer); + s_pSecFn->FreeCredentialsHandle(&cred_handle); + s_pSecFn->DeleteSecurityContext(&sspi_context); + return CURLE_COULDNT_CONNECT; + } + + code = Curl_write_plain(conn, sock, (char *)sspi_send_token.pvBuffer, + sspi_send_token.cbBuffer, &written); + if((code != CURLE_OK) || (sspi_send_token.cbBuffer != (size_t)written)) { + failf(data, "Failed to send SSPI authentication token."); + free(service_name); + service_name=NULL; + s_pSecFn->FreeContextBuffer(sspi_send_token.pvBuffer); + s_pSecFn->FreeContextBuffer(sspi_recv_token.pvBuffer); + s_pSecFn->FreeCredentialsHandle(&cred_handle); + s_pSecFn->DeleteSecurityContext(&sspi_context); + return CURLE_COULDNT_CONNECT; + } + + } + + s_pSecFn->FreeContextBuffer(sspi_send_token.pvBuffer); + sspi_send_token.pvBuffer = NULL; + sspi_send_token.cbBuffer = 0; + s_pSecFn->FreeContextBuffer(sspi_recv_token.pvBuffer); + sspi_recv_token.pvBuffer = NULL; + sspi_recv_token.cbBuffer = 0; + if(sspi_major_status != SEC_I_CONTINUE_NEEDED) break; + + /* analyse response */ + + /* GSSAPI response looks like + * +----+------+-----+----------------+ + * |VER | MTYP | LEN | TOKEN | + * +----+------+----------------------+ + * | 1 | 1 | 2 | up to 2^16 - 1 | + * +----+------+-----+----------------+ + */ + + result=Curl_blockread_all(conn, sock, (char *)socksreq, 4, + &actualread, timeout); + if(result != CURLE_OK || actualread != 4) { + failf(data, "Failed to receive SSPI authentication response."); + free(service_name); + service_name=NULL; + s_pSecFn->FreeCredentialsHandle(&cred_handle); + s_pSecFn->DeleteSecurityContext(&sspi_context); + return CURLE_COULDNT_CONNECT; + } + + /* ignore the first (VER) byte */ + if(socksreq[1] == 255) { /* status / message type */ + failf(data, "User was rejected by the SOCKS5 server (%d %d).", + socksreq[0], socksreq[1]); + free(service_name); + service_name=NULL; + s_pSecFn->FreeCredentialsHandle(&cred_handle); + s_pSecFn->DeleteSecurityContext(&sspi_context); + return CURLE_COULDNT_CONNECT; + } + + if(socksreq[1] != 1) { /* status / messgae type */ + failf(data, "Invalid SSPI authentication response type (%d %d).", + socksreq[0], socksreq[1]); + free(service_name); + service_name=NULL; + s_pSecFn->FreeCredentialsHandle(&cred_handle); + s_pSecFn->DeleteSecurityContext(&sspi_context); + return CURLE_COULDNT_CONNECT; + } + + memcpy(&us_length, socksreq+2, sizeof(short)); + us_length = ntohs(us_length); + + sspi_recv_token.cbBuffer = us_length; + sspi_recv_token.pvBuffer = malloc(us_length); + + if(!sspi_recv_token.pvBuffer) { + free(service_name); + service_name=NULL; + s_pSecFn->FreeCredentialsHandle(&cred_handle); + s_pSecFn->DeleteSecurityContext(&sspi_context); + return CURLE_OUT_OF_MEMORY; + } + result = Curl_blockread_all(conn, sock, (char *)sspi_recv_token.pvBuffer, + sspi_recv_token.cbBuffer, + &actualread, timeout); + + if(result != CURLE_OK || actualread != us_length) { + failf(data, "Failed to receive SSPI authentication token."); + free(service_name); + service_name=NULL; + s_pSecFn->FreeContextBuffer(sspi_recv_token.pvBuffer); + s_pSecFn->FreeCredentialsHandle(&cred_handle); + s_pSecFn->DeleteSecurityContext(&sspi_context); + return CURLE_COULDNT_CONNECT; + } + + context_handle = &sspi_context; + } + + free(service_name); + service_name=NULL; + + /* Everything is good so far, user was authenticated! */ + sspi_major_status = s_pSecFn->QueryCredentialsAttributes( &cred_handle, + SECPKG_CRED_ATTR_NAMES, + &names); + s_pSecFn->FreeCredentialsHandle(&cred_handle); + if(check_sspi_err(data,sspi_major_status,sspi_minor_status, + "QueryCredentialAttributes") ){ + s_pSecFn->DeleteSecurityContext(&sspi_context); + s_pSecFn->FreeContextBuffer(names.sUserName); + failf(data, "Failed to determine user name."); + return CURLE_COULDNT_CONNECT; + } + infof(data, "SOCKS5 server authencticated user %s with gssapi.\n", + names.sUserName); + s_pSecFn->FreeContextBuffer(names.sUserName); + + /* Do encryption */ + socksreq[0] = 1; /* gssapi subnegotiation version */ + socksreq[1] = 2; /* encryption message type */ + + gss_enc = 0; /* no data protection */ + /* do confidentiality protection if supported */ + if(sspi_ret_flags & ISC_REQ_CONFIDENTIALITY) + gss_enc = 2; + /* else do integrity protection */ + else if(sspi_ret_flags & ISC_REQ_INTEGRITY) + gss_enc = 1; + + infof(data, "SOCKS5 server supports gssapi %s data protection.\n", + (gss_enc==0)?"no":((gss_enc==1)?"integrity":"confidentiality") ); + /* force to no data protection, avoid encryption/decryption for now */ + gss_enc = 0; + /* + * Sending the encryption type in clear seems wrong. It should be + * protected with gss_seal()/gss_wrap(). See RFC1961 extract below + * The NEC reference implementations on which this is based is + * therefore at fault + * + * +------+------+------+.......................+ + * + ver | mtyp | len | token | + * +------+------+------+.......................+ + * + 0x01 | 0x02 | 0x02 | up to 2^16 - 1 octets | + * +------+------+------+.......................+ + * + * Where: + * + * - "ver" is the protocol version number, here 1 to represent the + * first version of the SOCKS/GSS-API protocol + * + * - "mtyp" is the message type, here 2 to represent a protection + * -level negotiation message + * + * - "len" is the length of the "token" field in octets + * + * - "token" is the GSS-API encapsulated protection level + * + * The token is produced by encapsulating an octet containing the + * required protection level using gss_seal()/gss_wrap() with conf_req + * set to FALSE. The token is verified using gss_unseal()/ + * gss_unwrap(). + * + */ + + if(data->set.socks5_gssapi_nec) { + us_length = htons((short)1); + memcpy(socksreq+2, &us_length, sizeof(short)); + } + else { + sspi_major_status = s_pSecFn->QueryContextAttributesA( &sspi_context, + SECPKG_ATTR_SIZES, + &sspi_sizes); + if(check_sspi_err(data,sspi_major_status,sspi_minor_status, + "QueryContextAttributesA")) { + s_pSecFn->DeleteSecurityContext(&sspi_context); + failf(data, "Failed to query security context attributes."); + return CURLE_COULDNT_CONNECT; + } + + sspi_w_token[0].cbBuffer = sspi_sizes.cbSecurityTrailer; + sspi_w_token[0].BufferType = SECBUFFER_TOKEN; + sspi_w_token[0].pvBuffer = malloc(sspi_sizes.cbSecurityTrailer); + + if(!sspi_w_token[0].pvBuffer) { + s_pSecFn->DeleteSecurityContext(&sspi_context); + return CURLE_OUT_OF_MEMORY; + } + + sspi_w_token[1].cbBuffer = 1; + sspi_w_token[1].pvBuffer = malloc(1); + if(!sspi_w_token[1].pvBuffer){ + s_pSecFn->FreeContextBuffer(sspi_w_token[0].pvBuffer); + s_pSecFn->DeleteSecurityContext(&sspi_context); + return CURLE_OUT_OF_MEMORY; + } + + memcpy(sspi_w_token[1].pvBuffer,&gss_enc,1); + sspi_w_token[2].BufferType = SECBUFFER_PADDING; + sspi_w_token[2].cbBuffer = sspi_sizes.cbBlockSize; + sspi_w_token[2].pvBuffer = malloc(sspi_sizes.cbBlockSize); + if(!sspi_w_token[2].pvBuffer) { + s_pSecFn->FreeContextBuffer(sspi_w_token[0].pvBuffer); + s_pSecFn->FreeContextBuffer(sspi_w_token[1].pvBuffer); + s_pSecFn->DeleteSecurityContext(&sspi_context); + return CURLE_OUT_OF_MEMORY; + } + sspi_major_status = s_pSecFn->EncryptMessage( &sspi_context, + KERB_WRAP_NO_ENCRYPT, + &wrap_desc, + 0); + if(check_sspi_err(data,sspi_major_status,sspi_minor_status, + "EncryptMessage") ) { + s_pSecFn->FreeContextBuffer(sspi_w_token[0].pvBuffer); + s_pSecFn->FreeContextBuffer(sspi_w_token[1].pvBuffer); + s_pSecFn->FreeContextBuffer(sspi_w_token[2].pvBuffer); + s_pSecFn->DeleteSecurityContext(&sspi_context); + failf(data, "Failed to query security context attributes."); + return CURLE_COULDNT_CONNECT; + } + sspi_send_token.cbBuffer = sspi_w_token[0].cbBuffer + + sspi_w_token[1].cbBuffer + + sspi_w_token[2].cbBuffer; + sspi_send_token.pvBuffer = malloc(sspi_send_token.cbBuffer); + if(!sspi_send_token.pvBuffer) { + s_pSecFn->FreeContextBuffer(sspi_w_token[0].pvBuffer); + s_pSecFn->FreeContextBuffer(sspi_w_token[1].pvBuffer); + s_pSecFn->FreeContextBuffer(sspi_w_token[2].pvBuffer); + s_pSecFn->DeleteSecurityContext(&sspi_context); + return CURLE_OUT_OF_MEMORY; + } + + memcpy(sspi_send_token.pvBuffer, sspi_w_token[0].pvBuffer, + sspi_w_token[0].cbBuffer); + memcpy((PUCHAR) sspi_send_token.pvBuffer +(int)sspi_w_token[0].cbBuffer, + sspi_w_token[1].pvBuffer, sspi_w_token[1].cbBuffer); + memcpy((PUCHAR) sspi_send_token.pvBuffer + +sspi_w_token[0].cbBuffer + +sspi_w_token[1].cbBuffer, + sspi_w_token[2].pvBuffer, sspi_w_token[2].cbBuffer); + + s_pSecFn->FreeContextBuffer(sspi_w_token[0].pvBuffer); + sspi_w_token[0].pvBuffer = NULL; + sspi_w_token[0].cbBuffer = 0; + s_pSecFn->FreeContextBuffer(sspi_w_token[1].pvBuffer); + sspi_w_token[1].pvBuffer = NULL; + sspi_w_token[1].cbBuffer = 0; + s_pSecFn->FreeContextBuffer(sspi_w_token[2].pvBuffer); + sspi_w_token[2].pvBuffer = NULL; + sspi_w_token[2].cbBuffer = 0; + + us_length = htons((short)sspi_send_token.cbBuffer); + memcpy(socksreq+2,&us_length,sizeof(short)); + } + + code = Curl_write_plain(conn, sock, (char *)socksreq, 4, &written); + if((code != CURLE_OK) || (4 != written)) { + failf(data, "Failed to send SSPI encryption request."); + s_pSecFn->FreeContextBuffer(sspi_send_token.pvBuffer); + s_pSecFn->DeleteSecurityContext(&sspi_context); + return CURLE_COULDNT_CONNECT; + } + + if(data->set.socks5_gssapi_nec) { + memcpy(socksreq,&gss_enc,1); + code = Curl_write_plain(conn, sock, (char *)socksreq, 1, &written); + if((code != CURLE_OK) || (1 != written)) { + failf(data, "Failed to send SSPI encryption type."); + s_pSecFn->DeleteSecurityContext(&sspi_context); + return CURLE_COULDNT_CONNECT; + } + } else { + code = Curl_write_plain(conn, sock, (char *)sspi_send_token.pvBuffer, + sspi_send_token.cbBuffer, &written); + if((code != CURLE_OK) || (sspi_send_token.cbBuffer != (size_t)written)) { + failf(data, "Failed to send SSPI encryption type."); + s_pSecFn->FreeContextBuffer(sspi_send_token.pvBuffer); + s_pSecFn->DeleteSecurityContext(&sspi_context); + return CURLE_COULDNT_CONNECT; + } + s_pSecFn->FreeContextBuffer(sspi_send_token.pvBuffer); + } + + result=Curl_blockread_all(conn, sock, (char *)socksreq, 4, + &actualread, timeout); + if(result != CURLE_OK || actualread != 4) { + failf(data, "Failed to receive SSPI encryption response."); + s_pSecFn->DeleteSecurityContext(&sspi_context); + return CURLE_COULDNT_CONNECT; + } + + /* ignore the first (VER) byte */ + if(socksreq[1] == 255) { /* status / message type */ + failf(data, "User was rejected by the SOCKS5 server (%d %d).", + socksreq[0], socksreq[1]); + s_pSecFn->DeleteSecurityContext(&sspi_context); + return CURLE_COULDNT_CONNECT; + } + + if(socksreq[1] != 2) { /* status / message type */ + failf(data, "Invalid SSPI encryption response type (%d %d).", + socksreq[0], socksreq[1]); + s_pSecFn->DeleteSecurityContext(&sspi_context); + return CURLE_COULDNT_CONNECT; + } + + memcpy(&us_length, socksreq+2, sizeof(short)); + us_length = ntohs(us_length); + + sspi_w_token[0].cbBuffer = us_length; + sspi_w_token[0].pvBuffer = malloc(us_length); + if(!sspi_w_token[0].pvBuffer) { + s_pSecFn->DeleteSecurityContext(&sspi_context); + return CURLE_OUT_OF_MEMORY; + } + + result=Curl_blockread_all(conn, sock, (char *)sspi_w_token[0].pvBuffer, + sspi_w_token[0].cbBuffer, + &actualread, timeout); + + if(result != CURLE_OK || actualread != us_length) { + failf(data, "Failed to receive SSPI encryption type."); + s_pSecFn->FreeContextBuffer(sspi_w_token[0].pvBuffer); + s_pSecFn->DeleteSecurityContext(&sspi_context); + return CURLE_COULDNT_CONNECT; + } + + + if(!data->set.socks5_gssapi_nec) { + wrap_desc.cBuffers = 2; + sspi_w_token[0].BufferType = SECBUFFER_STREAM; + sspi_w_token[1].BufferType = SECBUFFER_DATA; + sspi_w_token[1].cbBuffer = 0; + sspi_w_token[1].pvBuffer = NULL; + + sspi_major_status = s_pSecFn->DecryptMessage( &sspi_context, + &wrap_desc, + 0, + &qop); + + if(check_sspi_err(data,sspi_major_status,sspi_minor_status, + "DecryptMessage")) { + s_pSecFn->FreeContextBuffer(sspi_w_token[0].pvBuffer); + s_pSecFn->FreeContextBuffer(sspi_w_token[1].pvBuffer); + s_pSecFn->DeleteSecurityContext(&sspi_context); + failf(data, "Failed to query security context attributes."); + return CURLE_COULDNT_CONNECT; + } + + if(sspi_w_token[1].cbBuffer != 1) { + failf(data, "Invalid SSPI encryption response length (%d).", + sspi_w_token[1].cbBuffer); + s_pSecFn->FreeContextBuffer(sspi_w_token[0].pvBuffer); + s_pSecFn->FreeContextBuffer(sspi_w_token[1].pvBuffer); + s_pSecFn->DeleteSecurityContext(&sspi_context); + return CURLE_COULDNT_CONNECT; + } + + memcpy(socksreq,sspi_w_token[1].pvBuffer,sspi_w_token[1].cbBuffer); + s_pSecFn->FreeContextBuffer(sspi_w_token[0].pvBuffer); + s_pSecFn->FreeContextBuffer(sspi_w_token[1].pvBuffer); + } else { + if(sspi_w_token[0].cbBuffer != 1) { + failf(data, "Invalid SSPI encryption response length (%d).", + sspi_w_token[0].cbBuffer); + s_pSecFn->FreeContextBuffer(sspi_w_token[0].pvBuffer); + s_pSecFn->DeleteSecurityContext(&sspi_context); + return CURLE_COULDNT_CONNECT; + } + memcpy(socksreq,sspi_w_token[0].pvBuffer,sspi_w_token[0].cbBuffer); + s_pSecFn->FreeContextBuffer(sspi_w_token[0].pvBuffer); + } + + infof(data, "SOCKS5 access with%s protection granted.\n", + (socksreq[0]==0)?"out gssapi data": + ((socksreq[0]==1)?" gssapi integrity":" gssapi confidentiality")); + + /* For later use if encryption is required + conn->socks5_gssapi_enctype = socksreq[0]; + if (socksreq[0] != 0) + conn->socks5_sspi_context = sspi_context; + else { + s_pSecFn->DeleteSecurityContext(&sspi_context); + conn->socks5_sspi_context = sspi_context; + } + */ + return CURLE_OK; +} +#endif diff --git a/mobicore/common/curl/lib/speedcheck.c b/mobicore/common/curl/lib/speedcheck.c new file mode 100644 index 0000000000000000000000000000000000000000..38bad5a57904633d15a561de6e89074303ee2af3 --- /dev/null +++ b/mobicore/common/curl/lib/speedcheck.c @@ -0,0 +1,74 @@ +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) 1998 - 2010, Daniel Stenberg, , et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at http://curl.haxx.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ***************************************************************************/ + +#include "setup.h" + +#include +#include + +#include +#include "urldata.h" +#include "sendf.h" +#include "multiif.h" +#include "speedcheck.h" + +void Curl_speedinit(struct SessionHandle *data) +{ + memset(&data->state.keeps_speed, 0, sizeof(struct timeval)); +} + +CURLcode Curl_speedcheck(struct SessionHandle *data, + struct timeval now) +{ + if((data->progress.current_speed >= 0) && + data->set.low_speed_time && + (Curl_tvlong(data->state.keeps_speed) != 0) && + (data->progress.current_speed < data->set.low_speed_limit)) { + long howlong = Curl_tvdiff(now, data->state.keeps_speed); + + /* We are now below the "low speed limit". If we are below it + for "low speed time" seconds we consider that enough reason + to abort the download. */ + + if( (howlong/1000) > data->set.low_speed_time) { + /* we have been this slow for long enough, now die */ + failf(data, + "Operation too slow. " + "Less than %ld bytes/sec transfered the last %ld seconds", + data->set.low_speed_limit, + data->set.low_speed_time); + return CURLE_OPERATION_TIMEDOUT; + } + Curl_expire(data, howlong); + } + else { + /* we keep up the required speed all right */ + data->state.keeps_speed = now; + + if(data->set.low_speed_limit) + /* if there is a low speed limit enabled, we set the expire timer to + make this connection's speed get checked again no later than when + this time is up */ + Curl_expire(data, data->set.low_speed_time*1000); + } + return CURLE_OK; +} diff --git a/mobicore/common/curl/lib/speedcheck.h b/mobicore/common/curl/lib/speedcheck.h new file mode 100644 index 0000000000000000000000000000000000000000..fc40e7d0cc7e262e8692fc6c1b312eb8267d6357 --- /dev/null +++ b/mobicore/common/curl/lib/speedcheck.h @@ -0,0 +1,33 @@ +#ifndef HEADER_CURL_SPEEDCHECK_H +#define HEADER_CURL_SPEEDCHECK_H +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) 1998 - 2010, Daniel Stenberg, , et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at http://curl.haxx.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ***************************************************************************/ + +#include "setup.h" + +#include "timeval.h" + +void Curl_speedinit(struct SessionHandle *data); +CURLcode Curl_speedcheck(struct SessionHandle *data, + struct timeval now); + +#endif /* HEADER_CURL_SPEEDCHECK_H */ diff --git a/mobicore/common/curl/lib/splay.c b/mobicore/common/curl/lib/splay.c new file mode 100644 index 0000000000000000000000000000000000000000..dcc42cf26f942bb1cce95aae56d3188c120235c0 --- /dev/null +++ b/mobicore/common/curl/lib/splay.c @@ -0,0 +1,438 @@ +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) 1997 - 2009, Daniel Stenberg, , et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at http://curl.haxx.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ***************************************************************************/ + +#include "setup.h" + +#include "splay.h" + +/* + * This macro compares two node keys i and j and returns: + * + * negative value: when i is smaller than j + * zero : when i is equal to j + * positive when : when i is larger than j + */ +#define compare(i,j) Curl_splaycomparekeys((i),(j)) + +/* + * Splay using the key i (which may or may not be in the tree.) The starting + * root is t. + */ +struct Curl_tree *Curl_splay(struct timeval i, + struct Curl_tree *t) +{ + struct Curl_tree N, *l, *r, *y; + long comp; + + if(t == NULL) + return t; + N.smaller = N.larger = NULL; + l = r = &N; + + for (;;) { + comp = compare(i, t->key); + if(comp < 0) { + if(t->smaller == NULL) + break; + if(compare(i, t->smaller->key) < 0) { + y = t->smaller; /* rotate smaller */ + t->smaller = y->larger; + y->larger = t; + t = y; + if(t->smaller == NULL) + break; + } + r->smaller = t; /* link smaller */ + r = t; + t = t->smaller; + } + else if(comp > 0) { + if(t->larger == NULL) + break; + if(compare(i, t->larger->key) > 0) { + y = t->larger; /* rotate larger */ + t->larger = y->smaller; + y->smaller = t; + t = y; + if(t->larger == NULL) + break; + } + l->larger = t; /* link larger */ + l = t; + t = t->larger; + } + else + break; + } + + l->larger = t->smaller; /* assemble */ + r->smaller = t->larger; + t->smaller = N.larger; + t->larger = N.smaller; + + return t; +} + +/* Insert key i into the tree t. Return a pointer to the resulting tree or + NULL if something went wrong. */ +struct Curl_tree *Curl_splayinsert(struct timeval i, + struct Curl_tree *t, + struct Curl_tree *node) +{ + static struct timeval KEY_NOTUSED = {-1,-1}; /* key that will *NEVER* appear */ + + if(node == NULL) + return t; + + if(t != NULL) { + t = Curl_splay(i,t); + if(compare(i, t->key)==0) { + /* There already exists a node in the tree with the very same key. Build + a linked list of nodes. We make the new 'node' struct the new master + node and make the previous node the first one in the 'same' list. */ + + node->same = t; + node->key = i; + node->smaller = t->smaller; + node->larger = t->larger; + + t->smaller = node; /* in the sub node for this same key, we use the + smaller pointer to point back to the master + node */ + + t->key = KEY_NOTUSED; /* and we set the key in the sub node to NOTUSED + to quickly identify this node as a subnode */ + + return node; /* new root node */ + } + } + + if(t == NULL) { + node->smaller = node->larger = NULL; + } + else if(compare(i, t->key) < 0) { + node->smaller = t->smaller; + node->larger = t; + t->smaller = NULL; + + } + else { + node->larger = t->larger; + node->smaller = t; + t->larger = NULL; + } + node->key = i; + + node->same = NULL; /* no identical node (yet) */ + return node; +} + +#if 0 +/* Deletes 'i' from the tree if it's there (with an exact match). Returns a + pointer to the resulting tree. + + Function not used in libcurl. +*/ +struct Curl_tree *Curl_splayremove(struct timeval i, + struct Curl_tree *t, + struct Curl_tree **removed) +{ + struct Curl_tree *x; + + *removed = NULL; /* default to no removed */ + + if(t==NULL) + return NULL; + + t = Curl_splay(i,t); + if(compare(i, t->key) == 0) { /* found it */ + + /* FIRST! Check if there is a list with identical sizes */ + if((x = t->same) != NULL) { + /* there is, pick one from the list */ + + /* 'x' is the new root node */ + + x->key = t->key; + x->larger = t->larger; + x->smaller = t->smaller; + + *removed = t; + return x; /* new root */ + } + + if(t->smaller == NULL) { + x = t->larger; + } + else { + x = Curl_splay(i, t->smaller); + x->larger = t->larger; + } + *removed = t; + + return x; + } + else + return t; /* It wasn't there */ +} +#endif + +/* Finds and deletes the best-fit node from the tree. Return a pointer to the + resulting tree. best-fit means the node with the given or lower key */ +struct Curl_tree *Curl_splaygetbest(struct timeval i, + struct Curl_tree *t, + struct Curl_tree **removed) +{ + struct Curl_tree *x; + + if(!t) { + *removed = NULL; /* none removed since there was no root */ + return NULL; + } + + t = Curl_splay(i,t); + if(compare(i, t->key) < 0) { + /* too big node, try the smaller chain */ + if(t->smaller) + t=Curl_splay(t->smaller->key, t); + else { + /* fail */ + *removed = NULL; + return t; + } + } + + if(compare(i, t->key) >= 0) { /* found it */ + /* FIRST! Check if there is a list with identical keys */ + x = t->same; + if(x) { + /* there is, pick one from the list */ + + /* 'x' is the new root node */ + + x->key = t->key; + x->larger = t->larger; + x->smaller = t->smaller; + + *removed = t; + return x; /* new root */ + } + + if(t->smaller == NULL) { + x = t->larger; + } + else { + x = Curl_splay(i, t->smaller); + x->larger = t->larger; + } + *removed = t; + + return x; + } + else { + *removed = NULL; /* no match */ + return t; /* It wasn't there */ + } +} + + +/* Deletes the very node we point out from the tree if it's there. Stores a + pointer to the new resulting tree in 'newroot'. + + Returns zero on success and non-zero on errors! TODO: document error codes. + When returning error, it does not touch the 'newroot' pointer. + + NOTE: when the last node of the tree is removed, there's no tree left so + 'newroot' will be made to point to NULL. +*/ +int Curl_splayremovebyaddr(struct Curl_tree *t, + struct Curl_tree *removenode, + struct Curl_tree **newroot) +{ + static struct timeval KEY_NOTUSED = {-1,-1}; /* key that will *NEVER* appear */ + struct Curl_tree *x; + + if(!t || !removenode) + return 1; + + if(compare(KEY_NOTUSED, removenode->key) == 0) { + /* Key set to NOTUSED means it is a subnode within a 'same' linked list + and thus we can unlink it easily. The 'smaller' link of a subnode + links to the parent node. */ + if(removenode->smaller == NULL) + return 3; + + removenode->smaller->same = removenode->same; + if(removenode->same) + removenode->same->smaller = removenode->smaller; + + /* Ensures that double-remove gets caught. */ + removenode->smaller = NULL; + + /* voila, we're done! */ + *newroot = t; /* return the same root */ + return 0; + } + + t = Curl_splay(removenode->key, t); + + /* First make sure that we got the same root node as the one we want + to remove, as otherwise we might be trying to remove a node that + isn't actually in the tree. + + We cannot just compare the keys here as a double remove in quick + succession of a node with key != KEY_NOTUSED && same != NULL + could return the same key but a different node. */ + if(t != removenode) + return 2; + + /* Check if there is a list with identical sizes, as then we're trying to + remove the root node of a list of nodes with identical keys. */ + x = t->same; + if(x) { + /* 'x' is the new root node, we just make it use the root node's + smaller/larger links */ + + x->key = t->key; + x->larger = t->larger; + x->smaller = t->smaller; + } + else { + /* Remove the root node */ + if(t->smaller == NULL) + x = t->larger; + else { + x = Curl_splay(removenode->key, t->smaller); + x->larger = t->larger; + } + } + + *newroot = x; /* store new root pointer */ + + return 0; +} + +#ifdef DEBUGBUILD + +void Curl_splayprint(struct Curl_tree * t, int d, char output) +{ + struct Curl_tree *node; + int i; + int count; + if(t == NULL) + return; + + Curl_splayprint(t->larger, d+1, output); + for (i=0; ikey.tv_usec, i); +#else + fprintf(stderr, "%ld.%ld[%d]", (long)t->key.tv_sec, (long)t->key.tv_usec, i); +#endif + } + + for(count=0, node = t->same; node; node = node->same, count++) + ; + + if(output) { + if(count) + fprintf(stderr, " [%d more]\n", count); + else + fprintf(stderr, "\n"); + } + + Curl_splayprint(t->smaller, d+1, output); +} +#endif + +#ifdef TEST_SPLAY + +/*#define TEST2 */ +#define MAX 50 +#define TEST2 + +/* A sample use of these functions. Start with the empty tree, insert some + stuff into it, and then delete it */ +int main(int argc, argv_item_t argv[]) +{ + struct Curl_tree *root, *t; + void *ptrs[MAX]; + int adds=0; + int rc; + + static const long sizes[]={ + 50, 60, 50, 100, 60, 200, 120, 300, 400, 200, 256, 122, 60, 120, 200, 300, + 220, 80, 90, 50, 100, 60, 200, 120, 300, 400, 200, 256, 122, 60, 120, 200, + 300, 220, 80, 90, 50, 100, 60, 200, 120, 300, 400, 200, 256, 122, 60, 120, + 200, 300, 220, 80, 90}; + int i; + root = NULL; /* the empty tree */ + + for (i = 0; i < MAX; i++) { + struct timeval key; + ptrs[i] = t = malloc(sizeof(struct Curl_tree)); + if(!t) { + puts("out of memory!"); + return 0; + } + + key.tv_sec = 0; +#ifdef TEST2 + key.tv_usec = sizes[i]; +#elif defined(TEST1) + key.tv_usec = (541*i)%1023; +#elif defined(TEST3) + key.tv_usec = 100; +#endif + + t->payload = (void *)key.tv_usec; /* for simplicity */ + root = Curl_splayinsert(key, root, t); + } + +#if 0 + puts("Result:"); + Curl_splayprint(root, 0, 1); +#endif + +#if 1 + for (i = 0; i < MAX; i++) { + int rem = (i+7)%MAX; + struct Curl_tree *r; + printf("Tree look:\n"); + Curl_splayprint(root, 0, 1); + printf("remove pointer %d, payload %ld\n", rem, + (long)((struct Curl_tree *)ptrs[rem])->payload); + rc = Curl_splayremovebyaddr(root, (struct Curl_tree *)ptrs[rem], &root); + if(rc) + /* failed! */ + printf("remove %d failed!\n", rem); + } +#endif + + return 0; +} + +#endif /* TEST_SPLAY */ diff --git a/mobicore/common/curl/lib/splay.h b/mobicore/common/curl/lib/splay.h new file mode 100644 index 0000000000000000000000000000000000000000..832e4e2bbf7f337396c7f3d021795d45cc660d04 --- /dev/null +++ b/mobicore/common/curl/lib/splay.h @@ -0,0 +1,65 @@ +#ifndef __SPLAY_H +#define __SPLAY_H +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) 1997 - 2009, Daniel Stenberg, , et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at http://curl.haxx.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ***************************************************************************/ + +struct Curl_tree { + struct Curl_tree *smaller; /* smaller node */ + struct Curl_tree *larger; /* larger node */ + struct Curl_tree *same; /* points to a node with identical key */ + struct timeval key; /* this node's "sort" key */ + void *payload; /* data the splay code doesn't care about */ +}; + +struct Curl_tree *Curl_splay(struct timeval i, + struct Curl_tree *t); + +struct Curl_tree *Curl_splayinsert(struct timeval key, + struct Curl_tree *t, + struct Curl_tree *newnode); + +#if 0 +struct Curl_tree *Curl_splayremove(struct timeval key, + struct Curl_tree *t, + struct Curl_tree **removed); +#endif + +struct Curl_tree *Curl_splaygetbest(struct timeval key, + struct Curl_tree *t, + struct Curl_tree **removed); + +int Curl_splayremovebyaddr(struct Curl_tree *t, + struct Curl_tree *removenode, + struct Curl_tree **newroot); + +#define Curl_splaycomparekeys(i,j) ( ((i.tv_sec) < (j.tv_sec)) ? -1 : \ + ( ((i.tv_sec) > (j.tv_sec)) ? 1 : \ + ( ((i.tv_usec) < (j.tv_usec)) ? -1 : \ + ( ((i.tv_usec) > (j.tv_usec)) ? 1 : 0 )))) + +#ifdef DEBUGBUILD +void Curl_splayprint(struct Curl_tree * t, int d, char output); +#else +#define Curl_splayprint(x,y,z) +#endif + +#endif diff --git a/mobicore/common/curl/lib/ssh.c b/mobicore/common/curl/lib/ssh.c new file mode 100644 index 0000000000000000000000000000000000000000..ffcb48b4216ec50d3766aab238b8a33a7e185faf --- /dev/null +++ b/mobicore/common/curl/lib/ssh.c @@ -0,0 +1,3092 @@ +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) 1998 - 2010, Daniel Stenberg, , et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at http://curl.haxx.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ***************************************************************************/ + +/* #define CURL_LIBSSH2_DEBUG */ + +#include "setup.h" + +#ifdef USE_LIBSSH2 +#include +#include +#include +#include +#include +#ifdef HAVE_LIMITS_H +# include +#endif + +#include +#include + +#ifdef HAVE_UNISTD_H +#include +#endif + +#ifdef HAVE_FCNTL_H +#include +#endif + +#ifdef HAVE_TIME_H +#include +#endif + +#ifndef WIN32 +#ifdef HAVE_SYS_SOCKET_H +#include +#endif +#ifdef HAVE_NETINET_IN_H +#include +#endif +#ifdef HAVE_ARPA_INET_H +#include +#endif +#ifdef HAVE_UTSNAME_H +#include +#endif +#ifdef HAVE_NETDB_H +#include +#endif +#ifdef __VMS +#include +#include +#endif +#endif /* !WIN32 */ + +#if (defined(NETWARE) && defined(__NOVELL_LIBC__)) +#undef in_addr_t +#define in_addr_t unsigned long +#endif + +#include +#include "urldata.h" +#include "sendf.h" +#include "easyif.h" /* for Curl_convert_... prototypes */ + +#include "hostip.h" +#include "progress.h" +#include "transfer.h" +#include "escape.h" +#include "http.h" /* for HTTP proxy tunnel stuff */ +#include "ssh.h" +#include "url.h" +#include "speedcheck.h" +#include "getinfo.h" + +#include "strequal.h" +#include "sslgen.h" +#include "connect.h" +#include "strerror.h" +#include "inet_ntop.h" +#include "parsedate.h" /* for the week day and month names */ +#include "sockaddr.h" /* required for Curl_sockaddr_storage */ +#include "strtoofft.h" +#include "multiif.h" +#include "select.h" +#include "warnless.h" + +#define _MPRINTF_REPLACE /* use our functions only */ +#include + +#include "curl_memory.h" +/* The last #include file should be: */ +#include "memdebug.h" + +#ifndef PATH_MAX +#define PATH_MAX 1024 /* just an extra precaution since there are systems that + have their definition hidden well */ +#endif + +/* Local functions: */ +static const char *sftp_libssh2_strerror(unsigned long err); +static LIBSSH2_ALLOC_FUNC(my_libssh2_malloc); +static LIBSSH2_REALLOC_FUNC(my_libssh2_realloc); +static LIBSSH2_FREE_FUNC(my_libssh2_free); + +static CURLcode get_pathname(const char **cpp, char **path); + +static CURLcode ssh_connect(struct connectdata *conn, bool *done); +static CURLcode ssh_multi_statemach(struct connectdata *conn, bool *done); +static CURLcode ssh_do(struct connectdata *conn, bool *done); + +static CURLcode ssh_getworkingpath(struct connectdata *conn, + char *homedir, /* when SFTP is used */ + char **path); + +static CURLcode scp_done(struct connectdata *conn, + CURLcode, bool premature); +static CURLcode scp_doing(struct connectdata *conn, + bool *dophase_done); +static CURLcode scp_disconnect(struct connectdata *conn, bool dead_connection); + +static CURLcode sftp_done(struct connectdata *conn, + CURLcode, bool premature); +static CURLcode sftp_doing(struct connectdata *conn, + bool *dophase_done); +static CURLcode sftp_disconnect(struct connectdata *conn, bool dead_connection); +static +CURLcode sftp_perform(struct connectdata *conn, + bool *connected, + bool *dophase_done); + +static int ssh_getsock(struct connectdata *conn, + curl_socket_t *sock, /* points to numsocks number + of sockets */ + int numsocks); + +static int ssh_perform_getsock(const struct connectdata *conn, + curl_socket_t *sock, /* points to numsocks + number of sockets */ + int numsocks); + +/* + * SCP protocol handler. + */ + +const struct Curl_handler Curl_handler_scp = { + "SCP", /* scheme */ + ZERO_NULL, /* setup_connection */ + ssh_do, /* do_it */ + scp_done, /* done */ + ZERO_NULL, /* do_more */ + ssh_connect, /* connect_it */ + ssh_multi_statemach, /* connecting */ + scp_doing, /* doing */ + ssh_getsock, /* proto_getsock */ + ssh_getsock, /* doing_getsock */ + ssh_perform_getsock, /* perform_getsock */ + scp_disconnect, /* disconnect */ + PORT_SSH, /* defport */ + PROT_SCP /* protocol */ +}; + + +/* + * SFTP protocol handler. + */ + +const struct Curl_handler Curl_handler_sftp = { + "SFTP", /* scheme */ + ZERO_NULL, /* setup_connection */ + ssh_do, /* do_it */ + sftp_done, /* done */ + ZERO_NULL, /* do_more */ + ssh_connect, /* connect_it */ + ssh_multi_statemach, /* connecting */ + sftp_doing, /* doing */ + ssh_getsock, /* proto_getsock */ + ssh_getsock, /* doing_getsock */ + ssh_perform_getsock, /* perform_getsock */ + sftp_disconnect, /* disconnect */ + PORT_SSH, /* defport */ + PROT_SFTP /* protocol */ +}; + + +static void +kbd_callback(const char *name, int name_len, const char *instruction, + int instruction_len, int num_prompts, + const LIBSSH2_USERAUTH_KBDINT_PROMPT *prompts, + LIBSSH2_USERAUTH_KBDINT_RESPONSE *responses, + void **abstract) +{ + struct connectdata *conn = (struct connectdata *)*abstract; + +#ifdef CURL_LIBSSH2_DEBUG + fprintf(stderr, "name=%s\n", name); + fprintf(stderr, "name_len=%d\n", name_len); + fprintf(stderr, "instruction=%s\n", instruction); + fprintf(stderr, "instruction_len=%d\n", instruction_len); + fprintf(stderr, "num_prompts=%d\n", num_prompts); +#else + (void)name; + (void)name_len; + (void)instruction; + (void)instruction_len; +#endif /* CURL_LIBSSH2_DEBUG */ + if(num_prompts == 1) { + responses[0].text = strdup(conn->passwd); + responses[0].length = (unsigned int)strlen(conn->passwd); + } + (void)prompts; + (void)abstract; +} /* kbd_callback */ + +static CURLcode sftp_libssh2_error_to_CURLE(int err) +{ + switch (err) { + case LIBSSH2_FX_OK: + return CURLE_OK; + + case LIBSSH2_FX_NO_SUCH_FILE: + case LIBSSH2_FX_NO_SUCH_PATH: + return CURLE_REMOTE_FILE_NOT_FOUND; + + case LIBSSH2_FX_PERMISSION_DENIED: + case LIBSSH2_FX_WRITE_PROTECT: + case LIBSSH2_FX_LOCK_CONFlICT: + return CURLE_REMOTE_ACCESS_DENIED; + + case LIBSSH2_FX_NO_SPACE_ON_FILESYSTEM: + case LIBSSH2_FX_QUOTA_EXCEEDED: + return CURLE_REMOTE_DISK_FULL; + + case LIBSSH2_FX_FILE_ALREADY_EXISTS: + return CURLE_REMOTE_FILE_EXISTS; + + case LIBSSH2_FX_DIR_NOT_EMPTY: + return CURLE_QUOTE_ERROR; + + default: + break; + } + + return CURLE_SSH; +} + +static CURLcode libssh2_session_error_to_CURLE(int err) +{ + switch (err) { + /* Ordered by order of appearance in libssh2.h */ + case LIBSSH2_ERROR_NONE: + return CURLE_OK; + + case LIBSSH2_ERROR_SOCKET_NONE: + return CURLE_COULDNT_CONNECT; + + case LIBSSH2_ERROR_ALLOC: + return CURLE_OUT_OF_MEMORY; + + case LIBSSH2_ERROR_SOCKET_SEND: + return CURLE_SEND_ERROR; + + case LIBSSH2_ERROR_HOSTKEY_INIT: + case LIBSSH2_ERROR_HOSTKEY_SIGN: + case LIBSSH2_ERROR_PUBLICKEY_UNRECOGNIZED: + case LIBSSH2_ERROR_PUBLICKEY_UNVERIFIED: + return CURLE_PEER_FAILED_VERIFICATION; + + case LIBSSH2_ERROR_PASSWORD_EXPIRED: + return CURLE_LOGIN_DENIED; + + case LIBSSH2_ERROR_SOCKET_TIMEOUT: + case LIBSSH2_ERROR_TIMEOUT: + return CURLE_OPERATION_TIMEDOUT; + + case LIBSSH2_ERROR_EAGAIN: + return CURLE_AGAIN; + } + + /* TODO: map some more of the libssh2 errors to the more appropriate CURLcode + error code, and possibly add a few new SSH-related one. We must however + not return or even depend on libssh2 errors in the public libcurl API */ + + return CURLE_SSH; +} + +static LIBSSH2_ALLOC_FUNC(my_libssh2_malloc) +{ + (void)abstract; /* arg not used */ + return malloc(count); +} + +static LIBSSH2_REALLOC_FUNC(my_libssh2_realloc) +{ + (void)abstract; /* arg not used */ + return realloc(ptr, count); +} + +static LIBSSH2_FREE_FUNC(my_libssh2_free) +{ + (void)abstract; /* arg not used */ + free(ptr); +} + +/* + * SSH State machine related code + */ +/* This is the ONLY way to change SSH state! */ +static void state(struct connectdata *conn, sshstate nowstate) +{ +#if defined(DEBUGBUILD) && !defined(CURL_DISABLE_VERBOSE_STRINGS) + /* for debug purposes */ + static const char * const names[] = { + "SSH_STOP", + "SSH_S_STARTUP", + "SSH_HOSTKEY", + "SSH_AUTHLIST", + "SSH_AUTH_PKEY_INIT", + "SSH_AUTH_PKEY", + "SSH_AUTH_PASS_INIT", + "SSH_AUTH_PASS", + "SSH_AUTH_HOST_INIT", + "SSH_AUTH_HOST", + "SSH_AUTH_KEY_INIT", + "SSH_AUTH_KEY", + "SSH_AUTH_DONE", + "SSH_SFTP_INIT", + "SSH_SFTP_REALPATH", + "SSH_SFTP_QUOTE_INIT", + "SSH_SFTP_POSTQUOTE_INIT", + "SSH_SFTP_QUOTE", + "SSH_SFTP_NEXT_QUOTE", + "SSH_SFTP_QUOTE_STAT", + "SSH_SFTP_QUOTE_SETSTAT", + "SSH_SFTP_QUOTE_SYMLINK", + "SSH_SFTP_QUOTE_MKDIR", + "SSH_SFTP_QUOTE_RENAME", + "SSH_SFTP_QUOTE_RMDIR", + "SSH_SFTP_QUOTE_UNLINK", + "SSH_SFTP_TRANS_INIT", + "SSH_SFTP_UPLOAD_INIT", + "SSH_SFTP_CREATE_DIRS_INIT", + "SSH_SFTP_CREATE_DIRS", + "SSH_SFTP_CREATE_DIRS_MKDIR", + "SSH_SFTP_READDIR_INIT", + "SSH_SFTP_READDIR", + "SSH_SFTP_READDIR_LINK", + "SSH_SFTP_READDIR_BOTTOM", + "SSH_SFTP_READDIR_DONE", + "SSH_SFTP_DOWNLOAD_INIT", + "SSH_SFTP_DOWNLOAD_STAT", + "SSH_SFTP_CLOSE", + "SSH_SFTP_SHUTDOWN", + "SSH_SCP_TRANS_INIT", + "SSH_SCP_UPLOAD_INIT", + "SSH_SCP_DOWNLOAD_INIT", + "SSH_SCP_DONE", + "SSH_SCP_SEND_EOF", + "SSH_SCP_WAIT_EOF", + "SSH_SCP_WAIT_CLOSE", + "SSH_SCP_CHANNEL_FREE", + "SSH_SESSION_DISCONNECT", + "SSH_SESSION_FREE", + "QUIT" + }; +#endif + struct ssh_conn *sshc = &conn->proto.sshc; + +#if defined(DEBUGBUILD) && !defined(CURL_DISABLE_VERBOSE_STRINGS) + if(sshc->state != nowstate) { + infof(conn->data, "SFTP %p state change from %s to %s\n", + sshc, names[sshc->state], names[nowstate]); + } +#endif + + sshc->state = nowstate; +} + +/* figure out the path to work with in this particular request */ +static CURLcode ssh_getworkingpath(struct connectdata *conn, + char *homedir, /* when SFTP is used */ + char **path) /* returns the allocated + real path to work with */ +{ + struct SessionHandle *data = conn->data; + char *real_path = NULL; + char *working_path; + int working_path_len; + + working_path = curl_easy_unescape(data, data->state.path, 0, + &working_path_len); + if(!working_path) + return CURLE_OUT_OF_MEMORY; + + /* Check for /~/ , indicating relative to the user's home directory */ + if(conn->protocol & PROT_SCP) { + real_path = malloc(working_path_len+1); + if(real_path == NULL) { + free(working_path); + return CURLE_OUT_OF_MEMORY; + } + if((working_path_len > 1) && (working_path[1] == '~')) + /* It is referenced to the home directory, so strip the leading '/' */ + memcpy(real_path, working_path+1, 1 + working_path_len-1); + else + memcpy(real_path, working_path, 1 + working_path_len); + } + else if(conn->protocol & PROT_SFTP) { + if((working_path_len > 1) && (working_path[1] == '~')) { + size_t homelen = strlen(homedir); + real_path = malloc(homelen + working_path_len + 1); + if(real_path == NULL) { + free(working_path); + return CURLE_OUT_OF_MEMORY; + } + /* It is referenced to the home directory, so strip the + leading '/' */ + memcpy(real_path, homedir, homelen); + real_path[homelen] = '/'; + real_path[homelen+1] = '\0'; + if(working_path_len > 3) { + memcpy(real_path+homelen+1, working_path + 3, + 1 + working_path_len -3); + } + } + else { + real_path = malloc(working_path_len+1); + if(real_path == NULL) { + free(working_path); + return CURLE_OUT_OF_MEMORY; + } + memcpy(real_path, working_path, 1+working_path_len); + } + } + + free(working_path); + + /* store the pointer for the caller to receive */ + *path = real_path; + + return CURLE_OK; +} + +#ifdef HAVE_LIBSSH2_KNOWNHOST_API +static int sshkeycallback(CURL *easy, + const struct curl_khkey *knownkey, /* known */ + const struct curl_khkey *foundkey, /* found */ + enum curl_khmatch match, + void *clientp) +{ + (void)easy; + (void)knownkey; + (void)foundkey; + (void)clientp; + + /* we only allow perfect matches, and we reject everything else */ + return (match != CURLKHMATCH_OK)?CURLKHSTAT_REJECT:CURLKHSTAT_FINE; +} +#endif + +/* + * Earlier libssh2 versions didn't have the ability to seek to 64bit positions + * with 32bit size_t. + */ +#ifdef HAVE_LIBSSH2_SFTP_SEEK64 +#define SFTP_SEEK(x,y) libssh2_sftp_seek64(x, (libssh2_uint64_t)y) +#else +#define SFTP_SEEK(x,y) libssh2_sftp_seek(x, (size_t)y) +#endif + +/* + * Earlier libssh2 versions didn't do SCP properly beyond 32bit sizes on 32bit + * architectures so we check of the necessary function is present. + */ +#ifndef HAVE_LIBSSH2_SCP_SEND64 +#define SCP_SEND(a,b,c,d) libssh2_scp_send_ex(a, b, (int)(c), (size_t)d, 0, 0) +#else +#define SCP_SEND(a,b,c,d) libssh2_scp_send64(a, b, (int)(c), \ + (libssh2_uint64_t)d, 0, 0) +#endif + +/* + * libssh2 1.2.8 fixed the problem with 32bit ints used for sockets on win64. + */ +#ifdef HAVE_LIBSSH2_SESSION_HANDSHAKE +#define libssh2_session_startup(x,y) libssh2_session_handshake(x,y) +#endif + +/* + * ssh_statemach_act() runs the SSH state machine as far as it can without + * blocking and without reaching the end. The data the pointer 'block' points + * to will be set to TRUE if the libssh2 function returns LIBSSH2_ERROR_EAGAIN + * meaning it wants to be called again when the socket is ready + */ + +static CURLcode ssh_statemach_act(struct connectdata *conn, bool *block) +{ + CURLcode result = CURLE_OK; + struct SessionHandle *data = conn->data; + struct SSHPROTO *sftp_scp = data->state.proto.ssh; + struct ssh_conn *sshc = &conn->proto.sshc; + curl_socket_t sock = conn->sock[FIRSTSOCKET]; +#ifdef CURL_LIBSSH2_DEBUG + const char *fingerprint; +#endif /* CURL_LIBSSH2_DEBUG */ + const char *host_public_key_md5; + int rc = LIBSSH2_ERROR_NONE, i; + int err; + int seekerr = CURL_SEEKFUNC_OK; + *block = 0; /* we're not blocking by default */ + + do { + + switch(sshc->state) { + case SSH_S_STARTUP: + sshc->secondCreateDirs = 0; + sshc->nextstate = SSH_NO_STATE; + sshc->actualcode = CURLE_OK; + + rc = libssh2_session_startup(sshc->ssh_session, sock); + if(rc == LIBSSH2_ERROR_EAGAIN) { + break; + } + else if(rc) { + failf(data, "Failure establishing ssh session"); + state(conn, SSH_SESSION_FREE); + sshc->actualcode = CURLE_FAILED_INIT; + break; + } + + /* Set libssh2 to non-blocking, since everything internally is + non-blocking */ + libssh2_session_set_blocking(sshc->ssh_session, 0); + + state(conn, SSH_HOSTKEY); + + /* fall-through */ + case SSH_HOSTKEY: + +#ifdef CURL_LIBSSH2_DEBUG + /* + * Before we authenticate we should check the hostkey's fingerprint + * against our known hosts. How that is handled (reading from file, + * whatever) is up to us. As for know not much is implemented, besides + * showing how to get the fingerprint. + */ + fingerprint = libssh2_hostkey_hash(sshc->ssh_session, + LIBSSH2_HOSTKEY_HASH_MD5); + + /* The fingerprint points to static storage (!), don't free() it. */ + infof(data, "Fingerprint: "); + for (rc = 0; rc < 16; rc++) { + infof(data, "%02X ", (unsigned char) fingerprint[rc]); + } + infof(data, "\n"); +#endif /* CURL_LIBSSH2_DEBUG */ + + /* Before we authenticate we check the hostkey's MD5 fingerprint + * against a known fingerprint, if available. This implementation pulls + * it from the curl option. + */ + if(data->set.str[STRING_SSH_HOST_PUBLIC_KEY_MD5] && + strlen(data->set.str[STRING_SSH_HOST_PUBLIC_KEY_MD5]) == 32) { + char buf[33]; + host_public_key_md5 = libssh2_hostkey_hash(sshc->ssh_session, + LIBSSH2_HOSTKEY_HASH_MD5); + for (i = 0; i < 16; i++) + snprintf(&buf[i*2], 3, "%02x", + (unsigned char) host_public_key_md5[i]); + if(!strequal(buf, data->set.str[STRING_SSH_HOST_PUBLIC_KEY_MD5])) { + failf(data, + "Denied establishing ssh session: mismatch md5 fingerprint. " + "Remote %s is not equal to %s", + buf, data->set.str[STRING_SSH_HOST_PUBLIC_KEY_MD5]); + state(conn, SSH_SESSION_FREE); + sshc->actualcode = CURLE_PEER_FAILED_VERIFICATION; + break; + } + } + +#ifdef HAVE_LIBSSH2_KNOWNHOST_API + if(data->set.str[STRING_SSH_KNOWNHOSTS]) { + /* we're asked to verify the host against a file */ + int keytype; + size_t keylen; + const char *remotekey = libssh2_session_hostkey(sshc->ssh_session, + &keylen, &keytype); + int keycheck; + int keybit; + + if(remotekey) { + /* + * A subject to figure out is what host name we need to pass in here. + * What host name does OpenSSH store in its file if an IDN name is + * used? + */ + struct libssh2_knownhost *host; + enum curl_khmatch keymatch; + curl_sshkeycallback func = + data->set.ssh_keyfunc?data->set.ssh_keyfunc:sshkeycallback; + struct curl_khkey knownkey; + struct curl_khkey *knownkeyp = NULL; + struct curl_khkey foundkey; + + keybit = (keytype == LIBSSH2_HOSTKEY_TYPE_RSA)? + LIBSSH2_KNOWNHOST_KEY_SSHRSA:LIBSSH2_KNOWNHOST_KEY_SSHDSS; + + keycheck = libssh2_knownhost_check(sshc->kh, + conn->host.name, + remotekey, keylen, + LIBSSH2_KNOWNHOST_TYPE_PLAIN| + LIBSSH2_KNOWNHOST_KEYENC_RAW| + keybit, + &host); + + infof(data, "SSH host check: %d, key: %s\n", keycheck, + (keycheck <= LIBSSH2_KNOWNHOST_CHECK_MISMATCH)? + host->key:""); + + /* setup 'knownkey' */ + if(keycheck <= LIBSSH2_KNOWNHOST_CHECK_MISMATCH) { + knownkey.key = host->key; + knownkey.len = 0; + knownkey.keytype = (keytype == LIBSSH2_HOSTKEY_TYPE_RSA)? + CURLKHTYPE_RSA : CURLKHTYPE_DSS; + knownkeyp = &knownkey; + } + + /* setup 'foundkey' */ + foundkey.key = remotekey; + foundkey.len = keylen; + foundkey.keytype = (keytype == LIBSSH2_HOSTKEY_TYPE_RSA)? + CURLKHTYPE_RSA : CURLKHTYPE_DSS; + + /* + * if any of the LIBSSH2_KNOWNHOST_CHECK_* defines and the + * curl_khmatch enum are ever modified, we need to introduce a + * translation table here! + */ + keymatch = (enum curl_khmatch)keycheck; + + /* Ask the callback how to behave */ + rc = func(data, knownkeyp, /* from the knownhosts file */ + &foundkey, /* from the remote host */ + keymatch, data->set.ssh_keyfunc_userp); + } + else + /* no remotekey means failure! */ + rc = CURLKHSTAT_REJECT; + + switch(rc) { + default: /* unknown return codes will equal reject */ + case CURLKHSTAT_REJECT: + state(conn, SSH_SESSION_FREE); + case CURLKHSTAT_DEFER: + /* DEFER means bail out but keep the SSH_HOSTKEY state */ + result = sshc->actualcode = CURLE_PEER_FAILED_VERIFICATION; + break; + case CURLKHSTAT_FINE: + case CURLKHSTAT_FINE_ADD_TO_FILE: + /* proceed */ + if(keycheck != LIBSSH2_KNOWNHOST_CHECK_MATCH) { + /* the found host+key didn't match but has been told to be fine + anyway so we add it in memory */ + int addrc = libssh2_knownhost_add(sshc->kh, + conn->host.name, NULL, + remotekey, keylen, + LIBSSH2_KNOWNHOST_TYPE_PLAIN| + LIBSSH2_KNOWNHOST_KEYENC_RAW| + keybit, NULL); + if(addrc) + infof(data, "Warning adding the known host %s failed!\n", + conn->host.name); + else if(rc == CURLKHSTAT_FINE_ADD_TO_FILE) { + /* now we write the entire in-memory list of known hosts to the + known_hosts file */ + int wrc = + libssh2_knownhost_writefile(sshc->kh, + data->set.str[STRING_SSH_KNOWNHOSTS], + LIBSSH2_KNOWNHOST_FILE_OPENSSH); + if(wrc) { + infof(data, "Warning, writing %s failed!\n", + data->set.str[STRING_SSH_KNOWNHOSTS]); + } + } + } + break; + } + } +#endif /* HAVE_LIBSSH2_KNOWNHOST_API */ + + state(conn, SSH_AUTHLIST); + break; + + case SSH_AUTHLIST: + /* + * Figure out authentication methods + * NB: As soon as we have provided a username to an openssh server we + * must never change it later. Thus, always specify the correct username + * here, even though the libssh2 docs kind of indicate that it should be + * possible to get a 'generic' list (not user-specific) of authentication + * methods, presumably with a blank username. That won't work in my + * experience. + * So always specify it here. + */ + sshc->authlist = libssh2_userauth_list(sshc->ssh_session, + conn->user, + (unsigned int)strlen(conn->user)); + + if(!sshc->authlist) { + if((err = libssh2_session_last_errno(sshc->ssh_session)) == + LIBSSH2_ERROR_EAGAIN) { + rc = LIBSSH2_ERROR_EAGAIN; + break; + } + else { + state(conn, SSH_SESSION_FREE); + sshc->actualcode = libssh2_session_error_to_CURLE(err); + break; + } + } + infof(data, "SSH authentication methods available: %s\n", + sshc->authlist); + + state(conn, SSH_AUTH_PKEY_INIT); + break; + + case SSH_AUTH_PKEY_INIT: + /* + * Check the supported auth types in the order I feel is most secure + * with the requested type of authentication + */ + sshc->authed = FALSE; + + if((data->set.ssh_auth_types & CURLSSH_AUTH_PUBLICKEY) && + (strstr(sshc->authlist, "publickey") != NULL)) { + char *home; + + sshc->rsa_pub = sshc->rsa = NULL; + + /* To ponder about: should really the lib be messing about with the + HOME environment variable etc? */ + home = curl_getenv("HOME"); + + if(data->set.str[STRING_SSH_PUBLIC_KEY]) + sshc->rsa_pub = aprintf("%s", data->set.str[STRING_SSH_PUBLIC_KEY]); + else if(home) + sshc->rsa_pub = aprintf("%s/.ssh/id_dsa.pub", home); + else + /* as a final resort, try current dir! */ + sshc->rsa_pub = strdup("id_dsa.pub"); + + if(sshc->rsa_pub == NULL) { + Curl_safefree(home); + home = NULL; + state(conn, SSH_SESSION_FREE); + sshc->actualcode = CURLE_OUT_OF_MEMORY; + break; + } + + if(data->set.str[STRING_SSH_PRIVATE_KEY]) + sshc->rsa = aprintf("%s", data->set.str[STRING_SSH_PRIVATE_KEY]); + else if(home) + sshc->rsa = aprintf("%s/.ssh/id_dsa", home); + else + /* as a final resort, try current dir! */ + sshc->rsa = strdup("id_dsa"); + + if(sshc->rsa == NULL) { + Curl_safefree(home); + home = NULL; + Curl_safefree(sshc->rsa_pub); + sshc->rsa_pub = NULL; + state(conn, SSH_SESSION_FREE); + sshc->actualcode = CURLE_OUT_OF_MEMORY; + break; + } + + sshc->passphrase = data->set.str[STRING_KEY_PASSWD]; + if(!sshc->passphrase) + sshc->passphrase = ""; + + Curl_safefree(home); + home = NULL; + + infof(data, "Using ssh public key file %s\n", sshc->rsa_pub); + infof(data, "Using ssh private key file %s\n", sshc->rsa); + + state(conn, SSH_AUTH_PKEY); + } + else { + state(conn, SSH_AUTH_PASS_INIT); + } + break; + + case SSH_AUTH_PKEY: + /* The function below checks if the files exists, no need to stat() here. + */ + rc = libssh2_userauth_publickey_fromfile_ex(sshc->ssh_session, + conn->user, + (unsigned int) + strlen(conn->user), + sshc->rsa_pub, + sshc->rsa, sshc->passphrase); + if(rc == LIBSSH2_ERROR_EAGAIN) { + break; + } + + Curl_safefree(sshc->rsa_pub); + sshc->rsa_pub = NULL; + Curl_safefree(sshc->rsa); + sshc->rsa = NULL; + + if(rc == 0) { + sshc->authed = TRUE; + infof(data, "Initialized SSH public key authentication\n"); + state(conn, SSH_AUTH_DONE); + } + else { + char *err_msg; + (void)libssh2_session_last_error(sshc->ssh_session, + &err_msg, NULL, 0); + infof(data, "SSH public key authentication failed: %s\n", err_msg); + state(conn, SSH_AUTH_PASS_INIT); + } + break; + + case SSH_AUTH_PASS_INIT: + if((data->set.ssh_auth_types & CURLSSH_AUTH_PASSWORD) && + (strstr(sshc->authlist, "password") != NULL)) { + state(conn, SSH_AUTH_PASS); + } + else { + state(conn, SSH_AUTH_HOST_INIT); + } + break; + + case SSH_AUTH_PASS: + rc = libssh2_userauth_password_ex(sshc->ssh_session, conn->user, + (unsigned int)strlen(conn->user), + conn->passwd, + (unsigned int)strlen(conn->passwd), + NULL); + if(rc == LIBSSH2_ERROR_EAGAIN) { + break; + } + else if(rc == 0) { + sshc->authed = TRUE; + infof(data, "Initialized password authentication\n"); + state(conn, SSH_AUTH_DONE); + } + else { + state(conn, SSH_AUTH_HOST_INIT); + } + break; + + case SSH_AUTH_HOST_INIT: + if((data->set.ssh_auth_types & CURLSSH_AUTH_HOST) && + (strstr(sshc->authlist, "hostbased") != NULL)) { + state(conn, SSH_AUTH_HOST); + } + else { + state(conn, SSH_AUTH_KEY_INIT); + } + break; + + case SSH_AUTH_HOST: + state(conn, SSH_AUTH_KEY_INIT); + break; + + case SSH_AUTH_KEY_INIT: + if((data->set.ssh_auth_types & CURLSSH_AUTH_KEYBOARD) + && (strstr(sshc->authlist, "keyboard-interactive") != NULL)) { + state(conn, SSH_AUTH_KEY); + } + else { + state(conn, SSH_AUTH_DONE); + } + break; + + case SSH_AUTH_KEY: + /* Authentication failed. Continue with keyboard-interactive now. */ + rc = libssh2_userauth_keyboard_interactive_ex(sshc->ssh_session, + conn->user, + (unsigned int) + strlen(conn->user), + &kbd_callback); + if(rc == LIBSSH2_ERROR_EAGAIN) { + break; + } + else if(rc == 0) { + sshc->authed = TRUE; + infof(data, "Initialized keyboard interactive authentication\n"); + } + state(conn, SSH_AUTH_DONE); + break; + + case SSH_AUTH_DONE: + if(!sshc->authed) { + failf(data, "Authentication failure"); + state(conn, SSH_SESSION_FREE); + sshc->actualcode = CURLE_LOGIN_DENIED; + break; + } + + /* + * At this point we have an authenticated ssh session. + */ + infof(data, "Authentication complete\n"); + + Curl_pgrsTime(conn->data, TIMER_APPCONNECT); /* SSH is connected */ + + conn->sockfd = sock; + conn->writesockfd = CURL_SOCKET_BAD; + + if(conn->protocol == PROT_SFTP) { + state(conn, SSH_SFTP_INIT); + break; + } + infof(data, "SSH CONNECT phase done\n"); + state(conn, SSH_STOP); + break; + + case SSH_SFTP_INIT: + /* + * Start the libssh2 sftp session + */ + sshc->sftp_session = libssh2_sftp_init(sshc->ssh_session); + if(!sshc->sftp_session) { + if(libssh2_session_last_errno(sshc->ssh_session) == + LIBSSH2_ERROR_EAGAIN) { + rc = LIBSSH2_ERROR_EAGAIN; + break; + } + else { + char *err_msg; + + (void)libssh2_session_last_error(sshc->ssh_session, + &err_msg, NULL, 0); + failf(data, "Failure initializing sftp session: %s", err_msg); + state(conn, SSH_SESSION_FREE); + sshc->actualcode = CURLE_FAILED_INIT; + break; + } + } + state(conn, SSH_SFTP_REALPATH); + break; + + case SSH_SFTP_REALPATH: + { + char tempHome[PATH_MAX]; + + /* + * Get the "home" directory + */ + rc = libssh2_sftp_realpath(sshc->sftp_session, ".", + tempHome, PATH_MAX-1); + if(rc == LIBSSH2_ERROR_EAGAIN) { + break; + } + else if(rc > 0) { + /* It seems that this string is not always NULL terminated */ + tempHome[rc] = '\0'; + sshc->homedir = strdup(tempHome); + if(!sshc->homedir) { + state(conn, SSH_SFTP_CLOSE); + sshc->actualcode = CURLE_OUT_OF_MEMORY; + break; + } + } + else { + /* Return the error type */ + err = (int)(libssh2_sftp_last_error(sshc->sftp_session)); + result = sftp_libssh2_error_to_CURLE(err); + sshc->actualcode = result?result:CURLE_SSH; + DEBUGF(infof(data, "error = %d makes libcurl = %d\n", + err, (int)result)); + state(conn, SSH_STOP); + break; + } + } + /* This is the last step in the SFTP connect phase. Do note that while + we get the homedir here, we get the "workingpath" in the DO action + since the homedir will remain the same between request but the + working path will not. */ + DEBUGF(infof(data, "SSH CONNECT phase done\n")); + state(conn, SSH_STOP); + break; + + case SSH_SFTP_QUOTE_INIT: + + result = ssh_getworkingpath(conn, sshc->homedir, &sftp_scp->path); + if(result) { + sshc->actualcode = result; + state(conn, SSH_STOP); + break; + } + + if(data->set.quote) { + infof(data, "Sending quote commands\n"); + sshc->quote_item = data->set.quote; + state(conn, SSH_SFTP_QUOTE); + } + else { + state(conn, SSH_SFTP_TRANS_INIT); + } + break; + + case SSH_SFTP_POSTQUOTE_INIT: + if(data->set.postquote) { + infof(data, "Sending quote commands\n"); + sshc->quote_item = data->set.postquote; + state(conn, SSH_SFTP_QUOTE); + } + else { + state(conn, SSH_STOP); + } + break; + + case SSH_SFTP_QUOTE: + /* Send any quote commands */ + { + const char *cp; + + /* + * Support some of the "FTP" commands + */ + if(curl_strequal("pwd", sshc->quote_item->data)) { + /* output debug output if that is requested */ + if(data->set.verbose) { + char tmp[PATH_MAX+1]; + + Curl_debug(data, CURLINFO_HEADER_OUT, (char *)"PWD\n", 4, conn); + snprintf(tmp, PATH_MAX, "257 \"%s\" is current directory.\n", + sftp_scp->path); + Curl_debug(data, CURLINFO_HEADER_IN, tmp, strlen(tmp), conn); + } + state(conn, SSH_SFTP_NEXT_QUOTE); + break; + } + else if(sshc->quote_item->data) { + /* + * the arguments following the command must be separated from the + * command with a space so we can check for it unconditionally + */ + cp = strchr(sshc->quote_item->data, ' '); + if(cp == NULL) { + failf(data, "Syntax error in SFTP command. Supply parameter(s)!"); + state(conn, SSH_SFTP_CLOSE); + sshc->actualcode = CURLE_QUOTE_ERROR; + break; + } + + /* + * also, every command takes at least one argument so we get that + * first argument right now + */ + result = get_pathname(&cp, &sshc->quote_path1); + if(result) { + if(result == CURLE_OUT_OF_MEMORY) + failf(data, "Out of memory"); + else + failf(data, "Syntax error: Bad first parameter"); + state(conn, SSH_SFTP_CLOSE); + sshc->actualcode = result; + break; + } + + /* + * SFTP is a binary protocol, so we don't send text commands to + * the server. Instead, we scan for commands for commands used by + * OpenSSH's sftp program and call the appropriate libssh2 + * functions. + */ + if(curl_strnequal(sshc->quote_item->data, "chgrp ", 6) || + curl_strnequal(sshc->quote_item->data, "chmod ", 6) || + curl_strnequal(sshc->quote_item->data, "chown ", 6) ) { + /* attribute change */ + + /* sshc->quote_path1 contains the mode to set */ + /* get the destination */ + result = get_pathname(&cp, &sshc->quote_path2); + if(result) { + if(result == CURLE_OUT_OF_MEMORY) + failf(data, "Out of memory"); + else + failf(data, "Syntax error in chgrp/chmod/chown: " + "Bad second parameter"); + Curl_safefree(sshc->quote_path1); + sshc->quote_path1 = NULL; + state(conn, SSH_SFTP_CLOSE); + sshc->actualcode = result; + break; + } + memset(&sshc->quote_attrs, 0, sizeof(LIBSSH2_SFTP_ATTRIBUTES)); + state(conn, SSH_SFTP_QUOTE_STAT); + break; + } + else if(curl_strnequal(sshc->quote_item->data, "ln ", 3) || + curl_strnequal(sshc->quote_item->data, "symlink ", 8)) { + /* symbolic linking */ + /* sshc->quote_path1 is the source */ + /* get the destination */ + result = get_pathname(&cp, &sshc->quote_path2); + if(result) { + if(result == CURLE_OUT_OF_MEMORY) + failf(data, "Out of memory"); + else + failf(data, + "Syntax error in ln/symlink: Bad second parameter"); + Curl_safefree(sshc->quote_path1); + sshc->quote_path1 = NULL; + state(conn, SSH_SFTP_CLOSE); + sshc->actualcode = result; + break; + } + state(conn, SSH_SFTP_QUOTE_SYMLINK); + break; + } + else if(curl_strnequal(sshc->quote_item->data, "mkdir ", 6)) { + /* create dir */ + state(conn, SSH_SFTP_QUOTE_MKDIR); + break; + } + else if(curl_strnequal(sshc->quote_item->data, "rename ", 7)) { + /* rename file */ + /* first param is the source path */ + /* second param is the dest. path */ + result = get_pathname(&cp, &sshc->quote_path2); + if(result) { + if(result == CURLE_OUT_OF_MEMORY) + failf(data, "Out of memory"); + else + failf(data, "Syntax error in rename: Bad second parameter"); + Curl_safefree(sshc->quote_path1); + sshc->quote_path1 = NULL; + state(conn, SSH_SFTP_CLOSE); + sshc->actualcode = result; + break; + } + state(conn, SSH_SFTP_QUOTE_RENAME); + break; + } + else if(curl_strnequal(sshc->quote_item->data, "rmdir ", 6)) { + /* delete dir */ + state(conn, SSH_SFTP_QUOTE_RMDIR); + break; + } + else if(curl_strnequal(sshc->quote_item->data, "rm ", 3)) { + state(conn, SSH_SFTP_QUOTE_UNLINK); + break; + } + + failf(data, "Unknown SFTP command"); + Curl_safefree(sshc->quote_path1); + sshc->quote_path1 = NULL; + Curl_safefree(sshc->quote_path2); + sshc->quote_path2 = NULL; + state(conn, SSH_SFTP_CLOSE); + sshc->actualcode = CURLE_QUOTE_ERROR; + break; + } + } + if(!sshc->quote_item) { + state(conn, SSH_SFTP_TRANS_INIT); + } + break; + + case SSH_SFTP_NEXT_QUOTE: + if(sshc->quote_path1) { + Curl_safefree(sshc->quote_path1); + sshc->quote_path1 = NULL; + } + if(sshc->quote_path2) { + Curl_safefree(sshc->quote_path2); + sshc->quote_path2 = NULL; + } + + sshc->quote_item = sshc->quote_item->next; + + if(sshc->quote_item) { + state(conn, SSH_SFTP_QUOTE); + } + else { + if(sshc->nextstate != SSH_NO_STATE) { + state(conn, sshc->nextstate); + sshc->nextstate = SSH_NO_STATE; + } + else { + state(conn, SSH_SFTP_TRANS_INIT); + } + } + break; + + case SSH_SFTP_QUOTE_STAT: + if(!curl_strnequal(sshc->quote_item->data, "chmod", 5)) { + /* Since chown and chgrp only set owner OR group but libssh2 wants to + * set them both at once, we need to obtain the current ownership + * first. This takes an extra protocol round trip. + */ + rc = libssh2_sftp_stat_ex(sshc->sftp_session, sshc->quote_path2, + (unsigned int)strlen(sshc->quote_path2), + LIBSSH2_SFTP_STAT, + &sshc->quote_attrs); + if(rc == LIBSSH2_ERROR_EAGAIN) { + break; + } + else if(rc != 0) { /* get those attributes */ + err = (int)(libssh2_sftp_last_error(sshc->sftp_session)); + Curl_safefree(sshc->quote_path1); + sshc->quote_path1 = NULL; + Curl_safefree(sshc->quote_path2); + sshc->quote_path2 = NULL; + failf(data, "Attempt to get SFTP stats failed: %s", + sftp_libssh2_strerror(err)); + state(conn, SSH_SFTP_CLOSE); + sshc->actualcode = CURLE_QUOTE_ERROR; + break; + } + } + + /* Now set the new attributes... */ + if(curl_strnequal(sshc->quote_item->data, "chgrp", 5)) { + sshc->quote_attrs.gid = strtoul(sshc->quote_path1, NULL, 10); + sshc->quote_attrs.flags = LIBSSH2_SFTP_ATTR_UIDGID; + if(sshc->quote_attrs.gid == 0 && !ISDIGIT(sshc->quote_path1[0])) { + Curl_safefree(sshc->quote_path1); + sshc->quote_path1 = NULL; + Curl_safefree(sshc->quote_path2); + sshc->quote_path2 = NULL; + failf(data, "Syntax error: chgrp gid not a number"); + state(conn, SSH_SFTP_CLOSE); + sshc->actualcode = CURLE_QUOTE_ERROR; + break; + } + } + else if(curl_strnequal(sshc->quote_item->data, "chmod", 5)) { + sshc->quote_attrs.permissions = strtoul(sshc->quote_path1, NULL, 8); + sshc->quote_attrs.flags = LIBSSH2_SFTP_ATTR_PERMISSIONS; + /* permissions are octal */ + if(sshc->quote_attrs.permissions == 0 && + !ISDIGIT(sshc->quote_path1[0])) { + Curl_safefree(sshc->quote_path1); + sshc->quote_path1 = NULL; + Curl_safefree(sshc->quote_path2); + sshc->quote_path2 = NULL; + failf(data, "Syntax error: chmod permissions not a number"); + state(conn, SSH_SFTP_CLOSE); + sshc->actualcode = CURLE_QUOTE_ERROR; + break; + } + } + else if(curl_strnequal(sshc->quote_item->data, "chown", 5)) { + sshc->quote_attrs.uid = strtoul(sshc->quote_path1, NULL, 10); + sshc->quote_attrs.flags = LIBSSH2_SFTP_ATTR_UIDGID; + if(sshc->quote_attrs.uid == 0 && !ISDIGIT(sshc->quote_path1[0])) { + Curl_safefree(sshc->quote_path1); + sshc->quote_path1 = NULL; + Curl_safefree(sshc->quote_path2); + sshc->quote_path2 = NULL; + failf(data, "Syntax error: chown uid not a number"); + state(conn, SSH_SFTP_CLOSE); + sshc->actualcode = CURLE_QUOTE_ERROR; + break; + } + } + + /* Now send the completed structure... */ + state(conn, SSH_SFTP_QUOTE_SETSTAT); + break; + + case SSH_SFTP_QUOTE_SETSTAT: + rc = libssh2_sftp_stat_ex(sshc->sftp_session, sshc->quote_path2, + (unsigned int)strlen(sshc->quote_path2), + LIBSSH2_SFTP_SETSTAT, + &sshc->quote_attrs); + if(rc == LIBSSH2_ERROR_EAGAIN) { + break; + } + else if(rc != 0) { + err = (int)(libssh2_sftp_last_error(sshc->sftp_session)); + Curl_safefree(sshc->quote_path1); + sshc->quote_path1 = NULL; + Curl_safefree(sshc->quote_path2); + sshc->quote_path2 = NULL; + failf(data, "Attempt to set SFTP stats failed: %s", + sftp_libssh2_strerror(err)); + state(conn, SSH_SFTP_CLOSE); + sshc->actualcode = CURLE_QUOTE_ERROR; + break; + } + state(conn, SSH_SFTP_NEXT_QUOTE); + break; + + case SSH_SFTP_QUOTE_SYMLINK: + rc = libssh2_sftp_symlink_ex(sshc->sftp_session, sshc->quote_path1, + (unsigned int)strlen(sshc->quote_path1), + sshc->quote_path2, + (unsigned int)strlen(sshc->quote_path2), + LIBSSH2_SFTP_SYMLINK); + if(rc == LIBSSH2_ERROR_EAGAIN) { + break; + } + else if(rc != 0) { + err = (int)(libssh2_sftp_last_error(sshc->sftp_session)); + Curl_safefree(sshc->quote_path1); + sshc->quote_path1 = NULL; + Curl_safefree(sshc->quote_path2); + sshc->quote_path2 = NULL; + failf(data, "symlink command failed: %s", + sftp_libssh2_strerror(err)); + state(conn, SSH_SFTP_CLOSE); + sshc->actualcode = CURLE_QUOTE_ERROR; + break; + } + state(conn, SSH_SFTP_NEXT_QUOTE); + break; + + case SSH_SFTP_QUOTE_MKDIR: + rc = libssh2_sftp_mkdir_ex(sshc->sftp_session, sshc->quote_path1, + (unsigned int)strlen(sshc->quote_path1), + 0755); + if(rc == LIBSSH2_ERROR_EAGAIN) { + break; + } + else if(rc != 0) { + err = (int)(libssh2_sftp_last_error(sshc->sftp_session)); + Curl_safefree(sshc->quote_path1); + sshc->quote_path1 = NULL; + failf(data, "mkdir command failed: %s", sftp_libssh2_strerror(err)); + state(conn, SSH_SFTP_CLOSE); + sshc->actualcode = CURLE_QUOTE_ERROR; + break; + } + state(conn, SSH_SFTP_NEXT_QUOTE); + break; + + case SSH_SFTP_QUOTE_RENAME: + rc = libssh2_sftp_rename_ex(sshc->sftp_session, sshc->quote_path1, + (unsigned int)strlen(sshc->quote_path1), + sshc->quote_path2, + (unsigned int)strlen(sshc->quote_path2), + LIBSSH2_SFTP_RENAME_OVERWRITE | + LIBSSH2_SFTP_RENAME_ATOMIC | + LIBSSH2_SFTP_RENAME_NATIVE); + if(rc == LIBSSH2_ERROR_EAGAIN) { + break; + } + else if(rc != 0) { + err = (int)(libssh2_sftp_last_error(sshc->sftp_session)); + Curl_safefree(sshc->quote_path1); + sshc->quote_path1 = NULL; + Curl_safefree(sshc->quote_path2); + sshc->quote_path2 = NULL; + failf(data, "rename command failed: %s", sftp_libssh2_strerror(err)); + state(conn, SSH_SFTP_CLOSE); + sshc->actualcode = CURLE_QUOTE_ERROR; + break; + } + state(conn, SSH_SFTP_NEXT_QUOTE); + break; + + case SSH_SFTP_QUOTE_RMDIR: + rc = libssh2_sftp_rmdir_ex(sshc->sftp_session, sshc->quote_path1, + (unsigned int)strlen(sshc->quote_path1)); + if(rc == LIBSSH2_ERROR_EAGAIN) { + break; + } + else if(rc != 0) { + err = (int)(libssh2_sftp_last_error(sshc->sftp_session)); + Curl_safefree(sshc->quote_path1); + sshc->quote_path1 = NULL; + failf(data, "rmdir command failed: %s", sftp_libssh2_strerror(err)); + state(conn, SSH_SFTP_CLOSE); + sshc->actualcode = CURLE_QUOTE_ERROR; + break; + } + state(conn, SSH_SFTP_NEXT_QUOTE); + break; + + case SSH_SFTP_QUOTE_UNLINK: + rc = libssh2_sftp_unlink_ex(sshc->sftp_session, sshc->quote_path1, + (unsigned int)strlen(sshc->quote_path1)); + if(rc == LIBSSH2_ERROR_EAGAIN) { + break; + } + else if(rc != 0) { + err = (int)(libssh2_sftp_last_error(sshc->sftp_session)); + Curl_safefree(sshc->quote_path1); + sshc->quote_path1 = NULL; + failf(data, "rm command failed: %s", sftp_libssh2_strerror(err)); + state(conn, SSH_SFTP_CLOSE); + sshc->actualcode = CURLE_QUOTE_ERROR; + break; + } + state(conn, SSH_SFTP_NEXT_QUOTE); + break; + + case SSH_SFTP_TRANS_INIT: + if(data->set.upload) + state(conn, SSH_SFTP_UPLOAD_INIT); + else { + if(data->set.opt_no_body) + state(conn, SSH_STOP); + else if(sftp_scp->path[strlen(sftp_scp->path)-1] == '/') + state(conn, SSH_SFTP_READDIR_INIT); + else + state(conn, SSH_SFTP_DOWNLOAD_INIT); + } + break; + + case SSH_SFTP_UPLOAD_INIT: + { + unsigned long flags; + /* + * NOTE!!! libssh2 requires that the destination path is a full path + * that includes the destination file and name OR ends in a "/" + * If this is not done the destination file will be named the + * same name as the last directory in the path. + */ + + if(data->state.resume_from != 0) { + LIBSSH2_SFTP_ATTRIBUTES attrs; + if(data->state.resume_from < 0) { + rc = libssh2_sftp_stat_ex(sshc->sftp_session, sftp_scp->path, + (unsigned int)strlen(sftp_scp->path), + LIBSSH2_SFTP_STAT, &attrs); + if(rc == LIBSSH2_ERROR_EAGAIN) { + break; + } + else if(rc) { + data->state.resume_from = 0; + } + else { + curl_off_t size = attrs.filesize; + if(size < 0) { + failf(data, "Bad file size (%" FORMAT_OFF_T ")", size); + return CURLE_BAD_DOWNLOAD_RESUME; + } + data->state.resume_from = attrs.filesize; + } + } + } + + if(data->set.ftp_append) + /* Try to open for append, but create if nonexisting */ + flags = LIBSSH2_FXF_WRITE|LIBSSH2_FXF_CREAT|LIBSSH2_FXF_APPEND; + else if (data->state.resume_from > 0) + /* If we have restart position then open for append */ + flags = LIBSSH2_FXF_WRITE|LIBSSH2_FXF_APPEND; + else + /* Clear file before writing (normal behaviour) */ + flags = LIBSSH2_FXF_WRITE|LIBSSH2_FXF_CREAT|LIBSSH2_FXF_TRUNC; + + sshc->sftp_handle = + libssh2_sftp_open_ex(sshc->sftp_session, sftp_scp->path, + (unsigned int)strlen(sftp_scp->path), + flags, data->set.new_file_perms, + LIBSSH2_SFTP_OPENFILE); + + if(!sshc->sftp_handle) { + rc = libssh2_session_last_errno(sshc->ssh_session); + + if(LIBSSH2_ERROR_EAGAIN == rc) + break; + else { + if(LIBSSH2_ERROR_SFTP_PROTOCOL == rc) + /* only when there was an SFTP protocol error can we extract + the sftp error! */ + err = (int)(libssh2_sftp_last_error(sshc->sftp_session)); + else + err = -1; /* not an sftp error at all */ + + if(sshc->secondCreateDirs) { + state(conn, SSH_SFTP_CLOSE); + sshc->actualcode = err>= LIBSSH2_FX_OK? + sftp_libssh2_error_to_CURLE(err):CURLE_SSH; + failf(data, "Creating the dir/file failed: %s", + sftp_libssh2_strerror(err)); + break; + } + else if(((err == LIBSSH2_FX_NO_SUCH_FILE) || + (err == LIBSSH2_FX_FAILURE) || + (err == LIBSSH2_FX_NO_SUCH_PATH)) && + (data->set.ftp_create_missing_dirs && + (strlen(sftp_scp->path) > 1))) { + /* try to create the path remotely */ + sshc->secondCreateDirs = 1; + state(conn, SSH_SFTP_CREATE_DIRS_INIT); + break; + } + state(conn, SSH_SFTP_CLOSE); + sshc->actualcode = err>= LIBSSH2_FX_OK? + sftp_libssh2_error_to_CURLE(err):CURLE_SSH; + if(!sshc->actualcode) { + /* Sometimes, for some reason libssh2_sftp_last_error() returns + zero even though libssh2_sftp_open() failed previously! We need + to work around that! */ + sshc->actualcode = CURLE_SSH; + err=-1; + } + failf(data, "Upload failed: %s (%d/%d)", + err>= LIBSSH2_FX_OK?sftp_libssh2_strerror(err):"ssh error", + err, rc); + break; + } + } + + /* If we have restart point then we need to seek to the correct + position. */ + if(data->state.resume_from > 0) { + /* Let's read off the proper amount of bytes from the input. */ + if(conn->seek_func) { + seekerr = conn->seek_func(conn->seek_client, data->state.resume_from, + SEEK_SET); + } + + if(seekerr != CURL_SEEKFUNC_OK){ + + if(seekerr != CURL_SEEKFUNC_CANTSEEK) { + failf(data, "Could not seek stream"); + return CURLE_FTP_COULDNT_USE_REST; + } + /* seekerr == CURL_SEEKFUNC_CANTSEEK (can't seek to offset) */ + else { + curl_off_t passed=0; + do { + size_t readthisamountnow = + (data->state.resume_from - passed > CURL_OFF_T_C(BUFSIZE)) ? + BUFSIZE : curlx_sotouz(data->state.resume_from - passed); + + size_t actuallyread = + conn->fread_func(data->state.buffer, 1, readthisamountnow, + conn->fread_in); + + passed += actuallyread; + if((actuallyread == 0) || (actuallyread > readthisamountnow)) { + /* this checks for greater-than only to make sure that the + CURL_READFUNC_ABORT return code still aborts */ + failf(data, "Failed to read data"); + return CURLE_FTP_COULDNT_USE_REST; + } + } while(passed < data->state.resume_from); + } + } + + /* now, decrease the size of the read */ + if(data->set.infilesize > 0) { + data->set.infilesize -= data->state.resume_from; + data->req.size = data->set.infilesize; + Curl_pgrsSetUploadSize(data, data->set.infilesize); + } + + SFTP_SEEK(sshc->sftp_handle, data->state.resume_from); + } + if(data->set.infilesize > 0) { + data->req.size = data->set.infilesize; + Curl_pgrsSetUploadSize(data, data->set.infilesize); + } + /* upload data */ + Curl_setup_transfer(conn, -1, -1, FALSE, NULL, FIRSTSOCKET, NULL); + + /* not set by Curl_setup_transfer to preserve keepon bits */ + conn->sockfd = conn->writesockfd; + + if(result) { + state(conn, SSH_SFTP_CLOSE); + sshc->actualcode = result; + } + else { + /* store this original bitmask setup to use later on if we can't + figure out a "real" bitmask */ + sshc->orig_waitfor = data->req.keepon; + + state(conn, SSH_STOP); + } + break; + } + + case SSH_SFTP_CREATE_DIRS_INIT: + if(strlen(sftp_scp->path) > 1) { + sshc->slash_pos = sftp_scp->path + 1; /* ignore the leading '/' */ + state(conn, SSH_SFTP_CREATE_DIRS); + } + else { + state(conn, SSH_SFTP_UPLOAD_INIT); + } + break; + + case SSH_SFTP_CREATE_DIRS: + if((sshc->slash_pos = strchr(sshc->slash_pos, '/')) != NULL) { + *sshc->slash_pos = 0; + + infof(data, "Creating directory '%s'\n", sftp_scp->path); + state(conn, SSH_SFTP_CREATE_DIRS_MKDIR); + break; + } + else { + state(conn, SSH_SFTP_UPLOAD_INIT); + } + break; + + case SSH_SFTP_CREATE_DIRS_MKDIR: + /* 'mode' - parameter is preliminary - default to 0644 */ + rc = libssh2_sftp_mkdir_ex(sshc->sftp_session, sftp_scp->path, + (unsigned int)strlen(sftp_scp->path), + data->set.new_directory_perms); + if(rc == LIBSSH2_ERROR_EAGAIN) { + break; + } + *sshc->slash_pos = '/'; + ++sshc->slash_pos; + if(rc == -1) { + unsigned int sftp_err = 0; + /* + * Abort if failure wasn't that the dir already exists or the + * permission was denied (creation might succeed further down the + * path) - retry on unspecific FAILURE also + */ + sftp_err = (unsigned int)(libssh2_sftp_last_error(sshc->sftp_session)); + if((sftp_err != LIBSSH2_FX_FILE_ALREADY_EXISTS) && + (sftp_err != LIBSSH2_FX_FAILURE) && + (sftp_err != LIBSSH2_FX_PERMISSION_DENIED)) { + result = sftp_libssh2_error_to_CURLE(sftp_err); + state(conn, SSH_SFTP_CLOSE); + sshc->actualcode = result?result:CURLE_SSH; + break; + } + } + state(conn, SSH_SFTP_CREATE_DIRS); + break; + + case SSH_SFTP_READDIR_INIT: + /* + * This is a directory that we are trying to get, so produce a directory + * listing + */ + sshc->sftp_handle = libssh2_sftp_open_ex(sshc->sftp_session, + sftp_scp->path, + (unsigned int) + strlen(sftp_scp->path), + 0, 0, LIBSSH2_SFTP_OPENDIR); + if(!sshc->sftp_handle) { + if(libssh2_session_last_errno(sshc->ssh_session) == + LIBSSH2_ERROR_EAGAIN) { + rc = LIBSSH2_ERROR_EAGAIN; + break; + } + else { + err = (int)(libssh2_sftp_last_error(sshc->sftp_session)); + failf(data, "Could not open directory for reading: %s", + sftp_libssh2_strerror(err)); + state(conn, SSH_SFTP_CLOSE); + result = sftp_libssh2_error_to_CURLE(err); + sshc->actualcode = result?result:CURLE_SSH; + break; + } + } + if((sshc->readdir_filename = malloc(PATH_MAX+1)) == NULL) { + state(conn, SSH_SFTP_CLOSE); + sshc->actualcode = CURLE_OUT_OF_MEMORY; + break; + } + if((sshc->readdir_longentry = malloc(PATH_MAX+1)) == NULL) { + Curl_safefree(sshc->readdir_filename); + sshc->readdir_filename = NULL; + state(conn, SSH_SFTP_CLOSE); + sshc->actualcode = CURLE_OUT_OF_MEMORY; + break; + } + state(conn, SSH_SFTP_READDIR); + break; + + case SSH_SFTP_READDIR: + sshc->readdir_len = libssh2_sftp_readdir_ex(sshc->sftp_handle, + sshc->readdir_filename, + PATH_MAX, + sshc->readdir_longentry, + PATH_MAX, + &sshc->readdir_attrs); + if(sshc->readdir_len == LIBSSH2_ERROR_EAGAIN) { + rc = LIBSSH2_ERROR_EAGAIN; + break; + } + if(sshc->readdir_len > 0) { + sshc->readdir_filename[sshc->readdir_len] = '\0'; + + if(data->set.ftp_list_only) { + char *tmpLine; + + tmpLine = aprintf("%s\n", sshc->readdir_filename); + if(tmpLine == NULL) { + state(conn, SSH_SFTP_CLOSE); + sshc->actualcode = CURLE_OUT_OF_MEMORY; + break; + } + result = Curl_client_write(conn, CLIENTWRITE_BODY, + tmpLine, sshc->readdir_len+1); + Curl_safefree(tmpLine); + + if(result) { + state(conn, SSH_STOP); + break; + } + /* since this counts what we send to the client, we include the + newline in this counter */ + data->req.bytecount += sshc->readdir_len+1; + + /* output debug output if that is requested */ + if(data->set.verbose) { + Curl_debug(data, CURLINFO_DATA_OUT, sshc->readdir_filename, + sshc->readdir_len, conn); + } + } + else { + sshc->readdir_currLen = (int)strlen(sshc->readdir_longentry); + sshc->readdir_totalLen = 80 + sshc->readdir_currLen; + sshc->readdir_line = calloc(sshc->readdir_totalLen, 1); + if(!sshc->readdir_line) { + Curl_safefree(sshc->readdir_filename); + sshc->readdir_filename = NULL; + Curl_safefree(sshc->readdir_longentry); + sshc->readdir_longentry = NULL; + state(conn, SSH_SFTP_CLOSE); + sshc->actualcode = CURLE_OUT_OF_MEMORY; + break; + } + + memcpy(sshc->readdir_line, sshc->readdir_longentry, + sshc->readdir_currLen); + if((sshc->readdir_attrs.flags & LIBSSH2_SFTP_ATTR_PERMISSIONS) && + ((sshc->readdir_attrs.permissions & LIBSSH2_SFTP_S_IFMT) == + LIBSSH2_SFTP_S_IFLNK)) { + sshc->readdir_linkPath = malloc(PATH_MAX + 1); + if(sshc->readdir_linkPath == NULL) { + Curl_safefree(sshc->readdir_filename); + sshc->readdir_filename = NULL; + Curl_safefree(sshc->readdir_longentry); + sshc->readdir_longentry = NULL; + state(conn, SSH_SFTP_CLOSE); + sshc->actualcode = CURLE_OUT_OF_MEMORY; + break; + } + + snprintf(sshc->readdir_linkPath, PATH_MAX, "%s%s", sftp_scp->path, + sshc->readdir_filename); + state(conn, SSH_SFTP_READDIR_LINK); + break; + } + state(conn, SSH_SFTP_READDIR_BOTTOM); + break; + } + } + else if(sshc->readdir_len == 0) { + Curl_safefree(sshc->readdir_filename); + sshc->readdir_filename = NULL; + Curl_safefree(sshc->readdir_longentry); + sshc->readdir_longentry = NULL; + state(conn, SSH_SFTP_READDIR_DONE); + break; + } + else if(sshc->readdir_len <= 0) { + err = (int)(libssh2_sftp_last_error(sshc->sftp_session)); + result = sftp_libssh2_error_to_CURLE(err); + sshc->actualcode = result?result:CURLE_SSH; + failf(data, "Could not open remote file for reading: %s :: %d", + sftp_libssh2_strerror(err), + libssh2_session_last_errno(sshc->ssh_session)); + Curl_safefree(sshc->readdir_filename); + sshc->readdir_filename = NULL; + Curl_safefree(sshc->readdir_longentry); + sshc->readdir_longentry = NULL; + state(conn, SSH_SFTP_CLOSE); + break; + } + break; + + case SSH_SFTP_READDIR_LINK: + sshc->readdir_len = + libssh2_sftp_symlink_ex(sshc->sftp_session, + sshc->readdir_linkPath, + (unsigned int) strlen(sshc->readdir_linkPath), + sshc->readdir_filename, + PATH_MAX, LIBSSH2_SFTP_READLINK); + if(sshc->readdir_len == LIBSSH2_ERROR_EAGAIN) { + rc = LIBSSH2_ERROR_EAGAIN; + break; + } + Curl_safefree(sshc->readdir_linkPath); + sshc->readdir_linkPath = NULL; + sshc->readdir_line = realloc(sshc->readdir_line, + sshc->readdir_totalLen + 4 + + sshc->readdir_len); + if(!sshc->readdir_line) { + Curl_safefree(sshc->readdir_filename); + sshc->readdir_filename = NULL; + Curl_safefree(sshc->readdir_longentry); + sshc->readdir_longentry = NULL; + state(conn, SSH_SFTP_CLOSE); + sshc->actualcode = CURLE_OUT_OF_MEMORY; + break; + } + + sshc->readdir_currLen += snprintf(sshc->readdir_line + + sshc->readdir_currLen, + sshc->readdir_totalLen - + sshc->readdir_currLen, + " -> %s", + sshc->readdir_filename); + + state(conn, SSH_SFTP_READDIR_BOTTOM); + break; + + case SSH_SFTP_READDIR_BOTTOM: + sshc->readdir_currLen += snprintf(sshc->readdir_line + + sshc->readdir_currLen, + sshc->readdir_totalLen - + sshc->readdir_currLen, "\n"); + result = Curl_client_write(conn, CLIENTWRITE_BODY, + sshc->readdir_line, + sshc->readdir_currLen); + + if(result == CURLE_OK) { + + /* output debug output if that is requested */ + if(data->set.verbose) { + Curl_debug(data, CURLINFO_DATA_OUT, sshc->readdir_line, + sshc->readdir_currLen, conn); + } + data->req.bytecount += sshc->readdir_currLen; + } + Curl_safefree(sshc->readdir_line); + sshc->readdir_line = NULL; + if(result) { + state(conn, SSH_STOP); + } + else + state(conn, SSH_SFTP_READDIR); + break; + + case SSH_SFTP_READDIR_DONE: + if(libssh2_sftp_closedir(sshc->sftp_handle) == + LIBSSH2_ERROR_EAGAIN) { + rc = LIBSSH2_ERROR_EAGAIN; + break; + } + sshc->sftp_handle = NULL; + Curl_safefree(sshc->readdir_filename); + sshc->readdir_filename = NULL; + Curl_safefree(sshc->readdir_longentry); + sshc->readdir_longentry = NULL; + + /* no data to transfer */ + Curl_setup_transfer(conn, -1, -1, FALSE, NULL, -1, NULL); + state(conn, SSH_STOP); + break; + + case SSH_SFTP_DOWNLOAD_INIT: + /* + * Work on getting the specified file + */ + sshc->sftp_handle = + libssh2_sftp_open_ex(sshc->sftp_session, sftp_scp->path, + (unsigned int)strlen(sftp_scp->path), + LIBSSH2_FXF_READ, data->set.new_file_perms, + LIBSSH2_SFTP_OPENFILE); + if(!sshc->sftp_handle) { + if(libssh2_session_last_errno(sshc->ssh_session) == + LIBSSH2_ERROR_EAGAIN) { + rc = LIBSSH2_ERROR_EAGAIN; + break; + } + else { + err = (int)(libssh2_sftp_last_error(sshc->sftp_session)); + failf(data, "Could not open remote file for reading: %s", + sftp_libssh2_strerror(err)); + state(conn, SSH_SFTP_CLOSE); + result = sftp_libssh2_error_to_CURLE(err); + sshc->actualcode = result?result:CURLE_SSH; + break; + } + } + state(conn, SSH_SFTP_DOWNLOAD_STAT); + break; + + case SSH_SFTP_DOWNLOAD_STAT: + { + LIBSSH2_SFTP_ATTRIBUTES attrs; + + rc = libssh2_sftp_stat_ex(sshc->sftp_session, sftp_scp->path, + (unsigned int)strlen(sftp_scp->path), + LIBSSH2_SFTP_STAT, &attrs); + if(rc == LIBSSH2_ERROR_EAGAIN) { + break; + } + else if(rc) { + /* + * libssh2_sftp_open() didn't return an error, so maybe the server + * just doesn't support stat() + */ + data->req.size = -1; + data->req.maxdownload = -1; + } + else { + curl_off_t size = attrs.filesize; + + if(size < 0) { + failf(data, "Bad file size (%" FORMAT_OFF_T ")", size); + return CURLE_BAD_DOWNLOAD_RESUME; + } + if(conn->data->state.use_range) { + curl_off_t from, to; + char *ptr; + char *ptr2; + + from=curlx_strtoofft(conn->data->state.range, &ptr, 0); + while(*ptr && (ISSPACE(*ptr) || (*ptr=='-'))) + ptr++; + to=curlx_strtoofft(ptr, &ptr2, 0); + if((ptr == ptr2) /* no "to" value given */ + || (to >= size)) { + to = size - 1; + } + if(from < 0) { + /* from is relative to end of file */ + from += size; + } + if(from >= size) { + failf(data, "Offset (%" + FORMAT_OFF_T ") was beyond file size (%" FORMAT_OFF_T ")", + from, attrs.filesize); + return CURLE_BAD_DOWNLOAD_RESUME; + } + if(from > to) { + from = to; + size = 0; + } + else { + size = to - from + 1; + } + + SFTP_SEEK(conn->proto.sshc.sftp_handle, from); + } + data->req.size = size; + data->req.maxdownload = size; + Curl_pgrsSetDownloadSize(data, size); + } + + /* We can resume if we can seek to the resume position */ + if(data->state.resume_from) { + if(data->state.resume_from < 0) { + /* We're supposed to download the last abs(from) bytes */ + if((curl_off_t)attrs.filesize < -data->state.resume_from) { + failf(data, "Offset (%" + FORMAT_OFF_T ") was beyond file size (%" FORMAT_OFF_T ")", + data->state.resume_from, attrs.filesize); + return CURLE_BAD_DOWNLOAD_RESUME; + } + /* download from where? */ + data->state.resume_from += attrs.filesize; + } + else { + if((curl_off_t)attrs.filesize < data->state.resume_from) { + failf(data, "Offset (%" FORMAT_OFF_T + ") was beyond file size (%" FORMAT_OFF_T ")", + data->state.resume_from, attrs.filesize); + return CURLE_BAD_DOWNLOAD_RESUME; + } + } + /* Does a completed file need to be seeked and started or closed ? */ + /* Now store the number of bytes we are expected to download */ + data->req.size = attrs.filesize - data->state.resume_from; + data->req.maxdownload = attrs.filesize - data->state.resume_from; + Curl_pgrsSetDownloadSize(data, + attrs.filesize - data->state.resume_from); + SFTP_SEEK(sshc->sftp_handle, data->state.resume_from); + } + } + /* Setup the actual download */ + if(data->req.size == 0) { + /* no data to transfer */ + Curl_setup_transfer(conn, -1, -1, FALSE, NULL, -1, NULL); + infof(data, "File already completely downloaded\n"); + state(conn, SSH_STOP); + break; + } + else { + Curl_setup_transfer(conn, FIRSTSOCKET, data->req.size, + FALSE, NULL, -1, NULL); + + /* not set by Curl_setup_transfer to preserve keepon bits */ + conn->writesockfd = conn->sockfd; + + /* FIXME: here should be explained why we need it to start the + * download */ + conn->cselect_bits = CURL_CSELECT_IN; + } + if(result) { + state(conn, SSH_SFTP_CLOSE); + sshc->actualcode = result; + } + else { + state(conn, SSH_STOP); + } + break; + + case SSH_SFTP_CLOSE: + if(sshc->sftp_handle) { + rc = libssh2_sftp_close(sshc->sftp_handle); + if(rc == LIBSSH2_ERROR_EAGAIN) { + break; + } + else if(rc < 0) { + infof(data, "Failed to close libssh2 file\n"); + } + sshc->sftp_handle = NULL; + } + Curl_safefree(sftp_scp->path); + sftp_scp->path = NULL; + + DEBUGF(infof(data, "SFTP DONE done\n")); +#if 0 /* PREV */ + state(conn, SSH_SFTP_SHUTDOWN); +#endif + state(conn, SSH_STOP); + result = sshc->actualcode; + break; + + case SSH_SFTP_SHUTDOWN: + /* during times we get here due to a broken transfer and then the + sftp_handle might not have been taken down so make sure that is done + before we proceed */ + + if(sshc->sftp_handle) { + rc = libssh2_sftp_close(sshc->sftp_handle); + if(rc == LIBSSH2_ERROR_EAGAIN) { + break; + } + else if(rc < 0) { + infof(data, "Failed to close libssh2 file\n"); + } + sshc->sftp_handle = NULL; + } + if(sshc->sftp_session) { + rc = libssh2_sftp_shutdown(sshc->sftp_session); + if(rc == LIBSSH2_ERROR_EAGAIN) { + break; + } + else if(rc < 0) { + infof(data, "Failed to stop libssh2 sftp subsystem\n"); + } + sshc->sftp_session = NULL; + } + + Curl_safefree(sshc->homedir); + sshc->homedir = NULL; + + state(conn, SSH_SESSION_DISCONNECT); + break; + + case SSH_SCP_TRANS_INIT: + result = ssh_getworkingpath(conn, sshc->homedir, &sftp_scp->path); + if(result) { + sshc->actualcode = result; + state(conn, SSH_STOP); + break; + } + + if(data->set.upload) { + if(data->set.infilesize < 0) { + failf(data, "SCP requires a known file size for upload"); + sshc->actualcode = CURLE_UPLOAD_FAILED; + state(conn, SSH_SCP_CHANNEL_FREE); + break; + } + state(conn, SSH_SCP_UPLOAD_INIT); + } + else { + state(conn, SSH_SCP_DOWNLOAD_INIT); + } + break; + + case SSH_SCP_UPLOAD_INIT: + /* + * libssh2 requires that the destination path is a full path that + * includes the destination file and name OR ends in a "/" . If this is + * not done the destination file will be named the same name as the last + * directory in the path. + */ + sshc->ssh_channel = + SCP_SEND(sshc->ssh_session, sftp_scp->path, data->set.new_file_perms, + data->set.infilesize); + if(!sshc->ssh_channel) { + if(libssh2_session_last_errno(sshc->ssh_session) == + LIBSSH2_ERROR_EAGAIN) { + rc = LIBSSH2_ERROR_EAGAIN; + break; + } + else { + int ssh_err; + char *err_msg; + + ssh_err = (int)(libssh2_session_last_error(sshc->ssh_session, + &err_msg, NULL, 0)); + failf(conn->data, "%s", err_msg); + state(conn, SSH_SCP_CHANNEL_FREE); + sshc->actualcode = libssh2_session_error_to_CURLE(ssh_err); + break; + } + } + + /* upload data */ + Curl_setup_transfer(conn, -1, data->req.size, FALSE, NULL, + FIRSTSOCKET, NULL); + + /* not set by Curl_setup_transfer to preserve keepon bits */ + conn->sockfd = conn->writesockfd; + + if(result) { + state(conn, SSH_SCP_CHANNEL_FREE); + sshc->actualcode = result; + } + else { + state(conn, SSH_STOP); + } + break; + + case SSH_SCP_DOWNLOAD_INIT: + { + /* + * We must check the remote file; if it is a directory no values will + * be set in sb + */ + struct stat sb; + curl_off_t bytecount; + + /* clear the struct scp recv will fill in */ + memset(&sb, 0, sizeof(struct stat)); + + /* get a fresh new channel from the ssh layer */ + sshc->ssh_channel = libssh2_scp_recv(sshc->ssh_session, + sftp_scp->path, &sb); + if(!sshc->ssh_channel) { + if(libssh2_session_last_errno(sshc->ssh_session) == + LIBSSH2_ERROR_EAGAIN) { + rc = LIBSSH2_ERROR_EAGAIN; + break; + } + else { + int ssh_err; + char *err_msg; + + ssh_err = (int)(libssh2_session_last_error(sshc->ssh_session, + &err_msg, NULL, 0)); + failf(conn->data, "%s", err_msg); + state(conn, SSH_SCP_CHANNEL_FREE); + sshc->actualcode = libssh2_session_error_to_CURLE(ssh_err); + break; + } + } + + /* download data */ + bytecount = (curl_off_t)sb.st_size; + data->req.maxdownload = (curl_off_t)sb.st_size; + Curl_setup_transfer(conn, FIRSTSOCKET, bytecount, FALSE, NULL, -1, NULL); + + /* not set by Curl_setup_transfer to preserve keepon bits */ + conn->writesockfd = conn->sockfd; + + /* FIXME: here should be explained why we need it to start the + * download */ + conn->cselect_bits = CURL_CSELECT_IN; + + if(result) { + state(conn, SSH_SCP_CHANNEL_FREE); + sshc->actualcode = result; + } + else + state(conn, SSH_STOP); + } + break; + + case SSH_SCP_DONE: + if(data->set.upload) + state(conn, SSH_SCP_SEND_EOF); + else + state(conn, SSH_SCP_CHANNEL_FREE); + break; + + case SSH_SCP_SEND_EOF: + if(sshc->ssh_channel) { + rc = libssh2_channel_send_eof(sshc->ssh_channel); + if(rc == LIBSSH2_ERROR_EAGAIN) { + break; + } + else if(rc) { + infof(data, "Failed to send libssh2 channel EOF\n"); + } + } + state(conn, SSH_SCP_WAIT_EOF); + break; + + case SSH_SCP_WAIT_EOF: + if(sshc->ssh_channel) { + rc = libssh2_channel_wait_eof(sshc->ssh_channel); + if(rc == LIBSSH2_ERROR_EAGAIN) { + break; + } + else if(rc) { + infof(data, "Failed to get channel EOF: %d\n", rc); + } + } + state(conn, SSH_SCP_WAIT_CLOSE); + break; + + case SSH_SCP_WAIT_CLOSE: + if(sshc->ssh_channel) { + rc = libssh2_channel_wait_closed(sshc->ssh_channel); + if(rc == LIBSSH2_ERROR_EAGAIN) { + break; + } + else if(rc) { + infof(data, "Channel failed to close: %d\n", rc); + } + } + state(conn, SSH_SCP_CHANNEL_FREE); + break; + + case SSH_SCP_CHANNEL_FREE: + if(sshc->ssh_channel) { + rc = libssh2_channel_free(sshc->ssh_channel); + if(rc == LIBSSH2_ERROR_EAGAIN) { + break; + } + else if(rc < 0) { + infof(data, "Failed to free libssh2 scp subsystem\n"); + } + sshc->ssh_channel = NULL; + } + DEBUGF(infof(data, "SCP DONE phase complete\n")); +#if 0 /* PREV */ + state(conn, SSH_SESSION_DISCONNECT); +#endif + state(conn, SSH_STOP); + result = sshc->actualcode; + break; + + case SSH_SESSION_DISCONNECT: + /* during weird times when we've been prematurely aborted, the channel + is still alive when we reach this state and we MUST kill the channel + properly first */ + if(sshc->ssh_channel) { + rc = libssh2_channel_free(sshc->ssh_channel); + if(rc == LIBSSH2_ERROR_EAGAIN) { + break; + } + else if(rc < 0) { + infof(data, "Failed to free libssh2 scp subsystem\n"); + } + sshc->ssh_channel = NULL; + } + + if(sshc->ssh_session) { + rc = libssh2_session_disconnect(sshc->ssh_session, "Shutdown"); + if(rc == LIBSSH2_ERROR_EAGAIN) { + break; + } + else if(rc < 0) { + infof(data, "Failed to disconnect libssh2 session\n"); + } + } + + Curl_safefree(sshc->homedir); + sshc->homedir = NULL; + + state(conn, SSH_SESSION_FREE); + break; + + case SSH_SESSION_FREE: +#ifdef HAVE_LIBSSH2_KNOWNHOST_API + if(sshc->kh) { + libssh2_knownhost_free(sshc->kh); + sshc->kh = NULL; + } +#endif + + if(sshc->ssh_session) { + rc = libssh2_session_free(sshc->ssh_session); + if(rc == LIBSSH2_ERROR_EAGAIN) { + break; + } + else if(rc < 0) { + infof(data, "Failed to free libssh2 session\n"); + } + sshc->ssh_session = NULL; + } + conn->bits.close = TRUE; + sshc->nextstate = SSH_NO_STATE; + state(conn, SSH_STOP); + result = sshc->actualcode; + break; + + case SSH_QUIT: + /* fallthrough, just stop! */ + default: + /* internal error */ + sshc->nextstate = SSH_NO_STATE; + state(conn, SSH_STOP); + break; + } + + } while(!rc && (sshc->state != SSH_STOP)); + + if(rc == LIBSSH2_ERROR_EAGAIN) { + /* we would block, we need to wait for the socket to be ready (in the + right direction too)! */ + *block = TRUE; + } + + return result; +} + +/* called by the multi interface to figure out what socket(s) to wait for and + for what actions in the DO_DONE, PERFORM and WAITPERFORM states */ +static int ssh_perform_getsock(const struct connectdata *conn, + curl_socket_t *sock, /* points to numsocks + number of sockets */ + int numsocks) +{ +#ifdef HAVE_LIBSSH2_SESSION_BLOCK_DIRECTION + int bitmap = GETSOCK_BLANK; + (void)numsocks; + + sock[0] = conn->sock[FIRSTSOCKET]; + + if(conn->waitfor & KEEP_RECV) + bitmap |= GETSOCK_READSOCK(FIRSTSOCKET); + + if(conn->waitfor & KEEP_SEND) + bitmap |= GETSOCK_WRITESOCK(FIRSTSOCKET); + + return bitmap; +#else + /* if we don't know the direction we can use the generic *_getsock() + function even for the protocol_connect and doing states */ + return Curl_single_getsock(conn, sock, numsocks); +#endif +} + +/* Generic function called by the multi interface to figure out what socket(s) + to wait for and for what actions during the DOING and PROTOCONNECT states*/ +static int ssh_getsock(struct connectdata *conn, + curl_socket_t *sock, /* points to numsocks number + of sockets */ + int numsocks) +{ +#ifndef HAVE_LIBSSH2_SESSION_BLOCK_DIRECTION + (void)conn; + (void)sock; + (void)numsocks; + /* if we don't know any direction we can just play along as we used to and + not provide any sensible info */ + return GETSOCK_BLANK; +#else + /* if we know the direction we can use the generic *_getsock() function even + for the protocol_connect and doing states */ + return ssh_perform_getsock(conn, sock, numsocks); +#endif +} + +#ifdef HAVE_LIBSSH2_SESSION_BLOCK_DIRECTION +/* + * When one of the libssh2 functions has returned LIBSSH2_ERROR_EAGAIN this + * function is used to figure out in what direction and stores this info so + * that the multi interface can take advantage of it. Make sure to call this + * function in all cases so that when it _doesn't_ return EAGAIN we can + * restore the default wait bits. + */ +static void ssh_block2waitfor(struct connectdata *conn, bool block) +{ + struct ssh_conn *sshc = &conn->proto.sshc; + int dir; + if(!block) + conn->waitfor = 0; + else if((dir = libssh2_session_block_directions(sshc->ssh_session))) { + /* translate the libssh2 define bits into our own bit defines */ + conn->waitfor = ((dir&LIBSSH2_SESSION_BLOCK_INBOUND)?KEEP_RECV:0) | + ((dir&LIBSSH2_SESSION_BLOCK_OUTBOUND)?KEEP_SEND:0); + } + else + /* It didn't block or libssh2 didn't reveal in which direction, put back + the original set */ + conn->waitfor = sshc->orig_waitfor; +} +#else + /* no libssh2 directional support so we simply don't know */ +#define ssh_block2waitfor(x,y) +#endif + +/* called repeatedly until done from multi.c */ +static CURLcode ssh_multi_statemach(struct connectdata *conn, bool *done) +{ + struct ssh_conn *sshc = &conn->proto.sshc; + CURLcode result = CURLE_OK; + bool block; /* we store the status and use that to provide a ssh_getsock() + implementation */ + + result = ssh_statemach_act(conn, &block); + *done = (bool)(sshc->state == SSH_STOP); + ssh_block2waitfor(conn, block); + + return result; +} + +static CURLcode ssh_easy_statemach(struct connectdata *conn, + bool duringconnect) +{ + struct ssh_conn *sshc = &conn->proto.sshc; + CURLcode result = CURLE_OK; + struct SessionHandle *data = conn->data; + + while((sshc->state != SSH_STOP) && !result) { + bool block; + long left; + + result = ssh_statemach_act(conn, &block); + + if(Curl_pgrsUpdate(conn)) + return CURLE_ABORTED_BY_CALLBACK; + + left = Curl_timeleft(conn, NULL, duringconnect); + if(left < 0) { + failf(data, "Operation timed out\n"); + return CURLE_OPERATION_TIMEDOUT; + } + +#ifdef HAVE_LIBSSH2_SESSION_BLOCK_DIRECTION + if((CURLE_OK == result) && block) { + int dir = libssh2_session_block_directions(sshc->ssh_session); + curl_socket_t sock = conn->sock[FIRSTSOCKET]; + curl_socket_t fd_read = CURL_SOCKET_BAD; + curl_socket_t fd_write = CURL_SOCKET_BAD; + if (LIBSSH2_SESSION_BLOCK_INBOUND & dir) { + fd_read = sock; + } + if (LIBSSH2_SESSION_BLOCK_OUTBOUND & dir) { + fd_write = sock; + } + /* wait for the socket to become ready */ + Curl_socket_ready(fd_read, fd_write, + (int)(left>1000?1000:left)); /* ignore result */ + } +#endif + + } + + return result; +} + +/* + * SSH setup and connection + */ +static CURLcode ssh_init(struct connectdata *conn) +{ + struct SessionHandle *data = conn->data; + struct SSHPROTO *ssh; + struct ssh_conn *sshc = &conn->proto.sshc; + + sshc->actualcode = CURLE_OK; /* reset error code */ + sshc->secondCreateDirs =0; /* reset the create dir attempt state + variable */ + + if(data->state.proto.ssh) + return CURLE_OK; + + ssh = calloc(1, sizeof(struct SSHPROTO)); + if(!ssh) + return CURLE_OUT_OF_MEMORY; + + data->state.proto.ssh = ssh; + + return CURLE_OK; +} + +static Curl_recv scp_recv, sftp_recv; +static Curl_send scp_send, sftp_send; + +/* + * Curl_ssh_connect() gets called from Curl_protocol_connect() to allow us to + * do protocol-specific actions at connect-time. + */ +static CURLcode ssh_connect(struct connectdata *conn, bool *done) +{ +#ifdef CURL_LIBSSH2_DEBUG + curl_socket_t sock; +#endif + struct ssh_conn *ssh; + CURLcode result; + struct SessionHandle *data = conn->data; + + /* We default to persistent connections. We set this already in this connect + function to make the re-use checks properly be able to check this bit. */ + conn->bits.close = FALSE; + + /* If there already is a protocol-specific struct allocated for this + sessionhandle, deal with it */ + Curl_reset_reqproto(conn); + + result = ssh_init(conn); + if(result) + return result; + + if(conn->protocol & PROT_SCP) { + conn->recv[FIRSTSOCKET] = scp_recv; + conn->send[FIRSTSOCKET] = scp_send; + } else { + conn->recv[FIRSTSOCKET] = sftp_recv; + conn->send[FIRSTSOCKET] = sftp_send; + } + ssh = &conn->proto.sshc; + +#ifdef CURL_LIBSSH2_DEBUG + if(conn->user) { + infof(data, "User: %s\n", conn->user); + } + if(conn->passwd) { + infof(data, "Password: %s\n", conn->passwd); + } + sock = conn->sock[FIRSTSOCKET]; +#endif /* CURL_LIBSSH2_DEBUG */ + + ssh->ssh_session = libssh2_session_init_ex(my_libssh2_malloc, + my_libssh2_free, + my_libssh2_realloc, conn); + if(ssh->ssh_session == NULL) { + failf(data, "Failure initialising ssh session"); + return CURLE_FAILED_INIT; + } + +#ifdef HAVE_LIBSSH2_KNOWNHOST_API + if(data->set.str[STRING_SSH_KNOWNHOSTS]) { + int rc; + ssh->kh = libssh2_knownhost_init(ssh->ssh_session); + if(!ssh->kh) { + /* eeek. TODO: free the ssh_session! */ + return CURLE_FAILED_INIT; + } + + /* read all known hosts from there */ + rc = libssh2_knownhost_readfile(ssh->kh, + data->set.str[STRING_SSH_KNOWNHOSTS], + LIBSSH2_KNOWNHOST_FILE_OPENSSH); + if(rc) { + infof(data, "Failed to read known hosts from %s\n", + data->set.str[STRING_SSH_KNOWNHOSTS]); + } + } +#endif /* HAVE_LIBSSH2_KNOWNHOST_API */ + +#ifdef CURL_LIBSSH2_DEBUG + libssh2_trace(ssh->ssh_session, ~0); + infof(data, "SSH socket: %d\n", (int)sock); +#endif /* CURL_LIBSSH2_DEBUG */ + + state(conn, SSH_S_STARTUP); + + if(data->state.used_interface == Curl_if_multi) + result = ssh_multi_statemach(conn, done); + else { + result = ssh_easy_statemach(conn, TRUE); + if(!result) + *done = TRUE; + } + + return result; +} + +/* + *********************************************************************** + * + * scp_perform() + * + * This is the actual DO function for SCP. Get a file according to + * the options previously setup. + */ + +static +CURLcode scp_perform(struct connectdata *conn, + bool *connected, + bool *dophase_done) +{ + CURLcode result = CURLE_OK; + + DEBUGF(infof(conn->data, "DO phase starts\n")); + + *dophase_done = FALSE; /* not done yet */ + + /* start the first command in the DO phase */ + state(conn, SSH_SCP_TRANS_INIT); + + /* run the state-machine */ + if(conn->data->state.used_interface == Curl_if_multi) { + result = ssh_multi_statemach(conn, dophase_done); + } + else { + result = ssh_easy_statemach(conn, FALSE); + *dophase_done = TRUE; /* with the easy interface we are done here */ + } + *connected = conn->bits.tcpconnect; + + if(*dophase_done) { + DEBUGF(infof(conn->data, "DO phase is complete\n")); + } + + return result; +} + +/* called from multi.c while DOing */ +static CURLcode scp_doing(struct connectdata *conn, + bool *dophase_done) +{ + CURLcode result; + result = ssh_multi_statemach(conn, dophase_done); + + if(*dophase_done) { + DEBUGF(infof(conn->data, "DO phase is complete\n")); + } + return result; +} + +/* + * The DO function is generic for both protocols. There was previously two + * separate ones but this way means less duplicated code. + */ + +static CURLcode ssh_do(struct connectdata *conn, bool *done) +{ + CURLcode res; + bool connected = 0; + struct SessionHandle *data = conn->data; + + *done = FALSE; /* default to false */ + + /* + Since connections can be re-used between SessionHandles, this might be a + connection already existing but on a fresh SessionHandle struct so we must + make sure we have a good 'struct SSHPROTO' to play with. For new + connections, the struct SSHPROTO is allocated and setup in the + ssh_connect() function. + */ + Curl_reset_reqproto(conn); + res = ssh_init(conn); + if(res) + return res; + + data->req.size = -1; /* make sure this is unknown at this point */ + + Curl_pgrsSetUploadCounter(data, 0); + Curl_pgrsSetDownloadCounter(data, 0); + Curl_pgrsSetUploadSize(data, 0); + Curl_pgrsSetDownloadSize(data, 0); + + if(conn->protocol & PROT_SCP) + res = scp_perform(conn, &connected, done); + else + res = sftp_perform(conn, &connected, done); + + return res; +} + +/* BLOCKING, but the function is using the state machine so the only reason + this is still blocking is that the multi interface code has no support for + disconnecting operations that takes a while */ +static CURLcode scp_disconnect(struct connectdata *conn, bool dead_connection) +{ + CURLcode result = CURLE_OK; + struct ssh_conn *ssh = &conn->proto.sshc; + (void) dead_connection; + + Curl_safefree(conn->data->state.proto.ssh); + conn->data->state.proto.ssh = NULL; + + if(ssh->ssh_session) { + /* only if there's a session still around to use! */ + + state(conn, SSH_SESSION_DISCONNECT); + + result = ssh_easy_statemach(conn, FALSE); + } + + return result; +} + +/* generic done function for both SCP and SFTP called from their specific + done functions */ +static CURLcode ssh_done(struct connectdata *conn, CURLcode status) +{ + CURLcode result = CURLE_OK; + struct SSHPROTO *sftp_scp = conn->data->state.proto.ssh; + + if(status == CURLE_OK) { + /* run the state-machine + + TODO: when the multi interface is used, this _really_ should be using + the ssh_multi_statemach function but we have no general support for + non-blocking DONE operations, not in the multi state machine and with + Curl_done() invokes on several places in the code! + */ + result = ssh_easy_statemach(conn, FALSE); + } + else + result = status; + + Curl_safefree(sftp_scp->path); + sftp_scp->path = NULL; + Curl_pgrsDone(conn); + + conn->data->req.keepon = 0; /* clear all bits */ + return result; +} + + +static CURLcode scp_done(struct connectdata *conn, CURLcode status, + bool premature) +{ + (void)premature; /* not used */ + + if(status == CURLE_OK) + state(conn, SSH_SCP_DONE); + + return ssh_done(conn, status); + +} + +/* return number of received (decrypted) bytes */ +static ssize_t scp_send(struct connectdata *conn, int sockindex, + const void *mem, size_t len, CURLcode *err) +{ + ssize_t nwrite; + (void)sockindex; /* we only support SCP on the fixed known primary socket */ + + /* libssh2_channel_write() returns int! */ + nwrite = (ssize_t) + libssh2_channel_write(conn->proto.sshc.ssh_channel, mem, len); + + ssh_block2waitfor(conn, (nwrite == LIBSSH2_ERROR_EAGAIN)?TRUE:FALSE); + + if(nwrite == LIBSSH2_ERROR_EAGAIN) { + *err = CURLE_AGAIN; + nwrite = 0; + } + + return nwrite; +} + +/* + * If the read would block (EWOULDBLOCK) we return -1. Otherwise we return + * a regular CURLcode value. + */ +static ssize_t scp_recv(struct connectdata *conn, int sockindex, + char *mem, size_t len, CURLcode *err) +{ + ssize_t nread; + (void)sockindex; /* we only support SCP on the fixed known primary socket */ + + /* libssh2_channel_read() returns int */ + nread = (ssize_t) + libssh2_channel_read(conn->proto.sshc.ssh_channel, mem, len); + + ssh_block2waitfor(conn, (nread == LIBSSH2_ERROR_EAGAIN)?TRUE:FALSE); + if (nread == LIBSSH2_ERROR_EAGAIN) { + *err = CURLE_AGAIN; + nread = -1; + } + + return nread; +} + +/* + * =============== SFTP =============== + */ + +/* + *********************************************************************** + * + * sftp_perform() + * + * This is the actual DO function for SFTP. Get a file/directory according to + * the options previously setup. + */ + +static +CURLcode sftp_perform(struct connectdata *conn, + bool *connected, + bool *dophase_done) +{ + CURLcode result = CURLE_OK; + + DEBUGF(infof(conn->data, "DO phase starts\n")); + + *dophase_done = FALSE; /* not done yet */ + + /* start the first command in the DO phase */ + state(conn, SSH_SFTP_QUOTE_INIT); + + /* run the state-machine */ + if(conn->data->state.used_interface == Curl_if_multi) { + result = ssh_multi_statemach(conn, dophase_done); + } + else { + result = ssh_easy_statemach(conn, FALSE); + *dophase_done = TRUE; /* with the easy interface we are done here */ + } + *connected = conn->bits.tcpconnect; + + if(*dophase_done) { + DEBUGF(infof(conn->data, "DO phase is complete\n")); + } + + return result; +} + +/* called from multi.c while DOing */ +static CURLcode sftp_doing(struct connectdata *conn, + bool *dophase_done) +{ + CURLcode result; + result = ssh_multi_statemach(conn, dophase_done); + + if(*dophase_done) { + DEBUGF(infof(conn->data, "DO phase is complete\n")); + } + return result; +} + +/* BLOCKING, but the function is using the state machine so the only reason + this is still blocking is that the multi interface code has no support for + disconnecting operations that takes a while */ +static CURLcode sftp_disconnect(struct connectdata *conn, bool dead_connection) +{ + CURLcode result = CURLE_OK; + (void) dead_connection; + + DEBUGF(infof(conn->data, "SSH DISCONNECT starts now\n")); + + Curl_safefree(conn->data->state.proto.ssh); + conn->data->state.proto.ssh = NULL; + + if(conn->proto.sshc.ssh_session) { + /* only if there's a session still around to use! */ + state(conn, SSH_SFTP_SHUTDOWN); + result = ssh_easy_statemach(conn, FALSE); + } + + DEBUGF(infof(conn->data, "SSH DISCONNECT is done\n")); + + return result; + +} + +static CURLcode sftp_done(struct connectdata *conn, CURLcode status, + bool premature) +{ + struct ssh_conn *sshc = &conn->proto.sshc; + + if(status == CURLE_OK) { + /* Before we shut down, see if there are any post-quote commands to + send: */ + if(!status && !premature && conn->data->set.postquote) { + sshc->nextstate = SSH_SFTP_CLOSE; + state(conn, SSH_SFTP_POSTQUOTE_INIT); + } + else + state(conn, SSH_SFTP_CLOSE); + } + return ssh_done(conn, status); +} + +/* return number of sent bytes */ +static ssize_t sftp_send(struct connectdata *conn, int sockindex, + const void *mem, size_t len, CURLcode *err) +{ + ssize_t nwrite; /* libssh2_sftp_write() used to return size_t in 0.14 + but is changed to ssize_t in 0.15. These days we don't + support libssh2 0.15*/ + (void)sockindex; + + nwrite = libssh2_sftp_write(conn->proto.sshc.sftp_handle, mem, len); + + ssh_block2waitfor(conn, (nwrite == LIBSSH2_ERROR_EAGAIN)?TRUE:FALSE); + + if(nwrite == LIBSSH2_ERROR_EAGAIN) { + *err = CURLE_AGAIN; + nwrite = 0; + } + + return nwrite; +} + +/* + * Return number of received (decrypted) bytes + */ +static ssize_t sftp_recv(struct connectdata *conn, int sockindex, + char *mem, size_t len, CURLcode *err) +{ + ssize_t nread; + (void)sockindex; + + nread = libssh2_sftp_read(conn->proto.sshc.sftp_handle, mem, len); + + ssh_block2waitfor(conn, (nread == LIBSSH2_ERROR_EAGAIN)?TRUE:FALSE); + + if(nread == LIBSSH2_ERROR_EAGAIN) { + *err = CURLE_AGAIN; + nread = -1; + } + return nread; +} + +/* The get_pathname() function is being borrowed from OpenSSH sftp.c + version 4.6p1. */ +/* + * Copyright (c) 2001-2004 Damien Miller + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ +static CURLcode +get_pathname(const char **cpp, char **path) +{ + const char *cp = *cpp, *end; + char quot; + unsigned int i, j; + static const char WHITESPACE[] = " \t\r\n"; + + cp += strspn(cp, WHITESPACE); + if(!*cp) { + *cpp = cp; + *path = NULL; + return CURLE_QUOTE_ERROR; + } + + *path = malloc(strlen(cp) + 1); + if(*path == NULL) + return CURLE_OUT_OF_MEMORY; + + /* Check for quoted filenames */ + if(*cp == '\"' || *cp == '\'') { + quot = *cp++; + + /* Search for terminating quote, unescape some chars */ + for (i = j = 0; i <= strlen(cp); i++) { + if(cp[i] == quot) { /* Found quote */ + i++; + (*path)[j] = '\0'; + break; + } + if(cp[i] == '\0') { /* End of string */ + /*error("Unterminated quote");*/ + goto fail; + } + if(cp[i] == '\\') { /* Escaped characters */ + i++; + if(cp[i] != '\'' && cp[i] != '\"' && + cp[i] != '\\') { + /*error("Bad escaped character '\\%c'", + cp[i]);*/ + goto fail; + } + } + (*path)[j++] = cp[i]; + } + + if(j == 0) { + /*error("Empty quotes");*/ + goto fail; + } + *cpp = cp + i + strspn(cp + i, WHITESPACE); + } + else { + /* Read to end of filename */ + end = strpbrk(cp, WHITESPACE); + if(end == NULL) + end = strchr(cp, '\0'); + *cpp = end + strspn(end, WHITESPACE); + + memcpy(*path, cp, end - cp); + (*path)[end - cp] = '\0'; + } + return CURLE_OK; + + fail: + Curl_safefree(*path); + *path = NULL; + return CURLE_QUOTE_ERROR; +} + + +static const char *sftp_libssh2_strerror(unsigned long err) +{ + switch (err) { + case LIBSSH2_FX_NO_SUCH_FILE: + return "No such file or directory"; + + case LIBSSH2_FX_PERMISSION_DENIED: + return "Permission denied"; + + case LIBSSH2_FX_FAILURE: + return "Operation failed"; + + case LIBSSH2_FX_BAD_MESSAGE: + return "Bad message from SFTP server"; + + case LIBSSH2_FX_NO_CONNECTION: + return "Not connected to SFTP server"; + + case LIBSSH2_FX_CONNECTION_LOST: + return "Connection to SFTP server lost"; + + case LIBSSH2_FX_OP_UNSUPPORTED: + return "Operation not supported by SFTP server"; + + case LIBSSH2_FX_INVALID_HANDLE: + return "Invalid handle"; + + case LIBSSH2_FX_NO_SUCH_PATH: + return "No such file or directory"; + + case LIBSSH2_FX_FILE_ALREADY_EXISTS: + return "File already exists"; + + case LIBSSH2_FX_WRITE_PROTECT: + return "File is write protected"; + + case LIBSSH2_FX_NO_MEDIA: + return "No media"; + + case LIBSSH2_FX_NO_SPACE_ON_FILESYSTEM: + return "Disk full"; + + case LIBSSH2_FX_QUOTA_EXCEEDED: + return "User quota exceeded"; + + case LIBSSH2_FX_UNKNOWN_PRINCIPLE: + return "Unknown principle"; + + case LIBSSH2_FX_LOCK_CONFlICT: + return "File lock conflict"; + + case LIBSSH2_FX_DIR_NOT_EMPTY: + return "Directory not empty"; + + case LIBSSH2_FX_NOT_A_DIRECTORY: + return "Not a directory"; + + case LIBSSH2_FX_INVALID_FILENAME: + return "Invalid filename"; + + case LIBSSH2_FX_LINK_LOOP: + return "Link points to itself"; + } + return "Unknown error in libssh2"; +} + +#endif /* USE_LIBSSH2 */ diff --git a/mobicore/common/curl/lib/ssh.h b/mobicore/common/curl/lib/ssh.h new file mode 100644 index 0000000000000000000000000000000000000000..406220cc41ff48797dd9200c49f93d0c7da8f2f9 --- /dev/null +++ b/mobicore/common/curl/lib/ssh.h @@ -0,0 +1,171 @@ +#ifndef HEADER_CURL_SSH_H +#define HEADER_CURL_SSH_H +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) 1998 - 2010, Daniel Stenberg, , et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at http://curl.haxx.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ***************************************************************************/ + +#include "setup.h" + +#ifdef HAVE_LIBSSH2_H +#include +#include +#endif /* HAVE_LIBSSH2_H */ + +/**************************************************************************** + * SSH unique setup + ***************************************************************************/ +typedef enum { + SSH_NO_STATE = -1, /* Used for "nextState" so say there is none */ + SSH_STOP = 0, /* do nothing state, stops the state machine */ + + SSH_S_STARTUP, /* Session startup, First state in SSH-CONNECT */ + SSH_HOSTKEY, /* verify hostkey */ + SSH_AUTHLIST, + SSH_AUTH_PKEY_INIT, + SSH_AUTH_PKEY, + SSH_AUTH_PASS_INIT, + SSH_AUTH_PASS, + SSH_AUTH_HOST_INIT, + SSH_AUTH_HOST, + SSH_AUTH_KEY_INIT, + SSH_AUTH_KEY, + SSH_AUTH_DONE, + SSH_SFTP_INIT, + SSH_SFTP_REALPATH, /* Last state in SSH-CONNECT */ + + SSH_SFTP_QUOTE_INIT, /* First state in SFTP-DO */ + SSH_SFTP_POSTQUOTE_INIT, /* (Possibly) First state in SFTP-DONE */ + SSH_SFTP_QUOTE, + SSH_SFTP_NEXT_QUOTE, + SSH_SFTP_QUOTE_STAT, + SSH_SFTP_QUOTE_SETSTAT, + SSH_SFTP_QUOTE_SYMLINK, + SSH_SFTP_QUOTE_MKDIR, + SSH_SFTP_QUOTE_RENAME, + SSH_SFTP_QUOTE_RMDIR, + SSH_SFTP_QUOTE_UNLINK, + SSH_SFTP_TRANS_INIT, + SSH_SFTP_UPLOAD_INIT, + SSH_SFTP_CREATE_DIRS_INIT, + SSH_SFTP_CREATE_DIRS, + SSH_SFTP_CREATE_DIRS_MKDIR, + SSH_SFTP_READDIR_INIT, + SSH_SFTP_READDIR, + SSH_SFTP_READDIR_LINK, + SSH_SFTP_READDIR_BOTTOM, + SSH_SFTP_READDIR_DONE, + SSH_SFTP_DOWNLOAD_INIT, + SSH_SFTP_DOWNLOAD_STAT, /* Last state in SFTP-DO */ + SSH_SFTP_CLOSE, /* Last state in SFTP-DONE */ + SSH_SFTP_SHUTDOWN, /* First state in SFTP-DISCONNECT */ + SSH_SCP_TRANS_INIT, /* First state in SCP-DO */ + SSH_SCP_UPLOAD_INIT, + SSH_SCP_DOWNLOAD_INIT, + SSH_SCP_DONE, + SSH_SCP_SEND_EOF, + SSH_SCP_WAIT_EOF, + SSH_SCP_WAIT_CLOSE, + SSH_SCP_CHANNEL_FREE, /* Last state in SCP-DONE */ + SSH_SESSION_DISCONNECT, /* First state in SCP-DISCONNECT */ + SSH_SESSION_FREE, /* Last state in SCP/SFTP-DISCONNECT */ + SSH_QUIT, + SSH_LAST /* never used */ +} sshstate; + +/* this struct is used in the HandleData struct which is part of the + SessionHandle, which means this is used on a per-easy handle basis. + Everything that is strictly related to a connection is banned from this + struct. */ +struct SSHPROTO { + char *path; /* the path we operate on */ +}; + +/* ssh_conn is used for struct connection-oriented data in the connectdata + struct */ +struct ssh_conn { + const char *authlist; /* List of auth. methods, managed by libssh2 */ +#ifdef USE_LIBSSH2 + const char *passphrase; /* pass-phrase to use */ + char *rsa_pub; /* path name */ + char *rsa; /* path name */ + bool authed; /* the connection has been authenticated fine */ + sshstate state; /* always use ssh.c:state() to change state! */ + sshstate nextstate; /* the state to goto after stopping */ + CURLcode actualcode; /* the actual error code */ + struct curl_slist *quote_item; /* for the quote option */ + char *quote_path1; /* two generic pointers for the QUOTE stuff */ + char *quote_path2; + LIBSSH2_SFTP_ATTRIBUTES quote_attrs; /* used by the SFTP_QUOTE state */ + char *homedir; /* when doing SFTP we figure out home dir in the + connect phase */ + + /* Here's a set of struct members used by the SFTP_READDIR state */ + LIBSSH2_SFTP_ATTRIBUTES readdir_attrs; + char *readdir_filename; + char *readdir_longentry; + int readdir_len, readdir_totalLen, readdir_currLen; + char *readdir_line; + char *readdir_linkPath; + /* end of READDIR stuff */ + + int secondCreateDirs; /* counter use by the code to see if the + second attempt has been made to change + to/create a directory */ + char *slash_pos; /* used by the SFTP_CREATE_DIRS state */ + LIBSSH2_SESSION *ssh_session; /* Secure Shell session */ + LIBSSH2_CHANNEL *ssh_channel; /* Secure Shell channel handle */ + LIBSSH2_SFTP *sftp_session; /* SFTP handle */ + LIBSSH2_SFTP_HANDLE *sftp_handle; + int orig_waitfor; /* default READ/WRITE bits wait for */ + + /* note that HAVE_LIBSSH2_KNOWNHOST_API is a define set in the libssh2.h + header */ +#ifdef HAVE_LIBSSH2_KNOWNHOST_API + LIBSSH2_KNOWNHOSTS *kh; +#endif +#endif /* USE_LIBSSH2 */ +}; + +#ifdef USE_LIBSSH2 + +#if !defined(LIBSSH2_VERSION_NUM) || (LIBSSH2_VERSION_NUM < 0x001000) +# error "SCP/SFTP protocols require libssh2 0.16 or later" +#endif + +#if defined(LIBSSH2_VERSION_NUM) && (LIBSSH2_VERSION_NUM >= 0x010000) +# define HAVE_LIBSSH2_SFTP_SEEK64 1 +#else +# undef HAVE_LIBSSH2_SFTP_SEEK64 +#endif + +#if defined(LIBSSH2_VERSION_NUM) && (LIBSSH2_VERSION_NUM >= 0x010206) +# define HAVE_LIBSSH2_SCP_SEND64 1 +#else +# undef HAVE_LIBSSH2_SCP_SEND64 +#endif + + +extern const struct Curl_handler Curl_handler_scp; +extern const struct Curl_handler Curl_handler_sftp; + +#endif /* USE_LIBSSH2 */ + +#endif /* HEADER_CURL_SSH_H */ diff --git a/mobicore/common/curl/lib/sslgen.c b/mobicore/common/curl/lib/sslgen.c new file mode 100644 index 0000000000000000000000000000000000000000..bd8dc17223a2830b9033b87627bb2e9c988242f1 --- /dev/null +++ b/mobicore/common/curl/lib/sslgen.c @@ -0,0 +1,472 @@ +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) 1998 - 2010, Daniel Stenberg, , et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at http://curl.haxx.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ***************************************************************************/ + +/* This file is for implementing all "generic" SSL functions that all libcurl + internals should use. It is then responsible for calling the proper + "backend" function. + + SSL-functions in libcurl should call functions in this source file, and not + to any specific SSL-layer. + + Curl_ssl_ - prefix for generic ones + Curl_ossl_ - prefix for OpenSSL ones + Curl_gtls_ - prefix for GnuTLS ones + Curl_nss_ - prefix for NSS ones + Curl_polarssl_ - prefix for PolarSSL ones + + Note that this source code uses curlssl_* functions, and they are all + defines/macros #defined by the lib-specific header files. + + "SSL/TLS Strong Encryption: An Introduction" + http://httpd.apache.org/docs-2.0/ssl/ssl_intro.html +*/ + +#include "setup.h" + +#include +#include +#include +#ifdef HAVE_SYS_SOCKET_H +#include +#endif + +#include "urldata.h" +#define SSLGEN_C +#include "sslgen.h" /* generic SSL protos etc */ +#include "ssluse.h" /* OpenSSL versions */ +#include "gtls.h" /* GnuTLS versions */ +#include "nssg.h" /* NSS versions */ +#include "qssl.h" /* QSOSSL versions */ +#include "polarssl.h" /* PolarSSL versions */ +#include "sendf.h" +#include "rawstr.h" +#include "url.h" +#include "curl_memory.h" +#include "progress.h" +/* The last #include file should be: */ +#include "memdebug.h" + +static bool safe_strequal(char* str1, char* str2) +{ + if(str1 && str2) + /* both pointers point to something then compare them */ + return (bool)(0 != Curl_raw_equal(str1, str2)); + else + /* if both pointers are NULL then treat them as equal */ + return (bool)(!str1 && !str2); +} + +bool +Curl_ssl_config_matches(struct ssl_config_data* data, + struct ssl_config_data* needle) +{ + if((data->version == needle->version) && + (data->verifypeer == needle->verifypeer) && + (data->verifyhost == needle->verifyhost) && + safe_strequal(data->CApath, needle->CApath) && + safe_strequal(data->CAfile, needle->CAfile) && + safe_strequal(data->random_file, needle->random_file) && + safe_strequal(data->egdsocket, needle->egdsocket) && + safe_strequal(data->cipher_list, needle->cipher_list)) + return TRUE; + + return FALSE; +} + +bool +Curl_clone_ssl_config(struct ssl_config_data *source, + struct ssl_config_data *dest) +{ + dest->sessionid = source->sessionid; + dest->verifyhost = source->verifyhost; + dest->verifypeer = source->verifypeer; + dest->version = source->version; + + if(source->CAfile) { + dest->CAfile = strdup(source->CAfile); + if(!dest->CAfile) + return FALSE; + } + else + dest->CAfile = NULL; + + if(source->CApath) { + dest->CApath = strdup(source->CApath); + if(!dest->CApath) + return FALSE; + } + else + dest->CApath = NULL; + + if(source->cipher_list) { + dest->cipher_list = strdup(source->cipher_list); + if(!dest->cipher_list) + return FALSE; + } + else + dest->cipher_list = NULL; + + if(source->egdsocket) { + dest->egdsocket = strdup(source->egdsocket); + if(!dest->egdsocket) + return FALSE; + } + else + dest->egdsocket = NULL; + + if(source->random_file) { + dest->random_file = strdup(source->random_file); + if(!dest->random_file) + return FALSE; + } + else + dest->random_file = NULL; + + return TRUE; +} + +void Curl_free_ssl_config(struct ssl_config_data* sslc) +{ + Curl_safefree(sslc->CAfile); + Curl_safefree(sslc->CApath); + Curl_safefree(sslc->cipher_list); + Curl_safefree(sslc->egdsocket); + Curl_safefree(sslc->random_file); +} + +#ifdef USE_SSL + +/* "global" init done? */ +static bool init_ssl=FALSE; + +/** + * Global SSL init + * + * @retval 0 error initializing SSL + * @retval 1 SSL initialized successfully + */ +int Curl_ssl_init(void) +{ + /* make sure this is only done once */ + if(init_ssl) + return 1; + init_ssl = TRUE; /* never again */ + + return curlssl_init(); +} + + +/* Global cleanup */ +void Curl_ssl_cleanup(void) +{ + if(init_ssl) { + /* only cleanup if we did a previous init */ + curlssl_cleanup(); + init_ssl = FALSE; + } +} + +CURLcode +Curl_ssl_connect(struct connectdata *conn, int sockindex) +{ + CURLcode res; + /* mark this is being ssl-enabled from here on. */ + conn->ssl[sockindex].use = TRUE; + conn->ssl[sockindex].state = ssl_connection_negotiating; + + res = curlssl_connect(conn, sockindex); + + if(!res) + Curl_pgrsTime(conn->data, TIMER_APPCONNECT); /* SSL is connected */ + + return res; +} + +CURLcode +Curl_ssl_connect_nonblocking(struct connectdata *conn, int sockindex, + bool *done) +{ +#ifdef curlssl_connect_nonblocking + CURLcode res; + /* mark this is being ssl requested from here on. */ + conn->ssl[sockindex].use = TRUE; + res = curlssl_connect_nonblocking(conn, sockindex, done); + if(!res && *done == TRUE) + Curl_pgrsTime(conn->data, TIMER_APPCONNECT); /* SSL is connected */ + return res; +#else + *done = TRUE; /* fallback to BLOCKING */ + conn->ssl[sockindex].use = TRUE; + return curlssl_connect(conn, sockindex); +#endif /* non-blocking connect support */ +} + +/* + * Check if there's a session ID for the given connection in the cache, and if + * there's one suitable, it is provided. Returns TRUE when no entry matched. + */ +int Curl_ssl_getsessionid(struct connectdata *conn, + void **ssl_sessionid, + size_t *idsize) /* set 0 if unknown */ +{ + struct curl_ssl_session *check; + struct SessionHandle *data = conn->data; + long i; + + if(!conn->ssl_config.sessionid) + /* session ID re-use is disabled */ + return TRUE; + + for(i=0; i< data->set.ssl.numsessions; i++) { + check = &data->state.session[i]; + if(!check->sessionid) + /* not session ID means blank entry */ + continue; + if(Curl_raw_equal(conn->host.name, check->name) && + (conn->remote_port == check->remote_port) && + Curl_ssl_config_matches(&conn->ssl_config, &check->ssl_config)) { + /* yes, we have a session ID! */ + data->state.sessionage++; /* increase general age */ + check->age = data->state.sessionage; /* set this as used in this age */ + *ssl_sessionid = check->sessionid; + if(idsize) + *idsize = check->idsize; + return FALSE; + } + } + *ssl_sessionid = NULL; + return TRUE; +} + +/* + * Kill a single session ID entry in the cache. + */ +static int kill_session(struct curl_ssl_session *session) +{ + if(session->sessionid) { + /* defensive check */ + + /* free the ID the SSL-layer specific way */ + curlssl_session_free(session->sessionid); + + session->sessionid=NULL; + session->age = 0; /* fresh */ + + Curl_free_ssl_config(&session->ssl_config); + + Curl_safefree(session->name); + session->name = NULL; /* no name */ + + return 0; /* ok */ + } + else + return 1; +} + +/* + * Delete the given session ID from the cache. + */ +void Curl_ssl_delsessionid(struct connectdata *conn, void *ssl_sessionid) +{ + int i; + for(i=0; i< conn->data->set.ssl.numsessions; i++) { + struct curl_ssl_session *check = &conn->data->state.session[i]; + + if (check->sessionid == ssl_sessionid) { + kill_session(check); + break; + } + } +} + +/* + * Store session id in the session cache. The ID passed on to this function + * must already have been extracted and allocated the proper way for the SSL + * layer. Curl_XXXX_session_free() will be called to free/kill the session ID + * later on. + */ +CURLcode Curl_ssl_addsessionid(struct connectdata *conn, + void *ssl_sessionid, + size_t idsize) +{ + long i; + struct SessionHandle *data=conn->data; /* the mother of all structs */ + struct curl_ssl_session *store = &data->state.session[0]; + long oldest_age=data->state.session[0].age; /* zero if unused */ + char *clone_host; + + /* Even though session ID re-use might be disabled, that only disables USING + IT. We still store it here in case the re-using is again enabled for an + upcoming transfer */ + + clone_host = strdup(conn->host.name); + if(!clone_host) + return CURLE_OUT_OF_MEMORY; /* bail out */ + + /* Now we should add the session ID and the host name to the cache, (remove + the oldest if necessary) */ + + /* find an empty slot for us, or find the oldest */ + for(i=1; (iset.ssl.numsessions) && + data->state.session[i].sessionid; i++) { + if(data->state.session[i].age < oldest_age) { + oldest_age = data->state.session[i].age; + store = &data->state.session[i]; + } + } + if(i == data->set.ssl.numsessions) + /* cache is full, we must "kill" the oldest entry! */ + kill_session(store); + else + store = &data->state.session[i]; /* use this slot */ + + /* now init the session struct wisely */ + store->sessionid = ssl_sessionid; + store->idsize = idsize; + store->age = data->state.sessionage; /* set current age */ + if (store->name) + /* free it if there's one already present */ + free(store->name); + store->name = clone_host; /* clone host name */ + store->remote_port = conn->remote_port; /* port number */ + + if(!Curl_clone_ssl_config(&conn->ssl_config, &store->ssl_config)) + return CURLE_OUT_OF_MEMORY; + + return CURLE_OK; +} + + +void Curl_ssl_close_all(struct SessionHandle *data) +{ + long i; + /* kill the session ID cache */ + if(data->state.session) { + for(i=0; i< data->set.ssl.numsessions; i++) + /* the single-killer function handles empty table slots */ + kill_session(&data->state.session[i]); + + /* free the cache data */ + free(data->state.session); + data->state.session = NULL; + } + + curlssl_close_all(data); +} + +void Curl_ssl_close(struct connectdata *conn, int sockindex) +{ + DEBUGASSERT((sockindex <= 1) && (sockindex >= -1)); + curlssl_close(conn, sockindex); +} + +CURLcode Curl_ssl_shutdown(struct connectdata *conn, int sockindex) +{ + if(curlssl_shutdown(conn, sockindex)) + return CURLE_SSL_SHUTDOWN_FAILED; + + conn->ssl[sockindex].use = FALSE; /* get back to ordinary socket usage */ + conn->ssl[sockindex].state = ssl_connection_none; + + return CURLE_OK; +} + +/* Selects an SSL crypto engine + */ +CURLcode Curl_ssl_set_engine(struct SessionHandle *data, const char *engine) +{ + return curlssl_set_engine(data, engine); +} + +/* Selects the default SSL crypto engine + */ +CURLcode Curl_ssl_set_engine_default(struct SessionHandle *data) +{ + return curlssl_set_engine_default(data); +} + +/* Return list of OpenSSL crypto engine names. */ +struct curl_slist *Curl_ssl_engines_list(struct SessionHandle *data) +{ + return curlssl_engines_list(data); +} + +/* + * This sets up a session ID cache to the specified size. Make sure this code + * is agnostic to what underlying SSL technology we use. + */ +CURLcode Curl_ssl_initsessions(struct SessionHandle *data, long amount) +{ + struct curl_ssl_session *session; + + if(data->state.session) + /* this is just a precaution to prevent multiple inits */ + return CURLE_OK; + + session = calloc(amount, sizeof(struct curl_ssl_session)); + if(!session) + return CURLE_OUT_OF_MEMORY; + + /* store the info in the SSL section */ + data->set.ssl.numsessions = amount; + data->state.session = session; + data->state.sessionage = 1; /* this is brand new */ + return CURLE_OK; +} + +size_t Curl_ssl_version(char *buffer, size_t size) +{ + return curlssl_version(buffer, size); +} + +/* + * This function tries to determine connection status. + * + * Return codes: + * 1 means the connection is still in place + * 0 means the connection has been closed + * -1 means the connection status is unknown + */ +int Curl_ssl_check_cxn(struct connectdata *conn) +{ + return curlssl_check_cxn(conn); +} + +bool Curl_ssl_data_pending(const struct connectdata *conn, + int connindex) +{ + return curlssl_data_pending(conn, connindex); +} + +void Curl_ssl_free_certinfo(struct SessionHandle *data) +{ + int i; + struct curl_certinfo *ci = &data->info.certs; + if(ci->num_of_certs) { + /* free all individual lists used */ + for(i=0; inum_of_certs; i++) + curl_slist_free_all(ci->certinfo[i]); + free(ci->certinfo); /* free the actual array too */ + ci->num_of_certs = 0; + } +} +#endif /* USE_SSL */ diff --git a/mobicore/common/curl/lib/sslgen.h b/mobicore/common/curl/lib/sslgen.h new file mode 100644 index 0000000000000000000000000000000000000000..997e30d35eb641853ae717417c5f3370b5326ea8 --- /dev/null +++ b/mobicore/common/curl/lib/sslgen.h @@ -0,0 +1,92 @@ +#ifndef __SSLGEN_H +#define __SSLGEN_H +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) 1998 - 2008, 2010, Daniel Stenberg, , et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at http://curl.haxx.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ***************************************************************************/ + +bool Curl_ssl_config_matches(struct ssl_config_data* data, + struct ssl_config_data* needle); +bool Curl_clone_ssl_config(struct ssl_config_data* source, + struct ssl_config_data* dest); +void Curl_free_ssl_config(struct ssl_config_data* sslc); + +#ifdef USE_SSL +int Curl_ssl_init(void); +void Curl_ssl_cleanup(void); +CURLcode Curl_ssl_connect(struct connectdata *conn, int sockindex); +CURLcode Curl_ssl_connect_nonblocking(struct connectdata *conn, + int sockindex, + bool *done); +/* tell the SSL stuff to close down all open information regarding + connections (and thus session ID caching etc) */ +void Curl_ssl_close_all(struct SessionHandle *data); +void Curl_ssl_close(struct connectdata *conn, int sockindex); +CURLcode Curl_ssl_shutdown(struct connectdata *conn, int sockindex); +CURLcode Curl_ssl_set_engine(struct SessionHandle *data, const char *engine); +/* Sets engine as default for all SSL operations */ +CURLcode Curl_ssl_set_engine_default(struct SessionHandle *data); +struct curl_slist *Curl_ssl_engines_list(struct SessionHandle *data); + +/* init the SSL session ID cache */ +CURLcode Curl_ssl_initsessions(struct SessionHandle *, long); +size_t Curl_ssl_version(char *buffer, size_t size); +bool Curl_ssl_data_pending(const struct connectdata *conn, + int connindex); +int Curl_ssl_check_cxn(struct connectdata *conn); +void Curl_ssl_free_certinfo(struct SessionHandle *data); + +/* Functions to be used by SSL library adaptation functions */ + +/* extract a session ID */ +int Curl_ssl_getsessionid(struct connectdata *conn, + void **ssl_sessionid, + size_t *idsize) /* set 0 if unknown */; +/* add a new session ID */ +CURLcode Curl_ssl_addsessionid(struct connectdata *conn, + void *ssl_sessionid, + size_t idsize); +/* delete a session from the cache */ +void Curl_ssl_delsessionid(struct connectdata *conn, void *ssl_sessionid); + +#define SSL_SHUTDOWN_TIMEOUT 10000 /* ms */ + +#else +/* When SSL support is not present, just define away these function calls */ +#define Curl_ssl_init() 1 +#define Curl_ssl_cleanup() do { } while (0) +#define Curl_ssl_connect(x,y) CURLE_FAILED_INIT +#define Curl_ssl_close_all(x) +#define Curl_ssl_close(x,y) +#define Curl_ssl_shutdown(x,y) CURLE_FAILED_INIT +#define Curl_ssl_set_engine(x,y) CURLE_FAILED_INIT +#define Curl_ssl_set_engine_default(x) CURLE_FAILED_INIT +#define Curl_ssl_engines_list(x) NULL +#define Curl_ssl_send(a,b,c,d,e) -1 +#define Curl_ssl_recv(a,b,c,d,e) -1 +#define Curl_ssl_initsessions(x,y) CURLE_OK +#define Curl_ssl_version(x,y) 0 +#define Curl_ssl_data_pending(x,y) 0 +#define Curl_ssl_check_cxn(x) 0 +#define Curl_ssl_free_certinfo(x) + +#endif + +#endif /* USE_SSL */ diff --git a/mobicore/common/curl/lib/ssluse.c b/mobicore/common/curl/lib/ssluse.c new file mode 100644 index 0000000000000000000000000000000000000000..d8f7760181edf151058e9d48524f86c14d58aeae --- /dev/null +++ b/mobicore/common/curl/lib/ssluse.c @@ -0,0 +1,2664 @@ +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) 1998 - 2010, Daniel Stenberg, , et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at http://curl.haxx.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ***************************************************************************/ + +/* + * Source file for all OpenSSL-specific code for the TLS/SSL layer. No code + * but sslgen.c should ever call or use these functions. + */ + +/* + * The original SSLeay-using code for curl was written by Linas Vepstas and + * Sampo Kellomaki 1998. + */ + +#include "setup.h" + +#include +#include +#include +#ifdef HAVE_LIMITS_H +#include +#endif +#ifdef HAVE_SYS_SOCKET_H +#include +#endif + +#include "urldata.h" +#include "sendf.h" +#include "formdata.h" /* for the boundary function */ +#include "url.h" /* for the ssl config check function */ +#include "inet_pton.h" +#include "ssluse.h" +#include "connect.h" +#include "strequal.h" +#include "select.h" +#include "sslgen.h" +#include "rawstr.h" + +#define _MPRINTF_REPLACE /* use the internal *printf() functions */ +#include + +#ifdef USE_SSLEAY + +#ifdef USE_OPENSSL +#include +#include +#include +#include +#include +#else +#include +#include +#endif + +#include "curl_memory.h" +#include "easyif.h" /* for Curl_convert_from_utf8 prototype */ + +/* The last #include file should be: */ +#include "memdebug.h" + +#if OPENSSL_VERSION_NUMBER >= 0x0090581fL +#define HAVE_SSL_GET1_SESSION 1 +#else +#undef HAVE_SSL_GET1_SESSION +#endif + +#if OPENSSL_VERSION_NUMBER >= 0x00904100L +#define HAVE_USERDATA_IN_PWD_CALLBACK 1 +#else +#undef HAVE_USERDATA_IN_PWD_CALLBACK +#endif + +#if OPENSSL_VERSION_NUMBER >= 0x00907001L +/* ENGINE_load_private_key() takes four arguments */ +#define HAVE_ENGINE_LOAD_FOUR_ARGS +#include +#else +/* ENGINE_load_private_key() takes three arguments */ +#undef HAVE_ENGINE_LOAD_FOUR_ARGS +#endif + +#if (OPENSSL_VERSION_NUMBER >= 0x00903001L) && defined(HAVE_OPENSSL_PKCS12_H) +/* OpenSSL has PKCS 12 support */ +#define HAVE_PKCS12_SUPPORT +#else +/* OpenSSL/SSLEay does not have PKCS12 support */ +#undef HAVE_PKCS12_SUPPORT +#endif + +#if OPENSSL_VERSION_NUMBER >= 0x00906001L +#define HAVE_ERR_ERROR_STRING_N 1 +#endif + +#if OPENSSL_VERSION_NUMBER >= 0x00909000L +#define SSL_METHOD_QUAL const +#else +#define SSL_METHOD_QUAL +#endif + +#if OPENSSL_VERSION_NUMBER >= 0x00907000L +/* 0.9.6 didn't have X509_STORE_set_flags() */ +#define HAVE_X509_STORE_SET_FLAGS 1 +#else +#define X509_STORE_set_flags(x,y) +#endif + +/* + * Number of bytes to read from the random number seed file. This must be + * a finite value (because some entropy "files" like /dev/urandom have + * an infinite length), but must be large enough to provide enough + * entopy to properly seed OpenSSL's PRNG. + */ +#define RAND_LOAD_LENGTH 1024 + +#ifndef HAVE_USERDATA_IN_PWD_CALLBACK +static char global_passwd[64]; +#endif + +static int passwd_callback(char *buf, int num, int verify +#ifdef HAVE_USERDATA_IN_PWD_CALLBACK + /* This was introduced in 0.9.4, we can set this + using SSL_CTX_set_default_passwd_cb_userdata() + */ + , void *global_passwd +#endif + ) +{ + if(verify) + fprintf(stderr, "%s\n", buf); + else { + if(num > (int)strlen((char *)global_passwd)) { + strcpy(buf, global_passwd); + return (int)strlen(buf); + } + } + return 0; +} + +/* + * rand_enough() is a function that returns TRUE if we have seeded the random + * engine properly. We use some preprocessor magic to provide a seed_enough() + * macro to use, just to prevent a compiler warning on this function if we + * pass in an argument that is never used. + */ + +#ifdef HAVE_RAND_STATUS +#define seed_enough(x) rand_enough() +static bool rand_enough(void) +{ + return (bool)(0 != RAND_status()); +} +#else +#define seed_enough(x) rand_enough(x) +static bool rand_enough(int nread) +{ + /* this is a very silly decision to make */ + return (bool)(nread > 500); +} +#endif + +static int ossl_seed(struct SessionHandle *data) +{ + char *buf = data->state.buffer; /* point to the big buffer */ + int nread=0; + + /* Q: should we add support for a random file name as a libcurl option? + A: Yes, it is here */ + +#ifndef RANDOM_FILE + /* if RANDOM_FILE isn't defined, we only perform this if an option tells + us to! */ + if(data->set.ssl.random_file) +#define RANDOM_FILE "" /* doesn't matter won't be used */ +#endif + { + /* let the option override the define */ + nread += RAND_load_file((data->set.str[STRING_SSL_RANDOM_FILE]? + data->set.str[STRING_SSL_RANDOM_FILE]: + RANDOM_FILE), + RAND_LOAD_LENGTH); + if(seed_enough(nread)) + return nread; + } + +#if defined(HAVE_RAND_EGD) + /* only available in OpenSSL 0.9.5 and later */ + /* EGD_SOCKET is set at configure time or not at all */ +#ifndef EGD_SOCKET + /* If we don't have the define set, we only do this if the egd-option + is set */ + if(data->set.str[STRING_SSL_EGDSOCKET]) +#define EGD_SOCKET "" /* doesn't matter won't be used */ +#endif + { + /* If there's an option and a define, the option overrides the + define */ + int ret = RAND_egd(data->set.str[STRING_SSL_EGDSOCKET]? + data->set.str[STRING_SSL_EGDSOCKET]:EGD_SOCKET); + if(-1 != ret) { + nread += ret; + if(seed_enough(nread)) + return nread; + } + } +#endif + + /* If we get here, it means we need to seed the PRNG using a "silly" + approach! */ +#ifdef HAVE_RAND_SCREEN + /* if RAND_screen() is present, it was called during global init */ + nread = 100; /* just a value */ +#else + { + int len; + char *area; + + /* Changed call to RAND_seed to use the underlying RAND_add implementation + * directly. Do this in a loop, with the amount of additional entropy + * being dependent upon the algorithm used by Curl_FormBoundary(): N bytes + * of a 7-bit ascii set. -- Richard Gorton, March 11 2003. + */ + + do { + area = Curl_FormBoundary(); + if(!area) + return 3; /* out of memory */ + + len = (int)strlen(area); + RAND_add(area, len, (len >> 1)); + + free(area); /* now remove the random junk */ + } while(!RAND_status()); + } +#endif + + /* generates a default path for the random seed file */ + buf[0]=0; /* blank it first */ + RAND_file_name(buf, BUFSIZE); + if(buf[0]) { + /* we got a file name to try */ + nread += RAND_load_file(buf, RAND_LOAD_LENGTH); + if(seed_enough(nread)) + return nread; + } + + infof(data, "libcurl is now using a weak random seed!\n"); + return nread; +} + +int Curl_ossl_seed(struct SessionHandle *data) +{ + /* we have the "SSL is seeded" boolean static to prevent multiple + time-consuming seedings in vain */ + static bool ssl_seeded = FALSE; + + if(!ssl_seeded || data->set.str[STRING_SSL_RANDOM_FILE] || + data->set.str[STRING_SSL_EGDSOCKET]) { + ossl_seed(data); + ssl_seeded = TRUE; + } + return 0; +} + + +#ifndef SSL_FILETYPE_ENGINE +#define SSL_FILETYPE_ENGINE 42 +#endif +#ifndef SSL_FILETYPE_PKCS12 +#define SSL_FILETYPE_PKCS12 43 +#endif +static int do_file_type(const char *type) +{ + if(!type || !type[0]) + return SSL_FILETYPE_PEM; + if(Curl_raw_equal(type, "PEM")) + return SSL_FILETYPE_PEM; + if(Curl_raw_equal(type, "DER")) + return SSL_FILETYPE_ASN1; + if(Curl_raw_equal(type, "ENG")) + return SSL_FILETYPE_ENGINE; + if(Curl_raw_equal(type, "P12")) + return SSL_FILETYPE_PKCS12; + return -1; +} + +static +int cert_stuff(struct connectdata *conn, + SSL_CTX* ctx, + char *cert_file, + const char *cert_type, + char *key_file, + const char *key_type) +{ + struct SessionHandle *data = conn->data; + + int file_type = do_file_type(cert_type); + + if(cert_file != NULL || file_type == SSL_FILETYPE_ENGINE) { + SSL *ssl; + X509 *x509; + int cert_done = 0; + + if(data->set.str[STRING_KEY_PASSWD]) { +#ifndef HAVE_USERDATA_IN_PWD_CALLBACK + /* + * If password has been given, we store that in the global + * area (*shudder*) for a while: + */ + size_t len = strlen(data->set.key_passwd); + if(len < sizeof(global_passwd)) + memcpy(global_passwd, data->set.key_passwd, len+1); +#else + /* + * We set the password in the callback userdata + */ + SSL_CTX_set_default_passwd_cb_userdata(ctx, + data->set.str[STRING_KEY_PASSWD]); +#endif + /* Set passwd callback: */ + SSL_CTX_set_default_passwd_cb(ctx, passwd_callback); + } + + +#define SSL_CLIENT_CERT_ERR \ + "unable to use client certificate (no key found or wrong pass phrase?)" + + switch(file_type) { + case SSL_FILETYPE_PEM: + /* SSL_CTX_use_certificate_chain_file() only works on PEM files */ + if(SSL_CTX_use_certificate_chain_file(ctx, + cert_file) != 1) { + failf(data, SSL_CLIENT_CERT_ERR); + return 0; + } + break; + + case SSL_FILETYPE_ASN1: + /* SSL_CTX_use_certificate_file() works with either PEM or ASN1, but + we use the case above for PEM so this can only be performed with + ASN1 files. */ + if(SSL_CTX_use_certificate_file(ctx, + cert_file, + file_type) != 1) { + failf(data, SSL_CLIENT_CERT_ERR); + return 0; + } + break; + case SSL_FILETYPE_ENGINE: +#if defined(HAVE_OPENSSL_ENGINE_H) && defined(ENGINE_CTRL_GET_CMD_FROM_NAME) + { + if(data->state.engine) { + const char *cmd_name = "LOAD_CERT_CTRL"; + struct { + const char *cert_id; + X509 *cert; + } params; + + params.cert_id = cert_file; + params.cert = NULL; + + /* Does the engine supports LOAD_CERT_CTRL ? */ + if (!ENGINE_ctrl(data->state.engine, ENGINE_CTRL_GET_CMD_FROM_NAME, + 0, (void *)cmd_name, NULL)) { + failf(data, "ssl engine does not support loading certificates"); + return 0; + } + + /* Load the certificate from the engine */ + if (!ENGINE_ctrl_cmd(data->state.engine, cmd_name, + 0, ¶ms, NULL, 1)) { + failf(data, "ssl engine cannot load client cert with id" + " '%s' [%s]", cert_file, + ERR_error_string(ERR_get_error(), NULL)); + return 0; + } + + if (!params.cert) { + failf(data, "ssl engine didn't initialized the certificate " + "properly."); + return 0; + } + + if(SSL_CTX_use_certificate(ctx, params.cert) != 1) { + failf(data, "unable to set client certificate"); + X509_free(params.cert); + return 0; + } + X509_free(params.cert); /* we don't need the handle any more... */ + } + else { + failf(data, "crypto engine not set, can't load certificate"); + return 0; + } + } + break; +#else + failf(data, "file type ENG for certificate not implemented"); + return 0; +#endif + + case SSL_FILETYPE_PKCS12: + { +#ifdef HAVE_PKCS12_SUPPORT + FILE *f; + PKCS12 *p12; + EVP_PKEY *pri; + STACK_OF(X509) *ca = NULL; + int i; + + f = fopen(cert_file,"rb"); + if(!f) { + failf(data, "could not open PKCS12 file '%s'", cert_file); + return 0; + } + p12 = d2i_PKCS12_fp(f, NULL); + fclose(f); + + if(!p12) { + failf(data, "error reading PKCS12 file '%s'", cert_file ); + return 0; + } + + PKCS12_PBE_add(); + + if(!PKCS12_parse(p12, data->set.str[STRING_KEY_PASSWD], &pri, &x509, + &ca)) { + failf(data, + "could not parse PKCS12 file, check password, OpenSSL error %s", + ERR_error_string(ERR_get_error(), NULL) ); + PKCS12_free(p12); + return 0; + } + + PKCS12_free(p12); + + if(SSL_CTX_use_certificate(ctx, x509) != 1) { + failf(data, SSL_CLIENT_CERT_ERR); + EVP_PKEY_free(pri); + X509_free(x509); + return 0; + } + + if(SSL_CTX_use_PrivateKey(ctx, pri) != 1) { + failf(data, "unable to use private key from PKCS12 file '%s'", + cert_file); + EVP_PKEY_free(pri); + X509_free(x509); + return 0; + } + + if (!SSL_CTX_check_private_key (ctx)) { + failf(data, "private key from PKCS12 file '%s' " + "does not match certificate in same file", cert_file); + EVP_PKEY_free(pri); + X509_free(x509); + return 0; + } + /* Set Certificate Verification chain */ + if (ca && sk_X509_num(ca)) { + for (i = 0; i < sk_X509_num(ca); i++) { + if (!SSL_CTX_add_extra_chain_cert(ctx,sk_X509_value(ca, i))) { + failf(data, "cannot add certificate to certificate chain"); + EVP_PKEY_free(pri); + X509_free(x509); + return 0; + } + if (!SSL_CTX_add_client_CA(ctx, sk_X509_value(ca, i))) { + failf(data, "cannot add certificate to client CA list"); + EVP_PKEY_free(pri); + X509_free(x509); + return 0; + } + } + } + + EVP_PKEY_free(pri); + X509_free(x509); + cert_done = 1; + break; +#else + failf(data, "file type P12 for certificate not supported"); + return 0; +#endif + } + default: + failf(data, "not supported file type '%s' for certificate", cert_type); + return 0; + } + + file_type = do_file_type(key_type); + + switch(file_type) { + case SSL_FILETYPE_PEM: + if(cert_done) + break; + if(key_file == NULL) + /* cert & key can only be in PEM case in the same file */ + key_file=cert_file; + case SSL_FILETYPE_ASN1: + if(SSL_CTX_use_PrivateKey_file(ctx, key_file, file_type) != 1) { + failf(data, "unable to set private key file: '%s' type %s", + key_file, key_type?key_type:"PEM"); + return 0; + } + break; + case SSL_FILETYPE_ENGINE: +#ifdef HAVE_OPENSSL_ENGINE_H + { /* XXXX still needs some work */ + EVP_PKEY *priv_key = NULL; + if(data->state.engine) { +#ifdef HAVE_ENGINE_LOAD_FOUR_ARGS + UI_METHOD *ui_method = UI_OpenSSL(); +#endif + /* the typecast below was added to please mingw32 */ + priv_key = (EVP_PKEY *) + ENGINE_load_private_key(data->state.engine,key_file, +#ifdef HAVE_ENGINE_LOAD_FOUR_ARGS + ui_method, +#endif + data->set.str[STRING_KEY_PASSWD]); + if(!priv_key) { + failf(data, "failed to load private key from crypto engine"); + return 0; + } + if(SSL_CTX_use_PrivateKey(ctx, priv_key) != 1) { + failf(data, "unable to set private key"); + EVP_PKEY_free(priv_key); + return 0; + } + EVP_PKEY_free(priv_key); /* we don't need the handle any more... */ + } + else { + failf(data, "crypto engine not set, can't load private key"); + return 0; + } + } + break; +#else + failf(data, "file type ENG for private key not supported"); + return 0; +#endif + case SSL_FILETYPE_PKCS12: + if(!cert_done) { + failf(data, "file type P12 for private key not supported"); + return 0; + } + break; + default: + failf(data, "not supported file type for private key"); + return 0; + } + + ssl=SSL_new(ctx); + if(NULL == ssl) { + failf(data,"unable to create an SSL structure"); + return 0; + } + + x509=SSL_get_certificate(ssl); + + /* This version was provided by Evan Jordan and is supposed to not + leak memory as the previous version: */ + if(x509 != NULL) { + EVP_PKEY *pktmp = X509_get_pubkey(x509); + EVP_PKEY_copy_parameters(pktmp,SSL_get_privatekey(ssl)); + EVP_PKEY_free(pktmp); + } + + SSL_free(ssl); + + /* If we are using DSA, we can copy the parameters from + * the private key */ + + + /* Now we know that a key and cert have been set against + * the SSL context */ + if(!SSL_CTX_check_private_key(ctx)) { + failf(data, "Private key does not match the certificate public key"); + return 0; + } +#ifndef HAVE_USERDATA_IN_PWD_CALLBACK + /* erase it now */ + memset(global_passwd, 0, sizeof(global_passwd)); +#endif + } + return 1; +} + +/* returns non-zero on failure */ +static int x509_name_oneline(X509_NAME *a, char *buf, size_t size) +{ +#if 0 + return X509_NAME_oneline(a, buf, size); +#else + BIO *bio_out = BIO_new(BIO_s_mem()); + BUF_MEM *biomem; + int rc; + + if(!bio_out) + return 1; /* alloc failed! */ + + rc = X509_NAME_print_ex(bio_out, a, 0, XN_FLAG_SEP_SPLUS_SPC); + BIO_get_mem_ptr(bio_out, &biomem); + + if((size_t)biomem->length < size) + size = biomem->length; + else + size--; /* don't overwrite the buffer end */ + + memcpy(buf, biomem->data, size); + buf[size]=0; + + BIO_free(bio_out); + + return !rc; +#endif +} + +static +int cert_verify_callback(int ok, X509_STORE_CTX *ctx) +{ + X509 *err_cert; + char buf[256]; + + err_cert=X509_STORE_CTX_get_current_cert(ctx); + (void)x509_name_oneline(X509_get_subject_name(err_cert), buf, sizeof(buf)); + return ok; +} + +/* Return error string for last OpenSSL error + */ +static char *SSL_strerror(unsigned long error, char *buf, size_t size) +{ +#ifdef HAVE_ERR_ERROR_STRING_N + /* OpenSSL 0.9.6 and later has a function named + ERRO_error_string_n() that takes the size of the buffer as a + third argument */ + ERR_error_string_n(error, buf, size); +#else + (void) size; + ERR_error_string(error, buf); +#endif + return buf; +} + +#endif /* USE_SSLEAY */ + +#ifdef USE_SSLEAY +/** + * Global SSL init + * + * @retval 0 error initializing SSL + * @retval 1 SSL initialized successfully + */ +int Curl_ossl_init(void) +{ +#ifdef HAVE_ENGINE_LOAD_BUILTIN_ENGINES + ENGINE_load_builtin_engines(); +#endif + + /* Lets get nice error messages */ + SSL_load_error_strings(); + + /* Init the global ciphers and digests */ + if(!SSLeay_add_ssl_algorithms()) + return 0; + + OpenSSL_add_all_algorithms(); + +#ifdef HAVE_RAND_SCREEN + /* This one gets a random value by reading the currently shown screen. + RAND_screen() is not thread-safe according to OpenSSL devs - although not + mentioned in documentation. */ + RAND_screen(); +#endif + + return 1; +} + +#endif /* USE_SSLEAY */ + +#ifdef USE_SSLEAY + +/* Global cleanup */ +void Curl_ossl_cleanup(void) +{ + /* Free the SSL error strings */ + ERR_free_strings(); + + /* EVP_cleanup() removes all ciphers and digests from the table. */ + EVP_cleanup(); + +#ifdef HAVE_ENGINE_CLEANUP + ENGINE_cleanup(); +#endif + +#ifdef HAVE_CRYPTO_CLEANUP_ALL_EX_DATA + /* this function was not present in 0.9.6b, but was added sometimes + later */ + CRYPTO_cleanup_all_ex_data(); +#endif +} + +/* + * This function uses SSL_peek to determine connection status. + * + * Return codes: + * 1 means the connection is still in place + * 0 means the connection has been closed + * -1 means the connection status is unknown + */ +int Curl_ossl_check_cxn(struct connectdata *conn) +{ + int rc; + char buf; + + rc = SSL_peek(conn->ssl[FIRSTSOCKET].handle, (void*)&buf, 1); + if(rc > 0) + return 1; /* connection still in place */ + + if(rc == 0) + return 0; /* connection has been closed */ + + return -1; /* connection status unknown */ +} + +/* Selects an OpenSSL crypto engine + */ +CURLcode Curl_ossl_set_engine(struct SessionHandle *data, const char *engine) +{ +#if defined(USE_SSLEAY) && defined(HAVE_OPENSSL_ENGINE_H) + ENGINE *e; + +#if OPENSSL_VERSION_NUMBER >= 0x00909000L + e = ENGINE_by_id(engine); +#else + /* avoid memory leak */ + for(e = ENGINE_get_first(); e; e = ENGINE_get_next(e)) { + const char *e_id = ENGINE_get_id(e); + if(!strcmp(engine, e_id)) + break; + } +#endif + + if(!e) { + failf(data, "SSL Engine '%s' not found", engine); + return CURLE_SSL_ENGINE_NOTFOUND; + } + + if(data->state.engine) { + ENGINE_finish(data->state.engine); + ENGINE_free(data->state.engine); + data->state.engine = NULL; + } + if(!ENGINE_init(e)) { + char buf[256]; + + ENGINE_free(e); + failf(data, "Failed to initialise SSL Engine '%s':\n%s", + engine, SSL_strerror(ERR_get_error(), buf, sizeof(buf))); + return CURLE_SSL_ENGINE_INITFAILED; + } + data->state.engine = e; + return CURLE_OK; +#else + (void)engine; + failf(data, "SSL Engine not supported"); + return CURLE_SSL_ENGINE_NOTFOUND; +#endif +} + +/* Sets engine as default for all SSL operations + */ +CURLcode Curl_ossl_set_engine_default(struct SessionHandle *data) +{ +#ifdef HAVE_OPENSSL_ENGINE_H + if(data->state.engine) { + if(ENGINE_set_default(data->state.engine, ENGINE_METHOD_ALL) > 0) { + infof(data,"set default crypto engine '%s'\n", ENGINE_get_id(data->state.engine)); + } + else { + failf(data, "set default crypto engine '%s' failed", ENGINE_get_id(data->state.engine)); + return CURLE_SSL_ENGINE_SETFAILED; + } + } +#else + (void) data; +#endif + return CURLE_OK; +} + +/* Return list of OpenSSL crypto engine names. + */ +struct curl_slist *Curl_ossl_engines_list(struct SessionHandle *data) +{ + struct curl_slist *list = NULL; +#if defined(USE_SSLEAY) && defined(HAVE_OPENSSL_ENGINE_H) + struct curl_slist *beg = NULL; + ENGINE *e; + + for (e = ENGINE_get_first(); e; e = ENGINE_get_next(e)) { + list = curl_slist_append(list, ENGINE_get_id(e)); + if(list == NULL) { + curl_slist_free_all(beg); + return NULL; + } + else if(beg == NULL) { + beg = list; + } + } +#endif + (void) data; + return list; +} + + +/* + * This function is called when an SSL connection is closed. + */ +void Curl_ossl_close(struct connectdata *conn, int sockindex) +{ + struct ssl_connect_data *connssl = &conn->ssl[sockindex]; + + if(connssl->handle) { + (void)SSL_shutdown(connssl->handle); + SSL_set_connect_state(connssl->handle); + + SSL_free (connssl->handle); + connssl->handle = NULL; + } + if(connssl->ctx) { + SSL_CTX_free (connssl->ctx); + connssl->ctx = NULL; + } +} + +/* + * This function is called to shut down the SSL layer but keep the + * socket open (CCC - Clear Command Channel) + */ +int Curl_ossl_shutdown(struct connectdata *conn, int sockindex) +{ + int retval = 0; + struct ssl_connect_data *connssl = &conn->ssl[sockindex]; + struct SessionHandle *data = conn->data; + char buf[120]; /* We will use this for the OpenSSL error buffer, so it has + to be at least 120 bytes long. */ + unsigned long sslerror; + ssize_t nread; + int buffsize; + int err; + int done = 0; + + /* This has only been tested on the proftpd server, and the mod_tls code + sends a close notify alert without waiting for a close notify alert in + response. Thus we wait for a close notify alert from the server, but + we do not send one. Let's hope other servers do the same... */ + + if(data->set.ftp_ccc == CURLFTPSSL_CCC_ACTIVE) + (void)SSL_shutdown(connssl->handle); + + if(connssl->handle) { + buffsize = (int)sizeof(buf); + while(!done) { + int what = Curl_socket_ready(conn->sock[sockindex], + CURL_SOCKET_BAD, SSL_SHUTDOWN_TIMEOUT); + if(what > 0) { + ERR_clear_error(); + + /* Something to read, let's do it and hope that it is the close + notify alert from the server */ + nread = (ssize_t)SSL_read(conn->ssl[sockindex].handle, buf, + buffsize); + err = SSL_get_error(conn->ssl[sockindex].handle, (int)nread); + + switch(err) { + case SSL_ERROR_NONE: /* this is not an error */ + case SSL_ERROR_ZERO_RETURN: /* no more data */ + /* This is the expected response. There was no data but only + the close notify alert */ + done = 1; + break; + case SSL_ERROR_WANT_READ: + /* there's data pending, re-invoke SSL_read() */ + infof(data, "SSL_ERROR_WANT_READ\n"); + break; + case SSL_ERROR_WANT_WRITE: + /* SSL wants a write. Really odd. Let's bail out. */ + infof(data, "SSL_ERROR_WANT_WRITE\n"); + done = 1; + break; + default: + /* openssl/ssl.h says "look at error stack/return value/errno" */ + sslerror = ERR_get_error(); + failf(conn->data, "SSL read: %s, errno %d", + ERR_error_string(sslerror, buf), + SOCKERRNO); + done = 1; + break; + } + } + else if(0 == what) { + /* timeout */ + failf(data, "SSL shutdown timeout"); + done = 1; + } + else { + /* anything that gets here is fatally bad */ + failf(data, "select/poll on SSL socket, errno: %d", SOCKERRNO); + retval = -1; + done = 1; + } + } /* while()-loop for the select() */ + + if(data->set.verbose) { +#ifdef HAVE_SSL_GET_SHUTDOWN + switch(SSL_get_shutdown(connssl->handle)) { + case SSL_SENT_SHUTDOWN: + infof(data, "SSL_get_shutdown() returned SSL_SENT_SHUTDOWN\n"); + break; + case SSL_RECEIVED_SHUTDOWN: + infof(data, "SSL_get_shutdown() returned SSL_RECEIVED_SHUTDOWN\n"); + break; + case SSL_SENT_SHUTDOWN|SSL_RECEIVED_SHUTDOWN: + infof(data, "SSL_get_shutdown() returned SSL_SENT_SHUTDOWN|" + "SSL_RECEIVED__SHUTDOWN\n"); + break; + } +#endif + } + + SSL_free (connssl->handle); + connssl->handle = NULL; + } + return retval; +} + +void Curl_ossl_session_free(void *ptr) +{ + /* free the ID */ + SSL_SESSION_free(ptr); +} + +/* + * This function is called when the 'data' struct is going away. Close + * down everything and free all resources! + */ +int Curl_ossl_close_all(struct SessionHandle *data) +{ + /* + ERR_remove_state() frees the error queue associated with + thread pid. If pid == 0, the current thread will have its + error queue removed. + + Since error queue data structures are allocated + automatically for new threads, they must be freed when + threads are terminated in oder to avoid memory leaks. + */ + ERR_remove_state(0); + +#ifdef HAVE_OPENSSL_ENGINE_H + if(data->state.engine) { + ENGINE_finish(data->state.engine); + ENGINE_free(data->state.engine); + data->state.engine = NULL; + } +#else + (void)data; +#endif + return 0; +} + +static int asn1_output(const ASN1_UTCTIME *tm, + char *buf, + size_t sizeofbuf) +{ + const char *asn1_string; + int gmt=FALSE; + int i; + int year=0,month=0,day=0,hour=0,minute=0,second=0; + + i=tm->length; + asn1_string=(const char *)tm->data; + + if(i < 10) + return 1; + if(asn1_string[i-1] == 'Z') + gmt=TRUE; + for (i=0; i<10; i++) + if((asn1_string[i] > '9') || (asn1_string[i] < '0')) + return 2; + + year= (asn1_string[0]-'0')*10+(asn1_string[1]-'0'); + if(year < 50) + year+=100; + + month= (asn1_string[2]-'0')*10+(asn1_string[3]-'0'); + if((month > 12) || (month < 1)) + return 3; + + day= (asn1_string[4]-'0')*10+(asn1_string[5]-'0'); + hour= (asn1_string[6]-'0')*10+(asn1_string[7]-'0'); + minute= (asn1_string[8]-'0')*10+(asn1_string[9]-'0'); + + if((asn1_string[10] >= '0') && (asn1_string[10] <= '9') && + (asn1_string[11] >= '0') && (asn1_string[11] <= '9')) + second= (asn1_string[10]-'0')*10+(asn1_string[11]-'0'); + + snprintf(buf, sizeofbuf, + "%04d-%02d-%02d %02d:%02d:%02d %s", + year+1900, month, day, hour, minute, second, (gmt?"GMT":"")); + + return 0; +} + +/* ====================================================== */ + +/* + * Match a hostname against a wildcard pattern. + * E.g. + * "foo.host.com" matches "*.host.com". + * + * We are a bit more liberal than RFC2818 describes in that we + * accept multiple "*" in pattern (similar to what some other browsers do). + * E.g. + * "abc.def.domain.com" should strickly not match "*.domain.com", but we + * don't consider "." to be important in CERT checking. + */ +#define HOST_NOMATCH 0 +#define HOST_MATCH 1 + +static int hostmatch(const char *hostname, const char *pattern) +{ + for(;;) { + char c = *pattern++; + + if(c == '\0') + return (*hostname ? HOST_NOMATCH : HOST_MATCH); + + if(c == '*') { + c = *pattern; + if(c == '\0') /* "*\0" matches anything remaining */ + return HOST_MATCH; + + while(*hostname) { + /* The only recursive function in libcurl! */ + if(hostmatch(hostname++,pattern) == HOST_MATCH) + return HOST_MATCH; + } + break; + } + + if(Curl_raw_toupper(c) != Curl_raw_toupper(*hostname++)) + break; + } + return HOST_NOMATCH; +} + +static int +cert_hostcheck(const char *match_pattern, const char *hostname) +{ + if(!match_pattern || !*match_pattern || + !hostname || !*hostname) /* sanity check */ + return 0; + + if(Curl_raw_equal(hostname, match_pattern)) /* trivial case */ + return 1; + + if(hostmatch(hostname,match_pattern) == HOST_MATCH) + return 1; + return 0; +} + +/* Quote from RFC2818 section 3.1 "Server Identity" + + If a subjectAltName extension of type dNSName is present, that MUST + be used as the identity. Otherwise, the (most specific) Common Name + field in the Subject field of the certificate MUST be used. Although + the use of the Common Name is existing practice, it is deprecated and + Certification Authorities are encouraged to use the dNSName instead. + + Matching is performed using the matching rules specified by + [RFC2459]. If more than one identity of a given type is present in + the certificate (e.g., more than one dNSName name, a match in any one + of the set is considered acceptable.) Names may contain the wildcard + character * which is considered to match any single domain name + component or component fragment. E.g., *.a.com matches foo.a.com but + not bar.foo.a.com. f*.com matches foo.com but not bar.com. + + In some cases, the URI is specified as an IP address rather than a + hostname. In this case, the iPAddress subjectAltName must be present + in the certificate and must exactly match the IP in the URI. + +*/ +static CURLcode verifyhost(struct connectdata *conn, + X509 *server_cert) +{ + int matched = -1; /* -1 is no alternative match yet, 1 means match and 0 + means mismatch */ + int target = GEN_DNS; /* target type, GEN_DNS or GEN_IPADD */ + size_t addrlen = 0; + struct SessionHandle *data = conn->data; + STACK_OF(GENERAL_NAME) *altnames; +#ifdef ENABLE_IPV6 + struct in6_addr addr; +#else + struct in_addr addr; +#endif + CURLcode res = CURLE_OK; + +#ifdef ENABLE_IPV6 + if(conn->bits.ipv6_ip && + Curl_inet_pton(AF_INET6, conn->host.name, &addr)) { + target = GEN_IPADD; + addrlen = sizeof(struct in6_addr); + } + else +#endif + if(Curl_inet_pton(AF_INET, conn->host.name, &addr)) { + target = GEN_IPADD; + addrlen = sizeof(struct in_addr); + } + + /* get a "list" of alternative names */ + altnames = X509_get_ext_d2i(server_cert, NID_subject_alt_name, NULL, NULL); + + if(altnames) { + int numalts; + int i; + + /* get amount of alternatives, RFC2459 claims there MUST be at least + one, but we don't depend on it... */ + numalts = sk_GENERAL_NAME_num(altnames); + + /* loop through all alternatives while none has matched */ + for (i=0; (itype == target) { + /* get data and length */ + const char *altptr = (char *)ASN1_STRING_data(check->d.ia5); + size_t altlen = (size_t) ASN1_STRING_length(check->d.ia5); + + switch(target) { + case GEN_DNS: /* name/pattern comparison */ + /* The OpenSSL man page explicitly says: "In general it cannot be + assumed that the data returned by ASN1_STRING_data() is null + terminated or does not contain embedded nulls." But also that + "The actual format of the data will depend on the actual string + type itself: for example for and IA5String the data will be ASCII" + + Gisle researched the OpenSSL sources: + "I checked the 0.9.6 and 0.9.8 sources before my patch and + it always 0-terminates an IA5String." + */ + if((altlen == strlen(altptr)) && + /* if this isn't true, there was an embedded zero in the name + string and we cannot match it. */ + cert_hostcheck(altptr, conn->host.name)) + matched = 1; + else + matched = 0; + break; + + case GEN_IPADD: /* IP address comparison */ + /* compare alternative IP address if the data chunk is the same size + our server IP address is */ + if((altlen == addrlen) && !memcmp(altptr, &addr, altlen)) + matched = 1; + else + matched = 0; + break; + } + } + } + GENERAL_NAMES_free(altnames); + } + + if(matched == 1) + /* an alternative name matched the server hostname */ + infof(data, "\t subjectAltName: %s matched\n", conn->host.dispname); + else if(matched == 0) { + /* an alternative name field existed, but didn't match and then + we MUST fail */ + infof(data, "\t subjectAltName does not match %s\n", conn->host.dispname); + res = CURLE_PEER_FAILED_VERIFICATION; + } + else { + /* we have to look to the last occurence of a commonName in the + distinguished one to get the most significant one. */ + int j,i=-1 ; + +/* The following is done because of a bug in 0.9.6b */ + + unsigned char *nulstr = (unsigned char *)""; + unsigned char *peer_CN = nulstr; + + X509_NAME *name = X509_get_subject_name(server_cert) ; + if(name) + while((j = X509_NAME_get_index_by_NID(name, NID_commonName, i))>=0) + i=j; + + /* we have the name entry and we will now convert this to a string + that we can use for comparison. Doing this we support BMPstring, + UTF8 etc. */ + + if(i>=0) { + ASN1_STRING *tmp = X509_NAME_ENTRY_get_data(X509_NAME_get_entry(name,i)); + + /* In OpenSSL 0.9.7d and earlier, ASN1_STRING_to_UTF8 fails if the input + is already UTF-8 encoded. We check for this case and copy the raw + string manually to avoid the problem. This code can be made + conditional in the future when OpenSSL has been fixed. Work-around + brought by Alexis S. L. Carvalho. */ + if(tmp) { + if(ASN1_STRING_type(tmp) == V_ASN1_UTF8STRING) { + j = ASN1_STRING_length(tmp); + if(j >= 0) { + peer_CN = OPENSSL_malloc(j+1); + if(peer_CN) { + memcpy(peer_CN, ASN1_STRING_data(tmp), j); + peer_CN[j] = '\0'; + } + } + } + else /* not a UTF8 name */ + j = ASN1_STRING_to_UTF8(&peer_CN, tmp); + + if(peer_CN && ((int)strlen((char *)peer_CN) != j)) { + /* there was a terminating zero before the end of string, this + cannot match and we return failure! */ + failf(data, "SSL: illegal cert name field"); + res = CURLE_PEER_FAILED_VERIFICATION; + } + } + } + + if(peer_CN == nulstr) + peer_CN = NULL; +#ifdef CURL_DOES_CONVERSIONS + else { + /* convert peer_CN from UTF8 */ + size_t rc; + rc = Curl_convert_from_utf8(data, peer_CN, strlen(peer_CN)); + /* Curl_convert_from_utf8 calls failf if unsuccessful */ + if(rc != CURLE_OK) { + OPENSSL_free(peer_CN); + return rc; + } + } +#endif /* CURL_DOES_CONVERSIONS */ + + if(res) + /* error already detected, pass through */ + ; + else if(!peer_CN) { + failf(data, + "SSL: unable to obtain common name from peer certificate"); + res = CURLE_PEER_FAILED_VERIFICATION; + } + else if(!cert_hostcheck((const char *)peer_CN, conn->host.name)) { + if(data->set.ssl.verifyhost > 1) { + failf(data, "SSL: certificate subject name '%s' does not match " + "target host name '%s'", peer_CN, conn->host.dispname); + res = CURLE_PEER_FAILED_VERIFICATION; + } + else + infof(data, "\t common name: %s (does not match '%s')\n", + peer_CN, conn->host.dispname); + } + else { + infof(data, "\t common name: %s (matched)\n", peer_CN); + } + if(peer_CN) + OPENSSL_free(peer_CN); + } + return res; +} +#endif /* USE_SSLEAY */ + +/* The SSL_CTRL_SET_MSG_CALLBACK doesn't exist in ancient OpenSSL versions + and thus this cannot be done there. */ +#ifdef SSL_CTRL_SET_MSG_CALLBACK + +static const char *ssl_msg_type(int ssl_ver, int msg) +{ + if(ssl_ver == SSL2_VERSION_MAJOR) { + switch (msg) { + case SSL2_MT_ERROR: + return "Error"; + case SSL2_MT_CLIENT_HELLO: + return "Client hello"; + case SSL2_MT_CLIENT_MASTER_KEY: + return "Client key"; + case SSL2_MT_CLIENT_FINISHED: + return "Client finished"; + case SSL2_MT_SERVER_HELLO: + return "Server hello"; + case SSL2_MT_SERVER_VERIFY: + return "Server verify"; + case SSL2_MT_SERVER_FINISHED: + return "Server finished"; + case SSL2_MT_REQUEST_CERTIFICATE: + return "Request CERT"; + case SSL2_MT_CLIENT_CERTIFICATE: + return "Client CERT"; + } + } + else if(ssl_ver == SSL3_VERSION_MAJOR) { + switch (msg) { + case SSL3_MT_HELLO_REQUEST: + return "Hello request"; + case SSL3_MT_CLIENT_HELLO: + return "Client hello"; + case SSL3_MT_SERVER_HELLO: + return "Server hello"; + case SSL3_MT_CERTIFICATE: + return "CERT"; + case SSL3_MT_SERVER_KEY_EXCHANGE: + return "Server key exchange"; + case SSL3_MT_CLIENT_KEY_EXCHANGE: + return "Client key exchange"; + case SSL3_MT_CERTIFICATE_REQUEST: + return "Request CERT"; + case SSL3_MT_SERVER_DONE: + return "Server finished"; + case SSL3_MT_CERTIFICATE_VERIFY: + return "CERT verify"; + case SSL3_MT_FINISHED: + return "Finished"; + } + } + return "Unknown"; +} + +static const char *tls_rt_type(int type) +{ + return ( + type == SSL3_RT_CHANGE_CIPHER_SPEC ? "TLS change cipher, " : + type == SSL3_RT_ALERT ? "TLS alert, " : + type == SSL3_RT_HANDSHAKE ? "TLS handshake, " : + type == SSL3_RT_APPLICATION_DATA ? "TLS app data, " : + "TLS Unknown, "); +} + + +/* + * Our callback from the SSL/TLS layers. + */ +static void ssl_tls_trace(int direction, int ssl_ver, int content_type, + const void *buf, size_t len, const SSL *ssl, + struct connectdata *conn) +{ + struct SessionHandle *data; + const char *msg_name, *tls_rt_name; + char ssl_buf[1024]; + int ver, msg_type, txt_len; + + if(!conn || !conn->data || !conn->data->set.fdebug || + (direction != 0 && direction != 1)) + return; + + data = conn->data; + ssl_ver >>= 8; + ver = (ssl_ver == SSL2_VERSION_MAJOR ? '2' : + ssl_ver == SSL3_VERSION_MAJOR ? '3' : '?'); + + /* SSLv2 doesn't seem to have TLS record-type headers, so OpenSSL + * always pass-up content-type as 0. But the interesting message-type + * is at 'buf[0]'. + */ + if(ssl_ver == SSL3_VERSION_MAJOR && content_type != 0) + tls_rt_name = tls_rt_type(content_type); + else + tls_rt_name = ""; + + msg_type = *(char*)buf; + msg_name = ssl_msg_type(ssl_ver, msg_type); + + txt_len = snprintf(ssl_buf, sizeof(ssl_buf), "SSLv%c, %s%s (%d):\n", + ver, tls_rt_name, msg_name, msg_type); + Curl_debug(data, CURLINFO_TEXT, ssl_buf, (size_t)txt_len, NULL); + + Curl_debug(data, (direction == 1) ? CURLINFO_SSL_DATA_OUT : + CURLINFO_SSL_DATA_IN, (char *)buf, len, NULL); + (void) ssl; +} +#endif + +#ifdef USE_SSLEAY +/* ====================================================== */ + +#ifdef SSL_CTRL_SET_TLSEXT_HOSTNAME +# define use_sni(x) sni = (x) +#else +# define use_sni(x) do { } while (0) +#endif + +static CURLcode +ossl_connect_step1(struct connectdata *conn, + int sockindex) +{ + CURLcode retcode = CURLE_OK; + + struct SessionHandle *data = conn->data; + SSL_METHOD_QUAL SSL_METHOD *req_method=NULL; + void *ssl_sessionid=NULL; + X509_LOOKUP *lookup=NULL; + curl_socket_t sockfd = conn->sock[sockindex]; + struct ssl_connect_data *connssl = &conn->ssl[sockindex]; +#ifdef SSL_CTRL_SET_TLSEXT_HOSTNAME + bool sni; +#ifdef ENABLE_IPV6 + struct in6_addr addr; +#else + struct in_addr addr; +#endif +#endif + + DEBUGASSERT(ssl_connect_1 == connssl->connecting_state); + + /* Make funny stuff to get random input */ + Curl_ossl_seed(data); + + /* check to see if we've been told to use an explicit SSL/TLS version */ + switch(data->set.ssl.version) { + default: + case CURL_SSLVERSION_DEFAULT: + /* we try to figure out version */ + req_method = SSLv23_client_method(); + use_sni(TRUE); + break; + case CURL_SSLVERSION_TLSv1: + req_method = TLSv1_client_method(); + use_sni(TRUE); + break; + case CURL_SSLVERSION_SSLv2: + req_method = SSLv2_client_method(); + use_sni(FALSE); + break; + case CURL_SSLVERSION_SSLv3: + req_method = SSLv3_client_method(); + use_sni(FALSE); + break; + } + + if(connssl->ctx) + SSL_CTX_free(connssl->ctx); + connssl->ctx = SSL_CTX_new(req_method); + + if(!connssl->ctx) { + failf(data, "SSL: couldn't create a context!"); + return CURLE_OUT_OF_MEMORY; + } + +#ifdef SSL_CTRL_SET_MSG_CALLBACK + if(data->set.fdebug && data->set.verbose) { + /* the SSL trace callback is only used for verbose logging so we only + inform about failures of setting it */ + if(!SSL_CTX_callback_ctrl(connssl->ctx, SSL_CTRL_SET_MSG_CALLBACK, + (void (*)(void))ssl_tls_trace)) { + infof(data, "SSL: couldn't set callback!\n"); + } + else if(!SSL_CTX_ctrl(connssl->ctx, SSL_CTRL_SET_MSG_CALLBACK_ARG, 0, + conn)) { + infof(data, "SSL: couldn't set callback argument!\n"); + } + } +#endif + + /* OpenSSL contains code to work-around lots of bugs and flaws in various + SSL-implementations. SSL_CTX_set_options() is used to enabled those + work-arounds. The man page for this option states that SSL_OP_ALL enables + all the work-arounds and that "It is usually safe to use SSL_OP_ALL to + enable the bug workaround options if compatibility with somewhat broken + implementations is desired." + + The "-no_ticket" option was introduced in Openssl0.9.8j. It's a flag to + disable "rfc4507bis session ticket support". rfc4507bis was later turned + into the proper RFC5077 it seems: http://tools.ietf.org/html/rfc5077 + + The enabled extension concerns the session management. I wonder how often + libcurl stops a connection and then resumes a TLS session. also, sending + the session data is some overhead. .I suggest that you just use your + proposed patch (which explicitly disables TICKET). + + If someone writes an application with libcurl and openssl who wants to + enable the feature, one can do this in the SSL callback. + + */ +#ifdef SSL_OP_NO_TICKET + /* expect older openssl releases to not have this define so only use it if + present */ +#define CURL_CTX_OPTIONS SSL_OP_ALL|SSL_OP_NO_TICKET +#else +#define CURL_CTX_OPTIONS SSL_OP_ALL +#endif + + SSL_CTX_set_options(connssl->ctx, CURL_CTX_OPTIONS); + + /* disable SSLv2 in the default case (i.e. allow SSLv3 and TLSv1) */ + if(data->set.ssl.version == CURL_SSLVERSION_DEFAULT) + SSL_CTX_set_options(connssl->ctx, SSL_OP_NO_SSLv2); + +#if 0 + /* + * Not sure it's needed to tell SSL_connect() that socket is + * non-blocking. It doesn't seem to care, but just return with + * SSL_ERROR_WANT_x. + */ + if(data->state.used_interface == Curl_if_multi) + SSL_CTX_ctrl(connssl->ctx, BIO_C_SET_NBIO, 1, NULL); +#endif + + if(data->set.str[STRING_CERT] || data->set.str[STRING_CERT_TYPE]) { + if(!cert_stuff(conn, + connssl->ctx, + data->set.str[STRING_CERT], + data->set.str[STRING_CERT_TYPE], + data->set.str[STRING_KEY], + data->set.str[STRING_KEY_TYPE])) { + /* failf() is already done in cert_stuff() */ + return CURLE_SSL_CERTPROBLEM; + } + } + + if(data->set.str[STRING_SSL_CIPHER_LIST]) { + if(!SSL_CTX_set_cipher_list(connssl->ctx, + data->set.str[STRING_SSL_CIPHER_LIST])) { + failf(data, "failed setting cipher list"); + return CURLE_SSL_CIPHER; + } + } + + if(data->set.str[STRING_SSL_CAFILE] || data->set.str[STRING_SSL_CAPATH]) { + /* tell SSL where to find CA certificates that are used to verify + the servers certificate. */ + if(!SSL_CTX_load_verify_locations(connssl->ctx, + data->set.str[STRING_SSL_CAFILE], + data->set.str[STRING_SSL_CAPATH])) { + if(data->set.ssl.verifypeer) { + /* Fail if we insist on successfully verifying the server. */ + failf(data,"error setting certificate verify locations:\n" + " CAfile: %s\n CApath: %s\n", + data->set.str[STRING_SSL_CAFILE]? + data->set.str[STRING_SSL_CAFILE]: "none", + data->set.str[STRING_SSL_CAPATH]? + data->set.str[STRING_SSL_CAPATH] : "none"); + return CURLE_SSL_CACERT_BADFILE; + } + else { + /* Just continue with a warning if no strict certificate verification + is required. */ + infof(data, "error setting certificate verify locations," + " continuing anyway:\n"); + } + } + else { + /* Everything is fine. */ + infof(data, "successfully set certificate verify locations:\n"); + } + infof(data, + " CAfile: %s\n" + " CApath: %s\n", + data->set.str[STRING_SSL_CAFILE] ? data->set.str[STRING_SSL_CAFILE]: + "none", + data->set.str[STRING_SSL_CAPATH] ? data->set.str[STRING_SSL_CAPATH]: + "none"); + } + + if (data->set.str[STRING_SSL_CRLFILE]) { + /* tell SSL where to find CRL file that is used to check certificate + * revocation */ + lookup=X509_STORE_add_lookup(connssl->ctx->cert_store,X509_LOOKUP_file()); + if ( !lookup || + (!X509_load_crl_file(lookup,data->set.str[STRING_SSL_CRLFILE], + X509_FILETYPE_PEM)) ) { + failf(data,"error loading CRL file: %s\n", + data->set.str[STRING_SSL_CRLFILE]); + return CURLE_SSL_CRL_BADFILE; + } + else { + /* Everything is fine. */ + infof(data, "successfully load CRL file:\n"); + X509_STORE_set_flags(connssl->ctx->cert_store, + X509_V_FLAG_CRL_CHECK|X509_V_FLAG_CRL_CHECK_ALL); + } + infof(data, + " CRLfile: %s\n", data->set.str[STRING_SSL_CRLFILE] ? + data->set.str[STRING_SSL_CRLFILE]: "none"); + } + + /* SSL always tries to verify the peer, this only says whether it should + * fail to connect if the verification fails, or if it should continue + * anyway. In the latter case the result of the verification is checked with + * SSL_get_verify_result() below. */ + SSL_CTX_set_verify(connssl->ctx, + data->set.ssl.verifypeer?SSL_VERIFY_PEER:SSL_VERIFY_NONE, + cert_verify_callback); + + /* give application a chance to interfere with SSL set up. */ + if(data->set.ssl.fsslctx) { + retcode = (*data->set.ssl.fsslctx)(data, connssl->ctx, + data->set.ssl.fsslctxp); + if(retcode) { + failf(data,"error signaled by ssl ctx callback"); + return retcode; + } + } + + /* Lets make an SSL structure */ + if(connssl->handle) + SSL_free(connssl->handle); + connssl->handle = SSL_new(connssl->ctx); + if(!connssl->handle) { + failf(data, "SSL: couldn't create a context (handle)!"); + return CURLE_OUT_OF_MEMORY; + } + SSL_set_connect_state(connssl->handle); + + connssl->server_cert = 0x0; + +#ifdef SSL_CTRL_SET_TLSEXT_HOSTNAME + if ((0 == Curl_inet_pton(AF_INET, conn->host.name, &addr)) && +#ifdef ENABLE_IPV6 + (0 == Curl_inet_pton(AF_INET6, conn->host.name, &addr)) && +#endif + sni && + !SSL_set_tlsext_host_name(connssl->handle, conn->host.name)) + infof(data, "WARNING: failed to configure server name indication (SNI) " + "TLS extension\n"); +#endif + + /* Check if there's a cached ID we can/should use here! */ + if(!Curl_ssl_getsessionid(conn, &ssl_sessionid, NULL)) { + /* we got a session id, use it! */ + if(!SSL_set_session(connssl->handle, ssl_sessionid)) { + failf(data, "SSL: SSL_set_session failed: %s", + ERR_error_string(ERR_get_error(),NULL)); + return CURLE_SSL_CONNECT_ERROR; + } + /* Informational message */ + infof (data, "SSL re-using session ID\n"); + } + + /* pass the raw socket into the SSL layers */ + if(!SSL_set_fd(connssl->handle, (int)sockfd)) { + failf(data, "SSL: SSL_set_fd failed: %s", + ERR_error_string(ERR_get_error(),NULL)); + return CURLE_SSL_CONNECT_ERROR; + } + + connssl->connecting_state = ssl_connect_2; + return CURLE_OK; +} + +static CURLcode +ossl_connect_step2(struct connectdata *conn, int sockindex) +{ + struct SessionHandle *data = conn->data; + int err; + struct ssl_connect_data *connssl = &conn->ssl[sockindex]; + + DEBUGASSERT(ssl_connect_2 == connssl->connecting_state + || ssl_connect_2_reading == connssl->connecting_state + || ssl_connect_2_writing == connssl->connecting_state); + + ERR_clear_error(); + + err = SSL_connect(connssl->handle); + + /* 1 is fine + 0 is "not successful but was shut down controlled" + <0 is "handshake was not successful, because a fatal error occurred" */ + if(1 != err) { + int detail = SSL_get_error(connssl->handle, err); + + if(SSL_ERROR_WANT_READ == detail) { + connssl->connecting_state = ssl_connect_2_reading; + return CURLE_OK; + } + else if(SSL_ERROR_WANT_WRITE == detail) { + connssl->connecting_state = ssl_connect_2_writing; + return CURLE_OK; + } + else { + /* untreated error */ + unsigned long errdetail; + char error_buffer[256]; /* OpenSSL documents that this must be at least + 256 bytes long. */ + CURLcode rc; + const char *cert_problem = NULL; + + connssl->connecting_state = ssl_connect_2; /* the connection failed, + we're not waiting for + anything else. */ + + errdetail = ERR_get_error(); /* Gets the earliest error code from the + thread's error queue and removes the + entry. */ + + switch(errdetail) { + case 0x1407E086: + /* 1407E086: + SSL routines: + SSL2_SET_CERTIFICATE: + certificate verify failed */ + /* fall-through */ + case 0x14090086: + /* 14090086: + SSL routines: + SSL3_GET_SERVER_CERTIFICATE: + certificate verify failed */ + cert_problem = "SSL certificate problem, verify that the CA cert is" + " OK. Details:\n"; + rc = CURLE_SSL_CACERT; + break; + default: + rc = CURLE_SSL_CONNECT_ERROR; + break; + } + + /* detail is already set to the SSL error above */ + + /* If we e.g. use SSLv2 request-method and the server doesn't like us + * (RST connection etc.), OpenSSL gives no explanation whatsoever and + * the SO_ERROR is also lost. + */ + if(CURLE_SSL_CONNECT_ERROR == rc && errdetail == 0) { + failf(data, "Unknown SSL protocol error in connection to %s:%ld ", + conn->host.name, conn->port); + return rc; + } + /* Could be a CERT problem */ + + SSL_strerror(errdetail, error_buffer, sizeof(error_buffer)); + failf(data, "%s%s", cert_problem ? cert_problem : "", error_buffer); + return rc; + } + } + else { + /* we have been connected fine, we're not waiting for anything else. */ + connssl->connecting_state = ssl_connect_3; + + /* Informational message */ + infof (data, "SSL connection using %s\n", + SSL_get_cipher(connssl->handle)); + + return CURLE_OK; + } +} + +static int asn1_object_dump(ASN1_OBJECT *a, char *buf, size_t len) +{ + int i, ilen; + + if((ilen = (int)len) < 0) + return 1; /* buffer too big */ + + i = i2t_ASN1_OBJECT(buf, ilen, a); + + if(i >= ilen) + return 1; /* buffer too small */ + + return 0; +} + +static CURLcode push_certinfo_len(struct SessionHandle *data, + int certnum, + const char *label, + const char *value, + size_t valuelen) +{ + struct curl_certinfo *ci = &data->info.certs; + char *output; + struct curl_slist *nl; + CURLcode res = CURLE_OK; + size_t labellen = strlen(label); + size_t outlen = labellen + 1 + valuelen + 1; /* label:value\0 */ + + output = malloc(outlen); + if(!output) + return CURLE_OUT_OF_MEMORY; + + /* sprintf the label and colon */ + snprintf(output, outlen, "%s:", label); + + /* memcpy the value (it might not be zero terminated) */ + memcpy(&output[labellen+1], value, valuelen); + + /* zero terminate the output */ + output[labellen + 1 + valuelen] = 0; + + /* TODO: we should rather introduce an internal API that can do the + equivalent of curl_slist_append but doesn't strdup() the given data as + like in this place the extra malloc/free is totally pointless */ + nl = curl_slist_append(ci->certinfo[certnum], output); + if(!nl) { + curl_slist_free_all(ci->certinfo[certnum]); + res = CURLE_OUT_OF_MEMORY; + } + else + ci->certinfo[certnum] = nl; + + free(output); + + return res; +} + +/* this is a convenience function for push_certinfo_len that takes a zero + terminated value */ +static CURLcode push_certinfo(struct SessionHandle *data, + int certnum, + const char *label, + const char *value) +{ + size_t valuelen = strlen(value); + + return push_certinfo_len(data, certnum, label, value, valuelen); +} + +static void pubkey_show(struct SessionHandle *data, + int num, + const char *type, + const char *name, + unsigned char *raw, + int len) +{ + char buffer[1024]; + size_t left = sizeof(buffer); + int i; + char *ptr=buffer; + char namebuf[32]; + + snprintf(namebuf, sizeof(namebuf), "%s(%s)", type, name); + + for(i=0; i< len; i++) { + snprintf(ptr, left, "%02x:", raw[i]); + ptr += 3; + left -= 3; + } + infof(data, " %s: %s\n", namebuf, buffer); + push_certinfo(data, num, namebuf, buffer); +} + +#define print_pubkey_BN(_type, _name, _num) \ +do { \ + if (pubkey->pkey._type->_name != NULL) { \ + int len = BN_num_bytes(pubkey->pkey._type->_name); \ + if(len < (int)sizeof(buf)) { \ + BN_bn2bin(pubkey->pkey._type->_name, (unsigned char*)buf); \ + buf[len] = 0; \ + pubkey_show(data, _num, #_type, #_name, (unsigned char*)buf, len); \ + } \ + } \ +} while (0) + +static int X509V3_ext(struct SessionHandle *data, + int certnum, + STACK_OF(X509_EXTENSION) *exts) +{ + int i; + size_t j; + + if(sk_X509_EXTENSION_num(exts) <= 0) + /* no extensions, bail out */ + return 1; + + for (i=0; ivalue); + + BIO_get_mem_ptr(bio_out, &biomem); + + /* biomem->length bytes at biomem->data, this little loop here is only + done for the infof() call, we send the "raw" data to the certinfo + function */ + for(j=0; j<(size_t)biomem->length; j++) { + const char *sep=""; + if(biomem->data[j] == '\n') { + sep=", "; + j++; /* skip the newline */ + }; + while((biomem->data[j] == ' ') && (j<(size_t)biomem->length)) + j++; + if(j<(size_t)biomem->length) + ptr+=snprintf(ptr, sizeof(buf)-(ptr-buf), "%s%c", sep, biomem->data[j]); + } + infof(data, " %s\n", buf); + + push_certinfo(data, certnum, namebuf, buf); + + BIO_free(bio_out); + + } + return 0; /* all is fine */ +} + + +static void X509_signature(struct SessionHandle *data, + int numcert, + ASN1_STRING *sig) +{ + char buf[1024]; + char *ptr = buf; + int i; + for (i=0; ilength; i++) + ptr+=snprintf(ptr, sizeof(buf)-(ptr-buf), "%02x:", sig->data[i]); + + infof(data, " Signature: %s\n", buf); + push_certinfo(data, numcert, "Signature", buf); +} + +static void dumpcert(struct SessionHandle *data, X509 *x, int numcert) +{ + BIO *bio_out = BIO_new(BIO_s_mem()); + BUF_MEM *biomem; + + /* this outputs the cert in this 64 column wide style with newlines and + -----BEGIN CERTIFICATE----- texts and more */ + PEM_write_bio_X509(bio_out, x); + + BIO_get_mem_ptr(bio_out, &biomem); + + infof(data, "%s\n", biomem->data); + + push_certinfo_len(data, numcert, "Cert", biomem->data, biomem->length); + + BIO_free(bio_out); + +} + + +static int init_certinfo(struct SessionHandle *data, + int num) +{ + struct curl_certinfo *ci = &data->info.certs; + struct curl_slist **table; + + Curl_ssl_free_certinfo(data); + + ci->num_of_certs = num; + table = calloc((size_t)num, sizeof(struct curl_slist *)); + if(!table) + return 1; + + ci->certinfo = table; + return 0; +} + +static CURLcode get_cert_chain(struct connectdata *conn, + struct ssl_connect_data *connssl) + +{ + STACK_OF(X509) *sk; + int i; + char buf[512]; + struct SessionHandle *data = conn->data; + int numcerts; + + sk = SSL_get_peer_cert_chain(connssl->handle); + + if(!sk) + return CURLE_OUT_OF_MEMORY; + + numcerts = sk_X509_num(sk); + + if(init_certinfo(data, numcerts)) + return CURLE_OUT_OF_MEMORY; + + infof(data, "--- Certificate chain\n"); + for (i=0; ilength <= 4) { + value = ASN1_INTEGER_get(num); + infof(data," Serial Number: %ld (0x%lx)\n", value, value); + snprintf(buf, sizeof(buf), "%lx", value); + } + else { + + ptr = buf; + *ptr++ = 0; + if(num->type == V_ASN1_NEG_INTEGER) + *ptr++='-'; + + for (j=0; jlength; j++) { + /* TODO: length restrictions */ + snprintf(ptr, 3, "%02x%c",num->data[j], + ((j+1 == num->length)?'\n':':')); + ptr += 3; + } + if(num->length) + infof(data," Serial Number: %s\n", buf); + else + buf[0]=0; + } + if(buf[0]) + push_certinfo(data, i, "Serial Number", buf); /* hex */ + + cinf = x->cert_info; + + j = asn1_object_dump(cinf->signature->algorithm, buf, sizeof(buf)); + if(!j) { + infof(data, " Signature Algorithm: %s\n", buf); + push_certinfo(data, i, "Signature Algorithm", buf); + } + + certdate = X509_get_notBefore(x); + asn1_output(certdate, buf, sizeof(buf)); + infof(data, " Start date: %s\n", buf); + push_certinfo(data, i, "Start date", buf); + + certdate = X509_get_notAfter(x); + asn1_output(certdate, buf, sizeof(buf)); + infof(data, " Expire date: %s\n", buf); + push_certinfo(data, i, "Expire date", buf); + + j = asn1_object_dump(cinf->key->algor->algorithm, buf, sizeof(buf)); + if(!j) { + infof(data, " Public Key Algorithm: %s\n", buf); + push_certinfo(data, i, "Public Key Algorithm", buf); + } + + pubkey = X509_get_pubkey(x); + if(!pubkey) + infof(data, " Unable to load public key\n"); + else { + switch(pubkey->type) { + case EVP_PKEY_RSA: + infof(data, " RSA Public Key (%d bits)\n", + BN_num_bits(pubkey->pkey.rsa->n)); + snprintf(buf, sizeof(buf), "%d", BN_num_bits(pubkey->pkey.rsa->n)); + push_certinfo(data, i, "RSA Public Key", buf); + + print_pubkey_BN(rsa, n, i); + print_pubkey_BN(rsa, e, i); + print_pubkey_BN(rsa, d, i); + print_pubkey_BN(rsa, p, i); + print_pubkey_BN(rsa, q, i); + print_pubkey_BN(rsa, dmp1, i); + print_pubkey_BN(rsa, dmq1, i); + print_pubkey_BN(rsa, iqmp, i); + break; + case EVP_PKEY_DSA: + print_pubkey_BN(dsa, p, i); + print_pubkey_BN(dsa, q, i); + print_pubkey_BN(dsa, g, i); + print_pubkey_BN(dsa, priv_key, i); + print_pubkey_BN(dsa, pub_key, i); + break; + case EVP_PKEY_DH: + print_pubkey_BN(dh, p, i); + print_pubkey_BN(dh, g, i); + print_pubkey_BN(dh, priv_key, i); + print_pubkey_BN(dh, pub_key, i); + break; +#if 0 + case EVP_PKEY_EC: /* symbol not present in OpenSSL 0.9.6 */ + /* left TODO */ + break; +#endif + } + EVP_PKEY_free(pubkey); + } + + X509V3_ext(data, i, cinf->extensions); + + X509_signature(data, i, x->signature); + + dumpcert(data, x, i); + } + + return CURLE_OK; +} + +/* + * Get the server cert, verify it and show it etc, only call failf() if the + * 'strict' argument is TRUE as otherwise all this is for informational + * purposes only! + * + * We check certificates to authenticate the server; otherwise we risk + * man-in-the-middle attack. + */ +static CURLcode servercert(struct connectdata *conn, + struct ssl_connect_data *connssl, + bool strict) +{ + CURLcode retcode = CURLE_OK; + int rc; + long lerr; + ASN1_TIME *certdate; + struct SessionHandle *data = conn->data; + X509 *issuer; + FILE *fp; + char buffer[256]; + + if(data->set.ssl.certinfo) + /* we've been asked to gather certificate info! */ + (void)get_cert_chain(conn, connssl); + + data->set.ssl.certverifyresult = !X509_V_OK; + + connssl->server_cert = SSL_get_peer_certificate(connssl->handle); + if(!connssl->server_cert) { + if(strict) + failf(data, "SSL: couldn't get peer certificate!"); + return CURLE_PEER_FAILED_VERIFICATION; + } + infof (data, "Server certificate:\n"); + + rc = x509_name_oneline(X509_get_subject_name(connssl->server_cert), + buffer, sizeof(buffer)); + if(rc) { + if(strict) + failf(data, "SSL: couldn't get X509-subject!"); + X509_free(connssl->server_cert); + connssl->server_cert = NULL; + return CURLE_SSL_CONNECT_ERROR; + } + infof(data, "\t subject: %s\n", buffer); + + certdate = X509_get_notBefore(connssl->server_cert); + asn1_output(certdate, buffer, sizeof(buffer)); + infof(data, "\t start date: %s\n", buffer); + + certdate = X509_get_notAfter(connssl->server_cert); + asn1_output(certdate, buffer, sizeof(buffer)); + infof(data, "\t expire date: %s\n", buffer); + + if(data->set.ssl.verifyhost) { + retcode = verifyhost(conn, connssl->server_cert); + if(retcode) { + X509_free(connssl->server_cert); + connssl->server_cert = NULL; + return retcode; + } + } + + rc = x509_name_oneline(X509_get_issuer_name(connssl->server_cert), + buffer, sizeof(buffer)); + if(rc) { + if(strict) + failf(data, "SSL: couldn't get X509-issuer name!"); + retcode = CURLE_SSL_CONNECT_ERROR; + } + else { + infof(data, "\t issuer: %s\n", buffer); + + /* We could do all sorts of certificate verification stuff here before + deallocating the certificate. */ + + /* e.g. match issuer name with provided issuer certificate */ + if (data->set.str[STRING_SSL_ISSUERCERT]) { + if (! (fp=fopen(data->set.str[STRING_SSL_ISSUERCERT],"r"))) { + if (strict) + failf(data, "SSL: Unable to open issuer cert (%s)\n", + data->set.str[STRING_SSL_ISSUERCERT]); + X509_free(connssl->server_cert); + connssl->server_cert = NULL; + return CURLE_SSL_ISSUER_ERROR; + } + issuer = PEM_read_X509(fp,NULL,ZERO_NULL,NULL); + if (!issuer) { + if (strict) + failf(data, "SSL: Unable to read issuer cert (%s)\n", + data->set.str[STRING_SSL_ISSUERCERT]); + X509_free(connssl->server_cert); + X509_free(issuer); + fclose(fp); + return CURLE_SSL_ISSUER_ERROR; + } + fclose(fp); + if (X509_check_issued(issuer,connssl->server_cert) != X509_V_OK) { + if (strict) + failf(data, "SSL: Certificate issuer check failed (%s)\n", + data->set.str[STRING_SSL_ISSUERCERT]); + X509_free(connssl->server_cert); + X509_free(issuer); + connssl->server_cert = NULL; + return CURLE_SSL_ISSUER_ERROR; + } + infof(data, "\t SSL certificate issuer check ok (%s)\n", + data->set.str[STRING_SSL_ISSUERCERT]); + X509_free(issuer); + } + + lerr = data->set.ssl.certverifyresult= + SSL_get_verify_result(connssl->handle); + if(data->set.ssl.certverifyresult != X509_V_OK) { + if(data->set.ssl.verifypeer) { + /* We probably never reach this, because SSL_connect() will fail + and we return earlier if verifypeer is set? */ + if(strict) + failf(data, "SSL certificate verify result: %s (%ld)", + X509_verify_cert_error_string(lerr), lerr); + retcode = CURLE_PEER_FAILED_VERIFICATION; + } + else + infof(data, "\t SSL certificate verify result: %s (%ld)," + " continuing anyway.\n", + X509_verify_cert_error_string(lerr), lerr); + } + else + infof(data, "\t SSL certificate verify ok.\n"); + } + + X509_free(connssl->server_cert); + connssl->server_cert = NULL; + connssl->connecting_state = ssl_connect_done; + + return retcode; +} + + +static CURLcode +ossl_connect_step3(struct connectdata *conn, + int sockindex) +{ + CURLcode retcode = CURLE_OK; + void *old_ssl_sessionid=NULL; + struct SessionHandle *data = conn->data; + struct ssl_connect_data *connssl = &conn->ssl[sockindex]; + int incache; + SSL_SESSION *our_ssl_sessionid; + + DEBUGASSERT(ssl_connect_3 == connssl->connecting_state); + +#ifdef HAVE_SSL_GET1_SESSION + our_ssl_sessionid = SSL_get1_session(connssl->handle); + + /* SSL_get1_session() will increment the reference + count and the session will stay in memory until explicitly freed with + SSL_SESSION_free(3), regardless of its state. + This function was introduced in openssl 0.9.5a. */ +#else + our_ssl_sessionid = SSL_get_session(connssl->handle); + + /* if SSL_get1_session() is unavailable, use SSL_get_session(). + This is an inferior option because the session can be flushed + at any time by openssl. It is included only so curl compiles + under versions of openssl < 0.9.5a. + + WARNING: How curl behaves if it's session is flushed is + untested. + */ +#endif + + incache = !(Curl_ssl_getsessionid(conn, &old_ssl_sessionid, NULL)); + if (incache) { + if (old_ssl_sessionid != our_ssl_sessionid) { + infof(data, "old SSL session ID is stale, removing\n"); + Curl_ssl_delsessionid(conn, old_ssl_sessionid); + incache = FALSE; + } + } + if (!incache) { + retcode = Curl_ssl_addsessionid(conn, our_ssl_sessionid, + 0 /* unknown size */); + if(retcode) { + failf(data, "failed to store ssl session"); + return retcode; + } + } +#ifdef HAVE_SSL_GET1_SESSION + else { + /* Session was incache, so refcount already incremented earlier. + * Avoid further increments with each SSL_get1_session() call. + * This does not free the session as refcount remains > 0 + */ + SSL_SESSION_free(our_ssl_sessionid); + } +#endif + + /* + * We check certificates to authenticate the server; otherwise we risk + * man-in-the-middle attack; NEVERTHELESS, if we're told explicitly not to + * verify the peer ignore faults and failures from the server cert + * operations. + */ + + if(!data->set.ssl.verifypeer) + (void)servercert(conn, connssl, FALSE); + else + retcode = servercert(conn, connssl, TRUE); + + if(CURLE_OK == retcode) + connssl->connecting_state = ssl_connect_done; + return retcode; +} + +static Curl_recv ossl_recv; +static Curl_send ossl_send; + +static CURLcode +ossl_connect_common(struct connectdata *conn, + int sockindex, + bool nonblocking, + bool *done) +{ + CURLcode retcode; + struct SessionHandle *data = conn->data; + struct ssl_connect_data *connssl = &conn->ssl[sockindex]; + curl_socket_t sockfd = conn->sock[sockindex]; + long timeout_ms; + int what; + + /* check if the connection has already been established */ + if(ssl_connection_complete == connssl->state) { + *done = TRUE; + return CURLE_OK; + } + + if(ssl_connect_1==connssl->connecting_state) { + /* Find out how much more time we're allowed */ + timeout_ms = Curl_timeleft(conn, NULL, TRUE); + + if(timeout_ms < 0) { + /* no need to continue if time already is up */ + failf(data, "SSL connection timeout"); + return CURLE_OPERATION_TIMEDOUT; + } + retcode = ossl_connect_step1(conn, sockindex); + if(retcode) + return retcode; + } + + while(ssl_connect_2 == connssl->connecting_state || + ssl_connect_2_reading == connssl->connecting_state || + ssl_connect_2_writing == connssl->connecting_state) { + + /* check allowed time left */ + timeout_ms = Curl_timeleft(conn, NULL, TRUE); + + if(timeout_ms < 0) { + /* no need to continue if time already is up */ + failf(data, "SSL connection timeout"); + return CURLE_OPERATION_TIMEDOUT; + } + + /* if ssl is expecting something, check if it's available. */ + if(connssl->connecting_state == ssl_connect_2_reading + || connssl->connecting_state == ssl_connect_2_writing) { + + curl_socket_t writefd = ssl_connect_2_writing== + connssl->connecting_state?sockfd:CURL_SOCKET_BAD; + curl_socket_t readfd = ssl_connect_2_reading== + connssl->connecting_state?sockfd:CURL_SOCKET_BAD; + + what = Curl_socket_ready(readfd, writefd, + nonblocking?0:(int)timeout_ms); + if(what < 0) { + /* fatal error */ + failf(data, "select/poll on SSL socket, errno: %d", SOCKERRNO); + return CURLE_SSL_CONNECT_ERROR; + } + else if(0 == what) { + if(nonblocking) { + *done = FALSE; + return CURLE_OK; + } + else { + /* timeout */ + failf(data, "SSL connection timeout"); + return CURLE_OPERATION_TIMEDOUT; + } + } + /* socket is readable or writable */ + } + + /* Run transaction, and return to the caller if it failed or if this + * connection is done nonblocking and this loop would execute again. This + * permits the owner of a multi handle to abort a connection attempt + * before step2 has completed while ensuring that a client using select() + * or epoll() will always have a valid fdset to wait on. + */ + retcode = ossl_connect_step2(conn, sockindex); + if(retcode || (nonblocking && + (ssl_connect_2 == connssl->connecting_state || + ssl_connect_2_reading == connssl->connecting_state || + ssl_connect_2_writing == connssl->connecting_state))) + return retcode; + + } /* repeat step2 until all transactions are done. */ + + + if(ssl_connect_3==connssl->connecting_state) { + retcode = ossl_connect_step3(conn, sockindex); + if(retcode) + return retcode; + } + + if(ssl_connect_done==connssl->connecting_state) { + connssl->state = ssl_connection_complete; + conn->recv[sockindex] = ossl_recv; + conn->send[sockindex] = ossl_send; + *done = TRUE; + } + else + *done = FALSE; + + /* Reset our connect state machine */ + connssl->connecting_state = ssl_connect_1; + + return CURLE_OK; +} + +CURLcode +Curl_ossl_connect_nonblocking(struct connectdata *conn, + int sockindex, + bool *done) +{ + return ossl_connect_common(conn, sockindex, TRUE, done); +} + +CURLcode +Curl_ossl_connect(struct connectdata *conn, + int sockindex) +{ + CURLcode retcode; + bool done = FALSE; + + retcode = ossl_connect_common(conn, sockindex, FALSE, &done); + if(retcode) + return retcode; + + DEBUGASSERT(done); + + return CURLE_OK; +} + +bool Curl_ossl_data_pending(const struct connectdata *conn, + int connindex) +{ + if(conn->ssl[connindex].handle) + /* SSL is in use */ + return (bool)(0 != SSL_pending(conn->ssl[connindex].handle)); + else + return FALSE; +} + +static ssize_t ossl_send(struct connectdata *conn, + int sockindex, + const void *mem, + size_t len, + CURLcode *curlcode) +{ + /* SSL_write() is said to return 'int' while write() and send() returns + 'size_t' */ + int err; + char error_buffer[120]; /* OpenSSL documents that this must be at least 120 + bytes long. */ + unsigned long sslerror; + int memlen; + int rc; + + ERR_clear_error(); + + memlen = (len > (size_t)INT_MAX) ? INT_MAX : (int)len; + rc = SSL_write(conn->ssl[sockindex].handle, mem, memlen); + + if(rc < 0) { + err = SSL_get_error(conn->ssl[sockindex].handle, rc); + + switch(err) { + case SSL_ERROR_WANT_READ: + case SSL_ERROR_WANT_WRITE: + /* The operation did not complete; the same TLS/SSL I/O function + should be called again later. This is basicly an EWOULDBLOCK + equivalent. */ + *curlcode = CURLE_AGAIN; + return -1; + case SSL_ERROR_SYSCALL: + failf(conn->data, "SSL_write() returned SYSCALL, errno = %d", + SOCKERRNO); + *curlcode = CURLE_SEND_ERROR; + return -1; + case SSL_ERROR_SSL: + /* A failure in the SSL library occurred, usually a protocol error. + The OpenSSL error queue contains more information on the error. */ + sslerror = ERR_get_error(); + failf(conn->data, "SSL_write() error: %s", + ERR_error_string(sslerror, error_buffer)); + *curlcode = CURLE_SEND_ERROR; + return -1; + } + /* a true error */ + failf(conn->data, "SSL_write() return error %d", err); + *curlcode = CURLE_SEND_ERROR; + return -1; + } + return (ssize_t)rc; /* number of bytes */ +} + +static ssize_t ossl_recv(struct connectdata *conn, /* connection data */ + int num, /* socketindex */ + char *buf, /* store read data here */ + size_t buffersize, /* max amount to read */ + CURLcode *curlcode) +{ + char error_buffer[120]; /* OpenSSL documents that this must be at + least 120 bytes long. */ + unsigned long sslerror; + ssize_t nread; + int buffsize; + + ERR_clear_error(); + + buffsize = (buffersize > (size_t)INT_MAX) ? INT_MAX : (int)buffersize; + nread = (ssize_t)SSL_read(conn->ssl[num].handle, buf, buffsize); + if(nread < 0) { + /* failed SSL_read */ + int err = SSL_get_error(conn->ssl[num].handle, (int)nread); + + switch(err) { + case SSL_ERROR_NONE: /* this is not an error */ + case SSL_ERROR_ZERO_RETURN: /* no more data */ + break; + case SSL_ERROR_WANT_READ: + case SSL_ERROR_WANT_WRITE: + /* there's data pending, re-invoke SSL_read() */ + *curlcode = CURLE_AGAIN; + return -1; + default: + /* openssl/ssl.h says "look at error stack/return value/errno" */ + sslerror = ERR_get_error(); + failf(conn->data, "SSL read: %s, errno %d", + ERR_error_string(sslerror, error_buffer), + SOCKERRNO); + *curlcode = CURLE_RECV_ERROR; + return -1; + } + } + return nread; +} + +size_t Curl_ossl_version(char *buffer, size_t size) +{ +#ifdef YASSL_VERSION + /* yassl provides an OpenSSL API compatiblity layer so it looks identical + to OpenSSL in all other aspects */ + return snprintf(buffer, size, "yassl/%s", YASSL_VERSION); +#else /* YASSL_VERSION */ + +#if(SSLEAY_VERSION_NUMBER >= 0x905000) + { + char sub[2]; + unsigned long ssleay_value; + sub[1]='\0'; + ssleay_value=SSLeay(); + if(ssleay_value < 0x906000) { + ssleay_value=SSLEAY_VERSION_NUMBER; + sub[0]='\0'; + } + else { + if(ssleay_value&0xff0) { + sub[0]=(char)(((ssleay_value>>4)&0xff) + 'a' -1); + } + else + sub[0]='\0'; + } + + return snprintf(buffer, size, "OpenSSL/%lx.%lx.%lx%s", + (ssleay_value>>28)&0xf, + (ssleay_value>>20)&0xff, + (ssleay_value>>12)&0xff, + sub); + } + +#else /* SSLEAY_VERSION_NUMBER is less than 0.9.5 */ + +#if(SSLEAY_VERSION_NUMBER >= 0x900000) + return snprintf(buffer, size, "OpenSSL/%lx.%lx.%lx", + (SSLEAY_VERSION_NUMBER>>28)&0xff, + (SSLEAY_VERSION_NUMBER>>20)&0xff, + (SSLEAY_VERSION_NUMBER>>12)&0xf); + +#else /* (SSLEAY_VERSION_NUMBER >= 0x900000) */ + { + char sub[2]; + sub[1]='\0'; + if(SSLEAY_VERSION_NUMBER&0x0f) { + sub[0]=(SSLEAY_VERSION_NUMBER&0x0f) + 'a' -1; + } + else + sub[0]='\0'; + + return snprintf(buffer, size, "SSL/%x.%x.%x%s", + (SSLEAY_VERSION_NUMBER>>12)&0xff, + (SSLEAY_VERSION_NUMBER>>8)&0xf, + (SSLEAY_VERSION_NUMBER>>4)&0xf, sub); + } +#endif /* (SSLEAY_VERSION_NUMBER >= 0x900000) */ +#endif /* SSLEAY_VERSION_NUMBER is less than 0.9.5 */ + +#endif /* YASSL_VERSION */ +} +#endif /* USE_SSLEAY */ diff --git a/mobicore/common/curl/lib/ssluse.h b/mobicore/common/curl/lib/ssluse.h new file mode 100644 index 0000000000000000000000000000000000000000..2ac0ad2ec630c2e269e94cfa1e94ec38ba1bcde9 --- /dev/null +++ b/mobicore/common/curl/lib/ssluse.h @@ -0,0 +1,84 @@ +#ifndef __SSLUSE_H +#define __SSLUSE_H +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) 1998 - 2010, Daniel Stenberg, , et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at http://curl.haxx.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ***************************************************************************/ + +#ifdef USE_SSLEAY +/* + * This header should only be needed to get included by sslgen.c and ssluse.c + */ + +#include "urldata.h" +CURLcode Curl_ossl_connect(struct connectdata *conn, int sockindex); +CURLcode Curl_ossl_connect_nonblocking(struct connectdata *conn, + int sockindex, + bool *done); + +/* close a SSL connection */ +void Curl_ossl_close(struct connectdata *conn, int sockindex); + +/* tell OpenSSL to close down all open information regarding connections (and + thus session ID caching etc) */ +int Curl_ossl_close_all(struct SessionHandle *data); + +/* Sets an OpenSSL engine */ +CURLcode Curl_ossl_set_engine(struct SessionHandle *data, const char *engine); + +/* function provided for the generic SSL-layer, called when a session id + should be freed */ +void Curl_ossl_session_free(void *ptr); + +/* Sets engine as default for all SSL operations */ +CURLcode Curl_ossl_set_engine_default(struct SessionHandle *data); + +/* Build list of OpenSSL engines */ +struct curl_slist *Curl_ossl_engines_list(struct SessionHandle *data); + +int Curl_ossl_init(void); +void Curl_ossl_cleanup(void); + +size_t Curl_ossl_version(char *buffer, size_t size); +int Curl_ossl_check_cxn(struct connectdata *cxn); +int Curl_ossl_seed(struct SessionHandle *data); + +int Curl_ossl_shutdown(struct connectdata *conn, int sockindex); +bool Curl_ossl_data_pending(const struct connectdata *conn, + int connindex); + +/* API setup for OpenSSL */ +#define curlssl_init Curl_ossl_init +#define curlssl_cleanup Curl_ossl_cleanup +#define curlssl_connect Curl_ossl_connect +#define curlssl_connect_nonblocking Curl_ossl_connect_nonblocking +#define curlssl_session_free(x) Curl_ossl_session_free(x) +#define curlssl_close_all Curl_ossl_close_all +#define curlssl_close Curl_ossl_close +#define curlssl_shutdown(x,y) Curl_ossl_shutdown(x,y) +#define curlssl_set_engine(x,y) Curl_ossl_set_engine(x,y) +#define curlssl_set_engine_default(x) Curl_ossl_set_engine_default(x) +#define curlssl_engines_list(x) Curl_ossl_engines_list(x) +#define curlssl_version Curl_ossl_version +#define curlssl_check_cxn Curl_ossl_check_cxn +#define curlssl_data_pending(x,y) Curl_ossl_data_pending(x,y) + +#endif /* USE_SSLEAY */ +#endif /* __SSLUSE_H */ diff --git a/mobicore/common/curl/lib/stamp-h1 b/mobicore/common/curl/lib/stamp-h1 new file mode 100644 index 0000000000000000000000000000000000000000..8f5adb6e9531009187cc85a38bba3047d6a974a5 --- /dev/null +++ b/mobicore/common/curl/lib/stamp-h1 @@ -0,0 +1 @@ +timestamp for lib/curl_config.h diff --git a/mobicore/common/curl/lib/strdup.c b/mobicore/common/curl/lib/strdup.c new file mode 100644 index 0000000000000000000000000000000000000000..a3107cff7385b3e251bc5061a64fb2ecc180832e --- /dev/null +++ b/mobicore/common/curl/lib/strdup.c @@ -0,0 +1,49 @@ +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) 1998 - 2008, Daniel Stenberg, , et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at http://curl.haxx.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ***************************************************************************/ + +#include "setup.h" +#include "strdup.h" + +#ifndef HAVE_STRDUP +char *curlx_strdup(const char *str) +{ + size_t len; + char *newstr; + + if(!str) + return (char *)NULL; + + len = strlen(str); + + if(len >= ((size_t)-1) / sizeof(char)) + return (char *)NULL; + + newstr = malloc((len+1)*sizeof(char)); + if(!newstr) + return (char *)NULL; + + memcpy(newstr,str,(len+1)*sizeof(char)); + + return newstr; + +} +#endif diff --git a/mobicore/common/curl/lib/strdup.h b/mobicore/common/curl/lib/strdup.h new file mode 100644 index 0000000000000000000000000000000000000000..4edbcd7d4e476366c64e73cc644507921bf4b249 --- /dev/null +++ b/mobicore/common/curl/lib/strdup.h @@ -0,0 +1,30 @@ +#ifndef HEADER_CURL_STRDUP_H +#define HEADER_CURL_STRDUP_H +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) 1998 - 2010, Daniel Stenberg, , et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at http://curl.haxx.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ***************************************************************************/ +#include "setup.h" + +#ifndef HAVE_STRDUP +extern char *curlx_strdup(const char *str); +#endif + +#endif /* HEADER_CURL_STRDUP_H */ diff --git a/mobicore/common/curl/lib/strequal.c b/mobicore/common/curl/lib/strequal.c new file mode 100644 index 0000000000000000000000000000000000000000..f6bf5f3b988841c3f98e6e3dcf83134cc89feb5d --- /dev/null +++ b/mobicore/common/curl/lib/strequal.c @@ -0,0 +1,121 @@ +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) 1998 - 2010, Daniel Stenberg, , et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at http://curl.haxx.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ***************************************************************************/ + +#include "setup.h" + +#include +#include + +#ifdef HAVE_STRINGS_H +#include +#endif + +#include "strequal.h" + +int curl_strequal(const char *first, const char *second) +{ +#if defined(HAVE_STRCASECMP) + return !(strcasecmp)(first, second); +#elif defined(HAVE_STRCMPI) + return !(strcmpi)(first, second); +#elif defined(HAVE_STRICMP) + return !(stricmp)(first, second); +#else + while(*first && *second) { + if(toupper(*first) != toupper(*second)) { + break; + } + first++; + second++; + } + return toupper(*first) == toupper(*second); +#endif +} + +int curl_strnequal(const char *first, const char *second, size_t max) +{ +#if defined(HAVE_STRNCASECMP) + return !strncasecmp(first, second, max); +#elif defined(HAVE_STRNCMPI) + return !strncmpi(first, second, max); +#elif defined(HAVE_STRNICMP) + return !strnicmp(first, second, max); +#else + while(*first && *second && max) { + if(toupper(*first) != toupper(*second)) { + break; + } + max--; + first++; + second++; + } + if(0 == max) + return 1; /* they are equal this far */ + + return toupper(*first) == toupper(*second); +#endif +} + +#ifndef HAVE_STRLCAT +/* + * The strlcat() function appends the NUL-terminated string src to the end + * of dst. It will append at most size - strlen(dst) - 1 bytes, NUL-termi- + * nating the result. + * + * The strlcpy() and strlcat() functions return the total length of the + * string they tried to create. For strlcpy() that means the length of src. + * For strlcat() that means the initial length of dst plus the length of + * src. While this may seem somewhat confusing it was done to make trunca- + * tion detection simple. + * + * + */ +size_t Curl_strlcat(char *dst, const char *src, size_t siz) +{ + char *d = dst; + const char *s = src; + size_t n = siz; + union { + ssize_t sig; + size_t uns; + } dlen; + + /* Find the end of dst and adjust bytes left but don't go past end */ + while(n-- != 0 && *d != '\0') + d++; + dlen.sig = d - dst; + n = siz - dlen.uns; + + if(n == 0) + return(dlen.uns + strlen(s)); + while(*s != '\0') { + if(n != 1) { + *d++ = *s; + n--; + } + s++; + } + *d = '\0'; + + return(dlen.uns + (s - src)); /* count does not include NUL */ +} +#endif diff --git a/mobicore/common/curl/lib/strequal.h b/mobicore/common/curl/lib/strequal.h new file mode 100644 index 0000000000000000000000000000000000000000..202c9197df28714e27c96ff2338137558472ae2a --- /dev/null +++ b/mobicore/common/curl/lib/strequal.h @@ -0,0 +1,35 @@ +#ifndef __STREQUAL_H +#define __STREQUAL_H +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) 1998 - 2008, Daniel Stenberg, , et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at http://curl.haxx.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ***************************************************************************/ + +#include + +#define strequal(a,b) curl_strequal(a,b) +#define strnequal(a,b,c) curl_strnequal(a,b,c) + +#ifndef HAVE_STRLCAT +#define strlcat(x,y,z) Curl_strlcat(x,y,z) +#endif +size_t strlcat(char *dst, const char *src, size_t siz); + +#endif diff --git a/mobicore/common/curl/lib/strerror.c b/mobicore/common/curl/lib/strerror.c new file mode 100644 index 0000000000000000000000000000000000000000..e8ecea59fda4e492ebf5b84c4548bd544441d1fd --- /dev/null +++ b/mobicore/common/curl/lib/strerror.c @@ -0,0 +1,775 @@ +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) 2004 - 2010, Daniel Stenberg, , et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at http://curl.haxx.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ***************************************************************************/ + +#include "setup.h" + +#ifdef HAVE_STRERROR_R +# if (!defined(HAVE_POSIX_STRERROR_R) && \ + !defined(HAVE_GLIBC_STRERROR_R) && \ + !defined(HAVE_VXWORKS_STRERROR_R)) || \ + (defined(HAVE_POSIX_STRERROR_R) && defined(HAVE_VXWORKS_STRERROR_R)) || \ + (defined(HAVE_GLIBC_STRERROR_R) && defined(HAVE_VXWORKS_STRERROR_R)) || \ + (defined(HAVE_POSIX_STRERROR_R) && defined(HAVE_GLIBC_STRERROR_R)) +# error "strerror_r MUST be either POSIX-style, glibc-style or vxworks-style" +# endif +#endif + +#include +#include +#include +#include + +#ifdef USE_LIBIDN +#include +#endif + +#include "strerror.h" + +#define _MPRINTF_REPLACE /* use our functions only */ +#include + + +const char * +curl_easy_strerror(CURLcode error) +{ +#ifndef CURL_DISABLE_VERBOSE_STRINGS + switch (error) { + case CURLE_OK: + return "No error"; + + case CURLE_UNSUPPORTED_PROTOCOL: + return "Unsupported protocol"; + + case CURLE_FAILED_INIT: + return "Failed initialization"; + + case CURLE_URL_MALFORMAT: + return "URL using bad/illegal format or missing URL"; + + case CURLE_COULDNT_RESOLVE_PROXY: + return "Couldn't resolve proxy name"; + + case CURLE_COULDNT_RESOLVE_HOST: + return "Couldn't resolve host name"; + + case CURLE_COULDNT_CONNECT: + return "Couldn't connect to server"; + + case CURLE_FTP_WEIRD_SERVER_REPLY: + return "FTP: weird server reply"; + + case CURLE_REMOTE_ACCESS_DENIED: + return "Access denied to remote resource"; + + case CURLE_FTP_PRET_FAILED: + return "FTP: The server did not accept the PRET command."; + + case CURLE_FTP_WEIRD_PASS_REPLY: + return "FTP: unknown PASS reply"; + + case CURLE_FTP_WEIRD_PASV_REPLY: + return "FTP: unknown PASV reply"; + + case CURLE_FTP_WEIRD_227_FORMAT: + return "FTP: unknown 227 response format"; + + case CURLE_FTP_CANT_GET_HOST: + return "FTP: can't figure out the host in the PASV response"; + + case CURLE_FTP_COULDNT_SET_TYPE: + return "FTP: couldn't set file type"; + + case CURLE_PARTIAL_FILE: + return "Transferred a partial file"; + + case CURLE_FTP_COULDNT_RETR_FILE: + return "FTP: couldn't retrieve (RETR failed) the specified file"; + + case CURLE_QUOTE_ERROR: + return "Quote command returned error"; + + case CURLE_HTTP_RETURNED_ERROR: + return "HTTP response code said error"; + + case CURLE_WRITE_ERROR: + return "Failed writing received data to disk/application"; + + case CURLE_UPLOAD_FAILED: + return "Upload failed (at start/before it took off)"; + + case CURLE_READ_ERROR: + return "Failed to open/read local data from file/application"; + + case CURLE_OUT_OF_MEMORY: + return "Out of memory"; + + case CURLE_OPERATION_TIMEDOUT: + return "Timeout was reached"; + + case CURLE_FTP_PORT_FAILED: + return "FTP: command PORT failed"; + + case CURLE_FTP_COULDNT_USE_REST: + return "FTP: command REST failed"; + + case CURLE_RANGE_ERROR: + return "Requested range was not delivered by the server"; + + case CURLE_HTTP_POST_ERROR: + return "Internal problem setting up the POST"; + + case CURLE_SSL_CONNECT_ERROR: + return "SSL connect error"; + + case CURLE_BAD_DOWNLOAD_RESUME: + return "Couldn't resume download"; + + case CURLE_FILE_COULDNT_READ_FILE: + return "Couldn't read a file:// file"; + + case CURLE_LDAP_CANNOT_BIND: + return "LDAP: cannot bind"; + + case CURLE_LDAP_SEARCH_FAILED: + return "LDAP: search failed"; + + case CURLE_FUNCTION_NOT_FOUND: + return "A required function in the library was not found"; + + case CURLE_ABORTED_BY_CALLBACK: + return "Operation was aborted by an application callback"; + + case CURLE_BAD_FUNCTION_ARGUMENT: + return "A libcurl function was given a bad argument"; + + case CURLE_INTERFACE_FAILED: + return "Failed binding local connection end"; + + case CURLE_TOO_MANY_REDIRECTS : + return "Number of redirects hit maximum amount"; + + case CURLE_UNKNOWN_TELNET_OPTION: + return "User specified an unknown telnet option"; + + case CURLE_TELNET_OPTION_SYNTAX : + return "Malformed telnet option"; + + case CURLE_PEER_FAILED_VERIFICATION: + return "SSL peer certificate or SSH remote key was not OK"; + + case CURLE_GOT_NOTHING: + return "Server returned nothing (no headers, no data)"; + + case CURLE_SSL_ENGINE_NOTFOUND: + return "SSL crypto engine not found"; + + case CURLE_SSL_ENGINE_SETFAILED: + return "Can not set SSL crypto engine as default"; + + case CURLE_SSL_ENGINE_INITFAILED: + return "Failed to initialise SSL crypto engine"; + + case CURLE_SEND_ERROR: + return "Failed sending data to the peer"; + + case CURLE_RECV_ERROR: + return "Failure when receiving data from the peer"; + + case CURLE_SSL_CERTPROBLEM: + return "Problem with the local SSL certificate"; + + case CURLE_SSL_CIPHER: + return "Couldn't use specified SSL cipher"; + + case CURLE_SSL_CACERT: + return "Peer certificate cannot be authenticated with known CA certificates"; + + case CURLE_SSL_CACERT_BADFILE: + return "Problem with the SSL CA cert (path? access rights?)"; + + case CURLE_BAD_CONTENT_ENCODING: + return "Unrecognized HTTP Content-Encoding"; + + case CURLE_LDAP_INVALID_URL: + return "Invalid LDAP URL"; + + case CURLE_FILESIZE_EXCEEDED: + return "Maximum file size exceeded"; + + case CURLE_USE_SSL_FAILED: + return "Requested SSL level failed"; + + case CURLE_SSL_SHUTDOWN_FAILED: + return "Failed to shut down the SSL connection"; + + case CURLE_SSL_CRL_BADFILE: + return "Failed to load CRL file (path? access rights?, format?)"; + + case CURLE_SSL_ISSUER_ERROR: + return "Issuer check against peer certificate failed"; + + case CURLE_SEND_FAIL_REWIND: + return "Send failed since rewinding of the data stream failed"; + + case CURLE_LOGIN_DENIED: + return "Login denied"; + + case CURLE_TFTP_NOTFOUND: + return "TFTP: File Not Found"; + + case CURLE_TFTP_PERM: + return "TFTP: Access Violation"; + + case CURLE_REMOTE_DISK_FULL: + return "Disk full or allocation exceeded"; + + case CURLE_TFTP_ILLEGAL: + return "TFTP: Illegal operation"; + + case CURLE_TFTP_UNKNOWNID: + return "TFTP: Unknown transfer ID"; + + case CURLE_REMOTE_FILE_EXISTS: + return "Remote file already exists"; + + case CURLE_TFTP_NOSUCHUSER: + return "TFTP: No such user"; + + case CURLE_CONV_FAILED: + return "Conversion failed"; + + case CURLE_CONV_REQD: + return "Caller must register CURLOPT_CONV_ callback options"; + + case CURLE_REMOTE_FILE_NOT_FOUND: + return "Remote file not found"; + + case CURLE_SSH: + return "Error in the SSH layer"; + + case CURLE_AGAIN: + return "Socket not ready for send/recv"; + + case CURLE_RTSP_CSEQ_ERROR: + return "RTSP CSeq mismatch or invalid CSeq"; + + case CURLE_RTSP_SESSION_ERROR: + return "RTSP session error"; + + case CURLE_FTP_BAD_FILE_LIST: + return "Unable to parse FTP file list"; + + case CURLE_CHUNK_FAILED: + return "Chunk callback failed"; + + /* error codes not used by current libcurl */ + case CURLE_OBSOLETE4: + case CURLE_OBSOLETE10: + case CURLE_OBSOLETE12: + case CURLE_OBSOLETE16: + case CURLE_OBSOLETE20: + case CURLE_OBSOLETE24: + case CURLE_OBSOLETE29: + case CURLE_OBSOLETE32: + case CURLE_OBSOLETE40: + case CURLE_OBSOLETE44: + case CURLE_OBSOLETE46: + case CURLE_OBSOLETE50: + case CURLE_OBSOLETE57: + case CURL_LAST: + break; + } + /* + * By using a switch, gcc -Wall will complain about enum values + * which do not appear, helping keep this function up-to-date. + * By using gcc -Wall -Werror, you can't forget. + * + * A table would not have the same benefit. Most compilers will + * generate code very similar to a table in any case, so there + * is little performance gain from a table. And something is broken + * for the user's application, anyways, so does it matter how fast + * it _doesn't_ work? + * + * The line number for the error will be near this comment, which + * is why it is here, and not at the start of the switch. + */ + return "Unknown error"; +#else + if(error == CURLE_OK) + return "No error"; + else + return "Error"; +#endif +} + +const char * +curl_multi_strerror(CURLMcode error) +{ +#ifndef CURL_DISABLE_VERBOSE_STRINGS + switch (error) { + case CURLM_CALL_MULTI_PERFORM: + return "Please call curl_multi_perform() soon"; + + case CURLM_OK: + return "No error"; + + case CURLM_BAD_HANDLE: + return "Invalid multi handle"; + + case CURLM_BAD_EASY_HANDLE: + return "Invalid easy handle"; + + case CURLM_OUT_OF_MEMORY: + return "Out of memory"; + + case CURLM_INTERNAL_ERROR: + return "Internal error"; + + case CURLM_BAD_SOCKET: + return "Invalid socket argument"; + + case CURLM_UNKNOWN_OPTION: + return "Unknown option"; + + case CURLM_LAST: + break; + } + + return "Unknown error"; +#else + if(error == CURLM_OK) + return "No error"; + else + return "Error"; +#endif +} + +const char * +curl_share_strerror(CURLSHcode error) +{ +#ifndef CURL_DISABLE_VERBOSE_STRINGS + switch (error) { + case CURLSHE_OK: + return "No error"; + + case CURLSHE_BAD_OPTION: + return "Unknown share option"; + + case CURLSHE_IN_USE: + return "Share currently in use"; + + case CURLSHE_INVALID: + return "Invalid share handle"; + + case CURLSHE_NOMEM: + return "Out of memory"; + + case CURLSHE_LAST: + break; + } + + return "CURLSHcode unknown"; +#else + if(error == CURLSHE_OK) + return "No error"; + else + return "Error"; +#endif +} + +#ifdef USE_WINSOCK + +/* This function handles most / all (?) Winsock errors cURL is able to produce. + */ +static const char * +get_winsock_error (int err, char *buf, size_t len) +{ + const char *p; + +#ifndef CURL_DISABLE_VERBOSE_STRINGS + switch (err) { + case WSAEINTR: + p = "Call interrupted"; + break; + case WSAEBADF: + p = "Bad file"; + break; + case WSAEACCES: + p = "Bad access"; + break; + case WSAEFAULT: + p = "Bad argument"; + break; + case WSAEINVAL: + p = "Invalid arguments"; + break; + case WSAEMFILE: + p = "Out of file descriptors"; + break; + case WSAEWOULDBLOCK: + p = "Call would block"; + break; + case WSAEINPROGRESS: + case WSAEALREADY: + p = "Blocking call in progress"; + break; + case WSAENOTSOCK: + p = "Descriptor is not a socket"; + break; + case WSAEDESTADDRREQ: + p = "Need destination address"; + break; + case WSAEMSGSIZE: + p = "Bad message size"; + break; + case WSAEPROTOTYPE: + p = "Bad protocol"; + break; + case WSAENOPROTOOPT: + p = "Protocol option is unsupported"; + break; + case WSAEPROTONOSUPPORT: + p = "Protocol is unsupported"; + break; + case WSAESOCKTNOSUPPORT: + p = "Socket is unsupported"; + break; + case WSAEOPNOTSUPP: + p = "Operation not supported"; + break; + case WSAEAFNOSUPPORT: + p = "Address family not supported"; + break; + case WSAEPFNOSUPPORT: + p = "Protocol family not supported"; + break; + case WSAEADDRINUSE: + p = "Address already in use"; + break; + case WSAEADDRNOTAVAIL: + p = "Address not available"; + break; + case WSAENETDOWN: + p = "Network down"; + break; + case WSAENETUNREACH: + p = "Network unreachable"; + break; + case WSAENETRESET: + p = "Network has been reset"; + break; + case WSAECONNABORTED: + p = "Connection was aborted"; + break; + case WSAECONNRESET: + p = "Connection was reset"; + break; + case WSAENOBUFS: + p = "No buffer space"; + break; + case WSAEISCONN: + p = "Socket is already connected"; + break; + case WSAENOTCONN: + p = "Socket is not connected"; + break; + case WSAESHUTDOWN: + p = "Socket has been shut down"; + break; + case WSAETOOMANYREFS: + p = "Too many references"; + break; + case WSAETIMEDOUT: + p = "Timed out"; + break; + case WSAECONNREFUSED: + p = "Connection refused"; + break; + case WSAELOOP: + p = "Loop??"; + break; + case WSAENAMETOOLONG: + p = "Name too long"; + break; + case WSAEHOSTDOWN: + p = "Host down"; + break; + case WSAEHOSTUNREACH: + p = "Host unreachable"; + break; + case WSAENOTEMPTY: + p = "Not empty"; + break; + case WSAEPROCLIM: + p = "Process limit reached"; + break; + case WSAEUSERS: + p = "Too many users"; + break; + case WSAEDQUOT: + p = "Bad quota"; + break; + case WSAESTALE: + p = "Something is stale"; + break; + case WSAEREMOTE: + p = "Remote error"; + break; +#ifdef WSAEDISCON /* missing in SalfordC! */ + case WSAEDISCON: + p = "Disconnected"; + break; +#endif + /* Extended Winsock errors */ + case WSASYSNOTREADY: + p = "Winsock library is not ready"; + break; + case WSANOTINITIALISED: + p = "Winsock library not initialised"; + break; + case WSAVERNOTSUPPORTED: + p = "Winsock version not supported"; + break; + + /* getXbyY() errors (already handled in herrmsg): + * Authoritative Answer: Host not found */ + case WSAHOST_NOT_FOUND: + p = "Host not found"; + break; + + /* Non-Authoritative: Host not found, or SERVERFAIL */ + case WSATRY_AGAIN: + p = "Host not found, try again"; + break; + + /* Non recoverable errors, FORMERR, REFUSED, NOTIMP */ + case WSANO_RECOVERY: + p = "Unrecoverable error in call to nameserver"; + break; + + /* Valid name, no data record of requested type */ + case WSANO_DATA: + p = "No data record of requested type"; + break; + + default: + return NULL; + } +#else + if(err == CURLE_OK) + return NULL; + else + p = "error"; +#endif + strncpy (buf, p, len); + buf [len-1] = '\0'; + return buf; +} +#endif /* USE_WINSOCK */ + +/* + * Our thread-safe and smart strerror() replacement. + * + * The 'err' argument passed in to this function MUST be a true errno number + * as reported on this system. We do no range checking on the number before + * we pass it to the "number-to-message" conversion function and there might + * be systems that don't do proper range checking in there themselves. + * + * We don't do range checking (on systems other than Windows) since there is + * no good reliable and portable way to do it. + */ +const char *Curl_strerror(struct connectdata *conn, int err) +{ + char *buf, *p; + size_t max; + int old_errno = ERRNO; + + DEBUGASSERT(conn); + DEBUGASSERT(err >= 0); + + buf = conn->syserr_buf; + max = sizeof(conn->syserr_buf)-1; + *buf = '\0'; + +#ifdef USE_WINSOCK + +#ifdef _WIN32_WCE + { + wchar_t wbuf[256]; + wbuf[0] = L'\0'; + + FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM, NULL, err, + LANG_NEUTRAL, wbuf, sizeof(wbuf)/sizeof(wchar_t), NULL); + wcstombs(buf,wbuf,max); + } +#else + /* 'sys_nerr' is the maximum errno number, it is not widely portable */ + if(err >= 0 && err < sys_nerr) + strncpy(buf, strerror(err), max); + else { + if(!get_winsock_error(err, buf, max) && + !FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM, NULL, err, + LANG_NEUTRAL, buf, (DWORD)max, NULL)) + snprintf(buf, max, "Unknown error %d (%#x)", err, err); + } +#endif + +#else /* not USE_WINSOCK coming up */ + +#if defined(HAVE_STRERROR_R) && defined(HAVE_POSIX_STRERROR_R) + /* + * The POSIX-style strerror_r() may set errno to ERANGE if insufficient + * storage is supplied via 'strerrbuf' and 'buflen' to hold the generated + * message string, or EINVAL if 'errnum' is not a valid error number. + */ + if(0 != strerror_r(err, buf, max)) { + if('\0' == buf[0]) + snprintf(buf, max, "Unknown error %d", err); + } +#elif defined(HAVE_STRERROR_R) && defined(HAVE_GLIBC_STRERROR_R) + /* + * The glibc-style strerror_r() only *might* use the buffer we pass to + * the function, but it always returns the error message as a pointer, + * so we must copy that string unconditionally (if non-NULL). + */ + { + char buffer[256]; + char *msg = strerror_r(err, buffer, sizeof(buffer)); + if(msg) + strncpy(buf, msg, max); + else + snprintf(buf, max, "Unknown error %d", err); + } +#elif defined(HAVE_STRERROR_R) && defined(HAVE_VXWORKS_STRERROR_R) + /* + * The vxworks-style strerror_r() does use the buffer we pass to the function. + * The buffer size should be at least MAXERRSTR_SIZE (150) defined in rtsold.h + */ + { + char buffer[256]; + if(OK == strerror_r(err, buffer)) + strncpy(buf, buffer, max); + else + snprintf(buf, max, "Unknown error %d", err); + } +#else + { + char *msg = strerror(err); + if(msg) + strncpy(buf, msg, max); + else + snprintf(buf, max, "Unknown error %d", err); + } +#endif + +#endif /* end of ! USE_WINSOCK */ + + buf[max] = '\0'; /* make sure the string is zero terminated */ + + /* strip trailing '\r\n' or '\n'. */ + if((p = strrchr(buf,'\n')) != NULL && (p - buf) >= 2) + *p = '\0'; + if((p = strrchr(buf,'\r')) != NULL && (p - buf) >= 1) + *p = '\0'; + + if(old_errno != ERRNO) + SET_ERRNO(old_errno); + + return buf; +} + +#ifdef USE_LIBIDN +/* + * Return error-string for libidn status as returned from idna_to_ascii_lz(). + */ +const char *Curl_idn_strerror (struct connectdata *conn, int err) +{ +#ifdef HAVE_IDNA_STRERROR + (void)conn; + return idna_strerror((Idna_rc) err); +#else + const char *str; + char *buf; + size_t max; + + DEBUGASSERT(conn); + + buf = conn->syserr_buf; + max = sizeof(conn->syserr_buf)-1; + *buf = '\0'; + +#ifndef CURL_DISABLE_VERBOSE_STRINGS + switch ((Idna_rc)err) { + case IDNA_SUCCESS: + str = "No error"; + break; + case IDNA_STRINGPREP_ERROR: + str = "Error in string preparation"; + break; + case IDNA_PUNYCODE_ERROR: + str = "Error in Punycode operation"; + break; + case IDNA_CONTAINS_NON_LDH: + str = "Illegal ASCII characters"; + break; + case IDNA_CONTAINS_MINUS: + str = "Contains minus"; + break; + case IDNA_INVALID_LENGTH: + str = "Invalid output length"; + break; + case IDNA_NO_ACE_PREFIX: + str = "No ACE prefix (\"xn--\")"; + break; + case IDNA_ROUNDTRIP_VERIFY_ERROR: + str = "Round trip verify error"; + break; + case IDNA_CONTAINS_ACE_PREFIX: + str = "Already have ACE prefix (\"xn--\")"; + break; + case IDNA_ICONV_ERROR: + str = "Locale conversion failed"; + break; + case IDNA_MALLOC_ERROR: + str = "Allocation failed"; + break; + case IDNA_DLOPEN_ERROR: + str = "dlopen() error"; + break; + default: + snprintf(buf, max, "error %d", err); + str = NULL; + break; + } +#else + if((Idna_rc)err == IDNA_SUCCESS) + str = "No error"; + else + str = "Error"; +#endif + if(str) + strncpy(buf, str, max); + buf[max] = '\0'; + return (buf); +#endif +} +#endif /* USE_LIBIDN */ diff --git a/mobicore/common/curl/lib/strerror.h b/mobicore/common/curl/lib/strerror.h new file mode 100644 index 0000000000000000000000000000000000000000..7f2342aea1fd54c7e5dfb4891ea7b7b000472ef5 --- /dev/null +++ b/mobicore/common/curl/lib/strerror.h @@ -0,0 +1,33 @@ +#ifndef __CURL_STRERROR_H +#define __CURL_STRERROR_H +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) 1998 - 2009, Daniel Stenberg, , et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at http://curl.haxx.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ***************************************************************************/ + +#include "urldata.h" + +const char *Curl_strerror (struct connectdata *conn, int err); + +#ifdef USE_LIBIDN +const char *Curl_idn_strerror (struct connectdata *conn, int err); +#endif + +#endif diff --git a/mobicore/common/curl/lib/strtok.c b/mobicore/common/curl/lib/strtok.c new file mode 100644 index 0000000000000000000000000000000000000000..91c2541566ab42d8c1e256e372f93e4e35c55a05 --- /dev/null +++ b/mobicore/common/curl/lib/strtok.c @@ -0,0 +1,67 @@ +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) 1998 - 2007, Daniel Stenberg, , et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at http://curl.haxx.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ***************************************************************************/ + +#include "setup.h" + +#ifndef HAVE_STRTOK_R +#include +#include + +#include "strtok.h" + +char * +Curl_strtok_r(char *ptr, const char *sep, char **end) +{ + if(!ptr) + /* we got NULL input so then we get our last position instead */ + ptr = *end; + + /* pass all letters that are including in the separator string */ + while(*ptr && strchr(sep, *ptr)) + ++ptr; + + if(*ptr) { + /* so this is where the next piece of string starts */ + char *start = ptr; + + /* set the end pointer to the first byte after the start */ + *end = start + 1; + + /* scan through the string to find where it ends, it ends on a + null byte or a character that exists in the separator string */ + while(**end && !strchr(sep, **end)) + ++*end; + + if(**end) { + /* the end is not a null byte */ + **end = '\0'; /* zero terminate it! */ + ++*end; /* advance the last pointer to beyond the null byte */ + } + + return start; /* return the position where the string starts */ + } + + /* we ended up on a null byte, there are no more strings to find! */ + return NULL; +} + +#endif /* this was only compiled if strtok_r wasn't present */ diff --git a/mobicore/common/curl/lib/strtok.h b/mobicore/common/curl/lib/strtok.h new file mode 100644 index 0000000000000000000000000000000000000000..8baf77948f6bc29433cf660c49c203c2394cce8d --- /dev/null +++ b/mobicore/common/curl/lib/strtok.h @@ -0,0 +1,34 @@ +#ifndef HEADER_CURL_STRTOK_H +#define HEADER_CURL_STRTOK_H +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) 1998 - 2010, Daniel Stenberg, , et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at http://curl.haxx.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ***************************************************************************/ +#include "setup.h" +#include + +#ifndef HAVE_STRTOK_R +char *Curl_strtok_r(char *s, const char *delim, char **last); +#define strtok_r Curl_strtok_r +#else +#include +#endif + +#endif /* HEADER_CURL_STRTOK_H */ diff --git a/mobicore/common/curl/lib/strtoofft.c b/mobicore/common/curl/lib/strtoofft.c new file mode 100644 index 0000000000000000000000000000000000000000..61ff05bed28606306b31264b04007b97ffe4e3af --- /dev/null +++ b/mobicore/common/curl/lib/strtoofft.c @@ -0,0 +1,191 @@ +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) 1998 - 2007, Daniel Stenberg, , et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at http://curl.haxx.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ***************************************************************************/ + +#include "setup.h" +#include "strtoofft.h" + +/* + * NOTE: + * + * In the ISO C standard (IEEE Std 1003.1), there is a strtoimax() function we + * could use in case strtoll() doesn't exist... See + * http://www.opengroup.org/onlinepubs/009695399/functions/strtoimax.html + */ + +#ifdef NEED_CURL_STRTOLL +#include +#include +#include + +/* Range tests can be used for alphanum decoding if characters are consecutive, + like in ASCII. Else an array is scanned. Determine this condition now. */ + +#if('9' - '0') != 9 || ('Z' - 'A') != 25 || ('z' - 'a') != 25 +#include + +#define NO_RANGE_TEST + +static const char valchars[] = + "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"; +#endif + +static int get_char(char c, int base); + +/** + * Emulated version of the strtoll function. This extracts a long long + * value from the given input string and returns it. + */ +curl_off_t +curlx_strtoll(const char *nptr, char **endptr, int base) +{ + char *end; + int is_negative = 0; + int overflow; + int i; + curl_off_t value = 0; + curl_off_t newval; + + /* Skip leading whitespace. */ + end = (char *)nptr; + while(ISSPACE(end[0])) { + end++; + } + + /* Handle the sign, if any. */ + if(end[0] == '-') { + is_negative = 1; + end++; + } + else if(end[0] == '+') { + end++; + } + else if(end[0] == '\0') { + /* We had nothing but perhaps some whitespace -- there was no number. */ + if(endptr) { + *endptr = end; + } + return 0; + } + + /* Handle special beginnings, if present and allowed. */ + if(end[0] == '0' && end[1] == 'x') { + if(base == 16 || base == 0) { + end += 2; + base = 16; + } + } + else if(end[0] == '0') { + if(base == 8 || base == 0) { + end++; + base = 8; + } + } + + /* Matching strtol, if the base is 0 and it doesn't look like + * the number is octal or hex, we assume it's base 10. + */ + if(base == 0) { + base = 10; + } + + /* Loop handling digits. */ + value = 0; + overflow = 0; + for (i = get_char(end[0], base); + i != -1; + end++, i = get_char(end[0], base)) { + newval = base * value + i; + if(newval < value) { + /* We've overflowed. */ + overflow = 1; + break; + } + else + value = newval; + } + + if(!overflow) { + if(is_negative) { + /* Fix the sign. */ + value *= -1; + } + } + else { + if(is_negative) + value = CURL_OFF_T_MIN; + else + value = CURL_OFF_T_MAX; + + SET_ERRNO(ERANGE); + } + + if(endptr) + *endptr = end; + + return value; +} + +/** + * Returns the value of c in the given base, or -1 if c cannot + * be interpreted properly in that base (i.e., is out of range, + * is a null, etc.). + * + * @param c the character to interpret according to base + * @param base the base in which to interpret c + * + * @return the value of c in base, or -1 if c isn't in range + */ +static int get_char(char c, int base) +{ +#ifndef NO_RANGE_TEST + int value = -1; + if(c <= '9' && c >= '0') { + value = c - '0'; + } + else if(c <= 'Z' && c >= 'A') { + value = c - 'A' + 10; + } + else if(c <= 'z' && c >= 'a') { + value = c - 'a' + 10; + } +#else + const char * cp; + int value; + + cp = memchr(valchars, c, 10 + 26 + 26); + + if(!cp) + return -1; + + value = cp - valchars; + + if(value >= 10 + 26) + value -= 26; /* Lowercase. */ +#endif + + if(value >= base) { + value = -1; + } + + return value; +} +#endif /* Only present if we need strtoll, but don't have it. */ diff --git a/mobicore/common/curl/lib/strtoofft.h b/mobicore/common/curl/lib/strtoofft.h new file mode 100644 index 0000000000000000000000000000000000000000..8208e87fa04b23bbb33ede7688146a22f9dc3a0c --- /dev/null +++ b/mobicore/common/curl/lib/strtoofft.h @@ -0,0 +1,68 @@ +#ifndef HEADER_CURL_STRTOOFFT_H +#define HEADER_CURL_STRTOOFFT_H +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) 1998 - 2010, Daniel Stenberg, , et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at http://curl.haxx.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ***************************************************************************/ + +#include "setup.h" + +/* + * Determine which string to integral data type conversion function we use + * to implement string conversion to our curl_off_t integral data type. + * + * Notice that curl_off_t might be 64 or 32 bit wide, and that it might use + * an undelying data type which might be 'long', 'int64_t', 'long long' or + * '__int64' and more remotely other data types. + * + * On systems where the size of curl_off_t is greater than the size of 'long' + * the conversion funtion to use is strtoll() if it is available, otherwise, + * we emulate its functionality with our own clone. + * + * On systems where the size of curl_off_t is smaller or equal than the size + * of 'long' the conversion funtion to use is strtol(). + */ + +#if (CURL_SIZEOF_CURL_OFF_T > CURL_SIZEOF_LONG) +# ifdef HAVE_STRTOLL +# define curlx_strtoofft strtoll +# else +# if defined(_MSC_VER) && (_MSC_VER >= 1300) && (_INTEGRAL_MAX_BITS >= 64) + _CRTIMP __int64 __cdecl _strtoi64(const char *, char **, int); +# define curlx_strtoofft _strtoi64 +# else + curl_off_t curlx_strtoll(const char *nptr, char **endptr, int base); +# define curlx_strtoofft curlx_strtoll +# define NEED_CURL_STRTOLL 1 +# endif +# endif +#else +# define curlx_strtoofft strtol +#endif + +#if (CURL_SIZEOF_CURL_OFF_T == 4) +# define CURL_OFF_T_MAX CURL_OFF_T_C(0x7FFFFFFF) +#else + /* assume CURL_SIZEOF_CURL_OFF_T == 8 */ +# define CURL_OFF_T_MAX CURL_OFF_T_C(0x7FFFFFFFFFFFFFFF) +#endif +#define CURL_OFF_T_MIN (-CURL_OFF_T_MAX - CURL_OFF_T_C(1)) + +#endif /* HEADER_CURL_STRTOOFFT_H */ diff --git a/mobicore/common/curl/lib/telnet.c b/mobicore/common/curl/lib/telnet.c new file mode 100644 index 0000000000000000000000000000000000000000..1a5683d401321dfb7f32cfdf8f194729aebcd965 --- /dev/null +++ b/mobicore/common/curl/lib/telnet.c @@ -0,0 +1,1558 @@ +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) 1998 - 2010, Daniel Stenberg, , et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at http://curl.haxx.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ***************************************************************************/ + +#include "setup.h" + +#ifndef CURL_DISABLE_TELNET +/* -- WIN32 approved -- */ +#include +#include +#include +#include +#include + +#if defined(WIN32) +#include +#include +#else +#ifdef HAVE_SYS_SOCKET_H +#include +#endif +#include +#ifdef HAVE_SYS_TIME_H +#include +#endif +#ifdef HAVE_UNISTD_H +#include +#endif +#include +#ifdef HAVE_ARPA_INET_H +#include +#endif +#ifdef HAVE_NET_IF_H +#include +#endif +#ifdef HAVE_SYS_IOCTL_H +#include +#endif + +#ifdef HAVE_SYS_PARAM_H +#include +#endif + +#endif /* WIN32 */ + +#include "urldata.h" +#include +#include "transfer.h" +#include "sendf.h" +#include "telnet.h" +#include "connect.h" +#include "progress.h" + +#define _MPRINTF_REPLACE /* use our functions only */ +#include + +#define TELOPTS +#define TELCMDS + +#include "arpa_telnet.h" +#include "curl_memory.h" +#include "select.h" +#include "strequal.h" +#include "rawstr.h" + +/* The last #include file should be: */ +#include "memdebug.h" + +#define SUBBUFSIZE 512 + +#define CURL_SB_CLEAR(x) x->subpointer = x->subbuffer; +#define CURL_SB_TERM(x) { x->subend = x->subpointer; CURL_SB_CLEAR(x); } +#define CURL_SB_ACCUM(x,c) \ + if(x->subpointer < (x->subbuffer+sizeof x->subbuffer)) { \ + *x->subpointer++ = (c); \ + } + +#define CURL_SB_GET(x) ((*x->subpointer++)&0xff) +#define CURL_SB_PEEK(x) ((*x->subpointer)&0xff) +#define CURL_SB_EOF(x) (x->subpointer >= x->subend) +#define CURL_SB_LEN(x) (x->subend - x->subpointer) + +#ifdef CURL_DISABLE_VERBOSE_STRINGS +#define printoption(a,b,c,d) do { } while(0) +#endif + +#ifdef USE_WINSOCK +typedef FARPROC WSOCK2_FUNC; +static CURLcode check_wsock2 ( struct SessionHandle *data ); +#endif + +static +CURLcode telrcv(struct connectdata *, + const unsigned char *inbuf, /* Data received from socket */ + ssize_t count); /* Number of bytes received */ + +#ifndef CURL_DISABLE_VERBOSE_STRINGS +static void printoption(struct SessionHandle *data, + const char *direction, + int cmd, int option); +#endif + +static void negotiate(struct connectdata *); +static void send_negotiation(struct connectdata *, int cmd, int option); +static void set_local_option(struct connectdata *, int cmd, int option); +static void set_remote_option(struct connectdata *, int cmd, int option); + +static void printsub(struct SessionHandle *data, + int direction, unsigned char *pointer, + size_t length); +static void suboption(struct connectdata *); + +static CURLcode telnet_do(struct connectdata *conn, bool *done); +static CURLcode telnet_done(struct connectdata *conn, + CURLcode, bool premature); + +/* For negotiation compliant to RFC 1143 */ +#define CURL_NO 0 +#define CURL_YES 1 +#define CURL_WANTYES 2 +#define CURL_WANTNO 3 + +#define CURL_EMPTY 0 +#define CURL_OPPOSITE 1 + +/* + * Telnet receiver states for fsm + */ +typedef enum +{ + CURL_TS_DATA = 0, + CURL_TS_IAC, + CURL_TS_WILL, + CURL_TS_WONT, + CURL_TS_DO, + CURL_TS_DONT, + CURL_TS_CR, + CURL_TS_SB, /* sub-option collection */ + CURL_TS_SE /* looking for sub-option end */ +} TelnetReceive; + +struct TELNET { + int please_negotiate; + int already_negotiated; + int us[256]; + int usq[256]; + int us_preferred[256]; + int him[256]; + int himq[256]; + int him_preferred[256]; + char subopt_ttype[32]; /* Set with suboption TTYPE */ + char subopt_xdisploc[128]; /* Set with suboption XDISPLOC */ + struct curl_slist *telnet_vars; /* Environment variables */ + + /* suboptions */ + unsigned char subbuffer[SUBBUFSIZE]; + unsigned char *subpointer, *subend; /* buffer for sub-options */ + + TelnetReceive telrcv_state; +}; + + +/* + * TELNET protocol handler. + */ + +const struct Curl_handler Curl_handler_telnet = { + "TELNET", /* scheme */ + ZERO_NULL, /* setup_connection */ + telnet_do, /* do_it */ + telnet_done, /* done */ + ZERO_NULL, /* do_more */ + ZERO_NULL, /* connect_it */ + ZERO_NULL, /* connecting */ + ZERO_NULL, /* doing */ + ZERO_NULL, /* proto_getsock */ + ZERO_NULL, /* doing_getsock */ + ZERO_NULL, /* perform_getsock */ + ZERO_NULL, /* disconnect */ + PORT_TELNET, /* defport */ + PROT_TELNET /* protocol */ +}; + + +#ifdef USE_WINSOCK +static CURLcode +check_wsock2 ( struct SessionHandle *data ) +{ + int err; + WORD wVersionRequested; + WSADATA wsaData; + + DEBUGASSERT(data); + + /* telnet requires at least WinSock 2.0 so ask for it. */ + wVersionRequested = MAKEWORD(2, 0); + + err = WSAStartup(wVersionRequested, &wsaData); + + /* We must've called this once already, so this call */ + /* should always succeed. But, just in case... */ + if(err != 0) { + failf(data,"WSAStartup failed (%d)",err); + return CURLE_FAILED_INIT; + } + + /* We have to have a WSACleanup call for every successful */ + /* WSAStartup call. */ + WSACleanup(); + + /* Check that our version is supported */ + if(LOBYTE(wsaData.wVersion) != LOBYTE(wVersionRequested) || + HIBYTE(wsaData.wVersion) != HIBYTE(wVersionRequested)) { + /* Our version isn't supported */ + failf(data,"insufficient winsock version to support " + "telnet"); + return CURLE_FAILED_INIT; + } + + /* Our version is supported */ + return CURLE_OK; +} +#endif + +static +CURLcode init_telnet(struct connectdata *conn) +{ + struct TELNET *tn; + + tn = calloc(1, sizeof(struct TELNET)); + if(!tn) + return CURLE_OUT_OF_MEMORY; + + conn->data->state.proto.telnet = (void *)tn; /* make us known */ + + tn->telrcv_state = CURL_TS_DATA; + + /* Init suboptions */ + CURL_SB_CLEAR(tn); + + /* Set the options we want by default */ + tn->us_preferred[CURL_TELOPT_BINARY] = CURL_YES; + tn->us_preferred[CURL_TELOPT_SGA] = CURL_YES; + tn->him_preferred[CURL_TELOPT_BINARY] = CURL_YES; + tn->him_preferred[CURL_TELOPT_SGA] = CURL_YES; + + return CURLE_OK; +} + +static void negotiate(struct connectdata *conn) +{ + int i; + struct TELNET *tn = (struct TELNET *) conn->data->state.proto.telnet; + + for(i = 0;i < CURL_NTELOPTS;i++) + { + if(tn->us_preferred[i] == CURL_YES) + set_local_option(conn, i, CURL_YES); + + if(tn->him_preferred[i] == CURL_YES) + set_remote_option(conn, i, CURL_YES); + } +} + +#ifndef CURL_DISABLE_VERBOSE_STRINGS +static void printoption(struct SessionHandle *data, + const char *direction, int cmd, int option) +{ + const char *fmt; + const char *opt; + + if(data->set.verbose) + { + if(cmd == CURL_IAC) + { + if(CURL_TELCMD_OK(option)) + infof(data, "%s IAC %s\n", direction, CURL_TELCMD(option)); + else + infof(data, "%s IAC %d\n", direction, option); + } + else + { + fmt = (cmd == CURL_WILL) ? "WILL" : (cmd == CURL_WONT) ? "WONT" : + (cmd == CURL_DO) ? "DO" : (cmd == CURL_DONT) ? "DONT" : 0; + if(fmt) + { + if(CURL_TELOPT_OK(option)) + opt = CURL_TELOPT(option); + else if(option == CURL_TELOPT_EXOPL) + opt = "EXOPL"; + else + opt = NULL; + + if(opt) + infof(data, "%s %s %s\n", direction, fmt, opt); + else + infof(data, "%s %s %d\n", direction, fmt, option); + } + else + infof(data, "%s %d %d\n", direction, cmd, option); + } + } +} +#endif + +static void send_negotiation(struct connectdata *conn, int cmd, int option) +{ + unsigned char buf[3]; + ssize_t bytes_written; + int err; + struct SessionHandle *data = conn->data; + + buf[0] = CURL_IAC; + buf[1] = (unsigned char)cmd; + buf[2] = (unsigned char)option; + + bytes_written = swrite(conn->sock[FIRSTSOCKET], buf, 3); + if(bytes_written < 0) { + err = SOCKERRNO; + failf(data,"Sending data failed (%d)",err); + } + + printoption(conn->data, "SENT", cmd, option); +} + +static +void set_remote_option(struct connectdata *conn, int option, int newstate) +{ + struct TELNET *tn = (struct TELNET *)conn->data->state.proto.telnet; + if(newstate == CURL_YES) + { + switch(tn->him[option]) + { + case CURL_NO: + tn->him[option] = CURL_WANTYES; + send_negotiation(conn, CURL_DO, option); + break; + + case CURL_YES: + /* Already enabled */ + break; + + case CURL_WANTNO: + switch(tn->himq[option]) + { + case CURL_EMPTY: + /* Already negotiating for CURL_YES, queue the request */ + tn->himq[option] = CURL_OPPOSITE; + break; + case CURL_OPPOSITE: + /* Error: already queued an enable request */ + break; + } + break; + + case CURL_WANTYES: + switch(tn->himq[option]) + { + case CURL_EMPTY: + /* Error: already negotiating for enable */ + break; + case CURL_OPPOSITE: + tn->himq[option] = CURL_EMPTY; + break; + } + break; + } + } + else /* NO */ + { + switch(tn->him[option]) + { + case CURL_NO: + /* Already disabled */ + break; + + case CURL_YES: + tn->him[option] = CURL_WANTNO; + send_negotiation(conn, CURL_DONT, option); + break; + + case CURL_WANTNO: + switch(tn->himq[option]) + { + case CURL_EMPTY: + /* Already negotiating for NO */ + break; + case CURL_OPPOSITE: + tn->himq[option] = CURL_EMPTY; + break; + } + break; + + case CURL_WANTYES: + switch(tn->himq[option]) + { + case CURL_EMPTY: + tn->himq[option] = CURL_OPPOSITE; + break; + case CURL_OPPOSITE: + break; + } + break; + } + } +} + +static +void rec_will(struct connectdata *conn, int option) +{ + struct TELNET *tn = (struct TELNET *)conn->data->state.proto.telnet; + switch(tn->him[option]) + { + case CURL_NO: + if(tn->him_preferred[option] == CURL_YES) + { + tn->him[option] = CURL_YES; + send_negotiation(conn, CURL_DO, option); + } + else + { + send_negotiation(conn, CURL_DONT, option); + } + break; + + case CURL_YES: + /* Already enabled */ + break; + + case CURL_WANTNO: + switch(tn->himq[option]) + { + case CURL_EMPTY: + /* Error: DONT answered by WILL */ + tn->him[option] = CURL_NO; + break; + case CURL_OPPOSITE: + /* Error: DONT answered by WILL */ + tn->him[option] = CURL_YES; + tn->himq[option] = CURL_EMPTY; + break; + } + break; + + case CURL_WANTYES: + switch(tn->himq[option]) + { + case CURL_EMPTY: + tn->him[option] = CURL_YES; + break; + case CURL_OPPOSITE: + tn->him[option] = CURL_WANTNO; + tn->himq[option] = CURL_EMPTY; + send_negotiation(conn, CURL_DONT, option); + break; + } + break; + } +} + +static +void rec_wont(struct connectdata *conn, int option) +{ + struct TELNET *tn = (struct TELNET *)conn->data->state.proto.telnet; + switch(tn->him[option]) + { + case CURL_NO: + /* Already disabled */ + break; + + case CURL_YES: + tn->him[option] = CURL_NO; + send_negotiation(conn, CURL_DONT, option); + break; + + case CURL_WANTNO: + switch(tn->himq[option]) + { + case CURL_EMPTY: + tn->him[option] = CURL_NO; + break; + + case CURL_OPPOSITE: + tn->him[option] = CURL_WANTYES; + tn->himq[option] = CURL_EMPTY; + send_negotiation(conn, CURL_DO, option); + break; + } + break; + + case CURL_WANTYES: + switch(tn->himq[option]) + { + case CURL_EMPTY: + tn->him[option] = CURL_NO; + break; + case CURL_OPPOSITE: + tn->him[option] = CURL_NO; + tn->himq[option] = CURL_EMPTY; + break; + } + break; + } +} + +static void +set_local_option(struct connectdata *conn, int option, int newstate) +{ + struct TELNET *tn = (struct TELNET *)conn->data->state.proto.telnet; + if(newstate == CURL_YES) + { + switch(tn->us[option]) + { + case CURL_NO: + tn->us[option] = CURL_WANTYES; + send_negotiation(conn, CURL_WILL, option); + break; + + case CURL_YES: + /* Already enabled */ + break; + + case CURL_WANTNO: + switch(tn->usq[option]) + { + case CURL_EMPTY: + /* Already negotiating for CURL_YES, queue the request */ + tn->usq[option] = CURL_OPPOSITE; + break; + case CURL_OPPOSITE: + /* Error: already queued an enable request */ + break; + } + break; + + case CURL_WANTYES: + switch(tn->usq[option]) + { + case CURL_EMPTY: + /* Error: already negotiating for enable */ + break; + case CURL_OPPOSITE: + tn->usq[option] = CURL_EMPTY; + break; + } + break; + } + } + else /* NO */ + { + switch(tn->us[option]) + { + case CURL_NO: + /* Already disabled */ + break; + + case CURL_YES: + tn->us[option] = CURL_WANTNO; + send_negotiation(conn, CURL_WONT, option); + break; + + case CURL_WANTNO: + switch(tn->usq[option]) + { + case CURL_EMPTY: + /* Already negotiating for NO */ + break; + case CURL_OPPOSITE: + tn->usq[option] = CURL_EMPTY; + break; + } + break; + + case CURL_WANTYES: + switch(tn->usq[option]) + { + case CURL_EMPTY: + tn->usq[option] = CURL_OPPOSITE; + break; + case CURL_OPPOSITE: + break; + } + break; + } + } +} + +static +void rec_do(struct connectdata *conn, int option) +{ + struct TELNET *tn = (struct TELNET *)conn->data->state.proto.telnet; + switch(tn->us[option]) + { + case CURL_NO: + if(tn->us_preferred[option] == CURL_YES) + { + tn->us[option] = CURL_YES; + send_negotiation(conn, CURL_WILL, option); + } + else + { + send_negotiation(conn, CURL_WONT, option); + } + break; + + case CURL_YES: + /* Already enabled */ + break; + + case CURL_WANTNO: + switch(tn->usq[option]) + { + case CURL_EMPTY: + /* Error: DONT answered by WILL */ + tn->us[option] = CURL_NO; + break; + case CURL_OPPOSITE: + /* Error: DONT answered by WILL */ + tn->us[option] = CURL_YES; + tn->usq[option] = CURL_EMPTY; + break; + } + break; + + case CURL_WANTYES: + switch(tn->usq[option]) + { + case CURL_EMPTY: + tn->us[option] = CURL_YES; + break; + case CURL_OPPOSITE: + tn->us[option] = CURL_WANTNO; + tn->himq[option] = CURL_EMPTY; + send_negotiation(conn, CURL_WONT, option); + break; + } + break; + } +} + +static +void rec_dont(struct connectdata *conn, int option) +{ + struct TELNET *tn = (struct TELNET *)conn->data->state.proto.telnet; + switch(tn->us[option]) + { + case CURL_NO: + /* Already disabled */ + break; + + case CURL_YES: + tn->us[option] = CURL_NO; + send_negotiation(conn, CURL_WONT, option); + break; + + case CURL_WANTNO: + switch(tn->usq[option]) + { + case CURL_EMPTY: + tn->us[option] = CURL_NO; + break; + + case CURL_OPPOSITE: + tn->us[option] = CURL_WANTYES; + tn->usq[option] = CURL_EMPTY; + send_negotiation(conn, CURL_WILL, option); + break; + } + break; + + case CURL_WANTYES: + switch(tn->usq[option]) + { + case CURL_EMPTY: + tn->us[option] = CURL_NO; + break; + case CURL_OPPOSITE: + tn->us[option] = CURL_NO; + tn->usq[option] = CURL_EMPTY; + break; + } + break; + } +} + + +static void printsub(struct SessionHandle *data, + int direction, /* '<' or '>' */ + unsigned char *pointer, /* where suboption data is */ + size_t length) /* length of suboption data */ +{ + unsigned int i = 0; + + if(data->set.verbose) + { + if(direction) + { + infof(data, "%s IAC SB ", (direction == '<')? "RCVD":"SENT"); + if(length >= 3) + { + int j; + + i = pointer[length-2]; + j = pointer[length-1]; + + if(i != CURL_IAC || j != CURL_SE) + { + infof(data, "(terminated by "); + if(CURL_TELOPT_OK(i)) + infof(data, "%s ", CURL_TELOPT(i)); + else if(CURL_TELCMD_OK(i)) + infof(data, "%s ", CURL_TELCMD(i)); + else + infof(data, "%u ", i); + if(CURL_TELOPT_OK(j)) + infof(data, "%s", CURL_TELOPT(j)); + else if(CURL_TELCMD_OK(j)) + infof(data, "%s", CURL_TELCMD(j)); + else + infof(data, "%d", j); + infof(data, ", not IAC SE!) "); + } + } + length -= 2; + } + if(length < 1) + { + infof(data, "(Empty suboption?)"); + return; + } + + if(CURL_TELOPT_OK(pointer[0])) { + switch(pointer[0]) { + case CURL_TELOPT_TTYPE: + case CURL_TELOPT_XDISPLOC: + case CURL_TELOPT_NEW_ENVIRON: + infof(data, "%s", CURL_TELOPT(pointer[0])); + break; + default: + infof(data, "%s (unsupported)", CURL_TELOPT(pointer[0])); + break; + } + } + else + infof(data, "%d (unknown)", pointer[i]); + + switch(pointer[1]) { + case CURL_TELQUAL_IS: + infof(data, " IS"); + break; + case CURL_TELQUAL_SEND: + infof(data, " SEND"); + break; + case CURL_TELQUAL_INFO: + infof(data, " INFO/REPLY"); + break; + case CURL_TELQUAL_NAME: + infof(data, " NAME"); + break; + } + + switch(pointer[0]) { + case CURL_TELOPT_TTYPE: + case CURL_TELOPT_XDISPLOC: + pointer[length] = 0; + infof(data, " \"%s\"", &pointer[2]); + break; + case CURL_TELOPT_NEW_ENVIRON: + if(pointer[1] == CURL_TELQUAL_IS) { + infof(data, " "); + for(i = 3;i < length;i++) { + switch(pointer[i]) { + case CURL_NEW_ENV_VAR: + infof(data, ", "); + break; + case CURL_NEW_ENV_VALUE: + infof(data, " = "); + break; + default: + infof(data, "%c", pointer[i]); + break; + } + } + } + break; + default: + for (i = 2; i < length; i++) + infof(data, " %.2x", pointer[i]); + break; + } + + if(direction) + { + infof(data, "\n"); + } + } +} + +static CURLcode check_telnet_options(struct connectdata *conn) +{ + struct curl_slist *head; + char option_keyword[128]; + char option_arg[256]; + char *buf; + struct SessionHandle *data = conn->data; + struct TELNET *tn = (struct TELNET *)conn->data->state.proto.telnet; + + /* Add the user name as an environment variable if it + was given on the command line */ + if(conn->bits.user_passwd) + { + snprintf(option_arg, sizeof(option_arg), "USER,%s", conn->user); + tn->telnet_vars = curl_slist_append(tn->telnet_vars, option_arg); + + tn->us_preferred[CURL_TELOPT_NEW_ENVIRON] = CURL_YES; + } + + for(head = data->set.telnet_options; head; head=head->next) { + if(sscanf(head->data, "%127[^= ]%*[ =]%255s", + option_keyword, option_arg) == 2) { + + /* Terminal type */ + if(Curl_raw_equal(option_keyword, "TTYPE")) { + strncpy(tn->subopt_ttype, option_arg, 31); + tn->subopt_ttype[31] = 0; /* String termination */ + tn->us_preferred[CURL_TELOPT_TTYPE] = CURL_YES; + continue; + } + + /* Display variable */ + if(Curl_raw_equal(option_keyword, "XDISPLOC")) { + strncpy(tn->subopt_xdisploc, option_arg, 127); + tn->subopt_xdisploc[127] = 0; /* String termination */ + tn->us_preferred[CURL_TELOPT_XDISPLOC] = CURL_YES; + continue; + } + + /* Environment variable */ + if(Curl_raw_equal(option_keyword, "NEW_ENV")) { + buf = strdup(option_arg); + if(!buf) + return CURLE_OUT_OF_MEMORY; + tn->telnet_vars = curl_slist_append(tn->telnet_vars, buf); + tn->us_preferred[CURL_TELOPT_NEW_ENVIRON] = CURL_YES; + continue; + } + + failf(data, "Unknown telnet option %s", head->data); + return CURLE_UNKNOWN_TELNET_OPTION; + } else { + failf(data, "Syntax error in telnet option: %s", head->data); + return CURLE_TELNET_OPTION_SYNTAX; + } + } + + return CURLE_OK; +} + +/* + * suboption() + * + * Look at the sub-option buffer, and try to be helpful to the other + * side. + */ + +static void suboption(struct connectdata *conn) +{ + struct curl_slist *v; + unsigned char temp[2048]; + ssize_t bytes_written; + size_t len; + size_t tmplen; + int err; + char varname[128]; + char varval[128]; + struct SessionHandle *data = conn->data; + struct TELNET *tn = (struct TELNET *)data->state.proto.telnet; + + printsub(data, '<', (unsigned char *)tn->subbuffer, CURL_SB_LEN(tn)+2); + switch (CURL_SB_GET(tn)) { + case CURL_TELOPT_TTYPE: + len = strlen(tn->subopt_ttype) + 4 + 2; + snprintf((char *)temp, sizeof(temp), + "%c%c%c%c%s%c%c", CURL_IAC, CURL_SB, CURL_TELOPT_TTYPE, + CURL_TELQUAL_IS, tn->subopt_ttype, CURL_IAC, CURL_SE); + bytes_written = swrite(conn->sock[FIRSTSOCKET], temp, len); + if(bytes_written < 0) { + err = SOCKERRNO; + failf(data,"Sending data failed (%d)",err); + } + printsub(data, '>', &temp[2], len-2); + break; + case CURL_TELOPT_XDISPLOC: + len = strlen(tn->subopt_xdisploc) + 4 + 2; + snprintf((char *)temp, sizeof(temp), + "%c%c%c%c%s%c%c", CURL_IAC, CURL_SB, CURL_TELOPT_XDISPLOC, + CURL_TELQUAL_IS, tn->subopt_xdisploc, CURL_IAC, CURL_SE); + bytes_written = swrite(conn->sock[FIRSTSOCKET], temp, len); + if(bytes_written < 0) { + err = SOCKERRNO; + failf(data,"Sending data failed (%d)",err); + } + printsub(data, '>', &temp[2], len-2); + break; + case CURL_TELOPT_NEW_ENVIRON: + snprintf((char *)temp, sizeof(temp), + "%c%c%c%c", CURL_IAC, CURL_SB, CURL_TELOPT_NEW_ENVIRON, + CURL_TELQUAL_IS); + len = 4; + + for(v = tn->telnet_vars;v;v = v->next) { + tmplen = (strlen(v->data) + 1); + /* Add the variable only if it fits */ + if(len + tmplen < (int)sizeof(temp)-6) { + sscanf(v->data, "%127[^,],%127s", varname, varval); + snprintf((char *)&temp[len], sizeof(temp) - len, + "%c%s%c%s", CURL_NEW_ENV_VAR, varname, + CURL_NEW_ENV_VALUE, varval); + len += tmplen; + } + } + snprintf((char *)&temp[len], sizeof(temp) - len, + "%c%c", CURL_IAC, CURL_SE); + len += 2; + bytes_written = swrite(conn->sock[FIRSTSOCKET], temp, len); + if(bytes_written < 0) { + err = SOCKERRNO; + failf(data,"Sending data failed (%d)",err); + } + printsub(data, '>', &temp[2], len-2); + break; + } + return; +} + +static +CURLcode telrcv(struct connectdata *conn, + const unsigned char *inbuf, /* Data received from socket */ + ssize_t count) /* Number of bytes received */ +{ + unsigned char c; + CURLcode result; + int in = 0; + int startwrite=-1; + struct SessionHandle *data = conn->data; + struct TELNET *tn = (struct TELNET *)data->state.proto.telnet; + +#define startskipping() \ + if(startwrite >= 0) { \ + result = Curl_client_write(conn, \ + CLIENTWRITE_BODY, \ + (char *)&inbuf[startwrite], \ + in-startwrite); \ + if(result != CURLE_OK) \ + return result; \ + } \ + startwrite = -1 + +#define writebyte() \ + if(startwrite < 0) \ + startwrite = in + +#define bufferflush() startskipping() + + while(count--) + { + c = inbuf[in]; + + /*infof(data,"In rcv state %d char %d\n", tn->telrcv_state, c);*/ + switch (tn->telrcv_state) + { + case CURL_TS_CR: + tn->telrcv_state = CURL_TS_DATA; + if(c == '\0') + { + startskipping(); + break; /* Ignore \0 after CR */ + } + writebyte(); + break; + + case CURL_TS_DATA: + if(c == CURL_IAC) + { + tn->telrcv_state = CURL_TS_IAC; + startskipping(); + break; + } + else if(c == '\r') + { + tn->telrcv_state = CURL_TS_CR; + } + writebyte(); + break; + + case CURL_TS_IAC: + process_iac: + DEBUGASSERT(startwrite < 0); + switch (c) + { + case CURL_WILL: + tn->telrcv_state = CURL_TS_WILL; + break; + case CURL_WONT: + tn->telrcv_state = CURL_TS_WONT; + break; + case CURL_DO: + tn->telrcv_state = CURL_TS_DO; + break; + case CURL_DONT: + tn->telrcv_state = CURL_TS_DONT; + break; + case CURL_SB: + CURL_SB_CLEAR(tn); + tn->telrcv_state = CURL_TS_SB; + break; + case CURL_IAC: + tn->telrcv_state = CURL_TS_DATA; + writebyte(); + break; + case CURL_DM: + case CURL_NOP: + case CURL_GA: + default: + tn->telrcv_state = CURL_TS_DATA; + printoption(data, "RCVD", CURL_IAC, c); + break; + } + break; + + case CURL_TS_WILL: + printoption(data, "RCVD", CURL_WILL, c); + tn->please_negotiate = 1; + rec_will(conn, c); + tn->telrcv_state = CURL_TS_DATA; + break; + + case CURL_TS_WONT: + printoption(data, "RCVD", CURL_WONT, c); + tn->please_negotiate = 1; + rec_wont(conn, c); + tn->telrcv_state = CURL_TS_DATA; + break; + + case CURL_TS_DO: + printoption(data, "RCVD", CURL_DO, c); + tn->please_negotiate = 1; + rec_do(conn, c); + tn->telrcv_state = CURL_TS_DATA; + break; + + case CURL_TS_DONT: + printoption(data, "RCVD", CURL_DONT, c); + tn->please_negotiate = 1; + rec_dont(conn, c); + tn->telrcv_state = CURL_TS_DATA; + break; + + case CURL_TS_SB: + if(c == CURL_IAC) + { + tn->telrcv_state = CURL_TS_SE; + } + else + { + CURL_SB_ACCUM(tn,c); + } + break; + + case CURL_TS_SE: + if(c != CURL_SE) + { + if(c != CURL_IAC) + { + /* + * This is an error. We only expect to get "IAC IAC" or "IAC SE". + * Several things may have happend. An IAC was not doubled, the + * IAC SE was left off, or another option got inserted into the + * suboption are all possibilities. If we assume that the IAC was + * not doubled, and really the IAC SE was left off, we could get + * into an infinate loop here. So, instead, we terminate the + * suboption, and process the partial suboption if we can. + */ + CURL_SB_ACCUM(tn, CURL_IAC); + CURL_SB_ACCUM(tn, c); + tn->subpointer -= 2; + CURL_SB_TERM(tn); + + printoption(data, "In SUBOPTION processing, RCVD", CURL_IAC, c); + suboption(conn); /* handle sub-option */ + tn->telrcv_state = CURL_TS_IAC; + goto process_iac; + } + CURL_SB_ACCUM(tn,c); + tn->telrcv_state = CURL_TS_SB; + } + else + { + CURL_SB_ACCUM(tn, CURL_IAC); + CURL_SB_ACCUM(tn, CURL_SE); + tn->subpointer -= 2; + CURL_SB_TERM(tn); + suboption(conn); /* handle sub-option */ + tn->telrcv_state = CURL_TS_DATA; + } + break; + } + ++in; + } + bufferflush(); + return CURLE_OK; +} + +/* Escape and send a telnet data block */ +/* TODO: write large chunks of data instead of one byte at a time */ +static CURLcode send_telnet_data(struct connectdata *conn, + char *buffer, ssize_t nread) +{ + unsigned char outbuf[2]; + ssize_t bytes_written, total_written; + int out_count; + CURLcode rc = CURLE_OK; + + while(rc == CURLE_OK && nread--) { + outbuf[0] = *buffer++; + out_count = 1; + if(outbuf[0] == CURL_IAC) + outbuf[out_count++] = CURL_IAC; + + total_written = 0; + do { + /* Make sure socket is writable to avoid EWOULDBLOCK condition */ + struct pollfd pfd[1]; + pfd[0].fd = conn->sock[FIRSTSOCKET]; + pfd[0].events = POLLOUT; + switch (Curl_poll(pfd, 1, -1)) { + case -1: /* error, abort writing */ + case 0: /* timeout (will never happen) */ + rc = CURLE_SEND_ERROR; + break; + default: /* write! */ + bytes_written = 0; + rc = Curl_write(conn, conn->sock[FIRSTSOCKET], outbuf+total_written, + out_count-total_written, &bytes_written); + total_written += bytes_written; + break; + } + /* handle partial write */ + } while (rc == CURLE_OK && total_written < out_count); + } + return rc; +} + +static CURLcode telnet_done(struct connectdata *conn, + CURLcode status, bool premature) +{ + struct TELNET *tn = (struct TELNET *)conn->data->state.proto.telnet; + (void)status; /* unused */ + (void)premature; /* not used */ + + curl_slist_free_all(tn->telnet_vars); + + free(conn->data->state.proto.telnet); + conn->data->state.proto.telnet = NULL; + + return CURLE_OK; +} + +static CURLcode telnet_do(struct connectdata *conn, bool *done) +{ + CURLcode code; + struct SessionHandle *data = conn->data; + curl_socket_t sockfd = conn->sock[FIRSTSOCKET]; +#ifdef USE_WINSOCK + HMODULE wsock2; + WSOCK2_FUNC close_event_func; + WSOCK2_FUNC create_event_func; + WSOCK2_FUNC event_select_func; + WSOCK2_FUNC enum_netevents_func; + WSAEVENT event_handle; + WSANETWORKEVENTS events; + HANDLE stdin_handle; + HANDLE objs[2]; + DWORD obj_count; + DWORD wait_timeout; + DWORD waitret; + DWORD readfile_read; + int err; +#else + int interval_ms; + struct pollfd pfd[2]; + int poll_cnt; + curl_off_t total_dl = 0; + curl_off_t total_ul = 0; +#endif + ssize_t nread; + struct timeval now; + bool keepon = TRUE; + char *buf = data->state.buffer; + struct TELNET *tn; + + *done = TRUE; /* unconditionally */ + + code = init_telnet(conn); + if(code) + return code; + + tn = (struct TELNET *)data->state.proto.telnet; + + code = check_telnet_options(conn); + if(code) + return code; + +#ifdef USE_WINSOCK + /* + ** This functionality only works with WinSock >= 2.0. So, + ** make sure have it. + */ + code = check_wsock2(data); + if(code) + return code; + + /* OK, so we have WinSock 2.0. We need to dynamically */ + /* load ws2_32.dll and get the function pointers we need. */ + wsock2 = LoadLibrary("WS2_32.DLL"); + if(wsock2 == NULL) { + failf(data,"failed to load WS2_32.DLL (%d)", ERRNO); + return CURLE_FAILED_INIT; + } + + /* Grab a pointer to WSACreateEvent */ + create_event_func = GetProcAddress(wsock2,"WSACreateEvent"); + if(create_event_func == NULL) { + failf(data,"failed to find WSACreateEvent function (%d)", + ERRNO); + FreeLibrary(wsock2); + return CURLE_FAILED_INIT; + } + + /* And WSACloseEvent */ + close_event_func = GetProcAddress(wsock2,"WSACloseEvent"); + if(close_event_func == NULL) { + failf(data,"failed to find WSACloseEvent function (%d)", + ERRNO); + FreeLibrary(wsock2); + return CURLE_FAILED_INIT; + } + + /* And WSAEventSelect */ + event_select_func = GetProcAddress(wsock2,"WSAEventSelect"); + if(event_select_func == NULL) { + failf(data,"failed to find WSAEventSelect function (%d)", + ERRNO); + FreeLibrary(wsock2); + return CURLE_FAILED_INIT; + } + + /* And WSAEnumNetworkEvents */ + enum_netevents_func = GetProcAddress(wsock2,"WSAEnumNetworkEvents"); + if(enum_netevents_func == NULL) { + failf(data,"failed to find WSAEnumNetworkEvents function (%d)", + ERRNO); + FreeLibrary(wsock2); + return CURLE_FAILED_INIT; + } + + /* We want to wait for both stdin and the socket. Since + ** the select() function in winsock only works on sockets + ** we have to use the WaitForMultipleObjects() call. + */ + + /* First, create a sockets event object */ + event_handle = (WSAEVENT)create_event_func(); + if(event_handle == WSA_INVALID_EVENT) { + failf(data,"WSACreateEvent failed (%d)", SOCKERRNO); + FreeLibrary(wsock2); + return CURLE_FAILED_INIT; + } + + /* The get the Windows file handle for stdin */ + stdin_handle = GetStdHandle(STD_INPUT_HANDLE); + + /* Create the list of objects to wait for */ + objs[0] = event_handle; + objs[1] = stdin_handle; + + /* Tell winsock what events we want to listen to */ + if(event_select_func(sockfd, event_handle, FD_READ|FD_CLOSE) == SOCKET_ERROR) { + close_event_func(event_handle); + FreeLibrary(wsock2); + return CURLE_OK; + } + + /* If stdin_handle is a pipe, use PeekNamedPipe() method to check it, + else use the old WaitForMultipleObjects() way */ + if(GetFileType(stdin_handle) == FILE_TYPE_PIPE) { + /* Don't wait for stdin_handle, just wait for event_handle */ + obj_count = 1; + /* Check stdin_handle per 100 milliseconds */ + wait_timeout = 100; + } else { + obj_count = 2; + wait_timeout = 1000; + } + + /* Keep on listening and act on events */ + while(keepon) { + waitret = WaitForMultipleObjects(obj_count, objs, FALSE, wait_timeout); + switch(waitret) { + case WAIT_TIMEOUT: + { + for(;;) { + if(!PeekNamedPipe(stdin_handle, NULL, 0, NULL, &readfile_read, NULL)) { + keepon = FALSE; + code = CURLE_READ_ERROR; + break; + } + + if(!readfile_read) + break; + + if(!ReadFile(stdin_handle, buf, sizeof(data->state.buffer), + &readfile_read, NULL)) { + keepon = FALSE; + code = CURLE_READ_ERROR; + break; + } + + code = send_telnet_data(conn, buf, readfile_read); + if(code) { + keepon = FALSE; + break; + } + } + } + break; + + case WAIT_OBJECT_0 + 1: + { + if(!ReadFile(stdin_handle, buf, sizeof(data->state.buffer), + &readfile_read, NULL)) { + keepon = FALSE; + code = CURLE_READ_ERROR; + break; + } + + code = send_telnet_data(conn, buf, readfile_read); + if(code) { + keepon = FALSE; + break; + } + } + break; + + case WAIT_OBJECT_0: + + if(SOCKET_ERROR == enum_netevents_func(sockfd, event_handle, &events)) { + if((err = SOCKERRNO) != EINPROGRESS) { + infof(data,"WSAEnumNetworkEvents failed (%d)", err); + keepon = FALSE; + code = CURLE_READ_ERROR; + } + break; + } + if(events.lNetworkEvents & FD_READ) { + /* read data from network */ + code = Curl_read(conn, sockfd, buf, BUFSIZE - 1, &nread); + /* read would've blocked. Loop again */ + if(code == CURLE_AGAIN) + break; + /* returned not-zero, this an error */ + else if(code) { + keepon = FALSE; + break; + } + /* returned zero but actually received 0 or less here, + the server closed the connection and we bail out */ + else if(nread <= 0) { + keepon = FALSE; + break; + } + + code = telrcv(conn, (unsigned char *)buf, nread); + if(code) { + keepon = FALSE; + break; + } + + /* Negotiate if the peer has started negotiating, + otherwise don't. We don't want to speak telnet with + non-telnet servers, like POP or SMTP. */ + if(tn->please_negotiate && !tn->already_negotiated) { + negotiate(conn); + tn->already_negotiated = 1; + } + } + if(events.lNetworkEvents & FD_CLOSE) { + keepon = FALSE; + } + break; + + } + + if(data->set.timeout) { + now = Curl_tvnow(); + if(Curl_tvdiff(now, conn->created) >= data->set.timeout) { + failf(data, "Time-out"); + code = CURLE_OPERATION_TIMEDOUT; + keepon = FALSE; + } + } + } + + /* We called WSACreateEvent, so call WSACloseEvent */ + if(close_event_func(event_handle) == FALSE) { + infof(data,"WSACloseEvent failed (%d)", SOCKERRNO); + } + + /* "Forget" pointers into the library we're about to free */ + create_event_func = NULL; + close_event_func = NULL; + event_select_func = NULL; + enum_netevents_func = NULL; + + /* We called LoadLibrary, so call FreeLibrary */ + if(!FreeLibrary(wsock2)) + infof(data,"FreeLibrary(wsock2) failed (%d)", ERRNO); +#else + pfd[0].fd = sockfd; + pfd[0].events = POLLIN; + + if (data->set.is_fread_set) { + poll_cnt = 1; + interval_ms = 100; /* poll user-supplied read function */ + } + else { + pfd[1].fd = 0; + pfd[1].events = POLLIN; + poll_cnt = 2; + interval_ms = 1 * 1000; + } + + while(keepon) { + switch (Curl_poll(pfd, poll_cnt, interval_ms)) { + case -1: /* error, stop reading */ + keepon = FALSE; + continue; + case 0: /* timeout */ + pfd[0].revents = 0; + pfd[1].revents = 0; + /* fall through */ + default: /* read! */ + if(pfd[0].revents & POLLIN) { + /* read data from network */ + code = Curl_read(conn, sockfd, buf, BUFSIZE - 1, &nread); + /* read would've blocked. Loop again */ + if(code == CURLE_AGAIN) + break; + /* returned not-zero, this an error */ + else if(code) { + keepon = FALSE; + break; + } + /* returned zero but actually received 0 or less here, + the server closed the connection and we bail out */ + else if(nread <= 0) { + keepon = FALSE; + break; + } + + total_dl += nread; + Curl_pgrsSetDownloadCounter(data, total_dl); + code = telrcv(conn, (unsigned char *)buf, nread); + if(code) { + keepon = FALSE; + break; + } + + /* Negotiate if the peer has started negotiating, + otherwise don't. We don't want to speak telnet with + non-telnet servers, like POP or SMTP. */ + if(tn->please_negotiate && !tn->already_negotiated) { + negotiate(conn); + tn->already_negotiated = 1; + } + } + + nread = 0; + if (poll_cnt == 2) { + if(pfd[1].revents & POLLIN) { /* read from stdin */ + nread = read(0, buf, BUFSIZE - 1); + } + } + else { + /* read from user-supplied method */ + nread = (int)conn->fread_func(buf, 1, BUFSIZE - 1, conn->fread_in); + if (nread == CURL_READFUNC_ABORT) { + keepon = FALSE; + break; + } + if (nread == CURL_READFUNC_PAUSE) + break; + } + + if (nread > 0) { + code = send_telnet_data(conn, buf, nread); + if(code) { + keepon = FALSE; + break; + } + total_ul += nread; + Curl_pgrsSetUploadCounter(data, total_ul); + } + else if (nread < 0) + keepon = FALSE; + + break; + } /* poll switch statement */ + + if(data->set.timeout) { + now = Curl_tvnow(); + if(Curl_tvdiff(now, conn->created) >= data->set.timeout) { + failf(data, "Time-out"); + code = CURLE_OPERATION_TIMEDOUT; + keepon = FALSE; + } + } + + if(Curl_pgrsUpdate(conn)) { + code = CURLE_ABORTED_BY_CALLBACK; + break; + } + } +#endif + /* mark this as "no further transfer wanted" */ + Curl_setup_transfer(conn, -1, -1, FALSE, NULL, -1, NULL); + + return code; +} +#endif diff --git a/mobicore/common/curl/lib/telnet.h b/mobicore/common/curl/lib/telnet.h new file mode 100644 index 0000000000000000000000000000000000000000..f00f7fd8f9a70e5e550d29a324c7e2b6f008b1f9 --- /dev/null +++ b/mobicore/common/curl/lib/telnet.h @@ -0,0 +1,28 @@ +#ifndef __TELNET_H +#define __TELNET_H + +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) 1998 - 2007, Daniel Stenberg, , et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at http://curl.haxx.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ***************************************************************************/ +#ifndef CURL_DISABLE_TELNET +extern const struct Curl_handler Curl_handler_telnet; +#endif +#endif diff --git a/mobicore/common/curl/lib/tftp.c b/mobicore/common/curl/lib/tftp.c new file mode 100644 index 0000000000000000000000000000000000000000..fc741c9412fab6fcfab5fc450c859127b6828c25 --- /dev/null +++ b/mobicore/common/curl/lib/tftp.c @@ -0,0 +1,1508 @@ +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) 1998 - 2010, Daniel Stenberg, , et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at http://curl.haxx.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ***************************************************************************/ + +#include "setup.h" + +#ifndef CURL_DISABLE_TFTP +/* -- WIN32 approved -- */ +#include +#include +#include +#include + +#if defined(WIN32) +#include +#include +#else +#ifdef HAVE_SYS_SOCKET_H +#include +#endif +#include +#ifdef HAVE_SYS_TIME_H +#include +#endif +#ifdef HAVE_UNISTD_H +#include +#endif +#include +#ifdef HAVE_ARPA_INET_H +#include +#endif +#ifdef HAVE_NET_IF_H +#include +#endif +#ifdef HAVE_SYS_IOCTL_H +#include +#endif + +#ifdef HAVE_SYS_PARAM_H +#include +#endif + +#endif /* WIN32 */ + +#include "urldata.h" +#include +#include "transfer.h" +#include "sendf.h" +#include "tftp.h" +#include "progress.h" +#include "connect.h" +#include "strerror.h" +#include "sockaddr.h" /* required for Curl_sockaddr_storage */ +#include "multiif.h" +#include "url.h" +#include "rawstr.h" + +#define _MPRINTF_REPLACE /* use our functions only */ +#include + +#include "curl_memory.h" +#include "select.h" + +/* The last #include file should be: */ +#include "memdebug.h" + +/* RFC2348 allows the block size to be negotiated */ +#define TFTP_BLKSIZE_DEFAULT 512 +#define TFTP_BLKSIZE_MIN 8 +#define TFTP_BLKSIZE_MAX 65464 +#define TFTP_OPTION_BLKSIZE "blksize" + +/* from RFC2349: */ +#define TFTP_OPTION_TSIZE "tsize" +#define TFTP_OPTION_INTERVAL "timeout" + +typedef enum { + TFTP_MODE_NETASCII=0, + TFTP_MODE_OCTET +} tftp_mode_t; + +typedef enum { + TFTP_STATE_START=0, + TFTP_STATE_RX, + TFTP_STATE_TX, + TFTP_STATE_FIN +} tftp_state_t; + +typedef enum { + TFTP_EVENT_NONE = -1, + TFTP_EVENT_INIT = 0, + TFTP_EVENT_RRQ = 1, + TFTP_EVENT_WRQ = 2, + TFTP_EVENT_DATA = 3, + TFTP_EVENT_ACK = 4, + TFTP_EVENT_ERROR = 5, + TFTP_EVENT_OACK = 6, + TFTP_EVENT_TIMEOUT +} tftp_event_t; + +typedef enum { + TFTP_ERR_UNDEF=0, + TFTP_ERR_NOTFOUND, + TFTP_ERR_PERM, + TFTP_ERR_DISKFULL, + TFTP_ERR_ILLEGAL, + TFTP_ERR_UNKNOWNID, + TFTP_ERR_EXISTS, + TFTP_ERR_NOSUCHUSER, /* This will never be triggered by this code */ + + /* The remaining error codes are internal to curl */ + TFTP_ERR_NONE = -100, + TFTP_ERR_TIMEOUT, + TFTP_ERR_NORESPONSE +} tftp_error_t; + +typedef struct tftp_packet { + unsigned char *data; +} tftp_packet_t; + +typedef struct tftp_state_data { + tftp_state_t state; + tftp_mode_t mode; + tftp_error_t error; + tftp_event_t event; + struct connectdata *conn; + curl_socket_t sockfd; + int retries; + int retry_time; + int retry_max; + time_t start_time; + time_t max_time; + time_t rx_time; + unsigned short block; + struct Curl_sockaddr_storage local_addr; + struct Curl_sockaddr_storage remote_addr; + curl_socklen_t remote_addrlen; + int rbytes; + int sbytes; + int blksize; + int requested_blksize; + tftp_packet_t rpacket; + tftp_packet_t spacket; +} tftp_state_data_t; + + +/* Forward declarations */ +static CURLcode tftp_rx(tftp_state_data_t *state, tftp_event_t event) ; +static CURLcode tftp_tx(tftp_state_data_t *state, tftp_event_t event) ; +static CURLcode tftp_connect(struct connectdata *conn, bool *done); +static CURLcode tftp_disconnect(struct connectdata *conn, bool dead_connection); +static CURLcode tftp_do(struct connectdata *conn, bool *done); +static CURLcode tftp_done(struct connectdata *conn, + CURLcode, bool premature); +static CURLcode tftp_setup_connection(struct connectdata * conn); +static CURLcode tftp_multi_statemach(struct connectdata *conn, bool *done); +static CURLcode tftp_doing(struct connectdata *conn, bool *dophase_done); +static int tftp_getsock(struct connectdata *conn, curl_socket_t *socks, + int numsocks); +static CURLcode tftp_translate_code(tftp_error_t error); + + +/* + * TFTP protocol handler. + */ + +const struct Curl_handler Curl_handler_tftp = { + "TFTP", /* scheme */ + tftp_setup_connection, /* setup_connection */ + tftp_do, /* do_it */ + tftp_done, /* done */ + ZERO_NULL, /* do_more */ + tftp_connect, /* connect_it */ + tftp_multi_statemach, /* connecting */ + tftp_doing, /* doing */ + tftp_getsock, /* proto_getsock */ + tftp_getsock, /* doing_getsock */ + ZERO_NULL, /* perform_getsock */ + tftp_disconnect, /* disconnect */ + PORT_TFTP, /* defport */ + PROT_TFTP /* protocol */ +}; + +/********************************************************** + * + * tftp_set_timeouts - + * + * Set timeouts based on state machine state. + * Use user provided connect timeouts until DATA or ACK + * packet is received, then use user-provided transfer timeouts + * + * + **********************************************************/ +static CURLcode tftp_set_timeouts(tftp_state_data_t *state) +{ + time_t maxtime, timeout; + long timeout_ms; + bool start = (bool)(state->state == TFTP_STATE_START); + + time(&state->start_time); + + /* Compute drop-dead time */ + timeout_ms = Curl_timeleft(state->conn, NULL, start); + + if(timeout_ms < 0) { + /* time-out, bail out, go home */ + failf(state->conn->data, "Connection time-out"); + return CURLE_OPERATION_TIMEDOUT; + } + + if(start) { + + maxtime = (time_t)(timeout_ms + 500) / 1000; + state->max_time = state->start_time+maxtime; + + /* Set per-block timeout to total */ + timeout = maxtime ; + + /* Average restart after 5 seconds */ + state->retry_max = (int)timeout/5; + + if(state->retry_max < 1) + /* avoid division by zero below */ + state->retry_max = 1; + + /* Compute the re-start interval to suit the timeout */ + state->retry_time = (int)timeout/state->retry_max; + if(state->retry_time<1) + state->retry_time=1; + + } + else { + if(timeout_ms > 0) + maxtime = (time_t)(timeout_ms + 500) / 1000; + else + maxtime = 3600; + + state->max_time = state->start_time+maxtime; + + /* Set per-block timeout to 10% of total */ + timeout = maxtime/10 ; + + /* Average reposting an ACK after 15 seconds */ + state->retry_max = (int)timeout/15; + } + /* But bound the total number */ + if(state->retry_max<3) + state->retry_max=3; + + if(state->retry_max>50) + state->retry_max=50; + + /* Compute the re-ACK interval to suit the timeout */ + state->retry_time = (int)(timeout/state->retry_max); + if(state->retry_time<1) + state->retry_time=1; + + infof(state->conn->data, + "set timeouts for state %d; Total %ld, retry %d maxtry %d\n", + (int)state->state, (long)(state->max_time-state->start_time), + state->retry_time, state->retry_max); + + /* init RX time */ + time(&state->rx_time); + + return CURLE_OK; +} + +/********************************************************** + * + * tftp_set_send_first + * + * Event handler for the START state + * + **********************************************************/ + +static void setpacketevent(tftp_packet_t *packet, unsigned short num) +{ + packet->data[0] = (unsigned char)(num >> 8); + packet->data[1] = (unsigned char)(num & 0xff); +} + + +static void setpacketblock(tftp_packet_t *packet, unsigned short num) +{ + packet->data[2] = (unsigned char)(num >> 8); + packet->data[3] = (unsigned char)(num & 0xff); +} + +static unsigned short getrpacketevent(const tftp_packet_t *packet) +{ + return (unsigned short)((packet->data[0] << 8) | packet->data[1]); +} + +static unsigned short getrpacketblock(const tftp_packet_t *packet) +{ + return (unsigned short)((packet->data[2] << 8) | packet->data[3]); +} + +static size_t Curl_strnlen(const char *string, size_t maxlen) +{ + const char *end = memchr (string, '\0', maxlen); + return end ? (size_t) (end - string) : maxlen; +} + +static const char *tftp_option_get(const char *buf, size_t len, + const char **option, const char **value) +{ + size_t loc; + + loc = Curl_strnlen( buf, len ); + loc++; /* NULL term */ + + if (loc >= len) + return NULL; + *option = buf; + + loc += Curl_strnlen( buf+loc, len-loc ); + loc++; /* NULL term */ + + if (loc > len) + return NULL; + *value = &buf[strlen(*option) + 1]; + + return &buf[loc]; +} + +static CURLcode tftp_parse_option_ack(tftp_state_data_t *state, + const char *ptr, int len) +{ + const char *tmp = ptr; + struct SessionHandle *data = state->conn->data; + + /* if OACK doesn't contain blksize option, the default (512) must be used */ + state->blksize = TFTP_BLKSIZE_DEFAULT; + + while (tmp < ptr + len) { + const char *option, *value; + + tmp = tftp_option_get(tmp, ptr + len - tmp, &option, &value); + if(tmp == NULL) { + failf(data, "Malformed ACK packet, rejecting"); + return CURLE_TFTP_ILLEGAL; + } + + infof(data, "got option=(%s) value=(%s)\n", option, value); + + if(checkprefix(option, TFTP_OPTION_BLKSIZE)) { + long blksize; + + blksize = strtol( value, NULL, 10 ); + + if(!blksize) { + failf(data, "invalid blocksize value in OACK packet"); + return CURLE_TFTP_ILLEGAL; + } + else if(blksize > TFTP_BLKSIZE_MAX) { + failf(data, "%s (%d)", "blksize is larger than max supported", + TFTP_BLKSIZE_MAX); + return CURLE_TFTP_ILLEGAL; + } + else if(blksize < TFTP_BLKSIZE_MIN) { + failf(data, "%s (%d)", "blksize is smaller than min supported", + TFTP_BLKSIZE_MIN); + return CURLE_TFTP_ILLEGAL; + } + else if (blksize > state->requested_blksize) { + /* could realloc pkt buffers here, but the spec doesn't call out + * support for the server requesting a bigger blksize than the client + * requests */ + failf(data, "%s (%ld)", + "server requested blksize larger than allocated", blksize); + return CURLE_TFTP_ILLEGAL; + } + + state->blksize = (int)blksize; + infof(data, "%s (%d) %s (%d)\n", "blksize parsed from OACK", + state->blksize, "requested", state->requested_blksize); + } + else if(checkprefix(option, TFTP_OPTION_TSIZE)) { + long tsize = 0; + + tsize = strtol( value, NULL, 10 ); + infof(data, "%s (%ld)\n", "tsize parsed from OACK", tsize); + + /* tsize should be ignored on upload: Who cares about the size of the + remote file? */ + if (!data->set.upload) { + if(!tsize) { + failf(data, "invalid tsize -:%s:- value in OACK packet", value); + return CURLE_TFTP_ILLEGAL; + } + Curl_pgrsSetDownloadSize(data, tsize); + } + } + } + + return CURLE_OK; +} + +static size_t tftp_option_add(tftp_state_data_t *state, size_t csize, + char *buf, const char *option) +{ + if( ( strlen(option) + csize + 1 ) > (size_t)state->blksize ) + return 0; + strcpy(buf, option); + return( strlen(option) + 1 ); +} + +static CURLcode tftp_connect_for_tx(tftp_state_data_t *state, + tftp_event_t event) +{ + CURLcode res; +#ifndef CURL_DISABLE_VERBOSE_STRINGS + struct SessionHandle *data = state->conn->data; + + infof(data, "%s\n", "Connected for transmit"); +#endif + state->state = TFTP_STATE_TX; + res = tftp_set_timeouts(state); + if(res != CURLE_OK) + return(res); + return tftp_tx(state, event); +} + +static CURLcode tftp_connect_for_rx(tftp_state_data_t *state, + tftp_event_t event) +{ + CURLcode res; +#ifndef CURL_DISABLE_VERBOSE_STRINGS + struct SessionHandle *data = state->conn->data; + + infof(data, "%s\n", "Connected for receive"); +#endif + state->state = TFTP_STATE_RX; + res = tftp_set_timeouts(state); + if(res != CURLE_OK) + return(res); + return tftp_rx(state, event); +} + +static CURLcode tftp_send_first(tftp_state_data_t *state, tftp_event_t event) +{ + size_t sbytes; + ssize_t senddata; + const char *mode = "octet"; + char *filename; + char buf[64]; + struct SessionHandle *data = state->conn->data; + CURLcode res = CURLE_OK; + + /* Set ascii mode if -B flag was used */ + if(data->set.prefer_ascii) + mode = "netascii"; + + switch(event) { + + case TFTP_EVENT_INIT: /* Send the first packet out */ + case TFTP_EVENT_TIMEOUT: /* Resend the first packet out */ + /* Increment the retry counter, quit if over the limit */ + state->retries++; + if(state->retries>state->retry_max) { + state->error = TFTP_ERR_NORESPONSE; + state->state = TFTP_STATE_FIN; + return res; + } + + if(data->set.upload) { + /* If we are uploading, send an WRQ */ + setpacketevent(&state->spacket, TFTP_EVENT_WRQ); + state->conn->data->req.upload_fromhere = + (char *)state->spacket.data+4; + if(data->set.infilesize != -1) + Curl_pgrsSetUploadSize(data, data->set.infilesize); + } + else { + /* If we are downloading, send an RRQ */ + setpacketevent(&state->spacket, TFTP_EVENT_RRQ); + } + /* As RFC3617 describes the separator slash is not actually part of the + file name so we skip the always-present first letter of the path + string. */ + filename = curl_easy_unescape(data, &state->conn->data->state.path[1], 0, + NULL); + if(!filename) + return CURLE_OUT_OF_MEMORY; + + snprintf((char *)state->spacket.data+2, + state->blksize, + "%s%c%s%c", filename, '\0', mode, '\0'); + sbytes = 4 + strlen(filename) + strlen(mode); + + /* add tsize option */ + if(data->set.upload && (data->set.infilesize != -1)) + snprintf( buf, sizeof(buf), "%" FORMAT_OFF_T, data->set.infilesize ); + else + strcpy(buf, "0"); /* the destination is large enough */ + + sbytes += tftp_option_add(state, sbytes, + (char *)state->spacket.data+sbytes, + TFTP_OPTION_TSIZE); + sbytes += tftp_option_add(state, sbytes, + (char *)state->spacket.data+sbytes, buf); + /* add blksize option */ + snprintf( buf, sizeof(buf), "%d", state->requested_blksize ); + sbytes += tftp_option_add(state, sbytes, + (char *)state->spacket.data+sbytes, + TFTP_OPTION_BLKSIZE); + sbytes += tftp_option_add(state, sbytes, + (char *)state->spacket.data+sbytes, buf ); + + /* add timeout option */ + snprintf( buf, sizeof(buf), "%d", state->retry_time); + sbytes += tftp_option_add(state, sbytes, + (char *)state->spacket.data+sbytes, + TFTP_OPTION_INTERVAL); + sbytes += tftp_option_add(state, sbytes, + (char *)state->spacket.data+sbytes, buf ); + + /* the typecase for the 3rd argument is mostly for systems that do + not have a size_t argument, like older unixes that want an 'int' */ + senddata = sendto(state->sockfd, (void *)state->spacket.data, + (SEND_TYPE_ARG3)sbytes, 0, + state->conn->ip_addr->ai_addr, + state->conn->ip_addr->ai_addrlen); + if(senddata != (ssize_t)sbytes) { + failf(data, "%s", Curl_strerror(state->conn, SOCKERRNO)); + } + Curl_safefree(filename); + break; + + case TFTP_EVENT_OACK: + if(data->set.upload) { + res = tftp_connect_for_tx(state, event); + } + else { + res = tftp_connect_for_rx(state, event); + } + break; + + case TFTP_EVENT_ACK: /* Connected for transmit */ + res = tftp_connect_for_tx(state, event); + break; + + case TFTP_EVENT_DATA: /* Connected for receive */ + res = tftp_connect_for_rx(state, event); + break; + + case TFTP_EVENT_ERROR: + state->state = TFTP_STATE_FIN; + break; + + default: + failf(state->conn->data, "tftp_send_first: internal error"); + break; + } + return res; +} + +/* the next blocknum is x + 1 but it needs to wrap at an unsigned 16bit + boundary */ +#define NEXT_BLOCKNUM(x) (((x)+1)&0xffff) + +/********************************************************** + * + * tftp_rx + * + * Event handler for the RX state + * + **********************************************************/ +static CURLcode tftp_rx(tftp_state_data_t *state, tftp_event_t event) +{ + ssize_t sbytes; + int rblock; + struct SessionHandle *data = state->conn->data; + + switch(event) { + + case TFTP_EVENT_DATA: + /* Is this the block we expect? */ + rblock = getrpacketblock(&state->rpacket); + if(NEXT_BLOCKNUM(state->block) != rblock) { + /* No, log it, up the retry count and fail if over the limit */ + infof(data, + "Received unexpected DATA packet block %d\n", rblock); + state->retries++; + if(state->retries > state->retry_max) { + failf(data, "tftp_rx: giving up waiting for block %d", + NEXT_BLOCKNUM(state->block)); + return CURLE_TFTP_ILLEGAL; + } + break; + } + /* This is the expected block. Reset counters and ACK it. */ + state->block = (unsigned short)rblock; + state->retries = 0; + setpacketevent(&state->spacket, TFTP_EVENT_ACK); + setpacketblock(&state->spacket, state->block); + sbytes = sendto(state->sockfd, (void *)state->spacket.data, + 4, SEND_4TH_ARG, + (struct sockaddr *)&state->remote_addr, + state->remote_addrlen); + if(sbytes < 0) { + failf(data, "%s", Curl_strerror(state->conn, SOCKERRNO)); + return CURLE_SEND_ERROR; + } + + /* Check if completed (That is, a less than full packet is received) */ + if(state->rbytes < (ssize_t)state->blksize+4){ + state->state = TFTP_STATE_FIN; + } + else { + state->state = TFTP_STATE_RX; + } + time(&state->rx_time); + break; + + case TFTP_EVENT_OACK: + /* ACK option acknowledgement so we can move on to data */ + state->block = 0; + state->retries = 0; + setpacketevent(&state->spacket, TFTP_EVENT_ACK); + setpacketblock(&state->spacket, state->block); + sbytes = sendto(state->sockfd, (void *)state->spacket.data, + 4, SEND_4TH_ARG, + (struct sockaddr *)&state->remote_addr, + state->remote_addrlen); + if(sbytes < 0) { + failf(data, "%s", Curl_strerror(state->conn, SOCKERRNO)); + return CURLE_SEND_ERROR; + } + + /* we're ready to RX data */ + state->state = TFTP_STATE_RX; + time(&state->rx_time); + break; + + case TFTP_EVENT_TIMEOUT: + /* Increment the retry count and fail if over the limit */ + state->retries++; + infof(data, + "Timeout waiting for block %d ACK. Retries = %d\n", + NEXT_BLOCKNUM(state->block), state->retries); + if(state->retries > state->retry_max) { + state->error = TFTP_ERR_TIMEOUT; + state->state = TFTP_STATE_FIN; + } + else { + /* Resend the previous ACK */ + sbytes = sendto(state->sockfd, (void *)state->spacket.data, + 4, SEND_4TH_ARG, + (struct sockaddr *)&state->remote_addr, + state->remote_addrlen); + if(sbytes<0) { + failf(data, "%s", Curl_strerror(state->conn, SOCKERRNO)); + return CURLE_SEND_ERROR; + } + } + break; + + case TFTP_EVENT_ERROR: + setpacketevent(&state->spacket, TFTP_EVENT_ERROR); + setpacketblock(&state->spacket, state->block); + (void)sendto(state->sockfd, (void *)state->spacket.data, + 4, SEND_4TH_ARG, + (struct sockaddr *)&state->remote_addr, + state->remote_addrlen); + /* don't bother with the return code, but if the socket is still up we + * should be a good TFTP client and let the server know we're done */ + state->state = TFTP_STATE_FIN; + break; + + default: + failf(data, "%s", "tftp_rx: internal error"); + return CURLE_TFTP_ILLEGAL; /* not really the perfect return code for + this */ + } + return CURLE_OK; +} + +/********************************************************** + * + * tftp_tx + * + * Event handler for the TX state + * + **********************************************************/ +static CURLcode tftp_tx(tftp_state_data_t *state, tftp_event_t event) +{ + struct SessionHandle *data = state->conn->data; + ssize_t sbytes; + int rblock; + CURLcode res = CURLE_OK; + struct SingleRequest *k = &data->req; + + switch(event) { + + case TFTP_EVENT_ACK: + case TFTP_EVENT_OACK: + if (event == TFTP_EVENT_ACK) { + /* Ack the packet */ + rblock = getrpacketblock(&state->rpacket); + + if(rblock != state->block && + /* There's a bug in tftpd-hpa that causes it to send us an ack for + * 65535 when the block number wraps to 0. So when we're expecting + * 0, also accept 65535. See + * http://syslinux.zytor.com/archives/2010-September/015253.html + * */ + !(state->block == 0 && rblock == 65535)) { + /* This isn't the expected block. Log it and up the retry counter */ + infof(data, "Received ACK for block %d, expecting %d\n", + rblock, state->block); + state->retries++; + /* Bail out if over the maximum */ + if(state->retries>state->retry_max) { + failf(data, "tftp_tx: giving up waiting for block %d ack", + state->block); + res = CURLE_SEND_ERROR; + } + else { + /* Re-send the data packet */ + sbytes = sendto(state->sockfd, (void *)&state->spacket.data, + 4+state->sbytes, SEND_4TH_ARG, + (struct sockaddr *)&state->remote_addr, + state->remote_addrlen); + /* Check all sbytes were sent */ + if(sbytes<0) { + failf(data, "%s", Curl_strerror(state->conn, SOCKERRNO)); + res = CURLE_SEND_ERROR; + } + } + return res; + } + /* This is the expected packet. Reset the counters and send the next + block */ + time(&state->rx_time); + state->block++; + } + else + state->block = 1; /* first data block is 1 when using OACK */ + + state->retries = 0; + setpacketevent(&state->spacket, TFTP_EVENT_DATA); + setpacketblock(&state->spacket, state->block); + if(state->block > 1 && state->sbytes < (int)state->blksize) { + state->state = TFTP_STATE_FIN; + return CURLE_OK; + } + res = Curl_fillreadbuffer(state->conn, state->blksize, &state->sbytes); + if(res) + return res; + sbytes = sendto(state->sockfd, (void *)state->spacket.data, + 4+state->sbytes, SEND_4TH_ARG, + (struct sockaddr *)&state->remote_addr, + state->remote_addrlen); + /* Check all sbytes were sent */ + if(sbytes<0) { + failf(data, "%s", Curl_strerror(state->conn, SOCKERRNO)); + return CURLE_SEND_ERROR; + } + /* Update the progress meter */ + k->writebytecount += state->sbytes; + Curl_pgrsSetUploadCounter(data, k->writebytecount); + break; + + case TFTP_EVENT_TIMEOUT: + /* Increment the retry counter and log the timeout */ + state->retries++; + infof(data, "Timeout waiting for block %d ACK. " + " Retries = %d\n", NEXT_BLOCKNUM(state->block), state->retries); + /* Decide if we've had enough */ + if(state->retries > state->retry_max) { + state->error = TFTP_ERR_TIMEOUT; + state->state = TFTP_STATE_FIN; + } + else { + /* Re-send the data packet */ + sbytes = sendto(state->sockfd, (void *)state->spacket.data, + 4+state->sbytes, SEND_4TH_ARG, + (struct sockaddr *)&state->remote_addr, + state->remote_addrlen); + /* Check all sbytes were sent */ + if(sbytes<0) { + failf(data, "%s", Curl_strerror(state->conn, SOCKERRNO)); + return CURLE_SEND_ERROR; + } + /* since this was a re-send, we remain at the still byte position */ + Curl_pgrsSetUploadCounter(data, k->writebytecount); + } + break; + + case TFTP_EVENT_ERROR: + state->state = TFTP_STATE_FIN; + setpacketevent(&state->spacket, TFTP_EVENT_ERROR); + setpacketblock(&state->spacket, state->block); + (void)sendto(state->sockfd, (void *)state->spacket.data, 4, SEND_4TH_ARG, + (struct sockaddr *)&state->remote_addr, + state->remote_addrlen); + /* don't bother with the return code, but if the socket is still up we + * should be a good TFTP client and let the server know we're done */ + state->state = TFTP_STATE_FIN; + break; + + default: + failf(data, "tftp_tx: internal error, event: %i", (int)(event)); + break; + } + + return res; +} + +/********************************************************** + * + * tftp_translate_code + * + * Translate internal error codes to CURL error codes + * + **********************************************************/ +static CURLcode tftp_translate_code(tftp_error_t error) +{ + CURLcode code = CURLE_OK; + + if(error != TFTP_ERR_NONE) { + switch(error) { + case TFTP_ERR_NOTFOUND: + code = CURLE_TFTP_NOTFOUND; + break; + case TFTP_ERR_PERM: + code = CURLE_TFTP_PERM; + break; + case TFTP_ERR_DISKFULL: + code = CURLE_REMOTE_DISK_FULL; + break; + case TFTP_ERR_UNDEF: + case TFTP_ERR_ILLEGAL: + code = CURLE_TFTP_ILLEGAL; + break; + case TFTP_ERR_UNKNOWNID: + code = CURLE_TFTP_UNKNOWNID; + break; + case TFTP_ERR_EXISTS: + code = CURLE_REMOTE_FILE_EXISTS; + break; + case TFTP_ERR_NOSUCHUSER: + code = CURLE_TFTP_NOSUCHUSER; + break; + case TFTP_ERR_TIMEOUT: + code = CURLE_OPERATION_TIMEDOUT; + break; + case TFTP_ERR_NORESPONSE: + code = CURLE_COULDNT_CONNECT; + break; + default: + code= CURLE_ABORTED_BY_CALLBACK; + break; + } + } + else { + code = CURLE_OK; + } + + return(code); +} + +/********************************************************** + * + * tftp_state_machine + * + * The tftp state machine event dispatcher + * + **********************************************************/ +static CURLcode tftp_state_machine(tftp_state_data_t *state, + tftp_event_t event) +{ + CURLcode res = CURLE_OK; + struct SessionHandle *data = state->conn->data; + switch(state->state) { + case TFTP_STATE_START: + DEBUGF(infof(data, "TFTP_STATE_START\n")); + res = tftp_send_first(state, event); + break; + case TFTP_STATE_RX: + DEBUGF(infof(data, "TFTP_STATE_RX\n")); + res = tftp_rx(state, event); + break; + case TFTP_STATE_TX: + DEBUGF(infof(data, "TFTP_STATE_TX\n")); + res = tftp_tx(state, event); + break; + case TFTP_STATE_FIN: + infof(data, "%s\n", "TFTP finished"); + break; + default: + DEBUGF(infof(data, "STATE: %d\n", state->state)); + failf(data, "%s", "Internal state machine error"); + res = CURLE_TFTP_ILLEGAL; + break; + } + return res; +} + +/********************************************************** + * + * tftp_disconnect + * + * The disconnect callback + * + **********************************************************/ +static CURLcode tftp_disconnect(struct connectdata *conn, bool dead_connection) +{ + tftp_state_data_t *state = conn->proto.tftpc; + (void) dead_connection; + + /* done, free dynamically allocated pkt buffers */ + if(state) { + Curl_safefree(state->rpacket.data); + Curl_safefree(state->spacket.data); + free(state); + } + + return CURLE_OK; +} + +/********************************************************** + * + * tftp_connect + * + * The connect callback + * + **********************************************************/ +static CURLcode tftp_connect(struct connectdata *conn, bool *done) +{ + CURLcode code; + tftp_state_data_t *state; + int blksize, rc; + + blksize = TFTP_BLKSIZE_DEFAULT; + + /* If there already is a protocol-specific struct allocated for this + sessionhandle, deal with it */ + Curl_reset_reqproto(conn); + + state = conn->proto.tftpc = calloc(1, sizeof(tftp_state_data_t)); + if(!state) + return CURLE_OUT_OF_MEMORY; + + /* alloc pkt buffers based on specified blksize */ + if(conn->data->set.tftp_blksize) { + blksize = (int)conn->data->set.tftp_blksize; + if(blksize > TFTP_BLKSIZE_MAX || blksize < TFTP_BLKSIZE_MIN ) + return CURLE_TFTP_ILLEGAL; + } + + if(!state->rpacket.data) { + state->rpacket.data = calloc(1, blksize + 2 + 2); + + if(!state->rpacket.data) + return CURLE_OUT_OF_MEMORY; + } + + if(!state->spacket.data) { + state->spacket.data = calloc(1, blksize + 2 + 2); + + if(!state->spacket.data) + return CURLE_OUT_OF_MEMORY; + } + + conn->bits.close = TRUE; /* we don't keep TFTP connections up bascially + because there's none or very little gain for UDP + */ + + state->conn = conn; + state->sockfd = state->conn->sock[FIRSTSOCKET]; + state->state = TFTP_STATE_START; + state->error = TFTP_ERR_NONE; + state->blksize = TFTP_BLKSIZE_DEFAULT; + state->requested_blksize = blksize; + + ((struct sockaddr *)&state->local_addr)->sa_family = + (unsigned short)(conn->ip_addr->ai_family); + + tftp_set_timeouts(state); + + if(!conn->bits.bound) { + /* If not already bound, bind to any interface, random UDP port. If it is + * reused or a custom local port was desired, this has already been done! + * + * We once used the size of the local_addr struct as the third argument + * for bind() to better work with IPv6 or whatever size the struct could + * have, but we learned that at least Tru64, AIX and IRIX *requires* the + * size of that argument to match the exact size of a 'sockaddr_in' struct + * when running IPv4-only. + * + * Therefore we use the size from the address we connected to, which we + * assume uses the same IP version and thus hopefully this works for both + * IPv4 and IPv6... + */ + rc = bind(state->sockfd, (struct sockaddr *)&state->local_addr, + conn->ip_addr->ai_addrlen); + if(rc) { + failf(conn->data, "bind() failed; %s", + Curl_strerror(conn, SOCKERRNO)); + return CURLE_COULDNT_CONNECT; + } + conn->bits.bound = TRUE; + } + + Curl_pgrsStartNow(conn->data); + + *done = TRUE; + code = CURLE_OK; + return(code); +} + +/********************************************************** + * + * tftp_done + * + * The done callback + * + **********************************************************/ +static CURLcode tftp_done(struct connectdata *conn, CURLcode status, + bool premature) +{ + CURLcode code = CURLE_OK; + tftp_state_data_t *state = (tftp_state_data_t *)conn->proto.tftpc; + + (void)status; /* unused */ + (void)premature; /* not used */ + + Curl_pgrsDone(conn); + + /* If we have encountered an error */ + code = tftp_translate_code(state->error); + + return code; +} + +/********************************************************** + * + * tftp_getsock + * + * The getsock callback + * + **********************************************************/ +static int tftp_getsock(struct connectdata *conn, curl_socket_t *socks, + int numsocks) +{ + if(!numsocks) + return GETSOCK_BLANK; + + socks[0] = conn->sock[FIRSTSOCKET]; + + return GETSOCK_READSOCK(0); +} + +/********************************************************** + * + * tftp_receive_packet + * + * Called once select fires and data is ready on the socket + * + **********************************************************/ +static CURLcode tftp_receive_packet(struct connectdata *conn) +{ + struct Curl_sockaddr_storage fromaddr; + curl_socklen_t fromlen; + CURLcode result = CURLE_OK; + struct SessionHandle *data = conn->data; + tftp_state_data_t *state = (tftp_state_data_t *)conn->proto.tftpc; + struct SingleRequest *k = &data->req; + + /* Receive the packet */ + fromlen = sizeof(fromaddr); + state->rbytes = (int)recvfrom(state->sockfd, + (void *)state->rpacket.data, + state->blksize+4, + 0, + (struct sockaddr *)&fromaddr, + &fromlen); + if(state->remote_addrlen==0) { + memcpy(&state->remote_addr, &fromaddr, fromlen); + state->remote_addrlen = fromlen; + } + + /* Sanity check packet length */ + if(state->rbytes < 4) { + failf(data, "Received too short packet"); + /* Not a timeout, but how best to handle it? */ + state->event = TFTP_EVENT_TIMEOUT; + } + else { + /* The event is given by the TFTP packet time */ + state->event = (tftp_event_t)getrpacketevent(&state->rpacket); + + switch(state->event) { + case TFTP_EVENT_DATA: + /* Don't pass to the client empty or retransmitted packets */ + if(state->rbytes > 4 && + (NEXT_BLOCKNUM(state->block) == getrpacketblock(&state->rpacket))) { + result = Curl_client_write(conn, CLIENTWRITE_BODY, + (char *)state->rpacket.data+4, + state->rbytes-4); + if(result) { + tftp_state_machine(state, TFTP_EVENT_ERROR); + return result; + } + k->bytecount += state->rbytes-4; + Curl_pgrsSetDownloadCounter(data, (curl_off_t) k->bytecount); + } + break; + case TFTP_EVENT_ERROR: + state->error = (tftp_error_t)getrpacketblock(&state->rpacket); + infof(data, "%s\n", (const char *)state->rpacket.data+4); + break; + case TFTP_EVENT_ACK: + break; + case TFTP_EVENT_OACK: + result = tftp_parse_option_ack(state, + (const char *)state->rpacket.data+2, + state->rbytes-2); + if(result) + return result; + break; + case TFTP_EVENT_RRQ: + case TFTP_EVENT_WRQ: + default: + failf(data, "%s", "Internal error: Unexpected packet"); + break; + } + + /* Update the progress meter */ + if(Curl_pgrsUpdate(conn)) { + tftp_state_machine(state, TFTP_EVENT_ERROR); + return CURLE_ABORTED_BY_CALLBACK; + } + } + return result; +} + +/********************************************************** + * + * tftp_state_timeout + * + * Check if timeouts have been reached + * + **********************************************************/ +static long tftp_state_timeout(struct connectdata *conn, tftp_event_t *event) +{ + time_t current; + tftp_state_data_t *state = (tftp_state_data_t *)conn->proto.tftpc; + + if (event) + *event = TFTP_EVENT_NONE; + + time(¤t); + if(current > state->max_time) { + DEBUGF(infof(conn->data, "timeout: %ld > %ld\n", + (long)current, (long)state->max_time)); + state->error = TFTP_ERR_TIMEOUT; + state->state = TFTP_STATE_FIN; + return 0; + } + else if (current > state->rx_time+state->retry_time) { + if (event) + *event = TFTP_EVENT_TIMEOUT; + time(&state->rx_time); /* update even though we received nothing */ + } + + /* there's a typecast below here since 'time_t' may in fact be larger than + 'long', but we estimate that a 'long' will still be able to hold number + of seconds even if "only" 32 bit */ + return (long)(state->max_time - current); +} + + +/********************************************************** + * + * tftp_easy_statemach + * + * Handle easy request until completion + * + **********************************************************/ +static CURLcode tftp_easy_statemach(struct connectdata *conn) +{ + int rc; + int check_time = 0; + CURLcode result = CURLE_OK; + struct SessionHandle *data = conn->data; + tftp_state_data_t *state = (tftp_state_data_t *)conn->proto.tftpc; + curl_socket_t fd_read; + long timeout_ms; + struct SingleRequest *k = &data->req; + struct timeval transaction_start = Curl_tvnow(); + + k->start = transaction_start; + k->now = transaction_start; + + /* Run the TFTP State Machine */ + for(; (state->state != TFTP_STATE_FIN) && (result == CURLE_OK); ) { + + timeout_ms = state->retry_time * 1000; + + if (data->set.upload) { + if (data->set.max_send_speed && + (data->progress.ulspeed > data->set.max_send_speed)) { + fd_read = CURL_SOCKET_BAD; + timeout_ms = Curl_sleep_time(data->set.max_send_speed, + data->progress.ulspeed, state->blksize); + } + else { + fd_read = state->sockfd; + } + } + else { + if (data->set.max_recv_speed && + (data->progress.dlspeed > data->set.max_recv_speed)) { + fd_read = CURL_SOCKET_BAD; + timeout_ms = Curl_sleep_time(data->set.max_recv_speed, + data->progress.dlspeed, state->blksize); + } + else { + fd_read = state->sockfd; + } + } + + if(data->set.timeout) { + timeout_ms = data->set.timeout - Curl_tvdiff(k->now, k->start); + if (timeout_ms > state->retry_time * 1000) + timeout_ms = state->retry_time * 1000; + else if(timeout_ms < 0) + timeout_ms = 0; + } + + + /* Wait until ready to read or timeout occurs */ + rc = Curl_socket_ready(fd_read, CURL_SOCKET_BAD, (int)(timeout_ms)); + + k->now = Curl_tvnow(); + + /* Force a progress callback if it's been too long */ + if (Curl_tvdiff(k->now, k->start) >= data->set.timeout) { + if(Curl_pgrsUpdate(conn)) { + tftp_state_machine(state, TFTP_EVENT_ERROR); + return CURLE_ABORTED_BY_CALLBACK; + } + k->start = k->now; + } + + if(rc == -1) { + /* bail out */ + int error = SOCKERRNO; + failf(data, "%s", Curl_strerror(conn, error)); + state->event = TFTP_EVENT_ERROR; + } + else { + + if(rc==0) { + /* A timeout occured, but our timeout is variable, so maybe + just continue? */ + long rtms = state->retry_time * 1000; + if (Curl_tvdiff(k->now, transaction_start) > rtms) { + state->event = TFTP_EVENT_TIMEOUT; + /* Force a look at transfer timeouts */ + check_time = 1; + } + else { + continue; /* skip state machine */ + } + } + else { + result = tftp_receive_packet(conn); + if (result == CURLE_OK) + transaction_start = Curl_tvnow(); + + if(k->bytecountp) + *k->bytecountp = k->bytecount; /* read count */ + if(k->writebytecountp) + *k->writebytecountp = k->writebytecount; /* write count */ + } + } + + if(check_time) { + tftp_state_timeout(conn, NULL); + check_time = 0; + } + + if(result) + return(result); + + result = tftp_state_machine(state, state->event); + } + + /* Tell curl we're done */ + Curl_setup_transfer(conn, -1, -1, FALSE, NULL, -1, NULL); + + return(result); +} + +/********************************************************** + * + * tftp_multi_statemach + * + * Handle single RX socket event and return + * + **********************************************************/ +static CURLcode tftp_multi_statemach(struct connectdata *conn, bool *done) +{ + int rc; + tftp_event_t event; + CURLcode result = CURLE_OK; + struct SessionHandle *data = conn->data; + tftp_state_data_t *state = (tftp_state_data_t *)conn->proto.tftpc; + long timeout_ms = tftp_state_timeout(conn, &event); + + *done = FALSE; + + if(timeout_ms <= 0) { + failf(data, "TFTP response timeout"); + return CURLE_OPERATION_TIMEDOUT; + } + else if (event != TFTP_EVENT_NONE) { + result = tftp_state_machine(state, event); + if(result != CURLE_OK) + return(result); + *done = (bool)(state->state == TFTP_STATE_FIN); + if(*done) + /* Tell curl we're done */ + Curl_setup_transfer(conn, -1, -1, FALSE, NULL, -1, NULL); + } + else { + /* no timeouts to handle, check our socket */ + rc = Curl_socket_ready(state->sockfd, CURL_SOCKET_BAD, 0); + + if(rc == -1) { + /* bail out */ + int error = SOCKERRNO; + failf(data, "%s", Curl_strerror(conn, error)); + state->event = TFTP_EVENT_ERROR; + } + else if(rc != 0) { + result = tftp_receive_packet(conn); + if(result != CURLE_OK) + return(result); + result = tftp_state_machine(state, state->event); + if(result != CURLE_OK) + return(result); + *done = (bool)(state->state == TFTP_STATE_FIN); + if(*done) + /* Tell curl we're done */ + Curl_setup_transfer(conn, -1, -1, FALSE, NULL, -1, NULL); + } + /* if rc == 0, then select() timed out */ + } + + return result; +} + +/********************************************************** + * + * tftp_doing + * + * Called from multi.c while DOing + * + **********************************************************/ +static CURLcode tftp_doing(struct connectdata *conn, bool *dophase_done) +{ + CURLcode result; + result = tftp_multi_statemach(conn, dophase_done); + + if(*dophase_done) { + DEBUGF(infof(conn->data, "DO phase is complete\n")); + } + return result; +} + +/********************************************************** + * + * tftp_peform + * + * Entry point for transfer from tftp_do, sarts state mach + * + **********************************************************/ +static CURLcode tftp_perform(struct connectdata *conn, bool *dophase_done) +{ + CURLcode result = CURLE_OK; + tftp_state_data_t *state = (tftp_state_data_t *)conn->proto.tftpc; + + *dophase_done = FALSE; + + result = tftp_state_machine(state, TFTP_EVENT_INIT); + + if(state->state == TFTP_STATE_FIN || result != CURLE_OK) + return(result); + + if(conn->data->state.used_interface == Curl_if_multi) + tftp_multi_statemach(conn, dophase_done); + else { + result = tftp_easy_statemach(conn); + *dophase_done = TRUE; /* with the easy interface we are done here */ + } + + if(*dophase_done) + DEBUGF(infof(conn->data, "DO phase is complete\n")); + + return result; +} + + +/********************************************************** + * + * tftp_do + * + * The do callback + * + * This callback initiates the TFTP transfer + * + **********************************************************/ + +static CURLcode tftp_do(struct connectdata *conn, bool *done) +{ + tftp_state_data_t *state; + CURLcode code; + + *done = FALSE; + + /* + Since connections can be re-used between SessionHandles, this might be a + connection already existing but on a fresh SessionHandle struct so we must + make sure we have a good 'struct TFTP' to play with. For new connections, + the struct TFTP is allocated and setup in the tftp_connect() function. + */ + Curl_reset_reqproto(conn); + + if(!conn->proto.tftpc) { + code = tftp_connect(conn, done); + if(code) + return code; + } + state = (tftp_state_data_t *)conn->proto.tftpc; + + code = tftp_perform(conn, done); + + /* If tftp_perform() returned an error, use that for return code. If it + was OK, see if tftp_translate_code() has an error. */ + if (code == CURLE_OK) + /* If we have encountered an internal tftp error, translate it. */ + code = tftp_translate_code(state->error); + + return code; +} + +static CURLcode tftp_setup_connection(struct connectdata * conn) +{ + struct SessionHandle *data = conn->data; + char * type; + char command; + + conn->socktype = SOCK_DGRAM; /* UDP datagram based */ + + /* TFTP URLs support an extension like ";mode=" that + * we'll try to get now! */ + type = strstr(data->state.path, ";mode="); + + if(!type) + type = strstr(conn->host.rawalloc, ";mode="); + + if(type) { + *type = 0; /* it was in the middle of the hostname */ + command = Curl_raw_toupper(type[6]); + + switch (command) { + case 'A': /* ASCII mode */ + case 'N': /* NETASCII mode */ + data->set.prefer_ascii = TRUE; + break; + + case 'O': /* octet mode */ + case 'I': /* binary mode */ + default: + /* switch off ASCII */ + data->set.prefer_ascii = FALSE; + break; + } + } + + return CURLE_OK; +} +#endif diff --git a/mobicore/common/curl/lib/tftp.h b/mobicore/common/curl/lib/tftp.h new file mode 100644 index 0000000000000000000000000000000000000000..b2d67b26be1a9007d0f202704b55c6ac4fb952d0 --- /dev/null +++ b/mobicore/common/curl/lib/tftp.h @@ -0,0 +1,28 @@ +#ifndef __TFTP_H +#define __TFTP_H + +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) 1998 - 2007, Daniel Stenberg, , et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at http://curl.haxx.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ***************************************************************************/ +#ifndef CURL_DISABLE_TFTP +extern const struct Curl_handler Curl_handler_tftp; +#endif +#endif diff --git a/mobicore/common/curl/lib/timeval.c b/mobicore/common/curl/lib/timeval.c new file mode 100644 index 0000000000000000000000000000000000000000..cb39308e0d2f09a635d293e4341a89df60b85a74 --- /dev/null +++ b/mobicore/common/curl/lib/timeval.c @@ -0,0 +1,131 @@ +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) 1998 - 2008, Daniel Stenberg, , et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at http://curl.haxx.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ***************************************************************************/ + +#include "timeval.h" + +#if defined(WIN32) && !defined(MSDOS) + +struct timeval curlx_tvnow(void) +{ + /* + ** GetTickCount() is available on _all_ Windows versions from W95 up + ** to nowadays. Returns milliseconds elapsed since last system boot, + ** increases monotonically and wraps once 49.7 days have elapsed. + */ + struct timeval now; + DWORD milliseconds = GetTickCount(); + now.tv_sec = milliseconds / 1000; + now.tv_usec = (milliseconds % 1000) * 1000; + return now; +} + +#elif defined(HAVE_CLOCK_GETTIME_MONOTONIC) + +struct timeval curlx_tvnow(void) +{ + /* + ** clock_gettime() is granted to be increased monotonically when the + ** monotonic clock is queried. Time starting point is unspecified, it + ** could be the system start-up time, the Epoch, or something else, + ** in any case the time starting point does not change once that the + ** system has started up. + */ + struct timeval now; + struct timespec tsnow; + if(0 == clock_gettime(CLOCK_MONOTONIC, &tsnow)) { + now.tv_sec = tsnow.tv_sec; + now.tv_usec = tsnow.tv_nsec / 1000; + } + /* + ** Even when the configure process has truly detected monotonic clock + ** availability, it might happen that it is not actually available at + ** run-time. When this occurs simply fallback to other time source. + */ +#ifdef HAVE_GETTIMEOFDAY + else + (void)gettimeofday(&now, NULL); +#else + else { + now.tv_sec = (long)time(NULL); + now.tv_usec = 0; + } +#endif + return now; +} + +#elif defined(HAVE_GETTIMEOFDAY) + +struct timeval curlx_tvnow(void) +{ + /* + ** gettimeofday() is not granted to be increased monotonically, due to + ** clock drifting and external source time synchronization it can jump + ** forward or backward in time. + */ + struct timeval now; + (void)gettimeofday(&now, NULL); + return now; +} + +#else + +struct timeval curlx_tvnow(void) +{ + /* + ** time() returns the value of time in seconds since the Epoch. + */ + struct timeval now; + now.tv_sec = (long)time(NULL); + now.tv_usec = 0; + return now; +} + +#endif + +/* + * Make sure that the first argument is the more recent time, as otherwise + * we'll get a weird negative time-diff back... + * + * Returns: the time difference in number of milliseconds. + */ +long curlx_tvdiff(struct timeval newer, struct timeval older) +{ + return (newer.tv_sec-older.tv_sec)*1000+ + (newer.tv_usec-older.tv_usec)/1000; +} + +/* + * Same as curlx_tvdiff but with full usec resolution. + * + * Returns: the time difference in seconds with subsecond resolution. + */ +double curlx_tvdiff_secs(struct timeval newer, struct timeval older) +{ + return (double)(newer.tv_sec-older.tv_sec)+ + (double)(newer.tv_usec-older.tv_usec)/1000000.0; +} + +/* return the number of seconds in the given input timeval struct */ +long Curl_tvlong(struct timeval t1) +{ + return t1.tv_sec; +} diff --git a/mobicore/common/curl/lib/timeval.h b/mobicore/common/curl/lib/timeval.h new file mode 100644 index 0000000000000000000000000000000000000000..bc79a45ad9b010b3cf324666915b1ea582ac65d0 --- /dev/null +++ b/mobicore/common/curl/lib/timeval.h @@ -0,0 +1,57 @@ +#ifndef __TIMEVAL_H +#define __TIMEVAL_H +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) 1998 - 2007, Daniel Stenberg, , et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at http://curl.haxx.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ***************************************************************************/ + +/* + * CAUTION: this header is designed to work when included by the app-side + * as well as the library. Do not mix with library internals! + */ + +#include "setup.h" + +struct timeval curlx_tvnow(void); + +/* + * Make sure that the first argument (t1) is the more recent time and t2 is + * the older time, as otherwise you get a weird negative time-diff back... + * + * Returns: the time difference in number of milliseconds. + */ +long curlx_tvdiff(struct timeval t1, struct timeval t2); + +/* + * Same as curlx_tvdiff but with full usec resolution. + * + * Returns: the time difference in seconds with subsecond resolution. + */ +double curlx_tvdiff_secs(struct timeval t1, struct timeval t2); + +long Curl_tvlong(struct timeval t1); + +/* These two defines below exist to provide the older API for library + internals only. */ +#define Curl_tvnow() curlx_tvnow() +#define Curl_tvdiff(x,y) curlx_tvdiff(x,y) +#define Curl_tvdiff_secs(x,y) curlx_tvdiff_secs(x,y) + +#endif diff --git a/mobicore/common/curl/lib/transfer.c b/mobicore/common/curl/lib/transfer.c new file mode 100644 index 0000000000000000000000000000000000000000..e4e3405d307dcf5ce2189c3ce2c60f4deb62a9dc --- /dev/null +++ b/mobicore/common/curl/lib/transfer.c @@ -0,0 +1,2338 @@ +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) 1998 - 2010, Daniel Stenberg, , et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at http://curl.haxx.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ***************************************************************************/ + +#include "setup.h" + +/* -- WIN32 approved -- */ +#include +#include +#include +#include +#include +#include + +#include "strtoofft.h" +#include "strequal.h" +#include "rawstr.h" + +#ifdef WIN32 +#include +#include +#else +#ifdef HAVE_SYS_SOCKET_H +#include +#endif +#ifdef HAVE_NETINET_IN_H +#include +#endif +#ifdef HAVE_SYS_TIME_H +#include +#endif +#ifdef HAVE_UNISTD_H +#include +#endif +#ifdef HAVE_NETDB_H +#include +#endif +#ifdef HAVE_ARPA_INET_H +#include +#endif +#ifdef HAVE_NET_IF_H +#include +#endif +#ifdef HAVE_SYS_IOCTL_H +#include +#endif +#ifdef HAVE_SIGNAL_H +#include +#endif + +#ifdef HAVE_SYS_PARAM_H +#include +#endif + +#ifdef HAVE_SYS_SELECT_H +#include +#endif + +#ifndef HAVE_SOCKET +#error "We can't compile without socket() support!" +#endif + +#endif /* WIN32 */ + +#include "urldata.h" +#include +#include "netrc.h" + +#include "content_encoding.h" +#include "hostip.h" +#include "transfer.h" +#include "sendf.h" +#include "speedcheck.h" +#include "progress.h" +#include "http.h" +#include "url.h" +#include "getinfo.h" +#include "sslgen.h" +#include "http_digest.h" +#include "http_ntlm.h" +#include "http_negotiate.h" +#include "share.h" +#include "curl_memory.h" +#include "select.h" +#include "multiif.h" +#include "easyif.h" /* for Curl_convert_to_network prototype */ +#include "rtsp.h" +#include "connect.h" + +#define _MPRINTF_REPLACE /* use our functions only */ +#include + +/* The last #include file should be: */ +#include "memdebug.h" + +#define CURL_TIMEOUT_EXPECT_100 1000 /* counting ms here */ + +/* + * This function will call the read callback to fill our buffer with data + * to upload. + */ +CURLcode Curl_fillreadbuffer(struct connectdata *conn, int bytes, int *nreadp) +{ + struct SessionHandle *data = conn->data; + size_t buffersize = (size_t)bytes; + int nread; +#ifdef CURL_DOES_CONVERSIONS + bool sending_http_headers = FALSE; + + if((conn->protocol&(PROT_HTTP|PROT_RTSP)) && + (data->state.proto.http->sending == HTTPSEND_REQUEST)) { + /* We're sending the HTTP request headers, not the data. + Remember that so we don't re-translate them into garbage. */ + sending_http_headers = TRUE; + } +#endif + + if(data->req.upload_chunky) { + /* if chunked Transfer-Encoding */ + buffersize -= (8 + 2 + 2); /* 32bit hex + CRLF + CRLF */ + data->req.upload_fromhere += (8 + 2); /* 32bit hex + CRLF */ + } + + /* this function returns a size_t, so we typecast to int to prevent warnings + with picky compilers */ + nread = (int)conn->fread_func(data->req.upload_fromhere, 1, + buffersize, conn->fread_in); + + if(nread == CURL_READFUNC_ABORT) { + failf(data, "operation aborted by callback"); + *nreadp = 0; + return CURLE_ABORTED_BY_CALLBACK; + } + else if(nread == CURL_READFUNC_PAUSE) { + struct SingleRequest *k = &data->req; + /* CURL_READFUNC_PAUSE pauses read callbacks that feed socket writes */ + k->keepon |= KEEP_SEND_PAUSE; /* mark socket send as paused */ + if(data->req.upload_chunky) { + /* Back out the preallocation done above */ + data->req.upload_fromhere -= (8 + 2); + } + *nreadp = 0; + return CURLE_OK; /* nothing was read */ + } + else if((size_t)nread > buffersize) { + /* the read function returned a too large value */ + *nreadp = 0; + failf(data, "read function returned funny value"); + return CURLE_READ_ERROR; + } + + if(!data->req.forbidchunk && data->req.upload_chunky) { + /* if chunked Transfer-Encoding + * build chunk: + * + * CRLF + * CRLF + */ + /* On non-ASCII platforms the may or may not be + translated based on set.prefer_ascii while the protocol + portion must always be translated to the network encoding. + To further complicate matters, line end conversion might be + done later on, so we need to prevent CRLFs from becoming + CRCRLFs if that's the case. To do this we use bare LFs + here, knowing they'll become CRLFs later on. + */ + + char hexbuffer[11]; + const char *endofline_native; + const char *endofline_network; + int hexlen; +#ifdef CURL_DO_LINEEND_CONV + if((data->set.crlf) || (data->set.prefer_ascii)) { +#else + if(data->set.crlf) { +#endif /* CURL_DO_LINEEND_CONV */ + /* \n will become \r\n later on */ + endofline_native = "\n"; + endofline_network = "\x0a"; + } + else { + endofline_native = "\r\n"; + endofline_network = "\x0d\x0a"; + } + hexlen = snprintf(hexbuffer, sizeof(hexbuffer), + "%x%s", nread, endofline_native); + + /* move buffer pointer */ + data->req.upload_fromhere -= hexlen; + nread += hexlen; + + /* copy the prefix to the buffer, leaving out the NUL */ + memcpy(data->req.upload_fromhere, hexbuffer, hexlen); + + /* always append ASCII CRLF to the data */ + memcpy(data->req.upload_fromhere + nread, + endofline_network, + strlen(endofline_network)); + +#ifdef CURL_DOES_CONVERSIONS + CURLcode res; + int length; + if(data->set.prefer_ascii) { + /* translate the protocol and data */ + length = nread; + } + else { + /* just translate the protocol portion */ + length = strlen(hexbuffer); + } + res = Curl_convert_to_network(data, data->req.upload_fromhere, length); + /* Curl_convert_to_network calls failf if unsuccessful */ + if(res) + return(res); +#endif /* CURL_DOES_CONVERSIONS */ + + if((nread - hexlen) == 0) + /* mark this as done once this chunk is transfered */ + data->req.upload_done = TRUE; + + nread+=(int)strlen(endofline_native); /* for the added end of line */ + } +#ifdef CURL_DOES_CONVERSIONS + else if((data->set.prefer_ascii) && (!sending_http_headers)) { + CURLcode res; + res = Curl_convert_to_network(data, data->req.upload_fromhere, nread); + /* Curl_convert_to_network calls failf if unsuccessful */ + if(res != CURLE_OK) + return(res); + } +#endif /* CURL_DOES_CONVERSIONS */ + + *nreadp = nread; + + return CURLE_OK; +} + + +/* + * Curl_readrewind() rewinds the read stream. This is typically used for HTTP + * POST/PUT with multi-pass authentication when a sending was denied and a + * resend is necessary. + */ +CURLcode Curl_readrewind(struct connectdata *conn) +{ + struct SessionHandle *data = conn->data; + + conn->bits.rewindaftersend = FALSE; /* we rewind now */ + + /* explicitly switch off sending data on this connection now since we are + about to restart a new transfer and thus we want to avoid inadvertently + sending more data on the existing connection until the next transfer + starts */ + data->req.keepon &= ~KEEP_SEND; + + /* We have sent away data. If not using CURLOPT_POSTFIELDS or + CURLOPT_HTTPPOST, call app to rewind + */ + if(data->set.postfields || + (data->set.httpreq == HTTPREQ_POST_FORM)) + ; /* do nothing */ + else { + if(data->set.seek_func) { + int err; + + err = (data->set.seek_func)(data->set.seek_client, 0, SEEK_SET); + if(err) { + failf(data, "seek callback returned error %d", (int)err); + return CURLE_SEND_FAIL_REWIND; + } + } + else if(data->set.ioctl_func) { + curlioerr err; + + err = (data->set.ioctl_func)(data, CURLIOCMD_RESTARTREAD, + data->set.ioctl_client); + infof(data, "the ioctl callback returned %d\n", (int)err); + + if(err) { + /* FIXME: convert to a human readable error message */ + failf(data, "ioctl callback returned error %d", (int)err); + return CURLE_SEND_FAIL_REWIND; + } + } + else { + /* If no CURLOPT_READFUNCTION is used, we know that we operate on a + given FILE * stream and we can actually attempt to rewind that + ourself with fseek() */ + if(data->set.fread_func == (curl_read_callback)fread) { + if(-1 != fseek(data->set.in, 0, SEEK_SET)) + /* successful rewind */ + return CURLE_OK; + } + + /* no callback set or failure above, makes us fail at once */ + failf(data, "necessary data rewind wasn't possible"); + return CURLE_SEND_FAIL_REWIND; + } + } + return CURLE_OK; +} + +static int data_pending(const struct connectdata *conn) +{ + /* in the case of libssh2, we can never be really sure that we have emptied + its internal buffers so we MUST always try until we get EAGAIN back */ + return conn->protocol&(PROT_SCP|PROT_SFTP) || + Curl_ssl_data_pending(conn, FIRSTSOCKET); +} + +static void read_rewind(struct connectdata *conn, + size_t thismuch) +{ + DEBUGASSERT(conn->read_pos >= thismuch); + + conn->read_pos -= thismuch; + conn->bits.stream_was_rewound = TRUE; + +#ifdef DEBUGBUILD + { + char buf[512 + 1]; + size_t show; + + show = CURLMIN(conn->buf_len - conn->read_pos, sizeof(buf)-1); + if(conn->master_buffer) { + memcpy(buf, conn->master_buffer + conn->read_pos, show); + buf[show] = '\0'; + } + else { + buf[0] = '\0'; + } + + DEBUGF(infof(conn->data, + "Buffer after stream rewind (read_pos = %zu): [%s]", + conn->read_pos, buf)); + } +#endif +} + + +/* + * Go ahead and do a read if we have a readable socket or if + * the stream was rewound (in which case we have data in a + * buffer) + */ +static CURLcode readwrite_data(struct SessionHandle *data, + struct connectdata *conn, + struct SingleRequest *k, + int *didwhat, bool *done) +{ + CURLcode result = CURLE_OK; + ssize_t nread; /* number of bytes read */ + size_t excess = 0; /* excess bytes read */ + bool is_empty_data = FALSE; +#ifndef CURL_DISABLE_RTSP + bool readmore = FALSE; /* used by RTP to signal for more data */ +#endif + + *done = FALSE; + + /* This is where we loop until we have read everything there is to + read or we get a CURLE_AGAIN */ + do { + size_t buffersize = data->set.buffer_size? + data->set.buffer_size : BUFSIZE; + size_t bytestoread = buffersize; + + if(k->size != -1 && !k->header) { + /* make sure we don't read "too much" if we can help it since we + might be pipelining and then someone else might want to read what + follows! */ + curl_off_t totalleft = k->size - k->bytecount; + if(totalleft < (curl_off_t)bytestoread) + bytestoread = (size_t)totalleft; + } + + if(bytestoread) { + /* receive data from the network! */ + result = Curl_read(conn, conn->sockfd, k->buf, bytestoread, &nread); + + /* read would've blocked */ + if(CURLE_AGAIN == result) + break; /* get out of loop */ + + if(result>0) + return result; + } + else { + /* read nothing but since we wanted nothing we consider this an OK + situation to proceed from */ + nread = 0; + } + + if((k->bytecount == 0) && (k->writebytecount == 0)) { + Curl_pgrsTime(data, TIMER_STARTTRANSFER); + if(k->exp100 > EXP100_SEND_DATA) + /* set time stamp to compare with when waiting for the 100 */ + k->start100 = Curl_tvnow(); + } + + *didwhat |= KEEP_RECV; + /* indicates data of zero size, i.e. empty file */ + is_empty_data = (bool)((nread == 0) && (k->bodywrites == 0)); + + /* NUL terminate, allowing string ops to be used */ + if(0 < nread || is_empty_data) { + k->buf[nread] = 0; + } + else if(0 >= nread) { + /* if we receive 0 or less here, the server closed the connection + and we bail out from this! */ + DEBUGF(infof(data, "nread <= 0, server closed connection, bailing\n")); + k->keepon &= ~KEEP_RECV; + break; + } + + /* Default buffer to use when we write the buffer, it may be changed + in the flow below before the actual storing is done. */ + k->str = k->buf; + +#ifndef CURL_DISABLE_RTSP + /* Check for RTP at the beginning of the data */ + if(conn->protocol & PROT_RTSP) { + result = Curl_rtsp_rtp_readwrite(data, conn, &nread, &readmore); + if(result) + return result; + if(readmore) + break; + } +#endif + +#ifndef CURL_DISABLE_HTTP + /* Since this is a two-state thing, we check if we are parsing + headers at the moment or not. */ + if(k->header) { + /* we are in parse-the-header-mode */ + bool stop_reading = FALSE; + result = Curl_http_readwrite_headers(data, conn, &nread, &stop_reading); + if(result) + return result; + +#ifndef CURL_DISABLE_RTSP + /* Check for RTP after the headers if there is no Content */ + if(k->maxdownload <= 0 && nread > 0 && (conn->protocol & PROT_RTSP)) { + result = Curl_rtsp_rtp_readwrite(data, conn, &nread, &readmore); + if(result) + return result; + if(readmore) + break; + } +#endif + + if(stop_reading) + /* We've stopped dealing with input, get out of the do-while loop */ + break; + } +#endif /* CURL_DISABLE_HTTP */ + + + /* This is not an 'else if' since it may be a rest from the header + parsing, where the beginning of the buffer is headers and the end + is non-headers. */ + if(k->str && !k->header && (nread > 0 || is_empty_data)) { + + +#ifndef CURL_DISABLE_HTTP + if(0 == k->bodywrites && !is_empty_data) { + /* These checks are only made the first time we are about to + write a piece of the body */ + if(conn->protocol&(PROT_HTTP|PROT_RTSP)) { + /* HTTP-only checks */ + + if(data->req.newurl) { + if(conn->bits.close) { + /* Abort after the headers if "follow Location" is set + and we're set to close anyway. */ + k->keepon &= ~KEEP_RECV; + *done = TRUE; + return CURLE_OK; + } + /* We have a new url to load, but since we want to be able + to re-use this connection properly, we read the full + response in "ignore more" */ + k->ignorebody = TRUE; + infof(data, "Ignoring the response-body\n"); + } + if(data->state.resume_from && !k->content_range && + (data->set.httpreq==HTTPREQ_GET) && + !k->ignorebody) { + /* we wanted to resume a download, although the server doesn't + * seem to support this and we did this with a GET (if it + * wasn't a GET we did a POST or PUT resume) */ + failf(data, "HTTP server doesn't seem to support " + "byte ranges. Cannot resume."); + return CURLE_RANGE_ERROR; + } + + if(data->set.timecondition && !data->state.range) { + /* A time condition has been set AND no ranges have been + requested. This seems to be what chapter 13.3.4 of + RFC 2616 defines to be the correct action for a + HTTP/1.1 client */ + if((k->timeofdoc > 0) && (data->set.timevalue > 0)) { + switch(data->set.timecondition) { + case CURL_TIMECOND_IFMODSINCE: + default: + if(k->timeofdoc < data->set.timevalue) { + infof(data, + "The requested document is not new enough\n"); + *done = TRUE; + data->info.timecond = TRUE; + return CURLE_OK; + } + break; + case CURL_TIMECOND_IFUNMODSINCE: + if(k->timeofdoc > data->set.timevalue) { + infof(data, + "The requested document is not old enough\n"); + *done = TRUE; + data->info.timecond = TRUE; + return CURLE_OK; + } + break; + } /* switch */ + } /* two valid time strings */ + } /* we have a time condition */ + + } /* this is HTTP */ + } /* this is the first time we write a body part */ +#endif /* CURL_DISABLE_HTTP */ + k->bodywrites++; + + /* pass data to the debug function before it gets "dechunked" */ + if(data->set.verbose) { + if(k->badheader) { + Curl_debug(data, CURLINFO_DATA_IN, data->state.headerbuff, + (size_t)k->hbuflen, conn); + if(k->badheader == HEADER_PARTHEADER) + Curl_debug(data, CURLINFO_DATA_IN, + k->str, (size_t)nread, conn); + } + else + Curl_debug(data, CURLINFO_DATA_IN, + k->str, (size_t)nread, conn); + } + +#ifndef CURL_DISABLE_HTTP + if(k->chunk) { + /* + * Here comes a chunked transfer flying and we need to decode this + * properly. While the name says read, this function both reads + * and writes away the data. The returned 'nread' holds the number + * of actual data it wrote to the client. + */ + + CHUNKcode res = + Curl_httpchunk_read(conn, k->str, nread, &nread); + + if(CHUNKE_OK < res) { + if(CHUNKE_WRITE_ERROR == res) { + failf(data, "Failed writing data"); + return CURLE_WRITE_ERROR; + } + failf(data, "Received problem %d in the chunky parser", (int)res); + return CURLE_RECV_ERROR; + } + else if(CHUNKE_STOP == res) { + size_t dataleft; + /* we're done reading chunks! */ + k->keepon &= ~KEEP_RECV; /* read no more */ + + /* There are now possibly N number of bytes at the end of the + str buffer that weren't written to the client. + + We DO care about this data if we are pipelining. + Push it back to be read on the next pass. */ + + dataleft = conn->chunk.dataleft; + if(dataleft != 0) { + infof(conn->data, "Leftovers after chunking: %zu bytes", dataleft); + if(conn->data->multi && Curl_multi_canPipeline(conn->data->multi)) { + /* only attempt the rewind if we truly are pipelining */ + infof(conn->data, "Rewinding %zu bytes\n",dataleft); + read_rewind(conn, dataleft); + } + } + } + /* If it returned OK, we just keep going */ + } +#endif /* CURL_DISABLE_HTTP */ + + /* Account for body content stored in the header buffer */ + if(k->badheader && !k->ignorebody) { + DEBUGF(infof(data, "Increasing bytecount by %zu from hbuflen\n", + k->hbuflen)); + k->bytecount += k->hbuflen; + } + + if((-1 != k->maxdownload) && + (k->bytecount + nread >= k->maxdownload)) { + + excess = (size_t)(k->bytecount + nread - k->maxdownload); + if(excess > 0 && !k->ignorebody) { + if(conn->data->multi && Curl_multi_canPipeline(conn->data->multi)) { + /* The 'excess' amount below can't be more than BUFSIZE which + always will fit in a size_t */ + infof(data, + "Rewinding stream by : %zu" + " bytes on url %s (size = %" FORMAT_OFF_T + ", maxdownload = %" FORMAT_OFF_T + ", bytecount = %" FORMAT_OFF_T ", nread = %zd)\n", + excess, data->state.path, + k->size, k->maxdownload, k->bytecount, nread); + read_rewind(conn, excess); + } + else { + infof(data, + "Excess found in a non pipelined read:" + " excess = %zu" + ", size = %" FORMAT_OFF_T + ", maxdownload = %" FORMAT_OFF_T + ", bytecount = %" FORMAT_OFF_T "\n", + excess, k->size, k->maxdownload, k->bytecount); + } + } + + nread = (ssize_t) (k->maxdownload - k->bytecount); + if(nread < 0 ) /* this should be unusual */ + nread = 0; + + k->keepon &= ~KEEP_RECV; /* we're done reading */ + } + + k->bytecount += nread; + + Curl_pgrsSetDownloadCounter(data, k->bytecount); + + if(!k->chunk && (nread || k->badheader || is_empty_data)) { + /* If this is chunky transfer, it was already written */ + + if(k->badheader && !k->ignorebody) { + /* we parsed a piece of data wrongly assuming it was a header + and now we output it as body instead */ + + /* Don't let excess data pollute body writes */ + if(k->maxdownload == -1 || (curl_off_t)k->hbuflen <= k->maxdownload) + result = Curl_client_write(conn, CLIENTWRITE_BODY, + data->state.headerbuff, + k->hbuflen); + else + result = Curl_client_write(conn, CLIENTWRITE_BODY, + data->state.headerbuff, + (size_t)k->maxdownload); + + if(result) + return result; + } + if(k->badheader < HEADER_ALLBAD) { + /* This switch handles various content encodings. If there's an + error here, be sure to check over the almost identical code + in http_chunks.c. + Make sure that ALL_CONTENT_ENCODINGS contains all the + encodings handled here. */ +#ifdef HAVE_LIBZ + switch (conn->data->set.http_ce_skip ? + IDENTITY : k->content_encoding) { + case IDENTITY: +#endif + /* This is the default when the server sends no + Content-Encoding header. See Curl_readwrite_init; the + memset() call initializes k->content_encoding to zero. */ + if(!k->ignorebody) { + +#ifndef CURL_DISABLE_POP3 + if(conn->protocol&PROT_POP3) + result = Curl_pop3_write(conn, k->str, nread); + else +#endif /* CURL_DISABLE_POP3 */ + + result = Curl_client_write(conn, CLIENTWRITE_BODY, k->str, + nread); + } +#ifdef HAVE_LIBZ + break; + + case DEFLATE: + /* Assume CLIENTWRITE_BODY; headers are not encoded. */ + if(!k->ignorebody) + result = Curl_unencode_deflate_write(conn, k, nread); + break; + + case GZIP: + /* Assume CLIENTWRITE_BODY; headers are not encoded. */ + if(!k->ignorebody) + result = Curl_unencode_gzip_write(conn, k, nread); + break; + + case COMPRESS: + default: + failf (data, "Unrecognized content encoding type. " + "libcurl understands `identity', `deflate' and `gzip' " + "content encodings."); + result = CURLE_BAD_CONTENT_ENCODING; + break; + } +#endif + } + k->badheader = HEADER_NORMAL; /* taken care of now */ + + if(result) + return result; + } + + } /* if(! header and data to read ) */ + +#ifndef CURL_DISABLE_RTSP + if(excess > 0 && !conn->bits.stream_was_rewound && + (conn->protocol & PROT_RTSP)) { + /* Check for RTP after the content if there is unrewound excess */ + + /* Parse the excess data */ + k->str += nread; + nread = (ssize_t)excess; + + result = Curl_rtsp_rtp_readwrite(data, conn, &nread, &readmore); + if(result) + return result; + + if(readmore) + k->keepon |= KEEP_RECV; /* we're not done reading */ + break; + } +#endif + + if(is_empty_data) { + /* if we received nothing, the server closed the connection and we + are done */ + k->keepon &= ~KEEP_RECV; + } + + } while(data_pending(conn)); + + if(((k->keepon & (KEEP_RECV|KEEP_SEND)) == KEEP_SEND) && + conn->bits.close ) { + /* When we've read the entire thing and the close bit is set, the server + may now close the connection. If there's now any kind of sending going + on from our side, we need to stop that immediately. */ + infof(data, "we are done reading and this is set to close, stop send\n"); + k->keepon &= ~KEEP_SEND; /* no writing anymore either */ + } + + return CURLE_OK; +} + +/* + * Send data to upload to the server, when the socket is writable. + */ +static CURLcode readwrite_upload(struct SessionHandle *data, + struct connectdata *conn, + struct SingleRequest *k, + int *didwhat) +{ + ssize_t i, si; + ssize_t bytes_written; + CURLcode result; + ssize_t nread; /* number of bytes read */ + bool sending_http_headers = FALSE; + + if((k->bytecount == 0) && (k->writebytecount == 0)) + Curl_pgrsTime(data, TIMER_STARTTRANSFER); + + *didwhat |= KEEP_SEND; + + /* + * We loop here to do the READ and SEND loop until we run out of + * data to send or until we get EWOULDBLOCK back + */ + do { + + /* only read more data if there's no upload data already + present in the upload buffer */ + if(0 == data->req.upload_present) { + /* init the "upload from here" pointer */ + data->req.upload_fromhere = k->uploadbuf; + + if(!k->upload_done) { + /* HTTP pollution, this should be written nicer to become more + protocol agnostic. */ + int fillcount; + + if((k->exp100 == EXP100_SENDING_REQUEST) && + (data->state.proto.http->sending == HTTPSEND_BODY)) { + /* If this call is to send body data, we must take some action: + We have sent off the full HTTP 1.1 request, and we shall now + go into the Expect: 100 state and await such a header */ + k->exp100 = EXP100_AWAITING_CONTINUE; /* wait for the header */ + k->keepon &= ~KEEP_SEND; /* disable writing */ + k->start100 = Curl_tvnow(); /* timeout count starts now */ + *didwhat &= ~KEEP_SEND; /* we didn't write anything actually */ + + /* set a timeout for the multi interface */ + Curl_expire(data, CURL_TIMEOUT_EXPECT_100); + break; + } + + if(conn->protocol&(PROT_HTTP|PROT_RTSP)) { + if(data->state.proto.http->sending == HTTPSEND_REQUEST) + /* We're sending the HTTP request headers, not the data. + Remember that so we don't change the line endings. */ + sending_http_headers = TRUE; + else + sending_http_headers = FALSE; + } + + result = Curl_fillreadbuffer(conn, BUFSIZE, &fillcount); + if(result) + return result; + + nread = (ssize_t)fillcount; + } + else + nread = 0; /* we're done uploading/reading */ + + if(!nread && (k->keepon & KEEP_SEND_PAUSE)) { + /* this is a paused transfer */ + break; + } + else if(nread<=0) { + /* done */ + k->keepon &= ~KEEP_SEND; /* we're done writing */ + + if(conn->bits.rewindaftersend) { + result = Curl_readrewind(conn); + if(result) + return result; + } + break; + } + + /* store number of bytes available for upload */ + data->req.upload_present = nread; + +#ifndef CURL_DISABLE_SMTP + if(conn->protocol & PROT_SMTP) { + result = Curl_smtp_escape_eob(conn, nread); + if(result) + return result; + } + else +#endif /* CURL_DISABLE_SMTP */ + + /* convert LF to CRLF if so asked */ + if((!sending_http_headers) && +#ifdef CURL_DO_LINEEND_CONV + /* always convert if we're FTPing in ASCII mode */ + ((data->set.crlf) || (data->set.prefer_ascii))) { +#else + (data->set.crlf)) { +#endif + if(data->state.scratch == NULL) + data->state.scratch = malloc(2*BUFSIZE); + if(data->state.scratch == NULL) { + failf (data, "Failed to alloc scratch buffer!"); + return CURLE_OUT_OF_MEMORY; + } + /* + * ASCII/EBCDIC Note: This is presumably a text (not binary) + * transfer so the data should already be in ASCII. + * That means the hex values for ASCII CR (0x0d) & LF (0x0a) + * must be used instead of the escape sequences \r & \n. + */ + for(i = 0, si = 0; i < nread; i++, si++) { + if(data->req.upload_fromhere[i] == 0x0a) { + data->state.scratch[si++] = 0x0d; + data->state.scratch[si] = 0x0a; + if(!data->set.crlf) { + /* we're here only because FTP is in ASCII mode... + bump infilesize for the LF we just added */ + data->set.infilesize++; + } + } + else + data->state.scratch[si] = data->req.upload_fromhere[i]; + } + if(si != nread) { + /* only perform the special operation if we really did replace + anything */ + nread = si; + + /* upload from the new (replaced) buffer instead */ + data->req.upload_fromhere = data->state.scratch; + + /* set the new amount too */ + data->req.upload_present = nread; + } + } + } /* if 0 == data->req.upload_present */ + else { + /* We have a partial buffer left from a previous "round". Use + that instead of reading more data */ + } + + /* write to socket (send away data) */ + result = Curl_write(conn, + conn->writesockfd, /* socket to send to */ + data->req.upload_fromhere, /* buffer pointer */ + data->req.upload_present, /* buffer size */ + &bytes_written); /* actually sent */ + + if(result) + return result; + + if(data->set.verbose) + /* show the data before we change the pointer upload_fromhere */ + Curl_debug(data, CURLINFO_DATA_OUT, data->req.upload_fromhere, + (size_t)bytes_written, conn); + + if(data->req.upload_present != bytes_written) { + /* we only wrote a part of the buffer (if anything), deal with it! */ + + /* store the amount of bytes left in the buffer to write */ + data->req.upload_present -= bytes_written; + + /* advance the pointer where to find the buffer when the next send + is to happen */ + data->req.upload_fromhere += bytes_written; + } + else { + /* we've uploaded that buffer now */ + data->req.upload_fromhere = k->uploadbuf; + data->req.upload_present = 0; /* no more bytes left */ + + if(k->upload_done) { + /* switch off writing, we're done! */ + k->keepon &= ~KEEP_SEND; /* we're done writing */ + } + } + + k->writebytecount += bytes_written; + Curl_pgrsSetUploadCounter(data, k->writebytecount); + + } while(0); /* just to break out from! */ + + return CURLE_OK; +} + +/* + * Curl_readwrite() is the low-level function to be called when data is to + * be read and written to/from the connection. + */ +CURLcode Curl_readwrite(struct connectdata *conn, + bool *done) +{ + struct SessionHandle *data = conn->data; + struct SingleRequest *k = &data->req; + CURLcode result; + int didwhat=0; + + curl_socket_t fd_read; + curl_socket_t fd_write; + int select_res = conn->cselect_bits; + + conn->cselect_bits = 0; + + /* only use the proper socket if the *_HOLD bit is not set simultaneously as + then we are in rate limiting state in that transfer direction */ + + if((k->keepon & KEEP_RECVBITS) == KEEP_RECV) + fd_read = conn->sockfd; + else + fd_read = CURL_SOCKET_BAD; + + if((k->keepon & KEEP_SENDBITS) == KEEP_SEND) + fd_write = conn->writesockfd; + else + fd_write = CURL_SOCKET_BAD; + + if(!select_res) /* Call for select()/poll() only, if read/write/error + status is not known. */ + select_res = Curl_socket_ready(fd_read, fd_write, 0); + + if(select_res == CURL_CSELECT_ERR) { + failf(data, "select/poll returned error"); + return CURLE_SEND_ERROR; + } + + /* We go ahead and do a read if we have a readable socket or if + the stream was rewound (in which case we have data in a + buffer) */ + if((k->keepon & KEEP_RECV) && + ((select_res & CURL_CSELECT_IN) || conn->bits.stream_was_rewound)) { + + result = readwrite_data(data, conn, k, &didwhat, done); + if(result || *done) + return result; + } + + /* If we still have writing to do, we check if we have a writable socket. */ + if((k->keepon & KEEP_SEND) && (select_res & CURL_CSELECT_OUT)) { + /* write */ + + result = readwrite_upload(data, conn, k, &didwhat); + if(result) + return result; + } + + k->now = Curl_tvnow(); + if(didwhat) { + /* Update read/write counters */ + if(k->bytecountp) + *k->bytecountp = k->bytecount; /* read count */ + if(k->writebytecountp) + *k->writebytecountp = k->writebytecount; /* write count */ + } + else { + /* no read no write, this is a timeout? */ + if(k->exp100 == EXP100_AWAITING_CONTINUE) { + /* This should allow some time for the header to arrive, but only a + very short time as otherwise it'll be too much wasted time too + often. */ + + /* Quoting RFC2616, section "8.2.3 Use of the 100 (Continue) Status": + + Therefore, when a client sends this header field to an origin server + (possibly via a proxy) from which it has never seen a 100 (Continue) + status, the client SHOULD NOT wait for an indefinite period before + sending the request body. + + */ + + long ms = Curl_tvdiff(k->now, k->start100); + if(ms > CURL_TIMEOUT_EXPECT_100) { + /* we've waited long enough, continue anyway */ + k->exp100 = EXP100_SEND_DATA; + k->keepon |= KEEP_SEND; + infof(data, "Done waiting for 100-continue\n"); + } + } + } + + if(Curl_pgrsUpdate(conn)) + result = CURLE_ABORTED_BY_CALLBACK; + else + result = Curl_speedcheck(data, k->now); + if(result) + return result; + + if(k->keepon) { + if(0 > Curl_timeleft(conn, &k->now, FALSE)) { + if(k->size != -1) { + failf(data, "Operation timed out after %ld milliseconds with %" + FORMAT_OFF_T " out of %" FORMAT_OFF_T " bytes received", + Curl_tvdiff(k->now, data->progress.t_startsingle), k->bytecount, + k->size); + } + else { + failf(data, "Operation timed out after %ld milliseconds with %" + FORMAT_OFF_T " bytes received", + Curl_tvdiff(k->now, data->progress.t_startsingle), k->bytecount); + } + return CURLE_OPERATION_TIMEDOUT; + } + } + else { + /* + * The transfer has been performed. Just make some general checks before + * returning. + */ + + if(!(data->set.opt_no_body) && (k->size != -1) && + (k->bytecount != k->size) && +#ifdef CURL_DO_LINEEND_CONV + /* Most FTP servers don't adjust their file SIZE response for CRLFs, + so we'll check to see if the discrepancy can be explained + by the number of CRLFs we've changed to LFs. + */ + (k->bytecount != (k->size + data->state.crlf_conversions)) && +#endif /* CURL_DO_LINEEND_CONV */ + !data->req.newurl) { + failf(data, "transfer closed with %" FORMAT_OFF_T + " bytes remaining to read", + k->size - k->bytecount); + return CURLE_PARTIAL_FILE; + } + else if(!(data->set.opt_no_body) && + k->chunk && + (conn->chunk.state != CHUNK_STOP)) { + /* + * In chunked mode, return an error if the connection is closed prior to + * the empty (terminiating) chunk is read. + * + * The condition above used to check for + * conn->proto.http->chunk.datasize != 0 which is true after reading + * *any* chunk, not just the empty chunk. + * + */ + failf(data, "transfer closed with outstanding read data remaining"); + return CURLE_PARTIAL_FILE; + } + if(Curl_pgrsUpdate(conn)) + return CURLE_ABORTED_BY_CALLBACK; + } + + /* Now update the "done" boolean we return */ + *done = (bool)(0 == (k->keepon&(KEEP_RECV|KEEP_SEND| + KEEP_RECV_PAUSE|KEEP_SEND_PAUSE))); + + return CURLE_OK; +} + +/* + * Curl_single_getsock() gets called by the multi interface code when the app + * has requested to get the sockets for the current connection. This function + * will then be called once for every connection that the multi interface + * keeps track of. This function will only be called for connections that are + * in the proper state to have this information available. + */ +int Curl_single_getsock(const struct connectdata *conn, + curl_socket_t *sock, /* points to numsocks number + of sockets */ + int numsocks) +{ + const struct SessionHandle *data = conn->data; + int bitmap = GETSOCK_BLANK; + unsigned sockindex = 0; + + if(conn->handler->perform_getsock) + return conn->handler->perform_getsock(conn, sock, numsocks); + + if(numsocks < 2) + /* simple check but we might need two slots */ + return GETSOCK_BLANK; + + /* don't include HOLD and PAUSE connections */ + if((data->req.keepon & KEEP_RECVBITS) == KEEP_RECV) { + + DEBUGASSERT(conn->sockfd != CURL_SOCKET_BAD); + + bitmap |= GETSOCK_READSOCK(sockindex); + sock[sockindex] = conn->sockfd; + } + + /* don't include HOLD and PAUSE connections */ + if((data->req.keepon & KEEP_SENDBITS) == KEEP_SEND) { + + if((conn->sockfd != conn->writesockfd) || + !(data->req.keepon & KEEP_RECV)) { + /* only if they are not the same socket or we didn't have a readable + one, we increase index */ + if(data->req.keepon & KEEP_RECV) + sockindex++; /* increase index if we need two entries */ + + DEBUGASSERT(conn->writesockfd != CURL_SOCKET_BAD); + + sock[sockindex] = conn->writesockfd; + } + + bitmap |= GETSOCK_WRITESOCK(sockindex); + } + + return bitmap; +} + +/* + * Determine optimum sleep time based on configured rate, current rate, + * and packet size. + * Returns value in mili-seconds. + * + * The basic idea is to adjust the desired rate up/down in this method + * based on whether we are running too slow or too fast. Then, calculate + * how many miliseconds to wait for the next packet to achieve this new + * rate. + */ +long Curl_sleep_time(curl_off_t rate_bps, curl_off_t cur_rate_bps, + int pkt_size) +{ + curl_off_t min_sleep = 0; + curl_off_t rv = 0; + + if (rate_bps == 0) + return 0; + + /* If running faster than about .1% of the desired speed, slow + * us down a bit. Use shift instead of division as the 0.1% + * cutoff is arbitrary anyway. + */ + if (cur_rate_bps > (rate_bps + (rate_bps >> 10))) { + /* running too fast, decrease target rate by 1/64th of rate */ + rate_bps -= rate_bps >> 6; + min_sleep = 1; + } + else if (cur_rate_bps < (rate_bps - (rate_bps >> 10))) { + /* running too slow, increase target rate by 1/64th of rate */ + rate_bps += rate_bps >> 6; + } + + /* Determine number of miliseconds to wait until we do + * the next packet at the adjusted rate. We should wait + * longer when using larger packets, for instance. + */ + rv = ((curl_off_t)((pkt_size * 8) * 1000) / rate_bps); + + /* Catch rounding errors and always slow down at least 1ms if + * we are running too fast. + */ + if (rv < min_sleep) + rv = min_sleep; + + /* Bound value to fit in 'long' on 32-bit platform. That's + * plenty long enough anyway! + */ + if(rv > 0x7fffffff) + rv = 0x7fffffff; + + return (long)rv; +} + + +/* + * Transfer() + * + * This function is what performs the actual transfer. It is capable of doing + * both ways simultaneously. The transfer must already have been setup by a + * call to Curl_setup_transfer(). + * + * Note that headers are created in a preallocated buffer of a default size. + * That buffer can be enlarged on demand, but it is never shrunken again. + * + */ + +static CURLcode +Transfer(struct connectdata *conn) +{ + CURLcode result; + struct SessionHandle *data = conn->data; + struct SingleRequest *k = &data->req; + bool done=FALSE; + bool first=TRUE; + int timeout_ms; + int buffersize; + int totmp; + + if((conn->sockfd == CURL_SOCKET_BAD) && + (conn->writesockfd == CURL_SOCKET_BAD)) + /* nothing to read, nothing to write, we're already OK! */ + return CURLE_OK; + + /* we want header and/or body, if neither then don't do this! */ + if(!k->getheader && data->set.opt_no_body) + return CURLE_OK; + + while(!done) { + curl_socket_t fd_read = conn->sockfd; + curl_socket_t fd_write = conn->writesockfd; + int keepon = k->keepon; + timeout_ms = 1000; + + if(conn->waitfor) { + /* if waitfor is set, get the RECV and SEND bits from that but keep the + other bits */ + keepon &= ~ (KEEP_RECV|KEEP_SEND); + keepon |= conn->waitfor & (KEEP_RECV|KEEP_SEND); + } + + /* limit-rate logic: if speed exceeds threshold, then do not include fd in + select set. The current speed is recalculated in each Curl_readwrite() + call */ + if((keepon & KEEP_SEND) && + (!data->set.max_send_speed || + (data->progress.ulspeed < data->set.max_send_speed) )) { + k->keepon &= ~KEEP_SEND_HOLD; + } + else { + if (data->set.upload && data->set.max_send_speed && + (data->progress.ulspeed > data->set.max_send_speed) ) { + /* calculate upload rate-limitation timeout. */ + buffersize = (int)(data->set.buffer_size ? + data->set.buffer_size : BUFSIZE); + totmp = (int)Curl_sleep_time(data->set.max_send_speed, + data->progress.ulspeed, buffersize); + if (totmp < timeout_ms) + timeout_ms = totmp; + } + fd_write = CURL_SOCKET_BAD; + if(keepon & KEEP_SEND) + k->keepon |= KEEP_SEND_HOLD; /* hold it */ + } + + if((keepon & KEEP_RECV) && + (!data->set.max_recv_speed || + (data->progress.dlspeed < data->set.max_recv_speed)) ) { + k->keepon &= ~KEEP_RECV_HOLD; + } + else { + if ((!data->set.upload) && data->set.max_recv_speed && + (data->progress.dlspeed > data->set.max_recv_speed)) { + /* Calculate download rate-limitation timeout. */ + buffersize = (int)(data->set.buffer_size ? + data->set.buffer_size : BUFSIZE); + totmp = (int)Curl_sleep_time(data->set.max_recv_speed, + data->progress.dlspeed, buffersize); + if (totmp < timeout_ms) + timeout_ms = totmp; + } + fd_read = CURL_SOCKET_BAD; + if(keepon & KEEP_RECV) + k->keepon |= KEEP_RECV_HOLD; /* hold it */ + } + + /* pause logic. Don't check descriptors for paused connections */ + if(k->keepon & KEEP_RECV_PAUSE) + fd_read = CURL_SOCKET_BAD; + if(k->keepon & KEEP_SEND_PAUSE) + fd_write = CURL_SOCKET_BAD; + + /* The *_HOLD and *_PAUSE logic is necessary since even though there might + be no traffic during the select interval, we still call + Curl_readwrite() for the timeout case and if we limit transfer speed we + must make sure that this function doesn't transfer anything while in + HOLD status. + + The no timeout for the first round is for the protocols for which data + has already been slurped off the socket and thus waiting for action + won't work since it'll wait even though there is already data present + to work with. */ + if(first && + ((fd_read != CURL_SOCKET_BAD) || (fd_write != CURL_SOCKET_BAD))) + /* if this is the first lap and one of the file descriptors is fine + to work with, skip the timeout */ + timeout_ms = 0; + else { + totmp = Curl_timeleft(conn, &k->now, FALSE); + if(totmp < 0) + return CURLE_OPERATION_TIMEDOUT; + else if(!totmp) + totmp = 1000; + + if (totmp < timeout_ms) + timeout_ms = totmp; + } + + switch (Curl_socket_ready(fd_read, fd_write, timeout_ms)) { + case -1: /* select() error, stop reading */ +#ifdef EINTR + /* The EINTR is not serious, and it seems you might get this more + often when using the lib in a multi-threaded environment! */ + if(SOCKERRNO == EINTR) + continue; +#endif + return CURLE_RECV_ERROR; /* indicate a network problem */ + case 0: /* timeout */ + default: /* readable descriptors */ + + result = Curl_readwrite(conn, &done); + /* "done" signals to us if the transfer(s) are ready */ + break; + } + if(result) + return result; + + first = FALSE; /* not the first lap anymore */ + } + + return CURLE_OK; +} + +static void loadhostpairs(struct SessionHandle *data) +{ + struct curl_slist *hostp; + char hostname[256]; + char address[256]; + int port; + + for(hostp = data->change.resolve; hostp; hostp = hostp->next ) { + if(!hostp->data) + continue; + if(hostp->data[0] == '-') { + /* mark an entry for removal */ + } + else if(3 == sscanf(hostp->data, "%255[^:]:%d:%255s", hostname, &port, + address)) { + struct Curl_dns_entry *dns; + Curl_addrinfo *addr; + + addr = Curl_str2addr(address, port); + if(!addr) { + infof(data, "Resolve %s found illegal!\n", hostp->data); + continue; + } + infof(data, "Added %s:%d:%s to DNS cache\n", + hostname, port, address); + + if(data->share) + Curl_share_lock(data, CURL_LOCK_DATA_DNS, CURL_LOCK_ACCESS_SINGLE); + + /* put this host in the cache */ + dns = Curl_cache_addr(data, addr, hostname, port); + + if(data->share) + Curl_share_unlock(data, CURL_LOCK_DATA_DNS); + } + } + data->change.resolve = NULL; /* dealt with now */ +} + + +/* + * Curl_pretransfer() is called immediately before a transfer starts. + */ +CURLcode Curl_pretransfer(struct SessionHandle *data) +{ + CURLcode res; + if(!data->change.url) { + /* we can't do anything without URL */ + failf(data, "No URL set!"); + return CURLE_URL_MALFORMAT; + } + + /* Init the SSL session ID cache here. We do it here since we want to do it + after the *_setopt() calls (that could change the size of the cache) but + before any transfer takes place. */ + res = Curl_ssl_initsessions(data, data->set.ssl.numsessions); + if(res) + return res; + + data->set.followlocation=0; /* reset the location-follow counter */ + data->state.this_is_a_follow = FALSE; /* reset this */ + data->state.errorbuf = FALSE; /* no error has occurred */ + data->state.httpversion = 0; /* don't assume any particular server version */ + + data->state.ssl_connect_retry = FALSE; + + data->state.authproblem = FALSE; + data->state.authhost.want = data->set.httpauth; + data->state.authproxy.want = data->set.proxyauth; + Curl_safefree(data->info.wouldredirect); + data->info.wouldredirect = NULL; + + /* If there is a list of cookie files to read, do it now! */ + if(data->change.cookielist) + Curl_cookie_loadfiles(data); + + /* If there is a list of host pairs to deal with */ + if(data->change.resolve) + loadhostpairs(data); + + /* Allow data->set.use_port to set which port to use. This needs to be + * disabled for example when we follow Location: headers to URLs using + * different ports! */ + data->state.allow_port = TRUE; + +#if defined(HAVE_SIGNAL) && defined(SIGPIPE) && !defined(HAVE_MSG_NOSIGNAL) + /************************************************************* + * Tell signal handler to ignore SIGPIPE + *************************************************************/ + if(!data->set.no_signal) + data->state.prev_signal = signal(SIGPIPE, SIG_IGN); +#endif + + Curl_initinfo(data); /* reset session-specific information "variables" */ + Curl_pgrsStartNow(data); + + if(data->set.timeout) + Curl_expire(data, data->set.timeout); + + if(data->set.connecttimeout) + Curl_expire(data, data->set.connecttimeout); + + return CURLE_OK; +} + +/* + * Curl_posttransfer() is called immediately after a transfer ends + */ +CURLcode Curl_posttransfer(struct SessionHandle *data) +{ +#if defined(HAVE_SIGNAL) && defined(SIGPIPE) && !defined(HAVE_MSG_NOSIGNAL) + /* restore the signal handler for SIGPIPE before we get back */ + if(!data->set.no_signal) + signal(SIGPIPE, data->state.prev_signal); +#else + (void)data; /* unused parameter */ +#endif + + if(!(data->progress.flags & PGRS_HIDE) && + !data->progress.callback) + /* only output if we don't use a progress callback and we're not hidden */ + fprintf(data->set.err, "\n"); + + return CURLE_OK; +} + +#ifndef CURL_DISABLE_HTTP +/* + * strlen_url() returns the length of the given URL if the spaces within the + * URL were properly URL encoded. + */ +static size_t strlen_url(const char *url) +{ + const char *ptr; + size_t newlen=0; + bool left=TRUE; /* left side of the ? */ + + for(ptr=url; *ptr; ptr++) { + switch(*ptr) { + case '?': + left=FALSE; + /* fall through */ + default: + newlen++; + break; + case ' ': + if(left) + newlen+=3; + else + newlen++; + break; + } + } + return newlen; +} + +/* strcpy_url() copies a url to a output buffer and URL-encodes the spaces in + * the source URL accordingly. + */ +static void strcpy_url(char *output, const char *url) +{ + /* we must add this with whitespace-replacing */ + bool left=TRUE; + const char *iptr; + char *optr = output; + for(iptr = url; /* read from here */ + *iptr; /* until zero byte */ + iptr++) { + switch(*iptr) { + case '?': + left=FALSE; + /* fall through */ + default: + *optr++=*iptr; + break; + case ' ': + if(left) { + *optr++='%'; /* add a '%' */ + *optr++='2'; /* add a '2' */ + *optr++='0'; /* add a '0' */ + } + else + *optr++='+'; /* add a '+' here */ + break; + } + } + *optr=0; /* zero terminate output buffer */ + +} + +/* + * Returns true if the given URL is absolute (as opposed to relative) + */ +static bool is_absolute_url(const char *url) +{ + char prot[16]; /* URL protocol string storage */ + char letter; /* used for a silly sscanf */ + + return (bool)(2 == sscanf(url, "%15[^?&/:]://%c", prot, &letter)); +} + +/* + * Concatenate a relative URL to a base URL making it absolute. + * URL-encodes any spaces. + * The returned pointer must be freed by the caller unless NULL + * (returns NULL on out of memory). + */ +static char *concat_url(const char *base, const char *relurl) +{ + /*** + TRY to append this new path to the old URL + to the right of the host part. Oh crap, this is doomed to cause + problems in the future... + */ + char *newest; + char *protsep; + char *pathsep; + size_t newlen; + + const char *useurl = relurl; + size_t urllen; + + /* we must make our own copy of the URL to play with, as it may + point to read-only data */ + char *url_clone=strdup(base); + + if(!url_clone) + return NULL; /* skip out of this NOW */ + + /* protsep points to the start of the host name */ + protsep=strstr(url_clone, "//"); + if(!protsep) + protsep=url_clone; + else + protsep+=2; /* pass the slashes */ + + if('/' != relurl[0]) { + int level=0; + + /* First we need to find out if there's a ?-letter in the URL, + and cut it and the right-side of that off */ + pathsep = strchr(protsep, '?'); + if(pathsep) + *pathsep=0; + + /* we have a relative path to append to the last slash if there's one + available, or if the new URL is just a query string (starts with a + '?') we append the new one at the end of the entire currently worked + out URL */ + if(useurl[0] != '?') { + pathsep = strrchr(protsep, '/'); + if(pathsep) + *pathsep=0; + } + + /* Check if there's any slash after the host name, and if so, remember + that position instead */ + pathsep = strchr(protsep, '/'); + if(pathsep) + protsep = pathsep+1; + else + protsep = NULL; + + /* now deal with one "./" or any amount of "../" in the newurl + and act accordingly */ + + if((useurl[0] == '.') && (useurl[1] == '/')) + useurl+=2; /* just skip the "./" */ + + while((useurl[0] == '.') && + (useurl[1] == '.') && + (useurl[2] == '/')) { + level++; + useurl+=3; /* pass the "../" */ + } + + if(protsep) { + while(level--) { + /* cut off one more level from the right of the original URL */ + pathsep = strrchr(protsep, '/'); + if(pathsep) + *pathsep=0; + else { + *protsep=0; + break; + } + } + } + } + else { + /* We got a new absolute path for this server, cut off from the + first slash */ + pathsep = strchr(protsep, '/'); + if(pathsep) { + /* When people use badly formatted URLs, such as + "http://www.url.com?dir=/home/daniel" we must not use the first + slash, if there's a ?-letter before it! */ + char *sep = strchr(protsep, '?'); + if(sep && (sep < pathsep)) + pathsep = sep; + *pathsep=0; + } + else { + /* There was no slash. Now, since we might be operating on a badly + formatted URL, such as "http://www.url.com?id=2380" which doesn't + use a slash separator as it is supposed to, we need to check for a + ?-letter as well! */ + pathsep = strchr(protsep, '?'); + if(pathsep) + *pathsep=0; + } + } + + /* If the new part contains a space, this is a mighty stupid redirect + but we still make an effort to do "right". To the left of a '?' + letter we replace each space with %20 while it is replaced with '+' + on the right side of the '?' letter. + */ + newlen = strlen_url(useurl); + + urllen = strlen(url_clone); + + newest = malloc( urllen + 1 + /* possible slash */ + newlen + 1 /* zero byte */); + + if(!newest) { + free(url_clone); /* don't leak this */ + return NULL; + } + + /* copy over the root url part */ + memcpy(newest, url_clone, urllen); + + /* check if we need to append a slash */ + if(('/' == useurl[0]) || (protsep && !*protsep) || ('?' == useurl[0])) + ; + else + newest[urllen++]='/'; + + /* then append the new piece on the right side */ + strcpy_url(&newest[urllen], useurl); + + free(url_clone); + + return newest; +} +#endif /* CURL_DISABLE_HTTP */ + +/* + * Curl_follow() handles the URL redirect magic. Pass in the 'newurl' string + * as given by the remote server and set up the new URL to request. + */ +CURLcode Curl_follow(struct SessionHandle *data, + char *newurl, /* this 'newurl' is the Location: string, + and it must be malloc()ed before passed + here */ + followtype type) /* see transfer.h */ +{ +#ifdef CURL_DISABLE_HTTP + (void)data; + (void)newurl; + (void)type; + /* Location: following will not happen when HTTP is disabled */ + return CURLE_TOO_MANY_REDIRECTS; +#else + + /* Location: redirect */ + bool disallowport = FALSE; + + if(type == FOLLOW_REDIR) { + if((data->set.maxredirs != -1) && + (data->set.followlocation >= data->set.maxredirs)) { + failf(data,"Maximum (%ld) redirects followed", data->set.maxredirs); + return CURLE_TOO_MANY_REDIRECTS; + } + + /* mark the next request as a followed location: */ + data->state.this_is_a_follow = TRUE; + + data->set.followlocation++; /* count location-followers */ + + if(data->set.http_auto_referer) { + /* We are asked to automatically set the previous URL as the referer + when we get the next URL. We pick the ->url field, which may or may + not be 100% correct */ + + if(data->change.referer_alloc) + /* If we already have an allocated referer, free this first */ + free(data->change.referer); + + data->change.referer = strdup(data->change.url); + if (!data->change.referer) { + data->change.referer_alloc = FALSE; + return CURLE_OUT_OF_MEMORY; + } + data->change.referer_alloc = TRUE; /* yes, free this later */ + } + } + + if(!is_absolute_url(newurl)) { + /*** + *DANG* this is an RFC 2068 violation. The URL is supposed + to be absolute and this doesn't seem to be that! + */ + char *absolute = concat_url(data->change.url, newurl); + if (!absolute) + return CURLE_OUT_OF_MEMORY; + free(newurl); + newurl = absolute; + } + else { + /* This is an absolute URL, don't allow the custom port number */ + disallowport = TRUE; + + if(strchr(newurl, ' ')) { + /* This new URL contains at least one space, this is a mighty stupid + redirect but we still make an effort to do "right". */ + char *newest; + size_t newlen = strlen_url(newurl); + + newest = malloc(newlen+1); /* get memory for this */ + if (!newest) + return CURLE_OUT_OF_MEMORY; + strcpy_url(newest, newurl); /* create a space-free URL */ + + free(newurl); /* that was no good */ + newurl = newest; /* use this instead now */ + } + + } + + if(type == FOLLOW_FAKE) { + /* we're only figuring out the new url if we would've followed locations + but now we're done so we can get out! */ + data->info.wouldredirect = newurl; + return CURLE_OK; + } + + if(disallowport) + data->state.allow_port = FALSE; + + if(data->change.url_alloc) + free(data->change.url); + else + data->change.url_alloc = TRUE; /* the URL is allocated */ + + data->change.url = newurl; + newurl = NULL; /* don't free! */ + + infof(data, "Issue another request to this URL: '%s'\n", data->change.url); + + /* + * We get here when the HTTP code is 300-399 (and 401). We need to perform + * differently based on exactly what return code there was. + * + * News from 7.10.6: we can also get here on a 401 or 407, in case we act on + * a HTTP (proxy-) authentication scheme other than Basic. + */ + switch(data->info.httpcode) { + /* 401 - Act on a WWW-Authenticate, we keep on moving and do the + Authorization: XXXX header in the HTTP request code snippet */ + /* 407 - Act on a Proxy-Authenticate, we keep on moving and do the + Proxy-Authorization: XXXX header in the HTTP request code snippet */ + /* 300 - Multiple Choices */ + /* 306 - Not used */ + /* 307 - Temporary Redirect */ + default: /* for all above (and the unknown ones) */ + /* Some codes are explicitly mentioned since I've checked RFC2616 and they + * seem to be OK to POST to. + */ + break; + case 301: /* Moved Permanently */ + /* (quote from RFC2616, section 10.3.2): + * + * Note: When automatically redirecting a POST request after receiving a + * 301 status code, some existing HTTP/1.0 user agents will erroneously + * change it into a GET request. + * + * ---- + * + * Warning: Because most of importants user agents do this obvious RFC2616 + * violation, many webservers expect this misbehavior. So these servers + * often answers to a POST request with an error page. To be sure that + * libcurl gets the page that most user agents would get, libcurl has to + * force GET. + * + * This behaviour can be overridden with CURLOPT_POSTREDIR. + */ + if( (data->set.httpreq == HTTPREQ_POST + || data->set.httpreq == HTTPREQ_POST_FORM) + && !data->set.post301) { + infof(data, + "Violate RFC 2616/10.3.2 and switch from POST to GET\n"); + data->set.httpreq = HTTPREQ_GET; + } + break; + case 302: /* Found */ + /* (From 10.3.3) + + Note: RFC 1945 and RFC 2068 specify that the client is not allowed + to change the method on the redirected request. However, most + existing user agent implementations treat 302 as if it were a 303 + response, performing a GET on the Location field-value regardless + of the original request method. The status codes 303 and 307 have + been added for servers that wish to make unambiguously clear which + kind of reaction is expected of the client. + + (From 10.3.4) + + Note: Many pre-HTTP/1.1 user agents do not understand the 303 + status. When interoperability with such clients is a concern, the + 302 status code may be used instead, since most user agents react + to a 302 response as described here for 303. + + This behaviour can be overriden with CURLOPT_POSTREDIR + */ + if( (data->set.httpreq == HTTPREQ_POST + || data->set.httpreq == HTTPREQ_POST_FORM) + && !data->set.post302) { + infof(data, + "Violate RFC 2616/10.3.3 and switch from POST to GET\n"); + data->set.httpreq = HTTPREQ_GET; + } + break; + + case 303: /* See Other */ + /* Disable both types of POSTs, since doing a second POST when + * following isn't what anyone would want! */ + if(data->set.httpreq != HTTPREQ_GET) { + data->set.httpreq = HTTPREQ_GET; /* enforce GET request */ + infof(data, "Disables POST, goes with %s\n", + data->set.opt_no_body?"HEAD":"GET"); + } + break; + case 304: /* Not Modified */ + /* 304 means we did a conditional request and it was "Not modified". + * We shouldn't get any Location: header in this response! + */ + break; + case 305: /* Use Proxy */ + /* (quote from RFC2616, section 10.3.6): + * "The requested resource MUST be accessed through the proxy given + * by the Location field. The Location field gives the URI of the + * proxy. The recipient is expected to repeat this single request + * via the proxy. 305 responses MUST only be generated by origin + * servers." + */ + break; + } + Curl_pgrsTime(data, TIMER_REDIRECT); + Curl_pgrsResetTimes(data); + + return CURLE_OK; +#endif /* CURL_DISABLE_HTTP */ +} + +static CURLcode +connect_host(struct SessionHandle *data, + struct connectdata **conn) +{ + CURLcode res = CURLE_OK; + + bool async; + bool protocol_done=TRUE; /* will be TRUE always since this is only used + within the easy interface */ + Curl_pgrsTime(data, TIMER_STARTSINGLE); + res = Curl_connect(data, conn, &async, &protocol_done); + + if((CURLE_OK == res) && async) { + /* Now, if async is TRUE here, we need to wait for the name + to resolve */ + res = Curl_wait_for_resolv(*conn, NULL); + if(CURLE_OK == res) + /* Resolved, continue with the connection */ + res = Curl_async_resolved(*conn, &protocol_done); + else + /* if we can't resolve, we kill this "connection" now */ + (void)Curl_disconnect(*conn, /* dead_connection */ FALSE); + } + + return res; +} + +CURLcode +Curl_reconnect_request(struct connectdata **connp) +{ + CURLcode result = CURLE_OK; + struct connectdata *conn = *connp; + struct SessionHandle *data = conn->data; + + /* This was a re-use of a connection and we got a write error in the + * DO-phase. Then we DISCONNECT this connection and have another attempt to + * CONNECT and then DO again! The retry cannot possibly find another + * connection to re-use, since we only keep one possible connection for + * each. */ + + infof(data, "Re-used connection seems dead, get a new one\n"); + + conn->bits.close = TRUE; /* enforce close of this connection */ + result = Curl_done(&conn, result, FALSE); /* we are so done with this */ + + /* conn may no longer be a good pointer */ + + /* + * According to bug report #1330310. We need to check for CURLE_SEND_ERROR + * here as well. I figure this could happen when the request failed on a FTP + * connection and thus Curl_done() itself tried to use the connection + * (again). Slight Lack of feedback in the report, but I don't think this + * extra check can do much harm. + */ + if((CURLE_OK == result) || (CURLE_SEND_ERROR == result)) { + bool async; + bool protocol_done = TRUE; + + /* Now, redo the connect and get a new connection */ + result = Curl_connect(data, connp, &async, &protocol_done); + if(CURLE_OK == result) { + /* We have connected or sent away a name resolve query fine */ + + conn = *connp; /* setup conn to again point to something nice */ + if(async) { + /* Now, if async is TRUE here, we need to wait for the name + to resolve */ + result = Curl_wait_for_resolv(conn, NULL); + if(result) + return result; + + /* Resolved, continue with the connection */ + result = Curl_async_resolved(conn, &protocol_done); + if(result) + return result; + } + } + } + + return result; +} + +/* Returns CURLE_OK *and* sets '*url' if a request retry is wanted. + + NOTE: that the *url is malloc()ed. */ +CURLcode Curl_retry_request(struct connectdata *conn, + char **url) +{ + struct SessionHandle *data = conn->data; + + *url = NULL; + + /* if we're talking upload, we can't do the checks below, unless the protocol + is HTTP as when uploading over HTTP we will still get a response */ + if(data->set.upload && !(conn->protocol&(PROT_HTTP|PROT_RTSP))) + return CURLE_OK; + + if(/* workaround for broken TLS servers */ data->state.ssl_connect_retry || + ((data->req.bytecount + + data->req.headerbytecount == 0) && + conn->bits.reuse && + !data->set.opt_no_body && + data->set.rtspreq != RTSPREQ_RECEIVE)) { + /* We got no data, we attempted to re-use a connection and yet we want a + "body". This might happen if the connection was left alive when we were + done using it before, but that was closed when we wanted to read from + it again. Bad luck. Retry the same request on a fresh connect! */ + infof(conn->data, "Connection died, retrying a fresh connect\n"); + *url = strdup(conn->data->change.url); + if(!*url) + return CURLE_OUT_OF_MEMORY; + + conn->bits.close = TRUE; /* close this connection */ + conn->bits.retry = TRUE; /* mark this as a connection we're about + to retry. Marking it this way should + prevent i.e HTTP transfers to return + error just because nothing has been + transfered! */ + } + return CURLE_OK; +} + +static CURLcode Curl_do_perform(struct SessionHandle *data) +{ + CURLcode res; + CURLcode res2; + struct connectdata *conn=NULL; + char *newurl = NULL; /* possibly a new URL to follow to! */ + followtype follow = FOLLOW_NONE; + + data->state.used_interface = Curl_if_easy; + + res = Curl_pretransfer(data); + if(res) + return res; + + /* + * It is important that there is NO 'return' from this function at any other + * place than falling down to the end of the function! This is because we + * have cleanup stuff that must be done before we get back, and that is only + * performed after this do-while loop. + */ + + for(;;) { + res = connect_host(data, &conn); /* primary connection */ + + if(res == CURLE_OK) { + bool do_done; + if(data->set.connect_only) { + /* keep connection open for application to use the socket */ + conn->bits.close = FALSE; + res = Curl_done(&conn, CURLE_OK, FALSE); + break; + } + res = Curl_do(&conn, &do_done); + + if(res == CURLE_OK) { + if(conn->data->set.wildcardmatch) { + if(conn->data->wildcard.state == CURLWC_DONE || + conn->data->wildcard.state == CURLWC_SKIP) { + /* keep connection open for application to use the socket */ + conn->bits.close = FALSE; + res = Curl_done(&conn, CURLE_OK, FALSE); + break; + } + } + res = Transfer(conn); /* now fetch that URL please */ + if((res == CURLE_OK) || (res == CURLE_RECV_ERROR)) { + bool retry = FALSE; + CURLcode rc = Curl_retry_request(conn, &newurl); + if(rc) + res = rc; + else + retry = (newurl?TRUE:FALSE); + + if(retry) { + /* we know (newurl != NULL) at this point */ + res = CURLE_OK; + follow = FOLLOW_RETRY; + } + else if (res == CURLE_OK) { + /* + * We must duplicate the new URL here as the connection data may + * be free()ed in the Curl_done() function. We prefer the newurl + * one since that's used for redirects or just further requests + * for retries or multi-stage HTTP auth methods etc. + */ + if(data->req.newurl) { + follow = FOLLOW_REDIR; + newurl = strdup(data->req.newurl); + if (!newurl) + res = CURLE_OUT_OF_MEMORY; + } + else if(data->req.location) { + follow = FOLLOW_FAKE; + newurl = strdup(data->req.location); + if (!newurl) + res = CURLE_OUT_OF_MEMORY; + } + } + + /* in the above cases where 'newurl' gets assigned, we have a fresh + * allocated memory pointed to */ + } + if(res != CURLE_OK) { + /* The transfer phase returned error, we mark the connection to get + * closed to prevent being re-used. This is because we can't + * possibly know if the connection is in a good shape or not now. */ + conn->bits.close = TRUE; + + if(CURL_SOCKET_BAD != conn->sock[SECONDARYSOCKET]) { + /* if we failed anywhere, we must clean up the secondary socket if + it was used */ + sclose(conn->sock[SECONDARYSOCKET]); + conn->sock[SECONDARYSOCKET] = CURL_SOCKET_BAD; + } + } + + /* Always run Curl_done(), even if some of the previous calls + failed, but return the previous (original) error code */ + res2 = Curl_done(&conn, res, FALSE); + + if(CURLE_OK == res) + res = res2; + } + else if(conn) + /* Curl_do() failed, clean up left-overs in the done-call, but note + that at some cases the conn pointer is NULL when Curl_do() failed + and the connection cache is very small so only call Curl_done() if + conn is still "alive". */ + /* ignore return code since we already have an error to return */ + (void)Curl_done(&conn, res, FALSE); + + /* + * Important: 'conn' cannot be used here, since it may have been closed + * in 'Curl_done' or other functions. + */ + + if((res == CURLE_OK) && follow) { + res = Curl_follow(data, newurl, follow); + if(CURLE_OK == res) { + /* if things went fine, Curl_follow() freed or otherwise took + responsibility for the newurl pointer */ + newurl = NULL; + if(follow >= FOLLOW_RETRY) { + follow = FOLLOW_NONE; + continue; + } + /* else we break out of the loop below */ + } + } + } + break; /* it only reaches here when this shouldn't loop */ + + } /* loop if Location: */ + + if(newurl) + free(newurl); + + if(res && !data->state.errorbuf) { + /* + * As an extra precaution: if no error string has been set and there was + * an error, use the strerror() string or if things are so bad that not + * even that is good, set a bad string that mentions the error code. + */ + const char *str = curl_easy_strerror(res); + if(!str) + failf(data, "unspecified error %d", (int)res); + else + failf(data, "%s", str); + } + + /* run post-transfer unconditionally, but don't clobber the return code if + we already have an error code recorder */ + res2 = Curl_posttransfer(data); + if(!res && res2) + res = res2; + + return res; +} + +/* + * Curl_perform() is the internal high-level function that gets called by the + * external curl_easy_perform() function. It inits, performs and cleans up a + * single file transfer. + */ +CURLcode Curl_perform(struct SessionHandle *data) +{ + CURLcode res; + if(!data->set.wildcardmatch) + return Curl_do_perform(data); + + /* init main wildcard structures */ + res = Curl_wildcard_init(&data->wildcard); + if(res) + return res; + + res = Curl_do_perform(data); + if(res) { + Curl_wildcard_dtor(&data->wildcard); + return res; + } + + /* wildcard loop */ + while(!res && data->wildcard.state != CURLWC_DONE) + res = Curl_do_perform(data); + + Curl_wildcard_dtor(&data->wildcard); + + /* wildcard download finished or failed */ + data->wildcard.state = CURLWC_INIT; + return res; +} + +/* + * Curl_setup_transfer() is called to setup some basic properties for the + * upcoming transfer. + */ +void +Curl_setup_transfer( + struct connectdata *conn, /* connection data */ + int sockindex, /* socket index to read from or -1 */ + curl_off_t size, /* -1 if unknown at this point */ + bool getheader, /* TRUE if header parsing is wanted */ + curl_off_t *bytecountp, /* return number of bytes read or NULL */ + int writesockindex, /* socket index to write to, it may very well be + the same we read from. -1 disables */ + curl_off_t *writecountp /* return number of bytes written or NULL */ + ) +{ + struct SessionHandle *data; + struct SingleRequest *k; + + DEBUGASSERT(conn != NULL); + + data = conn->data; + k = &data->req; + + DEBUGASSERT((sockindex <= 1) && (sockindex >= -1)); + + /* now copy all input parameters */ + conn->sockfd = sockindex == -1 ? + CURL_SOCKET_BAD : conn->sock[sockindex]; + conn->writesockfd = writesockindex == -1 ? + CURL_SOCKET_BAD:conn->sock[writesockindex]; + k->getheader = getheader; + + k->size = size; + k->bytecountp = bytecountp; + k->writebytecountp = writecountp; + + /* The code sequence below is placed in this function just because all + necessary input is not always known in do_complete() as this function may + be called after that */ + + if(!k->getheader) { + k->header = FALSE; + if(size > 0) + Curl_pgrsSetDownloadSize(data, size); + } + /* we want header and/or body, if neither then don't do this! */ + if(k->getheader || !data->set.opt_no_body) { + + if(conn->sockfd != CURL_SOCKET_BAD) + k->keepon |= KEEP_RECV; + + if(conn->writesockfd != CURL_SOCKET_BAD) { + /* HTTP 1.1 magic: + + Even if we require a 100-return code before uploading data, we might + need to write data before that since the REQUEST may not have been + finished sent off just yet. + + Thus, we must check if the request has been sent before we set the + state info where we wait for the 100-return code + */ + if((data->state.expect100header) && + (data->state.proto.http->sending == HTTPSEND_BODY)) { + /* wait with write until we either got 100-continue or a timeout */ + k->exp100 = EXP100_AWAITING_CONTINUE; + k->start100 = k->start; + + /* set a timeout for the multi interface */ + Curl_expire(data, CURL_TIMEOUT_EXPECT_100); + } + else { + if(data->state.expect100header) + /* when we've sent off the rest of the headers, we must await a + 100-continue but first finish sending the request */ + k->exp100 = EXP100_SENDING_REQUEST; + + /* enable the write bit when we're not waiting for continue */ + k->keepon |= KEEP_SEND; + } + } /* if(conn->writesockfd != CURL_SOCKET_BAD) */ + } /* if(k->getheader || !data->set.opt_no_body) */ + +} diff --git a/mobicore/common/curl/lib/transfer.h b/mobicore/common/curl/lib/transfer.h new file mode 100644 index 0000000000000000000000000000000000000000..790e1e3ef880829b031e741599df2fc4f2623395 --- /dev/null +++ b/mobicore/common/curl/lib/transfer.h @@ -0,0 +1,67 @@ +#ifndef __TRANSFER_H +#define __TRANSFER_H +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) 1998 - 2010, Daniel Stenberg, , et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at http://curl.haxx.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ***************************************************************************/ +CURLcode Curl_perform(struct SessionHandle *data); +CURLcode Curl_pretransfer(struct SessionHandle *data); +CURLcode Curl_second_connect(struct connectdata *conn); +CURLcode Curl_posttransfer(struct SessionHandle *data); + +typedef enum { + FOLLOW_NONE, /* not used within the function, just a placeholder to + allow initing to this */ + FOLLOW_FAKE, /* only records stuff, not actually following */ + FOLLOW_RETRY, /* set if this is a request retry as opposed to a real + redirect following */ + FOLLOW_REDIR, /* a full true redirect */ + FOLLOW_LAST /* never used */ +} followtype; + +CURLcode Curl_follow(struct SessionHandle *data, char *newurl, followtype type); + + +CURLcode Curl_readwrite(struct connectdata *conn, bool *done); +int Curl_single_getsock(const struct connectdata *conn, + curl_socket_t *socks, + int numsocks); +CURLcode Curl_readrewind(struct connectdata *conn); +CURLcode Curl_fillreadbuffer(struct connectdata *conn, int bytes, int *nreadp); +CURLcode Curl_reconnect_request(struct connectdata **connp); +CURLcode Curl_retry_request(struct connectdata *conn, char **url); + +/* This sets up a forthcoming transfer */ +void +Curl_setup_transfer (struct connectdata *data, + int sockindex, /* socket index to read from or -1 */ + curl_off_t size, /* -1 if unknown at this point */ + bool getheader, /* TRUE if header parsing is wanted */ + curl_off_t *bytecountp, /* return number of bytes read */ + int writesockindex, /* socket index to write to, it may + very well be the same we read from. + -1 disables */ + curl_off_t *writecountp /* return number of bytes written */ +); + +long Curl_sleep_time(curl_off_t rate_bps, curl_off_t cur_rate_bps, + int pkt_size); + +#endif diff --git a/mobicore/common/curl/lib/url.c b/mobicore/common/curl/lib/url.c new file mode 100644 index 0000000000000000000000000000000000000000..8511ffe4c924b410bc3ea4fd0cbc5c90c4f596aa --- /dev/null +++ b/mobicore/common/curl/lib/url.c @@ -0,0 +1,5390 @@ +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) 1998 - 2010, Daniel Stenberg, , et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at http://curl.haxx.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ***************************************************************************/ + +/* -- WIN32 approved -- */ + +#include "setup.h" + +#include +#include +#include +#include +#include +#include + +#ifdef WIN32 +#include +#include +#else +#ifdef HAVE_SYS_SOCKET_H +#include +#endif +#ifdef HAVE_NETINET_IN_H +#include +#endif +#ifdef HAVE_SYS_TIME_H +#include +#endif +#ifdef HAVE_UNISTD_H +#include +#endif +#ifdef HAVE_NETDB_H +#include +#endif +#ifdef HAVE_ARPA_INET_H +#include +#endif +#ifdef HAVE_NET_IF_H +#include +#endif +#ifdef HAVE_SYS_IOCTL_H +#include +#endif + +#ifdef HAVE_SYS_PARAM_H +#include +#endif + +#ifdef __VMS +#include +#include +#endif + +#ifndef HAVE_SOCKET +#error "We can't compile without socket() support!" +#endif + +#endif /* WIN32 */ + +#ifdef HAVE_LIMITS_H +#include +#endif + +#ifdef USE_LIBIDN +#include +#include +#include +#ifdef HAVE_IDN_FREE_H +#include +#else +void idn_free (void *ptr); /* prototype from idn-free.h, not provided by + libidn 0.4.5's make install! */ +#endif +#ifndef HAVE_IDN_FREE +/* if idn_free() was not found in this version of libidn, use plain free() + instead */ +#define idn_free(x) (free)(x) +#endif +#endif /* USE_LIBIDN */ + +#include "urldata.h" +#include "netrc.h" + +#include "formdata.h" +#include "sslgen.h" +#include "hostip.h" +#include "transfer.h" +#include "sendf.h" +#include "progress.h" +#include "cookie.h" +#include "strequal.h" +#include "strerror.h" +#include "escape.h" +#include "strtok.h" +#include "share.h" +#include "content_encoding.h" +#include "http_digest.h" +#include "http_negotiate.h" +#include "select.h" +#include "multiif.h" +#include "easyif.h" +#include "speedcheck.h" +#include "rawstr.h" +#include "warnless.h" + +/* And now for the protocols */ +#include "ftp.h" +#include "dict.h" +#include "telnet.h" +#include "tftp.h" +#include "http.h" +#include "file.h" +#include "curl_ldap.h" +#include "ssh.h" +#include "imap.h" +#include "url.h" +#include "connect.h" +#include "inet_ntop.h" +#include "http_ntlm.h" +#include "socks.h" +#include "rtsp.h" +#include "curl_rtmp.h" +#include "gopher.h" + +#define _MPRINTF_REPLACE /* use our functions only */ +#include + +#include "curl_memory.h" +/* The last #include file should be: */ +#include "memdebug.h" + +/* Local static prototypes */ +static long ConnectionKillOne(struct SessionHandle *data); +static void conn_free(struct connectdata *conn); +static void signalPipeClose(struct curl_llist *pipeline, bool pipe_broke); + +/* + * Protocol table. + */ + +static const struct Curl_handler * const protocols[] = { + +#ifndef CURL_DISABLE_HTTP + &Curl_handler_http, +#endif + +#if defined(USE_SSL) && !defined(CURL_DISABLE_HTTP) + &Curl_handler_https, +#endif + +#ifndef CURL_DISABLE_FTP + &Curl_handler_ftp, +#endif + +#if defined(USE_SSL) && !defined(CURL_DISABLE_FTP) + &Curl_handler_ftps, +#endif + +#ifndef CURL_DISABLE_TELNET + &Curl_handler_telnet, +#endif + +#ifndef CURL_DISABLE_DICT + &Curl_handler_dict, +#endif + +#ifndef CURL_DISABLE_LDAP + &Curl_handler_ldap, +#if (defined(USE_OPENLDAP) && defined(USE_SSL)) || \ + (!defined(USE_OPENLDAP) && defined(HAVE_LDAP_SSL)) + &Curl_handler_ldaps, +#endif +#endif + +#ifndef CURL_DISABLE_FILE + &Curl_handler_file, +#endif + +#ifndef CURL_DISABLE_TFTP + &Curl_handler_tftp, +#endif + +#ifdef USE_LIBSSH2 + &Curl_handler_scp, + &Curl_handler_sftp, +#endif + +#ifndef CURL_DISABLE_IMAP + &Curl_handler_imap, +#ifdef USE_SSL + &Curl_handler_imaps, +#endif +#endif + +#ifndef CURL_DISABLE_POP3 + &Curl_handler_pop3, +#ifdef USE_SSL + &Curl_handler_pop3s, +#endif +#endif + +#ifndef CURL_DISABLE_SMTP + &Curl_handler_smtp, +#ifdef USE_SSL + &Curl_handler_smtps, +#endif +#endif + +#ifndef CURL_DISABLE_RTSP + &Curl_handler_rtsp, +#endif + +#ifndef CURL_DISABLE_GOPHER + &Curl_handler_gopher, +#endif + +#ifdef USE_LIBRTMP + &Curl_handler_rtmp, + &Curl_handler_rtmpt, + &Curl_handler_rtmpe, + &Curl_handler_rtmpte, + &Curl_handler_rtmps, + &Curl_handler_rtmpts, +#endif + + (struct Curl_handler *) NULL +}; + +/* + * Dummy handler for undefined protocol schemes. + */ + +static const struct Curl_handler Curl_handler_dummy = { + "", /* scheme */ + ZERO_NULL, /* setup_connection */ + ZERO_NULL, /* do_it */ + ZERO_NULL, /* done */ + ZERO_NULL, /* do_more */ + ZERO_NULL, /* connect_it */ + ZERO_NULL, /* connecting */ + ZERO_NULL, /* doing */ + ZERO_NULL, /* proto_getsock */ + ZERO_NULL, /* doing_getsock */ + ZERO_NULL, /* perform_getsock */ + ZERO_NULL, /* disconnect */ + 0, /* defport */ + 0 /* protocol */ +}; + +void Curl_safefree(void *ptr) +{ + if(ptr) + free(ptr); +} + +static void close_connections(struct SessionHandle *data) +{ + /* Loop through all open connections and kill them one by one */ + long i; + do { + i = ConnectionKillOne(data); + } while(i != -1L); +} + +void Curl_freeset(struct SessionHandle * data) +{ + /* Free all dynamic strings stored in the data->set substructure. */ + enum dupstring i; + for(i=(enum dupstring)0; i < STRING_LAST; i++) + Curl_safefree(data->set.str[i]); +} + +static CURLcode setstropt(char **charp, char * s) +{ + /* Release the previous storage at `charp' and replace by a dynamic storage + copy of `s'. Return CURLE_OK or CURLE_OUT_OF_MEMORY. */ + + if(*charp) { + free(*charp); + *charp = (char *) NULL; + } + + if(s) { + s = strdup(s); + + if(!s) + return CURLE_OUT_OF_MEMORY; + + *charp = s; + } + + return CURLE_OK; +} + +static CURLcode setstropt_userpwd(char *option, char **user_storage, + char **pwd_storage) +{ + char* separator; + CURLcode result = CURLE_OK; + + if(!option) { + /* we treat a NULL passed in as a hint to clear existing info */ + Curl_safefree(*user_storage); + *user_storage = (char *) NULL; + Curl_safefree(*pwd_storage); + *pwd_storage = (char *) NULL; + return CURLE_OK; + } + + separator = strchr(option, ':'); + if (separator != NULL) { + + /* store username part of option */ + char * p; + size_t username_len = (size_t)(separator-option); + p = malloc(username_len+1); + if(!p) + result = CURLE_OUT_OF_MEMORY; + else { + memcpy(p, option, username_len); + p[username_len] = '\0'; + Curl_safefree(*user_storage); + *user_storage = p; + } + + /* store password part of option */ + if (result == CURLE_OK) { + result = setstropt(pwd_storage, separator+1); + } + } + else { + result = setstropt(user_storage, option); + } + return result; +} + +CURLcode Curl_dupset(struct SessionHandle * dst, struct SessionHandle * src) +{ + CURLcode r = CURLE_OK; + enum dupstring i; + + /* Copy src->set into dst->set first, then deal with the strings + afterwards */ + dst->set = src->set; + + /* clear all string pointers first */ + memset(dst->set.str, 0, STRING_LAST * sizeof(char *)); + + /* duplicate all strings */ + for(i=(enum dupstring)0; i< STRING_LAST; i++) { + r = setstropt(&dst->set.str[i], src->set.str[i]); + if(r != CURLE_OK) + break; + } + + /* If a failure occurred, freeing has to be performed externally. */ + return r; +} + +#if !defined(CURL_DISABLE_HTTP) && !defined(CURL_DISABLE_COOKIES) +static void flush_cookies(struct SessionHandle *data, int cleanup) +{ + if(data->set.str[STRING_COOKIEJAR]) { + if(data->change.cookielist) { + /* If there is a list of cookie files to read, do it first so that + we have all the told files read before we write the new jar. + Curl_cookie_loadfiles() LOCKS and UNLOCKS the share itself! */ + Curl_cookie_loadfiles(data); + } + + Curl_share_lock(data, CURL_LOCK_DATA_COOKIE, CURL_LOCK_ACCESS_SINGLE); + + /* if we have a destination file for all the cookies to get dumped to */ + if(Curl_cookie_output(data->cookies, data->set.str[STRING_COOKIEJAR])) + infof(data, "WARNING: failed to save cookies in %s\n", + data->set.str[STRING_COOKIEJAR]); + } + else { + if(cleanup && data->change.cookielist) + /* since nothing is written, we can just free the list of cookie file + names */ + curl_slist_free_all(data->change.cookielist); /* clean up list */ + Curl_share_lock(data, CURL_LOCK_DATA_COOKIE, CURL_LOCK_ACCESS_SINGLE); + } + + if(cleanup && (!data->share || (data->cookies != data->share->cookies))) { + Curl_cookie_cleanup(data->cookies); + } + Curl_share_unlock(data, CURL_LOCK_DATA_COOKIE); +} +#endif + +/* + * This is the internal function curl_easy_cleanup() calls. This should + * cleanup and free all resources associated with this sessionhandle. + * + * NOTE: if we ever add something that attempts to write to a socket or + * similar here, we must ignore SIGPIPE first. It is currently only done + * when curl_easy_perform() is invoked. + */ + +CURLcode Curl_close(struct SessionHandle *data) +{ + struct Curl_multi *m = data->multi; + +#ifdef DEBUGBUILD + /* only for debugging, scan through all connections and see if there's a + pipe reference still identifying this handle */ + + if(data->state.connc && data->state.connc->type == CONNCACHE_MULTI) { + struct conncache *c = data->state.connc; + long i; + struct curl_llist *pipeline; + struct curl_llist_element *curr; + struct connectdata *connptr; + + for(i=0; i< c->num; i++) { + connptr = c->connects[i]; + if(!connptr) + continue; + + pipeline = connptr->send_pipe; + if(pipeline) { + for (curr = pipeline->head; curr; curr=curr->next) { + if(data == (struct SessionHandle *) curr->ptr) { + fprintf(stderr, + "problem we %p are still in send pipe for %p done %d\n", + data, connptr, (int)connptr->bits.done); + } + } + } + pipeline = connptr->recv_pipe; + if(pipeline) { + for (curr = pipeline->head; curr; curr=curr->next) { + if(data == (struct SessionHandle *) curr->ptr) { + fprintf(stderr, + "problem we %p are still in recv pipe for %p done %d\n", + data, connptr, (int)connptr->bits.done); + } + } + } + pipeline = connptr->done_pipe; + if(pipeline) { + for (curr = pipeline->head; curr; curr=curr->next) { + if(data == (struct SessionHandle *) curr->ptr) { + fprintf(stderr, + "problem we %p are still in done pipe for %p done %d\n", + data, connptr, (int)connptr->bits.done); + } + } + } + pipeline = connptr->pend_pipe; + if(pipeline) { + for (curr = pipeline->head; curr; curr=curr->next) { + if(data == (struct SessionHandle *) curr->ptr) { + fprintf(stderr, + "problem we %p are still in pend pipe for %p done %d\n", + data, connptr, (int)connptr->bits.done); + } + } + } + } + } +#endif + + Curl_expire(data, 0); /* shut off timers */ + + if(m) + /* This handle is still part of a multi handle, take care of this first + and detach this handle from there. */ + curl_multi_remove_handle(data->multi, data); + + /* Destroy the timeout list that is held in the easy handle. It is + /normally/ done by curl_multi_remove_handle() but this is "just in + case" */ + if(data->state.timeoutlist) { + Curl_llist_destroy(data->state.timeoutlist, NULL); + data->state.timeoutlist = NULL; + } + + data->magic = 0; /* force a clear AFTER the possibly enforced removal from + the multi handle, since that function uses the magic + field! */ + + if(data->state.connc) { + + if(data->state.connc->type == CONNCACHE_PRIVATE) { + /* close all connections still alive that are in the private connection + cache, as we no longer have the pointer left to the shared one. */ + close_connections(data); + + /* free the connection cache if allocated privately */ + Curl_rm_connc(data->state.connc); + } + } + + if(data->state.shared_conn) { + /* marked to be used by a pending connection so we can't kill this handle + just yet */ + data->state.closed = TRUE; + return CURLE_OK; + } + + if(data->dns.hostcachetype == HCACHE_PRIVATE) { + Curl_hash_destroy(data->dns.hostcache); + data->dns.hostcachetype = HCACHE_NONE; + data->dns.hostcache = NULL; + } + + if(data->state.rangestringalloc) + free(data->state.range); + + /* Free the pathbuffer */ + Curl_safefree(data->state.pathbuffer); + Curl_safefree(data->state.proto.generic); + + /* Close down all open SSL info and sessions */ + Curl_ssl_close_all(data); + Curl_safefree(data->state.first_host); + Curl_safefree(data->state.scratch); + Curl_ssl_free_certinfo(data); + + if(data->change.referer_alloc) + free(data->change.referer); + + if(data->change.url_alloc) + free(data->change.url); + + Curl_safefree(data->state.headerbuff); + +#if !defined(CURL_DISABLE_HTTP) && !defined(CURL_DISABLE_COOKIES) + flush_cookies(data, 1); +#endif + + Curl_digest_cleanup(data); + + Curl_safefree(data->info.contenttype); + Curl_safefree(data->info.wouldredirect); + + /* this destroys the channel and we cannot use it anymore after this */ + ares_destroy(data->state.areschannel); + +#if defined(CURL_DOES_CONVERSIONS) && defined(HAVE_ICONV) + /* close iconv conversion descriptors */ + if(data->inbound_cd != (iconv_t)-1) { + iconv_close(data->inbound_cd); + } + if(data->outbound_cd != (iconv_t)-1) { + iconv_close(data->outbound_cd); + } + if(data->utf8_cd != (iconv_t)-1) { + iconv_close(data->utf8_cd); + } +#endif /* CURL_DOES_CONVERSIONS && HAVE_ICONV */ + + /* No longer a dirty share, if it exists */ + if(data->share) { + Curl_share_lock(data, CURL_LOCK_DATA_SHARE, CURL_LOCK_ACCESS_SINGLE); + data->share->dirty--; + Curl_share_unlock(data, CURL_LOCK_DATA_SHARE); + } + + Curl_freeset(data); + free(data); + return CURLE_OK; +} + +/* create a connection cache of a private or multi type */ +struct conncache *Curl_mk_connc(int type, + long amount) /* set -1 to use default */ +{ + /* It is subject for debate how many default connections to have for a multi + connection cache... */ + + struct conncache *c; + long default_amount; + long max_amount = (long)(((size_t)INT_MAX) / sizeof(struct connectdata *)); + + if(type == CONNCACHE_PRIVATE) { + default_amount = (amount < 1L) ? 5L : amount; + } + else { + default_amount = (amount < 1L) ? 10L : amount; + } + + if(default_amount > max_amount) + default_amount = max_amount; + + c = calloc(1, sizeof(struct conncache)); + if(!c) + return NULL; + + c->connects = calloc((size_t)default_amount, sizeof(struct connectdata *)); + if(!c->connects) { + free(c); + return NULL; + } + + c->num = default_amount; + + return c; +} + +/* Change number of entries of a connection cache */ +CURLcode Curl_ch_connc(struct SessionHandle *data, + struct conncache *c, + long newamount) +{ + long i; + struct connectdata **newptr; + long max_amount = (long)(((size_t)INT_MAX) / sizeof(struct connectdata *)); + + if(newamount < 1) + newamount = 1; /* we better have at least one entry */ + + if(!c) { + /* we get a NULL pointer passed in as connection cache, which means that + there is no cache created for this SessionHandle just yet, we create a + brand new with the requested size. + */ + data->state.connc = Curl_mk_connc(CONNCACHE_PRIVATE, newamount); + if(!data->state.connc) + return CURLE_OUT_OF_MEMORY; + return CURLE_OK; + } + + if(newamount < c->num) { + /* Since this number is *decreased* from the existing number, we must + close the possibly open connections that live on the indexes that + are being removed! + + NOTE: for conncache_multi cases we must make sure that we only + close handles not in use. + */ + for(i=newamount; i< c->num; i++) + Curl_disconnect(c->connects[i], /* dead_connection */ FALSE); + + /* If the most recent connection is no longer valid, mark it + invalid. */ + if(data->state.lastconnect <= newamount) + data->state.lastconnect = -1; + } + if(newamount > 0) { + if(newamount > max_amount) + newamount = max_amount; + newptr = realloc(c->connects, sizeof(struct connectdata *) * newamount); + if(!newptr) + /* we closed a few connections in vain, but so what? */ + return CURLE_OUT_OF_MEMORY; + + /* nullify the newly added pointers */ + for(i=c->num; iconnects = newptr; + c->num = newamount; + } + /* we no longer support less than 1 as size for the connection cache, and + I'm not sure it ever worked to set it to zero */ + return CURLE_OK; +} + +/* Free a connection cache. This is called from Curl_close() and + curl_multi_cleanup(). */ +void Curl_rm_connc(struct conncache *c) +{ + if(c->connects) { + long i; + for(i = 0; i < c->num; ++i) + conn_free(c->connects[i]); + + free(c->connects); + } + + free(c); +} + +/* + * Initialize the UserDefined fields within a SessionHandle. + * This may be safely called on a new or existing SessionHandle. + */ +CURLcode Curl_init_userdefined(struct UserDefined *set) +{ + CURLcode res = CURLE_OK; + + set->out = stdout; /* default output to stdout */ + set->in = stdin; /* default input from stdin */ + set->err = stderr; /* default stderr to stderr */ + + /* use fwrite as default function to store output */ + set->fwrite_func = (curl_write_callback)fwrite; + + /* use fread as default function to read input */ + set->fread_func = (curl_read_callback)fread; + set->is_fread_set = 0; + set->is_fwrite_set = 0; + + set->seek_func = ZERO_NULL; + set->seek_client = ZERO_NULL; + + /* conversion callbacks for non-ASCII hosts */ + set->convfromnetwork = ZERO_NULL; + set->convtonetwork = ZERO_NULL; + set->convfromutf8 = ZERO_NULL; + + set->infilesize = -1; /* we don't know any size */ + set->postfieldsize = -1; /* unknown size */ + set->maxredirs = -1; /* allow any amount by default */ + + set->httpreq = HTTPREQ_GET; /* Default HTTP request */ + set->rtspreq = RTSPREQ_OPTIONS; /* Default RTSP request */ + set->ftp_use_epsv = TRUE; /* FTP defaults to EPSV operations */ + set->ftp_use_eprt = TRUE; /* FTP defaults to EPRT operations */ + set->ftp_use_pret = FALSE; /* mainly useful for drftpd servers */ + set->ftp_filemethod = FTPFILE_MULTICWD; + + set->dns_cache_timeout = 60; /* Timeout every 60 seconds by default */ + + /* Set the default size of the SSL session ID cache */ + set->ssl.numsessions = 5; + + set->proxyport = CURL_DEFAULT_PROXY_PORT; /* from url.h */ + set->proxytype = CURLPROXY_HTTP; /* defaults to HTTP proxy */ + set->httpauth = CURLAUTH_BASIC; /* defaults to basic */ + set->proxyauth = CURLAUTH_BASIC; /* defaults to basic */ + + /* make libcurl quiet by default: */ + set->hide_progress = TRUE; /* CURLOPT_NOPROGRESS changes these */ + + /* + * libcurl 7.10 introduced SSL verification *by default*! This needs to be + * switched off unless wanted. + */ + set->ssl.verifypeer = TRUE; + set->ssl.verifyhost = 2; + set->ssh_auth_types = CURLSSH_AUTH_DEFAULT; /* defaults to any auth + type */ + set->ssl.sessionid = TRUE; /* session ID caching enabled by default */ + + set->new_file_perms = 0644; /* Default permissions */ + set->new_directory_perms = 0755; /* Default permissions */ + + /* for the *protocols fields we don't use the CURLPROTO_ALL convenience + define since we internally only use the lower 16 bits for the passed + in bitmask to not conflict with the private bits */ + set->allowed_protocols = PROT_EXTMASK; + set->redir_protocols = + PROT_EXTMASK & ~(CURLPROTO_FILE|CURLPROTO_SCP); /* not FILE or SCP */ + +#if defined(HAVE_GSSAPI) || defined(USE_WINDOWS_SSPI) + /* + * disallow unprotected protection negotiation NEC reference implementation + * seem not to follow rfc1961 section 4.3/4.4 + */ + set->socks5_gssapi_nec = FALSE; + /* set default gssapi service name */ + res = setstropt(&set->str[STRING_SOCKS5_GSSAPI_SERVICE], + (char *) CURL_DEFAULT_SOCKS5_GSSAPI_SERVICE); + if (res != CURLE_OK) + return res; +#endif + + /* This is our preferred CA cert bundle/path since install time */ +#if defined(CURL_CA_BUNDLE) + res = setstropt(&set->str[STRING_SSL_CAFILE], (char *) CURL_CA_BUNDLE); +#elif defined(CURL_CA_PATH) + res = setstropt(&set->str[STRING_SSL_CAPATH], (char *) CURL_CA_PATH); +#endif + + set->wildcardmatch = FALSE; + set->chunk_bgn = ZERO_NULL; + set->chunk_end = ZERO_NULL; + + return res; +} + +/** + * Curl_open() + * + * @param curl is a pointer to a sessionhandle pointer that gets set by this + * function. + * @return CURLcode + */ + +CURLcode Curl_open(struct SessionHandle **curl) +{ + CURLcode res = CURLE_OK; + struct SessionHandle *data; +#ifdef USE_ARES + int status; +#endif + + /* Very simple start-up: alloc the struct, init it with zeroes and return */ + data = calloc(1, sizeof(struct SessionHandle)); + if(!data) { + /* this is a very serious error */ + DEBUGF(fprintf(stderr, "Error: calloc of SessionHandle failed\n")); + return CURLE_OUT_OF_MEMORY; + } + + data->magic = CURLEASY_MAGIC_NUMBER; + +#ifdef USE_ARES + if((status = ares_init(&data->state.areschannel)) != ARES_SUCCESS) { + DEBUGF(fprintf(stderr, "Error: ares_init failed\n")); + free(data); + if(status == ARES_ENOMEM) + return CURLE_OUT_OF_MEMORY; + else + return CURLE_FAILED_INIT; + } + /* make sure that all other returns from this function should destroy the + ares channel before returning error! */ +#endif + + /* We do some initial setup here, all those fields that can't be just 0 */ + + data->state.headerbuff = malloc(HEADERSIZE); + if(!data->state.headerbuff) { + DEBUGF(fprintf(stderr, "Error: malloc of headerbuff failed\n")); + res = CURLE_OUT_OF_MEMORY; + } + else { + Curl_easy_initHandleData(data); + res = Curl_init_userdefined(&data->set); + + data->state.headersize=HEADERSIZE; + +#if defined(CURL_DOES_CONVERSIONS) && defined(HAVE_ICONV) + /* conversion descriptors for iconv calls */ + data->outbound_cd = (iconv_t)-1; + data->inbound_cd = (iconv_t)-1; + data->utf8_cd = (iconv_t)-1; +#endif /* CURL_DOES_CONVERSIONS && HAVE_ICONV */ + + /* most recent connection is not yet defined */ + data->state.lastconnect = -1; + + data->progress.flags |= PGRS_HIDE; + data->state.current_speed = -1; /* init to negative == impossible */ + + data->wildcard.state = CURLWC_INIT; + data->wildcard.filelist = NULL; + data->set.fnmatch = ZERO_NULL; + /* This no longer creates a connection cache here. It is instead made on + the first call to curl_easy_perform() or when the handle is added to a + multi stack. */ + } + + if(res) { + ares_destroy(data->state.areschannel); + if(data->state.headerbuff) + free(data->state.headerbuff); + Curl_freeset(data); + free(data); + data = NULL; + } + else + *curl = data; + + return res; +} + +CURLcode Curl_setopt(struct SessionHandle *data, CURLoption option, + va_list param) +{ + char *argptr; + CURLcode result = CURLE_OK; +#ifndef CURL_DISABLE_HTTP + curl_off_t bigsize; +#endif + + switch(option) { + case CURLOPT_DNS_CACHE_TIMEOUT: + data->set.dns_cache_timeout = va_arg(param, long); + break; + case CURLOPT_DNS_USE_GLOBAL_CACHE: + { + /* remember we want this enabled */ + long use_cache = va_arg(param, long); + data->set.global_dns_cache = (bool)(0 != use_cache); + } + break; + case CURLOPT_SSL_CIPHER_LIST: + /* set a list of cipher we want to use in the SSL connection */ + result = setstropt(&data->set.str[STRING_SSL_CIPHER_LIST], + va_arg(param, char *)); + break; + + case CURLOPT_RANDOM_FILE: + /* + * This is the path name to a file that contains random data to seed + * the random SSL stuff with. The file is only used for reading. + */ + result = setstropt(&data->set.str[STRING_SSL_RANDOM_FILE], + va_arg(param, char *)); + break; + case CURLOPT_EGDSOCKET: + /* + * The Entropy Gathering Daemon socket pathname + */ + result = setstropt(&data->set.str[STRING_SSL_EGDSOCKET], + va_arg(param, char *)); + break; + case CURLOPT_MAXCONNECTS: + /* + * Set the absolute number of maximum simultaneous alive connection that + * libcurl is allowed to have. + */ + result = Curl_ch_connc(data, data->state.connc, va_arg(param, long)); + break; + case CURLOPT_FORBID_REUSE: + /* + * When this transfer is done, it must not be left to be reused by a + * subsequent transfer but shall be closed immediately. + */ + data->set.reuse_forbid = (bool)(0 != va_arg(param, long)); + break; + case CURLOPT_FRESH_CONNECT: + /* + * This transfer shall not use a previously cached connection but + * should be made with a fresh new connect! + */ + data->set.reuse_fresh = (bool)(0 != va_arg(param, long)); + break; + case CURLOPT_VERBOSE: + /* + * Verbose means infof() calls that give a lot of information about + * the connection and transfer procedures as well as internal choices. + */ + data->set.verbose = (bool)(0 != va_arg(param, long)); + break; + case CURLOPT_HEADER: + /* + * Set to include the header in the general data output stream. + */ + data->set.include_header = (bool)(0 != va_arg(param, long)); + break; + case CURLOPT_NOPROGRESS: + /* + * Shut off the internal supported progress meter + */ + data->set.hide_progress = (bool)(0 != va_arg(param, long)); + if(data->set.hide_progress) + data->progress.flags |= PGRS_HIDE; + else + data->progress.flags &= ~PGRS_HIDE; + break; + case CURLOPT_NOBODY: + /* + * Do not include the body part in the output data stream. + */ + data->set.opt_no_body = (bool)(0 != va_arg(param, long)); + break; + case CURLOPT_FAILONERROR: + /* + * Don't output the >=300 error code HTML-page, but instead only + * return error. + */ + data->set.http_fail_on_error = (bool)(0 != va_arg(param, long)); + break; + case CURLOPT_UPLOAD: + case CURLOPT_PUT: + /* + * We want to sent data to the remote host. If this is HTTP, that equals + * using the PUT request. + */ + data->set.upload = (bool)(0 != va_arg(param, long)); + if(data->set.upload) { + /* If this is HTTP, PUT is what's needed to "upload" */ + data->set.httpreq = HTTPREQ_PUT; + data->set.opt_no_body = FALSE; /* this is implied */ + } + else + /* In HTTP, the opposite of upload is GET (unless NOBODY is true as + then this can be changed to HEAD later on) */ + data->set.httpreq = HTTPREQ_GET; + break; + case CURLOPT_FILETIME: + /* + * Try to get the file time of the remote document. The time will + * later (possibly) become available using curl_easy_getinfo(). + */ + data->set.get_filetime = (bool)(0 != va_arg(param, long)); + break; + case CURLOPT_FTP_CREATE_MISSING_DIRS: + /* + * An FTP option that modifies an upload to create missing directories on + * the server. + */ + switch(va_arg(param, long)) { + case 0: + data->set.ftp_create_missing_dirs = 0; + break; + case 1: + data->set.ftp_create_missing_dirs = 1; + break; + case 2: + data->set.ftp_create_missing_dirs = 2; + break; + default: + /* reserve other values for future use */ + result = CURLE_FAILED_INIT; + break; + } + break; + case CURLOPT_SERVER_RESPONSE_TIMEOUT: + /* + * Option that specifies how quickly an server response must be obtained + * before it is considered failure. For pingpong protocols. + */ + data->set.server_response_timeout = va_arg( param , long ) * 1000; + break; + case CURLOPT_TFTP_BLKSIZE: + /* + * TFTP option that specifies the block size to use for data transmission + */ + data->set.tftp_blksize = va_arg(param, long); + break; + case CURLOPT_DIRLISTONLY: + /* + * An option that changes the command to one that asks for a list + * only, no file info details. + */ + data->set.ftp_list_only = (bool)(0 != va_arg(param, long)); + break; + case CURLOPT_APPEND: + /* + * We want to upload and append to an existing file. + */ + data->set.ftp_append = (bool)(0 != va_arg(param, long)); + break; + case CURLOPT_FTP_FILEMETHOD: + /* + * How do access files over FTP. + */ + data->set.ftp_filemethod = (curl_ftpfile)va_arg(param, long); + break; + case CURLOPT_NETRC: + /* + * Parse the $HOME/.netrc file + */ + data->set.use_netrc = (enum CURL_NETRC_OPTION)va_arg(param, long); + break; + case CURLOPT_NETRC_FILE: + /* + * Use this file instead of the $HOME/.netrc file + */ + result = setstropt(&data->set.str[STRING_NETRC_FILE], + va_arg(param, char *)); + break; + case CURLOPT_TRANSFERTEXT: + /* + * This option was previously named 'FTPASCII'. Renamed to work with + * more protocols than merely FTP. + * + * Transfer using ASCII (instead of BINARY). + */ + data->set.prefer_ascii = (bool)(0 != va_arg(param, long)); + break; + case CURLOPT_TIMECONDITION: + /* + * Set HTTP time condition. This must be one of the defines in the + * curl/curl.h header file. + */ + data->set.timecondition = (curl_TimeCond)va_arg(param, long); + break; + case CURLOPT_TIMEVALUE: + /* + * This is the value to compare with the remote document with the + * method set with CURLOPT_TIMECONDITION + */ + data->set.timevalue = (time_t)va_arg(param, long); + break; + case CURLOPT_SSLVERSION: + /* + * Set explicit SSL version to try to connect with, as some SSL + * implementations are lame. + */ + data->set.ssl.version = va_arg(param, long); + break; + +#ifndef CURL_DISABLE_HTTP + case CURLOPT_AUTOREFERER: + /* + * Switch on automatic referer that gets set if curl follows locations. + */ + data->set.http_auto_referer = (bool)(0 != va_arg(param, long)); + break; + + case CURLOPT_ENCODING: + /* + * String to use at the value of Accept-Encoding header. + * + * If the encoding is set to "" we use an Accept-Encoding header that + * encompasses all the encodings we support. + * If the encoding is set to NULL we don't send an Accept-Encoding header + * and ignore an received Content-Encoding header. + * + */ + argptr = va_arg(param, char *); + result = setstropt(&data->set.str[STRING_ENCODING], + (argptr && !*argptr)? + (char *) ALL_CONTENT_ENCODINGS: argptr); + break; + + case CURLOPT_FOLLOWLOCATION: + /* + * Follow Location: header hints on a HTTP-server. + */ + data->set.http_follow_location = (bool)(0 != va_arg(param, long)); + break; + + case CURLOPT_UNRESTRICTED_AUTH: + /* + * Send authentication (user+password) when following locations, even when + * hostname changed. + */ + data->set.http_disable_hostname_check_before_authentication = + (bool)(0 != va_arg(param, long)); + break; + + case CURLOPT_MAXREDIRS: + /* + * The maximum amount of hops you allow curl to follow Location: + * headers. This should mostly be used to detect never-ending loops. + */ + data->set.maxredirs = va_arg(param, long); + break; + + case CURLOPT_POSTREDIR: + { + /* + * Set the behaviour of POST when redirecting + * CURL_REDIR_GET_ALL - POST is changed to GET after 301 and 302 + * CURL_REDIR_POST_301 - POST is kept as POST after 301 + * CURL_REDIR_POST_302 - POST is kept as POST after 302 + * CURL_REDIR_POST_ALL - POST is kept as POST after 301 and 302 + * other - POST is kept as POST after 301 and 302 + */ + long postRedir = va_arg(param, long); + data->set.post301 = (bool)((postRedir & CURL_REDIR_POST_301)?TRUE:FALSE); + data->set.post302 = (bool)((postRedir & CURL_REDIR_POST_302)?TRUE:FALSE); + } + break; + + case CURLOPT_POST: + /* Does this option serve a purpose anymore? Yes it does, when + CURLOPT_POSTFIELDS isn't used and the POST data is read off the + callback! */ + if(va_arg(param, long)) { + data->set.httpreq = HTTPREQ_POST; + data->set.opt_no_body = FALSE; /* this is implied */ + } + else + data->set.httpreq = HTTPREQ_GET; + break; + + case CURLOPT_COPYPOSTFIELDS: + /* + * A string with POST data. Makes curl HTTP POST. Even if it is NULL. + * If needed, CURLOPT_POSTFIELDSIZE must have been set prior to + * CURLOPT_COPYPOSTFIELDS and not altered later. + */ + argptr = va_arg(param, char *); + + if(!argptr || data->set.postfieldsize == -1) + result = setstropt(&data->set.str[STRING_COPYPOSTFIELDS], argptr); + else { + /* + * Check that requested length does not overflow the size_t type. + */ + + if((data->set.postfieldsize < 0) || + ((sizeof(curl_off_t) != sizeof(size_t)) && + (data->set.postfieldsize > (curl_off_t)((size_t)-1)))) + result = CURLE_OUT_OF_MEMORY; + else { + char * p; + + (void) setstropt(&data->set.str[STRING_COPYPOSTFIELDS], NULL); + + /* Allocate even when size == 0. This satisfies the need of possible + later address compare to detect the COPYPOSTFIELDS mode, and + to mark that postfields is used rather than read function or + form data. + */ + p = malloc((size_t)(data->set.postfieldsize? + data->set.postfieldsize:1)); + + if(!p) + result = CURLE_OUT_OF_MEMORY; + else { + if(data->set.postfieldsize) + memcpy(p, argptr, (size_t)data->set.postfieldsize); + + data->set.str[STRING_COPYPOSTFIELDS] = p; + } + } + } + + data->set.postfields = data->set.str[STRING_COPYPOSTFIELDS]; + data->set.httpreq = HTTPREQ_POST; + break; + + case CURLOPT_POSTFIELDS: + /* + * Like above, but use static data instead of copying it. + */ + data->set.postfields = va_arg(param, void *); + /* Release old copied data. */ + (void) setstropt(&data->set.str[STRING_COPYPOSTFIELDS], NULL); + data->set.httpreq = HTTPREQ_POST; + break; + + case CURLOPT_POSTFIELDSIZE: + /* + * The size of the POSTFIELD data to prevent libcurl to do strlen() to + * figure it out. Enables binary posts. + */ + bigsize = va_arg(param, long); + + if(data->set.postfieldsize < bigsize && + data->set.postfields == data->set.str[STRING_COPYPOSTFIELDS]) { + /* Previous CURLOPT_COPYPOSTFIELDS is no longer valid. */ + (void) setstropt(&data->set.str[STRING_COPYPOSTFIELDS], NULL); + data->set.postfields = NULL; + } + + data->set.postfieldsize = bigsize; + break; + + case CURLOPT_POSTFIELDSIZE_LARGE: + /* + * The size of the POSTFIELD data to prevent libcurl to do strlen() to + * figure it out. Enables binary posts. + */ + bigsize = va_arg(param, curl_off_t); + + if(data->set.postfieldsize < bigsize && + data->set.postfields == data->set.str[STRING_COPYPOSTFIELDS]) { + /* Previous CURLOPT_COPYPOSTFIELDS is no longer valid. */ + (void) setstropt(&data->set.str[STRING_COPYPOSTFIELDS], NULL); + data->set.postfields = NULL; + } + + data->set.postfieldsize = bigsize; + break; + + case CURLOPT_HTTPPOST: + /* + * Set to make us do HTTP POST + */ + data->set.httppost = va_arg(param, struct curl_httppost *); + data->set.httpreq = HTTPREQ_POST_FORM; + data->set.opt_no_body = FALSE; /* this is implied */ + break; + + case CURLOPT_REFERER: + /* + * String to set in the HTTP Referer: field. + */ + if(data->change.referer_alloc) { + free(data->change.referer); + data->change.referer_alloc = FALSE; + } + result = setstropt(&data->set.str[STRING_SET_REFERER], + va_arg(param, char *)); + data->change.referer = data->set.str[STRING_SET_REFERER]; + break; + + case CURLOPT_USERAGENT: + /* + * String to use in the HTTP User-Agent field + */ + result = setstropt(&data->set.str[STRING_USERAGENT], + va_arg(param, char *)); + break; + + case CURLOPT_HTTPHEADER: + /* + * Set a list with HTTP headers to use (or replace internals with) + */ + data->set.headers = va_arg(param, struct curl_slist *); + break; + + case CURLOPT_HTTP200ALIASES: + /* + * Set a list of aliases for HTTP 200 in response header + */ + data->set.http200aliases = va_arg(param, struct curl_slist *); + break; + +#if !defined(CURL_DISABLE_COOKIES) + case CURLOPT_COOKIE: + /* + * Cookie string to send to the remote server in the request. + */ + result = setstropt(&data->set.str[STRING_COOKIE], + va_arg(param, char *)); + break; + + case CURLOPT_COOKIEFILE: + /* + * Set cookie file to read and parse. Can be used multiple times. + */ + argptr = (char *)va_arg(param, void *); + if(argptr) { + struct curl_slist *cl; + /* append the cookie file name to the list of file names, and deal with + them later */ + cl = curl_slist_append(data->change.cookielist, argptr); + + if(!cl) + return CURLE_OUT_OF_MEMORY; + + data->change.cookielist = cl; /* store the list for later use */ + } + break; + + case CURLOPT_COOKIEJAR: + /* + * Set cookie file name to dump all cookies to when we're done. + */ + result = setstropt(&data->set.str[STRING_COOKIEJAR], + va_arg(param, char *)); + + /* + * Activate the cookie parser. This may or may not already + * have been made. + */ + data->cookies = Curl_cookie_init(data, NULL, data->cookies, + data->set.cookiesession); + break; + + case CURLOPT_COOKIESESSION: + /* + * Set this option to TRUE to start a new "cookie session". It will + * prevent the forthcoming read-cookies-from-file actions to accept + * cookies that are marked as being session cookies, as they belong to a + * previous session. + * + * In the original Netscape cookie spec, "session cookies" are cookies + * with no expire date set. RFC2109 describes the same action if no + * 'Max-Age' is set and RFC2965 includes the RFC2109 description and adds + * a 'Discard' action that can enforce the discard even for cookies that + * have a Max-Age. + * + * We run mostly with the original cookie spec, as hardly anyone implements + * anything else. + */ + data->set.cookiesession = (bool)(0 != va_arg(param, long)); + break; + + case CURLOPT_COOKIELIST: + argptr = va_arg(param, char *); + + if(argptr == NULL) + break; + + if(Curl_raw_equal(argptr, "ALL")) { + /* clear all cookies */ + Curl_cookie_clearall(data->cookies); + break; + } + else if(Curl_raw_equal(argptr, "SESS")) { + /* clear session cookies */ + Curl_cookie_clearsess(data->cookies); + break; + } + else if(Curl_raw_equal(argptr, "FLUSH")) { + /* flush cookies to file */ + flush_cookies(data, 0); + break; + } + + if(!data->cookies) + /* if cookie engine was not running, activate it */ + data->cookies = Curl_cookie_init(data, NULL, NULL, TRUE); + + argptr = strdup(argptr); + if(!argptr) { + result = CURLE_OUT_OF_MEMORY; + break; + } + + if(checkprefix("Set-Cookie:", argptr)) + /* HTTP Header format line */ + Curl_cookie_add(data, data->cookies, TRUE, argptr + 11, NULL, NULL); + + else + /* Netscape format line */ + Curl_cookie_add(data, data->cookies, FALSE, argptr, NULL, NULL); + + free(argptr); + break; +#endif /* CURL_DISABLE_COOKIES */ + + case CURLOPT_HTTPGET: + /* + * Set to force us do HTTP GET + */ + if(va_arg(param, long)) { + data->set.httpreq = HTTPREQ_GET; + data->set.upload = FALSE; /* switch off upload */ + data->set.opt_no_body = FALSE; /* this is implied */ + } + break; + + case CURLOPT_HTTP_VERSION: + /* + * This sets a requested HTTP version to be used. The value is one of + * the listed enums in curl/curl.h. + */ + data->set.httpversion = va_arg(param, long); + break; + + case CURLOPT_HTTPAUTH: + /* + * Set HTTP Authentication type BITMASK. + */ + { + long auth = va_arg(param, long); + + /* the DIGEST_IE bit is only used to set a special marker, for all the + rest we need to handle it as normal DIGEST */ + data->state.authhost.iestyle = (bool)((auth & CURLAUTH_DIGEST_IE)? + TRUE:FALSE); + + if(auth & CURLAUTH_DIGEST_IE) { + auth |= CURLAUTH_DIGEST; /* set standard digest bit */ + auth &= ~CURLAUTH_DIGEST_IE; /* unset ie digest bit */ + } + + /* switch off bits we can't support */ +#ifndef USE_NTLM + auth &= ~CURLAUTH_NTLM; /* no NTLM without SSL */ +#endif +#ifndef HAVE_GSSAPI + auth &= ~CURLAUTH_GSSNEGOTIATE; /* no GSS-Negotiate without GSSAPI */ +#endif + if(!auth) + return CURLE_FAILED_INIT; /* no supported types left! */ + + data->set.httpauth = auth; + } + break; + +#endif /* CURL_DISABLE_HTTP */ + + case CURLOPT_CUSTOMREQUEST: + /* + * Set a custom string to use as request + */ + result = setstropt(&data->set.str[STRING_CUSTOMREQUEST], + va_arg(param, char *)); + + /* we don't set + data->set.httpreq = HTTPREQ_CUSTOM; + here, we continue as if we were using the already set type + and this just changes the actual request keyword */ + break; + +#ifndef CURL_DISABLE_PROXY + case CURLOPT_HTTPPROXYTUNNEL: + /* + * Tunnel operations through the proxy instead of normal proxy use + */ + data->set.tunnel_thru_httpproxy = (bool)(0 != va_arg(param, long)); + break; + + case CURLOPT_PROXYPORT: + /* + * Explicitly set HTTP proxy port number. + */ + data->set.proxyport = va_arg(param, long); + break; + + case CURLOPT_PROXYAUTH: + /* + * Set HTTP Authentication type BITMASK. + */ + { + long auth = va_arg(param, long); + + /* the DIGEST_IE bit is only used to set a special marker, for all the + rest we need to handle it as normal DIGEST */ + data->state.authproxy.iestyle = (bool)((auth & CURLAUTH_DIGEST_IE)? + TRUE:FALSE); + + if(auth & CURLAUTH_DIGEST_IE) { + auth |= CURLAUTH_DIGEST; /* set standard digest bit */ + auth &= ~CURLAUTH_DIGEST_IE; /* unset ie digest bit */ + } + /* switch off bits we can't support */ +#ifndef USE_NTLM + auth &= ~CURLAUTH_NTLM; /* no NTLM without SSL */ +#endif +#ifndef HAVE_GSSAPI + auth &= ~CURLAUTH_GSSNEGOTIATE; /* no GSS-Negotiate without GSSAPI */ +#endif + if(!auth) + return CURLE_FAILED_INIT; /* no supported types left! */ + + data->set.proxyauth = auth; + } + break; + + case CURLOPT_PROXY: + /* + * Set proxy server:port to use as HTTP proxy. + * + * If the proxy is set to "" we explicitly say that we don't want to use a + * proxy (even though there might be environment variables saying so). + * + * Setting it to NULL, means no proxy but allows the environment variables + * to decide for us. + */ + result = setstropt(&data->set.str[STRING_PROXY], + va_arg(param, char *)); + break; + + case CURLOPT_PROXYTYPE: + /* + * Set proxy type. HTTP/HTTP_1_0/SOCKS4/SOCKS4a/SOCKS5/SOCKS5_HOSTNAME + */ + data->set.proxytype = (curl_proxytype)va_arg(param, long); + break; + + case CURLOPT_PROXY_TRANSFER_MODE: + /* + * set transfer mode (;type=) when doing FTP via an HTTP proxy + */ + switch (va_arg(param, long)) { + case 0: + data->set.proxy_transfer_mode = FALSE; + break; + case 1: + data->set.proxy_transfer_mode = TRUE; + break; + default: + /* reserve other values for future use */ + result = CURLE_FAILED_INIT; + break; + } + break; +#endif /* CURL_DISABLE_PROXY */ + +#if defined(HAVE_GSSAPI) || defined(USE_WINDOWS_SSPI) + case CURLOPT_SOCKS5_GSSAPI_SERVICE: + /* + * Set gssapi service name + */ + result = setstropt(&data->set.str[STRING_SOCKS5_GSSAPI_SERVICE], + va_arg(param, char *)); + break; + + case CURLOPT_SOCKS5_GSSAPI_NEC: + /* + * set flag for nec socks5 support + */ + data->set.socks5_gssapi_nec = (bool)(0 != va_arg(param, long)); + break; +#endif + + case CURLOPT_WRITEHEADER: + /* + * Custom pointer to pass the header write callback function + */ + data->set.writeheader = (void *)va_arg(param, void *); + break; + case CURLOPT_ERRORBUFFER: + /* + * Error buffer provided by the caller to get the human readable + * error string in. + */ + data->set.errorbuffer = va_arg(param, char *); + break; + case CURLOPT_FILE: + /* + * FILE pointer to write to or include in the data write callback + */ + data->set.out = va_arg(param, FILE *); + break; + case CURLOPT_FTPPORT: + /* + * Use FTP PORT, this also specifies which IP address to use + */ + result = setstropt(&data->set.str[STRING_FTPPORT], + va_arg(param, char *)); + data->set.ftp_use_port = (bool)(NULL != data->set.str[STRING_FTPPORT]); + break; + + case CURLOPT_FTP_USE_EPRT: + data->set.ftp_use_eprt = (bool)(0 != va_arg(param, long)); + break; + + case CURLOPT_FTP_USE_EPSV: + data->set.ftp_use_epsv = (bool)(0 != va_arg(param, long)); + break; + + case CURLOPT_FTP_USE_PRET: + data->set.ftp_use_pret = (bool)(0 != va_arg(param, long)); + break; + + case CURLOPT_FTP_SSL_CCC: + data->set.ftp_ccc = (curl_ftpccc)va_arg(param, long); + break; + + case CURLOPT_FTP_SKIP_PASV_IP: + /* + * Enable or disable FTP_SKIP_PASV_IP, which will disable/enable the + * bypass of the IP address in PASV responses. + */ + data->set.ftp_skip_ip = (bool)(0 != va_arg(param, long)); + break; + + case CURLOPT_INFILE: + /* + * FILE pointer to read the file to be uploaded from. Or possibly + * used as argument to the read callback. + */ + data->set.in = va_arg(param, FILE *); + break; + case CURLOPT_INFILESIZE: + /* + * If known, this should inform curl about the file size of the + * to-be-uploaded file. + */ + data->set.infilesize = va_arg(param, long); + break; + case CURLOPT_INFILESIZE_LARGE: + /* + * If known, this should inform curl about the file size of the + * to-be-uploaded file. + */ + data->set.infilesize = va_arg(param, curl_off_t); + break; + case CURLOPT_LOW_SPEED_LIMIT: + /* + * The low speed limit that if transfers are below this for + * CURLOPT_LOW_SPEED_TIME, the transfer is aborted. + */ + data->set.low_speed_limit=va_arg(param, long); + break; + case CURLOPT_MAX_SEND_SPEED_LARGE: + /* + * When transfer uploads are faster then CURLOPT_MAX_SEND_SPEED_LARGE + * bytes per second the transfer is throttled.. + */ + data->set.max_send_speed=va_arg(param, curl_off_t); + break; + case CURLOPT_MAX_RECV_SPEED_LARGE: + /* + * When receiving data faster than CURLOPT_MAX_RECV_SPEED_LARGE bytes per + * second the transfer is throttled.. + */ + data->set.max_recv_speed=va_arg(param, curl_off_t); + break; + case CURLOPT_LOW_SPEED_TIME: + /* + * The low speed time that if transfers are below the set + * CURLOPT_LOW_SPEED_LIMIT during this time, the transfer is aborted. + */ + data->set.low_speed_time=va_arg(param, long); + break; + case CURLOPT_URL: + /* + * The URL to fetch. + */ + if(data->change.url_alloc) { + /* the already set URL is allocated, free it first! */ + free(data->change.url); + data->change.url_alloc=FALSE; + } + result = setstropt(&data->set.str[STRING_SET_URL], + va_arg(param, char *)); + data->change.url = data->set.str[STRING_SET_URL]; + break; + case CURLOPT_PORT: + /* + * The port number to use when getting the URL + */ + data->set.use_port = va_arg(param, long); + break; + case CURLOPT_TIMEOUT: + /* + * The maximum time you allow curl to use for a single transfer + * operation. + */ + data->set.timeout = va_arg(param, long) * 1000L; + break; + + case CURLOPT_TIMEOUT_MS: + data->set.timeout = va_arg(param, long); + break; + + case CURLOPT_CONNECTTIMEOUT: + /* + * The maximum time you allow curl to use to connect. + */ + data->set.connecttimeout = va_arg(param, long) * 1000L; + break; + + case CURLOPT_CONNECTTIMEOUT_MS: + data->set.connecttimeout = va_arg(param, long); + break; + + case CURLOPT_USERPWD: + /* + * user:password to use in the operation + */ + result = setstropt_userpwd(va_arg(param, char *), + &data->set.str[STRING_USERNAME], + &data->set.str[STRING_PASSWORD]); + break; + case CURLOPT_USERNAME: + /* + * authentication user name to use in the operation + */ + result = setstropt(&data->set.str[STRING_USERNAME], + va_arg(param, char *)); + break; + case CURLOPT_PASSWORD: + /* + * authentication password to use in the operation + */ + result = setstropt(&data->set.str[STRING_PASSWORD], + va_arg(param, char *)); + break; + case CURLOPT_POSTQUOTE: + /* + * List of RAW FTP commands to use after a transfer + */ + data->set.postquote = va_arg(param, struct curl_slist *); + break; + case CURLOPT_PREQUOTE: + /* + * List of RAW FTP commands to use prior to RETR (Wesley Laxton) + */ + data->set.prequote = va_arg(param, struct curl_slist *); + break; + case CURLOPT_QUOTE: + /* + * List of RAW FTP commands to use before a transfer + */ + data->set.quote = va_arg(param, struct curl_slist *); + break; + case CURLOPT_RESOLVE: + /* + * List of NAME:[address] names to populate the DNS cache with + * Prefix the NAME with dash (-) to _remove_ the name from the cache. + * + * Names added with this API will remain in the cache until explicitly + * removed or the handle is cleaned up. + * + * This API can remove any name from the DNS cache, but only entries + * that aren't actually in use right now will be pruned immediately. + */ + data->set.resolve = va_arg(param, struct curl_slist *); + data->change.resolve = data->set.resolve; + break; + case CURLOPT_PROGRESSFUNCTION: + /* + * Progress callback function + */ + data->set.fprogress = va_arg(param, curl_progress_callback); + if(data->set.fprogress) + data->progress.callback = TRUE; /* no longer internal */ + else + data->progress.callback = FALSE; /* NULL enforces internal */ + + break; + case CURLOPT_PROGRESSDATA: + /* + * Custom client data to pass to the progress callback + */ + data->set.progress_client = va_arg(param, void *); + break; + +#ifndef CURL_DISABLE_PROXY + case CURLOPT_PROXYUSERPWD: + /* + * user:password needed to use the proxy + */ + result = setstropt_userpwd(va_arg(param, char *), + &data->set.str[STRING_PROXYUSERNAME], + &data->set.str[STRING_PROXYPASSWORD]); + break; + case CURLOPT_PROXYUSERNAME: + /* + * authentication user name to use in the operation + */ + result = setstropt(&data->set.str[STRING_PROXYUSERNAME], + va_arg(param, char *)); + break; + case CURLOPT_PROXYPASSWORD: + /* + * authentication password to use in the operation + */ + result = setstropt(&data->set.str[STRING_PROXYPASSWORD], + va_arg(param, char *)); + break; + case CURLOPT_NOPROXY: + /* + * proxy exception list + */ + result = setstropt(&data->set.str[STRING_NOPROXY], + va_arg(param, char *)); + break; +#endif + + case CURLOPT_RANGE: + /* + * What range of the file you want to transfer + */ + result = setstropt(&data->set.str[STRING_SET_RANGE], + va_arg(param, char *)); + break; + case CURLOPT_RESUME_FROM: + /* + * Resume transfer at the give file position + */ + data->set.set_resume_from = va_arg(param, long); + break; + case CURLOPT_RESUME_FROM_LARGE: + /* + * Resume transfer at the give file position + */ + data->set.set_resume_from = va_arg(param, curl_off_t); + break; + case CURLOPT_DEBUGFUNCTION: + /* + * stderr write callback. + */ + data->set.fdebug = va_arg(param, curl_debug_callback); + /* + * if the callback provided is NULL, it'll use the default callback + */ + break; + case CURLOPT_DEBUGDATA: + /* + * Set to a void * that should receive all error writes. This + * defaults to CURLOPT_STDERR for normal operations. + */ + data->set.debugdata = va_arg(param, void *); + break; + case CURLOPT_STDERR: + /* + * Set to a FILE * that should receive all error writes. This + * defaults to stderr for normal operations. + */ + data->set.err = va_arg(param, FILE *); + if(!data->set.err) + data->set.err = stderr; + break; + case CURLOPT_HEADERFUNCTION: + /* + * Set header write callback + */ + data->set.fwrite_header = va_arg(param, curl_write_callback); + break; + case CURLOPT_WRITEFUNCTION: + /* + * Set data write callback + */ + data->set.fwrite_func = va_arg(param, curl_write_callback); + if(!data->set.fwrite_func) { + data->set.is_fwrite_set = 0; + /* When set to NULL, reset to our internal default function */ + data->set.fwrite_func = (curl_write_callback)fwrite; + } + else + data->set.is_fwrite_set = 1; + break; + case CURLOPT_READFUNCTION: + /* + * Read data callback + */ + data->set.fread_func = va_arg(param, curl_read_callback); + if(!data->set.fread_func) { + data->set.is_fread_set = 0; + /* When set to NULL, reset to our internal default function */ + data->set.fread_func = (curl_read_callback)fread; + } + else + data->set.is_fread_set = 1; + break; + case CURLOPT_SEEKFUNCTION: + /* + * Seek callback. Might be NULL. + */ + data->set.seek_func = va_arg(param, curl_seek_callback); + break; + case CURLOPT_SEEKDATA: + /* + * Seek control callback. Might be NULL. + */ + data->set.seek_client = va_arg(param, void *); + break; + case CURLOPT_CONV_FROM_NETWORK_FUNCTION: + /* + * "Convert from network encoding" callback + */ + data->set.convfromnetwork = va_arg(param, curl_conv_callback); + break; + case CURLOPT_CONV_TO_NETWORK_FUNCTION: + /* + * "Convert to network encoding" callback + */ + data->set.convtonetwork = va_arg(param, curl_conv_callback); + break; + case CURLOPT_CONV_FROM_UTF8_FUNCTION: + /* + * "Convert from UTF-8 encoding" callback + */ + data->set.convfromutf8 = va_arg(param, curl_conv_callback); + break; + case CURLOPT_IOCTLFUNCTION: + /* + * I/O control callback. Might be NULL. + */ + data->set.ioctl_func = va_arg(param, curl_ioctl_callback); + break; + case CURLOPT_IOCTLDATA: + /* + * I/O control data pointer. Might be NULL. + */ + data->set.ioctl_client = va_arg(param, void *); + break; + case CURLOPT_SSLCERT: + /* + * String that holds file name of the SSL certificate to use + */ + result = setstropt(&data->set.str[STRING_CERT], + va_arg(param, char *)); + break; + case CURLOPT_SSLCERTTYPE: + /* + * String that holds file type of the SSL certificate to use + */ + result = setstropt(&data->set.str[STRING_CERT_TYPE], + va_arg(param, char *)); + break; + case CURLOPT_SSLKEY: + /* + * String that holds file name of the SSL key to use + */ + result = setstropt(&data->set.str[STRING_KEY], + va_arg(param, char *)); + break; + case CURLOPT_SSLKEYTYPE: + /* + * String that holds file type of the SSL key to use + */ + result = setstropt(&data->set.str[STRING_KEY_TYPE], + va_arg(param, char *)); + break; + case CURLOPT_KEYPASSWD: + /* + * String that holds the SSL or SSH private key password. + */ + result = setstropt(&data->set.str[STRING_KEY_PASSWD], + va_arg(param, char *)); + break; + case CURLOPT_SSLENGINE: + /* + * String that holds the SSL crypto engine. + */ + argptr = va_arg(param, char *); + if(argptr && argptr[0]) + result = Curl_ssl_set_engine(data, argptr); + break; + + case CURLOPT_SSLENGINE_DEFAULT: + /* + * flag to set engine as default. + */ + result = Curl_ssl_set_engine_default(data); + break; + case CURLOPT_CRLF: + /* + * Kludgy option to enable CRLF conversions. Subject for removal. + */ + data->set.crlf = (bool)(0 != va_arg(param, long)); + break; + + case CURLOPT_INTERFACE: + /* + * Set what interface or address/hostname to bind the socket to when + * performing an operation and thus what from-IP your connection will use. + */ + result = setstropt(&data->set.str[STRING_DEVICE], + va_arg(param, char *)); + break; + case CURLOPT_LOCALPORT: + /* + * Set what local port to bind the socket to when performing an operation. + */ + data->set.localport = curlx_sltous(va_arg(param, long)); + break; + case CURLOPT_LOCALPORTRANGE: + /* + * Set number of local ports to try, starting with CURLOPT_LOCALPORT. + */ + data->set.localportrange = curlx_sltosi(va_arg(param, long)); + break; + case CURLOPT_KRBLEVEL: + /* + * A string that defines the kerberos security level. + */ + result = setstropt(&data->set.str[STRING_KRB_LEVEL], + va_arg(param, char *)); + data->set.krb = (bool)(NULL != data->set.str[STRING_KRB_LEVEL]); + break; + case CURLOPT_SSL_VERIFYPEER: + /* + * Enable peer SSL verifying. + */ + data->set.ssl.verifypeer = va_arg(param, long); + break; + case CURLOPT_SSL_VERIFYHOST: + /* + * Enable verification of the CN contained in the peer certificate + */ + data->set.ssl.verifyhost = va_arg(param, long); + break; +#ifdef USE_SSLEAY + /* since these two options are only possible to use on an OpenSSL- + powered libcurl we #ifdef them on this condition so that libcurls + built against other SSL libs will return a proper error when trying + to set this option! */ + case CURLOPT_SSL_CTX_FUNCTION: + /* + * Set a SSL_CTX callback + */ + data->set.ssl.fsslctx = va_arg(param, curl_ssl_ctx_callback); + break; + case CURLOPT_SSL_CTX_DATA: + /* + * Set a SSL_CTX callback parameter pointer + */ + data->set.ssl.fsslctxp = va_arg(param, void *); + break; + case CURLOPT_CERTINFO: + data->set.ssl.certinfo = (bool)(0 != va_arg(param, long)); + break; +#endif + case CURLOPT_CAINFO: + /* + * Set CA info for SSL connection. Specify file name of the CA certificate + */ + result = setstropt(&data->set.str[STRING_SSL_CAFILE], + va_arg(param, char *)); + break; + case CURLOPT_CAPATH: + /* + * Set CA path info for SSL connection. Specify directory name of the CA + * certificates which have been prepared using openssl c_rehash utility. + */ + /* This does not work on windows. */ + result = setstropt(&data->set.str[STRING_SSL_CAPATH], + va_arg(param, char *)); + break; + case CURLOPT_CRLFILE: + /* + * Set CRL file info for SSL connection. Specify file name of the CRL + * to check certificates revocation + */ + result = setstropt(&data->set.str[STRING_SSL_CRLFILE], + va_arg(param, char *)); + break; + case CURLOPT_ISSUERCERT: + /* + * Set Issuer certificate file + * to check certificates issuer + */ + result = setstropt(&data->set.str[STRING_SSL_ISSUERCERT], + va_arg(param, char *)); + break; + case CURLOPT_TELNETOPTIONS: + /* + * Set a linked list of telnet options + */ + data->set.telnet_options = va_arg(param, struct curl_slist *); + break; + + case CURLOPT_BUFFERSIZE: + /* + * The application kindly asks for a differently sized receive buffer. + * If it seems reasonable, we'll use it. + */ + data->set.buffer_size = va_arg(param, long); + + if((data->set.buffer_size> (BUFSIZE -1 )) || + (data->set.buffer_size < 1)) + data->set.buffer_size = 0; /* huge internal default */ + + break; + + case CURLOPT_NOSIGNAL: + /* + * The application asks not to set any signal() or alarm() handlers, + * even when using a timeout. + */ + data->set.no_signal = (bool)(0 != va_arg(param, long)); + break; + + case CURLOPT_SHARE: + { + struct Curl_share *set; + set = va_arg(param, struct Curl_share *); + + /* disconnect from old share, if any */ + if(data->share) { + Curl_share_lock(data, CURL_LOCK_DATA_SHARE, CURL_LOCK_ACCESS_SINGLE); + + if(data->dns.hostcachetype == HCACHE_SHARED) { + data->dns.hostcache = NULL; + data->dns.hostcachetype = HCACHE_NONE; + } + + if(data->share->cookies == data->cookies) + data->cookies = NULL; + + data->share->dirty--; + + Curl_share_unlock(data, CURL_LOCK_DATA_SHARE); + data->share = NULL; + } + + /* use new share if it set */ + data->share = set; + if(data->share) { + + Curl_share_lock(data, CURL_LOCK_DATA_SHARE, CURL_LOCK_ACCESS_SINGLE); + + data->share->dirty++; + + if(data->share->hostcache) { + /* use shared host cache, first free the private one if any */ + if(data->dns.hostcachetype == HCACHE_PRIVATE) + Curl_hash_destroy(data->dns.hostcache); + + data->dns.hostcache = data->share->hostcache; + data->dns.hostcachetype = HCACHE_SHARED; + } +#if !defined(CURL_DISABLE_HTTP) && !defined(CURL_DISABLE_COOKIES) + if(data->share->cookies) { + /* use shared cookie list, first free own one if any */ + if(data->cookies) + Curl_cookie_cleanup(data->cookies); + /* enable cookies since we now use a share that uses cookies! */ + data->cookies = data->share->cookies; + } +#endif /* CURL_DISABLE_HTTP */ + Curl_share_unlock(data, CURL_LOCK_DATA_SHARE); + + } + /* check for host cache not needed, + * it will be done by curl_easy_perform */ + } + break; + + case CURLOPT_PRIVATE: + /* + * Set private data pointer. + */ + data->set.private_data = va_arg(param, void *); + break; + + case CURLOPT_MAXFILESIZE: + /* + * Set the maximum size of a file to download. + */ + data->set.max_filesize = va_arg(param, long); + break; + +#ifdef USE_SSL + case CURLOPT_USE_SSL: + /* + * Make transfers attempt to use SSL/TLS. + */ + data->set.ftp_ssl = (curl_usessl)va_arg(param, long); + break; +#endif + case CURLOPT_FTPSSLAUTH: + /* + * Set a specific auth for FTP-SSL transfers. + */ + data->set.ftpsslauth = (curl_ftpauth)va_arg(param, long); + break; + + case CURLOPT_IPRESOLVE: + data->set.ipver = va_arg(param, long); + break; + + case CURLOPT_MAXFILESIZE_LARGE: + /* + * Set the maximum size of a file to download. + */ + data->set.max_filesize = va_arg(param, curl_off_t); + break; + + case CURLOPT_TCP_NODELAY: + /* + * Enable or disable TCP_NODELAY, which will disable/enable the Nagle + * algorithm + */ + data->set.tcp_nodelay = (bool)(0 != va_arg(param, long)); + break; + + case CURLOPT_FTP_ACCOUNT: + result = setstropt(&data->set.str[STRING_FTP_ACCOUNT], + va_arg(param, char *)); + break; + + case CURLOPT_IGNORE_CONTENT_LENGTH: + data->set.ignorecl = (bool)(0 != va_arg(param, long)); + break; + + case CURLOPT_CONNECT_ONLY: + /* + * No data transfer, set up connection and let application use the socket + */ + data->set.connect_only = (bool)(0 != va_arg(param, long)); + break; + + case CURLOPT_FTP_ALTERNATIVE_TO_USER: + result = setstropt(&data->set.str[STRING_FTP_ALTERNATIVE_TO_USER], + va_arg(param, char *)); + break; + + case CURLOPT_SOCKOPTFUNCTION: + /* + * socket callback function: called after socket() but before connect() + */ + data->set.fsockopt = va_arg(param, curl_sockopt_callback); + break; + + case CURLOPT_SOCKOPTDATA: + /* + * socket callback data pointer. Might be NULL. + */ + data->set.sockopt_client = va_arg(param, void *); + break; + + case CURLOPT_OPENSOCKETFUNCTION: + /* + * open/create socket callback function: called instead of socket(), + * before connect() + */ + data->set.fopensocket = va_arg(param, curl_opensocket_callback); + break; + + case CURLOPT_OPENSOCKETDATA: + /* + * socket callback data pointer. Might be NULL. + */ + data->set.opensocket_client = va_arg(param, void *); + break; + + case CURLOPT_SSL_SESSIONID_CACHE: + data->set.ssl.sessionid = (bool)(0 != va_arg(param, long)); + break; + +#ifdef USE_LIBSSH2 + /* we only include SSH options if explicitly built to support SSH */ + case CURLOPT_SSH_AUTH_TYPES: + data->set.ssh_auth_types = va_arg(param, long); + break; + + case CURLOPT_SSH_PUBLIC_KEYFILE: + /* + * Use this file instead of the $HOME/.ssh/id_dsa.pub file + */ + result = setstropt(&data->set.str[STRING_SSH_PUBLIC_KEY], + va_arg(param, char *)); + break; + + case CURLOPT_SSH_PRIVATE_KEYFILE: + /* + * Use this file instead of the $HOME/.ssh/id_dsa file + */ + result = setstropt(&data->set.str[STRING_SSH_PRIVATE_KEY], + va_arg(param, char *)); + break; + case CURLOPT_SSH_HOST_PUBLIC_KEY_MD5: + /* + * Option to allow for the MD5 of the host public key to be checked + * for validation purposes. + */ + result = setstropt(&data->set.str[STRING_SSH_HOST_PUBLIC_KEY_MD5], + va_arg(param, char *)); + break; +#ifdef HAVE_LIBSSH2_KNOWNHOST_API + case CURLOPT_SSH_KNOWNHOSTS: + /* + * Store the file name to read known hosts from. + */ + result = setstropt(&data->set.str[STRING_SSH_KNOWNHOSTS], + va_arg(param, char *)); + break; + + case CURLOPT_SSH_KEYFUNCTION: + /* setting to NULL is fine since the ssh.c functions themselves will + then rever to use the internal default */ + data->set.ssh_keyfunc = va_arg(param, curl_sshkeycallback); + break; + + case CURLOPT_SSH_KEYDATA: + /* + * Custom client data to pass to the SSH keyfunc callback + */ + data->set.ssh_keyfunc_userp = va_arg(param, void *); + break; +#endif /* HAVE_LIBSSH2_KNOWNHOST_API */ + +#endif /* USE_LIBSSH2 */ + + case CURLOPT_HTTP_TRANSFER_DECODING: + /* + * disable libcurl transfer encoding is used + */ + data->set.http_te_skip = (bool)(0 == va_arg(param, long)); + break; + + case CURLOPT_HTTP_CONTENT_DECODING: + /* + * raw data passed to the application when content encoding is used + */ + data->set.http_ce_skip = (bool)(0 == va_arg(param, long)); + break; + + case CURLOPT_NEW_FILE_PERMS: + /* + * Uses these permissions instead of 0644 + */ + data->set.new_file_perms = va_arg(param, long); + break; + + case CURLOPT_NEW_DIRECTORY_PERMS: + /* + * Uses these permissions instead of 0755 + */ + data->set.new_directory_perms = va_arg(param, long); + break; + + case CURLOPT_ADDRESS_SCOPE: + /* + * We always get longs when passed plain numericals, but for this value we + * know that an unsigned int will always hold the value so we blindly + * typecast to this type + */ + data->set.scope = curlx_sltoui(va_arg(param, long)); + break; + + case CURLOPT_PROTOCOLS: + /* set the bitmask for the protocols that are allowed to be used for the + transfer, which thus helps the app which takes URLs from users or other + external inputs and want to restrict what protocol(s) to deal + with. Defaults to CURLPROTO_ALL. */ + data->set.allowed_protocols = va_arg(param, long) & PROT_EXTMASK; + break; + + case CURLOPT_REDIR_PROTOCOLS: + /* set the bitmask for the protocols that libcurl is allowed to follow to, + as a subset of the CURLOPT_PROTOCOLS ones. That means the protocol needs + to be set in both bitmasks to be allowed to get redirected to. Defaults + to all protocols except FILE and SCP. */ + data->set.redir_protocols = va_arg(param, long) & PROT_EXTMASK; + break; + + case CURLOPT_MAIL_FROM: + result = setstropt(&data->set.str[STRING_MAIL_FROM], + va_arg(param, char *)); + break; + + case CURLOPT_MAIL_RCPT: + /* get a list of mail recipients */ + data->set.mail_rcpt = va_arg(param, struct curl_slist *); + break; + + case CURLOPT_RTSP_REQUEST: + { + /* + * Set the RTSP request method (OPTIONS, SETUP, PLAY, etc...) + * Would this be better if the RTSPREQ_* were just moved into here? + */ + long curl_rtspreq = va_arg(param, long); + Curl_RtspReq rtspreq = RTSPREQ_NONE; + switch(curl_rtspreq) { + case CURL_RTSPREQ_OPTIONS: + rtspreq = RTSPREQ_OPTIONS; + break; + + case CURL_RTSPREQ_DESCRIBE: + rtspreq = RTSPREQ_DESCRIBE; + break; + + case CURL_RTSPREQ_ANNOUNCE: + rtspreq = RTSPREQ_ANNOUNCE; + break; + + case CURL_RTSPREQ_SETUP: + rtspreq = RTSPREQ_SETUP; + break; + + case CURL_RTSPREQ_PLAY: + rtspreq = RTSPREQ_PLAY; + break; + + case CURL_RTSPREQ_PAUSE: + rtspreq = RTSPREQ_PAUSE; + break; + + case CURL_RTSPREQ_TEARDOWN: + rtspreq = RTSPREQ_TEARDOWN; + break; + + case CURL_RTSPREQ_GET_PARAMETER: + rtspreq = RTSPREQ_GET_PARAMETER; + break; + + case CURL_RTSPREQ_SET_PARAMETER: + rtspreq = RTSPREQ_SET_PARAMETER; + break; + + case CURL_RTSPREQ_RECORD: + rtspreq = RTSPREQ_RECORD; + break; + + case CURL_RTSPREQ_RECEIVE: + rtspreq = RTSPREQ_RECEIVE; + break; + default: + rtspreq = RTSPREQ_NONE; + } + + data->set.rtspreq = rtspreq; + break; + } + + + case CURLOPT_RTSP_SESSION_ID: + /* + * Set the RTSP Session ID manually. Useful if the application is + * resuming a previously established RTSP session + */ + result = setstropt(&data->set.str[STRING_RTSP_SESSION_ID], + va_arg(param, char *)); + break; + + case CURLOPT_RTSP_STREAM_URI: + /* + * Set the Stream URI for the RTSP request. Unless the request is + * for generic server options, the application will need to set this. + */ + result = setstropt(&data->set.str[STRING_RTSP_STREAM_URI], + va_arg(param, char *)); + break; + + case CURLOPT_RTSP_TRANSPORT: + /* + * The content of the Transport: header for the RTSP request + */ + result = setstropt(&data->set.str[STRING_RTSP_TRANSPORT], + va_arg(param, char *)); + break; + + case CURLOPT_RTSP_CLIENT_CSEQ: + /* + * Set the CSEQ number to issue for the next RTSP request. Useful if the + * application is resuming a previously broken connection. The CSEQ + * will increment from this new number henceforth. + */ + data->state.rtsp_next_client_CSeq = va_arg(param, long); + break; + + case CURLOPT_RTSP_SERVER_CSEQ: + /* Same as the above, but for server-initiated requests */ + data->state.rtsp_next_client_CSeq = va_arg(param, long); + break; + + case CURLOPT_INTERLEAVEDATA: + data->set.rtp_out = va_arg(param, void *); + break; + case CURLOPT_INTERLEAVEFUNCTION: + /* Set the user defined RTP write function */ + data->set.fwrite_rtp = va_arg(param, curl_write_callback); + break; + + case CURLOPT_WILDCARDMATCH: + data->set.wildcardmatch = (bool)(0 != va_arg(param, long)); + break; + case CURLOPT_CHUNK_BGN_FUNCTION: + data->set.chunk_bgn = va_arg(param, curl_chunk_bgn_callback); + break; + case CURLOPT_CHUNK_END_FUNCTION: + data->set.chunk_end = va_arg(param, curl_chunk_end_callback); + break; + case CURLOPT_FNMATCH_FUNCTION: + data->set.fnmatch = va_arg(param, curl_fnmatch_callback); + break; + case CURLOPT_CHUNK_DATA: + data->wildcard.customptr = va_arg(param, void *); + break; + case CURLOPT_FNMATCH_DATA: + data->set.fnmatch_data = va_arg(param, void *); + break; + default: + /* unknown tag and its companion, just ignore: */ + result = CURLE_FAILED_INIT; /* correct this */ + break; + } + + return result; +} + +static void conn_free(struct connectdata *conn) +{ + if(!conn) + return; + + /* close the SSL stuff before we close any sockets since they will/may + write to the sockets */ + Curl_ssl_close(conn, FIRSTSOCKET); + Curl_ssl_close(conn, SECONDARYSOCKET); + + /* close possibly still open sockets */ + if(CURL_SOCKET_BAD != conn->sock[SECONDARYSOCKET]) + sclose(conn->sock[SECONDARYSOCKET]); + if(CURL_SOCKET_BAD != conn->sock[FIRSTSOCKET]) + sclose(conn->sock[FIRSTSOCKET]); + + Curl_safefree(conn->user); + Curl_safefree(conn->passwd); + Curl_safefree(conn->proxyuser); + Curl_safefree(conn->proxypasswd); + Curl_safefree(conn->allocptr.proxyuserpwd); + Curl_safefree(conn->allocptr.uagent); + Curl_safefree(conn->allocptr.userpwd); + Curl_safefree(conn->allocptr.accept_encoding); + Curl_safefree(conn->allocptr.rangeline); + Curl_safefree(conn->allocptr.ref); + Curl_safefree(conn->allocptr.host); + Curl_safefree(conn->allocptr.cookiehost); + Curl_safefree(conn->allocptr.rtsp_transport); + Curl_safefree(conn->trailer); + Curl_safefree(conn->host.rawalloc); /* host name buffer */ + Curl_safefree(conn->proxy.rawalloc); /* proxy name buffer */ + Curl_safefree(conn->master_buffer); + + Curl_llist_destroy(conn->send_pipe, NULL); + Curl_llist_destroy(conn->recv_pipe, NULL); + Curl_llist_destroy(conn->pend_pipe, NULL); + Curl_llist_destroy(conn->done_pipe, NULL); + + /* possible left-overs from the async name resolvers */ +#if defined(CURLRES_THREADED) + Curl_destroy_thread_data(&conn->async); +#elif defined(CURLRES_ASYNCH) + Curl_safefree(conn->async.hostname); + Curl_safefree(conn->async.os_specific); +#endif + + Curl_free_ssl_config(&conn->ssl_config); + + free(conn); /* free all the connection oriented data */ +} + +CURLcode Curl_disconnect(struct connectdata *conn, bool dead_connection) +{ + struct SessionHandle *data; + if(!conn) + return CURLE_OK; /* this is closed and fine already */ + data = conn->data; + + if(!data) { + DEBUGF(infof(data, "DISCONNECT without easy handle, ignoring\n")); + return CURLE_OK; + } + + if(conn->dns_entry != NULL) { + Curl_resolv_unlock(data, conn->dns_entry); + conn->dns_entry = NULL; + } + +#if defined(DEBUGBUILD) && defined(AGGRESIVE_TEST) + /* scan for DNS cache entries still marked as in use */ + Curl_hash_apply(data->hostcache, + NULL, Curl_scan_cache_used); +#endif + + Curl_hostcache_prune(data); /* kill old DNS cache entries */ + + { + int has_host_ntlm = (conn->ntlm.state != NTLMSTATE_NONE); + int has_proxy_ntlm = (conn->proxyntlm.state != NTLMSTATE_NONE); + + /* Authentication data is a mix of connection-related and sessionhandle- + related stuff. NTLM is connection-related so when we close the shop + we shall forget. */ + + if (has_host_ntlm) { + data->state.authhost.done = FALSE; + data->state.authhost.picked = + data->state.authhost.want; + } + + if (has_proxy_ntlm) { + data->state.authproxy.done = FALSE; + data->state.authproxy.picked = + data->state.authproxy.want; + } + + if (has_host_ntlm || has_proxy_ntlm) { + data->state.authproblem = FALSE; + + Curl_ntlm_cleanup(conn); + } + } + + /* Cleanup possible redirect junk */ + if(data->req.newurl) { + free(data->req.newurl); + data->req.newurl = NULL; + } + + if(conn->handler->disconnect) + /* This is set if protocol-specific cleanups should be made */ + conn->handler->disconnect(conn, dead_connection); + + if(-1 != conn->connectindex) { + /* unlink ourselves! */ + infof(data, "Closing connection #%ld\n", conn->connectindex); + if(data->state.connc) + /* only clear the table entry if we still know in which cache we + used to be in */ + data->state.connc->connects[conn->connectindex] = NULL; + } + +#ifdef USE_LIBIDN + if(conn->host.encalloc) + idn_free(conn->host.encalloc); /* encoded host name buffer, must be freed + with idn_free() since this was allocated + by libidn */ + if(conn->proxy.encalloc) + idn_free(conn->proxy.encalloc); /* encoded proxy name buffer, must be + freed with idn_free() since this was + allocated by libidn */ +#endif + + Curl_ssl_close(conn, FIRSTSOCKET); + + /* Indicate to all handles on the pipe that we're dead */ + if(Curl_isPipeliningEnabled(data)) { + signalPipeClose(conn->send_pipe, TRUE); + signalPipeClose(conn->recv_pipe, TRUE); + signalPipeClose(conn->pend_pipe, TRUE); + signalPipeClose(conn->done_pipe, FALSE); + } + + conn_free(conn); + data->state.current_conn = NULL; + + return CURLE_OK; +} + +/* + * This function should return TRUE if the socket is to be assumed to + * be dead. Most commonly this happens when the server has closed the + * connection due to inactivity. + */ +static bool SocketIsDead(curl_socket_t sock) +{ + int sval; + bool ret_val = TRUE; + + sval = Curl_socket_ready(sock, CURL_SOCKET_BAD, 0); + if(sval == 0) + /* timeout */ + ret_val = FALSE; + + return ret_val; +} + +#ifndef CURL_DISABLE_RTSP +/* + * The server may send us RTP data at any point, and RTSPREQ_RECEIVE does not + * want to block the application forever while receiving a stream. Therefore, + * we cannot assume that an RTSP socket is dead just because it is readable. + * + * Instead, if it is readable, run Curl_getconnectinfo() to peek at the socket + * and distinguish between closed and data. + */ +static bool RTSPConnIsDead(struct connectdata *check) +{ + int sval; + bool ret_val = TRUE; + + sval = Curl_socket_ready(check->sock[FIRSTSOCKET], CURL_SOCKET_BAD, 0); + if(sval == 0) { + /* timeout */ + ret_val = FALSE; + } + else if (sval & CURL_CSELECT_ERR) { + /* socket is in an error state */ + ret_val = TRUE; + } + else if (sval & CURL_CSELECT_IN) { + /* readable with no error. could be closed or could be alive */ + curl_socket_t connectinfo = + Curl_getconnectinfo(check->data, &check); + if(connectinfo != CURL_SOCKET_BAD) + ret_val = FALSE; + } + + return ret_val; +} +#endif /* CURL_DISABLE_RTSP */ + +static bool IsPipeliningPossible(const struct SessionHandle *handle, + const struct connectdata *conn) +{ + if((conn->handler->protocol & PROT_HTTP) && + handle->multi && Curl_multi_canPipeline(handle->multi) && + (handle->set.httpreq == HTTPREQ_GET || + handle->set.httpreq == HTTPREQ_HEAD) && + handle->set.httpversion != CURL_HTTP_VERSION_1_0) + return TRUE; + + return FALSE; +} + +bool Curl_isPipeliningEnabled(const struct SessionHandle *handle) +{ + if(handle->multi && Curl_multi_canPipeline(handle->multi)) + return TRUE; + + return FALSE; +} + +CURLcode Curl_addHandleToPipeline(struct SessionHandle *data, + struct curl_llist *pipeline) +{ + if(!Curl_llist_insert_next(pipeline, pipeline->tail, data)) + return CURLE_OUT_OF_MEMORY; + return CURLE_OK; +} + +int Curl_removeHandleFromPipeline(struct SessionHandle *handle, + struct curl_llist *pipeline) +{ + struct curl_llist_element *curr; + + curr = pipeline->head; + while(curr) { + if(curr->ptr == handle) { + Curl_llist_remove(pipeline, curr, NULL); + return 1; /* we removed a handle */ + } + curr = curr->next; + } + + return 0; +} + +#if 0 /* this code is saved here as it is useful for debugging purposes */ +static void Curl_printPipeline(struct curl_llist *pipeline) +{ + struct curl_llist_element *curr; + + curr = pipeline->head; + while(curr) { + struct SessionHandle *data = (struct SessionHandle *) curr->ptr; + infof(data, "Handle in pipeline: %s\n", data->state.path); + curr = curr->next; + } +} +#endif + +static struct SessionHandle* gethandleathead(struct curl_llist *pipeline) +{ + struct curl_llist_element *curr = pipeline->head; + if(curr) { + return (struct SessionHandle *) curr->ptr; + } + + return NULL; +} + +/* remove the specified connection from all (possible) pipelines and related + queues */ +void Curl_getoff_all_pipelines(struct SessionHandle *data, + struct connectdata *conn) +{ + bool recv_head = (bool)(conn->readchannel_inuse && + (gethandleathead(conn->recv_pipe) == data)); + + bool send_head = (bool)(conn->writechannel_inuse && + (gethandleathead(conn->send_pipe) == data)); + + if(Curl_removeHandleFromPipeline(data, conn->recv_pipe) && recv_head) + conn->readchannel_inuse = FALSE; + if(Curl_removeHandleFromPipeline(data, conn->send_pipe) && send_head) + conn->writechannel_inuse = FALSE; + Curl_removeHandleFromPipeline(data, conn->pend_pipe); + Curl_removeHandleFromPipeline(data, conn->done_pipe); +} + +static void signalPipeClose(struct curl_llist *pipeline, bool pipe_broke) +{ + struct curl_llist_element *curr; + + if(!pipeline) + return; + + curr = pipeline->head; + while(curr) { + struct curl_llist_element *next = curr->next; + struct SessionHandle *data = (struct SessionHandle *) curr->ptr; + +#ifdef DEBUGBUILD /* debug-only code */ + if(data->magic != CURLEASY_MAGIC_NUMBER) { + /* MAJOR BADNESS */ + infof(data, "signalPipeClose() found BAAD easy handle\n"); + } +#endif + + if (pipe_broke) + data->state.pipe_broke = TRUE; + Curl_multi_handlePipeBreak(data); + Curl_llist_remove(pipeline, curr, NULL); + curr = next; + } +} + + +/* + * Given one filled in connection struct (named needle), this function should + * detect if there already is one that has all the significant details + * exactly the same and thus should be used instead. + * + * If there is a match, this function returns TRUE - and has marked the + * connection as 'in-use'. It must later be called with ConnectionDone() to + * return back to 'idle' (unused) state. + */ +static bool +ConnectionExists(struct SessionHandle *data, + struct connectdata *needle, + struct connectdata **usethis) +{ + long i; + struct connectdata *check; + bool canPipeline = IsPipeliningPossible(data, needle); + + for(i=0; i< data->state.connc->num; i++) { + bool match = FALSE; + size_t pipeLen = 0; + /* + * Note that if we use a HTTP proxy, we check connections to that + * proxy and not to the actual remote server. + */ + check = data->state.connc->connects[i]; + if(!check) + /* NULL pointer means not filled-in entry */ + continue; + + pipeLen = check->send_pipe->size + check->recv_pipe->size; + + if(check->connectindex == -1) { + check->connectindex = i; /* Set this appropriately since it might have + been set to -1 when the easy was removed + from the multi */ + } + + if(!pipeLen && !check->inuse) { + /* The check for a dead socket makes sense only if there are no + handles in pipeline and the connection isn't already marked in + use */ + bool dead; +#ifndef CURL_DISABLE_RTSP + if(check->protocol & PROT_RTSP) + /* RTSP is a special case due to RTP interleaving */ + dead = RTSPConnIsDead(check); + else +#endif /*CURL_DISABLE_RTSP*/ + dead = SocketIsDead(check->sock[FIRSTSOCKET]); + + if(dead) { + check->data = data; + infof(data, "Connection #%ld seems to be dead!\n", i); + + /* disconnect resources */ + Curl_disconnect(check, /* dead_connection */ TRUE); + data->state.connc->connects[i]=NULL; /* nothing here */ + + continue; + } + } + + if(canPipeline) { + /* Make sure the pipe has only GET requests */ + struct SessionHandle* sh = gethandleathead(check->send_pipe); + struct SessionHandle* rh = gethandleathead(check->recv_pipe); + if(sh) { + if(!IsPipeliningPossible(sh, check)) + continue; + } + else if(rh) { + if(!IsPipeliningPossible(rh, check)) + continue; + } + +#ifdef DEBUGBUILD + if(pipeLen > MAX_PIPELINE_LENGTH) { + infof(data, "BAD! Connection #%ld has too big pipeline!\n", + check->connectindex); + } +#endif + } + else { + if(pipeLen > 0) { + /* can only happen within multi handles, and means that another easy + handle is using this connection */ + continue; + } + +#ifdef CURLRES_ASYNCH + /* ip_addr_str[0] is NUL only if the resolving of the name hasn't + completed yet and until then we don't re-use this connection */ + if(!check->ip_addr_str[0]) { + infof(data, + "Connection #%ld hasn't finished name resolve, can't reuse\n", + check->connectindex); + continue; + } +#endif + + if((check->sock[FIRSTSOCKET] == CURL_SOCKET_BAD) || check->bits.close) { + /* Don't pick a connection that hasn't connected yet or that is going + to get closed. */ + infof(data, "Connection #%ld isn't open enough, can't reuse\n", + check->connectindex); +#ifdef DEBUGBUILD + if(check->recv_pipe->size > 0) { + infof(data, "BAD! Unconnected #%ld has a non-empty recv pipeline!\n", + check->connectindex); + } +#endif + continue; + } + } + + if((needle->protocol&PROT_SSL) != (check->protocol&PROT_SSL)) + /* don't do mixed SSL and non-SSL connections */ + continue; + + if(needle->protocol&PROT_SSL) { + if((data->set.ssl.verifypeer != check->verifypeer) || + (data->set.ssl.verifyhost != check->verifyhost)) + continue; + } + + if(needle->bits.proxy != check->bits.proxy) + /* don't do mixed proxy and non-proxy connections */ + continue; + + if(!canPipeline && check->inuse) + /* this request can't be pipelined but the checked connection is already + in use so we skip it */ + continue; + + if(!needle->bits.httpproxy || needle->protocol&PROT_SSL || + (needle->bits.httpproxy && check->bits.httpproxy && + needle->bits.tunnel_proxy && check->bits.tunnel_proxy && + Curl_raw_equal(needle->proxy.name, check->proxy.name) && + (needle->port == check->port))) { + /* The requested connection does not use a HTTP proxy or it uses SSL or + it is a non-SSL protocol tunneled over the same http proxy name and + port number */ + + if(Curl_raw_equal(needle->handler->scheme, check->handler->scheme) && + Curl_raw_equal(needle->host.name, check->host.name) && + (needle->remote_port == check->remote_port) ) { + if(needle->protocol & PROT_SSL) { + /* This is SSL, verify that we're using the same + ssl options as well */ + if(!Curl_ssl_config_matches(&needle->ssl_config, + &check->ssl_config)) { + DEBUGF(infof(data, + "Connection #%ld has different SSL parameters, " + "can't reuse\n", + check->connectindex)); + continue; + } + else if(check->ssl[FIRSTSOCKET].state != ssl_connection_complete) { + DEBUGF(infof(data, + "Connection #%ld has not started ssl connect, " + "can't reuse\n", + check->connectindex)); + continue; + } + } + if((needle->protocol & PROT_FTP) || + ((needle->protocol & PROT_HTTP) && + (data->state.authhost.want==CURLAUTH_NTLM))) { + /* This is FTP or HTTP+NTLM, verify that we're using the same name + and password as well */ + if(!strequal(needle->user, check->user) || + !strequal(needle->passwd, check->passwd)) { + /* one of them was different */ + continue; + } + } + match = TRUE; + } + } + else { /* The requested needle connection is using a proxy, + is the checked one using the same host, port and type? */ + if(check->bits.proxy && + (needle->proxytype == check->proxytype) && + (needle->bits.tunnel_proxy == check->bits.tunnel_proxy) && + Curl_raw_equal(needle->proxy.name, check->proxy.name) && + needle->port == check->port) { + /* This is the same proxy connection, use it! */ + match = TRUE; + } + } + + if(match) { + check->inuse = TRUE; /* mark this as being in use so that no other + handle in a multi stack may nick it */ + + *usethis = check; + return TRUE; /* yes, we found one to use! */ + } + } + + return FALSE; /* no matching connecting exists */ +} + + + +/* + * This function frees/closes a connection in the connection cache. This + * should take the previously set policy into account when deciding which + * of the connections to kill. + */ +static long +ConnectionKillOne(struct SessionHandle *data) +{ + long i; + struct connectdata *conn; + long highscore=-1; + long connindex=-1; + long score; + struct timeval now; + + now = Curl_tvnow(); + + for(i=0; data->state.connc && (i< data->state.connc->num); i++) { + conn = data->state.connc->connects[i]; + + if(!conn || conn->inuse) + continue; + + /* Set higher score for the age passed since the connection was used */ + score = Curl_tvdiff(now, conn->now); + + if(score > highscore) { + highscore = score; + connindex = i; + } + } + if(connindex >= 0) { + /* Set the connection's owner correctly */ + conn = data->state.connc->connects[connindex]; + conn->data = data; + + /* the winner gets the honour of being disconnected */ + (void)Curl_disconnect(conn, /* dead_connection */ FALSE); + + /* clean the array entry */ + data->state.connc->connects[connindex] = NULL; + } + + return connindex; /* return the available index or -1 */ +} + +/* this connection can now be marked 'idle' */ +static void +ConnectionDone(struct connectdata *conn) +{ + conn->inuse = FALSE; +} + +/* + * The given input connection struct pointer is to be stored. If the "cache" + * is already full, we must clean out the most suitable using the previously + * set policy. + * + * The given connection should be unique. That must've been checked prior to + * this call. + */ +static long +ConnectionStore(struct SessionHandle *data, + struct connectdata *conn) +{ + long i; + for(i=0; i< data->state.connc->num; i++) { + if(!data->state.connc->connects[i]) + break; + } + if(i == data->state.connc->num) { + /* there was no room available, kill one */ + i = ConnectionKillOne(data); + if(-1 != i) + infof(data, "Connection (#%ld) was killed to make room (holds %ld)\n", + i, data->state.connc->num); + else + infof(data, "This connection did not fit in the connection cache\n"); + } + + conn->connectindex = i; /* Make the child know where the pointer to this + particular data is stored. But note that this -1 + if this is not within the cache and this is + probably not checked for everywhere (yet). */ + conn->inuse = TRUE; + if(-1 != i) { + /* Only do this if a true index was returned, if -1 was returned there + is no room in the cache for an unknown reason and we cannot store + this there. + + TODO: make sure we really can work with more handles than positions in + the cache, or possibly we should (allow to automatically) resize the + connection cache when we add more easy handles to a multi handle! + */ + data->state.connc->connects[i] = conn; /* fill in this */ + conn->data = data; + } + + return i; +} + +/* after a TCP connection to the proxy has been verified, this function does + the next magic step. + + Note: this function's sub-functions call failf() + +*/ +CURLcode Curl_connected_proxy(struct connectdata *conn) +{ + CURLcode result = CURLE_OK; + struct SessionHandle *data = conn->data; + + switch(data->set.proxytype) { +#ifndef CURL_DISABLE_PROXY + case CURLPROXY_SOCKS5: + case CURLPROXY_SOCKS5_HOSTNAME: + result = Curl_SOCKS5(conn->proxyuser, conn->proxypasswd, + conn->host.name, conn->remote_port, + FIRSTSOCKET, conn); + break; + case CURLPROXY_SOCKS4: + result = Curl_SOCKS4(conn->proxyuser, conn->host.name, + conn->remote_port, FIRSTSOCKET, conn, FALSE); + break; + case CURLPROXY_SOCKS4A: + result = Curl_SOCKS4(conn->proxyuser, conn->host.name, + conn->remote_port, FIRSTSOCKET, conn, TRUE); + break; +#endif /* CURL_DISABLE_PROXY */ + case CURLPROXY_HTTP: + case CURLPROXY_HTTP_1_0: + /* do nothing here. handled later. */ + break; + default: + break; + } /* switch proxytype */ + + return result; +} + +static CURLcode ConnectPlease(struct SessionHandle *data, + struct connectdata *conn, + bool *connected) +{ + CURLcode result; + Curl_addrinfo *addr; +#ifndef CURL_DISABLE_VERBOSE_STRINGS + char *hostname = conn->bits.proxy?conn->proxy.name:conn->host.name; + + infof(data, "About to connect() to %s%s port %ld (#%ld)\n", + conn->bits.proxy?"proxy ":"", + hostname, conn->port, conn->connectindex); +#else + (void)data; +#endif + + /************************************************************* + * Connect to server/proxy + *************************************************************/ + result= Curl_connecthost(conn, + conn->dns_entry, + &conn->sock[FIRSTSOCKET], + &addr, + connected); + if(CURLE_OK == result) { + /* All is cool, we store the current information */ + conn->ip_addr = addr; + + if(*connected) + result = Curl_connected_proxy(conn); + } + + if(result) + *connected = FALSE; /* mark it as not connected */ + + return result; +} + +/* + * verboseconnect() displays verbose information after a connect + */ +#ifndef CURL_DISABLE_VERBOSE_STRINGS +void Curl_verboseconnect(struct connectdata *conn) +{ + if(conn->data->set.verbose) + infof(conn->data, "Connected to %s (%s) port %ld (#%ld)\n", + conn->bits.proxy ? conn->proxy.dispname : conn->host.dispname, + conn->ip_addr_str, conn->port, conn->connectindex); +} +#endif + +int Curl_protocol_getsock(struct connectdata *conn, + curl_socket_t *socks, + int numsocks) +{ + if(conn->handler->proto_getsock) + return conn->handler->proto_getsock(conn, socks, numsocks); + return GETSOCK_BLANK; +} + +int Curl_doing_getsock(struct connectdata *conn, + curl_socket_t *socks, + int numsocks) +{ + if(conn && conn->handler->doing_getsock) + return conn->handler->doing_getsock(conn, socks, numsocks); + return GETSOCK_BLANK; +} + +/* + * We are doing protocol-specific connecting and this is being called over and + * over from the multi interface until the connection phase is done on + * protocol layer. + */ + +CURLcode Curl_protocol_connecting(struct connectdata *conn, + bool *done) +{ + CURLcode result=CURLE_OK; + + if(conn && conn->handler->connecting) { + *done = FALSE; + result = conn->handler->connecting(conn, done); + } + else + *done = TRUE; + + return result; +} + +/* + * We are DOING this is being called over and over from the multi interface + * until the DOING phase is done on protocol layer. + */ + +CURLcode Curl_protocol_doing(struct connectdata *conn, bool *done) +{ + CURLcode result=CURLE_OK; + + if(conn && conn->handler->doing) { + *done = FALSE; + result = conn->handler->doing(conn, done); + } + else + *done = TRUE; + + return result; +} + +/* + * We have discovered that the TCP connection has been successful, we can now + * proceed with some action. + * + */ +CURLcode Curl_protocol_connect(struct connectdata *conn, + bool *protocol_done) +{ + CURLcode result=CURLE_OK; + struct SessionHandle *data = conn->data; + + *protocol_done = FALSE; + + if(conn->bits.tcpconnect && conn->bits.protoconnstart) { + /* We already are connected, get back. This may happen when the connect + worked fine in the first call, like when we connect to a local server + or proxy. Note that we don't know if the protocol is actually done. + + Unless this protocol doesn't have any protocol-connect callback, as + then we know we're done. */ + if(!conn->handler->connecting) + *protocol_done = TRUE; + + return CURLE_OK; + } + + if(!conn->bits.tcpconnect) { + + Curl_pgrsTime(data, TIMER_CONNECT); /* connect done */ + Curl_verboseconnect(conn); + } + + if(!conn->bits.protoconnstart) { + if(conn->handler->connect_it) { + /* is there a protocol-specific connect() procedure? */ + + /* Set start time here for timeout purposes in the connect procedure, it + is later set again for the progress meter purpose */ + conn->now = Curl_tvnow(); + + /* Call the protocol-specific connect function */ + result = conn->handler->connect_it(conn, protocol_done); + } + else + *protocol_done = TRUE; + + /* it has started, possibly even completed but that knowledge isn't stored + in this bit! */ + if(!result) + conn->bits.protoconnstart = TRUE; + } + + return result; /* pass back status */ +} + +/* + * Helpers for IDNA convertions. + */ +#ifdef USE_LIBIDN +static bool is_ASCII_name(const char *hostname) +{ + const unsigned char *ch = (const unsigned char*)hostname; + + while(*ch) { + if(*ch++ & 0x80) + return FALSE; + } + return TRUE; +} + +/* + * Check if characters in hostname is allowed in Top Level Domain. + */ +static bool tld_check_name(struct SessionHandle *data, + const char *ace_hostname) +{ + size_t err_pos; + char *uc_name = NULL; + int rc; +#ifndef CURL_DISABLE_VERBOSE_STRINGS + const char *tld_errmsg = ""; +#else + (void)data; +#endif + + /* Convert (and downcase) ACE-name back into locale's character set */ + rc = idna_to_unicode_lzlz(ace_hostname, &uc_name, 0); + if(rc != IDNA_SUCCESS) + return FALSE; + + rc = tld_check_lz(uc_name, &err_pos, NULL); +#ifndef CURL_DISABLE_VERBOSE_STRINGS +#ifdef HAVE_TLD_STRERROR + if(rc != TLD_SUCCESS) + tld_errmsg = tld_strerror((Tld_rc)rc); +#endif + if(rc == TLD_INVALID) + infof(data, "WARNING: %s; pos %u = `%c'/0x%02X\n", + tld_errmsg, err_pos, uc_name[err_pos], + uc_name[err_pos] & 255); + else if(rc != TLD_SUCCESS) + infof(data, "WARNING: TLD check for %s failed; %s\n", + uc_name, tld_errmsg); +#endif /* CURL_DISABLE_VERBOSE_STRINGS */ + if(uc_name) + idn_free(uc_name); + if(rc != TLD_SUCCESS) + return FALSE; + + return TRUE; +} +#endif + +/* + * Perform any necessary IDN conversion of hostname + */ +static void fix_hostname(struct SessionHandle *data, + struct connectdata *conn, struct hostname *host) +{ +#ifndef USE_LIBIDN + (void)data; + (void)conn; +#elif defined(CURL_DISABLE_VERBOSE_STRINGS) + (void)conn; +#endif + + /* set the name we use to display the host name */ + host->dispname = host->name; + +#ifdef USE_LIBIDN + /************************************************************* + * Check name for non-ASCII and convert hostname to ACE form. + *************************************************************/ + if(!is_ASCII_name(host->name) && + stringprep_check_version(LIBIDN_REQUIRED_VERSION)) { + char *ace_hostname = NULL; + int rc = idna_to_ascii_lz(host->name, &ace_hostname, 0); + infof (data, "Input domain encoded as `%s'\n", + stringprep_locale_charset ()); + if(rc != IDNA_SUCCESS) + infof(data, "Failed to convert %s to ACE; %s\n", + host->name, Curl_idn_strerror(conn,rc)); + else { + /* tld_check_name() displays a warning if the host name contains + "illegal" characters for this TLD */ + (void)tld_check_name(data, ace_hostname); + + host->encalloc = ace_hostname; + /* change the name pointer to point to the encoded hostname */ + host->name = host->encalloc; + } + } +#endif +} + +static void llist_dtor(void *user, void *element) +{ + (void)user; + (void)element; + /* Do nothing */ +} + +/* + * Allocate and initialize a new connectdata object. + */ +static struct connectdata *allocate_conn(struct SessionHandle *data) +{ + struct connectdata *conn = calloc(1, sizeof(struct connectdata)); + if(!conn) + return NULL; + + conn->handler = &Curl_handler_dummy; /* Be sure we have a handler defined + already from start to avoid NULL + situations and checks */ + + /* and we setup a few fields in case we end up actually using this struct */ + + conn->sock[FIRSTSOCKET] = CURL_SOCKET_BAD; /* no file descriptor */ + conn->sock[SECONDARYSOCKET] = CURL_SOCKET_BAD; /* no file descriptor */ + conn->connectindex = -1; /* no index */ + conn->port = -1; /* unknown at this point */ + + /* Default protocol-independent behavior doesn't support persistent + connections, so we set this to force-close. Protocols that support + this need to set this to FALSE in their "curl_do" functions. */ + conn->bits.close = TRUE; + + /* Store creation time to help future close decision making */ + conn->created = Curl_tvnow(); + + conn->data = data; /* Setup the association between this connection + and the SessionHandle */ + + conn->proxytype = data->set.proxytype; /* type */ + +#ifdef CURL_DISABLE_PROXY + + conn->bits.proxy = FALSE; + conn->bits.httpproxy = FALSE; + conn->bits.proxy_user_passwd = FALSE; + conn->bits.tunnel_proxy = FALSE; + +#else /* CURL_DISABLE_PROXY */ + + conn->bits.proxy = (bool)(data->set.str[STRING_PROXY] && + *data->set.str[STRING_PROXY]); + conn->bits.httpproxy = (bool)(conn->bits.proxy && + (conn->proxytype == CURLPROXY_HTTP || + conn->proxytype == CURLPROXY_HTTP_1_0)); + conn->bits.proxy_user_passwd = + (bool)(NULL != data->set.str[STRING_PROXYUSERNAME]); + conn->bits.tunnel_proxy = data->set.tunnel_thru_httpproxy; + +#endif /* CURL_DISABLE_PROXY */ + + conn->bits.user_passwd = (bool)(NULL != data->set.str[STRING_USERNAME]); + conn->bits.ftp_use_epsv = data->set.ftp_use_epsv; + conn->bits.ftp_use_eprt = data->set.ftp_use_eprt; + + conn->verifypeer = data->set.ssl.verifypeer; + conn->verifyhost = data->set.ssl.verifyhost; + + conn->ip_version = data->set.ipver; + + if(data->multi && Curl_multi_canPipeline(data->multi) && + !conn->master_buffer) { + /* Allocate master_buffer to be used for pipelining */ + conn->master_buffer = calloc(BUFSIZE, sizeof (char)); + if(!conn->master_buffer) + goto error; + } + + /* Initialize the pipeline lists */ + conn->send_pipe = Curl_llist_alloc((curl_llist_dtor) llist_dtor); + conn->recv_pipe = Curl_llist_alloc((curl_llist_dtor) llist_dtor); + conn->pend_pipe = Curl_llist_alloc((curl_llist_dtor) llist_dtor); + conn->done_pipe = Curl_llist_alloc((curl_llist_dtor) llist_dtor); + if(!conn->send_pipe || !conn->recv_pipe || !conn->pend_pipe || + !conn->done_pipe) + goto error; + +#if defined(HAVE_KRB4) || defined(HAVE_GSSAPI) + conn->data_prot = PROT_CLEAR; +#endif + + return conn; + error: + Curl_llist_destroy(conn->send_pipe, NULL); + Curl_llist_destroy(conn->recv_pipe, NULL); + Curl_llist_destroy(conn->pend_pipe, NULL); + Curl_llist_destroy(conn->done_pipe, NULL); + Curl_safefree(conn->master_buffer); + Curl_safefree(conn); + return NULL; +} + +static CURLcode findprotocol(struct SessionHandle *data, + struct connectdata *conn, + const char *protostr) +{ + const struct Curl_handler * const *pp; + const struct Curl_handler *p; + + /* Scan protocol handler table and match against 'protostr' to set a few + variables based on the URL. Now that the handler may be changed later + when the protocol specific setup function is called. */ + for (pp = protocols; (p = *pp) != NULL; pp++) { + if(Curl_raw_equal(p->scheme, protostr)) { + /* Protocol found in table. Check if allowed */ + if(!(data->set.allowed_protocols & p->protocol)) + /* nope, get out */ + break; + + /* it is allowed for "normal" request, now do an extra check if this is + the result of a redirect */ + if(data->state.this_is_a_follow && + !(data->set.redir_protocols & p->protocol)) + /* nope, get out */ + break; + + /* Perform setup complement if some. */ + conn->handler = p; + conn->protocol |= p->protocol; + + /* 'port' and 'remote_port' are set in setup_connection_internals() */ + return CURLE_OK; + } + } + + + /* The protocol was not found in the table, but we don't have to assign it + to anything since it is already assigned to a dummy-struct in the + create_conn() function when the connectdata struct is allocated. */ + failf(data, "Protocol %s not supported or disabled in " LIBCURL_NAME, + protostr); + + return CURLE_UNSUPPORTED_PROTOCOL; +} + +/* + * Parse URL and fill in the relevant members of the connection struct. + */ +static CURLcode parseurlandfillconn(struct SessionHandle *data, + struct connectdata *conn, + bool *prot_missing) +{ + char *at; + char *fragment; + char *path = data->state.path; + char *query; + int rc; + char protobuf[16]; + const char *protop; + + *prot_missing = FALSE; + + /************************************************************* + * Parse the URL. + * + * We need to parse the url even when using the proxy, because we will need + * the hostname and port in case we are trying to SSL connect through the + * proxy -- and we don't know if we will need to use SSL until we parse the + * url ... + ************************************************************/ + if((2 == sscanf(data->change.url, "%15[^:]:%[^\n]", + protobuf, path)) && + Curl_raw_equal(protobuf, "file")) { + if(path[0] == '/' && path[1] == '/') { + /* Allow omitted hostname (e.g. file:/). This is not strictly + * speaking a valid file: URL by RFC 1738, but treating file:/ as + * file://localhost/ is similar to how other schemes treat missing + * hostnames. See RFC 1808. */ + + /* This cannot be done with strcpy() in a portable manner, since the + memory areas overlap! */ + memmove(path, path + 2, strlen(path + 2)+1); + } + /* + * we deal with file:/// differently since it supports no + * hostname other than "localhost" and "127.0.0.1", which is unique among + * the URL protocols specified in RFC 1738 + */ + if(path[0] != '/') { + /* the URL included a host name, we ignore host names in file:// URLs + as the standards don't define what to do with them */ + char *ptr=strchr(path, '/'); + if(ptr) { + /* there was a slash present + + RFC1738 (section 3.1, page 5) says: + + The rest of the locator consists of data specific to the scheme, + and is known as the "url-path". It supplies the details of how the + specified resource can be accessed. Note that the "/" between the + host (or port) and the url-path is NOT part of the url-path. + + As most agents use file://localhost/foo to get '/foo' although the + slash preceding foo is a separator and not a slash for the path, + a URL as file://localhost//foo must be valid as well, to refer to + the same file with an absolute path. + */ + + if(ptr[1] && ('/' == ptr[1])) + /* if there was two slashes, we skip the first one as that is then + used truly as a separator */ + ptr++; + + /* This cannot be made with strcpy, as the memory chunks overlap! */ + memmove(path, ptr, strlen(ptr)+1); + } + } + + protop = "file"; /* protocol string */ + } + else { + /* clear path */ + path[0]=0; + + if(2 > sscanf(data->change.url, + "%15[^\n:]://%[^\n/?]%[^\n]", + protobuf, + conn->host.name, path)) { + + /* + * The URL was badly formatted, let's try the browser-style _without_ + * protocol specified like 'http://'. + */ + rc = sscanf(data->change.url, "%[^\n/?]%[^\n]", conn->host.name, path); + if(1 > rc) { + /* + * We couldn't even get this format. + * djgpp 2.04 has a sscanf() bug where 'conn->host.name' is + * assigned, but the return value is EOF! + */ +#if defined(__DJGPP__) && (DJGPP_MINOR == 4) + if (!(rc == -1 && *conn->host.name)) +#endif + { + failf(data, " malformed"); + return CURLE_URL_MALFORMAT; + } + } + + /* + * Since there was no protocol part specified, we guess what protocol it + * is based on the first letters of the server name. + */ + + /* Note: if you add a new protocol, please update the list in + * lib/version.c too! */ + + if(checkprefix("FTP.", conn->host.name)) + protop = "ftp"; + else if(checkprefix("DICT.", conn->host.name)) + protop = "DICT"; + else if(checkprefix("LDAP.", conn->host.name)) + protop = "LDAP"; + else if(checkprefix("IMAP.", conn->host.name)) + protop = "IMAP"; + else { + protop = "http"; + } + + *prot_missing = TRUE; /* not given in URL */ + } + else + protop = protobuf; + } + + /* We search for '?' in the host name (but only on the right side of a + * @-letter to allow ?-letters in username and password) to handle things + * like http://example.com?param= (notice the missing '/'). + */ + at = strchr(conn->host.name, '@'); + if(at) + query = strchr(at+1, '?'); + else + query = strchr(conn->host.name, '?'); + + if(query) { + /* We must insert a slash before the '?'-letter in the URL. If the URL had + a slash after the '?', that is where the path currently begins and the + '?string' is still part of the host name. + + We must move the trailing part from the host name and put it first in + the path. And have it all prefixed with a slash. + */ + + size_t hostlen = strlen(query); + size_t pathlen = strlen(path); + + /* move the existing path plus the zero byte forward, to make room for + the host-name part */ + memmove(path+hostlen+1, path, pathlen+1); + + /* now copy the trailing host part in front of the existing path */ + memcpy(path+1, query, hostlen); + + path[0]='/'; /* prepend the missing slash */ + + *query=0; /* now cut off the hostname at the ? */ + } + else if(!path[0]) { + /* if there's no path set, use a single slash */ + strcpy(path, "/"); + } + + /* If the URL is malformatted (missing a '/' after hostname before path) we + * insert a slash here. The only letter except '/' we accept to start a path + * is '?'. + */ + if(path[0] == '?') { + /* We need this function to deal with overlapping memory areas. We know + that the memory area 'path' points to is 'urllen' bytes big and that + is bigger than the path. Use +1 to move the zero byte too. */ + memmove(&path[1], path, strlen(path)+1); + path[0] = '/'; + } + + if (conn->host.name[0] == '[') { + /* This looks like an IPv6 address literal. See if there is an address + scope. */ + char *percent = strstr (conn->host.name, "%25"); + if (percent) { + char *endp; + unsigned long scope = strtoul (percent + 3, &endp, 10); + if (*endp == ']') { + /* The address scope was well formed. Knock it out of the + hostname. */ + memmove(percent, endp, strlen(endp)+1); + if (!data->state.this_is_a_follow) + /* Don't honour a scope given in a Location: header */ + conn->scope = (unsigned int)scope; + } else + infof(data, "Invalid IPv6 address format\n"); + } + } + + if(data->set.scope) + /* Override any scope that was set above. */ + conn->scope = data->set.scope; + + /* Remove the fragment part of the path. Per RFC 2396, this is always the + last part of the URI. We are looking for the first '#' so that we deal + gracefully with non conformant URI such as http://example.com#foo#bar. */ + fragment = strchr(path, '#'); + if(fragment) + *fragment = 0; + + /* + * So if the URL was A://B/C#D, + * protop is A + * conn->host.name is B + * data->state.path is /C + */ + + return findprotocol(data, conn, protop); +} + +/* + * If we're doing a resumed transfer, we need to setup our stuff + * properly. + */ +static CURLcode setup_range(struct SessionHandle *data) +{ + struct UrlState *s = &data->state; + s->resume_from = data->set.set_resume_from; + if(s->resume_from || data->set.str[STRING_SET_RANGE]) { + if(s->rangestringalloc) + free(s->range); + + if(s->resume_from) + s->range = aprintf("%" FORMAT_OFF_TU "-", s->resume_from); + else + s->range = strdup(data->set.str[STRING_SET_RANGE]); + + s->rangestringalloc = (bool)(s->range?TRUE:FALSE); + + if(!s->range) + return CURLE_OUT_OF_MEMORY; + + /* tell ourselves to fetch this range */ + s->use_range = TRUE; /* enable range download */ + } + else + s->use_range = FALSE; /* disable range download */ + + return CURLE_OK; +} + + +/*************************************************************** +* Setup connection internals specific to the requested protocol. +* This MUST get called after proxy magic has been figured out. +***************************************************************/ +static CURLcode setup_connection_internals(struct connectdata *conn) +{ + const struct Curl_handler * p; + CURLcode result; + + conn->socktype = SOCK_STREAM; /* most of them are TCP streams */ + + /* Scan protocol handler table. */ + + /* Perform setup complement if some. */ + p = conn->handler; + + if(p->setup_connection) { + result = (*p->setup_connection)(conn); + + if(result != CURLE_OK) + return result; + + p = conn->handler; /* May have changed. */ + } + + if(conn->port < 0) + /* we check for -1 here since if proxy was detected already, this + was very likely already set to the proxy port */ + conn->port = p->defport; + conn->remote_port = (unsigned short)p->defport; + conn->protocol |= p->protocol; + + return CURLE_OK; +} + +#ifndef CURL_DISABLE_PROXY +/**************************************************************** +* Checks if the host is in the noproxy list. returns true if it matches +* and therefore the proxy should NOT be used. +****************************************************************/ +static bool check_noproxy(const char* name, const char* no_proxy) +{ + /* no_proxy=domain1.dom,host.domain2.dom + * (a comma-separated list of hosts which should + * not be proxied, or an asterisk to override + * all proxy variables) + */ + size_t tok_start; + size_t tok_end; + const char* separator = ", "; + size_t no_proxy_len; + size_t namelen; + char *endptr; + + if(no_proxy && no_proxy[0]) { + if(Curl_raw_equal("*", no_proxy)) { + return TRUE; + } + + /* NO_PROXY was specified and it wasn't just an asterisk */ + + no_proxy_len = strlen(no_proxy); + endptr = strchr(name, ':'); + if(endptr) + namelen = endptr - name; + else + namelen = strlen(name); + + for (tok_start = 0; tok_start < no_proxy_len; tok_start = tok_end + 1) { + while (tok_start < no_proxy_len && + strchr(separator, no_proxy[tok_start]) != NULL) { + /* Look for the beginning of the token. */ + ++tok_start; + } + + if(tok_start == no_proxy_len) + break; /* It was all trailing separator chars, no more tokens. */ + + for (tok_end = tok_start; tok_end < no_proxy_len && + strchr(separator, no_proxy[tok_end]) == NULL; ++tok_end) { + /* Look for the end of the token. */ + } + + /* To match previous behaviour, where it was necessary to specify + * ".local.com" to prevent matching "notlocal.com", we will leave + * the '.' off. + */ + if(no_proxy[tok_start] == '.') + ++tok_start; + + if((tok_end - tok_start) <= namelen) { + /* Match the last part of the name to the domain we are checking. */ + const char *checkn = name + namelen - (tok_end - tok_start); + if(Curl_raw_nequal(no_proxy + tok_start, checkn, + tok_end - tok_start)) { + if((tok_end - tok_start) == namelen || *(checkn - 1) == '.') { + /* We either have an exact match, or the previous character is a . + * so it is within the same domain, so no proxy for this host. + */ + return TRUE; + } + } + } /* if((tok_end - tok_start) <= namelen) */ + } /* for (tok_start = 0; tok_start < no_proxy_len; + tok_start = tok_end + 1) */ + } /* NO_PROXY was specified and it wasn't just an asterisk */ + + return FALSE; +} + +/**************************************************************** +* Detect what (if any) proxy to use. Remember that this selects a host +* name and is not limited to HTTP proxies only. +* The returned pointer must be freed by the caller (unless NULL) +****************************************************************/ +static char *detect_proxy(struct connectdata *conn) +{ + char *proxy = NULL; + +#ifndef CURL_DISABLE_HTTP + /* If proxy was not specified, we check for default proxy environment + * variables, to enable i.e Lynx compliance: + * + * http_proxy=http://some.server.dom:port/ + * https_proxy=http://some.server.dom:port/ + * ftp_proxy=http://some.server.dom:port/ + * no_proxy=domain1.dom,host.domain2.dom + * (a comma-separated list of hosts which should + * not be proxied, or an asterisk to override + * all proxy variables) + * all_proxy=http://some.server.dom:port/ + * (seems to exist for the CERN www lib. Probably + * the first to check for.) + * + * For compatibility, the all-uppercase versions of these variables are + * checked if the lowercase versions don't exist. + */ + char *no_proxy=NULL; + char proxy_env[128]; + + no_proxy=curl_getenv("no_proxy"); + if(!no_proxy) + no_proxy=curl_getenv("NO_PROXY"); + + if(!check_noproxy(conn->host.name, no_proxy)) { + /* It was not listed as without proxy */ + const char *protop = conn->handler->scheme; + char *envp = proxy_env; + char *prox; + + /* Now, build _proxy and check for such a one to use */ + while(*protop) + *envp++ = (char)tolower((int)*protop++); + + /* append _proxy */ + strcpy(envp, "_proxy"); + + /* read the protocol proxy: */ + prox=curl_getenv(proxy_env); + + /* + * We don't try the uppercase version of HTTP_PROXY because of + * security reasons: + * + * When curl is used in a webserver application + * environment (cgi or php), this environment variable can + * be controlled by the web server user by setting the + * http header 'Proxy:' to some value. + * + * This can cause 'internal' http/ftp requests to be + * arbitrarily redirected by any external attacker. + */ + if(!prox && !Curl_raw_equal("http_proxy", proxy_env)) { + /* There was no lowercase variable, try the uppercase version: */ + Curl_strntoupper(proxy_env, proxy_env, sizeof(proxy_env)); + prox=curl_getenv(proxy_env); + } + + if(prox && *prox) { /* don't count "" strings */ + proxy = prox; /* use this */ + } + else { + proxy = curl_getenv("all_proxy"); /* default proxy to use */ + if(!proxy) + proxy=curl_getenv("ALL_PROXY"); + } + } /* if(!check_noproxy(conn->host.name, no_proxy)) - it wasn't specified + non-proxy */ + if(no_proxy) + free(no_proxy); + +#else /* !CURL_DISABLE_HTTP */ + + (void)conn; +#endif /* CURL_DISABLE_HTTP */ + + return proxy; +} + +/* + * If this is supposed to use a proxy, we need to figure out the proxy + * host name, so that we can re-use an existing connection + * that may exist registered to the same proxy host. + * proxy will be freed before this function returns. + */ +static CURLcode parse_proxy(struct SessionHandle *data, + struct connectdata *conn, char *proxy) +{ + char *prox_portno; + char *endofprot; + + /* We use 'proxyptr' to point to the proxy name from now on... */ + char *proxyptr; + char *portptr; + char *atsign; + + /* We do the proxy host string parsing here. We want the host name and the + * port name. Accept a protocol:// prefix, even though it should just be + * ignored. + */ + + /* Skip the protocol part if present */ + endofprot = strstr(proxy, "://"); + if(endofprot) + proxyptr = endofprot+3; + else + proxyptr = proxy; + + /* Is there a username and password given in this proxy url? */ + atsign = strchr(proxyptr, '@'); + if(atsign) { + char proxyuser[MAX_CURL_USER_LENGTH]; + char proxypasswd[MAX_CURL_PASSWORD_LENGTH]; + proxypasswd[0] = 0; + + if(1 <= sscanf(proxyptr, + "%" MAX_CURL_USER_LENGTH_TXT"[^:@]:" + "%" MAX_CURL_PASSWORD_LENGTH_TXT "[^@]", + proxyuser, proxypasswd)) { + CURLcode res = CURLE_OK; + + /* found user and password, rip them out. note that we are + unescaping them, as there is otherwise no way to have a + username or password with reserved characters like ':' in + them. */ + Curl_safefree(conn->proxyuser); + conn->proxyuser = curl_easy_unescape(data, proxyuser, 0, NULL); + + if(!conn->proxyuser) + res = CURLE_OUT_OF_MEMORY; + else { + Curl_safefree(conn->proxypasswd); + conn->proxypasswd = curl_easy_unescape(data, proxypasswd, 0, NULL); + + if(!conn->proxypasswd) + res = CURLE_OUT_OF_MEMORY; + } + + if(CURLE_OK == res) { + conn->bits.proxy_user_passwd = TRUE; /* enable it */ + atsign = strdup(atsign+1); /* the right side of the @-letter */ + + if(atsign) { + free(proxy); /* free the former proxy string */ + proxy = proxyptr = atsign; /* now use this instead */ + } + else + res = CURLE_OUT_OF_MEMORY; + } + + if(res) { + free(proxy); /* free the allocated proxy string */ + return res; + } + } + } + + /* start scanning for port number at this point */ + portptr = proxyptr; + + /* detect and extract RFC2732-style IPv6-addresses */ + if(*proxyptr == '[') { + char *ptr = ++proxyptr; /* advance beyond the initial bracket */ + while(*ptr && (ISXDIGIT(*ptr) || (*ptr == ':') || (*ptr == '%') || + (*ptr == '.'))) + ptr++; + if(*ptr == ']') { + /* yeps, it ended nicely with a bracket as well */ + *ptr++ = 0; + } else + infof(data, "Invalid IPv6 address format\n"); + portptr = ptr; + /* Note that if this didn't end with a bracket, we still advanced the + * proxyptr first, but I can't see anything wrong with that as no host + * name nor a numeric can legally start with a bracket. + */ + } + + /* Get port number off proxy.server.com:1080 */ + prox_portno = strchr(portptr, ':'); + if(prox_portno) { + *prox_portno = 0x0; /* cut off number from host name */ + prox_portno ++; + /* now set the local port number */ + conn->port = strtol(prox_portno, NULL, 10); + } + else { + /* without a port number after the host name, some people seem to use + a slash so we strip everything from the first slash */ + atsign = strchr(proxyptr, '/'); + if(atsign) + *atsign = 0x0; /* cut off path part from host name */ + + if(data->set.proxyport) + /* None given in the proxy string, then get the default one if it is + given */ + conn->port = data->set.proxyport; + } + + /* now, clone the cleaned proxy host name */ + conn->proxy.rawalloc = strdup(proxyptr); + conn->proxy.name = conn->proxy.rawalloc; + + free(proxy); + if(!conn->proxy.rawalloc) + return CURLE_OUT_OF_MEMORY; + + return CURLE_OK; +} + +/* + * Extract the user and password from the authentication string + */ +static CURLcode parse_proxy_auth(struct SessionHandle *data, + struct connectdata *conn) +{ + char proxyuser[MAX_CURL_USER_LENGTH]=""; + char proxypasswd[MAX_CURL_PASSWORD_LENGTH]=""; + + if(data->set.str[STRING_PROXYUSERNAME] != NULL) { + strncpy(proxyuser, data->set.str[STRING_PROXYUSERNAME], + MAX_CURL_USER_LENGTH); + proxyuser[MAX_CURL_USER_LENGTH-1] = '\0'; /*To be on safe side*/ + } + if(data->set.str[STRING_PROXYPASSWORD] != NULL) { + strncpy(proxypasswd, data->set.str[STRING_PROXYPASSWORD], + MAX_CURL_PASSWORD_LENGTH); + proxypasswd[MAX_CURL_PASSWORD_LENGTH-1] = '\0'; /*To be on safe side*/ + } + + conn->proxyuser = curl_easy_unescape(data, proxyuser, 0, NULL); + if(!conn->proxyuser) + return CURLE_OUT_OF_MEMORY; + + conn->proxypasswd = curl_easy_unescape(data, proxypasswd, 0, NULL); + if(!conn->proxypasswd) + return CURLE_OUT_OF_MEMORY; + + return CURLE_OK; +} +#endif /* CURL_DISABLE_PROXY */ + +/* + * + * Parse a user name and password in the URL and strip it out of the host name + * + * Inputs: data->set.use_netrc (CURLOPT_NETRC) + * conn->host.name + * + * Outputs: (almost :- all currently undefined) + * conn->bits.user_passwd - non-zero if non-default passwords exist + * user - non-zero length if defined + * passwd - ditto + * conn->host.name - remove user name and password + */ +static CURLcode parse_url_userpass(struct SessionHandle *data, + struct connectdata *conn, + char *user, char *passwd) +{ + /* At this point, we're hoping all the other special cases have + * been taken care of, so conn->host.name is at most + * [user[:password]]@]hostname + * + * We need somewhere to put the embedded details, so do that first. + */ + + char *ptr=strchr(conn->host.name, '@'); + char *userpass = conn->host.name; + + user[0] =0; /* to make everything well-defined */ + passwd[0]=0; + + /* We will now try to extract the + * possible user+password pair in a string like: + * ftp://user:password@ftp.my.site:8021/README */ + if(ptr != NULL) { + /* there's a user+password given here, to the left of the @ */ + + conn->host.name = ++ptr; + + /* So the hostname is sane. Only bother interpreting the + * results if we could care. It could still be wasted + * work because it might be overtaken by the programmatically + * set user/passwd, but doing that first adds more cases here :-( + */ + + conn->bits.userpwd_in_url = TRUE; + if(data->set.use_netrc != CURL_NETRC_REQUIRED) { + /* We could use the one in the URL */ + + conn->bits.user_passwd = TRUE; /* enable user+password */ + + if(*userpass != ':') { + /* the name is given, get user+password */ + sscanf(userpass, "%" MAX_CURL_USER_LENGTH_TXT "[^:@]:" + "%" MAX_CURL_PASSWORD_LENGTH_TXT "[^@]", + user, passwd); + } + else + /* no name given, get the password only */ + sscanf(userpass, ":%" MAX_CURL_PASSWORD_LENGTH_TXT "[^@]", passwd); + + if(user[0]) { + char *newname=curl_easy_unescape(data, user, 0, NULL); + if(!newname) + return CURLE_OUT_OF_MEMORY; + if(strlen(newname) < MAX_CURL_USER_LENGTH) + strcpy(user, newname); + + /* if the new name is longer than accepted, then just use + the unconverted name, it'll be wrong but what the heck */ + free(newname); + } + if(passwd[0]) { + /* we have a password found in the URL, decode it! */ + char *newpasswd=curl_easy_unescape(data, passwd, 0, NULL); + if(!newpasswd) + return CURLE_OUT_OF_MEMORY; + if(strlen(newpasswd) < MAX_CURL_PASSWORD_LENGTH) + strcpy(passwd, newpasswd); + + free(newpasswd); + } + } + } + return CURLE_OK; +} + +/************************************************************* + * Figure out the remote port number and fix it in the URL + * + * No matter if we use a proxy or not, we have to figure out the remote + * port number of various reasons. + * + * To be able to detect port number flawlessly, we must not confuse them + * IPv6-specified addresses in the [0::1] style. (RFC2732) + * + * The conn->host.name is currently [user:passwd@]host[:port] where host + * could be a hostname, IPv4 address or IPv6 address. + * + * The port number embedded in the URL is replaced, if necessary. + *************************************************************/ +static CURLcode parse_remote_port(struct SessionHandle *data, + struct connectdata *conn) +{ + char *portptr; + char endbracket; + + /* Note that at this point, the IPv6 address cannot contain any scope + suffix as that has already been removed in the parseurlandfillconn() + function */ + if((1 == sscanf(conn->host.name, "[%*45[0123456789abcdefABCDEF:.]%c", + &endbracket)) && + (']' == endbracket)) { + /* this is a RFC2732-style specified IP-address */ + conn->bits.ipv6_ip = TRUE; + + conn->host.name++; /* skip over the starting bracket */ + portptr = strchr(conn->host.name, ']'); + if(portptr) { + *portptr++ = '\0'; /* zero terminate, killing the bracket */ + if(':' != *portptr) + portptr = NULL; /* no port number available */ + } + } + else + portptr = strrchr(conn->host.name, ':'); + + if(data->set.use_port && data->state.allow_port) { + /* if set, we use this and ignore the port possibly given in the URL */ + conn->remote_port = (unsigned short)data->set.use_port; + if(portptr) + *portptr = '\0'; /* cut off the name there anyway - if there was a port + number - since the port number is to be ignored! */ + if(conn->bits.httpproxy) { + /* we need to create new URL with the new port number */ + char *url; + char type[12]=""; + + if(conn->bits.type_set) + snprintf(type, sizeof(type), ";type=%c", + data->set.prefer_ascii?'A': + (data->set.ftp_list_only?'D':'I')); + + /* + * This synthesized URL isn't always right--suffixes like ;type=A are + * stripped off. It would be better to work directly from the original + * URL and simply replace the port part of it. + */ + url = aprintf("%s://%s%s%s:%hu%s%s%s", conn->handler->scheme, + conn->bits.ipv6_ip?"[":"", conn->host.name, + conn->bits.ipv6_ip?"]":"", conn->remote_port, + data->state.slash_removed?"/":"", data->state.path, + type); + if(!url) + return CURLE_OUT_OF_MEMORY; + + if(data->change.url_alloc) + free(data->change.url); + + data->change.url = url; + data->change.url_alloc = TRUE; + } + } + else if(portptr) { + /* no CURLOPT_PORT given, extract the one from the URL */ + + char *rest; + unsigned long port; + + port=strtoul(portptr+1, &rest, 10); /* Port number must be decimal */ + + if(rest != (portptr+1) && *rest == '\0') { + /* The colon really did have only digits after it, + * so it is either a port number or a mistake */ + + if(port > 0xffff) { /* Single unix standard says port numbers are + * 16 bits long */ + failf(data, "Port number too large: %lu", port); + return CURLE_URL_MALFORMAT; + } + + *portptr = '\0'; /* cut off the name there */ + conn->remote_port = curlx_ultous(port); + } + else if(!port) + /* Browser behavior adaptation. If there's a colon with no digits after, + just cut off the name there which makes us ignore the colon and just + use the default port. Firefox and Chrome both do that. */ + *portptr = '\0'; + } + return CURLE_OK; +} + +/* + * Override a user name and password from the URL with that in the + * CURLOPT_USERPWD option or a .netrc file, if applicable. + */ +static void override_userpass(struct SessionHandle *data, + struct connectdata *conn, + char *user, char *passwd) +{ + if(data->set.str[STRING_USERNAME] != NULL) { + strncpy(user, data->set.str[STRING_USERNAME], MAX_CURL_USER_LENGTH); + user[MAX_CURL_USER_LENGTH-1] = '\0'; /*To be on safe side*/ + } + if(data->set.str[STRING_PASSWORD] != NULL) { + strncpy(passwd, data->set.str[STRING_PASSWORD], MAX_CURL_PASSWORD_LENGTH); + passwd[MAX_CURL_PASSWORD_LENGTH-1] = '\0'; /*To be on safe side*/ + } + + conn->bits.netrc = FALSE; + if(data->set.use_netrc != CURL_NETRC_IGNORED) { + if(Curl_parsenetrc(conn->host.name, + user, passwd, + data->set.str[STRING_NETRC_FILE])) { + infof(data, "Couldn't find host %s in the " + DOT_CHAR "netrc file; using defaults\n", + conn->host.name); + } + else { + /* set bits.netrc TRUE to remember that we got the name from a .netrc + file, so that it is safe to use even if we followed a Location: to a + different host or similar. */ + conn->bits.netrc = TRUE; + + conn->bits.user_passwd = TRUE; /* enable user+password */ + } + } +} + +/* + * Set password so it's available in the connection. + */ +static CURLcode set_userpass(struct connectdata *conn, + const char *user, const char *passwd) +{ + /* If our protocol needs a password and we have none, use the defaults */ + if( (conn->protocol & (PROT_FTP|PROT_IMAP)) && + !conn->bits.user_passwd) { + + conn->user = strdup(CURL_DEFAULT_USER); + if(conn->user) + conn->passwd = strdup(CURL_DEFAULT_PASSWORD); + else + conn->passwd = NULL; + /* This is the default password, so DON'T set conn->bits.user_passwd */ + } + else { + /* store user + password, zero-length if not set */ + conn->user = strdup(user); + if(conn->user) + conn->passwd = strdup(passwd); + else + conn->passwd = NULL; + } + if(!conn->user || !conn->passwd) + return CURLE_OUT_OF_MEMORY; + + return CURLE_OK; +} + +/************************************************************* + * Resolve the address of the server or proxy + *************************************************************/ +static CURLcode resolve_server(struct SessionHandle *data, + struct connectdata *conn, + bool *async) +{ + CURLcode result=CURLE_OK; + long timeout_ms = Curl_timeleft(conn, NULL, TRUE); + + /************************************************************* + * Resolve the name of the server or proxy + *************************************************************/ + if(conn->bits.reuse) { + /* We're reusing the connection - no need to resolve anything */ + *async = FALSE; + + if(conn->bits.proxy) + fix_hostname(data, conn, &conn->host); + } + else { + /* this is a fresh connect */ + int rc; + struct Curl_dns_entry *hostaddr; + + /* set a pointer to the hostname we display */ + fix_hostname(data, conn, &conn->host); + + if(!conn->proxy.name || !*conn->proxy.name) { + /* If not connecting via a proxy, extract the port from the URL, if it is + * there, thus overriding any defaults that might have been set above. */ + conn->port = conn->remote_port; /* it is the same port */ + + /* Resolve target host right on */ + rc = Curl_resolv_timeout(conn, conn->host.name, (int)conn->port, + &hostaddr, timeout_ms); + if(rc == CURLRESOLV_PENDING) + *async = TRUE; + + else if (rc == CURLRESOLV_TIMEDOUT) + result = CURLE_OPERATION_TIMEDOUT; + + else if(!hostaddr) { + failf(data, "Couldn't resolve host '%s'", conn->host.dispname); + result = CURLE_COULDNT_RESOLVE_HOST; + /* don't return yet, we need to clean up the timeout first */ + } + } + else { + /* This is a proxy that hasn't been resolved yet. */ + + /* IDN-fix the proxy name */ + fix_hostname(data, conn, &conn->proxy); + + /* resolve proxy */ + rc = Curl_resolv_timeout(conn, conn->proxy.name, (int)conn->port, + &hostaddr, timeout_ms); + + if(rc == CURLRESOLV_PENDING) + *async = TRUE; + + else if (rc == CURLRESOLV_TIMEDOUT) + result = CURLE_OPERATION_TIMEDOUT; + + else if(!hostaddr) { + failf(data, "Couldn't resolve proxy '%s'", conn->proxy.dispname); + result = CURLE_COULDNT_RESOLVE_PROXY; + /* don't return yet, we need to clean up the timeout first */ + } + } + DEBUGASSERT(conn->dns_entry == NULL); + conn->dns_entry = hostaddr; + } + + return result; +} + +/* + * Cleanup the connection just allocated before we can move along and use the + * previously existing one. All relevant data is copied over and old_conn is + * ready for freeing once this function returns. + */ +static void reuse_conn(struct connectdata *old_conn, + struct connectdata *conn) +{ + if(old_conn->proxy.rawalloc) + free(old_conn->proxy.rawalloc); + + /* free the SSL config struct from this connection struct as this was + allocated in vain and is targeted for destruction */ + Curl_free_ssl_config(&old_conn->ssl_config); + + conn->data = old_conn->data; + + /* get the user+password information from the old_conn struct since it may + * be new for this request even when we re-use an existing connection */ + conn->bits.user_passwd = old_conn->bits.user_passwd; + if(conn->bits.user_passwd) { + /* use the new user name and password though */ + Curl_safefree(conn->user); + Curl_safefree(conn->passwd); + conn->user = old_conn->user; + conn->passwd = old_conn->passwd; + old_conn->user = NULL; + old_conn->passwd = NULL; + } + + conn->bits.proxy_user_passwd = old_conn->bits.proxy_user_passwd; + if(conn->bits.proxy_user_passwd) { + /* use the new proxy user name and proxy password though */ + Curl_safefree(conn->proxyuser); + Curl_safefree(conn->proxypasswd); + conn->proxyuser = old_conn->proxyuser; + conn->proxypasswd = old_conn->proxypasswd; + old_conn->proxyuser = NULL; + old_conn->proxypasswd = NULL; + } + + /* host can change, when doing keepalive with a proxy ! */ + if(conn->bits.proxy) { + free(conn->host.rawalloc); + conn->host=old_conn->host; + } + else + free(old_conn->host.rawalloc); /* free the newly allocated name buffer */ + + /* persist connection info in session handle */ + Curl_persistconninfo(conn); + + /* re-use init */ + conn->bits.reuse = TRUE; /* yes, we're re-using here */ + + Curl_safefree(old_conn->user); + Curl_safefree(old_conn->passwd); + Curl_safefree(old_conn->proxyuser); + Curl_safefree(old_conn->proxypasswd); + Curl_llist_destroy(old_conn->send_pipe, NULL); + Curl_llist_destroy(old_conn->recv_pipe, NULL); + Curl_llist_destroy(old_conn->pend_pipe, NULL); + Curl_llist_destroy(old_conn->done_pipe, NULL); + Curl_safefree(old_conn->master_buffer); +} + +/** + * create_conn() sets up a new connectdata struct, or re-uses an already + * existing one, and resolves host name. + * + * if this function returns CURLE_OK and *async is set to TRUE, the resolve + * response will be coming asynchronously. If *async is FALSE, the name is + * already resolved. + * + * @param data The sessionhandle pointer + * @param in_connect is set to the next connection data pointer + * @param async is set TRUE when an async DNS resolution is pending + * @see setup_conn() + * + * *NOTE* this function assigns the conn->data pointer! + */ + +static CURLcode create_conn(struct SessionHandle *data, + struct connectdata **in_connect, + bool *async) +{ + CURLcode result=CURLE_OK; + struct connectdata *conn; + struct connectdata *conn_temp = NULL; + size_t urllen; + char user[MAX_CURL_USER_LENGTH]; + char passwd[MAX_CURL_PASSWORD_LENGTH]; + bool reuse; + char *proxy = NULL; + bool prot_missing = FALSE; + + *async = FALSE; + + /************************************************************* + * Check input data + *************************************************************/ + + if(!data->change.url) + return CURLE_URL_MALFORMAT; + + /* First, split up the current URL in parts so that we can use the + parts for checking against the already present connections. In order + to not have to modify everything at once, we allocate a temporary + connection data struct and fill in for comparison purposes. */ + conn = allocate_conn(data); + + if(!conn) + return CURLE_OUT_OF_MEMORY; + + /* We must set the return variable as soon as possible, so that our + parent can cleanup any possible allocs we may have done before + any failure */ + *in_connect = conn; + + /* This initing continues below, see the comment "Continue connectdata + * initialization here" */ + + /*********************************************************** + * We need to allocate memory to store the path in. We get the size of the + * full URL to be sure, and we need to make it at least 256 bytes since + * other parts of the code will rely on this fact + ***********************************************************/ +#define LEAST_PATH_ALLOC 256 + urllen=strlen(data->change.url); + if(urllen < LEAST_PATH_ALLOC) + urllen=LEAST_PATH_ALLOC; + + /* + * We malloc() the buffers below urllen+2 to make room for to possibilities: + * 1 - an extra terminating zero + * 2 - an extra slash (in case a syntax like "www.host.com?moo" is used) + */ + + Curl_safefree(data->state.pathbuffer); + data->state.pathbuffer = malloc(urllen+2); + if(NULL == data->state.pathbuffer) + return CURLE_OUT_OF_MEMORY; /* really bad error */ + data->state.path = data->state.pathbuffer; + + conn->host.rawalloc = malloc(urllen+2); + if(NULL == conn->host.rawalloc) + return CURLE_OUT_OF_MEMORY; + + conn->host.name = conn->host.rawalloc; + conn->host.name[0] = 0; + + result = parseurlandfillconn(data, conn, &prot_missing); + if(result != CURLE_OK) { + return result; + } + + /************************************************************* + * No protocol part in URL was used, add it! + *************************************************************/ + if(prot_missing) { + /* We're guessing prefixes here and if we're told to use a proxy or if + we're gonna follow a Location: later or... then we need the protocol + part added so that we have a valid URL. */ + char *reurl; + + reurl = aprintf("%s://%s", conn->handler->scheme, data->change.url); + + if(!reurl) { + Curl_safefree(proxy); + return CURLE_OUT_OF_MEMORY; + } + + data->change.url = reurl; + data->change.url_alloc = TRUE; /* free this later */ + } + + /************************************************************* + * Parse a user name and password in the URL and strip it out + * of the host name + *************************************************************/ + result = parse_url_userpass(data, conn, user, passwd); + if(result != CURLE_OK) + return result; + +#ifndef CURL_DISABLE_PROXY + /************************************************************* + * Extract the user and password from the authentication string + *************************************************************/ + if(conn->bits.proxy_user_passwd) { + result = parse_proxy_auth(data, conn); + if(result != CURLE_OK) + return result; + } + + /************************************************************* + * Detect what (if any) proxy to use + *************************************************************/ + if(data->set.str[STRING_PROXY]) { + proxy = strdup(data->set.str[STRING_PROXY]); + /* if global proxy is set, this is it */ + if(NULL == proxy) { + failf(data, "memory shortage"); + return CURLE_OUT_OF_MEMORY; + } + } + + if(data->set.str[STRING_NOPROXY] && + check_noproxy(conn->host.name, data->set.str[STRING_NOPROXY])) { + if(proxy) { + free(proxy); /* proxy is in exception list */ + proxy = NULL; + } + } + else if(!proxy) + proxy = detect_proxy(conn); + + if(proxy && !*proxy) { + free(proxy); /* Don't bother with an empty proxy string */ + proxy = NULL; + } + /* proxy must be freed later unless NULL */ + if(proxy) { + long bits = conn->protocol & (PROT_HTTPS|PROT_SSL); + + if((conn->proxytype == CURLPROXY_HTTP) || + (conn->proxytype == CURLPROXY_HTTP_1_0)) { + /* force this connection's protocol to become HTTP */ + conn->protocol = PROT_HTTP | bits; + conn->bits.httpproxy = TRUE; + } + conn->bits.proxy = TRUE; + } + else { + /* we aren't using the proxy after all... */ + conn->bits.proxy = FALSE; + conn->bits.httpproxy = FALSE; + conn->bits.proxy_user_passwd = FALSE; + conn->bits.tunnel_proxy = FALSE; + } + + /*********************************************************************** + * If this is supposed to use a proxy, we need to figure out the proxy + * host name, so that we can re-use an existing connection + * that may exist registered to the same proxy host. + ***********************************************************************/ + if(proxy) { + result = parse_proxy(data, conn, proxy); + /* parse_proxy has freed the proxy string, so don't try to use it again */ + proxy = NULL; + if(result != CURLE_OK) + return result; + } +#endif /* CURL_DISABLE_PROXY */ + + /************************************************************* + * Setup internals depending on protocol. Needs to be done after + * we figured out what/if proxy to use. + *************************************************************/ + result = setup_connection_internals(conn); + if(result != CURLE_OK) { + Curl_safefree(proxy); + return result; + } + + conn->recv[FIRSTSOCKET] = Curl_recv_plain; + conn->send[FIRSTSOCKET] = Curl_send_plain; + conn->recv[SECONDARYSOCKET] = Curl_recv_plain; + conn->send[SECONDARYSOCKET] = Curl_send_plain; + + /*********************************************************************** + * file: is a special case in that it doesn't need a network connection + ***********************************************************************/ +#ifndef CURL_DISABLE_FILE + if(conn->protocol & PROT_FILE) { + bool done; + /* this is supposed to be the connect function so we better at least check + that the file is present here! */ + DEBUGASSERT(conn->handler->connect_it); + result = conn->handler->connect_it(conn, &done); + + /* Setup a "faked" transfer that'll do nothing */ + if(CURLE_OK == result) { + conn->data = data; + conn->bits.tcpconnect = TRUE; /* we are "connected */ + + ConnectionStore(data, conn); + + /* + * Setup whatever necessary for a resumed transfer + */ + result = setup_range(data); + if(result) { + DEBUGASSERT(conn->handler->done); + /* we ignore the return code for the protocol-specific DONE */ + (void)conn->handler->done(conn, result, FALSE); + return result; + } + + Curl_setup_transfer(conn, -1, -1, FALSE, NULL, /* no download */ + -1, NULL); /* no upload */ + } + + return result; + } +#endif + + /************************************************************* + * If the protocol is using SSL and HTTP proxy is used, we set + * the tunnel_proxy bit. + *************************************************************/ + if((conn->protocol&PROT_SSL) && conn->bits.httpproxy) + conn->bits.tunnel_proxy = TRUE; + + /************************************************************* + * Figure out the remote port number and fix it in the URL + *************************************************************/ + result = parse_remote_port(data, conn); + if(result != CURLE_OK) + return result; + + /************************************************************* + * Check for an overridden user name and password, then set it + * for use + *************************************************************/ + override_userpass(data, conn, user, passwd); + result = set_userpass(conn, user, passwd); + if(result != CURLE_OK) + return result; + + /* Get a cloned copy of the SSL config situation stored in the + connection struct. But to get this going nicely, we must first make + sure that the strings in the master copy are pointing to the correct + strings in the session handle strings array! + + Keep in mind that the pointers in the master copy are pointing to strings + that will be freed as part of the SessionHandle struct, but all cloned + copies will be separately allocated. + */ + data->set.ssl.CApath = data->set.str[STRING_SSL_CAPATH]; + data->set.ssl.CAfile = data->set.str[STRING_SSL_CAFILE]; + data->set.ssl.CRLfile = data->set.str[STRING_SSL_CRLFILE]; + data->set.ssl.issuercert = data->set.str[STRING_SSL_ISSUERCERT]; + data->set.ssl.random_file = data->set.str[STRING_SSL_RANDOM_FILE]; + data->set.ssl.egdsocket = data->set.str[STRING_SSL_EGDSOCKET]; + data->set.ssl.cipher_list = data->set.str[STRING_SSL_CIPHER_LIST]; + + if(!Curl_clone_ssl_config(&data->set.ssl, &conn->ssl_config)) + return CURLE_OUT_OF_MEMORY; + + /************************************************************* + * Check the current list of connections to see if we can + * re-use an already existing one or if we have to create a + * new one. + *************************************************************/ + + /* reuse_fresh is TRUE if we are told to use a new connection by force, but + we only acknowledge this option if this is not a re-used connection + already (which happens due to follow-location or during a HTTP + authentication phase). */ + if(data->set.reuse_fresh && !data->state.this_is_a_follow) + reuse = FALSE; + else + reuse = ConnectionExists(data, conn, &conn_temp); + + if(reuse) { + /* + * We already have a connection for this, we got the former connection + * in the conn_temp variable and thus we need to cleanup the one we + * just allocated before we can move along and use the previously + * existing one. + */ + reuse_conn(conn, conn_temp); + free(conn); /* we don't need this anymore */ + conn = conn_temp; + *in_connect = conn; + infof(data, "Re-using existing connection! (#%ld) with host %s\n", + conn->connectindex, + conn->proxy.name?conn->proxy.dispname:conn->host.dispname); + } + else { + /* + * This is a brand new connection, so let's store it in the connection + * cache of ours! + */ + ConnectionStore(data, conn); + } + + /* + * Setup whatever necessary for a resumed transfer + */ + result = setup_range(data); + if(result) + return result; + + /* Continue connectdata initialization here. */ + + /* + * Inherit the proper values from the urldata struct AFTER we have arranged + * the persistent connection stuff + */ + conn->fread_func = data->set.fread_func; + conn->fread_in = data->set.in; + conn->seek_func = data->set.seek_func; + conn->seek_client = data->set.seek_client; + + /************************************************************* + * Resolve the address of the server or proxy + *************************************************************/ + result = resolve_server(data, conn, async); + + return result; +} + +/* setup_conn() is called after the name resolve initiated in + * create_conn() is all done. + * + * setup_conn() also handles reused connections + * + * conn->data MUST already have been setup fine (in create_conn) + */ + +static CURLcode setup_conn(struct connectdata *conn, + bool *protocol_done) +{ + CURLcode result=CURLE_OK; + struct SessionHandle *data = conn->data; + + Curl_pgrsTime(data, TIMER_NAMELOOKUP); + + if(conn->protocol & PROT_FILE) { + /* There's nothing in this function to setup if we're only doing + a file:// transfer */ + *protocol_done = TRUE; + return result; + } + *protocol_done = FALSE; /* default to not done */ + + /* set proxy_connect_closed to false unconditionally already here since it + is used strictly to provide extra information to a parent function in the + case of proxy CONNECT failures and we must make sure we don't have it + lingering set from a previous invoke */ + conn->bits.proxy_connect_closed = FALSE; + + /* + * Set user-agent. Used for HTTP, but since we can attempt to tunnel + * basically anything through a http proxy we can't limit this based on + * protocol. + */ + if(data->set.str[STRING_USERAGENT]) { + Curl_safefree(conn->allocptr.uagent); + conn->allocptr.uagent = + aprintf("User-Agent: %s\r\n", data->set.str[STRING_USERAGENT]); + if(!conn->allocptr.uagent) + return CURLE_OUT_OF_MEMORY; + } + + data->req.headerbytecount = 0; + +#ifdef CURL_DO_LINEEND_CONV + data->state.crlf_conversions = 0; /* reset CRLF conversion counter */ +#endif /* CURL_DO_LINEEND_CONV */ + + for(;;) { + /* loop for CURL_SERVER_CLOSED_CONNECTION */ + + if(CURL_SOCKET_BAD == conn->sock[FIRSTSOCKET]) { + /* Try to connect only if not already connected */ + bool connected = FALSE; + + result = ConnectPlease(data, conn, &connected); + + if(connected) { + result = Curl_protocol_connect(conn, protocol_done); + if(CURLE_OK == result) + conn->bits.tcpconnect = TRUE; + } + else + conn->bits.tcpconnect = FALSE; + + /* if the connection was closed by the server while exchanging + authentication informations, retry with the new set + authentication information */ + if(conn->bits.proxy_connect_closed) { + /* reset the error buffer */ + if(data->set.errorbuffer) + data->set.errorbuffer[0] = '\0'; + data->state.errorbuf = FALSE; + continue; + } + + if(CURLE_OK != result) + return result; + } + else { + Curl_pgrsTime(data, TIMER_CONNECT); /* we're connected already */ + Curl_pgrsTime(data, TIMER_APPCONNECT); /* we're connected already */ + conn->bits.tcpconnect = TRUE; + *protocol_done = TRUE; + Curl_verboseconnect(conn); + Curl_updateconninfo(conn, conn->sock[FIRSTSOCKET]); + } + /* Stop the loop now */ + break; + } + + conn->now = Curl_tvnow(); /* time this *after* the connect is done, we + set this here perhaps a second time */ + +#ifdef __EMX__ + /* + * This check is quite a hack. We're calling _fsetmode to fix the problem + * with fwrite converting newline characters (you get mangled text files, + * and corrupted binary files when you download to stdout and redirect it to + * a file). + */ + + if((data->set.out)->_handle == NULL) { + _fsetmode(stdout, "b"); + } +#endif + + return result; +} + +CURLcode Curl_connect(struct SessionHandle *data, + struct connectdata **in_connect, + bool *asyncp, + bool *protocol_done) +{ + CURLcode code; + + *asyncp = FALSE; /* assume synchronous resolves by default */ + + /* call the stuff that needs to be called */ + code = create_conn(data, in_connect, asyncp); + + if(CURLE_OK == code) { + /* no error */ + if((*in_connect)->send_pipe->size || (*in_connect)->recv_pipe->size) + /* pipelining */ + *protocol_done = TRUE; + else if (!*asyncp) { + /* DNS resolution is done: that's either because this is a reused + connection, in which case DNS was unnecessary, or because DNS + really did finish already (synch resolver/fast async resolve) */ + code = setup_conn(*in_connect, protocol_done); + } + } + + if(code && *in_connect) { + /* We're not allowed to return failure with memory left allocated + in the connectdata struct, free those here */ + Curl_disconnect(*in_connect, FALSE); /* close the connection */ + *in_connect = NULL; /* return a NULL */ + } + + return code; +} + +/* Call this function after Curl_connect() has returned async=TRUE and + then a successful name resolve has been received. + + Note: this function disconnects and frees the conn data in case of + resolve failure */ +CURLcode Curl_async_resolved(struct connectdata *conn, + bool *protocol_done) +{ +#ifdef CURLRES_ASYNCH + CURLcode code; + + if(conn->async.dns) { + conn->dns_entry = conn->async.dns; + conn->async.dns = NULL; + } + + code = setup_conn(conn, protocol_done); + + if(code) + /* We're not allowed to return failure with memory left allocated + in the connectdata struct, free those here */ + Curl_disconnect(conn, FALSE); /* close the connection */ + + return code; +#else + (void)conn; + (void)protocol_done; + return CURLE_OK; +#endif +} + + +CURLcode Curl_done(struct connectdata **connp, + CURLcode status, /* an error if this is called after an + error was detected */ + bool premature) +{ + CURLcode result; + struct connectdata *conn; + struct SessionHandle *data; + + DEBUGASSERT(*connp); + + conn = *connp; + data = conn->data; + + if(conn->bits.done) + /* Stop if Curl_done() has already been called */ + return CURLE_OK; + + Curl_getoff_all_pipelines(data, conn); + + if((conn->send_pipe->size + conn->recv_pipe->size != 0 && + !data->set.reuse_forbid && + !conn->bits.close)) + /* Stop if pipeline is not empty and we do not have to close + connection. */ + return CURLE_OK; + + conn->bits.done = TRUE; /* called just now! */ + + /* Cleanup possible redirect junk */ + if(data->req.newurl) { + free(data->req.newurl); + data->req.newurl = NULL; + } + if(data->req.location) { + free(data->req.location); + data->req.location = NULL; + } + + if(conn->dns_entry) { + Curl_resolv_unlock(data, conn->dns_entry); /* done with this */ + conn->dns_entry = NULL; + } + + /* this calls the protocol-specific function pointer previously set */ + if(conn->handler->done) + result = conn->handler->done(conn, status, premature); + else + result = CURLE_OK; + + Curl_pgrsDone(conn); /* done with the operation */ + + /* if the transfer was completed in a paused state there can be buffered + data left to write and then kill */ + if(data->state.tempwrite) { + free(data->state.tempwrite); + data->state.tempwrite = NULL; + } + + /* for ares-using, make sure all possible outstanding requests are properly + cancelled before we proceed */ + ares_cancel(data->state.areschannel); + + /* if data->set.reuse_forbid is TRUE, it means the libcurl client has + forced us to close this no matter what we think. + + if conn->bits.close is TRUE, it means that the connection should be + closed in spite of all our efforts to be nice, due to protocol + restrictions in our or the server's end + + if premature is TRUE, it means this connection was said to be DONE before + the entire request operation is complete and thus we can't know in what + state it is for re-using, so we're forced to close it. In a perfect world + we can add code that keep track of if we really must close it here or not, + but currently we have no such detail knowledge. + + connectindex == -1 here means that the connection has no spot in the + connection cache and thus we must disconnect it here. + */ + if(data->set.reuse_forbid || conn->bits.close || premature || + (-1 == conn->connectindex)) { + CURLcode res2 = Curl_disconnect(conn, FALSE); /* close the connection */ + + /* If we had an error already, make sure we return that one. But + if we got a new error, return that. */ + if(!result && res2) + result = res2; + } + else { + ConnectionDone(conn); /* the connection is no longer in use */ + + /* remember the most recently used connection */ + data->state.lastconnect = conn->connectindex; + + infof(data, "Connection #%ld to host %s left intact\n", + conn->connectindex, + conn->bits.httpproxy?conn->proxy.dispname:conn->host.dispname); + } + + *connp = NULL; /* to make the caller of this function better detect that + this was either closed or handed over to the connection + cache here, and therefore cannot be used from this point on + */ + + return result; +} + +/* + * do_init() inits the readwrite session. This is inited each time (in the DO + * function before the protocol-specific DO functions are invoked) for a + * transfer, sometimes multiple times on the same SessionHandle. Make sure + * nothing in here depends on stuff that are setup dynamically for the + * transfer. + */ + +static CURLcode do_init(struct connectdata *conn) +{ + struct SessionHandle *data = conn->data; + struct SingleRequest *k = &data->req; + + conn->bits.done = FALSE; /* Curl_done() is not called yet */ + conn->bits.do_more = FALSE; /* by default there's no curl_do_more() to use */ + data->state.expect100header = FALSE; + + if(data->set.opt_no_body) + /* in HTTP lingo, no body means using the HEAD request... */ + data->set.httpreq = HTTPREQ_HEAD; + else if(HTTPREQ_HEAD == data->set.httpreq) + /* ... but if unset there really is no perfect method that is the + "opposite" of HEAD but in reality most people probably think GET + then. The important thing is that we can't let it remain HEAD if the + opt_no_body is set FALSE since then we'll behave wrong when getting + HTTP. */ + data->set.httpreq = HTTPREQ_GET; + + /* NB: the content encoding software depends on this initialization */ + Curl_easy_initHandleData(data); + + k->start = Curl_tvnow(); /* start time */ + k->now = k->start; /* current time is now */ + k->header = TRUE; /* assume header */ + + k->bytecount = 0; + + k->buf = data->state.buffer; + k->uploadbuf = data->state.uploadbuffer; + k->hbufp = data->state.headerbuff; + k->ignorebody=FALSE; + + Curl_pgrsTime(data, TIMER_PRETRANSFER); + Curl_speedinit(data); + + Curl_pgrsSetUploadCounter(data, 0); + Curl_pgrsSetDownloadCounter(data, 0); + + return CURLE_OK; +} + +/* + * do_complete is called when the DO actions are complete. + * + * We init chunking and trailer bits to their default values here immediately + * before receiving any header data for the current request in the pipeline. + */ +static void do_complete(struct connectdata *conn) +{ + conn->data->req.chunk=FALSE; + conn->data->req.maxfd = (conn->sockfd>conn->writesockfd? + conn->sockfd:conn->writesockfd)+1; +} + +CURLcode Curl_do(struct connectdata **connp, bool *done) +{ + CURLcode result=CURLE_OK; + struct connectdata *conn = *connp; + struct SessionHandle *data = conn->data; + + /* setup and init stuff before DO starts, in preparing for the transfer */ + do_init(conn); + + if(conn->handler->do_it) { + /* generic protocol-specific function pointer set in curl_connect() */ + result = conn->handler->do_it(conn, done); + + /* This was formerly done in transfer.c, but we better do it here */ + if((CURLE_SEND_ERROR == result) && conn->bits.reuse) { + /* + * If the connection is using an easy handle, call reconnect + * to re-establish the connection. Otherwise, let the multi logic + * figure out how to re-establish the connection. + */ + if(!data->multi) { + result = Curl_reconnect_request(connp); + + if(result == CURLE_OK) { + /* ... finally back to actually retry the DO phase */ + result = conn->handler->do_it(conn, done); + } + } + else { + return result; + } + } + + if((result == CURLE_OK) && *done) + /* do_complete must be called after the protocol-specific DO function */ + do_complete(conn); + } + return result; +} + +CURLcode Curl_do_more(struct connectdata *conn) +{ + CURLcode result=CURLE_OK; + + if(conn->handler->do_more) + result = conn->handler->do_more(conn); + + if(result == CURLE_OK) + /* do_complete must be called after the protocol-specific DO function */ + do_complete(conn); + + return result; +} + +/* Called on connect, and if there's already a protocol-specific struct + allocated for a different connection, this frees it that it can be setup + properly later on. */ +void Curl_reset_reqproto(struct connectdata *conn) +{ + struct SessionHandle *data = conn->data; + if(data->state.proto.generic && data->state.current_conn != conn) { + free(data->state.proto.generic); + data->state.proto.generic = NULL; + } + data->state.current_conn = conn; +} diff --git a/mobicore/common/curl/lib/url.h b/mobicore/common/curl/lib/url.h new file mode 100644 index 0000000000000000000000000000000000000000..241dc28c0936954ae4abf674e4f6f3a28c4d3348 --- /dev/null +++ b/mobicore/common/curl/lib/url.h @@ -0,0 +1,96 @@ +#ifndef __URL_H +#define __URL_H +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) 1998 - 2010, Daniel Stenberg, , et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at http://curl.haxx.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ***************************************************************************/ + +#include /* to make sure we have ap_list */ + +/* + * Prototypes for library-wide functions provided by url.c + */ + +CURLcode Curl_open(struct SessionHandle **curl); +CURLcode Curl_init_userdefined(struct UserDefined *set); +CURLcode Curl_setopt(struct SessionHandle *data, CURLoption option, + va_list arg); +CURLcode Curl_dupset(struct SessionHandle * dst, struct SessionHandle * src); +void Curl_freeset(struct SessionHandle * data); +CURLcode Curl_close(struct SessionHandle *data); /* opposite of curl_open() */ +CURLcode Curl_connect(struct SessionHandle *, struct connectdata **, + bool *async, bool *protocol_connect); +CURLcode Curl_async_resolved(struct connectdata *conn, + bool *protocol_connect); +CURLcode Curl_do(struct connectdata **, bool *done); +CURLcode Curl_do_more(struct connectdata *); +CURLcode Curl_done(struct connectdata **, CURLcode, bool premature); +CURLcode Curl_disconnect(struct connectdata *, bool dead_connection); +CURLcode Curl_protocol_connect(struct connectdata *conn, bool *done); +CURLcode Curl_protocol_connecting(struct connectdata *conn, bool *done); +CURLcode Curl_protocol_doing(struct connectdata *conn, bool *done); +void Curl_safefree(void *ptr); + +/* create a connection cache */ +struct conncache *Curl_mk_connc(int type, long amount); +/* free a connection cache */ +void Curl_rm_connc(struct conncache *c); +/* Change number of entries of a connection cache */ +CURLcode Curl_ch_connc(struct SessionHandle *data, + struct conncache *c, + long newamount); + +int Curl_protocol_getsock(struct connectdata *conn, + curl_socket_t *socks, + int numsocks); +int Curl_doing_getsock(struct connectdata *conn, + curl_socket_t *socks, + int numsocks); + +bool Curl_isPipeliningEnabled(const struct SessionHandle *handle); +CURLcode Curl_addHandleToPipeline(struct SessionHandle *handle, + struct curl_llist *pipeline); +int Curl_removeHandleFromPipeline(struct SessionHandle *handle, + struct curl_llist *pipeline); +/* remove the specified connection from all (possible) pipelines and related + queues */ +void Curl_getoff_all_pipelines(struct SessionHandle *data, + struct connectdata *conn); + +void Curl_close_connections(struct SessionHandle *data); + +/* Called on connect, and if there's already a protocol-specific struct + allocated for a different connection, this frees it that it can be setup + properly later on. */ +void Curl_reset_reqproto(struct connectdata *conn); + +#define CURL_DEFAULT_PROXY_PORT 1080 /* default proxy port unless specified */ +#define CURL_DEFAULT_SOCKS5_GSSAPI_SERVICE "rcmd" /* default socks5 gssapi service */ + +CURLcode Curl_connected_proxy(struct connectdata *conn); + +#ifdef CURL_DISABLE_VERBOSE_STRINGS +#define Curl_verboseconnect(x) do { } while (0) +#else +void Curl_verboseconnect(struct connectdata *conn); +#endif + + +#endif diff --git a/mobicore/common/curl/lib/urldata.h b/mobicore/common/curl/lib/urldata.h new file mode 100644 index 0000000000000000000000000000000000000000..f4f678620c7dbdc402755246b81b6e98f04cf3ff --- /dev/null +++ b/mobicore/common/curl/lib/urldata.h @@ -0,0 +1,1524 @@ +#ifndef __URLDATA_H +#define __URLDATA_H +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) 1998 - 2010, Daniel Stenberg, , et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at http://curl.haxx.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ***************************************************************************/ + +/* This file is for lib internal stuff */ + +#include "setup.h" + +#define PORT_FTP 21 +#define PORT_FTPS 990 +#define PORT_TELNET 23 +#define PORT_HTTP 80 +#define PORT_HTTPS 443 +#define PORT_DICT 2628 +#define PORT_LDAP 389 +#define PORT_LDAPS 636 +#define PORT_TFTP 69 +#define PORT_SSH 22 +#define PORT_IMAP 143 +#define PORT_IMAPS 993 +#define PORT_POP3 110 +#define PORT_POP3S 995 +#define PORT_SMTP 25 +#define PORT_SMTPS 465 /* sometimes called SSMTP */ +#define PORT_RTSP 554 +#define PORT_RTMP 1935 +#define PORT_RTMPT PORT_HTTP +#define PORT_RTMPS PORT_HTTPS +#define PORT_GOPHER 70 + +#define DICT_MATCH "/MATCH:" +#define DICT_MATCH2 "/M:" +#define DICT_MATCH3 "/FIND:" +#define DICT_DEFINE "/DEFINE:" +#define DICT_DEFINE2 "/D:" +#define DICT_DEFINE3 "/LOOKUP:" + +#define CURL_DEFAULT_USER "anonymous" +#define CURL_DEFAULT_PASSWORD "ftp@example.com" + +/* length of longest IPv6 address string including the trailing null */ +#define MAX_IPADR_LEN sizeof("ffff:ffff:ffff:ffff:ffff:ffff:255.255.255.255") + +/* Default FTP/IMAP etc response timeout in milliseconds. + Symbian OS panics when given a timeout much greater than 1/2 hour. +*/ +#define RESP_TIMEOUT (1800*1000) + +#include "cookie.h" +#include "formdata.h" + +#ifdef USE_SSLEAY +#ifdef USE_OPENSSL +#include "openssl/rsa.h" +#include "openssl/crypto.h" +#include "openssl/x509.h" +#include "openssl/pem.h" +#include "openssl/ssl.h" +#include "openssl/err.h" +#ifdef HAVE_OPENSSL_ENGINE_H +#include +#endif +#ifdef HAVE_OPENSSL_PKCS12_H +#include +#endif +#else /* SSLeay-style includes */ +#include "rsa.h" +#include "crypto.h" +#include "x509.h" +#include "pem.h" +#include "ssl.h" +#include "err.h" +#ifdef HAVE_OPENSSL_ENGINE_H +#include +#endif +#ifdef HAVE_OPENSSL_PKCS12_H +#include +#endif +#endif /* USE_OPENSSL */ +#ifdef USE_GNUTLS +#error Configuration error; cannot use GnuTLS *and* OpenSSL. +#endif +#endif /* USE_SSLEAY */ + +#ifdef USE_GNUTLS +#include +#endif + +#ifdef USE_POLARSSL +#include +#include +#endif + +#ifdef USE_NSS +#include +#include +#endif + +#ifdef USE_QSOSSL +#include +#endif + +#ifdef HAVE_NETINET_IN_H +#include +#endif + +#include "timeval.h" + +#ifdef HAVE_ZLIB_H +#include /* for content-encoding */ +#ifdef __SYMBIAN32__ +/* zlib pollutes the namespace with this definition */ +#undef WIN32 +#endif +#endif + +#ifdef USE_ARES +# if defined(CURL_STATICLIB) && !defined(CARES_STATICLIB) && \ + (defined(WIN32) || defined(_WIN32) || defined(__SYMBIAN32__)) +# define CARES_STATICLIB +# endif +# include +#endif + +#include + +#include "http_chunks.h" /* for the structs and enum stuff */ +#include "hostip.h" +#include "hash.h" +#include "splay.h" + +#include "imap.h" +#include "pop3.h" +#include "smtp.h" +#include "ftp.h" +#include "file.h" +#include "ssh.h" +#include "http.h" +#include "rtsp.h" +#include "wildcard.h" + +#ifdef HAVE_GSSAPI +# ifdef HAVE_GSSGNU +# include +# elif defined HAVE_GSSMIT +# include +# include +# else +# include +# endif +#endif + +#ifdef HAVE_LIBSSH2_H +#include +#include +#endif /* HAVE_LIBSSH2_H */ + +/* Download buffer size, keep it fairly big for speed reasons */ +#undef BUFSIZE +#define BUFSIZE CURL_MAX_WRITE_SIZE + +/* Initial size of the buffer to store headers in, it'll be enlarged in case + of need. */ +#define HEADERSIZE 256 + +#define CURLEASY_MAGIC_NUMBER 0xc0dedbadU + +/* Some convenience macros to get the larger/smaller value out of two given. + We prefix with CURL to prevent name collisions. */ +#define CURLMAX(x,y) ((x)>(y)?(x):(y)) +#define CURLMIN(x,y) ((x)<(y)?(x):(y)) + + +#if defined(HAVE_KRB4) || defined(HAVE_GSSAPI) +/* Types needed for krb4/5-ftp connections */ +struct krb4buffer { + void *data; + size_t size; + size_t index; + int eof_flag; +}; + +enum protection_level { + PROT_NONE, /* first in list */ + PROT_CLEAR, + PROT_SAFE, + PROT_CONFIDENTIAL, + PROT_PRIVATE, + PROT_CMD, + PROT_LAST /* last in list */ +}; +#endif + +/* enum for the nonblocking SSL connection state machine */ +typedef enum { + ssl_connect_1, + ssl_connect_2, + ssl_connect_2_reading, + ssl_connect_2_writing, + ssl_connect_3, + ssl_connect_done +} ssl_connect_state; + +typedef enum { + ssl_connection_none, + ssl_connection_negotiating, + ssl_connection_complete +} ssl_connection_state; + +/* struct for data related to each SSL connection */ +struct ssl_connect_data { + /* Use ssl encrypted communications TRUE/FALSE, not necessarily using it atm + but at least asked to or meaning to use it. See 'state' for the exact + current state of the connection. */ + bool use; + ssl_connection_state state; +#ifdef USE_SSLEAY + /* these ones requires specific SSL-types */ + SSL_CTX* ctx; + SSL* handle; + X509* server_cert; + ssl_connect_state connecting_state; +#endif /* USE_SSLEAY */ +#ifdef USE_GNUTLS + gnutls_session session; + gnutls_certificate_credentials cred; + ssl_connect_state connecting_state; +#endif /* USE_GNUTLS */ +#ifdef USE_POLARSSL + havege_state hs; + ssl_context ssl; + ssl_session ssn; + int server_fd; + x509_cert cacert; + x509_cert clicert; + x509_crl crl; + rsa_context rsa; +#endif /* USE_POLARSSL */ +#ifdef USE_NSS + PRFileDesc *handle; + char *client_nickname; + struct SessionHandle *data; +#ifdef HAVE_PK11_CREATEGENERICOBJECT + PK11GenericObject *key; + PK11GenericObject *cacert[2]; +#endif +#endif /* USE_NSS */ +#ifdef USE_QSOSSL + SSLHandle *handle; +#endif /* USE_QSOSSL */ +}; + +struct ssl_config_data { + long version; /* what version the client wants to use */ + long certverifyresult; /* result from the certificate verification */ + long verifypeer; /* set TRUE if this is desired */ + long verifyhost; /* 0: no verify + 1: check that CN exists + 2: CN must match hostname */ + char *CApath; /* certificate dir (doesn't work on windows) */ + char *CAfile; /* certificate to verify peer against */ + const char *CRLfile; /* CRL to check certificate revocation */ + const char *issuercert;/* optional issuer certificate filename */ + char *random_file; /* path to file containing "random" data */ + char *egdsocket; /* path to file containing the EGD daemon socket */ + char *cipher_list; /* list of ciphers to use */ + long numsessions; /* SSL session id cache size */ + curl_ssl_ctx_callback fsslctx; /* function to initialize ssl ctx */ + void *fsslctxp; /* parameter for call back */ + bool sessionid; /* cache session IDs or not */ + bool certinfo; /* gather lots of certificate info */ +}; + +/* information stored about one single SSL session */ +struct curl_ssl_session { + char *name; /* host name for which this ID was used */ + void *sessionid; /* as returned from the SSL layer */ + size_t idsize; /* if known, otherwise 0 */ + long age; /* just a number, the higher the more recent */ + unsigned short remote_port; /* remote port to connect to */ + struct ssl_config_data ssl_config; /* setup for this session */ +}; + +/* Struct used for Digest challenge-response authentication */ +struct digestdata { + char *nonce; + char *cnonce; + char *realm; + int algo; + bool stale; /* set true for re-negotiation */ + char *opaque; + char *qop; + char *algorithm; + int nc; /* nounce count */ +}; + +typedef enum { + NTLMSTATE_NONE, + NTLMSTATE_TYPE1, + NTLMSTATE_TYPE2, + NTLMSTATE_TYPE3, + NTLMSTATE_LAST +} curlntlm; + +#ifdef USE_WINDOWS_SSPI +#include "curl_sspi.h" +#endif + +#if defined(CURL_DOES_CONVERSIONS) && defined(HAVE_ICONV) +#include +#endif + +/* Struct used for NTLM challenge-response authentication */ +struct ntlmdata { + curlntlm state; +#ifdef USE_WINDOWS_SSPI + CredHandle handle; + CtxtHandle c_handle; + SEC_WINNT_AUTH_IDENTITY identity; + SEC_WINNT_AUTH_IDENTITY *p_identity; + int has_handles; + void *type_2; + int n_type_2; +#else + unsigned int flags; + unsigned char nonce[8]; +#endif +}; + +#ifdef HAVE_GSSAPI +struct negotiatedata { + /* when doing Negotiate we first need to receive an auth token and then we + need to send our header */ + enum { GSS_AUTHNONE, GSS_AUTHRECV, GSS_AUTHSENT } state; + bool gss; /* Whether we're processing GSS-Negotiate or Negotiate */ + const char* protocol; /* "GSS-Negotiate" or "Negotiate" */ + OM_uint32 status; + gss_ctx_id_t context; + gss_name_t server_name; + gss_buffer_desc output_token; +}; +#endif + + +/* + * Boolean values that concerns this connection. + */ +struct ConnectBits { + bool close; /* if set, we close the connection after this request */ + bool reuse; /* if set, this is a re-used connection */ + bool proxy; /* if set, this transfer is done through a proxy - any type */ + bool httpproxy; /* if set, this transfer is done through a http proxy */ + bool user_passwd; /* do we use user+password for this connection? */ + bool proxy_user_passwd; /* user+password for the proxy? */ + bool ipv6_ip; /* we communicate with a remote site specified with pure IPv6 + IP address */ + bool ipv6; /* we communicate with a site using an IPv6 address */ + + bool do_more; /* this is set TRUE if the ->curl_do_more() function is + supposed to be called, after ->curl_do() */ + + bool tcpconnect; /* the TCP layer (or similar) is connected, this is set + the first time on the first connect function call */ + bool protoconnstart;/* the protocol layer has STARTED its operation after + the TCP layer connect */ + + bool retry; /* this connection is about to get closed and then + re-attempted at another connection. */ + bool tunnel_proxy; /* if CONNECT is used to "tunnel" through the proxy. + This is implicit when SSL-protocols are used through + proxies, but can also be enabled explicitly by + apps */ + bool tunnel_connecting; /* TRUE while we're still waiting for a proxy CONNECT + */ + bool authneg; /* TRUE when the auth phase has started, which means + that we are creating a request with an auth header, + but it is not the final request in the auth + negotiation. */ + bool rewindaftersend;/* TRUE when the sending couldn't be stopped even + though it will be discarded. When the whole send + operation is done, we must call the data rewind + callback. */ + bool ftp_use_epsv; /* As set with CURLOPT_FTP_USE_EPSV, but if we find out + EPSV doesn't work we disable it for the forthcoming + requests */ + + bool ftp_use_eprt; /* As set with CURLOPT_FTP_USE_EPRT, but if we find out + EPRT doesn't work we disable it for the forthcoming + requests */ + bool netrc; /* name+password provided by netrc */ + bool userpwd_in_url; /* name+password found in url */ + + bool done; /* set to FALSE when Curl_do() is called and set to TRUE + when Curl_done() is called, to prevent Curl_done() to + get invoked twice when the multi interface is + used. */ + bool stream_was_rewound; /* Indicates that the stream was rewound after a + request read past the end of its response byte + boundary */ + bool proxy_connect_closed; /* set true if a proxy disconnected the + connection in a CONNECT request with auth, so + that libcurl should reconnect and continue. */ + bool bound; /* set true if bind() has already been done on this socket/ + connection */ + bool type_set; /* type= was used in the URL */ +}; + +struct hostname { + char *rawalloc; /* allocated "raw" version of the name */ + char *encalloc; /* allocated IDN-encoded version of the name */ + char *name; /* name to use internally, might be encoded, might be raw */ + const char *dispname; /* name to display, as 'name' might be encoded */ +}; + +/* + * Flags on the keepon member of the Curl_transfer_keeper + */ + +#define KEEP_NONE 0 +#define KEEP_RECV (1<<0) /* there is or may be data to read */ +#define KEEP_SEND (1<<1) /* there is or may be data to write */ +#define KEEP_RECV_HOLD (1<<2) /* when set, no reading should be done but there + might still be data to read */ +#define KEEP_SEND_HOLD (1<<3) /* when set, no writing should be done but there + might still be data to write */ +#define KEEP_RECV_PAUSE (1<<4) /* reading is paused */ +#define KEEP_SEND_PAUSE (1<<5) /* writing is paused */ + +#define KEEP_RECVBITS (KEEP_RECV | KEEP_RECV_HOLD | KEEP_RECV_PAUSE) +#define KEEP_SENDBITS (KEEP_SEND | KEEP_SEND_HOLD | KEEP_SEND_PAUSE) + + +#ifdef HAVE_LIBZ +typedef enum { + ZLIB_UNINIT, /* uninitialized */ + ZLIB_INIT, /* initialized */ + ZLIB_GZIP_HEADER, /* reading gzip header */ + ZLIB_GZIP_INFLATING, /* inflating gzip stream */ + ZLIB_INIT_GZIP /* initialized in transparent gzip mode */ +} zlibInitState; +#endif + +#ifdef CURLRES_ASYNCH +struct Curl_async { + char *hostname; + int port; + struct Curl_dns_entry *dns; + bool done; /* set TRUE when the lookup is complete */ + int status; /* if done is TRUE, this is the status from the callback */ + void *os_specific; /* 'struct thread_data' for Windows */ +}; +#endif + +#define FIRSTSOCKET 0 +#define SECONDARYSOCKET 1 + +/* These function pointer types are here only to allow easier typecasting + within the source when we need to cast between data pointers (such as NULL) + and function pointers. */ +typedef CURLcode (*Curl_do_more_func)(struct connectdata *); +typedef CURLcode (*Curl_done_func)(struct connectdata *, CURLcode, bool); + + +enum expect100 { + EXP100_SEND_DATA, /* enough waiting, just send the body now */ + EXP100_AWAITING_CONTINUE, /* waiting for the 100 Continue header */ + EXP100_SENDING_REQUEST, /* still sending the request but will wait for + the 100 header once done with the request */ + EXP100_FAILED /* used on 417 Expectation Failed */ +}; + +/* + * Request specific data in the easy handle (SessionHandle). Previously, + * these members were on the connectdata struct but since a conn struct may + * now be shared between different SessionHandles, we store connection-specific + * data here. This struct only keeps stuff that's interesting for *this* + * request, as it will be cleared between multiple ones + */ +struct SingleRequest { + curl_off_t size; /* -1 if unknown at this point */ + curl_off_t *bytecountp; /* return number of bytes read or NULL */ + + curl_off_t maxdownload; /* in bytes, the maximum amount of data to fetch, + -1 means unlimited */ + curl_off_t *writebytecountp; /* return number of bytes written or NULL */ + + curl_off_t bytecount; /* total number of bytes read */ + curl_off_t writebytecount; /* number of bytes written */ + + long headerbytecount; /* only count received headers */ + long deductheadercount; /* this amount of bytes doesn't count when we check + if anything has been transfered at the end of a + connection. We use this counter to make only a + 100 reply (without a following second response + code) result in a CURLE_GOT_NOTHING error code */ + + struct timeval start; /* transfer started at this time */ + struct timeval now; /* current time */ + bool header; /* incoming data has HTTP header */ + enum { + HEADER_NORMAL, /* no bad header at all */ + HEADER_PARTHEADER, /* part of the chunk is a bad header, the rest + is normal data */ + HEADER_ALLBAD /* all was believed to be header */ + } badheader; /* the header was deemed bad and will be + written as body */ + int headerline; /* counts header lines to better track the + first one */ + char *hbufp; /* points at *end* of header line */ + size_t hbuflen; + char *str; /* within buf */ + char *str_start; /* within buf */ + char *end_ptr; /* within buf */ + char *p; /* within headerbuff */ + bool content_range; /* set TRUE if Content-Range: was found */ + curl_off_t offset; /* possible resume offset read from the + Content-Range: header */ + int httpcode; /* error code from the 'HTTP/1.? XXX' or + 'RTSP/1.? XXX' line */ + struct timeval start100; /* time stamp to wait for the 100 code from */ + enum expect100 exp100; /* expect 100 continue state */ + + int content_encoding; /* What content encoding. sec 3.5, RFC2616. */ + +#define IDENTITY 0 /* No encoding */ +#define DEFLATE 1 /* zlib deflate [RFC 1950 & 1951] */ +#define GZIP 2 /* gzip algorithm [RFC 1952] */ +#define COMPRESS 3 /* Not handled, added for completeness */ + +#ifdef HAVE_LIBZ + zlibInitState zlib_init; /* possible zlib init state; + undefined if Content-Encoding header. */ + z_stream z; /* State structure for zlib. */ +#endif + + time_t timeofdoc; + long bodywrites; + + char *buf; + char *uploadbuf; + curl_socket_t maxfd; + + int keepon; + + bool upload_done; /* set to TRUE when doing chunked transfer-encoding upload + and we're uploading the last chunk */ + + bool ignorebody; /* we read a response-body but we ignore it! */ + bool ignorecl; /* This HTTP response has no body so we ignore the Content- + Length: header */ + + char *location; /* This points to an allocated version of the Location: + header data */ + char *newurl; /* Set to the new URL to use when a redirect or a retry is + wanted */ + + /* 'upload_present' is used to keep a byte counter of how much data there is + still left in the buffer, aimed for upload. */ + ssize_t upload_present; + + /* 'upload_fromhere' is used as a read-pointer when we uploaded parts of a + buffer, so the next read should read from where this pointer points to, + and the 'upload_present' contains the number of bytes available at this + position */ + char *upload_fromhere; + + bool chunk; /* if set, this is a chunked transfer-encoding */ + bool upload_chunky; /* set TRUE if we are doing chunked transfer-encoding + on upload */ + bool getheader; /* TRUE if header parsing is wanted */ + + bool forbidchunk; /* used only to explicitly forbid chunk-upload for + specific upload buffers. See readmoredata() in + http.c for details. */ +}; + +/* + * Specific protocol handler. + */ + +struct Curl_handler { + const char * scheme; /* URL scheme name. */ + + /* Complement to setup_connection_internals(). */ + CURLcode (*setup_connection)(struct connectdata *); + + /* These two functions MUST be set to be protocol dependent */ + CURLcode (*do_it)(struct connectdata *, bool *done); + Curl_done_func done; + + /* If the curl_do() function is better made in two halves, this + * curl_do_more() function will be called afterwards, if set. For example + * for doing the FTP stuff after the PASV/PORT command. + */ + Curl_do_more_func do_more; + + /* This function *MAY* be set to a protocol-dependent function that is run + * after the connect() and everything is done, as a step in the connection. + * The 'done' pointer points to a bool that should be set to TRUE if the + * function completes before return. If it doesn't complete, the caller + * should call the curl_connecting() function until it is. + */ + CURLcode (*connect_it)(struct connectdata *, bool *done); + + /* See above. Currently only used for FTP. */ + CURLcode (*connecting)(struct connectdata *, bool *done); + CURLcode (*doing)(struct connectdata *, bool *done); + + /* Called from the multi interface during the PROTOCONNECT phase, and it + should then return a proper fd set */ + int (*proto_getsock)(struct connectdata *conn, + curl_socket_t *socks, + int numsocks); + + /* Called from the multi interface during the DOING phase, and it should + then return a proper fd set */ + int (*doing_getsock)(struct connectdata *conn, + curl_socket_t *socks, + int numsocks); + + /* Called from the multi interface during the DO_DONE, PERFORM and + WAITPERFORM phases, and it should then return a proper fd set. Not setting + this will make libcurl use the generic default one. */ + int (*perform_getsock)(const struct connectdata *conn, + curl_socket_t *socks, + int numsocks); + + /* This function *MAY* be set to a protocol-dependent function that is run + * by the curl_disconnect(), as a step in the disconnection. If the handler + * is called because the connection has been considered dead, dead_connection + * is set to TRUE. + */ + CURLcode (*disconnect)(struct connectdata *, bool dead_connection); + + long defport; /* Default port. */ + long protocol; /* PROT_* flags concerning the protocol set */ +}; + +/* return the count of bytes sent, or -1 on error */ +typedef ssize_t (Curl_send)(struct connectdata *conn, /* connection data */ + int sockindex, /* socketindex */ + const void *buf, /* data to write */ + size_t len, /* max amount to write */ + CURLcode *err); /* error to return */ + +/* return the count of bytes read, or -1 on error */ +typedef ssize_t (Curl_recv)(struct connectdata *conn, /* connection data */ + int sockindex, /* socketindex */ + char *buf, /* store data here */ + size_t len, /* max amount to read */ + CURLcode *err); /* error to return */ + +/* + * The connectdata struct contains all fields and variables that should be + * unique for an entire connection. + */ +struct connectdata { + /* 'data' is the CURRENT SessionHandle using this connection -- take great + caution that this might very well vary between different times this + connection is used! */ + struct SessionHandle *data; + + /* chunk is for HTTP chunked encoding, but is in the general connectdata + struct only because we can do just about any protocol through a HTTP proxy + and a HTTP proxy may in fact respond using chunked encoding */ + struct Curl_chunker chunk; + + bool inuse; /* This is a marker for the connection cache logic. If this is + TRUE this handle is being used by an easy handle and cannot + be used by any other easy handle without careful + consideration (== only for pipelining). */ + + /**** Fields set when inited and not modified again */ + long connectindex; /* what index in the connection cache connects index this + particular struct has */ + long protocol; /* PROT_* flags concerning the protocol set */ +#define PROT_HTTP CURLPROTO_HTTP +#define PROT_HTTPS CURLPROTO_HTTPS +#define PROT_FTP CURLPROTO_FTP +#define PROT_TELNET CURLPROTO_TELNET +#define PROT_DICT CURLPROTO_DICT +#define PROT_LDAP CURLPROTO_LDAP +#define PROT_FILE CURLPROTO_FILE +#define PROT_FTPS CURLPROTO_FTPS +#define PROT_TFTP CURLPROTO_TFTP +#define PROT_SCP CURLPROTO_SCP +#define PROT_SFTP CURLPROTO_SFTP +#define PROT_IMAP CURLPROTO_IMAP +#define PROT_IMAPS CURLPROTO_IMAPS +#define PROT_POP3 CURLPROTO_POP3 +#define PROT_POP3S CURLPROTO_POP3S +#define PROT_SMTP CURLPROTO_SMTP +#define PROT_SMTPS CURLPROTO_SMTPS +#define PROT_RTSP CURLPROTO_RTSP +#define PROT_RTMP CURLPROTO_RTMP +#define PROT_RTMPT CURLPROTO_RTMPT +#define PROT_RTMPE CURLPROTO_RTMPE +#define PROT_RTMPTE CURLPROTO_RTMPTE +#define PROT_RTMPS CURLPROTO_RTMPS +#define PROT_RTMPTS CURLPROTO_RTMPTS +#define PROT_GOPHER CURLPROTO_GOPHER + +/* (1<<25) is currently the highest used bit in the public bitmask. We make + sure we use "private bits" above the public ones to make things easier; + Gopher will not conflict with the current bit 25. */ + +#define PROT_EXTMASK 0x03ffffff + +#define PROT_SSL (1<<29) /* protocol requires SSL */ + +/* these ones need action before socket close */ +#define PROT_CLOSEACTION (PROT_FTP | PROT_IMAP | PROT_POP3) +#define PROT_DUALCHANNEL PROT_FTP /* these protocols use two connections */ + + /* 'dns_entry' is the particular host we use. This points to an entry in the + DNS cache and it will not get pruned while locked. It gets unlocked in + Curl_done(). This entry will be NULL if the connection is re-used as then + there is no name resolve done. */ + struct Curl_dns_entry *dns_entry; + + /* 'ip_addr' is the particular IP we connected to. It points to a struct + within the DNS cache, so this pointer is only valid as long as the DNS + cache entry remains locked. It gets unlocked in Curl_done() */ + Curl_addrinfo *ip_addr; + + /* 'ip_addr_str' is the ip_addr data as a human readable string. + It remains available as long as the connection does, which is longer than + the ip_addr itself. */ + char ip_addr_str[MAX_IPADR_LEN]; + + unsigned int scope; /* address scope for IPv6 */ + + int socktype; /* SOCK_STREAM or SOCK_DGRAM */ + + struct hostname host; + struct hostname proxy; + + long port; /* which port to use locally */ + unsigned short remote_port; /* what remote port to connect to, + not the proxy port! */ + + /* 'primary_ip' and 'primary_port' get filled with peer's numerical + ip address and port number whenever an outgoing connection is + *attemted* from the primary socket to a remote address. When more + than one address is tried for a connection these will hold data + for the last attempt. When the connection is actualy established + these are updated with data which comes directly from the socket. */ + + char primary_ip[MAX_IPADR_LEN]; + long primary_port; + + /* 'local_ip' and 'local_port' get filled with local's numerical + ip address and port number whenever an outgoing connection is + **established** from the primary socket to a remote address. */ + + char local_ip[MAX_IPADR_LEN]; + long local_port; + + char *user; /* user name string, allocated */ + char *passwd; /* password string, allocated */ + + char *proxyuser; /* proxy user name string, allocated */ + char *proxypasswd; /* proxy password string, allocated */ + curl_proxytype proxytype; /* what kind of proxy that is in use */ + + int httpversion; /* the HTTP version*10 reported by the server */ + int rtspversion; /* the RTSP version*10 reported by the server */ + + struct timeval now; /* "current" time */ + struct timeval created; /* creation time */ + curl_socket_t sock[2]; /* two sockets, the second is used for the data + transfer when doing FTP */ + + Curl_recv *recv[2]; + Curl_send *send[2]; + + struct ssl_connect_data ssl[2]; /* this is for ssl-stuff */ + struct ssl_config_data ssl_config; + + struct ConnectBits bits; /* various state-flags for this connection */ + + const struct Curl_handler * handler; /* Connection's protocol handler. */ + + long ip_version; /* copied from the SessionHandle at creation time */ + + /**** curl_get() phase fields */ + + curl_socket_t sockfd; /* socket to read from or CURL_SOCKET_BAD */ + curl_socket_t writesockfd; /* socket to write to, it may very + well be the same we read from. + CURL_SOCKET_BAD disables */ + + /** Dynamicly allocated strings, may need to be freed before this **/ + /** struct is killed. **/ + struct dynamically_allocated_data { + char *proxyuserpwd; /* free later if not NULL! */ + char *uagent; /* free later if not NULL! */ + char *accept_encoding; /* free later if not NULL! */ + char *userpwd; /* free later if not NULL! */ + char *rangeline; /* free later if not NULL! */ + char *ref; /* free later if not NULL! */ + char *host; /* free later if not NULL */ + char *cookiehost; /* free later if not NULL */ + char *rtsp_transport; /* free later if not NULL */ + } allocptr; + + int sec_complete; /* if kerberos is enabled for this connection */ +#if defined(HAVE_KRB4) || defined(HAVE_GSSAPI) + enum protection_level command_prot; + enum protection_level data_prot; + enum protection_level request_data_prot; + size_t buffer_size; + struct krb4buffer in_buffer; + void *app_data; + const struct Curl_sec_client_mech *mech; + struct sockaddr_in local_addr; +#endif + + /* the two following *_inuse fields are only flags, not counters in any way. + If TRUE it means the channel is in use, and if FALSE it means the channel + is up for grabs by one. */ + + bool readchannel_inuse; /* whether the read channel is in use by an easy + handle */ + bool writechannel_inuse; /* whether the write channel is in use by an easy + handle */ + bool server_supports_pipelining; /* TRUE if server supports pipelining, + set after first response */ + + struct curl_llist *send_pipe; /* List of handles waiting to + send on this pipeline */ + struct curl_llist *recv_pipe; /* List of handles waiting to read + their responses on this pipeline */ + struct curl_llist *pend_pipe; /* List of pending handles on + this pipeline */ + struct curl_llist *done_pipe; /* Handles that are finished, but + still reference this connectdata */ +#define MAX_PIPELINE_LENGTH 5 + + char* master_buffer; /* The master buffer allocated on-demand; + used for pipelining. */ + size_t read_pos; /* Current read position in the master buffer */ + size_t buf_len; /* Length of the buffer?? */ + + + curl_seek_callback seek_func; /* function that seeks the input */ + void *seek_client; /* pointer to pass to the seek() above */ + + /*************** Request - specific items ************/ + + /* previously this was in the urldata struct */ + curl_read_callback fread_func; /* function that reads the input */ + void *fread_in; /* pointer to pass to the fread() above */ + + struct ntlmdata ntlm; /* NTLM differs from other authentication schemes + because it authenticates connections, not + single requests! */ + struct ntlmdata proxyntlm; /* NTLM data for proxy */ + + char syserr_buf [256]; /* buffer for Curl_strerror() */ + +#ifdef CURLRES_ASYNCH + /* data used for the asynch name resolve callback */ + struct Curl_async async; +#endif + + /* These three are used for chunked-encoding trailer support */ + char *trailer; /* allocated buffer to store trailer in */ + int trlMax; /* allocated buffer size */ + int trlPos; /* index of where to store data */ + + union { + struct ftp_conn ftpc; + struct ssh_conn sshc; + struct tftp_state_data *tftpc; + struct imap_conn imapc; + struct pop3_conn pop3c; + struct smtp_conn smtpc; + struct rtsp_conn rtspc; + void *generic; + } proto; + + int cselect_bits; /* bitmask of socket events */ + int waitfor; /* current READ/WRITE bits to wait for */ + +#if defined(HAVE_GSSAPI) || defined(USE_WINDOWS_SSPI) + int socks5_gssapi_enctype; +#endif + + long verifypeer; + long verifyhost; +}; + +/* The end of connectdata. */ + +/* + * Struct to keep statistical and informational data. + */ +struct PureInfo { + int httpcode; /* Recent HTTP, FTP, or RTSP response code */ + int httpproxycode; /* response code from proxy when received separate */ + int httpversion; /* the http version number X.Y = X*10+Y */ + long filetime; /* If requested, this is might get set. Set to -1 if the time + was unretrievable. We cannot have this of type time_t, + since time_t is unsigned on several platforms such as + OpenVMS. */ + bool timecond; /* set to TRUE if the time condition didn't match, which + thus made the document NOT get fetched */ + long header_size; /* size of read header(s) in bytes */ + long request_size; /* the amount of bytes sent in the request(s) */ + long proxyauthavail; /* what proxy auth types were announced */ + long httpauthavail; /* what host auth types were announced */ + long numconnects; /* how many new connection did libcurl created */ + char *contenttype; /* the content type of the object */ + char *wouldredirect; /* URL this would've been redirected to if asked to */ + + /* PureInfo members 'conn_primary_ip', 'conn_primary_port', 'conn_local_ip' + and, 'conn_local_port' are copied over from the connectdata struct in + order to allow curl_easy_getinfo() to return this information even when + the session handle is no longer associated with a connection, and also + allow curl_easy_reset() to clear this information from the session handle + without disturbing information which is still alive, and that might be + reused, in the connection cache. */ + + char conn_primary_ip[MAX_IPADR_LEN]; + long conn_primary_port; + + char conn_local_ip[MAX_IPADR_LEN]; + long conn_local_port; + + struct curl_certinfo certs; /* info about the certs, only populated in + OpenSSL builds. Asked for with + CURLOPT_CERTINFO / CURLINFO_CERTINFO */ +}; + + +struct Progress { + long lastshow; /* time() of the last displayed progress meter or NULL to + force redraw at next call */ + curl_off_t size_dl; /* total expected size */ + curl_off_t size_ul; /* total expected size */ + curl_off_t downloaded; /* transfered so far */ + curl_off_t uploaded; /* transfered so far */ + + curl_off_t current_speed; /* uses the currently fastest transfer */ + + bool callback; /* set when progress callback is used */ + int width; /* screen width at download start */ + int flags; /* see progress.h */ + + double timespent; + + curl_off_t dlspeed; + curl_off_t ulspeed; + + double t_nslookup; + double t_connect; + double t_appconnect; + double t_pretransfer; + double t_starttransfer; + double t_redirect; + + struct timeval start; + struct timeval t_startsingle; +#define CURR_TIME (5+1) /* 6 entries for 5 seconds */ + + curl_off_t speeder[ CURR_TIME ]; + struct timeval speeder_time[ CURR_TIME ]; + int speeder_c; +}; + +typedef enum { + HTTPREQ_NONE, /* first in list */ + HTTPREQ_GET, + HTTPREQ_POST, + HTTPREQ_POST_FORM, /* we make a difference internally */ + HTTPREQ_PUT, + HTTPREQ_HEAD, + HTTPREQ_CUSTOM, + HTTPREQ_LAST /* last in list */ +} Curl_HttpReq; + +typedef enum { + RTSPREQ_NONE, /* first in list */ + RTSPREQ_OPTIONS, + RTSPREQ_DESCRIBE, + RTSPREQ_ANNOUNCE, + RTSPREQ_SETUP, + RTSPREQ_PLAY, + RTSPREQ_PAUSE, + RTSPREQ_TEARDOWN, + RTSPREQ_GET_PARAMETER, + RTSPREQ_SET_PARAMETER, + RTSPREQ_RECORD, + RTSPREQ_RECEIVE, + RTSPREQ_LAST /* last in list */ +} Curl_RtspReq; + +/* + * Values that are generated, temporary or calculated internally for a + * "session handle" must be defined within the 'struct UrlState'. This struct + * will be used within the SessionHandle struct. When the 'SessionHandle' + * struct is cloned, this data MUST NOT be copied. + * + * Remember that any "state" information goes globally for the curl handle. + * Session-data MUST be put in the connectdata struct and here. */ +#define MAX_CURL_USER_LENGTH 256 +#define MAX_CURL_PASSWORD_LENGTH 256 +#define MAX_CURL_USER_LENGTH_TXT "255" +#define MAX_CURL_PASSWORD_LENGTH_TXT "255" + +struct auth { + long want; /* Bitmask set to the authentication methods wanted by the app + (with CURLOPT_HTTPAUTH or CURLOPT_PROXYAUTH). */ + long picked; + long avail; /* bitmask for what the server reports to support for this + resource */ + bool done; /* TRUE when the auth phase is done and ready to do the *actual* + request */ + bool multi; /* TRUE if this is not yet authenticated but within the auth + multipass negotiation */ + bool iestyle; /* TRUE if digest should be done IE-style or FALSE if it should + be RFC compliant */ +}; + +struct conncache { + /* 'connects' will be an allocated array with pointers. If the pointer is + set, it holds an allocated connection. */ + struct connectdata **connects; + long num; /* number of entries of the 'connects' array */ + enum { + CONNCACHE_PRIVATE, /* used for an easy handle alone */ + CONNCACHE_MULTI /* shared within a multi handle */ + } type; +}; + + +struct UrlState { + enum { + Curl_if_none, + Curl_if_easy, + Curl_if_multi + } used_interface; + + struct conncache *connc; /* points to the connection cache this handle + uses */ + + /* buffers to store authentication data in, as parsed from input options */ + struct timeval keeps_speed; /* for the progress meter really */ + + long lastconnect; /* index of most recent connect or -1 if undefined */ + + char *headerbuff; /* allocated buffer to store headers in */ + size_t headersize; /* size of the allocation */ + + char buffer[BUFSIZE+1]; /* download buffer */ + char uploadbuffer[BUFSIZE+1]; /* upload buffer */ + curl_off_t current_speed; /* the ProgressShow() funcion sets this, + bytes / second */ + bool this_is_a_follow; /* this is a followed Location: request */ + + char *first_host; /* if set, this should be the host name that we will + sent authorization to, no else. Used to make Location: + following not keep sending user+password... This is + strdup() data. + */ + struct curl_ssl_session *session; /* array of 'numsessions' size */ + long sessionage; /* number of the most recent session */ + char *tempwrite; /* allocated buffer to keep data in when a write + callback returns to make the connection paused */ + size_t tempwritesize; /* size of the 'tempwrite' allocated buffer */ + int tempwritetype; /* type of the 'tempwrite' buffer as a bitmask that is + used with Curl_client_write() */ + char *scratch; /* huge buffer[BUFSIZE*2] when doing upload CRLF replacing */ + bool errorbuf; /* Set to TRUE if the error buffer is already filled in. + This must be set to FALSE every time _easy_perform() is + called. */ + int os_errno; /* filled in with errno whenever an error occurs */ +#ifdef HAVE_SIGNAL + /* storage for the previous bag^H^H^HSIGPIPE signal handler :-) */ + void (*prev_signal)(int sig); +#endif + bool allow_port; /* Is set.use_port allowed to take effect or not. This + is always set TRUE when curl_easy_perform() is called. */ + struct digestdata digest; /* state data for host Digest auth */ + struct digestdata proxydigest; /* state data for proxy Digest auth */ + +#ifdef HAVE_GSSAPI + struct negotiatedata negotiate; /* state data for host Negotiate auth */ + struct negotiatedata proxyneg; /* state data for proxy Negotiate auth */ +#endif + + struct auth authhost; /* auth details for host */ + struct auth authproxy; /* auth details for proxy */ + + bool authproblem; /* TRUE if there's some problem authenticating */ + +#ifdef USE_ARES + ares_channel areschannel; /* for name resolves */ +#endif + +#if defined(USE_SSLEAY) && defined(HAVE_OPENSSL_ENGINE_H) + ENGINE *engine; +#endif /* USE_SSLEAY */ + struct timeval expiretime; /* set this with Curl_expire() only */ + struct Curl_tree timenode; /* for the splay stuff */ + struct curl_llist *timeoutlist; /* list of pending timeouts */ + + /* a place to store the most recently set FTP entrypath */ + char *most_recent_ftp_entrypath; + + /* set after initial USER failure, to prevent an authentication loop */ + bool ftp_trying_alternative; + + int httpversion; /* the lowest HTTP version*10 reported by any server + involved in this request */ + bool expect100header; /* TRUE if we added Expect: 100-continue */ + + bool pipe_broke; /* TRUE if the connection we were pipelined on broke + and we need to restart from the beginning */ + +#if !defined(WIN32) && !defined(MSDOS) && !defined(__EMX__) && \ + !defined(__SYMBIAN32__) +/* do FTP line-end conversions on most platforms */ +#define CURL_DO_LINEEND_CONV + /* for FTP downloads: track CRLF sequences that span blocks */ + bool prev_block_had_trailing_cr; + /* for FTP downloads: how many CRLFs did we converted to LFs? */ + curl_off_t crlf_conversions; +#endif + /* If set to non-NULL, there's a connection in a shared connection cache + that uses this handle so we can't kill this SessionHandle just yet but + must keep it around and add it to the list of handles to kill once all + its connections are gone */ + void *shared_conn; + bool closed; /* set to TRUE when curl_easy_cleanup() has been called on this + handle, but it is kept around as mentioned for + shared_conn */ + char *pathbuffer;/* allocated buffer to store the URL's path part in */ + char *path; /* path to use, points to somewhere within the pathbuffer + area */ + bool slash_removed; /* set TRUE if the 'path' points to a path where the + initial URL slash separator has been taken off */ + bool use_range; + bool rangestringalloc; /* the range string is malloc()'ed */ + + char *range; /* range, if used. See README for detailed specification on + this syntax. */ + curl_off_t resume_from; /* continue [ftp] transfer from here */ + + /* This RTSP state information survives requests and connections */ + long rtsp_next_client_CSeq; /* the session's next client CSeq */ + long rtsp_next_server_CSeq; /* the session's next server CSeq */ + long rtsp_CSeq_recv; /* most recent CSeq received */ + + /* Protocol specific data. + * + ************************************************************************* + * Note that this data will be REMOVED after each request, so anything that + * should be kept/stored on a per-connection basis and thus live for the + * next request on the same connection MUST be put in the connectdata struct! + *************************************************************************/ + union { + struct HTTP *http; + struct HTTP *https; /* alias, just for the sake of being more readable */ + struct RTSP *rtsp; + struct FTP *ftp; + /* void *tftp; not used */ + struct FILEPROTO *file; + void *telnet; /* private for telnet.c-eyes only */ + void *generic; + struct SSHPROTO *ssh; + struct FTP *imap; + struct FTP *pop3; + struct FTP *smtp; + } proto; + /* current user of this SessionHandle instance, or NULL */ + struct connectdata *current_conn; + + /* if true, force SSL connection retry (workaround for certain servers) */ + bool ssl_connect_retry; +}; + + +/* + * This 'DynamicStatic' struct defines dynamic states that actually change + * values in the 'UserDefined' area, which MUST be taken into consideration + * if the UserDefined struct is cloned or similar. You can probably just + * copy these, but each one indicate a special action on other data. + */ + +struct DynamicStatic { + char *url; /* work URL, copied from UserDefined */ + bool url_alloc; /* URL string is malloc()'ed */ + char *referer; /* referer string */ + bool referer_alloc; /* referer sting is malloc()ed */ + struct curl_slist *cookielist; /* list of cookie files set by + curl_easy_setopt(COOKIEFILE) calls */ + struct curl_slist *resolve; /* set to point to the set.resolve list when + this should be dealt with in pretransfer */ +}; + +/* + * This 'UserDefined' struct must only contain data that is set once to go + * for many (perhaps) independent connections. Values that are generated or + * calculated internally for the "session handle" MUST be defined within the + * 'struct UrlState' instead. The only exceptions MUST note the changes in + * the 'DynamicStatic' struct. + * Character pointer fields point to dynamic storage, unless otherwise stated. + */ +struct Curl_one_easy; /* declared and used only in multi.c */ +struct Curl_multi; /* declared and used only in multi.c */ + +enum dupstring { + STRING_CERT, /* client certificate file name */ + STRING_CERT_TYPE, /* format for certificate (default: PEM)*/ + STRING_COOKIE, /* HTTP cookie string to send */ + STRING_COOKIEJAR, /* dump all cookies to this file */ + STRING_CUSTOMREQUEST, /* HTTP/FTP/RTSP request/method to use */ + STRING_DEVICE, /* local network interface/address to use */ + STRING_ENCODING, /* Accept-Encoding string */ + STRING_FTP_ACCOUNT, /* ftp account data */ + STRING_FTP_ALTERNATIVE_TO_USER, /* command to send if USER/PASS fails */ + STRING_FTPPORT, /* port to send with the FTP PORT command */ + STRING_KEY, /* private key file name */ + STRING_KEY_PASSWD, /* plain text private key password */ + STRING_KEY_TYPE, /* format for private key (default: PEM) */ + STRING_KRB_LEVEL, /* krb security level */ + STRING_NETRC_FILE, /* if not NULL, use this instead of trying to find + $HOME/.netrc */ + STRING_COPYPOSTFIELDS, /* if POST, set the fields' values here */ + STRING_PROXY, /* proxy to use */ + STRING_SET_RANGE, /* range, if used */ + STRING_SET_REFERER, /* custom string for the HTTP referer field */ + STRING_SET_URL, /* what original URL to work on */ + STRING_SSL_CAPATH, /* CA directory name (doesn't work on windows) */ + STRING_SSL_CAFILE, /* certificate file to verify peer against */ + STRING_SSL_CIPHER_LIST, /* list of ciphers to use */ + STRING_SSL_EGDSOCKET, /* path to file containing the EGD daemon socket */ + STRING_SSL_RANDOM_FILE, /* path to file containing "random" data */ + STRING_USERAGENT, /* User-Agent string */ + STRING_SSL_CRLFILE, /* crl file to check certificate */ + STRING_SSL_ISSUERCERT, /* issuer cert file to check certificate */ + STRING_USERNAME, /* , if used */ + STRING_PASSWORD, /* , if used */ + STRING_PROXYUSERNAME, /* Proxy , if used */ + STRING_PROXYPASSWORD, /* Proxy , if used */ + STRING_NOPROXY, /* List of hosts which should not use the proxy, if + used */ + STRING_RTSP_SESSION_ID, /* Session ID to use */ + STRING_RTSP_STREAM_URI, /* Stream URI for this request */ + STRING_RTSP_TRANSPORT, /* Transport for this session */ +#ifdef USE_LIBSSH2 + STRING_SSH_PRIVATE_KEY, /* path to the private key file for auth */ + STRING_SSH_PUBLIC_KEY, /* path to the public key file for auth */ + STRING_SSH_HOST_PUBLIC_KEY_MD5, /* md5 of host public key in ascii hex */ + STRING_SSH_KNOWNHOSTS, /* file name of knownhosts file */ +#endif +#if defined(HAVE_GSSAPI) || defined(USE_WINDOWS_SSPI) + STRING_SOCKS5_GSSAPI_SERVICE, /* GSSAPI service name */ +#endif + STRING_MAIL_FROM, + + /* -- end of strings -- */ + STRING_LAST /* not used, just an end-of-list marker */ +}; + +struct UserDefined { + FILE *err; /* the stderr user data goes here */ + void *debugdata; /* the data that will be passed to fdebug */ + char *errorbuffer; /* (Static) store failure messages in here */ + long proxyport; /* If non-zero, use this port number by default. If the + proxy string features a ":[port]" that one will override + this. */ + void *out; /* the fetched file goes here */ + void *in; /* the uploaded file is read from here */ + void *writeheader; /* write the header to this if non-NULL */ + void *rtp_out; /* write RTP to this if non-NULL */ + long use_port; /* which port to use (when not using default) */ + long httpauth; /* what kind of HTTP authentication to use (bitmask) */ + long proxyauth; /* what kind of proxy authentication to use (bitmask) */ + long followlocation; /* as in HTTP Location: */ + long maxredirs; /* maximum no. of http(s) redirects to follow, set to -1 + for infinity */ + bool post301; /* Obey RFC 2616/10.3.2 and keep POSTs as POSTs after a + 301 */ + bool post302; /* keep POSTs as POSTs after a 302 */ + bool free_referer; /* set TRUE if 'referer' points to a string we + allocated */ + void *postfields; /* if POST, set the fields' values here */ + curl_seek_callback seek_func; /* function that seeks the input */ + curl_off_t postfieldsize; /* if POST, this might have a size to use instead + of strlen(), and then the data *may* be binary + (contain zero bytes) */ + unsigned short localport; /* local port number to bind to */ + int localportrange; /* number of additional port numbers to test in case the + 'localport' one can't be bind()ed */ + curl_write_callback fwrite_func; /* function that stores the output */ + curl_write_callback fwrite_header; /* function that stores headers */ + curl_write_callback fwrite_rtp; /* function that stores interleaved RTP */ + curl_read_callback fread_func; /* function that reads the input */ + int is_fread_set; /* boolean, has read callback been set to non-NULL? */ + int is_fwrite_set; /* boolean, has write callback been set to non-NULL? */ + curl_progress_callback fprogress; /* function for progress information */ + curl_debug_callback fdebug; /* function that write informational data */ + curl_ioctl_callback ioctl_func; /* function for I/O control */ + curl_sockopt_callback fsockopt; /* function for setting socket options */ + void *sockopt_client; /* pointer to pass to the socket options callback */ + curl_opensocket_callback fopensocket; /* function for checking/translating + the address and opening the socket */ + void* opensocket_client; + + void *seek_client; /* pointer to pass to the seek callback */ + /* the 3 curl_conv_callback functions below are used on non-ASCII hosts */ + /* function to convert from the network encoding: */ + curl_conv_callback convfromnetwork; + /* function to convert to the network encoding: */ + curl_conv_callback convtonetwork; + /* function to convert from UTF-8 encoding: */ + curl_conv_callback convfromutf8; + + void *progress_client; /* pointer to pass to the progress callback */ + void *ioctl_client; /* pointer to pass to the ioctl callback */ + long timeout; /* in milliseconds, 0 means no timeout */ + long connecttimeout; /* in milliseconds, 0 means no timeout */ + long server_response_timeout; /* in milliseconds, 0 means no timeout */ + long tftp_blksize ; /* in bytes, 0 means use default */ + curl_off_t infilesize; /* size of file to upload, -1 means unknown */ + long low_speed_limit; /* bytes/second */ + long low_speed_time; /* number of seconds */ + curl_off_t max_send_speed; /* high speed limit in bytes/second for upload */ + curl_off_t max_recv_speed; /* high speed limit in bytes/second for download */ + curl_off_t set_resume_from; /* continue [ftp] transfer from here */ + struct curl_slist *headers; /* linked list of extra headers */ + struct curl_httppost *httppost; /* linked list of POST data */ + bool cookiesession; /* new cookie session? */ + bool crlf; /* convert crlf on ftp upload(?) */ + struct curl_slist *quote; /* after connection is established */ + struct curl_slist *postquote; /* after the transfer */ + struct curl_slist *prequote; /* before the transfer, after type */ + struct curl_slist *source_quote; /* 3rd party quote */ + struct curl_slist *source_prequote; /* in 3rd party transfer mode - before + the transfer on source host */ + struct curl_slist *source_postquote; /* in 3rd party transfer mode - after + the transfer on source host */ + struct curl_slist *telnet_options; /* linked list of telnet options */ + struct curl_slist *resolve; /* list of names to add/remove from + DNS cache */ + curl_TimeCond timecondition; /* kind of time/date comparison */ + time_t timevalue; /* what time to compare with */ + Curl_HttpReq httpreq; /* what kind of HTTP request (if any) is this */ + long httpversion; /* when non-zero, a specific HTTP version requested to + be used in the library's request(s) */ + struct ssl_config_data ssl; /* user defined SSL stuff */ + curl_proxytype proxytype; /* what kind of proxy that is in use */ + long dns_cache_timeout; /* DNS cache timeout */ + long buffer_size; /* size of receive buffer to use */ + void *private_data; /* application-private data */ + + struct Curl_one_easy *one_easy; /* When adding an easy handle to a multi + handle, an internal 'Curl_one_easy' + struct is created and this is a pointer + to the particular struct associated with + this SessionHandle */ + + struct curl_slist *http200aliases; /* linked list of aliases for http200 */ + + long ipver; /* the CURL_IPRESOLVE_* defines in the public header file + 0 - whatever, 1 - v2, 2 - v6 */ + + curl_off_t max_filesize; /* Maximum file size to download */ + + curl_ftpfile ftp_filemethod; /* how to get to a file when FTP is used */ + + int ftp_create_missing_dirs; /* 1 - create directories that don't exist + 2 - the same but also allow MKD to fail once + */ + + curl_sshkeycallback ssh_keyfunc; /* key matching callback */ + void *ssh_keyfunc_userp; /* custom pointer to callback */ + +/* Here follows boolean settings that define how to behave during + this session. They are STATIC, set by libcurl users or at least initially + and they don't change during operations. */ + + bool printhost; /* printing host name in debug info */ + bool get_filetime; /* get the time and get of the remote file */ + bool tunnel_thru_httpproxy; /* use CONNECT through a HTTP proxy */ + bool prefer_ascii; /* ASCII rather than binary */ + bool ftp_append; /* append, not overwrite, on upload */ + bool ftp_list_only; /* switch FTP command for listing directories */ + bool ftp_use_port; /* use the FTP PORT command */ + bool hide_progress; /* don't use the progress meter */ + bool http_fail_on_error; /* fail on HTTP error codes >= 300 */ + bool http_follow_location; /* follow HTTP redirects */ + bool http_disable_hostname_check_before_authentication; + bool include_header; /* include received protocol headers in data output */ + bool http_set_referer; /* is a custom referer used */ + bool http_auto_referer; /* set "correct" referer when following location: */ + bool opt_no_body; /* as set with CURLOPT_NO_BODY */ + bool set_port; /* custom port number used */ + bool upload; /* upload request */ + enum CURL_NETRC_OPTION + use_netrc; /* defined in include/curl.h */ + bool verbose; /* output verbosity */ + bool krb; /* kerberos connection requested */ + bool reuse_forbid; /* forbidden to be reused, close after use */ + bool reuse_fresh; /* do not re-use an existing connection */ + bool ftp_use_epsv; /* if EPSV is to be attempted or not */ + bool ftp_use_eprt; /* if EPRT is to be attempted or not */ + bool ftp_use_pret; /* if PRET is to be used before PASV or not */ + + curl_usessl ftp_ssl; /* if AUTH TLS is to be attempted etc, for FTP or + IMAP or POP3 or others! */ + curl_ftpauth ftpsslauth; /* what AUTH XXX to be attempted */ + curl_ftpccc ftp_ccc; /* FTP CCC options */ + bool no_signal; /* do not use any signal/alarm handler */ + bool global_dns_cache; /* subject for future removal */ + bool tcp_nodelay; /* whether to enable TCP_NODELAY or not */ + bool ignorecl; /* ignore content length */ + bool ftp_skip_ip; /* skip the IP address the FTP server passes on to + us */ + bool connect_only; /* make connection, let application use the socket */ + long ssh_auth_types; /* allowed SSH auth types */ + bool http_te_skip; /* pass the raw body data to the user, even when + transfer-encoded (chunked, compressed) */ + bool http_ce_skip; /* pass the raw body data to the user, even when + content-encoded (chunked, compressed) */ + long new_file_perms; /* Permissions to use when creating remote files */ + long new_directory_perms; /* Permissions to use when creating remote dirs */ + bool proxy_transfer_mode; /* set transfer mode (;type=) when doing FTP + via an HTTP proxy */ + char *str[STRING_LAST]; /* array of strings, pointing to allocated memory */ + unsigned int scope; /* address scope for IPv6 */ + long allowed_protocols; + long redir_protocols; +#if defined(HAVE_GSSAPI) || defined(USE_WINDOWS_SSPI) + long socks5_gssapi_nec; /* flag to support nec socks5 server */ +#endif + struct curl_slist *mail_rcpt; /* linked list of mail recipients */ + /* Common RTSP header options */ + Curl_RtspReq rtspreq; /* RTSP request type */ + long rtspversion; /* like httpversion, for RTSP */ + bool wildcardmatch; /* enable wildcard matching */ + curl_chunk_bgn_callback chunk_bgn; /* called before part of transfer starts */ + curl_chunk_end_callback chunk_end; /* called after part transferring + stopped */ + curl_fnmatch_callback fnmatch; /* callback to decide which file corresponds + to pattern (e.g. if WILDCARDMATCH is on) */ + void *fnmatch_data; +}; + +struct Names { + struct curl_hash *hostcache; + enum { + HCACHE_NONE, /* not pointing to anything */ + HCACHE_PRIVATE, /* points to our own */ + HCACHE_GLOBAL, /* points to the (shrug) global one */ + HCACHE_MULTI, /* points to a shared one in the multi handle */ + HCACHE_SHARED /* points to a shared one in a shared object */ + } hostcachetype; +}; + +/* + * The 'connectdata' struct MUST have all the connection oriented stuff as we + * may have several simultaneous connections and connection structs in memory. + * + * The 'struct UserDefined' must only contain data that is set once to go for + * many (perhaps) independent connections. Values that are generated or + * calculated internally for the "session handle" must be defined within the + * 'struct UrlState' instead. + */ + +struct SessionHandle { + struct Names dns; + struct Curl_multi *multi; /* if non-NULL, points to the multi handle + struct to which this "belongs" */ + struct Curl_one_easy *multi_pos; /* if non-NULL, points to its position + in multi controlling structure to assist + in removal. */ + struct Curl_share *share; /* Share, handles global variable mutexing */ + struct SingleRequest req; /* Request-specific data */ + struct UserDefined set; /* values set by the libcurl user */ + struct DynamicStatic change; /* possibly modified userdefined data */ + struct CookieInfo *cookies; /* the cookies, read from files and servers. + NOTE that the 'cookie' field in the + UserDefined struct defines if the "engine" + is to be used or not. */ + struct Progress progress; /* for all the progress meter data */ + struct UrlState state; /* struct for fields used for state info and + other dynamic purposes */ + struct WildcardData wildcard; /* wildcard download state info */ + struct PureInfo info; /* stats, reports and info data */ +#if defined(CURL_DOES_CONVERSIONS) && defined(HAVE_ICONV) + iconv_t outbound_cd; /* for translating to the network encoding */ + iconv_t inbound_cd; /* for translating from the network encoding */ + iconv_t utf8_cd; /* for translating to UTF8 */ +#endif /* CURL_DOES_CONVERSIONS && HAVE_ICONV */ + unsigned int magic; /* set to a CURLEASY_MAGIC_NUMBER */ +}; + +#define LIBCURL_NAME "libcurl" + +#endif diff --git a/mobicore/common/curl/lib/vc6libcurl.dsp b/mobicore/common/curl/lib/vc6libcurl.dsp new file mode 100644 index 0000000000000000000000000000000000000000..ee8f6f142009c3eda609f0634c4b798e1718ca12 --- /dev/null +++ b/mobicore/common/curl/lib/vc6libcurl.dsp @@ -0,0 +1,862 @@ +# Microsoft Developer Studio Project File - Name="libcurl" - Package Owner=<4> +# Microsoft Developer Studio Generated Build File, Format Version 6.00 +# ** DO NOT EDIT ** + +# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102 +# TARGTYPE "Win32 (x86) Static Library" 0x0104 + +CFG=libcurl - Win32 LIB Debug +!MESSAGE This is not a valid makefile. To build this project using NMAKE, +!MESSAGE use the Export Makefile command and run +!MESSAGE +!MESSAGE NMAKE /f "libcurl.mak". +!MESSAGE +!MESSAGE You can specify a configuration when running NMAKE +!MESSAGE by defining the macro CFG on the command line. For example: +!MESSAGE +!MESSAGE NMAKE /f "libcurl.mak" CFG="libcurl - Win32 LIB Debug" +!MESSAGE +!MESSAGE Possible choices for configuration are: +!MESSAGE +!MESSAGE "libcurl - Win32 DLL Debug" (based on "Win32 (x86) Dynamic-Link Library") +!MESSAGE "libcurl - Win32 DLL Release" (based on "Win32 (x86) Dynamic-Link Library") +!MESSAGE "libcurl - Win32 LIB Debug" (based on "Win32 (x86) Static Library") +!MESSAGE "libcurl - Win32 LIB Release" (based on "Win32 (x86) Static Library") +!MESSAGE + +# Begin Project +# PROP AllowPerConfigDependencies 0 +# PROP Scc_ProjName "" +# PROP Scc_LocalPath "" + +!IF "$(CFG)" == "libcurl - Win32 DLL Debug" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir "DLL-Debug" +# PROP BASE Intermediate_Dir "DLL-Debug" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "DLL-Debug" +# PROP Intermediate_Dir "DLL-Debug" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +CPP=cl.exe +# ADD BASE CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "." /I "..\include" /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "BUILDING_LIBCURL" /FD /GZ /c +# ADD CPP /nologo /MDd /W3 /Gm /GX /Zi /Od /I "." /I "..\include" /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "BUILDING_LIBCURL" /FD /GZ /c +MTL=midl.exe +# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 +# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 +RSC=rc.exe +# ADD BASE RSC /l 0x409 /d "_DEBUG" +# ADD RSC /l 0x409 /d "_DEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib ws2_32.lib wldap32.lib /nologo /dll /incremental:no /map /debug /machine:I386 /out:"DLL-Debug/libcurld.dll" /implib:"DLL-Debug/libcurld_imp.lib" /pdbtype:sept +# ADD LINK32 kernel32.lib ws2_32.lib wldap32.lib /nologo /dll /incremental:no /map /debug /machine:I386 /out:"DLL-Debug/libcurld.dll" /implib:"DLL-Debug/libcurld_imp.lib" /pdbtype:sept + +!ELSEIF "$(CFG)" == "libcurl - Win32 DLL Release" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "DLL-Release" +# PROP BASE Intermediate_Dir "DLL-Release" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "DLL-Release" +# PROP Intermediate_Dir "DLL-Release" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +CPP=cl.exe +# ADD BASE CPP /nologo /MD /W3 /GX /O2 /I "." /I "..\include" /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "BUILDING_LIBCURL" /FD /c +# ADD CPP /nologo /MD /W3 /GX /O2 /I "." /I "..\include" /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "BUILDING_LIBCURL" /FD /c +MTL=midl.exe +# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 +# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 +RSC=rc.exe +# ADD BASE RSC /l 0x409 /d "NDEBUG" +# ADD RSC /l 0x409 /d "NDEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib ws2_32.lib wldap32.lib /nologo /dll /pdb:none /machine:I386 /out:"DLL-Release/libcurl.dll" /implib:"DLL-Release/libcurl_imp.lib" +# ADD LINK32 kernel32.lib ws2_32.lib wldap32.lib /nologo /dll /pdb:none /machine:I386 /out:"DLL-Release/libcurl.dll" /implib:"DLL-Release/libcurl_imp.lib" + +!ELSEIF "$(CFG)" == "libcurl - Win32 LIB Debug" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir "LIB-Debug" +# PROP BASE Intermediate_Dir "LIB-Debug" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "LIB-Debug" +# PROP Intermediate_Dir "LIB-Debug" +# PROP Target_Dir "" +CPP=cl.exe +# ADD BASE CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "." /I "..\include" /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "BUILDING_LIBCURL" /D "CURL_STATICLIB" /FD /GZ /c +# ADD CPP /nologo /MDd /W3 /Gm /GX /Zi /Od /I "." /I "..\include" /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "BUILDING_LIBCURL" /D "CURL_STATICLIB" /FD /GZ /c +RSC=rc.exe +# ADD BASE RSC /l 0x409 /d "_DEBUG" +# ADD RSC /l 0x409 /d "_DEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LIB32=link.exe -lib +# ADD BASE LIB32 /nologo /out:"LIB-Debug/libcurld.lib" /machine:I386 +# ADD LIB32 /nologo /out:"LIB-Debug/libcurld.lib" /machine:I386 + +!ELSEIF "$(CFG)" == "libcurl - Win32 LIB Release" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "LIB-Release" +# PROP BASE Intermediate_Dir "LIB-Release" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "LIB-Release" +# PROP Intermediate_Dir "LIB-Release" +# PROP Target_Dir "" +CPP=cl.exe +# ADD BASE CPP /nologo /MD /W3 /GX /O2 /I "." /I "..\include" /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "BUILDING_LIBCURL" /D "CURL_STATICLIB" /FD /c +# ADD CPP /nologo /MD /W3 /GX /O2 /I "." /I "..\include" /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "BUILDING_LIBCURL" /D "CURL_STATICLIB" /FD /c +RSC=rc.exe +# ADD BASE RSC /l 0x409 /d "NDEBUG" +# ADD RSC /l 0x409 /d "NDEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LIB32=link.exe -lib +# ADD BASE LIB32 /nologo /out:"LIB-Release/libcurl.lib" /machine:I386 +# ADD LIB32 /nologo /out:"LIB-Release/libcurl.lib" /machine:I386 + +!ENDIF + +# Begin Target + +# Name "libcurl - Win32 DLL Debug" +# Name "libcurl - Win32 DLL Release" +# Name "libcurl - Win32 LIB Debug" +# Name "libcurl - Win32 LIB Release" +# Begin Group "Source Files" + +# PROP Default_Filter "" +# Begin Source File + +SOURCE=.\base64.c +# End Source File +# Begin Source File + +SOURCE=.\connect.c +# End Source File +# Begin Source File + +SOURCE=.\content_encoding.c +# End Source File +# Begin Source File + +SOURCE=.\cookie.c +# End Source File +# Begin Source File + +SOURCE=.\curl_addrinfo.c +# End Source File +# Begin Source File + +SOURCE=.\curl_fnmatch.c +# End Source File +# Begin Source File + +SOURCE=.\curl_gethostname.c +# End Source File +# Begin Source File + +SOURCE=.\curl_memrchr.c +# End Source File +# Begin Source File + +SOURCE=.\curl_rand.c +# End Source File +# Begin Source File + +SOURCE=.\curl_rtmp.c +# End Source File +# Begin Source File + +SOURCE=.\curl_sspi.c +# End Source File +# Begin Source File + +SOURCE=.\curl_threads.c +# End Source File +# Begin Source File + +SOURCE=.\dict.c +# End Source File +# Begin Source File + +SOURCE=.\easy.c +# End Source File +# Begin Source File + +SOURCE=.\escape.c +# End Source File +# Begin Source File + +SOURCE=.\file.c +# End Source File +# Begin Source File + +SOURCE=.\fileinfo.c +# End Source File +# Begin Source File + +SOURCE=.\formdata.c +# End Source File +# Begin Source File + +SOURCE=.\ftp.c +# End Source File +# Begin Source File + +SOURCE=.\ftplistparser.c +# End Source File +# Begin Source File + +SOURCE=.\getenv.c +# End Source File +# Begin Source File + +SOURCE=.\getinfo.c +# End Source File +# Begin Source File + +SOURCE=.\gopher.c +# End Source File +# Begin Source File + +SOURCE=.\gtls.c +# End Source File +# Begin Source File + +SOURCE=.\hash.c +# End Source File +# Begin Source File + +SOURCE=.\hmac.c +# End Source File +# Begin Source File + +SOURCE=.\hostares.c +# End Source File +# Begin Source File + +SOURCE=.\hostasyn.c +# End Source File +# Begin Source File + +SOURCE=.\hostip4.c +# End Source File +# Begin Source File + +SOURCE=.\hostip6.c +# End Source File +# Begin Source File + +SOURCE=.\hostip.c +# End Source File +# Begin Source File + +SOURCE=.\hostsyn.c +# End Source File +# Begin Source File + +SOURCE=.\hostthre.c +# End Source File +# Begin Source File + +SOURCE=.\http.c +# End Source File +# Begin Source File + +SOURCE=.\http_chunks.c +# End Source File +# Begin Source File + +SOURCE=.\http_digest.c +# End Source File +# Begin Source File + +SOURCE=.\http_negotiate.c +# End Source File +# Begin Source File + +SOURCE=.\http_ntlm.c +# End Source File +# Begin Source File + +SOURCE=.\if2ip.c +# End Source File +# Begin Source File + +SOURCE=.\imap.c +# End Source File +# Begin Source File + +SOURCE=.\inet_ntop.c +# End Source File +# Begin Source File + +SOURCE=.\inet_pton.c +# End Source File +# Begin Source File + +SOURCE=.\krb4.c +# End Source File +# Begin Source File + +SOURCE=.\krb5.c +# End Source File +# Begin Source File + +SOURCE=.\ldap.c +# End Source File +# Begin Source File + +SOURCE=.\llist.c +# End Source File +# Begin Source File + +SOURCE=.\md4.c +# End Source File +# Begin Source File + +SOURCE=.\md5.c +# End Source File +# Begin Source File + +SOURCE=.\memdebug.c +# End Source File +# Begin Source File + +SOURCE=.\mprintf.c +# End Source File +# Begin Source File + +SOURCE=.\multi.c +# End Source File +# Begin Source File + +SOURCE=.\netrc.c +# End Source File +# Begin Source File + +SOURCE=.\nonblock.c +# End Source File +# Begin Source File + +SOURCE=.\nss.c +# End Source File +# Begin Source File + +SOURCE=.\openldap.c +# End Source File +# Begin Source File + +SOURCE=.\parsedate.c +# End Source File +# Begin Source File + +SOURCE=.\pingpong.c +# End Source File +# Begin Source File + +SOURCE=.\polarssl.c +# End Source File +# Begin Source File + +SOURCE=.\pop3.c +# End Source File +# Begin Source File + +SOURCE=.\progress.c +# End Source File +# Begin Source File + +SOURCE=.\qssl.c +# End Source File +# Begin Source File + +SOURCE=.\rawstr.c +# End Source File +# Begin Source File + +SOURCE=.\rtsp.c +# End Source File +# Begin Source File + +SOURCE=.\security.c +# End Source File +# Begin Source File + +SOURCE=.\select.c +# End Source File +# Begin Source File + +SOURCE=.\sendf.c +# End Source File +# Begin Source File + +SOURCE=.\share.c +# End Source File +# Begin Source File + +SOURCE=.\slist.c +# End Source File +# Begin Source File + +SOURCE=.\smtp.c +# End Source File +# Begin Source File + +SOURCE=.\socks.c +# End Source File +# Begin Source File + +SOURCE=.\socks_gssapi.c +# End Source File +# Begin Source File + +SOURCE=.\socks_sspi.c +# End Source File +# Begin Source File + +SOURCE=.\speedcheck.c +# End Source File +# Begin Source File + +SOURCE=.\splay.c +# End Source File +# Begin Source File + +SOURCE=.\ssh.c +# End Source File +# Begin Source File + +SOURCE=.\sslgen.c +# End Source File +# Begin Source File + +SOURCE=.\ssluse.c +# End Source File +# Begin Source File + +SOURCE=.\strdup.c +# End Source File +# Begin Source File + +SOURCE=.\strequal.c +# End Source File +# Begin Source File + +SOURCE=.\strerror.c +# End Source File +# Begin Source File + +SOURCE=.\strtok.c +# End Source File +# Begin Source File + +SOURCE=.\strtoofft.c +# End Source File +# Begin Source File + +SOURCE=.\telnet.c +# End Source File +# Begin Source File + +SOURCE=.\tftp.c +# End Source File +# Begin Source File + +SOURCE=.\timeval.c +# End Source File +# Begin Source File + +SOURCE=.\transfer.c +# End Source File +# Begin Source File + +SOURCE=.\url.c +# End Source File +# Begin Source File + +SOURCE=.\version.c +# End Source File +# Begin Source File + +SOURCE=.\warnless.c +# End Source File +# Begin Source File + +SOURCE=.\wildcard.c +# End Source File +# End Group +# Begin Group "Header Files" + +# PROP Default_Filter "" +# Begin Source File + +SOURCE=.\arpa_telnet.h +# End Source File +# Begin Source File + +SOURCE=.\config-win32.h +# End Source File +# Begin Source File + +SOURCE=.\connect.h +# End Source File +# Begin Source File + +SOURCE=.\content_encoding.h +# End Source File +# Begin Source File + +SOURCE=.\cookie.h +# End Source File +# Begin Source File + +SOURCE=.\curl_addrinfo.h +# End Source File +# Begin Source File + +SOURCE=.\curl_base64.h +# End Source File +# Begin Source File + +SOURCE=.\curl_fnmatch.h +# End Source File +# Begin Source File + +SOURCE=.\curl_gethostname.h +# End Source File +# Begin Source File + +SOURCE=.\curl_hmac.h +# End Source File +# Begin Source File + +SOURCE=.\curl_ldap.h +# End Source File +# Begin Source File + +SOURCE=.\curl_md4.h +# End Source File +# Begin Source File + +SOURCE=.\curl_md5.h +# End Source File +# Begin Source File + +SOURCE=.\curl_memory.h +# End Source File +# Begin Source File + +SOURCE=.\curl_memrchr.h +# End Source File +# Begin Source File + +SOURCE=.\curl_rand.h +# End Source File +# Begin Source File + +SOURCE=.\curl_rtmp.h +# End Source File +# Begin Source File + +SOURCE=.\curl_sspi.h +# End Source File +# Begin Source File + +SOURCE=.\curl_threads.h +# End Source File +# Begin Source File + +SOURCE=.\curlx.h +# End Source File +# Begin Source File + +SOURCE=.\dict.h +# End Source File +# Begin Source File + +SOURCE=.\easyif.h +# End Source File +# Begin Source File + +SOURCE=.\escape.h +# End Source File +# Begin Source File + +SOURCE=.\file.h +# End Source File +# Begin Source File + +SOURCE=.\fileinfo.h +# End Source File +# Begin Source File + +SOURCE=.\formdata.h +# End Source File +# Begin Source File + +SOURCE=.\ftp.h +# End Source File +# Begin Source File + +SOURCE=.\ftplistparser.h +# End Source File +# Begin Source File + +SOURCE=.\getinfo.h +# End Source File +# Begin Source File + +SOURCE=.\gopher.h +# End Source File +# Begin Source File + +SOURCE=.\gtls.h +# End Source File +# Begin Source File + +SOURCE=.\hash.h +# End Source File +# Begin Source File + +SOURCE=.\hostip.h +# End Source File +# Begin Source File + +SOURCE=.\http_chunks.h +# End Source File +# Begin Source File + +SOURCE=.\http_digest.h +# End Source File +# Begin Source File + +SOURCE=.\http.h +# End Source File +# Begin Source File + +SOURCE=.\http_negotiate.h +# End Source File +# Begin Source File + +SOURCE=.\http_ntlm.h +# End Source File +# Begin Source File + +SOURCE=.\if2ip.h +# End Source File +# Begin Source File + +SOURCE=.\imap.h +# End Source File +# Begin Source File + +SOURCE=.\inet_ntop.h +# End Source File +# Begin Source File + +SOURCE=.\inet_pton.h +# End Source File +# Begin Source File + +SOURCE=.\krb4.h +# End Source File +# Begin Source File + +SOURCE=.\llist.h +# End Source File +# Begin Source File + +SOURCE=.\memdebug.h +# End Source File +# Begin Source File + +SOURCE=.\multiif.h +# End Source File +# Begin Source File + +SOURCE=.\netrc.h +# End Source File +# Begin Source File + +SOURCE=.\nonblock.h +# End Source File +# Begin Source File + +SOURCE=.\nssg.h +# End Source File +# Begin Source File + +SOURCE=.\parsedate.h +# End Source File +# Begin Source File + +SOURCE=.\pingpong.h +# End Source File +# Begin Source File + +SOURCE=.\polarssl.h +# End Source File +# Begin Source File + +SOURCE=.\pop3.h +# End Source File +# Begin Source File + +SOURCE=.\progress.h +# End Source File +# Begin Source File + +SOURCE=.\qssl.h +# End Source File +# Begin Source File + +SOURCE=.\rawstr.h +# End Source File +# Begin Source File + +SOURCE=.\rtsp.h +# End Source File +# Begin Source File + +SOURCE=.\select.h +# End Source File +# Begin Source File + +SOURCE=.\sendf.h +# End Source File +# Begin Source File + +SOURCE=.\setup.h +# End Source File +# Begin Source File + +SOURCE=.\setup_once.h +# End Source File +# Begin Source File + +SOURCE=.\share.h +# End Source File +# Begin Source File + +SOURCE=.\slist.h +# End Source File +# Begin Source File + +SOURCE=.\smtp.h +# End Source File +# Begin Source File + +SOURCE=.\sockaddr.h +# End Source File +# Begin Source File + +SOURCE=.\socks.h +# End Source File +# Begin Source File + +SOURCE=.\speedcheck.h +# End Source File +# Begin Source File + +SOURCE=.\splay.h +# End Source File +# Begin Source File + +SOURCE=.\ssh.h +# End Source File +# Begin Source File + +SOURCE=.\sslgen.h +# End Source File +# Begin Source File + +SOURCE=.\ssluse.h +# End Source File +# Begin Source File + +SOURCE=.\strdup.h +# End Source File +# Begin Source File + +SOURCE=.\strequal.h +# End Source File +# Begin Source File + +SOURCE=.\strerror.h +# End Source File +# Begin Source File + +SOURCE=.\strtok.h +# End Source File +# Begin Source File + +SOURCE=.\strtoofft.h +# End Source File +# Begin Source File + +SOURCE=.\telnet.h +# End Source File +# Begin Source File + +SOURCE=.\tftp.h +# End Source File +# Begin Source File + +SOURCE=.\timeval.h +# End Source File +# Begin Source File + +SOURCE=.\transfer.h +# End Source File +# Begin Source File + +SOURCE=.\urldata.h +# End Source File +# Begin Source File + +SOURCE=.\url.h +# End Source File +# Begin Source File + +SOURCE=.\warnless.h +# End Source File +# Begin Source File + +SOURCE=.\wildcard.h +# End Source File +# End Group + +# Begin Group "Resource Files" + +# PROP Default_Filter "" +# Begin Source File + +SOURCE=.\libcurl.rc +# End Source File +# End Group +# End Target +# End Project diff --git a/mobicore/common/curl/lib/vc6libcurl.dsw b/mobicore/common/curl/lib/vc6libcurl.dsw new file mode 100644 index 0000000000000000000000000000000000000000..1fa8814a6b1ef6012c0eab87e3c4511249d50b04 --- /dev/null +++ b/mobicore/common/curl/lib/vc6libcurl.dsw @@ -0,0 +1,29 @@ +Microsoft Developer Studio Workspace File, Format Version 6.00 +# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE! + +############################################################################### + +Project: "libcurl"=".\vc6libcurl.dsp" - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ +}}} + +############################################################################### + +Global: + +Package=<5> +{{{ +}}} + +Package=<3> +{{{ +}}} + +############################################################################### + diff --git a/mobicore/common/curl/lib/version.c b/mobicore/common/curl/lib/version.c new file mode 100644 index 0000000000000000000000000000000000000000..9ba2e33c1e6c8b2adb99304a5542d0f2c2146d04 --- /dev/null +++ b/mobicore/common/curl/lib/version.c @@ -0,0 +1,323 @@ +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) 1998 - 2010, Daniel Stenberg, , et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at http://curl.haxx.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ***************************************************************************/ + +#include "setup.h" + +#include +#include + +#include +#include "urldata.h" +#include "sslgen.h" + +#define _MPRINTF_REPLACE /* use the internal *printf() functions */ +#include + +#ifdef USE_ARES +#include +#endif + +#ifdef USE_LIBIDN +#include +#endif + +#if defined(HAVE_ICONV) && defined(CURL_DOES_CONVERSIONS) +#include +#endif + +#ifdef USE_LIBRTMP +#include +#endif + +#ifdef USE_LIBSSH2 +#include +#endif + +#ifdef HAVE_LIBSSH2_VERSION +/* get it run-time if possible */ +#define CURL_LIBSSH2_VERSION libssh2_version(0) +#else +/* use build-time if run-time not possible */ +#define CURL_LIBSSH2_VERSION LIBSSH2_VERSION +#endif + +char *curl_version(void) +{ + static char version[200]; + char *ptr=version; + size_t len; + size_t left = sizeof(version); + strcpy(ptr, LIBCURL_NAME "/" LIBCURL_VERSION ); + len = strlen(ptr); + left -= len; + ptr += len; + + if(left > 1) { + len = Curl_ssl_version(ptr + 1, left - 1); + + if(len > 0) { + *ptr = ' '; + left -= ++len; + ptr += len; + } + } + +#ifdef HAVE_LIBZ + len = snprintf(ptr, left, " zlib/%s", zlibVersion()); + left -= len; + ptr += len; +#endif +#ifdef USE_ARES + /* this function is only present in c-ares, not in the original ares */ + len = snprintf(ptr, left, " c-ares/%s", ares_version(NULL)); + left -= len; + ptr += len; +#endif +#ifdef USE_LIBIDN + if(stringprep_check_version(LIBIDN_REQUIRED_VERSION)) { + len = snprintf(ptr, left, " libidn/%s", stringprep_check_version(NULL)); + left -= len; + ptr += len; + } +#endif +#if defined(HAVE_ICONV) && defined(CURL_DOES_CONVERSIONS) +#ifdef _LIBICONV_VERSION + len = snprintf(ptr, left, " iconv/%d.%d", + _LIBICONV_VERSION >> 8, _LIBICONV_VERSION & 255); +#else + /* version unknown */ + len = snprintf(ptr, left, " iconv"); +#endif /* _LIBICONV_VERSION */ + left -= len; + ptr += len; +#endif +#ifdef USE_LIBSSH2 + len = snprintf(ptr, left, " libssh2/%s", CURL_LIBSSH2_VERSION); + left -= len; + ptr += len; +#endif +#ifdef USE_LIBRTMP + { + char suff[2]; + if (RTMP_LIB_VERSION & 0xff) { + suff[0] = (RTMP_LIB_VERSION & 0xff) + 'a' - 1; + suff[1] = '\0'; + } else { + suff[0] = '\0'; + } + len = snprintf(ptr, left, " librtmp/%d.%d%s", + RTMP_LIB_VERSION >> 16, (RTMP_LIB_VERSION >> 8) & 0xff, suff); +/* + If another lib version is added below this one, this code would + also have to do: + + left -= len; + ptr += len; +*/ + } +#endif + + return version; +} + +/* data for curl_version_info + + Keep the list sorted alphabetically. It is also written so that each + protocol line has its own #if line to make things easier on the eye. + */ + +static const char * const protocols[] = { +#ifndef CURL_DISABLE_DICT + "dict", +#endif +#ifndef CURL_DISABLE_FILE + "file", +#endif +#ifndef CURL_DISABLE_FTP + "ftp", +#endif +#if defined(USE_SSL) && !defined(CURL_DISABLE_FTP) + "ftps", +#endif +#ifndef CURL_DISABLE_GOPHER + "gopher", +#endif +#ifndef CURL_DISABLE_HTTP + "http", +#endif +#if defined(USE_SSL) && !defined(CURL_DISABLE_HTTP) + "https", +#endif +#ifndef CURL_DISABLE_IMAP + "imap", +#endif +#if defined(USE_SSL) && !defined(CURL_DISABLE_IMAP) + "imaps", +#endif +#ifndef CURL_DISABLE_LDAP + "ldap", +#if (defined(USE_OPENLDAP) && defined(USE_SSL)) || \ + (!defined(USE_OPENLDAP) && defined(HAVE_LDAP_SSL)) + "ldaps", +#endif +#endif +#ifndef CURL_DISABLE_POP3 + "pop3", +#endif +#if defined(USE_SSL) && !defined(CURL_DISABLE_POP3) + "pop3s", +#endif +#ifdef USE_LIBRTMP + "rtmp", +#endif +#ifndef CURL_DISABLE_RTSP + "rtsp", +#endif +#ifdef USE_LIBSSH2 + "scp", +#endif +#ifdef USE_LIBSSH2 + "sftp", +#endif +#ifndef CURL_DISABLE_SMTP + "smtp", +#endif +#if defined(USE_SSL) && !defined(CURL_DISABLE_SMTP) + "smtps", +#endif +#ifndef CURL_DISABLE_TELNET + "telnet", +#endif +#ifndef CURL_DISABLE_TFTP + "tftp", +#endif + + NULL +}; + +static curl_version_info_data version_info = { + CURLVERSION_NOW, + LIBCURL_VERSION, + LIBCURL_VERSION_NUM, + OS, /* as found by configure or set by hand at build-time */ + 0 /* features is 0 by default */ +#ifdef ENABLE_IPV6 + | CURL_VERSION_IPV6 +#endif +#ifdef HAVE_KRB4 + | CURL_VERSION_KERBEROS4 +#endif +#ifdef USE_SSL + | CURL_VERSION_SSL +#endif +#ifdef USE_NTLM + | CURL_VERSION_NTLM +#endif +#ifdef USE_WINDOWS_SSPI + | CURL_VERSION_SSPI +#endif +#ifdef HAVE_LIBZ + | CURL_VERSION_LIBZ +#endif +#ifdef HAVE_GSSAPI + | CURL_VERSION_GSSNEGOTIATE +#endif +#ifdef DEBUGBUILD + | CURL_VERSION_DEBUG +#endif +#ifdef CURLDEBUG + | CURL_VERSION_CURLDEBUG +#endif +#ifdef CURLRES_ASYNCH + | CURL_VERSION_ASYNCHDNS +#endif +#ifdef HAVE_SPNEGO + | CURL_VERSION_SPNEGO +#endif +#if (CURL_SIZEOF_CURL_OFF_T > 4) && \ + ( (SIZEOF_OFF_T > 4) || defined(USE_WIN32_LARGE_FILES) ) + | CURL_VERSION_LARGEFILE +#endif +#if defined(CURL_DOES_CONVERSIONS) + | CURL_VERSION_CONV +#endif + , + NULL, /* ssl_version */ + 0, /* ssl_version_num, this is kept at zero */ + NULL, /* zlib_version */ + protocols, + NULL, /* c-ares version */ + 0, /* c-ares version numerical */ + NULL, /* libidn version */ + 0, /* iconv version */ + NULL, /* ssh lib version */ +}; + +curl_version_info_data *curl_version_info(CURLversion stamp) +{ +#ifdef USE_LIBSSH2 + static char ssh_buffer[80]; +#endif + +#ifdef USE_SSL + static char ssl_buffer[80]; + Curl_ssl_version(ssl_buffer, sizeof(ssl_buffer)); + version_info.ssl_version = ssl_buffer; +#endif + +#ifdef HAVE_LIBZ + version_info.libz_version = zlibVersion(); + /* libz left NULL if non-existing */ +#endif +#ifdef USE_ARES + { + int aresnum; + version_info.ares = ares_version(&aresnum); + version_info.ares_num = aresnum; + } +#endif +#ifdef USE_LIBIDN + /* This returns a version string if we use the given version or later, + otherwise it returns NULL */ + version_info.libidn = stringprep_check_version(LIBIDN_REQUIRED_VERSION); + if(version_info.libidn) + version_info.features |= CURL_VERSION_IDN; +#endif + +#if defined(HAVE_ICONV) && defined(CURL_DOES_CONVERSIONS) +#ifdef _LIBICONV_VERSION + version_info.iconv_ver_num = _LIBICONV_VERSION; +#else + /* version unknown */ + version_info.iconv_ver_num = -1; +#endif /* _LIBICONV_VERSION */ +#endif + +#ifdef USE_LIBSSH2 + snprintf(ssh_buffer, sizeof(ssh_buffer), "libssh2/%s", LIBSSH2_VERSION); + version_info.libssh_version = ssh_buffer; +#endif + + (void)stamp; /* avoid compiler warnings, we don't use this */ + + return &version_info; +} diff --git a/mobicore/common/curl/lib/warnless.c b/mobicore/common/curl/lib/warnless.c new file mode 100644 index 0000000000000000000000000000000000000000..bc29d28df6a60e4e58afc23e2f118911ee4271d9 --- /dev/null +++ b/mobicore/common/curl/lib/warnless.c @@ -0,0 +1,253 @@ +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) 1998 - 2010, Daniel Stenberg, , et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at http://curl.haxx.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ***************************************************************************/ + +#include "setup.h" + +#include "warnless.h" + +#define CURL_MASK_SCHAR 0x7F +#define CURL_MASK_UCHAR 0xFF + +#if (SIZEOF_SHORT == 2) +# define CURL_MASK_SSHORT 0x7FFF +# define CURL_MASK_USHORT 0xFFFF +#elif (SIZEOF_SHORT == 4) +# define CURL_MASK_SSHORT 0x7FFFFFFF +# define CURL_MASK_USHORT 0xFFFFFFFF +#elif (SIZEOF_SHORT == 8) +# define CURL_MASK_SSHORT 0x7FFFFFFFFFFFFFFF +# define CURL_MASK_USHORT 0xFFFFFFFFFFFFFFFF +#else +# error "SIZEOF_SHORT not defined" +#endif + +#if (SIZEOF_INT == 2) +# define CURL_MASK_SINT 0x7FFF +# define CURL_MASK_UINT 0xFFFF +#elif (SIZEOF_INT == 4) +# define CURL_MASK_SINT 0x7FFFFFFF +# define CURL_MASK_UINT 0xFFFFFFFF +#elif (SIZEOF_INT == 8) +# define CURL_MASK_SINT 0x7FFFFFFFFFFFFFFF +# define CURL_MASK_UINT 0xFFFFFFFFFFFFFFFF +#elif (SIZEOF_INT == 16) +# define CURL_MASK_SINT 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF +# define CURL_MASK_UINT 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF +#else +# error "SIZEOF_INT not defined" +#endif + +#if (CURL_SIZEOF_LONG == 2) +# define CURL_MASK_SLONG 0x7FFFL +# define CURL_MASK_ULONG 0xFFFFUL +#elif (CURL_SIZEOF_LONG == 4) +# define CURL_MASK_SLONG 0x7FFFFFFFL +# define CURL_MASK_ULONG 0xFFFFFFFFUL +#elif (CURL_SIZEOF_LONG == 8) +# define CURL_MASK_SLONG 0x7FFFFFFFFFFFFFFFL +# define CURL_MASK_ULONG 0xFFFFFFFFFFFFFFFFUL +#elif (CURL_SIZEOF_LONG == 16) +# define CURL_MASK_SLONG 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFL +# define CURL_MASK_ULONG 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFUL +#else +# error "CURL_SIZEOF_LONG not defined" +#endif + +#if (CURL_SIZEOF_CURL_OFF_T == 2) +# define CURL_MASK_SCOFFT CURL_OFF_T_C(0x7FFF) +# define CURL_MASK_UCOFFT CURL_OFF_TU_C(0xFFFF) +#elif (CURL_SIZEOF_CURL_OFF_T == 4) +# define CURL_MASK_SCOFFT CURL_OFF_T_C(0x7FFFFFFF) +# define CURL_MASK_UCOFFT CURL_OFF_TU_C(0xFFFFFFFF) +#elif (CURL_SIZEOF_CURL_OFF_T == 8) +# define CURL_MASK_SCOFFT CURL_OFF_T_C(0x7FFFFFFFFFFFFFFF) +# define CURL_MASK_UCOFFT CURL_OFF_TU_C(0xFFFFFFFFFFFFFFFF) +#elif (CURL_SIZEOF_CURL_OFF_T == 16) +# define CURL_MASK_SCOFFT CURL_OFF_T_C(0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF) +# define CURL_MASK_UCOFFT CURL_OFF_TU_C(0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF) +#else +# error "CURL_SIZEOF_CURL_OFF_T not defined" +#endif + +#if (SIZEOF_SIZE_T == SIZEOF_SHORT) +# define CURL_MASK_SSIZE_T CURL_MASK_SSHORT +# define CURL_MASK_USIZE_T CURL_MASK_USHORT +#elif (SIZEOF_SIZE_T == SIZEOF_INT) +# define CURL_MASK_SSIZE_T CURL_MASK_SINT +# define CURL_MASK_USIZE_T CURL_MASK_UINT +#elif (SIZEOF_SIZE_T == CURL_SIZEOF_LONG) +# define CURL_MASK_SSIZE_T CURL_MASK_SLONG +# define CURL_MASK_USIZE_T CURL_MASK_ULONG +#elif (SIZEOF_SIZE_T == CURL_SIZEOF_CURL_OFF_T) +# define CURL_MASK_SSIZE_T CURL_MASK_SCOFFT +# define CURL_MASK_USIZE_T CURL_MASK_UCOFFT +#else +# error "SIZEOF_SIZE_T not defined" +#endif + +/* +** unsigned long to unsigned short +*/ + +unsigned short curlx_ultous(unsigned long ulnum) +{ +#ifdef __INTEL_COMPILER +# pragma warning(push) +# pragma warning(disable:810) /* conversion may lose significant bits */ +#endif + + return (unsigned short)(ulnum & (unsigned long) CURL_MASK_USHORT); + +#ifdef __INTEL_COMPILER +# pragma warning(pop) +#endif +} + +/* +** unsigned long to unsigned char +*/ + +unsigned char curlx_ultouc(unsigned long ulnum) +{ +#ifdef __INTEL_COMPILER +# pragma warning(push) +# pragma warning(disable:810) /* conversion may lose significant bits */ +#endif + + return (unsigned char)(ulnum & (unsigned long) CURL_MASK_UCHAR); + +#ifdef __INTEL_COMPILER +# pragma warning(pop) +#endif +} + +/* +** unsigned size_t to signed int +*/ + +int curlx_uztosi(size_t uznum) +{ +#ifdef __INTEL_COMPILER +# pragma warning(push) +# pragma warning(disable:810) /* conversion may lose significant bits */ +#endif + + return (int)(uznum & (size_t) CURL_MASK_SINT); + +#ifdef __INTEL_COMPILER +# pragma warning(pop) +#endif +} + +/* +** signed long to signed int +*/ + +int curlx_sltosi(long slnum) +{ +#ifdef __INTEL_COMPILER +# pragma warning(push) +# pragma warning(disable:810) /* conversion may lose significant bits */ +#endif + + DEBUGASSERT(slnum >= 0); + return (int)(slnum & (long) CURL_MASK_SINT); + +#ifdef __INTEL_COMPILER +# pragma warning(pop) +#endif +} + +/* +** signed long to unsigned int +*/ + +unsigned int curlx_sltoui(long slnum) +{ +#ifdef __INTEL_COMPILER +# pragma warning(push) +# pragma warning(disable:810) /* conversion may lose significant bits */ +#endif + + DEBUGASSERT(slnum >= 0); + return (unsigned int)(slnum & (long) CURL_MASK_UINT); + +#ifdef __INTEL_COMPILER +# pragma warning(pop) +#endif +} + +/* +** signed long to unsigned short +*/ + +unsigned short curlx_sltous(long slnum) +{ +#ifdef __INTEL_COMPILER +# pragma warning(push) +# pragma warning(disable:810) /* conversion may lose significant bits */ +#endif + + DEBUGASSERT(slnum >= 0); + return (unsigned short)(slnum & (long) CURL_MASK_USHORT); + +#ifdef __INTEL_COMPILER +# pragma warning(pop) +#endif +} + +/* +** unsigned size_t to signed ssize_t +*/ + +ssize_t curlx_uztosz(size_t uznum) +{ +#ifdef __INTEL_COMPILER +# pragma warning(push) +# pragma warning(disable:810) /* conversion may lose significant bits */ +#endif + + return (ssize_t)(uznum & (size_t) CURL_MASK_SSIZE_T); + +#ifdef __INTEL_COMPILER +# pragma warning(pop) +#endif +} + +/* +** signed curl_off_t to unsigned size_t +*/ + +size_t curlx_sotouz(curl_off_t sonum) +{ +#ifdef __INTEL_COMPILER +# pragma warning(push) +# pragma warning(disable:810) /* conversion may lose significant bits */ +#endif + + DEBUGASSERT(sonum >= 0); + return (size_t)(sonum & (curl_off_t) CURL_MASK_USIZE_T); + +#ifdef __INTEL_COMPILER +# pragma warning(pop) +#endif +} diff --git a/mobicore/common/curl/lib/warnless.h b/mobicore/common/curl/lib/warnless.h new file mode 100644 index 0000000000000000000000000000000000000000..7b9bd3c7f4d7a90991650c72aef5a5b3a155ea48 --- /dev/null +++ b/mobicore/common/curl/lib/warnless.h @@ -0,0 +1,41 @@ +#ifndef HEADER_CURL_WARNLESS_H +#define HEADER_CURL_WARNLESS_H +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) 1998 - 2010, Daniel Stenberg, , et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at http://curl.haxx.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ***************************************************************************/ + +unsigned short curlx_ultous(unsigned long ulnum); + +unsigned char curlx_ultouc(unsigned long ulnum); + +int curlx_uztosi(size_t uznum); + +int curlx_sltosi(long slnum); + +unsigned int curlx_sltoui(long slnum); + +unsigned short curlx_sltous(long slnum); + +ssize_t curlx_uztosz(size_t uznum); + +size_t curlx_sotouz(curl_off_t sonum); + +#endif /* HEADER_CURL_WARNLESS_H */ diff --git a/mobicore/common/curl/lib/wildcard.c b/mobicore/common/curl/lib/wildcard.c new file mode 100644 index 0000000000000000000000000000000000000000..9fe5d51355d4d3f96374496c914bdd01c013ce0e --- /dev/null +++ b/mobicore/common/curl/lib/wildcard.c @@ -0,0 +1,76 @@ +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) 1998 - 2010, Daniel Stenberg, , et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at http://curl.haxx.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ***************************************************************************/ + +#include "setup.h" +#include "wildcard.h" +#include "llist.h" +#include "fileinfo.h" + +#define _MPRINTF_REPLACE /* use our functions only */ +#include + +#include "curl_memory.h" +/* The last #include file should be: */ +#include "memdebug.h" + +CURLcode Curl_wildcard_init(struct WildcardData *wc) +{ + DEBUGASSERT(wc->filelist == NULL); + /* now allocate only wc->filelist, everything else + will be allocated if it is needed. */ + wc->filelist = Curl_llist_alloc(Curl_fileinfo_dtor); + if(!wc->filelist) {; + return CURLE_OUT_OF_MEMORY; + } + return CURLE_OK; +} + +void Curl_wildcard_dtor(struct WildcardData *wc) +{ + if(!wc) + return; + + if(wc->tmp_dtor) { + wc->tmp_dtor(wc->tmp); + wc->tmp_dtor = ZERO_NULL; + wc->tmp = NULL; + } + DEBUGASSERT(wc->tmp == NULL); + + if(wc->filelist) { + Curl_llist_destroy(wc->filelist, NULL); + wc->filelist = NULL; + } + + if(wc->path) { + free(wc->path); + wc->path = NULL; + } + + if(wc->pattern) { + free(wc->pattern); + wc->pattern = NULL; + } + + wc->customptr = NULL; + wc->state = CURLWC_INIT; +} diff --git a/mobicore/common/curl/lib/wildcard.h b/mobicore/common/curl/lib/wildcard.h new file mode 100644 index 0000000000000000000000000000000000000000..8f732d106ba9aebce0f93feac68007d22ec47e74 --- /dev/null +++ b/mobicore/common/curl/lib/wildcard.h @@ -0,0 +1,58 @@ +#ifndef HEADER_CURL_WILDCARD_H +#define HEADER_CURL_WILDCARD_H +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) 2010, Daniel Stenberg, , et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at http://curl.haxx.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ***************************************************************************/ + +#include + +/* list of wildcard process states */ +typedef enum { + CURLWC_INIT = 0, + CURLWC_MATCHING, /* library is trying to get list of addresses for + downloading */ + CURLWC_DOWNLOADING, + CURLWC_CLEAN, /* deallocate resources and reset settings */ + CURLWC_SKIP, /* skip over concrete file */ + CURLWC_ERROR, /* error cases */ + CURLWC_DONE /* if is wildcard->state == CURLWC_DONE wildcard loop in + Curl_perform() will end */ +} curl_wildcard_states; + +typedef void (*curl_wildcard_tmp_dtor)(void *ptr); + +/* struct keeping information about wildcard download process */ +struct WildcardData { + curl_wildcard_states state; + char *path; /* path to the directory, where we trying wildcard-match */ + char *pattern; /* wildcard pattern */ + struct curl_llist *filelist; /* llist with struct Curl_fileinfo */ + void *tmp; /* pointer to protocol specific temporary data */ + curl_wildcard_tmp_dtor tmp_dtor; + void *customptr; /* for CURLOPT_CHUNK_DATA pointer */ +}; + +CURLcode Curl_wildcard_init(struct WildcardData *wc); +void Curl_wildcard_dtor(struct WildcardData *wc); + +struct SessionHandle; + +#endif /* HEADER_CURL_WILDCARD_H */ diff --git a/mobicore/common/curl/libcurl.pc.in b/mobicore/common/curl/libcurl.pc.in new file mode 100644 index 0000000000000000000000000000000000000000..6eea31fb560cf215f5612d2ebb3a6c34e75370d9 --- /dev/null +++ b/mobicore/common/curl/libcurl.pc.in @@ -0,0 +1,39 @@ +#*************************************************************************** +# _ _ ____ _ +# Project ___| | | | _ \| | +# / __| | | | |_) | | +# | (__| |_| | _ <| |___ +# \___|\___/|_| \_\_____| +# +# Copyright (C) 2004 - 2007, Daniel Stenberg, , et al. +# +# This software is licensed as described in the file COPYING, which +# you should have received as part of this distribution. The terms +# are also available at http://curl.haxx.se/docs/copyright.html. +# +# You may opt to use, copy, modify, merge, publish, distribute and/or sell +# copies of the Software, and permit persons to whom the Software is +# furnished to do so, under the terms of the COPYING file. +# +# This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY +# KIND, either express or implied. +# +########################################################################### + +# This should most probably benefit from getting a "Requires:" field added +# dynamically by configure. +# +prefix=@prefix@ +exec_prefix=@exec_prefix@ +libdir=@libdir@ +includedir=@includedir@ +supported_protocols="@SUPPORT_PROTOCOLS@" +supported_features="@SUPPORT_FEATURES@" + +Name: libcurl +URL: http://curl.haxx.se/ +Description: Library to transfer files with ftp, http, etc. +Version: @VERSION@ +Libs: -L${libdir} -lcurl @LIBS@ +Libs.private: @LIBCURL_LIBS@ @LIBS@ +Cflags: -I${includedir} diff --git a/mobicore/common/curl/m4/curl-compilers.m4 b/mobicore/common/curl/m4/curl-compilers.m4 new file mode 100644 index 0000000000000000000000000000000000000000..413293b1065a6ef786539e79b9d49b1086354d9a --- /dev/null +++ b/mobicore/common/curl/m4/curl-compilers.m4 @@ -0,0 +1,1421 @@ +#*************************************************************************** +# _ _ ____ _ +# Project ___| | | | _ \| | +# / __| | | | |_) | | +# | (__| |_| | _ <| |___ +# \___|\___/|_| \_\_____| +# +# Copyright (C) 1998 - 2010, Daniel Stenberg, , et al. +# +# This software is licensed as described in the file COPYING, which +# you should have received as part of this distribution. The terms +# are also available at http://curl.haxx.se/docs/copyright.html. +# +# You may opt to use, copy, modify, merge, publish, distribute and/or sell +# copies of the Software, and permit persons to whom the Software is +# furnished to do so, under the terms of the COPYING file. +# +# This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY +# KIND, either express or implied. +# +#*************************************************************************** + +# File version for 'aclocal' use. Keep it a single number. +# serial 56 + + +dnl CURL_CHECK_COMPILER +dnl ------------------------------------------------- +dnl Verify if the C compiler being used is known. + +AC_DEFUN([CURL_CHECK_COMPILER], [ + # + compiler_id="unknown" + compiler_num="0" + # + flags_dbg_all="unknown" + flags_dbg_yes="unknown" + flags_dbg_off="unknown" + flags_opt_all="unknown" + flags_opt_yes="unknown" + flags_opt_off="unknown" + # + CURL_CHECK_COMPILER_DEC_C + CURL_CHECK_COMPILER_HPUX_C + CURL_CHECK_COMPILER_IBM_C + CURL_CHECK_COMPILER_INTEL_C + CURL_CHECK_COMPILER_CLANG + CURL_CHECK_COMPILER_GNU_C + CURL_CHECK_COMPILER_LCC + CURL_CHECK_COMPILER_SGI_MIPSPRO_C + CURL_CHECK_COMPILER_SGI_MIPS_C + CURL_CHECK_COMPILER_SUNPRO_C + CURL_CHECK_COMPILER_TINY_C + CURL_CHECK_COMPILER_WATCOM_C + # + if test "$compiler_id" = "unknown"; then + cat <<_EOF 1>&2 +*** +*** Warning: This configure script does not have information about the +*** compiler you are using, relative to the flags required to enable or +*** disable generation of debug info, optimization options or warnings. +*** +*** Whatever settings are present in CFLAGS will be used for this run. +*** +*** If you wish to help the cURL project to better support your compiler +*** you can report this and the required info on the libcurl development +*** mailing list: http://cool.haxx.se/mailman/listinfo/curl-library/ +*** +_EOF + fi +]) + + +dnl CURL_CHECK_COMPILER_CLANG +dnl ------------------------------------------------- +dnl Verify if compiler being used is clang. + +AC_DEFUN([CURL_CHECK_COMPILER_CLANG], [ + AC_BEFORE([$0],[CURL_CHECK_COMPILER_GNU_C])dnl + AC_MSG_CHECKING([if compiler is clang]) + CURL_CHECK_DEF([__clang__], [], [silent]) + if test "$curl_cv_have_def___clang__" = "yes"; then + AC_MSG_RESULT([yes]) + compiler_id="CLANG" + clangver=`$CC -dumpversion` + clangvhi=`echo $clangver | cut -d . -f1` + clangvlo=`echo $clangver | cut -d . -f2` + compiler_num=`(expr $clangvhi "*" 100 + $clangvlo) 2>/dev/null` + flags_dbg_all="-g -g0 -g1 -g2 -g3" + flags_dbg_all="$flags_dbg_all -ggdb" + flags_dbg_all="$flags_dbg_all -gstabs" + flags_dbg_all="$flags_dbg_all -gstabs+" + flags_dbg_all="$flags_dbg_all -gcoff" + flags_dbg_all="$flags_dbg_all -gxcoff" + flags_dbg_all="$flags_dbg_all -gdwarf-2" + flags_dbg_all="$flags_dbg_all -gvms" + flags_dbg_yes="-g" + flags_dbg_off="-g0" + flags_opt_all="-O -O0 -O1 -O2 -Os -O3 -O4" + flags_opt_yes="-Os" + flags_opt_off="-O0" + else + AC_MSG_RESULT([no]) + fi +]) + + +dnl CURL_CHECK_COMPILER_DEC_C +dnl ------------------------------------------------- +dnl Verify if compiler being used is DEC C. + +AC_DEFUN([CURL_CHECK_COMPILER_DEC_C], [ + AC_MSG_CHECKING([if compiler is DEC/Compaq/HP C]) + CURL_CHECK_DEF([__DECC], [], [silent]) + CURL_CHECK_DEF([__DECC_VER], [], [silent]) + if test "$curl_cv_have_def___DECC" = "yes" && + test "$curl_cv_have_def___DECC_VER" = "yes"; then + AC_MSG_RESULT([yes]) + compiler_id="DEC_C" + flags_dbg_all="-g -g0 -g1 -g2 -g3" + flags_dbg_yes="-g2" + flags_dbg_off="-g0" + flags_opt_all="-O -O0 -O1 -O2 -O3 -O4" + flags_opt_yes="-O1" + flags_opt_off="-O0" + else + AC_MSG_RESULT([no]) + fi +]) + + +dnl CURL_CHECK_COMPILER_GNU_C +dnl ------------------------------------------------- +dnl Verify if compiler being used is GNU C. + +AC_DEFUN([CURL_CHECK_COMPILER_GNU_C], [ + AC_REQUIRE([CURL_CHECK_COMPILER_INTEL_C])dnl + AC_REQUIRE([CURL_CHECK_COMPILER_CLANG])dnl + AC_MSG_CHECKING([if compiler is GNU C]) + CURL_CHECK_DEF([__GNUC__], [], [silent]) + if test "$curl_cv_have_def___GNUC__" = "yes" && + test "$compiler_id" = "unknown"; then + AC_MSG_RESULT([yes]) + compiler_id="GNU_C" + gccver=`$CC -dumpversion` + gccvhi=`echo $gccver | cut -d . -f1` + gccvlo=`echo $gccver | cut -d . -f2` + compiler_num=`(expr $gccvhi "*" 100 + $gccvlo) 2>/dev/null` + flags_dbg_all="-g -g0 -g1 -g2 -g3" + flags_dbg_all="$flags_dbg_all -ggdb" + flags_dbg_all="$flags_dbg_all -gstabs" + flags_dbg_all="$flags_dbg_all -gstabs+" + flags_dbg_all="$flags_dbg_all -gcoff" + flags_dbg_all="$flags_dbg_all -gxcoff" + flags_dbg_all="$flags_dbg_all -gdwarf-2" + flags_dbg_all="$flags_dbg_all -gvms" + flags_dbg_yes="-g" + flags_dbg_off="-g0" + flags_opt_all="-O -O0 -O1 -O2 -O3 -Os" + flags_opt_yes="-O2" + flags_opt_off="-O0" + else + AC_MSG_RESULT([no]) + fi +]) + + +dnl CURL_CHECK_COMPILER_HPUX_C +dnl ------------------------------------------------- +dnl Verify if compiler being used is HP-UX C. + +AC_DEFUN([CURL_CHECK_COMPILER_HPUX_C], [ + AC_MSG_CHECKING([if compiler is HP-UX C]) + CURL_CHECK_DEF([__HP_cc], [], [silent]) + if test "$curl_cv_have_def___HP_cc" = "yes"; then + AC_MSG_RESULT([yes]) + compiler_id="HP_UX_C" + flags_dbg_all="-g -s" + flags_dbg_yes="-g" + flags_dbg_off="-s" + flags_opt_all="-O +O0 +O1 +O2 +O3 +O4" + flags_opt_yes="+O2" + flags_opt_off="+O0" + else + AC_MSG_RESULT([no]) + fi +]) + + +dnl CURL_CHECK_COMPILER_IBM_C +dnl ------------------------------------------------- +dnl Verify if compiler being used is IBM C. + +AC_DEFUN([CURL_CHECK_COMPILER_IBM_C], [ + AC_MSG_CHECKING([if compiler is IBM C]) + CURL_CHECK_DEF([__IBMC__], [], [silent]) + if test "$curl_cv_have_def___IBMC__" = "yes"; then + AC_MSG_RESULT([yes]) + compiler_id="IBM_C" + flags_dbg_all="-g -g0 -g1 -g2 -g3" + flags_dbg_yes="-g" + flags_dbg_off="" + flags_opt_all="-O -O0 -O1 -O2 -O3 -O4 -O5" + flags_opt_all="$flags_opt_all -qnooptimize" + flags_opt_all="$flags_opt_all -qoptimize=0" + flags_opt_all="$flags_opt_all -qoptimize=1" + flags_opt_all="$flags_opt_all -qoptimize=2" + flags_opt_all="$flags_opt_all -qoptimize=3" + flags_opt_all="$flags_opt_all -qoptimize=4" + flags_opt_all="$flags_opt_all -qoptimize=5" + flags_opt_yes="-O2" + flags_opt_off="-qnooptimize" + else + AC_MSG_RESULT([no]) + fi +]) + + +dnl CURL_CHECK_COMPILER_INTEL_C +dnl ------------------------------------------------- +dnl Verify if compiler being used is Intel C. + +AC_DEFUN([CURL_CHECK_COMPILER_INTEL_C], [ + AC_BEFORE([$0],[CURL_CHECK_COMPILER_GNU_C])dnl + AC_MSG_CHECKING([if compiler is Intel C]) + CURL_CHECK_DEF([__INTEL_COMPILER], [], [silent]) + if test "$curl_cv_have_def___INTEL_COMPILER" = "yes"; then + AC_MSG_RESULT([yes]) + compiler_num="$curl_cv_def___INTEL_COMPILER" + CURL_CHECK_DEF([__unix__], [], [silent]) + if test "$curl_cv_have_def___unix__" = "yes"; then + compiler_id="INTEL_UNIX_C" + flags_dbg_all="-g -g0" + flags_dbg_yes="-g" + flags_dbg_off="-g0" + flags_opt_all="-O -O0 -O1 -O2 -O3 -Os" + flags_opt_yes="-O2" + flags_opt_off="-O0" + else + compiler_id="INTEL_WINDOWS_C" + flags_dbg_all="/ZI /Zi /zI /zi /ZD /Zd /zD /zd /Z7 /z7 /Oy /Oy-" + flags_dbg_all="$flags_dbg_all /debug" + flags_dbg_all="$flags_dbg_all /debug:none" + flags_dbg_all="$flags_dbg_all /debug:minimal" + flags_dbg_all="$flags_dbg_all /debug:partial" + flags_dbg_all="$flags_dbg_all /debug:full" + flags_dbg_all="$flags_dbg_all /debug:semantic_stepping" + flags_dbg_all="$flags_dbg_all /debug:extended" + flags_dbg_yes="/Zi /Oy-" + flags_dbg_off="/debug:none /Oy-" + flags_opt_all="/O /O0 /O1 /O2 /O3 /Od /Og /Og- /Oi /Oi-" + flags_opt_yes="/O2" + flags_opt_off="/Od" + fi + else + AC_MSG_RESULT([no]) + fi +]) + + +dnl CURL_CHECK_COMPILER_LCC +dnl ------------------------------------------------- +dnl Verify if compiler being used is LCC. + +AC_DEFUN([CURL_CHECK_COMPILER_LCC], [ + AC_MSG_CHECKING([if compiler is LCC]) + CURL_CHECK_DEF([__LCC__], [], [silent]) + if test "$curl_cv_have_def___LCC__" = "yes"; then + AC_MSG_RESULT([yes]) + compiler_id="LCC" + flags_dbg_all="-g" + flags_dbg_yes="-g" + flags_dbg_off="" + flags_opt_all="" + flags_opt_yes="" + flags_opt_off="" + else + AC_MSG_RESULT([no]) + fi +]) + + +dnl CURL_CHECK_COMPILER_SGI_MIPS_C +dnl ------------------------------------------------- +dnl Verify if compiler being used is SGI MIPS C. + +AC_DEFUN([CURL_CHECK_COMPILER_SGI_MIPS_C], [ + AC_REQUIRE([CURL_CHECK_COMPILER_SGI_MIPSPRO_C])dnl + AC_MSG_CHECKING([if compiler is SGI MIPS C]) + CURL_CHECK_DEF([__GNUC__], [], [silent]) + CURL_CHECK_DEF([__sgi], [], [silent]) + if test "$curl_cv_have_def___GNUC__" = "no" && + test "$curl_cv_have_def___sgi" = "yes" && + test "$compiler_id" = "unknown"; then + AC_MSG_RESULT([yes]) + compiler_id="SGI_MIPS_C" + flags_dbg_all="-g -g0 -g1 -g2 -g3" + flags_dbg_yes="-g" + flags_dbg_off="-g0" + flags_opt_all="-O -O0 -O1 -O2 -O3 -Ofast" + flags_opt_yes="-O2" + flags_opt_off="-O0" + else + AC_MSG_RESULT([no]) + fi +]) + + +dnl CURL_CHECK_COMPILER_SGI_MIPSPRO_C +dnl ------------------------------------------------- +dnl Verify if compiler being used is SGI MIPSpro C. + +AC_DEFUN([CURL_CHECK_COMPILER_SGI_MIPSPRO_C], [ + AC_BEFORE([$0],[CURL_CHECK_COMPILER_SGI_MIPS_C])dnl + AC_MSG_CHECKING([if compiler is SGI MIPSpro C]) + CURL_CHECK_DEF([__GNUC__], [], [silent]) + CURL_CHECK_DEF([_COMPILER_VERSION], [], [silent]) + CURL_CHECK_DEF([_SGI_COMPILER_VERSION], [], [silent]) + if test "$curl_cv_have_def___GNUC__" = "no" && + (test "$curl_cv_have_def__SGI_COMPILER_VERSION" = "yes" || + test "$curl_cv_have_def__COMPILER_VERSION" = "yes"); then + AC_MSG_RESULT([yes]) + compiler_id="SGI_MIPSPRO_C" + flags_dbg_all="-g -g0 -g1 -g2 -g3" + flags_dbg_yes="-g" + flags_dbg_off="-g0" + flags_opt_all="-O -O0 -O1 -O2 -O3 -Ofast" + flags_opt_yes="-O2" + flags_opt_off="-O0" + else + AC_MSG_RESULT([no]) + fi +]) + + +dnl CURL_CHECK_COMPILER_SUNPRO_C +dnl ------------------------------------------------- +dnl Verify if compiler being used is SunPro C. + +AC_DEFUN([CURL_CHECK_COMPILER_SUNPRO_C], [ + AC_MSG_CHECKING([if compiler is SunPro C]) + CURL_CHECK_DEF([__SUNPRO_C], [], [silent]) + if test "$curl_cv_have_def___SUNPRO_C" = "yes"; then + AC_MSG_RESULT([yes]) + compiler_id="SUNPRO_C" + flags_dbg_all="-g -s" + flags_dbg_yes="-g" + flags_dbg_off="-s" + flags_opt_all="-O -xO -xO1 -xO2 -xO3 -xO4 -xO5" + flags_opt_yes="-xO2" + flags_opt_off="" + else + AC_MSG_RESULT([no]) + fi +]) + + +dnl CURL_CHECK_COMPILER_TINY_C +dnl ------------------------------------------------- +dnl Verify if compiler being used is Tiny C. + +AC_DEFUN([CURL_CHECK_COMPILER_TINY_C], [ + AC_MSG_CHECKING([if compiler is Tiny C]) + CURL_CHECK_DEF([__TINYC__], [], [silent]) + if test "$curl_cv_have_def___TINYC__" = "yes"; then + AC_MSG_RESULT([yes]) + compiler_id="TINY_C" + flags_dbg_all="-g -b" + flags_dbg_yes="-g" + flags_dbg_off="" + flags_opt_all="" + flags_opt_yes="" + flags_opt_off="" + else + AC_MSG_RESULT([no]) + fi +]) + + +dnl CURL_CHECK_COMPILER_WATCOM_C +dnl ------------------------------------------------- +dnl Verify if compiler being used is Watcom C. + +AC_DEFUN([CURL_CHECK_COMPILER_WATCOM_C], [ + AC_MSG_CHECKING([if compiler is Watcom C]) + CURL_CHECK_DEF([__WATCOMC__], [], [silent]) + if test "$curl_cv_have_def___WATCOMC__" = "yes"; then + AC_MSG_RESULT([yes]) + CURL_CHECK_DEF([__UNIX__], [], [silent]) + if test "$curl_cv_have_def___UNIX__" = "yes"; then + compiler_id="WATCOM_UNIX_C" + flags_dbg_all="-g1 -g1+ -g2 -g3" + flags_dbg_yes="-g2" + flags_dbg_off="" + flags_opt_all="-O0 -O1 -O2 -O3" + flags_opt_yes="-O2" + flags_opt_off="-O0" + else + compiler_id="WATCOM_WINDOWS_C" + flags_dbg_all="" + flags_dbg_yes="" + flags_dbg_off="" + flags_opt_all="" + flags_opt_yes="" + flags_opt_off="" + fi + else + AC_MSG_RESULT([no]) + fi +]) + + +dnl CURL_CONVERT_INCLUDE_TO_ISYSTEM +dnl ------------------------------------------------- +dnl Changes standard include paths present in CFLAGS +dnl and CPPFLAGS into isystem include paths. This is +dnl done to prevent GNUC from generating warnings on +dnl headers from these locations, although on ancient +dnl GNUC versions these warnings are not silenced. + +AC_DEFUN([CURL_CONVERT_INCLUDE_TO_ISYSTEM], [ + AC_REQUIRE([CURL_SHFUNC_SQUEEZE])dnl + tmp_has_include="no" + tmp_chg_FLAGS="$CFLAGS" + for word1 in $tmp_chg_FLAGS; do + case "$word1" in + -I*) + tmp_has_include="yes" + ;; + esac + done + if test "$tmp_has_include" = "yes"; then + tmp_chg_FLAGS=`echo "$tmp_chg_FLAGS" | "$SED" 's/^-I/ -isystem /g'` + tmp_chg_FLAGS=`echo "$tmp_chg_FLAGS" | "$SED" 's/ -I/ -isystem /g'` + CFLAGS="$tmp_chg_FLAGS" + squeeze CFLAGS + fi + tmp_has_include="no" + tmp_chg_FLAGS="$CPPFLAGS" + for word1 in $tmp_chg_FLAGS; do + case "$word1" in + -I*) + tmp_has_include="yes" + ;; + esac + done + if test "$tmp_has_include" = "yes"; then + tmp_chg_FLAGS=`echo "$tmp_chg_FLAGS" | "$SED" 's/^-I/ -isystem /g'` + tmp_chg_FLAGS=`echo "$tmp_chg_FLAGS" | "$SED" 's/ -I/ -isystem /g'` + CPPFLAGS="$tmp_chg_FLAGS" + squeeze CPPFLAGS + fi +]) + + +dnl CURL_COMPILER_WORKS_IFELSE ([ACTION-IF-WORKS], [ACTION-IF-NOT-WORKS]) +dnl ------------------------------------------------- +dnl Verify if the C compiler seems to work with the +dnl settings that are 'active' at the time the test +dnl is performed. + +AC_DEFUN([CURL_COMPILER_WORKS_IFELSE], [ + dnl compilation capability verification + tmp_compiler_works="unknown" + AC_COMPILE_IFELSE([ + AC_LANG_PROGRAM([[ + ]],[[ + int i = 1; + return i; + ]]) + ],[ + tmp_compiler_works="yes" + ],[ + tmp_compiler_works="no" + echo " " >&6 + sed 's/^/cc-fail: /' conftest.err >&6 + echo " " >&6 + ]) + dnl linking capability verification + if test "$tmp_compiler_works" = "yes"; then + AC_LINK_IFELSE([ + AC_LANG_PROGRAM([[ + ]],[[ + int i = 1; + return i; + ]]) + ],[ + tmp_compiler_works="yes" + ],[ + tmp_compiler_works="no" + echo " " >&6 + sed 's/^/link-fail: /' conftest.err >&6 + echo " " >&6 + ]) + fi + dnl only do runtime verification when not cross-compiling + if test "x$cross_compiling" != "xyes" && + test "$tmp_compiler_works" = "yes"; then + AC_RUN_IFELSE([ + AC_LANG_PROGRAM([[ +# ifdef __STDC__ +# include +# endif + ]],[[ + int i = 0; + exit(i); + ]]) + ],[ + tmp_compiler_works="yes" + ],[ + tmp_compiler_works="no" + echo " " >&6 + echo "run-fail: test program exited with status $ac_status" >&6 + echo " " >&6 + ]) + fi + dnl branch upon test result + if test "$tmp_compiler_works" = "yes"; then + ifelse($1,,:,[$1]) + ifelse($2,,,[else + $2]) + fi +]) + + +dnl CURL_SET_COMPILER_BASIC_OPTS +dnl ------------------------------------------------- +dnl Sets compiler specific options/flags which do not +dnl depend on configure's debug, optimize or warnings +dnl options. + +AC_DEFUN([CURL_SET_COMPILER_BASIC_OPTS], [ + AC_REQUIRE([CURL_CHECK_COMPILER])dnl + AC_REQUIRE([CURL_SHFUNC_SQUEEZE])dnl + # + if test "$compiler_id" != "unknown"; then + # + if test "$compiler_id" = "GNU_C" || + test "$compiler_id" = "CLANG"; then + CURL_CONVERT_INCLUDE_TO_ISYSTEM + fi + # + tmp_save_CPPFLAGS="$CPPFLAGS" + tmp_save_CFLAGS="$CFLAGS" + tmp_CPPFLAGS="" + tmp_CFLAGS="" + # + case "$compiler_id" in + # + CLANG) + # + dnl Disable warnings for unused arguments, otherwise clang will + dnl warn about compile-time arguments used during link-time, like + dnl -O and -g and -pedantic. + tmp_CFLAGS="$tmp_CFLAGS -Qunused-arguments" + ;; + # + DEC_C) + # + dnl Select strict ANSI C compiler mode + tmp_CFLAGS="$tmp_CFLAGS -std1" + dnl Turn off optimizer ANSI C aliasing rules + tmp_CFLAGS="$tmp_CFLAGS -noansi_alias" + dnl Generate warnings for missing function prototypes + tmp_CFLAGS="$tmp_CFLAGS -warnprotos" + dnl Change some warnings into fatal errors + tmp_CFLAGS="$tmp_CFLAGS -msg_fatal toofewargs,toomanyargs" + ;; + # + GNU_C) + # + dnl Placeholder + tmp_CFLAGS="$tmp_CFLAGS" + ;; + # + HP_UX_C) + # + dnl Disallow run-time dereferencing of null pointers + tmp_CFLAGS="$tmp_CFLAGS -z" + dnl Disable some remarks + dnl #4227: padding struct with n bytes to align member + dnl #4255: padding size of struct with n bytes to alignment boundary + tmp_CFLAGS="$tmp_CFLAGS +W 4227,4255" + ;; + # + IBM_C) + # + dnl Ensure that compiler optimizations are always thread-safe. + tmp_CFLAGS="$tmp_CFLAGS -qthreaded" + dnl Disable type based strict aliasing optimizations, using worst + dnl case aliasing assumptions when compiling. Type based aliasing + dnl would restrict the lvalues that could be safely used to access + dnl a data object. + tmp_CFLAGS="$tmp_CFLAGS -qnoansialias" + dnl Force compiler to stop after the compilation phase, without + dnl generating an object code file when compilation has errors. + tmp_CFLAGS="$tmp_CFLAGS -qhalt=e" + ;; + # + INTEL_UNIX_C) + # + dnl On unix this compiler uses gcc's header files, so + dnl we select ANSI C89 dialect plus GNU extensions. + tmp_CFLAGS="$tmp_CFLAGS -std=gnu89" + dnl Change some warnings into errors + dnl #140: too many arguments in function call + dnl #147: declaration is incompatible with 'previous one' + dnl #165: too few arguments in function call + dnl #266: function declared implicitly + tmp_CPPFLAGS="$tmp_CPPFLAGS -we 140,147,165,266" + dnl Disable some remarks + dnl #279: controlling expression is constant + dnl #981: operands are evaluated in unspecified order + dnl #1469: "cc" clobber ignored + tmp_CPPFLAGS="$tmp_CPPFLAGS -wd 279,981,1469" + ;; + # + INTEL_WINDOWS_C) + # + dnl Placeholder + tmp_CFLAGS="$tmp_CFLAGS" + ;; + # + LCC) + # + dnl Disallow run-time dereferencing of null pointers + tmp_CFLAGS="$tmp_CFLAGS -n" + ;; + # + SGI_MIPS_C) + # + dnl Placeholder + tmp_CFLAGS="$tmp_CFLAGS" + ;; + # + SGI_MIPSPRO_C) + # + dnl Placeholder + tmp_CFLAGS="$tmp_CFLAGS" + ;; + # + SUNPRO_C) + # + dnl Placeholder + tmp_CFLAGS="$tmp_CFLAGS" + ;; + # + TINY_C) + # + dnl Placeholder + tmp_CFLAGS="$tmp_CFLAGS" + ;; + # + WATCOM_UNIX_C) + # + dnl Placeholder + tmp_CFLAGS="$tmp_CFLAGS" + ;; + # + WATCOM_WINDOWS_C) + # + dnl Placeholder + tmp_CFLAGS="$tmp_CFLAGS" + ;; + # + esac + # + squeeze tmp_CPPFLAGS + squeeze tmp_CFLAGS + # + if test ! -z "$tmp_CFLAGS" || test ! -z "$tmp_CPPFLAGS"; then + AC_MSG_CHECKING([if compiler accepts some basic options]) + CPPFLAGS="$tmp_save_CPPFLAGS $tmp_CPPFLAGS" + CFLAGS="$tmp_save_CFLAGS $tmp_CFLAGS" + squeeze CPPFLAGS + squeeze CFLAGS + CURL_COMPILER_WORKS_IFELSE([ + AC_MSG_RESULT([yes]) + AC_MSG_NOTICE([compiler options added: $tmp_CFLAGS $tmp_CPPFLAGS]) + ],[ + AC_MSG_RESULT([no]) + AC_MSG_WARN([compiler options rejected: $tmp_CFLAGS $tmp_CPPFLAGS]) + dnl restore initial settings + CPPFLAGS="$tmp_save_CPPFLAGS" + CFLAGS="$tmp_save_CFLAGS" + ]) + fi + # + fi +]) + + +dnl CURL_SET_COMPILER_DEBUG_OPTS +dnl ------------------------------------------------- +dnl Sets compiler specific options/flags which depend +dnl on configure's debug option. + +AC_DEFUN([CURL_SET_COMPILER_DEBUG_OPTS], [ + AC_REQUIRE([CURL_CHECK_OPTION_DEBUG])dnl + AC_REQUIRE([CURL_CHECK_COMPILER])dnl + AC_REQUIRE([CURL_SHFUNC_SQUEEZE])dnl + # + if test "$compiler_id" != "unknown"; then + # + tmp_save_CFLAGS="$CFLAGS" + tmp_save_CPPFLAGS="$CPPFLAGS" + # + tmp_options="" + tmp_CFLAGS="$CFLAGS" + tmp_CPPFLAGS="$CPPFLAGS" + CURL_VAR_STRIP([tmp_CFLAGS],[$flags_dbg_all]) + CURL_VAR_STRIP([tmp_CPPFLAGS],[$flags_dbg_all]) + # + if test "$want_debug" = "yes"; then + AC_MSG_CHECKING([if compiler accepts debug enabling options]) + tmp_options="$flags_dbg_yes" + fi + if test "$want_debug" = "no"; then + AC_MSG_CHECKING([if compiler accepts debug disabling options]) + tmp_options="$flags_dbg_off" + fi + # + CPPFLAGS="$tmp_CPPFLAGS" + CFLAGS="$tmp_CFLAGS $tmp_options" + squeeze CPPFLAGS + squeeze CFLAGS + CURL_COMPILER_WORKS_IFELSE([ + AC_MSG_RESULT([yes]) + AC_MSG_NOTICE([compiler options added: $tmp_options]) + ],[ + AC_MSG_RESULT([no]) + AC_MSG_WARN([compiler options rejected: $tmp_options]) + dnl restore initial settings + CPPFLAGS="$tmp_save_CPPFLAGS" + CFLAGS="$tmp_save_CFLAGS" + ]) + # + fi +]) + + +dnl CURL_SET_COMPILER_OPTIMIZE_OPTS +dnl ------------------------------------------------- +dnl Sets compiler specific options/flags which depend +dnl on configure's optimize option. + +AC_DEFUN([CURL_SET_COMPILER_OPTIMIZE_OPTS], [ + AC_REQUIRE([CURL_CHECK_OPTION_OPTIMIZE])dnl + AC_REQUIRE([CURL_CHECK_COMPILER])dnl + AC_REQUIRE([CURL_SHFUNC_SQUEEZE])dnl + # + if test "$compiler_id" != "unknown"; then + # + tmp_save_CFLAGS="$CFLAGS" + tmp_save_CPPFLAGS="$CPPFLAGS" + # + tmp_options="" + tmp_CFLAGS="$CFLAGS" + tmp_CPPFLAGS="$CPPFLAGS" + honor_optimize_option="yes" + # + dnl If optimization request setting has not been explicitly specified, + dnl it has been derived from the debug setting and initially assumed. + dnl This initially assumed optimizer setting will finally be ignored + dnl if CFLAGS or CPPFLAGS already hold optimizer flags. This implies + dnl that an initially assumed optimizer setting might not be honored. + # + if test "$want_optimize" = "assume_no" || + test "$want_optimize" = "assume_yes"; then + AC_MSG_CHECKING([if compiler optimizer assumed setting might be used]) + CURL_VAR_MATCH_IFELSE([tmp_CFLAGS],[$flags_opt_all],[ + honor_optimize_option="no" + ]) + CURL_VAR_MATCH_IFELSE([tmp_CPPFLAGS],[$flags_opt_all],[ + honor_optimize_option="no" + ]) + AC_MSG_RESULT([$honor_optimize_option]) + if test "$honor_optimize_option" = "yes"; then + if test "$want_optimize" = "assume_yes"; then + want_optimize="yes" + fi + if test "$want_optimize" = "assume_no"; then + want_optimize="no" + fi + fi + fi + # + if test "$honor_optimize_option" = "yes"; then + CURL_VAR_STRIP([tmp_CFLAGS],[$flags_opt_all]) + CURL_VAR_STRIP([tmp_CPPFLAGS],[$flags_opt_all]) + if test "$want_optimize" = "yes"; then + AC_MSG_CHECKING([if compiler accepts optimizer enabling options]) + tmp_options="$flags_opt_yes" + fi + if test "$want_optimize" = "no"; then + AC_MSG_CHECKING([if compiler accepts optimizer disabling options]) + tmp_options="$flags_opt_off" + fi + CPPFLAGS="$tmp_CPPFLAGS" + CFLAGS="$tmp_CFLAGS $tmp_options" + squeeze CPPFLAGS + squeeze CFLAGS + CURL_COMPILER_WORKS_IFELSE([ + AC_MSG_RESULT([yes]) + AC_MSG_NOTICE([compiler options added: $tmp_options]) + ],[ + AC_MSG_RESULT([no]) + AC_MSG_WARN([compiler options rejected: $tmp_options]) + dnl restore initial settings + CPPFLAGS="$tmp_save_CPPFLAGS" + CFLAGS="$tmp_save_CFLAGS" + ]) + fi + # + fi +]) + + +dnl CURL_SET_COMPILER_WARNING_OPTS +dnl ------------------------------------------------- +dnl Sets compiler options/flags which depend on +dnl configure's warnings given option. + +AC_DEFUN([CURL_SET_COMPILER_WARNING_OPTS], [ + AC_REQUIRE([CURL_CHECK_OPTION_WARNINGS])dnl + AC_REQUIRE([CURL_CHECK_COMPILER])dnl + AC_REQUIRE([CURL_SHFUNC_SQUEEZE])dnl + # + if test "$compiler_id" != "unknown"; then + # + tmp_save_CPPFLAGS="$CPPFLAGS" + tmp_save_CFLAGS="$CFLAGS" + tmp_CPPFLAGS="" + tmp_CFLAGS="" + # + case "$compiler_id" in + # + CLANG) + # + if test "$want_warnings" = "yes"; then + dnl All versions of clang support the same warnings as at least + dnl gcc 4.2.1 except -Wunused. + tmp_CFLAGS="$tmp_CFLAGS -pedantic" + tmp_CFLAGS="$tmp_CFLAGS -Wall -Wextra" + tmp_CFLAGS="$tmp_CFLAGS -Wpointer-arith -Wwrite-strings" + tmp_CFLAGS="$tmp_CFLAGS -Wshadow" + tmp_CFLAGS="$tmp_CFLAGS -Winline -Wnested-externs" + tmp_CFLAGS="$tmp_CFLAGS -Wmissing-declarations" + tmp_CFLAGS="$tmp_CFLAGS -Wmissing-prototypes" + tmp_CFLAGS="$tmp_CFLAGS -Wno-long-long" + tmp_CFLAGS="$tmp_CFLAGS -Wfloat-equal" + tmp_CFLAGS="$tmp_CFLAGS -Wno-multichar -Wsign-compare" + tmp_CFLAGS="$tmp_CFLAGS -Wundef" + tmp_CFLAGS="$tmp_CFLAGS -Wno-format-nonliteral" + tmp_CFLAGS="$tmp_CFLAGS -Wendif-labels -Wstrict-prototypes" + tmp_CFLAGS="$tmp_CFLAGS -Wdeclaration-after-statement" + tmp_CFLAGS="$tmp_CFLAGS -Wcast-align" + tmp_CFLAGS="$tmp_CFLAGS -Wno-system-headers" + tmp_CFLAGS="$tmp_CFLAGS -Wshorten-64-to-32" + # + dnl Only clang 1.1 or later + if test "$compiler_num" -ge "101"; then + tmp_CFLAGS="$tmp_CFLAGS -Wunused" + fi + fi + ;; + # + DEC_C) + # + if test "$want_warnings" = "yes"; then + dnl Select a higher warning level than default level2 + tmp_CFLAGS="$tmp_CFLAGS -msg_enable level3" + fi + ;; + # + GNU_C) + # + if test "$want_warnings" = "yes"; then + # + dnl Do not enable -pedantic when cross-compiling with a gcc older + dnl than 3.0, to avoid warnings from third party system headers. + if test "x$cross_compiling" != "xyes" || + test "$compiler_num" -ge "300"; then + tmp_CFLAGS="$tmp_CFLAGS -pedantic" + fi + # + dnl Set of options we believe *ALL* gcc versions support: + tmp_CFLAGS="$tmp_CFLAGS -Wall -W" + # + dnl Only gcc 1.4 or later + if test "$compiler_num" -ge "104"; then + tmp_CFLAGS="$tmp_CFLAGS -Wpointer-arith -Wwrite-strings" + dnl If not cross-compiling with a gcc older than 3.0 + if test "x$cross_compiling" != "xyes" || + test "$compiler_num" -ge "300"; then + tmp_CFLAGS="$tmp_CFLAGS -Wunused -Wshadow" + fi + fi + # + dnl Only gcc 2.7 or later + if test "$compiler_num" -ge "207"; then + tmp_CFLAGS="$tmp_CFLAGS -Winline -Wnested-externs" + dnl If not cross-compiling with a gcc older than 3.0 + if test "x$cross_compiling" != "xyes" || + test "$compiler_num" -ge "300"; then + tmp_CFLAGS="$tmp_CFLAGS -Wmissing-declarations" + tmp_CFLAGS="$tmp_CFLAGS -Wmissing-prototypes" + fi + fi + # + dnl Only gcc 2.95 or later + if test "$compiler_num" -ge "295"; then + tmp_CFLAGS="$tmp_CFLAGS -Wno-long-long" + fi + # + dnl Only gcc 2.96 or later + if test "$compiler_num" -ge "296"; then + tmp_CFLAGS="$tmp_CFLAGS -Wfloat-equal" + tmp_CFLAGS="$tmp_CFLAGS -Wno-multichar -Wsign-compare" + dnl -Wundef used only if gcc is 2.96 or later since we get + dnl lots of "`_POSIX_C_SOURCE' is not defined" in system + dnl headers with gcc 2.95.4 on FreeBSD 4.9 + tmp_CFLAGS="$tmp_CFLAGS -Wundef" + fi + # + dnl Only gcc 2.97 or later + if test "$compiler_num" -ge "297"; then + tmp_CFLAGS="$tmp_CFLAGS -Wno-format-nonliteral" + fi + # + dnl Only gcc 3.0 or later + if test "$compiler_num" -ge "300"; then + dnl -Wunreachable-code seems totally unreliable on my gcc 3.3.2 on + dnl on i686-Linux as it gives us heaps with false positives. + dnl Also, on gcc 4.0.X it is totally unbearable and complains all + dnl over making it unusable for generic purposes. Let's not use it. + tmp_CFLAGS="$tmp_CFLAGS" + fi + # + dnl Only gcc 3.3 or later + if test "$compiler_num" -ge "303"; then + tmp_CFLAGS="$tmp_CFLAGS -Wendif-labels -Wstrict-prototypes" + fi + # + dnl Only gcc 3.4 or later + if test "$compiler_num" -ge "304"; then + tmp_CFLAGS="$tmp_CFLAGS -Wdeclaration-after-statement" + fi + # + dnl Only gcc 4.2 or later + if test "$compiler_num" -ge "402"; then + tmp_CFLAGS="$tmp_CFLAGS -Wcast-align" + fi + dnl Only gcc 4.3 or later + if test "$compiler_num" -ge "403"; then + tmp_CFLAGS="$tmp_CFLAGS -Wtype-limits -Wold-style-declaration" + tmp_CFLAGS="$tmp_CFLAGS -Wmissing-parameter-type -Wempty-body" + tmp_CFLAGS="$tmp_CFLAGS -Wclobbered -Wignored-qualifiers" + tmp_CFLAGS="$tmp_CFLAGS -Wconversion -Wno-sign-conversion -Wvla" + fi + # + fi + # + dnl Do not issue warnings for code in system include paths. + if test "$compiler_num" -ge "300"; then + tmp_CFLAGS="$tmp_CFLAGS -Wno-system-headers" + else + dnl When cross-compiling with a gcc older than 3.0, disable + dnl some warnings triggered on third party system headers. + if test "x$cross_compiling" = "xyes"; then + if test "$compiler_num" -ge "104"; then + dnl gcc 1.4 or later + tmp_CFLAGS="$tmp_CFLAGS -Wno-unused -Wno-shadow" + fi + if test "$compiler_num" -ge "207"; then + dnl gcc 2.7 or later + tmp_CFLAGS="$tmp_CFLAGS -Wno-missing-declarations" + tmp_CFLAGS="$tmp_CFLAGS -Wno-missing-prototypes" + fi + fi + fi + ;; + # + HP_UX_C) + # + if test "$want_warnings" = "yes"; then + dnl Issue all warnings + tmp_CFLAGS="$tmp_CFLAGS +w1" + fi + ;; + # + IBM_C) + # + dnl Placeholder + tmp_CFLAGS="$tmp_CFLAGS" + ;; + # + INTEL_UNIX_C) + # + if test "$want_warnings" = "yes"; then + if test "$compiler_num" -gt "600"; then + dnl Show errors, warnings, and remarks + tmp_CPPFLAGS="$tmp_CPPFLAGS -Wall -w2" + dnl Perform extra compile-time code checking + tmp_CPPFLAGS="$tmp_CPPFLAGS -Wcheck" + dnl Warn on nested comments + tmp_CPPFLAGS="$tmp_CPPFLAGS -Wcomment" + dnl Show warnings relative to deprecated features + tmp_CPPFLAGS="$tmp_CPPFLAGS -Wdeprecated" + dnl Enable warnings for missing prototypes + tmp_CPPFLAGS="$tmp_CPPFLAGS -Wmissing-prototypes" + dnl Enable warnings for 64-bit portability issues + tmp_CPPFLAGS="$tmp_CPPFLAGS -Wp64" + dnl Enable warnings for questionable pointer arithmetic + tmp_CPPFLAGS="$tmp_CPPFLAGS -Wpointer-arith" + dnl Check for function return typw issues + tmp_CPPFLAGS="$tmp_CPPFLAGS -Wreturn-type" + dnl Warn on variable declarations hiding a previous one + tmp_CPPFLAGS="$tmp_CPPFLAGS -Wshadow" + dnl Warn when a variable is used before initialized + tmp_CPPFLAGS="$tmp_CPPFLAGS -Wuninitialized" + dnl Warn if a declared function is not used + tmp_CPPFLAGS="$tmp_CPPFLAGS -Wunused-function" + fi + fi + dnl Disable using EBP register in optimizations + tmp_CFLAGS="$tmp_CFLAGS -fno-omit-frame-pointer" + dnl Disable use of ANSI C aliasing rules in optimizations + tmp_CFLAGS="$tmp_CFLAGS -fno-strict-aliasing" + dnl Value-safe optimizations on floating-point data + tmp_CFLAGS="$tmp_CFLAGS -fp-model precise" + dnl Only icc 10.0 or later + if test "$compiler_num" -ge "1000"; then + dnl Disable vectorizer diagnostic information + tmp_CFLAGS="$tmp_CFLAGS -vec-report0" + fi + ;; + # + INTEL_WINDOWS_C) + # + dnl Placeholder + tmp_CFLAGS="$tmp_CFLAGS" + ;; + # + LCC) + # + if test "$want_warnings" = "yes"; then + dnl Highest warning level is double -A, next is single -A. + dnl Due to the big number of warnings these trigger on third + dnl party header files it is impractical for us to use any of + dnl them here. If you want them simply define it in CPPFLAGS. + tmp_CFLAGS="$tmp_CFLAGS" + fi + ;; + # + SGI_MIPS_C) + # + if test "$want_warnings" = "yes"; then + dnl Perform stricter semantic and lint-like checks + tmp_CFLAGS="$tmp_CFLAGS -fullwarn" + fi + ;; + # + SGI_MIPSPRO_C) + # + if test "$want_warnings" = "yes"; then + dnl Perform stricter semantic and lint-like checks + tmp_CFLAGS="$tmp_CFLAGS -fullwarn" + dnl Disable some remarks + dnl #1209: controlling expression is constant + tmp_CFLAGS="$tmp_CFLAGS -woff 1209" + fi + ;; + # + SUNPRO_C) + # + if test "$want_warnings" = "yes"; then + dnl Perform stricter semantic and lint-like checks + tmp_CFLAGS="$tmp_CFLAGS -v" + fi + ;; + # + TINY_C) + # + if test "$want_warnings" = "yes"; then + dnl Activate all warnings + tmp_CFLAGS="$tmp_CFLAGS -Wall" + dnl Make string constants be of type const char * + tmp_CFLAGS="$tmp_CFLAGS -Wwrite-strings" + dnl Warn use of unsupported GCC features ignored by TCC + tmp_CFLAGS="$tmp_CFLAGS -Wunsupported" + fi + ;; + # + WATCOM_UNIX_C) + # + if test "$want_warnings" = "yes"; then + dnl Issue all warnings + tmp_CFLAGS="$tmp_CFLAGS -Wall -Wextra" + fi + ;; + # + WATCOM_WINDOWS_C) + # + dnl Placeholder + tmp_CFLAGS="$tmp_CFLAGS" + ;; + # + esac + # + squeeze tmp_CPPFLAGS + squeeze tmp_CFLAGS + # + if test ! -z "$tmp_CFLAGS" || test ! -z "$tmp_CPPFLAGS"; then + AC_MSG_CHECKING([if compiler accepts strict warning options]) + CPPFLAGS="$tmp_save_CPPFLAGS $tmp_CPPFLAGS" + CFLAGS="$tmp_save_CFLAGS $tmp_CFLAGS" + squeeze CPPFLAGS + squeeze CFLAGS + CURL_COMPILER_WORKS_IFELSE([ + AC_MSG_RESULT([yes]) + AC_MSG_NOTICE([compiler options added: $tmp_CFLAGS $tmp_CPPFLAGS]) + ],[ + AC_MSG_RESULT([no]) + AC_MSG_WARN([compiler options rejected: $tmp_CFLAGS $tmp_CPPFLAGS]) + dnl restore initial settings + CPPFLAGS="$tmp_save_CPPFLAGS" + CFLAGS="$tmp_save_CFLAGS" + ]) + fi + # + fi +]) + + +dnl CURL_SHFUNC_SQUEEZE +dnl ------------------------------------------------- +dnl Declares a shell function squeeze() which removes +dnl redundant whitespace out of a shell variable. + +AC_DEFUN([CURL_SHFUNC_SQUEEZE], [ +squeeze() { + _sqz_result="" + eval _sqz_input=\[$][$]1 + for _sqz_token in $_sqz_input; do + if test -z "$_sqz_result"; then + _sqz_result="$_sqz_token" + else + _sqz_result="$_sqz_result $_sqz_token" + fi + done + eval [$]1=\$_sqz_result + return 0 +} +]) + + +dnl CURL_CHECK_CURLDEBUG +dnl ------------------------------------------------- +dnl Settings which depend on configure's curldebug given +dnl option, and other additional configure pre-requisites. +dnl Actually the curl debug memory tracking feature can +dnl only be used/enabled when libcurl is built as a static +dnl library or as a shared one on those systems on which +dnl shared libraries support undefined symbols. + +AC_DEFUN([CURL_CHECK_CURLDEBUG], [ + AC_REQUIRE([CURL_SHFUNC_SQUEEZE])dnl + supports_curldebug="unknown" + if test "$want_curldebug" = "yes"; then + if test "x$enable_shared" != "xno" && + test "x$enable_shared" != "xyes"; then + AC_MSG_WARN([unknown enable_shared setting.]) + supports_curldebug="no" + fi + if test "x$enable_static" != "xno" && + test "x$enable_static" != "xyes"; then + AC_MSG_WARN([unknown enable_static setting.]) + supports_curldebug="no" + fi + if test "$supports_curldebug" != "no"; then + if test "$enable_shared" = "yes" && + test "$need_no_undefined" = "yes"; then + supports_curldebug="no" + AC_MSG_WARN([shared library does not support undefined symbols.]) + fi + fi + fi + # + if test "$want_curldebug" = "yes"; then + AC_MSG_CHECKING([if curl debug memory tracking can be enabled]) + test "$supports_curldebug" = "no" || supports_curldebug="yes" + AC_MSG_RESULT([$supports_curldebug]) + if test "$supports_curldebug" = "no"; then + AC_MSG_WARN([cannot enable curl debug memory tracking.]) + want_curldebug="no" + fi + fi + # + if test "$want_curldebug" = "yes"; then + CPPFLAGS="$CPPFLAGS -DCURLDEBUG" + squeeze CPPFLAGS + fi + if test "$want_debug" = "yes"; then + CPPFLAGS="$CPPFLAGS -DDEBUGBUILD" + squeeze CPPFLAGS + fi +]) + + +dnl CURL_CHECK_NO_UNDEFINED +dnl ------------------------------------------------- +dnl Checks if the -no-undefined flag must be used when +dnl building shared libraries. This is required on all +dnl systems on which shared libraries should not have +dnl references to undefined symbols. This check should +dnl not be done before AC-PROG-LIBTOOL. + +AC_DEFUN([CURL_CHECK_NO_UNDEFINED], [ + AC_BEFORE([$0],[CURL_CHECK_CURLDEBUG])dnl + AC_MSG_CHECKING([if shared libraries need -no-undefined]) + need_no_undefined="no" + case $host in + *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-cegcc* | *-*-aix*) + need_no_undefined="yes" + ;; + esac + if test "x$allow_undefined" = "xno"; then + need_no_undefined="yes" + elif test "x$allow_undefined_flag" = "xunsupported"; then + need_no_undefined="yes" + fi + AC_MSG_RESULT($need_no_undefined) +]) + + +dnl CURL_CHECK_PROG_CC +dnl ------------------------------------------------- +dnl Check for compiler program, preventing CFLAGS and +dnl CPPFLAGS from being unexpectedly changed. + +AC_DEFUN([CURL_CHECK_PROG_CC], [ + ac_save_CFLAGS="$CFLAGS" + ac_save_CPPFLAGS="$CPPFLAGS" + AC_PROG_CC + CFLAGS="$ac_save_CFLAGS" + CPPFLAGS="$ac_save_CPPFLAGS" +]) + + +dnl CURL_CHECK_COMPILER_HALT_ON_ERROR +dnl ------------------------------------------------- +dnl Verifies if the compiler actually halts after the +dnl compilation phase without generating any object +dnl code file, when the source compiles with errors. + +AC_DEFUN([CURL_CHECK_COMPILER_HALT_ON_ERROR], [ + AC_MSG_CHECKING([if compiler halts on compilation errors]) + AC_COMPILE_IFELSE([ + AC_LANG_PROGRAM([[ + ]],[[ + force compilation error + ]]) + ],[ + AC_MSG_RESULT([no]) + AC_MSG_ERROR([compiler does not halt on compilation errors.]) + ],[ + AC_MSG_RESULT([yes]) + ]) +]) + + +dnl CURL_CHECK_COMPILER_ARRAY_SIZE_NEGATIVE +dnl ------------------------------------------------- +dnl Verifies if the compiler actually halts after the +dnl compilation phase without generating any object +dnl code file, when the source code tries to define a +dnl type for a constant array with negative dimension. + +AC_DEFUN([CURL_CHECK_COMPILER_ARRAY_SIZE_NEGATIVE], [ + AC_REQUIRE([CURL_CHECK_COMPILER_HALT_ON_ERROR])dnl + AC_MSG_CHECKING([if compiler halts on negative sized arrays]) + AC_COMPILE_IFELSE([ + AC_LANG_PROGRAM([[ + typedef char bad_t[sizeof(char) == sizeof(int) ? -1 : -1 ]; + ]],[[ + bad_t dummy; + ]]) + ],[ + AC_MSG_RESULT([no]) + AC_MSG_ERROR([compiler does not halt on negative sized arrays.]) + ],[ + AC_MSG_RESULT([yes]) + ]) +]) + + +dnl CURL_CHECK_COMPILER_STRUCT_MEMBER_SIZE +dnl ------------------------------------------------- +dnl Verifies if the compiler is capable of handling the +dnl size of a struct member, struct which is a function +dnl result, as a compilation-time condition inside the +dnl type definition of a constant array. + +AC_DEFUN([CURL_CHECK_COMPILER_STRUCT_MEMBER_SIZE], [ + AC_REQUIRE([CURL_CHECK_COMPILER_ARRAY_SIZE_NEGATIVE])dnl + AC_MSG_CHECKING([if compiler struct member size checking works]) + tst_compiler_check_one_works="unknown" + AC_COMPILE_IFELSE([ + AC_LANG_PROGRAM([[ + struct mystruct { + int mi; + char mc; + struct mystruct *next; + }; + struct mystruct myfunc(); + typedef char good_t1[sizeof(myfunc().mi) == sizeof(int) ? 1 : -1 ]; + typedef char good_t2[sizeof(myfunc().mc) == sizeof(char) ? 1 : -1 ]; + ]],[[ + good_t1 dummy1; + good_t2 dummy2; + ]]) + ],[ + tst_compiler_check_one_works="yes" + ],[ + tst_compiler_check_one_works="no" + sed 's/^/cc-src: /' conftest.$ac_ext >&6 + sed 's/^/cc-err: /' conftest.err >&6 + ]) + tst_compiler_check_two_works="unknown" + AC_COMPILE_IFELSE([ + AC_LANG_PROGRAM([[ + struct mystruct { + int mi; + char mc; + struct mystruct *next; + }; + struct mystruct myfunc(); + typedef char bad_t1[sizeof(myfunc().mi) != sizeof(int) ? 1 : -1 ]; + typedef char bad_t2[sizeof(myfunc().mc) != sizeof(char) ? 1 : -1 ]; + ]],[[ + bad_t1 dummy1; + bad_t2 dummy2; + ]]) + ],[ + tst_compiler_check_two_works="no" + ],[ + tst_compiler_check_two_works="yes" + ]) + if test "$tst_compiler_check_one_works" = "yes" && + test "$tst_compiler_check_two_works" = "yes"; then + AC_MSG_RESULT([yes]) + else + AC_MSG_RESULT([no]) + AC_MSG_ERROR([compiler fails struct member size checking.]) + fi +]) + + +dnl CURL_VAR_MATCH (VARNAME, VALUE) +dnl ------------------------------------------------- +dnl Verifies if shell variable VARNAME contains VALUE. +dnl Contents of variable VARNAME and VALUE are handled +dnl as whitespace separated lists of words. If at least +dnl one word of VALUE is present in VARNAME the match +dnl is considered positive, otherwise false. + +AC_DEFUN([CURL_VAR_MATCH], [ + ac_var_match_word="no" + for word1 in $[$1]; do + for word2 in [$2]; do + if test "$word1" = "$word2"; then + ac_var_match_word="yes" + fi + done + done +]) + + +dnl CURL_VAR_MATCH_IFELSE (VARNAME, VALUE, +dnl [ACTION-IF-MATCH], [ACTION-IF-NOT-MATCH]) +dnl ------------------------------------------------- +dnl This performs a CURL_VAR_MATCH check and executes +dnl first branch if the match is positive, otherwise +dnl the second branch is executed. + +AC_DEFUN([CURL_VAR_MATCH_IFELSE], [ + CURL_VAR_MATCH([$1],[$2]) + if test "$ac_var_match_word" = "yes"; then + ifelse($3,,:,[$3]) + ifelse($4,,,[else + $4]) + fi +]) + + +dnl CURL_VAR_STRIP (VARNAME, VALUE) +dnl ------------------------------------------------- +dnl Contents of variable VARNAME and VALUE are handled +dnl as whitespace separated lists of words. Each word +dnl from VALUE is removed from VARNAME when present. + +AC_DEFUN([CURL_VAR_STRIP], [ + AC_REQUIRE([CURL_SHFUNC_SQUEEZE])dnl + ac_var_stripped="" + for word1 in $[$1]; do + ac_var_strip_word="no" + for word2 in [$2]; do + if test "$word1" = "$word2"; then + ac_var_strip_word="yes" + fi + done + if test "$ac_var_strip_word" = "no"; then + ac_var_stripped="$ac_var_stripped $word1" + fi + done + dnl squeeze whitespace out of result + [$1]="$ac_var_stripped" + squeeze [$1] +]) + diff --git a/mobicore/common/curl/m4/curl-confopts.m4 b/mobicore/common/curl/m4/curl-confopts.m4 new file mode 100644 index 0000000000000000000000000000000000000000..30fb025fdf75e575751c6ece62c17414c483e219 --- /dev/null +++ b/mobicore/common/curl/m4/curl-confopts.m4 @@ -0,0 +1,498 @@ +#*************************************************************************** +# _ _ ____ _ +# Project ___| | | | _ \| | +# / __| | | | |_) | | +# | (__| |_| | _ <| |___ +# \___|\___/|_| \_\_____| +# +# Copyright (C) 1998 - 2010, Daniel Stenberg, , et al. +# +# This software is licensed as described in the file COPYING, which +# you should have received as part of this distribution. The terms +# are also available at http://curl.haxx.se/docs/copyright.html. +# +# You may opt to use, copy, modify, merge, publish, distribute and/or sell +# copies of the Software, and permit persons to whom the Software is +# furnished to do so, under the terms of the COPYING file. +# +# This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY +# KIND, either express or implied. +# +#*************************************************************************** + +# File version for 'aclocal' use. Keep it a single number. +# serial 14 + +dnl CURL_CHECK_OPTION_THREADED_RESOLVER +dnl ------------------------------------------------- +dnl Verify if configure has been invoked with option +dnl --enable-threaded-resolver or --disable-threaded-resolver, and +dnl set shell variable want_thres as appropriate. + +AC_DEFUN([CURL_CHECK_OPTION_THREADED_RESOLVER], [ + AC_MSG_CHECKING([whether to enable the threaded resolver]) + OPT_THRES="default" + AC_ARG_ENABLE(threaded_resolver, +AC_HELP_STRING([--enable-threaded-resolver],[Enable threaded resolver]) +AC_HELP_STRING([--disable-threaded-resolver],[Disable threaded resolver]), + OPT_THRES=$enableval) + case "$OPT_THRES" in + yes) + dnl --enable-threaded-resolver option used + want_thres="yes" + ;; + *) + dnl configure option not specified + want_thres="no" + ;; + esac + AC_MSG_RESULT([$want_thres]) +]) + +dnl CURL_CHECK_OPTION_ARES +dnl ------------------------------------------------- +dnl Verify if configure has been invoked with option +dnl --enable-ares or --disable-ares, and +dnl set shell variable want_ares as appropriate. + +AC_DEFUN([CURL_CHECK_OPTION_ARES], [ +dnl AC_BEFORE([$0],[CURL_CHECK_OPTION_THREADS])dnl + AC_BEFORE([$0],[CURL_CHECK_LIB_ARES])dnl + AC_MSG_CHECKING([whether to enable c-ares for DNS lookups]) + OPT_ARES="default" + AC_ARG_ENABLE(ares, +AC_HELP_STRING([--enable-ares@<:@=PATH@:>@],[Enable c-ares for DNS lookups]) +AC_HELP_STRING([--disable-ares],[Disable c-ares for DNS lookups]), + OPT_ARES=$enableval) + case "$OPT_ARES" in + no) + dnl --disable-ares option used + want_ares="no" + ;; + default) + dnl configure option not specified + want_ares="no" + ;; + *) + dnl --enable-ares option used + want_ares="yes" + if test -n "$enableval" && test "$enableval" != "yes"; then + want_ares_path="$enableval" + fi + ;; + esac + AC_MSG_RESULT([$want_ares]) +]) + + +dnl CURL_CHECK_OPTION_CURLDEBUG +dnl ------------------------------------------------- +dnl Verify if configure has been invoked with option +dnl --enable-curldebug or --disable-curldebug, and set +dnl shell variable want_curldebug value as appropriate. + +AC_DEFUN([CURL_CHECK_OPTION_CURLDEBUG], [ + AC_BEFORE([$0],[CURL_CHECK_CURLDEBUG])dnl + AC_MSG_CHECKING([whether to enable curl debug memory tracking]) + OPT_CURLDEBUG_BUILD="default" + AC_ARG_ENABLE(curldebug, +AC_HELP_STRING([--enable-curldebug],[Enable curl debug memory tracking]) +AC_HELP_STRING([--disable-curldebug],[Disable curl debug memory tracking]), + OPT_CURLDEBUG_BUILD=$enableval) + case "$OPT_CURLDEBUG_BUILD" in + no) + dnl --disable-curldebug option used + want_curldebug="no" + AC_MSG_RESULT([no]) + ;; + default) + dnl configure's curldebug option not specified. Initially we will + dnl handle this as a a request to use the same setting as option + dnl --enable-debug. IOW, initially, for debug-enabled builds + dnl this will be handled as a request to enable curldebug if + dnl possible, and for debug-disabled builds this will be handled + dnl as a request to disable curldebug. + if test "$want_debug" = "yes"; then + AC_MSG_RESULT([(assumed) yes]) + else + AC_MSG_RESULT([no]) + fi + want_curldebug_assumed="yes" + want_curldebug="$want_debug" + ;; + *) + dnl --enable-curldebug option used. + dnl The use of this option value is a request to enable curl's + dnl debug memory tracking for the libcurl library. This can only + dnl be done when some requisites are simultaneously satisfied. + dnl Later on, these requisites are verified and if they are not + dnl fully satisfied the option will be ignored and act as if + dnl --disable-curldebug had been given setting shell variable + dnl want_curldebug to 'no'. + want_curldebug="yes" + AC_MSG_RESULT([yes]) + ;; + esac +]) + + +dnl CURL_CHECK_OPTION_DEBUG +dnl ------------------------------------------------- +dnl Verify if configure has been invoked with option +dnl --enable-debug or --disable-debug, and set shell +dnl variable want_debug value as appropriate. + +AC_DEFUN([CURL_CHECK_OPTION_DEBUG], [ + AC_BEFORE([$0],[CURL_CHECK_OPTION_WARNINGS])dnl + AC_BEFORE([$0],[CURL_CHECK_OPTION_CURLDEBUG])dnl + AC_BEFORE([$0],[CURL_CHECK_PROG_CC])dnl + AC_MSG_CHECKING([whether to enable debug build options]) + OPT_DEBUG_BUILD="default" + AC_ARG_ENABLE(debug, +AC_HELP_STRING([--enable-debug],[Enable debug build options]) +AC_HELP_STRING([--disable-debug],[Disable debug build options]), + OPT_DEBUG_BUILD=$enableval) + case "$OPT_DEBUG_BUILD" in + no) + dnl --disable-debug option used + want_debug="no" + ;; + default) + dnl configure option not specified + want_debug="no" + ;; + *) + dnl --enable-debug option used + want_debug="yes" + ;; + esac + AC_MSG_RESULT([$want_debug]) +]) + + +dnl CURL_CHECK_OPTION_NONBLOCKING +dnl ------------------------------------------------- +dnl Verify if configure has been invoked with option +dnl --enable-nonblocking or --disable-nonblocking, and +dnl set shell variable want_nonblocking as appropriate. + +AC_DEFUN([CURL_CHECK_OPTION_NONBLOCKING], [ + AC_BEFORE([$0],[CURL_CHECK_NONBLOCKING_SOCKET])dnl + AC_MSG_CHECKING([whether to enable non-blocking communications]) + OPT_NONBLOCKING="default" + AC_ARG_ENABLE(nonblocking, +AC_HELP_STRING([--enable-nonblocking],[Enable non-blocking communications]) +AC_HELP_STRING([--disable-nonblocking],[Disable non-blocking communications]), + OPT_NONBLOCKING=$enableval) + case "$OPT_NONBLOCKING" in + no) + dnl --disable-nonblocking option used + want_nonblocking="no" + ;; + default) + dnl configure option not specified + want_nonblocking="yes" + ;; + *) + dnl --enable-nonblocking option used + want_nonblocking="yes" + ;; + esac + AC_MSG_RESULT([$want_nonblocking]) +]) + + +dnl CURL_CHECK_OPTION_OPTIMIZE +dnl ------------------------------------------------- +dnl Verify if configure has been invoked with option +dnl --enable-optimize or --disable-optimize, and set +dnl shell variable want_optimize value as appropriate. + +AC_DEFUN([CURL_CHECK_OPTION_OPTIMIZE], [ + AC_REQUIRE([CURL_CHECK_OPTION_DEBUG])dnl + AC_BEFORE([$0],[CURL_CHECK_PROG_CC])dnl + AC_MSG_CHECKING([whether to enable compiler optimizer]) + OPT_COMPILER_OPTIMIZE="default" + AC_ARG_ENABLE(optimize, +AC_HELP_STRING([--enable-optimize],[Enable compiler optimizations]) +AC_HELP_STRING([--disable-optimize],[Disable compiler optimizations]), + OPT_COMPILER_OPTIMIZE=$enableval) + case "$OPT_COMPILER_OPTIMIZE" in + no) + dnl --disable-optimize option used. We will handle this as + dnl a request to disable compiler optimizations if possible. + dnl If the compiler is known CFLAGS and CPPFLAGS will be + dnl overridden, otherwise this can not be honored. + want_optimize="no" + AC_MSG_RESULT([no]) + ;; + default) + dnl configure's optimize option not specified. Initially we will + dnl handle this as a a request contrary to configure's setting + dnl for --enable-debug. IOW, initially, for debug-enabled builds + dnl this will be handled as a request to disable optimizations if + dnl possible, and for debug-disabled builds this will be handled + dnl initially as a request to enable optimizations if possible. + dnl Finally, if the compiler is known and CFLAGS and CPPFLAGS do + dnl not have any optimizer flag the request will be honored, in + dnl any other case the request can not be honored. + dnl IOW, existing optimizer flags defined in CFLAGS or CPPFLAGS + dnl will always take precedence over any initial assumption. + if test "$want_debug" = "yes"; then + want_optimize="assume_no" + AC_MSG_RESULT([(assumed) no]) + else + want_optimize="assume_yes" + AC_MSG_RESULT([(assumed) yes]) + fi + ;; + *) + dnl --enable-optimize option used. We will handle this as + dnl a request to enable compiler optimizations if possible. + dnl If the compiler is known CFLAGS and CPPFLAGS will be + dnl overridden, otherwise this can not be honored. + want_optimize="yes" + AC_MSG_RESULT([yes]) + ;; + esac +]) + + +dnl CURL_CHECK_OPTION_THREADS +dnl ------------------------------------------------- +dnl Verify if configure has been invoked with option +dnl --enable-threads or --disable-threads, and +dnl set shell variable want_threads as appropriate. + +dnl AC_DEFUN([CURL_CHECK_OPTION_THREADS], [ +dnl AC_BEFORE([$0],[CURL_CHECK_LIB_THREADS])dnl +dnl AC_MSG_CHECKING([whether to enable threads for DNS lookups]) +dnl OPT_THREADS="default" +dnl AC_ARG_ENABLE(threads, +dnl AC_HELP_STRING([--enable-threads@<:@=PATH@:>@],[Enable threads for DNS lookups]) +dnl AC_HELP_STRING([--disable-threads],[Disable threads for DNS lookups]), +dnl OPT_THREADS=$enableval) +dnl case "$OPT_THREADS" in +dnl no) +dnl dnl --disable-threads option used +dnl want_threads="no" +dnl AC_MSG_RESULT([no]) +dnl ;; +dnl default) +dnl dnl configure option not specified +dnl want_threads="no" +dnl AC_MSG_RESULT([(assumed) no]) +dnl ;; +dnl *) +dnl dnl --enable-threads option used +dnl want_threads="yes" +dnl want_threads_path="$enableval" +dnl AC_MSG_RESULT([yes]) +dnl ;; +dnl esac +dnl # +dnl if test "$want_ares" = "assume_yes"; then +dnl if test "$want_threads" = "yes"; then +dnl AC_MSG_CHECKING([whether to ignore c-ares enabling assumed setting]) +dnl AC_MSG_RESULT([yes]) +dnl want_ares="no" +dnl else +dnl want_ares="yes" +dnl fi +dnl fi +dnl if test "$want_threads" = "yes" && test "$want_ares" = "yes"; then +dnl AC_MSG_ERROR([options --enable-ares and --enable-threads are mutually exclusive, at most one may be enabled.]) +dnl fi +dnl ]) + + +dnl CURL_CHECK_OPTION_WARNINGS +dnl ------------------------------------------------- +dnl Verify if configure has been invoked with option +dnl --enable-warnings or --disable-warnings, and set +dnl shell variable want_warnings as appropriate. + +AC_DEFUN([CURL_CHECK_OPTION_WARNINGS], [ + AC_REQUIRE([CURL_CHECK_OPTION_DEBUG])dnl + AC_BEFORE([$0],[CURL_CHECK_OPTION_WERROR])dnl + AC_BEFORE([$0],[CURL_CHECK_PROG_CC])dnl + AC_MSG_CHECKING([whether to enable strict compiler warnings]) + OPT_COMPILER_WARNINGS="default" + AC_ARG_ENABLE(warnings, +AC_HELP_STRING([--enable-warnings],[Enable strict compiler warnings]) +AC_HELP_STRING([--disable-warnings],[Disable strict compiler warnings]), + OPT_COMPILER_WARNINGS=$enableval) + case "$OPT_COMPILER_WARNINGS" in + no) + dnl --disable-warnings option used + want_warnings="no" + ;; + default) + dnl configure option not specified, so + dnl use same setting as --enable-debug + want_warnings="$want_debug" + ;; + *) + dnl --enable-warnings option used + want_warnings="yes" + ;; + esac + AC_MSG_RESULT([$want_warnings]) +]) + +dnl CURL_CHECK_OPTION_WERROR +dnl ------------------------------------------------- +dnl Verify if configure has been invoked with option +dnl --enable-werror or --disable-werror, and set +dnl shell variable want_werror as appropriate. + +AC_DEFUN([CURL_CHECK_OPTION_WERROR], [ + AC_BEFORE([$0],[CURL_CHECK_COMPILER])dnl + AC_MSG_CHECKING([whether to enable compiler warnings as errors]) + OPT_COMPILER_WERROR="default" + AC_ARG_ENABLE(werror, +AC_HELP_STRING([--enable-werror],[Enable compiler warnings as errors]) +AC_HELP_STRING([--disable-werror],[Disable compiler warnings as errors]), + OPT_COMPILER_WERROR=$enableval) + case "$OPT_COMPILER_WERROR" in + no) + dnl --disable-werror option used + want_werror="no" + ;; + default) + dnl configure option not specified + want_werror="no" + ;; + *) + dnl --enable-werror option used + want_werror="yes" + ;; + esac + AC_MSG_RESULT([$want_werror]) +]) + + +dnl CURL_CHECK_NONBLOCKING_SOCKET +dnl ------------------------------------------------- +dnl Check for how to set a socket into non-blocking state. + +AC_DEFUN([CURL_CHECK_NONBLOCKING_SOCKET], [ + AC_REQUIRE([CURL_CHECK_OPTION_NONBLOCKING])dnl + AC_REQUIRE([CURL_CHECK_FUNC_FCNTL])dnl + AC_REQUIRE([CURL_CHECK_FUNC_IOCTL])dnl + AC_REQUIRE([CURL_CHECK_FUNC_IOCTLSOCKET])dnl + AC_REQUIRE([CURL_CHECK_FUNC_IOCTLSOCKET_CAMEL])dnl + AC_REQUIRE([CURL_CHECK_FUNC_SETSOCKOPT])dnl + # + tst_method="unknown" + if test "$want_nonblocking" = "yes"; then + AC_MSG_CHECKING([how to set a socket into non-blocking mode]) + if test "x$ac_cv_func_fcntl_o_nonblock" = "xyes"; then + tst_method="fcntl O_NONBLOCK" + elif test "x$ac_cv_func_ioctl_fionbio" = "xyes"; then + tst_method="ioctl FIONBIO" + elif test "x$ac_cv_func_ioctlsocket_fionbio" = "xyes"; then + tst_method="ioctlsocket FIONBIO" + elif test "x$ac_cv_func_ioctlsocket_camel_fionbio" = "xyes"; then + tst_method="IoctlSocket FIONBIO" + elif test "x$ac_cv_func_setsockopt_so_nonblock" = "xyes"; then + tst_method="setsockopt SO_NONBLOCK" + fi + AC_MSG_RESULT([$tst_method]) + if test "$tst_method" = "unknown"; then + AC_MSG_WARN([cannot determine non-blocking socket method.]) + fi + fi + if test "$tst_method" = "unknown"; then + AC_DEFINE_UNQUOTED(USE_BLOCKING_SOCKETS, 1, + [Define to disable non-blocking sockets.]) + AC_MSG_WARN([non-blocking sockets disabled.]) + fi +]) + + +dnl CURL_CHECK_LIB_ARES +dnl ------------------------------------------------- +dnl When c-ares library support has been requested, +dnl performs necessary checks and adjustsments needed +dnl to enable support of this library. + +AC_DEFUN([CURL_CHECK_LIB_ARES], [ + # + if test "$want_ares" = "yes"; then + dnl c-ares library support has been requested + clean_CPPFLAGS="$CPPFLAGS" + clean_LDFLAGS="$LDFLAGS" + clean_LIBS="$LIBS" + embedded_ares="unknown" + configure_runpath=`pwd` + embedded_ares_builddir="$configure_runpath/ares" + if test -n "$want_ares_path"; then + dnl c-ares library path has been specified + ares_CPPFLAGS="-I$want_ares_path/include" + ares_LDFLAGS="-L$want_ares_path/lib" + ares_LIBS="-lcares" + else + dnl c-ares library path has not been given + if test -d "$srcdir/ares"; then + dnl c-ares sources embedded in curl tree + embedded_ares="yes" + AC_CONFIG_SUBDIRS(ares) + dnl c-ares has installable configured header files, path + dnl inclusion fully done in makefiles for in-tree builds. + ares_CPPFLAGS="" + ares_LDFLAGS="-L$embedded_ares_builddir" + ares_LIBS="-lcares" + else + dnl c-ares path not specified, use defaults + ares_CPPFLAGS="" + ares_LDFLAGS="" + ares_LIBS="-lcares" + fi + fi + # + CPPFLAGS="$ares_CPPFLAGS $clean_CPPFLAGS" + LDFLAGS="$ares_LDFLAGS $clean_LDFLAGS" + LIBS="$ares_LIBS $clean_LIBS" + # + if test "$embedded_ares" != "yes"; then + dnl check if c-ares new enough when not using an embedded + dnl source tree one which normally has not been built yet. + AC_MSG_CHECKING([that c-ares is good and recent enough]) + AC_LINK_IFELSE([ + AC_LANG_PROGRAM([[ +#include + /* set of dummy functions in case c-ares was built with debug */ + void curl_dofree() { } + void curl_sclose() { } + void curl_domalloc() { } + void curl_docalloc() { } + void curl_socket() { } + ]],[[ + ares_channel channel; + ares_cancel(channel); /* added in 1.2.0 */ + ares_process_fd(channel, 0, 0); /* added in 1.4.0 */ + ares_dup(&channel, channel); /* added in 1.6.0 */ + ]]) + ],[ + AC_MSG_RESULT([yes]) + ],[ + AC_MSG_RESULT([no]) + AC_MSG_ERROR([c-ares library defective or too old]) + dnl restore initial settings + CPPFLAGS="$clean_CPPFLAGS" + LDFLAGS="$clean_LDFLAGS" + LIBS="$clean_LIBS" + # prevent usage + want_ares="no" + ]) + fi + if test "$want_ares" = "yes"; then + dnl finally c-ares will be used + AC_DEFINE(USE_ARES, 1, [Define to enable c-ares support]) + AC_SUBST([USE_ARES], [1]) + curl_res_msg="c-ares" + fi + fi +]) + diff --git a/mobicore/common/curl/m4/curl-functions.m4 b/mobicore/common/curl/m4/curl-functions.m4 new file mode 100644 index 0000000000000000000000000000000000000000..6067abf964c80613a5d366e7100a126b2fe264bd --- /dev/null +++ b/mobicore/common/curl/m4/curl-functions.m4 @@ -0,0 +1,6901 @@ +#*************************************************************************** +# _ _ ____ _ +# Project ___| | | | _ \| | +# / __| | | | |_) | | +# | (__| |_| | _ <| |___ +# \___|\___/|_| \_\_____| +# +# Copyright (C) 1998 - 2010, Daniel Stenberg, , et al. +# +# This software is licensed as described in the file COPYING, which +# you should have received as part of this distribution. The terms +# are also available at http://curl.haxx.se/docs/copyright.html. +# +# You may opt to use, copy, modify, merge, publish, distribute and/or sell +# copies of the Software, and permit persons to whom the Software is +# furnished to do so, under the terms of the COPYING file. +# +# This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY +# KIND, either express or implied. +# +#*************************************************************************** + +# File version for 'aclocal' use. Keep it a single number. +# serial 65 + + +dnl CURL_INCLUDES_ARPA_INET +dnl ------------------------------------------------- +dnl Set up variable with list of headers that must be +dnl included when arpa/inet.h is to be included. + +AC_DEFUN([CURL_INCLUDES_ARPA_INET], [ +curl_includes_arpa_inet="\ +/* includes start */ +#ifdef HAVE_SYS_TYPES_H +# include +#endif +#ifdef HAVE_SYS_SOCKET_H +# include +#endif +#ifdef HAVE_NETINET_IN_H +# include +#endif +#ifdef HAVE_ARPA_INET_H +# include +#endif +/* includes end */" + AC_CHECK_HEADERS( + sys/types.h sys/socket.h netinet/in.h arpa/inet.h, + [], [], [$curl_includes_arpa_inet]) +]) + + +dnl CURL_INCLUDES_FCNTL +dnl ------------------------------------------------- +dnl Set up variable with list of headers that must be +dnl included when fcntl.h is to be included. + +AC_DEFUN([CURL_INCLUDES_FCNTL], [ +curl_includes_fcntl="\ +/* includes start */ +#ifdef HAVE_SYS_TYPES_H +# include +#endif +#ifdef HAVE_UNISTD_H +# include +#endif +#ifdef HAVE_FCNTL_H +# include +#endif +/* includes end */" + AC_CHECK_HEADERS( + sys/types.h unistd.h fcntl.h, + [], [], [$curl_includes_fcntl]) +]) + + +dnl CURL_INCLUDES_IFADDRS +dnl ------------------------------------------------- +dnl Set up variable with list of headers that must be +dnl included when ifaddrs.h is to be included. + +AC_DEFUN([CURL_INCLUDES_IFADDRS], [ +curl_includes_ifaddrs="\ +/* includes start */ +#ifdef HAVE_SYS_TYPES_H +# include +#endif +#ifdef HAVE_SYS_SOCKET_H +# include +#endif +#ifdef HAVE_NETINET_IN_H +# include +#endif +#ifdef HAVE_IFADDRS_H +# include +#endif +/* includes end */" + AC_CHECK_HEADERS( + sys/types.h sys/socket.h netinet/in.h ifaddrs.h, + [], [], [$curl_includes_ifaddrs]) +]) + + +dnl CURL_INCLUDES_INTTYPES +dnl ------------------------------------------------- +dnl Set up variable with list of headers that must be +dnl included when inttypes.h is to be included. + +AC_DEFUN([CURL_INCLUDES_INTTYPES], [ +curl_includes_inttypes="\ +/* includes start */ +#ifdef HAVE_SYS_TYPES_H +# include +#endif +#ifdef HAVE_STDINT_H +# include +#endif +#ifdef HAVE_INTTYPES_H +# include +#endif +/* includes end */" + case $host_os in + irix*) + ac_cv_header_stdint_h="no" + ;; + esac + AC_CHECK_HEADERS( + sys/types.h stdint.h inttypes.h, + [], [], [$curl_includes_inttypes]) +]) + + +dnl CURL_INCLUDES_LIBGEN +dnl ------------------------------------------------- +dnl Set up variable with list of headers that must be +dnl included when libgen.h is to be included. + +AC_DEFUN([CURL_INCLUDES_LIBGEN], [ +curl_includes_libgen="\ +/* includes start */ +#ifdef HAVE_SYS_TYPES_H +# include +#endif +#ifdef HAVE_LIBGEN_H +# include +#endif +/* includes end */" + AC_CHECK_HEADERS( + sys/types.h libgen.h, + [], [], [$curl_includes_libgen]) +]) + + +dnl CURL_INCLUDES_NETDB +dnl ------------------------------------------------- +dnl Set up variable with list of headers that must be +dnl included when netdb.h is to be included. + +AC_DEFUN([CURL_INCLUDES_NETDB], [ +curl_includes_netdb="\ +/* includes start */ +#ifdef HAVE_SYS_TYPES_H +# include +#endif +#ifdef HAVE_NETDB_H +# include +#endif +/* includes end */" + AC_CHECK_HEADERS( + sys/types.h netdb.h, + [], [], [$curl_includes_netdb]) +]) + + +dnl CURL_INCLUDES_POLL +dnl ------------------------------------------------- +dnl Set up variable with list of headers that must be +dnl included when poll.h is to be included. + +AC_DEFUN([CURL_INCLUDES_POLL], [ +curl_includes_poll="\ +/* includes start */ +#ifdef HAVE_SYS_TYPES_H +# include +#endif +#ifdef HAVE_POLL_H +# include +#endif +#ifdef HAVE_SYS_POLL_H +# include +#endif +/* includes end */" + AC_CHECK_HEADERS( + sys/types.h poll.h sys/poll.h, + [], [], [$curl_includes_poll]) +]) + + +dnl CURL_INCLUDES_SETJMP +dnl ------------------------------------------------- +dnl Set up variable with list of headers that must be +dnl included when setjmp.h is to be included. + +AC_DEFUN([CURL_INCLUDES_SETJMP], [ +curl_includes_setjmp="\ +/* includes start */ +#ifdef HAVE_SYS_TYPES_H +# include +#endif +#ifdef HAVE_SETJMP_H +# include +#endif +/* includes end */" + AC_CHECK_HEADERS( + sys/types.h setjmp.h, + [], [], [$curl_includes_setjmp]) +]) + + +dnl CURL_INCLUDES_SIGNAL +dnl ------------------------------------------------- +dnl Set up variable with list of headers that must be +dnl included when signal.h is to be included. + +AC_DEFUN([CURL_INCLUDES_SIGNAL], [ +curl_includes_signal="\ +/* includes start */ +#ifdef HAVE_SYS_TYPES_H +# include +#endif +#ifdef HAVE_SIGNAL_H +# include +#endif +/* includes end */" + AC_CHECK_HEADERS( + sys/types.h signal.h, + [], [], [$curl_includes_signal]) +]) + + +dnl CURL_INCLUDES_SOCKET +dnl ------------------------------------------------- +dnl Set up variable with list of headers that must be +dnl included when socket.h is to be included. + +AC_DEFUN([CURL_INCLUDES_SOCKET], [ +curl_includes_socket="\ +/* includes start */ +#ifdef HAVE_SYS_TYPES_H +# include +#endif +#ifdef HAVE_SOCKET_H +# include +#endif +/* includes end */" + AC_CHECK_HEADERS( + sys/types.h socket.h, + [], [], [$curl_includes_socket]) +]) + + +dnl CURL_INCLUDES_STDIO +dnl ------------------------------------------------- +dnl Set up variable with list of headers that must be +dnl included when stdio.h is to be included. + +AC_DEFUN([CURL_INCLUDES_STDIO], [ +curl_includes_stdio="\ +/* includes start */ +#ifdef HAVE_SYS_TYPES_H +# include +#endif +#ifdef HAVE_STDIO_H +# include +#endif +/* includes end */" + AC_CHECK_HEADERS( + sys/types.h stdio.h, + [], [], [$curl_includes_stdio]) +]) + + +dnl CURL_INCLUDES_STDLIB +dnl ------------------------------------------------- +dnl Set up variable with list of headers that must be +dnl included when stdlib.h is to be included. + +AC_DEFUN([CURL_INCLUDES_STDLIB], [ +curl_includes_stdlib="\ +/* includes start */ +#ifdef HAVE_SYS_TYPES_H +# include +#endif +#ifdef HAVE_STDLIB_H +# include +#endif +/* includes end */" + AC_CHECK_HEADERS( + sys/types.h stdlib.h, + [], [], [$curl_includes_stdlib]) +]) + + +dnl CURL_INCLUDES_STRING +dnl ------------------------------------------------- +dnl Set up variable with list of headers that must be +dnl included when string(s).h is to be included. + +AC_DEFUN([CURL_INCLUDES_STRING], [ +curl_includes_string="\ +/* includes start */ +#ifdef HAVE_SYS_TYPES_H +# include +#endif +#ifdef HAVE_STRING_H +# include +#endif +#ifdef HAVE_STRINGS_H +# include +#endif +/* includes end */" + AC_CHECK_HEADERS( + sys/types.h string.h strings.h, + [], [], [$curl_includes_string]) +]) + + +dnl CURL_INCLUDES_STROPTS +dnl ------------------------------------------------- +dnl Set up variable with list of headers that must be +dnl included when stropts.h is to be included. + +AC_DEFUN([CURL_INCLUDES_STROPTS], [ +curl_includes_stropts="\ +/* includes start */ +#ifdef HAVE_SYS_TYPES_H +# include +#endif +#ifdef HAVE_UNISTD_H +# include +#endif +#ifdef HAVE_SYS_SOCKET_H +# include +#endif +#ifdef HAVE_SYS_IOCTL_H +# include +#endif +#ifdef HAVE_STROPTS_H +# include +#endif +/* includes end */" + AC_CHECK_HEADERS( + sys/types.h unistd.h sys/socket.h sys/ioctl.h stropts.h, + [], [], [$curl_includes_stropts]) +]) + + +dnl CURL_INCLUDES_SYS_SOCKET +dnl ------------------------------------------------- +dnl Set up variable with list of headers that must be +dnl included when sys/socket.h is to be included. + +AC_DEFUN([CURL_INCLUDES_SYS_SOCKET], [ +curl_includes_sys_socket="\ +/* includes start */ +#ifdef HAVE_SYS_TYPES_H +# include +#endif +#ifdef HAVE_SYS_SOCKET_H +# include +#endif +/* includes end */" + AC_CHECK_HEADERS( + sys/types.h sys/socket.h, + [], [], [$curl_includes_sys_socket]) +]) + + +dnl CURL_INCLUDES_SYS_TYPES +dnl ------------------------------------------------- +dnl Set up variable with list of headers that must be +dnl included when sys/types.h is to be included. + +AC_DEFUN([CURL_INCLUDES_SYS_TYPES], [ +curl_includes_sys_types="\ +/* includes start */ +#ifdef HAVE_SYS_TYPES_H +# include +#endif +/* includes end */" + AC_CHECK_HEADERS( + sys/types.h, + [], [], [$curl_includes_sys_types]) +]) + + +dnl CURL_INCLUDES_SYS_UIO +dnl ------------------------------------------------- +dnl Set up variable with list of headers that must be +dnl included when sys/uio.h is to be included. + +AC_DEFUN([CURL_INCLUDES_SYS_UIO], [ +curl_includes_sys_uio="\ +/* includes start */ +#ifdef HAVE_SYS_TYPES_H +# include +#endif +#ifdef HAVE_SYS_UIO_H +# include +#endif +/* includes end */" + AC_CHECK_HEADERS( + sys/types.h sys/uio.h, + [], [], [$curl_includes_sys_uio]) +]) + + +dnl CURL_INCLUDES_SYS_XATTR +dnl ------------------------------------------------- +dnl Set up variable with list of headers that must be +dnl included when sys/xattr.h is to be included. + +AC_DEFUN([CURL_INCLUDES_SYS_XATTR], [ +curl_includes_sys_xattr="\ +/* includes start */ +#ifdef HAVE_SYS_TYPES_H +# include +#endif +#ifdef HAVE_SYS_XATTR_H +# include +#endif +/* includes end */" + AC_CHECK_HEADERS( + sys/types.h sys/xattr.h, + [], [], [$curl_includes_sys_xattr]) +]) + +dnl CURL_INCLUDES_TIME +dnl ------------------------------------------------- +dnl Set up variable with list of headers that must be +dnl included when time.h is to be included. + +AC_DEFUN([CURL_INCLUDES_TIME], [ +AC_REQUIRE([AC_HEADER_TIME])dnl +curl_includes_time="\ +/* includes start */ +#ifdef HAVE_SYS_TYPES_H +# include +#endif +#ifdef HAVE_SYS_TIME_H +# include +# ifdef TIME_WITH_SYS_TIME +# include +# endif +#else +# ifdef HAVE_TIME_H +# include +# endif +#endif +/* includes end */" + AC_CHECK_HEADERS( + sys/types.h sys/time.h time.h, + [], [], [$curl_includes_time]) +]) + + +dnl CURL_INCLUDES_UNISTD +dnl ------------------------------------------------- +dnl Set up variable with list of headers that must be +dnl included when unistd.h is to be included. + +AC_DEFUN([CURL_INCLUDES_UNISTD], [ +curl_includes_unistd="\ +/* includes start */ +#ifdef HAVE_SYS_TYPES_H +# include +#endif +#ifdef HAVE_UNISTD_H +# include +#endif +/* includes end */" + AC_CHECK_HEADERS( + sys/types.h unistd.h, + [], [], [$curl_includes_unistd]) +]) + + +dnl CURL_INCLUDES_WINSOCK2 +dnl ------------------------------------------------- +dnl Set up variable with list of headers that must be +dnl included when winsock(2).h is to be included. + +AC_DEFUN([CURL_INCLUDES_WINSOCK2], [ +curl_includes_winsock2="\ +/* includes start */ +#ifdef HAVE_WINDOWS_H +# ifndef WIN32_LEAN_AND_MEAN +# define WIN32_LEAN_AND_MEAN +# endif +# include +# ifdef HAVE_WINSOCK2_H +# include +# else +# ifdef HAVE_WINSOCK_H +# include +# endif +# endif +#endif +/* includes end */" + CURL_CHECK_HEADER_WINDOWS + CURL_CHECK_HEADER_WINSOCK + CURL_CHECK_HEADER_WINSOCK2 +]) + + +dnl CURL_INCLUDES_WS2TCPIP +dnl ------------------------------------------------- +dnl Set up variable with list of headers that must be +dnl included when ws2tcpip.h is to be included. + +AC_DEFUN([CURL_INCLUDES_WS2TCPIP], [ +curl_includes_ws2tcpip="\ +/* includes start */ +#ifdef HAVE_WINDOWS_H +# ifndef WIN32_LEAN_AND_MEAN +# define WIN32_LEAN_AND_MEAN +# endif +# include +# ifdef HAVE_WINSOCK2_H +# include +# ifdef HAVE_WS2TCPIP_H +# include +# endif +# endif +#endif +/* includes end */" + CURL_CHECK_HEADER_WINDOWS + CURL_CHECK_HEADER_WINSOCK2 + CURL_CHECK_HEADER_WS2TCPIP +]) + + +dnl CURL_PREPROCESS_CALLCONV +dnl ------------------------------------------------- +dnl Set up variable with a preprocessor block which +dnl defines function calling convention. + +AC_DEFUN([CURL_PREPROCESS_CALLCONV], [ +curl_preprocess_callconv="\ +/* preprocess start */ +#ifdef HAVE_WINDOWS_H +# define FUNCALLCONV __stdcall +#else +# define FUNCALLCONV +#endif +/* preprocess end */" +]) + + +dnl CURL_CHECK_FUNC_ALARM +dnl ------------------------------------------------- +dnl Verify if alarm is available, prototyped, and +dnl can be compiled. If all of these are true, and +dnl usage has not been previously disallowed with +dnl shell variable curl_disallow_alarm, then +dnl HAVE_ALARM will be defined. + +AC_DEFUN([CURL_CHECK_FUNC_ALARM], [ + AC_REQUIRE([CURL_INCLUDES_UNISTD])dnl + # + tst_links_alarm="unknown" + tst_proto_alarm="unknown" + tst_compi_alarm="unknown" + tst_allow_alarm="unknown" + # + AC_MSG_CHECKING([if alarm can be linked]) + AC_LINK_IFELSE([ + AC_LANG_FUNC_LINK_TRY([alarm]) + ],[ + AC_MSG_RESULT([yes]) + tst_links_alarm="yes" + ],[ + AC_MSG_RESULT([no]) + tst_links_alarm="no" + ]) + # + if test "$tst_links_alarm" = "yes"; then + AC_MSG_CHECKING([if alarm is prototyped]) + AC_EGREP_CPP([alarm],[ + $curl_includes_unistd + ],[ + AC_MSG_RESULT([yes]) + tst_proto_alarm="yes" + ],[ + AC_MSG_RESULT([no]) + tst_proto_alarm="no" + ]) + fi + # + if test "$tst_proto_alarm" = "yes"; then + AC_MSG_CHECKING([if alarm is compilable]) + AC_COMPILE_IFELSE([ + AC_LANG_PROGRAM([[ + $curl_includes_unistd + ]],[[ + if(0 != alarm(0)) + return 1; + ]]) + ],[ + AC_MSG_RESULT([yes]) + tst_compi_alarm="yes" + ],[ + AC_MSG_RESULT([no]) + tst_compi_alarm="no" + ]) + fi + # + if test "$tst_compi_alarm" = "yes"; then + AC_MSG_CHECKING([if alarm usage allowed]) + if test "x$curl_disallow_alarm" != "xyes"; then + AC_MSG_RESULT([yes]) + tst_allow_alarm="yes" + else + AC_MSG_RESULT([no]) + tst_allow_alarm="no" + fi + fi + # + AC_MSG_CHECKING([if alarm might be used]) + if test "$tst_links_alarm" = "yes" && + test "$tst_proto_alarm" = "yes" && + test "$tst_compi_alarm" = "yes" && + test "$tst_allow_alarm" = "yes"; then + AC_MSG_RESULT([yes]) + AC_DEFINE_UNQUOTED(HAVE_ALARM, 1, + [Define to 1 if you have the alarm function.]) + ac_cv_func_alarm="yes" + else + AC_MSG_RESULT([no]) + ac_cv_func_alarm="no" + fi +]) + + +dnl CURL_CHECK_FUNC_BASENAME +dnl ------------------------------------------------- +dnl Verify if basename is available, prototyped, and +dnl can be compiled. If all of these are true, and +dnl usage has not been previously disallowed with +dnl shell variable curl_disallow_basename, then +dnl HAVE_BASENAME will be defined. + +AC_DEFUN([CURL_CHECK_FUNC_BASENAME], [ + AC_REQUIRE([CURL_INCLUDES_STRING])dnl + AC_REQUIRE([CURL_INCLUDES_LIBGEN])dnl + AC_REQUIRE([CURL_INCLUDES_UNISTD])dnl + # + tst_links_basename="unknown" + tst_proto_basename="unknown" + tst_compi_basename="unknown" + tst_allow_basename="unknown" + # + AC_MSG_CHECKING([if basename can be linked]) + AC_LINK_IFELSE([ + AC_LANG_FUNC_LINK_TRY([basename]) + ],[ + AC_MSG_RESULT([yes]) + tst_links_basename="yes" + ],[ + AC_MSG_RESULT([no]) + tst_links_basename="no" + ]) + # + if test "$tst_links_basename" = "yes"; then + AC_MSG_CHECKING([if basename is prototyped]) + AC_EGREP_CPP([basename],[ + $curl_includes_string + $curl_includes_libgen + $curl_includes_unistd + ],[ + AC_MSG_RESULT([yes]) + tst_proto_basename="yes" + ],[ + AC_MSG_RESULT([no]) + tst_proto_basename="no" + ]) + fi + # + if test "$tst_proto_basename" = "yes"; then + AC_MSG_CHECKING([if basename is compilable]) + AC_COMPILE_IFELSE([ + AC_LANG_PROGRAM([[ + $curl_includes_string + $curl_includes_libgen + $curl_includes_unistd + ]],[[ + if(0 != basename(0)) + return 1; + ]]) + ],[ + AC_MSG_RESULT([yes]) + tst_compi_basename="yes" + ],[ + AC_MSG_RESULT([no]) + tst_compi_basename="no" + ]) + fi + # + if test "$tst_compi_basename" = "yes"; then + AC_MSG_CHECKING([if basename usage allowed]) + if test "x$curl_disallow_basename" != "xyes"; then + AC_MSG_RESULT([yes]) + tst_allow_basename="yes" + else + AC_MSG_RESULT([no]) + tst_allow_basename="no" + fi + fi + # + AC_MSG_CHECKING([if basename might be used]) + if test "$tst_links_basename" = "yes" && + test "$tst_proto_basename" = "yes" && + test "$tst_compi_basename" = "yes" && + test "$tst_allow_basename" = "yes"; then + AC_MSG_RESULT([yes]) + AC_DEFINE_UNQUOTED(HAVE_BASENAME, 1, + [Define to 1 if you have the basename function.]) + ac_cv_func_basename="yes" + else + AC_MSG_RESULT([no]) + ac_cv_func_basename="no" + fi +]) + + +dnl CURL_CHECK_FUNC_CLOSESOCKET +dnl ------------------------------------------------- +dnl Verify if closesocket is available, prototyped, and +dnl can be compiled. If all of these are true, and +dnl usage has not been previously disallowed with +dnl shell variable curl_disallow_closesocket, then +dnl HAVE_CLOSESOCKET will be defined. + +AC_DEFUN([CURL_CHECK_FUNC_CLOSESOCKET], [ + AC_REQUIRE([CURL_INCLUDES_WINSOCK2])dnl + AC_REQUIRE([CURL_INCLUDES_SOCKET])dnl + # + tst_links_closesocket="unknown" + tst_proto_closesocket="unknown" + tst_compi_closesocket="unknown" + tst_allow_closesocket="unknown" + # + AC_MSG_CHECKING([if closesocket can be linked]) + AC_LINK_IFELSE([ + AC_LANG_PROGRAM([[ + $curl_includes_winsock2 + $curl_includes_socket + ]],[[ + if(0 != closesocket(0)) + return 1; + ]]) + ],[ + AC_MSG_RESULT([yes]) + tst_links_closesocket="yes" + ],[ + AC_MSG_RESULT([no]) + tst_links_closesocket="no" + ]) + # + if test "$tst_links_closesocket" = "yes"; then + AC_MSG_CHECKING([if closesocket is prototyped]) + AC_EGREP_CPP([closesocket],[ + $curl_includes_winsock2 + $curl_includes_socket + ],[ + AC_MSG_RESULT([yes]) + tst_proto_closesocket="yes" + ],[ + AC_MSG_RESULT([no]) + tst_proto_closesocket="no" + ]) + fi + # + if test "$tst_proto_closesocket" = "yes"; then + AC_MSG_CHECKING([if closesocket is compilable]) + AC_COMPILE_IFELSE([ + AC_LANG_PROGRAM([[ + $curl_includes_winsock2 + $curl_includes_socket + ]],[[ + if(0 != closesocket(0)) + return 1; + ]]) + ],[ + AC_MSG_RESULT([yes]) + tst_compi_closesocket="yes" + ],[ + AC_MSG_RESULT([no]) + tst_compi_closesocket="no" + ]) + fi + # + if test "$tst_compi_closesocket" = "yes"; then + AC_MSG_CHECKING([if closesocket usage allowed]) + if test "x$curl_disallow_closesocket" != "xyes"; then + AC_MSG_RESULT([yes]) + tst_allow_closesocket="yes" + else + AC_MSG_RESULT([no]) + tst_allow_closesocket="no" + fi + fi + # + AC_MSG_CHECKING([if closesocket might be used]) + if test "$tst_links_closesocket" = "yes" && + test "$tst_proto_closesocket" = "yes" && + test "$tst_compi_closesocket" = "yes" && + test "$tst_allow_closesocket" = "yes"; then + AC_MSG_RESULT([yes]) + AC_DEFINE_UNQUOTED(HAVE_CLOSESOCKET, 1, + [Define to 1 if you have the closesocket function.]) + ac_cv_func_closesocket="yes" + else + AC_MSG_RESULT([no]) + ac_cv_func_closesocket="no" + fi +]) + + +dnl CURL_CHECK_FUNC_CLOSESOCKET_CAMEL +dnl ------------------------------------------------- +dnl Verify if CloseSocket is available, prototyped, and +dnl can be compiled. If all of these are true, and +dnl usage has not been previously disallowed with +dnl shell variable curl_disallow_closesocket_camel, +dnl then HAVE_CLOSESOCKET_CAMEL will be defined. + +AC_DEFUN([CURL_CHECK_FUNC_CLOSESOCKET_CAMEL], [ + AC_REQUIRE([CURL_INCLUDES_SYS_SOCKET])dnl + # + tst_links_closesocket_camel="unknown" + tst_proto_closesocket_camel="unknown" + tst_compi_closesocket_camel="unknown" + tst_allow_closesocket_camel="unknown" + # + AC_MSG_CHECKING([if CloseSocket can be linked]) + AC_LINK_IFELSE([ + AC_LANG_PROGRAM([[ + $curl_includes_sys_socket + ]],[[ + if(0 != CloseSocket(0)) + return 1; + ]]) + ],[ + AC_MSG_RESULT([yes]) + tst_links_closesocket_camel="yes" + ],[ + AC_MSG_RESULT([no]) + tst_links_closesocket_camel="no" + ]) + # + if test "$tst_links_closesocket_camel" = "yes"; then + AC_MSG_CHECKING([if CloseSocket is prototyped]) + AC_EGREP_CPP([CloseSocket],[ + $curl_includes_sys_socket + ],[ + AC_MSG_RESULT([yes]) + tst_proto_closesocket_camel="yes" + ],[ + AC_MSG_RESULT([no]) + tst_proto_closesocket_camel="no" + ]) + fi + # + if test "$tst_proto_closesocket_camel" = "yes"; then + AC_MSG_CHECKING([if CloseSocket is compilable]) + AC_COMPILE_IFELSE([ + AC_LANG_PROGRAM([[ + $curl_includes_sys_socket + ]],[[ + if(0 != CloseSocket(0)) + return 1; + ]]) + ],[ + AC_MSG_RESULT([yes]) + tst_compi_closesocket_camel="yes" + ],[ + AC_MSG_RESULT([no]) + tst_compi_closesocket_camel="no" + ]) + fi + # + if test "$tst_compi_closesocket_camel" = "yes"; then + AC_MSG_CHECKING([if CloseSocket usage allowed]) + if test "x$curl_disallow_closesocket_camel" != "xyes"; then + AC_MSG_RESULT([yes]) + tst_allow_closesocket_camel="yes" + else + AC_MSG_RESULT([no]) + tst_allow_closesocket_camel="no" + fi + fi + # + AC_MSG_CHECKING([if CloseSocket might be used]) + if test "$tst_links_closesocket_camel" = "yes" && + test "$tst_proto_closesocket_camel" = "yes" && + test "$tst_compi_closesocket_camel" = "yes" && + test "$tst_allow_closesocket_camel" = "yes"; then + AC_MSG_RESULT([yes]) + AC_DEFINE_UNQUOTED(HAVE_CLOSESOCKET_CAMEL, 1, + [Define to 1 if you have the CloseSocket camel case function.]) + ac_cv_func_closesocket_camel="yes" + else + AC_MSG_RESULT([no]) + ac_cv_func_closesocket_camel="no" + fi +]) + + +dnl CURL_CHECK_FUNC_CONNECT +dnl ------------------------------------------------- +dnl Verify if connect is available, prototyped, and +dnl can be compiled. If all of these are true, and +dnl usage has not been previously disallowed with +dnl shell variable curl_disallow_connect, then +dnl HAVE_CONNECT will be defined. + +AC_DEFUN([CURL_CHECK_FUNC_CONNECT], [ + AC_REQUIRE([CURL_INCLUDES_WINSOCK2])dnl + AC_REQUIRE([CURL_INCLUDES_SYS_SOCKET])dnl + AC_REQUIRE([CURL_INCLUDES_SOCKET])dnl + # + tst_links_connect="unknown" + tst_proto_connect="unknown" + tst_compi_connect="unknown" + tst_allow_connect="unknown" + # + AC_MSG_CHECKING([if connect can be linked]) + AC_LINK_IFELSE([ + AC_LANG_PROGRAM([[ + $curl_includes_winsock2 + $curl_includes_sys_socket + $curl_includes_socket + ]],[[ + if(0 != connect(0, 0, 0)) + return 1; + ]]) + ],[ + AC_MSG_RESULT([yes]) + tst_links_connect="yes" + ],[ + AC_MSG_RESULT([no]) + tst_links_connect="no" + ]) + # + if test "$tst_links_connect" = "yes"; then + AC_MSG_CHECKING([if connect is prototyped]) + AC_EGREP_CPP([connect],[ + $curl_includes_winsock2 + $curl_includes_sys_socket + $curl_includes_socket + ],[ + AC_MSG_RESULT([yes]) + tst_proto_connect="yes" + ],[ + AC_MSG_RESULT([no]) + tst_proto_connect="no" + ]) + fi + # + if test "$tst_proto_connect" = "yes"; then + AC_MSG_CHECKING([if connect is compilable]) + AC_COMPILE_IFELSE([ + AC_LANG_PROGRAM([[ + $curl_includes_winsock2 + $curl_includes_sys_socket + $curl_includes_socket + ]],[[ + if(0 != connect(0, 0, 0)) + return 1; + ]]) + ],[ + AC_MSG_RESULT([yes]) + tst_compi_connect="yes" + ],[ + AC_MSG_RESULT([no]) + tst_compi_connect="no" + ]) + fi + # + if test "$tst_compi_connect" = "yes"; then + AC_MSG_CHECKING([if connect usage allowed]) + if test "x$curl_disallow_connect" != "xyes"; then + AC_MSG_RESULT([yes]) + tst_allow_connect="yes" + else + AC_MSG_RESULT([no]) + tst_allow_connect="no" + fi + fi + # + AC_MSG_CHECKING([if connect might be used]) + if test "$tst_links_connect" = "yes" && + test "$tst_proto_connect" = "yes" && + test "$tst_compi_connect" = "yes" && + test "$tst_allow_connect" = "yes"; then + AC_MSG_RESULT([yes]) + AC_DEFINE_UNQUOTED(HAVE_CONNECT, 1, + [Define to 1 if you have the connect function.]) + ac_cv_func_connect="yes" + else + AC_MSG_RESULT([no]) + ac_cv_func_connect="no" + fi +]) + + +dnl CURL_CHECK_FUNC_FCNTL +dnl ------------------------------------------------- +dnl Verify if fcntl is available, prototyped, and +dnl can be compiled. If all of these are true, and +dnl usage has not been previously disallowed with +dnl shell variable curl_disallow_fcntl, then +dnl HAVE_FCNTL will be defined. + +AC_DEFUN([CURL_CHECK_FUNC_FCNTL], [ + AC_REQUIRE([CURL_INCLUDES_FCNTL])dnl + # + tst_links_fcntl="unknown" + tst_proto_fcntl="unknown" + tst_compi_fcntl="unknown" + tst_allow_fcntl="unknown" + # + AC_MSG_CHECKING([if fcntl can be linked]) + AC_LINK_IFELSE([ + AC_LANG_FUNC_LINK_TRY([fcntl]) + ],[ + AC_MSG_RESULT([yes]) + tst_links_fcntl="yes" + ],[ + AC_MSG_RESULT([no]) + tst_links_fcntl="no" + ]) + # + if test "$tst_links_fcntl" = "yes"; then + AC_MSG_CHECKING([if fcntl is prototyped]) + AC_EGREP_CPP([fcntl],[ + $curl_includes_fcntl + ],[ + AC_MSG_RESULT([yes]) + tst_proto_fcntl="yes" + ],[ + AC_MSG_RESULT([no]) + tst_proto_fcntl="no" + ]) + fi + # + if test "$tst_proto_fcntl" = "yes"; then + AC_MSG_CHECKING([if fcntl is compilable]) + AC_COMPILE_IFELSE([ + AC_LANG_PROGRAM([[ + $curl_includes_fcntl + ]],[[ + if(0 != fcntl(0, 0, 0)) + return 1; + ]]) + ],[ + AC_MSG_RESULT([yes]) + tst_compi_fcntl="yes" + ],[ + AC_MSG_RESULT([no]) + tst_compi_fcntl="no" + ]) + fi + # + if test "$tst_compi_fcntl" = "yes"; then + AC_MSG_CHECKING([if fcntl usage allowed]) + if test "x$curl_disallow_fcntl" != "xyes"; then + AC_MSG_RESULT([yes]) + tst_allow_fcntl="yes" + else + AC_MSG_RESULT([no]) + tst_allow_fcntl="no" + fi + fi + # + AC_MSG_CHECKING([if fcntl might be used]) + if test "$tst_links_fcntl" = "yes" && + test "$tst_proto_fcntl" = "yes" && + test "$tst_compi_fcntl" = "yes" && + test "$tst_allow_fcntl" = "yes"; then + AC_MSG_RESULT([yes]) + AC_DEFINE_UNQUOTED(HAVE_FCNTL, 1, + [Define to 1 if you have the fcntl function.]) + ac_cv_func_fcntl="yes" + CURL_CHECK_FUNC_FCNTL_O_NONBLOCK + else + AC_MSG_RESULT([no]) + ac_cv_func_fcntl="no" + fi +]) + + +dnl CURL_CHECK_FUNC_FCNTL_O_NONBLOCK +dnl ------------------------------------------------- +dnl Verify if fcntl with status flag O_NONBLOCK is +dnl available, can be compiled, and seems to work. If +dnl all of these are true, then HAVE_FCNTL_O_NONBLOCK +dnl will be defined. + +AC_DEFUN([CURL_CHECK_FUNC_FCNTL_O_NONBLOCK], [ + # + tst_compi_fcntl_o_nonblock="unknown" + tst_allow_fcntl_o_nonblock="unknown" + # + case $host_os in + sunos4* | aix3* | beos*) + dnl O_NONBLOCK does not work on these platforms + curl_disallow_fcntl_o_nonblock="yes" + ;; + esac + # + if test "$ac_cv_func_fcntl" = "yes"; then + AC_MSG_CHECKING([if fcntl O_NONBLOCK is compilable]) + AC_COMPILE_IFELSE([ + AC_LANG_PROGRAM([[ + $curl_includes_fcntl + ]],[[ + int flags = 0; + if(0 != fcntl(0, F_SETFL, flags | O_NONBLOCK)) + return 1; + ]]) + ],[ + AC_MSG_RESULT([yes]) + tst_compi_fcntl_o_nonblock="yes" + ],[ + AC_MSG_RESULT([no]) + tst_compi_fcntl_o_nonblock="no" + ]) + fi + # + if test "$tst_compi_fcntl_o_nonblock" = "yes"; then + AC_MSG_CHECKING([if fcntl O_NONBLOCK usage allowed]) + if test "x$curl_disallow_fcntl_o_nonblock" != "xyes"; then + AC_MSG_RESULT([yes]) + tst_allow_fcntl_o_nonblock="yes" + else + AC_MSG_RESULT([no]) + tst_allow_fcntl_o_nonblock="no" + fi + fi + # + AC_MSG_CHECKING([if fcntl O_NONBLOCK might be used]) + if test "$tst_compi_fcntl_o_nonblock" = "yes" && + test "$tst_allow_fcntl_o_nonblock" = "yes"; then + AC_MSG_RESULT([yes]) + AC_DEFINE_UNQUOTED(HAVE_FCNTL_O_NONBLOCK, 1, + [Define to 1 if you have a working fcntl O_NONBLOCK function.]) + ac_cv_func_fcntl_o_nonblock="yes" + else + AC_MSG_RESULT([no]) + ac_cv_func_fcntl_o_nonblock="no" + fi +]) + + +dnl CURL_CHECK_FUNC_FDOPEN +dnl ------------------------------------------------- +dnl Verify if fdopen is available, prototyped, and +dnl can be compiled. If all of these are true, and +dnl usage has not been previously disallowed with +dnl shell variable curl_disallow_fdopen, then +dnl HAVE_FDOPEN will be defined. + +AC_DEFUN([CURL_CHECK_FUNC_FDOPEN], [ + AC_REQUIRE([CURL_INCLUDES_STDIO])dnl + # + tst_links_fdopen="unknown" + tst_proto_fdopen="unknown" + tst_compi_fdopen="unknown" + tst_allow_fdopen="unknown" + # + AC_MSG_CHECKING([if fdopen can be linked]) + AC_LINK_IFELSE([ + AC_LANG_FUNC_LINK_TRY([fdopen]) + ],[ + AC_MSG_RESULT([yes]) + tst_links_fdopen="yes" + ],[ + AC_MSG_RESULT([no]) + tst_links_fdopen="no" + ]) + # + if test "$tst_links_fdopen" = "yes"; then + AC_MSG_CHECKING([if fdopen is prototyped]) + AC_EGREP_CPP([fdopen],[ + $curl_includes_stdio + ],[ + AC_MSG_RESULT([yes]) + tst_proto_fdopen="yes" + ],[ + AC_MSG_RESULT([no]) + tst_proto_fdopen="no" + ]) + fi + # + if test "$tst_proto_fdopen" = "yes"; then + AC_MSG_CHECKING([if fdopen is compilable]) + AC_COMPILE_IFELSE([ + AC_LANG_PROGRAM([[ + $curl_includes_stdio + ]],[[ + if(0 != fdopen(0, 0)) + return 1; + ]]) + ],[ + AC_MSG_RESULT([yes]) + tst_compi_fdopen="yes" + ],[ + AC_MSG_RESULT([no]) + tst_compi_fdopen="no" + ]) + fi + # + if test "$tst_compi_fdopen" = "yes"; then + AC_MSG_CHECKING([if fdopen usage allowed]) + if test "x$curl_disallow_fdopen" != "xyes"; then + AC_MSG_RESULT([yes]) + tst_allow_fdopen="yes" + else + AC_MSG_RESULT([no]) + tst_allow_fdopen="no" + fi + fi + # + AC_MSG_CHECKING([if fdopen might be used]) + if test "$tst_links_fdopen" = "yes" && + test "$tst_proto_fdopen" = "yes" && + test "$tst_compi_fdopen" = "yes" && + test "$tst_allow_fdopen" = "yes"; then + AC_MSG_RESULT([yes]) + AC_DEFINE_UNQUOTED(HAVE_FDOPEN, 1, + [Define to 1 if you have the fdopen function.]) + ac_cv_func_fdopen="yes" + else + AC_MSG_RESULT([no]) + ac_cv_func_fdopen="no" + fi +]) + + +dnl CURL_CHECK_FUNC_FGETXATTR +dnl ------------------------------------------------- +dnl Verify if fgetxattr is available, prototyped, and +dnl can be compiled. If all of these are true, and +dnl usage has not been previously disallowed with +dnl shell variable curl_disallow_fgetxattr, then +dnl HAVE_FGETXATTR will be defined. + +AC_DEFUN([CURL_CHECK_FUNC_FGETXATTR], [ + AC_REQUIRE([CURL_INCLUDES_SYS_XATTR])dnl + # + tst_links_fgetxattr="unknown" + tst_proto_fgetxattr="unknown" + tst_compi_fgetxattr="unknown" + tst_allow_fgetxattr="unknown" + tst_nargs_fgetxattr="unknown" + # + AC_MSG_CHECKING([if fgetxattr can be linked]) + AC_LINK_IFELSE([ + AC_LANG_FUNC_LINK_TRY([fgetxattr]) + ],[ + AC_MSG_RESULT([yes]) + tst_links_fgetxattr="yes" + ],[ + AC_MSG_RESULT([no]) + tst_links_fgetxattr="no" + ]) + # + if test "$tst_links_fgetxattr" = "yes"; then + AC_MSG_CHECKING([if fgetxattr is prototyped]) + AC_EGREP_CPP([fgetxattr],[ + $curl_includes_sys_xattr + ],[ + AC_MSG_RESULT([yes]) + tst_proto_fgetxattr="yes" + ],[ + AC_MSG_RESULT([no]) + tst_proto_fgetxattr="no" + ]) + fi + # + if test "$tst_proto_fgetxattr" = "yes"; then + if test "$tst_nargs_fgetxattr" = "unknown"; then + AC_MSG_CHECKING([if fgetxattr takes 4 args.]) + AC_COMPILE_IFELSE([ + AC_LANG_PROGRAM([[ + $curl_includes_sys_xattr + ]],[[ + if(0 != fgetxattr(0, 0, 0, 0)) + return 1; + ]]) + ],[ + AC_MSG_RESULT([yes]) + tst_compi_fgetxattr="yes" + tst_nargs_fgetxattr="4" + ],[ + AC_MSG_RESULT([no]) + tst_compi_fgetxattr="no" + ]) + fi + if test "$tst_nargs_fgetxattr" = "unknown"; then + AC_MSG_CHECKING([if fgetxattr takes 6 args.]) + AC_COMPILE_IFELSE([ + AC_LANG_PROGRAM([[ + $curl_includes_sys_xattr + ]],[[ + if(0 != fgetxattr(0, 0, 0, 0, 0, 0)) + return 1; + ]]) + ],[ + AC_MSG_RESULT([yes]) + tst_compi_fgetxattr="yes" + tst_nargs_fgetxattr="6" + ],[ + AC_MSG_RESULT([no]) + tst_compi_fgetxattr="no" + ]) + fi + AC_MSG_CHECKING([if fgetxattr is compilable]) + if test "$tst_compi_fgetxattr" = "yes"; then + AC_MSG_RESULT([yes]) + else + AC_MSG_RESULT([no]) + fi + fi + # + if test "$tst_compi_fgetxattr" = "yes"; then + AC_MSG_CHECKING([if fgetxattr usage allowed]) + if test "x$curl_disallow_fgetxattr" != "xyes"; then + AC_MSG_RESULT([yes]) + tst_allow_fgetxattr="yes" + else + AC_MSG_RESULT([no]) + tst_allow_fgetxattr="no" + fi + fi + # + AC_MSG_CHECKING([if fgetxattr might be used]) + if test "$tst_links_fgetxattr" = "yes" && + test "$tst_proto_fgetxattr" = "yes" && + test "$tst_compi_fgetxattr" = "yes" && + test "$tst_allow_fgetxattr" = "yes"; then + AC_MSG_RESULT([yes]) + AC_DEFINE_UNQUOTED(HAVE_FGETXATTR, 1, + [Define to 1 if you have the fgetxattr function.]) + dnl AC_DEFINE_UNQUOTED(FGETXATTR_ARGS, $tst_nargs_fgetxattr, + dnl [Specifies the number of arguments to fgetxattr]) + # + if test "$tst_nargs_fgetxattr" -eq "4"; then + AC_DEFINE(HAVE_FGETXATTR_4, 1, [fgetxattr() takes 4 args]) + elif test "$tst_nargs_fgetxattr" -eq "6"; then + AC_DEFINE(HAVE_FGETXATTR_6, 1, [fgetxattr() takes 6 args]) + fi + # + ac_cv_func_fgetxattr="yes" + else + AC_MSG_RESULT([no]) + ac_cv_func_fgetxattr="no" + fi +]) + + +dnl CURL_CHECK_FUNC_FLISTXATTR +dnl ------------------------------------------------- +dnl Verify if flistxattr is available, prototyped, and +dnl can be compiled. If all of these are true, and +dnl usage has not been previously disallowed with +dnl shell variable curl_disallow_flistxattr, then +dnl HAVE_FLISTXATTR will be defined. + +AC_DEFUN([CURL_CHECK_FUNC_FLISTXATTR], [ + AC_REQUIRE([CURL_INCLUDES_SYS_XATTR])dnl + # + tst_links_flistxattr="unknown" + tst_proto_flistxattr="unknown" + tst_compi_flistxattr="unknown" + tst_allow_flistxattr="unknown" + tst_nargs_flistxattr="unknown" + # + AC_MSG_CHECKING([if flistxattr can be linked]) + AC_LINK_IFELSE([ + AC_LANG_FUNC_LINK_TRY([flistxattr]) + ],[ + AC_MSG_RESULT([yes]) + tst_links_flistxattr="yes" + ],[ + AC_MSG_RESULT([no]) + tst_links_flistxattr="no" + ]) + # + if test "$tst_links_flistxattr" = "yes"; then + AC_MSG_CHECKING([if flistxattr is prototyped]) + AC_EGREP_CPP([flistxattr],[ + $curl_includes_sys_xattr + ],[ + AC_MSG_RESULT([yes]) + tst_proto_flistxattr="yes" + ],[ + AC_MSG_RESULT([no]) + tst_proto_flistxattr="no" + ]) + fi + # + if test "$tst_proto_flistxattr" = "yes"; then + if test "$tst_nargs_flistxattr" = "unknown"; then + AC_MSG_CHECKING([if flistxattr takes 3 args.]) + AC_COMPILE_IFELSE([ + AC_LANG_PROGRAM([[ + $curl_includes_sys_xattr + ]],[[ + if(0 != flistxattr(0, 0, 0)) + return 1; + ]]) + ],[ + AC_MSG_RESULT([yes]) + tst_compi_flistxattr="yes" + tst_nargs_flistxattr="3" + ],[ + AC_MSG_RESULT([no]) + tst_compi_flistxattr="no" + ]) + fi + if test "$tst_nargs_flistxattr" = "unknown"; then + AC_MSG_CHECKING([if flistxattr takes 4 args.]) + AC_COMPILE_IFELSE([ + AC_LANG_PROGRAM([[ + $curl_includes_sys_xattr + ]],[[ + if(0 != flistxattr(0, 0, 0, 0)) + return 1; + ]]) + ],[ + AC_MSG_RESULT([yes]) + tst_compi_flistxattr="yes" + tst_nargs_flistxattr="4" + ],[ + AC_MSG_RESULT([no]) + tst_compi_flistxattr="no" + ]) + fi + AC_MSG_CHECKING([if flistxattr is compilable]) + if test "$tst_compi_flistxattr" = "yes"; then + AC_MSG_RESULT([yes]) + else + AC_MSG_RESULT([no]) + fi + fi + # + if test "$tst_compi_flistxattr" = "yes"; then + AC_MSG_CHECKING([if flistxattr usage allowed]) + if test "x$curl_disallow_flistxattr" != "xyes"; then + AC_MSG_RESULT([yes]) + tst_allow_flistxattr="yes" + else + AC_MSG_RESULT([no]) + tst_allow_flistxattr="no" + fi + fi + # + AC_MSG_CHECKING([if flistxattr might be used]) + if test "$tst_links_flistxattr" = "yes" && + test "$tst_proto_flistxattr" = "yes" && + test "$tst_compi_flistxattr" = "yes" && + test "$tst_allow_flistxattr" = "yes"; then + AC_MSG_RESULT([yes]) + AC_DEFINE_UNQUOTED(HAVE_FLISTXATTR, 1, + [Define to 1 if you have the flistxattr function.]) + dnl AC_DEFINE_UNQUOTED(FLISTXATTR_ARGS, $tst_nargs_flistxattr, + dnl [Specifies the number of arguments to flistxattr]) + # + if test "$tst_nargs_flistxattr" -eq "3"; then + AC_DEFINE(HAVE_FLISTXATTR_3, 1, [flistxattr() takes 3 args]) + elif test "$tst_nargs_flistxattr" -eq "4"; then + AC_DEFINE(HAVE_FLISTXATTR_4, 1, [flistxattr() takes 4 args]) + fi + # + ac_cv_func_flistxattr="yes" + else + AC_MSG_RESULT([no]) + ac_cv_func_flistxattr="no" + fi +]) + + +dnl CURL_CHECK_FUNC_FREEADDRINFO +dnl ------------------------------------------------- +dnl Verify if freeaddrinfo is available, prototyped, +dnl and can be compiled. If all of these are true, +dnl and usage has not been previously disallowed with +dnl shell variable curl_disallow_freeaddrinfo, then +dnl HAVE_FREEADDRINFO will be defined. + +AC_DEFUN([CURL_CHECK_FUNC_FREEADDRINFO], [ + AC_REQUIRE([CURL_INCLUDES_WS2TCPIP])dnl + AC_REQUIRE([CURL_INCLUDES_SYS_SOCKET])dnl + AC_REQUIRE([CURL_INCLUDES_NETDB])dnl + # + tst_links_freeaddrinfo="unknown" + tst_proto_freeaddrinfo="unknown" + tst_compi_freeaddrinfo="unknown" + tst_allow_freeaddrinfo="unknown" + # + AC_MSG_CHECKING([if freeaddrinfo can be linked]) + AC_LINK_IFELSE([ + AC_LANG_PROGRAM([[ + $curl_includes_ws2tcpip + $curl_includes_sys_socket + $curl_includes_netdb + ]],[[ + freeaddrinfo(0); + ]]) + ],[ + AC_MSG_RESULT([yes]) + tst_links_freeaddrinfo="yes" + ],[ + AC_MSG_RESULT([no]) + tst_links_freeaddrinfo="no" + ]) + # + if test "$tst_links_freeaddrinfo" = "yes"; then + AC_MSG_CHECKING([if freeaddrinfo is prototyped]) + AC_EGREP_CPP([freeaddrinfo],[ + $curl_includes_ws2tcpip + $curl_includes_sys_socket + $curl_includes_netdb + ],[ + AC_MSG_RESULT([yes]) + tst_proto_freeaddrinfo="yes" + ],[ + AC_MSG_RESULT([no]) + tst_proto_freeaddrinfo="no" + ]) + fi + # + if test "$tst_proto_freeaddrinfo" = "yes"; then + AC_MSG_CHECKING([if freeaddrinfo is compilable]) + AC_COMPILE_IFELSE([ + AC_LANG_PROGRAM([[ + $curl_includes_ws2tcpip + $curl_includes_sys_socket + $curl_includes_netdb + ]],[[ + freeaddrinfo(0); + ]]) + ],[ + AC_MSG_RESULT([yes]) + tst_compi_freeaddrinfo="yes" + ],[ + AC_MSG_RESULT([no]) + tst_compi_freeaddrinfo="no" + ]) + fi + # + if test "$tst_compi_freeaddrinfo" = "yes"; then + AC_MSG_CHECKING([if freeaddrinfo usage allowed]) + if test "x$curl_disallow_freeaddrinfo" != "xyes"; then + AC_MSG_RESULT([yes]) + tst_allow_freeaddrinfo="yes" + else + AC_MSG_RESULT([no]) + tst_allow_freeaddrinfo="no" + fi + fi + # + AC_MSG_CHECKING([if freeaddrinfo might be used]) + if test "$tst_links_freeaddrinfo" = "yes" && + test "$tst_proto_freeaddrinfo" = "yes" && + test "$tst_compi_freeaddrinfo" = "yes" && + test "$tst_allow_freeaddrinfo" = "yes"; then + AC_MSG_RESULT([yes]) + AC_DEFINE_UNQUOTED(HAVE_FREEADDRINFO, 1, + [Define to 1 if you have the freeaddrinfo function.]) + ac_cv_func_freeaddrinfo="yes" + else + AC_MSG_RESULT([no]) + ac_cv_func_freeaddrinfo="no" + fi +]) + + +dnl CURL_CHECK_FUNC_FREEIFADDRS +dnl ------------------------------------------------- +dnl Verify if freeifaddrs is available, prototyped, and +dnl can be compiled. If all of these are true, and +dnl usage has not been previously disallowed with +dnl shell variable curl_disallow_freeifaddrs, then +dnl HAVE_FREEIFADDRS will be defined. + +AC_DEFUN([CURL_CHECK_FUNC_FREEIFADDRS], [ + AC_REQUIRE([CURL_INCLUDES_IFADDRS])dnl + # + tst_links_freeifaddrs="unknown" + tst_proto_freeifaddrs="unknown" + tst_compi_freeifaddrs="unknown" + tst_allow_freeifaddrs="unknown" + # + AC_MSG_CHECKING([if freeifaddrs can be linked]) + AC_LINK_IFELSE([ + AC_LANG_FUNC_LINK_TRY([freeifaddrs]) + ],[ + AC_MSG_RESULT([yes]) + tst_links_freeifaddrs="yes" + ],[ + AC_MSG_RESULT([no]) + tst_links_freeifaddrs="no" + ]) + # + if test "$tst_links_freeifaddrs" = "yes"; then + AC_MSG_CHECKING([if freeifaddrs is prototyped]) + AC_EGREP_CPP([freeifaddrs],[ + $curl_includes_ifaddrs + ],[ + AC_MSG_RESULT([yes]) + tst_proto_freeifaddrs="yes" + ],[ + AC_MSG_RESULT([no]) + tst_proto_freeifaddrs="no" + ]) + fi + # + if test "$tst_proto_freeifaddrs" = "yes"; then + AC_MSG_CHECKING([if freeifaddrs is compilable]) + AC_COMPILE_IFELSE([ + AC_LANG_PROGRAM([[ + $curl_includes_ifaddrs + ]],[[ + freeifaddrs(0); + ]]) + ],[ + AC_MSG_RESULT([yes]) + tst_compi_freeifaddrs="yes" + ],[ + AC_MSG_RESULT([no]) + tst_compi_freeifaddrs="no" + ]) + fi + # + if test "$tst_compi_freeifaddrs" = "yes"; then + AC_MSG_CHECKING([if freeifaddrs usage allowed]) + if test "x$curl_disallow_freeifaddrs" != "xyes"; then + AC_MSG_RESULT([yes]) + tst_allow_freeifaddrs="yes" + else + AC_MSG_RESULT([no]) + tst_allow_freeifaddrs="no" + fi + fi + # + AC_MSG_CHECKING([if freeifaddrs might be used]) + if test "$tst_links_freeifaddrs" = "yes" && + test "$tst_proto_freeifaddrs" = "yes" && + test "$tst_compi_freeifaddrs" = "yes" && + test "$tst_allow_freeifaddrs" = "yes"; then + AC_MSG_RESULT([yes]) + AC_DEFINE_UNQUOTED(HAVE_FREEIFADDRS, 1, + [Define to 1 if you have the freeifaddrs function.]) + ac_cv_func_freeifaddrs="yes" + else + AC_MSG_RESULT([no]) + ac_cv_func_freeifaddrs="no" + fi +]) + + +dnl CURL_CHECK_FUNC_FREMOVEXATTR +dnl ------------------------------------------------- +dnl Verify if fremovexattr is available, prototyped, and +dnl can be compiled. If all of these are true, and +dnl usage has not been previously disallowed with +dnl shell variable curl_disallow_fremovexattr, then +dnl HAVE_FREMOVEXATTR will be defined. + +AC_DEFUN([CURL_CHECK_FUNC_FREMOVEXATTR], [ + AC_REQUIRE([CURL_INCLUDES_SYS_XATTR])dnl + # + tst_links_fremovexattr="unknown" + tst_proto_fremovexattr="unknown" + tst_compi_fremovexattr="unknown" + tst_allow_fremovexattr="unknown" + tst_nargs_fremovexattr="unknown" + # + AC_MSG_CHECKING([if fremovexattr can be linked]) + AC_LINK_IFELSE([ + AC_LANG_FUNC_LINK_TRY([fremovexattr]) + ],[ + AC_MSG_RESULT([yes]) + tst_links_fremovexattr="yes" + ],[ + AC_MSG_RESULT([no]) + tst_links_fremovexattr="no" + ]) + # + if test "$tst_links_fremovexattr" = "yes"; then + AC_MSG_CHECKING([if fremovexattr is prototyped]) + AC_EGREP_CPP([fremovexattr],[ + $curl_includes_sys_xattr + ],[ + AC_MSG_RESULT([yes]) + tst_proto_fremovexattr="yes" + ],[ + AC_MSG_RESULT([no]) + tst_proto_fremovexattr="no" + ]) + fi + # + if test "$tst_proto_fremovexattr" = "yes"; then + if test "$tst_nargs_fremovexattr" = "unknown"; then + AC_MSG_CHECKING([if fremovexattr takes 2 args.]) + AC_COMPILE_IFELSE([ + AC_LANG_PROGRAM([[ + $curl_includes_sys_xattr + ]],[[ + if(0 != fremovexattr(0, 0)) + return 1; + ]]) + ],[ + AC_MSG_RESULT([yes]) + tst_compi_fremovexattr="yes" + tst_nargs_fremovexattr="2" + ],[ + AC_MSG_RESULT([no]) + tst_compi_fremovexattr="no" + ]) + fi + if test "$tst_nargs_fremovexattr" = "unknown"; then + AC_MSG_CHECKING([if fremovexattr takes 3 args.]) + AC_COMPILE_IFELSE([ + AC_LANG_PROGRAM([[ + $curl_includes_sys_xattr + ]],[[ + if(0 != fremovexattr(0, 0, 0)) + return 1; + ]]) + ],[ + AC_MSG_RESULT([yes]) + tst_compi_fremovexattr="yes" + tst_nargs_fremovexattr="3" + ],[ + AC_MSG_RESULT([no]) + tst_compi_fremovexattr="no" + ]) + fi + AC_MSG_CHECKING([if fremovexattr is compilable]) + if test "$tst_compi_fremovexattr" = "yes"; then + AC_MSG_RESULT([yes]) + else + AC_MSG_RESULT([no]) + fi + fi + # + if test "$tst_compi_fremovexattr" = "yes"; then + AC_MSG_CHECKING([if fremovexattr usage allowed]) + if test "x$curl_disallow_fremovexattr" != "xyes"; then + AC_MSG_RESULT([yes]) + tst_allow_fremovexattr="yes" + else + AC_MSG_RESULT([no]) + tst_allow_fremovexattr="no" + fi + fi + # + AC_MSG_CHECKING([if fremovexattr might be used]) + if test "$tst_links_fremovexattr" = "yes" && + test "$tst_proto_fremovexattr" = "yes" && + test "$tst_compi_fremovexattr" = "yes" && + test "$tst_allow_fremovexattr" = "yes"; then + AC_MSG_RESULT([yes]) + AC_DEFINE_UNQUOTED(HAVE_FREMOVEXATTR, 1, + [Define to 1 if you have the fremovexattr function.]) + dnl AC_DEFINE_UNQUOTED(FREMOVEXATTR_ARGS, $tst_nargs_fremovexattr, + dnl [Specifies the number of arguments to fremovexattr]) + # + if test "$tst_nargs_fremovexattr" -eq "2"; then + AC_DEFINE(HAVE_FREMOVEXATTR_2, 1, [fremovexattr() takes 2 args]) + elif test "$tst_nargs_fremovexattr" -eq "3"; then + AC_DEFINE(HAVE_FREMOVEXATTR_3, 1, [fremovexattr() takes 3 args]) + fi + # + ac_cv_func_fremovexattr="yes" + else + AC_MSG_RESULT([no]) + ac_cv_func_fremovexattr="no" + fi +]) + + +dnl CURL_CHECK_FUNC_FSETXATTR +dnl ------------------------------------------------- +dnl Verify if fsetxattr is available, prototyped, and +dnl can be compiled. If all of these are true, and +dnl usage has not been previously disallowed with +dnl shell variable curl_disallow_fsetxattr, then +dnl HAVE_FSETXATTR will be defined. + +AC_DEFUN([CURL_CHECK_FUNC_FSETXATTR], [ + AC_REQUIRE([CURL_INCLUDES_SYS_XATTR])dnl + # + tst_links_fsetxattr="unknown" + tst_proto_fsetxattr="unknown" + tst_compi_fsetxattr="unknown" + tst_allow_fsetxattr="unknown" + tst_nargs_fsetxattr="unknown" + # + AC_MSG_CHECKING([if fsetxattr can be linked]) + AC_LINK_IFELSE([ + AC_LANG_FUNC_LINK_TRY([fsetxattr]) + ],[ + AC_MSG_RESULT([yes]) + tst_links_fsetxattr="yes" + ],[ + AC_MSG_RESULT([no]) + tst_links_fsetxattr="no" + ]) + # + if test "$tst_links_fsetxattr" = "yes"; then + AC_MSG_CHECKING([if fsetxattr is prototyped]) + AC_EGREP_CPP([fsetxattr],[ + $curl_includes_sys_xattr + ],[ + AC_MSG_RESULT([yes]) + tst_proto_fsetxattr="yes" + ],[ + AC_MSG_RESULT([no]) + tst_proto_fsetxattr="no" + ]) + fi + # + if test "$tst_proto_fsetxattr" = "yes"; then + if test "$tst_nargs_fsetxattr" = "unknown"; then + AC_MSG_CHECKING([if fsetxattr takes 5 args.]) + AC_COMPILE_IFELSE([ + AC_LANG_PROGRAM([[ + $curl_includes_sys_xattr + ]],[[ + if(0 != fsetxattr(0, 0, 0, 0, 0)) + return 1; + ]]) + ],[ + AC_MSG_RESULT([yes]) + tst_compi_fsetxattr="yes" + tst_nargs_fsetxattr="5" + ],[ + AC_MSG_RESULT([no]) + tst_compi_fsetxattr="no" + ]) + fi + if test "$tst_nargs_fsetxattr" = "unknown"; then + AC_MSG_CHECKING([if fsetxattr takes 6 args.]) + AC_COMPILE_IFELSE([ + AC_LANG_PROGRAM([[ + $curl_includes_sys_xattr + ]],[[ + if(0 != fsetxattr(0, 0, 0, 0, 0, 0)) + return 1; + ]]) + ],[ + AC_MSG_RESULT([yes]) + tst_compi_fsetxattr="yes" + tst_nargs_fsetxattr="6" + ],[ + AC_MSG_RESULT([no]) + tst_compi_fsetxattr="no" + ]) + fi + AC_MSG_CHECKING([if fsetxattr is compilable]) + if test "$tst_compi_fsetxattr" = "yes"; then + AC_MSG_RESULT([yes]) + else + AC_MSG_RESULT([no]) + fi + fi + # + if test "$tst_compi_fsetxattr" = "yes"; then + AC_MSG_CHECKING([if fsetxattr usage allowed]) + if test "x$curl_disallow_fsetxattr" != "xyes"; then + AC_MSG_RESULT([yes]) + tst_allow_fsetxattr="yes" + else + AC_MSG_RESULT([no]) + tst_allow_fsetxattr="no" + fi + fi + # + AC_MSG_CHECKING([if fsetxattr might be used]) + if test "$tst_links_fsetxattr" = "yes" && + test "$tst_proto_fsetxattr" = "yes" && + test "$tst_compi_fsetxattr" = "yes" && + test "$tst_allow_fsetxattr" = "yes"; then + AC_MSG_RESULT([yes]) + AC_DEFINE_UNQUOTED(HAVE_FSETXATTR, 1, + [Define to 1 if you have the fsetxattr function.]) + dnl AC_DEFINE_UNQUOTED(FSETXATTR_ARGS, $tst_nargs_fsetxattr, + dnl [Specifies the number of arguments to fsetxattr]) + # + if test "$tst_nargs_fsetxattr" -eq "5"; then + AC_DEFINE(HAVE_FSETXATTR_5, 1, [fsetxattr() takes 5 args]) + elif test "$tst_nargs_fsetxattr" -eq "6"; then + AC_DEFINE(HAVE_FSETXATTR_6, 1, [fsetxattr() takes 6 args]) + fi + # + ac_cv_func_fsetxattr="yes" + else + AC_MSG_RESULT([no]) + ac_cv_func_fsetxattr="no" + fi +]) + + +dnl CURL_CHECK_FUNC_FTRUNCATE +dnl ------------------------------------------------- +dnl Verify if ftruncate is available, prototyped, and +dnl can be compiled. If all of these are true, and +dnl usage has not been previously disallowed with +dnl shell variable curl_disallow_ftruncate, then +dnl HAVE_FTRUNCATE will be defined. + +AC_DEFUN([CURL_CHECK_FUNC_FTRUNCATE], [ + AC_REQUIRE([CURL_INCLUDES_UNISTD])dnl + # + tst_links_ftruncate="unknown" + tst_proto_ftruncate="unknown" + tst_compi_ftruncate="unknown" + tst_allow_ftruncate="unknown" + # + AC_MSG_CHECKING([if ftruncate can be linked]) + AC_LINK_IFELSE([ + AC_LANG_FUNC_LINK_TRY([ftruncate]) + ],[ + AC_MSG_RESULT([yes]) + tst_links_ftruncate="yes" + ],[ + AC_MSG_RESULT([no]) + tst_links_ftruncate="no" + ]) + # + if test "$tst_links_ftruncate" = "yes"; then + AC_MSG_CHECKING([if ftruncate is prototyped]) + AC_EGREP_CPP([ftruncate],[ + $curl_includes_unistd + ],[ + AC_MSG_RESULT([yes]) + tst_proto_ftruncate="yes" + ],[ + AC_MSG_RESULT([no]) + tst_proto_ftruncate="no" + ]) + fi + # + if test "$tst_proto_ftruncate" = "yes"; then + AC_MSG_CHECKING([if ftruncate is compilable]) + AC_COMPILE_IFELSE([ + AC_LANG_PROGRAM([[ + $curl_includes_unistd + ]],[[ + if(0 != ftruncate(0, 0)) + return 1; + ]]) + ],[ + AC_MSG_RESULT([yes]) + tst_compi_ftruncate="yes" + ],[ + AC_MSG_RESULT([no]) + tst_compi_ftruncate="no" + ]) + fi + # + if test "$tst_compi_ftruncate" = "yes"; then + AC_MSG_CHECKING([if ftruncate usage allowed]) + if test "x$curl_disallow_ftruncate" != "xyes"; then + AC_MSG_RESULT([yes]) + tst_allow_ftruncate="yes" + else + AC_MSG_RESULT([no]) + tst_allow_ftruncate="no" + fi + fi + # + AC_MSG_CHECKING([if ftruncate might be used]) + if test "$tst_links_ftruncate" = "yes" && + test "$tst_proto_ftruncate" = "yes" && + test "$tst_compi_ftruncate" = "yes" && + test "$tst_allow_ftruncate" = "yes"; then + AC_MSG_RESULT([yes]) + AC_DEFINE_UNQUOTED(HAVE_FTRUNCATE, 1, + [Define to 1 if you have the ftruncate function.]) + ac_cv_func_ftruncate="yes" + else + AC_MSG_RESULT([no]) + ac_cv_func_ftruncate="no" + fi +]) + + +dnl CURL_CHECK_FUNC_GETADDRINFO +dnl ------------------------------------------------- +dnl Verify if getaddrinfo is available, prototyped, can +dnl be compiled and seems to work. If all of these are +dnl true, and usage has not been previously disallowed +dnl with shell variable curl_disallow_getaddrinfo, then +dnl HAVE_GETADDRINFO will be defined. Additionally when +dnl HAVE_GETADDRINFO gets defined this will also attempt +dnl to find out if getaddrinfo happens to be threadsafe, +dnl defining HAVE_GETADDRINFO_THREADSAFE when true. + +AC_DEFUN([CURL_CHECK_FUNC_GETADDRINFO], [ + AC_REQUIRE([CURL_INCLUDES_WS2TCPIP])dnl + AC_REQUIRE([CURL_INCLUDES_STDLIB])dnl + AC_REQUIRE([CURL_INCLUDES_STRING])dnl + AC_REQUIRE([CURL_INCLUDES_SYS_SOCKET])dnl + AC_REQUIRE([CURL_INCLUDES_NETDB])dnl + # + tst_links_getaddrinfo="unknown" + tst_proto_getaddrinfo="unknown" + tst_compi_getaddrinfo="unknown" + tst_works_getaddrinfo="unknown" + tst_allow_getaddrinfo="unknown" + tst_tsafe_getaddrinfo="unknown" + # + AC_MSG_CHECKING([if getaddrinfo can be linked]) + AC_LINK_IFELSE([ + AC_LANG_PROGRAM([[ + $curl_includes_ws2tcpip + $curl_includes_sys_socket + $curl_includes_netdb + ]],[[ + if(0 != getaddrinfo(0, 0, 0, 0)) + return 1; + ]]) + ],[ + AC_MSG_RESULT([yes]) + tst_links_getaddrinfo="yes" + ],[ + AC_MSG_RESULT([no]) + tst_links_getaddrinfo="no" + ]) + # + if test "$tst_links_getaddrinfo" = "yes"; then + AC_MSG_CHECKING([if getaddrinfo is prototyped]) + AC_EGREP_CPP([getaddrinfo],[ + $curl_includes_ws2tcpip + $curl_includes_sys_socket + $curl_includes_netdb + ],[ + AC_MSG_RESULT([yes]) + tst_proto_getaddrinfo="yes" + ],[ + AC_MSG_RESULT([no]) + tst_proto_getaddrinfo="no" + ]) + fi + # + if test "$tst_proto_getaddrinfo" = "yes"; then + AC_MSG_CHECKING([if getaddrinfo is compilable]) + AC_COMPILE_IFELSE([ + AC_LANG_PROGRAM([[ + $curl_includes_ws2tcpip + $curl_includes_sys_socket + $curl_includes_netdb + ]],[[ + if(0 != getaddrinfo(0, 0, 0, 0)) + return 1; + ]]) + ],[ + AC_MSG_RESULT([yes]) + tst_compi_getaddrinfo="yes" + ],[ + AC_MSG_RESULT([no]) + tst_compi_getaddrinfo="no" + ]) + fi + # + dnl only do runtime verification when not cross-compiling + if test "x$cross_compiling" != "xyes" && + test "$tst_compi_getaddrinfo" = "yes"; then + AC_MSG_CHECKING([if getaddrinfo seems to work]) + AC_RUN_IFELSE([ + AC_LANG_PROGRAM([[ + $curl_includes_ws2tcpip + $curl_includes_stdlib + $curl_includes_string + $curl_includes_sys_socket + $curl_includes_netdb + ]],[[ + struct addrinfo hints; + struct addrinfo *ai = 0; + int error; + + memset(&hints, 0, sizeof(hints)); + hints.ai_flags = AI_NUMERICHOST; + hints.ai_family = AF_UNSPEC; + hints.ai_socktype = SOCK_STREAM; + error = getaddrinfo("127.0.0.1", 0, &hints, &ai); + if(error || !ai) + exit(1); /* fail */ + else + exit(0); + ]]) + ],[ + AC_MSG_RESULT([yes]) + tst_works_getaddrinfo="yes" + ],[ + AC_MSG_RESULT([no]) + tst_works_getaddrinfo="no" + ]) + fi + # + if test "$tst_compi_getaddrinfo" = "yes" && + test "$tst_works_getaddrinfo" != "no"; then + AC_MSG_CHECKING([if getaddrinfo usage allowed]) + if test "x$curl_disallow_getaddrinfo" != "xyes"; then + AC_MSG_RESULT([yes]) + tst_allow_getaddrinfo="yes" + else + AC_MSG_RESULT([no]) + tst_allow_getaddrinfo="no" + fi + fi + # + AC_MSG_CHECKING([if getaddrinfo might be used]) + if test "$tst_links_getaddrinfo" = "yes" && + test "$tst_proto_getaddrinfo" = "yes" && + test "$tst_compi_getaddrinfo" = "yes" && + test "$tst_allow_getaddrinfo" = "yes" && + test "$tst_works_getaddrinfo" != "no"; then + AC_MSG_RESULT([yes]) + AC_DEFINE_UNQUOTED(HAVE_GETADDRINFO, 1, + [Define to 1 if you have a working getaddrinfo function.]) + ac_cv_func_getaddrinfo="yes" + else + AC_MSG_RESULT([no]) + ac_cv_func_getaddrinfo="no" + ac_cv_func_getaddrinfo_threadsafe="no" + fi + # + if test "$ac_cv_func_getaddrinfo" = "yes"; then + AC_MSG_CHECKING([if getaddrinfo is threadsafe]) + case $host_os in + aix[[1234]].* | aix5.[[01]].*) + dnl aix 5.1 and older + tst_tsafe_getaddrinfo="no" + ;; + aix*) + dnl aix 5.2 and newer + tst_tsafe_getaddrinfo="yes" + ;; + darwin[[12345]].*) + dnl darwin 5.0 and mac os x 10.1.X and older + tst_tsafe_getaddrinfo="no" + ;; + darwin*) + dnl darwin 6.0 and mac os x 10.2.X and newer + tst_tsafe_getaddrinfo="yes" + ;; + freebsd[[1234]].* | freebsd5.[[1234]]*) + dnl freebsd 5.4 and older + tst_tsafe_getaddrinfo="no" + ;; + freebsd*) + dnl freebsd 5.5 and newer + tst_tsafe_getaddrinfo="yes" + ;; + hpux[[123456789]].* | hpux10.* | hpux11.0* | hpux11.10*) + dnl hpux 11.10 and older + tst_tsafe_getaddrinfo="no" + ;; + hpux*) + dnl hpux 11.11 and newer + tst_tsafe_getaddrinfo="yes" + ;; + netbsd[[123]].*) + dnl netbsd 3.X and older + tst_tsafe_getaddrinfo="no" + ;; + netbsd*) + dnl netbsd 4.X and newer + tst_tsafe_getaddrinfo="yes" + ;; + *bsd*) + dnl All other bsd's + tst_tsafe_getaddrinfo="no" + ;; + solaris2*) + dnl solaris which have it + tst_tsafe_getaddrinfo="yes" + ;; + esac + if test "$tst_tsafe_getaddrinfo" = "unknown"; then + CURL_CHECK_DEF_CC([h_errno], [ + $curl_includes_ws2tcpip + $curl_includes_sys_socket + $curl_includes_netdb + ], [silent]) + if test "$curl_cv_have_def_h_errno" = "no"; then + tst_tsafe_getaddrinfo="no" + fi + fi + if test "$tst_tsafe_getaddrinfo" = "unknown"; then + tst_tsafe_getaddrinfo="yes" + fi + AC_MSG_RESULT([$tst_tsafe_getaddrinfo]) + if test "$tst_tsafe_getaddrinfo" = "yes"; then + AC_DEFINE_UNQUOTED(HAVE_GETADDRINFO_THREADSAFE, 1, + [Define to 1 if the getaddrinfo function is threadsafe.]) + ac_cv_func_getaddrinfo_threadsafe="yes" + else + ac_cv_func_getaddrinfo_threadsafe="no" + fi + fi +]) + + +dnl CURL_CHECK_FUNC_GETHOSTBYADDR +dnl ------------------------------------------------- +dnl Verify if gethostbyaddr is available, prototyped, +dnl and can be compiled. If all of these are true, +dnl and usage has not been previously disallowed with +dnl shell variable curl_disallow_gethostbyaddr, then +dnl HAVE_GETHOSTBYADDR will be defined. + +AC_DEFUN([CURL_CHECK_FUNC_GETHOSTBYADDR], [ + AC_REQUIRE([CURL_INCLUDES_WINSOCK2])dnl + AC_REQUIRE([CURL_INCLUDES_NETDB])dnl + # + tst_links_gethostbyaddr="unknown" + tst_proto_gethostbyaddr="unknown" + tst_compi_gethostbyaddr="unknown" + tst_allow_gethostbyaddr="unknown" + # + AC_MSG_CHECKING([if gethostbyaddr can be linked]) + AC_LINK_IFELSE([ + AC_LANG_PROGRAM([[ + $curl_includes_winsock2 + $curl_includes_netdb + ]],[[ + if(0 != gethostbyaddr(0, 0, 0)) + return 1; + ]]) + ],[ + AC_MSG_RESULT([yes]) + tst_links_gethostbyaddr="yes" + ],[ + AC_MSG_RESULT([no]) + tst_links_gethostbyaddr="no" + ]) + # + if test "$tst_links_gethostbyaddr" = "yes"; then + AC_MSG_CHECKING([if gethostbyaddr is prototyped]) + AC_EGREP_CPP([gethostbyaddr],[ + $curl_includes_winsock2 + $curl_includes_netdb + ],[ + AC_MSG_RESULT([yes]) + tst_proto_gethostbyaddr="yes" + ],[ + AC_MSG_RESULT([no]) + tst_proto_gethostbyaddr="no" + ]) + fi + # + if test "$tst_proto_gethostbyaddr" = "yes"; then + AC_MSG_CHECKING([if gethostbyaddr is compilable]) + AC_COMPILE_IFELSE([ + AC_LANG_PROGRAM([[ + $curl_includes_winsock2 + $curl_includes_netdb + ]],[[ + if(0 != gethostbyaddr(0, 0, 0)) + return 1; + ]]) + ],[ + AC_MSG_RESULT([yes]) + tst_compi_gethostbyaddr="yes" + ],[ + AC_MSG_RESULT([no]) + tst_compi_gethostbyaddr="no" + ]) + fi + # + if test "$tst_compi_gethostbyaddr" = "yes"; then + AC_MSG_CHECKING([if gethostbyaddr usage allowed]) + if test "x$curl_disallow_gethostbyaddr" != "xyes"; then + AC_MSG_RESULT([yes]) + tst_allow_gethostbyaddr="yes" + else + AC_MSG_RESULT([no]) + tst_allow_gethostbyaddr="no" + fi + fi + # + AC_MSG_CHECKING([if gethostbyaddr might be used]) + if test "$tst_links_gethostbyaddr" = "yes" && + test "$tst_proto_gethostbyaddr" = "yes" && + test "$tst_compi_gethostbyaddr" = "yes" && + test "$tst_allow_gethostbyaddr" = "yes"; then + AC_MSG_RESULT([yes]) + AC_DEFINE_UNQUOTED(HAVE_GETHOSTBYADDR, 1, + [Define to 1 if you have the gethostbyaddr function.]) + ac_cv_func_gethostbyaddr="yes" + else + AC_MSG_RESULT([no]) + ac_cv_func_gethostbyaddr="no" + fi +]) + + +dnl CURL_CHECK_FUNC_GETHOSTBYADDR_R +dnl ------------------------------------------------- +dnl Verify if gethostbyaddr_r is available, prototyped, +dnl and can be compiled. If all of these are true, and +dnl usage has not been previously disallowed with +dnl shell variable curl_disallow_gethostbyaddr_r, then +dnl HAVE_GETHOSTBYADDR_R will be defined. + +AC_DEFUN([CURL_CHECK_FUNC_GETHOSTBYADDR_R], [ + AC_REQUIRE([CURL_INCLUDES_NETDB])dnl + # + tst_links_gethostbyaddr_r="unknown" + tst_proto_gethostbyaddr_r="unknown" + tst_compi_gethostbyaddr_r="unknown" + tst_allow_gethostbyaddr_r="unknown" + tst_nargs_gethostbyaddr_r="unknown" + # + AC_MSG_CHECKING([if gethostbyaddr_r can be linked]) + AC_LINK_IFELSE([ + AC_LANG_FUNC_LINK_TRY([gethostbyaddr_r]) + ],[ + AC_MSG_RESULT([yes]) + tst_links_gethostbyaddr_r="yes" + ],[ + AC_MSG_RESULT([no]) + tst_links_gethostbyaddr_r="no" + ]) + # + if test "$tst_links_gethostbyaddr_r" = "yes"; then + AC_MSG_CHECKING([if gethostbyaddr_r is prototyped]) + AC_EGREP_CPP([gethostbyaddr_r],[ + $curl_includes_netdb + ],[ + AC_MSG_RESULT([yes]) + tst_proto_gethostbyaddr_r="yes" + ],[ + AC_MSG_RESULT([no]) + tst_proto_gethostbyaddr_r="no" + ]) + fi + # + if test "$tst_proto_gethostbyaddr_r" = "yes"; then + if test "$tst_nargs_gethostbyaddr_r" = "unknown"; then + AC_MSG_CHECKING([if gethostbyaddr_r takes 5 args.]) + AC_COMPILE_IFELSE([ + AC_LANG_PROGRAM([[ + $curl_includes_netdb + ]],[[ + if(0 != gethostbyaddr_r(0, 0, 0, 0, 0)) + return 1; + ]]) + ],[ + AC_MSG_RESULT([yes]) + tst_compi_gethostbyaddr_r="yes" + tst_nargs_gethostbyaddr_r="5" + ],[ + AC_MSG_RESULT([no]) + tst_compi_gethostbyaddr_r="no" + ]) + fi + if test "$tst_nargs_gethostbyaddr_r" = "unknown"; then + AC_MSG_CHECKING([if gethostbyaddr_r takes 7 args.]) + AC_COMPILE_IFELSE([ + AC_LANG_PROGRAM([[ + $curl_includes_netdb + ]],[[ + if(0 != gethostbyaddr_r(0, 0, 0, 0, 0, 0, 0)) + return 1; + ]]) + ],[ + AC_MSG_RESULT([yes]) + tst_compi_gethostbyaddr_r="yes" + tst_nargs_gethostbyaddr_r="7" + ],[ + AC_MSG_RESULT([no]) + tst_compi_gethostbyaddr_r="no" + ]) + fi + if test "$tst_nargs_gethostbyaddr_r" = "unknown"; then + AC_MSG_CHECKING([if gethostbyaddr_r takes 8 args.]) + AC_COMPILE_IFELSE([ + AC_LANG_PROGRAM([[ + $curl_includes_netdb + ]],[[ + if(0 != gethostbyaddr_r(0, 0, 0, 0, 0, 0, 0, 0)) + return 1; + ]]) + ],[ + AC_MSG_RESULT([yes]) + tst_compi_gethostbyaddr_r="yes" + tst_nargs_gethostbyaddr_r="8" + ],[ + AC_MSG_RESULT([no]) + tst_compi_gethostbyaddr_r="no" + ]) + fi + AC_MSG_CHECKING([if gethostbyaddr_r is compilable]) + if test "$tst_compi_gethostbyaddr_r" = "yes"; then + AC_MSG_RESULT([yes]) + else + AC_MSG_RESULT([no]) + fi + fi + # + if test "$tst_compi_gethostbyaddr_r" = "yes"; then + AC_MSG_CHECKING([if gethostbyaddr_r usage allowed]) + if test "x$curl_disallow_gethostbyaddr_r" != "xyes"; then + AC_MSG_RESULT([yes]) + tst_allow_gethostbyaddr_r="yes" + else + AC_MSG_RESULT([no]) + tst_allow_gethostbyaddr_r="no" + fi + fi + # + AC_MSG_CHECKING([if gethostbyaddr_r might be used]) + if test "$tst_links_gethostbyaddr_r" = "yes" && + test "$tst_proto_gethostbyaddr_r" = "yes" && + test "$tst_compi_gethostbyaddr_r" = "yes" && + test "$tst_allow_gethostbyaddr_r" = "yes"; then + AC_MSG_RESULT([yes]) + AC_DEFINE_UNQUOTED(HAVE_GETHOSTBYADDR_R, 1, + [Define to 1 if you have the gethostbyaddr_r function.]) + dnl AC_DEFINE_UNQUOTED(GETHOSTBYADDR_R_ARGS, $tst_nargs_gethostbyaddr_r, + dnl [Specifies the number of arguments to gethostbyaddr_r]) + # + if test "$tst_nargs_gethostbyaddr_r" -eq "5"; then + AC_DEFINE(HAVE_GETHOSTBYADDR_R_5, 1, [gethostbyaddr_r() takes 5 args]) + elif test "$tst_nargs_gethostbyaddr_r" -eq "7"; then + AC_DEFINE(HAVE_GETHOSTBYADDR_R_7, 1, [gethostbyaddr_r() takes 7 args]) + elif test "$tst_nargs_gethostbyaddr_r" -eq "8"; then + AC_DEFINE(HAVE_GETHOSTBYADDR_R_8, 1, [gethostbyaddr_r() takes 8 args]) + fi + # + ac_cv_func_gethostbyaddr_r="yes" + else + AC_MSG_RESULT([no]) + ac_cv_func_gethostbyaddr_r="no" + fi +]) + + +dnl CURL_CHECK_FUNC_GETHOSTBYNAME +dnl ------------------------------------------------- +dnl Verify if gethostbyname is available, prototyped, +dnl and can be compiled. If all of these are true, +dnl and usage has not been previously disallowed with +dnl shell variable curl_disallow_gethostbyname, then +dnl HAVE_GETHOSTBYNAME will be defined. + +AC_DEFUN([CURL_CHECK_FUNC_GETHOSTBYNAME], [ + AC_REQUIRE([CURL_INCLUDES_WINSOCK2])dnl + AC_REQUIRE([CURL_INCLUDES_NETDB])dnl + # + tst_links_gethostbyname="unknown" + tst_proto_gethostbyname="unknown" + tst_compi_gethostbyname="unknown" + tst_allow_gethostbyname="unknown" + # + AC_MSG_CHECKING([if gethostbyname can be linked]) + AC_LINK_IFELSE([ + AC_LANG_PROGRAM([[ + $curl_includes_winsock2 + $curl_includes_netdb + ]],[[ + if(0 != gethostbyname(0)) + return 1; + ]]) + ],[ + AC_MSG_RESULT([yes]) + tst_links_gethostbyname="yes" + ],[ + AC_MSG_RESULT([no]) + tst_links_gethostbyname="no" + ]) + # + if test "$tst_links_gethostbyname" = "yes"; then + AC_MSG_CHECKING([if gethostbyname is prototyped]) + AC_EGREP_CPP([gethostbyname],[ + $curl_includes_winsock2 + $curl_includes_netdb + ],[ + AC_MSG_RESULT([yes]) + tst_proto_gethostbyname="yes" + ],[ + AC_MSG_RESULT([no]) + tst_proto_gethostbyname="no" + ]) + fi + # + if test "$tst_proto_gethostbyname" = "yes"; then + AC_MSG_CHECKING([if gethostbyname is compilable]) + AC_COMPILE_IFELSE([ + AC_LANG_PROGRAM([[ + $curl_includes_winsock2 + $curl_includes_netdb + ]],[[ + if(0 != gethostbyname(0)) + return 1; + ]]) + ],[ + AC_MSG_RESULT([yes]) + tst_compi_gethostbyname="yes" + ],[ + AC_MSG_RESULT([no]) + tst_compi_gethostbyname="no" + ]) + fi + # + if test "$tst_compi_gethostbyname" = "yes"; then + AC_MSG_CHECKING([if gethostbyname usage allowed]) + if test "x$curl_disallow_gethostbyname" != "xyes"; then + AC_MSG_RESULT([yes]) + tst_allow_gethostbyname="yes" + else + AC_MSG_RESULT([no]) + tst_allow_gethostbyname="no" + fi + fi + # + AC_MSG_CHECKING([if gethostbyname might be used]) + if test "$tst_links_gethostbyname" = "yes" && + test "$tst_proto_gethostbyname" = "yes" && + test "$tst_compi_gethostbyname" = "yes" && + test "$tst_allow_gethostbyname" = "yes"; then + AC_MSG_RESULT([yes]) + AC_DEFINE_UNQUOTED(HAVE_GETHOSTBYNAME, 1, + [Define to 1 if you have the gethostbyname function.]) + ac_cv_func_gethostbyname="yes" + else + AC_MSG_RESULT([no]) + ac_cv_func_gethostbyname="no" + fi +]) + + +dnl CURL_CHECK_FUNC_GETHOSTBYNAME_R +dnl ------------------------------------------------- +dnl Verify if gethostbyname_r is available, prototyped, +dnl and can be compiled. If all of these are true, and +dnl usage has not been previously disallowed with +dnl shell variable curl_disallow_gethostbyname_r, then +dnl HAVE_GETHOSTBYNAME_R will be defined. + +AC_DEFUN([CURL_CHECK_FUNC_GETHOSTBYNAME_R], [ + AC_REQUIRE([CURL_INCLUDES_NETDB])dnl + # + tst_links_gethostbyname_r="unknown" + tst_proto_gethostbyname_r="unknown" + tst_compi_gethostbyname_r="unknown" + tst_allow_gethostbyname_r="unknown" + tst_nargs_gethostbyname_r="unknown" + # + AC_MSG_CHECKING([if gethostbyname_r can be linked]) + AC_LINK_IFELSE([ + AC_LANG_FUNC_LINK_TRY([gethostbyname_r]) + ],[ + AC_MSG_RESULT([yes]) + tst_links_gethostbyname_r="yes" + ],[ + AC_MSG_RESULT([no]) + tst_links_gethostbyname_r="no" + ]) + # + if test "$tst_links_gethostbyname_r" = "yes"; then + AC_MSG_CHECKING([if gethostbyname_r is prototyped]) + AC_EGREP_CPP([gethostbyname_r],[ + $curl_includes_netdb + ],[ + AC_MSG_RESULT([yes]) + tst_proto_gethostbyname_r="yes" + ],[ + AC_MSG_RESULT([no]) + tst_proto_gethostbyname_r="no" + ]) + fi + # + if test "$tst_proto_gethostbyname_r" = "yes"; then + if test "$tst_nargs_gethostbyname_r" = "unknown"; then + AC_MSG_CHECKING([if gethostbyname_r takes 3 args.]) + AC_COMPILE_IFELSE([ + AC_LANG_PROGRAM([[ + $curl_includes_netdb + ]],[[ + if(0 != gethostbyname_r(0, 0, 0)) + return 1; + ]]) + ],[ + AC_MSG_RESULT([yes]) + tst_compi_gethostbyname_r="yes" + tst_nargs_gethostbyname_r="3" + ],[ + AC_MSG_RESULT([no]) + tst_compi_gethostbyname_r="no" + ]) + fi + if test "$tst_nargs_gethostbyname_r" = "unknown"; then + AC_MSG_CHECKING([if gethostbyname_r takes 5 args.]) + AC_COMPILE_IFELSE([ + AC_LANG_PROGRAM([[ + $curl_includes_netdb + ]],[[ + if(0 != gethostbyname_r(0, 0, 0, 0, 0)) + return 1; + ]]) + ],[ + AC_MSG_RESULT([yes]) + tst_compi_gethostbyname_r="yes" + tst_nargs_gethostbyname_r="5" + ],[ + AC_MSG_RESULT([no]) + tst_compi_gethostbyname_r="no" + ]) + fi + if test "$tst_nargs_gethostbyname_r" = "unknown"; then + AC_MSG_CHECKING([if gethostbyname_r takes 6 args.]) + AC_COMPILE_IFELSE([ + AC_LANG_PROGRAM([[ + $curl_includes_netdb + ]],[[ + if(0 != gethostbyname_r(0, 0, 0, 0, 0, 0)) + return 1; + ]]) + ],[ + AC_MSG_RESULT([yes]) + tst_compi_gethostbyname_r="yes" + tst_nargs_gethostbyname_r="6" + ],[ + AC_MSG_RESULT([no]) + tst_compi_gethostbyname_r="no" + ]) + fi + AC_MSG_CHECKING([if gethostbyname_r is compilable]) + if test "$tst_compi_gethostbyname_r" = "yes"; then + AC_MSG_RESULT([yes]) + else + AC_MSG_RESULT([no]) + fi + fi + # + if test "$tst_compi_gethostbyname_r" = "yes"; then + AC_MSG_CHECKING([if gethostbyname_r usage allowed]) + if test "x$curl_disallow_gethostbyname_r" != "xyes"; then + AC_MSG_RESULT([yes]) + tst_allow_gethostbyname_r="yes" + else + AC_MSG_RESULT([no]) + tst_allow_gethostbyname_r="no" + fi + fi + # + AC_MSG_CHECKING([if gethostbyname_r might be used]) + if test "$tst_links_gethostbyname_r" = "yes" && + test "$tst_proto_gethostbyname_r" = "yes" && + test "$tst_compi_gethostbyname_r" = "yes" && + test "$tst_allow_gethostbyname_r" = "yes"; then + AC_MSG_RESULT([yes]) + AC_DEFINE_UNQUOTED(HAVE_GETHOSTBYNAME_R, 1, + [Define to 1 if you have the gethostbyname_r function.]) + dnl AC_DEFINE_UNQUOTED(GETHOSTBYNAME_R_ARGS, $tst_nargs_gethostbyname_r, + dnl [Specifies the number of arguments to gethostbyname_r]) + # + if test "$tst_nargs_gethostbyname_r" -eq "3"; then + AC_DEFINE(HAVE_GETHOSTBYNAME_R_3, 1, [gethostbyname_r() takes 3 args]) + elif test "$tst_nargs_gethostbyname_r" -eq "5"; then + AC_DEFINE(HAVE_GETHOSTBYNAME_R_5, 1, [gethostbyname_r() takes 5 args]) + elif test "$tst_nargs_gethostbyname_r" -eq "6"; then + AC_DEFINE(HAVE_GETHOSTBYNAME_R_6, 1, [gethostbyname_r() takes 6 args]) + fi + # + ac_cv_func_gethostbyname_r="yes" + else + AC_MSG_RESULT([no]) + ac_cv_func_gethostbyname_r="no" + fi +]) + + +dnl CURL_CHECK_FUNC_GETHOSTNAME +dnl ------------------------------------------------- +dnl Verify if gethostname is available, prototyped, and +dnl can be compiled. If all of these are true, and +dnl usage has not been previously disallowed with +dnl shell variable curl_disallow_gethostname, then +dnl HAVE_GETHOSTNAME will be defined. + +AC_DEFUN([CURL_CHECK_FUNC_GETHOSTNAME], [ + AC_REQUIRE([CURL_INCLUDES_WINSOCK2])dnl + AC_REQUIRE([CURL_INCLUDES_UNISTD])dnl + # + tst_links_gethostname="unknown" + tst_proto_gethostname="unknown" + tst_compi_gethostname="unknown" + tst_allow_gethostname="unknown" + # + AC_MSG_CHECKING([if gethostname can be linked]) + AC_LINK_IFELSE([ + AC_LANG_PROGRAM([[ + $curl_includes_winsock2 + $curl_includes_unistd + ]],[[ + if(0 != gethostname(0, 0)) + return 1; + ]]) + ],[ + AC_MSG_RESULT([yes]) + tst_links_gethostname="yes" + ],[ + AC_MSG_RESULT([no]) + tst_links_gethostname="no" + ]) + # + if test "$tst_links_gethostname" = "yes"; then + AC_MSG_CHECKING([if gethostname is prototyped]) + AC_EGREP_CPP([gethostname],[ + $curl_includes_winsock2 + $curl_includes_unistd + ],[ + AC_MSG_RESULT([yes]) + tst_proto_gethostname="yes" + ],[ + AC_MSG_RESULT([no]) + tst_proto_gethostname="no" + ]) + fi + # + if test "$tst_proto_gethostname" = "yes"; then + AC_MSG_CHECKING([if gethostname is compilable]) + AC_COMPILE_IFELSE([ + AC_LANG_PROGRAM([[ + $curl_includes_winsock2 + $curl_includes_unistd + ]],[[ + if(0 != gethostname(0, 0)) + return 1; + ]]) + ],[ + AC_MSG_RESULT([yes]) + tst_compi_gethostname="yes" + ],[ + AC_MSG_RESULT([no]) + tst_compi_gethostname="no" + ]) + fi + # + if test "$tst_compi_gethostname" = "yes"; then + AC_MSG_CHECKING([if gethostname usage allowed]) + if test "x$curl_disallow_gethostname" != "xyes"; then + AC_MSG_RESULT([yes]) + tst_allow_gethostname="yes" + else + AC_MSG_RESULT([no]) + tst_allow_gethostname="no" + fi + fi + # + AC_MSG_CHECKING([if gethostname might be used]) + if test "$tst_links_gethostname" = "yes" && + test "$tst_proto_gethostname" = "yes" && + test "$tst_compi_gethostname" = "yes" && + test "$tst_allow_gethostname" = "yes"; then + AC_MSG_RESULT([yes]) + AC_DEFINE_UNQUOTED(HAVE_GETHOSTNAME, 1, + [Define to 1 if you have the gethostname function.]) + ac_cv_func_gethostname="yes" + else + AC_MSG_RESULT([no]) + ac_cv_func_gethostname="no" + fi +]) + + +dnl CURL_CHECK_FUNC_GETIFADDRS +dnl ------------------------------------------------- +dnl Verify if getifaddrs is available, prototyped, can +dnl be compiled and seems to work. If all of these are +dnl true, and usage has not been previously disallowed +dnl with shell variable curl_disallow_getifaddrs, then +dnl HAVE_GETIFADDRS will be defined. + +AC_DEFUN([CURL_CHECK_FUNC_GETIFADDRS], [ + AC_REQUIRE([CURL_INCLUDES_STDLIB])dnl + AC_REQUIRE([CURL_INCLUDES_IFADDRS])dnl + # + tst_links_getifaddrs="unknown" + tst_proto_getifaddrs="unknown" + tst_compi_getifaddrs="unknown" + tst_works_getifaddrs="unknown" + tst_allow_getifaddrs="unknown" + # + AC_MSG_CHECKING([if getifaddrs can be linked]) + AC_LINK_IFELSE([ + AC_LANG_FUNC_LINK_TRY([getifaddrs]) + ],[ + AC_MSG_RESULT([yes]) + tst_links_getifaddrs="yes" + ],[ + AC_MSG_RESULT([no]) + tst_links_getifaddrs="no" + ]) + # + if test "$tst_links_getifaddrs" = "yes"; then + AC_MSG_CHECKING([if getifaddrs is prototyped]) + AC_EGREP_CPP([getifaddrs],[ + $curl_includes_ifaddrs + ],[ + AC_MSG_RESULT([yes]) + tst_proto_getifaddrs="yes" + ],[ + AC_MSG_RESULT([no]) + tst_proto_getifaddrs="no" + ]) + fi + # + if test "$tst_proto_getifaddrs" = "yes"; then + AC_MSG_CHECKING([if getifaddrs is compilable]) + AC_COMPILE_IFELSE([ + AC_LANG_PROGRAM([[ + $curl_includes_ifaddrs + ]],[[ + if(0 != getifaddrs(0)) + return 1; + ]]) + ],[ + AC_MSG_RESULT([yes]) + tst_compi_getifaddrs="yes" + ],[ + AC_MSG_RESULT([no]) + tst_compi_getifaddrs="no" + ]) + fi + # + dnl only do runtime verification when not cross-compiling + if test "x$cross_compiling" != "xyes" && + test "$tst_compi_getifaddrs" = "yes"; then + AC_MSG_CHECKING([if getifaddrs seems to work]) + AC_RUN_IFELSE([ + AC_LANG_PROGRAM([[ + $curl_includes_stdlib + $curl_includes_ifaddrs + ]],[[ + struct ifaddrs *ifa = 0; + int error; + + error = getifaddrs(&ifa); + if(error || !ifa) + exit(1); /* fail */ + else + exit(0); + ]]) + ],[ + AC_MSG_RESULT([yes]) + tst_works_getifaddrs="yes" + ],[ + AC_MSG_RESULT([no]) + tst_works_getifaddrs="no" + ]) + fi + # + if test "$tst_compi_getifaddrs" = "yes" && + test "$tst_works_getifaddrs" != "no"; then + AC_MSG_CHECKING([if getifaddrs usage allowed]) + if test "x$curl_disallow_getifaddrs" != "xyes"; then + AC_MSG_RESULT([yes]) + tst_allow_getifaddrs="yes" + else + AC_MSG_RESULT([no]) + tst_allow_getifaddrs="no" + fi + fi + # + AC_MSG_CHECKING([if getifaddrs might be used]) + if test "$tst_links_getifaddrs" = "yes" && + test "$tst_proto_getifaddrs" = "yes" && + test "$tst_compi_getifaddrs" = "yes" && + test "$tst_allow_getifaddrs" = "yes" && + test "$tst_works_getifaddrs" != "no"; then + AC_MSG_RESULT([yes]) + AC_DEFINE_UNQUOTED(HAVE_GETIFADDRS, 1, + [Define to 1 if you have a working getifaddrs function.]) + ac_cv_func_getifaddrs="yes" + else + AC_MSG_RESULT([no]) + ac_cv_func_getifaddrs="no" + fi +]) + + +dnl CURL_CHECK_FUNC_GETSERVBYPORT_R +dnl ------------------------------------------------- +dnl Verify if getservbyport_r is available, prototyped, +dnl and can be compiled. If all of these are true, and +dnl usage has not been previously disallowed with +dnl shell variable curl_disallow_getservbyport_r, then +dnl HAVE_GETSERVBYPORT_R will be defined. + +AC_DEFUN([CURL_CHECK_FUNC_GETSERVBYPORT_R], [ + AC_REQUIRE([CURL_INCLUDES_NETDB])dnl + # + tst_links_getservbyport_r="unknown" + tst_proto_getservbyport_r="unknown" + tst_compi_getservbyport_r="unknown" + tst_allow_getservbyport_r="unknown" + tst_nargs_getservbyport_r="unknown" + # + AC_MSG_CHECKING([if getservbyport_r can be linked]) + AC_LINK_IFELSE([ + AC_LANG_FUNC_LINK_TRY([getservbyport_r]) + ],[ + AC_MSG_RESULT([yes]) + tst_links_getservbyport_r="yes" + ],[ + AC_MSG_RESULT([no]) + tst_links_getservbyport_r="no" + ]) + # + if test "$tst_links_getservbyport_r" = "yes"; then + AC_MSG_CHECKING([if getservbyport_r is prototyped]) + AC_EGREP_CPP([getservbyport_r],[ + $curl_includes_netdb + ],[ + AC_MSG_RESULT([yes]) + tst_proto_getservbyport_r="yes" + ],[ + AC_MSG_RESULT([no]) + tst_proto_getservbyport_r="no" + ]) + fi + # + if test "$tst_proto_getservbyport_r" = "yes"; then + if test "$tst_nargs_getservbyport_r" = "unknown"; then + AC_MSG_CHECKING([if getservbyport_r takes 4 args.]) + AC_COMPILE_IFELSE([ + AC_LANG_PROGRAM([[ + $curl_includes_netdb + ]],[[ + if(0 != getservbyport_r(0, 0, 0, 0)) + return 1; + ]]) + ],[ + AC_MSG_RESULT([yes]) + tst_compi_getservbyport_r="yes" + tst_nargs_getservbyport_r="4" + ],[ + AC_MSG_RESULT([no]) + tst_compi_getservbyport_r="no" + ]) + fi + if test "$tst_nargs_getservbyport_r" = "unknown"; then + AC_MSG_CHECKING([if getservbyport_r takes 5 args.]) + AC_COMPILE_IFELSE([ + AC_LANG_PROGRAM([[ + $curl_includes_netdb + ]],[[ + if(0 != getservbyport_r(0, 0, 0, 0, 0)) + return 1; + ]]) + ],[ + AC_MSG_RESULT([yes]) + tst_compi_getservbyport_r="yes" + tst_nargs_getservbyport_r="5" + ],[ + AC_MSG_RESULT([no]) + tst_compi_getservbyport_r="no" + ]) + fi + if test "$tst_nargs_getservbyport_r" = "unknown"; then + AC_MSG_CHECKING([if getservbyport_r takes 6 args.]) + AC_COMPILE_IFELSE([ + AC_LANG_PROGRAM([[ + $curl_includes_netdb + ]],[[ + if(0 != getservbyport_r(0, 0, 0, 0, 0, 0)) + return 1; + ]]) + ],[ + AC_MSG_RESULT([yes]) + tst_compi_getservbyport_r="yes" + tst_nargs_getservbyport_r="6" + ],[ + AC_MSG_RESULT([no]) + tst_compi_getservbyport_r="no" + ]) + fi + AC_MSG_CHECKING([if getservbyport_r is compilable]) + if test "$tst_compi_getservbyport_r" = "yes"; then + AC_MSG_RESULT([yes]) + else + AC_MSG_RESULT([no]) + fi + fi + # + if test "$tst_compi_getservbyport_r" = "yes"; then + AC_MSG_CHECKING([if getservbyport_r usage allowed]) + if test "x$curl_disallow_getservbyport_r" != "xyes"; then + AC_MSG_RESULT([yes]) + tst_allow_getservbyport_r="yes" + else + AC_MSG_RESULT([no]) + tst_allow_getservbyport_r="no" + fi + fi + # + AC_MSG_CHECKING([if getservbyport_r might be used]) + if test "$tst_links_getservbyport_r" = "yes" && + test "$tst_proto_getservbyport_r" = "yes" && + test "$tst_compi_getservbyport_r" = "yes" && + test "$tst_allow_getservbyport_r" = "yes"; then + AC_MSG_RESULT([yes]) + AC_DEFINE_UNQUOTED(HAVE_GETSERVBYPORT_R, 1, + [Define to 1 if you have the getservbyport_r function.]) + AC_DEFINE_UNQUOTED(GETSERVBYPORT_R_ARGS, $tst_nargs_getservbyport_r, + [Specifies the number of arguments to getservbyport_r]) + if test "$tst_nargs_getservbyport_r" -eq "4"; then + AC_DEFINE(GETSERVBYPORT_R_BUFSIZE, sizeof(struct servent_data), + [Specifies the size of the buffer to pass to getservbyport_r]) + else + AC_DEFINE(GETSERVBYPORT_R_BUFSIZE, 4096, + [Specifies the size of the buffer to pass to getservbyport_r]) + fi + ac_cv_func_getservbyport_r="yes" + else + AC_MSG_RESULT([no]) + ac_cv_func_getservbyport_r="no" + fi +]) + + +dnl CURL_CHECK_FUNC_GETXATTR +dnl ------------------------------------------------- +dnl Verify if getxattr is available, prototyped, and +dnl can be compiled. If all of these are true, and +dnl usage has not been previously disallowed with +dnl shell variable curl_disallow_getxattr, then +dnl HAVE_GETXATTR will be defined. + +AC_DEFUN([CURL_CHECK_FUNC_GETXATTR], [ + AC_REQUIRE([CURL_INCLUDES_SYS_XATTR])dnl + # + tst_links_getxattr="unknown" + tst_proto_getxattr="unknown" + tst_compi_getxattr="unknown" + tst_allow_getxattr="unknown" + tst_nargs_getxattr="unknown" + # + AC_MSG_CHECKING([if getxattr can be linked]) + AC_LINK_IFELSE([ + AC_LANG_FUNC_LINK_TRY([getxattr]) + ],[ + AC_MSG_RESULT([yes]) + tst_links_getxattr="yes" + ],[ + AC_MSG_RESULT([no]) + tst_links_getxattr="no" + ]) + # + if test "$tst_links_getxattr" = "yes"; then + AC_MSG_CHECKING([if getxattr is prototyped]) + AC_EGREP_CPP([getxattr],[ + $curl_includes_sys_xattr + ],[ + AC_MSG_RESULT([yes]) + tst_proto_getxattr="yes" + ],[ + AC_MSG_RESULT([no]) + tst_proto_getxattr="no" + ]) + fi + # + if test "$tst_proto_getxattr" = "yes"; then + if test "$tst_nargs_getxattr" = "unknown"; then + AC_MSG_CHECKING([if getxattr takes 4 args.]) + AC_COMPILE_IFELSE([ + AC_LANG_PROGRAM([[ + $curl_includes_sys_xattr + ]],[[ + if(0 != getxattr(0, 0, 0, 0)) + return 1; + ]]) + ],[ + AC_MSG_RESULT([yes]) + tst_compi_getxattr="yes" + tst_nargs_getxattr="4" + ],[ + AC_MSG_RESULT([no]) + tst_compi_getxattr="no" + ]) + fi + if test "$tst_nargs_getxattr" = "unknown"; then + AC_MSG_CHECKING([if getxattr takes 6 args.]) + AC_COMPILE_IFELSE([ + AC_LANG_PROGRAM([[ + $curl_includes_sys_xattr + ]],[[ + if(0 != getxattr(0, 0, 0, 0, 0, 0)) + return 1; + ]]) + ],[ + AC_MSG_RESULT([yes]) + tst_compi_getxattr="yes" + tst_nargs_getxattr="6" + ],[ + AC_MSG_RESULT([no]) + tst_compi_getxattr="no" + ]) + fi + AC_MSG_CHECKING([if getxattr is compilable]) + if test "$tst_compi_getxattr" = "yes"; then + AC_MSG_RESULT([yes]) + else + AC_MSG_RESULT([no]) + fi + fi + # + if test "$tst_compi_getxattr" = "yes"; then + AC_MSG_CHECKING([if getxattr usage allowed]) + if test "x$curl_disallow_getxattr" != "xyes"; then + AC_MSG_RESULT([yes]) + tst_allow_getxattr="yes" + else + AC_MSG_RESULT([no]) + tst_allow_getxattr="no" + fi + fi + # + AC_MSG_CHECKING([if getxattr might be used]) + if test "$tst_links_getxattr" = "yes" && + test "$tst_proto_getxattr" = "yes" && + test "$tst_compi_getxattr" = "yes" && + test "$tst_allow_getxattr" = "yes"; then + AC_MSG_RESULT([yes]) + AC_DEFINE_UNQUOTED(HAVE_GETXATTR, 1, + [Define to 1 if you have the getxattr function.]) + dnl AC_DEFINE_UNQUOTED(GETXATTR_ARGS, $tst_nargs_getxattr, + dnl [Specifies the number of arguments to getxattr]) + # + if test "$tst_nargs_getxattr" -eq "4"; then + AC_DEFINE(HAVE_GETXATTR_4, 1, [getxattr() takes 4 args]) + elif test "$tst_nargs_getxattr" -eq "6"; then + AC_DEFINE(HAVE_GETXATTR_6, 1, [getxattr() takes 6 args]) + fi + # + ac_cv_func_getxattr="yes" + else + AC_MSG_RESULT([no]) + ac_cv_func_getxattr="no" + fi +]) + + +dnl CURL_CHECK_FUNC_GMTIME_R +dnl ------------------------------------------------- +dnl Verify if gmtime_r is available, prototyped, can +dnl be compiled and seems to work. If all of these are +dnl true, and usage has not been previously disallowed +dnl with shell variable curl_disallow_gmtime_r, then +dnl HAVE_GMTIME_R will be defined. + +AC_DEFUN([CURL_CHECK_FUNC_GMTIME_R], [ + AC_REQUIRE([CURL_INCLUDES_STDLIB])dnl + AC_REQUIRE([CURL_INCLUDES_TIME])dnl + # + tst_links_gmtime_r="unknown" + tst_proto_gmtime_r="unknown" + tst_compi_gmtime_r="unknown" + tst_works_gmtime_r="unknown" + tst_allow_gmtime_r="unknown" + # + AC_MSG_CHECKING([if gmtime_r can be linked]) + AC_LINK_IFELSE([ + AC_LANG_FUNC_LINK_TRY([gmtime_r]) + ],[ + AC_MSG_RESULT([yes]) + tst_links_gmtime_r="yes" + ],[ + AC_MSG_RESULT([no]) + tst_links_gmtime_r="no" + ]) + # + if test "$tst_links_gmtime_r" = "yes"; then + AC_MSG_CHECKING([if gmtime_r is prototyped]) + AC_EGREP_CPP([gmtime_r],[ + $curl_includes_time + ],[ + AC_MSG_RESULT([yes]) + tst_proto_gmtime_r="yes" + ],[ + AC_MSG_RESULT([no]) + tst_proto_gmtime_r="no" + ]) + fi + # + if test "$tst_proto_gmtime_r" = "yes"; then + AC_MSG_CHECKING([if gmtime_r is compilable]) + AC_COMPILE_IFELSE([ + AC_LANG_PROGRAM([[ + $curl_includes_time + ]],[[ + if(0 != gmtime_r(0, 0)) + return 1; + ]]) + ],[ + AC_MSG_RESULT([yes]) + tst_compi_gmtime_r="yes" + ],[ + AC_MSG_RESULT([no]) + tst_compi_gmtime_r="no" + ]) + fi + # + dnl only do runtime verification when not cross-compiling + if test "x$cross_compiling" != "xyes" && + test "$tst_compi_gmtime_r" = "yes"; then + AC_MSG_CHECKING([if gmtime_r seems to work]) + AC_RUN_IFELSE([ + AC_LANG_PROGRAM([[ + $curl_includes_stdlib + $curl_includes_time + ]],[[ + time_t local = 1170352587; + struct tm *gmt = 0; + struct tm result; + gmt = gmtime_r(&local, &result); + if(gmt) + exit(0); + else + exit(1); + ]]) + ],[ + AC_MSG_RESULT([yes]) + tst_works_gmtime_r="yes" + ],[ + AC_MSG_RESULT([no]) + tst_works_gmtime_r="no" + ]) + fi + # + if test "$tst_compi_gmtime_r" = "yes" && + test "$tst_works_gmtime_r" != "no"; then + AC_MSG_CHECKING([if gmtime_r usage allowed]) + if test "x$curl_disallow_gmtime_r" != "xyes"; then + AC_MSG_RESULT([yes]) + tst_allow_gmtime_r="yes" + else + AC_MSG_RESULT([no]) + tst_allow_gmtime_r="no" + fi + fi + # + AC_MSG_CHECKING([if gmtime_r might be used]) + if test "$tst_links_gmtime_r" = "yes" && + test "$tst_proto_gmtime_r" = "yes" && + test "$tst_compi_gmtime_r" = "yes" && + test "$tst_allow_gmtime_r" = "yes" && + test "$tst_works_gmtime_r" != "no"; then + AC_MSG_RESULT([yes]) + AC_DEFINE_UNQUOTED(HAVE_GMTIME_R, 1, + [Define to 1 if you have a working gmtime_r function.]) + ac_cv_func_gmtime_r="yes" + else + AC_MSG_RESULT([no]) + ac_cv_func_gmtime_r="no" + fi +]) + + +dnl CURL_CHECK_FUNC_INET_NTOA_R +dnl ------------------------------------------------- +dnl Verify if inet_ntoa_r is available, prototyped, +dnl and can be compiled. If all of these are true, and +dnl usage has not been previously disallowed with +dnl shell variable curl_disallow_inet_ntoa_r, then +dnl HAVE_INET_NTOA_R will be defined. + +AC_DEFUN([CURL_CHECK_FUNC_INET_NTOA_R], [ + AC_REQUIRE([CURL_INCLUDES_ARPA_INET])dnl + # + tst_links_inet_ntoa_r="unknown" + tst_proto_inet_ntoa_r="unknown" + tst_compi_inet_ntoa_r="unknown" + tst_allow_inet_ntoa_r="unknown" + tst_nargs_inet_ntoa_r="unknown" + # + AC_MSG_CHECKING([if inet_ntoa_r can be linked]) + AC_LINK_IFELSE([ + AC_LANG_FUNC_LINK_TRY([inet_ntoa_r]) + ],[ + AC_MSG_RESULT([yes]) + tst_links_inet_ntoa_r="yes" + ],[ + AC_MSG_RESULT([no]) + tst_links_inet_ntoa_r="no" + ]) + # + if test "$tst_links_inet_ntoa_r" = "yes"; then + AC_MSG_CHECKING([if inet_ntoa_r is prototyped]) + AC_EGREP_CPP([inet_ntoa_r],[ + $curl_includes_arpa_inet + ],[ + AC_MSG_RESULT([yes]) + tst_proto_inet_ntoa_r="yes" + ],[ + AC_MSG_RESULT([no]) + tst_proto_inet_ntoa_r="no" + ]) + fi + # + if test "$tst_proto_inet_ntoa_r" = "yes"; then + if test "$tst_nargs_inet_ntoa_r" = "unknown"; then + AC_MSG_CHECKING([if inet_ntoa_r takes 2 args.]) + AC_COMPILE_IFELSE([ + AC_LANG_PROGRAM([[ + $curl_includes_arpa_inet + ]],[[ + struct in_addr addr; + if(0 != inet_ntoa_r(addr, 0)) + return 1; + ]]) + ],[ + AC_MSG_RESULT([yes]) + tst_compi_inet_ntoa_r="yes" + tst_nargs_inet_ntoa_r="2" + ],[ + AC_MSG_RESULT([no]) + tst_compi_inet_ntoa_r="no" + ]) + fi + if test "$tst_nargs_inet_ntoa_r" = "unknown"; then + AC_MSG_CHECKING([if inet_ntoa_r takes 3 args.]) + AC_COMPILE_IFELSE([ + AC_LANG_PROGRAM([[ + $curl_includes_arpa_inet + ]],[[ + struct in_addr addr; + if(0 != inet_ntoa_r(addr, 0, 0)) + return 1; + ]]) + ],[ + AC_MSG_RESULT([yes]) + tst_compi_inet_ntoa_r="yes" + tst_nargs_inet_ntoa_r="3" + ],[ + AC_MSG_RESULT([no]) + tst_compi_inet_ntoa_r="no" + ]) + fi + AC_MSG_CHECKING([if inet_ntoa_r is compilable]) + if test "$tst_compi_inet_ntoa_r" = "yes"; then + AC_MSG_RESULT([yes]) + else + AC_MSG_RESULT([no]) + fi + fi + # + if test "$tst_compi_inet_ntoa_r" = "yes"; then + AC_MSG_CHECKING([if inet_ntoa_r usage allowed]) + if test "x$curl_disallow_inet_ntoa_r" != "xyes"; then + AC_MSG_RESULT([yes]) + tst_allow_inet_ntoa_r="yes" + else + AC_MSG_RESULT([no]) + tst_allow_inet_ntoa_r="no" + fi + fi + # + AC_MSG_CHECKING([if inet_ntoa_r might be used]) + if test "$tst_links_inet_ntoa_r" = "yes" && + test "$tst_proto_inet_ntoa_r" = "yes" && + test "$tst_compi_inet_ntoa_r" = "yes" && + test "$tst_allow_inet_ntoa_r" = "yes"; then + AC_MSG_RESULT([yes]) + AC_DEFINE_UNQUOTED(HAVE_INET_NTOA_R, 1, + [Define to 1 if you have the inet_ntoa_r function.]) + dnl AC_DEFINE_UNQUOTED(INET_NTOA_R_ARGS, $tst_nargs_inet_ntoa_r, + dnl [Specifies the number of arguments to inet_ntoa_r]) + # + if test "$tst_nargs_inet_ntoa_r" -eq "2"; then + AC_DEFINE(HAVE_INET_NTOA_R_2, 1, [inet_ntoa_r() takes 2 args]) + elif test "$tst_nargs_inet_ntoa_r" -eq "3"; then + AC_DEFINE(HAVE_INET_NTOA_R_3, 1, [inet_ntoa_r() takes 3 args]) + fi + # + ac_cv_func_inet_ntoa_r="yes" + else + AC_MSG_RESULT([no]) + ac_cv_func_inet_ntoa_r="no" + fi +]) + + +dnl CURL_CHECK_FUNC_INET_NTOP +dnl ------------------------------------------------- +dnl Verify if inet_ntop is available, prototyped, can +dnl be compiled and seems to work. If all of these are +dnl true, and usage has not been previously disallowed +dnl with shell variable curl_disallow_inet_ntop, then +dnl HAVE_INET_NTOP will be defined. + +AC_DEFUN([CURL_CHECK_FUNC_INET_NTOP], [ + AC_REQUIRE([CURL_INCLUDES_STDLIB])dnl + AC_REQUIRE([CURL_INCLUDES_ARPA_INET])dnl + AC_REQUIRE([CURL_INCLUDES_STRING])dnl + # + tst_links_inet_ntop="unknown" + tst_proto_inet_ntop="unknown" + tst_compi_inet_ntop="unknown" + tst_works_inet_ntop="unknown" + tst_allow_inet_ntop="unknown" + # + AC_MSG_CHECKING([if inet_ntop can be linked]) + AC_LINK_IFELSE([ + AC_LANG_FUNC_LINK_TRY([inet_ntop]) + ],[ + AC_MSG_RESULT([yes]) + tst_links_inet_ntop="yes" + ],[ + AC_MSG_RESULT([no]) + tst_links_inet_ntop="no" + ]) + # + if test "$tst_links_inet_ntop" = "yes"; then + AC_MSG_CHECKING([if inet_ntop is prototyped]) + AC_EGREP_CPP([inet_ntop],[ + $curl_includes_arpa_inet + ],[ + AC_MSG_RESULT([yes]) + tst_proto_inet_ntop="yes" + ],[ + AC_MSG_RESULT([no]) + tst_proto_inet_ntop="no" + ]) + fi + # + if test "$tst_proto_inet_ntop" = "yes"; then + AC_MSG_CHECKING([if inet_ntop is compilable]) + AC_COMPILE_IFELSE([ + AC_LANG_PROGRAM([[ + $curl_includes_arpa_inet + ]],[[ + if(0 != inet_ntop(0, 0, 0, 0)) + return 1; + ]]) + ],[ + AC_MSG_RESULT([yes]) + tst_compi_inet_ntop="yes" + ],[ + AC_MSG_RESULT([no]) + tst_compi_inet_ntop="no" + ]) + fi + # + dnl only do runtime verification when not cross-compiling + if test "x$cross_compiling" != "xyes" && + test "$tst_compi_inet_ntop" = "yes"; then + AC_MSG_CHECKING([if inet_ntop seems to work]) + AC_RUN_IFELSE([ + AC_LANG_PROGRAM([[ + $curl_includes_stdlib + $curl_includes_arpa_inet + $curl_includes_string + ]],[[ + char ipv6res[sizeof("ffff:ffff:ffff:ffff:ffff:ffff:255.255.255.255")]; + char ipv4res[sizeof "255.255.255.255"]; + unsigned char ipv6a[26]; + unsigned char ipv4a[5]; + char *ipv6ptr = 0; + char *ipv4ptr = 0; + /* - */ + ipv4res[0] = '\0'; + ipv4a[0] = 0xc0; + ipv4a[1] = 0xa8; + ipv4a[2] = 0x64; + ipv4a[3] = 0x01; + ipv4a[4] = 0x01; + /* - */ + ipv4ptr = inet_ntop(AF_INET, ipv4a, ipv4res, sizeof(ipv4res)); + if(!ipv4ptr) + exit(1); /* fail */ + if(ipv4ptr != ipv4res) + exit(1); /* fail */ + if(!ipv4ptr[0]) + exit(1); /* fail */ + if(memcmp(ipv4res, "192.168.100.1", 13) != 0) + exit(1); /* fail */ + /* - */ + ipv6res[0] = '\0'; + memset(ipv6a, 0, sizeof(ipv6a)); + ipv6a[0] = 0xfe; + ipv6a[1] = 0x80; + ipv6a[8] = 0x02; + ipv6a[9] = 0x14; + ipv6a[10] = 0x4f; + ipv6a[11] = 0xff; + ipv6a[12] = 0xfe; + ipv6a[13] = 0x0b; + ipv6a[14] = 0x76; + ipv6a[15] = 0xc8; + ipv6a[25] = 0x01; + /* - */ + ipv6ptr = inet_ntop(AF_INET6, ipv6a, ipv6res, sizeof(ipv6res)); + if(!ipv6ptr) + exit(1); /* fail */ + if(ipv6ptr != ipv6res) + exit(1); /* fail */ + if(!ipv6ptr[0]) + exit(1); /* fail */ + if(memcmp(ipv6res, "fe80::214:4fff:fe0b:76c8", 24) != 0) + exit(1); /* fail */ + /* - */ + exit(0); + ]]) + ],[ + AC_MSG_RESULT([yes]) + tst_works_inet_ntop="yes" + ],[ + AC_MSG_RESULT([no]) + tst_works_inet_ntop="no" + ]) + fi + # + if test "$tst_compi_inet_ntop" = "yes" && + test "$tst_works_inet_ntop" != "no"; then + AC_MSG_CHECKING([if inet_ntop usage allowed]) + if test "x$curl_disallow_inet_ntop" != "xyes"; then + AC_MSG_RESULT([yes]) + tst_allow_inet_ntop="yes" + else + AC_MSG_RESULT([no]) + tst_allow_inet_ntop="no" + fi + fi + # + AC_MSG_CHECKING([if inet_ntop might be used]) + if test "$tst_links_inet_ntop" = "yes" && + test "$tst_proto_inet_ntop" = "yes" && + test "$tst_compi_inet_ntop" = "yes" && + test "$tst_allow_inet_ntop" = "yes" && + test "$tst_works_inet_ntop" != "no"; then + AC_MSG_RESULT([yes]) + AC_DEFINE_UNQUOTED(HAVE_INET_NTOP, 1, + [Define to 1 if you have a IPv6 capable working inet_ntop function.]) + ac_cv_func_inet_ntop="yes" + else + AC_MSG_RESULT([no]) + ac_cv_func_inet_ntop="no" + fi +]) + + +dnl CURL_CHECK_FUNC_INET_PTON +dnl ------------------------------------------------- +dnl Verify if inet_pton is available, prototyped, can +dnl be compiled and seems to work. If all of these are +dnl true, and usage has not been previously disallowed +dnl with shell variable curl_disallow_inet_pton, then +dnl HAVE_INET_PTON will be defined. + +AC_DEFUN([CURL_CHECK_FUNC_INET_PTON], [ + AC_REQUIRE([CURL_INCLUDES_STDLIB])dnl + AC_REQUIRE([CURL_INCLUDES_ARPA_INET])dnl + AC_REQUIRE([CURL_INCLUDES_STRING])dnl + # + tst_links_inet_pton="unknown" + tst_proto_inet_pton="unknown" + tst_compi_inet_pton="unknown" + tst_works_inet_pton="unknown" + tst_allow_inet_pton="unknown" + # + AC_MSG_CHECKING([if inet_pton can be linked]) + AC_LINK_IFELSE([ + AC_LANG_FUNC_LINK_TRY([inet_pton]) + ],[ + AC_MSG_RESULT([yes]) + tst_links_inet_pton="yes" + ],[ + AC_MSG_RESULT([no]) + tst_links_inet_pton="no" + ]) + # + if test "$tst_links_inet_pton" = "yes"; then + AC_MSG_CHECKING([if inet_pton is prototyped]) + AC_EGREP_CPP([inet_pton],[ + $curl_includes_arpa_inet + ],[ + AC_MSG_RESULT([yes]) + tst_proto_inet_pton="yes" + ],[ + AC_MSG_RESULT([no]) + tst_proto_inet_pton="no" + ]) + fi + # + if test "$tst_proto_inet_pton" = "yes"; then + AC_MSG_CHECKING([if inet_pton is compilable]) + AC_COMPILE_IFELSE([ + AC_LANG_PROGRAM([[ + $curl_includes_arpa_inet + ]],[[ + if(0 != inet_pton(0, 0, 0)) + return 1; + ]]) + ],[ + AC_MSG_RESULT([yes]) + tst_compi_inet_pton="yes" + ],[ + AC_MSG_RESULT([no]) + tst_compi_inet_pton="no" + ]) + fi + # + dnl only do runtime verification when not cross-compiling + if test "x$cross_compiling" != "xyes" && + test "$tst_compi_inet_pton" = "yes"; then + AC_MSG_CHECKING([if inet_pton seems to work]) + AC_RUN_IFELSE([ + AC_LANG_PROGRAM([[ + $curl_includes_stdlib + $curl_includes_arpa_inet + $curl_includes_string + ]],[[ + unsigned char ipv6a[16+1]; + unsigned char ipv4a[4+1]; + const char *ipv6src = "fe80::214:4fff:fe0b:76c8"; + const char *ipv4src = "192.168.100.1"; + /* - */ + memset(ipv4a, 1, sizeof(ipv4a)); + if(1 != inet_pton(AF_INET, ipv4src, ipv4a)) + exit(1); /* fail */ + /* - */ + if( (ipv4a[0] != 0xc0) || + (ipv4a[1] != 0xa8) || + (ipv4a[2] != 0x64) || + (ipv4a[3] != 0x01) || + (ipv4a[4] != 0x01) ) + exit(1); /* fail */ + /* - */ + memset(ipv6a, 1, sizeof(ipv6a)); + if(1 != inet_pton(AF_INET6, ipv6src, ipv6a)) + exit(1); /* fail */ + /* - */ + if( (ipv6a[0] != 0xfe) || + (ipv6a[1] != 0x80) || + (ipv6a[8] != 0x02) || + (ipv6a[9] != 0x14) || + (ipv6a[10] != 0x4f) || + (ipv6a[11] != 0xff) || + (ipv6a[12] != 0xfe) || + (ipv6a[13] != 0x0b) || + (ipv6a[14] != 0x76) || + (ipv6a[15] != 0xc8) || + (ipv6a[16] != 0x01) ) + exit(1); /* fail */ + /* - */ + if( (ipv6a[2] != 0x0) || + (ipv6a[3] != 0x0) || + (ipv6a[4] != 0x0) || + (ipv6a[5] != 0x0) || + (ipv6a[6] != 0x0) || + (ipv6a[7] != 0x0) ) + exit(1); /* fail */ + /* - */ + exit(0); + ]]) + ],[ + AC_MSG_RESULT([yes]) + tst_works_inet_pton="yes" + ],[ + AC_MSG_RESULT([no]) + tst_works_inet_pton="no" + ]) + fi + # + if test "$tst_compi_inet_pton" = "yes" && + test "$tst_works_inet_pton" != "no"; then + AC_MSG_CHECKING([if inet_pton usage allowed]) + if test "x$curl_disallow_inet_pton" != "xyes"; then + AC_MSG_RESULT([yes]) + tst_allow_inet_pton="yes" + else + AC_MSG_RESULT([no]) + tst_allow_inet_pton="no" + fi + fi + # + AC_MSG_CHECKING([if inet_pton might be used]) + if test "$tst_links_inet_pton" = "yes" && + test "$tst_proto_inet_pton" = "yes" && + test "$tst_compi_inet_pton" = "yes" && + test "$tst_allow_inet_pton" = "yes" && + test "$tst_works_inet_pton" != "no"; then + AC_MSG_RESULT([yes]) + AC_DEFINE_UNQUOTED(HAVE_INET_PTON, 1, + [Define to 1 if you have a IPv6 capable working inet_pton function.]) + ac_cv_func_inet_pton="yes" + else + AC_MSG_RESULT([no]) + ac_cv_func_inet_pton="no" + fi +]) + + +dnl CURL_CHECK_FUNC_IOCTL +dnl ------------------------------------------------- +dnl Verify if ioctl is available, prototyped, and +dnl can be compiled. If all of these are true, and +dnl usage has not been previously disallowed with +dnl shell variable curl_disallow_ioctl, then +dnl HAVE_IOCTL will be defined. + +AC_DEFUN([CURL_CHECK_FUNC_IOCTL], [ + AC_REQUIRE([CURL_INCLUDES_STROPTS])dnl + # + tst_links_ioctl="unknown" + tst_proto_ioctl="unknown" + tst_compi_ioctl="unknown" + tst_allow_ioctl="unknown" + # + AC_MSG_CHECKING([if ioctl can be linked]) + AC_LINK_IFELSE([ + AC_LANG_FUNC_LINK_TRY([ioctl]) + ],[ + AC_MSG_RESULT([yes]) + tst_links_ioctl="yes" + ],[ + AC_MSG_RESULT([no]) + tst_links_ioctl="no" + ]) + # + if test "$tst_links_ioctl" = "yes"; then + AC_MSG_CHECKING([if ioctl is prototyped]) + AC_EGREP_CPP([ioctl],[ + $curl_includes_stropts + ],[ + AC_MSG_RESULT([yes]) + tst_proto_ioctl="yes" + ],[ + AC_MSG_RESULT([no]) + tst_proto_ioctl="no" + ]) + fi + # + if test "$tst_proto_ioctl" = "yes"; then + AC_MSG_CHECKING([if ioctl is compilable]) + AC_COMPILE_IFELSE([ + AC_LANG_PROGRAM([[ + $curl_includes_stropts + ]],[[ + if(0 != ioctl(0, 0, 0)) + return 1; + ]]) + ],[ + AC_MSG_RESULT([yes]) + tst_compi_ioctl="yes" + ],[ + AC_MSG_RESULT([no]) + tst_compi_ioctl="no" + ]) + fi + # + if test "$tst_compi_ioctl" = "yes"; then + AC_MSG_CHECKING([if ioctl usage allowed]) + if test "x$curl_disallow_ioctl" != "xyes"; then + AC_MSG_RESULT([yes]) + tst_allow_ioctl="yes" + else + AC_MSG_RESULT([no]) + tst_allow_ioctl="no" + fi + fi + # + AC_MSG_CHECKING([if ioctl might be used]) + if test "$tst_links_ioctl" = "yes" && + test "$tst_proto_ioctl" = "yes" && + test "$tst_compi_ioctl" = "yes" && + test "$tst_allow_ioctl" = "yes"; then + AC_MSG_RESULT([yes]) + AC_DEFINE_UNQUOTED(HAVE_IOCTL, 1, + [Define to 1 if you have the ioctl function.]) + ac_cv_func_ioctl="yes" + CURL_CHECK_FUNC_IOCTL_FIONBIO + CURL_CHECK_FUNC_IOCTL_SIOCGIFADDR + else + AC_MSG_RESULT([no]) + ac_cv_func_ioctl="no" + fi +]) + + +dnl CURL_CHECK_FUNC_IOCTL_FIONBIO +dnl ------------------------------------------------- +dnl Verify if ioctl with the FIONBIO command is +dnl available, can be compiled, and seems to work. If +dnl all of these are true, then HAVE_IOCTL_FIONBIO +dnl will be defined. + +AC_DEFUN([CURL_CHECK_FUNC_IOCTL_FIONBIO], [ + # + tst_compi_ioctl_fionbio="unknown" + tst_allow_ioctl_fionbio="unknown" + # + if test "$ac_cv_func_ioctl" = "yes"; then + AC_MSG_CHECKING([if ioctl FIONBIO is compilable]) + AC_COMPILE_IFELSE([ + AC_LANG_PROGRAM([[ + $curl_includes_stropts + ]],[[ + int flags = 0; + if(0 != ioctl(0, FIONBIO, &flags)) + return 1; + ]]) + ],[ + AC_MSG_RESULT([yes]) + tst_compi_ioctl_fionbio="yes" + ],[ + AC_MSG_RESULT([no]) + tst_compi_ioctl_fionbio="no" + ]) + fi + # + if test "$tst_compi_ioctl_fionbio" = "yes"; then + AC_MSG_CHECKING([if ioctl FIONBIO usage allowed]) + if test "x$curl_disallow_ioctl_fionbio" != "xyes"; then + AC_MSG_RESULT([yes]) + tst_allow_ioctl_fionbio="yes" + else + AC_MSG_RESULT([no]) + tst_allow_ioctl_fionbio="no" + fi + fi + # + AC_MSG_CHECKING([if ioctl FIONBIO might be used]) + if test "$tst_compi_ioctl_fionbio" = "yes" && + test "$tst_allow_ioctl_fionbio" = "yes"; then + AC_MSG_RESULT([yes]) + AC_DEFINE_UNQUOTED(HAVE_IOCTL_FIONBIO, 1, + [Define to 1 if you have a working ioctl FIONBIO function.]) + ac_cv_func_ioctl_fionbio="yes" + else + AC_MSG_RESULT([no]) + ac_cv_func_ioctl_fionbio="no" + fi +]) + + +dnl CURL_CHECK_FUNC_IOCTL_SIOCGIFADDR +dnl ------------------------------------------------- +dnl Verify if ioctl with the SIOCGIFADDR command is available, +dnl struct ifreq is defined, they can be compiled, and seem to +dnl work. If all of these are true, then HAVE_IOCTL_SIOCGIFADDR +dnl will be defined. + +AC_DEFUN([CURL_CHECK_FUNC_IOCTL_SIOCGIFADDR], [ + # + tst_compi_ioctl_siocgifaddr="unknown" + tst_allow_ioctl_siocgifaddr="unknown" + # + if test "$ac_cv_func_ioctl" = "yes"; then + AC_MSG_CHECKING([if ioctl SIOCGIFADDR is compilable]) + AC_COMPILE_IFELSE([ + AC_LANG_PROGRAM([[ + $curl_includes_stropts + #include + ]],[[ + struct ifreq ifr; + if(0 != ioctl(0, SIOCGIFADDR, &ifr)) + return 1; + ]]) + ],[ + AC_MSG_RESULT([yes]) + tst_compi_ioctl_siocgifaddr="yes" + ],[ + AC_MSG_RESULT([no]) + tst_compi_ioctl_siocgifaddr="no" + ]) + fi + # + if test "$tst_compi_ioctl_siocgifaddr" = "yes"; then + AC_MSG_CHECKING([if ioctl SIOCGIFADDR usage allowed]) + if test "x$curl_disallow_ioctl_siocgifaddr" != "xyes"; then + AC_MSG_RESULT([yes]) + tst_allow_ioctl_siocgifaddr="yes" + else + AC_MSG_RESULT([no]) + tst_allow_ioctl_siocgifaddr="no" + fi + fi + # + AC_MSG_CHECKING([if ioctl SIOCGIFADDR might be used]) + if test "$tst_compi_ioctl_siocgifaddr" = "yes" && + test "$tst_allow_ioctl_siocgifaddr" = "yes"; then + AC_MSG_RESULT([yes]) + AC_DEFINE_UNQUOTED(HAVE_IOCTL_SIOCGIFADDR, 1, + [Define to 1 if you have a working ioctl SIOCGIFADDR function.]) + ac_cv_func_ioctl_siocgifaddr="yes" + else + AC_MSG_RESULT([no]) + ac_cv_func_ioctl_siocgifaddr="no" + fi +]) + + +dnl CURL_CHECK_FUNC_IOCTLSOCKET +dnl ------------------------------------------------- +dnl Verify if ioctlsocket is available, prototyped, and +dnl can be compiled. If all of these are true, and +dnl usage has not been previously disallowed with +dnl shell variable curl_disallow_ioctlsocket, then +dnl HAVE_IOCTLSOCKET will be defined. + +AC_DEFUN([CURL_CHECK_FUNC_IOCTLSOCKET], [ + AC_REQUIRE([CURL_INCLUDES_WINSOCK2])dnl + # + tst_links_ioctlsocket="unknown" + tst_proto_ioctlsocket="unknown" + tst_compi_ioctlsocket="unknown" + tst_allow_ioctlsocket="unknown" + # + AC_MSG_CHECKING([if ioctlsocket can be linked]) + AC_LINK_IFELSE([ + AC_LANG_PROGRAM([[ + $curl_includes_winsock2 + ]],[[ + if(0 != ioctlsocket(0, 0, 0)) + return 1; + ]]) + ],[ + AC_MSG_RESULT([yes]) + tst_links_ioctlsocket="yes" + ],[ + AC_MSG_RESULT([no]) + tst_links_ioctlsocket="no" + ]) + # + if test "$tst_links_ioctlsocket" = "yes"; then + AC_MSG_CHECKING([if ioctlsocket is prototyped]) + AC_EGREP_CPP([ioctlsocket],[ + $curl_includes_winsock2 + ],[ + AC_MSG_RESULT([yes]) + tst_proto_ioctlsocket="yes" + ],[ + AC_MSG_RESULT([no]) + tst_proto_ioctlsocket="no" + ]) + fi + # + if test "$tst_proto_ioctlsocket" = "yes"; then + AC_MSG_CHECKING([if ioctlsocket is compilable]) + AC_COMPILE_IFELSE([ + AC_LANG_PROGRAM([[ + $curl_includes_winsock2 + ]],[[ + if(0 != ioctlsocket(0, 0, 0)) + return 1; + ]]) + ],[ + AC_MSG_RESULT([yes]) + tst_compi_ioctlsocket="yes" + ],[ + AC_MSG_RESULT([no]) + tst_compi_ioctlsocket="no" + ]) + fi + # + if test "$tst_compi_ioctlsocket" = "yes"; then + AC_MSG_CHECKING([if ioctlsocket usage allowed]) + if test "x$curl_disallow_ioctlsocket" != "xyes"; then + AC_MSG_RESULT([yes]) + tst_allow_ioctlsocket="yes" + else + AC_MSG_RESULT([no]) + tst_allow_ioctlsocket="no" + fi + fi + # + AC_MSG_CHECKING([if ioctlsocket might be used]) + if test "$tst_links_ioctlsocket" = "yes" && + test "$tst_proto_ioctlsocket" = "yes" && + test "$tst_compi_ioctlsocket" = "yes" && + test "$tst_allow_ioctlsocket" = "yes"; then + AC_MSG_RESULT([yes]) + AC_DEFINE_UNQUOTED(HAVE_IOCTLSOCKET, 1, + [Define to 1 if you have the ioctlsocket function.]) + ac_cv_func_ioctlsocket="yes" + CURL_CHECK_FUNC_IOCTLSOCKET_FIONBIO + else + AC_MSG_RESULT([no]) + ac_cv_func_ioctlsocket="no" + fi +]) + + +dnl CURL_CHECK_FUNC_IOCTLSOCKET_FIONBIO +dnl ------------------------------------------------- +dnl Verify if ioctlsocket with the FIONBIO command is +dnl available, can be compiled, and seems to work. If +dnl all of these are true, then HAVE_IOCTLSOCKET_FIONBIO +dnl will be defined. + +AC_DEFUN([CURL_CHECK_FUNC_IOCTLSOCKET_FIONBIO], [ + # + tst_compi_ioctlsocket_fionbio="unknown" + tst_allow_ioctlsocket_fionbio="unknown" + # + if test "$ac_cv_func_ioctlsocket" = "yes"; then + AC_MSG_CHECKING([if ioctlsocket FIONBIO is compilable]) + AC_COMPILE_IFELSE([ + AC_LANG_PROGRAM([[ + $curl_includes_winsock2 + ]],[[ + int flags = 0; + if(0 != ioctlsocket(0, FIONBIO, &flags)) + return 1; + ]]) + ],[ + AC_MSG_RESULT([yes]) + tst_compi_ioctlsocket_fionbio="yes" + ],[ + AC_MSG_RESULT([no]) + tst_compi_ioctlsocket_fionbio="no" + ]) + fi + # + if test "$tst_compi_ioctlsocket_fionbio" = "yes"; then + AC_MSG_CHECKING([if ioctlsocket FIONBIO usage allowed]) + if test "x$curl_disallow_ioctlsocket_fionbio" != "xyes"; then + AC_MSG_RESULT([yes]) + tst_allow_ioctlsocket_fionbio="yes" + else + AC_MSG_RESULT([no]) + tst_allow_ioctlsocket_fionbio="no" + fi + fi + # + AC_MSG_CHECKING([if ioctlsocket FIONBIO might be used]) + if test "$tst_compi_ioctlsocket_fionbio" = "yes" && + test "$tst_allow_ioctlsocket_fionbio" = "yes"; then + AC_MSG_RESULT([yes]) + AC_DEFINE_UNQUOTED(HAVE_IOCTLSOCKET_FIONBIO, 1, + [Define to 1 if you have a working ioctlsocket FIONBIO function.]) + ac_cv_func_ioctlsocket_fionbio="yes" + else + AC_MSG_RESULT([no]) + ac_cv_func_ioctlsocket_fionbio="no" + fi +]) + + +dnl CURL_CHECK_FUNC_IOCTLSOCKET_CAMEL +dnl ------------------------------------------------- +dnl Verify if IoctlSocket is available, prototyped, and +dnl can be compiled. If all of these are true, and +dnl usage has not been previously disallowed with +dnl shell variable curl_disallow_ioctlsocket_camel, +dnl then HAVE_IOCTLSOCKET_CAMEL will be defined. + +AC_DEFUN([CURL_CHECK_FUNC_IOCTLSOCKET_CAMEL], [ + AC_REQUIRE([CURL_INCLUDES_STROPTS])dnl + # + tst_links_ioctlsocket_camel="unknown" + tst_proto_ioctlsocket_camel="unknown" + tst_compi_ioctlsocket_camel="unknown" + tst_allow_ioctlsocket_camel="unknown" + # + AC_MSG_CHECKING([if IoctlSocket can be linked]) + AC_LINK_IFELSE([ + AC_LANG_FUNC_LINK_TRY([IoctlSocket]) + ],[ + AC_MSG_RESULT([yes]) + tst_links_ioctlsocket_camel="yes" + ],[ + AC_MSG_RESULT([no]) + tst_links_ioctlsocket_camel="no" + ]) + # + if test "$tst_links_ioctlsocket_camel" = "yes"; then + AC_MSG_CHECKING([if IoctlSocket is prototyped]) + AC_EGREP_CPP([IoctlSocket],[ + $curl_includes_stropts + ],[ + AC_MSG_RESULT([yes]) + tst_proto_ioctlsocket_camel="yes" + ],[ + AC_MSG_RESULT([no]) + tst_proto_ioctlsocket_camel="no" + ]) + fi + # + if test "$tst_proto_ioctlsocket_camel" = "yes"; then + AC_MSG_CHECKING([if IoctlSocket is compilable]) + AC_COMPILE_IFELSE([ + AC_LANG_PROGRAM([[ + $curl_includes_stropts + ]],[[ + if(0 != IoctlSocket(0, 0, 0)) + return 1; + ]]) + ],[ + AC_MSG_RESULT([yes]) + tst_compi_ioctlsocket_camel="yes" + ],[ + AC_MSG_RESULT([no]) + tst_compi_ioctlsocket_camel="no" + ]) + fi + # + if test "$tst_compi_ioctlsocket_camel" = "yes"; then + AC_MSG_CHECKING([if IoctlSocket usage allowed]) + if test "x$curl_disallow_ioctlsocket_camel" != "xyes"; then + AC_MSG_RESULT([yes]) + tst_allow_ioctlsocket_camel="yes" + else + AC_MSG_RESULT([no]) + tst_allow_ioctlsocket_camel="no" + fi + fi + # + AC_MSG_CHECKING([if IoctlSocket might be used]) + if test "$tst_links_ioctlsocket_camel" = "yes" && + test "$tst_proto_ioctlsocket_camel" = "yes" && + test "$tst_compi_ioctlsocket_camel" = "yes" && + test "$tst_allow_ioctlsocket_camel" = "yes"; then + AC_MSG_RESULT([yes]) + AC_DEFINE_UNQUOTED(HAVE_IOCTLSOCKET_CAMEL, 1, + [Define to 1 if you have the IoctlSocket camel case function.]) + ac_cv_func_ioctlsocket_camel="yes" + CURL_CHECK_FUNC_IOCTLSOCKET_CAMEL_FIONBIO + else + AC_MSG_RESULT([no]) + ac_cv_func_ioctlsocket_camel="no" + fi +]) + + +dnl CURL_CHECK_FUNC_IOCTLSOCKET_CAMEL_FIONBIO +dnl ------------------------------------------------- +dnl Verify if IoctlSocket with FIONBIO command is available, +dnl can be compiled, and seems to work. If all of these are +dnl true, then HAVE_IOCTLSOCKET_CAMEL_FIONBIO will be defined. + +AC_DEFUN([CURL_CHECK_FUNC_IOCTLSOCKET_CAMEL_FIONBIO], [ + # + tst_compi_ioctlsocket_camel_fionbio="unknown" + tst_allow_ioctlsocket_camel_fionbio="unknown" + # + if test "$ac_cv_func_ioctlsocket_camel" = "yes"; then + AC_MSG_CHECKING([if IoctlSocket FIONBIO is compilable]) + AC_COMPILE_IFELSE([ + AC_LANG_PROGRAM([[ + $curl_includes_stropts + ]],[[ + long flags = 0; + if(0 != ioctlsocket(0, FIONBIO, &flags)) + return 1; + ]]) + ],[ + AC_MSG_RESULT([yes]) + tst_compi_ioctlsocket_camel_fionbio="yes" + ],[ + AC_MSG_RESULT([no]) + tst_compi_ioctlsocket_camel_fionbio="no" + ]) + fi + # + if test "$tst_compi_ioctlsocket_camel_fionbio" = "yes"; then + AC_MSG_CHECKING([if IoctlSocket FIONBIO usage allowed]) + if test "x$curl_disallow_ioctlsocket_camel_fionbio" != "xyes"; then + AC_MSG_RESULT([yes]) + tst_allow_ioctlsocket_camel_fionbio="yes" + else + AC_MSG_RESULT([no]) + tst_allow_ioctlsocket_camel_fionbio="no" + fi + fi + # + AC_MSG_CHECKING([if IoctlSocket FIONBIO might be used]) + if test "$tst_compi_ioctlsocket_camel_fionbio" = "yes" && + test "$tst_allow_ioctlsocket_camel_fionbio" = "yes"; then + AC_MSG_RESULT([yes]) + AC_DEFINE_UNQUOTED(HAVE_IOCTLSOCKET_CAMEL_FIONBIO, 1, + [Define to 1 if you have a working IoctlSocket camel case FIONBIO function.]) + ac_cv_func_ioctlsocket_camel_fionbio="yes" + else + AC_MSG_RESULT([no]) + ac_cv_func_ioctlsocket_camel_fionbio="no" + fi +]) + + +dnl CURL_CHECK_FUNC_LISTXATTR +dnl ------------------------------------------------- +dnl Verify if listxattr is available, prototyped, and +dnl can be compiled. If all of these are true, and +dnl usage has not been previously disallowed with +dnl shell variable curl_disallow_listxattr, then +dnl HAVE_LISTXATTR will be defined. + +AC_DEFUN([CURL_CHECK_FUNC_LISTXATTR], [ + AC_REQUIRE([CURL_INCLUDES_SYS_XATTR])dnl + # + tst_links_listxattr="unknown" + tst_proto_listxattr="unknown" + tst_compi_listxattr="unknown" + tst_allow_listxattr="unknown" + tst_nargs_listxattr="unknown" + # + AC_MSG_CHECKING([if listxattr can be linked]) + AC_LINK_IFELSE([ + AC_LANG_FUNC_LINK_TRY([listxattr]) + ],[ + AC_MSG_RESULT([yes]) + tst_links_listxattr="yes" + ],[ + AC_MSG_RESULT([no]) + tst_links_listxattr="no" + ]) + # + if test "$tst_links_listxattr" = "yes"; then + AC_MSG_CHECKING([if listxattr is prototyped]) + AC_EGREP_CPP([listxattr],[ + $curl_includes_sys_xattr + ],[ + AC_MSG_RESULT([yes]) + tst_proto_listxattr="yes" + ],[ + AC_MSG_RESULT([no]) + tst_proto_listxattr="no" + ]) + fi + # + if test "$tst_proto_listxattr" = "yes"; then + if test "$tst_nargs_listxattr" = "unknown"; then + AC_MSG_CHECKING([if listxattr takes 3 args.]) + AC_COMPILE_IFELSE([ + AC_LANG_PROGRAM([[ + $curl_includes_sys_xattr + ]],[[ + if(0 != listxattr(0, 0, 0)) + return 1; + ]]) + ],[ + AC_MSG_RESULT([yes]) + tst_compi_listxattr="yes" + tst_nargs_listxattr="3" + ],[ + AC_MSG_RESULT([no]) + tst_compi_listxattr="no" + ]) + fi + if test "$tst_nargs_listxattr" = "unknown"; then + AC_MSG_CHECKING([if listxattr takes 4 args.]) + AC_COMPILE_IFELSE([ + AC_LANG_PROGRAM([[ + $curl_includes_sys_xattr + ]],[[ + if(0 != listxattr(0, 0, 0, 0)) + return 1; + ]]) + ],[ + AC_MSG_RESULT([yes]) + tst_compi_listxattr="yes" + tst_nargs_listxattr="4" + ],[ + AC_MSG_RESULT([no]) + tst_compi_listxattr="no" + ]) + fi + AC_MSG_CHECKING([if listxattr is compilable]) + if test "$tst_compi_listxattr" = "yes"; then + AC_MSG_RESULT([yes]) + else + AC_MSG_RESULT([no]) + fi + fi + # + if test "$tst_compi_listxattr" = "yes"; then + AC_MSG_CHECKING([if listxattr usage allowed]) + if test "x$curl_disallow_listxattr" != "xyes"; then + AC_MSG_RESULT([yes]) + tst_allow_listxattr="yes" + else + AC_MSG_RESULT([no]) + tst_allow_listxattr="no" + fi + fi + # + AC_MSG_CHECKING([if listxattr might be used]) + if test "$tst_links_listxattr" = "yes" && + test "$tst_proto_listxattr" = "yes" && + test "$tst_compi_listxattr" = "yes" && + test "$tst_allow_listxattr" = "yes"; then + AC_MSG_RESULT([yes]) + AC_DEFINE_UNQUOTED(HAVE_LISTXATTR, 1, + [Define to 1 if you have the listxattr function.]) + dnl AC_DEFINE_UNQUOTED(LISTXATTR_ARGS, $tst_nargs_listxattr, + dnl [Specifies the number of arguments to listxattr]) + # + if test "$tst_nargs_listxattr" -eq "3"; then + AC_DEFINE(HAVE_LISTXATTR_3, 1, [listxattr() takes 3 args]) + elif test "$tst_nargs_listxattr" -eq "4"; then + AC_DEFINE(HAVE_LISTXATTR_4, 1, [listxattr() takes 4 args]) + fi + # + ac_cv_func_listxattr="yes" + else + AC_MSG_RESULT([no]) + ac_cv_func_listxattr="no" + fi +]) + + +dnl CURL_CHECK_FUNC_LOCALTIME_R +dnl ------------------------------------------------- +dnl Verify if localtime_r is available, prototyped, can +dnl be compiled and seems to work. If all of these are +dnl true, and usage has not been previously disallowed +dnl with shell variable curl_disallow_localtime_r, then +dnl HAVE_LOCALTIME_R will be defined. + +AC_DEFUN([CURL_CHECK_FUNC_LOCALTIME_R], [ + AC_REQUIRE([CURL_INCLUDES_STDLIB])dnl + AC_REQUIRE([CURL_INCLUDES_TIME])dnl + # + tst_links_localtime_r="unknown" + tst_proto_localtime_r="unknown" + tst_compi_localtime_r="unknown" + tst_works_localtime_r="unknown" + tst_allow_localtime_r="unknown" + # + AC_MSG_CHECKING([if localtime_r can be linked]) + AC_LINK_IFELSE([ + AC_LANG_FUNC_LINK_TRY([localtime_r]) + ],[ + AC_MSG_RESULT([yes]) + tst_links_localtime_r="yes" + ],[ + AC_MSG_RESULT([no]) + tst_links_localtime_r="no" + ]) + # + if test "$tst_links_localtime_r" = "yes"; then + AC_MSG_CHECKING([if localtime_r is prototyped]) + AC_EGREP_CPP([localtime_r],[ + $curl_includes_time + ],[ + AC_MSG_RESULT([yes]) + tst_proto_localtime_r="yes" + ],[ + AC_MSG_RESULT([no]) + tst_proto_localtime_r="no" + ]) + fi + # + if test "$tst_proto_localtime_r" = "yes"; then + AC_MSG_CHECKING([if localtime_r is compilable]) + AC_COMPILE_IFELSE([ + AC_LANG_PROGRAM([[ + $curl_includes_time + ]],[[ + if(0 != localtime_r(0, 0)) + return 1; + ]]) + ],[ + AC_MSG_RESULT([yes]) + tst_compi_localtime_r="yes" + ],[ + AC_MSG_RESULT([no]) + tst_compi_localtime_r="no" + ]) + fi + # + dnl only do runtime verification when not cross-compiling + if test "x$cross_compiling" != "xyes" && + test "$tst_compi_localtime_r" = "yes"; then + AC_MSG_CHECKING([if localtime_r seems to work]) + AC_RUN_IFELSE([ + AC_LANG_PROGRAM([[ + $curl_includes_stdlib + $curl_includes_time + ]],[[ + time_t clock = 1170352587; + struct tm *tmp = 0; + struct tm result; + tmp = localtime_r(&clock, &result); + if(tmp) + exit(0); + else + exit(1); + ]]) + ],[ + AC_MSG_RESULT([yes]) + tst_works_localtime_r="yes" + ],[ + AC_MSG_RESULT([no]) + tst_works_localtime_r="no" + ]) + fi + # + if test "$tst_compi_localtime_r" = "yes" && + test "$tst_works_localtime_r" != "no"; then + AC_MSG_CHECKING([if localtime_r usage allowed]) + if test "x$curl_disallow_localtime_r" != "xyes"; then + AC_MSG_RESULT([yes]) + tst_allow_localtime_r="yes" + else + AC_MSG_RESULT([no]) + tst_allow_localtime_r="no" + fi + fi + # + AC_MSG_CHECKING([if localtime_r might be used]) + if test "$tst_links_localtime_r" = "yes" && + test "$tst_proto_localtime_r" = "yes" && + test "$tst_compi_localtime_r" = "yes" && + test "$tst_allow_localtime_r" = "yes" && + test "$tst_works_localtime_r" != "no"; then + AC_MSG_RESULT([yes]) + AC_DEFINE_UNQUOTED(HAVE_LOCALTIME_R, 1, + [Define to 1 if you have a working localtime_r function.]) + ac_cv_func_localtime_r="yes" + else + AC_MSG_RESULT([no]) + ac_cv_func_localtime_r="no" + fi +]) + + +dnl CURL_CHECK_FUNC_MEMRCHR +dnl ------------------------------------------------- +dnl Verify if memrchr is available, prototyped, and +dnl can be compiled. If all of these are true, and +dnl usage has not been previously disallowed with +dnl shell variable curl_disallow_memrchr, then +dnl HAVE_MEMRCHR will be defined. + +AC_DEFUN([CURL_CHECK_FUNC_MEMRCHR], [ + AC_REQUIRE([CURL_INCLUDES_STRING])dnl + # + tst_links_memrchr="unknown" + tst_macro_memrchr="unknown" + tst_proto_memrchr="unknown" + tst_compi_memrchr="unknown" + tst_allow_memrchr="unknown" + # + AC_MSG_CHECKING([if memrchr can be linked]) + AC_LINK_IFELSE([ + AC_LANG_FUNC_LINK_TRY([memrchr]) + ],[ + AC_MSG_RESULT([yes]) + tst_links_memrchr="yes" + ],[ + AC_MSG_RESULT([no]) + tst_links_memrchr="no" + ]) + # + if test "$tst_links_memrchr" = "no"; then + AC_MSG_CHECKING([if memrchr seems a macro]) + AC_LINK_IFELSE([ + AC_LANG_PROGRAM([[ + $curl_includes_string + ]],[[ + if(0 != memrchr(0, 0, 0)) + return 1; + ]]) + ],[ + AC_MSG_RESULT([yes]) + tst_macro_memrchr="yes" + ],[ + AC_MSG_RESULT([no]) + tst_macro_memrchr="no" + ]) + fi + # + if test "$tst_links_memrchr" = "yes"; then + AC_MSG_CHECKING([if memrchr is prototyped]) + AC_EGREP_CPP([memrchr],[ + $curl_includes_string + ],[ + AC_MSG_RESULT([yes]) + tst_proto_memrchr="yes" + ],[ + AC_MSG_RESULT([no]) + tst_proto_memrchr="no" + ]) + fi + # + if test "$tst_proto_memrchr" = "yes" || + test "$tst_macro_memrchr" = "yes"; then + AC_MSG_CHECKING([if memrchr is compilable]) + AC_COMPILE_IFELSE([ + AC_LANG_PROGRAM([[ + $curl_includes_string + ]],[[ + if(0 != memrchr(0, 0, 0)) + return 1; + ]]) + ],[ + AC_MSG_RESULT([yes]) + tst_compi_memrchr="yes" + ],[ + AC_MSG_RESULT([no]) + tst_compi_memrchr="no" + ]) + fi + # + if test "$tst_compi_memrchr" = "yes"; then + AC_MSG_CHECKING([if memrchr usage allowed]) + if test "x$curl_disallow_memrchr" != "xyes"; then + AC_MSG_RESULT([yes]) + tst_allow_memrchr="yes" + else + AC_MSG_RESULT([no]) + tst_allow_memrchr="no" + fi + fi + # + AC_MSG_CHECKING([if memrchr might be used]) + if (test "$tst_proto_memrchr" = "yes" || + test "$tst_macro_memrchr" = "yes") && + test "$tst_compi_memrchr" = "yes" && + test "$tst_allow_memrchr" = "yes"; then + AC_MSG_RESULT([yes]) + AC_DEFINE_UNQUOTED(HAVE_MEMRCHR, 1, + [Define to 1 if you have the memrchr function or macro.]) + ac_cv_func_memrchr="yes" + else + AC_MSG_RESULT([no]) + ac_cv_func_memrchr="no" + fi +]) + + +dnl CURL_CHECK_FUNC_POLL +dnl ------------------------------------------------- +dnl Verify if poll is available, prototyped, can +dnl be compiled and seems to work. If all of these are +dnl true, and usage has not been previously disallowed +dnl with shell variable curl_disallow_poll, then +dnl HAVE_POLL will be defined. + +AC_DEFUN([CURL_CHECK_FUNC_POLL], [ + AC_REQUIRE([CURL_INCLUDES_STDLIB])dnl + AC_REQUIRE([CURL_INCLUDES_POLL])dnl + # + tst_links_poll="unknown" + tst_proto_poll="unknown" + tst_compi_poll="unknown" + tst_works_poll="unknown" + tst_allow_poll="unknown" + # + case $host_os in + darwin*|interix*) + dnl poll() does not work on these platforms + dnl Interix: "does provide poll(), but the implementing developer must + dnl have been in a bad mood, because poll() only works on the /proc + dnl filesystem here" + curl_disallow_poll="yes" + ;; + esac + # + AC_MSG_CHECKING([if poll can be linked]) + AC_LINK_IFELSE([ + AC_LANG_PROGRAM([[ + $curl_includes_poll + ]],[[ + if(0 != poll(0, 0, 0)) + return 1; + ]]) + ],[ + AC_MSG_RESULT([yes]) + tst_links_poll="yes" + ],[ + AC_MSG_RESULT([no]) + tst_links_poll="no" + ]) + # + if test "$tst_links_poll" = "yes"; then + AC_MSG_CHECKING([if poll is prototyped]) + AC_EGREP_CPP([poll],[ + $curl_includes_poll + ],[ + AC_MSG_RESULT([yes]) + tst_proto_poll="yes" + ],[ + AC_MSG_RESULT([no]) + tst_proto_poll="no" + ]) + fi + # + if test "$tst_proto_poll" = "yes"; then + AC_MSG_CHECKING([if poll is compilable]) + AC_COMPILE_IFELSE([ + AC_LANG_PROGRAM([[ + $curl_includes_poll + ]],[[ + if(0 != poll(0, 0, 0)) + return 1; + ]]) + ],[ + AC_MSG_RESULT([yes]) + tst_compi_poll="yes" + ],[ + AC_MSG_RESULT([no]) + tst_compi_poll="no" + ]) + fi + # + dnl only do runtime verification when not cross-compiling + if test "x$cross_compiling" != "xyes" && + test "$tst_compi_poll" = "yes"; then + AC_MSG_CHECKING([if poll seems to work]) + AC_RUN_IFELSE([ + AC_LANG_PROGRAM([[ + $curl_includes_stdlib + $curl_includes_poll + ]],[[ + if(0 != poll(0, 0, 10)) + exit(1); /* fail */ + else + exit(0); + ]]) + ],[ + AC_MSG_RESULT([yes]) + tst_works_poll="yes" + ],[ + AC_MSG_RESULT([no]) + tst_works_poll="no" + ]) + fi + # + if test "$tst_compi_poll" = "yes" && + test "$tst_works_poll" != "no"; then + AC_MSG_CHECKING([if poll usage allowed]) + if test "x$curl_disallow_poll" != "xyes"; then + AC_MSG_RESULT([yes]) + tst_allow_poll="yes" + else + AC_MSG_RESULT([no]) + tst_allow_poll="no" + fi + fi + # + AC_MSG_CHECKING([if poll might be used]) + if test "$tst_links_poll" = "yes" && + test "$tst_proto_poll" = "yes" && + test "$tst_compi_poll" = "yes" && + test "$tst_allow_poll" = "yes" && + test "$tst_works_poll" != "no"; then + AC_MSG_RESULT([yes]) + AC_DEFINE_UNQUOTED(HAVE_POLL, 1, + [Define to 1 if you have a working poll function.]) + AC_DEFINE_UNQUOTED(HAVE_POLL_FINE, 1, + [If you have a fine poll]) + ac_cv_func_poll="yes" + else + AC_MSG_RESULT([no]) + ac_cv_func_poll="no" + fi +]) + + +dnl CURL_CHECK_FUNC_REMOVEXATTR +dnl ------------------------------------------------- +dnl Verify if removexattr is available, prototyped, and +dnl can be compiled. If all of these are true, and +dnl usage has not been previously disallowed with +dnl shell variable curl_disallow_removexattr, then +dnl HAVE_REMOVEXATTR will be defined. + +AC_DEFUN([CURL_CHECK_FUNC_REMOVEXATTR], [ + AC_REQUIRE([CURL_INCLUDES_SYS_XATTR])dnl + # + tst_links_removexattr="unknown" + tst_proto_removexattr="unknown" + tst_compi_removexattr="unknown" + tst_allow_removexattr="unknown" + tst_nargs_removexattr="unknown" + # + AC_MSG_CHECKING([if removexattr can be linked]) + AC_LINK_IFELSE([ + AC_LANG_FUNC_LINK_TRY([removexattr]) + ],[ + AC_MSG_RESULT([yes]) + tst_links_removexattr="yes" + ],[ + AC_MSG_RESULT([no]) + tst_links_removexattr="no" + ]) + # + if test "$tst_links_removexattr" = "yes"; then + AC_MSG_CHECKING([if removexattr is prototyped]) + AC_EGREP_CPP([removexattr],[ + $curl_includes_sys_xattr + ],[ + AC_MSG_RESULT([yes]) + tst_proto_removexattr="yes" + ],[ + AC_MSG_RESULT([no]) + tst_proto_removexattr="no" + ]) + fi + # + if test "$tst_proto_removexattr" = "yes"; then + if test "$tst_nargs_removexattr" = "unknown"; then + AC_MSG_CHECKING([if removexattr takes 2 args.]) + AC_COMPILE_IFELSE([ + AC_LANG_PROGRAM([[ + $curl_includes_sys_xattr + ]],[[ + if(0 != removexattr(0, 0)) + return 1; + ]]) + ],[ + AC_MSG_RESULT([yes]) + tst_compi_removexattr="yes" + tst_nargs_removexattr="2" + ],[ + AC_MSG_RESULT([no]) + tst_compi_removexattr="no" + ]) + fi + if test "$tst_nargs_removexattr" = "unknown"; then + AC_MSG_CHECKING([if removexattr takes 3 args.]) + AC_COMPILE_IFELSE([ + AC_LANG_PROGRAM([[ + $curl_includes_sys_xattr + ]],[[ + if(0 != removexattr(0, 0, 0)) + return 1; + ]]) + ],[ + AC_MSG_RESULT([yes]) + tst_compi_removexattr="yes" + tst_nargs_removexattr="3" + ],[ + AC_MSG_RESULT([no]) + tst_compi_removexattr="no" + ]) + fi + AC_MSG_CHECKING([if removexattr is compilable]) + if test "$tst_compi_removexattr" = "yes"; then + AC_MSG_RESULT([yes]) + else + AC_MSG_RESULT([no]) + fi + fi + # + if test "$tst_compi_removexattr" = "yes"; then + AC_MSG_CHECKING([if removexattr usage allowed]) + if test "x$curl_disallow_removexattr" != "xyes"; then + AC_MSG_RESULT([yes]) + tst_allow_removexattr="yes" + else + AC_MSG_RESULT([no]) + tst_allow_removexattr="no" + fi + fi + # + AC_MSG_CHECKING([if removexattr might be used]) + if test "$tst_links_removexattr" = "yes" && + test "$tst_proto_removexattr" = "yes" && + test "$tst_compi_removexattr" = "yes" && + test "$tst_allow_removexattr" = "yes"; then + AC_MSG_RESULT([yes]) + AC_DEFINE_UNQUOTED(HAVE_REMOVEXATTR, 1, + [Define to 1 if you have the removexattr function.]) + dnl AC_DEFINE_UNQUOTED(REMOVEXATTR_ARGS, $tst_nargs_removexattr, + dnl [Specifies the number of arguments to removexattr]) + # + if test "$tst_nargs_removexattr" -eq "2"; then + AC_DEFINE(HAVE_REMOVEXATTR_2, 1, [removexattr() takes 2 args]) + elif test "$tst_nargs_removexattr" -eq "3"; then + AC_DEFINE(HAVE_REMOVEXATTR_3, 1, [removexattr() takes 3 args]) + fi + # + ac_cv_func_removexattr="yes" + else + AC_MSG_RESULT([no]) + ac_cv_func_removexattr="no" + fi +]) + + +dnl CURL_CHECK_FUNC_SETSOCKOPT +dnl ------------------------------------------------- +dnl Verify if setsockopt is available, prototyped, and +dnl can be compiled. If all of these are true, and +dnl usage has not been previously disallowed with +dnl shell variable curl_disallow_setsockopt, then +dnl HAVE_SETSOCKOPT will be defined. + +AC_DEFUN([CURL_CHECK_FUNC_SETSOCKOPT], [ + AC_REQUIRE([CURL_INCLUDES_WINSOCK2])dnl + AC_REQUIRE([CURL_INCLUDES_SYS_SOCKET])dnl + # + tst_links_setsockopt="unknown" + tst_proto_setsockopt="unknown" + tst_compi_setsockopt="unknown" + tst_allow_setsockopt="unknown" + # + AC_MSG_CHECKING([if setsockopt can be linked]) + AC_LINK_IFELSE([ + AC_LANG_PROGRAM([[ + $curl_includes_winsock2 + $curl_includes_sys_socket + ]],[[ + if(0 != setsockopt(0, 0, 0, 0, 0)) + return 1; + ]]) + ],[ + AC_MSG_RESULT([yes]) + tst_links_setsockopt="yes" + ],[ + AC_MSG_RESULT([no]) + tst_links_setsockopt="no" + ]) + # + if test "$tst_links_setsockopt" = "yes"; then + AC_MSG_CHECKING([if setsockopt is prototyped]) + AC_EGREP_CPP([setsockopt],[ + $curl_includes_winsock2 + $curl_includes_sys_socket + ],[ + AC_MSG_RESULT([yes]) + tst_proto_setsockopt="yes" + ],[ + AC_MSG_RESULT([no]) + tst_proto_setsockopt="no" + ]) + fi + # + if test "$tst_proto_setsockopt" = "yes"; then + AC_MSG_CHECKING([if setsockopt is compilable]) + AC_COMPILE_IFELSE([ + AC_LANG_PROGRAM([[ + $curl_includes_winsock2 + $curl_includes_sys_socket + ]],[[ + if(0 != setsockopt(0, 0, 0, 0, 0)) + return 1; + ]]) + ],[ + AC_MSG_RESULT([yes]) + tst_compi_setsockopt="yes" + ],[ + AC_MSG_RESULT([no]) + tst_compi_setsockopt="no" + ]) + fi + # + if test "$tst_compi_setsockopt" = "yes"; then + AC_MSG_CHECKING([if setsockopt usage allowed]) + if test "x$curl_disallow_setsockopt" != "xyes"; then + AC_MSG_RESULT([yes]) + tst_allow_setsockopt="yes" + else + AC_MSG_RESULT([no]) + tst_allow_setsockopt="no" + fi + fi + # + AC_MSG_CHECKING([if setsockopt might be used]) + if test "$tst_links_setsockopt" = "yes" && + test "$tst_proto_setsockopt" = "yes" && + test "$tst_compi_setsockopt" = "yes" && + test "$tst_allow_setsockopt" = "yes"; then + AC_MSG_RESULT([yes]) + AC_DEFINE_UNQUOTED(HAVE_SETSOCKOPT, 1, + [Define to 1 if you have the setsockopt function.]) + ac_cv_func_setsockopt="yes" + CURL_CHECK_FUNC_SETSOCKOPT_SO_NONBLOCK + else + AC_MSG_RESULT([no]) + ac_cv_func_setsockopt="no" + fi +]) + + +dnl CURL_CHECK_FUNC_SETSOCKOPT_SO_NONBLOCK +dnl ------------------------------------------------- +dnl Verify if setsockopt with the SO_NONBLOCK command is +dnl available, can be compiled, and seems to work. If +dnl all of these are true, then HAVE_SETSOCKOPT_SO_NONBLOCK +dnl will be defined. + +AC_DEFUN([CURL_CHECK_FUNC_SETSOCKOPT_SO_NONBLOCK], [ + # + tst_compi_setsockopt_so_nonblock="unknown" + tst_allow_setsockopt_so_nonblock="unknown" + # + if test "$ac_cv_func_setsockopt" = "yes"; then + AC_MSG_CHECKING([if setsockopt SO_NONBLOCK is compilable]) + AC_COMPILE_IFELSE([ + AC_LANG_PROGRAM([[ + $curl_includes_winsock2 + $curl_includes_sys_socket + ]],[[ + if(0 != setsockopt(0, SOL_SOCKET, SO_NONBLOCK, 0, 0)) + return 1; + ]]) + ],[ + AC_MSG_RESULT([yes]) + tst_compi_setsockopt_so_nonblock="yes" + ],[ + AC_MSG_RESULT([no]) + tst_compi_setsockopt_so_nonblock="no" + ]) + fi + # + if test "$tst_compi_setsockopt_so_nonblock" = "yes"; then + AC_MSG_CHECKING([if setsockopt SO_NONBLOCK usage allowed]) + if test "x$curl_disallow_setsockopt_so_nonblock" != "xyes"; then + AC_MSG_RESULT([yes]) + tst_allow_setsockopt_so_nonblock="yes" + else + AC_MSG_RESULT([no]) + tst_allow_setsockopt_so_nonblock="no" + fi + fi + # + AC_MSG_CHECKING([if setsockopt SO_NONBLOCK might be used]) + if test "$tst_compi_setsockopt_so_nonblock" = "yes" && + test "$tst_allow_setsockopt_so_nonblock" = "yes"; then + AC_MSG_RESULT([yes]) + AC_DEFINE_UNQUOTED(HAVE_SETSOCKOPT_SO_NONBLOCK, 1, + [Define to 1 if you have a working setsockopt SO_NONBLOCK function.]) + ac_cv_func_setsockopt_so_nonblock="yes" + else + AC_MSG_RESULT([no]) + ac_cv_func_setsockopt_so_nonblock="no" + fi +]) + + +dnl CURL_CHECK_FUNC_SETXATTR +dnl ------------------------------------------------- +dnl Verify if setxattr is available, prototyped, and +dnl can be compiled. If all of these are true, and +dnl usage has not been previously disallowed with +dnl shell variable curl_disallow_setxattr, then +dnl HAVE_SETXATTR will be defined. + +AC_DEFUN([CURL_CHECK_FUNC_SETXATTR], [ + AC_REQUIRE([CURL_INCLUDES_SYS_XATTR])dnl + # + tst_links_setxattr="unknown" + tst_proto_setxattr="unknown" + tst_compi_setxattr="unknown" + tst_allow_setxattr="unknown" + tst_nargs_setxattr="unknown" + # + AC_MSG_CHECKING([if setxattr can be linked]) + AC_LINK_IFELSE([ + AC_LANG_FUNC_LINK_TRY([setxattr]) + ],[ + AC_MSG_RESULT([yes]) + tst_links_setxattr="yes" + ],[ + AC_MSG_RESULT([no]) + tst_links_setxattr="no" + ]) + # + if test "$tst_links_setxattr" = "yes"; then + AC_MSG_CHECKING([if setxattr is prototyped]) + AC_EGREP_CPP([setxattr],[ + $curl_includes_sys_xattr + ],[ + AC_MSG_RESULT([yes]) + tst_proto_setxattr="yes" + ],[ + AC_MSG_RESULT([no]) + tst_proto_setxattr="no" + ]) + fi + # + if test "$tst_proto_setxattr" = "yes"; then + if test "$tst_nargs_setxattr" = "unknown"; then + AC_MSG_CHECKING([if setxattr takes 5 args.]) + AC_COMPILE_IFELSE([ + AC_LANG_PROGRAM([[ + $curl_includes_sys_xattr + ]],[[ + if(0 != setxattr(0, 0, 0, 0, 0)) + return 1; + ]]) + ],[ + AC_MSG_RESULT([yes]) + tst_compi_setxattr="yes" + tst_nargs_setxattr="5" + ],[ + AC_MSG_RESULT([no]) + tst_compi_setxattr="no" + ]) + fi + if test "$tst_nargs_setxattr" = "unknown"; then + AC_MSG_CHECKING([if setxattr takes 6 args.]) + AC_COMPILE_IFELSE([ + AC_LANG_PROGRAM([[ + $curl_includes_sys_xattr + ]],[[ + if(0 != setxattr(0, 0, 0, 0, 0, 0)) + return 1; + ]]) + ],[ + AC_MSG_RESULT([yes]) + tst_compi_setxattr="yes" + tst_nargs_setxattr="6" + ],[ + AC_MSG_RESULT([no]) + tst_compi_setxattr="no" + ]) + fi + AC_MSG_CHECKING([if setxattr is compilable]) + if test "$tst_compi_setxattr" = "yes"; then + AC_MSG_RESULT([yes]) + else + AC_MSG_RESULT([no]) + fi + fi + # + if test "$tst_compi_setxattr" = "yes"; then + AC_MSG_CHECKING([if setxattr usage allowed]) + if test "x$curl_disallow_setxattr" != "xyes"; then + AC_MSG_RESULT([yes]) + tst_allow_setxattr="yes" + else + AC_MSG_RESULT([no]) + tst_allow_setxattr="no" + fi + fi + # + AC_MSG_CHECKING([if setxattr might be used]) + if test "$tst_links_setxattr" = "yes" && + test "$tst_proto_setxattr" = "yes" && + test "$tst_compi_setxattr" = "yes" && + test "$tst_allow_setxattr" = "yes"; then + AC_MSG_RESULT([yes]) + AC_DEFINE_UNQUOTED(HAVE_SETXATTR, 1, + [Define to 1 if you have the setxattr function.]) + dnl AC_DEFINE_UNQUOTED(SETXATTR_ARGS, $tst_nargs_setxattr, + dnl [Specifies the number of arguments to setxattr]) + # + if test "$tst_nargs_setxattr" -eq "5"; then + AC_DEFINE(HAVE_SETXATTR_5, 1, [setxattr() takes 5 args]) + elif test "$tst_nargs_setxattr" -eq "6"; then + AC_DEFINE(HAVE_SETXATTR_6, 1, [setxattr() takes 6 args]) + fi + # + ac_cv_func_setxattr="yes" + else + AC_MSG_RESULT([no]) + ac_cv_func_setxattr="no" + fi +]) + + +dnl CURL_CHECK_FUNC_SIGACTION +dnl ------------------------------------------------- +dnl Verify if sigaction is available, prototyped, and +dnl can be compiled. If all of these are true, and +dnl usage has not been previously disallowed with +dnl shell variable curl_disallow_sigaction, then +dnl HAVE_SIGACTION will be defined. + +AC_DEFUN([CURL_CHECK_FUNC_SIGACTION], [ + AC_REQUIRE([CURL_INCLUDES_SIGNAL])dnl + # + tst_links_sigaction="unknown" + tst_proto_sigaction="unknown" + tst_compi_sigaction="unknown" + tst_allow_sigaction="unknown" + # + AC_MSG_CHECKING([if sigaction can be linked]) + AC_LINK_IFELSE([ + AC_LANG_FUNC_LINK_TRY([sigaction]) + ],[ + AC_MSG_RESULT([yes]) + tst_links_sigaction="yes" + ],[ + AC_MSG_RESULT([no]) + tst_links_sigaction="no" + ]) + # + if test "$tst_links_sigaction" = "yes"; then + AC_MSG_CHECKING([if sigaction is prototyped]) + AC_EGREP_CPP([sigaction],[ + $curl_includes_signal + ],[ + AC_MSG_RESULT([yes]) + tst_proto_sigaction="yes" + ],[ + AC_MSG_RESULT([no]) + tst_proto_sigaction="no" + ]) + fi + # + if test "$tst_proto_sigaction" = "yes"; then + AC_MSG_CHECKING([if sigaction is compilable]) + AC_COMPILE_IFELSE([ + AC_LANG_PROGRAM([[ + $curl_includes_signal + ]],[[ + if(0 != sigaction(0, 0, 0)) + return 1; + ]]) + ],[ + AC_MSG_RESULT([yes]) + tst_compi_sigaction="yes" + ],[ + AC_MSG_RESULT([no]) + tst_compi_sigaction="no" + ]) + fi + # + if test "$tst_compi_sigaction" = "yes"; then + AC_MSG_CHECKING([if sigaction usage allowed]) + if test "x$curl_disallow_sigaction" != "xyes"; then + AC_MSG_RESULT([yes]) + tst_allow_sigaction="yes" + else + AC_MSG_RESULT([no]) + tst_allow_sigaction="no" + fi + fi + # + AC_MSG_CHECKING([if sigaction might be used]) + if test "$tst_links_sigaction" = "yes" && + test "$tst_proto_sigaction" = "yes" && + test "$tst_compi_sigaction" = "yes" && + test "$tst_allow_sigaction" = "yes"; then + AC_MSG_RESULT([yes]) + AC_DEFINE_UNQUOTED(HAVE_SIGACTION, 1, + [Define to 1 if you have the sigaction function.]) + ac_cv_func_sigaction="yes" + else + AC_MSG_RESULT([no]) + ac_cv_func_sigaction="no" + fi +]) + + +dnl CURL_CHECK_FUNC_SIGINTERRUPT +dnl ------------------------------------------------- +dnl Verify if siginterrupt is available, prototyped, and +dnl can be compiled. If all of these are true, and +dnl usage has not been previously disallowed with +dnl shell variable curl_disallow_siginterrupt, then +dnl HAVE_SIGINTERRUPT will be defined. + +AC_DEFUN([CURL_CHECK_FUNC_SIGINTERRUPT], [ + AC_REQUIRE([CURL_INCLUDES_SIGNAL])dnl + # + tst_links_siginterrupt="unknown" + tst_proto_siginterrupt="unknown" + tst_compi_siginterrupt="unknown" + tst_allow_siginterrupt="unknown" + # + AC_MSG_CHECKING([if siginterrupt can be linked]) + AC_LINK_IFELSE([ + AC_LANG_FUNC_LINK_TRY([siginterrupt]) + ],[ + AC_MSG_RESULT([yes]) + tst_links_siginterrupt="yes" + ],[ + AC_MSG_RESULT([no]) + tst_links_siginterrupt="no" + ]) + # + if test "$tst_links_siginterrupt" = "yes"; then + AC_MSG_CHECKING([if siginterrupt is prototyped]) + AC_EGREP_CPP([siginterrupt],[ + $curl_includes_signal + ],[ + AC_MSG_RESULT([yes]) + tst_proto_siginterrupt="yes" + ],[ + AC_MSG_RESULT([no]) + tst_proto_siginterrupt="no" + ]) + fi + # + if test "$tst_proto_siginterrupt" = "yes"; then + AC_MSG_CHECKING([if siginterrupt is compilable]) + AC_COMPILE_IFELSE([ + AC_LANG_PROGRAM([[ + $curl_includes_signal + ]],[[ + if(0 != siginterrupt(0, 0)) + return 1; + ]]) + ],[ + AC_MSG_RESULT([yes]) + tst_compi_siginterrupt="yes" + ],[ + AC_MSG_RESULT([no]) + tst_compi_siginterrupt="no" + ]) + fi + # + if test "$tst_compi_siginterrupt" = "yes"; then + AC_MSG_CHECKING([if siginterrupt usage allowed]) + if test "x$curl_disallow_siginterrupt" != "xyes"; then + AC_MSG_RESULT([yes]) + tst_allow_siginterrupt="yes" + else + AC_MSG_RESULT([no]) + tst_allow_siginterrupt="no" + fi + fi + # + AC_MSG_CHECKING([if siginterrupt might be used]) + if test "$tst_links_siginterrupt" = "yes" && + test "$tst_proto_siginterrupt" = "yes" && + test "$tst_compi_siginterrupt" = "yes" && + test "$tst_allow_siginterrupt" = "yes"; then + AC_MSG_RESULT([yes]) + AC_DEFINE_UNQUOTED(HAVE_SIGINTERRUPT, 1, + [Define to 1 if you have the siginterrupt function.]) + ac_cv_func_siginterrupt="yes" + else + AC_MSG_RESULT([no]) + ac_cv_func_siginterrupt="no" + fi +]) + + +dnl CURL_CHECK_FUNC_SIGNAL +dnl ------------------------------------------------- +dnl Verify if signal is available, prototyped, and +dnl can be compiled. If all of these are true, and +dnl usage has not been previously disallowed with +dnl shell variable curl_disallow_signal, then +dnl HAVE_SIGNAL will be defined. + +AC_DEFUN([CURL_CHECK_FUNC_SIGNAL], [ + AC_REQUIRE([CURL_INCLUDES_SIGNAL])dnl + # + tst_links_signal="unknown" + tst_proto_signal="unknown" + tst_compi_signal="unknown" + tst_allow_signal="unknown" + # + AC_MSG_CHECKING([if signal can be linked]) + AC_LINK_IFELSE([ + AC_LANG_FUNC_LINK_TRY([signal]) + ],[ + AC_MSG_RESULT([yes]) + tst_links_signal="yes" + ],[ + AC_MSG_RESULT([no]) + tst_links_signal="no" + ]) + # + if test "$tst_links_signal" = "yes"; then + AC_MSG_CHECKING([if signal is prototyped]) + AC_EGREP_CPP([signal],[ + $curl_includes_signal + ],[ + AC_MSG_RESULT([yes]) + tst_proto_signal="yes" + ],[ + AC_MSG_RESULT([no]) + tst_proto_signal="no" + ]) + fi + # + if test "$tst_proto_signal" = "yes"; then + AC_MSG_CHECKING([if signal is compilable]) + AC_COMPILE_IFELSE([ + AC_LANG_PROGRAM([[ + $curl_includes_signal + ]],[[ + if(0 != signal(0, 0)) + return 1; + ]]) + ],[ + AC_MSG_RESULT([yes]) + tst_compi_signal="yes" + ],[ + AC_MSG_RESULT([no]) + tst_compi_signal="no" + ]) + fi + # + if test "$tst_compi_signal" = "yes"; then + AC_MSG_CHECKING([if signal usage allowed]) + if test "x$curl_disallow_signal" != "xyes"; then + AC_MSG_RESULT([yes]) + tst_allow_signal="yes" + else + AC_MSG_RESULT([no]) + tst_allow_signal="no" + fi + fi + # + AC_MSG_CHECKING([if signal might be used]) + if test "$tst_links_signal" = "yes" && + test "$tst_proto_signal" = "yes" && + test "$tst_compi_signal" = "yes" && + test "$tst_allow_signal" = "yes"; then + AC_MSG_RESULT([yes]) + AC_DEFINE_UNQUOTED(HAVE_SIGNAL, 1, + [Define to 1 if you have the signal function.]) + ac_cv_func_signal="yes" + else + AC_MSG_RESULT([no]) + ac_cv_func_signal="no" + fi +]) + + +dnl CURL_CHECK_FUNC_SIGSETJMP +dnl ------------------------------------------------- +dnl Verify if sigsetjmp is available, prototyped, and +dnl can be compiled. If all of these are true, and +dnl usage has not been previously disallowed with +dnl shell variable curl_disallow_sigsetjmp, then +dnl HAVE_SIGSETJMP will be defined. + +AC_DEFUN([CURL_CHECK_FUNC_SIGSETJMP], [ + AC_REQUIRE([CURL_INCLUDES_SETJMP])dnl + # + tst_links_sigsetjmp="unknown" + tst_macro_sigsetjmp="unknown" + tst_proto_sigsetjmp="unknown" + tst_compi_sigsetjmp="unknown" + tst_allow_sigsetjmp="unknown" + # + AC_MSG_CHECKING([if sigsetjmp can be linked]) + AC_LINK_IFELSE([ + AC_LANG_FUNC_LINK_TRY([sigsetjmp]) + ],[ + AC_MSG_RESULT([yes]) + tst_links_sigsetjmp="yes" + ],[ + AC_MSG_RESULT([no]) + tst_links_sigsetjmp="no" + ]) + # + if test "$tst_links_sigsetjmp" = "no"; then + AC_MSG_CHECKING([if sigsetjmp seems a macro]) + AC_LINK_IFELSE([ + AC_LANG_PROGRAM([[ + $curl_includes_setjmp + ]],[[ + sigjmp_buf env; + if(0 != sigsetjmp(env, 0)) + return 1; + ]]) + ],[ + AC_MSG_RESULT([yes]) + tst_macro_sigsetjmp="yes" + ],[ + AC_MSG_RESULT([no]) + tst_macro_sigsetjmp="no" + ]) + fi + # + if test "$tst_links_sigsetjmp" = "yes"; then + AC_MSG_CHECKING([if sigsetjmp is prototyped]) + AC_EGREP_CPP([sigsetjmp],[ + $curl_includes_setjmp + ],[ + AC_MSG_RESULT([yes]) + tst_proto_sigsetjmp="yes" + ],[ + AC_MSG_RESULT([no]) + tst_proto_sigsetjmp="no" + ]) + fi + # + if test "$tst_proto_sigsetjmp" = "yes" || + test "$tst_macro_sigsetjmp" = "yes"; then + AC_MSG_CHECKING([if sigsetjmp is compilable]) + AC_COMPILE_IFELSE([ + AC_LANG_PROGRAM([[ + $curl_includes_setjmp + ]],[[ + sigjmp_buf env; + if(0 != sigsetjmp(env, 0)) + return 1; + ]]) + ],[ + AC_MSG_RESULT([yes]) + tst_compi_sigsetjmp="yes" + ],[ + AC_MSG_RESULT([no]) + tst_compi_sigsetjmp="no" + ]) + fi + # + if test "$tst_compi_sigsetjmp" = "yes"; then + AC_MSG_CHECKING([if sigsetjmp usage allowed]) + if test "x$curl_disallow_sigsetjmp" != "xyes"; then + AC_MSG_RESULT([yes]) + tst_allow_sigsetjmp="yes" + else + AC_MSG_RESULT([no]) + tst_allow_sigsetjmp="no" + fi + fi + # + AC_MSG_CHECKING([if sigsetjmp might be used]) + if (test "$tst_proto_sigsetjmp" = "yes" || + test "$tst_macro_sigsetjmp" = "yes") && + test "$tst_compi_sigsetjmp" = "yes" && + test "$tst_allow_sigsetjmp" = "yes"; then + AC_MSG_RESULT([yes]) + AC_DEFINE_UNQUOTED(HAVE_SIGSETJMP, 1, + [Define to 1 if you have the sigsetjmp function or macro.]) + ac_cv_func_sigsetjmp="yes" + else + AC_MSG_RESULT([no]) + ac_cv_func_sigsetjmp="no" + fi +]) + + +dnl CURL_CHECK_FUNC_SOCKET +dnl ------------------------------------------------- +dnl Verify if socket is available, prototyped, and +dnl can be compiled. If all of these are true, and +dnl usage has not been previously disallowed with +dnl shell variable curl_disallow_socket, then +dnl HAVE_SOCKET will be defined. + +AC_DEFUN([CURL_CHECK_FUNC_SOCKET], [ + AC_REQUIRE([CURL_INCLUDES_WINSOCK2])dnl + AC_REQUIRE([CURL_INCLUDES_SYS_SOCKET])dnl + AC_REQUIRE([CURL_INCLUDES_SOCKET])dnl + # + tst_links_socket="unknown" + tst_proto_socket="unknown" + tst_compi_socket="unknown" + tst_allow_socket="unknown" + # + AC_MSG_CHECKING([if socket can be linked]) + AC_LINK_IFELSE([ + AC_LANG_PROGRAM([[ + $curl_includes_winsock2 + $curl_includes_sys_socket + $curl_includes_socket + ]],[[ + if(0 != socket(0, 0, 0)) + return 1; + ]]) + ],[ + AC_MSG_RESULT([yes]) + tst_links_socket="yes" + ],[ + AC_MSG_RESULT([no]) + tst_links_socket="no" + ]) + # + if test "$tst_links_socket" = "yes"; then + AC_MSG_CHECKING([if socket is prototyped]) + AC_EGREP_CPP([socket],[ + $curl_includes_winsock2 + $curl_includes_sys_socket + $curl_includes_socket + ],[ + AC_MSG_RESULT([yes]) + tst_proto_socket="yes" + ],[ + AC_MSG_RESULT([no]) + tst_proto_socket="no" + ]) + fi + # + if test "$tst_proto_socket" = "yes"; then + AC_MSG_CHECKING([if socket is compilable]) + AC_COMPILE_IFELSE([ + AC_LANG_PROGRAM([[ + $curl_includes_winsock2 + $curl_includes_sys_socket + $curl_includes_socket + ]],[[ + if(0 != socket(0, 0, 0)) + return 1; + ]]) + ],[ + AC_MSG_RESULT([yes]) + tst_compi_socket="yes" + ],[ + AC_MSG_RESULT([no]) + tst_compi_socket="no" + ]) + fi + # + if test "$tst_compi_socket" = "yes"; then + AC_MSG_CHECKING([if socket usage allowed]) + if test "x$curl_disallow_socket" != "xyes"; then + AC_MSG_RESULT([yes]) + tst_allow_socket="yes" + else + AC_MSG_RESULT([no]) + tst_allow_socket="no" + fi + fi + # + AC_MSG_CHECKING([if socket might be used]) + if test "$tst_links_socket" = "yes" && + test "$tst_proto_socket" = "yes" && + test "$tst_compi_socket" = "yes" && + test "$tst_allow_socket" = "yes"; then + AC_MSG_RESULT([yes]) + AC_DEFINE_UNQUOTED(HAVE_SOCKET, 1, + [Define to 1 if you have the socket function.]) + ac_cv_func_socket="yes" + else + AC_MSG_RESULT([no]) + ac_cv_func_socket="no" + fi +]) + + +dnl CURL_CHECK_FUNC_STRCASECMP +dnl ------------------------------------------------- +dnl Verify if strcasecmp is available, prototyped, and +dnl can be compiled. If all of these are true, and +dnl usage has not been previously disallowed with +dnl shell variable curl_disallow_strcasecmp, then +dnl HAVE_STRCASECMP will be defined. + +AC_DEFUN([CURL_CHECK_FUNC_STRCASECMP], [ + AC_REQUIRE([CURL_INCLUDES_STRING])dnl + # + tst_links_strcasecmp="unknown" + tst_proto_strcasecmp="unknown" + tst_compi_strcasecmp="unknown" + tst_allow_strcasecmp="unknown" + # + AC_MSG_CHECKING([if strcasecmp can be linked]) + AC_LINK_IFELSE([ + AC_LANG_FUNC_LINK_TRY([strcasecmp]) + ],[ + AC_MSG_RESULT([yes]) + tst_links_strcasecmp="yes" + ],[ + AC_MSG_RESULT([no]) + tst_links_strcasecmp="no" + ]) + # + if test "$tst_links_strcasecmp" = "yes"; then + AC_MSG_CHECKING([if strcasecmp is prototyped]) + AC_EGREP_CPP([strcasecmp],[ + $curl_includes_string + ],[ + AC_MSG_RESULT([yes]) + tst_proto_strcasecmp="yes" + ],[ + AC_MSG_RESULT([no]) + tst_proto_strcasecmp="no" + ]) + fi + # + if test "$tst_proto_strcasecmp" = "yes"; then + AC_MSG_CHECKING([if strcasecmp is compilable]) + AC_COMPILE_IFELSE([ + AC_LANG_PROGRAM([[ + $curl_includes_string + ]],[[ + if(0 != strcasecmp(0, 0)) + return 1; + ]]) + ],[ + AC_MSG_RESULT([yes]) + tst_compi_strcasecmp="yes" + ],[ + AC_MSG_RESULT([no]) + tst_compi_strcasecmp="no" + ]) + fi + # + if test "$tst_compi_strcasecmp" = "yes"; then + AC_MSG_CHECKING([if strcasecmp usage allowed]) + if test "x$curl_disallow_strcasecmp" != "xyes"; then + AC_MSG_RESULT([yes]) + tst_allow_strcasecmp="yes" + else + AC_MSG_RESULT([no]) + tst_allow_strcasecmp="no" + fi + fi + # + AC_MSG_CHECKING([if strcasecmp might be used]) + if test "$tst_links_strcasecmp" = "yes" && + test "$tst_proto_strcasecmp" = "yes" && + test "$tst_compi_strcasecmp" = "yes" && + test "$tst_allow_strcasecmp" = "yes"; then + AC_MSG_RESULT([yes]) + AC_DEFINE_UNQUOTED(HAVE_STRCASECMP, 1, + [Define to 1 if you have the strcasecmp function.]) + ac_cv_func_strcasecmp="yes" + else + AC_MSG_RESULT([no]) + ac_cv_func_strcasecmp="no" + fi +]) + + +dnl CURL_CHECK_FUNC_STRCASESTR +dnl ------------------------------------------------- +dnl Verify if strcasestr is available, prototyped, and +dnl can be compiled. If all of these are true, and +dnl usage has not been previously disallowed with +dnl shell variable curl_disallow_strcasestr, then +dnl HAVE_STRCASESTR will be defined. + +AC_DEFUN([CURL_CHECK_FUNC_STRCASESTR], [ + AC_REQUIRE([CURL_INCLUDES_STRING])dnl + # + tst_links_strcasestr="unknown" + tst_proto_strcasestr="unknown" + tst_compi_strcasestr="unknown" + tst_allow_strcasestr="unknown" + # + AC_MSG_CHECKING([if strcasestr can be linked]) + AC_LINK_IFELSE([ + AC_LANG_FUNC_LINK_TRY([strcasestr]) + ],[ + AC_MSG_RESULT([yes]) + tst_links_strcasestr="yes" + ],[ + AC_MSG_RESULT([no]) + tst_links_strcasestr="no" + ]) + # + if test "$tst_links_strcasestr" = "yes"; then + AC_MSG_CHECKING([if strcasestr is prototyped]) + AC_EGREP_CPP([strcasestr],[ + $curl_includes_string + ],[ + AC_MSG_RESULT([yes]) + tst_proto_strcasestr="yes" + ],[ + AC_MSG_RESULT([no]) + tst_proto_strcasestr="no" + ]) + fi + # + if test "$tst_proto_strcasestr" = "yes"; then + AC_MSG_CHECKING([if strcasestr is compilable]) + AC_COMPILE_IFELSE([ + AC_LANG_PROGRAM([[ + $curl_includes_string + ]],[[ + if(0 != strcasestr(0, 0)) + return 1; + ]]) + ],[ + AC_MSG_RESULT([yes]) + tst_compi_strcasestr="yes" + ],[ + AC_MSG_RESULT([no]) + tst_compi_strcasestr="no" + ]) + fi + # + if test "$tst_compi_strcasestr" = "yes"; then + AC_MSG_CHECKING([if strcasestr usage allowed]) + if test "x$curl_disallow_strcasestr" != "xyes"; then + AC_MSG_RESULT([yes]) + tst_allow_strcasestr="yes" + else + AC_MSG_RESULT([no]) + tst_allow_strcasestr="no" + fi + fi + # + AC_MSG_CHECKING([if strcasestr might be used]) + if test "$tst_links_strcasestr" = "yes" && + test "$tst_proto_strcasestr" = "yes" && + test "$tst_compi_strcasestr" = "yes" && + test "$tst_allow_strcasestr" = "yes"; then + AC_MSG_RESULT([yes]) + AC_DEFINE_UNQUOTED(HAVE_STRCASESTR, 1, + [Define to 1 if you have the strcasestr function.]) + ac_cv_func_strcasestr="yes" + else + AC_MSG_RESULT([no]) + ac_cv_func_strcasestr="no" + fi +]) + + +dnl CURL_CHECK_FUNC_STRCMPI +dnl ------------------------------------------------- +dnl Verify if strcmpi is available, prototyped, and +dnl can be compiled. If all of these are true, and +dnl usage has not been previously disallowed with +dnl shell variable curl_disallow_strcmpi, then +dnl HAVE_STRCMPI will be defined. + +AC_DEFUN([CURL_CHECK_FUNC_STRCMPI], [ + AC_REQUIRE([CURL_INCLUDES_STRING])dnl + # + tst_links_strcmpi="unknown" + tst_proto_strcmpi="unknown" + tst_compi_strcmpi="unknown" + tst_allow_strcmpi="unknown" + # + AC_MSG_CHECKING([if strcmpi can be linked]) + AC_LINK_IFELSE([ + AC_LANG_FUNC_LINK_TRY([strcmpi]) + ],[ + AC_MSG_RESULT([yes]) + tst_links_strcmpi="yes" + ],[ + AC_MSG_RESULT([no]) + tst_links_strcmpi="no" + ]) + # + if test "$tst_links_strcmpi" = "yes"; then + AC_MSG_CHECKING([if strcmpi is prototyped]) + AC_EGREP_CPP([strcmpi],[ + $curl_includes_string + ],[ + AC_MSG_RESULT([yes]) + tst_proto_strcmpi="yes" + ],[ + AC_MSG_RESULT([no]) + tst_proto_strcmpi="no" + ]) + fi + # + if test "$tst_proto_strcmpi" = "yes"; then + AC_MSG_CHECKING([if strcmpi is compilable]) + AC_COMPILE_IFELSE([ + AC_LANG_PROGRAM([[ + $curl_includes_string + ]],[[ + if(0 != strcmpi(0, 0)) + return 1; + ]]) + ],[ + AC_MSG_RESULT([yes]) + tst_compi_strcmpi="yes" + ],[ + AC_MSG_RESULT([no]) + tst_compi_strcmpi="no" + ]) + fi + # + if test "$tst_compi_strcmpi" = "yes"; then + AC_MSG_CHECKING([if strcmpi usage allowed]) + if test "x$curl_disallow_strcmpi" != "xyes"; then + AC_MSG_RESULT([yes]) + tst_allow_strcmpi="yes" + else + AC_MSG_RESULT([no]) + tst_allow_strcmpi="no" + fi + fi + # + AC_MSG_CHECKING([if strcmpi might be used]) + if test "$tst_links_strcmpi" = "yes" && + test "$tst_proto_strcmpi" = "yes" && + test "$tst_compi_strcmpi" = "yes" && + test "$tst_allow_strcmpi" = "yes"; then + AC_MSG_RESULT([yes]) + AC_DEFINE_UNQUOTED(HAVE_STRCMPI, 1, + [Define to 1 if you have the strcmpi function.]) + ac_cv_func_strcmpi="yes" + else + AC_MSG_RESULT([no]) + ac_cv_func_strcmpi="no" + fi +]) + + +dnl CURL_CHECK_FUNC_STRDUP +dnl ------------------------------------------------- +dnl Verify if strdup is available, prototyped, and +dnl can be compiled. If all of these are true, and +dnl usage has not been previously disallowed with +dnl shell variable curl_disallow_strdup, then +dnl HAVE_STRDUP will be defined. + +AC_DEFUN([CURL_CHECK_FUNC_STRDUP], [ + AC_REQUIRE([CURL_INCLUDES_STRING])dnl + # + tst_links_strdup="unknown" + tst_proto_strdup="unknown" + tst_compi_strdup="unknown" + tst_allow_strdup="unknown" + # + AC_MSG_CHECKING([if strdup can be linked]) + AC_LINK_IFELSE([ + AC_LANG_FUNC_LINK_TRY([strdup]) + ],[ + AC_MSG_RESULT([yes]) + tst_links_strdup="yes" + ],[ + AC_MSG_RESULT([no]) + tst_links_strdup="no" + ]) + # + if test "$tst_links_strdup" = "yes"; then + AC_MSG_CHECKING([if strdup is prototyped]) + AC_EGREP_CPP([strdup],[ + $curl_includes_string + ],[ + AC_MSG_RESULT([yes]) + tst_proto_strdup="yes" + ],[ + AC_MSG_RESULT([no]) + tst_proto_strdup="no" + ]) + fi + # + if test "$tst_proto_strdup" = "yes"; then + AC_MSG_CHECKING([if strdup is compilable]) + AC_COMPILE_IFELSE([ + AC_LANG_PROGRAM([[ + $curl_includes_string + ]],[[ + if(0 != strdup(0)) + return 1; + ]]) + ],[ + AC_MSG_RESULT([yes]) + tst_compi_strdup="yes" + ],[ + AC_MSG_RESULT([no]) + tst_compi_strdup="no" + ]) + fi + # + if test "$tst_compi_strdup" = "yes"; then + AC_MSG_CHECKING([if strdup usage allowed]) + if test "x$curl_disallow_strdup" != "xyes"; then + AC_MSG_RESULT([yes]) + tst_allow_strdup="yes" + else + AC_MSG_RESULT([no]) + tst_allow_strdup="no" + fi + fi + # + AC_MSG_CHECKING([if strdup might be used]) + if test "$tst_links_strdup" = "yes" && + test "$tst_proto_strdup" = "yes" && + test "$tst_compi_strdup" = "yes" && + test "$tst_allow_strdup" = "yes"; then + AC_MSG_RESULT([yes]) + AC_DEFINE_UNQUOTED(HAVE_STRDUP, 1, + [Define to 1 if you have the strdup function.]) + ac_cv_func_strdup="yes" + else + AC_MSG_RESULT([no]) + ac_cv_func_strdup="no" + fi +]) + + +dnl CURL_CHECK_FUNC_STRERROR_R +dnl ------------------------------------------------- +dnl Verify if strerror_r is available, prototyped, can be compiled and +dnl seems to work. If all of these are true, and usage has not been +dnl previously disallowed with shell variable curl_disallow_strerror_r, +dnl then HAVE_STRERROR_R and STRERROR_R_TYPE_ARG3 will be defined, as +dnl well as one of HAVE_GLIBC_STRERROR_R or HAVE_POSIX_STRERROR_R. +dnl +dnl glibc-style strerror_r: +dnl +dnl char *strerror_r(int errnum, char *workbuf, size_t bufsize); +dnl +dnl glibc-style strerror_r returns a pointer to the the error string, +dnl and might use the provided workbuf as a scratch area if needed. A +dnl quick test on a few systems shows that it's usually not used at all. +dnl +dnl POSIX-style strerror_r: +dnl +dnl int strerror_r(int errnum, char *resultbuf, size_t bufsize); +dnl +dnl POSIX-style strerror_r returns 0 upon successful completion and the +dnl error string in the provided resultbuf. +dnl + +AC_DEFUN([CURL_CHECK_FUNC_STRERROR_R], [ + AC_REQUIRE([CURL_INCLUDES_STDLIB])dnl + AC_REQUIRE([CURL_INCLUDES_STRING])dnl + # + tst_links_strerror_r="unknown" + tst_proto_strerror_r="unknown" + tst_compi_strerror_r="unknown" + tst_glibc_strerror_r="unknown" + tst_posix_strerror_r="unknown" + tst_allow_strerror_r="unknown" + tst_works_glibc_strerror_r="unknown" + tst_works_posix_strerror_r="unknown" + tst_glibc_strerror_r_type_arg3="unknown" + tst_posix_strerror_r_type_arg3="unknown" + # + AC_MSG_CHECKING([if strerror_r can be linked]) + AC_LINK_IFELSE([ + AC_LANG_FUNC_LINK_TRY([strerror_r]) + ],[ + AC_MSG_RESULT([yes]) + tst_links_strerror_r="yes" + ],[ + AC_MSG_RESULT([no]) + tst_links_strerror_r="no" + ]) + # + if test "$tst_links_strerror_r" = "yes"; then + AC_MSG_CHECKING([if strerror_r is prototyped]) + AC_EGREP_CPP([strerror_r],[ + $curl_includes_string + ],[ + AC_MSG_RESULT([yes]) + tst_proto_strerror_r="yes" + ],[ + AC_MSG_RESULT([no]) + tst_proto_strerror_r="no" + ]) + fi + # + if test "$tst_proto_strerror_r" = "yes"; then + AC_MSG_CHECKING([if strerror_r is compilable]) + AC_COMPILE_IFELSE([ + AC_LANG_PROGRAM([[ + $curl_includes_string + ]],[[ + if(0 != strerror_r(0, 0, 0)) + return 1; + ]]) + ],[ + AC_MSG_RESULT([yes]) + tst_compi_strerror_r="yes" + ],[ + AC_MSG_RESULT([no]) + tst_compi_strerror_r="no" + ]) + fi + # + if test "$tst_compi_strerror_r" = "yes"; then + AC_MSG_CHECKING([if strerror_r is glibc like]) + tst_glibc_strerror_r_type_arg3="unknown" + for arg3 in 'size_t' 'int' 'unsigned int'; do + if test "$tst_glibc_strerror_r_type_arg3" = "unknown"; then + AC_COMPILE_IFELSE([ + AC_LANG_PROGRAM([[ + $curl_includes_string + ]],[[ + char *strerror_r(int errnum, char *workbuf, $arg3 bufsize); + if(0 != strerror_r(0, 0, 0)) + return 1; + ]]) + ],[ + tst_glibc_strerror_r_type_arg3="$arg3" + ]) + fi + done + case "$tst_glibc_strerror_r_type_arg3" in + unknown) + AC_MSG_RESULT([no]) + tst_glibc_strerror_r="no" + ;; + *) + AC_MSG_RESULT([yes]) + tst_glibc_strerror_r="yes" + ;; + esac + fi + # + dnl only do runtime verification when not cross-compiling + if test "x$cross_compiling" != "xyes" && + test "$tst_glibc_strerror_r" = "yes"; then + AC_MSG_CHECKING([if strerror_r seems to work]) + AC_RUN_IFELSE([ + AC_LANG_PROGRAM([[ + $curl_includes_stdlib + $curl_includes_string +# include + ]],[[ + char buffer[1024]; + char *string = 0; + buffer[0] = '\0'; + string = strerror_r(EACCES, buffer, sizeof(buffer)); + if(!string) + exit(1); /* fail */ + if(!string[0]) + exit(1); /* fail */ + else + exit(0); + ]]) + ],[ + AC_MSG_RESULT([yes]) + tst_works_glibc_strerror_r="yes" + ],[ + AC_MSG_RESULT([no]) + tst_works_glibc_strerror_r="no" + ]) + fi + # + if test "$tst_compi_strerror_r" = "yes" && + test "$tst_works_glibc_strerror_r" != "yes"; then + AC_MSG_CHECKING([if strerror_r is POSIX like]) + tst_posix_strerror_r_type_arg3="unknown" + for arg3 in 'size_t' 'int' 'unsigned int'; do + if test "$tst_posix_strerror_r_type_arg3" = "unknown"; then + AC_COMPILE_IFELSE([ + AC_LANG_PROGRAM([[ + $curl_includes_string + ]],[[ + int strerror_r(int errnum, char *resultbuf, $arg3 bufsize); + if(0 != strerror_r(0, 0, 0)) + return 1; + ]]) + ],[ + tst_posix_strerror_r_type_arg3="$arg3" + ]) + fi + done + case "$tst_posix_strerror_r_type_arg3" in + unknown) + AC_MSG_RESULT([no]) + tst_posix_strerror_r="no" + ;; + *) + AC_MSG_RESULT([yes]) + tst_posix_strerror_r="yes" + ;; + esac + fi + # + dnl only do runtime verification when not cross-compiling + if test "x$cross_compiling" != "xyes" && + test "$tst_posix_strerror_r" = "yes"; then + AC_MSG_CHECKING([if strerror_r seems to work]) + AC_RUN_IFELSE([ + AC_LANG_PROGRAM([[ + $curl_includes_stdlib + $curl_includes_string +# include + ]],[[ + char buffer[1024]; + int error = 1; + buffer[0] = '\0'; + error = strerror_r(EACCES, buffer, sizeof(buffer)); + if(error) + exit(1); /* fail */ + if(buffer[0] == '\0') + exit(1); /* fail */ + else + exit(0); + ]]) + ],[ + AC_MSG_RESULT([yes]) + tst_works_posix_strerror_r="yes" + ],[ + AC_MSG_RESULT([no]) + tst_works_posix_strerror_r="no" + ]) + fi + # + if test "$tst_works_glibc_strerror_r" = "yes"; then + tst_posix_strerror_r="no" + fi + if test "$tst_works_posix_strerror_r" = "yes"; then + tst_glibc_strerror_r="no" + fi + if test "$tst_glibc_strerror_r" = "yes" && + test "$tst_works_glibc_strerror_r" != "no" && + test "$tst_posix_strerror_r" != "yes"; then + tst_allow_strerror_r="check" + fi + if test "$tst_posix_strerror_r" = "yes" && + test "$tst_works_posix_strerror_r" != "no" && + test "$tst_glibc_strerror_r" != "yes"; then + tst_allow_strerror_r="check" + fi + if test "$tst_allow_strerror_r" = "check"; then + AC_MSG_CHECKING([if strerror_r usage allowed]) + if test "x$curl_disallow_strerror_r" != "xyes"; then + AC_MSG_RESULT([yes]) + tst_allow_strerror_r="yes" + else + AC_MSG_RESULT([no]) + tst_allow_strerror_r="no" + fi + fi + # + AC_MSG_CHECKING([if strerror_r might be used]) + if test "$tst_links_strerror_r" = "yes" && + test "$tst_proto_strerror_r" = "yes" && + test "$tst_compi_strerror_r" = "yes" && + test "$tst_allow_strerror_r" = "yes"; then + AC_MSG_RESULT([yes]) + if test "$tst_glibc_strerror_r" = "yes"; then + AC_DEFINE_UNQUOTED(HAVE_STRERROR_R, 1, + [Define to 1 if you have the strerror_r function.]) + AC_DEFINE_UNQUOTED(HAVE_GLIBC_STRERROR_R, 1, + [Define to 1 if you have a working glibc-style strerror_r function.]) + AC_DEFINE_UNQUOTED(STRERROR_R_TYPE_ARG3, $tst_glibc_strerror_r_type_arg3, + [Define to the type of arg 3 for strerror_r.]) + fi + if test "$tst_posix_strerror_r" = "yes"; then + AC_DEFINE_UNQUOTED(HAVE_STRERROR_R, 1, + [Define to 1 if you have the strerror_r function.]) + AC_DEFINE_UNQUOTED(HAVE_POSIX_STRERROR_R, 1, + [Define to 1 if you have a working POSIX-style strerror_r function.]) + AC_DEFINE_UNQUOTED(STRERROR_R_TYPE_ARG3, $tst_posix_strerror_r_type_arg3, + [Define to the type of arg 3 for strerror_r.]) + fi + ac_cv_func_strerror_r="yes" + else + AC_MSG_RESULT([no]) + ac_cv_func_strerror_r="no" + fi + # + if test "$tst_compi_strerror_r" = "yes" && + test "$tst_allow_strerror_r" = "unknown"; then + AC_MSG_WARN([cannot determine strerror_r() style: edit lib/curl_config.h manually.]) + fi + # +]) + + +dnl CURL_CHECK_FUNC_STRICMP +dnl ------------------------------------------------- +dnl Verify if stricmp is available, prototyped, and +dnl can be compiled. If all of these are true, and +dnl usage has not been previously disallowed with +dnl shell variable curl_disallow_stricmp, then +dnl HAVE_STRICMP will be defined. + +AC_DEFUN([CURL_CHECK_FUNC_STRICMP], [ + AC_REQUIRE([CURL_INCLUDES_STRING])dnl + # + tst_links_stricmp="unknown" + tst_proto_stricmp="unknown" + tst_compi_stricmp="unknown" + tst_allow_stricmp="unknown" + # + AC_MSG_CHECKING([if stricmp can be linked]) + AC_LINK_IFELSE([ + AC_LANG_FUNC_LINK_TRY([stricmp]) + ],[ + AC_MSG_RESULT([yes]) + tst_links_stricmp="yes" + ],[ + AC_MSG_RESULT([no]) + tst_links_stricmp="no" + ]) + # + if test "$tst_links_stricmp" = "yes"; then + AC_MSG_CHECKING([if stricmp is prototyped]) + AC_EGREP_CPP([stricmp],[ + $curl_includes_string + ],[ + AC_MSG_RESULT([yes]) + tst_proto_stricmp="yes" + ],[ + AC_MSG_RESULT([no]) + tst_proto_stricmp="no" + ]) + fi + # + if test "$tst_proto_stricmp" = "yes"; then + AC_MSG_CHECKING([if stricmp is compilable]) + AC_COMPILE_IFELSE([ + AC_LANG_PROGRAM([[ + $curl_includes_string + ]],[[ + if(0 != stricmp(0, 0)) + return 1; + ]]) + ],[ + AC_MSG_RESULT([yes]) + tst_compi_stricmp="yes" + ],[ + AC_MSG_RESULT([no]) + tst_compi_stricmp="no" + ]) + fi + # + if test "$tst_compi_stricmp" = "yes"; then + AC_MSG_CHECKING([if stricmp usage allowed]) + if test "x$curl_disallow_stricmp" != "xyes"; then + AC_MSG_RESULT([yes]) + tst_allow_stricmp="yes" + else + AC_MSG_RESULT([no]) + tst_allow_stricmp="no" + fi + fi + # + AC_MSG_CHECKING([if stricmp might be used]) + if test "$tst_links_stricmp" = "yes" && + test "$tst_proto_stricmp" = "yes" && + test "$tst_compi_stricmp" = "yes" && + test "$tst_allow_stricmp" = "yes"; then + AC_MSG_RESULT([yes]) + AC_DEFINE_UNQUOTED(HAVE_STRICMP, 1, + [Define to 1 if you have the stricmp function.]) + ac_cv_func_stricmp="yes" + else + AC_MSG_RESULT([no]) + ac_cv_func_stricmp="no" + fi +]) + + +dnl CURL_CHECK_FUNC_STRLCAT +dnl ------------------------------------------------- +dnl Verify if strlcat is available, prototyped, and +dnl can be compiled. If all of these are true, and +dnl usage has not been previously disallowed with +dnl shell variable curl_disallow_strlcat, then +dnl HAVE_STRLCAT will be defined. + +AC_DEFUN([CURL_CHECK_FUNC_STRLCAT], [ + AC_REQUIRE([CURL_INCLUDES_STRING])dnl + # + tst_links_strlcat="unknown" + tst_proto_strlcat="unknown" + tst_compi_strlcat="unknown" + tst_allow_strlcat="unknown" + # + AC_MSG_CHECKING([if strlcat can be linked]) + AC_LINK_IFELSE([ + AC_LANG_FUNC_LINK_TRY([strlcat]) + ],[ + AC_MSG_RESULT([yes]) + tst_links_strlcat="yes" + ],[ + AC_MSG_RESULT([no]) + tst_links_strlcat="no" + ]) + # + if test "$tst_links_strlcat" = "yes"; then + AC_MSG_CHECKING([if strlcat is prototyped]) + AC_EGREP_CPP([strlcat],[ + $curl_includes_string + ],[ + AC_MSG_RESULT([yes]) + tst_proto_strlcat="yes" + ],[ + AC_MSG_RESULT([no]) + tst_proto_strlcat="no" + ]) + fi + # + if test "$tst_proto_strlcat" = "yes"; then + AC_MSG_CHECKING([if strlcat is compilable]) + AC_COMPILE_IFELSE([ + AC_LANG_PROGRAM([[ + $curl_includes_string + ]],[[ + if(0 != strlcat(0, 0, 0)) + return 1; + ]]) + ],[ + AC_MSG_RESULT([yes]) + tst_compi_strlcat="yes" + ],[ + AC_MSG_RESULT([no]) + tst_compi_strlcat="no" + ]) + fi + # + if test "$tst_compi_strlcat" = "yes"; then + AC_MSG_CHECKING([if strlcat usage allowed]) + if test "x$curl_disallow_strlcat" != "xyes"; then + AC_MSG_RESULT([yes]) + tst_allow_strlcat="yes" + else + AC_MSG_RESULT([no]) + tst_allow_strlcat="no" + fi + fi + # + AC_MSG_CHECKING([if strlcat might be used]) + if test "$tst_links_strlcat" = "yes" && + test "$tst_proto_strlcat" = "yes" && + test "$tst_compi_strlcat" = "yes" && + test "$tst_allow_strlcat" = "yes"; then + AC_MSG_RESULT([yes]) + AC_DEFINE_UNQUOTED(HAVE_STRLCAT, 1, + [Define to 1 if you have the strlcat function.]) + ac_cv_func_strlcat="yes" + else + AC_MSG_RESULT([no]) + ac_cv_func_strlcat="no" + fi +]) + + +dnl CURL_CHECK_FUNC_STRNCASECMP +dnl ------------------------------------------------- +dnl Verify if strncasecmp is available, prototyped, and +dnl can be compiled. If all of these are true, and +dnl usage has not been previously disallowed with +dnl shell variable curl_disallow_strncasecmp, then +dnl HAVE_STRNCASECMP will be defined. + +AC_DEFUN([CURL_CHECK_FUNC_STRNCASECMP], [ + AC_REQUIRE([CURL_INCLUDES_STRING])dnl + # + tst_links_strncasecmp="unknown" + tst_proto_strncasecmp="unknown" + tst_compi_strncasecmp="unknown" + tst_allow_strncasecmp="unknown" + # + AC_MSG_CHECKING([if strncasecmp can be linked]) + AC_LINK_IFELSE([ + AC_LANG_FUNC_LINK_TRY([strncasecmp]) + ],[ + AC_MSG_RESULT([yes]) + tst_links_strncasecmp="yes" + ],[ + AC_MSG_RESULT([no]) + tst_links_strncasecmp="no" + ]) + # + if test "$tst_links_strncasecmp" = "yes"; then + AC_MSG_CHECKING([if strncasecmp is prototyped]) + AC_EGREP_CPP([strncasecmp],[ + $curl_includes_string + ],[ + AC_MSG_RESULT([yes]) + tst_proto_strncasecmp="yes" + ],[ + AC_MSG_RESULT([no]) + tst_proto_strncasecmp="no" + ]) + fi + # + if test "$tst_proto_strncasecmp" = "yes"; then + AC_MSG_CHECKING([if strncasecmp is compilable]) + AC_COMPILE_IFELSE([ + AC_LANG_PROGRAM([[ + $curl_includes_string + ]],[[ + if(0 != strncasecmp(0, 0, 0)) + return 1; + ]]) + ],[ + AC_MSG_RESULT([yes]) + tst_compi_strncasecmp="yes" + ],[ + AC_MSG_RESULT([no]) + tst_compi_strncasecmp="no" + ]) + fi + # + if test "$tst_compi_strncasecmp" = "yes"; then + AC_MSG_CHECKING([if strncasecmp usage allowed]) + if test "x$curl_disallow_strncasecmp" != "xyes"; then + AC_MSG_RESULT([yes]) + tst_allow_strncasecmp="yes" + else + AC_MSG_RESULT([no]) + tst_allow_strncasecmp="no" + fi + fi + # + AC_MSG_CHECKING([if strncasecmp might be used]) + if test "$tst_links_strncasecmp" = "yes" && + test "$tst_proto_strncasecmp" = "yes" && + test "$tst_compi_strncasecmp" = "yes" && + test "$tst_allow_strncasecmp" = "yes"; then + AC_MSG_RESULT([yes]) + AC_DEFINE_UNQUOTED(HAVE_STRNCASECMP, 1, + [Define to 1 if you have the strncasecmp function.]) + ac_cv_func_strncasecmp="yes" + else + AC_MSG_RESULT([no]) + ac_cv_func_strncasecmp="no" + fi +]) + + +dnl CURL_CHECK_FUNC_STRNCMPI +dnl ------------------------------------------------- +dnl Verify if strncmpi is available, prototyped, and +dnl can be compiled. If all of these are true, and +dnl usage has not been previously disallowed with +dnl shell variable curl_disallow_strncmpi, then +dnl HAVE_STRNCMPI will be defined. + +AC_DEFUN([CURL_CHECK_FUNC_STRNCMPI], [ + AC_REQUIRE([CURL_INCLUDES_STRING])dnl + # + tst_links_strncmpi="unknown" + tst_proto_strncmpi="unknown" + tst_compi_strncmpi="unknown" + tst_allow_strncmpi="unknown" + # + AC_MSG_CHECKING([if strncmpi can be linked]) + AC_LINK_IFELSE([ + AC_LANG_FUNC_LINK_TRY([strncmpi]) + ],[ + AC_MSG_RESULT([yes]) + tst_links_strncmpi="yes" + ],[ + AC_MSG_RESULT([no]) + tst_links_strncmpi="no" + ]) + # + if test "$tst_links_strncmpi" = "yes"; then + AC_MSG_CHECKING([if strncmpi is prototyped]) + AC_EGREP_CPP([strncmpi],[ + $curl_includes_string + ],[ + AC_MSG_RESULT([yes]) + tst_proto_strncmpi="yes" + ],[ + AC_MSG_RESULT([no]) + tst_proto_strncmpi="no" + ]) + fi + # + if test "$tst_proto_strncmpi" = "yes"; then + AC_MSG_CHECKING([if strncmpi is compilable]) + AC_COMPILE_IFELSE([ + AC_LANG_PROGRAM([[ + $curl_includes_string + ]],[[ + if(0 != strncmpi(0, 0)) + return 1; + ]]) + ],[ + AC_MSG_RESULT([yes]) + tst_compi_strncmpi="yes" + ],[ + AC_MSG_RESULT([no]) + tst_compi_strncmpi="no" + ]) + fi + # + if test "$tst_compi_strncmpi" = "yes"; then + AC_MSG_CHECKING([if strncmpi usage allowed]) + if test "x$curl_disallow_strncmpi" != "xyes"; then + AC_MSG_RESULT([yes]) + tst_allow_strncmpi="yes" + else + AC_MSG_RESULT([no]) + tst_allow_strncmpi="no" + fi + fi + # + AC_MSG_CHECKING([if strncmpi might be used]) + if test "$tst_links_strncmpi" = "yes" && + test "$tst_proto_strncmpi" = "yes" && + test "$tst_compi_strncmpi" = "yes" && + test "$tst_allow_strncmpi" = "yes"; then + AC_MSG_RESULT([yes]) + AC_DEFINE_UNQUOTED(HAVE_STRNCMPI, 1, + [Define to 1 if you have the strncmpi function.]) + ac_cv_func_strncmpi="yes" + else + AC_MSG_RESULT([no]) + ac_cv_func_strncmpi="no" + fi +]) + + +dnl CURL_CHECK_FUNC_STRNICMP +dnl ------------------------------------------------- +dnl Verify if strnicmp is available, prototyped, and +dnl can be compiled. If all of these are true, and +dnl usage has not been previously disallowed with +dnl shell variable curl_disallow_strnicmp, then +dnl HAVE_STRNICMP will be defined. + +AC_DEFUN([CURL_CHECK_FUNC_STRNICMP], [ + AC_REQUIRE([CURL_INCLUDES_STRING])dnl + # + tst_links_strnicmp="unknown" + tst_proto_strnicmp="unknown" + tst_compi_strnicmp="unknown" + tst_allow_strnicmp="unknown" + # + AC_MSG_CHECKING([if strnicmp can be linked]) + AC_LINK_IFELSE([ + AC_LANG_FUNC_LINK_TRY([strnicmp]) + ],[ + AC_MSG_RESULT([yes]) + tst_links_strnicmp="yes" + ],[ + AC_MSG_RESULT([no]) + tst_links_strnicmp="no" + ]) + # + if test "$tst_links_strnicmp" = "yes"; then + AC_MSG_CHECKING([if strnicmp is prototyped]) + AC_EGREP_CPP([strnicmp],[ + $curl_includes_string + ],[ + AC_MSG_RESULT([yes]) + tst_proto_strnicmp="yes" + ],[ + AC_MSG_RESULT([no]) + tst_proto_strnicmp="no" + ]) + fi + # + if test "$tst_proto_strnicmp" = "yes"; then + AC_MSG_CHECKING([if strnicmp is compilable]) + AC_COMPILE_IFELSE([ + AC_LANG_PROGRAM([[ + $curl_includes_string + ]],[[ + if(0 != strnicmp(0, 0)) + return 1; + ]]) + ],[ + AC_MSG_RESULT([yes]) + tst_compi_strnicmp="yes" + ],[ + AC_MSG_RESULT([no]) + tst_compi_strnicmp="no" + ]) + fi + # + if test "$tst_compi_strnicmp" = "yes"; then + AC_MSG_CHECKING([if strnicmp usage allowed]) + if test "x$curl_disallow_strnicmp" != "xyes"; then + AC_MSG_RESULT([yes]) + tst_allow_strnicmp="yes" + else + AC_MSG_RESULT([no]) + tst_allow_strnicmp="no" + fi + fi + # + AC_MSG_CHECKING([if strnicmp might be used]) + if test "$tst_links_strnicmp" = "yes" && + test "$tst_proto_strnicmp" = "yes" && + test "$tst_compi_strnicmp" = "yes" && + test "$tst_allow_strnicmp" = "yes"; then + AC_MSG_RESULT([yes]) + AC_DEFINE_UNQUOTED(HAVE_STRNICMP, 1, + [Define to 1 if you have the strnicmp function.]) + ac_cv_func_strnicmp="yes" + else + AC_MSG_RESULT([no]) + ac_cv_func_strnicmp="no" + fi +]) + + +dnl CURL_CHECK_FUNC_STRSTR +dnl ------------------------------------------------- +dnl Verify if strstr is available, prototyped, and +dnl can be compiled. If all of these are true, and +dnl usage has not been previously disallowed with +dnl shell variable curl_disallow_strstr, then +dnl HAVE_STRSTR will be defined. + +AC_DEFUN([CURL_CHECK_FUNC_STRSTR], [ + AC_REQUIRE([CURL_INCLUDES_STRING])dnl + # + tst_links_strstr="unknown" + tst_proto_strstr="unknown" + tst_compi_strstr="unknown" + tst_allow_strstr="unknown" + # + AC_MSG_CHECKING([if strstr can be linked]) + AC_LINK_IFELSE([ + AC_LANG_FUNC_LINK_TRY([strstr]) + ],[ + AC_MSG_RESULT([yes]) + tst_links_strstr="yes" + ],[ + AC_MSG_RESULT([no]) + tst_links_strstr="no" + ]) + # + if test "$tst_links_strstr" = "yes"; then + AC_MSG_CHECKING([if strstr is prototyped]) + AC_EGREP_CPP([strstr],[ + $curl_includes_string + ],[ + AC_MSG_RESULT([yes]) + tst_proto_strstr="yes" + ],[ + AC_MSG_RESULT([no]) + tst_proto_strstr="no" + ]) + fi + # + if test "$tst_proto_strstr" = "yes"; then + AC_MSG_CHECKING([if strstr is compilable]) + AC_COMPILE_IFELSE([ + AC_LANG_PROGRAM([[ + $curl_includes_string + ]],[[ + if(0 != strstr(0, 0)) + return 1; + ]]) + ],[ + AC_MSG_RESULT([yes]) + tst_compi_strstr="yes" + ],[ + AC_MSG_RESULT([no]) + tst_compi_strstr="no" + ]) + fi + # + if test "$tst_compi_strstr" = "yes"; then + AC_MSG_CHECKING([if strstr usage allowed]) + if test "x$curl_disallow_strstr" != "xyes"; then + AC_MSG_RESULT([yes]) + tst_allow_strstr="yes" + else + AC_MSG_RESULT([no]) + tst_allow_strstr="no" + fi + fi + # + AC_MSG_CHECKING([if strstr might be used]) + if test "$tst_links_strstr" = "yes" && + test "$tst_proto_strstr" = "yes" && + test "$tst_compi_strstr" = "yes" && + test "$tst_allow_strstr" = "yes"; then + AC_MSG_RESULT([yes]) + AC_DEFINE_UNQUOTED(HAVE_STRSTR, 1, + [Define to 1 if you have the strstr function.]) + ac_cv_func_strstr="yes" + else + AC_MSG_RESULT([no]) + ac_cv_func_strstr="no" + fi +]) + + +dnl CURL_CHECK_FUNC_STRTOK_R +dnl ------------------------------------------------- +dnl Verify if strtok_r is available, prototyped, and +dnl can be compiled. If all of these are true, and +dnl usage has not been previously disallowed with +dnl shell variable curl_disallow_strtok_r, then +dnl HAVE_STRTOK_R will be defined. + +AC_DEFUN([CURL_CHECK_FUNC_STRTOK_R], [ + AC_REQUIRE([CURL_INCLUDES_STRING])dnl + # + tst_links_strtok_r="unknown" + tst_proto_strtok_r="unknown" + tst_compi_strtok_r="unknown" + tst_allow_strtok_r="unknown" + # + AC_MSG_CHECKING([if strtok_r can be linked]) + AC_LINK_IFELSE([ + AC_LANG_FUNC_LINK_TRY([strtok_r]) + ],[ + AC_MSG_RESULT([yes]) + tst_links_strtok_r="yes" + ],[ + AC_MSG_RESULT([no]) + tst_links_strtok_r="no" + ]) + # + if test "$tst_links_strtok_r" = "yes"; then + AC_MSG_CHECKING([if strtok_r is prototyped]) + AC_EGREP_CPP([strtok_r],[ + $curl_includes_string + ],[ + AC_MSG_RESULT([yes]) + tst_proto_strtok_r="yes" + ],[ + AC_MSG_RESULT([no]) + tst_proto_strtok_r="no" + ]) + fi + # + if test "$tst_proto_strtok_r" = "yes"; then + AC_MSG_CHECKING([if strtok_r is compilable]) + AC_COMPILE_IFELSE([ + AC_LANG_PROGRAM([[ + $curl_includes_string + ]],[[ + if(0 != strtok_r(0, 0, 0)) + return 1; + ]]) + ],[ + AC_MSG_RESULT([yes]) + tst_compi_strtok_r="yes" + ],[ + AC_MSG_RESULT([no]) + tst_compi_strtok_r="no" + ]) + fi + # + if test "$tst_compi_strtok_r" = "yes"; then + AC_MSG_CHECKING([if strtok_r usage allowed]) + if test "x$curl_disallow_strtok_r" != "xyes"; then + AC_MSG_RESULT([yes]) + tst_allow_strtok_r="yes" + else + AC_MSG_RESULT([no]) + tst_allow_strtok_r="no" + fi + fi + # + AC_MSG_CHECKING([if strtok_r might be used]) + if test "$tst_links_strtok_r" = "yes" && + test "$tst_proto_strtok_r" = "yes" && + test "$tst_compi_strtok_r" = "yes" && + test "$tst_allow_strtok_r" = "yes"; then + AC_MSG_RESULT([yes]) + AC_DEFINE_UNQUOTED(HAVE_STRTOK_R, 1, + [Define to 1 if you have the strtok_r function.]) + ac_cv_func_strtok_r="yes" + else + AC_MSG_RESULT([no]) + ac_cv_func_strtok_r="no" + fi +]) + + +dnl CURL_CHECK_FUNC_STRTOLL +dnl ------------------------------------------------- +dnl Verify if strtoll is available, prototyped, and +dnl can be compiled. If all of these are true, and +dnl usage has not been previously disallowed with +dnl shell variable curl_disallow_strtoll, then +dnl HAVE_STRTOLL will be defined. + +AC_DEFUN([CURL_CHECK_FUNC_STRTOLL], [ + AC_REQUIRE([CURL_INCLUDES_STDLIB])dnl + # + tst_links_strtoll="unknown" + tst_proto_strtoll="unknown" + tst_compi_strtoll="unknown" + tst_allow_strtoll="unknown" + # + AC_MSG_CHECKING([if strtoll can be linked]) + AC_LINK_IFELSE([ + AC_LANG_FUNC_LINK_TRY([strtoll]) + ],[ + AC_MSG_RESULT([yes]) + tst_links_strtoll="yes" + ],[ + AC_MSG_RESULT([no]) + tst_links_strtoll="no" + ]) + # + if test "$tst_links_strtoll" = "yes"; then + AC_MSG_CHECKING([if strtoll is prototyped]) + AC_EGREP_CPP([strtoll],[ + $curl_includes_stdlib + ],[ + AC_MSG_RESULT([yes]) + tst_proto_strtoll="yes" + ],[ + AC_MSG_RESULT([no]) + tst_proto_strtoll="no" + ]) + fi + # + if test "$tst_proto_strtoll" = "yes"; then + AC_MSG_CHECKING([if strtoll is compilable]) + AC_COMPILE_IFELSE([ + AC_LANG_PROGRAM([[ + $curl_includes_stdlib + ]],[[ + if(0 != strtoll(0, 0, 0)) + return 1; + ]]) + ],[ + AC_MSG_RESULT([yes]) + tst_compi_strtoll="yes" + ],[ + AC_MSG_RESULT([no]) + tst_compi_strtoll="no" + ]) + fi + # + if test "$tst_compi_strtoll" = "yes"; then + AC_MSG_CHECKING([if strtoll usage allowed]) + if test "x$curl_disallow_strtoll" != "xyes"; then + AC_MSG_RESULT([yes]) + tst_allow_strtoll="yes" + else + AC_MSG_RESULT([no]) + tst_allow_strtoll="no" + fi + fi + # + AC_MSG_CHECKING([if strtoll might be used]) + if test "$tst_links_strtoll" = "yes" && + test "$tst_proto_strtoll" = "yes" && + test "$tst_compi_strtoll" = "yes" && + test "$tst_allow_strtoll" = "yes"; then + AC_MSG_RESULT([yes]) + AC_DEFINE_UNQUOTED(HAVE_STRTOLL, 1, + [Define to 1 if you have the strtoll function.]) + ac_cv_func_strtoll="yes" + else + AC_MSG_RESULT([no]) + ac_cv_func_strtoll="no" + fi +]) + + +dnl CURL_CHECK_FUNC_WRITEV +dnl ------------------------------------------------- +dnl Verify if writev is available, prototyped, and +dnl can be compiled. If all of these are true, and +dnl usage has not been previously disallowed with +dnl shell variable curl_disallow_writev, then +dnl HAVE_WRITEV will be defined. + +AC_DEFUN([CURL_CHECK_FUNC_WRITEV], [ + AC_REQUIRE([CURL_INCLUDES_SYS_UIO])dnl + # + tst_links_writev="unknown" + tst_proto_writev="unknown" + tst_compi_writev="unknown" + tst_allow_writev="unknown" + # + AC_MSG_CHECKING([if writev can be linked]) + AC_LINK_IFELSE([ + AC_LANG_FUNC_LINK_TRY([writev]) + ],[ + AC_MSG_RESULT([yes]) + tst_links_writev="yes" + ],[ + AC_MSG_RESULT([no]) + tst_links_writev="no" + ]) + # + if test "$tst_links_writev" = "yes"; then + AC_MSG_CHECKING([if writev is prototyped]) + AC_EGREP_CPP([writev],[ + $curl_includes_sys_uio + ],[ + AC_MSG_RESULT([yes]) + tst_proto_writev="yes" + ],[ + AC_MSG_RESULT([no]) + tst_proto_writev="no" + ]) + fi + # + if test "$tst_proto_writev" = "yes"; then + AC_MSG_CHECKING([if writev is compilable]) + AC_COMPILE_IFELSE([ + AC_LANG_PROGRAM([[ + $curl_includes_sys_uio + ]],[[ + if(0 != writev(0, 0, 0)) + return 1; + ]]) + ],[ + AC_MSG_RESULT([yes]) + tst_compi_writev="yes" + ],[ + AC_MSG_RESULT([no]) + tst_compi_writev="no" + ]) + fi + # + if test "$tst_compi_writev" = "yes"; then + AC_MSG_CHECKING([if writev usage allowed]) + if test "x$curl_disallow_writev" != "xyes"; then + AC_MSG_RESULT([yes]) + tst_allow_writev="yes" + else + AC_MSG_RESULT([no]) + tst_allow_writev="no" + fi + fi + # + AC_MSG_CHECKING([if writev might be used]) + if test "$tst_links_writev" = "yes" && + test "$tst_proto_writev" = "yes" && + test "$tst_compi_writev" = "yes" && + test "$tst_allow_writev" = "yes"; then + AC_MSG_RESULT([yes]) + AC_DEFINE_UNQUOTED(HAVE_WRITEV, 1, + [Define to 1 if you have the writev function.]) + ac_cv_func_writev="yes" + else + AC_MSG_RESULT([no]) + ac_cv_func_writev="no" + fi +]) diff --git a/mobicore/common/curl/m4/curl-override.m4 b/mobicore/common/curl/m4/curl-override.m4 new file mode 100644 index 0000000000000000000000000000000000000000..326c59cef1ff1db91faae151c775c7fb1c86d261 --- /dev/null +++ b/mobicore/common/curl/m4/curl-override.m4 @@ -0,0 +1,101 @@ +#*************************************************************************** +#*************************************************************************** + +# File version for 'aclocal' use. Keep it a single number. +# serial 3 + +dnl CURL_OVERRIDE_AUTOCONF +dnl ------------------------------------------------- +dnl Placing a call to this macro in configure.ac after +dnl the one to AC_INIT will make macros in this file +dnl visible to the rest of the compilation overriding +dnl those from Autoconf. + +AC_DEFUN([CURL_OVERRIDE_AUTOCONF], [ +AC_BEFORE([$0],[AC_PROG_LIBTOOL]) +# using curl-override.m4 +]) + +dnl Override some Libtool tests +dnl ------------------------------------------------- +dnl This is done to prevent Libtool 1.5.X from doing +dnl unnecesary C++, Fortran and Java tests and reduce +dnl resulting configure script by nearly 300 Kb. + +m4_define([AC_LIBTOOL_LANG_CXX_CONFIG],[:]) +m4_define([AC_LIBTOOL_LANG_F77_CONFIG],[:]) +m4_define([AC_LIBTOOL_LANG_GCJ_CONFIG],[:]) + +dnl Override Autoconf's AC_LANG_PROGRAM (C) +dnl ------------------------------------------------- +dnl This is done to prevent compiler warning +dnl 'function declaration isn't a prototype' +dnl in function main. This requires at least +dnl a c89 compiler and does not suport K&R. + +m4_define([AC_LANG_PROGRAM(C)], +[$1 +int main (void) +{ +$2 + ; + return 0; +}]) + +dnl Override Autoconf's AC_LANG_CALL (C) +dnl ------------------------------------------------- +dnl This is a backport of Autoconf's 2.60 with the +dnl embedded comments that hit the resulting script +dnl removed. This is done to reduce configure size +dnl and use fixed macro across Autoconf versions. + +m4_define([AC_LANG_CALL(C)], +[AC_LANG_PROGRAM([$1 +m4_if([$2], [main], , +[ +#ifdef __cplusplus +extern "C" +#endif +char $2 ();])], [return $2 ();])]) + +dnl Override Autoconf's AC_LANG_FUNC_LINK_TRY (C) +dnl ------------------------------------------------- +dnl This is a backport of Autoconf's 2.60 with the +dnl embedded comments that hit the resulting script +dnl removed. This is done to reduce configure size +dnl and use fixed macro across Autoconf versions. + +m4_define([AC_LANG_FUNC_LINK_TRY(C)], +[AC_LANG_PROGRAM( +[ +#define $1 innocuous_$1 +#ifdef __STDC__ +# include +#else +# include +#endif +#undef $1 +#ifdef __cplusplus +extern "C" +#endif +char $1 (); +#if defined __stub_$1 || defined __stub___$1 +choke me +#endif +], [return $1 ();])]) + +dnl Override Autoconf's PATH_SEPARATOR check +dnl ------------------------------------------------- +dnl This is done to ensure that the same check is +dnl used across different Autoconf versions and to +dnl allow us to use this macro early enough in the +dnl configure script. + +m4_defun([_AS_PATH_SEPARATOR_PREPARE], +[CURL_CHECK_PATH_SEPARATOR +m4_define([$0],[])]) + +m4_defun([_LT_AC_LIBTOOL_SYS_PATH_SEPARATOR], +[CURL_CHECK_PATH_SEPARATOR +m4_define([$0],[])]) + diff --git a/mobicore/common/curl/m4/curl-reentrant.m4 b/mobicore/common/curl/m4/curl-reentrant.m4 new file mode 100644 index 0000000000000000000000000000000000000000..2e2d868d6632aeb393c2ce2f0d95626eb56473a8 --- /dev/null +++ b/mobicore/common/curl/m4/curl-reentrant.m4 @@ -0,0 +1,617 @@ +#*************************************************************************** +# _ _ ____ _ +# Project ___| | | | _ \| | +# / __| | | | |_) | | +# | (__| |_| | _ <| |___ +# \___|\___/|_| \_\_____| +# +# Copyright (C) 1998 - 2009, Daniel Stenberg, , et al. +# +# This software is licensed as described in the file COPYING, which +# you should have received as part of this distribution. The terms +# are also available at http://curl.haxx.se/docs/copyright.html. +# +# You may opt to use, copy, modify, merge, publish, distribute and/or sell +# copies of the Software, and permit persons to whom the Software is +# furnished to do so, under the terms of the COPYING file. +# +# This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY +# KIND, either express or implied. +# +#*************************************************************************** + +# File version for 'aclocal' use. Keep it a single number. +# serial 8 + +dnl Note 1 +dnl ------ +dnl None of the CURL_CHECK_NEED_REENTRANT_* macros shall use HAVE_FOO_H to +dnl conditionally include header files. These macros are used early in the +dnl configure process much before header file availability is known. + + +dnl CURL_CHECK_NEED_REENTRANT_ERRNO +dnl ------------------------------------------------- +dnl Checks if the preprocessor _REENTRANT definition +dnl makes errno available as a preprocessor macro. + +AC_DEFUN([CURL_CHECK_NEED_REENTRANT_ERRNO], [ + AC_COMPILE_IFELSE([ + AC_LANG_PROGRAM([[ +#include + ]],[[ + if(0 != errno) + return 1; + ]]) + ],[ + tmp_errno="yes" + ],[ + tmp_errno="no" + ]) + if test "$tmp_errno" = "yes"; then + AC_COMPILE_IFELSE([ + AC_LANG_PROGRAM([[ +#include + ]],[[ +#ifdef errno + int dummy=1; +#else + force compilation error +#endif + ]]) + ],[ + tmp_errno="errno_macro_defined" + ],[ + AC_COMPILE_IFELSE([ + AC_LANG_PROGRAM([[ +#define _REENTRANT +#include + ]],[[ +#ifdef errno + int dummy=1; +#else + force compilation error +#endif + ]]) + ],[ + tmp_errno="errno_macro_needs_reentrant" + tmp_need_reentrant="yes" + ]) + ]) + fi +]) + + +dnl CURL_CHECK_NEED_REENTRANT_GMTIME_R +dnl ------------------------------------------------- +dnl Checks if the preprocessor _REENTRANT definition +dnl makes function gmtime_r compiler visible. + +AC_DEFUN([CURL_CHECK_NEED_REENTRANT_GMTIME_R], [ + AC_LINK_IFELSE([ + AC_LANG_FUNC_LINK_TRY([gmtime_r]) + ],[ + tmp_gmtime_r="yes" + ],[ + tmp_gmtime_r="no" + ]) + if test "$tmp_gmtime_r" = "yes"; then + AC_EGREP_CPP([gmtime_r],[ +#include +#include + ],[ + tmp_gmtime_r="proto_declared" + ],[ + AC_EGREP_CPP([gmtime_r],[ +#define _REENTRANT +#include +#include + ],[ + tmp_gmtime_r="proto_needs_reentrant" + tmp_need_reentrant="yes" + ]) + ]) + fi +]) + + +dnl CURL_CHECK_NEED_REENTRANT_LOCALTIME_R +dnl ------------------------------------------------- +dnl Checks if the preprocessor _REENTRANT definition +dnl makes function localtime_r compiler visible. + +AC_DEFUN([CURL_CHECK_NEED_REENTRANT_LOCALTIME_R], [ + AC_LINK_IFELSE([ + AC_LANG_FUNC_LINK_TRY([localtime_r]) + ],[ + tmp_localtime_r="yes" + ],[ + tmp_localtime_r="no" + ]) + if test "$tmp_localtime_r" = "yes"; then + AC_EGREP_CPP([localtime_r],[ +#include +#include + ],[ + tmp_localtime_r="proto_declared" + ],[ + AC_EGREP_CPP([localtime_r],[ +#define _REENTRANT +#include +#include + ],[ + tmp_localtime_r="proto_needs_reentrant" + tmp_need_reentrant="yes" + ]) + ]) + fi +]) + + +dnl CURL_CHECK_NEED_REENTRANT_STRERROR_R +dnl ------------------------------------------------- +dnl Checks if the preprocessor _REENTRANT definition +dnl makes function strerror_r compiler visible. + +AC_DEFUN([CURL_CHECK_NEED_REENTRANT_STRERROR_R], [ + AC_LINK_IFELSE([ + AC_LANG_FUNC_LINK_TRY([strerror_r]) + ],[ + tmp_strerror_r="yes" + ],[ + tmp_strerror_r="no" + ]) + if test "$tmp_strerror_r" = "yes"; then + AC_EGREP_CPP([strerror_r],[ +#include +#include + ],[ + tmp_strerror_r="proto_declared" + ],[ + AC_EGREP_CPP([strerror_r],[ +#define _REENTRANT +#include +#include + ],[ + tmp_strerror_r="proto_needs_reentrant" + tmp_need_reentrant="yes" + ]) + ]) + fi +]) + + +dnl CURL_CHECK_NEED_REENTRANT_STRTOK_R +dnl ------------------------------------------------- +dnl Checks if the preprocessor _REENTRANT definition +dnl makes function strtok_r compiler visible. + +AC_DEFUN([CURL_CHECK_NEED_REENTRANT_STRTOK_R], [ + AC_LINK_IFELSE([ + AC_LANG_FUNC_LINK_TRY([strtok_r]) + ],[ + tmp_strtok_r="yes" + ],[ + tmp_strtok_r="no" + ]) + if test "$tmp_strtok_r" = "yes"; then + AC_EGREP_CPP([strtok_r],[ +#include +#include + ],[ + tmp_strtok_r="proto_declared" + ],[ + AC_EGREP_CPP([strtok_r],[ +#define _REENTRANT +#include +#include + ],[ + tmp_strtok_r="proto_needs_reentrant" + tmp_need_reentrant="yes" + ]) + ]) + fi +]) + + +dnl CURL_CHECK_NEED_REENTRANT_INET_NTOA_R +dnl ------------------------------------------------- +dnl Checks if the preprocessor _REENTRANT definition +dnl makes function inet_ntoa_r compiler visible. + +AC_DEFUN([CURL_CHECK_NEED_REENTRANT_INET_NTOA_R], [ + AC_LINK_IFELSE([ + AC_LANG_FUNC_LINK_TRY([inet_ntoa_r]) + ],[ + tmp_inet_ntoa_r="yes" + ],[ + tmp_inet_ntoa_r="no" + ]) + if test "$tmp_inet_ntoa_r" = "yes"; then + AC_EGREP_CPP([inet_ntoa_r],[ +#include +#include +#include +#include + ],[ + tmp_inet_ntoa_r="proto_declared" + ],[ + AC_EGREP_CPP([inet_ntoa_r],[ +#define _REENTRANT +#include +#include +#include +#include + ],[ + tmp_inet_ntoa_r="proto_needs_reentrant" + tmp_need_reentrant="yes" + ]) + ]) + fi +]) + + +dnl CURL_CHECK_NEED_REENTRANT_GETHOSTBYADDR_R +dnl ------------------------------------------------- +dnl Checks if the preprocessor _REENTRANT definition +dnl makes function gethostbyaddr_r compiler visible. + +AC_DEFUN([CURL_CHECK_NEED_REENTRANT_GETHOSTBYADDR_R], [ + AC_LINK_IFELSE([ + AC_LANG_FUNC_LINK_TRY([gethostbyaddr_r]) + ],[ + tmp_gethostbyaddr_r="yes" + ],[ + tmp_gethostbyaddr_r="no" + ]) + if test "$tmp_gethostbyaddr_r" = "yes"; then + AC_EGREP_CPP([gethostbyaddr_r],[ +#include +#include + ],[ + tmp_gethostbyaddr_r="proto_declared" + ],[ + AC_EGREP_CPP([gethostbyaddr_r],[ +#define _REENTRANT +#include +#include + ],[ + tmp_gethostbyaddr_r="proto_needs_reentrant" + tmp_need_reentrant="yes" + ]) + ]) + fi +]) + + +dnl CURL_CHECK_NEED_REENTRANT_GETHOSTBYNAME_R +dnl ------------------------------------------------- +dnl Checks if the preprocessor _REENTRANT definition +dnl makes function gethostbyname_r compiler visible. + +AC_DEFUN([CURL_CHECK_NEED_REENTRANT_GETHOSTBYNAME_R], [ + AC_LINK_IFELSE([ + AC_LANG_FUNC_LINK_TRY([gethostbyname_r]) + ],[ + tmp_gethostbyname_r="yes" + ],[ + tmp_gethostbyname_r="no" + ]) + if test "$tmp_gethostbyname_r" = "yes"; then + AC_EGREP_CPP([gethostbyname_r],[ +#include +#include + ],[ + tmp_gethostbyname_r="proto_declared" + ],[ + AC_EGREP_CPP([gethostbyname_r],[ +#define _REENTRANT +#include +#include + ],[ + tmp_gethostbyname_r="proto_needs_reentrant" + tmp_need_reentrant="yes" + ]) + ]) + fi +]) + + +dnl CURL_CHECK_NEED_REENTRANT_GETPROTOBYNAME_R +dnl ------------------------------------------------- +dnl Checks if the preprocessor _REENTRANT definition +dnl makes function getprotobyname_r compiler visible. + +AC_DEFUN([CURL_CHECK_NEED_REENTRANT_GETPROTOBYNAME_R], [ + AC_LINK_IFELSE([ + AC_LANG_FUNC_LINK_TRY([getprotobyname_r]) + ],[ + tmp_getprotobyname_r="yes" + ],[ + tmp_getprotobyname_r="no" + ]) + if test "$tmp_getprotobyname_r" = "yes"; then + AC_EGREP_CPP([getprotobyname_r],[ +#include +#include + ],[ + tmp_getprotobyname_r="proto_declared" + ],[ + AC_EGREP_CPP([getprotobyname_r],[ +#define _REENTRANT +#include +#include + ],[ + tmp_getprotobyname_r="proto_needs_reentrant" + tmp_need_reentrant="yes" + ]) + ]) + fi +]) + + +dnl CURL_CHECK_NEED_REENTRANT_GETSERVBYPORT_R +dnl ------------------------------------------------- +dnl Checks if the preprocessor _REENTRANT definition +dnl makes function getservbyport_r compiler visible. + +AC_DEFUN([CURL_CHECK_NEED_REENTRANT_GETSERVBYPORT_R], [ + AC_LINK_IFELSE([ + AC_LANG_FUNC_LINK_TRY([getservbyport_r]) + ],[ + tmp_getservbyport_r="yes" + ],[ + tmp_getservbyport_r="no" + ]) + if test "$tmp_getservbyport_r" = "yes"; then + AC_EGREP_CPP([getservbyport_r],[ +#include +#include + ],[ + tmp_getservbyport_r="proto_declared" + ],[ + AC_EGREP_CPP([getservbyport_r],[ +#define _REENTRANT +#include +#include + ],[ + tmp_getservbyport_r="proto_needs_reentrant" + tmp_need_reentrant="yes" + ]) + ]) + fi +]) + + +dnl CURL_CHECK_NEED_REENTRANT_FUNCTIONS_R +dnl ------------------------------------------------- +dnl Checks if the preprocessor _REENTRANT definition +dnl makes several _r functions compiler visible. +dnl Internal macro for CURL_CONFIGURE_REENTRANT. + +AC_DEFUN([CURL_CHECK_NEED_REENTRANT_FUNCTIONS_R], [ + if test "$tmp_need_reentrant" = "no"; then + CURL_CHECK_NEED_REENTRANT_GMTIME_R + fi + if test "$tmp_need_reentrant" = "no"; then + CURL_CHECK_NEED_REENTRANT_LOCALTIME_R + fi + if test "$tmp_need_reentrant" = "no"; then + CURL_CHECK_NEED_REENTRANT_STRERROR_R + fi + if test "$tmp_need_reentrant" = "no"; then + CURL_CHECK_NEED_REENTRANT_STRTOK_R + fi + if test "$tmp_need_reentrant" = "no"; then + CURL_CHECK_NEED_REENTRANT_INET_NTOA_R + fi + if test "$tmp_need_reentrant" = "no"; then + CURL_CHECK_NEED_REENTRANT_GETHOSTBYADDR_R + fi + if test "$tmp_need_reentrant" = "no"; then + CURL_CHECK_NEED_REENTRANT_GETHOSTBYNAME_R + fi + if test "$tmp_need_reentrant" = "no"; then + CURL_CHECK_NEED_REENTRANT_GETPROTOBYNAME_R + fi + if test "$tmp_need_reentrant" = "no"; then + CURL_CHECK_NEED_REENTRANT_GETSERVBYPORT_R + fi +]) + + +dnl CURL_CHECK_NEED_REENTRANT_SYSTEM +dnl ------------------------------------------------- +dnl Checks if the preprocessor _REENTRANT definition +dnl must be unconditionally done for this platform. +dnl Internal macro for CURL_CONFIGURE_REENTRANT. + +AC_DEFUN([CURL_CHECK_NEED_REENTRANT_SYSTEM], [ + case $host_os in + solaris*) + tmp_need_reentrant="yes" + ;; + *) + tmp_need_reentrant="no" + ;; + esac +]) + + +dnl CURL_CHECK_NEED_THREAD_SAFE_SYSTEM +dnl ------------------------------------------------- +dnl Checks if the preprocessor _THREAD_SAFE definition +dnl must be unconditionally done for this platform. +dnl Internal macro for CURL_CONFIGURE_THREAD_SAFE. + +AC_DEFUN([CURL_CHECK_NEED_THREAD_SAFE_SYSTEM], [ + case $host_os in + aix[[123]].* | aix4.[[012]].*) + dnl aix 4.2 and older + tmp_need_thread_safe="no" + ;; + aix*) + dnl AIX 4.3 and newer + tmp_need_thread_safe="yes" + ;; + *) + tmp_need_thread_safe="no" + ;; + esac +]) + + +dnl CURL_CONFIGURE_FROM_NOW_ON_WITH_REENTRANT +dnl ------------------------------------------------- +dnl This macro ensures that configuration tests done +dnl after this will execute with preprocessor symbol +dnl _REENTRANT defined. This macro also ensures that +dnl the generated config file defines NEED_REENTRANT +dnl and that in turn setup.h will define _REENTRANT. +dnl Internal macro for CURL_CONFIGURE_REENTRANT. + +AC_DEFUN([CURL_CONFIGURE_FROM_NOW_ON_WITH_REENTRANT], [ +AC_DEFINE(NEED_REENTRANT, 1, + [Define to 1 if _REENTRANT preprocessor symbol must be defined.]) +cat >>confdefs.h <<_EOF +#ifndef _REENTRANT +# define _REENTRANT +#endif +_EOF +]) + + +dnl CURL_CONFIGURE_FROM_NOW_ON_WITH_THREAD_SAFE +dnl ------------------------------------------------- +dnl This macro ensures that configuration tests done +dnl after this will execute with preprocessor symbol +dnl _THREAD_SAFE defined. This macro also ensures that +dnl the generated config file defines NEED_THREAD_SAFE +dnl and that in turn setup.h will define _THREAD_SAFE. +dnl Internal macro for CURL_CONFIGURE_THREAD_SAFE. + +AC_DEFUN([CURL_CONFIGURE_FROM_NOW_ON_WITH_THREAD_SAFE], [ +AC_DEFINE(NEED_THREAD_SAFE, 1, + [Define to 1 if _THREAD_SAFE preprocessor symbol must be defined.]) +cat >>confdefs.h <<_EOF +#ifndef _THREAD_SAFE +# define _THREAD_SAFE +#endif +_EOF +]) + + +dnl CURL_CONFIGURE_REENTRANT +dnl ------------------------------------------------- +dnl This first checks if the preprocessor _REENTRANT +dnl symbol is already defined. If it isn't currently +dnl defined a set of checks are performed to verify +dnl if its definition is required to make visible to +dnl the compiler a set of *_r functions. Finally, if +dnl _REENTRANT is already defined or needed it takes +dnl care of making adjustments necessary to ensure +dnl that it is defined equally for further configure +dnl tests and generated config file. + +AC_DEFUN([CURL_CONFIGURE_REENTRANT], [ + AC_PREREQ([2.50])dnl + # + AC_MSG_CHECKING([if _REENTRANT is already defined]) + AC_COMPILE_IFELSE([ + AC_LANG_PROGRAM([[ + ]],[[ +#ifdef _REENTRANT + int dummy=1; +#else + force compilation error +#endif + ]]) + ],[ + AC_MSG_RESULT([yes]) + tmp_reentrant_initially_defined="yes" + ],[ + AC_MSG_RESULT([no]) + tmp_reentrant_initially_defined="no" + ]) + # + if test "$tmp_reentrant_initially_defined" = "no"; then + AC_MSG_CHECKING([if _REENTRANT is actually needed]) + CURL_CHECK_NEED_REENTRANT_SYSTEM + if test "$tmp_need_reentrant" = "no"; then + CURL_CHECK_NEED_REENTRANT_ERRNO + fi + if test "$tmp_need_reentrant" = "no"; then + CURL_CHECK_NEED_REENTRANT_FUNCTIONS_R + fi + if test "$tmp_need_reentrant" = "yes"; then + AC_MSG_RESULT([yes]) + else + AC_MSG_RESULT([no]) + fi + fi + # + AC_MSG_CHECKING([if _REENTRANT is onwards defined]) + if test "$tmp_reentrant_initially_defined" = "yes" || + test "$tmp_need_reentrant" = "yes"; then + CURL_CONFIGURE_FROM_NOW_ON_WITH_REENTRANT + AC_MSG_RESULT([yes]) + else + AC_MSG_RESULT([no]) + fi + # +]) + + +dnl CURL_CONFIGURE_THREAD_SAFE +dnl ------------------------------------------------- +dnl This first checks if the preprocessor _THREAD_SAFE +dnl symbol is already defined. If it isn't currently +dnl defined a set of checks are performed to verify +dnl if its definition is required. Finally, if +dnl _THREAD_SAFE is already defined or needed it takes +dnl care of making adjustments necessary to ensure +dnl that it is defined equally for further configure +dnl tests and generated config file. + +AC_DEFUN([CURL_CONFIGURE_THREAD_SAFE], [ + AC_PREREQ([2.50])dnl + # + AC_MSG_CHECKING([if _THREAD_SAFE is already defined]) + AC_COMPILE_IFELSE([ + AC_LANG_PROGRAM([[ + ]],[[ +#ifdef _THREAD_SAFE + int dummy=1; +#else + force compilation error +#endif + ]]) + ],[ + AC_MSG_RESULT([yes]) + tmp_thread_safe_initially_defined="yes" + ],[ + AC_MSG_RESULT([no]) + tmp_thread_safe_initially_defined="no" + ]) + # + if test "$tmp_thread_safe_initially_defined" = "no"; then + AC_MSG_CHECKING([if _THREAD_SAFE is actually needed]) + CURL_CHECK_NEED_THREAD_SAFE_SYSTEM + if test "$tmp_need_thread_safe" = "yes"; then + AC_MSG_RESULT([yes]) + else + AC_MSG_RESULT([no]) + fi + fi + # + AC_MSG_CHECKING([if _THREAD_SAFE is onwards defined]) + if test "$tmp_thread_safe_initially_defined" = "yes" || + test "$tmp_need_thread_safe" = "yes"; then + CURL_CONFIGURE_FROM_NOW_ON_WITH_THREAD_SAFE + AC_MSG_RESULT([yes]) + else + AC_MSG_RESULT([no]) + fi + # +]) + diff --git a/mobicore/common/curl/m4/curl-system.m4 b/mobicore/common/curl/m4/curl-system.m4 new file mode 100644 index 0000000000000000000000000000000000000000..6e3e9f97b5a07291027b8d367860e72b60b13164 --- /dev/null +++ b/mobicore/common/curl/m4/curl-system.m4 @@ -0,0 +1,88 @@ +#*************************************************************************** +# _ _ ____ _ +# Project ___| | | | _ \| | +# / __| | | | |_) | | +# | (__| |_| | _ <| |___ +# \___|\___/|_| \_\_____| +# +# Copyright (C) 1998 - 2009, Daniel Stenberg, , et al. +# +# This software is licensed as described in the file COPYING, which +# you should have received as part of this distribution. The terms +# are also available at http://curl.haxx.se/docs/copyright.html. +# +# You may opt to use, copy, modify, merge, publish, distribute and/or sell +# copies of the Software, and permit persons to whom the Software is +# furnished to do so, under the terms of the COPYING file. +# +# This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY +# KIND, either express or implied. +# +#*************************************************************************** + +# File version for 'aclocal' use. Keep it a single number. +# serial 3 + + +dnl CURL_CHECK_PATH_SEPARATOR +dnl ------------------------------------------------- +dnl Check and compute the path separator for us. This +dnl path separator is the symbol used to diferentiate +dnl or separate paths inside the PATH environment var. + +AC_DEFUN([CURL_CHECK_PATH_SEPARATOR], [ + if test -z "$curl_cv_PATH_SEPARATOR"; then + if test -z "$PATH"; then + AC_MSG_ERROR([PATH not set. Cannot continue without PATH being set.]) + fi + dnl Directory count in PATH when using a colon separator. + tst_dirs_col=0 + tst_save_IFS=$IFS; IFS=':' + for tst_dir in $PATH; do + IFS=$tst_save_IFS + test -d "$tst_dir" && tst_dirs_col=`expr $tst_dirs_col + 1` + done + IFS=$tst_save_IFS + dnl Directory count in PATH when using a semicolon separator. + tst_dirs_sem=0 + tst_save_IFS=$IFS; IFS=';' + for tst_dir in $PATH; do + IFS=$tst_save_IFS + test -d "$tst_dir" && tst_dirs_sem=`expr $tst_dirs_sem + 1` + done + IFS=$tst_save_IFS + if test $tst_dirs_sem -eq $tst_dirs_col; then + dnl When both counting methods give the same result we do not want to + dnl chose one over the other, and consider auto-detection not possible. + if test -z "$PATH_SEPARATOR"; then + dnl Stop dead until user provides PATH_SEPARATOR definition. + AC_MSG_ERROR([PATH_SEPARATOR not set. Cannot continue without it.]) + fi + else + dnl Separator with the greater directory count is the auto-detected one. + if test $tst_dirs_sem -gt $tst_dirs_col; then + tst_auto_separator=';' + else + tst_auto_separator=':' + fi + if test -z "$PATH_SEPARATOR"; then + dnl Simply use the auto-detected one when not already set. + PATH_SEPARATOR="$tst_auto_separator" + fi + fi + curl_cv_PATH_SEPARATOR="$PATH_SEPARATOR" + fi + AC_SUBST([PATH_SEPARATOR]) + AC_SUBST([PATH]) +]) + + +dnl CURL_CHECK_PATH_SEPARATOR_REQUIRED +dnl ------------------------------------------------- +dnl Use this to ensure that the path separator check +dnl macro is only expanded and included once. + +AC_DEFUN([CURL_CHECK_PATH_SEPARATOR_REQUIRED], [ + AC_REQUIRE([CURL_CHECK_PATH_SEPARATOR])dnl +]) + diff --git a/mobicore/common/curl/m4/ltoptions.m4 b/mobicore/common/curl/m4/ltoptions.m4 new file mode 100644 index 0000000000000000000000000000000000000000..34151a3ba625f326e6645d6afc79586f10746a3e --- /dev/null +++ b/mobicore/common/curl/m4/ltoptions.m4 @@ -0,0 +1,368 @@ +# Helper functions for option handling. -*- Autoconf -*- +# +# Copyright (C) 2004, 2005, 2007, 2008 Free Software Foundation, Inc. +# Written by Gary V. Vaughan, 2004 +# +# This file is free software; the Free Software Foundation gives +# unlimited permission to copy and/or distribute it, with or without +# modifications, as long as this notice is preserved. + +# serial 6 ltoptions.m4 + +# This is to help aclocal find these macros, as it can't see m4_define. +AC_DEFUN([LTOPTIONS_VERSION], [m4_if([1])]) + + +# _LT_MANGLE_OPTION(MACRO-NAME, OPTION-NAME) +# ------------------------------------------ +m4_define([_LT_MANGLE_OPTION], +[[_LT_OPTION_]m4_bpatsubst($1__$2, [[^a-zA-Z0-9_]], [_])]) + + +# _LT_SET_OPTION(MACRO-NAME, OPTION-NAME) +# --------------------------------------- +# Set option OPTION-NAME for macro MACRO-NAME, and if there is a +# matching handler defined, dispatch to it. Other OPTION-NAMEs are +# saved as a flag. +m4_define([_LT_SET_OPTION], +[m4_define(_LT_MANGLE_OPTION([$1], [$2]))dnl +m4_ifdef(_LT_MANGLE_DEFUN([$1], [$2]), + _LT_MANGLE_DEFUN([$1], [$2]), + [m4_warning([Unknown $1 option `$2'])])[]dnl +]) + + +# _LT_IF_OPTION(MACRO-NAME, OPTION-NAME, IF-SET, [IF-NOT-SET]) +# ------------------------------------------------------------ +# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise. +m4_define([_LT_IF_OPTION], +[m4_ifdef(_LT_MANGLE_OPTION([$1], [$2]), [$3], [$4])]) + + +# _LT_UNLESS_OPTIONS(MACRO-NAME, OPTION-LIST, IF-NOT-SET) +# ------------------------------------------------------- +# Execute IF-NOT-SET unless all options in OPTION-LIST for MACRO-NAME +# are set. +m4_define([_LT_UNLESS_OPTIONS], +[m4_foreach([_LT_Option], m4_split(m4_normalize([$2])), + [m4_ifdef(_LT_MANGLE_OPTION([$1], _LT_Option), + [m4_define([$0_found])])])[]dnl +m4_ifdef([$0_found], [m4_undefine([$0_found])], [$3 +])[]dnl +]) + + +# _LT_SET_OPTIONS(MACRO-NAME, OPTION-LIST) +# ---------------------------------------- +# OPTION-LIST is a space-separated list of Libtool options associated +# with MACRO-NAME. If any OPTION has a matching handler declared with +# LT_OPTION_DEFINE, dispatch to that macro; otherwise complain about +# the unknown option and exit. +m4_defun([_LT_SET_OPTIONS], +[# Set options +m4_foreach([_LT_Option], m4_split(m4_normalize([$2])), + [_LT_SET_OPTION([$1], _LT_Option)]) + +m4_if([$1],[LT_INIT],[ + dnl + dnl Simply set some default values (i.e off) if boolean options were not + dnl specified: + _LT_UNLESS_OPTIONS([LT_INIT], [dlopen], [enable_dlopen=no + ]) + _LT_UNLESS_OPTIONS([LT_INIT], [win32-dll], [enable_win32_dll=no + ]) + dnl + dnl If no reference was made to various pairs of opposing options, then + dnl we run the default mode handler for the pair. For example, if neither + dnl `shared' nor `disable-shared' was passed, we enable building of shared + dnl archives by default: + _LT_UNLESS_OPTIONS([LT_INIT], [shared disable-shared], [_LT_ENABLE_SHARED]) + _LT_UNLESS_OPTIONS([LT_INIT], [static disable-static], [_LT_ENABLE_STATIC]) + _LT_UNLESS_OPTIONS([LT_INIT], [pic-only no-pic], [_LT_WITH_PIC]) + _LT_UNLESS_OPTIONS([LT_INIT], [fast-install disable-fast-install], + [_LT_ENABLE_FAST_INSTALL]) + ]) +])# _LT_SET_OPTIONS + + +## --------------------------------- ## +## Macros to handle LT_INIT options. ## +## --------------------------------- ## + +# _LT_MANGLE_DEFUN(MACRO-NAME, OPTION-NAME) +# ----------------------------------------- +m4_define([_LT_MANGLE_DEFUN], +[[_LT_OPTION_DEFUN_]m4_bpatsubst(m4_toupper([$1__$2]), [[^A-Z0-9_]], [_])]) + + +# LT_OPTION_DEFINE(MACRO-NAME, OPTION-NAME, CODE) +# ----------------------------------------------- +m4_define([LT_OPTION_DEFINE], +[m4_define(_LT_MANGLE_DEFUN([$1], [$2]), [$3])[]dnl +])# LT_OPTION_DEFINE + + +# dlopen +# ------ +LT_OPTION_DEFINE([LT_INIT], [dlopen], [enable_dlopen=yes +]) + +AU_DEFUN([AC_LIBTOOL_DLOPEN], +[_LT_SET_OPTION([LT_INIT], [dlopen]) +AC_DIAGNOSE([obsolete], +[$0: Remove this warning and the call to _LT_SET_OPTION when you +put the `dlopen' option into LT_INIT's first parameter.]) +]) + +dnl aclocal-1.4 backwards compatibility: +dnl AC_DEFUN([AC_LIBTOOL_DLOPEN], []) + + +# win32-dll +# --------- +# Declare package support for building win32 dll's. +LT_OPTION_DEFINE([LT_INIT], [win32-dll], +[enable_win32_dll=yes + +case $host in +*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-cegcc*) + AC_CHECK_TOOL(AS, as, false) + AC_CHECK_TOOL(DLLTOOL, dlltool, false) + AC_CHECK_TOOL(OBJDUMP, objdump, false) + ;; +esac + +test -z "$AS" && AS=as +_LT_DECL([], [AS], [0], [Assembler program])dnl + +test -z "$DLLTOOL" && DLLTOOL=dlltool +_LT_DECL([], [DLLTOOL], [0], [DLL creation program])dnl + +test -z "$OBJDUMP" && OBJDUMP=objdump +_LT_DECL([], [OBJDUMP], [0], [Object dumper program])dnl +])# win32-dll + +AU_DEFUN([AC_LIBTOOL_WIN32_DLL], +[AC_REQUIRE([AC_CANONICAL_HOST])dnl +_LT_SET_OPTION([LT_INIT], [win32-dll]) +AC_DIAGNOSE([obsolete], +[$0: Remove this warning and the call to _LT_SET_OPTION when you +put the `win32-dll' option into LT_INIT's first parameter.]) +]) + +dnl aclocal-1.4 backwards compatibility: +dnl AC_DEFUN([AC_LIBTOOL_WIN32_DLL], []) + + +# _LT_ENABLE_SHARED([DEFAULT]) +# ---------------------------- +# implement the --enable-shared flag, and supports the `shared' and +# `disable-shared' LT_INIT options. +# DEFAULT is either `yes' or `no'. If omitted, it defaults to `yes'. +m4_define([_LT_ENABLE_SHARED], +[m4_define([_LT_ENABLE_SHARED_DEFAULT], [m4_if($1, no, no, yes)])dnl +AC_ARG_ENABLE([shared], + [AS_HELP_STRING([--enable-shared@<:@=PKGS@:>@], + [build shared libraries @<:@default=]_LT_ENABLE_SHARED_DEFAULT[@:>@])], + [p=${PACKAGE-default} + case $enableval in + yes) enable_shared=yes ;; + no) enable_shared=no ;; + *) + enable_shared=no + # Look at the argument we got. We use all the common list separators. + lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," + for pkg in $enableval; do + IFS="$lt_save_ifs" + if test "X$pkg" = "X$p"; then + enable_shared=yes + fi + done + IFS="$lt_save_ifs" + ;; + esac], + [enable_shared=]_LT_ENABLE_SHARED_DEFAULT) + + _LT_DECL([build_libtool_libs], [enable_shared], [0], + [Whether or not to build shared libraries]) +])# _LT_ENABLE_SHARED + +LT_OPTION_DEFINE([LT_INIT], [shared], [_LT_ENABLE_SHARED([yes])]) +LT_OPTION_DEFINE([LT_INIT], [disable-shared], [_LT_ENABLE_SHARED([no])]) + +# Old names: +AC_DEFUN([AC_ENABLE_SHARED], +[_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[shared]) +]) + +AC_DEFUN([AC_DISABLE_SHARED], +[_LT_SET_OPTION([LT_INIT], [disable-shared]) +]) + +AU_DEFUN([AM_ENABLE_SHARED], [AC_ENABLE_SHARED($@)]) +AU_DEFUN([AM_DISABLE_SHARED], [AC_DISABLE_SHARED($@)]) + +dnl aclocal-1.4 backwards compatibility: +dnl AC_DEFUN([AM_ENABLE_SHARED], []) +dnl AC_DEFUN([AM_DISABLE_SHARED], []) + + + +# _LT_ENABLE_STATIC([DEFAULT]) +# ---------------------------- +# implement the --enable-static flag, and support the `static' and +# `disable-static' LT_INIT options. +# DEFAULT is either `yes' or `no'. If omitted, it defaults to `yes'. +m4_define([_LT_ENABLE_STATIC], +[m4_define([_LT_ENABLE_STATIC_DEFAULT], [m4_if($1, no, no, yes)])dnl +AC_ARG_ENABLE([static], + [AS_HELP_STRING([--enable-static@<:@=PKGS@:>@], + [build static libraries @<:@default=]_LT_ENABLE_STATIC_DEFAULT[@:>@])], + [p=${PACKAGE-default} + case $enableval in + yes) enable_static=yes ;; + no) enable_static=no ;; + *) + enable_static=no + # Look at the argument we got. We use all the common list separators. + lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," + for pkg in $enableval; do + IFS="$lt_save_ifs" + if test "X$pkg" = "X$p"; then + enable_static=yes + fi + done + IFS="$lt_save_ifs" + ;; + esac], + [enable_static=]_LT_ENABLE_STATIC_DEFAULT) + + _LT_DECL([build_old_libs], [enable_static], [0], + [Whether or not to build static libraries]) +])# _LT_ENABLE_STATIC + +LT_OPTION_DEFINE([LT_INIT], [static], [_LT_ENABLE_STATIC([yes])]) +LT_OPTION_DEFINE([LT_INIT], [disable-static], [_LT_ENABLE_STATIC([no])]) + +# Old names: +AC_DEFUN([AC_ENABLE_STATIC], +[_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[static]) +]) + +AC_DEFUN([AC_DISABLE_STATIC], +[_LT_SET_OPTION([LT_INIT], [disable-static]) +]) + +AU_DEFUN([AM_ENABLE_STATIC], [AC_ENABLE_STATIC($@)]) +AU_DEFUN([AM_DISABLE_STATIC], [AC_DISABLE_STATIC($@)]) + +dnl aclocal-1.4 backwards compatibility: +dnl AC_DEFUN([AM_ENABLE_STATIC], []) +dnl AC_DEFUN([AM_DISABLE_STATIC], []) + + + +# _LT_ENABLE_FAST_INSTALL([DEFAULT]) +# ---------------------------------- +# implement the --enable-fast-install flag, and support the `fast-install' +# and `disable-fast-install' LT_INIT options. +# DEFAULT is either `yes' or `no'. If omitted, it defaults to `yes'. +m4_define([_LT_ENABLE_FAST_INSTALL], +[m4_define([_LT_ENABLE_FAST_INSTALL_DEFAULT], [m4_if($1, no, no, yes)])dnl +AC_ARG_ENABLE([fast-install], + [AS_HELP_STRING([--enable-fast-install@<:@=PKGS@:>@], + [optimize for fast installation @<:@default=]_LT_ENABLE_FAST_INSTALL_DEFAULT[@:>@])], + [p=${PACKAGE-default} + case $enableval in + yes) enable_fast_install=yes ;; + no) enable_fast_install=no ;; + *) + enable_fast_install=no + # Look at the argument we got. We use all the common list separators. + lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," + for pkg in $enableval; do + IFS="$lt_save_ifs" + if test "X$pkg" = "X$p"; then + enable_fast_install=yes + fi + done + IFS="$lt_save_ifs" + ;; + esac], + [enable_fast_install=]_LT_ENABLE_FAST_INSTALL_DEFAULT) + +_LT_DECL([fast_install], [enable_fast_install], [0], + [Whether or not to optimize for fast installation])dnl +])# _LT_ENABLE_FAST_INSTALL + +LT_OPTION_DEFINE([LT_INIT], [fast-install], [_LT_ENABLE_FAST_INSTALL([yes])]) +LT_OPTION_DEFINE([LT_INIT], [disable-fast-install], [_LT_ENABLE_FAST_INSTALL([no])]) + +# Old names: +AU_DEFUN([AC_ENABLE_FAST_INSTALL], +[_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[fast-install]) +AC_DIAGNOSE([obsolete], +[$0: Remove this warning and the call to _LT_SET_OPTION when you put +the `fast-install' option into LT_INIT's first parameter.]) +]) + +AU_DEFUN([AC_DISABLE_FAST_INSTALL], +[_LT_SET_OPTION([LT_INIT], [disable-fast-install]) +AC_DIAGNOSE([obsolete], +[$0: Remove this warning and the call to _LT_SET_OPTION when you put +the `disable-fast-install' option into LT_INIT's first parameter.]) +]) + +dnl aclocal-1.4 backwards compatibility: +dnl AC_DEFUN([AC_ENABLE_FAST_INSTALL], []) +dnl AC_DEFUN([AM_DISABLE_FAST_INSTALL], []) + + +# _LT_WITH_PIC([MODE]) +# -------------------- +# implement the --with-pic flag, and support the `pic-only' and `no-pic' +# LT_INIT options. +# MODE is either `yes' or `no'. If omitted, it defaults to `both'. +m4_define([_LT_WITH_PIC], +[AC_ARG_WITH([pic], + [AS_HELP_STRING([--with-pic], + [try to use only PIC/non-PIC objects @<:@default=use both@:>@])], + [pic_mode="$withval"], + [pic_mode=default]) + +test -z "$pic_mode" && pic_mode=m4_default([$1], [default]) + +_LT_DECL([], [pic_mode], [0], [What type of objects to build])dnl +])# _LT_WITH_PIC + +LT_OPTION_DEFINE([LT_INIT], [pic-only], [_LT_WITH_PIC([yes])]) +LT_OPTION_DEFINE([LT_INIT], [no-pic], [_LT_WITH_PIC([no])]) + +# Old name: +AU_DEFUN([AC_LIBTOOL_PICMODE], +[_LT_SET_OPTION([LT_INIT], [pic-only]) +AC_DIAGNOSE([obsolete], +[$0: Remove this warning and the call to _LT_SET_OPTION when you +put the `pic-only' option into LT_INIT's first parameter.]) +]) + +dnl aclocal-1.4 backwards compatibility: +dnl AC_DEFUN([AC_LIBTOOL_PICMODE], []) + +## ----------------- ## +## LTDL_INIT Options ## +## ----------------- ## + +m4_define([_LTDL_MODE], []) +LT_OPTION_DEFINE([LTDL_INIT], [nonrecursive], + [m4_define([_LTDL_MODE], [nonrecursive])]) +LT_OPTION_DEFINE([LTDL_INIT], [recursive], + [m4_define([_LTDL_MODE], [recursive])]) +LT_OPTION_DEFINE([LTDL_INIT], [subproject], + [m4_define([_LTDL_MODE], [subproject])]) + +m4_define([_LTDL_TYPE], []) +LT_OPTION_DEFINE([LTDL_INIT], [installable], + [m4_define([_LTDL_TYPE], [installable])]) +LT_OPTION_DEFINE([LTDL_INIT], [convenience], + [m4_define([_LTDL_TYPE], [convenience])]) diff --git a/mobicore/common/curl/m4/ltsugar.m4 b/mobicore/common/curl/m4/ltsugar.m4 new file mode 100644 index 0000000000000000000000000000000000000000..9000a057d31ddf75cb85ccda8757de4493bcdbe7 --- /dev/null +++ b/mobicore/common/curl/m4/ltsugar.m4 @@ -0,0 +1,123 @@ +# ltsugar.m4 -- libtool m4 base layer. -*-Autoconf-*- +# +# Copyright (C) 2004, 2005, 2007, 2008 Free Software Foundation, Inc. +# Written by Gary V. Vaughan, 2004 +# +# This file is free software; the Free Software Foundation gives +# unlimited permission to copy and/or distribute it, with or without +# modifications, as long as this notice is preserved. + +# serial 6 ltsugar.m4 + +# This is to help aclocal find these macros, as it can't see m4_define. +AC_DEFUN([LTSUGAR_VERSION], [m4_if([0.1])]) + + +# lt_join(SEP, ARG1, [ARG2...]) +# ----------------------------- +# Produce ARG1SEPARG2...SEPARGn, omitting [] arguments and their +# associated separator. +# Needed until we can rely on m4_join from Autoconf 2.62, since all earlier +# versions in m4sugar had bugs. +m4_define([lt_join], +[m4_if([$#], [1], [], + [$#], [2], [[$2]], + [m4_if([$2], [], [], [[$2]_])$0([$1], m4_shift(m4_shift($@)))])]) +m4_define([_lt_join], +[m4_if([$#$2], [2], [], + [m4_if([$2], [], [], [[$1$2]])$0([$1], m4_shift(m4_shift($@)))])]) + + +# lt_car(LIST) +# lt_cdr(LIST) +# ------------ +# Manipulate m4 lists. +# These macros are necessary as long as will still need to support +# Autoconf-2.59 which quotes differently. +m4_define([lt_car], [[$1]]) +m4_define([lt_cdr], +[m4_if([$#], 0, [m4_fatal([$0: cannot be called without arguments])], + [$#], 1, [], + [m4_dquote(m4_shift($@))])]) +m4_define([lt_unquote], $1) + + +# lt_append(MACRO-NAME, STRING, [SEPARATOR]) +# ------------------------------------------ +# Redefine MACRO-NAME to hold its former content plus `SEPARATOR'`STRING'. +# Note that neither SEPARATOR nor STRING are expanded; they are appended +# to MACRO-NAME as is (leaving the expansion for when MACRO-NAME is invoked). +# No SEPARATOR is output if MACRO-NAME was previously undefined (different +# than defined and empty). +# +# This macro is needed until we can rely on Autoconf 2.62, since earlier +# versions of m4sugar mistakenly expanded SEPARATOR but not STRING. +m4_define([lt_append], +[m4_define([$1], + m4_ifdef([$1], [m4_defn([$1])[$3]])[$2])]) + + + +# lt_combine(SEP, PREFIX-LIST, INFIX, SUFFIX1, [SUFFIX2...]) +# ---------------------------------------------------------- +# Produce a SEP delimited list of all paired combinations of elements of +# PREFIX-LIST with SUFFIX1 through SUFFIXn. Each element of the list +# has the form PREFIXmINFIXSUFFIXn. +# Needed until we can rely on m4_combine added in Autoconf 2.62. +m4_define([lt_combine], +[m4_if(m4_eval([$# > 3]), [1], + [m4_pushdef([_Lt_sep], [m4_define([_Lt_sep], m4_defn([lt_car]))])]]dnl +[[m4_foreach([_Lt_prefix], [$2], + [m4_foreach([_Lt_suffix], + ]m4_dquote(m4_dquote(m4_shift(m4_shift(m4_shift($@)))))[, + [_Lt_sep([$1])[]m4_defn([_Lt_prefix])[$3]m4_defn([_Lt_suffix])])])])]) + + +# lt_if_append_uniq(MACRO-NAME, VARNAME, [SEPARATOR], [UNIQ], [NOT-UNIQ]) +# ----------------------------------------------------------------------- +# Iff MACRO-NAME does not yet contain VARNAME, then append it (delimited +# by SEPARATOR if supplied) and expand UNIQ, else NOT-UNIQ. +m4_define([lt_if_append_uniq], +[m4_ifdef([$1], + [m4_if(m4_index([$3]m4_defn([$1])[$3], [$3$2$3]), [-1], + [lt_append([$1], [$2], [$3])$4], + [$5])], + [lt_append([$1], [$2], [$3])$4])]) + + +# lt_dict_add(DICT, KEY, VALUE) +# ----------------------------- +m4_define([lt_dict_add], +[m4_define([$1($2)], [$3])]) + + +# lt_dict_add_subkey(DICT, KEY, SUBKEY, VALUE) +# -------------------------------------------- +m4_define([lt_dict_add_subkey], +[m4_define([$1($2:$3)], [$4])]) + + +# lt_dict_fetch(DICT, KEY, [SUBKEY]) +# ---------------------------------- +m4_define([lt_dict_fetch], +[m4_ifval([$3], + m4_ifdef([$1($2:$3)], [m4_defn([$1($2:$3)])]), + m4_ifdef([$1($2)], [m4_defn([$1($2)])]))]) + + +# lt_if_dict_fetch(DICT, KEY, [SUBKEY], VALUE, IF-TRUE, [IF-FALSE]) +# ----------------------------------------------------------------- +m4_define([lt_if_dict_fetch], +[m4_if(lt_dict_fetch([$1], [$2], [$3]), [$4], + [$5], + [$6])]) + + +# lt_dict_filter(DICT, [SUBKEY], VALUE, [SEPARATOR], KEY, [...]) +# -------------------------------------------------------------- +m4_define([lt_dict_filter], +[m4_if([$5], [], [], + [lt_join(m4_quote(m4_default([$4], [[, ]])), + lt_unquote(m4_split(m4_normalize(m4_foreach(_Lt_key, lt_car([m4_shiftn(4, $@)]), + [lt_if_dict_fetch([$1], _Lt_key, [$2], [$3], [_Lt_key ])])))))])[]dnl +]) diff --git a/mobicore/common/curl/m4/ltversion.m4 b/mobicore/common/curl/m4/ltversion.m4 new file mode 100644 index 0000000000000000000000000000000000000000..f3c5309802447a3b341b1a2c5e4d74ec138b311a --- /dev/null +++ b/mobicore/common/curl/m4/ltversion.m4 @@ -0,0 +1,23 @@ +# ltversion.m4 -- version numbers -*- Autoconf -*- +# +# Copyright (C) 2004 Free Software Foundation, Inc. +# Written by Scott James Remnant, 2004 +# +# This file is free software; the Free Software Foundation gives +# unlimited permission to copy and/or distribute it, with or without +# modifications, as long as this notice is preserved. + +# Generated from ltversion.in. + +# serial 3017 ltversion.m4 +# This file is part of GNU Libtool + +m4_define([LT_PACKAGE_VERSION], [2.2.6b]) +m4_define([LT_PACKAGE_REVISION], [1.3017]) + +AC_DEFUN([LTVERSION_VERSION], +[macro_version='2.2.6b' +macro_revision='1.3017' +_LT_DECL(, macro_version, 0, [Which release of libtool.m4 was used?]) +_LT_DECL(, macro_revision, 0) +]) diff --git a/mobicore/common/curl/m4/lt~obsolete.m4 b/mobicore/common/curl/m4/lt~obsolete.m4 new file mode 100644 index 0000000000000000000000000000000000000000..637bb2066c425f79faecd6cc9e4e6b5074c6b55c --- /dev/null +++ b/mobicore/common/curl/m4/lt~obsolete.m4 @@ -0,0 +1,92 @@ +# lt~obsolete.m4 -- aclocal satisfying obsolete definitions. -*-Autoconf-*- +# +# Copyright (C) 2004, 2005, 2007 Free Software Foundation, Inc. +# Written by Scott James Remnant, 2004. +# +# This file is free software; the Free Software Foundation gives +# unlimited permission to copy and/or distribute it, with or without +# modifications, as long as this notice is preserved. + +# serial 4 lt~obsolete.m4 + +# These exist entirely to fool aclocal when bootstrapping libtool. +# +# In the past libtool.m4 has provided macros via AC_DEFUN (or AU_DEFUN) +# which have later been changed to m4_define as they aren't part of the +# exported API, or moved to Autoconf or Automake where they belong. +# +# The trouble is, aclocal is a bit thick. It'll see the old AC_DEFUN +# in /usr/share/aclocal/libtool.m4 and remember it, then when it sees us +# using a macro with the same name in our local m4/libtool.m4 it'll +# pull the old libtool.m4 in (it doesn't see our shiny new m4_define +# and doesn't know about Autoconf macros at all.) +# +# So we provide this file, which has a silly filename so it's always +# included after everything else. This provides aclocal with the +# AC_DEFUNs it wants, but when m4 processes it, it doesn't do anything +# because those macros already exist, or will be overwritten later. +# We use AC_DEFUN over AU_DEFUN for compatibility with aclocal-1.6. +# +# Anytime we withdraw an AC_DEFUN or AU_DEFUN, remember to add it here. +# Yes, that means every name once taken will need to remain here until +# we give up compatibility with versions before 1.7, at which point +# we need to keep only those names which we still refer to. + +# This is to help aclocal find these macros, as it can't see m4_define. +AC_DEFUN([LTOBSOLETE_VERSION], [m4_if([1])]) + +m4_ifndef([AC_LIBTOOL_LINKER_OPTION], [AC_DEFUN([AC_LIBTOOL_LINKER_OPTION])]) +m4_ifndef([AC_PROG_EGREP], [AC_DEFUN([AC_PROG_EGREP])]) +m4_ifndef([_LT_AC_PROG_ECHO_BACKSLASH], [AC_DEFUN([_LT_AC_PROG_ECHO_BACKSLASH])]) +m4_ifndef([_LT_AC_SHELL_INIT], [AC_DEFUN([_LT_AC_SHELL_INIT])]) +m4_ifndef([_LT_AC_SYS_LIBPATH_AIX], [AC_DEFUN([_LT_AC_SYS_LIBPATH_AIX])]) +m4_ifndef([_LT_PROG_LTMAIN], [AC_DEFUN([_LT_PROG_LTMAIN])]) +m4_ifndef([_LT_AC_TAGVAR], [AC_DEFUN([_LT_AC_TAGVAR])]) +m4_ifndef([AC_LTDL_ENABLE_INSTALL], [AC_DEFUN([AC_LTDL_ENABLE_INSTALL])]) +m4_ifndef([AC_LTDL_PREOPEN], [AC_DEFUN([AC_LTDL_PREOPEN])]) +m4_ifndef([_LT_AC_SYS_COMPILER], [AC_DEFUN([_LT_AC_SYS_COMPILER])]) +m4_ifndef([_LT_AC_LOCK], [AC_DEFUN([_LT_AC_LOCK])]) +m4_ifndef([AC_LIBTOOL_SYS_OLD_ARCHIVE], [AC_DEFUN([AC_LIBTOOL_SYS_OLD_ARCHIVE])]) +m4_ifndef([_LT_AC_TRY_DLOPEN_SELF], [AC_DEFUN([_LT_AC_TRY_DLOPEN_SELF])]) +m4_ifndef([AC_LIBTOOL_PROG_CC_C_O], [AC_DEFUN([AC_LIBTOOL_PROG_CC_C_O])]) +m4_ifndef([AC_LIBTOOL_SYS_HARD_LINK_LOCKS], [AC_DEFUN([AC_LIBTOOL_SYS_HARD_LINK_LOCKS])]) +m4_ifndef([AC_LIBTOOL_OBJDIR], [AC_DEFUN([AC_LIBTOOL_OBJDIR])]) +m4_ifndef([AC_LTDL_OBJDIR], [AC_DEFUN([AC_LTDL_OBJDIR])]) +m4_ifndef([AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH], [AC_DEFUN([AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH])]) +m4_ifndef([AC_LIBTOOL_SYS_LIB_STRIP], [AC_DEFUN([AC_LIBTOOL_SYS_LIB_STRIP])]) +m4_ifndef([AC_PATH_MAGIC], [AC_DEFUN([AC_PATH_MAGIC])]) +m4_ifndef([AC_PROG_LD_GNU], [AC_DEFUN([AC_PROG_LD_GNU])]) +m4_ifndef([AC_PROG_LD_RELOAD_FLAG], [AC_DEFUN([AC_PROG_LD_RELOAD_FLAG])]) +m4_ifndef([AC_DEPLIBS_CHECK_METHOD], [AC_DEFUN([AC_DEPLIBS_CHECK_METHOD])]) +m4_ifndef([AC_LIBTOOL_PROG_COMPILER_NO_RTTI], [AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_NO_RTTI])]) +m4_ifndef([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE], [AC_DEFUN([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE])]) +m4_ifndef([AC_LIBTOOL_PROG_COMPILER_PIC], [AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_PIC])]) +m4_ifndef([AC_LIBTOOL_PROG_LD_SHLIBS], [AC_DEFUN([AC_LIBTOOL_PROG_LD_SHLIBS])]) +m4_ifndef([AC_LIBTOOL_POSTDEP_PREDEP], [AC_DEFUN([AC_LIBTOOL_POSTDEP_PREDEP])]) +m4_ifndef([LT_AC_PROG_EGREP], [AC_DEFUN([LT_AC_PROG_EGREP])]) +m4_ifndef([LT_AC_PROG_SED], [AC_DEFUN([LT_AC_PROG_SED])]) +m4_ifndef([_LT_CC_BASENAME], [AC_DEFUN([_LT_CC_BASENAME])]) +m4_ifndef([_LT_COMPILER_BOILERPLATE], [AC_DEFUN([_LT_COMPILER_BOILERPLATE])]) +m4_ifndef([_LT_LINKER_BOILERPLATE], [AC_DEFUN([_LT_LINKER_BOILERPLATE])]) +m4_ifndef([_AC_PROG_LIBTOOL], [AC_DEFUN([_AC_PROG_LIBTOOL])]) +m4_ifndef([AC_LIBTOOL_SETUP], [AC_DEFUN([AC_LIBTOOL_SETUP])]) +m4_ifndef([_LT_AC_CHECK_DLFCN], [AC_DEFUN([_LT_AC_CHECK_DLFCN])]) +m4_ifndef([AC_LIBTOOL_SYS_DYNAMIC_LINKER], [AC_DEFUN([AC_LIBTOOL_SYS_DYNAMIC_LINKER])]) +m4_ifndef([_LT_AC_TAGCONFIG], [AC_DEFUN([_LT_AC_TAGCONFIG])]) +m4_ifndef([AC_DISABLE_FAST_INSTALL], [AC_DEFUN([AC_DISABLE_FAST_INSTALL])]) +m4_ifndef([_LT_AC_LANG_CXX], [AC_DEFUN([_LT_AC_LANG_CXX])]) +m4_ifndef([_LT_AC_LANG_F77], [AC_DEFUN([_LT_AC_LANG_F77])]) +m4_ifndef([_LT_AC_LANG_GCJ], [AC_DEFUN([_LT_AC_LANG_GCJ])]) +m4_ifndef([AC_LIBTOOL_RC], [AC_DEFUN([AC_LIBTOOL_RC])]) +m4_ifndef([AC_LIBTOOL_LANG_C_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_C_CONFIG])]) +m4_ifndef([_LT_AC_LANG_C_CONFIG], [AC_DEFUN([_LT_AC_LANG_C_CONFIG])]) +m4_ifndef([AC_LIBTOOL_LANG_CXX_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_CXX_CONFIG])]) +m4_ifndef([_LT_AC_LANG_CXX_CONFIG], [AC_DEFUN([_LT_AC_LANG_CXX_CONFIG])]) +m4_ifndef([AC_LIBTOOL_LANG_F77_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_F77_CONFIG])]) +m4_ifndef([_LT_AC_LANG_F77_CONFIG], [AC_DEFUN([_LT_AC_LANG_F77_CONFIG])]) +m4_ifndef([AC_LIBTOOL_LANG_GCJ_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_GCJ_CONFIG])]) +m4_ifndef([_LT_AC_LANG_GCJ_CONFIG], [AC_DEFUN([_LT_AC_LANG_GCJ_CONFIG])]) +m4_ifndef([AC_LIBTOOL_LANG_RC_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_RC_CONFIG])]) +m4_ifndef([_LT_AC_LANG_RC_CONFIG], [AC_DEFUN([_LT_AC_LANG_RC_CONFIG])]) +m4_ifndef([AC_LIBTOOL_CONFIG], [AC_DEFUN([AC_LIBTOOL_CONFIG])]) +m4_ifndef([_LT_AC_FILE_LTDLL_C], [AC_DEFUN([_LT_AC_FILE_LTDLL_C])]) diff --git a/mobicore/common/curl/maketgz b/mobicore/common/curl/maketgz new file mode 100644 index 0000000000000000000000000000000000000000..b2a09be48dd8d04e5f01d6dbe90599456e0a36ec --- /dev/null +++ b/mobicore/common/curl/maketgz @@ -0,0 +1,186 @@ +#! /bin/sh +# Script to build release-archives with. Note that this requires a checkout +# from git and you should first run ./buildconf and build curl once. +# +#*************************************************************************** +# _ _ ____ _ +# Project ___| | | | _ \| | +# / __| | | | |_) | | +# | (__| |_| | _ <| |___ +# \___|\___/|_| \_\_____| +# +# Copyright (C) 1998 - 2010, Daniel Stenberg, , et al. +# +# This software is licensed as described in the file COPYING, which +# you should have received as part of this distribution. The terms +# are also available at http://curl.haxx.se/docs/copyright.html. +# +# You may opt to use, copy, modify, merge, publish, distribute and/or sell +# copies of the Software, and permit persons to whom the Software is +# furnished to do so, under the terms of the COPYING file. +# +# This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY +# KIND, either express or implied. +# +########################################################################### + +version=$1 + +if [ -z "$version" ]; then + echo "Specify a version number!" + exit +fi + +libversion="$version" + +# we make curl the same version as libcurl +curlversion=$libversion + +major=`echo $libversion |cut -d. -f1 | sed -e "s/[^0-9]//g"` +minor=`echo $libversion |cut -d. -f2 | sed -e "s/[^0-9]//g"` +patch=`echo $libversion |cut -d. -f3 | cut -d- -f1 | sed -e "s/[^0-9]//g"` + +numeric=`perl -e 'printf("%02x%02x%02x\n", '"$major, $minor, $patch);"` + +HEADER=include/curl/curlver.h +CHEADER=src/version.h + +# requires a date command that knows -u for UTC time zone +datestamp=`date -u` + +# Replace version number in header file: +sed -e 's/^#define LIBCURL_VERSION .*/#define LIBCURL_VERSION "'$libversion'"/g' \ + -e 's/^#define LIBCURL_VERSION_NUM .*/#define LIBCURL_VERSION_NUM 0x'$numeric'/g' \ + -e 's/^#define LIBCURL_VERSION_MAJOR .*/#define LIBCURL_VERSION_MAJOR '$major'/g' \ + -e 's/^#define LIBCURL_VERSION_MINOR .*/#define LIBCURL_VERSION_MINOR '$minor'/g' \ + -e 's/^#define LIBCURL_VERSION_PATCH .*/#define LIBCURL_VERSION_PATCH '$patch'/g' \ + -e "s/^#define LIBCURL_TIMESTAMP .*/#define LIBCURL_TIMESTAMP \"$datestamp\"/g" \ + $HEADER >$HEADER.dist + +# Replace version number in header file: +sed 's/#define CURL_VERSION .*/#define CURL_VERSION "'$curlversion'"/g' $CHEADER >$CHEADER.dist + +# Generate VC8, VC9, and VC10 versions from the VC6 Makefile versions +for ver in vc8 vc9 vc10; do + make -f Makefile.dist $ver + mv src/Makefile.$ver src/Makefile.$ver.dist + mv lib/Makefile.$ver lib/Makefile.$ver.dist +done + +# Replace version number in plist file: +PLIST=lib/libcurl.plist +sed "s/7\.12\.3/$libversion/g" $PLIST > $PLIST.dist + +echo "curl version $curlversion" +echo "libcurl version $libversion" +echo "libcurl numerical $numeric" +echo "datestamp $datestamp" + +findprog() +{ + file="$1" + for part in `echo $PATH| tr ':' ' '`; do + path="$part/$file" + if [ -x "$path" ]; then + # there it is! + return 1 + fi + done + + # no such executable + return 0 +} + +echo "maketgz: cp lib/curl_config.h.in src/curl_config.h.in" +cp lib/curl_config.h.in src/curl_config.h.in + +############################################################################ +# +# Enforce a rerun of configure (updates the VERSION) +# + +echo "Re-running config.status" +./config.status --recheck >/dev/null + +############################################################################ +# +# automake is needed to run to make a non-GNU Makefile.in if Makefile.am has +# been modified. +# + +if { findprog automake >/dev/null 2>/dev/null; } then + echo "- Could not find or run automake, I hope you know what you're doing!" +else + echo "Runs automake --include-deps" + automake --include-deps Makefile >/dev/null +fi + +############################################################################ +# +# Make sure we have updated HTML versions of all man pages: +# +echo "make html" +make -s html + +# And the PDF versions +echo "make pdf" +make -s pdf + +echo "produce CHANGES" +git log --pretty=fuller --no-color --date=short --decorate=full -1000 | ./log2changes.pl > CHANGES.dist + +############################################################################ +# +# Now run make dist to generate a tar.gz archive +# + +echo "make dist" +targz="curl-$version.tar.gz" +make -s dist VERSION=$version + +############################################################################ +# +# Now make a bz2 archive from the tar.gz original +# + +bzip2="curl-$version.tar.bz2" +echo "Generating $bzip2" +gzip -dc $targz | bzip2 --best - > $bzip2 + +############################################################################ +# +# Now make an lzma archive from the tar.gz original +# + +lzma="curl-$version.tar.lzma" +echo "Generating $lzma" +gzip -dc $targz | lzma --best - > $lzma + +############################################################################ +# +# Now make a zip archive from the tar.gz original +# +makezip () +{ + rm -rf $tempdir + mkdir $tempdir + cd $tempdir + gzip -dc ../$targz | tar -xf - + find . | zip $zip -@ >/dev/null + mv $zip ../ + cd .. + rm -rf $tempdir +} + +zip="curl-$version.zip" +echo "Generating $zip" +tempdir=".builddir" +makezip + +echo "------------------" +echo "maketgz report:" +echo "" +ls -l $targz $bzip2 $zip $lzma + +echo "Run this:" +echo "gpg -b -a $targz && gpg -b -a $bzip2 && gpg -b -a $zip && gpg -b -a $lzma" diff --git a/mobicore/common/curl/missing b/mobicore/common/curl/missing new file mode 100644 index 0000000000000000000000000000000000000000..a9f9d941e91bab8301684262fdc42385dd818230 --- /dev/null +++ b/mobicore/common/curl/missing @@ -0,0 +1,283 @@ +#! /bin/sh +# Common stub for a few missing GNU programs while installing. +# Copyright 1996, 1997, 1999, 2000 Free Software Foundation, Inc. +# Originally by Fran,cois Pinard , 1996. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA +# 02111-1307, USA. + +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + +if test $# -eq 0; then + echo 1>&2 "Try \`$0 --help' for more information" + exit 1 +fi + +run=: + +# In the cases where this matters, `missing' is being run in the +# srcdir already. +if test -f configure.ac; then + configure_ac=configure.ac +else + configure_ac=configure.in +fi + +case "$1" in +--run) + # Try to run requested program, and just exit if it succeeds. + run= + shift + "$@" && exit 0 + ;; +esac + +# If it does not exist, or fails to run (possibly an outdated version), +# try to emulate it. +case "$1" in + + -h|--h|--he|--hel|--help) + echo "\ +$0 [OPTION]... PROGRAM [ARGUMENT]... + +Handle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an +error status if there is no known handling for PROGRAM. + +Options: + -h, --help display this help and exit + -v, --version output version information and exit + --run try to run the given command, and emulate it if it fails + +Supported PROGRAM values: + aclocal touch file \`aclocal.m4' + autoconf touch file \`configure' + autoheader touch file \`curl_config.h.in' + automake touch all \`Makefile.in' files + bison create \`y.tab.[ch]', if possible, from existing .[ch] + flex create \`lex.yy.c', if possible, from existing .c + help2man touch the output file + lex create \`lex.yy.c', if possible, from existing .c + makeinfo touch the output file + tar try tar, gnutar, gtar, then tar without non-portable flags + yacc create \`y.tab.[ch]', if possible, from existing .[ch]" + ;; + + -v|--v|--ve|--ver|--vers|--versi|--versio|--version) + echo "missing 0.3 - GNU automake" + ;; + + -*) + echo 1>&2 "$0: Unknown \`$1' option" + echo 1>&2 "Try \`$0 --help' for more information" + exit 1 + ;; + + aclocal) + echo 1>&2 "\ +WARNING: \`$1' is missing on your system. You should only need it if + you modified \`acinclude.m4' or \`${configure_ac}'. You might want + to install the \`Automake' and \`Perl' packages. Grab them from + any GNU archive site." + touch aclocal.m4 + ;; + + autoconf) + echo 1>&2 "\ +WARNING: \`$1' is missing on your system. You should only need it if + you modified \`${configure_ac}'. You might want to install the + \`Autoconf' and \`GNU m4' packages. Grab them from any GNU + archive site." + touch configure + ;; + + autoheader) + echo 1>&2 "\ +WARNING: \`$1' is missing on your system. You should only need it if + you modified \`acconfig.h' or \`${configure_ac}'. You might want + to install the \`Autoconf' and \`GNU m4' packages. Grab them + from any GNU archive site." + files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}` + test -z "$files" && files="curl_config.h" + touch_files= + for f in $files; do + case "$f" in + *:*) touch_files="$touch_files "`echo "$f" | + sed -e 's/^[^:]*://' -e 's/:.*//'`;; + *) touch_files="$touch_files $f.in";; + esac + done + touch $touch_files + ;; + + automake) + echo 1>&2 "\ +WARNING: \`$1' is missing on your system. You should only need it if + you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'. + You might want to install the \`Automake' and \`Perl' packages. + Grab them from any GNU archive site." + find . -type f -name Makefile.am -print | + sed 's/\.am$/.in/' | + while read f; do touch "$f"; done + ;; + + bison|yacc) + echo 1>&2 "\ +WARNING: \`$1' is missing on your system. You should only need it if + you modified a \`.y' file. You may need the \`Bison' package + in order for those modifications to take effect. You can get + \`Bison' from any GNU archive site." + rm -f y.tab.c y.tab.h + if [ $# -ne 1 ]; then + eval LASTARG="\${$#}" + case "$LASTARG" in + *.y) + SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'` + if [ -f "$SRCFILE" ]; then + cp "$SRCFILE" y.tab.c + fi + SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'` + if [ -f "$SRCFILE" ]; then + cp "$SRCFILE" y.tab.h + fi + ;; + esac + fi + if [ ! -f y.tab.h ]; then + echo >y.tab.h + fi + if [ ! -f y.tab.c ]; then + echo 'main() { return 0; }' >y.tab.c + fi + ;; + + lex|flex) + echo 1>&2 "\ +WARNING: \`$1' is missing on your system. You should only need it if + you modified a \`.l' file. You may need the \`Flex' package + in order for those modifications to take effect. You can get + \`Flex' from any GNU archive site." + rm -f lex.yy.c + if [ $# -ne 1 ]; then + eval LASTARG="\${$#}" + case "$LASTARG" in + *.l) + SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'` + if [ -f "$SRCFILE" ]; then + cp "$SRCFILE" lex.yy.c + fi + ;; + esac + fi + if [ ! -f lex.yy.c ]; then + echo 'main() { return 0; }' >lex.yy.c + fi + ;; + + help2man) + echo 1>&2 "\ +WARNING: \`$1' is missing on your system. You should only need it if + you modified a dependency of a manual page. You may need the + \`Help2man' package in order for those modifications to take + effect. You can get \`Help2man' from any GNU archive site." + + file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'` + if test -z "$file"; then + file=`echo "$*" | sed -n 's/.*--output=\([^ ]*\).*/\1/p'` + fi + if [ -f "$file" ]; then + touch $file + else + test -z "$file" || exec >$file + echo ".ab help2man is required to generate this page" + exit 1 + fi + ;; + + makeinfo) + if test -z "$run" && (makeinfo --version) > /dev/null 2>&1; then + # We have makeinfo, but it failed. + exit 1 + fi + + echo 1>&2 "\ +WARNING: \`$1' is missing on your system. You should only need it if + you modified a \`.texi' or \`.texinfo' file, or any other file + indirectly affecting the aspect of the manual. The spurious + call might also be the consequence of using a buggy \`make' (AIX, + DU, IRIX). You might want to install the \`Texinfo' package or + the \`GNU make' package. Grab either from any GNU archive site." + file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'` + if test -z "$file"; then + file=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'` + file=`sed -n '/^@setfilename/ { s/.* \([^ ]*\) *$/\1/; p; q; }' $file` + fi + touch $file + ;; + + tar) + shift + if test -n "$run"; then + echo 1>&2 "ERROR: \`tar' requires --run" + exit 1 + fi + + # We have already tried tar in the generic part. + # Look for gnutar/gtar before invocation to avoid ugly error + # messages. + if (gnutar --version > /dev/null 2>&1); then + gnutar ${1+"$@"} && exit 0 + fi + if (gtar --version > /dev/null 2>&1); then + gtar ${1+"$@"} && exit 0 + fi + firstarg="$1" + if shift; then + case "$firstarg" in + *o*) + firstarg=`echo "$firstarg" | sed s/o//` + tar "$firstarg" ${1+"$@"} && exit 0 + ;; + esac + case "$firstarg" in + *h*) + firstarg=`echo "$firstarg" | sed s/h//` + tar "$firstarg" ${1+"$@"} && exit 0 + ;; + esac + fi + + echo 1>&2 "\ +WARNING: I can't seem to be able to run \`tar' with the given arguments. + You may want to install GNU tar or Free paxutils, or check the + command line arguments." + exit 1 + ;; + + *) + echo 1>&2 "\ +WARNING: \`$1' is needed, and you do not seem to have it handy on your + system. You might have modified some files without having the + proper tools for further handling them. Check the \`README' file, + it often tells you about the needed prerequirements for installing + this package. You may also peek at any GNU archive site, in case + some other package would contain this missing \`$1' program." + exit 1 + ;; +esac + +exit 0 diff --git a/mobicore/common/curl/mkinstalldirs b/mobicore/common/curl/mkinstalldirs new file mode 100644 index 0000000000000000000000000000000000000000..115df4e3d777530fb4b39fc70d9c31175cb62bc1 --- /dev/null +++ b/mobicore/common/curl/mkinstalldirs @@ -0,0 +1,39 @@ +#! /bin/sh +# mkinstalldirs --- make directory hierarchy +# Author: Noah Friedman +# Created: 1993-05-16 +# Public domain + + +errstatus=0 + +for file +do + set fnord `echo ":$file" | sed -ne 's/^:\//#/;s/^://;s/\// /g;s/^#/\//;p'` + shift + + pathcomp= + for d + do + pathcomp="$pathcomp$d" + case "$pathcomp" in + -* ) pathcomp=./$pathcomp ;; + esac + + if test ! -d "$pathcomp"; then + echo "mkdir -m0755 $pathcomp" 1>&2 + + mkdir -m0755 "$pathcomp" || lasterr=$? + + if test ! -d "$pathcomp"; then + errstatus=$lasterr + fi + fi + + pathcomp="$pathcomp/" + done +done + +exit $errstatus + +# mkinstalldirs ends here diff --git a/mobicore/common/curl/packages/AIX/Makefile.am b/mobicore/common/curl/packages/AIX/Makefile.am new file mode 100644 index 0000000000000000000000000000000000000000..4b038ed31cae1c50dced08e47553ec3c0a30f876 --- /dev/null +++ b/mobicore/common/curl/packages/AIX/Makefile.am @@ -0,0 +1,3 @@ +SUBDIRS = RPM + +EXTRA_DIST = Makefile.am diff --git a/mobicore/common/curl/packages/AIX/Makefile.in b/mobicore/common/curl/packages/AIX/Makefile.in new file mode 100644 index 0000000000000000000000000000000000000000..09d13857de383165142e640fb972720708570dd8 --- /dev/null +++ b/mobicore/common/curl/packages/AIX/Makefile.in @@ -0,0 +1,563 @@ +# Makefile.in generated by automake 1.9.6 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005 Free Software Foundation, Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ +srcdir = @srcdir@ +top_srcdir = @top_srcdir@ +VPATH = @srcdir@ +pkgdatadir = $(datadir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +top_builddir = ../.. +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +INSTALL = @INSTALL@ +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +subdir = packages/AIX +DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/m4/curl-compilers.m4 \ + $(top_srcdir)/m4/curl-confopts.m4 \ + $(top_srcdir)/m4/curl-functions.m4 \ + $(top_srcdir)/m4/curl-override.m4 \ + $(top_srcdir)/m4/curl-reentrant.m4 \ + $(top_srcdir)/m4/curl-system.m4 $(top_srcdir)/m4/libtool.m4 \ + $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ + $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ + $(top_srcdir)/acinclude.m4 $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs +CONFIG_HEADER = $(top_builddir)/lib/curl_config.h \ + $(top_builddir)/src/curl_config.h \ + $(top_builddir)/include/curl/curlbuild.h +CONFIG_CLEAN_FILES = +SOURCES = +DIST_SOURCES = +RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \ + html-recursive info-recursive install-data-recursive \ + install-exec-recursive install-info-recursive \ + install-recursive installcheck-recursive installdirs-recursive \ + pdf-recursive ps-recursive uninstall-info-recursive \ + uninstall-recursive +ETAGS = etags +CTAGS = ctags +DIST_SUBDIRS = $(SUBDIRS) +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +AMDEP_FALSE = @AMDEP_FALSE@ +AMDEP_TRUE = @AMDEP_TRUE@ +AMTAR = @AMTAR@ +AR = @AR@ +AS = @AS@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +BUILD_LIBHOSTNAME_FALSE = @BUILD_LIBHOSTNAME_FALSE@ +BUILD_LIBHOSTNAME_TRUE = @BUILD_LIBHOSTNAME_TRUE@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CONFIGURE_OPTIONS = @CONFIGURE_OPTIONS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CROSSCOMPILING_FALSE = @CROSSCOMPILING_FALSE@ +CROSSCOMPILING_TRUE = @CROSSCOMPILING_TRUE@ +CURLDEBUG_FALSE = @CURLDEBUG_FALSE@ +CURLDEBUG_TRUE = @CURLDEBUG_TRUE@ +CURL_CA_BUNDLE = @CURL_CA_BUNDLE@ +CURL_CFLAG_EXTRAS = @CURL_CFLAG_EXTRAS@ +CURL_DISABLE_DICT = @CURL_DISABLE_DICT@ +CURL_DISABLE_FILE = @CURL_DISABLE_FILE@ +CURL_DISABLE_FTP = @CURL_DISABLE_FTP@ +CURL_DISABLE_GOPHER = @CURL_DISABLE_GOPHER@ +CURL_DISABLE_HTTP = @CURL_DISABLE_HTTP@ +CURL_DISABLE_IMAP = @CURL_DISABLE_IMAP@ +CURL_DISABLE_LDAP = @CURL_DISABLE_LDAP@ +CURL_DISABLE_LDAPS = @CURL_DISABLE_LDAPS@ +CURL_DISABLE_POP3 = @CURL_DISABLE_POP3@ +CURL_DISABLE_PROXY = @CURL_DISABLE_PROXY@ +CURL_DISABLE_RTSP = @CURL_DISABLE_RTSP@ +CURL_DISABLE_SMTP = @CURL_DISABLE_SMTP@ +CURL_DISABLE_TELNET = @CURL_DISABLE_TELNET@ +CURL_DISABLE_TFTP = @CURL_DISABLE_TFTP@ +CURL_LIBS = @CURL_LIBS@ +CURL_NETWORK_LIBS = @CURL_NETWORK_LIBS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DLLTOOL = @DLLTOOL@ +DSYMUTIL = @DSYMUTIL@ +DUMPBIN = @DUMPBIN@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +ENABLE_SHARED = @ENABLE_SHARED@ +EXEEXT = @EXEEXT@ +FGREP = @FGREP@ +GREP = @GREP@ +HAVE_LDAP_SSL = @HAVE_LDAP_SSL@ +HAVE_LIBZ = @HAVE_LIBZ@ +HAVE_LIBZ_FALSE = @HAVE_LIBZ_FALSE@ +HAVE_LIBZ_TRUE = @HAVE_LIBZ_TRUE@ +HAVE_PK11_CREATEGENERICOBJECT = @HAVE_PK11_CREATEGENERICOBJECT@ +IDN_ENABLED = @IDN_ENABLED@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +IPV6_ENABLED = @IPV6_ENABLED@ +KRB4_ENABLED = @KRB4_ENABLED@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LIBCURL_LIBS = @LIBCURL_LIBS@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +MAINT = @MAINT@ +MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@ +MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@ +MAKEINFO = @MAKEINFO@ +MANOPT = @MANOPT@ +MIMPURE_FALSE = @MIMPURE_FALSE@ +MIMPURE_TRUE = @MIMPURE_TRUE@ +NM = @NM@ +NMEDIT = @NMEDIT@ +NO_UNDEFINED_FALSE = @NO_UNDEFINED_FALSE@ +NO_UNDEFINED_TRUE = @NO_UNDEFINED_TRUE@ +NROFF = @NROFF@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +OTOOL = @OTOOL@ +OTOOL64 = @OTOOL64@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH = @PATH@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PERL = @PERL@ +PKGADD_NAME = @PKGADD_NAME@ +PKGADD_PKG = @PKGADD_PKG@ +PKGADD_VENDOR = @PKGADD_VENDOR@ +PKGCONFIG = @PKGCONFIG@ +RANDOM_FILE = @RANDOM_FILE@ +RANLIB = @RANLIB@ +REQUIRE_LIB_DEPS = @REQUIRE_LIB_DEPS@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +SONAME_BUMP_FALSE = @SONAME_BUMP_FALSE@ +SONAME_BUMP_TRUE = @SONAME_BUMP_TRUE@ +SSL_ENABLED = @SSL_ENABLED@ +STATICLIB_FALSE = @STATICLIB_FALSE@ +STATICLIB_TRUE = @STATICLIB_TRUE@ +STRIP = @STRIP@ +SUPPORT_FEATURES = @SUPPORT_FEATURES@ +SUPPORT_PROTOCOLS = @SUPPORT_PROTOCOLS@ +TEST_SERVER_LIBS = @TEST_SERVER_LIBS@ +USE_ARES = @USE_ARES@ +USE_EMBEDDED_ARES_FALSE = @USE_EMBEDDED_ARES_FALSE@ +USE_EMBEDDED_ARES_TRUE = @USE_EMBEDDED_ARES_TRUE@ +USE_GNUTLS = @USE_GNUTLS@ +USE_LIBRTMP = @USE_LIBRTMP@ +USE_LIBSSH2 = @USE_LIBSSH2@ +USE_MANUAL_FALSE = @USE_MANUAL_FALSE@ +USE_MANUAL_TRUE = @USE_MANUAL_TRUE@ +USE_NSS = @USE_NSS@ +USE_OPENLDAP = @USE_OPENLDAP@ +USE_POLARSSL = @USE_POLARSSL@ +USE_SSLEAY = @USE_SSLEAY@ +USE_WINDOWS_SSPI = @USE_WINDOWS_SSPI@ +VERSION = @VERSION@ +VERSIONNUM = @VERSIONNUM@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ +am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ +am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +libext = @libext@ +localedir = @localedir@ +localstatedir = @localstatedir@ +lt_ECHO = @lt_ECHO@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +subdirs = @subdirs@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +SUBDIRS = RPM +EXTRA_DIST = Makefile.am +all: all-recursive + +.SUFFIXES: +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ + && exit 0; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu packages/AIX/Makefile'; \ + cd $(top_srcdir) && \ + $(AUTOMAKE) --gnu packages/AIX/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +distclean-libtool: + -rm -f libtool +uninstall-info-am: + +# This directory's subdirectories are mostly independent; you can cd +# into them and run `make' without going through this Makefile. +# To change the values of `make' variables: instead of editing Makefiles, +# (1) if the variable is set in `config.status', edit `config.status' +# (which will cause the Makefiles to be regenerated when you run `make'); +# (2) otherwise, pass the desired values on the `make' command line. +$(RECURSIVE_TARGETS): + @failcom='exit 1'; \ + for f in x $$MAKEFLAGS; do \ + case $$f in \ + *=* | --[!k]*);; \ + *k*) failcom='fail=yes';; \ + esac; \ + done; \ + dot_seen=no; \ + target=`echo $@ | sed s/-recursive//`; \ + list='$(SUBDIRS)'; for subdir in $$list; do \ + echo "Making $$target in $$subdir"; \ + if test "$$subdir" = "."; then \ + dot_seen=yes; \ + local_target="$$target-am"; \ + else \ + local_target="$$target"; \ + fi; \ + (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ + || eval $$failcom; \ + done; \ + if test "$$dot_seen" = "no"; then \ + $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ + fi; test -z "$$fail" + +mostlyclean-recursive clean-recursive distclean-recursive \ +maintainer-clean-recursive: + @failcom='exit 1'; \ + for f in x $$MAKEFLAGS; do \ + case $$f in \ + *=* | --[!k]*);; \ + *k*) failcom='fail=yes';; \ + esac; \ + done; \ + dot_seen=no; \ + case "$@" in \ + distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ + *) list='$(SUBDIRS)' ;; \ + esac; \ + rev=''; for subdir in $$list; do \ + if test "$$subdir" = "."; then :; else \ + rev="$$subdir $$rev"; \ + fi; \ + done; \ + rev="$$rev ."; \ + target=`echo $@ | sed s/-recursive//`; \ + for subdir in $$rev; do \ + echo "Making $$target in $$subdir"; \ + if test "$$subdir" = "."; then \ + local_target="$$target-am"; \ + else \ + local_target="$$target"; \ + fi; \ + (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ + || eval $$failcom; \ + done && test -z "$$fail" +tags-recursive: + list='$(SUBDIRS)'; for subdir in $$list; do \ + test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \ + done +ctags-recursive: + list='$(SUBDIRS)'; for subdir in $$list; do \ + test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \ + done + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + mkid -fID $$unique +tags: TAGS + +TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ + include_option=--etags-include; \ + empty_fix=.; \ + else \ + include_option=--include; \ + empty_fix=; \ + fi; \ + list='$(SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + test ! -f $$subdir/TAGS || \ + tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \ + fi; \ + done; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$tags $$unique; \ + fi +ctags: CTAGS +CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + test -z "$(CTAGS_ARGS)$$tags$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$tags $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && cd $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) $$here + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ + list='$(DISTFILES)'; for file in $$list; do \ + case $$file in \ + $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ + $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ + esac; \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test "$$dir" != "$$file" && test "$$dir" != "."; then \ + dir="/$$dir"; \ + $(mkdir_p) "$(distdir)$$dir"; \ + else \ + dir=''; \ + fi; \ + if test -d $$d/$$file; then \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ + fi; \ + cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ + else \ + test -f $(distdir)/$$file \ + || cp -p $$d/$$file $(distdir)/$$file \ + || exit 1; \ + fi; \ + done + list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + test -d "$(distdir)/$$subdir" \ + || $(mkdir_p) "$(distdir)/$$subdir" \ + || exit 1; \ + distdir=`$(am__cd) $(distdir) && pwd`; \ + top_distdir=`$(am__cd) $(top_distdir) && pwd`; \ + (cd $$subdir && \ + $(MAKE) $(AM_MAKEFLAGS) \ + top_distdir="$$top_distdir" \ + distdir="$$distdir/$$subdir" \ + distdir) \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-recursive +all-am: Makefile +installdirs: installdirs-recursive +installdirs-am: +install: install-recursive +install-exec: install-exec-recursive +install-data: install-data-recursive +uninstall: uninstall-recursive + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-recursive +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-recursive + +clean-am: clean-generic clean-libtool mostlyclean-am + +distclean: distclean-recursive + -rm -f Makefile +distclean-am: clean-am distclean-generic distclean-libtool \ + distclean-tags + +dvi: dvi-recursive + +dvi-am: + +html: html-recursive + +info: info-recursive + +info-am: + +install-data-am: + +install-exec-am: + +install-info: install-info-recursive + +install-man: + +installcheck-am: + +maintainer-clean: maintainer-clean-recursive + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-recursive + +mostlyclean-am: mostlyclean-generic mostlyclean-libtool + +pdf: pdf-recursive + +pdf-am: + +ps: ps-recursive + +ps-am: + +uninstall-am: uninstall-info-am + +uninstall-info: uninstall-info-recursive + +.PHONY: $(RECURSIVE_TARGETS) CTAGS GTAGS all all-am check check-am \ + clean clean-generic clean-libtool clean-recursive ctags \ + ctags-recursive distclean distclean-generic distclean-libtool \ + distclean-recursive distclean-tags distdir dvi dvi-am html \ + html-am info info-am install install-am install-data \ + install-data-am install-exec install-exec-am install-info \ + install-info-am install-man install-strip installcheck \ + installcheck-am installdirs installdirs-am maintainer-clean \ + maintainer-clean-generic maintainer-clean-recursive \ + mostlyclean mostlyclean-generic mostlyclean-libtool \ + mostlyclean-recursive pdf pdf-am ps ps-am tags tags-recursive \ + uninstall uninstall-am uninstall-info-am + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/mobicore/common/curl/packages/AIX/RPM/Makefile.am b/mobicore/common/curl/packages/AIX/RPM/Makefile.am new file mode 100644 index 0000000000000000000000000000000000000000..d1e7bf9d93b88441b805d4e3a4fa2767e19d8de8 --- /dev/null +++ b/mobicore/common/curl/packages/AIX/RPM/Makefile.am @@ -0,0 +1,2 @@ +EXTRA_DIST = README curl.spec.in + diff --git a/mobicore/common/curl/packages/AIX/RPM/Makefile.in b/mobicore/common/curl/packages/AIX/RPM/Makefile.in new file mode 100644 index 0000000000000000000000000000000000000000..7c4a55542a12994ea895df5911ae98976c6761f2 --- /dev/null +++ b/mobicore/common/curl/packages/AIX/RPM/Makefile.in @@ -0,0 +1,408 @@ +# Makefile.in generated by automake 1.9.6 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005 Free Software Foundation, Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ +srcdir = @srcdir@ +top_srcdir = @top_srcdir@ +VPATH = @srcdir@ +pkgdatadir = $(datadir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +top_builddir = ../../.. +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +INSTALL = @INSTALL@ +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +subdir = packages/AIX/RPM +DIST_COMMON = README $(srcdir)/Makefile.am $(srcdir)/Makefile.in \ + $(srcdir)/curl.spec.in +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/m4/curl-compilers.m4 \ + $(top_srcdir)/m4/curl-confopts.m4 \ + $(top_srcdir)/m4/curl-functions.m4 \ + $(top_srcdir)/m4/curl-override.m4 \ + $(top_srcdir)/m4/curl-reentrant.m4 \ + $(top_srcdir)/m4/curl-system.m4 $(top_srcdir)/m4/libtool.m4 \ + $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ + $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ + $(top_srcdir)/acinclude.m4 $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs +CONFIG_HEADER = $(top_builddir)/lib/curl_config.h \ + $(top_builddir)/src/curl_config.h \ + $(top_builddir)/include/curl/curlbuild.h +CONFIG_CLEAN_FILES = curl.spec +SOURCES = +DIST_SOURCES = +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +AMDEP_FALSE = @AMDEP_FALSE@ +AMDEP_TRUE = @AMDEP_TRUE@ +AMTAR = @AMTAR@ +AR = @AR@ +AS = @AS@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +BUILD_LIBHOSTNAME_FALSE = @BUILD_LIBHOSTNAME_FALSE@ +BUILD_LIBHOSTNAME_TRUE = @BUILD_LIBHOSTNAME_TRUE@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CONFIGURE_OPTIONS = @CONFIGURE_OPTIONS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CROSSCOMPILING_FALSE = @CROSSCOMPILING_FALSE@ +CROSSCOMPILING_TRUE = @CROSSCOMPILING_TRUE@ +CURLDEBUG_FALSE = @CURLDEBUG_FALSE@ +CURLDEBUG_TRUE = @CURLDEBUG_TRUE@ +CURL_CA_BUNDLE = @CURL_CA_BUNDLE@ +CURL_CFLAG_EXTRAS = @CURL_CFLAG_EXTRAS@ +CURL_DISABLE_DICT = @CURL_DISABLE_DICT@ +CURL_DISABLE_FILE = @CURL_DISABLE_FILE@ +CURL_DISABLE_FTP = @CURL_DISABLE_FTP@ +CURL_DISABLE_GOPHER = @CURL_DISABLE_GOPHER@ +CURL_DISABLE_HTTP = @CURL_DISABLE_HTTP@ +CURL_DISABLE_IMAP = @CURL_DISABLE_IMAP@ +CURL_DISABLE_LDAP = @CURL_DISABLE_LDAP@ +CURL_DISABLE_LDAPS = @CURL_DISABLE_LDAPS@ +CURL_DISABLE_POP3 = @CURL_DISABLE_POP3@ +CURL_DISABLE_PROXY = @CURL_DISABLE_PROXY@ +CURL_DISABLE_RTSP = @CURL_DISABLE_RTSP@ +CURL_DISABLE_SMTP = @CURL_DISABLE_SMTP@ +CURL_DISABLE_TELNET = @CURL_DISABLE_TELNET@ +CURL_DISABLE_TFTP = @CURL_DISABLE_TFTP@ +CURL_LIBS = @CURL_LIBS@ +CURL_NETWORK_LIBS = @CURL_NETWORK_LIBS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DLLTOOL = @DLLTOOL@ +DSYMUTIL = @DSYMUTIL@ +DUMPBIN = @DUMPBIN@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +ENABLE_SHARED = @ENABLE_SHARED@ +EXEEXT = @EXEEXT@ +FGREP = @FGREP@ +GREP = @GREP@ +HAVE_LDAP_SSL = @HAVE_LDAP_SSL@ +HAVE_LIBZ = @HAVE_LIBZ@ +HAVE_LIBZ_FALSE = @HAVE_LIBZ_FALSE@ +HAVE_LIBZ_TRUE = @HAVE_LIBZ_TRUE@ +HAVE_PK11_CREATEGENERICOBJECT = @HAVE_PK11_CREATEGENERICOBJECT@ +IDN_ENABLED = @IDN_ENABLED@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +IPV6_ENABLED = @IPV6_ENABLED@ +KRB4_ENABLED = @KRB4_ENABLED@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LIBCURL_LIBS = @LIBCURL_LIBS@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +MAINT = @MAINT@ +MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@ +MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@ +MAKEINFO = @MAKEINFO@ +MANOPT = @MANOPT@ +MIMPURE_FALSE = @MIMPURE_FALSE@ +MIMPURE_TRUE = @MIMPURE_TRUE@ +NM = @NM@ +NMEDIT = @NMEDIT@ +NO_UNDEFINED_FALSE = @NO_UNDEFINED_FALSE@ +NO_UNDEFINED_TRUE = @NO_UNDEFINED_TRUE@ +NROFF = @NROFF@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +OTOOL = @OTOOL@ +OTOOL64 = @OTOOL64@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH = @PATH@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PERL = @PERL@ +PKGADD_NAME = @PKGADD_NAME@ +PKGADD_PKG = @PKGADD_PKG@ +PKGADD_VENDOR = @PKGADD_VENDOR@ +PKGCONFIG = @PKGCONFIG@ +RANDOM_FILE = @RANDOM_FILE@ +RANLIB = @RANLIB@ +REQUIRE_LIB_DEPS = @REQUIRE_LIB_DEPS@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +SONAME_BUMP_FALSE = @SONAME_BUMP_FALSE@ +SONAME_BUMP_TRUE = @SONAME_BUMP_TRUE@ +SSL_ENABLED = @SSL_ENABLED@ +STATICLIB_FALSE = @STATICLIB_FALSE@ +STATICLIB_TRUE = @STATICLIB_TRUE@ +STRIP = @STRIP@ +SUPPORT_FEATURES = @SUPPORT_FEATURES@ +SUPPORT_PROTOCOLS = @SUPPORT_PROTOCOLS@ +TEST_SERVER_LIBS = @TEST_SERVER_LIBS@ +USE_ARES = @USE_ARES@ +USE_EMBEDDED_ARES_FALSE = @USE_EMBEDDED_ARES_FALSE@ +USE_EMBEDDED_ARES_TRUE = @USE_EMBEDDED_ARES_TRUE@ +USE_GNUTLS = @USE_GNUTLS@ +USE_LIBRTMP = @USE_LIBRTMP@ +USE_LIBSSH2 = @USE_LIBSSH2@ +USE_MANUAL_FALSE = @USE_MANUAL_FALSE@ +USE_MANUAL_TRUE = @USE_MANUAL_TRUE@ +USE_NSS = @USE_NSS@ +USE_OPENLDAP = @USE_OPENLDAP@ +USE_POLARSSL = @USE_POLARSSL@ +USE_SSLEAY = @USE_SSLEAY@ +USE_WINDOWS_SSPI = @USE_WINDOWS_SSPI@ +VERSION = @VERSION@ +VERSIONNUM = @VERSIONNUM@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ +am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ +am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +libext = @libext@ +localedir = @localedir@ +localstatedir = @localstatedir@ +lt_ECHO = @lt_ECHO@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +subdirs = @subdirs@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +EXTRA_DIST = README curl.spec.in +all: all-am + +.SUFFIXES: +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ + && exit 0; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu packages/AIX/RPM/Makefile'; \ + cd $(top_srcdir) && \ + $(AUTOMAKE) --gnu packages/AIX/RPM/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +curl.spec: $(top_builddir)/config.status $(srcdir)/curl.spec.in + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +distclean-libtool: + -rm -f libtool +uninstall-info-am: +tags: TAGS +TAGS: + +ctags: CTAGS +CTAGS: + + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ + list='$(DISTFILES)'; for file in $$list; do \ + case $$file in \ + $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ + $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ + esac; \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test "$$dir" != "$$file" && test "$$dir" != "."; then \ + dir="/$$dir"; \ + $(mkdir_p) "$(distdir)$$dir"; \ + else \ + dir=''; \ + fi; \ + if test -d $$d/$$file; then \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ + fi; \ + cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ + else \ + test -f $(distdir)/$$file \ + || cp -p $$d/$$file $(distdir)/$$file \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile +installdirs: +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-generic clean-libtool mostlyclean-am + +distclean: distclean-am + -rm -f Makefile +distclean-am: clean-am distclean-generic distclean-libtool + +dvi: dvi-am + +dvi-am: + +html: html-am + +info: info-am + +info-am: + +install-data-am: + +install-exec-am: + +install-info: install-info-am + +install-man: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-generic mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: uninstall-info-am + +.PHONY: all all-am check check-am clean clean-generic clean-libtool \ + distclean distclean-generic distclean-libtool distdir dvi \ + dvi-am html html-am info info-am install install-am \ + install-data install-data-am install-exec install-exec-am \ + install-info install-info-am install-man install-strip \ + installcheck installcheck-am installdirs maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-generic \ + mostlyclean-libtool pdf pdf-am ps ps-am uninstall uninstall-am \ + uninstall-info-am + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/mobicore/common/curl/packages/AIX/RPM/README b/mobicore/common/curl/packages/AIX/RPM/README new file mode 100644 index 0000000000000000000000000000000000000000..790beb80e810883140f1d1055a7c7e733a883ea3 --- /dev/null +++ b/mobicore/common/curl/packages/AIX/RPM/README @@ -0,0 +1,33 @@ + _ _ ____ _ + ___| | | | _ \| | + / __| | | | |_) | | + ( (__| |_| | _ <| |___ + \___|\___/|_| \_\_____| + for AIX Toolbox + +Author: Tor Arntsen + +The spec file in this directory is based on the Linux ssl and non-ssl +curl spec files, plus additions to make it AIX Toolbox compatible. + +The AIX Toolbox setup (installs into /opt/freeware, with symlinks in +/usr/bin,/usr/lib,/usr/include) are based on IBM's aixtoolbox spec +file written by David Clissold , see + +ftp://ftp.software.ibm.com/aixtoolbox/SPECS/curl-7.9.3-2.spec + +This spec file is designed to be a drop-in replacement for the +old spec file found at the above link. Thus, like the old spec file +this version is also a unified ssl/non-ssl version. To get non-ssl +RPMs just pass --define 'nossl 1' to the command line when building +the RPM, e.g. + +rpm -bb --define 'nossl 1' curl.spec + +Default is to build with ssl support. + +Lastly, the spec file expects the Curl source distribution file to be +in .tar.bz2 format. + +The nifty cURL header of this README is a ripoff of the vms/readme file. + diff --git a/mobicore/common/curl/packages/AIX/RPM/curl.spec.in b/mobicore/common/curl/packages/AIX/RPM/curl.spec.in new file mode 100644 index 0000000000000000000000000000000000000000..a37e0d7ca134112231a9d2332b5d12d2ad8ccbc8 --- /dev/null +++ b/mobicore/common/curl/packages/AIX/RPM/curl.spec.in @@ -0,0 +1,132 @@ +# Use --define 'nossl 1' on the command line to disable SSL detection +%{!?nossl:%define SSL 1} +%{?nossl:%define SSL 0} + +%define name curl +%define version @VERSION@ +%define release 1%{!?nossl:ssl} + +%define curlroot %{_builddir}/%{name}-%{version} + +Summary: get a file from a FTP or HTTP server. +Name: %{name} +Version: %{version} +Release: %{release} +License: MIT/X derivate +Vendor: Daniel Stenberg +Group: Applications/Internet +Source: %{name}-%{version}.tar.bz2 +URL: http://curl.haxx.se/ +Provides: curl +BuildRoot: %{_tmppath}/%{name}-%{version}-root +Prefix: %{_prefix} + +%description +curl is a client to get documents/files from servers, using any of the +supported protocols. The command is designed to work without user +interaction or any kind of interactivity. + +curl offers many useful tricks like proxy support, user authentication, +ftp upload, HTTP post, file transfer resume and more. + +%if %{SSL} == 1 +Note: this version is compiled with SSL support. +%else +Note: this version is compiled without SSL support. +%endif + +%package devel +Summary: Development files for the curl libary +Group: Development/Libraries +%if %{SSL} == 1 +Requires: openssl >= 0.9.5 +%endif +Requires: curl = %{version} +Provides: curl-devel + +%description devel +libcurl is the core engine of curl; this packages contains all the +libs, headers, and manual pages to develop applications using libcurl. + +%define DEFCC xlc + +%prep +rm -rf %{curlroot} +%setup -q + +%build + +# Use the default compiler for this platform - gcc otherwise +if [[ -z "$CC" ]] +then + if test "X`type %{DEFCC} 2>/dev/null`" != 'X'; then + export CC=%{DEFCC} + else + export CC=gcc + fi +fi + +cd %{curlroot} && (if [ -f configure.in ]; then mv -f configure.in configure.in. +rpm; fi) + +./configure --prefix=%{prefix} \ +%if %{SSL} == 1 + --with-ssl +%else + --without-ssl +%endif + +make + +%install +[ "%{buildroot}" != "/" ] && rm -rf %{buildroot} +make DESTDIR=%{buildroot} install-strip + +( cd $RPM_BUILD_ROOT # same as %{buildroot} + + for dir in bin include + do + mkdir -p usr/$dir + cd usr/$dir + ln -sf ../..%{prefix}/$dir/* . + cd - + done + + mkdir -p usr/lib + cd usr/lib + ln -sf ../..%{prefix}/lib/* . + cd - +) + +%clean +[ "%{buildroot}" != "/" ] && rm -rf %{buildroot} + +%files +%defattr(-,root,root) +%attr(0755,root,root) %{_bindir}/curl +%attr(0644,root,root) %{_mandir}/man1/curl.1* +%{_libdir}/libcurl.a +%if %{SSL} == 1 +%{_datadir}/curl/curl-ca-bundle.crt +%endif +%doc CHANGES COPYING README RELEASE-NOTES +%doc docs/BUGS docs/CONTRIBUTE docs/FAQ docs/FEATURES docs/HISTORY +%doc docs/INSTALL docs/KNOWN_BUGS +%doc docs/MANUAL docs/RESOURCES docs/THANKS docs/VERSIONS docs/TODO +%doc docs/TheArtOfHttpScripting +%if %{SSL} == 1 +%doc docs/SSLCERTS +%endif +/usr/bin/curl +/usr/lib/libcurl.a + +%files devel +%defattr(-,root,root) +%attr(0755,root,root) %{_bindir}/curl-config +%attr(0644,root,root) %{_mandir}/man1/curl-config.1* +%attr(0644,root,root) %{_mandir}/man3/* +%attr(0644,root,root) %{_includedir}/curl/* +%{_libdir}/libcurl.la +%doc docs/BINDINGS docs/INTERNALS docs/LICENSE-MIXING +/usr/bin/curl-config +/usr/include/curl diff --git a/mobicore/common/curl/packages/DOS/README b/mobicore/common/curl/packages/DOS/README new file mode 100644 index 0000000000000000000000000000000000000000..c2ab9b9aa51c8d5c4a08bdc48af8c5a18c1c1b0a --- /dev/null +++ b/mobicore/common/curl/packages/DOS/README @@ -0,0 +1,11 @@ +Gisle Vanem made curl build fine on DOS (and MingW) with djgpp, OpenSSL and his +Watt-32 stack. + +'make djgpp' in the root curl dir should build it fine. + +Note 1: djgpp 2.04 beta has a sscanf() bug so the URL parsing isn't + done proberly. Use djgpp 2.03 until they fix it. + +Note 2: Compile Watt-32 (and OpenSSL) with the same version of djgpp. + Otherwise things go wrong because things like FS-extensions and + errnos have been changed between releases. diff --git a/mobicore/common/curl/packages/DOS/common.dj b/mobicore/common/curl/packages/DOS/common.dj new file mode 100644 index 0000000000000000000000000000000000000000..a32f10c5413aaa95f9a5290dcd2609c6a03cdd66 --- /dev/null +++ b/mobicore/common/curl/packages/DOS/common.dj @@ -0,0 +1,136 @@ +# +# Common defines for curl (djgpp/Watt-32) +# +# Assumes you've unpacked cURL with long-file names +# I.e use "set LFN=y" before untaring on Win9x/XP. +# Requires sed, yacc, rm and the usual stuff. +# +# Define TOPDIR before including this file. + +.SUFFIXES: .exe .y + +MAKEFILE = Makefile.dj +OBJ_DIR = djgpp + +# +# Find out if using a UNIX-like shell or a DOS command interpreter +# +ifneq ($(findstring COMMAND.COM,$(SHELL)),COMMAND.COM) + ifneq ($(findstring CMD.EXE,$(SHELL)),CMD.EXE) + ifneq ($(findstring 4DOS.COM,$(SHELL)),4DOS.COM) + IS_UNIX_SHELL = 1 + endif + endif +endif + +# +# Define shell dependent commands and vars +# +ifeq ($(IS_UNIX_SHELL),1) + COPY = cp -f + DELETE = rm -f + MKDIR = mkdir + RMDIR = rm -f -r + DS = / +else + COPY = copy + DELETE = del + MKDIR = mkdir + RMDIR = rmdir + DS = \$(NOTHING) +endif + +# +# OpenSSL is available from www.openssl.org and builds okay +# with djgpp/Watt-32. Set to 0 if you don't need https URLs +# (reduces curl.exe with approx 700 kB) +# +USE_SSL = 0 + +# +# Use zlib for contents encoding +# +USE_ZLIB = 0 + +# +# Use libidn for international domain names +# +USE_IDNA = 0 + +# +# Use Watt-32 IPv6 stack (only IPv6 name resolution working at the moment) +# +USE_IPV6 = 0 + +# +# Use C-Ares resolver library +# +USE_ARES = 0 + +# +# Enable debug code in libcurl/curl +# +USE_DEBUG = 0 + +# +# Enable memory tracking code in libcurl/curl +# +USE_CURLDEBUG = 0 + +default: all + +# +# Root directory for Waterloo tcp/ip etc. Change to suite. +# WATT_ROOT should be set during Watt-32 install. +# +WATT32_ROOT = $(subst \,/,$(WATT_ROOT)) +OPENSSL_ROOT = e:/net/openssl.099 +ZLIB_ROOT = $(DJDIR)/contrib/zlib +LIBIDN_ROOT = $(TOPDIR)/../IDN/libidn +ARES_ROOT = $(TOPDIR)/ares + +CC = gcc +YACC = bison -y + +CFLAGS = -g -gcoff -O2 -I. -I$(TOPDIR)/include -I$(TOPDIR)/lib \ + -I$(WATT32_ROOT)/inc -Wall -DHAVE_CONFIG_H + +ifeq ($(USE_SSL),1) + CFLAGS += -DUSE_SSLEAY -DUSE_OPENSSL -I$(OPENSSL_ROOT) +endif + +ifeq ($(USE_ZLIB),1) + CFLAGS += -DUSE_ZLIB -I$(ZLIB_ROOT) +endif + +ifeq ($(USE_IPV6),1) + CFLAGS += -DENABLE_IPV6 +endif + +ifeq ($(USE_ARES),1) + CFLAGS += -DUSE_ARES -I$(ARES_ROOT) +endif + +ifeq ($(USE_IDNA),1) + CFLAGS += -DHAVE_LIBIDN -DHAVE_IDN_FREE_H -DHAVE_IDN_FREE -DHAVE_TLD_H \ + -DHAVE_TLD_STRERROR -I$(LIBIDN_ROOT)/lib +endif + +ifeq ($(USE_DEBUG),1) + CFLAGS += -DDEBUG=1 -DDEBUGBUILD +endif + +ifeq ($(USE_CURLDEBUG),1) + CFLAGS += -DCURLDEBUG +endif + +$(OBJ_DIR): + $(MKDIR) $(OBJ_DIR) + +$(OBJ_DIR)/%.o: %.c + $(CC) $(CFLAGS) -o $@ -c $< + @echo + +depend: $(DEPEND_PREREQ) $(MAKEFILE) + $(CC) -MM $(CFLAGS) $(CSOURCES) | \ + sed -e 's/^\([a-zA-Z0-9_-]*\.o:\)/$$(OBJ_DIR)\/\1/' > depend.dj diff --git a/mobicore/common/curl/packages/EPM/Makefile.am b/mobicore/common/curl/packages/EPM/Makefile.am new file mode 100644 index 0000000000000000000000000000000000000000..b010a4b038a27b2c186d7c5023e81d1162b8e5c5 --- /dev/null +++ b/mobicore/common/curl/packages/EPM/Makefile.am @@ -0,0 +1,3 @@ +AUTOMAKE_OPTIONS = foreign + +EXTRA_DIST = README curl.list.in diff --git a/mobicore/common/curl/packages/EPM/Makefile.in b/mobicore/common/curl/packages/EPM/Makefile.in new file mode 100644 index 0000000000000000000000000000000000000000..122015ee076be50d60d6400c2b77716294ba1c92 --- /dev/null +++ b/mobicore/common/curl/packages/EPM/Makefile.in @@ -0,0 +1,409 @@ +# Makefile.in generated by automake 1.9.6 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005 Free Software Foundation, Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ +srcdir = @srcdir@ +top_srcdir = @top_srcdir@ +VPATH = @srcdir@ +pkgdatadir = $(datadir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +top_builddir = ../.. +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +INSTALL = @INSTALL@ +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +subdir = packages/EPM +DIST_COMMON = README $(srcdir)/Makefile.am $(srcdir)/Makefile.in \ + $(srcdir)/curl.list.in +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/m4/curl-compilers.m4 \ + $(top_srcdir)/m4/curl-confopts.m4 \ + $(top_srcdir)/m4/curl-functions.m4 \ + $(top_srcdir)/m4/curl-override.m4 \ + $(top_srcdir)/m4/curl-reentrant.m4 \ + $(top_srcdir)/m4/curl-system.m4 $(top_srcdir)/m4/libtool.m4 \ + $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ + $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ + $(top_srcdir)/acinclude.m4 $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs +CONFIG_HEADER = $(top_builddir)/lib/curl_config.h \ + $(top_builddir)/src/curl_config.h \ + $(top_builddir)/include/curl/curlbuild.h +CONFIG_CLEAN_FILES = curl.list +SOURCES = +DIST_SOURCES = +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +AMDEP_FALSE = @AMDEP_FALSE@ +AMDEP_TRUE = @AMDEP_TRUE@ +AMTAR = @AMTAR@ +AR = @AR@ +AS = @AS@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +BUILD_LIBHOSTNAME_FALSE = @BUILD_LIBHOSTNAME_FALSE@ +BUILD_LIBHOSTNAME_TRUE = @BUILD_LIBHOSTNAME_TRUE@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CONFIGURE_OPTIONS = @CONFIGURE_OPTIONS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CROSSCOMPILING_FALSE = @CROSSCOMPILING_FALSE@ +CROSSCOMPILING_TRUE = @CROSSCOMPILING_TRUE@ +CURLDEBUG_FALSE = @CURLDEBUG_FALSE@ +CURLDEBUG_TRUE = @CURLDEBUG_TRUE@ +CURL_CA_BUNDLE = @CURL_CA_BUNDLE@ +CURL_CFLAG_EXTRAS = @CURL_CFLAG_EXTRAS@ +CURL_DISABLE_DICT = @CURL_DISABLE_DICT@ +CURL_DISABLE_FILE = @CURL_DISABLE_FILE@ +CURL_DISABLE_FTP = @CURL_DISABLE_FTP@ +CURL_DISABLE_GOPHER = @CURL_DISABLE_GOPHER@ +CURL_DISABLE_HTTP = @CURL_DISABLE_HTTP@ +CURL_DISABLE_IMAP = @CURL_DISABLE_IMAP@ +CURL_DISABLE_LDAP = @CURL_DISABLE_LDAP@ +CURL_DISABLE_LDAPS = @CURL_DISABLE_LDAPS@ +CURL_DISABLE_POP3 = @CURL_DISABLE_POP3@ +CURL_DISABLE_PROXY = @CURL_DISABLE_PROXY@ +CURL_DISABLE_RTSP = @CURL_DISABLE_RTSP@ +CURL_DISABLE_SMTP = @CURL_DISABLE_SMTP@ +CURL_DISABLE_TELNET = @CURL_DISABLE_TELNET@ +CURL_DISABLE_TFTP = @CURL_DISABLE_TFTP@ +CURL_LIBS = @CURL_LIBS@ +CURL_NETWORK_LIBS = @CURL_NETWORK_LIBS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DLLTOOL = @DLLTOOL@ +DSYMUTIL = @DSYMUTIL@ +DUMPBIN = @DUMPBIN@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +ENABLE_SHARED = @ENABLE_SHARED@ +EXEEXT = @EXEEXT@ +FGREP = @FGREP@ +GREP = @GREP@ +HAVE_LDAP_SSL = @HAVE_LDAP_SSL@ +HAVE_LIBZ = @HAVE_LIBZ@ +HAVE_LIBZ_FALSE = @HAVE_LIBZ_FALSE@ +HAVE_LIBZ_TRUE = @HAVE_LIBZ_TRUE@ +HAVE_PK11_CREATEGENERICOBJECT = @HAVE_PK11_CREATEGENERICOBJECT@ +IDN_ENABLED = @IDN_ENABLED@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +IPV6_ENABLED = @IPV6_ENABLED@ +KRB4_ENABLED = @KRB4_ENABLED@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LIBCURL_LIBS = @LIBCURL_LIBS@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +MAINT = @MAINT@ +MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@ +MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@ +MAKEINFO = @MAKEINFO@ +MANOPT = @MANOPT@ +MIMPURE_FALSE = @MIMPURE_FALSE@ +MIMPURE_TRUE = @MIMPURE_TRUE@ +NM = @NM@ +NMEDIT = @NMEDIT@ +NO_UNDEFINED_FALSE = @NO_UNDEFINED_FALSE@ +NO_UNDEFINED_TRUE = @NO_UNDEFINED_TRUE@ +NROFF = @NROFF@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +OTOOL = @OTOOL@ +OTOOL64 = @OTOOL64@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH = @PATH@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PERL = @PERL@ +PKGADD_NAME = @PKGADD_NAME@ +PKGADD_PKG = @PKGADD_PKG@ +PKGADD_VENDOR = @PKGADD_VENDOR@ +PKGCONFIG = @PKGCONFIG@ +RANDOM_FILE = @RANDOM_FILE@ +RANLIB = @RANLIB@ +REQUIRE_LIB_DEPS = @REQUIRE_LIB_DEPS@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +SONAME_BUMP_FALSE = @SONAME_BUMP_FALSE@ +SONAME_BUMP_TRUE = @SONAME_BUMP_TRUE@ +SSL_ENABLED = @SSL_ENABLED@ +STATICLIB_FALSE = @STATICLIB_FALSE@ +STATICLIB_TRUE = @STATICLIB_TRUE@ +STRIP = @STRIP@ +SUPPORT_FEATURES = @SUPPORT_FEATURES@ +SUPPORT_PROTOCOLS = @SUPPORT_PROTOCOLS@ +TEST_SERVER_LIBS = @TEST_SERVER_LIBS@ +USE_ARES = @USE_ARES@ +USE_EMBEDDED_ARES_FALSE = @USE_EMBEDDED_ARES_FALSE@ +USE_EMBEDDED_ARES_TRUE = @USE_EMBEDDED_ARES_TRUE@ +USE_GNUTLS = @USE_GNUTLS@ +USE_LIBRTMP = @USE_LIBRTMP@ +USE_LIBSSH2 = @USE_LIBSSH2@ +USE_MANUAL_FALSE = @USE_MANUAL_FALSE@ +USE_MANUAL_TRUE = @USE_MANUAL_TRUE@ +USE_NSS = @USE_NSS@ +USE_OPENLDAP = @USE_OPENLDAP@ +USE_POLARSSL = @USE_POLARSSL@ +USE_SSLEAY = @USE_SSLEAY@ +USE_WINDOWS_SSPI = @USE_WINDOWS_SSPI@ +VERSION = @VERSION@ +VERSIONNUM = @VERSIONNUM@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ +am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ +am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +libext = @libext@ +localedir = @localedir@ +localstatedir = @localstatedir@ +lt_ECHO = @lt_ECHO@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +subdirs = @subdirs@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +AUTOMAKE_OPTIONS = foreign +EXTRA_DIST = README curl.list.in +all: all-am + +.SUFFIXES: +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ + && exit 0; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign packages/EPM/Makefile'; \ + cd $(top_srcdir) && \ + $(AUTOMAKE) --foreign packages/EPM/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +curl.list: $(top_builddir)/config.status $(srcdir)/curl.list.in + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +distclean-libtool: + -rm -f libtool +uninstall-info-am: +tags: TAGS +TAGS: + +ctags: CTAGS +CTAGS: + + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ + list='$(DISTFILES)'; for file in $$list; do \ + case $$file in \ + $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ + $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ + esac; \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test "$$dir" != "$$file" && test "$$dir" != "."; then \ + dir="/$$dir"; \ + $(mkdir_p) "$(distdir)$$dir"; \ + else \ + dir=''; \ + fi; \ + if test -d $$d/$$file; then \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ + fi; \ + cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ + else \ + test -f $(distdir)/$$file \ + || cp -p $$d/$$file $(distdir)/$$file \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile +installdirs: +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-generic clean-libtool mostlyclean-am + +distclean: distclean-am + -rm -f Makefile +distclean-am: clean-am distclean-generic distclean-libtool + +dvi: dvi-am + +dvi-am: + +html: html-am + +info: info-am + +info-am: + +install-data-am: + +install-exec-am: + +install-info: install-info-am + +install-man: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-generic mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: uninstall-info-am + +.PHONY: all all-am check check-am clean clean-generic clean-libtool \ + distclean distclean-generic distclean-libtool distdir dvi \ + dvi-am html html-am info info-am install install-am \ + install-data install-data-am install-exec install-exec-am \ + install-info install-info-am install-man install-strip \ + installcheck installcheck-am installdirs maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-generic \ + mostlyclean-libtool pdf pdf-am ps ps-am uninstall uninstall-am \ + uninstall-info-am + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/mobicore/common/curl/packages/EPM/README b/mobicore/common/curl/packages/EPM/README new file mode 100644 index 0000000000000000000000000000000000000000..3529dbf5a1985fd56e385d61de96d7f9ea80daf9 --- /dev/null +++ b/mobicore/common/curl/packages/EPM/README @@ -0,0 +1,12 @@ +EPM is a free UNIX software/file packaging program that generates distribution +archives from a list of files. EPM Can: + + * Generate portable script-based distribution packages complete with + installation and removal scripts. + * Generate vendor distributions in AIX, BSD, Compaq Tru64, Debian, HP-UX, + IRIX, Red Hat, and Solaris formats. + * Provide a complete, cross-platform software distribution solution for your + applications. + +http://www.easysw.com/epm/ + diff --git a/mobicore/common/curl/packages/EPM/curl.list.in b/mobicore/common/curl/packages/EPM/curl.list.in new file mode 100644 index 0000000000000000000000000000000000000000..39060dded70bcf145ef87a6d6dc7bf6446d70eae --- /dev/null +++ b/mobicore/common/curl/packages/EPM/curl.list.in @@ -0,0 +1,59 @@ +# Directories... +$prefix=@prefix@ +$exec_prefix=@exec_prefix@ +$bindir=@bindir@ +$confdir=@sysconfdir@ +$docdir=@prefix@/doc +$mandir=@mandir@ +$libdir=@libdir@ +$srcdir=@top_srcdir@ +$includedir=@includedir@ +$datarootdir=@datarootdir@ + +# Product information +%product curl +%copyright 1998-2002 by Daniel Stenberg +%vendor Daniel Stenberg, +%license ${srcdir}/MITX.txt +%readme ${srcdir}/README +%description Curl is a command line tool for transfering data specified +%description with URL syntax +%version @VERSION@ +%packager Giuseppe "Cowo" Corbelli + +f 0644 cowo pppusers ${mandir}/man1/curl.1 ./docs/curl.1 +f 0644 cowo pppusers ${mandir}/man1/curl-config.1 ./docs/curl-config.1 +f 0644 cowo pppusers ${mandir}/man3/curl_easy_cleanup.3 ./docs/curl_easy_cleanup.3 +f 0644 cowo pppusers ${mandir}/man3/curl_easy_getinfo.3 ./docs/curl_easy_getinfo.3 +f 0644 cowo pppusers ${mandir}/man3/curl_easy_init.3 ./docs/curl_easy_init.3 +f 0644 cowo pppusers ${mandir}/man3/curl_easy_perform.3 ./docs/curl_easy_perform.3 +f 0644 cowo pppusers ${mandir}/man3/curl_easy_setopt.3 ./docs/curl_easy_setopt.3 +f 0644 cowo pppusers ${mandir}/man3/curl_easy_duphandle.3 ./docs/curl_easy_duphandle.3 +f 0644 cowo pppusers ${mandir}/man3/curl_formparse.3 ./docs/curl_formparse.3 +f 0644 cowo pppusers ${mandir}/man3/curl_formadd.3 ./docs/curl_formadd.3 +f 0644 cowo pppusers ${mandir}/man3/curl_formfree.3 ./docs/curl_formfree.3 +f 0644 cowo pppusers ${mandir}/man3/curl_getdate.3 ./docs/curl_getdate.3 +f 0644 cowo pppusers ${mandir}/man3/curl_getenv.3 ./docs/curl_getenv.3 +f 0644 cowo pppusers ${mandir}/man3/curl_slist_append.3 ./docs/curl_slist_append.3 +f 0644 cowo pppusers ${mandir}/man3/curl_slist_free_all.3 ./docs/curl_slist_free_all.3 +f 0644 cowo pppusers ${mandir}/man3/curl_version.3 ./docs/curl_version.3 +f 0644 cowo pppusers ${mandir}/man3/curl_escape.3 ./docs/curl_escape.3 +f 0644 cowo pppusers ${mandir}/man3/curl_unescape.3 ./docs/curl_unescape.3 +f 0644 cowo pppusers ${mandir}/man3/curl_strequal.3 ./docs/curl_strequal.3 +f 0644 cowo pppusers ${mandir}/man3/curl_strnequal.3 ./docs/curl_strnequal.3 +f 0644 cowo pppusers ${mandir}/man3/curl_mprintf.3 ./docs/curl_mprintf.3 +f 0644 cowo pppusers ${mandir}/man3/curl_global_init.3 ./docs/curl_global_init.3 +f 0644 cowo pppusers ${mandir}/man3/curl_global_cleanup.3 ./docs/curl_global_cleanup.3 +f 0644 cowo pppusers ${mandir}/man3/libcurl.3 ./docs/libcurl.3 +f 0755 cowo pppusers ${libdir}/libcurl.so.2.0.2 ./lib/.libs/libcurl.so.2.0.2 +f 0755 cowo pppusers ${libdir}/libcurl.la ./lib/libcurl.la +f 0755 cowo pppusers ${libdir}/libcurl.la ./lib/.libs/libcurl.la +f 0644 cowo pppusers ${libdir}/libcurl.a ./lib/.libs/libcurl.a +f 0755 cowo pppusers ${bindir}/curl ./src/curl +f 0755 cowo pppusers ${bindir}/curl ./src/.libs/curl +f 0644 cowo pppusers ${includedir}/curl/curl.h ./include/curl/curl.h +f 0644 cowo pppusers ${includedir}/curl/easy.h ./include/curl/easy.h +f 0644 cowo pppusers ${includedir}/curl/mprintf.h ./include/curl/mprintf.h +f 0644 cowo pppusers ${includedir}/curl/stdcheaders.h ./include/curl/stdcheaders.h +f 0644 cowo pppusers ${includedir}/curl/types.h ./include/curl/types.h +f 0755 cowo pppusers ${bindir}/curl-config ./curl-config diff --git a/mobicore/common/curl/packages/Linux/Makefile.am b/mobicore/common/curl/packages/Linux/Makefile.am new file mode 100644 index 0000000000000000000000000000000000000000..5753055799b263c6fcba124906fdfe3332459e4d --- /dev/null +++ b/mobicore/common/curl/packages/Linux/Makefile.am @@ -0,0 +1 @@ +SUBDIRS = RPM diff --git a/mobicore/common/curl/packages/Linux/Makefile.in b/mobicore/common/curl/packages/Linux/Makefile.in new file mode 100644 index 0000000000000000000000000000000000000000..cc2a027128c34f816c493a68ea7a3cc7c94a924e --- /dev/null +++ b/mobicore/common/curl/packages/Linux/Makefile.in @@ -0,0 +1,562 @@ +# Makefile.in generated by automake 1.9.6 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005 Free Software Foundation, Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ +srcdir = @srcdir@ +top_srcdir = @top_srcdir@ +VPATH = @srcdir@ +pkgdatadir = $(datadir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +top_builddir = ../.. +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +INSTALL = @INSTALL@ +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +subdir = packages/Linux +DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/m4/curl-compilers.m4 \ + $(top_srcdir)/m4/curl-confopts.m4 \ + $(top_srcdir)/m4/curl-functions.m4 \ + $(top_srcdir)/m4/curl-override.m4 \ + $(top_srcdir)/m4/curl-reentrant.m4 \ + $(top_srcdir)/m4/curl-system.m4 $(top_srcdir)/m4/libtool.m4 \ + $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ + $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ + $(top_srcdir)/acinclude.m4 $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs +CONFIG_HEADER = $(top_builddir)/lib/curl_config.h \ + $(top_builddir)/src/curl_config.h \ + $(top_builddir)/include/curl/curlbuild.h +CONFIG_CLEAN_FILES = +SOURCES = +DIST_SOURCES = +RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \ + html-recursive info-recursive install-data-recursive \ + install-exec-recursive install-info-recursive \ + install-recursive installcheck-recursive installdirs-recursive \ + pdf-recursive ps-recursive uninstall-info-recursive \ + uninstall-recursive +ETAGS = etags +CTAGS = ctags +DIST_SUBDIRS = $(SUBDIRS) +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +AMDEP_FALSE = @AMDEP_FALSE@ +AMDEP_TRUE = @AMDEP_TRUE@ +AMTAR = @AMTAR@ +AR = @AR@ +AS = @AS@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +BUILD_LIBHOSTNAME_FALSE = @BUILD_LIBHOSTNAME_FALSE@ +BUILD_LIBHOSTNAME_TRUE = @BUILD_LIBHOSTNAME_TRUE@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CONFIGURE_OPTIONS = @CONFIGURE_OPTIONS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CROSSCOMPILING_FALSE = @CROSSCOMPILING_FALSE@ +CROSSCOMPILING_TRUE = @CROSSCOMPILING_TRUE@ +CURLDEBUG_FALSE = @CURLDEBUG_FALSE@ +CURLDEBUG_TRUE = @CURLDEBUG_TRUE@ +CURL_CA_BUNDLE = @CURL_CA_BUNDLE@ +CURL_CFLAG_EXTRAS = @CURL_CFLAG_EXTRAS@ +CURL_DISABLE_DICT = @CURL_DISABLE_DICT@ +CURL_DISABLE_FILE = @CURL_DISABLE_FILE@ +CURL_DISABLE_FTP = @CURL_DISABLE_FTP@ +CURL_DISABLE_GOPHER = @CURL_DISABLE_GOPHER@ +CURL_DISABLE_HTTP = @CURL_DISABLE_HTTP@ +CURL_DISABLE_IMAP = @CURL_DISABLE_IMAP@ +CURL_DISABLE_LDAP = @CURL_DISABLE_LDAP@ +CURL_DISABLE_LDAPS = @CURL_DISABLE_LDAPS@ +CURL_DISABLE_POP3 = @CURL_DISABLE_POP3@ +CURL_DISABLE_PROXY = @CURL_DISABLE_PROXY@ +CURL_DISABLE_RTSP = @CURL_DISABLE_RTSP@ +CURL_DISABLE_SMTP = @CURL_DISABLE_SMTP@ +CURL_DISABLE_TELNET = @CURL_DISABLE_TELNET@ +CURL_DISABLE_TFTP = @CURL_DISABLE_TFTP@ +CURL_LIBS = @CURL_LIBS@ +CURL_NETWORK_LIBS = @CURL_NETWORK_LIBS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DLLTOOL = @DLLTOOL@ +DSYMUTIL = @DSYMUTIL@ +DUMPBIN = @DUMPBIN@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +ENABLE_SHARED = @ENABLE_SHARED@ +EXEEXT = @EXEEXT@ +FGREP = @FGREP@ +GREP = @GREP@ +HAVE_LDAP_SSL = @HAVE_LDAP_SSL@ +HAVE_LIBZ = @HAVE_LIBZ@ +HAVE_LIBZ_FALSE = @HAVE_LIBZ_FALSE@ +HAVE_LIBZ_TRUE = @HAVE_LIBZ_TRUE@ +HAVE_PK11_CREATEGENERICOBJECT = @HAVE_PK11_CREATEGENERICOBJECT@ +IDN_ENABLED = @IDN_ENABLED@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +IPV6_ENABLED = @IPV6_ENABLED@ +KRB4_ENABLED = @KRB4_ENABLED@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LIBCURL_LIBS = @LIBCURL_LIBS@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +MAINT = @MAINT@ +MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@ +MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@ +MAKEINFO = @MAKEINFO@ +MANOPT = @MANOPT@ +MIMPURE_FALSE = @MIMPURE_FALSE@ +MIMPURE_TRUE = @MIMPURE_TRUE@ +NM = @NM@ +NMEDIT = @NMEDIT@ +NO_UNDEFINED_FALSE = @NO_UNDEFINED_FALSE@ +NO_UNDEFINED_TRUE = @NO_UNDEFINED_TRUE@ +NROFF = @NROFF@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +OTOOL = @OTOOL@ +OTOOL64 = @OTOOL64@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH = @PATH@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PERL = @PERL@ +PKGADD_NAME = @PKGADD_NAME@ +PKGADD_PKG = @PKGADD_PKG@ +PKGADD_VENDOR = @PKGADD_VENDOR@ +PKGCONFIG = @PKGCONFIG@ +RANDOM_FILE = @RANDOM_FILE@ +RANLIB = @RANLIB@ +REQUIRE_LIB_DEPS = @REQUIRE_LIB_DEPS@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +SONAME_BUMP_FALSE = @SONAME_BUMP_FALSE@ +SONAME_BUMP_TRUE = @SONAME_BUMP_TRUE@ +SSL_ENABLED = @SSL_ENABLED@ +STATICLIB_FALSE = @STATICLIB_FALSE@ +STATICLIB_TRUE = @STATICLIB_TRUE@ +STRIP = @STRIP@ +SUPPORT_FEATURES = @SUPPORT_FEATURES@ +SUPPORT_PROTOCOLS = @SUPPORT_PROTOCOLS@ +TEST_SERVER_LIBS = @TEST_SERVER_LIBS@ +USE_ARES = @USE_ARES@ +USE_EMBEDDED_ARES_FALSE = @USE_EMBEDDED_ARES_FALSE@ +USE_EMBEDDED_ARES_TRUE = @USE_EMBEDDED_ARES_TRUE@ +USE_GNUTLS = @USE_GNUTLS@ +USE_LIBRTMP = @USE_LIBRTMP@ +USE_LIBSSH2 = @USE_LIBSSH2@ +USE_MANUAL_FALSE = @USE_MANUAL_FALSE@ +USE_MANUAL_TRUE = @USE_MANUAL_TRUE@ +USE_NSS = @USE_NSS@ +USE_OPENLDAP = @USE_OPENLDAP@ +USE_POLARSSL = @USE_POLARSSL@ +USE_SSLEAY = @USE_SSLEAY@ +USE_WINDOWS_SSPI = @USE_WINDOWS_SSPI@ +VERSION = @VERSION@ +VERSIONNUM = @VERSIONNUM@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ +am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ +am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +libext = @libext@ +localedir = @localedir@ +localstatedir = @localstatedir@ +lt_ECHO = @lt_ECHO@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +subdirs = @subdirs@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +SUBDIRS = RPM +all: all-recursive + +.SUFFIXES: +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ + && exit 0; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu packages/Linux/Makefile'; \ + cd $(top_srcdir) && \ + $(AUTOMAKE) --gnu packages/Linux/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +distclean-libtool: + -rm -f libtool +uninstall-info-am: + +# This directory's subdirectories are mostly independent; you can cd +# into them and run `make' without going through this Makefile. +# To change the values of `make' variables: instead of editing Makefiles, +# (1) if the variable is set in `config.status', edit `config.status' +# (which will cause the Makefiles to be regenerated when you run `make'); +# (2) otherwise, pass the desired values on the `make' command line. +$(RECURSIVE_TARGETS): + @failcom='exit 1'; \ + for f in x $$MAKEFLAGS; do \ + case $$f in \ + *=* | --[!k]*);; \ + *k*) failcom='fail=yes';; \ + esac; \ + done; \ + dot_seen=no; \ + target=`echo $@ | sed s/-recursive//`; \ + list='$(SUBDIRS)'; for subdir in $$list; do \ + echo "Making $$target in $$subdir"; \ + if test "$$subdir" = "."; then \ + dot_seen=yes; \ + local_target="$$target-am"; \ + else \ + local_target="$$target"; \ + fi; \ + (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ + || eval $$failcom; \ + done; \ + if test "$$dot_seen" = "no"; then \ + $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ + fi; test -z "$$fail" + +mostlyclean-recursive clean-recursive distclean-recursive \ +maintainer-clean-recursive: + @failcom='exit 1'; \ + for f in x $$MAKEFLAGS; do \ + case $$f in \ + *=* | --[!k]*);; \ + *k*) failcom='fail=yes';; \ + esac; \ + done; \ + dot_seen=no; \ + case "$@" in \ + distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ + *) list='$(SUBDIRS)' ;; \ + esac; \ + rev=''; for subdir in $$list; do \ + if test "$$subdir" = "."; then :; else \ + rev="$$subdir $$rev"; \ + fi; \ + done; \ + rev="$$rev ."; \ + target=`echo $@ | sed s/-recursive//`; \ + for subdir in $$rev; do \ + echo "Making $$target in $$subdir"; \ + if test "$$subdir" = "."; then \ + local_target="$$target-am"; \ + else \ + local_target="$$target"; \ + fi; \ + (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ + || eval $$failcom; \ + done && test -z "$$fail" +tags-recursive: + list='$(SUBDIRS)'; for subdir in $$list; do \ + test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \ + done +ctags-recursive: + list='$(SUBDIRS)'; for subdir in $$list; do \ + test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \ + done + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + mkid -fID $$unique +tags: TAGS + +TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ + include_option=--etags-include; \ + empty_fix=.; \ + else \ + include_option=--include; \ + empty_fix=; \ + fi; \ + list='$(SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + test ! -f $$subdir/TAGS || \ + tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \ + fi; \ + done; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$tags $$unique; \ + fi +ctags: CTAGS +CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + test -z "$(CTAGS_ARGS)$$tags$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$tags $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && cd $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) $$here + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ + list='$(DISTFILES)'; for file in $$list; do \ + case $$file in \ + $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ + $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ + esac; \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test "$$dir" != "$$file" && test "$$dir" != "."; then \ + dir="/$$dir"; \ + $(mkdir_p) "$(distdir)$$dir"; \ + else \ + dir=''; \ + fi; \ + if test -d $$d/$$file; then \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ + fi; \ + cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ + else \ + test -f $(distdir)/$$file \ + || cp -p $$d/$$file $(distdir)/$$file \ + || exit 1; \ + fi; \ + done + list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + test -d "$(distdir)/$$subdir" \ + || $(mkdir_p) "$(distdir)/$$subdir" \ + || exit 1; \ + distdir=`$(am__cd) $(distdir) && pwd`; \ + top_distdir=`$(am__cd) $(top_distdir) && pwd`; \ + (cd $$subdir && \ + $(MAKE) $(AM_MAKEFLAGS) \ + top_distdir="$$top_distdir" \ + distdir="$$distdir/$$subdir" \ + distdir) \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-recursive +all-am: Makefile +installdirs: installdirs-recursive +installdirs-am: +install: install-recursive +install-exec: install-exec-recursive +install-data: install-data-recursive +uninstall: uninstall-recursive + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-recursive +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-recursive + +clean-am: clean-generic clean-libtool mostlyclean-am + +distclean: distclean-recursive + -rm -f Makefile +distclean-am: clean-am distclean-generic distclean-libtool \ + distclean-tags + +dvi: dvi-recursive + +dvi-am: + +html: html-recursive + +info: info-recursive + +info-am: + +install-data-am: + +install-exec-am: + +install-info: install-info-recursive + +install-man: + +installcheck-am: + +maintainer-clean: maintainer-clean-recursive + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-recursive + +mostlyclean-am: mostlyclean-generic mostlyclean-libtool + +pdf: pdf-recursive + +pdf-am: + +ps: ps-recursive + +ps-am: + +uninstall-am: uninstall-info-am + +uninstall-info: uninstall-info-recursive + +.PHONY: $(RECURSIVE_TARGETS) CTAGS GTAGS all all-am check check-am \ + clean clean-generic clean-libtool clean-recursive ctags \ + ctags-recursive distclean distclean-generic distclean-libtool \ + distclean-recursive distclean-tags distdir dvi dvi-am html \ + html-am info info-am install install-am install-data \ + install-data-am install-exec install-exec-am install-info \ + install-info-am install-man install-strip installcheck \ + installcheck-am installdirs installdirs-am maintainer-clean \ + maintainer-clean-generic maintainer-clean-recursive \ + mostlyclean mostlyclean-generic mostlyclean-libtool \ + mostlyclean-recursive pdf pdf-am ps ps-am tags tags-recursive \ + uninstall uninstall-am uninstall-info-am + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/mobicore/common/curl/packages/Linux/RPM/Makefile.am b/mobicore/common/curl/packages/Linux/RPM/Makefile.am new file mode 100644 index 0000000000000000000000000000000000000000..5d46d87c67100c702b4706d42fac6ba72498b660 --- /dev/null +++ b/mobicore/common/curl/packages/Linux/RPM/Makefile.am @@ -0,0 +1,2 @@ +EXTRA_DIST = README curl-ssl.spec.in curl.spec.in make_curl_rpm + diff --git a/mobicore/common/curl/packages/Linux/RPM/Makefile.in b/mobicore/common/curl/packages/Linux/RPM/Makefile.in new file mode 100644 index 0000000000000000000000000000000000000000..46b69554345c739549af4567b9457dc495182ae5 --- /dev/null +++ b/mobicore/common/curl/packages/Linux/RPM/Makefile.in @@ -0,0 +1,410 @@ +# Makefile.in generated by automake 1.9.6 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005 Free Software Foundation, Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ +srcdir = @srcdir@ +top_srcdir = @top_srcdir@ +VPATH = @srcdir@ +pkgdatadir = $(datadir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +top_builddir = ../../.. +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +INSTALL = @INSTALL@ +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +subdir = packages/Linux/RPM +DIST_COMMON = README $(srcdir)/Makefile.am $(srcdir)/Makefile.in \ + $(srcdir)/curl-ssl.spec.in $(srcdir)/curl.spec.in +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/m4/curl-compilers.m4 \ + $(top_srcdir)/m4/curl-confopts.m4 \ + $(top_srcdir)/m4/curl-functions.m4 \ + $(top_srcdir)/m4/curl-override.m4 \ + $(top_srcdir)/m4/curl-reentrant.m4 \ + $(top_srcdir)/m4/curl-system.m4 $(top_srcdir)/m4/libtool.m4 \ + $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ + $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ + $(top_srcdir)/acinclude.m4 $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs +CONFIG_HEADER = $(top_builddir)/lib/curl_config.h \ + $(top_builddir)/src/curl_config.h \ + $(top_builddir)/include/curl/curlbuild.h +CONFIG_CLEAN_FILES = curl.spec curl-ssl.spec +SOURCES = +DIST_SOURCES = +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +AMDEP_FALSE = @AMDEP_FALSE@ +AMDEP_TRUE = @AMDEP_TRUE@ +AMTAR = @AMTAR@ +AR = @AR@ +AS = @AS@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +BUILD_LIBHOSTNAME_FALSE = @BUILD_LIBHOSTNAME_FALSE@ +BUILD_LIBHOSTNAME_TRUE = @BUILD_LIBHOSTNAME_TRUE@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CONFIGURE_OPTIONS = @CONFIGURE_OPTIONS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CROSSCOMPILING_FALSE = @CROSSCOMPILING_FALSE@ +CROSSCOMPILING_TRUE = @CROSSCOMPILING_TRUE@ +CURLDEBUG_FALSE = @CURLDEBUG_FALSE@ +CURLDEBUG_TRUE = @CURLDEBUG_TRUE@ +CURL_CA_BUNDLE = @CURL_CA_BUNDLE@ +CURL_CFLAG_EXTRAS = @CURL_CFLAG_EXTRAS@ +CURL_DISABLE_DICT = @CURL_DISABLE_DICT@ +CURL_DISABLE_FILE = @CURL_DISABLE_FILE@ +CURL_DISABLE_FTP = @CURL_DISABLE_FTP@ +CURL_DISABLE_GOPHER = @CURL_DISABLE_GOPHER@ +CURL_DISABLE_HTTP = @CURL_DISABLE_HTTP@ +CURL_DISABLE_IMAP = @CURL_DISABLE_IMAP@ +CURL_DISABLE_LDAP = @CURL_DISABLE_LDAP@ +CURL_DISABLE_LDAPS = @CURL_DISABLE_LDAPS@ +CURL_DISABLE_POP3 = @CURL_DISABLE_POP3@ +CURL_DISABLE_PROXY = @CURL_DISABLE_PROXY@ +CURL_DISABLE_RTSP = @CURL_DISABLE_RTSP@ +CURL_DISABLE_SMTP = @CURL_DISABLE_SMTP@ +CURL_DISABLE_TELNET = @CURL_DISABLE_TELNET@ +CURL_DISABLE_TFTP = @CURL_DISABLE_TFTP@ +CURL_LIBS = @CURL_LIBS@ +CURL_NETWORK_LIBS = @CURL_NETWORK_LIBS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DLLTOOL = @DLLTOOL@ +DSYMUTIL = @DSYMUTIL@ +DUMPBIN = @DUMPBIN@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +ENABLE_SHARED = @ENABLE_SHARED@ +EXEEXT = @EXEEXT@ +FGREP = @FGREP@ +GREP = @GREP@ +HAVE_LDAP_SSL = @HAVE_LDAP_SSL@ +HAVE_LIBZ = @HAVE_LIBZ@ +HAVE_LIBZ_FALSE = @HAVE_LIBZ_FALSE@ +HAVE_LIBZ_TRUE = @HAVE_LIBZ_TRUE@ +HAVE_PK11_CREATEGENERICOBJECT = @HAVE_PK11_CREATEGENERICOBJECT@ +IDN_ENABLED = @IDN_ENABLED@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +IPV6_ENABLED = @IPV6_ENABLED@ +KRB4_ENABLED = @KRB4_ENABLED@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LIBCURL_LIBS = @LIBCURL_LIBS@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +MAINT = @MAINT@ +MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@ +MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@ +MAKEINFO = @MAKEINFO@ +MANOPT = @MANOPT@ +MIMPURE_FALSE = @MIMPURE_FALSE@ +MIMPURE_TRUE = @MIMPURE_TRUE@ +NM = @NM@ +NMEDIT = @NMEDIT@ +NO_UNDEFINED_FALSE = @NO_UNDEFINED_FALSE@ +NO_UNDEFINED_TRUE = @NO_UNDEFINED_TRUE@ +NROFF = @NROFF@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +OTOOL = @OTOOL@ +OTOOL64 = @OTOOL64@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH = @PATH@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PERL = @PERL@ +PKGADD_NAME = @PKGADD_NAME@ +PKGADD_PKG = @PKGADD_PKG@ +PKGADD_VENDOR = @PKGADD_VENDOR@ +PKGCONFIG = @PKGCONFIG@ +RANDOM_FILE = @RANDOM_FILE@ +RANLIB = @RANLIB@ +REQUIRE_LIB_DEPS = @REQUIRE_LIB_DEPS@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +SONAME_BUMP_FALSE = @SONAME_BUMP_FALSE@ +SONAME_BUMP_TRUE = @SONAME_BUMP_TRUE@ +SSL_ENABLED = @SSL_ENABLED@ +STATICLIB_FALSE = @STATICLIB_FALSE@ +STATICLIB_TRUE = @STATICLIB_TRUE@ +STRIP = @STRIP@ +SUPPORT_FEATURES = @SUPPORT_FEATURES@ +SUPPORT_PROTOCOLS = @SUPPORT_PROTOCOLS@ +TEST_SERVER_LIBS = @TEST_SERVER_LIBS@ +USE_ARES = @USE_ARES@ +USE_EMBEDDED_ARES_FALSE = @USE_EMBEDDED_ARES_FALSE@ +USE_EMBEDDED_ARES_TRUE = @USE_EMBEDDED_ARES_TRUE@ +USE_GNUTLS = @USE_GNUTLS@ +USE_LIBRTMP = @USE_LIBRTMP@ +USE_LIBSSH2 = @USE_LIBSSH2@ +USE_MANUAL_FALSE = @USE_MANUAL_FALSE@ +USE_MANUAL_TRUE = @USE_MANUAL_TRUE@ +USE_NSS = @USE_NSS@ +USE_OPENLDAP = @USE_OPENLDAP@ +USE_POLARSSL = @USE_POLARSSL@ +USE_SSLEAY = @USE_SSLEAY@ +USE_WINDOWS_SSPI = @USE_WINDOWS_SSPI@ +VERSION = @VERSION@ +VERSIONNUM = @VERSIONNUM@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ +am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ +am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +libext = @libext@ +localedir = @localedir@ +localstatedir = @localstatedir@ +lt_ECHO = @lt_ECHO@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +subdirs = @subdirs@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +EXTRA_DIST = README curl-ssl.spec.in curl.spec.in make_curl_rpm +all: all-am + +.SUFFIXES: +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ + && exit 0; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu packages/Linux/RPM/Makefile'; \ + cd $(top_srcdir) && \ + $(AUTOMAKE) --gnu packages/Linux/RPM/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +curl.spec: $(top_builddir)/config.status $(srcdir)/curl.spec.in + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ +curl-ssl.spec: $(top_builddir)/config.status $(srcdir)/curl-ssl.spec.in + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +distclean-libtool: + -rm -f libtool +uninstall-info-am: +tags: TAGS +TAGS: + +ctags: CTAGS +CTAGS: + + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ + list='$(DISTFILES)'; for file in $$list; do \ + case $$file in \ + $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ + $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ + esac; \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test "$$dir" != "$$file" && test "$$dir" != "."; then \ + dir="/$$dir"; \ + $(mkdir_p) "$(distdir)$$dir"; \ + else \ + dir=''; \ + fi; \ + if test -d $$d/$$file; then \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ + fi; \ + cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ + else \ + test -f $(distdir)/$$file \ + || cp -p $$d/$$file $(distdir)/$$file \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile +installdirs: +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-generic clean-libtool mostlyclean-am + +distclean: distclean-am + -rm -f Makefile +distclean-am: clean-am distclean-generic distclean-libtool + +dvi: dvi-am + +dvi-am: + +html: html-am + +info: info-am + +info-am: + +install-data-am: + +install-exec-am: + +install-info: install-info-am + +install-man: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-generic mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: uninstall-info-am + +.PHONY: all all-am check check-am clean clean-generic clean-libtool \ + distclean distclean-generic distclean-libtool distdir dvi \ + dvi-am html html-am info info-am install install-am \ + install-data install-data-am install-exec install-exec-am \ + install-info install-info-am install-man install-strip \ + installcheck installcheck-am installdirs maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-generic \ + mostlyclean-libtool pdf pdf-am ps ps-am uninstall uninstall-am \ + uninstall-info-am + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/mobicore/common/curl/packages/Linux/RPM/README b/mobicore/common/curl/packages/Linux/RPM/README new file mode 100644 index 0000000000000000000000000000000000000000..a48ece0433dc01fe7b6a09ebd11e292e4f66dbe4 --- /dev/null +++ b/mobicore/common/curl/packages/Linux/RPM/README @@ -0,0 +1,5 @@ +Author: Daniel (I'm not trustworthy, replace this!) + +Paul Marquis's 'make_curl_rpm' script is a fine example on how to automate the +jobs. You need to fill in your own name and email at least. + diff --git a/mobicore/common/curl/packages/Linux/RPM/curl-ssl.spec.in b/mobicore/common/curl/packages/Linux/RPM/curl-ssl.spec.in new file mode 100644 index 0000000000000000000000000000000000000000..7f290ba215f574a637b4c62dc82d85d75bd3ae31 --- /dev/null +++ b/mobicore/common/curl/packages/Linux/RPM/curl-ssl.spec.in @@ -0,0 +1,84 @@ +%define name curl-ssl +%define tarball curl +%define version 7.11.0 +%define release 1 + +%define curlroot %{_builddir}/%{tarball}-%{version} + +Summary: get a file from an FTP or HTTP server. +Name: %{name} +Version: %{version} +Release: %{release} +Copyright: MIT/X derivate +Vendor: Daniel Stenberg +Packager: Troy Engel +Group: Utilities/Console +Source: %{tarball}-%{version}.tar.gz +URL: http://curl.haxx.se/ +Provides: curl +Obsoletes: curl +BuildRoot: %{_tmppath}/%{tarball}-%{version}-root +Requires: openssl >= 0.9.5 + +%description +curl is a client to get documents/files from servers, using any of the +supported protocols. The command is designed to work without user +interaction or any kind of interactivity. + +curl offers a busload of useful tricks like proxy support, user +authentication, ftp upload, HTTP post, file transfer resume and more. + +%package devel +Summary: The includes, libs, and man pages to develop with libcurl +Group: Development/Libraries +Requires: openssl-devel >= 0.9.5 +Provides: curl-devel + +%description devel +libcurl is the core engine of curl; this packages contains all the libs, +headers, and manual pages to develop applications using libcurl. + +%prep + +%setup -q -n %{tarball}-%{version} + +%build +cd %{curlroot} && (if [ -f configure.in ]; then mv -f configure.in configure.in.rpm; fi) +%configure +cd %{curlroot} && (if [ -f configure.in.rpm ]; then mv -f configure.in.rpm configure.in; fi) +make + +%install +[ "%{buildroot}" != "/" ] && rm -rf %{buildroot} +make DESTDIR=%{buildroot} install-strip + +%clean +[ "%{buildroot}" != "/" ] && rm -rf %{buildroot} +[ "%{curlroot}" != "/" ] && rm -rf %{curlroot} + +%post +/sbin/ldconfig + +%postun +/sbin/ldconfig + +%files +%defattr(-,root,root) +%attr(0755,root,root) %{_bindir}/curl +%attr(0644,root,root) %{_mandir}/man1/curl.1* +%{_libdir}/libcurl.so* +%{_datadir}/curl/curl-ca-bundle.crt +%doc CHANGES COPYING README testcurl.sh docs/BUGS docs/SSLCERTS +%doc docs/CONTRIBUTE docs/FAQ docs/FEATURES docs/HISTORY docs/INSTALL +%doc docs/KNOWN_BUGS docs/MANUAL docs/RESOURCES docs/THANKS +%doc docs/TODO docs/VERSIONS docs/TheArtOfHttpScripting tests + +%files devel +%defattr(-,root,root) +%attr(0755,root,root) %{_bindir}/curl-config +%attr(0644,root,root) %{_mandir}/man1/curl-config.1* +%attr(0644,root,root) %{_mandir}/man3/* +%attr(0644,root,root) %{_includedir}/curl/* +%{_libdir}/libcurl.a +%{_libdir}/libcurl.la +%doc docs/BINDINGS docs/INTERNALS docs/examples/* docs/libcurl-the-guide diff --git a/mobicore/common/curl/packages/Linux/RPM/curl.spec.in b/mobicore/common/curl/packages/Linux/RPM/curl.spec.in new file mode 100644 index 0000000000000000000000000000000000000000..2382f578df6a6404daab9e98e88a309a2fdb757b --- /dev/null +++ b/mobicore/common/curl/packages/Linux/RPM/curl.spec.in @@ -0,0 +1,84 @@ +%define name curl +%define version @VERSION@ +%define release 1 +%define prefix /usr + +%define builddir $RPM_BUILD_DIR/%{name}-%{version} + +Summary: get a file from an FTP or HTTP server. +Name: %{name} +Version: %{version} +Release: %{release} +Copyright: MPL +Vendor: Daniel Stenberg +Packager: Loic Dachary +Group: Utilities/Console +Source: %{name}-%{version}.tar.gz +URL: http://curl.haxx.se/ +BuildRoot: /tmp/%{name}-%{version}-root + +%description +curl is a client to get documents/files from servers, using any of the +supported protocols. The command is designed to work without user +interaction or any kind of interactivity. + +curl offers a busload of useful tricks like proxy support, user +authentication, ftp upload, HTTP post, file transfer resume and more. + +Note: this version is compiled without SSL (https:) support. + +%package devel +Summary: The includes, libs, and man pages to develop with libcurl +Group: Development/Libraries + +%description devel +libcurl is the core engine of curl; this packages contains all the libs, +headers, and manual pages to develop applications using libcurl. + +%prep +rm -rf %{builddir} + +%setup + +%build +%configure --without-ssl --prefix=%{prefix} +make + +%install +rm -rf $RPM_BUILD_ROOT +make DESTDIR=$RPM_BUILD_ROOT install-strip + +%clean +rm -rf $RPM_BUILD_ROOT +rm -rf %{builddir} + +%post +/sbin/ldconfig + +%postun +/sbin/ldconfig + +%files +%defattr(-,root,root) +%attr(0755,root,root) %{_bindir}/curl +%attr(0644,root,root) %{_mandir}/man1/* +%{prefix}/lib/libcurl.so* +%doc CHANGES LEGAL MITX.txt MPL-1.1.txt README docs/BUGS +%doc docs/CONTRIBUTE docs/FAQ docs/FEATURES docs/INSTALL docs/INTERNALS +%doc docs/LIBCURL docs/MANUAL docs/README* docs/RESOURCES docs/TODO +%doc docs/TheArtOfHttpScripting + +%files devel +%defattr(-,root,root) +%attr(0644,root,root) %{_mandir}/man3/* +%attr(0644,root,root) %{_includedir}/curl/* +%{prefix}/lib/libcurl.a +%{prefix}/lib/libcurl.la +%doc docs/examples/* + +%changelog +* Sun Jan 7 2001 Loic Dachary + + - use _mandir instead of prefix to locate man pages because + _mandir is not always prefix/man/man?. + diff --git a/mobicore/common/curl/packages/Linux/RPM/make_curl_rpm b/mobicore/common/curl/packages/Linux/RPM/make_curl_rpm new file mode 100644 index 0000000000000000000000000000000000000000..544a23b67fc93bd342d38e380a0db7905e9ddb94 --- /dev/null +++ b/mobicore/common/curl/packages/Linux/RPM/make_curl_rpm @@ -0,0 +1,62 @@ +#! /bin/sh +# script to build curl RPM from src RPM (SSL and non-SSL versions) + +# initialize +top_dir=/usr/src/redhat +sources_dir=$top_dir/SOURCES +specs_dir=$top_dir/SPECS +rpms_dir=$top_dir/RPMS +arch=`rpm --showrc | awk 'NF == 3 && $2 == "_arch" { print $3 }'` + +# fill in your own name and email here +packager_name="Mr Joe Packager Person" +packager_email='' + +# make sure we're running as root +if test `id -u` -ne `id -u root` +then + echo "you must build the RPM as root" + exit 1 +fi + +# get version and release number +if test $# -lt 1 +then + echo "version number?" + read version +else + version=$1 +fi + +if test $# -lt 2 +then + echo "release number?" + read release +else + release=$2 +fi + +# build all the files +targets="curl curl-ssl" +for target in $targets +do + # make sure src RPM exist + src_rpm="$target-$version-$release.src.rpm" + if test -f $src_rpm + then + rpm -ivh $src_rpm + + # replace packager in spec file + sed -e 's/^Packager: .*/Packager: $packager_name $packager_email/' $specs_dir/$target.spec > $specs_dir/$target-$version-$arch.spec + + # build it + if ! rpm -ba $specs_dir/$target-$version-$arch.spec + then + echo "error building $target for $arch -- check output above" + fi + + echo "$target rpm is now in $rpms_dir/$arch" + else + echo $src_rpm does not exist + fi +done diff --git a/mobicore/common/curl/packages/Makefile.am b/mobicore/common/curl/packages/Makefile.am new file mode 100644 index 0000000000000000000000000000000000000000..e211c0a3f148e3101e039f456703fbb1ab8e3c48 --- /dev/null +++ b/mobicore/common/curl/packages/Makefile.am @@ -0,0 +1,32 @@ +SUBDIRS = Win32 Linux Solaris EPM AIX vms + +EXTRA_DIST = README \ + DOS/README \ + DOS/common.dj \ + NetWare/get_ver.awk \ + OS400/README.OS400 \ + OS400/ccsidcurl.c \ + OS400/ccsidcurl.h \ + OS400/curl.inc.in \ + OS400/initscript.sh \ + OS400/make-include.sh \ + OS400/make-lib.sh \ + OS400/make-src.sh \ + OS400/make-tests.sh \ + OS400/makefile.sh \ + OS400/os400sys.c \ + OS400/os400sys.h \ + Symbian/bwins/libcurlu.def \ + Symbian/eabi/libcurlu.def \ + Symbian/group/bld.inf \ + Symbian/group/curl.iby \ + Symbian/group/curl.mmp \ + Symbian/group/curl.pkg \ + Symbian/group/libcurl.iby \ + Symbian/group/libcurl.mmp \ + Symbian/group/libcurl.pkg \ + Symbian/readme.txt \ + TPF/curl.mak \ + TPF/maketpf.env_curl \ + TPF/maketpf.env_curllib + diff --git a/mobicore/common/curl/packages/Makefile.in b/mobicore/common/curl/packages/Makefile.in new file mode 100644 index 0000000000000000000000000000000000000000..da71578bdb621ab483a437c7c2aa719f04d864e6 --- /dev/null +++ b/mobicore/common/curl/packages/Makefile.in @@ -0,0 +1,593 @@ +# Makefile.in generated by automake 1.9.6 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005 Free Software Foundation, Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ +srcdir = @srcdir@ +top_srcdir = @top_srcdir@ +VPATH = @srcdir@ +pkgdatadir = $(datadir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +top_builddir = .. +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +INSTALL = @INSTALL@ +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +subdir = packages +DIST_COMMON = README $(srcdir)/Makefile.am $(srcdir)/Makefile.in +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/m4/curl-compilers.m4 \ + $(top_srcdir)/m4/curl-confopts.m4 \ + $(top_srcdir)/m4/curl-functions.m4 \ + $(top_srcdir)/m4/curl-override.m4 \ + $(top_srcdir)/m4/curl-reentrant.m4 \ + $(top_srcdir)/m4/curl-system.m4 $(top_srcdir)/m4/libtool.m4 \ + $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ + $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ + $(top_srcdir)/acinclude.m4 $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs +CONFIG_HEADER = $(top_builddir)/lib/curl_config.h \ + $(top_builddir)/src/curl_config.h \ + $(top_builddir)/include/curl/curlbuild.h +CONFIG_CLEAN_FILES = +SOURCES = +DIST_SOURCES = +RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \ + html-recursive info-recursive install-data-recursive \ + install-exec-recursive install-info-recursive \ + install-recursive installcheck-recursive installdirs-recursive \ + pdf-recursive ps-recursive uninstall-info-recursive \ + uninstall-recursive +ETAGS = etags +CTAGS = ctags +DIST_SUBDIRS = $(SUBDIRS) +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +AMDEP_FALSE = @AMDEP_FALSE@ +AMDEP_TRUE = @AMDEP_TRUE@ +AMTAR = @AMTAR@ +AR = @AR@ +AS = @AS@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +BUILD_LIBHOSTNAME_FALSE = @BUILD_LIBHOSTNAME_FALSE@ +BUILD_LIBHOSTNAME_TRUE = @BUILD_LIBHOSTNAME_TRUE@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CONFIGURE_OPTIONS = @CONFIGURE_OPTIONS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CROSSCOMPILING_FALSE = @CROSSCOMPILING_FALSE@ +CROSSCOMPILING_TRUE = @CROSSCOMPILING_TRUE@ +CURLDEBUG_FALSE = @CURLDEBUG_FALSE@ +CURLDEBUG_TRUE = @CURLDEBUG_TRUE@ +CURL_CA_BUNDLE = @CURL_CA_BUNDLE@ +CURL_CFLAG_EXTRAS = @CURL_CFLAG_EXTRAS@ +CURL_DISABLE_DICT = @CURL_DISABLE_DICT@ +CURL_DISABLE_FILE = @CURL_DISABLE_FILE@ +CURL_DISABLE_FTP = @CURL_DISABLE_FTP@ +CURL_DISABLE_GOPHER = @CURL_DISABLE_GOPHER@ +CURL_DISABLE_HTTP = @CURL_DISABLE_HTTP@ +CURL_DISABLE_IMAP = @CURL_DISABLE_IMAP@ +CURL_DISABLE_LDAP = @CURL_DISABLE_LDAP@ +CURL_DISABLE_LDAPS = @CURL_DISABLE_LDAPS@ +CURL_DISABLE_POP3 = @CURL_DISABLE_POP3@ +CURL_DISABLE_PROXY = @CURL_DISABLE_PROXY@ +CURL_DISABLE_RTSP = @CURL_DISABLE_RTSP@ +CURL_DISABLE_SMTP = @CURL_DISABLE_SMTP@ +CURL_DISABLE_TELNET = @CURL_DISABLE_TELNET@ +CURL_DISABLE_TFTP = @CURL_DISABLE_TFTP@ +CURL_LIBS = @CURL_LIBS@ +CURL_NETWORK_LIBS = @CURL_NETWORK_LIBS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DLLTOOL = @DLLTOOL@ +DSYMUTIL = @DSYMUTIL@ +DUMPBIN = @DUMPBIN@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +ENABLE_SHARED = @ENABLE_SHARED@ +EXEEXT = @EXEEXT@ +FGREP = @FGREP@ +GREP = @GREP@ +HAVE_LDAP_SSL = @HAVE_LDAP_SSL@ +HAVE_LIBZ = @HAVE_LIBZ@ +HAVE_LIBZ_FALSE = @HAVE_LIBZ_FALSE@ +HAVE_LIBZ_TRUE = @HAVE_LIBZ_TRUE@ +HAVE_PK11_CREATEGENERICOBJECT = @HAVE_PK11_CREATEGENERICOBJECT@ +IDN_ENABLED = @IDN_ENABLED@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +IPV6_ENABLED = @IPV6_ENABLED@ +KRB4_ENABLED = @KRB4_ENABLED@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LIBCURL_LIBS = @LIBCURL_LIBS@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +MAINT = @MAINT@ +MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@ +MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@ +MAKEINFO = @MAKEINFO@ +MANOPT = @MANOPT@ +MIMPURE_FALSE = @MIMPURE_FALSE@ +MIMPURE_TRUE = @MIMPURE_TRUE@ +NM = @NM@ +NMEDIT = @NMEDIT@ +NO_UNDEFINED_FALSE = @NO_UNDEFINED_FALSE@ +NO_UNDEFINED_TRUE = @NO_UNDEFINED_TRUE@ +NROFF = @NROFF@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +OTOOL = @OTOOL@ +OTOOL64 = @OTOOL64@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH = @PATH@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PERL = @PERL@ +PKGADD_NAME = @PKGADD_NAME@ +PKGADD_PKG = @PKGADD_PKG@ +PKGADD_VENDOR = @PKGADD_VENDOR@ +PKGCONFIG = @PKGCONFIG@ +RANDOM_FILE = @RANDOM_FILE@ +RANLIB = @RANLIB@ +REQUIRE_LIB_DEPS = @REQUIRE_LIB_DEPS@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +SONAME_BUMP_FALSE = @SONAME_BUMP_FALSE@ +SONAME_BUMP_TRUE = @SONAME_BUMP_TRUE@ +SSL_ENABLED = @SSL_ENABLED@ +STATICLIB_FALSE = @STATICLIB_FALSE@ +STATICLIB_TRUE = @STATICLIB_TRUE@ +STRIP = @STRIP@ +SUPPORT_FEATURES = @SUPPORT_FEATURES@ +SUPPORT_PROTOCOLS = @SUPPORT_PROTOCOLS@ +TEST_SERVER_LIBS = @TEST_SERVER_LIBS@ +USE_ARES = @USE_ARES@ +USE_EMBEDDED_ARES_FALSE = @USE_EMBEDDED_ARES_FALSE@ +USE_EMBEDDED_ARES_TRUE = @USE_EMBEDDED_ARES_TRUE@ +USE_GNUTLS = @USE_GNUTLS@ +USE_LIBRTMP = @USE_LIBRTMP@ +USE_LIBSSH2 = @USE_LIBSSH2@ +USE_MANUAL_FALSE = @USE_MANUAL_FALSE@ +USE_MANUAL_TRUE = @USE_MANUAL_TRUE@ +USE_NSS = @USE_NSS@ +USE_OPENLDAP = @USE_OPENLDAP@ +USE_POLARSSL = @USE_POLARSSL@ +USE_SSLEAY = @USE_SSLEAY@ +USE_WINDOWS_SSPI = @USE_WINDOWS_SSPI@ +VERSION = @VERSION@ +VERSIONNUM = @VERSIONNUM@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ +am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ +am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +libext = @libext@ +localedir = @localedir@ +localstatedir = @localstatedir@ +lt_ECHO = @lt_ECHO@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +subdirs = @subdirs@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +SUBDIRS = Win32 Linux Solaris EPM AIX vms +EXTRA_DIST = README \ + DOS/README \ + DOS/common.dj \ + NetWare/get_ver.awk \ + OS400/README.OS400 \ + OS400/ccsidcurl.c \ + OS400/ccsidcurl.h \ + OS400/curl.inc.in \ + OS400/initscript.sh \ + OS400/make-include.sh \ + OS400/make-lib.sh \ + OS400/make-src.sh \ + OS400/make-tests.sh \ + OS400/makefile.sh \ + OS400/os400sys.c \ + OS400/os400sys.h \ + Symbian/bwins/libcurlu.def \ + Symbian/eabi/libcurlu.def \ + Symbian/group/bld.inf \ + Symbian/group/curl.iby \ + Symbian/group/curl.mmp \ + Symbian/group/curl.pkg \ + Symbian/group/libcurl.iby \ + Symbian/group/libcurl.mmp \ + Symbian/group/libcurl.pkg \ + Symbian/readme.txt \ + TPF/curl.mak \ + TPF/maketpf.env_curl \ + TPF/maketpf.env_curllib + +all: all-recursive + +.SUFFIXES: +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ + && exit 0; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu packages/Makefile'; \ + cd $(top_srcdir) && \ + $(AUTOMAKE) --gnu packages/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +distclean-libtool: + -rm -f libtool +uninstall-info-am: + +# This directory's subdirectories are mostly independent; you can cd +# into them and run `make' without going through this Makefile. +# To change the values of `make' variables: instead of editing Makefiles, +# (1) if the variable is set in `config.status', edit `config.status' +# (which will cause the Makefiles to be regenerated when you run `make'); +# (2) otherwise, pass the desired values on the `make' command line. +$(RECURSIVE_TARGETS): + @failcom='exit 1'; \ + for f in x $$MAKEFLAGS; do \ + case $$f in \ + *=* | --[!k]*);; \ + *k*) failcom='fail=yes';; \ + esac; \ + done; \ + dot_seen=no; \ + target=`echo $@ | sed s/-recursive//`; \ + list='$(SUBDIRS)'; for subdir in $$list; do \ + echo "Making $$target in $$subdir"; \ + if test "$$subdir" = "."; then \ + dot_seen=yes; \ + local_target="$$target-am"; \ + else \ + local_target="$$target"; \ + fi; \ + (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ + || eval $$failcom; \ + done; \ + if test "$$dot_seen" = "no"; then \ + $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ + fi; test -z "$$fail" + +mostlyclean-recursive clean-recursive distclean-recursive \ +maintainer-clean-recursive: + @failcom='exit 1'; \ + for f in x $$MAKEFLAGS; do \ + case $$f in \ + *=* | --[!k]*);; \ + *k*) failcom='fail=yes';; \ + esac; \ + done; \ + dot_seen=no; \ + case "$@" in \ + distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ + *) list='$(SUBDIRS)' ;; \ + esac; \ + rev=''; for subdir in $$list; do \ + if test "$$subdir" = "."; then :; else \ + rev="$$subdir $$rev"; \ + fi; \ + done; \ + rev="$$rev ."; \ + target=`echo $@ | sed s/-recursive//`; \ + for subdir in $$rev; do \ + echo "Making $$target in $$subdir"; \ + if test "$$subdir" = "."; then \ + local_target="$$target-am"; \ + else \ + local_target="$$target"; \ + fi; \ + (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ + || eval $$failcom; \ + done && test -z "$$fail" +tags-recursive: + list='$(SUBDIRS)'; for subdir in $$list; do \ + test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \ + done +ctags-recursive: + list='$(SUBDIRS)'; for subdir in $$list; do \ + test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \ + done + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + mkid -fID $$unique +tags: TAGS + +TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ + include_option=--etags-include; \ + empty_fix=.; \ + else \ + include_option=--include; \ + empty_fix=; \ + fi; \ + list='$(SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + test ! -f $$subdir/TAGS || \ + tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \ + fi; \ + done; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$tags $$unique; \ + fi +ctags: CTAGS +CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + test -z "$(CTAGS_ARGS)$$tags$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$tags $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && cd $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) $$here + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(DISTFILES) + $(mkdir_p) $(distdir)/DOS $(distdir)/NetWare $(distdir)/OS400 $(distdir)/Symbian $(distdir)/Symbian/bwins $(distdir)/Symbian/eabi $(distdir)/Symbian/group $(distdir)/TPF + @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ + list='$(DISTFILES)'; for file in $$list; do \ + case $$file in \ + $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ + $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ + esac; \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test "$$dir" != "$$file" && test "$$dir" != "."; then \ + dir="/$$dir"; \ + $(mkdir_p) "$(distdir)$$dir"; \ + else \ + dir=''; \ + fi; \ + if test -d $$d/$$file; then \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ + fi; \ + cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ + else \ + test -f $(distdir)/$$file \ + || cp -p $$d/$$file $(distdir)/$$file \ + || exit 1; \ + fi; \ + done + list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + test -d "$(distdir)/$$subdir" \ + || $(mkdir_p) "$(distdir)/$$subdir" \ + || exit 1; \ + distdir=`$(am__cd) $(distdir) && pwd`; \ + top_distdir=`$(am__cd) $(top_distdir) && pwd`; \ + (cd $$subdir && \ + $(MAKE) $(AM_MAKEFLAGS) \ + top_distdir="$$top_distdir" \ + distdir="$$distdir/$$subdir" \ + distdir) \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-recursive +all-am: Makefile +installdirs: installdirs-recursive +installdirs-am: +install: install-recursive +install-exec: install-exec-recursive +install-data: install-data-recursive +uninstall: uninstall-recursive + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-recursive +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-recursive + +clean-am: clean-generic clean-libtool mostlyclean-am + +distclean: distclean-recursive + -rm -f Makefile +distclean-am: clean-am distclean-generic distclean-libtool \ + distclean-tags + +dvi: dvi-recursive + +dvi-am: + +html: html-recursive + +info: info-recursive + +info-am: + +install-data-am: + +install-exec-am: + +install-info: install-info-recursive + +install-man: + +installcheck-am: + +maintainer-clean: maintainer-clean-recursive + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-recursive + +mostlyclean-am: mostlyclean-generic mostlyclean-libtool + +pdf: pdf-recursive + +pdf-am: + +ps: ps-recursive + +ps-am: + +uninstall-am: uninstall-info-am + +uninstall-info: uninstall-info-recursive + +.PHONY: $(RECURSIVE_TARGETS) CTAGS GTAGS all all-am check check-am \ + clean clean-generic clean-libtool clean-recursive ctags \ + ctags-recursive distclean distclean-generic distclean-libtool \ + distclean-recursive distclean-tags distdir dvi dvi-am html \ + html-am info info-am install install-am install-data \ + install-data-am install-exec install-exec-am install-info \ + install-info-am install-man install-strip installcheck \ + installcheck-am installdirs installdirs-am maintainer-clean \ + maintainer-clean-generic maintainer-clean-recursive \ + mostlyclean mostlyclean-generic mostlyclean-libtool \ + mostlyclean-recursive pdf pdf-am ps ps-am tags tags-recursive \ + uninstall uninstall-am uninstall-info-am + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/mobicore/common/curl/packages/NetWare/get_ver.awk b/mobicore/common/curl/packages/NetWare/get_ver.awk new file mode 100644 index 0000000000000000000000000000000000000000..2f3b30814e529e8877258518a068a208e54a0606 --- /dev/null +++ b/mobicore/common/curl/packages/NetWare/get_ver.awk @@ -0,0 +1,75 @@ +# *************************************************************************** +# * _ _ ____ _ +# * Project ___| | | | _ \| | +# * / __| | | | |_) | | +# * | (__| |_| | _ <| |___ +# * \___|\___/|_| \_\_____| +# * +# * Copyright (C) 1998 - 2008, Daniel Stenberg, , et al. +# * +# * This software is licensed as described in the file COPYING, which +# * you should have received as part of this distribution. The terms +# * are also available at http://curl.haxx.se/docs/copyright.html. +# * +# * You may opt to use, copy, modify, merge, publish, distribute and/or sell +# * copies of the Software, and permit persons to whom the Software is +# * furnished to do so, under the terms of the COPYING file. +# * +# * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY +# * KIND, either express or implied. +# * +# *************************************************************************** +# awk script which fetches curl / ares version number and string from input +# file and writes them to STDOUT. Here you can get an awk version for Win32: +# http://www.gknw.net/development/prgtools/awk-20070501.zip +# +BEGIN { + if (match (ARGV[1], /curlver.h/)) { + while ((getline < ARGV[1]) > 0) { + if (match ($0, /^#define LIBCURL_COPYRIGHT "[^"]+"$/)) { + libcurl_copyright_str = substr($0, 28, length($0)-28); + } + else if (match ($0, /^#define LIBCURL_VERSION "[^"]+"$/)) { + libcurl_ver_str = substr($3, 2, length($3)-2); + } + else if (match ($0, /^#define LIBCURL_VERSION_MAJOR [0-9]+$/)) { + libcurl_ver_major = substr($3, 1, length($3)); + } + else if (match ($0, /^#define LIBCURL_VERSION_MINOR [0-9]+$/)) { + libcurl_ver_minor = substr($3, 1, length($3)); + } + else if (match ($0, /^#define LIBCURL_VERSION_PATCH [0-9]+$/)) { + libcurl_ver_patch = substr($3, 1, length($3)); + } + } + libcurl_ver = libcurl_ver_major "," libcurl_ver_minor "," libcurl_ver_patch; + print "LIBCURL_VERSION = " libcurl_ver ""; + print "LIBCURL_VERSION_STR = " libcurl_ver_str ""; + print "LIBCURL_COPYRIGHT_STR = " libcurl_copyright_str ""; + } + if (match (ARGV[1], /ares_version.h/)) { + while ((getline < ARGV[1]) > 0) { + if (match ($0, /^#define ARES_COPYRIGHT "[^"]+"$/)) { + libcares_copyright_str = substr($0, 25, length($0)-25); + } + else if (match ($0, /^#define ARES_VERSION_STR "[^"]+"$/)) { + libcares_ver_str = substr($3, 2, length($3)-2); + } + else if (match ($0, /^#define ARES_VERSION_MAJOR [0-9]+$/)) { + libcares_ver_major = substr($3, 1, length($3)); + } + else if (match ($0, /^#define ARES_VERSION_MINOR [0-9]+$/)) { + libcares_ver_minor = substr($3, 1, length($3)); + } + else if (match ($0, /^#define ARES_VERSION_PATCH [0-9]+$/)) { + libcares_ver_patch = substr($3, 1, length($3)); + } + } + libcares_ver = libcares_ver_major "," libcares_ver_minor "," libcares_ver_patch; + print "LIBCARES_VERSION = " libcares_ver ""; + print "LIBCARES_VERSION_STR = " libcares_ver_str ""; + print "LIBCARES_COPYRIGHT_STR = " libcares_copyright_str ""; + } +} + + diff --git a/mobicore/common/curl/packages/OS400/README.OS400 b/mobicore/common/curl/packages/OS400/README.OS400 new file mode 100644 index 0000000000000000000000000000000000000000..746bba8a537a27285689e6a5f9c1a646a695b44e --- /dev/null +++ b/mobicore/common/curl/packages/OS400/README.OS400 @@ -0,0 +1,262 @@ + +Implementation notes: + + This is a true OS/400 implementation, not a PASE implementation (for PASE, +use AIX implementation). + + The biggest problem with OS/400 is EBCDIC. Libcurl implements an internal +conversion mechanism, but it has been designed for computers that have a +single native character set. OS/400 default native character set varies +depending on the country for which it has been localized. And more, a job +may dynamically alter its "native" character set. + Several characters that do not have fixed code in EBCDIC variants are +used in libcurl strings. As a consequence, using the existing conversion +mechanism would have lead in a localized binary library - not portable across +countries. + For this reason, and because libcurl was originally designed for ASCII based +operating systems, the current OS/400 implementation uses ASCII as internal +character set. This has been accomplished using the QADRT library and +include files, a C and system procedures ASCII wrapper library. See IBM QADRT +description for more information. + This then results in libcurl being an ASCII library: any function string +argument is taken/returned in ASCII and a C/C++ calling program built around +QADRT may use libcurl functions as on any other platform. + QADRT does not define ASCII wrappers for all C/system procedures: the +OS/400 configuration header file and an additional module (os400sys.c) define +some more of them, that are used by libcurl and that QADRT left out. + To support all the different variants of EBCDIC, non-standard wrapper +procedures have been added to libcurl on OS/400: they provide an additional +CCSID (numeric Coded Character Set ID specific to OS/400) parameter for each +string argument. String values passed to callback procedures are NOT converted, +so text gathered this way is (probably !) ASCII. + + Another OS/400 problem comes from the fact that the last fixed argument of a +vararg procedure may not be of type char, unsigned char, short or unsigned +short. Enums that are internally implemented by the C compiler as one of these +types are also forbidden. Libcurl uses enums as vararg procedure tagfields... +Happily, there is a pragma forcing enums to type "int". The original libcurl +header files are thus altered during build process to use this pragma, in +order to force libcurl enums of being type int (the pragma disposition in use +before inclusion is restored before resuming the including unit compilation). + + Three SSL implementations were present in libcurl. Nevertheless, none of them +is available on OS/400. To support SSL on OS/400, a fourth implementation has +been added (qssl.[ch]). There is no way to have different certificate stores +for CAs and for personal/application certificates/key. More, the SSL context +may be defined as an application identifier in the main certificate store, +or as a keyring file. As a consequence, the meaning of some fields have been +slightly altered: +_ The "certificate identifier" is taken from CURLOPT_SSLCERT if defined, else +from CURLOPT_CAINFO. +_ The certificate identifier is then used as an application identifier in the +main certificate store. If successful, this context is used. +_ If the previous step failed, the certificate identifier is used as the file +name of a keyring. CURLOPT_KEYPASSWD is used here as the keyring password. +_ The default ca-bundle (CURLOPT_CAINFO) is set to the main certificate store's +keyring file name: this allows to use the system global CAs by default. (In that +case, the keyring password is safely recovered from the system... IBM dixit!) + + Non-standard EBCDIC wrapper prototypes are defined in an additional header +file: ccsidcurl.h. These should be self-explanatory to an OS/400-aware +designer. CCSID 0 can be used to select the current job's CCSID. + Wrapper procedures with variable arguments are described below: + +_ curl_easy_setopt_ccsid() + Variable arguments are a string pointer and a CCSID (unsigned int) for +options: + CURLOPT_CAINFO + CURLOPT_CAPATH + CURLOPT_COOKIE + CURLOPT_COOKIEFILE + CURLOPT_COOKIEJAR + CURLOPT_COOKIELIST + CURLOPT_CUSTOMREQUEST + CURLOPT_EGDSOCKET + CURLOPT_ENCODING + CURLOPT_FTPPORT + CURLOPT_FTP_ACCOUNT + CURLOPT_FTP_ALTERNATIVE_TO_USER + CURLOPT_INTERFACE + CURLOPT_KEYPASSWD + CURLOPT_KRBLEVEL + CURLOPT_NETRC_FILE + CURLOPT_COPYPOSTFIELDS + CURLOPT_PROXY + CURLOPT_PROXYUSERPWD + CURLOPT_RANDOM_FILE + CURLOPT_RANGE + CURLOPT_REFERER + CURLOPT_SSH_PRIVATE_KEYFILE + CURLOPT_SSH_PUBLIC_KEYFILE + CURLOPT_SSLCERT + CURLOPT_SSLCERTTYPE + CURLOPT_SSLENGINE + CURLOPT_SSLKEY + CURLOPT_SSLKEYTYPE + CURLOPT_SSL_CIPHER_LIST + CURLOPT_URL + CURLOPT_USERAGENT + CURLOPT_USERPWD + CURLOPT_SSH_HOST_PUBLIC_KEY_MD5 + CURLOPT_CRLFILE + CURLOPT_ISSUERCERT + CURLOPT_USERNAME + CURLOPT_PASSWORD + CURLOPT_PROXYUSERNAME + CURLOPT_PROXYPASSWORD + CURLOPT_NOPROXY + CURLOPT_RTSP_SESSION_UID + CURLOPT_RTSP_STREAM_URI + CURLOPT_RTSP_TRANSPORT + CURLOPT_SOCKS5_GSSAPI_SERVICE + CURLOPT_MAIL_FROM + Else it is the same as for curl_easy_setopt(). + Note that CURLOPT_ERRORBUFFER is not in the list above, since it gives the +address of an (empty) character buffer, not the address of a string. +CURLOPT_POSTFIELDS stores the address of static binary data (of type void *) and +thus is not converted. If CURLOPT_COPYPOSTFIELDS is issued after +CURLOPT_POSTFIELDSIZE != -1, the data size is adjusted according to the +CCSID conversion result length. + +_ curl_formadd_ccsid() + In the variable argument list, string pointers should be followed by a (long) +CCSID for the following options: + CURLFORM_FILENAME + CURLFORM_CONTENTTYPE + CURLFORM_BUFFER + CURLFORM_FILE + CURLFORM_FILECONTENT + CURLFORM_COPYCONTENTS + CURLFORM_COPYNAME + CURLFORM_PTRNAME + If taken from an argument array, an additional array entry must follow each +entry containing one of the above option. This additional entry holds the CCSID +in its value field, and the option field is meaningless. + It is not possible to have a string pointer and its CCSID across a function +parameter/array boundary. + Please note that CURLFORM_PTRCONTENTS and CURLFORM_BUFFERPTR are considered +unconvertible strings and thus are NOT followed by a CCSID. + +_ curl_easy_getinfo_ccsid + The following options are followed by a 'char * *' and a CCSID. Unlike +curl_easy_getinfo(), the value returned in the pointer should be freed after +use: + CURLINFO_EFFECTIVE_URL + CURLINFO_CONTENT_TYPE + CURLINFO_FTP_ENTRY_PATH + Other options are processed like in curl_easy_getinfo(). + + Standard compilation environment does support neither autotools nor make; +in fact, very few common utilities are available. As a consequence, the +config-os400.h has been coded manually and the compilation scripts are +a set of shell scripts stored in subdirectory packages/OS400. + + The "curl" command and the test environment are currently not supported on +OS/400. + + +Protocols currently implemented on OS/400: +_ HTTP +_ HTTPS +_ FTP +_ FTPS +_ FTP with secure transmission. +_ LDAP +_ DICT +_ TELNET + + + +Compiling on OS/400: + + These instructions targets people who knows about OS/400, compiling, IFS and +archive extraction. Do not ask questions about these subjects if you're not +familiar with. + +_ As a prerequisite, QADRT development environment must be installed. +_ Install the curl source directory in IFS. +_ Enter shell (QSH) +_ Change current directory to the curl installation directory +_ Change current directory to ./packages/OS400 +_ Edit file iniscript.sh. You may want to change tunable configuration + parameters, like debug info generation, optimisation level, listing option, + target library, etc. +_ Copy any file in the current directory to makelog (i.e.: + cp initscript.sh makelog): this is intended to create the makelog file with + an ASCII CCSID! +_ Enter the command "sh makefile.sh > makelog 2>&1' +_ Examine the makelog file to check for compilation errors. + + Leaving file initscript.sh unchanged, this will produce the following OS/400 +objects: +_ Library CURL. All other objects will be stored in this library. +_ Modules for all libcurl units. +_ Binding directory CURL_A, to be used at calling program link time for + statically binding the modules (specify BNDSRVPGM(QADRTTS QGLDCLNT QGLDBRDR) + when creating a program using CURL_A). +_ Service program CURL., where is extracted from the + lib/Makefile.am VERSION variable. To be used at calling program run-time + when this program has dynamically bound curl at link time. +_ Binding directory CURL. To be used to dynamically bind libcurl when linking a + calling program. +_ Source file H. It contains all the include members needed to compile a C/C++ + module using libcurl, and an ILE/RPG /copy member for support in this + language. +_ Standard C/C++ libcurl include members in file H. +_ CCSIDCURL member in file H. This defines the non-standard EBCDIC wrappers for + C and C++. +_ CURL.INC member in file H. This defines everything needed by an ILE/RPG + program using libcurl. +_ LIBxxx modules and programs. Although the test environment is not supported + on OS/400, the libcurl test programs are compiled for manual tests. + + + +Special programming consideration: + +QADRT being used, the following points must be considered: +_ If static binding is used, service program QADRTTS must be linked too. +_ The EBCDIC CCSID used by QADRT is 37 by default, NOT THE JOB'S CCSID. If + another EBCDIC CCSID is required, it must be set via a locale through a call + to setlocale_a (QADRT's setlocale() ASCII wrapper) with category LC_ALL or + LC_CTYPE, or by setting environment variable QADRT_ENV_LOCALE to the locale + object path before executing the program. +_ Do not use original source include files unless you know what you are doing. + Use the installed members instead (in /QSYS.LIB/CURL.LIB/H.FILE). + + + +ILE/RPG support: + + Since 95% of the OS/400 programmers use ILE/RPG exclusively, a definition + /COPY member is provided for this language. To include all libcurl + definitions in an ILE/RPG module, line + + h bnddir('CURL/CURL') + +must figure in the program header, and line + + d/copy curl/h,curl.inc + +in the global data section of the module's source code. + + No vararg procedure support exists in ILE/RPG: for this reason, the following +considerations apply: +_ Procedures curl_easy_setopt_long(), curl_easy_setopt_object(), + curl_easy_setopt_function() and curl_easy_setopt_offset() are all alias + prototypes to curl_easy_setopt(), but with different parameter lists. +_ Procedures curl_easy_getinfo_string(), curl_easy_getinfo_long(), + curl_easy_getinfo_double() and curl_easy_getinfo_slist() are all alias + prototypes to curl_easy_getinfo(), but with different parameter lists. +_ Procedures curl_multi_setopt_long(), curl_multi_setopt_object(), + curl_multi_setopt_function() and curl_multi_setopt_offset() are all alias + prototypes to curl_multi_setopt(), but with different parameter lists. +_ The prototype of procedure curl_formadd() allows specifying a pointer option + and the CURLFORM_END option. This makes possible to use an option array + without any additional definition. If some specific incompatible argument + list is used in the ILE/RPG program, the latter must define a specialised + alias. The same applies to curl_formadd_ccsid() too. + + Since RPG cannot cast a long to a pointer, procedure curl_form_long_value() +is provided for that purpose: this allows storing a long value in the curl_forms +array. diff --git a/mobicore/common/curl/packages/OS400/ccsidcurl.c b/mobicore/common/curl/packages/OS400/ccsidcurl.c new file mode 100644 index 0000000000000000000000000000000000000000..ad67e1c87b80bdd61315e940f2edb16a97b25565 --- /dev/null +++ b/mobicore/common/curl/packages/OS400/ccsidcurl.c @@ -0,0 +1,1186 @@ +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) 1998 - 2010, Daniel Stenberg, , et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at http://curl.haxx.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + * + ***************************************************************************/ + +/* CCSID API wrappers for OS/400. */ + +#include +#include +#include +#include +#include + +#pragma enum(int) + +#include "curl.h" +#include "mprintf.h" +#include "urldata.h" +#include "url.h" +#include "getinfo.h" +#include "ccsidcurl.h" + +#include "os400sys.h" + +#ifndef SIZE_MAX +#define SIZE_MAX ((size_t) ~0) /* Is unsigned on OS/400. */ +#endif + + +#define ASCII_CCSID 819 /* Use ISO-8859-1 as ASCII. */ +#define NOCONV_CCSID 65535 /* No conversion. */ +#define ICONV_ID_SIZE 32 /* Size of iconv_open() code identifier. */ +#define ICONV_OPEN_ERROR(t) ((t).return_value == -1) + +#define ALLOC_GRANULE 8 /* Alloc. granule for curl_formadd_ccsid(). */ + + +static void +makeOS400IconvCode(char buf[ICONV_ID_SIZE], unsigned int ccsid) + +{ + /** + *** Convert a CCSID to the corresponding IBM iconv_open() character + *** code identifier. + *** This code is specific to the OS400 implementation of the iconv library. + *** CCSID 65535 (no conversion) is replaced by the ASCII CCSID. + *** CCSID 0 is interpreted by the OS400 as the job's CCSID. + **/ + + ccsid &= 0xFFFF; + + if (ccsid == NOCONV_CCSID) + ccsid = ASCII_CCSID; + + memset(buf, 0, ICONV_ID_SIZE); + curl_msprintf(buf, "IBMCCSID%05u0000000", ccsid); +} + + +static iconv_t +iconv_open_CCSID(unsigned int ccsidout, unsigned int ccsidin, unsigned int cstr) + +{ + char fromcode[ICONV_ID_SIZE]; + char tocode[ICONV_ID_SIZE]; + + /** + *** Like iconv_open(), but character codes are given as CCSIDs. + *** If `cstr' is non-zero, conversion is set up to stop whenever a + *** null character is encountered. + *** See iconv_open() IBM description in "National Language Support API". + **/ + + makeOS400IconvCode(fromcode, ccsidin); + makeOS400IconvCode(tocode, ccsidout); + memset(tocode + 13, 0, sizeof tocode - 13); /* Dest. code id format. */ + + if (cstr) + fromcode[18] = '1'; /* Set null-terminator flag. */ + + return iconv_open(tocode, fromcode); +} + + +static int +convert(char * d, size_t dlen, int dccsid, + const char * s, int slen, int sccsid) + +{ + int i; + iconv_t cd; + size_t lslen; + + /** + *** Convert `sccsid'-coded `slen'-data bytes at `s' into `dccsid'-coded + *** data stored in the `dlen'-byte buffer at `d'. + *** If `slen' < 0, source string is null-terminated. + *** CCSID 65535 (no conversion) is replaced by the ASCII CCSID. + *** Return the converted destination byte count, or -1 if error. + **/ + + if (sccsid == 65535) + sccsid = ASCII_CCSID; + + if (dccsid == 65535) + dccsid = ASCII_CCSID; + + if (sccsid == dccsid) { + lslen = slen >= 0? slen: strlen(s) + 1; + i = lslen < dlen? lslen: dlen; + + if (s != d && i > 0) + memcpy(d, s, i); + + return i; + } + + if (slen < 0) { + lslen = 0; + cd = iconv_open_CCSID(dccsid, sccsid, 1); + } + else { + lslen = (size_t) slen; + cd = iconv_open_CCSID(dccsid, sccsid, 0); + } + + if (ICONV_OPEN_ERROR(cd)) + return -1; + + i = dlen; + + if ((int) iconv(cd, (char * *) &s, &lslen, &d, &dlen) < 0) + i = -1; + else + i -= dlen; + + iconv_close(cd); + return i; +} + + +static char * +dynconvert(int dccsid, const char * s, int slen, int sccsid) + +{ + char * d; + char * cp; + size_t dlen; + int l; + int l2; + static const char nullbyte = 0; + + /* Like convert, but the destination is allocated and returned. */ + + dlen = (size_t) (slen < 0? strlen(s): slen) + 1; + dlen *= MAX_CONV_EXPANSION; /* Allow some expansion. */ + d = malloc(dlen); + + if (!d) + return (char *) NULL; + + l = convert(d, dlen, dccsid, s, slen, sccsid); + + if (l < 0) { + free(d); + return (char *) NULL; + } + + if (slen < 0) { + /* Need to null-terminate even when source length is given. + Since destination code size is unknown, use a conversion to generate + terminator. */ + + l2 = convert(d + l, dlen - l, dccsid, &nullbyte, -1, ASCII_CCSID); + + if (l2 < 0) { + free(d); + return (char *) NULL; + } + + l += l2; + } + + if ((size_t) l < dlen) { + cp = realloc(d, l); /* Shorten to minimum needed. */ + + if (cp) + d = cp; + } + + return d; +} + + +char * +curl_version_ccsid(unsigned int ccsid) + +{ + int i; + char * aversion; + char * eversion; + + aversion = curl_version(); + + if (!aversion) + return aversion; + + i = strlen(aversion) + 1; + i *= MAX_CONV_EXPANSION; + + if (!(eversion = Curl_thread_buffer(LK_CURL_VERSION, i))) + return (char *) NULL; + + if (convert(eversion, i, ccsid, aversion, -1, ASCII_CCSID) < 0) + return (char *) NULL; + + return eversion; +} + + +char * +curl_easy_escape_ccsid(CURL * handle, const char * string, int length, + unsigned int sccsid, unsigned int dccsid) + +{ + char * s; + char * d; + + if (!string) { + errno = EINVAL; + return (char *) NULL; + } + + s = dynconvert(ASCII_CCSID, s, length? length: -1, sccsid); + + if (!s) + return (char *) NULL; + + d = curl_easy_escape(handle, s, 0); + free(s); + + if (!d) + return (char *) NULL; + + s = dynconvert(dccsid, d, -1, ASCII_CCSID); + free(d); + return s; +} + + +char * +curl_easy_unescape_ccsid(CURL * handle, const char * string, int length, + int * outlength, + unsigned int sccsid, unsigned int dccsid) + +{ + char * s; + char * d; + + if (!string) { + errno = EINVAL; + return (char *) NULL; + } + + s = dynconvert(ASCII_CCSID, s, length? length: -1, sccsid); + + if (!s) + return (char *) NULL; + + d = curl_easy_unescape(handle, s, 0, outlength); + free(s); + + if (!d) + return (char *) NULL; + + s = dynconvert(dccsid, d, -1, ASCII_CCSID); + free(d); + + if (s && outlength) + *outlength = strlen(s); + + return s; +} + + +struct curl_slist * +curl_slist_append_ccsid(struct curl_slist * list, + const char * data, unsigned int ccsid) + +{ + char * s; + + s = (char *) NULL; + + if (!data) + return curl_slist_append(list, data); + + s = dynconvert(ASCII_CCSID, data, -1, ccsid); + + if (!s) + return (struct curl_slist *) NULL; + + list = curl_slist_append(list, s); + free(s); + return list; +} + + +time_t +curl_getdate_ccsid(const char * p, const time_t * unused, unsigned int ccsid) + +{ + char * s; + time_t t; + + if (!p) + return curl_getdate(p, unused); + + s = dynconvert(ASCII_CCSID, p, -1, ccsid); + + if (!s) + return (time_t) -1; + + t = curl_getdate(s, unused); + free(s); + return t; +} + + +static int +convert_version_info_string(const char * * stringp, + char * * bufp, int * left, unsigned int ccsid) + +{ + int l; + + /* Helper for curl_version_info_ccsid(): convert a string if defined. + Result is stored in the `*left'-byte buffer at `*bufp'. + `*bufp' and `*left' are updated accordingly. + Return 0 if ok, else -1. */ + + if (*stringp) { + l = convert(*bufp, *left, ccsid, *stringp, -1, ASCII_CCSID); + + if (l <= 0) + return -1; + + *stringp = *bufp; + *bufp += l; + *left -= l; + } + + return 0; +} + + +curl_version_info_data * +curl_version_info_ccsid(CURLversion stamp, unsigned int ccsid) + +{ + curl_version_info_data * p; + char * cp; + int n; + int nproto; + int i; + curl_version_info_data * id; + + /* The assertion below is possible, because although the second operand + is an enum member, the first is a #define. In that case, the OS/400 C + compiler seems to compare string values after substitution. */ + +#if CURLVERSION_NOW != CURLVERSION_FOURTH +#error curl_version_info_data structure has changed: upgrade this procedure too. +#endif + + /* If caller has been compiled with a new version, error. */ + + if (stamp > CURLVERSION_NOW) + return (curl_version_info_data *) NULL; + + p = curl_version_info(stamp); + + if (!p) + return p; + + /* Measure thread space needed. */ + + n = 0; + nproto = 0; + + if (p->protocols) { + while (p->protocols[nproto]) + n += strlen(p->protocols[nproto++]); + + n += nproto++; + } + + if (p->version) + n += strlen(p->version) + 1; + + if (p->host) + n += strlen(p->host) + 1; + + if (p->ssl_version) + n += strlen(p->ssl_version) + 1; + + if (p->libz_version) + n += strlen(p->libz_version) + 1; + + if (p->ares) + n += strlen(p->ares) + 1; + + if (p->libidn) + n += strlen(p->libidn) + 1; + + if (p->libssh_version) + n += strlen(p->libssh_version) + 1; + + /* Allocate thread space. */ + + n *= MAX_CONV_EXPANSION; + + if (nproto) + n += nproto * sizeof(const char *); + + cp = Curl_thread_buffer(LK_VERSION_INFO_DATA, n); + id = (curl_version_info_data *) Curl_thread_buffer(LK_VERSION_INFO, + sizeof *id); + + if (!id || !cp) + return (curl_version_info_data *) NULL; + + /* Copy data and convert strings. */ + + memcpy((char *) id, (char *) p, sizeof *p); + + if (id->protocols) { + id->protocols = (const char * const *) cp; + i = nproto * sizeof id->protocols[0]; + memcpy(cp, (char *) p->protocols, i); + cp += i; + n -= i; + + for (i = 0; id->protocols[i]; i++) + if (convert_version_info_string(((const char * *) id->protocols) + i, + &cp, &n, ccsid)) + return (curl_version_info_data *) NULL; + } + + if (convert_version_info_string(&id->version, &cp, &n, ccsid)) + return (curl_version_info_data *) NULL; + + if (convert_version_info_string(&id->host, &cp, &n, ccsid)) + return (curl_version_info_data *) NULL; + + if (convert_version_info_string(&id->ssl_version, &cp, &n, ccsid)) + return (curl_version_info_data *) NULL; + + if (convert_version_info_string(&id->libz_version, &cp, &n, ccsid)) + return (curl_version_info_data *) NULL; + + if (convert_version_info_string(&id->ares, &cp, &n, ccsid)) + return (curl_version_info_data *) NULL; + + if (convert_version_info_string(&id->libidn, &cp, &n, ccsid)) + return (curl_version_info_data *) NULL; + + if (convert_version_info_string(&id->libssh_version, &cp, &n, ccsid)) + return (curl_version_info_data *) NULL; + + return id; +} + + +const char * +curl_easy_strerror_ccsid(CURLcode error, unsigned int ccsid) + +{ + int i; + const char * s; + char * buf; + + s = curl_easy_strerror(error); + + if (!s) + return s; + + i = MAX_CONV_EXPANSION * (strlen(s) + 1); + + if (!(buf = Curl_thread_buffer(LK_EASY_STRERROR, i))) + return (const char *) NULL; + + if (convert(buf, i, ccsid, s, -1, ASCII_CCSID) < 0) + return (const char *) NULL; + + return (const char *) buf; +} + + +const char * +curl_share_strerror_ccsid(CURLSHcode error, unsigned int ccsid) + +{ + int i; + const char * s; + char * buf; + + s = curl_share_strerror(error); + + if (!s) + return s; + + i = MAX_CONV_EXPANSION * (strlen(s) + 1); + + if (!(buf = Curl_thread_buffer(LK_SHARE_STRERROR, i))) + return (const char *) NULL; + + if (convert(buf, i, ccsid, s, -1, ASCII_CCSID) < 0) + return (const char *) NULL; + + return (const char *) buf; +} + + +const char * +curl_multi_strerror_ccsid(CURLMcode error, unsigned int ccsid) + +{ + int i; + const char * s; + char * buf; + + s = curl_multi_strerror(error); + + if (!s) + return s; + + i = MAX_CONV_EXPANSION * (strlen(s) + 1); + + if (!(buf = Curl_thread_buffer(LK_MULTI_STRERROR, i))) + return (const char *) NULL; + + if (convert(buf, i, ccsid, s, -1, ASCII_CCSID) < 0) + return (const char *) NULL; + + return (const char *) buf; +} + + +CURLcode +curl_easy_getinfo_ccsid(CURL * curl, CURLINFO info, ...) + +{ + va_list arg; + void * paramp; + CURLcode ret; + unsigned int ccsid; + char * * cpp; + char * s; + char * d; + struct SessionHandle * data; + + /* WARNING: unlike curl_easy_get_info(), the strings returned by this + procedure have to be free'ed. */ + + data = (struct SessionHandle *) curl; + va_start(arg, info); + paramp = va_arg(arg, void *); + ret = Curl_getinfo(data, info, paramp); + + if (ret != CURLE_OK || ((int) info & CURLINFO_TYPEMASK) != CURLINFO_STRING) { + va_end(arg); + return ret; + } + + ccsid = va_arg(arg, unsigned int); + va_end(arg); + cpp = (char * *) paramp; + s = *cpp; + + if (!s) + return ret; + + d = dynconvert(ccsid, s, -1, ASCII_CCSID); + *cpp = d; + + if (!d) + return CURLE_OUT_OF_MEMORY; + + return ret; +} + + +static int +Curl_is_formadd_string(CURLformoption option) + +{ + switch (option) { + + case CURLFORM_FILENAME: + case CURLFORM_CONTENTTYPE: + case CURLFORM_BUFFER: + case CURLFORM_FILE: + case CURLFORM_FILECONTENT: + case CURLFORM_COPYCONTENTS: + case CURLFORM_COPYNAME: + return 1; + } + + return 0; +} + + +static void +Curl_formadd_release_local(struct curl_forms * forms, int nargs, int skip) + +{ + while (nargs--) + if (nargs != skip) + if (Curl_is_formadd_string(forms[nargs].option)) + if (forms[nargs].value) + free((char *) forms[nargs].value); + + free((char *) forms); +} + + +static int +Curl_formadd_convert(struct curl_forms * forms, + int formx, int lengthx, unsigned int ccsid) + +{ + int l; + char * cp; + char * cp2; + + if (formx < 0 || !forms[formx].value) + return 0; + + if (lengthx >= 0) + l = (int) forms[lengthx].value; + else + l = strlen(forms[formx].value) + 1; + + cp = malloc(MAX_CONV_EXPANSION * l); + + if (!cp) + return -1; + + l = convert(cp, MAX_CONV_EXPANSION * l, ASCII_CCSID, + forms[formx].value, l, ccsid); + + if (l < 0) { + free(cp); + return -1; + } + + cp2 = realloc(cp, l); /* Shorten buffer to the string size. */ + + if (cp2) + cp = cp2; + + forms[formx].value = cp; + + if (lengthx >= 0) + forms[lengthx].value = (char *) l; /* Update to length after conversion. */ + + return l; +} + + +CURLFORMcode +curl_formadd_ccsid(struct curl_httppost * * httppost, + struct curl_httppost * * last_post, ...) + +{ + va_list arg; + CURLformoption option; + CURLFORMcode result; + struct curl_forms * forms; + struct curl_forms * lforms; + struct curl_forms * tforms; + unsigned int lformlen; + const char * value; + unsigned int ccsid; + int nargs; + int namex; + int namelengthx; + int contentx; + int lengthx; + unsigned int contentccsid; + unsigned int nameccsid; + + /* A single curl_formadd() call cannot be splitted in several calls to deal + with all parameters: the original parameters are thus copied to a local + curl_forms array and converted to ASCII when needed. + CURLFORM_PTRNAME is processed as if it were CURLFORM_COPYNAME. + CURLFORM_COPYNAME and CURLFORM_NAMELENGTH occurrence order in + parameters is not defined; for this reason, the actual conversion is + delayed to the end of parameter processing. The same applies to + CURLFORM_COPYCONTENTS/CURLFORM_CONTENTSLENGTH, but these may appear + several times in the parameter list; the problem resides here in knowing + which CURLFORM_CONTENTSLENGTH applies to which CURLFORM_COPYCONTENTS and + when we can be sure to have both info for conversion: end of parameter + list is such a point, but CURLFORM_CONTENTTYPE is also used here as a + natural separator between content data definitions; this seems to be + in accordance with FormAdd() behavior. */ + + /* Allocate the local curl_forms array. */ + + lformlen = ALLOC_GRANULE; + lforms = malloc(lformlen * sizeof *lforms); + + if (!lforms) + return CURL_FORMADD_MEMORY; + + /* Process the arguments, copying them into local array, latching conversion + indexes and converting when needed. */ + + result = CURL_FORMADD_OK; + nargs = 0; + contentx = -1; + lengthx = -1; + namex = -1; + namelengthx = -1; + forms = (struct curl_forms *) NULL; + va_start(arg, last_post); + + for (;;) { + /* Make sure there is still room for an item in local array. */ + + if (nargs >= lformlen) { + lformlen += ALLOC_GRANULE; + tforms = realloc(lforms, lformlen * sizeof *lforms); + + if (!tforms) { + result = CURL_FORMADD_MEMORY; + break; + } + + lforms = tforms; + } + + /* Get next option. */ + + if (forms) { + /* Get option from array. */ + + option = forms->option; + value = forms->value; + forms++; + } + else { + /* Get option from arguments. */ + + option = va_arg(arg, CURLformoption); + + if (option == CURLFORM_END) + break; + } + + /* Dispatch by option. */ + + switch (option) { + + case CURLFORM_END: + forms = (struct curl_forms *) NULL; /* Leave array mode. */ + continue; + + case CURLFORM_ARRAY: + if (!forms) { + forms = va_arg(arg, struct curl_forms *); + continue; + } + + result = CURL_FORMADD_ILLEGAL_ARRAY; + break; + + case CURLFORM_COPYNAME: + option = CURLFORM_PTRNAME; /* Static for now. */ + + case CURLFORM_PTRNAME: + if (namex >= 0) + result = CURL_FORMADD_OPTION_TWICE; + + namex = nargs; + + if (!forms) { + value = va_arg(arg, char *); + nameccsid = (unsigned int) va_arg(arg, long); + } + else { + nameccsid = (unsigned int) forms->value; + forms++; + } + + break; + + case CURLFORM_COPYCONTENTS: + if (contentx >= 0) + result = CURL_FORMADD_OPTION_TWICE; + + contentx = nargs; + + if (!forms) { + value = va_arg(arg, char *); + contentccsid = (unsigned int) va_arg(arg, long); + } + else { + contentccsid = (unsigned int) forms->value; + forms++; + } + + break; + + case CURLFORM_PTRCONTENTS: + case CURLFORM_BUFFERPTR: + if (!forms) + value = va_arg(arg, char *); /* No conversion. */ + + break; + + case CURLFORM_CONTENTSLENGTH: + lengthx = nargs; + + if (!forms) + value = (char *) va_arg(arg, long); + + break; + + case CURLFORM_NAMELENGTH: + namelengthx = nargs; + + if (!forms) + value = (char *) va_arg(arg, long); + + break; + + case CURLFORM_BUFFERLENGTH: + if (!forms) + value = (char *) va_arg(arg, long); + + break; + + case CURLFORM_CONTENTHEADER: + if (!forms) + value = (char *) va_arg(arg, struct curl_slist *); + + break; + + case CURLFORM_STREAM: + if (!forms) + value = (char *) va_arg(arg, void *); + + break; + + case CURLFORM_CONTENTTYPE: + /* If a previous content has been encountered, convert it now. */ + + if (Curl_formadd_convert(lforms, contentx, lengthx, contentccsid) < 0) { + result = CURL_FORMADD_MEMORY; + break; + } + + contentx = -1; + lengthx = -1; + /* Fall into default. */ + + default: + /* Must be a convertible string. */ + + if (!Curl_is_formadd_string(option)) { + result = CURL_FORMADD_UNKNOWN_OPTION; + break; + } + + if (!forms) { + value = va_arg(arg, char *); + ccsid = (unsigned int) va_arg(arg, long); + } + else { + ccsid = (unsigned int) forms->value; + forms++; + } + + /* Do the conversion. */ + + lforms[nargs].value = value; + + if (Curl_formadd_convert(lforms, nargs, -1, ccsid) < 0) { + result = CURL_FORMADD_MEMORY; + break; + } + + value = lforms[nargs].value; + } + + if (result != CURL_FORMADD_OK) + break; + + lforms[nargs].value = value; + lforms[nargs++].option = option; + } + + va_end(arg); + + /* Convert the name and the last content, now that we know their lengths. */ + + if (result == CURL_FORMADD_OK && namex >= 0) { + if (Curl_formadd_convert(lforms, namex, namelengthx, nameccsid) < 0) + result = CURL_FORMADD_MEMORY; + else + lforms[namex].option = CURLFORM_COPYNAME; /* Force copy. */ + } + + if (result == CURL_FORMADD_OK) { + if (Curl_formadd_convert(lforms, contentx, lengthx, contentccsid) < 0) + result = CURL_FORMADD_MEMORY; + else + contentx = -1; + } + + /* Do the formadd with our converted parameters. */ + + if (result == CURL_FORMADD_OK) { + lforms[nargs].option = CURLFORM_END; + result = curl_formadd(httppost, last_post, + CURLFORM_ARRAY, lforms, CURLFORM_END); + } + + /* Terminate. */ + + Curl_formadd_release_local(lforms, nargs, contentx); + return result; +} + + +typedef struct { + curl_formget_callback append; + void * arg; + unsigned int ccsid; +} cfcdata; + + +static size_t +Curl_formget_callback_ccsid(void * arg, const char * buf, size_t len) + +{ + cfcdata * p; + char * b; + int l; + size_t ret; + + p = (cfcdata *) arg; + + if ((long) len <= 0) + return (*p->append)(p->arg, buf, len); + + b = malloc(MAX_CONV_EXPANSION * len); + + if (!b) + return (size_t) -1; + + l = convert(b, MAX_CONV_EXPANSION * len, p->ccsid, buf, len, ASCII_CCSID); + + if (l < 0) { + free(b); + return (size_t) -1; + } + + ret = (*p->append)(p->arg, b, l); + free(b); + return ret == l? len: -1; +} + + +int +curl_formget_ccsid(struct curl_httppost * form, void * arg, + curl_formget_callback append, unsigned int ccsid) + +{ + cfcdata lcfc; + + lcfc.append = append; + lcfc.arg = arg; + lcfc.ccsid = ccsid; + return curl_formget(form, (void *) &lcfc, Curl_formget_callback_ccsid); +} + + +CURLcode +curl_easy_setopt_ccsid(CURL * curl, CURLoption tag, ...) + +{ + CURLcode result; + va_list arg; + struct SessionHandle * data; + char * s; + char * cp; + unsigned int ccsid; + size_t len; + curl_off_t pfsize; + static char testwarn = 1; + + /* Warns if this procedure has not been updated when the dupstring enum + changes. + We (try to) do it only once: there is no need to issue several times + the same message; but since threadsafeness is not handled here, + this may occur (and we don't care!). */ + + if (testwarn) { + testwarn = 0; + + if ((int) STRING_LAST != (int) STRING_MAIL_FROM + 1) + curl_mfprintf(stderr, + "*** WARNING: curl_easy_setopt_ccsid() should be reworked ***\n"); + } + + data = (struct SessionHandle *) curl; + va_start(arg, tag); + + switch (tag) { + + case CURLOPT_CAINFO: + case CURLOPT_CAPATH: + case CURLOPT_COOKIE: + case CURLOPT_COOKIEFILE: + case CURLOPT_COOKIEJAR: + case CURLOPT_COOKIELIST: + case CURLOPT_CUSTOMREQUEST: + case CURLOPT_EGDSOCKET: + case CURLOPT_ENCODING: + case CURLOPT_FTPPORT: + case CURLOPT_FTP_ACCOUNT: + case CURLOPT_FTP_ALTERNATIVE_TO_USER: + case CURLOPT_INTERFACE: + case CURLOPT_KEYPASSWD: + case CURLOPT_KRBLEVEL: + case CURLOPT_NETRC_FILE: + case CURLOPT_PROXY: + case CURLOPT_PROXYUSERPWD: + case CURLOPT_RANDOM_FILE: + case CURLOPT_RANGE: + case CURLOPT_REFERER: + case CURLOPT_SSH_PRIVATE_KEYFILE: + case CURLOPT_SSH_PUBLIC_KEYFILE: + case CURLOPT_SSLCERT: + case CURLOPT_SSLCERTTYPE: + case CURLOPT_SSLENGINE: + case CURLOPT_SSLKEY: + case CURLOPT_SSLKEYTYPE: + case CURLOPT_SSL_CIPHER_LIST: + case CURLOPT_URL: + case CURLOPT_USERAGENT: + case CURLOPT_USERPWD: + case CURLOPT_SSH_HOST_PUBLIC_KEY_MD5: + case CURLOPT_CRLFILE: + case CURLOPT_ISSUERCERT: + case CURLOPT_USERNAME: + case CURLOPT_PASSWORD: + case CURLOPT_PROXYUSERNAME: + case CURLOPT_PROXYPASSWORD: + case CURLOPT_NOPROXY: + case CURLOPT_RTSP_SESSION_ID: + case CURLOPT_RTSP_STREAM_URI: + case CURLOPT_RTSP_TRANSPORT: + /* SSH2 not (yet) implemented on OS400. */ + /* case CURLOPT_SSH_KNOWNHOSTS: */ + case CURLOPT_SOCKS5_GSSAPI_SERVICE: + case CURLOPT_MAIL_FROM: + s = va_arg(arg, char *); + ccsid = va_arg(arg, unsigned int); + + if (s) { + s = dynconvert(ASCII_CCSID, s, -1, ccsid); + + if (!s) { + result = CURLE_OUT_OF_MEMORY; + break; + } + } + + result = curl_easy_setopt(curl, tag, s); + + if (s) + free(s); + + break; + + case CURLOPT_COPYPOSTFIELDS: + /* Special case: byte count may have been given by CURLOPT_POSTFIELDSIZE + prior to this call. In this case, convert the given byte count and + replace the length according to the conversion result. */ + s = va_arg(arg, char *); + ccsid = va_arg(arg, unsigned int); + + pfsize = data->set.postfieldsize; + + if (!s || !pfsize || ccsid == NOCONV_CCSID || ccsid == ASCII_CCSID) { + result = curl_easy_setopt(curl, CURLOPT_COPYPOSTFIELDS, s); + break; + } + + if (pfsize == -1) { + /* Data is null-terminated. */ + s = dynconvert(ASCII_CCSID, s, -1, ccsid); + + if (!s) { + result = CURLE_OUT_OF_MEMORY; + break; + } + } + else { + /* Data length specified. */ + + if (pfsize < 0 || pfsize > SIZE_MAX) { + result = CURLE_OUT_OF_MEMORY; + break; + } + + len = pfsize; + pfsize = len * MAX_CONV_EXPANSION; + + if (pfsize > SIZE_MAX) + pfsize = SIZE_MAX; + + cp = malloc(pfsize); + + if (!cp) { + result = CURLE_OUT_OF_MEMORY; + break; + } + + pfsize = convert(cp, pfsize, ASCII_CCSID, s, len, ccsid); + + if (pfsize < 0) { + free(cp); + result = CURLE_OUT_OF_MEMORY; + break; + } + + data->set.postfieldsize = pfsize; /* Replace data size. */ + s = cp; + } + + result = curl_easy_setopt(curl, CURLOPT_POSTFIELDS, s); + data->set.str[STRING_COPYPOSTFIELDS] = s; /* Give to library. */ + break; + + case CURLOPT_ERRORBUFFER: /* This is an output buffer. */ + default: + result = Curl_setopt(data, tag, arg); + break; + } + + va_end(arg); + return result; +} + + +char * +curl_form_long_value(long value) + +{ + /* ILE/RPG cannot cast an integer to a pointer. This procedure does it. */ + + return (char *) value; +} diff --git a/mobicore/common/curl/packages/OS400/ccsidcurl.h b/mobicore/common/curl/packages/OS400/ccsidcurl.h new file mode 100644 index 0000000000000000000000000000000000000000..96340c92192541538753b3bdc8c6fdb53429ab1d --- /dev/null +++ b/mobicore/common/curl/packages/OS400/ccsidcurl.h @@ -0,0 +1,64 @@ +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) 1998 - 2008, Daniel Stenberg, , et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at http://curl.haxx.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + * + ***************************************************************************/ + +#ifndef __CURL_CCSIDCURL_H +#define __CURL_CCSIDCURL_H + +#include "curl.h" +#include "easy.h" +#include "multi.h" + + +CURL_EXTERN char * curl_version_ccsid(unsigned int ccsid); +CURL_EXTERN char * curl_easy_escape_ccsid(CURL * handle, + const char * string, int length, + unsigned int sccsid, + unsigned int dccsid); +CURL_EXTERN char * curl_easy_unescape_ccsid(CURL * handle, const char * string, + int length, int * outlength, + unsigned int sccsid, + unsigned int dccsid); +CURL_EXTERN struct curl_slist * curl_slist_append_ccsid(struct curl_slist * lst, + const char * data, + unsigned int ccsid); +CURL_EXTERN time_t curl_getdate_ccsid(const char * p, const time_t * unused, + unsigned int ccsid); +CURL_EXTERN curl_version_info_data * curl_version_info_ccsid(CURLversion stamp, + unsigned int csid); +CURL_EXTERN const char * curl_easy_strerror_ccsid(CURLcode error, + unsigned int ccsid); +CURL_EXTERN const char * curl_share_strerror_ccsid(CURLSHcode error, + unsigned int ccsid); +CURL_EXTERN const char * curl_multi_strerror_ccsid(CURLMcode error, + unsigned int ccsid); +CURL_EXTERN CURLcode curl_easy_getinfo_ccsid(CURL * curl, CURLINFO info, ...); +CURL_EXTERN CURLFORMcode curl_formadd_ccsid(struct curl_httppost * * httppost, + struct curl_httppost * * last_post, + ...); +CURL_EXTERN char * curl_form_long_value(long value); +CURL_EXTERN int curl_formget_ccsid(struct curl_httppost * form, void * arg, + curl_formget_callback append, + unsigned int ccsid); +CURL_EXTERN CURLcode curl_easy_setopt_ccsid(CURL * curl, CURLoption tag, ...); + +#endif diff --git a/mobicore/common/curl/packages/OS400/curl.inc.in b/mobicore/common/curl/packages/OS400/curl.inc.in new file mode 100644 index 0000000000000000000000000000000000000000..b5e46bb16e748033e6f59d313c6b7b95ab0f2ef9 --- /dev/null +++ b/mobicore/common/curl/packages/OS400/curl.inc.in @@ -0,0 +1,1966 @@ + ************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) 1998 - 2010, Daniel Stenberg, , et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at http://curl.haxx.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF + * ANY KIND, either express or implied. + * + * + ************************************************************************** + * + /if not defined(CURL_CURL_INC_) + /define CURL_CURL_INC_ + * + * WARNING: this file should be kept in sync with C include files. + * + ************************************************************************** + * Constants + ************************************************************************** + * + d LIBCURL_VERSION... + d c '@LIBCURL_VERSION@' + d LIBCURL_VERSION_MAJOR... + d c @LIBCURL_VERSION_MAJOR@ + d LIBCURL_VERSION_MINOR... + d c @LIBCURL_VERSION_MINOR@ + d LIBCURL_VERSION_PATCH... + d c @LIBCURL_VERSION_PATCH@ + d LIBCURL_VERSION_NUM... + d c X'00@LIBCURL_VERSION_NUM@' + d LIBCURL_TIMESTAMP... + d c '@LIBCURL_TIMESTAMP@' + * + d CURL_SOCKET_BAD... + d c -1 + d CURL_SOCKET_TIMEOUT... + d c -1 + * + /if not defined(CURL_MAX_WRITE_SIZE) + /define CURL_MAX_WRITE_SIZE + d CURL_MAX_WRITE_SIZE... + d c 16384 + /endif + * + /if not defined(CURL_MAX_HTTP_HEADER) + /define CURL_MAX_HTTP_HEADER + d CURL_MAX_HTTP_HEADER... + d c 102400 + /endif + * + d CURLINFO_STRING... + d c X'00100000' + d CURLINFO_LONG c X'00200000' + d CURLINFO_DOUBLE... + d c X'00300000' + d CURLINFO_SLIST c X'00400000' + d CURLINFO_MASK c X'000FFFFF' + d CURLINFO_TYPEMASK... + d c X'00F00000' + * + d CURL_GLOBAL_SSL... + d c X'00000001' + d CURL_GLOBAL_WIN32... + d c X'00000002' + d CURL_GLOBAL_ALL... + d c X'00000003' + d CURL_GLOBAL_NOTHING... + d c X'00000000' + d CURL_GLOBAL_DEFAULT... + d c X'00000003' + * + d CURL_VERSION_IPV6... + d c X'00000001' + d CURL_VERSION_KERBEROS4... + d c X'00000002' + d CURL_VERSION_SSL... + d c X'00000004' + d CURL_VERSION_LIBZ... + d c X'00000008' + d CURL_VERSION_NTLM... + d c X'00000010' + d CURL_VERSION_GSSNEGOTIATE... + d c X'00000020' + d CURL_VERSION_DEBUG... + d c X'00000040' + d CURL_VERSION_ASYNCHDNS... + d c X'00000080' + d CURL_VERSION_SPNEGO... + d c X'00000100' + d CURL_VERSION_LARGEFILE... + d c X'00000200' + d CURL_VERSION_IDN... + d c X'00000400' + d CURL_VERSION_SSPI... + d c X'00000800' + d CURL_VERSION_CONV... + d c X'00001000' + d CURL_VERSION_CURLDEBUG... + d c X'00002000' + * + d HTTPPOST_FILENAME... + d c X'00000001' + d HTTPPOST_READFILE... + d c X'00000002' + d HTTPPOST_PTRNAME... + d c X'00000004' + d HTTPPOST_PTRCONTENTS... + d c X'00000008' + d HTTPPOST_BUFFER... + d c X'00000010' + d HTTPPOST_PTRBUFFER... + d c X'00000020' + d HTTPPOST_CALLBACK... + d c X'00000040' + * + d CURL_SEEKFUNC_OK... + d c 0 + d CURL_SEEKFUNC_FAIL... + d c 1 + d CURL_SEEKFUNC_CANTSEEK... + d c 2 + * + d CURL_READFUNC_ABORT... + d c X'10000000' + d CURL_READFUNC_PAUSE... + d c X'10000001' + * + d CURL_WRITEFUNC_PAUSE... + d c X'10000001' + * + d CURLAUTH_NONE c X'00000000' + d CURLAUTH_BASIC c X'00000001' + d CURLAUTH_DIGEST... + d c X'00000002' + d CURLAUTH_GSSNEGOTIATE... + d c X'00000004' + d CURLAUTH_NTLM c X'00000008' + d CURLAUTH_DIGEST_IE... + d c X'00000010' + d CURLAUTH_ANY c X'7FFFFFEF' + d CURLAUTH_ANYSAFE... + d c X'7FFFFFEE' + * + d CURLSSH_AUTH_ANY... + d c X'7FFFFFFF' + d CURLSSH_AUTH_NONE... + d c X'00000000' + d CURLSSH_AUTH_PUBLICKEY... + d c X'00000001' + d CURLSSH_AUTH_PASSWORD... + d c X'00000002' + d CURLSSH_AUTH_HOST... + d c X'00000004' + d CURLSSH_AUTH_KEYBOARD... + d c X'00000008' + d CURLSSH_AUTH_DEFAULT... + d c X'7FFFFFFF' CURLSSH_AUTH_ANY + * + d CURL_ERROR_SIZE... + d c 256 + * + d CURLOPTTYPE_LONG... + d c 0 + d CURLOPTTYPE_OBJECTPOINT... + d c 10000 + d CURLOPTTYPE_FUNCTIONPOINT... + d c 20000 + d CURLOPTTYPE_OFF_T... + d c 30000 + * + d CURL_IPRESOLVE_WHATEVER... + d c 0 + d CURL_IPRESOLVE_V4... + d c 1 + d CURL_IPRESOLVE_V6... + d c 2 + * + d CURL_HTTP_VERSION_NONE... + d c 0 + d CURL_HTTP_VERSION_1_0... + d c 1 + d CURL_HTTP_VERSION_1_1... + d c 2 + * + d CURL_NETRC_IGNORED... + d c 0 + d CURL_NETRC_OPTIONAL... + d c 1 + d CURL_NETRC_REQUIRED... + d c 2 + * + d CURL_SSLVERSION_DEFAULT... + d c 0 + d CURL_SSLVERSION_TLSv1... + d c 1 + d CURL_SSLVERSION_SSLv2... + d c 2 + d CURL_SSLVERSION_SSLv3... + d c 3 + * + d CURL_REDIR_GET_ALL... + d c 0 + d CURL_REDIR_POST_301... + d c 1 + d CURL_REDIR_POST_302... + d c 2 + d CURL_REDIR_POST_ALL... + d c 3 + * + d CURL_POLL_NONE c 0 + d CURL_POLL_IN c 1 + d CURL_POLL_OUT c 2 + d CURL_POLL_INOUT... + d c 3 + d CURL_POLL_REMOVE... + d c 4 + * + d CURL_CSELECT_IN... + d c X'00000001' + d CURL_CSELECT_OUT... + d c X'00000002' + d CURL_CSELECT_ERR... + d c X'00000004' + * + d CURLPAUSE_RECV c X'00000001' + d CURLPAUSE_RECV_CONT... + d c X'00000000' + d CURLPAUSE_SEND c X'00000004' + d CURLPAUSE_SEND_CONT... + d c X'00000000' + d CURLPAUSE_ALL c X'00000005' + d CURLPAUSE_CONT c X'00000000' + * + d CURLINFOFLAG_KNOWN_FILENAME... + d c X'00000001' + d CURLINFOFLAG_KNOWN_FILETYPE... + d c X'00000002' + d CURLINFOFLAG_KNOWN_TIME... + d c X'00000004' + d CURLINFOFLAG_KNOWN_PERM... + d c X'00000008' + d CURLINFOFLAG_KNOWN_UID... + d c X'00000010' + d CURLINFOFLAG_KNOWN_GID... + d c X'00000020' + d CURLINFOFLAG_KNOWN_SIZE... + d c X'00000040' + d CURLINFOFLAG_KNOWN_HLINKCOUNT... + d c X'00000080' + * + d CURL_CHUNK_BGN_FUNC_OK... + d c 0 + d CURL_CHUNK_BGN_FUNC_FAIL... + d c 1 + d CURL_CHUNK_BGN_FUNC_SKIP... + d c 2 + * + d CURL_CHUNK_END_FUNC_OK... + d c 0 + d CURL_CHUNK_END_FUNC_FAIL... + d c 1 + * + d CURL_FNMATCHFUNC_MATCH... + d c 0 + d CURL_FNMATCHFUNC_NOMATCH... + d c 1 + d CURL_FNMATCHFUNC_FAIL... + d c 2 + * + ************************************************************************** + * Types + ************************************************************************** + * + d curl_socket_t s 10i 0 based(######ptr######) + * + d curl_off_t s 20i 0 based(######ptr######) + * + d CURLcode s 10i 0 based(######ptr######) Enum + d CURLE_OK c 0 + d CURLE_UNSUPPORTED_PROTOCOL... + d c 1 + d CURLE_FAILED_INIT... + d c 2 + d CURLE_URL_MALFORMAT... + d c 3 + d CURLE_OBSOLETE4... + d c 4 + d CURLE_COULDNT_RESOLVE_PROXY... + d c 5 + d CURLE_COULDNT_RESOLVE_HOST... + d c 6 + d CURLE_COULDNT_CONNECT... + d c 7 + d CURLE_FTP_WEIRD_SERVER_REPLY... + d c 8 + d CURLE_REMOTE_ACCESS_DENIED... + d c 9 + d CURLE_OBSOLETE10... + d c 10 + d CURLE_FTP_WEIRD_PASS_REPLY... + d c 11 + d CURLE_OBSOLETE12... + d c 12 + d CURLE_FTP_WEIRD_PASV_REPLY... + d c 13 + d CURLE_FTP_WEIRD_227_FORMAT... + d c 14 + d CURLE_FTP_CANT_GET_HOST... + d c 15 + d CURLE_OBSOLETE16... + d c 16 + d CURLE_FTP_COULDNT_SET_TYPE... + d c 17 + d CURLE_PARTIAL_FILE... + d c 18 + d CURLE_FTP_COULDNT_RETR_FILE... + d c 19 + d CURLE_OBSOLETE20... + d c 20 + d CURLE_QUOTE_ERROR... + d c 21 + d CURLE_HTTP_RETURNED_ERROR... + d c 22 + d CURLE_WRITE_ERROR... + d c 23 + d CURLE_OBSOLETE24... + d c 24 + d CURLE_UPLOAD_FAILED... + d c 25 + d CURLE_READ_ERROR... + d c 26 + d CURLE_OUT_OF_MEMORY... + d c 27 + d CURLE_OPERATION_TIMEDOUT... + d c 28 + d CURLE_OBSOLETE29... + d c 29 + d CURLE_FTP_PORT_FAILED... + d c 30 + d CURLE_FTP_COULDNT_USE_REST... + d c 31 + d CURLE_OBSOLETE32... + d c 32 + d CURLE_RANGE_ERROR... + d c 33 + d CURLE_HTTP_POST_ERROR... + d c 34 + d CURLE_SSL_CONNECT_ERROR... + d c 35 + d CURLE_BAD_DOWNLOAD_RESUME... + d c 36 + d CURLE_FILE_COULDNT_READ_FILE... + d c 37 + d CURLE_LDAP_CANNOT_BIND... + d c 38 + d CURLE_LDAP_SEARCH_FAILED... + d c 39 + d CURLE_OBSOLETE40... + d c 40 + d CURLE_FUNCTION_NOT_FOUND... + d c 41 + d CURLE_ABORTED_BY_CALLBACK... + d c 42 + d CURLE_BAD_FUNCTION_ARGUMENT... + d c 43 + d CURLE_OBSOLETE44... + d c 44 + d CURLE_INTERFACE_FAILED... + d c 45 + d CURLE_OBSOLETE46... + d c 46 + d CURLE_TOO_MANY_REDIRECTS... + d c 47 + d CURLE_UNKNOWN_TELNET_OPTION... + d c 48 + d CURLE_TELNET_OPTION_SYNTAX... + d c 49 + d CURLE_OBSOLETE50... + d c 50 + d CURLE_PEER_FAILED_VERIFICATION... + d c 51 + d CURLE_GOT_NOTHING... + d c 52 + d CURLE_SSL_ENGINE_NOTFOUND... + d c 53 + d CURLE_SSL_ENGINE_SETFAILED... + d c 54 + d CURLE_SEND_ERROR... + d c 55 + d CURLE_RECV_ERROR... + d c 56 + d CURLE_OBSOLETE57... + d c 57 + d CURLE_SSL_CERTPROBLEM... + d c 58 + d CURLE_SSL_CIPHER... + d c 59 + d CURLE_SSL_CACERT... + d c 60 + d CURLE_BAD_CONTENT_ENCODING... + d c 61 + d CURLE_LDAP_INVALID_URL... + d c 62 + d CURLE_FILESIZE_EXCEEDED... + d c 63 + d CURLE_USE_SSL_FAILED... + d c 64 + d CURLE_SEND_FAIL_REWIND... + d c 65 + d CURLE_SSL_ENGINE_INITFAILED... + d c 66 + d CURLE_LOGIN_DENIED... + d c 67 + d CURLE_TFTP_NOTFOUND... + d c 68 + d CURLE_TFTP_PERM... + d c 69 + d CURLE_REMOTE_DISK_FULL... + d c 70 + d CURLE_TFTP_ILLEGAL... + d c 71 + d CURLE_TFTP_UNKNOWNID... + d c 72 + d CURLE_REMOTE_FILE_EXISTS... + d c 73 + d CURLE_TFTP_NOSUCHUSER... + d c 74 + d CURLE_CONV_FAILED... + d c 75 + d CURLE_CONV_REQD... + d c 76 + d CURLE_SSL_CACERT_BADFILE... + d c 77 + d CURLE_REMOTE_FILE_NOT_FOUND... + d c 78 + d CURLE_SSH... + d c 79 + d CURLE_SSL_SHUTDOWN_FAILED... + d c 80 + d CURLE_AGAIN... + d c 81 + d CURLE_SSL_CRL_BADFILE... + d c 82 + d CURLE_SSL_ISSUER_ERROR... + d c 83 + d CURLE_FTP_PRET_FAILED... + d c 84 + d CURLE_RTSP_CSEQ_ERROR... + d c 85 + d CURLE_RTSP_SESSION_ERROR... + d c 86 + d CURLE_FTP_BAD_FILE_LIST... + d c 87 + d CURLE_CHUNK_FAILED... + d c 88 + * + d curlioerr s 10i 0 based(######ptr######) Enum + d CURLIOE_OK c 0 + d CURLIOE_UNKNOWNCMD... + d c 1 + d CURLIOE_FAILRESTART... + d c 2 + * + d curlfiletype s 10i 0 based(######ptr######) Enum + d CURLFILETYPE_FILE... + d c 0 + d CURLFILETYPE_DIRECTORY... + d c 1 + d CURLFILETYPE_SYMLINK... + d c 2 + d CURLFILETYPE_DEVICE_BLOCK... + d c 3 + d CURLFILETYPE_DEVICE_CHAR... + d c 4 + d CURLFILETYPE_NAMEDPIPE... + d c 5 + d CURLFILETYPE_SOCKET... + d c 6 + d CURLFILETYPE_DOOR... + d c 7 + * + d curliocmd s 10i 0 based(######ptr######) Enum + d CURLIOCMD_NOP c 0 + d CURLIOCMD_RESTARTREAD... + d c 1 + * + d curl_infotype s 10i 0 based(######ptr######) Enum + d CURLINFO_TEXT... + d c 0 + d CURLINFO_HEADER_IN... + d c 1 + d CURLINFO_HEADER_OUT... + d c 2 + d CURLINFO_DATA_IN... + d c 3 + d CURLINFO_DATA_OUT... + d c 4 + d CURLINFO_SSL_DATA_IN... + d c 5 + d CURLINFO_SSL_DATA_OUT... + d c 6 + d CURLINFO_END... + d c 7 + * + d curl_proxytype s 10i 0 based(######ptr######) Enum + d CURLPROXY_HTTP... + d c 0 + d CURLPROXY_HTTP_1_0... + d c 1 + d CURLPROXY_SOCKS4... + d c 4 + d CURLPROXY_SOCKS5... + d c 5 + d CURLPROXY_SOCKS4A... + d c 6 + d CURLPROXY_SOCKS5_HOSTNAME... + d c 7 + * + d curl_khstat s 10i 0 based(######ptr######) Enum + d CURLKHSTAT_FINE_ADD_TO_FILE... + d c 0 + d CURLKHSTAT_FINE... + d c 1 + d CURLKHSTAT_REJECT... + d c 2 + d CURLKHSTAT_DEFER... + d c 3 + d CURLKHSTAT_LAST... + d c 4 + * + d curl_khmatch s 10i 0 based(######ptr######) Enum + d CURLKHMATCH_OK... + d c 0 + d CURLKHMATCH_MISMATCH... + d c 1 + d CURLKHMATCH_MISSING... + d c 2 + d CURLKHMATCH_LAST... + d c 3 + * + d curl_usessl s 10i 0 based(######ptr######) Enum + d CURLUSESSL_NONE... + d c 0 + d CURLUSESSL_TRY... + d c 1 + d CURLUSESSL_CONTROL... + d c 2 + d CURLUSESSL_ALL... + d c 3 + * + d curl_ftpccc s 10i 0 based(######ptr######) Enum + d CURLFTPSSL_CCC_NONE... + d c 0 + d CURLFTPSSL_CCC_PASSIVE... + d c 1 + d CURLFTPSSL_CCC_ACTIVE... + d c 2 + * + d curl_ftpauth s 10i 0 based(######ptr######) Enum + d CURLFTPAUTH_DEFAULT... + d c 0 + d CURLFTPAUTH_SSL... + d c 1 + d CURLFTPAUTH_TLS... + d c 2 + * + d curl_ftpcreatedir... + d s 10i 0 based(######ptr######) Enum + d CURLFTP_CREATE_DIR_NONE... + d c 0 + d CURLFTP_CREATE_DIR... + d c 1 + d CURLFTP_CREATE_DIR_RETRY... + d c 2 + * + d curl_ftpmethod s 10i 0 based(######ptr######) Enum + d CURLFTPMETHOD_DEFAULT... + d c 0 + d CURLFTPMETHOD_MULTICWD... + d c 1 + d CURLFTPMETHOD_NOCWD... + d c 2 + d CURLFTPMETHOD_SINGLECWD... + d c 3 + * + d CURLPROTO_HTTP... + d c X'00000001' + d CURLPROTO_HTTPS... + d c X'00000002' + d CURLPROTO_FTP... + d c X'00000004' + d CURLPROTO_FTPS... + d c X'00000008' + d CURLPROTO_SCP... + d c X'00000010' + d CURLPROTO_SFTP... + d c X'00000020' + d CURLPROTO_TELNET... + d c X'00000040' + d CURLPROTO_LDAP... + d c X'00000080' + d CURLPROTO_LDAPS... + d c X'00000100' + d CURLPROTO_DICT... + d c X'00000200' + d CURLPROTO_FILE... + d c X'00000400' + d CURLPROTO_TFTP... + d c X'00000800' + d CURLPROTO_IMAP... + d c X'00001000' + d CURLPROTO_IMAPS... + d c X'00002000' + d CURLPROTO_POP3... + d c X'00004000' + d CURLPROTO_POP3S... + d c X'00008000' + d CURLPROTO_SMTP... + d c X'00010000' + d CURLPROTO_SMTPS... + d c X'00020000' + d CURLPROTO_RTSP... + d c X'00040000' + d CURLPROTO_RTMP... + d c X'00080000' + d CURLPROTO_RTMPT... + d c X'00100000' + d CURLPROTO_RTMPTE... + d c X'00200000' + d CURLPROTO_RTMPE... + d c X'00400000' + d CURLPROTO_RTMPS... + d c X'00800000' + d CURLPROTO_RTMPTS... + d c X'01000000' + d CURLPROTO_GOPHER... + d c X'02000000' + * + d CURLoption s 10i 0 based(######ptr######) Enum + d CURLOPT_FILE c 10001 + d CURLOPT_WRITEDATA... + d c 10001 + d CURLOPT_URL c 10002 + d CURLOPT_PORT c 00003 + d CURLOPT_PROXY c 10004 + d CURLOPT_USERPWD... + d c 10005 + d CURLOPT_PROXYUSERPWD... + d c 10006 + d CURLOPT_RANGE c 10007 + d CURLOPT_INFILE... + d c 10009 + d CURLOPT_READDATA... + d c 10009 + d CURLOPT_ERRORBUFFER... + d c 10010 + d CURLOPT_WRITEFUNCTION... + d c 20011 + d CURLOPT_READFUNCTION... + d c 20012 + d CURLOPT_TIMEOUT... + d c 00013 + d CURLOPT_INFILESIZE... + d c 00014 + d CURLOPT_POSTFIELDS... + d c 10015 + d CURLOPT_REFERER... + d c 10016 + d CURLOPT_FTPPORT... + d c 10017 + d CURLOPT_USERAGENT... + d c 10018 + d CURLOPT_LOW_SPEED_LIMIT... + d c 00019 + d CURLOPT_LOW_SPEED_TIME... + d c 00020 + d CURLOPT_RESUME_FROM... + d c 00021 + d CURLOPT_COOKIE... + d c 10022 + d CURLOPT_HTTPHEADER... + d c 10023 + d CURLOPT_RTSPHEADER... + d c 10023 + d CURLOPT_HTTPPOST... + d c 10024 + d CURLOPT_SSLCERT... + d c 10025 + d CURLOPT_SSLCERTPASSWD... + d c 10026 + d CURLOPT_KEYPASSWD... + d c 10026 + d CURLOPT_CRLF c 00027 + d CURLOPT_QUOTE c 10028 + d CURLOPT_WRITEHEADER... + d c 10029 + d CURLOPT_HEADERDATA... + d c 10029 + d CURLOPT_COOKIEFILE... + d c 10031 + d CURLOPT_SSLVERSION... + d c 00032 + d CURLOPT_TIMECONDITION... + d c 00033 + d CURLOPT_TIMEVALUE... + d c 00034 + d CURLOPT_CUSTOMREQUEST... + d c 10036 + d CURLOPT_STDERR... + d c 10037 + d CURLOPT_POSTQUOTE... + d c 10039 + d CURLOPT_WRITEINFO... + d c 10040 + d CURLOPT_VERBOSE... + d c 00041 + d CURLOPT_HEADER... + d c 00042 + d CURLOPT_NOPROGRESS... + d c 00043 + d CURLOPT_NOBODY... + d c 00044 + d CURLOPT_FAILONERROR... + d c 00045 + d CURLOPT_UPLOAD... + d c 00046 + d CURLOPT_POST c 00047 + d CURLOPT_DIRLISTONLY... + d c 00048 + d CURLOPT_APPEND... + d c 00050 + d CURLOPT_NETRC c 00051 + d CURLOPT_FOLLOWLOCATION... + d c 00052 + d CURLOPT_TRANSFERTEXT... + d c 00053 + d CURLOPT_PUT c 00054 + d CURLOPT_PROGRESSFUNCTION... + d c 20056 + d CURLOPT_PROGRESSDATA... + d c 10057 + d CURLOPT_AUTOREFERER... + d c 00058 + d CURLOPT_PROXYPORT... + d c 00059 + d CURLOPT_POSTFIELDSIZE... + d c 00060 + d CURLOPT_HTTPPROXYTUNNEL... + d c 00061 + d CURLOPT_INTERFACE... + d c 10062 + d CURLOPT_KRBLEVEL... + d c 10063 + d CURLOPT_SSL_VERIFYPEER... + d c 00064 + d CURLOPT_CAINFO... + d c 10065 + d CURLOPT_MAXREDIRS... + d c 00068 + d CURLOPT_FILETIME... + d c 00069 + d CURLOPT_TELNETOPTIONS... + d c 10070 + d CURLOPT_MAXCONNECTS... + d c 00071 + d CURLOPT_CLOSEPOLICY... + d c 00072 + d CURLOPT_FRESH_CONNECT... + d c 00074 + d CURLOPT_FORBID_REUSE... + d c 00075 + d CURLOPT_RANDOM_FILE... + d c 10076 + d CURLOPT_EGDSOCKET... + d c 10077 + d CURLOPT_CONNECTTIMEOUT... + d c 00078 + d CURLOPT_HEADERFUNCTION... + d c 20079 + d CURLOPT_HTTPGET... + d c 00080 + d CURLOPT_SSL_VERIFYHOST... + d c 00081 + d CURLOPT_COOKIEJAR... + d c 10082 + d CURLOPT_SSL_CIPHER_LIST... + d c 10083 + d CURLOPT_HTTP_VERSION... + d c 00084 + d CURLOPT_FTP_USE_EPSV... + d c 00085 + d CURLOPT_SSLCERTTYPE... + d c 10086 + d CURLOPT_SSLKEY... + d c 10087 + d CURLOPT_SSLKEYTYPE... + d c 10088 + d CURLOPT_SSLENGINE... + d c 10089 + d CURLOPT_SSLENGINE_DEFAULT... + d c 00090 + d CURLOPT_DNS_USE_GLOBAL_CACHE... + d c 00091 + d CURLOPT_DNS_CACHE_TIMEOUT... + d c 00092 + d CURLOPT_PREQUOTE... + d c 10093 + d CURLOPT_DEBUGFUNCTION... + d c 20094 + d CURLOPT_DEBUGDATA... + d c 10095 + d CURLOPT_COOKIESESSION... + d c 00096 + d CURLOPT_CAPATH... + d c 10097 + d CURLOPT_BUFFERSIZE... + d c 00098 + d CURLOPT_NOSIGNAL... + d c 00099 + d CURLOPT_SHARE c 10100 + d CURLOPT_PROXYTYPE... + d c 00101 + d CURLOPT_ENCODING... + d c 10102 + d CURLOPT_PRIVATE... + d c 10103 + d CURLOPT_HTTP200ALIASES... + d c 10104 + d CURLOPT_UNRESTRICTED_AUTH... + d c 00105 + d CURLOPT_FTP_USE_EPRT... + d c 00106 + d CURLOPT_HTTPAUTH... + d c 00107 + d CURLOPT_SSL_CTX_FUNCTION... + d c 20108 + d CURLOPT_SSL_CTX_DATA... + d c 10109 + d CURLOPT_FTP_CREATE_MISSING_DIRS... + d c 00110 + d CURLOPT_PROXYAUTH... + d c 00111 + d CURLOPT_FTP_RESPONSE_TIMEOUT... + d c 00112 + d CURLOPT_IPRESOLVE... + d c 00113 + d CURLOPT_MAXFILESIZE... + d c 00114 + d CURLOPT_INFILESIZE_LARGE... + d c 30115 + d CURLOPT_RESUME_FROM_LARGE... + d c 30116 + d CURLOPT_MAXFILESIZE_LARGE... + d c 30117 + d CURLOPT_NETRC_FILE... + d c 10118 + d CURLOPT_USE_SSL... + d c 00119 + d CURLOPT_POSTFIELDSIZE_LARGE... + d c 30120 + d CURLOPT_TCP_NODELAY... + d c 00121 + d CURLOPT_FTPSSLAUTH... + d c 00129 + d CURLOPT_IOCTLFUNCTION... + d c 20130 + d CURLOPT_IOCTLDATA... + d c 10131 + d CURLOPT_FTP_ACCOUNT... + d c 10134 + d CURLOPT_COOKIELIST... + d c 10135 + d CURLOPT_IGNORE_CONTENT_LENGTH... + d c 00136 + d CURLOPT_FTP_SKIP_PASV_IP... + d c 00137 + d CURLOPT_FTP_FILEMETHOD... + d c 00138 + d CURLOPT_LOCALPORT... + d c 00139 + d CURLOPT_LOCALPORTRANGE... + d c 00140 + d CURLOPT_CONNECT_ONLY... + d c 00141 + d CURLOPT_CONV_FROM_NETWORK_FUNCTION... + d c 20142 + d CURLOPT_CONV_TO_NETWORK_FUNCTION... + d c 20143 + d CURLOPT_CONV_FROM_UTF8_FUNCTION... + d c 20144 + d CURLOPT_MAX_SEND_SPEED_LARGE... + d c 30145 + d CURLOPT_MAX_RECV_SPEED_LARGE... + d c 30146 + d CURLOPT_FTP_ALTERNATIVE_TO_USER... + d c 10147 + d CURLOPT_SOCKOPTFUNCTION... + d c 20148 + d CURLOPT_SOCKOPTDATA... + d c 10149 + d CURLOPT_SSL_SESSIONID_CACHE... + d c 00150 + d CURLOPT_SSH_AUTH_TYPES... + d c 00151 + d CURLOPT_SSH_PUBLIC_KEYFILE... + d c 10152 + d CURLOPT_SSH_PRIVATE_KEYFILE... + d c 10153 + d CURLOPT_FTP_SSL_CCC... + d c 00154 + d CURLOPT_TIMEOUT_MS... + d c 00155 + d CURLOPT_CONNECTTIMEOUT_MS... + d c 00156 + d CURLOPT_HTTP_TRANSFER_DECODING... + d c 00157 + d CURLOPT_HTTP_CONTENT_DECODING... + d c 00158 + d CURLOPT_NEW_FILE_PERMS... + d c 00159 + d CURLOPT_NEW_DIRECTORY_PERMS... + d c 00160 + d CURLOPT_POSTREDIR... + d c 00161 + d CURLOPT_SSH_HOST_PUBLIC_KEY_MD5... + d c 10162 + d CURLOPT_OPENSOCKETFUNCTION... + d c 20163 + d CURLOPT_OPENSOCKETDATA... + d c 10164 + d CURLOPT_COPYPOSTFIELDS... + d c 10165 + d CURLOPT_PROXY_TRANSFER_MODE... + d c 00166 + d CURLOPT_SEEKFUNCTION... + d c 20167 + d CURLOPT_SEEKDATA... + d c 10168 + d CURLOPT_CRLFILE... + d c 10169 + d CURLOPT_ISSUERCERT... + d c 10170 + d CURLOPT_ADDRESS_SCOPE... + d c 00171 + d CURLOPT_CERTINFO... + d c 00172 + d CURLOPT_USERNAME... + d c 10173 + d CURLOPT_PASSWORD... + d c 10174 + d CURLOPT_PROXYUSERNAME... + d c 10175 + d CURLOPT_PROXYPASSWORD... + d c 10176 + d CURLOPT_NOPROXY... + d c 10177 + d CURLOPT_TFTP_BLKSIZE... + d c 00178 + d CURLOPT_SOCKS5_GSSAPI_SERVICE... + d c 10179 + d CURLOPT_SOCKS5_GSSAPI_NEC... + d c 00180 + d CURLOPT_PROTOCOLS... + d c 00181 + d CURLOPT_REDIR_PROTOCOLS... + d c 00182 + d CURLOPT_SSH_KNOWNHOSTS... + d c 10183 + d CURLOPT_SSH_KEYFUNCTION... + d c 20184 + d CURLOPT_SSH_KEYDATA... + d c 10185 + d CURLOPT_MAIL_FROM... + d c 10186 + d CURLOPT_MAIL_RCPT... + d c 10187 + d CURLOPT_FTP_USE_PRET... + d c 00188 + d CURLOPT_RTSP_REQUEST... + d c 00189 + d CURLOPT_RTSP_SESSION_ID... + d c 10190 + d CURLOPT_RTSP_STREAM_URI... + d c 10191 + d CURLOPT_RTSP_TRANSPORT... + d c 10192 + d CURLOPT_RTSP_CLIENT_CSEQ... + d c 00193 + d CURLOPT_RTSP_SERVER_CSEQ... + d c 00194 + d CURLOPT_INTERLEAVEDATA... + d c 10195 + d CURLOPT_INTERLEAVEFUNCTION... + d c 20196 + d CURLOPT_WILDCARDMATCH... + d c 00197 + d CURLOPT_CHUNK_BGN_FUNCTION... + d c 20198 + d CURLOPT_CHUNK_END_FUNCTION... + d c 20199 + d CURLOPT_FNMATCH_FUNCTION... + d c 20200 + d CURLOPT_CHUNK_DATA... + d c 10201 + d CURLOPT_FNMATCH_DATA... + d c 10202 + * + d CURLOPT_SERVER_RESPONSE_TIMEOUT... + d c 00112 + d CURLOPT_POST301... + d c 00161 Obsolescent + * + d CURLFORMcode s 10i 0 based(######ptr######) Enum + d CURL_FORMADD_OK... + d c 0 + d CURL_FORMADD_MEMORY... + d c 1 + d CURL_FORMADD_OPTION_TWICE... + d c 2 + d CURL_FORMADD_NULL... + d c 3 + d CURL_FORMADD_UNKNOWN_OPTION... + d c 4 + d CURL_FORMADD_INCOMPLETE... + d c 5 + d CURL_FORMADD_ILLEGAL_ARRAY... + d c 6 + d CURL_FORMADD_DISABLED... + d c 7 + * + d CURLformoption s 10i 0 based(######ptr######) Enum + d CURLFORM_NOTHING... + d c 0 + d CURLFORM_COPYNAME... + d c 1 + d CURLFORM_PTRNAME... + d c 2 + d CURLFORM_NAMELENGTH... + d c 3 + d CURLFORM_COPYCONTENTS... + d c 4 + d CURLFORM_PTRCONTENTS... + d c 5 + d CURLFORM_CONTENTSLENGTH... + d c 6 + d CURLFORM_FILECONTENT... + d c 7 + d CURLFORM_ARRAY... + d c 8 + d CURLFORM_OBSOLETE... + d c 9 + d CURLFORM_FILE... + d c 10 + d CURLFORM_BUFFER... + d c 11 + d CURLFORM_BUFFERPTR... + d c 12 + d CURLFORM_BUFFERLENGTH... + d c 13 + d CURLFORM_CONTENTTYPE... + d c 14 + d CURLFORM_CONTENTHEADER... + d c 15 + d CURLFORM_FILENAME... + d c 16 + d CURLFORM_END... + d c 17 + d CURLFORM_OBSOLETE2... + d c 18 + d CURLFORM_STREAM... + d c 19 + * + d CURLINFO s 10i 0 based(######ptr######) Enum + d CURLINFO_EFFECTIVE_URL... CURLINFO_STRING + 1 + d c X'00100001' + d CURLINFO_RESPONSE_CODE... CURLINFO_LONG + 2 + d c X'00200002' + d CURLINFO_TOTAL_TIME... CURLINFO_DOUBLE + 3 + d c X'00300003' + d CURLINFO_NAMELOOKUP_TIME... CURLINFO_DOUBLE + 4 + d c X'00300004' + d CURLINFO_CONNECT_TIME... CURLINFO_DOUBLE + 5 + d c X'00300005' + d CURLINFO_PRETRANSFER_TIME... CURLINFO_DOUBLE + 6 + d c X'00300006' + d CURLINFO_SIZE_UPLOAD... CURLINFO_DOUBLE + 7 + d c X'00300007' + d CURLINFO_SIZE_DOWNLOAD... CURLINFO_DOUBLE + 8 + d c X'00300008' + d CURLINFO_SPEED_DOWNLOAD... CURLINFO_DOUBLE + 9 + d c X'00300009' + d CURLINFO_SPEED_UPLOAD... CURLINFO_DOUBLE + 10 + d c X'0030000A' + d CURLINFO_HEADER_SIZE... CURLINFO_LONG + 11 + d c X'0020000B' + d CURLINFO_REQUEST_SIZE... CURLINFO_LONG + 12 + d c X'0020000C' + d CURLINFO_SSL_VERIFYRESULT... CURLINFO_LONG + 13 + d c X'0020000D' + d CURLINFO_FILETIME... CURLINFO_LONG + 14 + d c X'0020000E' + d CURLINFO_CONTENT_LENGTH_DOWNLOAD... CURLINFO_DOUBLE + 15 + d c X'0030000F' + d CURLINFO_CONTENT_LENGTH_UPLOAD... CURLINFO_DOUBLE + 16 + d c X'00300010' + d CURLINFO_STARTTRANSFER_TIME... CURLINFO_DOUBLE + 17 + d c X'00300011' + d CURLINFO_CONTENT_TYPE... CURLINFO_STRING + 18 + d c X'00100012' + d CURLINFO_REDIRECT_TIME... CURLINFO_DOUBLE + 19 + d c X'00300013' + d CURLINFO_REDIRECT_COUNT... CURLINFO_LONG + 20 + d c X'00200014' + d CURLINFO_PRIVATE... CURLINFO_STRING + 21 + d c X'00100015' + d CURLINFO_HTTP_CONNECTCODE... CURLINFO_LONG + 22 + d c X'00200016' + d CURLINFO_HTTPAUTH_AVAIL... CURLINFO_LONG + 23 + d c X'00200017' + d CURLINFO_PROXYAUTH_AVAIL... CURLINFO_LONG + 24 + d c X'00200018' + d CURLINFO_OS_ERRNO... CURLINFO_LONG + 25 + d c X'00200019' + d CURLINFO_NUM_CONNECTS... CURLINFO_LONG + 26 + d c X'0020001A' + d CURLINFO_SSL_ENGINES... CURLINFO_SLIST + 27 + d c X'0040001B' + d CURLINFO_COOKIELIST... CURLINFO_SLIST + 28 + d c X'0040001C' + d CURLINFO_LASTSOCKET... CURLINFO_LONG + 29 + d c X'0020001D' + d CURLINFO_FTP_ENTRY_PATH... CURLINFO_STRING + 30 + d c X'0010001E' + d CURLINFO_REDIRECT_URL... CURLINFO_STRING + 31 + d c X'0010001F' + d CURLINFO_PRIMARY_IP... CURLINFO_STRING + 32 + d c X'00100020' + d CURLINFO_APPCONNECT_TIME... CURLINFO_DOUBLE + 33 + d c X'00300021' + d CURLINFO_CERTINFO... CURLINFO_SLIST + 34 + d c X'00400022' + d CURLINFO_CONDITION_UNMET... CURLINFO_LONG + 35 + d c X'00200023' + d CURLINFO_RTSP_SESSION_ID... CURLINFO_STRING + 36 + d c X'00100024' + d CURLINFO_RTSP_CLIENT_CSEQ... CURLINFO_LONG + 37 + d c X'00200025' + d CURLINFO_RTSP_SERVER_CSEQ... CURLINFO_LONG + 38 + d c X'00200026' + d CURLINFO_RTSP_CSEQ_RECV... CURLINFO_LONG + 39 + d c X'00200027' + d CURLINFO_PRIMARY_PORT... CURLINFO_LONG + 40 + d c X'00200028' + d CURLINFO_LOCAL_IP... CURLINFO_STRING + 41 + d c X'00100029' + d CURLINFO_LOCAL_PORT... CURLINFO_LONG + 42 + d c X'0020002A' + * + d CURLINFO_HTTP_CODE... Old ...RESPONSE_CODE + d c X'00200002' + * + d curl_closepolicy... + d s 10i 0 based(######ptr######) Enum + d CURLCLOSEPOLICY_OLDEST... + d c 1 + d CURLCLOSEPOLICY_LEAST_RECENTLY_USED... + d c 2 + d CURLCLOSEPOLICY_LEAST_TRAFFIC... + d c 3 + d CURLCLOSEPOLICY_SLOWEST... + d c 4 + d CURLCLOSEPOLICY_CALLBACK... + d c 5 + * + d curl_lock_data... + d s 10i 0 based(######ptr######) Enum + d CURL_LOCK_DATA_NONE... + d c 0 + d CURL_LOCK_DATA_SHARE... + d c 1 + d CURL_LOCK_DATA_COOKIE... + d c 2 + d CURL_LOCK_DATA_DNS... + d c 3 + d CURL_LOCK_DATA_SSL_SESSION... + d c 4 + d CURL_LOCK_DATA_CONNECT... + d c 5 + d CURL_LOCK_DATA_LAST... + d c 6 + * + d curl_lock_access... + d s 10i 0 based(######ptr######) Enum + d CURL_LOCK_ACCESS_NONE... + d c 0 + d CURL_LOCK_ACCESS_SHARED... + d c 1 + d CURL_LOCK_ACCESS_SINGLE... + d c 2 + * + d curl_TimeCond s 10i 0 based(######ptr######) Enum + d CURL_TIMECOND_NONE... + d c 0 + d CURL_TIMECOND_IFMODSINCE... + d c 1 + d CURL_TIMECOND_LASTMOD... + d c 2 + d CURL_TIMECOND_LAST... + d c 3 + * + d CURLSHcode s 10i 0 based(######ptr######) Enum + d CURLSHE_OK c 0 + d CURLSHE_BAD_OPTION... + d c 1 + d CURLSHE_IN_USE... + d c 2 + d CURLSHE_INVALID... + d c 3 + d CURLSHE_NOMEM... + d c 4 + * + d CURLSHoption... + d s 10i 0 based(######ptr######) Enum + d CURLSHOPT_SHARE... + d c 1 + d CURLSHOPT_UNSHARE... + d c 2 + d CURLSHOPT_LOCKFUNC... + d c 3 + d CURLSHOPT_UNLOCKFUNC... + d c 4 + d CURLSHOPT_USERDATA... + d c 5 + * + d CURLversion s 10i 0 based(######ptr######) Enum + d CURLVERSION_FIRST... + d c 0 + d CURLVERSION_SECOND... + d c 1 + d CURLVERSION_THIRD... + d c 2 + d CURLVERSION_FOURTH... + d c 3 + d CURLVERSION_NOW... + d c 3 CURLVERSION_FOURTH + * + d curlsocktype s 10i 0 based(######ptr######) Enum + d CURLSOCKTYPE_IPCXN... + d c 0 + * + d CURLMcode s 10i 0 based(######ptr######) Enum + d CURLM_CALL_MULTI_PERFORM... + d c -1 + d CURLM_CALL_MULTI_SOCKET... + d c -1 + d CURLM_OK c 0 + d CURLM_BAD_HANDLE... + d c 1 + d CURLM_BAD_EASY_HANDLE... + d c 2 + d CURLM_OUT_OF_MEMORY... + d c 3 + d CURLM_INTERNAL_ERROR... + d c 4 + d CURLM_BAD_SOCKET... + d c 5 + d CURLM_UNKNOWN_OPTION... + d c 6 + d CURLM_LAST c 7 + * + d CURLMSG s 10i 0 based(######ptr######) Enum + d CURLMSG_NONE c 0 + d CURLMSG_DONE c 1 + * + d CURLMoption s 10i 0 based(######ptr######) Enum + d CURLMOPT_SOCKETFUNCTION... + d c 20001 + d CURLMOPT_SOCKETDATA... + d c 10002 + d CURLMOPT_PIPELINING... + d c 00003 + d CURLMOPT_TIMERFUNCTION... + d c 20004 + d CURLMOPT_TIMERDATA... + d c 10005 + d CURLMOPT_MAXCONNECTS... + d c 00006 + * + * Public API enums for RTSP requests. + * + d CURLRTSPREQ_NONE... + d c 0 + d CURL_RTSPREQ_OPTIONS... + d c 1 + d CURL_RTSPREQ_DESCRIBE... + d c 2 + d CURL_RTSPREQ_ANNOUNCE... + d c 3 + d CURL_RTSPREQ_SETUP... + d c 4 + d CURL_RTSPREQ_PLAY... + d c 5 + d CURL_RTSPREQ_PAUSE... + d c 6 + d CURL_RTSPREQ_TEARDOWN... + d c 7 + d CURL_RTSPREQ_GET_PARAMETER... + d c 8 + d CURL_RTSPREQ_SET_PARAMETER... + d c 9 + d CURL_RTSPREQ_RECORD... + d c 10 + d CURL_RTSPREQ_RECEIVE... + d c 12 + d CURL_RTSPREQ_LAST... + d c 13 + + * + * Renaming CURLMsg to CURL_Msg to avoid case-insensivity name clash. + * + d CURL_Msg ds based(######ptr######) + d qualified + d msg like(CURLMSG) + d easy_handle * CURL * + d data * + d whatever * overlay(data) void * + d result overlay(data) like(CURLcode) + * + d curl_http_post... + d ds based(######ptr######) + d qualified + d next * curl_httppost * + d name * char * + d namelength 10i 0 long + d contents * char * + d contentslength... + d 10i 0 long + d buffer * char * + d bufferlength... + d 10i 0 long + d contenttype * char * + d contentheader... + d * curl_slist * + d more * curl_httppost * + d flags 10i 0 long + d showfilename * char * + d userp * void * + * + d curl_sockaddr ds based(######ptr######) + d qualified + d family 10i 0 + d socktype 10i 0 + d protocol 10i 0 + d addrlen 10u 0 + d addr 16 struct sockaddr + * + d curl_khkey ds based(######ptr######) + d qualified + d key * const char * + d len 10u 0 + d keytype 10i 0 + * + d CURLKHTYPE_UNKNOWN... + d c 0 + d CURLKHTYPE_RSA1... + d c 1 + d CURLKHTYPE_RSA... + d c 2 + d CURLKHTYPE_DSS... + d c 3 + * + d curl_forms ds based(######ptr######) + d qualified + d option like(CURLformoption) + d value * const char * + d value_ptr * overlay(value) + d value_procptr... + d * overlay(value) procptr + * + d curl_slist ds based(######ptr######) + d qualified + d data * char * + d next * struct curl_slist * + * + d curl_version_info_data... + d ds based(######ptr######) + d qualified + d age like(CURLversion) + d version * const char * + d version_num 10u 0 + d host * const char * + d features 10i 0 + d ssl_version * const char * + d ssl_version_num... + d 10i 0 long + d libz_version * const char * + d protocols * const char * const * + d ares * const char * + d ares_num 10i 0 + d libidn * const char * + d iconv_ver_num... + d 10i 0 + d libssh_version... + d * const char * + * + d curl_certinfo ds based(######ptr######) + d qualified + d num_of_certs 10i 0 + d certinfo * struct curl_slist ** + * + d curl_fistrgs ds based(######ptr######) + d qualified + d time * char * + d perm * char * + d user * char * + d group * char * + d target * char * + * + d curl_fileinfo ds based(######ptr######) + d qualified + d filename * char * + d filetype like(curlfiletype) + d time 10i 0 time_t + d perm 10u 0 + d uid 10i 0 + d gid 10i 0 + d size like(curl_off_t) + d hardlinks 10i 0 + d strings likeds(curl_fistrgs) + d flags 10u 0 + d b_data * char * + d b_size 10u 0 size_t + d b_used 10u 0 size_t + * + d curl_formget_callback... + d s * based(######ptr######) procptr + * + d curl_malloc_callback... + d s * based(######ptr######) procptr + * + d curl_free_callback... + d s * based(######ptr######) procptr + * + d curl_realloc_callback... + d s * based(######ptr######) procptr + * + d curl_strdup_callback... + d s * based(######ptr######) procptr + * + d curl_calloc_callback... + d s * based(######ptr######) procptr + * + d curl_lock_function... + d s * based(######ptr######) procptr + * + d curl_unlock_function... + d s * based(######ptr######) procptr + * + d curl_progress_callback... + d s * based(######ptr######) procptr + * + d curl_read_callback... + d s * based(######ptr######) procptr + * + d curl_write_callback... + d s * based(######ptr######) procptr + * + d curl_seek_callback... + d s * based(######ptr######) procptr + * + d curl_sockopt_callback... + d s * based(######ptr######) procptr + * + d curl_ioctl_callback... + d s * based(######ptr######) procptr + * + d curl_debug_callback... + d s * based(######ptr######) procptr + * + d curl_conv_callback... + d s * based(######ptr######) procptr + * + d curl_ssl_ctx_callback... + d s * based(######ptr######) procptr + * + d curl_socket_callback... + d s * based(######ptr######) procptr + * + d curl_opensocket_callback... + d s * based(######ptr######) procptr + * + d curl_sshkeycallback... + d s * based(######ptr######) procptr + * + d curl_chunk_bgn_callback... + d s * based(######ptr######) procptr + * + d curl_chunk_end_callback... + d s * based(######ptr######) procptr + * + d curl_fnmatch_callback... + d s * based(######ptr######) procptr + * + ************************************************************************** + * Prototypes + ************************************************************************** + * + * This procedure as a variable parameter list. + * This prototype allows use of an option array, or a single "object" + * option. Other argument lists may be implemented by alias procedure + * prototype definitions. + * + d curl_formadd pr extproc('curl_formadd') + d like(CURLFORMcode) + d httppost * curl_httppost * + d lastpost * curl_httppost * + d option1 value like(CURLFORMoption) CURLFORM_ARRAY + d options(*nopass) + d object1 * value options(*string: *nopass) + d option2 value like(CURLFORMoption) CURLFORM_END + d options(*nopass) + * + * + d curl_strequal pr 10i 0 extproc('curl_strequal') + d s1 * value options(*string) + d s2 * value options(*string) + * + d curl_strnequal pr 10i 0 extproc('curl_strnequal') + d s1 * value options(*string) + d s2 * value options(*string) + d n 10u 0 value + * + d curl_formget pr 10i 0 extproc('curl_formget') + d form * value curl_httppost * + d arg * value + d append value like(curl_formget_callback) + * + d curl_formfree pr extproc('curl_formfree') + d form * value curl_httppost * + * + d curl_getenv pr * extproc('curl_getenv') + d variable * value options(*string) + * + d curl_version pr * extproc('curl_version') + * + d curl_easy_escape... + d pr * extproc('curl_easy_escape') char * + d handle * value CURL * + d string * value options(*string) + d length 10i 0 value + * + d curl_escape pr * extproc('curl_escape') char * + d string * value options(*string) + d length 10i 0 value + * + d curl_easy_unescape... + d pr * extproc('curl_easy_unescape') char * + d handle * value CURL * + d string * value options(*string) + d length 10i 0 value + d outlength 10i 0 options(*omit) + * + d curl_unescape pr * extproc('curl_unescape') char * + d string * value options(*string) + d length 10i 0 value + * + d curl_free pr extproc('curl_free') + d p * value + * + d curl_global_init... + d pr extproc('curl_global_init') + d like(CURLcode) + d flags 10i 0 value + * + d curl_global_init_mem... + d pr extproc('curl_global_init_mem') + d like(CURLcode) + d m value like(curl_malloc_callback) + d f value like(curl_free_callback) + d r value like(curl_realloc_callback) + d s value like(curl_strdup_callback) + d c value like(curl_calloc_callback) + * + d curl_global_cleanup... + d pr extproc('curl_global_cleanup') + * + d curl_slist_append... + d pr * extproc('curl_slist_append') struct curl_slist * + d list * value struct curl_slist * + d data * value options(*string) const char * + * + d curl_slist_free_all... + d pr extproc('curl_slist_free_all') + d list * value struct curl_slist * + * + d curl_getdate pr 10i 0 extproc('curl_getdate') time_t + d p * value options(*string) const char * + d unused 10i 0 const options(*omit) time_t + * + d curl_share_init... + d pr * extproc('curl_share_init') CURLSH * (= void *) + * + * Variable argument type procedure. + * Multiply prototyped to support all possible types. + * + d curl_share_setopt_int... + d pr extproc('curl_share_setopt') + d like(CURLSHcode) + d share * value CURLSH * (= void *) + d option value like(CURLSHoption) + d intarg 10i 0 value options(*nopass) + * + d curl_share_setopt_ptr... + d pr extproc('curl_share_setopt') + d like(CURLSHcode) + d share * value CURLSH * (= void *) + d option value like(CURLSHoption) + d ptrarg * value options(*nopass) + * + d curl_share_setopt_proc... + d pr extproc('curl_share_setopt') + d like(CURLSHcode) + d share * value CURLSH * (= void *) + d option value like(CURLSHoption) + d procarg * value procptr options(*nopass) + * + d curl_share_cleanup... + d pr extproc('curl_share_cleanup') + d like(CURLSHcode) + d share * value CURLSH * (= void *) + * + d curl_version_info... + d pr * extproc('curl_version_info') c_i_version_data * + d version value like(CURLversion) + * + d curl_easy_strerror... + d pr * extproc('curl_easy_strerror') const char * + d code value like(CURLcode) + * + d curl_share_strerror... + d pr * extproc('curl_share_strerror') const char * + d code value like(CURLSHcode) + * + d curl_easy_init pr * extproc('curl_easy_init') CURL * + * + * Multiple prototypes for vararg procedure curl_easy_setopt. + * + d curl_easy_setopt_long... + d pr extproc('curl_easy_setopt') + d like(CURLcode) + d curl * value CURL * + d option value like(CURLoption) + d longarg 10i 0 value options(*nopass) + * + d curl_easy_setopt_object... + d pr extproc('curl_easy_setopt') + d like(CURLcode) + d curl * value CURL * + d option value like(CURLoption) + d objectarg * value options(*string: *nopass) + * + d curl_easy_setopt_function... + d pr extproc('curl_easy_setopt') + d like(CURLcode) + d curl * value CURL * + d option value like(CURLoption) + d functionarg * value procptr options(*nopass) + * + d curl_easy_setopt_offset... + d pr extproc('curl_easy_setopt') + d like(CURLcode) + d curl * value CURL * + d option value like(CURLoption) + d offsetarg value like(curl_off_t) + d options(*nopass) + * + * + d curl_easy_perform... + d pr extproc('curl_easy_perform') + d like(CURLcode) + d curl * value CURL * + * + d curl_easy_cleanup... + d pr extproc('curl_easy_cleanup') + d curl * value CURL * + * + * Multiple prototypes for vararg procedure curl_easy_getinfo. + * + d curl_easy_getinfo_string... + d pr extproc('curl_easy_getinfo') + d like(CURLcode) + d curl * value CURL * + d info value like(CURLINFO) + d stringarg * options(*nopass) char * + * + d curl_easy_getinfo_long... + d pr extproc('curl_easy_getinfo') + d like(CURLcode) + d curl * value CURL * + d info value like(CURLINFO) + d longarg 10i 0 options(*nopass) + * + d curl_easy_getinfo_double... + d pr extproc('curl_easy_getinfo') + d like(CURLcode) + d curl * value CURL * + d info value like(CURLINFO) + d doublearg 8f options(*nopass) + * + d curl_easy_getinfo_slist... + d pr extproc('curl_easy_getinfo') + d like(CURLcode) + d curl * value CURL * + d info value like(CURLINFO) + d slistarg * options(*nopass) struct curl_slist * + * + * + d curl_easy_duphandle... + d pr * extproc('curl_easy_duphandle') CURL * + d curl * value CURL * + * + d curl_easy_reset... + d pr extproc('curl_easy_reset') + d curl * value CURL * + * + d curl_easy_recv... + d pr extproc('curl_easy_recv') + d like(CURLcode) + d curl * value CURL * + d buffer * value void * + d buflen 10u 0 value size_t + d n 10u 0 size_t * + * + d curl_easy_send... + d pr extproc('curl_easy_send') + d like(CURLcode) + d curl * value CURL * + d buffer * value const void * + d buflen 10u 0 value size_t + d n 10u 0 size_t * + * + d curl_easy_pause... + d pr extproc('curl_easy_pause') + d curl * value CURL * + d bitmask 10i 0 value + * + d curl_multi_init... + d pr * extproc('curl_multi_init') CURLM * + * + d curl_multi_add_handle... + d pr extproc('curl_multi_add_handle') + d like(CURLMcode) + d multi_handle * value CURLM * + d curl_handle * value CURL * + * + d curl_multi_remove_handle... + d pr extproc('curl_multi_remove_handle') + d like(CURLMcode) + d multi_handle * value CURLM * + d curl_handle * value CURL * + * + d curl_multi_fdset... + d pr extproc('curl_multi_fdset') + d like(CURLMcode) + d multi_handle * value CURLM * + d read_fd_set 65535 options(*varsize) fd_set + d write_fd_set 65535 options(*varsize) fd_set + d exc_fd_set 65535 options(*varsize) fd_set + d max_fd 10i 0 + * + d curl_multi_perform... + d pr extproc('curl_multi_perform') + d like(CURLMcode) + d multi_handle * value CURLM * + d running_handles... + d 10i 0 + * + d curl_multi_cleanup... + d pr extproc('curl_multi_cleanup') + d like(CURLMcode) + d multi_handle * value CURLM * + * + d curl_multi_info_read... + d pr * extproc('curl_multi_info_read') CURL_Msg * + d multi_handle * value CURLM * + d msgs_in_queue 10i 0 + * + d curl_multi_strerror... + d pr * extproc('curl_multi_strerror') char * + d code value like(CURLMcode) + * + d curl_multi_socket... + d pr extproc('curl_multi_socket') + d like(CURLMcode) + d multi_handle * value CURLM * + d s value like(curl_socket_t) + d running_handles... + d 10i 0 + * + d curl_multi_socket_action... + d pr extproc('curl_multi_socket_action') + d like(CURLMcode) + d multi_handle * value CURLM * + d s value like(curl_socket_t) + d ev_bitmask 10i 0 value + d running_handles... + d 10i 0 + * + d curl_multi_socket_all... + d pr extproc('curl_multi_socket_all') + d like(CURLMcode) + d multi_handle * value CURLM * + d running_handles... + d 10i 0 + * + d curl_multi_timeout... + d pr extproc('curl_multi_timeout') + d like(CURLMcode) + d multi_handle * value CURLM * + d milliseconds 10i 0 + * + * Multiple prototypes for vararg procedure curl_multi_setopt. + * + d curl_multi_setopt_long... + d pr extproc('curl_multi_setopt') + d like(CURLMcode) + d multi_handle * value CURLM * + d option value like(CURLMoption) + d longarg 10i 0 value options(*nopass) + * + d curl_multi_setopt_object... + d pr extproc('curl_multi_setopt') + d like(CURLMcode) + d multi_handle * value CURLM * + d option value like(CURLMoption) + d objectarg * value options(*string: *nopass) + * + d curl_multi_setopt_function... + d pr extproc('curl_multi_setopt') + d like(CURLMcode) + d multi_handle * value CURLM * + d option value like(CURLMoption) + d functionarg * value procptr options(*nopass) + * + d curl_multi_setopt_offset... + d pr extproc('curl_multi_setopt') + d like(CURLMcode) + d multi_handle * value CURLM * + d option value like(CURLMoption) + d offsetarg value like(curl_off_t) + d options(*nopass) + * + * + d curl_multi_assign... + d pr extproc('curl_multi_assign') + d like(CURLMcode) + d multi_handle * value CURLM * + d sockfd value like(curl_socket_t) + d sockp * value void * + * + ************************************************************************** + * CCSID wrapper procedure prototypes + ************************************************************************** + * + d curl_version_ccsid... + d pr * extproc('curl_version_ccsid') + d ccsid 10u 0 value + * + d curl_easy_escape_ccsid... + d pr * extproc('curl_easy_escape_ccsid') char * + d handle * value CURL * + d string * value options(*string) + d length 10i 0 value + d ccsid 10u 0 value + * + d curl_easy_unescape_ccsid... + d pr * extproc('curl_easy_unescape_ccsid') char * + d handle * value CURL * + d string * value options(*string) + d length 10i 0 value + d outlength 10i 0 options(*omit) + d ccsid 10u 0 value + * + d curl_slist_append_ccsid... + d pr * extproc('curl_slist_append_ccsid') struct curl_slist * + d list * value struct curl_slist * + d data * value options(*string) const char * + d ccsid 10u 0 value + * + d curl_getdate_ccsid... + d pr 10i 0 extproc('curl_getdate_ccsid') time_t + d p * value options(*string) const char * + d unused 10i 0 const options(*omit) time_t + d ccsid 10u 0 value + * + d curl_version_info_ccsid... + d pr * extproc('curl_version_info_ccsid') c_i_version_data * + d version value like(CURLversion) + d ccsid 10u 0 value + * + d curl_easy_strerror_ccsid... + d pr * extproc('curl_easy_strerror_ccsid') const char * + d code value like(CURLcode) + d ccsid 10u 0 value + * + d curl_share_strerror_ccsid... + d pr * extproc('curl_share_strerror_ccsid') const char * + d code value like(CURLSHcode) + d ccsid 10u 0 value + * + d curl_multi_strerror_ccsid... + d pr * extproc('curl_multi_strerror_ccsid') char * + d code value like(CURLMcode) + d ccsid 10u 0 value + * + d curl_easy_getinfo_ccsid... + d pr extproc('curl_easy_getinfo_ccsid') + d like(CURLcode) + d curl * value CURL * + d info value like(CURLINFO) + d stringarg * options(*nopass) char * + d ccsid 10u 0 value options(*nopass) + * + d curl_formadd_ccsid... + d pr extproc('curl_formadd_ccsid') + d like(CURLFORMcode) + d httppost * curl_httppost * + d lastpost * curl_httppost * + d option1 value like(CURLFORMoption) CURLFORM_ARRAY + d options(*nopass) + d object1 * value options(*string: *nopass) + d option2 value like(CURLFORMoption) CURLFORM_END + d options(*nopass) + * + d curl_formget_ccsid... + d pr 10i 0 extproc('curl_formget_ccsid') + d form * value curl_httppost * + d arg * value + d append value like(curl_formget_callback) + d ccsid 10u 0 value + * + d curl_form_long_value... + d pr * extproc('curl_form_long_value') + d value 10i 0 value curl_httppost * + * + d curl_easy_setopt_ccsid... + d pr extproc('curl_easy_setopt_ccsid') + d like(CURLcode) + d curl * value CURL * + d option value like(CURLoption) + d objectarg * value options(*string: *nopass) + d ccsid 10u 0 value options(*nopass) + * + /endif diff --git a/mobicore/common/curl/packages/OS400/initscript.sh b/mobicore/common/curl/packages/OS400/initscript.sh new file mode 100644 index 0000000000000000000000000000000000000000..9bf93a8e6426ddc15eacbc856e250caf4a435470 --- /dev/null +++ b/mobicore/common/curl/packages/OS400/initscript.sh @@ -0,0 +1,176 @@ +#!/bin/sh + + +case "${SCRIPTDIR}" in +/*) ;; +*) SCRIPTDIR="`pwd`/${SCRIPTDIR}" +esac + +while true +do case "${SCRIPTDIR}" in + */.) SCRIPTDIR="${SCRIPTDIR%/.}";; + *) break;; + esac +done + +# The script directory is supposed to be in $TOPDIR/packages/os400. + +TOPDIR=`dirname "${SCRIPTDIR}"` +TOPDIR=`dirname "${TOPDIR}"` +export SCRIPTDIR TOPDIR + +# Extract the SONAME from the library makefile. + +SONAME=`sed -e '/^VERSIONINFO=/!d' -e 's/^.* \([0-9]*\):.*$/\1/' -e 'q' \ + < "${TOPDIR}/lib/Makefile.am"` +export SONAME + + +################################################################################ +# +# Tunable configuration parameters. +# +################################################################################ + +TARGETLIB='CURL' # Target OS/400 program library +STATBNDDIR='CURL_A' # Static binding directory. +DYNBNDDIR='CURL' # Dynamic binding directory. +SRVPGM="CURL.${SONAME}" # Service program. +TGTCCSID='500' # Target CCSID of objects +DEBUG='*ALL' # Debug level +OPTIMIZE='10' # Optimisation level +OUTPUT='*NONE' # Compilation output option. +TGTRLS='V5R3M0' # Target OS release + +export TARGETLIB STATBNDDIR DYNBNDDIR SRVPGM TGTCCSID DEBUG OPTIMIZE OUTPUT +export TGTRLS + + +################################################################################ + +# Need to get the version definitions. + +LIBCURL_VERSION=`grep '^#define *LIBCURL_VERSION ' \ + "${TOPDIR}/include/curl/curlver.h" | + sed 's/.*"\(.*\)".*/\1/'` +LIBCURL_VERSION_MAJOR=`grep '^#define *LIBCURL_VERSION_MAJOR ' \ + "${TOPDIR}/include/curl/curlver.h" | + sed 's/^#define *LIBCURL_VERSION_MAJOR *\([^ ]*\).*/\1/'` +LIBCURL_VERSION_MINOR=`grep '^#define *LIBCURL_VERSION_MINOR ' \ + "${TOPDIR}/include/curl/curlver.h" | + sed 's/^#define *LIBCURL_VERSION_MINOR *\([^ ]*\).*/\1/'` +LIBCURL_VERSION_PATCH=`grep '^#define *LIBCURL_VERSION_PATCH ' \ + "${TOPDIR}/include/curl/curlver.h" | + sed 's/^#define *LIBCURL_VERSION_PATCH *\([^ ]*\).*/\1/'` +LIBCURL_VERSION_NUM=`grep '^#define *LIBCURL_VERSION_NUM ' \ + "${TOPDIR}/include/curl/curlver.h" | + sed 's/^#define *LIBCURL_VERSION_NUM *0x\([^ ]*\).*/\1/'` +LIBCURL_TIMESTAMP=`grep '^#define *LIBCURL_TIMESTAMP ' \ + "${TOPDIR}/include/curl/curlver.h" | + sed 's/.*"\(.*\)".*/\1/'` +export LIBCURL_VERSION +export LIBCURL_VERSION_MAJOR LIBCURL_VERSION_MINOR LIBCURL_VERSION_PATCH +export LIBCURL_VERSION_NUM LIBCURL_TIMESTAMP + +################################################################################ +# +# OS/400 specific definitions. +# +################################################################################ + +LIBIFSNAME="/QSYS.LIB/${TARGETLIB}.LIB" + + +################################################################################ +# +# Procedures. +# +################################################################################ + +# action_needed dest [src] +# +# dest is an object to build +# if specified, src is an object on which dest depends. +# +# exit 0 (succeeds) if some action has to be taken, else 1. + +action_needed() + +{ + [ ! -e "${1}" ] && return 0 + [ "${2}" ] || return 1 + [ "${1}" -ot "${2}" ] && return 0 + return 1 +} + + +# make_module module_name source_name [additional_definitions] +# +# Compile source name into ASCII module if needed. +# As side effect, append the module name to variable MODULES. +# Set LINK to "YES" if the module has been compiled. + +make_module() + +{ + MODULES="${MODULES} ${1}" + MODIFSNAME="${LIBIFSNAME}/${1}.MODULE" + action_needed "${MODIFSNAME}" "${2}" || return 0; + + # #pragma convert has to be in the source file itself, i.e. + # putting it in an include file makes it only active + # for that include file. + # Thus we build a temporary file with the pragma prepended to + # the source file and we compile that themporary file. + + echo "#line 1 \"${2}\"" > __tmpsrcf.c + echo "#pragma convert(819)" >> __tmpsrcf.c + echo "#line 1" >> __tmpsrcf.c + cat "${2}" >> __tmpsrcf.c + CMD="CRTCMOD MODULE(${TARGETLIB}/${1}) SRCSTMF('__tmpsrcf.c')" +# CMD="${CMD} SYSIFCOPT(*IFS64IO) OPTION(*INCDIRFIRST *SHOWINC *SHOWSYS)" + CMD="${CMD} SYSIFCOPT(*IFS64IO) OPTION(*INCDIRFIRST)" + CMD="${CMD} LOCALETYPE(*LOCALE)" + CMD="${CMD} INCDIR('/qibm/proddata/qadrt/include'" + CMD="${CMD} '${TOPDIR}/include/curl' '${TOPDIR}/include'" + CMD="${CMD} '${TOPDIR}/packages/OS400' ${INCLUDES})" + CMD="${CMD} TGTCCSID(${TGTCCSID}) TGTRLS(${TGTRLS})" + CMD="${CMD} OUTPUT(${OUTPUT})" + CMD="${CMD} OPTIMIZE(${OPTIMIZE})" + CMD="${CMD} DBGVIEW(${DEBUG})" + + if [ "${3}" ] + then CMD="${CMD} DEFINE(${3})" + fi + + system "${CMD}" + rm -f __tmpsrcf.c + LINK=YES +} + + +# Determine DB2 object name from IFS name. + +db2_name() + +{ + basename "${1}" | + tr '[a-z-]' '[A-Z_]' | + sed -e 's/\..*//' \ + -e 's/^\(..........\).*/\1/' +} + + +# Copy IFS file replacing version info. + +versioned_copy() + +{ + sed -e "s/@LIBCURL_VERSION@/${LIBCURL_VERSION}/g" \ + -e "s/@LIBCURL_VERSION_MAJOR@/${LIBCURL_VERSION_MAJOR}/g" \ + -e "s/@LIBCURL_VERSION_MINOR@/${LIBCURL_VERSION_MINOR}/g" \ + -e "s/@LIBCURL_VERSION_PATCH@/${LIBCURL_VERSION_PATCH}/g" \ + -e "s/@LIBCURL_VERSION_NUM@/${LIBCURL_VERSION_NUM}/g" \ + -e "s/@LIBCURL_TIMESTAMP@/${LIBCURL_TIMESTAMP}/g" \ + < "${1}" > "${2}" +} diff --git a/mobicore/common/curl/packages/OS400/make-include.sh b/mobicore/common/curl/packages/OS400/make-include.sh new file mode 100644 index 0000000000000000000000000000000000000000..834ee2fce9617a95d3efdaa34b57de03d7364956 --- /dev/null +++ b/mobicore/common/curl/packages/OS400/make-include.sh @@ -0,0 +1,72 @@ +#!/bin/sh +# +# Installation of the include files in the OS/400 library. +# + +SCRIPTDIR=`dirname "${0}"` +. "${SCRIPTDIR}/initscript.sh" +cd "${TOPDIR}/include" + + +# Produce the curlbuild.h include file if not yet in distribution (CVS). + +if action_needed curl/curlbuild.h +then if action_needed curl/curlbuild.h curl/curlbuild.h.dist + then cp -p curl/curlbuild.h.dist curl/curlbuild.h + fi +fi + + +# Create the OS/400 source program file for the include files. + +SRCPF="${LIBIFSNAME}/H.FILE" + +if action_needed "${SRCPF}" +then CMD="CRTSRCPF FILE(${TARGETLIB}/H) RCDLEN(112)" + CMD="${CMD} CCSID(${TGTCCSID}) TEXT('curl: Header files')" + system "${CMD}" +fi + + +# Enumeration values are used as va_arg tagfields, so they MUST be +# integers. + +copy_hfile() + +{ + destfile="${1}" + srcfile="${2}" + shift + shift + sed -e '1i\ +#pragma enum(int)\ +' "${@}" -e '$a\ +#pragma enum(pop)\ +' < "${srcfile}" > "${destfile}" +} + +# Copy the header files. + +for HFILE in curl/*.h ${SCRIPTDIR}/ccsidcurl.h +do DEST="${SRCPF}/`db2_name \"${HFILE}\"`.MBR" + if action_needed "${DEST}" "${HFILE}" + then copy_hfile "${DEST}" "${HFILE}" + fi +done + + +# Copy the ILE/RPG include file, setting-up version number. + + versioned_copy "${SCRIPTDIR}/curl.inc.in" "${SRCPF}/CURL.INC.MBR" + + +# Duplicate file H as CURL to support more include path forms. + +if action_needed "${LIBIFSNAME}/CURL.FILE" +then : +else system "DLTF FILE(${TARGETLIB}/CURL)" +fi + +CMD="CRTDUPOBJ OBJ(H) FROMLIB(${TARGETLIB}) OBJTYPE(*FILE) TOLIB(*FROMLIB)" +CMD="${CMD} NEWOBJ(CURL) DATA(*YES)" +system "${CMD}" diff --git a/mobicore/common/curl/packages/OS400/make-lib.sh b/mobicore/common/curl/packages/OS400/make-lib.sh new file mode 100644 index 0000000000000000000000000000000000000000..b7f951b5a4a54b1b53229e82b8bc350d4d9260c0 --- /dev/null +++ b/mobicore/common/curl/packages/OS400/make-lib.sh @@ -0,0 +1,192 @@ +#!/bin/sh +# +# libcurl compilation script for the OS/400. +# + +SCRIPTDIR=`dirname "${0}"` +. "${SCRIPTDIR}/initscript.sh" +cd "${TOPDIR}/lib" + + +# Create and compile the identification source file. + +echo '#pragma comment(user, "libcurl version '"${LIBCURL_VERSION}"'")' > os400.c +echo '#pragma comment(date)' >> os400.c +echo '#pragma comment(copyright, "Copyright (C) 1998-2010 Daniel Stenberg et al. OS/400 version by P. Monnerat")' >> os400.c +make_module OS400 os400.c +LINK= # No need to rebuild service program yet. +MODULES= + + +# Get source list. + +CSOURCES() + +{ + shift # Drop the equal sign. + CSOURCES="$*" # Get the file names. +} + +HHEADERS() + +{ + shift # Drop the equal sign. + HHEADERS="$*" # Get the file names. +} + +. Makefile.inc + + +# Compile the sources into modules. + +INCLUDES="'`pwd`'" + +make_module OS400SYS "${SCRIPTDIR}/os400sys.c" +make_module CCSIDCURL "${SCRIPTDIR}/ccsidcurl.c" + +for SRC in ${CSOURCES} +do MODULE=`basename "${SRC}" .c | + tr '[a-z]' '[A-Z]' | + sed -e 's/^\(..........\).*/\1/'` + make_module "${MODULE}" "${SRC}" +done + + +# If needed, (re)create the static binding directory. + +if action_needed "${LIBIFSNAME}/${STATBNDDIR}.BNDDIR" +then LINK=YES +fi + +if [ "${LINK}" ] +then rm -rf "${LIBIFSNAME}/${STATBNDDIR}.BNDDIR" + CMD="CRTBNDDIR BNDDIR(${TARGETLIB}/${STATBNDDIR})" + CMD="${CMD} TEXT('LibCurl API static binding directory')" + system "${CMD}" + + for MODULE in ${MODULES} + do CMD="ADDBNDDIRE BNDDIR(${TARGETLIB}/${STATBNDDIR})" + CMD="${CMD} OBJ((${TARGETLIB}/${MODULE} *MODULE))" + system "${CMD}" + done +fi + + +# The exportation file for service program creation must be in a DB2 +# source file, so make sure it exists. + +if action_needed "${LIBIFSNAME}/TOOLS.FILE" +then CMD="CRTSRCPF FILE(${TARGETLIB}/TOOLS) RCDLEN(112)" + CMD="${CMD} TEXT('curl: build tools')" + system "${CMD}" +fi + + +# Gather the list of symbols to export. + +EXPORTS=`grep '^CURL_EXTERN[ ]' \ + "${TOPDIR}"/include/curl/*.h \ + "${SCRIPTDIR}/ccsidcurl.h" | + sed -e 's/^.*CURL_EXTERN[ ]\(.*\)(.*$/\1/' \ + -e 's/[ ]*$//' \ + -e 's/^.*[ ][ ]*//' \ + -e 's/^\*//' \ + -e 's/(\(.*\))/\1/'` + +# Create the service program exportation file in DB2 member if needed. + +BSF="${LIBIFSNAME}/TOOLS.FILE/BNDSRC.MBR" + +if action_needed "${BSF}" Makefile.am +then LINK=YES +fi + +if [ "${LINK}" ] +then echo " STRPGMEXP PGMLVL(*CURRENT) SIGNATURE('LIBCURL_${SONAME}')" \ + > "${BSF}" + for EXPORT in ${EXPORTS} + do echo ' EXPORT SYMBOL("'"${EXPORT}"'")' >> "${BSF}" + done + + echo ' ENDPGMEXP' >> "${BSF}" +fi + + +# Build the service program if needed. + +if action_needed "${LIBIFSNAME}/${SRVPGM}.SRVPGM" +then LINK=YES +fi + +if [ "${LINK}" ] +then CMD="CRTSRVPGM SRVPGM(${TARGETLIB}/${SRVPGM})" + CMD="${CMD} SRCFILE(${TARGETLIB}/TOOLS) SRCMBR(BNDSRC)" + CMD="${CMD} MODULE(${TARGETLIB}/OS400)" + CMD="${CMD} BNDDIR(${TARGETLIB}/${STATBNDDIR})" + CMD="${CMD} BNDSRVPGM(QADRTTS QGLDCLNT QGLDBRDR)" + CMD="${CMD} TEXT('curl API library')" + CMD="${CMD} TGTRLS(${TGTRLS})" + system "${CMD}" + LINK=YES +fi + + +# If needed, (re)create the dynamic binding directory. + +if action_needed "${LIBIFSNAME}/${DYNBNDDIR}.BNDDIR" +then LINK=YES +fi + +if [ "${LINK}" ] +then rm -rf "${LIBIFSNAME}/${DYNBNDDIR}.BNDDIR" + CMD="CRTBNDDIR BNDDIR(${TARGETLIB}/${DYNBNDDIR})" + CMD="${CMD} TEXT('LibCurl API dynamic binding directory')" + system "${CMD}" + CMD="ADDBNDDIRE BNDDIR(${TARGETLIB}/${DYNBNDDIR})" + CMD="${CMD} OBJ((*LIBL/${SRVPGM} *SRVPGM))" + system "${CMD}" +fi + + +# Rebuild the formdata test if needed. + +if [ "${TEST_FORMDATA}" ] +then MODULES= + make_module TFORMDATA formdata.c "'_FORM_DEBUG' 'CURLDEBUG'" + make_module TSTREQUAL strequal.c "'_FORM_DEBUG' 'CURLDEBUG'" + make_module TMEMDEBUG memdebug.c "'_FORM_DEBUG' 'CURLDEBUG'" + make_module TMPRINTF mprintf.c "'_FORM_DEBUG' 'CURLDEBUG'" + make_module TSTRERROR strerror.c "'_FORM_DEBUG' 'CURLDEBUG'" + # The following modules should not be needed (see comment in + # formdata.c. However, there are some unsatisfied + # external references leading in the following + # modules to be (recursively) needed. + MODULES="${MODULES} EASY STRDUP SSLGEN QSSL HOSTIP HOSTIP4 HOSTIP6" + MODULES="${MODULES} URL HASH TRANSFER GETINFO COOKIE SENDF SELECT" + MODULES="${MODULES} INET_NTOP SHARE HOSTTHRE MULTI LLIST FTP HTTP" + MODULES="${MODULES} HTTP_DIGES HTTP_CHUNK HTTP_NEGOT TIMEVAL HOSTSYN" + MODULES="${MODULES} CONNECT SOCKS PROGRESS ESCAPE INET_PTON GETENV" + MODULES="${MODULES} DICT LDAP TELNET FILE TFTP NETRC PARSEDATE" + MODULES="${MODULES} SPEEDCHECK SPLAY BASE64 SECURITY IF2IP MD5" + MODULES="${MODULES} KRB5 OS400SYS" + + PGMIFSNAME="${LIBIFSNAME}/TFORMDATA.PGM" + + if action_needed "${PGMIFSNAME}" + then LINK=YES + fi + + if [ "${LINK}" ] + then CMD="CRTPGM PGM(${TARGETLIB}/TFORMDATA)" + CMD="${CMD} ENTMOD(QADRT/QADRTMAIN2)" + CMD="${CMD} MODULE(" + + for MODULE in ${MODULES} + do CMD="${CMD} ${TARGETLIB}/${MODULE}" + done + + CMD="${CMD} ) BNDSRVPGM(QADRTTS)" + CMD="${CMD} TGTRLS(${TGTRLS})" + system "${CMD}" + fi +fi diff --git a/mobicore/common/curl/packages/OS400/make-src.sh b/mobicore/common/curl/packages/OS400/make-src.sh new file mode 100644 index 0000000000000000000000000000000000000000..090ae12874ba5c333fd2afbc0c20348e28b73f25 --- /dev/null +++ b/mobicore/common/curl/packages/OS400/make-src.sh @@ -0,0 +1,4 @@ +#!/bin/sh +# +# +# Not implemented yet on OS/400. diff --git a/mobicore/common/curl/packages/OS400/make-tests.sh b/mobicore/common/curl/packages/OS400/make-tests.sh new file mode 100644 index 0000000000000000000000000000000000000000..cee3ed95d2d08995e4bb5ce0e7b21dc567c8835f --- /dev/null +++ b/mobicore/common/curl/packages/OS400/make-tests.sh @@ -0,0 +1,114 @@ +#!/bin/sh +# +# tests compilation script for the OS/400. +# + + +SCRIPTDIR=`dirname "${0}"` +. "${SCRIPTDIR}/initscript.sh" +cd "${TOPDIR}/tests" + + +# tests directory not implemented yet. + + +# Process the libtest subdirectory. + +cd libtest + +# Get definitions from the Makefile.inc file. +# The `sed' statement works as follows: +# _ Join \nl-separated lines. +# _ Retain only lines that begins with "identifier =". +# _ Turn these lines into shell variable assignments. + +eval "`sed -e ': begin' \ + -e '/\\\\$/{' \ + -e 'N' \ + -e 's/\\\\\\n/ /' \ + -e 'b begin' \ + -e '}' \ + -e '/^[A-Za-z_][A-Za-z0-9_]*[ ]*[=]/b keep' \ + -e 'd' \ + -e ': keep' \ + -e 's/[ ]*=[ ]*/=/' \ + -e 's/=\\(.*[^ ]\\)[ ]*$/=\\"\\1\\"/' \ + -e 's/\\$(\\([^)]*\\))/${\\1}/g' \ + < Makefile.inc`" + +# Special case: redefine chkhostname compilation parameters. + +chkhostname_SOURCES=chkhostname.c +chkhostname_LDADD=curl_gethostname.o + +# Compile all programs. +# The list is found in variable "noinst_PROGRAMS" + +INCLUDES="'${TOPDIR}/tests/libtest' '${TOPDIR}/lib'" + +for PGM in ${noinst_PROGRAMS} +do DB2PGM=`db2_name "${PGM}"` + PGMIFSNAME="${LIBIFSNAME}/${DB2PGM}.PGM" + + # Extract preprocessor symbol definitions from compilation + # options for the program. + + PGMCFLAGS="`eval echo \"\\${${PGM}_CFLAGS}\"`" + PGMDEFINES= + + for FLAG in ${PGMCFLAGS} + do case "${FLAG}" in + -D?*) DEFINE="`echo \"${FLAG}\" | sed 's/^..//'`" + PGMDEFINES="${PGMDEFINES} '${DEFINE}'" + ;; + esac + done + + # Compile all C sources for the program into modules. + + PGMSOURCES="`eval echo \"\\${${PGM}_SOURCES}\"`" + LINK= + MODULES= + + for SOURCE in ${PGMSOURCES} + do case "${SOURCE}" in + *.c) # Special processing for libxxx.c files: their + # module name is determined by the target + # PROGRAM name. + + case "${SOURCE}" in + lib*.c) MODULE="${DB2PGM}" + ;; + *) MODULE=`db2_name "${SOURCE}"` + ;; + esac + + make_module "${MODULE}" "${SOURCE}" "${PGMDEFINES}" + if action_needed "${PGMIFSNAME}" "${MODIFSNAME}" + then LINK=yes + fi + ;; + esac + done + + # Link program if needed. + + if [ "${LINK}" ] + then PGMLDADD="`eval echo \"\\${${PGM}_LDADD}\"`" + for LDARG in ${PGMLDADD} + do case "${LDARG}" in + -*) ;; # Ignore non-module. + *) MODULES="${MODULES} "`db2_name "${LDARG}"` + ;; + esac + done + MODULES="`echo \"${MODULES}\" | + sed \"s/[^ ][^ ]*/${TARGETLIB}\/&/g\"`" + CMD="CRTPGM PGM(${TARGETLIB}/${DB2PGM})" + CMD="${CMD} ENTMOD(QADRT/QADRTMAIN2)" + CMD="${CMD} MODULE(${MODULES})" + CMD="${CMD} BNDSRVPGM(${TARGETLIB}/${SRVPGM} QADRTTS)" + CMD="${CMD} TGTRLS(${TGTRLS})" + system "${CMD}" + fi +done diff --git a/mobicore/common/curl/packages/OS400/makefile.sh b/mobicore/common/curl/packages/OS400/makefile.sh new file mode 100644 index 0000000000000000000000000000000000000000..1e67290d519771d78bb6171d47baa8fcf9377484 --- /dev/null +++ b/mobicore/common/curl/packages/OS400/makefile.sh @@ -0,0 +1,52 @@ +#!/bin/sh +# +# curl compilation script for the OS/400. +# +# +# This is a shell script since make is not a standard component of OS/400. + +SCRIPTDIR=`dirname "${0}"` +. "${SCRIPTDIR}/initscript.sh" +cd "${TOPDIR}" + + +# Create the OS/400 library if it does not exist. + +if action_needed "${LIBIFSNAME}" +then CMD="CRTLIB LIB(${TARGETLIB}) TEXT('curl: multiprotocol support API')" + system "${CMD}" +fi + + +# Create the DOCS source file if it does not exist. + +if action_needed "${LIBIFSNAME}/DOCS.FILE" +then CMD="CRTSRCPF FILE(${TARGETLIB}/DOCS) RCDLEN(112)" + CMD="${CMD} CCSID(${TGTCCSID}) TEXT('Documentation texts')" + system "${CMD}" +fi + + +# Copy some documentation files if needed. + +for TEXT in "${TOPDIR}/COPYING" "${SCRIPTDIR}/README.OS400" \ + "${TOPDIR}/CHANGES" "${TOPDIR}/docs/THANKS" "${TOPDIR}/docs/FAQ" \ + "${TOPDIR}/docs/FEATURES" "${TOPDIR}/docs/SSLCERTS" \ + "${TOPDIR}/docs/RESOURCES" "${TOPDIR}/docs/VERSIONS" \ + "${TOPDIR}/docs/HISTORY" +do MEMBER="`basename \"${TEXT}\" .OS400`" + MEMBER="${LIBIFSNAME}/DOCS.FILE/`db2_name \"${MEMBER}\"`.MBR" + + if action_needed "${MEMBER}" "${TEXT}" + then CMD="CPY OBJ('${TEXT}') TOOBJ('${MEMBER}') TOCCSID(${TGTCCSID})" + CMD="${CMD} DTAFMT(*TEXT) REPLACE(*YES)" + system "${CMD}" + fi +done + + +# Build in each directory. + +for SUBDIR in include lib src tests +do "${SCRIPTDIR}/make-${SUBDIR}.sh" +done diff --git a/mobicore/common/curl/packages/OS400/os400sys.c b/mobicore/common/curl/packages/OS400/os400sys.c new file mode 100644 index 0000000000000000000000000000000000000000..071fa482d1df41ce30287aed4c4eaacc55ca1fa3 --- /dev/null +++ b/mobicore/common/curl/packages/OS400/os400sys.c @@ -0,0 +1,1080 @@ +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) 1998 - 2010, Daniel Stenberg, , et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at http://curl.haxx.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + * + ***************************************************************************/ + +/* OS/400 additional support. */ + +#include "curlbuild.h" +#include "config-os400.h" /* Not setup.h: we only need some defines. */ + +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include + +#ifdef USE_QSOSSL +#include +#endif + +#ifdef HAVE_GSSAPI +#include +#endif + +#ifndef CURL_DISABLE_LDAP +#include +#endif + +#include +#include + +#include "os400sys.h" + + +/** +*** QADRT OS/400 ASCII runtime defines only the most used procedures, but +*** but a lot of them are not supported. This module implements +*** ASCII wrappers for those that are used by libcurl, but not +*** defined by QADRT. +**/ + +#pragma convert(0) /* Restore EBCDIC. */ + + +#define MIN_BYTE_GAIN 1024 /* Minimum gain when shortening a buffer. */ + +typedef struct { + unsigned long size; /* Buffer size. */ + char * buf; /* Buffer address. */ +} buffer_t; + + +static char * buffer_undef(localkey_t key, long size); +static char * buffer_threaded(localkey_t key, long size); +static char * buffer_unthreaded(localkey_t key, long size); + +static pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER; +static pthread_key_t thdkey; +static buffer_t * locbufs; + +char * (* Curl_thread_buffer)(localkey_t key, long size) = buffer_undef; + + +static void +thdbufdestroy(void * private) + +{ + localkey_t i; + buffer_t * p; + + if (private) { + p = (buffer_t *) private; + + for (i = (localkey_t) 0; i < LK_LAST; i++) { + if (p->buf) + free(p->buf); + + p++; + } + + free(private); + } +} + + +static void +terminate(void) + +{ + if (Curl_thread_buffer == buffer_threaded) { + locbufs = pthread_getspecific(thdkey); + pthread_setspecific(thdkey, (void *) NULL); + pthread_key_delete(thdkey); + } + + if (Curl_thread_buffer != buffer_undef) { + thdbufdestroy((void *) locbufs); + locbufs = (buffer_t *) NULL; + } + + Curl_thread_buffer = buffer_undef; +} + + +static char * +get_buffer(buffer_t * buf, long size) + +{ + char * cp; + + /* If `size' >= 0, make sure buffer at `buf' is at least `size'-byte long. + Return the buffer address. */ + + if (size < 0) + return buf->buf; + + if (!buf->buf) { + if ((buf->buf = malloc(size))) + buf->size = size; + + return buf->buf; + } + + if ((unsigned long) size <= buf->size) { + /* Shorten the buffer only if it frees a significant byte count. This + avoids some realloc() overhead. */ + + if (buf->size - size < MIN_BYTE_GAIN) + return buf->buf; + } + + /* Resize the buffer. */ + + if ((cp = realloc(buf->buf, size))) { + buf->buf = cp; + buf->size = size; + } + else if (size <= buf->size) + cp = buf->buf; + + return cp; +} + + +static char * +buffer_unthreaded(localkey_t key, long size) + +{ + return get_buffer(locbufs + key, size); +} + + +static char * +buffer_threaded(localkey_t key, long size) + +{ + buffer_t * bufs; + + /* Get the buffer for the given local key in the current thread, and + make sure it is at least `size'-byte long. Set `size' to < 0 to get + its address only. */ + + bufs = (buffer_t *) pthread_getspecific(thdkey); + + if (!bufs) { + if (size < 0) + return (char *) NULL; /* No buffer yet. */ + + /* Allocate buffer descriptors for the current thread. */ + + if (!(bufs = calloc((size_t) LK_LAST, sizeof *bufs))) + return (char *) NULL; + + if (pthread_setspecific(thdkey, (void *) bufs)) { + free(bufs); + return (char *) NULL; + } + } + + return get_buffer(bufs + key, size); +} + + +static char * +buffer_undef(localkey_t key, long size) + +{ + /* Define the buffer system, get the buffer for the given local key in + the current thread, and make sure it is at least `size'-byte long. + Set `size' to < 0 to get its address only. */ + + pthread_mutex_lock(&mutex); + + /* Determine if we can use pthread-specific data. */ + + if (Curl_thread_buffer == buffer_undef) { /* If unchanged during lock. */ + if (!pthread_key_create(&thdkey, thdbufdestroy)) + Curl_thread_buffer = buffer_threaded; + else if (!(locbufs = calloc((size_t) LK_LAST, + sizeof *locbufs))) { + pthread_mutex_unlock(&mutex); + return (char *) NULL; + } + else + Curl_thread_buffer = buffer_unthreaded; + + atexit(terminate); + } + + pthread_mutex_unlock(&mutex); + return Curl_thread_buffer(key, size); +} + + +int +Curl_getnameinfo_a(const struct sockaddr * sa, curl_socklen_t salen, + char * nodename, curl_socklen_t nodenamelen, + char * servname, curl_socklen_t servnamelen, + int flags) + +{ + char * enodename; + char * eservname; + int status; + int i; + + enodename = (char *) NULL; + eservname = (char *) NULL; + + if (nodename && nodenamelen) + if (!(enodename = malloc(nodenamelen))) + return EAI_MEMORY; + + if (servname && servnamelen) + if (!(eservname = malloc(servnamelen))) { + if (enodename) + free(enodename); + + return EAI_MEMORY; + } + + status = getnameinfo(sa, salen, enodename, nodenamelen, + eservname, servnamelen, flags); + + if (!status) { + if (enodename) { + i = QadrtConvertE2A(nodename, enodename, + nodenamelen - 1, strlen(enodename)); + nodename[i] = '\0'; + } + + if (eservname) { + i = QadrtConvertE2A(servname, eservname, + servnamelen - 1, strlen(eservname)); + servname[i] = '\0'; + } + } + + if (enodename) + free(enodename); + + if (eservname) + free(eservname); + + return status; +} + + +int +Curl_getaddrinfo_a(const char * nodename, const char * servname, + const struct addrinfo * hints, + struct addrinfo * * res) + +{ + char * enodename; + char * eservname; + int status; + int i; + + enodename = (char *) NULL; + eservname = (char *) NULL; + + if (nodename) { + i = strlen(nodename); + + if (!(enodename = malloc(i + 1))) + return EAI_MEMORY; + + i = QadrtConvertA2E(enodename, nodename, i, i); + enodename[i] = '\0'; + } + + if (servname) { + i = strlen(servname); + + if (!(eservname = malloc(i + 1))) { + if (enodename) + free(enodename); + + return EAI_MEMORY; + } + + QadrtConvertA2E(eservname, servname, i, i); + eservname[i] = '\0'; + } + + status = getaddrinfo(enodename, eservname, hints, res); + + if (enodename) + free(enodename); + + if (eservname) + free(eservname); + + return status; +} + + +#ifdef USE_QSOSSL + +/* ASCII wrappers for the SSL procedures. */ + +int +Curl_SSL_Init_Application_a(SSLInitApp * init_app) + +{ + int rc; + unsigned int i; + SSLInitApp ia; + + if (!init_app || !init_app->applicationID || !init_app->applicationIDLen) + return SSL_Init_Application(init_app); + + memcpy((char *) &ia, (char *) init_app, sizeof ia); + i = ia.applicationIDLen; + + if (!(ia.applicationID = malloc(i + 1))) { + errno = ENOMEM; + return SSL_ERROR_IO; + } + + QadrtConvertA2E(ia.applicationID, init_app->applicationID, i, i); + ia.applicationID[i] = '\0'; + rc = SSL_Init_Application(&ia); + free(ia.applicationID); + init_app->localCertificateLen = ia.localCertificateLen; + init_app->sessionType = ia.sessionType; + return rc; +} + + +int +Curl_SSL_Init_a(SSLInit * init) + +{ + int rc; + unsigned int i; + SSLInit ia; + + if (!init || (!init->keyringFileName && !init->keyringPassword)) + return SSL_Init(init); + + memcpy((char *) &ia, (char *) init, sizeof ia); + + if (ia.keyringFileName) { + i = strlen(ia.keyringFileName); + + if (!(ia.keyringFileName = malloc(i + 1))) { + errno = ENOMEM; + return SSL_ERROR_IO; + } + + QadrtConvertA2E(ia.keyringFileName, init->keyringFileName, i, i); + ia.keyringFileName[i] = '\0'; + } + + if (ia.keyringPassword) { + i = strlen(ia.keyringPassword); + + if (!(ia.keyringPassword = malloc(i + 1))) { + if (ia.keyringFileName) + free(ia.keyringFileName); + + errno = ENOMEM; + return SSL_ERROR_IO; + } + + QadrtConvertA2E(ia.keyringPassword, init->keyringPassword, i, i); + ia.keyringPassword[i] = '\0'; + } + + rc = SSL_Init(&ia); + + if (ia.keyringFileName) + free(ia.keyringFileName); + + if (ia.keyringPassword) + free(ia.keyringPassword); + + return rc; +} + + +char * +Curl_SSL_Strerror_a(int sslreturnvalue, SSLErrorMsg * serrmsgp) + +{ + int i; + char * cp; + char * cp2; + + cp = SSL_Strerror(sslreturnvalue, serrmsgp); + + if (!cp) + return cp; + + i = strlen(cp); + + if (!(cp2 = Curl_thread_buffer(LK_SSL_ERROR, MAX_CONV_EXPANSION * i + 1))) + return cp2; + + i = QadrtConvertE2A(cp2, cp, MAX_CONV_EXPANSION * i, i); + cp2[i] = '\0'; + return cp2; +} + +#endif /* USE_QSOSSL */ + + +#ifdef HAVE_GSSAPI + +/* ASCII wrappers for the GSSAPI procedures. */ + +static int +Curl_gss_convert_in_place(OM_uint32 * minor_status, gss_buffer_t buf) + +{ + unsigned int i; + char * t; + + /* Convert `buf' in place, from EBCDIC to ASCII. + If error, release the buffer and return -1. Else return 0. */ + + i = buf->length; + + if (i) { + if (!(t = malloc(i))) { + gss_release_buffer(minor_status, buf); + + if (minor_status) + *minor_status = ENOMEM; + + return -1; + } + + QadrtConvertE2A(t, buf->value, i, i); + memcpy(buf->value, t, i); + free(t); + } + + return 0; +} + + +OM_uint32 +Curl_gss_import_name_a(OM_uint32 * minor_status, gss_buffer_t in_name, + gss_OID in_name_type, gss_name_t * out_name) + +{ + int rc; + unsigned int i; + gss_buffer_desc in; + + if (!in_name || !in_name->value || !in_name->length) + return gss_import_name(minor_status, in_name, in_name_type, out_name); + + memcpy((char *) &in, (char *) in_name, sizeof in); + i = in.length; + + if (!(in.value = malloc(i + 1))) { + if (minor_status) + *minor_status = ENOMEM; + + return GSS_S_FAILURE; + } + + QadrtConvertA2E(in.value, in_name->value, i, i); + ((char *) in.value)[i] = '\0'; + rc = gss_import_name(minor_status, &in, in_name_type, out_name); + free(in.value); + return rc; +} + + +OM_uint32 +Curl_gss_display_status_a(OM_uint32 * minor_status, OM_uint32 status_value, + int status_type, gss_OID mech_type, + gss_msg_ctx_t * message_context, gss_buffer_t status_string) + +{ + int rc; + + rc = gss_display_status(minor_status, status_value, status_type, + mech_type, message_context, status_string); + + if (rc != GSS_S_COMPLETE || !status_string || + !status_string->length || !status_string->value) + return rc; + + /* No way to allocate a buffer here, because it will be released by + gss_release_buffer(). The solution is to overwrite the EBCDIC buffer + with ASCII to return it. */ + + if (Curl_gss_convert_in_place(minor_status, status_string)) + return GSS_S_FAILURE; + + return rc; +} + + +OM_uint32 +Curl_gss_init_sec_context_a(OM_uint32 * minor_status, gss_cred_id_t cred_handle, + gss_ctx_id_t * context_handle, + gss_name_t target_name, gss_OID mech_type, + gss_flags_t req_flags, OM_uint32 time_req, + gss_channel_bindings_t input_chan_bindings, + gss_buffer_t input_token, + gss_OID * actual_mech_type, + gss_buffer_t output_token, gss_flags_t * ret_flags, + OM_uint32 * time_rec) + +{ + int rc; + unsigned int i; + gss_buffer_desc in; + gss_buffer_t inp; + + in.value = NULL; + + if ((inp = input_token)) + if (inp->length && inp->value) { + i = inp->length; + + if (!(in.value = malloc(i + 1))) { + if (minor_status) + *minor_status = ENOMEM; + + return GSS_S_FAILURE; + } + + QadrtConvertA2E(in.value, input_token->value, i, i); + ((char *) in.value)[i] = '\0'; + in.length = i; + inp = ∈ + } + + rc = gss_init_sec_context(minor_status, cred_handle, context_handle, + target_name, mech_type, req_flags, time_req, + input_chan_bindings, inp, actual_mech_type, + output_token, ret_flags, time_rec); + + if (in.value) + free(in.value); + + if (rc != GSS_S_COMPLETE || !output_token || + !output_token->length || !output_token->value) + return rc; + + /* No way to allocate a buffer here, because it will be released by + gss_release_buffer(). The solution is to overwrite the EBCDIC buffer + with ASCII to return it. */ + + if (Curl_gss_convert_in_place(minor_status, output_token)) + return GSS_S_FAILURE; + + return rc; +} + + +OM_uint32 +Curl_gss_delete_sec_context_a(OM_uint32 * minor_status, + gss_ctx_id_t * context_handle, + gss_buffer_t output_token) + +{ + int rc; + + rc = gss_delete_sec_context(minor_status, context_handle, output_token); + + if (rc != GSS_S_COMPLETE || !output_token || + !output_token->length || !output_token->value) + return rc; + + /* No way to allocate a buffer here, because it will be released by + gss_release_buffer(). The solution is to overwrite the EBCDIC buffer + with ASCII to return it. */ + + if (Curl_gss_convert_in_place(minor_status, output_token)) + return GSS_S_FAILURE; + + return rc; +} + +#endif /* HAVE_GSSAPI */ + + +#ifndef CURL_DISABLE_LDAP + +/* ASCII wrappers for the LDAP procedures. */ + +void * +Curl_ldap_init_a(char * host, int port) + +{ + unsigned int i; + char * ehost; + void * result; + + if (!host) + return (void *) ldap_init(host, port); + + i = strlen(host); + + if (!(ehost = malloc(i + 1))) + return (void *) NULL; + + QadrtConvertA2E(ehost, host, i, i); + ehost[i] = '\0'; + result = (void *) ldap_init(ehost, port); + free(ehost); + return result; +} + + +int +Curl_ldap_simple_bind_s_a(void * ld, char * dn, char * passwd) + +{ + int i; + char * edn; + char * epasswd; + + edn = (char *) NULL; + epasswd = (char *) NULL; + + if (dn) { + i = strlen(dn); + + if (!(edn = malloc(i + 1))) + return LDAP_NO_MEMORY; + + QadrtConvertA2E(edn, dn, i, i); + edn[i] = '\0'; + } + + if (passwd) { + i = strlen(passwd); + + if (!(epasswd = malloc(i + 1))) { + if (edn) + free(edn); + + return LDAP_NO_MEMORY; + } + + QadrtConvertA2E(epasswd, passwd, i, i); + epasswd[i] = '\0'; + } + + i = ldap_simple_bind_s(ld, edn, epasswd); + + if (epasswd) + free(epasswd); + + if (edn) + free(edn); + + return i; +} + + +int +Curl_ldap_search_s_a(void * ld, char * base, int scope, char * filter, + char * * attrs, int attrsonly, LDAPMessage * * res) + +{ + int i; + int j; + char * ebase; + char * efilter; + char * * eattrs; + int status; + + ebase = (char *) NULL; + efilter = (char *) NULL; + eattrs = (char * *) NULL; + status = LDAP_SUCCESS; + + if (base) { + i = strlen(base); + + if (!(ebase = malloc(i + 1))) + status = LDAP_NO_MEMORY; + else { + QadrtConvertA2E(ebase, base, i, i); + ebase[i] = '\0'; + } + } + + if (filter && status == LDAP_SUCCESS) { + i = strlen(filter); + + if (!(efilter = malloc(i + 1))) + status = LDAP_NO_MEMORY; + else { + QadrtConvertA2E(efilter, filter, i, i); + efilter[i] = '\0'; + } + } + + if (attrs && status == LDAP_SUCCESS) { + for (i = 0; attrs[i++];) + ; + + if (!(eattrs = calloc(i, sizeof *eattrs))) + status = LDAP_NO_MEMORY; + else { + for (j = 0; attrs[j]; j++) { + i = strlen(attrs[j]); + + if (!(eattrs[j] = malloc(i + 1))) { + status = LDAP_NO_MEMORY; + break; + } + + QadrtConvertA2E(eattrs[j], attrs[j], i, i); + eattrs[j][i] = '\0'; + } + } + } + + if (status == LDAP_SUCCESS) + status = ldap_search_s(ld, ebase? ebase: "", scope, + efilter? efilter: "(objectclass=*)", + eattrs, attrsonly, res); + + if (eattrs) { + for (j = 0; eattrs[j]; j++) + free(eattrs[j]); + + free(eattrs); + } + + if (efilter) + free(efilter); + + if (ebase) + free(ebase); + + return status; +} + + +struct berval * * +Curl_ldap_get_values_len_a(void * ld, LDAPMessage * entry, const char * attr) + +{ + int i; + char * cp; + struct berval * * result; + + cp = (char *) NULL; + + if (attr) { + i = strlen(attr); + + if (!(cp = malloc(i + 1))) { + ldap_set_lderrno(ld, LDAP_NO_MEMORY, NULL, + ldap_err2string(LDAP_NO_MEMORY)); + return (struct berval * *) NULL; + } + + QadrtConvertA2E(cp, attr, i, i); + cp[i] = '\0'; + } + + result = ldap_get_values_len(ld, entry, cp); + + if (cp) + free(cp); + + /* Result data are binary in nature, so they haven't been converted to EBCDIC. + Therefore do not convert. */ + + return result; +} + + +char * +Curl_ldap_err2string_a(int error) + +{ + int i; + char * cp; + char * cp2; + + cp = ldap_err2string(error); + + if (!cp) + return cp; + + i = strlen(cp); + + if (!(cp2 = Curl_thread_buffer(LK_LDAP_ERROR, MAX_CONV_EXPANSION * i + 1))) + return cp2; + + i = QadrtConvertE2A(cp2, cp, MAX_CONV_EXPANSION * i, i); + cp2[i] = '\0'; + return cp2; +} + + +char * +Curl_ldap_get_dn_a(void * ld, LDAPMessage * entry) + +{ + int i; + char * cp; + char * cp2; + + cp = ldap_get_dn(ld, entry); + + if (!cp) + return cp; + + i = strlen(cp); + + if (!(cp2 = malloc(i + 1))) + return cp2; + + QadrtConvertE2A(cp2, cp, i, i); + + /* No way to allocate a buffer here, because it will be released by + ldap_memfree() and ldap_memalloc() does not exist. The solution is to + overwrite the EBCDIC buffer with ASCII to return it. */ + + strcpy(cp, cp2); + free(cp2); + return cp; +} + + +char * +Curl_ldap_first_attribute_a(void * ld, + LDAPMessage * entry, BerElement * * berptr) + +{ + int i; + char * cp; + char * cp2; + + cp = ldap_first_attribute(ld, entry, berptr); + + if (!cp) + return cp; + + i = strlen(cp); + + if (!(cp2 = malloc(i + 1))) + return cp2; + + QadrtConvertE2A(cp2, cp, i, i); + + /* No way to allocate a buffer here, because it will be released by + ldap_memfree() and ldap_memalloc() does not exist. The solution is to + overwrite the EBCDIC buffer with ASCII to return it. */ + + strcpy(cp, cp2); + free(cp2); + return cp; +} + + +char * +Curl_ldap_next_attribute_a(void * ld, + LDAPMessage * entry, BerElement * berptr) + +{ + int i; + char * cp; + char * cp2; + + cp = ldap_next_attribute(ld, entry, berptr); + + if (!cp) + return cp; + + i = strlen(cp); + + if (!(cp2 = malloc(i + 1))) + return cp2; + + QadrtConvertE2A(cp2, cp, i, i); + + /* No way to allocate a buffer here, because it will be released by + ldap_memfree() and ldap_memalloc() does not exist. The solution is to + overwrite the EBCDIC buffer with ASCII to return it. */ + + strcpy(cp, cp2); + free(cp2); + return cp; +} + +#endif /* CURL_DISABLE_LDAP */ + + +static int +convert_sockaddr(struct sockaddr_storage * dstaddr, + const struct sockaddr * srcaddr, int srclen) + +{ + const struct sockaddr_un * srcu; + struct sockaddr_un * dstu; + unsigned int i; + unsigned int dstsize; + + /* Convert a socket address into job CCSID, if needed. */ + + if (!srcaddr || srclen < offsetof(struct sockaddr, sa_family) + + sizeof srcaddr->sa_family || srclen > sizeof *dstaddr) { + errno = EINVAL; + return -1; + } + + memcpy((char *) dstaddr, (char *) srcaddr, srclen); + + switch (srcaddr->sa_family) { + + case AF_UNIX: + srcu = (const struct sockaddr_un *) srcaddr; + dstu = (struct sockaddr_un *) dstaddr; + dstsize = sizeof *dstaddr - offsetof(struct sockaddr_un, sun_path); + srclen -= offsetof(struct sockaddr_un, sun_path); + i = QadrtConvertA2E(dstu->sun_path, srcu->sun_path, dstsize - 1, srclen); + dstu->sun_path[i] = '\0'; + i += offsetof(struct sockaddr_un, sun_path); + srclen = i; + } + + return srclen; +} + + +int +Curl_os400_connect(int sd, struct sockaddr * destaddr, int addrlen) + +{ + int i; + struct sockaddr_storage laddr; + + i = convert_sockaddr(&laddr, destaddr, addrlen); + + if (i < 0) + return -1; + + return connect(sd, (struct sockaddr *) &laddr, i); +} + + +int +Curl_os400_bind(int sd, struct sockaddr * localaddr, int addrlen) + +{ + int i; + struct sockaddr_storage laddr; + + i = convert_sockaddr(&laddr, localaddr, addrlen); + + if (i < 0) + return -1; + + return bind(sd, (struct sockaddr *) &laddr, i); +} + + +int +Curl_os400_sendto(int sd, char * buffer, int buflen, int flags, + struct sockaddr * dstaddr, int addrlen) + +{ + int i; + struct sockaddr_storage laddr; + + i = convert_sockaddr(&laddr, dstaddr, addrlen); + + if (i < 0) + return -1; + + return sendto(sd, buffer, buflen, flags, (struct sockaddr *) &laddr, i); +} + + +int +Curl_os400_recvfrom(int sd, char * buffer, int buflen, int flags, + struct sockaddr * fromaddr, int * addrlen) + +{ + int i; + int rcvlen; + int laddrlen; + const struct sockaddr_un * srcu; + struct sockaddr_un * dstu; + struct sockaddr_storage laddr; + + if (!fromaddr || !addrlen || *addrlen <= 0) + return recvfrom(sd, buffer, buflen, flags, fromaddr, addrlen); + + laddrlen = sizeof laddr; + laddr.ss_family = AF_UNSPEC; /* To detect if unused. */ + rcvlen = recvfrom(sd, buffer, buflen, flags, + (struct sockaddr *) &laddr, &laddrlen); + + if (rcvlen < 0) + return rcvlen; + + switch (laddr.ss_family) { + + case AF_UNIX: + srcu = (const struct sockaddr_un *) &laddr; + dstu = (struct sockaddr_un *) fromaddr; + i = *addrlen - offsetof(struct sockaddr_un, sun_path); + laddrlen -= offsetof(struct sockaddr_un, sun_path); + i = QadrtConvertE2A(dstu->sun_path, srcu->sun_path, i, laddrlen); + laddrlen = i + offsetof(struct sockaddr_un, sun_path); + + if (laddrlen < *addrlen) + dstu->sun_path[i] = '\0'; + + break; + + case AF_UNSPEC: + break; + + default: + if (laddrlen > *addrlen) + laddrlen = *addrlen; + + if (laddrlen) + memcpy((char *) fromaddr, (char *) &laddr, laddrlen); + + break; + } + + *addrlen = laddrlen; + return rcvlen; +} diff --git a/mobicore/common/curl/packages/OS400/os400sys.h b/mobicore/common/curl/packages/OS400/os400sys.h new file mode 100644 index 0000000000000000000000000000000000000000..e708365e0cece5cdf4133b630745bc5e65afe4f9 --- /dev/null +++ b/mobicore/common/curl/packages/OS400/os400sys.h @@ -0,0 +1,52 @@ +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) 1998 - 2008, Daniel Stenberg, , et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at http://curl.haxx.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + * + ***************************************************************************/ + +/* OS/400 additional definitions. */ + +#ifndef __OS400_SYS_ +#define __OS400_SYS_ + + +/* Per-thread item identifiers. */ + +typedef enum { + LK_SSL_ERROR, + LK_LDAP_ERROR, + LK_CURL_VERSION, + LK_VERSION_INFO, + LK_VERSION_INFO_DATA, + LK_EASY_STRERROR, + LK_SHARE_STRERROR, + LK_MULTI_STRERROR, + LK_LAST +} localkey_t; + + +extern char * (* Curl_thread_buffer)(localkey_t key, long size); + + +/* Maximum string expansion factor due to character code conversion. */ + +#define MAX_CONV_EXPANSION 4 /* Can deal with UTF-8. */ + +#endif diff --git a/mobicore/common/curl/packages/README b/mobicore/common/curl/packages/README new file mode 100644 index 0000000000000000000000000000000000000000..2487d95d03461b6df64f9fb5dfe0005bab770fbe --- /dev/null +++ b/mobicore/common/curl/packages/README @@ -0,0 +1,27 @@ + _ _ ____ _ + ___| | | | _ \| | + / __| | | | |_) | | + | (__| |_| | _ <| |___ + \___|\___/|_| \_\_____| + +PACKAGES + + This directory and all its subdirectories are for special package +information, template, scripts and docs. The files herein should be of use for +those of you who want to package curl in a binary or source format using one +of those custom formats. + + The hierarchy for these directories is something like this: + + packages/[OS]/[FORMAT]/ + + Currently, we have Win32 and Linux for [OS]. There might be different formats +for the same OS so for Linux we have RPM as format. + + We might need to add some differentiation for CPU as well, as there is +Linux-RPMs for several CPUs. However, it might not be necessary since the +packaging should be pretty much the same no matter what CPU that is used. + + For each unique OS-FORMAT pair, there's a directory to "fill"! I'd like to +see a single README with as much details as possible, and then I'd like some +template files for the package process. diff --git a/mobicore/common/curl/packages/Solaris/Makefile.am b/mobicore/common/curl/packages/Solaris/Makefile.am new file mode 100644 index 0000000000000000000000000000000000000000..d0129479f072d583a38701e2f916d52f28774eb4 --- /dev/null +++ b/mobicore/common/curl/packages/Solaris/Makefile.am @@ -0,0 +1,38 @@ +# +# + +PKGADD_PKG="@PKGADD_PKG@" +PKGADD_NAME="@PACKAGE@-@VERSION@ - @PKGADD_NAME@" +PKGADD_VENDOR="@PKGADD_VENDOR@" +PKGADD_ARCH="@host_cpu@" +PKGADD_DESC="@PACKAGE@-@VERSION@ - @PKGADD_NAME@" +PKGADD_CLASSES=none +PKGADD_BASEDIR=/ + +PKGADD_FILE=${PKGADD_PKG}-@PACKAGE@-@VERSION@-@host@.pkg + +package: + if [ ! -f release ]; then echo 0 > release; fi + if [ `find root -newer release -print|wc -l` -gt 0 ]; then expr `cat release` + 1 > release; fi + echo PKG=${PKGADD_PKG} > pkginfo + echo NAME=${PKGADD_NAME} >> pkginfo + echo VENDOR=${PKGADD_VENDOR} >> pkginfo + echo ARCH=${PKGADD_ARCH} >> pkginfo + echo DESC=${PKGADD_DESC} >> pkginfo + echo CLASSES=${PKGADD_CLASSES} >> pkginfo + echo BASEDIR=${PKGADD_BASEDIR} >> pkginfo + echo CATEGORY=application >> pkginfo + echo VERSION=`cat ./release` >> pkginfo + echo > prototype + for subdir in opt var etc usr; \ + do if [ -d root/$$subdir ]; then \ + pkgproto root/$$subdir=$$subdir >> prototype;\ + fi; done + for file in pkginfo preinstall postinstall copyright; \ + do if [ -f $$file ]; then \ + echo "i $$file=$$file" >> prototype; \ + fi; done + rm -rf ./tmp + mkdir ./tmp + pkgmk -o -d ./tmp + pkgtrans -so ./tmp ${top_srcdir}/../${PKGADD_FILE} ${PKGADD_PKG} diff --git a/mobicore/common/curl/packages/Solaris/Makefile.in b/mobicore/common/curl/packages/Solaris/Makefile.in new file mode 100644 index 0000000000000000000000000000000000000000..951ac0cb4f4cc837955ba404ae7665a1e6d6c332 --- /dev/null +++ b/mobicore/common/curl/packages/Solaris/Makefile.in @@ -0,0 +1,438 @@ +# Makefile.in generated by automake 1.9.6 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005 Free Software Foundation, Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + +# +# +srcdir = @srcdir@ +top_srcdir = @top_srcdir@ +VPATH = @srcdir@ +pkgdatadir = $(datadir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +top_builddir = ../.. +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +INSTALL = @INSTALL@ +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +subdir = packages/Solaris +DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/m4/curl-compilers.m4 \ + $(top_srcdir)/m4/curl-confopts.m4 \ + $(top_srcdir)/m4/curl-functions.m4 \ + $(top_srcdir)/m4/curl-override.m4 \ + $(top_srcdir)/m4/curl-reentrant.m4 \ + $(top_srcdir)/m4/curl-system.m4 $(top_srcdir)/m4/libtool.m4 \ + $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ + $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ + $(top_srcdir)/acinclude.m4 $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs +CONFIG_HEADER = $(top_builddir)/lib/curl_config.h \ + $(top_builddir)/src/curl_config.h \ + $(top_builddir)/include/curl/curlbuild.h +CONFIG_CLEAN_FILES = +SOURCES = +DIST_SOURCES = +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +AMDEP_FALSE = @AMDEP_FALSE@ +AMDEP_TRUE = @AMDEP_TRUE@ +AMTAR = @AMTAR@ +AR = @AR@ +AS = @AS@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +BUILD_LIBHOSTNAME_FALSE = @BUILD_LIBHOSTNAME_FALSE@ +BUILD_LIBHOSTNAME_TRUE = @BUILD_LIBHOSTNAME_TRUE@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CONFIGURE_OPTIONS = @CONFIGURE_OPTIONS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CROSSCOMPILING_FALSE = @CROSSCOMPILING_FALSE@ +CROSSCOMPILING_TRUE = @CROSSCOMPILING_TRUE@ +CURLDEBUG_FALSE = @CURLDEBUG_FALSE@ +CURLDEBUG_TRUE = @CURLDEBUG_TRUE@ +CURL_CA_BUNDLE = @CURL_CA_BUNDLE@ +CURL_CFLAG_EXTRAS = @CURL_CFLAG_EXTRAS@ +CURL_DISABLE_DICT = @CURL_DISABLE_DICT@ +CURL_DISABLE_FILE = @CURL_DISABLE_FILE@ +CURL_DISABLE_FTP = @CURL_DISABLE_FTP@ +CURL_DISABLE_GOPHER = @CURL_DISABLE_GOPHER@ +CURL_DISABLE_HTTP = @CURL_DISABLE_HTTP@ +CURL_DISABLE_IMAP = @CURL_DISABLE_IMAP@ +CURL_DISABLE_LDAP = @CURL_DISABLE_LDAP@ +CURL_DISABLE_LDAPS = @CURL_DISABLE_LDAPS@ +CURL_DISABLE_POP3 = @CURL_DISABLE_POP3@ +CURL_DISABLE_PROXY = @CURL_DISABLE_PROXY@ +CURL_DISABLE_RTSP = @CURL_DISABLE_RTSP@ +CURL_DISABLE_SMTP = @CURL_DISABLE_SMTP@ +CURL_DISABLE_TELNET = @CURL_DISABLE_TELNET@ +CURL_DISABLE_TFTP = @CURL_DISABLE_TFTP@ +CURL_LIBS = @CURL_LIBS@ +CURL_NETWORK_LIBS = @CURL_NETWORK_LIBS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DLLTOOL = @DLLTOOL@ +DSYMUTIL = @DSYMUTIL@ +DUMPBIN = @DUMPBIN@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +ENABLE_SHARED = @ENABLE_SHARED@ +EXEEXT = @EXEEXT@ +FGREP = @FGREP@ +GREP = @GREP@ +HAVE_LDAP_SSL = @HAVE_LDAP_SSL@ +HAVE_LIBZ = @HAVE_LIBZ@ +HAVE_LIBZ_FALSE = @HAVE_LIBZ_FALSE@ +HAVE_LIBZ_TRUE = @HAVE_LIBZ_TRUE@ +HAVE_PK11_CREATEGENERICOBJECT = @HAVE_PK11_CREATEGENERICOBJECT@ +IDN_ENABLED = @IDN_ENABLED@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +IPV6_ENABLED = @IPV6_ENABLED@ +KRB4_ENABLED = @KRB4_ENABLED@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LIBCURL_LIBS = @LIBCURL_LIBS@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +MAINT = @MAINT@ +MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@ +MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@ +MAKEINFO = @MAKEINFO@ +MANOPT = @MANOPT@ +MIMPURE_FALSE = @MIMPURE_FALSE@ +MIMPURE_TRUE = @MIMPURE_TRUE@ +NM = @NM@ +NMEDIT = @NMEDIT@ +NO_UNDEFINED_FALSE = @NO_UNDEFINED_FALSE@ +NO_UNDEFINED_TRUE = @NO_UNDEFINED_TRUE@ +NROFF = @NROFF@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +OTOOL = @OTOOL@ +OTOOL64 = @OTOOL64@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH = @PATH@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PERL = @PERL@ +PKGADD_NAME = "@PACKAGE@-@VERSION@ - @PKGADD_NAME@" +PKGADD_PKG = "@PKGADD_PKG@" +PKGADD_VENDOR = "@PKGADD_VENDOR@" +PKGCONFIG = @PKGCONFIG@ +RANDOM_FILE = @RANDOM_FILE@ +RANLIB = @RANLIB@ +REQUIRE_LIB_DEPS = @REQUIRE_LIB_DEPS@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +SONAME_BUMP_FALSE = @SONAME_BUMP_FALSE@ +SONAME_BUMP_TRUE = @SONAME_BUMP_TRUE@ +SSL_ENABLED = @SSL_ENABLED@ +STATICLIB_FALSE = @STATICLIB_FALSE@ +STATICLIB_TRUE = @STATICLIB_TRUE@ +STRIP = @STRIP@ +SUPPORT_FEATURES = @SUPPORT_FEATURES@ +SUPPORT_PROTOCOLS = @SUPPORT_PROTOCOLS@ +TEST_SERVER_LIBS = @TEST_SERVER_LIBS@ +USE_ARES = @USE_ARES@ +USE_EMBEDDED_ARES_FALSE = @USE_EMBEDDED_ARES_FALSE@ +USE_EMBEDDED_ARES_TRUE = @USE_EMBEDDED_ARES_TRUE@ +USE_GNUTLS = @USE_GNUTLS@ +USE_LIBRTMP = @USE_LIBRTMP@ +USE_LIBSSH2 = @USE_LIBSSH2@ +USE_MANUAL_FALSE = @USE_MANUAL_FALSE@ +USE_MANUAL_TRUE = @USE_MANUAL_TRUE@ +USE_NSS = @USE_NSS@ +USE_OPENLDAP = @USE_OPENLDAP@ +USE_POLARSSL = @USE_POLARSSL@ +USE_SSLEAY = @USE_SSLEAY@ +USE_WINDOWS_SSPI = @USE_WINDOWS_SSPI@ +VERSION = @VERSION@ +VERSIONNUM = @VERSIONNUM@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ +am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ +am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +libext = @libext@ +localedir = @localedir@ +localstatedir = @localstatedir@ +lt_ECHO = @lt_ECHO@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +subdirs = @subdirs@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +PKGADD_ARCH = "@host_cpu@" +PKGADD_DESC = "@PACKAGE@-@VERSION@ - @PKGADD_NAME@" +PKGADD_CLASSES = none +PKGADD_BASEDIR = / +PKGADD_FILE = ${PKGADD_PKG}-@PACKAGE@-@VERSION@-@host@.pkg +all: all-am + +.SUFFIXES: +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ + && exit 0; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu packages/Solaris/Makefile'; \ + cd $(top_srcdir) && \ + $(AUTOMAKE) --gnu packages/Solaris/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +distclean-libtool: + -rm -f libtool +uninstall-info-am: +tags: TAGS +TAGS: + +ctags: CTAGS +CTAGS: + + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ + list='$(DISTFILES)'; for file in $$list; do \ + case $$file in \ + $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ + $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ + esac; \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test "$$dir" != "$$file" && test "$$dir" != "."; then \ + dir="/$$dir"; \ + $(mkdir_p) "$(distdir)$$dir"; \ + else \ + dir=''; \ + fi; \ + if test -d $$d/$$file; then \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ + fi; \ + cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ + else \ + test -f $(distdir)/$$file \ + || cp -p $$d/$$file $(distdir)/$$file \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile +installdirs: +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-generic clean-libtool mostlyclean-am + +distclean: distclean-am + -rm -f Makefile +distclean-am: clean-am distclean-generic distclean-libtool + +dvi: dvi-am + +dvi-am: + +html: html-am + +info: info-am + +info-am: + +install-data-am: + +install-exec-am: + +install-info: install-info-am + +install-man: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-generic mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: uninstall-info-am + +.PHONY: all all-am check check-am clean clean-generic clean-libtool \ + distclean distclean-generic distclean-libtool distdir dvi \ + dvi-am html html-am info info-am install install-am \ + install-data install-data-am install-exec install-exec-am \ + install-info install-info-am install-man install-strip \ + installcheck installcheck-am installdirs maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-generic \ + mostlyclean-libtool pdf pdf-am ps ps-am uninstall uninstall-am \ + uninstall-info-am + + +package: + if [ ! -f release ]; then echo 0 > release; fi + if [ `find root -newer release -print|wc -l` -gt 0 ]; then expr `cat release` + 1 > release; fi + echo PKG=${PKGADD_PKG} > pkginfo + echo NAME=${PKGADD_NAME} >> pkginfo + echo VENDOR=${PKGADD_VENDOR} >> pkginfo + echo ARCH=${PKGADD_ARCH} >> pkginfo + echo DESC=${PKGADD_DESC} >> pkginfo + echo CLASSES=${PKGADD_CLASSES} >> pkginfo + echo BASEDIR=${PKGADD_BASEDIR} >> pkginfo + echo CATEGORY=application >> pkginfo + echo VERSION=`cat ./release` >> pkginfo + echo > prototype + for subdir in opt var etc usr; \ + do if [ -d root/$$subdir ]; then \ + pkgproto root/$$subdir=$$subdir >> prototype;\ + fi; done + for file in pkginfo preinstall postinstall copyright; \ + do if [ -f $$file ]; then \ + echo "i $$file=$$file" >> prototype; \ + fi; done + rm -rf ./tmp + mkdir ./tmp + pkgmk -o -d ./tmp + pkgtrans -so ./tmp ${top_srcdir}/../${PKGADD_FILE} ${PKGADD_PKG} +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/mobicore/common/curl/packages/Symbian/bwins/libcurlu.def b/mobicore/common/curl/packages/Symbian/bwins/libcurlu.def new file mode 100644 index 0000000000000000000000000000000000000000..4d693a9b4c7d308a3b87ff585e7197dbcd19ba02 --- /dev/null +++ b/mobicore/common/curl/packages/Symbian/bwins/libcurlu.def @@ -0,0 +1,60 @@ +EXPORTS + curl_easy_cleanup @ 1 NONAME + curl_easy_duphandle @ 2 NONAME + curl_easy_escape @ 3 NONAME + curl_easy_getinfo @ 4 NONAME + curl_easy_init @ 5 NONAME + curl_easy_pause @ 6 NONAME + curl_easy_perform @ 7 NONAME + curl_easy_reset @ 8 NONAME + curl_easy_setopt @ 9 NONAME + curl_easy_strerror @ 10 NONAME + curl_easy_unescape @ 11 NONAME + curl_escape @ 12 NONAME + curl_formadd @ 13 NONAME + curl_formfree @ 14 NONAME + curl_formget @ 15 NONAME + curl_free @ 16 NONAME + curl_getdate @ 17 NONAME + curl_getenv @ 18 NONAME + curl_global_cleanup @ 19 NONAME + curl_global_init @ 20 NONAME + curl_global_init_mem @ 21 NONAME + curl_maprintf @ 22 NONAME + curl_mfprintf @ 23 NONAME + curl_mprintf @ 24 NONAME + curl_msnprintf @ 25 NONAME + curl_msprintf @ 26 NONAME + curl_multi_add_handle @ 27 NONAME + curl_multi_assign @ 28 NONAME + curl_multi_cleanup @ 29 NONAME + curl_multi_fdset @ 30 NONAME + curl_multi_info_read @ 31 NONAME + curl_multi_init @ 32 NONAME + curl_multi_perform @ 33 NONAME + curl_multi_remove_handle @ 34 NONAME + curl_multi_setopt @ 35 NONAME + curl_multi_socket @ 36 NONAME + curl_multi_socket_action @ 37 NONAME + curl_multi_socket_all @ 38 NONAME + curl_multi_strerror @ 39 NONAME + curl_multi_timeout @ 40 NONAME + curl_mvaprintf @ 41 NONAME + curl_mvfprintf @ 42 NONAME + curl_mvprintf @ 43 NONAME + curl_mvsnprintf @ 44 NONAME + curl_mvsprintf @ 45 NONAME + curl_share_cleanup @ 46 NONAME + curl_share_init @ 47 NONAME + curl_share_setopt @ 48 NONAME + curl_share_strerror @ 49 NONAME + curl_slist_append @ 50 NONAME + curl_slist_free_all @ 51 NONAME + curl_strequal @ 52 NONAME + curl_strnequal @ 53 NONAME + curl_unescape @ 54 NONAME + curl_version @ 55 NONAME + curl_version_info @ 56 NONAME + curl_easy_recv @ 57 NONAME + curl_easy_send @ 58 NONAME + diff --git a/mobicore/common/curl/packages/Symbian/eabi/libcurlu.def b/mobicore/common/curl/packages/Symbian/eabi/libcurlu.def new file mode 100644 index 0000000000000000000000000000000000000000..4d693a9b4c7d308a3b87ff585e7197dbcd19ba02 --- /dev/null +++ b/mobicore/common/curl/packages/Symbian/eabi/libcurlu.def @@ -0,0 +1,60 @@ +EXPORTS + curl_easy_cleanup @ 1 NONAME + curl_easy_duphandle @ 2 NONAME + curl_easy_escape @ 3 NONAME + curl_easy_getinfo @ 4 NONAME + curl_easy_init @ 5 NONAME + curl_easy_pause @ 6 NONAME + curl_easy_perform @ 7 NONAME + curl_easy_reset @ 8 NONAME + curl_easy_setopt @ 9 NONAME + curl_easy_strerror @ 10 NONAME + curl_easy_unescape @ 11 NONAME + curl_escape @ 12 NONAME + curl_formadd @ 13 NONAME + curl_formfree @ 14 NONAME + curl_formget @ 15 NONAME + curl_free @ 16 NONAME + curl_getdate @ 17 NONAME + curl_getenv @ 18 NONAME + curl_global_cleanup @ 19 NONAME + curl_global_init @ 20 NONAME + curl_global_init_mem @ 21 NONAME + curl_maprintf @ 22 NONAME + curl_mfprintf @ 23 NONAME + curl_mprintf @ 24 NONAME + curl_msnprintf @ 25 NONAME + curl_msprintf @ 26 NONAME + curl_multi_add_handle @ 27 NONAME + curl_multi_assign @ 28 NONAME + curl_multi_cleanup @ 29 NONAME + curl_multi_fdset @ 30 NONAME + curl_multi_info_read @ 31 NONAME + curl_multi_init @ 32 NONAME + curl_multi_perform @ 33 NONAME + curl_multi_remove_handle @ 34 NONAME + curl_multi_setopt @ 35 NONAME + curl_multi_socket @ 36 NONAME + curl_multi_socket_action @ 37 NONAME + curl_multi_socket_all @ 38 NONAME + curl_multi_strerror @ 39 NONAME + curl_multi_timeout @ 40 NONAME + curl_mvaprintf @ 41 NONAME + curl_mvfprintf @ 42 NONAME + curl_mvprintf @ 43 NONAME + curl_mvsnprintf @ 44 NONAME + curl_mvsprintf @ 45 NONAME + curl_share_cleanup @ 46 NONAME + curl_share_init @ 47 NONAME + curl_share_setopt @ 48 NONAME + curl_share_strerror @ 49 NONAME + curl_slist_append @ 50 NONAME + curl_slist_free_all @ 51 NONAME + curl_strequal @ 52 NONAME + curl_strnequal @ 53 NONAME + curl_unescape @ 54 NONAME + curl_version @ 55 NONAME + curl_version_info @ 56 NONAME + curl_easy_recv @ 57 NONAME + curl_easy_send @ 58 NONAME + diff --git a/mobicore/common/curl/packages/Symbian/group/bld.inf b/mobicore/common/curl/packages/Symbian/group/bld.inf new file mode 100644 index 0000000000000000000000000000000000000000..354a84382db697bdc8d975b0075c3ee577e76750 --- /dev/null +++ b/mobicore/common/curl/packages/Symbian/group/bld.inf @@ -0,0 +1,10 @@ +// +// libcurl and curl bld.inf file for Symbian OS +// +PRJ_EXPORTS + libcurl.iby /epoc32/rom/include/libcurl.iby + curl.iby /epoc32/rom/include/curl.iby + +PRJ_MMPFILES + libcurl.mmp + curl.mmp diff --git a/mobicore/common/curl/packages/Symbian/group/curl.iby b/mobicore/common/curl/packages/Symbian/group/curl.iby new file mode 100644 index 0000000000000000000000000000000000000000..7921aaa07b615fbaa39163a957ac19c891589bf9 --- /dev/null +++ b/mobicore/common/curl/packages/Symbian/group/curl.iby @@ -0,0 +1,15 @@ +// +// curl file transfer utility command-line utility +// +// Use this file with buildrom to add curl to a device ROM +// + +#ifndef CURL_IBY +#define CURL_IBY + +#include +#include + +file=ABI_DIR\BUILD_DIR\curl.exe \sys\bin\curl.exe + +#endif // CURL_IBY diff --git a/mobicore/common/curl/packages/Symbian/group/curl.mmp b/mobicore/common/curl/packages/Symbian/group/curl.mmp new file mode 100644 index 0000000000000000000000000000000000000000..706cba68b92fd3ffafb728b708380fc31ee5232e --- /dev/null +++ b/mobicore/common/curl/packages/Symbian/group/curl.mmp @@ -0,0 +1,28 @@ +// +// cURL network retrieval client +// + +TARGET curl.exe +TARGETTYPE exe +UID 0x00000000 0xF0206442 + +SOURCEPATH ../../../src +SOURCE \ + main.c hugehelp.c urlglob.c writeout.c writeenv.c \ + getpass.c homedir.c curlutil.c os-specific.c xattr.c + +SOURCEPATH ../../../lib +SOURCE \ + rawstr.c nonblock.c + +USERINCLUDE ../../../src ../../../lib ../../../include/curl + +SYSTEMINCLUDE ../../../include /epoc32/include /epoc32/include/stdapis + +LIBRARY euser.lib libc.lib libcurl.lib +STATICLIBRARY libcrt0.lib + +CAPABILITY NetworkServices + +EPOCSTACKSIZE 0x8000 + diff --git a/mobicore/common/curl/packages/Symbian/group/curl.pkg b/mobicore/common/curl/packages/Symbian/group/curl.pkg new file mode 100644 index 0000000000000000000000000000000000000000..dfc994f5379aa5a001a39ae196ded90faa6b3b63 --- /dev/null +++ b/mobicore/common/curl/packages/Symbian/group/curl.pkg @@ -0,0 +1,26 @@ +; curl package defintion file +; Use with makesis to create a Symbian .sis package + +;Language - standard language definitions +&EN + +;Header - standard sis file header including version number +;Version scheme: curl's major, curl's minor, curl's subminor*100 + build number +; e.g. The third Symbian package of curl ver. 7.20.1 would have a SIS package +; version of 7, 20, 103 +#{"curl"}, (0xF0206442), 7, 20, , TYPE=SA + +; Vendor name +%{"curl project"} +:"curl project" + +; Embedded component +@"libcurl.sis",(0xF0206D00) + +; A dependency on P.I.P.S. and the stdio server are probably good to have here +;(0x20009A80), *, *, *, {"Open C Standard Libraries"} +;(0x20009A81), *, *, *, {"P.I.P.S. for UIQ 3"} +;(0x20009AA2), *, *, *, {"Symbian OS STDIOSERVER"} + +;Files - standard file specifications +"\epoc32\release\armv5\urel\curl.exe" - "$:\sys\bin\curl.exe" diff --git a/mobicore/common/curl/packages/Symbian/group/libcurl.iby b/mobicore/common/curl/packages/Symbian/group/libcurl.iby new file mode 100644 index 0000000000000000000000000000000000000000..373f5b37de64750561c716e6e70cae61c006bd52 --- /dev/null +++ b/mobicore/common/curl/packages/Symbian/group/libcurl.iby @@ -0,0 +1,14 @@ +// +// libcurl file transfer DLL +// +// Use this file with buildrom to add libcurl to a device ROM +// + +#ifndef LIBCURL_IBY +#define LIBCURL_IBY + +#include + +file=ABI_DIR\BUILD_DIR\libcurl.dll \sys\bin\libcurl.dll + +#endif // LIBCURL_IBY diff --git a/mobicore/common/curl/packages/Symbian/group/libcurl.mmp b/mobicore/common/curl/packages/Symbian/group/libcurl.mmp new file mode 100644 index 0000000000000000000000000000000000000000..c060024fdbd729b5e212b4ede204060110718d44 --- /dev/null +++ b/mobicore/common/curl/packages/Symbian/group/libcurl.mmp @@ -0,0 +1,59 @@ +// +// libcurl.dll cURL network retrieval client library +// + +// Build-time options (uncomment these to enable) +#define ENABLE_ZLIB // Enable gzip/deflate decompression +//#define ENABLE_SSL // Enable SSL for HTTPS/FTPS (requires S60 Open C SDK) + +TARGET libcurl.dll +TARGETTYPE dll +UID 0x1000008d 0xF0206D00 + +MACRO BUILDING_LIBCURL + +#ifdef ENABLE_ZLIB +MACRO HAVE_LIBZ +#endif +#ifdef ENABLE_SSL +MACRO USE_SSLEAY +#endif + +SOURCEPATH ../../../lib +SOURCE \ + file.c timeval.c base64.c hostip.c progress.c formdata.c \ + cookie.c http.c sendf.c ftp.c url.c dict.c if2ip.c speedcheck.c \ + ldap.c ssluse.c version.c getenv.c escape.c mprintf.c telnet.c \ + netrc.c getinfo.c transfer.c strequal.c easy.c security.c krb4.c \ + curl_fnmatch.c fileinfo.c ftplistparser.c wildcard.c krb5.c \ + memdebug.c http_chunks.c strtok.c connect.c llist.c hash.c multi.c \ + content_encoding.c share.c http_digest.c md4.c md5.c curl_rand.c \ + http_negotiate.c http_ntlm.c inet_pton.c strtoofft.c strerror.c \ + hostares.c hostasyn.c hostip4.c hostip6.c hostsyn.c hostthre.c \ + inet_ntop.c parsedate.c select.c gtls.c sslgen.c tftp.c splay.c \ + strdup.c socks.c ssh.c nss.c qssl.c rawstr.c curl_addrinfo.c \ + socks_gssapi.c socks_sspi.c curl_sspi.c slist.c nonblock.c \ + curl_memrchr.c imap.c pop3.c smtp.c pingpong.c rtsp.c curl_threads.c \ + warnless.c hmac.c polarssl.c curl_rtmp.c openldap.c curl_gethostname.c\ + gopher.c + +USERINCLUDE ../../../lib ../../../include/curl +#ifdef ENABLE_SSL +SYSTEMINCLUDE /epoc32/include/osextensions/stdapis +// Older versions of the SDK need this instead: +//USERINCLUDE /epoc32/include/stdapis/openssl +#endif + +SYSTEMINCLUDE ../../../include /epoc32/include/stdapis /epoc32/include + +LIBRARY euser.lib libc.lib +#ifdef ENABLE_ZLIB +LIBRARY ezlib.lib +#endif +#ifdef ENABLE_SSL +LIBRARY libssl.lib libcrypto.lib +#endif + +CAPABILITY NetworkServices + +EPOCALLOWDLLDATA diff --git a/mobicore/common/curl/packages/Symbian/group/libcurl.pkg b/mobicore/common/curl/packages/Symbian/group/libcurl.pkg new file mode 100644 index 0000000000000000000000000000000000000000..1460a593cfd9926505a081c25a3525400c633ee5 --- /dev/null +++ b/mobicore/common/curl/packages/Symbian/group/libcurl.pkg @@ -0,0 +1,22 @@ +; libcurl package defintion file +; Use with makesis to create a Symbian .sis package + +;Language - standard language definitions +&EN + +;Header - standard sis file header including version number +;Version scheme: curl's major, curl's minor, curl's subminor*100 + build number +; e.g. The third Symbian package of curl ver. 7.20.1 would have a SIS package +; version of 7, 20, 103 +#{"libcurl"}, (0xF0206D00), 7, 20, , TYPE=SA + +; Vendor name +%{"curl project"} +:"curl project" + +; A dependency on P.I.P.S. is probably a good idea to add here +;(0x20009A80), *, *, *, {"Open C Standard Libraries"} +;(0x20009A81), *, *, *, {"P.I.P.S. for UIQ 3"} + +;Files - standard file specifications +"\epoc32\release\armv5\urel\libcurl.dll" - "$:\sys\bin\libcurl.dll" diff --git a/mobicore/common/curl/packages/Symbian/readme.txt b/mobicore/common/curl/packages/Symbian/readme.txt new file mode 100644 index 0000000000000000000000000000000000000000..57b899f9157a9cfabe3463db280aeade9b474480 --- /dev/null +++ b/mobicore/common/curl/packages/Symbian/readme.txt @@ -0,0 +1,93 @@ +Curl on Symbian OS +================== +This is a basic port of curl and libcurl to Symbian OS. The port is +a straightforward one using Symbian's P.I.P.S. POSIX compatibility +layer, which was first available for OS version 9.1. A more complete +port would involve writing a Symbian C++ binding, or wrapping libcurl +as a Symbian application server with a C++ API to handle requests +from client applications as well as creating a GUI application to allow +file transfers. The author has no current plans to do so. + +This means that integration with standard Symbian OS programs can be +tricky, since libcurl isn't designed with Symbian's native asynchronous +message passing idioms in mind. However, it may be possible to use libcurl +in an active object-based application through libcurl's multi interface. +The port is most easily used when porting POSIX applications to Symbian +OS using P.I.P.S. (a.k.a. Open C). + +libcurl is built as a standard Symbian ordinal-linked DLL, and curl is +built as a text mode EXE application. They have not been Symbian +Signed, which is required in order to install them on most phones. + +Following are some things to keep in mind when using this port. + + +curl notes +---------- +When starting curl in the Windows emulator from the Windows command-line, +place a double-dash -- before the first curl command-line option. +e.g. \epoc32\release\winscw\udeb\curl -- -v http://localhost/ +Failure to do so may mean that some of your options won't be correctly +processed. + +Symbian's ESHELL allows for redirecting stdin and stdout to files, but +stderr goes to the epocwind.out file (on the emulator). The standard +curl options -o, --stderr and --trace-ascii can be used to +redirect output to a file (or stdout) instead. + +P.I.P.S. doesn't inherit the current working directory at startup from +the shell, so relative path names are always relative to +C:\Private\f0206442\. + +P.I.P.S. provides no way to disable echoing of characters as they are +entered, so passwords typed in on the console will be visible. It also +line buffers keyboard input so interactive telnet sessions are not very +feasible. + +All screen output disappears after curl exits, so after a command completes, +curl waits by default for Enter to be pressed before exiting. This behaviour +is suppressed when the -s option is given. + +curl's "home directory" in Symbian is C:\Private\f0206442\. The .curlrc file +is read from this directory on startup. + + +libcurl notes +------------- +libcurl uses writable static data, so the EPOCALLOWDLLDATA option is +used in its MMP file, with the corresponding additional memory usage +and limitations on the Windows emulator. + +curl_global_init() *must* be called (either explicitly or implicitly through +calling certain other libcurl functions) before any libcurl functions +that could allocate memory (like curl_getenv()). + +P.I.P.S. doesn't support signals or the alarm() call, so some timeouts +(such as the connect timeout) are not honoured. This should not be +an issue once support for CURLRES_THREADED is added for Symbian. + +P.I.P.S. causes a USER:87 panic if certain timeouts much longer than +half an hour are selected. + +LDAP, SCP or SFTP methods are not supported due to lack of support for +the dependent libaries on Symbian. + +gzip and deflate decompression is supported when the appropriate macro +is uncommented in the libcurl.mmp file. + +SSL/TLS encryption is not enabled by default, but it is possible to add +when the OpenSSL libraries included in the S60 Open C SDK are available. +The appropriate macro in the libcurl.mmp file must be uncommented to +enable support. + +NTLM authentication may not work on some servers due to the lack of +MD4 support in the OpenSSL libraries included with Open C. + +Debug builds are not supported (i.e. --enable-debug) because they cause +additional symbol exports in the library which are not frozen in the .def +files. + + +Dan Fandrich +dan@coneharvesters.com +March 2010 diff --git a/mobicore/common/curl/packages/TPF/curl.mak b/mobicore/common/curl/packages/TPF/curl.mak new file mode 100644 index 0000000000000000000000000000000000000000..6e93404649771769282efa31a694a0eece914284 --- /dev/null +++ b/mobicore/common/curl/packages/TPF/curl.mak @@ -0,0 +1,61 @@ +####################################################################### +# # +# MAKEFILE NAME..... curl.mak # +# # +# DESCRIPTION..... This is the makefile for libcurl. # +# # +####################################################################### + +APP := CURL + +TPF_RUN_TPFSOCHK := NO + +####################################################################### +# Define any additional libs needed to link +####################################################################### + +LIBS := CRYP CSSL + +####################################################################### +# Define the envs needed to build this module +####################################################################### + +maketpf_env := curllib +maketpf_env += openssl +maketpf_env += base_rt +maketpf_env += system + +####################################################################### +# Segments to be compiled with gcc compiler +####################################################################### +# +### lib directory: +include $(word 1,$(wildcard $(foreach d,$(TPF_ROOT),$d/opensource/curl/lib/Makefile.inc)) Makefile.inc_not_found) +C_SRC := $(CSOURCES) + +####################################################################### +# Additions and overrides for gcc compiler flags +####################################################################### + +# suppress expected warnings in the ported code: +CFLAGS_CURL += -w + +# use SSL +# (overrides Curl's lib/config-tpf.h file) +CFLAGS_CURL += -DUSE_OPENSSL +CFLAGS_CURL += -DUSE_SSLEAY + +# disable all protocols except FTP and HTTP +# (overrides Curl's lib/config-tpf.h file) +CFLAGS_CURL += -DCURL_DISABLE_DICT +CFLAGS_CURL += -DCURL_DISABLE_FILE +CFLAGS_CURL += -DCURL_DISABLE_LDAP +CFLAGS_CURL += -DCURL_DISABLE_TELNET +CFLAGS_CURL += -DCURL_DISABLE_TFTP + +####################################################################### +# Include the maketpf.rules +####################################################################### + +include maketpf.rules + diff --git a/mobicore/common/curl/packages/TPF/maketpf.env_curl b/mobicore/common/curl/packages/TPF/maketpf.env_curl new file mode 100644 index 0000000000000000000000000000000000000000..91a2573a1a549248d9d746923d8cfbdd8ef90c4e --- /dev/null +++ b/mobicore/common/curl/packages/TPF/maketpf.env_curl @@ -0,0 +1,25 @@ +################################################################################ +################################################################################ +#env TPF CURL Includes +################################################################################ +################################################################################ + +################################################################################ +# Define the directories where the shared objects reside +################################################################################ + +ROOTLIBDIRS := $(foreach d,$(TPF_ROOT),$d/opensource/curl/output/lib) + +################################################################################ +# Set the include/header file directories +################################################################################ + +ROOTINCDIRS := $(foreach d,$(TPF_ROOT_LM),$d/opensource/curl/include) +ROOTINCDIRS += $(foreach d,$(TPF_ROOT_LM),$d/opensource/curl/include/curl) + +################################################################################ +# Define "TPF" to enable TPF-specific code in Curl files. +################################################################################ + +CFLAGS_$(APP) += -D TPF + diff --git a/mobicore/common/curl/packages/TPF/maketpf.env_curllib b/mobicore/common/curl/packages/TPF/maketpf.env_curllib new file mode 100644 index 0000000000000000000000000000000000000000..f6ad5ba9decad4656c5cb409034a5e164d8d4561 --- /dev/null +++ b/mobicore/common/curl/packages/TPF/maketpf.env_curllib @@ -0,0 +1,57 @@ +################################################################################ +################################################################################ +#env TPF CURL Library Source and Output +################################################################################ +################################################################################ + +################################################################################ +# Define the directories where the shared objects reside +################################################################################ + +ROOTLIBDIRS := $(foreach d,$(TPF_ROOT),$d/opensource/curl/output/lib) + +################################################################################ +# Define the directories where the loadables (XXXXVV) are to be written +################################################################################ + +ROOTLOADDIRS := $(foreach d,$(TPF_ROOT),$d/opensource/curl/output/load) + +################################################################################ +# Define the location of the export files used by the LD postprocessor +# - currently expected that .exp files will also live in lib dir +################################################################################ + +ROOTEXPDIRS := $(foreach d,$(TPF_ROOT_LM),$d/opensource/curl/output/exp) + +################################################################################ +# Define the object file directory name +################################################################################ + +ROOTOBJDIRS := $(foreach d,$(TPF_ROOT),$d/opensource/curl/output/obj) + +################################################################################ +# Define the listing files directory name +################################################################################ + +ROOTLSTDIRS := $(foreach d,$(TPF_ROOT),$d/opensource/curl/output/lst) + +################################################################################ +# Set the include/header file directories +################################################################################ + +ROOTINCDIRS := $(foreach d,$(TPF_ROOT_LM),$d/opensource/curl/lib) +ROOTINCDIRS += $(foreach d,$(TPF_ROOT_LM),$d/opensource/curl/include) +ROOTINCDIRS += $(foreach d,$(TPF_ROOT_LM),$d/opensource/curl/include/curl) + +################################################################################ +# Set the C file directories +################################################################################ + +ROOTCDIRS := $(foreach d,$(TPF_ROOT_LM),$d/opensource/curl/lib) + +################################################################################ +# Define "TPF" to enable TPF-specific code in Curl files. +################################################################################ + +CFLAGS_$(APP) += -D TPF + diff --git a/mobicore/common/curl/packages/Win32/Makefile.am b/mobicore/common/curl/packages/Win32/Makefile.am new file mode 100644 index 0000000000000000000000000000000000000000..93350ea13f97c27ec33b2764c1ea4c49b749a931 --- /dev/null +++ b/mobicore/common/curl/packages/Win32/Makefile.am @@ -0,0 +1,3 @@ +SUBDIRS = cygwin + +EXTRA_DIST = README diff --git a/mobicore/common/curl/packages/Win32/Makefile.in b/mobicore/common/curl/packages/Win32/Makefile.in new file mode 100644 index 0000000000000000000000000000000000000000..a4e19309f52cfe3f239699ae9d62b85de449c689 --- /dev/null +++ b/mobicore/common/curl/packages/Win32/Makefile.in @@ -0,0 +1,563 @@ +# Makefile.in generated by automake 1.9.6 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005 Free Software Foundation, Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ +srcdir = @srcdir@ +top_srcdir = @top_srcdir@ +VPATH = @srcdir@ +pkgdatadir = $(datadir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +top_builddir = ../.. +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +INSTALL = @INSTALL@ +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +subdir = packages/Win32 +DIST_COMMON = README $(srcdir)/Makefile.am $(srcdir)/Makefile.in +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/m4/curl-compilers.m4 \ + $(top_srcdir)/m4/curl-confopts.m4 \ + $(top_srcdir)/m4/curl-functions.m4 \ + $(top_srcdir)/m4/curl-override.m4 \ + $(top_srcdir)/m4/curl-reentrant.m4 \ + $(top_srcdir)/m4/curl-system.m4 $(top_srcdir)/m4/libtool.m4 \ + $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ + $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ + $(top_srcdir)/acinclude.m4 $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs +CONFIG_HEADER = $(top_builddir)/lib/curl_config.h \ + $(top_builddir)/src/curl_config.h \ + $(top_builddir)/include/curl/curlbuild.h +CONFIG_CLEAN_FILES = +SOURCES = +DIST_SOURCES = +RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \ + html-recursive info-recursive install-data-recursive \ + install-exec-recursive install-info-recursive \ + install-recursive installcheck-recursive installdirs-recursive \ + pdf-recursive ps-recursive uninstall-info-recursive \ + uninstall-recursive +ETAGS = etags +CTAGS = ctags +DIST_SUBDIRS = $(SUBDIRS) +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +AMDEP_FALSE = @AMDEP_FALSE@ +AMDEP_TRUE = @AMDEP_TRUE@ +AMTAR = @AMTAR@ +AR = @AR@ +AS = @AS@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +BUILD_LIBHOSTNAME_FALSE = @BUILD_LIBHOSTNAME_FALSE@ +BUILD_LIBHOSTNAME_TRUE = @BUILD_LIBHOSTNAME_TRUE@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CONFIGURE_OPTIONS = @CONFIGURE_OPTIONS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CROSSCOMPILING_FALSE = @CROSSCOMPILING_FALSE@ +CROSSCOMPILING_TRUE = @CROSSCOMPILING_TRUE@ +CURLDEBUG_FALSE = @CURLDEBUG_FALSE@ +CURLDEBUG_TRUE = @CURLDEBUG_TRUE@ +CURL_CA_BUNDLE = @CURL_CA_BUNDLE@ +CURL_CFLAG_EXTRAS = @CURL_CFLAG_EXTRAS@ +CURL_DISABLE_DICT = @CURL_DISABLE_DICT@ +CURL_DISABLE_FILE = @CURL_DISABLE_FILE@ +CURL_DISABLE_FTP = @CURL_DISABLE_FTP@ +CURL_DISABLE_GOPHER = @CURL_DISABLE_GOPHER@ +CURL_DISABLE_HTTP = @CURL_DISABLE_HTTP@ +CURL_DISABLE_IMAP = @CURL_DISABLE_IMAP@ +CURL_DISABLE_LDAP = @CURL_DISABLE_LDAP@ +CURL_DISABLE_LDAPS = @CURL_DISABLE_LDAPS@ +CURL_DISABLE_POP3 = @CURL_DISABLE_POP3@ +CURL_DISABLE_PROXY = @CURL_DISABLE_PROXY@ +CURL_DISABLE_RTSP = @CURL_DISABLE_RTSP@ +CURL_DISABLE_SMTP = @CURL_DISABLE_SMTP@ +CURL_DISABLE_TELNET = @CURL_DISABLE_TELNET@ +CURL_DISABLE_TFTP = @CURL_DISABLE_TFTP@ +CURL_LIBS = @CURL_LIBS@ +CURL_NETWORK_LIBS = @CURL_NETWORK_LIBS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DLLTOOL = @DLLTOOL@ +DSYMUTIL = @DSYMUTIL@ +DUMPBIN = @DUMPBIN@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +ENABLE_SHARED = @ENABLE_SHARED@ +EXEEXT = @EXEEXT@ +FGREP = @FGREP@ +GREP = @GREP@ +HAVE_LDAP_SSL = @HAVE_LDAP_SSL@ +HAVE_LIBZ = @HAVE_LIBZ@ +HAVE_LIBZ_FALSE = @HAVE_LIBZ_FALSE@ +HAVE_LIBZ_TRUE = @HAVE_LIBZ_TRUE@ +HAVE_PK11_CREATEGENERICOBJECT = @HAVE_PK11_CREATEGENERICOBJECT@ +IDN_ENABLED = @IDN_ENABLED@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +IPV6_ENABLED = @IPV6_ENABLED@ +KRB4_ENABLED = @KRB4_ENABLED@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LIBCURL_LIBS = @LIBCURL_LIBS@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +MAINT = @MAINT@ +MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@ +MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@ +MAKEINFO = @MAKEINFO@ +MANOPT = @MANOPT@ +MIMPURE_FALSE = @MIMPURE_FALSE@ +MIMPURE_TRUE = @MIMPURE_TRUE@ +NM = @NM@ +NMEDIT = @NMEDIT@ +NO_UNDEFINED_FALSE = @NO_UNDEFINED_FALSE@ +NO_UNDEFINED_TRUE = @NO_UNDEFINED_TRUE@ +NROFF = @NROFF@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +OTOOL = @OTOOL@ +OTOOL64 = @OTOOL64@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH = @PATH@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PERL = @PERL@ +PKGADD_NAME = @PKGADD_NAME@ +PKGADD_PKG = @PKGADD_PKG@ +PKGADD_VENDOR = @PKGADD_VENDOR@ +PKGCONFIG = @PKGCONFIG@ +RANDOM_FILE = @RANDOM_FILE@ +RANLIB = @RANLIB@ +REQUIRE_LIB_DEPS = @REQUIRE_LIB_DEPS@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +SONAME_BUMP_FALSE = @SONAME_BUMP_FALSE@ +SONAME_BUMP_TRUE = @SONAME_BUMP_TRUE@ +SSL_ENABLED = @SSL_ENABLED@ +STATICLIB_FALSE = @STATICLIB_FALSE@ +STATICLIB_TRUE = @STATICLIB_TRUE@ +STRIP = @STRIP@ +SUPPORT_FEATURES = @SUPPORT_FEATURES@ +SUPPORT_PROTOCOLS = @SUPPORT_PROTOCOLS@ +TEST_SERVER_LIBS = @TEST_SERVER_LIBS@ +USE_ARES = @USE_ARES@ +USE_EMBEDDED_ARES_FALSE = @USE_EMBEDDED_ARES_FALSE@ +USE_EMBEDDED_ARES_TRUE = @USE_EMBEDDED_ARES_TRUE@ +USE_GNUTLS = @USE_GNUTLS@ +USE_LIBRTMP = @USE_LIBRTMP@ +USE_LIBSSH2 = @USE_LIBSSH2@ +USE_MANUAL_FALSE = @USE_MANUAL_FALSE@ +USE_MANUAL_TRUE = @USE_MANUAL_TRUE@ +USE_NSS = @USE_NSS@ +USE_OPENLDAP = @USE_OPENLDAP@ +USE_POLARSSL = @USE_POLARSSL@ +USE_SSLEAY = @USE_SSLEAY@ +USE_WINDOWS_SSPI = @USE_WINDOWS_SSPI@ +VERSION = @VERSION@ +VERSIONNUM = @VERSIONNUM@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ +am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ +am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +libext = @libext@ +localedir = @localedir@ +localstatedir = @localstatedir@ +lt_ECHO = @lt_ECHO@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +subdirs = @subdirs@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +SUBDIRS = cygwin +EXTRA_DIST = README +all: all-recursive + +.SUFFIXES: +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ + && exit 0; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu packages/Win32/Makefile'; \ + cd $(top_srcdir) && \ + $(AUTOMAKE) --gnu packages/Win32/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +distclean-libtool: + -rm -f libtool +uninstall-info-am: + +# This directory's subdirectories are mostly independent; you can cd +# into them and run `make' without going through this Makefile. +# To change the values of `make' variables: instead of editing Makefiles, +# (1) if the variable is set in `config.status', edit `config.status' +# (which will cause the Makefiles to be regenerated when you run `make'); +# (2) otherwise, pass the desired values on the `make' command line. +$(RECURSIVE_TARGETS): + @failcom='exit 1'; \ + for f in x $$MAKEFLAGS; do \ + case $$f in \ + *=* | --[!k]*);; \ + *k*) failcom='fail=yes';; \ + esac; \ + done; \ + dot_seen=no; \ + target=`echo $@ | sed s/-recursive//`; \ + list='$(SUBDIRS)'; for subdir in $$list; do \ + echo "Making $$target in $$subdir"; \ + if test "$$subdir" = "."; then \ + dot_seen=yes; \ + local_target="$$target-am"; \ + else \ + local_target="$$target"; \ + fi; \ + (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ + || eval $$failcom; \ + done; \ + if test "$$dot_seen" = "no"; then \ + $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ + fi; test -z "$$fail" + +mostlyclean-recursive clean-recursive distclean-recursive \ +maintainer-clean-recursive: + @failcom='exit 1'; \ + for f in x $$MAKEFLAGS; do \ + case $$f in \ + *=* | --[!k]*);; \ + *k*) failcom='fail=yes';; \ + esac; \ + done; \ + dot_seen=no; \ + case "$@" in \ + distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ + *) list='$(SUBDIRS)' ;; \ + esac; \ + rev=''; for subdir in $$list; do \ + if test "$$subdir" = "."; then :; else \ + rev="$$subdir $$rev"; \ + fi; \ + done; \ + rev="$$rev ."; \ + target=`echo $@ | sed s/-recursive//`; \ + for subdir in $$rev; do \ + echo "Making $$target in $$subdir"; \ + if test "$$subdir" = "."; then \ + local_target="$$target-am"; \ + else \ + local_target="$$target"; \ + fi; \ + (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ + || eval $$failcom; \ + done && test -z "$$fail" +tags-recursive: + list='$(SUBDIRS)'; for subdir in $$list; do \ + test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \ + done +ctags-recursive: + list='$(SUBDIRS)'; for subdir in $$list; do \ + test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \ + done + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + mkid -fID $$unique +tags: TAGS + +TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ + include_option=--etags-include; \ + empty_fix=.; \ + else \ + include_option=--include; \ + empty_fix=; \ + fi; \ + list='$(SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + test ! -f $$subdir/TAGS || \ + tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \ + fi; \ + done; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$tags $$unique; \ + fi +ctags: CTAGS +CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + test -z "$(CTAGS_ARGS)$$tags$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$tags $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && cd $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) $$here + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ + list='$(DISTFILES)'; for file in $$list; do \ + case $$file in \ + $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ + $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ + esac; \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test "$$dir" != "$$file" && test "$$dir" != "."; then \ + dir="/$$dir"; \ + $(mkdir_p) "$(distdir)$$dir"; \ + else \ + dir=''; \ + fi; \ + if test -d $$d/$$file; then \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ + fi; \ + cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ + else \ + test -f $(distdir)/$$file \ + || cp -p $$d/$$file $(distdir)/$$file \ + || exit 1; \ + fi; \ + done + list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + test -d "$(distdir)/$$subdir" \ + || $(mkdir_p) "$(distdir)/$$subdir" \ + || exit 1; \ + distdir=`$(am__cd) $(distdir) && pwd`; \ + top_distdir=`$(am__cd) $(top_distdir) && pwd`; \ + (cd $$subdir && \ + $(MAKE) $(AM_MAKEFLAGS) \ + top_distdir="$$top_distdir" \ + distdir="$$distdir/$$subdir" \ + distdir) \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-recursive +all-am: Makefile +installdirs: installdirs-recursive +installdirs-am: +install: install-recursive +install-exec: install-exec-recursive +install-data: install-data-recursive +uninstall: uninstall-recursive + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-recursive +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-recursive + +clean-am: clean-generic clean-libtool mostlyclean-am + +distclean: distclean-recursive + -rm -f Makefile +distclean-am: clean-am distclean-generic distclean-libtool \ + distclean-tags + +dvi: dvi-recursive + +dvi-am: + +html: html-recursive + +info: info-recursive + +info-am: + +install-data-am: + +install-exec-am: + +install-info: install-info-recursive + +install-man: + +installcheck-am: + +maintainer-clean: maintainer-clean-recursive + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-recursive + +mostlyclean-am: mostlyclean-generic mostlyclean-libtool + +pdf: pdf-recursive + +pdf-am: + +ps: ps-recursive + +ps-am: + +uninstall-am: uninstall-info-am + +uninstall-info: uninstall-info-recursive + +.PHONY: $(RECURSIVE_TARGETS) CTAGS GTAGS all all-am check check-am \ + clean clean-generic clean-libtool clean-recursive ctags \ + ctags-recursive distclean distclean-generic distclean-libtool \ + distclean-recursive distclean-tags distdir dvi dvi-am html \ + html-am info info-am install install-am install-data \ + install-data-am install-exec install-exec-am install-info \ + install-info-am install-man install-strip installcheck \ + installcheck-am installdirs installdirs-am maintainer-clean \ + maintainer-clean-generic maintainer-clean-recursive \ + mostlyclean mostlyclean-generic mostlyclean-libtool \ + mostlyclean-recursive pdf pdf-am ps ps-am tags tags-recursive \ + uninstall uninstall-am uninstall-info-am + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/mobicore/common/curl/packages/Win32/README b/mobicore/common/curl/packages/Win32/README new file mode 100644 index 0000000000000000000000000000000000000000..266e4eaf394741955c961d05b1fb8910d62cc198 --- /dev/null +++ b/mobicore/common/curl/packages/Win32/README @@ -0,0 +1,53 @@ +Author: Jrn Hartroth + +DESCRIPTION + +(If you're only looking for precompiled win32 binaries, go visit +http://curl.haxx.se/download.html) + +Packaging of the curl binaries for Win32 should at this point in time be based +on the InfoZip (zip/unzip) archiver family as the de-facto standard for +Windows archives. A package should contain the main binary curl.exe along with +the appropriate documentation and license information files. For development +releases, you should also include the header directory and probably the +compiled binaries of libcurl and the appropriate Makefiles/project definition +files for the compiler used. + +A simple packaging mechanism can be based on a set of batch files which call +zip.exe with the appropriate files from the curl distribution - see the +samples included below (Long lines have been split with "\" as the split +marker, you'll want to rejoin the pieces to be all on one line in the batch +file). Call any of these batch files - after compiling the curl binaries - +with a single parameter specifying the name of the archive file to be created. + +It is implicitely assumed that all of the binary files (curl.exe, libcurl.a, +etc) have previously been copied to the main directory of the curl source +package (the directory where the main README resides), because that is where +they should end up in the zip archive. The archive should *not* be built with +absolute path information because the user will want to locally extract the +archive contents and shift the binaries to his executable directory. + +SCRIPT_TEMPLATES + +curlpkg.bat: + zip -9 %1 curl.exe CHANGES LEGAL MPL-1.0.txt README \ + docs/FAQ docs/FEATURES docs/README.curl docs/README.win32 docs/TODO + +curldevpkg.bat: + zip -9 %1 curl.exe include\README include\curl\*.h CHANGES docs\* \ + curl.spec curl-ssl.spec LEGAL lib/Makefile.m32 src/Makefile.m32 \ + libcurl.a libcurl.dll libcurldll.a MPL-1.0.txt README + +PROCEDURE_EXAMPLE + +A standard packaging routine (for MingW32) using the above batch files could +go like this: +(No SSL) (With SSL) +cd \lib cd \lib +make -f Makefile.m32 make -f Makefile.m32 SSL=1 +cd ..\src cd ..\src +make -f Makefile.m32 make -f Makefile.m32 SSL=1 +cd .. cd .. +copy lib\libcurl.a . copy lib\libcurl.a . +copy src\curl.exe . copy src\curl.exe . +curlpkg curl-win32-nossl.zip curlpkg curl-win32-ssl.zip diff --git a/mobicore/common/curl/packages/Win32/cygwin/Makefile.am b/mobicore/common/curl/packages/Win32/cygwin/Makefile.am new file mode 100644 index 0000000000000000000000000000000000000000..b56148dc928eb63f7e7f00e454a65fffa3cff955 --- /dev/null +++ b/mobicore/common/curl/packages/Win32/cygwin/Makefile.am @@ -0,0 +1,62 @@ +EXTRA_DIST = README + +# +# Build a Cygwin binary tar ball +# +# Read the README file for details on using this Makefile +# +# NOTE: As I'm not particularly familiar with Makefiles, this was the +# best I could come up with. It should probably be enhanced someday +# to actually use the correct target and pre-requisite names, etc... +# If anyone else wants to volunteer, feel free ;-) +# + +# Cygwin build number (default to "1") +CYGBUILD = 1 + +# Cygwin tarball build dir (fully-qualified name, gets deleted when done) +cygwintmp = $(CURDIR)/tmp_binbuild + +cygwinbin: + rm -rf $(cygwintmp) + rm -rf $(cygwintmp)-dev + $(MAKE) -C $(top_builddir) DESTDIR=$(cygwintmp) install-strip +# $(STRIP) $(cygwintmp)/usr/bin/cygcurl-?.dll + $(mkinstalldirs) \ + $(cygwintmp)$(datadir)/doc/Cygwin \ + $(cygwintmp)$(datadir)/doc/$(PACKAGE)-$(VERSION) \ + $(cygwintmp)-dev$(datadir)/doc/$(PACKAGE)-$(VERSION)/libcurl \ + $(cygwintmp)-dev$(datadir)/doc/$(PACKAGE)-$(VERSION)/examples \ + $(cygwintmp)-dev$(mandir) +# +# copy some files into the binary install dir + cp $(srcdir)/README \ + $(cygwintmp)$(datadir)/doc/Cygwin/$(PACKAGE)-$(VERSION)-$(CYGBUILD).README + cd $(top_srcdir) ; cp CHANGES COPYING README RELEASE-NOTES docs/* \ + $(cygwintmp)$(datadir)/doc/$(PACKAGE)-$(VERSION) ; pwd + cd $(cygwintmp)$(datadir)/doc/$(PACKAGE)-$(VERSION) ; rm *.1 Makefile* +# +# copy some files into the -dev install dir, remove some from binary + cp $(top_srcdir)/docs/libcurl/*.html \ + $(cygwintmp)-dev$(datadir)/doc/$(PACKAGE)-$(VERSION)/libcurl + cp $(top_srcdir)/docs/examples/* \ + $(cygwintmp)-dev$(datadir)/doc/$(PACKAGE)-$(VERSION)/examples + rm $(cygwintmp)-dev$(datadir)/doc/$(PACKAGE)-$(VERSION)/examples/Makefile* + cp $(top_srcdir)/docs/examples/Makefile.example \ + $(cygwintmp)-dev$(datadir)/doc/$(PACKAGE)-$(VERSION)/examples + mv $(cygwintmp)$(datadir)/doc/$(PACKAGE)-$(VERSION)/BINDINGS \ + $(cygwintmp)-dev$(datadir)/doc/$(PACKAGE)-$(VERSION) + mv $(cygwintmp)$(datadir)/doc/$(PACKAGE)-$(VERSION)/INTERNALS \ + $(cygwintmp)-dev$(datadir)/doc/$(PACKAGE)-$(VERSION) + mv $(cygwintmp)/usr/include $(cygwintmp)-dev/usr + mv $(cygwintmp)/usr/lib $(cygwintmp)-dev/usr + mv $(cygwintmp)$(mandir)/man3 $(cygwintmp)-dev$(mandir) +# +# create both tar files, and delete tmp folders + cd $(cygwintmp) ; tar cjf \ + $(PACKAGE)-$(VERSION)-$(CYGBUILD).tar.bz2 usr + mv $(cygwintmp)/*.tar.bz2 . && rm -rf $(cygwintmp) +# + cd $(cygwintmp)-dev ; tar cjf \ + $(PACKAGE)-devel-$(VERSION)-$(CYGBUILD).tar.bz2 usr + mv $(cygwintmp)-dev/*.tar.bz2 . && rm -rf $(cygwintmp)-dev diff --git a/mobicore/common/curl/packages/Win32/cygwin/Makefile.in b/mobicore/common/curl/packages/Win32/cygwin/Makefile.in new file mode 100644 index 0000000000000000000000000000000000000000..ebcb34da087739d9715423ba7cf7b3223bc31b35 --- /dev/null +++ b/mobicore/common/curl/packages/Win32/cygwin/Makefile.in @@ -0,0 +1,466 @@ +# Makefile.in generated by automake 1.9.6 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005 Free Software Foundation, Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ +srcdir = @srcdir@ +top_srcdir = @top_srcdir@ +VPATH = @srcdir@ +pkgdatadir = $(datadir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +top_builddir = ../../.. +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +INSTALL = @INSTALL@ +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +subdir = packages/Win32/cygwin +DIST_COMMON = README $(srcdir)/Makefile.am $(srcdir)/Makefile.in +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/m4/curl-compilers.m4 \ + $(top_srcdir)/m4/curl-confopts.m4 \ + $(top_srcdir)/m4/curl-functions.m4 \ + $(top_srcdir)/m4/curl-override.m4 \ + $(top_srcdir)/m4/curl-reentrant.m4 \ + $(top_srcdir)/m4/curl-system.m4 $(top_srcdir)/m4/libtool.m4 \ + $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ + $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ + $(top_srcdir)/acinclude.m4 $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs +CONFIG_HEADER = $(top_builddir)/lib/curl_config.h \ + $(top_builddir)/src/curl_config.h \ + $(top_builddir)/include/curl/curlbuild.h +CONFIG_CLEAN_FILES = +SOURCES = +DIST_SOURCES = +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +AMDEP_FALSE = @AMDEP_FALSE@ +AMDEP_TRUE = @AMDEP_TRUE@ +AMTAR = @AMTAR@ +AR = @AR@ +AS = @AS@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +BUILD_LIBHOSTNAME_FALSE = @BUILD_LIBHOSTNAME_FALSE@ +BUILD_LIBHOSTNAME_TRUE = @BUILD_LIBHOSTNAME_TRUE@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CONFIGURE_OPTIONS = @CONFIGURE_OPTIONS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CROSSCOMPILING_FALSE = @CROSSCOMPILING_FALSE@ +CROSSCOMPILING_TRUE = @CROSSCOMPILING_TRUE@ +CURLDEBUG_FALSE = @CURLDEBUG_FALSE@ +CURLDEBUG_TRUE = @CURLDEBUG_TRUE@ +CURL_CA_BUNDLE = @CURL_CA_BUNDLE@ +CURL_CFLAG_EXTRAS = @CURL_CFLAG_EXTRAS@ +CURL_DISABLE_DICT = @CURL_DISABLE_DICT@ +CURL_DISABLE_FILE = @CURL_DISABLE_FILE@ +CURL_DISABLE_FTP = @CURL_DISABLE_FTP@ +CURL_DISABLE_GOPHER = @CURL_DISABLE_GOPHER@ +CURL_DISABLE_HTTP = @CURL_DISABLE_HTTP@ +CURL_DISABLE_IMAP = @CURL_DISABLE_IMAP@ +CURL_DISABLE_LDAP = @CURL_DISABLE_LDAP@ +CURL_DISABLE_LDAPS = @CURL_DISABLE_LDAPS@ +CURL_DISABLE_POP3 = @CURL_DISABLE_POP3@ +CURL_DISABLE_PROXY = @CURL_DISABLE_PROXY@ +CURL_DISABLE_RTSP = @CURL_DISABLE_RTSP@ +CURL_DISABLE_SMTP = @CURL_DISABLE_SMTP@ +CURL_DISABLE_TELNET = @CURL_DISABLE_TELNET@ +CURL_DISABLE_TFTP = @CURL_DISABLE_TFTP@ +CURL_LIBS = @CURL_LIBS@ +CURL_NETWORK_LIBS = @CURL_NETWORK_LIBS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DLLTOOL = @DLLTOOL@ +DSYMUTIL = @DSYMUTIL@ +DUMPBIN = @DUMPBIN@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +ENABLE_SHARED = @ENABLE_SHARED@ +EXEEXT = @EXEEXT@ +FGREP = @FGREP@ +GREP = @GREP@ +HAVE_LDAP_SSL = @HAVE_LDAP_SSL@ +HAVE_LIBZ = @HAVE_LIBZ@ +HAVE_LIBZ_FALSE = @HAVE_LIBZ_FALSE@ +HAVE_LIBZ_TRUE = @HAVE_LIBZ_TRUE@ +HAVE_PK11_CREATEGENERICOBJECT = @HAVE_PK11_CREATEGENERICOBJECT@ +IDN_ENABLED = @IDN_ENABLED@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +IPV6_ENABLED = @IPV6_ENABLED@ +KRB4_ENABLED = @KRB4_ENABLED@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LIBCURL_LIBS = @LIBCURL_LIBS@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +MAINT = @MAINT@ +MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@ +MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@ +MAKEINFO = @MAKEINFO@ +MANOPT = @MANOPT@ +MIMPURE_FALSE = @MIMPURE_FALSE@ +MIMPURE_TRUE = @MIMPURE_TRUE@ +NM = @NM@ +NMEDIT = @NMEDIT@ +NO_UNDEFINED_FALSE = @NO_UNDEFINED_FALSE@ +NO_UNDEFINED_TRUE = @NO_UNDEFINED_TRUE@ +NROFF = @NROFF@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +OTOOL = @OTOOL@ +OTOOL64 = @OTOOL64@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH = @PATH@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PERL = @PERL@ +PKGADD_NAME = @PKGADD_NAME@ +PKGADD_PKG = @PKGADD_PKG@ +PKGADD_VENDOR = @PKGADD_VENDOR@ +PKGCONFIG = @PKGCONFIG@ +RANDOM_FILE = @RANDOM_FILE@ +RANLIB = @RANLIB@ +REQUIRE_LIB_DEPS = @REQUIRE_LIB_DEPS@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +SONAME_BUMP_FALSE = @SONAME_BUMP_FALSE@ +SONAME_BUMP_TRUE = @SONAME_BUMP_TRUE@ +SSL_ENABLED = @SSL_ENABLED@ +STATICLIB_FALSE = @STATICLIB_FALSE@ +STATICLIB_TRUE = @STATICLIB_TRUE@ +STRIP = @STRIP@ +SUPPORT_FEATURES = @SUPPORT_FEATURES@ +SUPPORT_PROTOCOLS = @SUPPORT_PROTOCOLS@ +TEST_SERVER_LIBS = @TEST_SERVER_LIBS@ +USE_ARES = @USE_ARES@ +USE_EMBEDDED_ARES_FALSE = @USE_EMBEDDED_ARES_FALSE@ +USE_EMBEDDED_ARES_TRUE = @USE_EMBEDDED_ARES_TRUE@ +USE_GNUTLS = @USE_GNUTLS@ +USE_LIBRTMP = @USE_LIBRTMP@ +USE_LIBSSH2 = @USE_LIBSSH2@ +USE_MANUAL_FALSE = @USE_MANUAL_FALSE@ +USE_MANUAL_TRUE = @USE_MANUAL_TRUE@ +USE_NSS = @USE_NSS@ +USE_OPENLDAP = @USE_OPENLDAP@ +USE_POLARSSL = @USE_POLARSSL@ +USE_SSLEAY = @USE_SSLEAY@ +USE_WINDOWS_SSPI = @USE_WINDOWS_SSPI@ +VERSION = @VERSION@ +VERSIONNUM = @VERSIONNUM@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ +am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ +am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +libext = @libext@ +localedir = @localedir@ +localstatedir = @localstatedir@ +lt_ECHO = @lt_ECHO@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +subdirs = @subdirs@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +EXTRA_DIST = README + +# +# Build a Cygwin binary tar ball +# +# Read the README file for details on using this Makefile +# +# NOTE: As I'm not particularly familiar with Makefiles, this was the +# best I could come up with. It should probably be enhanced someday +# to actually use the correct target and pre-requisite names, etc... +# If anyone else wants to volunteer, feel free ;-) +# + +# Cygwin build number (default to "1") +CYGBUILD = 1 + +# Cygwin tarball build dir (fully-qualified name, gets deleted when done) +cygwintmp = $(CURDIR)/tmp_binbuild +all: all-am + +.SUFFIXES: +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ + && exit 0; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu packages/Win32/cygwin/Makefile'; \ + cd $(top_srcdir) && \ + $(AUTOMAKE) --gnu packages/Win32/cygwin/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +distclean-libtool: + -rm -f libtool +uninstall-info-am: +tags: TAGS +TAGS: + +ctags: CTAGS +CTAGS: + + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ + list='$(DISTFILES)'; for file in $$list; do \ + case $$file in \ + $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ + $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ + esac; \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test "$$dir" != "$$file" && test "$$dir" != "."; then \ + dir="/$$dir"; \ + $(mkdir_p) "$(distdir)$$dir"; \ + else \ + dir=''; \ + fi; \ + if test -d $$d/$$file; then \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ + fi; \ + cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ + else \ + test -f $(distdir)/$$file \ + || cp -p $$d/$$file $(distdir)/$$file \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile +installdirs: +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-generic clean-libtool mostlyclean-am + +distclean: distclean-am + -rm -f Makefile +distclean-am: clean-am distclean-generic distclean-libtool + +dvi: dvi-am + +dvi-am: + +html: html-am + +info: info-am + +info-am: + +install-data-am: + +install-exec-am: + +install-info: install-info-am + +install-man: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-generic mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: uninstall-info-am + +.PHONY: all all-am check check-am clean clean-generic clean-libtool \ + distclean distclean-generic distclean-libtool distdir dvi \ + dvi-am html html-am info info-am install install-am \ + install-data install-data-am install-exec install-exec-am \ + install-info install-info-am install-man install-strip \ + installcheck installcheck-am installdirs maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-generic \ + mostlyclean-libtool pdf pdf-am ps ps-am uninstall uninstall-am \ + uninstall-info-am + + +cygwinbin: + rm -rf $(cygwintmp) + rm -rf $(cygwintmp)-dev + $(MAKE) -C $(top_builddir) DESTDIR=$(cygwintmp) install-strip +# $(STRIP) $(cygwintmp)/usr/bin/cygcurl-?.dll + $(mkinstalldirs) \ + $(cygwintmp)$(datadir)/doc/Cygwin \ + $(cygwintmp)$(datadir)/doc/$(PACKAGE)-$(VERSION) \ + $(cygwintmp)-dev$(datadir)/doc/$(PACKAGE)-$(VERSION)/libcurl \ + $(cygwintmp)-dev$(datadir)/doc/$(PACKAGE)-$(VERSION)/examples \ + $(cygwintmp)-dev$(mandir) +# +# copy some files into the binary install dir + cp $(srcdir)/README \ + $(cygwintmp)$(datadir)/doc/Cygwin/$(PACKAGE)-$(VERSION)-$(CYGBUILD).README + cd $(top_srcdir) ; cp CHANGES COPYING README RELEASE-NOTES docs/* \ + $(cygwintmp)$(datadir)/doc/$(PACKAGE)-$(VERSION) ; pwd + cd $(cygwintmp)$(datadir)/doc/$(PACKAGE)-$(VERSION) ; rm *.1 Makefile* +# +# copy some files into the -dev install dir, remove some from binary + cp $(top_srcdir)/docs/libcurl/*.html \ + $(cygwintmp)-dev$(datadir)/doc/$(PACKAGE)-$(VERSION)/libcurl + cp $(top_srcdir)/docs/examples/* \ + $(cygwintmp)-dev$(datadir)/doc/$(PACKAGE)-$(VERSION)/examples + rm $(cygwintmp)-dev$(datadir)/doc/$(PACKAGE)-$(VERSION)/examples/Makefile* + cp $(top_srcdir)/docs/examples/Makefile.example \ + $(cygwintmp)-dev$(datadir)/doc/$(PACKAGE)-$(VERSION)/examples + mv $(cygwintmp)$(datadir)/doc/$(PACKAGE)-$(VERSION)/BINDINGS \ + $(cygwintmp)-dev$(datadir)/doc/$(PACKAGE)-$(VERSION) + mv $(cygwintmp)$(datadir)/doc/$(PACKAGE)-$(VERSION)/INTERNALS \ + $(cygwintmp)-dev$(datadir)/doc/$(PACKAGE)-$(VERSION) + mv $(cygwintmp)/usr/include $(cygwintmp)-dev/usr + mv $(cygwintmp)/usr/lib $(cygwintmp)-dev/usr + mv $(cygwintmp)$(mandir)/man3 $(cygwintmp)-dev$(mandir) +# +# create both tar files, and delete tmp folders + cd $(cygwintmp) ; tar cjf \ + $(PACKAGE)-$(VERSION)-$(CYGBUILD).tar.bz2 usr + mv $(cygwintmp)/*.tar.bz2 . && rm -rf $(cygwintmp) +# + cd $(cygwintmp)-dev ; tar cjf \ + $(PACKAGE)-devel-$(VERSION)-$(CYGBUILD).tar.bz2 usr + mv $(cygwintmp)-dev/*.tar.bz2 . && rm -rf $(cygwintmp)-dev +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/mobicore/common/curl/packages/Win32/cygwin/README b/mobicore/common/curl/packages/Win32/cygwin/README new file mode 100644 index 0000000000000000000000000000000000000000..7457f7397a8581f0d5ce3447bc0d485591abaf44 --- /dev/null +++ b/mobicore/common/curl/packages/Win32/cygwin/README @@ -0,0 +1,114 @@ +Curl is a tool for transferring files with URL syntax, supporting + FTP, FTPS, HTTP, HTTPS, TELNET, DICT, FILE and LDAP. + Curl supports HTTPS certificates, HTTP POST, HTTP PUT, + FTP uploading, kerberos, HTTP form based upload, proxies, + cookies, user+password authentication, file transfer resume, + http proxy tunneling and a busload of other useful tricks. + +See /usr/doc/curl-$(VERSION)/FEATURES for more info. + + +Dependencies: + - Cygwin + - OpenSSL 0.9.6b-2+ (*) + + (*) cURL can be built without SSL support, see below for details + + +Canonical Homepage and Downloads: + http://curl.haxx.se/ + http://curl.haxx.se/download.html + + +Cygwin specific source files (a .README template and a Makefile + for building binary tarballs) are maintained in the upstream + CVS at: /packages/Win32/cygwin/ + + +Build Instructions (to recompile from the cygwin source tarball): + ---STANDARD (with SSL) RELEASE--- + Download the source (either the official release or the cygwin version), + unpack it (done for you if using setup.exe), then: + + $ ./configure --prefix=/usr --mandir=/usr/share/man # (*) + $ make + $ make test # optional + $ make install # (**) + + (*) The Cygwin project now (as of sometime in 2003) prefers man pages + within /usr/share/man, as opposed to the default /usr/man. + + (**) LibTool 1.4.2 had a bug related to cygwin's use of ".exe" extensions, + such that "make install" blew up at curl.exe. See this URL for details: + http://mail.gnu.org/pipermail/libtool/2001-September/005549.html + The copy of ltmain.sh that is distributed with cURL includes this patch. + + As of curl 7.9.1, the official source compiles (under Cygwin) and tests + 100% cleanly OOTB (Out Of The Box) + + ---NO SSL RELEASE--- + Same as standard, except for the configure step, which changes to: + + $ ./configure --prefix=/usr --mandir=/usr/share/man --without-ssl + + NOTE: the standard release is what is available via Cygwin's setup.exe; + the no-ssl release is only available from the curl website + + +Packaging Instructions: + ---BINARY--- + Compile cleanly as described above, then: + + $ make cygwinbin CYGBUILD=n + + where n is the cygwin release number (e.g. the "1" in curl-7.9-1), + and "CYGBUILD=n" is optional (n defaults to 1 if not specified) + + Assuming everything worked, you'll find your binary tarballs in + $(buildtop)/packages/Win32/cygwin/ + + ---SOURCE--- + 1. download & unpack the pristine source + 2. rename the source dir to add the "-$(REL)" suffix, e.g.: + $ mv curl-7.9 curl-7.9-1 + 3. unpack the pristine source once more, so you'll end up + with 2 directories: "curl-7.9" and "curl-7.9-1" in this example + 3. add a CYGWIN-PATCHES directory, and add this readme to it + $ cd curl-7.9-1; mkdir CYGWIN-PATCHES + $ cp packages/Win32/cygwin/README CYGWIN-PATCHES/curl-7.9-1.README + 4. if applicable, document any changes in the README file + 5. create a patch which, when applied + (using `patch -p1 < curl-7.9-$(REL).patch`) + will remove any changes you've made to the pristine source: + $ cd .. + $ diff -Nrup curl-7.9-1 curl-7.9 > curl-7.9-1.patch + and then move it into the CYGWIN-PATCHES directory + $ mv curl-7.9-1.patch curl-7.9-1/CYGWIN-PATCHES + 6. pack the new source dir into a tar.bz2 file: + $ tar cfj curl-7.9-1-src.tar.bz2 curl-7.9-1 + + ---SETUP.HINT--- + @ curl + sdesc: "a client that groks URLs" + ldesc: "Curl is a tool for transferring files with URL syntax, + supporting FTP, FTPS, HTTP, HTTPS, TELNET, DICT, FILE + and LDAP. Curl supports HTTPS certificates, HTTP POST, HTTP PUT, + FTP uploading, kerberos, HTTP form based upload, proxies, + cookies, user+password authentication, file transfer resume, + http proxy tunneling and a busload of other useful tricks." + category: Web Libs + requires: cygwin openssl + + @ curl-devel + sdesc: "(lib)cURL headers, static libraries, developer docs and samples" + ldesc: "curl-devel is the developer-oriented (non-run-time) parts + of the cURL package. It includes header files, static libraries, + example source code snippets, and the libcurl man pages." + category: Web Libs Devel + requires: cygwin openssl curl + + +Cygwin port maintained by: + Kevin Roth + Questions about cURL should be directed to curl-users@cool.haxx.se. + Questions about this cygwin package go to cygwin@cygwin.com. diff --git a/mobicore/common/curl/packages/vms/Makefile.am b/mobicore/common/curl/packages/vms/Makefile.am new file mode 100644 index 0000000000000000000000000000000000000000..848b62741f4a1018f91624cb4420cc21554be127 --- /dev/null +++ b/mobicore/common/curl/packages/vms/Makefile.am @@ -0,0 +1,16 @@ +EXTRA_DIST = build_vms.com \ + curlmsg.h \ + curlmsg.msg \ + curlmsg.sdl \ + curlmsg_vms.h \ + hpssl_alpha.opt \ + hpssl_ia64.opt \ + hpssl_vax.opt \ + ldap.opt \ + openssl_alpha.opt \ + openssl_ia64.opt \ + openssl_vax.opt \ + openssl_ssl_alpha.opt \ + openssl_ssl_ia64.opt \ + openssl_ssl_vax.opt \ + readme diff --git a/mobicore/common/curl/packages/vms/Makefile.in b/mobicore/common/curl/packages/vms/Makefile.in new file mode 100644 index 0000000000000000000000000000000000000000..65ea195fc5c2431ce42562e0261e50a4ac9b80c8 --- /dev/null +++ b/mobicore/common/curl/packages/vms/Makefile.in @@ -0,0 +1,421 @@ +# Makefile.in generated by automake 1.9.6 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005 Free Software Foundation, Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ +srcdir = @srcdir@ +top_srcdir = @top_srcdir@ +VPATH = @srcdir@ +pkgdatadir = $(datadir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +top_builddir = ../.. +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +INSTALL = @INSTALL@ +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +subdir = packages/vms +DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/m4/curl-compilers.m4 \ + $(top_srcdir)/m4/curl-confopts.m4 \ + $(top_srcdir)/m4/curl-functions.m4 \ + $(top_srcdir)/m4/curl-override.m4 \ + $(top_srcdir)/m4/curl-reentrant.m4 \ + $(top_srcdir)/m4/curl-system.m4 $(top_srcdir)/m4/libtool.m4 \ + $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ + $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ + $(top_srcdir)/acinclude.m4 $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs +CONFIG_HEADER = $(top_builddir)/lib/curl_config.h \ + $(top_builddir)/src/curl_config.h \ + $(top_builddir)/include/curl/curlbuild.h +CONFIG_CLEAN_FILES = +SOURCES = +DIST_SOURCES = +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +AMDEP_FALSE = @AMDEP_FALSE@ +AMDEP_TRUE = @AMDEP_TRUE@ +AMTAR = @AMTAR@ +AR = @AR@ +AS = @AS@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +BUILD_LIBHOSTNAME_FALSE = @BUILD_LIBHOSTNAME_FALSE@ +BUILD_LIBHOSTNAME_TRUE = @BUILD_LIBHOSTNAME_TRUE@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CONFIGURE_OPTIONS = @CONFIGURE_OPTIONS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CROSSCOMPILING_FALSE = @CROSSCOMPILING_FALSE@ +CROSSCOMPILING_TRUE = @CROSSCOMPILING_TRUE@ +CURLDEBUG_FALSE = @CURLDEBUG_FALSE@ +CURLDEBUG_TRUE = @CURLDEBUG_TRUE@ +CURL_CA_BUNDLE = @CURL_CA_BUNDLE@ +CURL_CFLAG_EXTRAS = @CURL_CFLAG_EXTRAS@ +CURL_DISABLE_DICT = @CURL_DISABLE_DICT@ +CURL_DISABLE_FILE = @CURL_DISABLE_FILE@ +CURL_DISABLE_FTP = @CURL_DISABLE_FTP@ +CURL_DISABLE_GOPHER = @CURL_DISABLE_GOPHER@ +CURL_DISABLE_HTTP = @CURL_DISABLE_HTTP@ +CURL_DISABLE_IMAP = @CURL_DISABLE_IMAP@ +CURL_DISABLE_LDAP = @CURL_DISABLE_LDAP@ +CURL_DISABLE_LDAPS = @CURL_DISABLE_LDAPS@ +CURL_DISABLE_POP3 = @CURL_DISABLE_POP3@ +CURL_DISABLE_PROXY = @CURL_DISABLE_PROXY@ +CURL_DISABLE_RTSP = @CURL_DISABLE_RTSP@ +CURL_DISABLE_SMTP = @CURL_DISABLE_SMTP@ +CURL_DISABLE_TELNET = @CURL_DISABLE_TELNET@ +CURL_DISABLE_TFTP = @CURL_DISABLE_TFTP@ +CURL_LIBS = @CURL_LIBS@ +CURL_NETWORK_LIBS = @CURL_NETWORK_LIBS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DLLTOOL = @DLLTOOL@ +DSYMUTIL = @DSYMUTIL@ +DUMPBIN = @DUMPBIN@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +ENABLE_SHARED = @ENABLE_SHARED@ +EXEEXT = @EXEEXT@ +FGREP = @FGREP@ +GREP = @GREP@ +HAVE_LDAP_SSL = @HAVE_LDAP_SSL@ +HAVE_LIBZ = @HAVE_LIBZ@ +HAVE_LIBZ_FALSE = @HAVE_LIBZ_FALSE@ +HAVE_LIBZ_TRUE = @HAVE_LIBZ_TRUE@ +HAVE_PK11_CREATEGENERICOBJECT = @HAVE_PK11_CREATEGENERICOBJECT@ +IDN_ENABLED = @IDN_ENABLED@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +IPV6_ENABLED = @IPV6_ENABLED@ +KRB4_ENABLED = @KRB4_ENABLED@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LIBCURL_LIBS = @LIBCURL_LIBS@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +MAINT = @MAINT@ +MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@ +MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@ +MAKEINFO = @MAKEINFO@ +MANOPT = @MANOPT@ +MIMPURE_FALSE = @MIMPURE_FALSE@ +MIMPURE_TRUE = @MIMPURE_TRUE@ +NM = @NM@ +NMEDIT = @NMEDIT@ +NO_UNDEFINED_FALSE = @NO_UNDEFINED_FALSE@ +NO_UNDEFINED_TRUE = @NO_UNDEFINED_TRUE@ +NROFF = @NROFF@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +OTOOL = @OTOOL@ +OTOOL64 = @OTOOL64@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH = @PATH@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PERL = @PERL@ +PKGADD_NAME = @PKGADD_NAME@ +PKGADD_PKG = @PKGADD_PKG@ +PKGADD_VENDOR = @PKGADD_VENDOR@ +PKGCONFIG = @PKGCONFIG@ +RANDOM_FILE = @RANDOM_FILE@ +RANLIB = @RANLIB@ +REQUIRE_LIB_DEPS = @REQUIRE_LIB_DEPS@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +SONAME_BUMP_FALSE = @SONAME_BUMP_FALSE@ +SONAME_BUMP_TRUE = @SONAME_BUMP_TRUE@ +SSL_ENABLED = @SSL_ENABLED@ +STATICLIB_FALSE = @STATICLIB_FALSE@ +STATICLIB_TRUE = @STATICLIB_TRUE@ +STRIP = @STRIP@ +SUPPORT_FEATURES = @SUPPORT_FEATURES@ +SUPPORT_PROTOCOLS = @SUPPORT_PROTOCOLS@ +TEST_SERVER_LIBS = @TEST_SERVER_LIBS@ +USE_ARES = @USE_ARES@ +USE_EMBEDDED_ARES_FALSE = @USE_EMBEDDED_ARES_FALSE@ +USE_EMBEDDED_ARES_TRUE = @USE_EMBEDDED_ARES_TRUE@ +USE_GNUTLS = @USE_GNUTLS@ +USE_LIBRTMP = @USE_LIBRTMP@ +USE_LIBSSH2 = @USE_LIBSSH2@ +USE_MANUAL_FALSE = @USE_MANUAL_FALSE@ +USE_MANUAL_TRUE = @USE_MANUAL_TRUE@ +USE_NSS = @USE_NSS@ +USE_OPENLDAP = @USE_OPENLDAP@ +USE_POLARSSL = @USE_POLARSSL@ +USE_SSLEAY = @USE_SSLEAY@ +USE_WINDOWS_SSPI = @USE_WINDOWS_SSPI@ +VERSION = @VERSION@ +VERSIONNUM = @VERSIONNUM@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ +am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ +am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +libext = @libext@ +localedir = @localedir@ +localstatedir = @localstatedir@ +lt_ECHO = @lt_ECHO@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +subdirs = @subdirs@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +EXTRA_DIST = build_vms.com \ + curlmsg.h \ + curlmsg.msg \ + curlmsg.sdl \ + curlmsg_vms.h \ + hpssl_alpha.opt \ + hpssl_ia64.opt \ + hpssl_vax.opt \ + ldap.opt \ + openssl_alpha.opt \ + openssl_ia64.opt \ + openssl_vax.opt \ + openssl_ssl_alpha.opt \ + openssl_ssl_ia64.opt \ + openssl_ssl_vax.opt \ + readme + +all: all-am + +.SUFFIXES: +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ + && exit 0; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu packages/vms/Makefile'; \ + cd $(top_srcdir) && \ + $(AUTOMAKE) --gnu packages/vms/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +distclean-libtool: + -rm -f libtool +uninstall-info-am: +tags: TAGS +TAGS: + +ctags: CTAGS +CTAGS: + + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ + list='$(DISTFILES)'; for file in $$list; do \ + case $$file in \ + $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ + $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ + esac; \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test "$$dir" != "$$file" && test "$$dir" != "."; then \ + dir="/$$dir"; \ + $(mkdir_p) "$(distdir)$$dir"; \ + else \ + dir=''; \ + fi; \ + if test -d $$d/$$file; then \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ + fi; \ + cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ + else \ + test -f $(distdir)/$$file \ + || cp -p $$d/$$file $(distdir)/$$file \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile +installdirs: +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-generic clean-libtool mostlyclean-am + +distclean: distclean-am + -rm -f Makefile +distclean-am: clean-am distclean-generic distclean-libtool + +dvi: dvi-am + +dvi-am: + +html: html-am + +info: info-am + +info-am: + +install-data-am: + +install-exec-am: + +install-info: install-info-am + +install-man: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-generic mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: uninstall-info-am + +.PHONY: all all-am check check-am clean clean-generic clean-libtool \ + distclean distclean-generic distclean-libtool distdir dvi \ + dvi-am html html-am info info-am install install-am \ + install-data install-data-am install-exec install-exec-am \ + install-info install-info-am install-man install-strip \ + installcheck installcheck-am installdirs maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-generic \ + mostlyclean-libtool pdf pdf-am ps ps-am uninstall uninstall-am \ + uninstall-info-am + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/mobicore/common/curl/packages/vms/build_vms.com b/mobicore/common/curl/packages/vms/build_vms.com new file mode 100644 index 0000000000000000000000000000000000000000..276e767d836c956f7e928459ccdf8438c08effab --- /dev/null +++ b/mobicore/common/curl/packages/vms/build_vms.com @@ -0,0 +1,583 @@ +$! BUILD_VMS.COM +$! +$! I've taken the original build_vms.com, supplied by Nico Baggus, if +$! memory serves me correctly, and made some modifications. +$! +$! SSL support is controlled by logical names. If SSL$INCLUDE is +$! defined, then it is assumed that HP's SSL product has been installed. +$! If OPENSSL is defined, but SSL$INCLUDE is not, then OpenSSL will be +$! used. If neither logical name is defined, then SSL support will not +$! be compiled/linked in. Command-line options NOHPSSL and NOSSL can be +$! specified to override the automatic SSL selection. +$! +$! Command-line Options: +$! +$! CLEAN Delete product files for this host architecture. (No +$! build done.) +$! CLEAN_ALL Delete product files for all host architectures. (No +$! build done.) +$! +$! 64 Compile with 64-bit pointers. +$! CCQUAL=x Add "x" to the C compiler qualifiers. +$! DEBUG Compile and link with debug. +$! IEEE Use IEEE floating point. (Alpha.) +$! LARGE Enable large-file support. (Non-VAX, VMS >= V7.2.) +$! LDAP Enable LDAP support. +$! LIST Create C compiler listings and linker maps. +$! NOHPSSL Don't use HP SSL, even if available. +$! NOSSL Don't use any SSL, even if available. +$! OSSLOLB Use OpenSSL object libraries (.OLB), even if shared +$! images (.EXE) are available. +$! +$! DCL Symbols: +$! +$! CURL_CCDEFS="c_macro_1=value1 [, c_macro_2=value2 [...]]" +$! Compile with these additional C macros defined. +$! +$! Revisions: +$! +$! 2-DEC-2003, MSK, the "original" version. +$! It works for me. Your mileage may vary. +$! 13-JAN-2004, MSK, moved this procedure to the [.packages.vms] directory +$! and updated it to do hardware dependent builds. +$! 29-JAN-2004, MSK, moved logical defines into defines.com +$! 6-FEB-2004, MSK, put in various SSL support bits +$! 9-MAR-2004, MSK, the config-vms.h* files are now copied to the lib and +$! src directories as curl_config.h. +$! 15-MAR-2004, MSK, All of the curlmsg*.* files have also been moved to +$! this build directory. They will be copied to the src +$! directory before build. The .msg file will be compiled +$! to get the .obj for messages, but the .h and .sdl files +$! are not automatically created since they partly rely on +$! the freeware SDL tool. +$! 8-FEB-2005, MSK, merged the two config-vms.h* files into one that uses +$! USE_SSLEAY to define if the target has SSL support built +$! in. Changed the cc/define parameter accordingly. +$! 11-FEB-2005, MSK, If [--.LIB]AMIGAOS.C and NWLIB.C are there, rename them +$! 23-MAR-2005, MSK, relocated cc_qual define so that DEBUG option would work +$! 25-APR-2007, STL, allow compilation in 64-bit mode. +$! 13-DEC-2009. SMS, Changed to skip unwanted source files without +$! renaming the original files. +$! Eliminated needless, persistent logical names. +$! Added CURL_CCDEFS DCL symbol for user-specified C +$! macro definitions. +$! Added CLEAN and CLEAN_ALL options. +$! Added CCQUAL option for user-specified C compiler +$! qualifiers. +$! Added IEEE option for IEEE floating point (Alpha). +$! Added LARGE option for large-file support. +$! Added OSSLOLB option, and support for OpenSSL +$! shared images. +$! Changed to put listing and map files into lisdir:. +$! Changed to avoid case confusion on ODS5 disks. +$! Added more default dev:[dir] save+restore. +$! Moved remaining "defines.com" code (back) into +$! here, eliminating the hard-coded OpenSSL nonsense. +$! Changed to use F$GETSYI( "ARCH_NAME") (or +$! equivalent) to name architecture-specific product +$! file destination directory, and to create the +$! directory if needed (obviating inclusion of these +$! directories and dummy files in the distribution +$! kit). +$! Changed the "compile" subroutine to break the CC +$! command across multiple lines to avoid DCL +$! line-too-long problems. +$! Changed "vo_c" messages to show the CC qualifiers +$! once, not with every compile command. +$! +$! +$! Save the original default dev:[dir], and arrange for its restoration +$! at exit. +$! +$ curl = "" +$ orig_def = f$environment( "DEFAULT") +$ on error then goto Common_Exit +$ on control_y then goto Common_Exit +$! +$ ctrl_y = 1556 +$ proc = f$environment( "PROCEDURE") +$ proc_dev_dir = - + f$parse( proc, , , "DEVICE")+ f$parse( proc, , , "DIRECTORY") +$! +$! Verbose output message stuff. Define symbol to "write sys$output" or "!". +$! vo_c - verbose output for compile +$! vo_l - link +$! vo_o - object check +$! +$ vo_c = "write sys$output" +$ vo_l = "write sys$output" +$ vo_o = "!" +$! +$! Determine the main distribution directory ("[--]") in an +$! ODS5-tolerant (case-insensitive) way. (We do assume that the only +$! "]" is the one at the end.) +$! +$ set default 'proc_dev_dir' +$ set default [--] +$ top_dev_dir = f$environment( "DEFAULT")- "]" +$! +$! Define the architecture-specific product file destination directory +$! name(s). +$! +$ if (f$getsyi( "HW_MODEL") .lt. 1024) +$ then +$ arch_name = "VAX" +$ else +$ arch_name = "" +$ arch_name = arch_name+ f$edit( f$getsyi( "ARCH_NAME"), "UPCASE") +$ if (arch_name .eqs. "") then arch_name = "UNK" +$ endif +$! +$ exedir = proc_dev_dir- "]"+ ".''arch_name']" +$ lisdir = exedir +$ objdir = exedir +$! +$! Interpret command-line options. +$! +$ hpssl = 0 +$ ldap = 0 +$ list = 0 +$ nohpssl = 0 +$ nossl = 0 +$ openssl = 0 +$ osslolb = 0 +$ cc_qual1 = "" +$ cc_qual2 = "" +$ cc_defs = "HAVE_CONFIG_H=1" +$ if (f$type( CURL_CCDEFS) .nes. "") +$ then +$ CURL_CCDEFS = f$edit( CURL_CCDEFS, "TRIM") +$ cc_defs = cc_defs+ ", "+ CURL_CCDEFS +$ endif +$ link_qual = "" +$ msg_qual = "/object = ''objdir'" +$ ssl_opt = "" +$! +$ arg = 1 +$arg_loop: +$ p = "p''arg'" +$ arg_val = 'p' +$ if (arg_val .eqs. "") then goto arg_loop_out +$ arg_val = f$edit( arg_val, "upcase") +$! +$ if (arg_val .eqs. "CLEAN") +$ then +$ prods = "''exedir'*.*;*" +$ if (f$search( prods) .nes. "") then delete /log 'prods' +$ prods = proc_dev_dir+ arch_name+ ".DIR;1" +$ if (f$search( prods) .nes. "") then delete /log 'prods' +$ goto Common_Exit +$ endif +$! +$ if (arg_val .eqs. "CLEAN_ALL") +$ then +$ prods = proc_dev_dir- "]"+ ".ALPHA]*.*;*" +$ if (f$search( prods) .nes. "") then delete /log 'prods' +$ prods = proc_dev_dir+ "ALPHA"+ ".DIR;1" +$ if (f$search( prods) .nes. "") then delete /log 'prods' +$ prods = proc_dev_dir- "]"+ ".IA64]*.*;*" +$ if (f$search( prods) .nes. "") then delete /log 'prods' +$ prods = proc_dev_dir+ "IA64"+ ".DIR;1" +$ if (f$search( prods) .nes. "") then delete /log 'prods' +$ prods = proc_dev_dir- "]"+ ".VAX]*.*;*" +$ if (f$search( prods) .nes. "") then delete /log 'prods' +$ prods = proc_dev_dir+ "VAX"+ ".DIR;1" +$ if (f$search( prods) .nes. "") then delete /log 'prods' +$ goto Common_Exit +$ endif +$! +$ if (arg_val .eqs. "64") +$ then +$ cc_qual1 = cc_qual1+ " /POINTER = 64" +$ goto arg_loop_end +$ endif +$! +$ if (f$extract( 0, 6, arg_val) .eqs. "CCQUAL") +$ then +$ opts = f$edit( arg_val, "COLLAPSE") +$ eq = f$locate( "=", opts) +$ cc_qual2 = f$extract( (eq+ 1), 1000, opts) +$ goto arg_loop_end +$ endif +$! +$ if (arg_val .eqs. "DEBUG") +$ then +$ cc_qual1 = cc_qual1+ " /debug /nooptimize" +$ link_qual = link_qual+ " /debug" +$ goto arg_loop_end +$ endif +$! +$ if (arg_val .eqs. "IEEE") +$ then +$ cc_qual1 = cc_qual1+ " /FLOAT = IEEE_FLOAT" +$ goto arg_loop_end +$ endif +$! +$ if (arg_val .eqs. "LARGE") +$ then +$ if (arch_name .eqs. "VAX") +$ then +$ write sys$output """LARGE"" is ignored on VAX." +$ else +$ cc_defs = cc_defs+ ", _LARGEFILE=1" +$ endif +$ goto arg_loop_end +$ endif +$! +$ if (arg_val .eqs. "LDAP") +$ then +$ ldap = 1 +$ goto arg_loop_end +$ endif +$! +$ if (f$extract( 0, 4, arg_val) .eqs. "LIST") +$ then +$ list = 1 +$ cc_qual1 = cc_qual1+ " /list = ''lisdir' /show = (all, nomessages)" +$ link_qual = link_qual+ " /map = ''lisdir'" +$ msg_qual = msg_qual+ " /list = ''lisdir'" +$ goto arg_loop_end +$ endif +$! +$ if (arg_val .eqs. "NOHPSSL") +$ then +$ nohpssl = 1 +$ goto arg_loop_end +$ endif +$! +$ if (arg_val .eqs. "NOSSL") +$ then +$ nossl = 1 +$ goto arg_loop_end +$ endif +$! +$ if (arg_val .eqs. "OSSLOLB") +$ then +$ osslolb = 1 +$ goto arg_loop_end +$ endif +$! +$ write sys$output "Unrecognized command-line option: ''arg_val'" +$ goto Common_Exit +$! +$arg_loop_end: +$ arg = arg+ 1 +$ goto arg_loop +$arg_loop_out: +$! +$! CC /LIST, LINK /MAP, and MESSAGE /LIST are defaults in batch mode, +$! so be explicit when they're not desired. +$! +$ if (list .eq. 0) +$ then +$ cc_qual1 = cc_qual1+ " /nolist" +$ link_qual = link_qual+ " /nomap" +$ msg_qual = msg_qual+ " /nolist" +$ endif +$! +$! Create product directory, if needed. +$! +$ if (f$search( proc_dev_dir+ arch_name+ ".DIR;1") .eqs. "") +$ then +$ create /directory 'exedir' +$ endif +$! +$! Detect available (but not prohibited) SSL software. +$! +$ if (.not. nossl) +$ then +$ if (f$trnlnm( "OPENSSL") .nes. "") +$ then +$ cc_defs = cc_defs+ ", USE_SSLEAY=1" +$ if ((f$trnlnm( "SSL$INCLUDE") .nes. "") .and. (.not. nohpssl)) +$ then +$! Use HP SSL. +$ hpssl = 1 +$ ssl_opt = ", ''proc_dev_dir'hpssl_"+ - + f$getsyi("ARCH_NAME")+ ".opt /options" +$ else +$! Use OpenSSL. Assume object libraries, unless shared images +$! are found (and not prohibited). +$ openssl = 1 +$ ssl_opt = ", ssllib:libssl.olb /library"+ - + ", ssllib:libcrypto.olb /library" +$ if (osslolb .eq. 0) +$ then + if ((f$search( "ssllib:ssl_libcrypto.exe") .nes. "") .and. - + (f$search( "ssllib:ssl_libssl.exe") .nes. "")) +$ then +$! OpenSSL shared images with "SSL_xxx.EXE names. +$ openssl = 2 +$ ssl_opt = ", ''proc_dev_dir'openssl_ssl_"+ - + f$getsyi("ARCH_NAME")+ ".opt /options" +$ else +$ if ((f$search( "ssllib:libcrypto.exe") .nes. "") .and. - + (f$search( "ssllib:libssl.exe") .nes. "")) +$ then +$! OpenSSL shared images with "xxx.EXE names. +$ openssl = 3 +$ ssl_opt = ", ''proc_dev_dir'openssl_"+ - + f$getsyi("ARCH_NAME")+ ".opt /options" +$ endif +$ endif +$ endif +$ endif +$ endif +$ endif +$! +$! LDAP. +$! +$ if (ldap .eq. 0) +$ then +$ cc_defs = cc_defs+ ", CURL_DISABLE_LDAP=1" +$ endif +$! +$! Form CC qualifiers. +$! +$ cc_defs = "/define = (''cc_defs')" +$ cc_qual2 = cc_qual2+ " /object = ''objdir'"+ - + " /include = ([-.lib], [-.src],"+ - + " [-.packages.vms], [-.packages.vms.''arch_name'])" +$! +$ 'vo_c' "CC opts:", - + " ''cc_defs'", - + " ''cc_qual1'", - + " ''cc_qual2'" +$! +$! Inform the victim of our plans. +$! +$ if (hpssl) +$ then +$ 'vo_c' "%CURL-I-BLDHPSSL, building with HP SSL support" +$ else +$ if (openssl .ne. 0) +$ then +$ if (openssl .eq. 1) +$ then +$ 'vo_c' - + "%CURL-I-BLDOSSL_OLB, building with OpenSSL (object library) support" +$ else +$ 'vo_c' - + "%CURL-I-BLDOSSL_EXE, building with OpenSSL (shared image) support" +$ endif +$ else +$ 'vo_c' "%CURL-I-BLDNOSSL, building with NO SSL support" +$ endif +$ endif +$! +$! Announce destination and SSL directories. +$! +$ 'vo_c' " OBJDIR = ''objdir'" +$ 'vo_c' " EXEDIR = ''exedir'" +$! +$ if (openssl .ne. 0) +$ then +$ ssllib = f$trnlnm( "ssllib") +$ if (ssllib .eqs. "") +$ then +$ ssllib = "(undefined)" +$ endif +$ 'vo_c' " SSLLIB = ''ssllib'" +$! +$ if (openssl .eq. 1) +$ then +$ ossl_lib1 = f$trnlnm( "ssllib")+ "LIBSSL.OLB" +$ ossl_lib2 = f$trnlnm( "ssllib")+ "LIBCRYPTO.OLB" +$ msg = "object libraries" +$ else +$ if (openssl .eq. 2) +$ then +$ ossl_lib1 = f$trnlnm( "ssllib")+ "SSL_LIBSSL.EXE" +$ ossl_lib2 = f$trnlnm( "ssllib")+ "SSL_LIBCRYPTO.EXE" +$ else +$ ossl_lib1 = f$trnlnm( "ssllib")+ "LIBSSL.EXE" +$ ossl_lib2 = f$trnlnm( "ssllib")+ "LIBCRYPTO.EXE" +$ endif +$ msg = "shared images" +$ endif +$ if ((f$search( ossl_lib1) .eqs. "") .or. - + (f$search( ossl_lib2) .eqs. "")) +$ then +$ write sys$output "Can't find OpenSSL ''msg':" +$ write sys$output " ''ossl_lib1'" +$ write sys$output " ''ossl_lib2'" +$ goto Common_Exit +$ endif +$ endif +$! +$! Define the "curl" (process) logical name for "#include ". +$! +$ curl = f$trnlnm( "curl", "LNM$PROCESS") +$ if (curl .nes. "") +$ then +$ write sys$output "" +$ write sys$output - + "Process logical name ""curl"" is already defined, but this procedure" +$ write sys$output - + "would override that definition. Use a command like" +$ write sys$output - + " deassign /process curl" +$ write sys$output - + "to cancel that logical name definition, and then and re-run this procedure." +$ write sys$output "" +$ goto Common_Exit +$ endif +$ define curl 'top_dev_dir'.include.curl] +$! +$! Copy the VMS-specific config file into the product directory. +$! +$ call MoveIfDiff 'top_dev_dir'.lib]config-vms.h 'objdir'curl_config.h +$! +$ on control_y then goto Common_Exit +$! +$ set default 'proc_dev_dir' +$ call build "[--.lib]" "*.c" "''objdir'CURLLIB.OLB" "amigaos, nwlib, nwos" +$ if ($status .eq. ctrl_y) then goto Common_Exit +$ call build "[--.src]" "*.c" "''objdir'CURLSRC.OLB" +$ if ($status .eq. ctrl_y) then goto Common_Exit +$ call build "[]" "*.msg" "''objdir'CURLSRC.OLB" +$ if ($status .eq. ctrl_y) then goto Common_Exit +$! +$ ldap_opt = "" +$ if (ldap .ne. 0) then ldap_opt = ", ''proc_dev_dir'ldap.opt /options" +$! +$ if (openssl .ne. 0) +$ then +$ if (openssl .eq. 1) +$ then +$ 'vo_l' "%CURL-I-LINK_OSSL, linking with OpenSSL (object library)" +$ else +$ 'vo_l' "%CURL-I-LINK_HPSSL, linking with OpenSSL (shared image)" +$ endif +$ else +$ if (hpssl) +$ then +$ 'vo_l' "%CURL-I-LINK_HPSSL, linking with HP SSL" +$ else +$ 'vo_l' "%CURL-I-LINK_NOSSL, linking with NO SSL support" +$ endif +$ endif +$! +$ link 'link_qual' /executable = 'exedir'CURL.EXE - + 'objdir'curlsrc.olb /library /include = (main, curlmsg), - + 'objdir'curllib.olb /library - + 'ssl_opt' - + 'ldap_opt' +$! +$ goto Common_Exit +$! +$! Subroutine to build everything with a filetype passed in via P2 in +$! the directory passed in via P1 and put it in the object library named +$! via P3. Exclude items in P4. +$! +$build: subroutine +$ build_def = f$environment( "default") +$ on control_y then goto EndLoop ! SS$_CONTROLY +$ sts = 1 ! SS$_NORMAL. +$! set noon +$ set default 'p1' +$ search = p2 +$ reset = f$search("reset") +$ if f$search( p3) .eqs. "" +$ then +$ librarian /create /object 'p3' +$ endif +$ reject_list__ = ","+ f$edit( p4, "COLLAPSE, UPCASE")+ "," +$ reject_list___len = f$length( reject_list__) +$ reset = f$search( "reset", 1) +$Loop: +$ file = f$search( search, 1) +$ if file .eqs. "" then goto EndLoop +$! Skip a name if it's in the P4 exclusion list. +$ if (p4 .nes. "") +$ then +$ name__ = ","+ - + f$edit( f$parse( file, , , "NAME", "SYNTAX_ONLY"), "UPCASE")+ - + "," +$ if (f$locate( name__, reject_list__) .lt. reject_list___len) +$ then +$ goto Loop +$ endif +$ endif +$ objfile = f$parse( "''objdir'.OBJ;", file) +$ obj = f$search( objfile, 2) +$ if (obj .nes. "") +$ then +$ if (f$cvtime(f$file(file,"rdt")) .gts. f$cvtime(f$file(obj,"rdt"))) +$ then +$ call compile 'file' +$ sts = $status +$ if .not. sts +$ then +$ goto EndLoop +$ endif +$ librarian /object 'p3' 'objfile' +$ else +$ 'vo_o' "%CURL-I-OBJUTD, ", objfile, " is up to date" +$ endif +$ else +$ 'vo_o' "%CURL-I-OBJDNE, ", file, " does not exist" +$ call compile 'file' +$ sts = $status +$ if .not. sts +$ then +$ goto EndLoop +$ endif +$ librarian /object 'p3' 'objfile' +$ endif +$ goto Loop +$EndLoop: +$!!! purge +$ set default 'build_def' +$ exit 'sts' +$ endsubroutine ! Build +$! +$! Based on the file TYPE, do the right compile command. +$! Only C and MSG supported. +$! +$compile: subroutine +$ on control_y then return ctrl_y ! SS$_CONTROLY +$! set noon +$ file = p1 +$ qual = p2+ p3+ p4+ p5+ p6+ p7+ p8 +$ typ = f$edit( f$parse( file, , , "TYPE"), "UPCASE") - "." +$ if (typ .eqs. "C") +$ then +$ 'vo_c' "CC (opts) ", file +$ CC 'cc_defs' - + 'cc_qual1' - + 'cc_qual2' - + 'file' +$ else +$ cmd_msg = "MESSAGE "+ msg_qual +$ x = cmd_'typ' +$ 'vo_c' x," ",file +$ 'x' 'file' +$ endif +$ ENDSUBROUTINE ! Compile +$! +$! Do a diff of the file specified in P1 with that in P2. If different +$! copy P1 to P2. This also covers if P2 doesn't exist, but not if P2 +$! is an invalid filespec. +$! +$MoveIfDiff: subroutine +$ set NoOn +$ define /user_mode sys$error nl: +$ define /user_mode sys$output nl: +$ differences 'p1' 'p2' +$ status = $status +$ if ( status .ne. %X006C8009) ! if status is not "no diff" +$ then +$ copy 'p1' 'p2' +$ purge /nolog 'p2' +$ endif +$ on control_y then return ctrl_y ! SS$_CONTROLY +$ ENDSUBROUTINE ! MoveIfDiff +$! +$Common_Exit: +$ set default 'orig_def' +$ if ((curl .eqs. "") .and. (f$trnlnm( "curl", "LNM$PROCESS") .nes. "")) +$ then +$ deassign curl +$ endif +$ exit diff --git a/mobicore/common/curl/packages/vms/curlmsg.h b/mobicore/common/curl/packages/vms/curlmsg.h new file mode 100644 index 0000000000000000000000000000000000000000..32f335fd6e1c4b6e60175ebb51265c02c5b4b624 --- /dev/null +++ b/mobicore/common/curl/packages/vms/curlmsg.h @@ -0,0 +1,119 @@ +#ifndef HEADER_CURLMSG_H +#define HEADER_CURLMSG_H + +#pragma __member_alignment __save +#pragma __nomember_alignment + +/* */ +/* CURLMSG.H */ +/* */ +/* SDL File Generated by VAX-11 Message V04-00 on 3-SEP-2008 13:33:54.09 */ +/* */ +/* THESE VMS ERROR CODES ARE GENERATED BY TAKING APART THE CURL.H */ +/* FILE AND PUTTING ALL THE CURLE_* ENUM STUFF INTO THIS FILE, */ +/* CURLMSG.MSG. AN .SDL FILE IS CREATED FROM THIS FILE WITH */ +/* MESSAGE/SDL. THE .H FILE IS CREATED USING THE FREEWARE SDL TOOL */ +/* AGAINST THE .SDL FILE WITH SDL/ALPHA/LANG=CC COMMAND. */ +/* */ +/* WITH THE EXCEPTION OF CURLE_OK, ALL OF THE MESSAGES ARE AT */ +/* THE ERROR SEVERITY LEVEL. WITH THE EXCEPTION OF */ +/* PEER_FAILED_VERIF, WHICH IS A SHORTENED FORM OF */ +/* PEER_FAILED_VERIFICATION, THESE ARE THE SAME NAMES AS THE */ +/* CURLE_ ONES IN INCLUDE/CURL.H. THE MESSAGE UTILITY MANUAL STATES */ +/* "THE COMBINED LENGTH OF THE PREFIX AND THE MESSAGE SYMBOL NAME CANNOT */ +/* EXCEED 31 CHARACTERS." WITH A PREFIX OF FIVE THAT LEAVES US WITH 26 */ +/* FOR THE MESSAGE NAME. */ +/* */ +/* IF YOU UPDATE THIS FILE, UPDATE CURLMSG_VMS.H SO THAT THEY ARE IN SYNC */ +/* */ + +#define CURL_FACILITY 3841 +#define CURL_OK 251756553 +#define CURL_UNSUPPORTED_PROTOCOL 251756562 +#define CURL_FAILED_INIT 251756570 +#define CURL_URL_MALFORMAT 251756578 +#define CURL_OBSOLETE4 251756586 +#define CURL_COULDNT_RESOLVE_PROXY 251756594 +#define CURL_COULDNT_RESOLVE_HOST 251756602 +#define CURL_COULDNT_CONNECT 251756610 +#define CURL_FTP_WEIRD_SERVER_REPLY 251756618 +#define CURL_FTP_ACCESS_DENIED 251756626 +#define CURL_OBSOLETE10 251756634 +#define CURL_FTP_WEIRD_PASS_REPLY 251756642 +#define CURL_OBSOLETE12 251756650 +#define CURL_FTP_WEIRD_PASV_REPLY 251756658 +#define CURL_FTP_WEIRD_227_FORMAT 251756666 +#define CURL_FTP_CANT_GET_HOST 251756674 +#define CURL_OBSOLETE16 251756682 +#define CURL_FTP_COULDNT_SET_TYPE 251756690 +#define CURL_PARTIAL_FILE 251756698 +#define CURL_FTP_COULDNT_RETR_FILE 251756706 +#define CURL_OBSOLETE20 251756714 +#define CURL_QUOTE_ERROR 251756722 +#define CURL_HTTP_RETURNED_ERROR 251756730 +#define CURL_WRITE_ERROR 251756738 +#define CURL_OBSOLETE24 251756746 +#define CURL_UPLOAD_FAILED 251756754 +#define CURL_READ_ERROR 251756762 +#define CURL_OUT_OF_MEMORY 251756770 +#define CURL_OPERATION_TIMEOUTED 251756778 +#define CURL_OBSOLETE29 251756786 +#define CURL_FTP_PORT_FAILED 251756794 +#define CURL_FTP_COULDNT_USE_REST 251756802 +#define CURL_OBSOLETE32 251756810 +#define CURL_RANGE_ERROR 251756818 +#define CURL_HTTP_POST_ERROR 251756826 +#define CURL_SSL_CONNECT_ERROR 251756834 +#define CURL_BAD_DOWNLOAD_RESUME 251756842 +#define CURL_FILE_COULDNT_READ_FILE 251756850 +#define CURL_LDAP_CANNOT_BIND 251756858 +#define CURL_LDAP_SEARCH_FAILED 251756866 +#define CURL_OBSOLETE40 251756874 +#define CURL_FUNCTION_NOT_FOUND 251756882 +#define CURL_ABORTED_BY_CALLBACK 251756890 +#define CURL_BAD_FUNCTION_ARGUMENT 251756898 +#define CURL_OBSOLETE44 251756906 +#define CURL_INTERFACE_FAILED 251756914 +#define CURL_OBSOLETE46 251756922 +#define CURL_TOO_MANY_REDIRECTS 251756930 +#define CURL_UNKNOWN_TELNET_OPTION 251756938 +#define CURL_TELNET_OPTION_SYNTAX 251756946 +#define CURL_OBSOLETE50 251756954 +#define CURL_PEER_FAILED_VERIF 251756962 +#define CURL_GOT_NOTHING 251756970 +#define CURL_SSL_ENGINE_NOTFOUND 251756978 +#define CURL_SSL_ENGINE_SETFAILED 251756986 +#define CURL_SEND_ERROR 251756994 +#define CURL_RECV_ERROR 251757002 +#define CURL_OBSOLETE57 251757010 +#define CURL_SSL_CERTPROBLEM 251757018 +#define CURL_SSL_CIPHER 251757026 +#define CURL_SSL_CACERT 251757034 +#define CURL_BAD_CONTENT_ENCODING 251757042 +#define CURL_LDAP_INVALID_URL 251757050 +#define CURL_FILESIZE_EXCEEDED 251757058 +#define CURL_USE_SSL_FAILED 251757066 +#define CURL_SEND_FAIL_REWIND 251757074 +#define CURL_SSL_ENGINE_INITFAILED 251757082 +#define CURL_LOGIN_DENIED 251757090 +#define CURL_TFTP_NOTFOUND 251757098 +#define CURL_TFTP_PERM 251757106 +#define CURL_REMOTE_DISK_FULL 251757114 +#define CURL_TFTP_ILLEGAL 251757122 +#define CURL_TFTP_UNKNOWNID 251757130 +#define CURL_REMOTE_FILE_EXISTS 251757138 +#define CURL_TFTP_NOSUCHUSER 251757146 +#define CURL_CONV_FAILED 251757154 +#define CURL_CONV_REQD 251757162 +#define CURL_SSL_CACERT_BADFILE 251757170 +#define CURL_REMOTE_FILE_NOT_FOUND 251757178 +#define CURL_SSH 251757186 +#define CURL_SSL_SHUTDOWN_FAILED 251757194 +#define CURL_AGAIN 251757202 +#define CURL_SSL_CRL_BADFILE 251757210 +#define CURL_SSL_ISSUER_ERROR 251757218 +#define CURL_CURL_LAST 251757226 + +#pragma __member_alignment __restore + +#endif /* HEADER_CURLMSG_H */ diff --git a/mobicore/common/curl/packages/vms/curlmsg.msg b/mobicore/common/curl/packages/vms/curlmsg.msg new file mode 100644 index 0000000000000000000000000000000000000000..7fd44835383f2998392169fd03bd29647bf835c9 --- /dev/null +++ b/mobicore/common/curl/packages/vms/curlmsg.msg @@ -0,0 +1,111 @@ +! +! These VMS error codes are generated by taking apart the curl.h +! file and putting all the CURLE_* enum stuff into this file, +! CURLMSG.MSG. An .SDL file is created from this file with +! MESSAGE/SDL. The .H file is created using the freeware SDL tool +! against the .SDL file with SDL/ALPHA/LANG=CC command. +! +! With the exception of CURLE_OK, all of the messages are at +! the error severity level. With the exception of +! PEER_FAILED_VERIF, which is a shortened form of +! PEER_FAILED_VERIFICATION, these are the same names as the +! CURLE_ ones in include/curl.h. The Message Utility manual states +! "The combined length of the prefix and the message symbol name cannot +! exceed 31 characters." With a prefix of five that leaves us with 26 +! for the message name. +! +! If you update this file also update curlmsg_vms.h so that they are in sync +! +.TITLE CURLMSG Message files +.FACILITY CURL,1793 /PREFIX=CURL_ +.BASE 1 +.SEVERITY SUCCESS +OK + +.SEVERITY ERROR +UNSUPPORTED_PROTOCOL +FAILED_INIT +URL_MALFORMAT +OBSOLETE4 +COULDNT_RESOLVE_PROXY +COULDNT_RESOLVE_HOST +COULDNT_CONNECT +FTP_WEIRD_SERVER_REPLY +FTP_ACCESS_DENIED +OBSOLETE10 +FTP_WEIRD_PASS_REPLY +OBSOLETE12 +FTP_WEIRD_PASV_REPLY +FTP_WEIRD_227_FORMAT +FTP_CANT_GET_HOST +OBSOLETE16 +FTP_COULDNT_SET_TYPE +PARTIAL_FILE +FTP_COULDNT_RETR_FILE +OBSOLETE20 +QUOTE_ERROR +HTTP_RETURNED_ERROR +WRITE_ERROR +OBSOLETE24 +UPLOAD_FAILED +READ_ERROR +OUT_OF_MEMORY +OPERATION_TIMEOUTED +OBSOLETE29 +FTP_PORT_FAILED +FTP_COULDNT_USE_REST +OBSOLETE32 +RANGE_ERROR +HTTP_POST_ERROR +SSL_CONNECT_ERROR +BAD_DOWNLOAD_RESUME +FILE_COULDNT_READ_FILE +LDAP_CANNOT_BIND +LDAP_SEARCH_FAILED +OBSOLETE40 +FUNCTION_NOT_FOUND +ABORTED_BY_CALLBACK +BAD_FUNCTION_ARGUMENT +OBSOLETE44 +INTERFACE_FAILED +OBSOLETE46 +TOO_MANY_REDIRECTS +UNKNOWN_TELNET_OPTION +TELNET_OPTION_SYNTAX +OBSOLETE50 +PEER_FAILED_VERIF +GOT_NOTHING +SSL_ENGINE_NOTFOUND +SSL_ENGINE_SETFAILED +SEND_ERROR +RECV_ERROR +OBSOLETE57 +SSL_CERTPROBLEM +SSL_CIPHER +SSL_CACERT +BAD_CONTENT_ENCODING +LDAP_INVALID_URL +FILESIZE_EXCEEDED +USE_SSL_FAILED +SEND_FAIL_REWIND +SSL_ENGINE_INITFAILED +LOGIN_DENIED +TFTP_NOTFOUND +TFTP_PERM +REMOTE_DISK_FULL +TFTP_ILLEGAL +TFTP_UNKNOWNID +REMOTE_FILE_EXISTS +TFTP_NOSUCHUSER +CONV_FAILED +CONV_REQD +SSL_CACERT_BADFILE +REMOTE_FILE_NOT_FOUND +SSH +SSL_SHUTDOWN_FAILED +AGAIN +SSL_CRL_BADFILE +SSL_ISSUER_ERROR +CURL_LAST + +.END diff --git a/mobicore/common/curl/packages/vms/curlmsg.sdl b/mobicore/common/curl/packages/vms/curlmsg.sdl new file mode 100644 index 0000000000000000000000000000000000000000..e192c0750818e8495f9623fb1771c570f899ade5 --- /dev/null +++ b/mobicore/common/curl/packages/vms/curlmsg.sdl @@ -0,0 +1,115 @@ + + + MODULE $CURDEF; + +/* +/* This SDL File Generated by VAX-11 Message V04-00 on 3-SEP-2008 13:33:54.09 +/* +/* $ID: CURLMSG.MSG,V 1.7 2008-05-30 23:51:09 CURLVMS EXP $ +/* +/* THESE VMS ERROR CODES ARE GENERATED BY TAKING APART THE CURL.H +/* FILE AND PUTTING ALL THE CURLE_* ENUM STUFF INTO THIS FILE, +/* CURLMSG.MSG. AN .SDL FILE IS CREATED FROM THIS FILE WITH +/* MESSAGE/SDL. THE .H FILE IS CREATED USING THE FREEWARE SDL TOOL +/* AGAINST THE .SDL FILE WITH SDL/ALPHA/LANG=CC COMMAND. +/* +/* WITH THE EXCEPTION OF CURLE_OK, ALL OF THE MESSAGES ARE AT +/* THE ERROR SEVERITY LEVEL. WITH THE EXCEPTION OF +/* PEER_FAILED_VERIF, WHICH IS A SHORTENED FORM OF +/* PEER_FAILED_VERIFICATION, THESE ARE THE SAME NAMES AS THE +/* CURLE_ ONES IN INCLUDE/CURL.H. THE MESSAGE UTILITY MANUAL STATES +/* "THE COMBINED LENGTH OF THE PREFIX AND THE MESSAGE SYMBOL NAME CANNOT +/* EXCEED 31 CHARACTERS." WITH A PREFIX OF FIVE THAT LEAVES US WITH 26 +/* FOR THE MESSAGE NAME. +/* +/* IF YOU UPDATE THIS FILE ALSO UPDATE CURLMSG_VMS.H SO THAT THEY ARE IN SYNC +/* + CONSTANT + "FACILITY" EQUALS 3841 PREFIX "CURL" TAG "" + ,"OK" EQUALS %X0F018009 PREFIX "CURL" TAG "" + ,"UNSUPPORTED_PROTOCOL" EQUALS %X0F018012 PREFIX "CURL" TAG "" + ,"FAILED_INIT" EQUALS %X0F01801A PREFIX "CURL" TAG "" + ,"URL_MALFORMAT" EQUALS %X0F018022 PREFIX "CURL" TAG "" + ,"OBSOLETE4" EQUALS %X0F01802A PREFIX "CURL" TAG "" + ,"COULDNT_RESOLVE_PROXY" EQUALS %X0F018032 PREFIX "CURL" TAG "" + ,"COULDNT_RESOLVE_HOST" EQUALS %X0F01803A PREFIX "CURL" TAG "" + ,"COULDNT_CONNECT" EQUALS %X0F018042 PREFIX "CURL" TAG "" + ,"FTP_WEIRD_SERVER_REPLY" EQUALS %X0F01804A PREFIX "CURL" TAG "" + ,"FTP_ACCESS_DENIED" EQUALS %X0F018052 PREFIX "CURL" TAG "" + ,"OBSOLETE10" EQUALS %X0F01805A PREFIX "CURL" TAG "" + ,"FTP_WEIRD_PASS_REPLY" EQUALS %X0F018062 PREFIX "CURL" TAG "" + ,"OBSOLETE12" EQUALS %X0F01806A PREFIX "CURL" TAG "" + ,"FTP_WEIRD_PASV_REPLY" EQUALS %X0F018072 PREFIX "CURL" TAG "" + ,"FTP_WEIRD_227_FORMAT" EQUALS %X0F01807A PREFIX "CURL" TAG "" + ,"FTP_CANT_GET_HOST" EQUALS %X0F018082 PREFIX "CURL" TAG "" + ,"OBSOLETE16" EQUALS %X0F01808A PREFIX "CURL" TAG "" + ,"FTP_COULDNT_SET_TYPE" EQUALS %X0F018092 PREFIX "CURL" TAG "" + ,"PARTIAL_FILE" EQUALS %X0F01809A PREFIX "CURL" TAG "" + ,"FTP_COULDNT_RETR_FILE" EQUALS %X0F0180A2 PREFIX "CURL" TAG "" + ,"OBSOLETE20" EQUALS %X0F0180AA PREFIX "CURL" TAG "" + ,"QUOTE_ERROR" EQUALS %X0F0180B2 PREFIX "CURL" TAG "" + ,"HTTP_RETURNED_ERROR" EQUALS %X0F0180BA PREFIX "CURL" TAG "" + ,"WRITE_ERROR" EQUALS %X0F0180C2 PREFIX "CURL" TAG "" + ,"OBSOLETE24" EQUALS %X0F0180CA PREFIX "CURL" TAG "" + ,"UPLOAD_FAILED" EQUALS %X0F0180D2 PREFIX "CURL" TAG "" + ,"READ_ERROR" EQUALS %X0F0180DA PREFIX "CURL" TAG "" + ,"OUT_OF_MEMORY" EQUALS %X0F0180E2 PREFIX "CURL" TAG "" + ,"OPERATION_TIMEOUTED" EQUALS %X0F0180EA PREFIX "CURL" TAG "" + ,"OBSOLETE29" EQUALS %X0F0180F2 PREFIX "CURL" TAG "" + ,"FTP_PORT_FAILED" EQUALS %X0F0180FA PREFIX "CURL" TAG "" + ,"FTP_COULDNT_USE_REST" EQUALS %X0F018102 PREFIX "CURL" TAG "" + ,"OBSOLETE32" EQUALS %X0F01810A PREFIX "CURL" TAG "" + ,"RANGE_ERROR" EQUALS %X0F018112 PREFIX "CURL" TAG "" + ,"HTTP_POST_ERROR" EQUALS %X0F01811A PREFIX "CURL" TAG "" + ,"SSL_CONNECT_ERROR" EQUALS %X0F018122 PREFIX "CURL" TAG "" + ,"BAD_DOWNLOAD_RESUME" EQUALS %X0F01812A PREFIX "CURL" TAG "" + ,"FILE_COULDNT_READ_FILE" EQUALS %X0F018132 PREFIX "CURL" TAG "" + ,"LDAP_CANNOT_BIND" EQUALS %X0F01813A PREFIX "CURL" TAG "" + ,"LDAP_SEARCH_FAILED" EQUALS %X0F018142 PREFIX "CURL" TAG "" + ,"OBSOLETE40" EQUALS %X0F01814A PREFIX "CURL" TAG "" + ,"FUNCTION_NOT_FOUND" EQUALS %X0F018152 PREFIX "CURL" TAG "" + ,"ABORTED_BY_CALLBACK" EQUALS %X0F01815A PREFIX "CURL" TAG "" + ,"BAD_FUNCTION_ARGUMENT" EQUALS %X0F018162 PREFIX "CURL" TAG "" + ,"OBSOLETE44" EQUALS %X0F01816A PREFIX "CURL" TAG "" + ,"INTERFACE_FAILED" EQUALS %X0F018172 PREFIX "CURL" TAG "" + ,"OBSOLETE46" EQUALS %X0F01817A PREFIX "CURL" TAG "" + ,"TOO_MANY_REDIRECTS" EQUALS %X0F018182 PREFIX "CURL" TAG "" + ,"UNKNOWN_TELNET_OPTION" EQUALS %X0F01818A PREFIX "CURL" TAG "" + ,"TELNET_OPTION_SYNTAX" EQUALS %X0F018192 PREFIX "CURL" TAG "" + ,"OBSOLETE50" EQUALS %X0F01819A PREFIX "CURL" TAG "" + ,"PEER_FAILED_VERIF" EQUALS %X0F0181A2 PREFIX "CURL" TAG "" + ,"GOT_NOTHING" EQUALS %X0F0181AA PREFIX "CURL" TAG "" + ,"SSL_ENGINE_NOTFOUND" EQUALS %X0F0181B2 PREFIX "CURL" TAG "" + ,"SSL_ENGINE_SETFAILED" EQUALS %X0F0181BA PREFIX "CURL" TAG "" + ,"SEND_ERROR" EQUALS %X0F0181C2 PREFIX "CURL" TAG "" + ,"RECV_ERROR" EQUALS %X0F0181CA PREFIX "CURL" TAG "" + ,"OBSOLETE57" EQUALS %X0F0181D2 PREFIX "CURL" TAG "" + ,"SSL_CERTPROBLEM" EQUALS %X0F0181DA PREFIX "CURL" TAG "" + ,"SSL_CIPHER" EQUALS %X0F0181E2 PREFIX "CURL" TAG "" + ,"SSL_CACERT" EQUALS %X0F0181EA PREFIX "CURL" TAG "" + ,"BAD_CONTENT_ENCODING" EQUALS %X0F0181F2 PREFIX "CURL" TAG "" + ,"LDAP_INVALID_URL" EQUALS %X0F0181FA PREFIX "CURL" TAG "" + ,"FILESIZE_EXCEEDED" EQUALS %X0F018202 PREFIX "CURL" TAG "" + ,"USE_SSL_FAILED" EQUALS %X0F01820A PREFIX "CURL" TAG "" + ,"SEND_FAIL_REWIND" EQUALS %X0F018212 PREFIX "CURL" TAG "" + ,"SSL_ENGINE_INITFAILED" EQUALS %X0F01821A PREFIX "CURL" TAG "" + ,"LOGIN_DENIED" EQUALS %X0F018222 PREFIX "CURL" TAG "" + ,"TFTP_NOTFOUND" EQUALS %X0F01822A PREFIX "CURL" TAG "" + ,"TFTP_PERM" EQUALS %X0F018232 PREFIX "CURL" TAG "" + ,"REMOTE_DISK_FULL" EQUALS %X0F01823A PREFIX "CURL" TAG "" + ,"TFTP_ILLEGAL" EQUALS %X0F018242 PREFIX "CURL" TAG "" + ,"TFTP_UNKNOWNID" EQUALS %X0F01824A PREFIX "CURL" TAG "" + ,"REMOTE_FILE_EXISTS" EQUALS %X0F018252 PREFIX "CURL" TAG "" + ,"TFTP_NOSUCHUSER" EQUALS %X0F01825A PREFIX "CURL" TAG "" + ,"CONV_FAILED" EQUALS %X0F018262 PREFIX "CURL" TAG "" + ,"CONV_REQD" EQUALS %X0F01826A PREFIX "CURL" TAG "" + ,"SSL_CACERT_BADFILE" EQUALS %X0F018272 PREFIX "CURL" TAG "" + ,"REMOTE_FILE_NOT_FOUND" EQUALS %X0F01827A PREFIX "CURL" TAG "" + ,"SSH" EQUALS %X0F018282 PREFIX "CURL" TAG "" + ,"SSL_SHUTDOWN_FAILED" EQUALS %X0F01828A PREFIX "CURL" TAG "" + ,"AGAIN" EQUALS %X0F018292 PREFIX "CURL" TAG "" + ,"SSL_CRL_BADFILE" EQUALS %X0F01829A PREFIX "CURL" TAG "" + ,"SSL_ISSUER_ERROR" EQUALS %X0F0182A2 PREFIX "CURL" TAG "" + ,"CURL_LAST" EQUALS %X0F0182AA PREFIX "CURL" TAG "" + ; + END_MODULE; diff --git a/mobicore/common/curl/packages/vms/curlmsg_vms.h b/mobicore/common/curl/packages/vms/curlmsg_vms.h new file mode 100644 index 0000000000000000000000000000000000000000..e99e88c48f5c46645a4f4799d4ef6cb73cdb831f --- /dev/null +++ b/mobicore/common/curl/packages/vms/curlmsg_vms.h @@ -0,0 +1,120 @@ +#ifndef HEADER_CURLMSG_VMS_H +#define HEADER_CURLMSG_VMS_H + +/* */ +/* CURLMSG_VMS.H */ +/* */ +/* This defines the necessary bits to change CURLE_* error codes to VMS */ +/* style error codes. CURLMSG.H is built from CURLMSG.SDL which is built */ +/* from CURLMSG.MSG. The vms_cond array is used to return VMS errors by */ +/* putting the VMS error codes into the array offset based on CURLE_* code. */ +/* */ +/* If you update CURLMSG.MSG make sure to update this file to match. */ +/* */ + +#include "curlmsg.h" + +/* +#define FAC_CURL 0xC01 +#define FAC_SYSTEM 0 +#define MSG_NORMAL 0 +*/ + +/* +#define SEV_WARNING 0 +#define SEV_SUCCESS 1 +#define SEV_ERROR 2 +#define SEV_INFO 3 +#define SEV_FATAL 4 +*/ + +static const long vms_cond[] = + { + CURL_OK, + CURL_UNSUPPORTED_PROTOCOL, + CURL_FAILED_INIT, + CURL_URL_MALFORMAT, + CURL_OBSOLETE4, + CURL_COULDNT_RESOLVE_PROXY, + CURL_COULDNT_RESOLVE_HOST, + CURL_COULDNT_CONNECT, + CURL_FTP_WEIRD_SERVER_REPLY, + CURL_FTP_ACCESS_DENIED, + CURL_OBSOLETE10, + CURL_FTP_WEIRD_PASS_REPLY, + CURL_OBSOLETE12, + CURL_FTP_WEIRD_PASV_REPLY, + CURL_FTP_WEIRD_227_FORMAT, + CURL_FTP_CANT_GET_HOST, + CURL_OBSOLETE16, + CURL_FTP_COULDNT_SET_TYPE, + CURL_PARTIAL_FILE, + CURL_FTP_COULDNT_RETR_FILE, + CURL_OBSOLETE20, + CURL_QUOTE_ERROR, + CURL_HTTP_RETURNED_ERROR, + CURL_WRITE_ERROR, + CURL_OBSOLETE24, + CURL_UPLOAD_FAILED, + CURL_READ_ERROR, + CURL_OUT_OF_MEMORY, + CURL_OPERATION_TIMEOUTED, + CURL_OBSOLETE29, + CURL_FTP_PORT_FAILED, + CURL_FTP_COULDNT_USE_REST, + CURL_OBSOLETE32, + CURL_RANGE_ERROR, + CURL_HTTP_POST_ERROR, + CURL_SSL_CONNECT_ERROR, + CURL_BAD_DOWNLOAD_RESUME, + CURL_FILE_COULDNT_READ_FILE, + CURL_LDAP_CANNOT_BIND, + CURL_LDAP_SEARCH_FAILED, + CURL_OBSOLETE40, + CURL_FUNCTION_NOT_FOUND, + CURL_ABORTED_BY_CALLBACK, + CURL_BAD_FUNCTION_ARGUMENT, + CURL_OBSOLETE44, + CURL_INTERFACE_FAILED, + CURL_OBSOLETE46, + CURL_TOO_MANY_REDIRECTS, + CURL_UNKNOWN_TELNET_OPTION, + CURL_TELNET_OPTION_SYNTAX, + CURL_OBSOLETE50, + CURL_PEER_FAILED_VERIF, + CURL_GOT_NOTHING, + CURL_SSL_ENGINE_NOTFOUND, + CURL_SSL_ENGINE_SETFAILED, + CURL_SEND_ERROR, + CURL_RECV_ERROR, + CURL_OBSOLETE57, + CURL_SSL_CERTPROBLEM, + CURL_SSL_CIPHER, + CURL_SSL_CACERT, + CURL_BAD_CONTENT_ENCODING, + CURL_LDAP_INVALID_URL, + CURL_FILESIZE_EXCEEDED, + CURL_USE_SSL_FAILED, + CURL_SEND_FAIL_REWIND, + CURL_SSL_ENGINE_INITFAILED, + CURL_LOGIN_DENIED, + CURL_TFTP_NOTFOUND, + CURL_TFTP_PERM, + CURL_REMOTE_DISK_FULL, + CURL_TFTP_ILLEGAL, + CURL_TFTP_UNKNOWNID, + CURL_REMOTE_FILE_EXISTS, + CURL_TFTP_NOSUCHUSER, + CURL_CONV_FAILED, + CURL_CONV_REQD, + CURL_SSL_CACERT_BADFILE, + CURL_REMOTE_FILE_NOT_FOUND, + CURL_SSH, + CURL_SSL_SHUTDOWN_FAILED, + CURL_AGAIN, + CURLE_SSL_CRL_BADFILE, + CURLE_SSL_ISSUER_ERROR, + CURL_CURL_LAST + }; + +#endif /* HEADER_CURLMSG_VMS_H */ diff --git a/mobicore/common/curl/packages/vms/hpssl_alpha.opt b/mobicore/common/curl/packages/vms/hpssl_alpha.opt new file mode 100644 index 0000000000000000000000000000000000000000..3ad9fbdb2dd0e176b6d98f1e06362e4b8eeb7905 --- /dev/null +++ b/mobicore/common/curl/packages/vms/hpssl_alpha.opt @@ -0,0 +1,2 @@ +SYS$LIBRARY:SSL$LIBCRYPTO_SHR32.EXE/SHARE +SYS$LIBRARY:SSL$LIBSSL_SHR32.EXE/SHARE diff --git a/mobicore/common/curl/packages/vms/hpssl_ia64.opt b/mobicore/common/curl/packages/vms/hpssl_ia64.opt new file mode 100644 index 0000000000000000000000000000000000000000..9b22014801e045c17a57bd45449039304bfc85db --- /dev/null +++ b/mobicore/common/curl/packages/vms/hpssl_ia64.opt @@ -0,0 +1,2 @@ +SYS$LIBRARY:SSL$LIBCRYPTO_SHR.EXE/SHARE +SYS$LIBRARY:SSL$LIBSSL_SHR.EXE/SHARE diff --git a/mobicore/common/curl/packages/vms/hpssl_vax.opt b/mobicore/common/curl/packages/vms/hpssl_vax.opt new file mode 100644 index 0000000000000000000000000000000000000000..3ad9fbdb2dd0e176b6d98f1e06362e4b8eeb7905 --- /dev/null +++ b/mobicore/common/curl/packages/vms/hpssl_vax.opt @@ -0,0 +1,2 @@ +SYS$LIBRARY:SSL$LIBCRYPTO_SHR32.EXE/SHARE +SYS$LIBRARY:SSL$LIBSSL_SHR32.EXE/SHARE diff --git a/mobicore/common/curl/packages/vms/ldap.opt b/mobicore/common/curl/packages/vms/ldap.opt new file mode 100644 index 0000000000000000000000000000000000000000..23f1ee40d2391db74d46cc67c39d88c15a44e9ca --- /dev/null +++ b/mobicore/common/curl/packages/vms/ldap.opt @@ -0,0 +1 @@ +SYS$SHARE:LDAP$SHR.EXE /SHARE diff --git a/mobicore/common/curl/packages/vms/openssl_alpha.opt b/mobicore/common/curl/packages/vms/openssl_alpha.opt new file mode 100644 index 0000000000000000000000000000000000000000..b445119a2b6d7e478feb31a2e05d145f31052669 --- /dev/null +++ b/mobicore/common/curl/packages/vms/openssl_alpha.opt @@ -0,0 +1,2 @@ +SSLLIB:LIBCRYPTO.EXE /SHARE +SSLLIB:LIBSSL.EXE /SHARE diff --git a/mobicore/common/curl/packages/vms/openssl_ia64.opt b/mobicore/common/curl/packages/vms/openssl_ia64.opt new file mode 100644 index 0000000000000000000000000000000000000000..b445119a2b6d7e478feb31a2e05d145f31052669 --- /dev/null +++ b/mobicore/common/curl/packages/vms/openssl_ia64.opt @@ -0,0 +1,2 @@ +SSLLIB:LIBCRYPTO.EXE /SHARE +SSLLIB:LIBSSL.EXE /SHARE diff --git a/mobicore/common/curl/packages/vms/openssl_ssl_alpha.opt b/mobicore/common/curl/packages/vms/openssl_ssl_alpha.opt new file mode 100644 index 0000000000000000000000000000000000000000..c726c2fa4869575dedbb843c10f122ee7a2fd468 --- /dev/null +++ b/mobicore/common/curl/packages/vms/openssl_ssl_alpha.opt @@ -0,0 +1,2 @@ +SSLLIB:SSL_LIBCRYPTO.EXE /SHARE +SSLLIB:SSL_LIBSSL.EXE /SHARE diff --git a/mobicore/common/curl/packages/vms/openssl_ssl_ia64.opt b/mobicore/common/curl/packages/vms/openssl_ssl_ia64.opt new file mode 100644 index 0000000000000000000000000000000000000000..c726c2fa4869575dedbb843c10f122ee7a2fd468 --- /dev/null +++ b/mobicore/common/curl/packages/vms/openssl_ssl_ia64.opt @@ -0,0 +1,2 @@ +SSLLIB:SSL_LIBCRYPTO.EXE /SHARE +SSLLIB:SSL_LIBSSL.EXE /SHARE diff --git a/mobicore/common/curl/packages/vms/openssl_ssl_vax.opt b/mobicore/common/curl/packages/vms/openssl_ssl_vax.opt new file mode 100644 index 0000000000000000000000000000000000000000..c726c2fa4869575dedbb843c10f122ee7a2fd468 --- /dev/null +++ b/mobicore/common/curl/packages/vms/openssl_ssl_vax.opt @@ -0,0 +1,2 @@ +SSLLIB:SSL_LIBCRYPTO.EXE /SHARE +SSLLIB:SSL_LIBSSL.EXE /SHARE diff --git a/mobicore/common/curl/packages/vms/openssl_vax.opt b/mobicore/common/curl/packages/vms/openssl_vax.opt new file mode 100644 index 0000000000000000000000000000000000000000..b445119a2b6d7e478feb31a2e05d145f31052669 --- /dev/null +++ b/mobicore/common/curl/packages/vms/openssl_vax.opt @@ -0,0 +1,2 @@ +SSLLIB:LIBCRYPTO.EXE /SHARE +SSLLIB:LIBSSL.EXE /SHARE diff --git a/mobicore/common/curl/packages/vms/readme b/mobicore/common/curl/packages/vms/readme new file mode 100644 index 0000000000000000000000000000000000000000..22fde88e24ac1535555ff97aedcdab841a0cd680 --- /dev/null +++ b/mobicore/common/curl/packages/vms/readme @@ -0,0 +1,70 @@ + _ _ ____ _ + ___| | | | _ \| | + / __| | | | |_) | | + ( (__| |_| | _ <| |___ + \___|\___/|_| \_\_____| + for OpenVMS + +History: + + 9-MAR-2004, Created this readme. file. Marty Kuhrt (MSK). +15-MAR-2004, MSK, Updated to reflect the new files in this directory. +14-FEB-2005, MSK, removed config-vms.h_with* file comments +10-FEB-2010, SMS. General update. + +Prerequisites: + +OpenVMS V7.0 or later (any platform) +DECC V6.5 or later +OpenSSL or hp SSL, if you want SSL support + +What is Here: + +This directory contains the following files: + +build_vms.com Build procedure. +config-vms.h VMS-specific config.h. +curlmsg.h C header defining cURL status code macros. +curlmsg.msg Error message source for curlmsg.h and curlmsg.sdl. +curlmsg.sdl SDL source defining cURL status code constants. +curlmsg_vms.h Mapping of cURL status codes to VMS-form codes. +hpssl_alpha.opt LINK options file for HP SSL on Alpha. +hpssl_ia64.opt LINK options file for HP SSL on IA64. +hpssl_vax.opt LINK options file for HP SSL on VAX. +ldap.opt LINK options file for LDAP. +Makefile.am cURL kit file list for this directory. +Makefile.in cURL kit makefile source for this directory. +openssl_alpha.opt LINK options file for OpenSSL on Alpha. +openssl_ia64.opt LINK options file for OpenSSL on IA64. +openssl_ssl_alpha.opt LINK options file for OpenSSL (SSL_ prefix) on Alpha. +openssl_ssl_ia64.opt LINK options file for OpenSSL (SSL_ prefix) on IA64. +openssl_ssl_vax.opt LINK options file for OpenSSL (SSL_ prefix) on VAX. +openssl_vax.opt LINK options file for OpenSSL on VAX. +readme. This file. + + +How to Build: + +The (brute-force) builder is [.packages.vms]build_vms.com. Comments in +this procedure describe various optional parameters which enable or +disable optional program features, or which control the build in other +ways. Product files (.EXE, .H, .LIS, .MAP, .OBJ, .OLB, ...) should be +produced in an architecture-specific subdirectory under this directory +([.ALPHA], [.IA64], [.VAX]). + + Example build commands: + + @ [.packages.vms]build_vms.com CLEAN + @ [.packages.vms]build_vms.com LARGE LDAP + submit /noprint [.packages.vms]build_vms.com /param = (LARGE, LDAP) + + +Other Notes: + +The test suites are not supported as of 7.11.0. + +The curlmsg.sdl and curlmsg.h files are generated from curlmsg.msg. +This is not done automatically, since the .MSG file is a hand edit +of the relevant stuff from the curl.h file. If you want to do this +yourself you'll need the SDL package from the freeware collection. + diff --git a/mobicore/common/curl/sample.emacs b/mobicore/common/curl/sample.emacs new file mode 100644 index 0000000000000000000000000000000000000000..e4470fe9eb901ebcf89c690339e6c458b37a6153 --- /dev/null +++ b/mobicore/common/curl/sample.emacs @@ -0,0 +1,45 @@ + +;; This file was contributed by Mats Lidell + +;; Here's a sample .emacs file that might help you along the way. + +;; First comes a setup that is ideal when you are only working with curl. Just +;; select the next few lines, paste it into your .emacs and change the path to +;; the tools folder. (If you are using more than one style. Look further down +;; this file.) + +(load-file "/curl-style.el") +(add-hook 'c-mode-common-hook 'curl-c-mode-common-hook) + +;; If you are using more than one style in maybe more than one project the +;; example below might help out. It uses a predicate hook pair to select the +;; right hook to use. + +(defvar my-style-selective-mode-hook nil + "Holds a list of predicate and hooks pairs. (list (PREDICATE . HOOK) +...) It is used by my-mode-selective-mood-hook-function for choosing +the right hook to run.") + +(defun my-style-selective-mode-hook-function () + "Run each PREDICATE in `my-style-selective-mode-hook' to see if the +HOOK in the pair should be executed. If the PREDICATE evaluate to non +nil HOOK is executed and the rest of the hooks are ignored." + (let ((h my-style-selective-mode-hook)) + (while (not (eval (caar h))) + (setq h (cdr h))) + (funcall (cdar h)))) + +;;; Example configuration. +;; Add the selective hook to the c-mode-common-hook +(add-hook 'c-mode-common-hook 'my-style-selective-mode-hook-function) + +;; Add your own hooks and predicates. The predicate should evaluate to +;; non nil if the hook in the pair is supposed to be evaluated. In the +;; example a part of the path is used to select what style to +;; use. Choose what is appropriate for you. +(add-hook 'my-style-selective-mode-hook + '((string-match "curl" (buffer-file-name)) . curl-c-mode-common-hook)) +(add-hook 'my-style-selective-mode-hook + '((string-match "other" (buffer-file-name)) . other-c-mode-common-hook)) +;; Make sure the default style is appended. +(add-hook 'my-style-selective-mode-hook '(t . my-c-mode-common-hook) t) diff --git a/mobicore/common/curl/src/CMakeLists.txt b/mobicore/common/curl/src/CMakeLists.txt new file mode 100644 index 0000000000000000000000000000000000000000..faea09676a44b9f8989d83259b7e710e554674fe --- /dev/null +++ b/mobicore/common/curl/src/CMakeLists.txt @@ -0,0 +1,56 @@ +set(EXE_NAME curl) + +# First try to locate hugehelp.c to see if it has already been created +# TODO Find the file WITHOUT adding a cache entry!!! Or else the user can delete the file after the script was first run, and the script won't notice it has gone. +find_file(HUGEHELP_C_FILE hugehelp.c PATHS . NO_DEFAULT_PATH) +if (NOT HUGEHELP_C_FILE) + message(STATUS "Warning: hugehelp.c file was not generated before. Generating an 'empty' file...") + file(WRITE hugehelp.c "/* built-in manual is disabled, blank function */\n#include \"hugehelp.h\"\nvoid hugehelp(void) {}\n\n") +endif() + +transform_makefile_inc("Makefile.inc" "${CMAKE_CURRENT_BINARY_DIR}/Makefile.inc.cmake") +include(${CMAKE_CURRENT_BINARY_DIR}/Makefile.inc.cmake) + +if(MSVC) + list(APPEND CURL_SOURCE curl.rc) +endif() + +add_executable( + ${EXE_NAME} + ${curl_SOURCES} + ) + +source_group("cURLX source files" FILES ${CURLX_ONES}) +source_group("cURL source files" FILES ${CURL_CFILES}) +source_group("cURL header files" FILES ${CURL_HFILES}) + +include_directories( + ${CURL_SOURCE_DIR}/lib # To be able to reach "setup_once.h" + ${CURL_BINARY_DIR}/lib # To be able to reach "curl_config.h" + ${CURL_BINARY_DIR}/include # To be able to reach "curl/curlbuild.h" + ) + + +# Setup dependencies +setup_curl_dependencies(${EXE_NAME}) +target_link_libraries( ${EXE_NAME} libcurl ) + + +################################################################################ + +#SET_TARGET_PROPERTIES(${EXE_NAME} ARCHIVE_OUTPUT_DIRECTORY "blah blah blah") +#SET_TARGET_PROPERTIES(${EXE_NAME} RUNTIME_OUTPUT_DIRECTORY "blah blah blah") +#SET_TARGET_PROPERTIES(${EXE_NAME} LIBRARY_OUTPUT_DIRECTORY "blah blah blah") + +# Add the postfix to the executable since it is not added automatically as for modules and shared libraries +set_target_properties(${EXE_NAME} PROPERTIES + DEBUG_POSTFIX "${CMAKE_DEBUG_POSTFIX}") + +if(MSVC) + if(NOT BUILD_RELEASE_DEBUG_DIRS) + # Ugly workaround to remove the "/debug" or "/release" in each output + set_target_properties(${EXE_NAME} PROPERTIES PREFIX "../") + endif() +endif() + +#INCLUDE(ModuleInstall OPTIONAL) diff --git a/mobicore/common/curl/src/Makefile.Watcom b/mobicore/common/curl/src/Makefile.Watcom new file mode 100644 index 0000000000000000000000000000000000000000..eb2e766b2b39b6c12395c0c5d8dcef690bb0b346 --- /dev/null +++ b/mobicore/common/curl/src/Makefile.Watcom @@ -0,0 +1,204 @@ +# +# Watcom / OpenWatcom / Win32 makefile for cURL. +# G. Vanem +# + +!ifndef %watcom +!error WATCOM environment variable not set! +!endif + +!ifdef %libname +LIBNAME = $(%libname) +!else +LIBNAME = libcurl +!endif +TARGETS = $(LIBNAME).dll $(LIBNAME)_imp.lib $(LIBNAME).lib + +CC = wcc386 +LD = wlink +AR = wlib +RC = wrc + +!ifdef __LOADDLL__ +! loaddll wcc386 wccd386 +! loaddll wpp386 wppd386 +! loaddll wlib wlibd +! if $(__VERSION__) > 1270 +! loaddll wlink wlinkd +! else +! loaddll wlink wlink +! endif +!endif + +!ifdef __LINUX__ +DS = / +CP = cp +MD = mkdir -p +RD = rmdir -p +RM = rm -f +!else +DS = $(X)\$(X) +CP = copy 2>NUL +MD = mkdir +RD = rmdir /q /s 2>NUL +!if $(__VERSION__) < 1250 +RM = del /q /f 2>NUL +!else +RM = rm -f +!endif +!endif + +SYS_INCL = -I$(%watcom)$(DS)h$(DS)nt -I$(%watcom)$(DS)h +SYS_LIBS = $(%watcom)$(DS)lib386$(DS)nt;$(%watcom)$(DS)lib386 + +CFLAGS = -3r -mf -hc -zff -zgf -zq -zm -s -fr=con -w2 -fpi -oilrtfm & + -wcd=201 -bt=nt -bc -d+ -dWIN32 -dHAVE_STRTOLL & + -I..$(DS)include -I..$(DS)lib $(SYS_INCL) + +!ifdef %debug +DEBUG = -dDEBUG=1 -dDEBUGBUILD +CFLAGS += -d3 $(DEBUG) +!else +CFLAGS += -d0 +!endif + +!ifdef %use_ipv6 +CFLAGS += -d_WIN32_WINNT=0x0501 -dENABLE_IPV6 +!endif + +# +# Change to suite. +# +!ifdef %zlib_root +ZLIB_ROOT = $(%zlib_root) +!else +ZLIB_ROOT = ..$(DS)..$(DS)zlib-1.2.5 +!endif + +!ifdef %libssh2_root +LIBSSH2_ROOT = $(%libssh2_root) +!else +LIBSSH2_ROOT = ..$(DS)..$(DS)libssh2-1.2.7 +!endif + +!ifdef %librtmp_root +LIBRTMP_ROOT = $(%librtmp_root) +!else +LIBRTMP_ROOT = ..$(DS)..$(DS)rtmpdump-2.3 +!endif + +!ifdef %openssl_root +OPENSSL_ROOT = $(%openssl_root) +!else +OPENSSL_ROOT = ..$(DS)..$(DS)openssl-0.9.8q +!endif + +!ifdef %ares_root +ARES_ROOT = $(%ares_root) +!else +ARES_ROOT = ..$(DS)ares +!endif + +!ifdef %use_ssl +CFLAGS += -wcd=138 -dUSE_OPENSSL -dUSE_SSLEAY -I$(OPENSSL_ROOT)$(DS)inc32 +!endif + +OBJ_DIR = WC_Win32.obj +LINK_ARG = $(OBJ_DIR)$(DS)wlink.arg + +# In order to process Makefile.inc wmake must be called with -u switch! +!ifndef %MAKEFLAGS +!error You MUST call wmake with the -u switch! +!else +!include Makefile.inc +!endif +# For now we still define the CURLX_ONES sources here unless we know how +# to split off the prefixed path. +CURLX_SOURCES = rawstr.c nonblock.c + +OBJS = $(CURL_CFILES:.c=.obj) +!ifdef %curl_static +CFLAGS += -DCURL_STATICLIB +!else +CFLAGS += -br +OBJS += $(CURLX_SOURCES:.c=.obj) +!endif +!ifdef __LINUX__ +OBJS = $OBJ_DIR/$(OBJS: = $OBJ_DIR/) + +!else +OBJS = $OBJ_DIR\$(OBJS: = $OBJ_DIR\) +!endif + +RESOURCE = $(OBJ_DIR)$(DS)curl.res + +all: hugehelp.c $(OBJ_DIR) curl.exe .SYMBOLIC + @echo Welcome to cURL + +clean: .SYMBOLIC + -$(RM) $(OBJS) + -$(RM) $(RESOURCE) $(LINK_ARG) + +vclean distclean: clean .SYMBOLIC + -$(RD) $(OBJ_DIR) + -$(RM) curl.exe curl.map curl.sym hugehelp.c + +hugehelp.c: hugehelp.c.cvs + $(CP) $[@ $^@ + +hugehelp.c.cvs: .EXISTSONLY + $(CP) hugehelp.c $^@ + +$(OBJ_DIR): + -$(MD) $^@ + +curl.exe: $(OBJS) $(RESOURCE) $(LINK_ARG) + $(LD) name $^@ @$]@ + +$(RESOURCE): curl.rc + $(RC) $(DEBUG) -q -r -zm -bt=nt -I..$(DS)include $(SYS_INCL) $[@ -fo=$^@ + +# suffix search path - vpath-like hack +.c: ..$(DS)lib + +.ERASE +.c{$(OBJ_DIR)}.obj: + $(CC) $(CFLAGS) $[@ -fo=$^@ + +$(LINK_ARG): $(__MAKEFILES__) + %create $^@ + @%append $^@ system nt + @%append $^@ file { $(OBJS) } +!ifdef %debug + @%append $^@ debug all + @%append $^@ option symfile +!endif + @%append $^@ option quiet, map, caseexact, eliminate, + @%append $^@ res=$(RESOURCE) libpath $(SYS_LIBS) +!ifdef %curl_static + @%append $^@ library wldap32.lib + @%append $^@ library ..$(DS)lib$(DS)$(LIBNAME).lib +!ifdef %use_zlib + @%append $^@ library $(ZLIB_ROOT)$(DS)zlib.lib +!endif +!ifdef %use_rtmp + @%append $^@ library $(LIBRTMP_ROOT)$(DS)librtmp$(DS)librtmp.lib, winmm.lib +!endif +!ifdef %use_ssh2 + @%append $^@ library $(LIBSSH2_ROOT)$(DS)win32$(DS)libssh2.lib +!endif +!ifdef %use_ssl + @%append $^@ library $(OPENSSL_ROOT)$(DS)out32$(DS)libeay32.lib, $(OPENSSL_ROOT)$(DS)out32$(DS)ssleay32.lib +!endif +!ifdef %use_ares + @%append $^@ library $(ARES_ROOT)$(DS)cares.lib +!endif +!else + @%append $^@ library ..$(DS)lib$(DS)$(LIBNAME)_imp.lib +!endif +!ifeq USE_WATT32 1 + @%append $^@ library $(%watt_root)$(DS)lib$(DS)wattcpw_imp.lib +!else + @%append $^@ library ws2_32.lib +!endif + diff --git a/mobicore/common/curl/src/Makefile.am b/mobicore/common/curl/src/Makefile.am new file mode 100644 index 0000000000000000000000000000000000000000..8b3c0b6b272daa7292d8970b2f1db578d5bc6329 --- /dev/null +++ b/mobicore/common/curl/src/Makefile.am @@ -0,0 +1,97 @@ +#*************************************************************************** +# _ _ ____ _ +# Project ___| | | | _ \| | +# / __| | | | |_) | | +# | (__| |_| | _ <| |___ +# \___|\___/|_| \_\_____| +# +# Copyright (C) 1998 - 2009, Daniel Stenberg, , et al. +# +# This software is licensed as described in the file COPYING, which +# you should have received as part of this distribution. The terms +# are also available at http://curl.haxx.se/docs/copyright.html. +# +# You may opt to use, copy, modify, merge, publish, distribute and/or sell +# copies of the Software, and permit persons to whom the Software is +# furnished to do so, under the terms of the COPYING file. +# +# This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY +# KIND, either express or implied. +# +########################################################################### +AUTOMAKE_OPTIONS = foreign nostdinc + +# Specify our include paths here, and do it relative to $(top_srcdir) and +# $(top_builddir), to ensure that these paths which belong to the library +# being currently built and tested are searched before the library which +# might possibly already be installed in the system. +# +# $(top_builddir)/include/curl for generated curlbuild.h included from curl.h +# $(top_builddir)/include for generated curlbuild.h included from lib/setup.h +# $(top_srcdir)/include is for libcurl's external include files +# $(top_builddir)/lib is for libcurl's generated lib/curl_config.h file +# $(top_builddir)/src is for curl's generated src/curl_config.h file +# $(top_srcdir)/lib is for libcurl's lib/setup.h and other "borrowed" files +# $(top_srcdir)/src is for curl's src/setup.h and "curl-private" files + +INCLUDES = -I$(top_builddir)/include/curl \ + -I$(top_builddir)/include \ + -I$(top_srcdir)/include \ + -I$(top_builddir)/lib \ + -I$(top_builddir)/src \ + -I$(top_srcdir)/lib \ + -I$(top_srcdir)/src + +bin_PROGRAMS = curl + +include Makefile.inc + +# This might hold -Werror +CFLAGS += @CURL_CFLAG_EXTRAS@ + +curl_LDADD = $(top_builddir)/lib/libcurl.la @CURL_LIBS@ +curl_DEPENDENCIES = $(top_builddir)/lib/libcurl.la +BUILT_SOURCES = hugehelp.c +CLEANFILES = hugehelp.c +# Use the C locale to ensure that only ASCII characters appear in the +# embedded text. +NROFF=env LC_ALL=C @NROFF@ @MANOPT@ # figured out by the configure script + +EXTRA_DIST = mkhelp.pl makefile.dj Makefile.vc6 Makefile.b32 Makefile.m32 \ + curl_config.h.in macos/curl.mcp.xml.sit.hqx \ + macos/MACINSTALL.TXT macos/src/curl_GUSIConfig.cpp vc6curlsrc.dsp \ + macos/src/macos_main.cpp config-amigaos.h makefile.amiga curl.rc \ + Makefile.netware Makefile.inc Makefile.Watcom vc6curlsrc.dsw \ + CMakeLists.txt + +MANPAGE=$(top_srcdir)/docs/curl.1 +README=$(top_srcdir)/docs/MANUAL +MKHELP=$(top_srcdir)/src/mkhelp.pl +HUGE=hugehelp.c + +if USE_MANUAL +# Here are the stuff to create a built-in manual + +if HAVE_LIBZ +# This generates the hugehelp.c file in both uncompressed and compressed formats +$(HUGE): $(README) $(MANPAGE) mkhelp.pl + echo '#include "setup.h"' > $(HUGE) + echo '#ifndef HAVE_LIBZ' >> $(HUGE) + $(NROFF) $(MANPAGE) | $(PERL) $(MKHELP) $(README) >> $(HUGE) + echo '#else' >> $(HUGE) + $(NROFF) $(MANPAGE) | $(PERL) $(MKHELP) -c $(README) >> $(HUGE) + echo '#endif /* HAVE_LIBZ */' >> $(HUGE) +else # HAVE_LIBZ +# This generates the hugehelp.c file uncompressed only +$(HUGE): $(README) $(MANPAGE) mkhelp.pl + echo '#include "setup.h"' > $(HUGE) + $(NROFF) $(MANPAGE) | $(PERL) $(MKHELP) $(README) >> $(HUGE) +endif + +else # USE_MANUAL +# built-in manual has been disabled, make a blank file +$(HUGE): + echo "/* built-in manual is disabled, blank function */" > $(HUGE) + echo '#include "hugehelp.h"' >> $(HUGE) + echo "void hugehelp(void) {}" >>$(HUGE) +endif diff --git a/mobicore/common/curl/src/Makefile.b32 b/mobicore/common/curl/src/Makefile.b32 new file mode 100644 index 0000000000000000000000000000000000000000..7408dd2d9e1d82b96bfdfa31b21db19c35f8ec06 --- /dev/null +++ b/mobicore/common/curl/src/Makefile.b32 @@ -0,0 +1,89 @@ +############################################################ +# +# Makefile.b32 - Borland's C++ Compiler 5.X +# +# 'src' directory +# +# 'BCCDIR' has to be set up to point to the base directory +# of the compiler, i.e. SET BCCDIR = c:\Borland\BCC55 +# where c:\Borland\BCC55 is the compiler is installed +# +# Written by Jaepil Kim, pit@paradise.net.nz +############################################################ + +# Edit the path below to point to the base of your Zlib sources. +!ifndef ZLIB_PATH +ZLIB_PATH = ../../zlib-1.2.1 +!endif + +# Edit the path below to point to the base of your OpenSSL package. +!ifndef OPENSSL_PATH +OPENSSL_PATH = ../../openssl-0.9.7d +!endif + +# Set program's name +PROGNAME = curl.exe + +# Setup environment +CXX = bcc32 +LD = bcc32 +CP = copy +RM = del +LIB = tlib + +CXXFLAGS = -q -5 -O2 -w-aus -w-ccc -w-csu -w-par -w-pia -w-rch -w-inl -w-ngu -w-pro -tWM +LDFLAGS = -q -lq -lap + +INCDIRS = -I.;../include;../lib +LINKLIB = $(BCCDIR)/lib/cw32mt.lib + +# If you build with SSL support, set WITH_SSL=1 +DEFINES = -DNDEBUG -DWIN32 + +!ifdef DYNAMIC +LIBCURL_LIB = ../lib/libcurl_imp.lib +!else +LIBCURL_LIB = ../lib/libcurl.lib +DEFINES = $(DEFINES) -DCURL_STATICLIB +!endif + +!ifdef WITH_ZLIB +DEFINES = $(DEFINES) -DHAVE_LIBZ -DHAVE_ZLIB_H +INCDIRS = $(INCDIRS);$(ZLIB_PATH) +LINKLIB = $(LINKLIB) $(ZLIB_PATH)/zlib.lib +!endif + +!ifdef WITH_SSL +DEFINES = $(DEFINES) -DUSE_SSLEAY +INCDIRS = $(INCDIRS);$(OPENSSL_PATH)/inc32;$(OPENSSL_PATH)/inc32/openssl +LINKLIB = $(LINKLIB) $(OPENSSL_PATH)/out32/ssleay32.lib $(OPENSSL_PATH)/out32/libeay32.lib +!endif + +.autodepend + +# Makefile.inc provides the CSOURCES and HHEADERS defines +top_srcdir = .. +!include Makefile.inc + +CSOURCES = $(CURL_CFILES) $(CURLX_ONES) +OBJECTS = $(CSOURCES:.c=.obj) + +.c.obj: + $(CXX) -c $(INCDIRS) $(CXXFLAGS) $(DEFINES) $< + +all: $(PROGNAME) + +clean: + -$(RM) $(PROGNAME) + -$(RM) *.obj + -$(RM) hugehelp.c + +$(PROGNAME): $(OBJECTS) $(LIBCURL_LIB) $(LINKLIB) + @-$(RM) $@ + $(LD) $(LDFLAGS) -e$@ $** + +hugehelp.c: hugehelp.c.cvs + @echo Creating $@ + @$(CP) $** $@ + + diff --git a/mobicore/common/curl/src/Makefile.in b/mobicore/common/curl/src/Makefile.in new file mode 100644 index 0000000000000000000000000000000000000000..eadbe48c0b8c9db7eae2e40d7e09be443a7f49dc --- /dev/null +++ b/mobicore/common/curl/src/Makefile.in @@ -0,0 +1,746 @@ +# Makefile.in generated by automake 1.9.6 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005 Free Software Foundation, Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + +# ./src/Makefile.inc +# Using the backslash as line continuation character might be problematic +# with some make flavours, as Watcom's wmake showed us already. If we +# ever want to change this in a portable manner then we should consider +# this idea (posted to the libcurl list by Adam Kellas): +# CSRC1 = file1.c file2.c file3.c +# CSRC2 = file4.c file5.c file6.c +# CSOURCES = $(CSRC1) $(CSRC2) + +srcdir = @srcdir@ +top_srcdir = @top_srcdir@ +VPATH = @srcdir@ +pkgdatadir = $(datadir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +top_builddir = .. +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +INSTALL = @INSTALL@ +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +bin_PROGRAMS = curl$(EXEEXT) +DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \ + $(srcdir)/Makefile.inc $(srcdir)/curl_config.h.in +subdir = src +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/m4/curl-compilers.m4 \ + $(top_srcdir)/m4/curl-confopts.m4 \ + $(top_srcdir)/m4/curl-functions.m4 \ + $(top_srcdir)/m4/curl-override.m4 \ + $(top_srcdir)/m4/curl-reentrant.m4 \ + $(top_srcdir)/m4/curl-system.m4 $(top_srcdir)/m4/libtool.m4 \ + $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ + $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ + $(top_srcdir)/acinclude.m4 $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs +CONFIG_HEADER = $(top_builddir)/lib/curl_config.h curl_config.h \ + $(top_builddir)/include/curl/curlbuild.h +CONFIG_CLEAN_FILES = +am__installdirs = "$(DESTDIR)$(bindir)" +binPROGRAMS_INSTALL = $(INSTALL_PROGRAM) +PROGRAMS = $(bin_PROGRAMS) +am__objects_1 = main.$(OBJEXT) hugehelp.$(OBJEXT) urlglob.$(OBJEXT) \ + writeout.$(OBJEXT) writeenv.$(OBJEXT) getpass.$(OBJEXT) \ + homedir.$(OBJEXT) curlutil.$(OBJEXT) os-specific.$(OBJEXT) \ + xattr.$(OBJEXT) +am__objects_2 = strtoofft.$(OBJEXT) strdup.$(OBJEXT) rawstr.$(OBJEXT) \ + nonblock.$(OBJEXT) +am__objects_3 = +am_curl_OBJECTS = $(am__objects_1) $(am__objects_2) $(am__objects_3) +curl_OBJECTS = $(am_curl_OBJECTS) +DEFAULT_INCLUDES = +depcomp = $(SHELL) $(top_srcdir)/depcomp +am__depfiles_maybe = depfiles +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +LTCOMPILE = $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) \ + $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ + $(AM_CFLAGS) $(CFLAGS) +CCLD = $(CC) +LINK = $(LIBTOOL) --tag=CC --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ + $(AM_LDFLAGS) $(LDFLAGS) -o $@ +SOURCES = $(curl_SOURCES) +DIST_SOURCES = $(curl_SOURCES) +ETAGS = etags +CTAGS = ctags +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +AMDEP_FALSE = @AMDEP_FALSE@ +AMDEP_TRUE = @AMDEP_TRUE@ +AMTAR = @AMTAR@ +AR = @AR@ +AS = @AS@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +BUILD_LIBHOSTNAME_FALSE = @BUILD_LIBHOSTNAME_FALSE@ +BUILD_LIBHOSTNAME_TRUE = @BUILD_LIBHOSTNAME_TRUE@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ + +# This might hold -Werror +CFLAGS = @CFLAGS@ @CURL_CFLAG_EXTRAS@ +CONFIGURE_OPTIONS = @CONFIGURE_OPTIONS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CROSSCOMPILING_FALSE = @CROSSCOMPILING_FALSE@ +CROSSCOMPILING_TRUE = @CROSSCOMPILING_TRUE@ +CURLDEBUG_FALSE = @CURLDEBUG_FALSE@ +CURLDEBUG_TRUE = @CURLDEBUG_TRUE@ +CURL_CA_BUNDLE = @CURL_CA_BUNDLE@ +CURL_CFLAG_EXTRAS = @CURL_CFLAG_EXTRAS@ +CURL_DISABLE_DICT = @CURL_DISABLE_DICT@ +CURL_DISABLE_FILE = @CURL_DISABLE_FILE@ +CURL_DISABLE_FTP = @CURL_DISABLE_FTP@ +CURL_DISABLE_GOPHER = @CURL_DISABLE_GOPHER@ +CURL_DISABLE_HTTP = @CURL_DISABLE_HTTP@ +CURL_DISABLE_IMAP = @CURL_DISABLE_IMAP@ +CURL_DISABLE_LDAP = @CURL_DISABLE_LDAP@ +CURL_DISABLE_LDAPS = @CURL_DISABLE_LDAPS@ +CURL_DISABLE_POP3 = @CURL_DISABLE_POP3@ +CURL_DISABLE_PROXY = @CURL_DISABLE_PROXY@ +CURL_DISABLE_RTSP = @CURL_DISABLE_RTSP@ +CURL_DISABLE_SMTP = @CURL_DISABLE_SMTP@ +CURL_DISABLE_TELNET = @CURL_DISABLE_TELNET@ +CURL_DISABLE_TFTP = @CURL_DISABLE_TFTP@ +CURL_LIBS = @CURL_LIBS@ +CURL_NETWORK_LIBS = @CURL_NETWORK_LIBS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DLLTOOL = @DLLTOOL@ +DSYMUTIL = @DSYMUTIL@ +DUMPBIN = @DUMPBIN@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +ENABLE_SHARED = @ENABLE_SHARED@ +EXEEXT = @EXEEXT@ +FGREP = @FGREP@ +GREP = @GREP@ +HAVE_LDAP_SSL = @HAVE_LDAP_SSL@ +HAVE_LIBZ = @HAVE_LIBZ@ +HAVE_LIBZ_FALSE = @HAVE_LIBZ_FALSE@ +HAVE_LIBZ_TRUE = @HAVE_LIBZ_TRUE@ +HAVE_PK11_CREATEGENERICOBJECT = @HAVE_PK11_CREATEGENERICOBJECT@ +IDN_ENABLED = @IDN_ENABLED@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +IPV6_ENABLED = @IPV6_ENABLED@ +KRB4_ENABLED = @KRB4_ENABLED@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LIBCURL_LIBS = @LIBCURL_LIBS@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +MAINT = @MAINT@ +MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@ +MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@ +MAKEINFO = @MAKEINFO@ +MANOPT = @MANOPT@ +MIMPURE_FALSE = @MIMPURE_FALSE@ +MIMPURE_TRUE = @MIMPURE_TRUE@ +NM = @NM@ +NMEDIT = @NMEDIT@ +NO_UNDEFINED_FALSE = @NO_UNDEFINED_FALSE@ +NO_UNDEFINED_TRUE = @NO_UNDEFINED_TRUE@ +# Use the C locale to ensure that only ASCII characters appear in the +# embedded text. +NROFF = env LC_ALL=C @NROFF@ @MANOPT@ # figured out by the configure script +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +OTOOL = @OTOOL@ +OTOOL64 = @OTOOL64@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH = @PATH@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PERL = @PERL@ +PKGADD_NAME = @PKGADD_NAME@ +PKGADD_PKG = @PKGADD_PKG@ +PKGADD_VENDOR = @PKGADD_VENDOR@ +PKGCONFIG = @PKGCONFIG@ +RANDOM_FILE = @RANDOM_FILE@ +RANLIB = @RANLIB@ +REQUIRE_LIB_DEPS = @REQUIRE_LIB_DEPS@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +SONAME_BUMP_FALSE = @SONAME_BUMP_FALSE@ +SONAME_BUMP_TRUE = @SONAME_BUMP_TRUE@ +SSL_ENABLED = @SSL_ENABLED@ +STATICLIB_FALSE = @STATICLIB_FALSE@ +STATICLIB_TRUE = @STATICLIB_TRUE@ +STRIP = @STRIP@ +SUPPORT_FEATURES = @SUPPORT_FEATURES@ +SUPPORT_PROTOCOLS = @SUPPORT_PROTOCOLS@ +TEST_SERVER_LIBS = @TEST_SERVER_LIBS@ +USE_ARES = @USE_ARES@ +USE_EMBEDDED_ARES_FALSE = @USE_EMBEDDED_ARES_FALSE@ +USE_EMBEDDED_ARES_TRUE = @USE_EMBEDDED_ARES_TRUE@ +USE_GNUTLS = @USE_GNUTLS@ +USE_LIBRTMP = @USE_LIBRTMP@ +USE_LIBSSH2 = @USE_LIBSSH2@ +USE_MANUAL_FALSE = @USE_MANUAL_FALSE@ +USE_MANUAL_TRUE = @USE_MANUAL_TRUE@ +USE_NSS = @USE_NSS@ +USE_OPENLDAP = @USE_OPENLDAP@ +USE_POLARSSL = @USE_POLARSSL@ +USE_SSLEAY = @USE_SSLEAY@ +USE_WINDOWS_SSPI = @USE_WINDOWS_SSPI@ +VERSION = @VERSION@ +VERSIONNUM = @VERSIONNUM@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ +am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ +am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +libext = @libext@ +localedir = @localedir@ +localstatedir = @localstatedir@ +lt_ECHO = @lt_ECHO@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +subdirs = @subdirs@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ + +#*************************************************************************** +# _ _ ____ _ +# Project ___| | | | _ \| | +# / __| | | | |_) | | +# | (__| |_| | _ <| |___ +# \___|\___/|_| \_\_____| +# +# Copyright (C) 1998 - 2009, Daniel Stenberg, , et al. +# +# This software is licensed as described in the file COPYING, which +# you should have received as part of this distribution. The terms +# are also available at http://curl.haxx.se/docs/copyright.html. +# +# You may opt to use, copy, modify, merge, publish, distribute and/or sell +# copies of the Software, and permit persons to whom the Software is +# furnished to do so, under the terms of the COPYING file. +# +# This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY +# KIND, either express or implied. +# +########################################################################### +AUTOMAKE_OPTIONS = foreign nostdinc + +# Specify our include paths here, and do it relative to $(top_srcdir) and +# $(top_builddir), to ensure that these paths which belong to the library +# being currently built and tested are searched before the library which +# might possibly already be installed in the system. +# +# $(top_builddir)/include/curl for generated curlbuild.h included from curl.h +# $(top_builddir)/include for generated curlbuild.h included from lib/setup.h +# $(top_srcdir)/include is for libcurl's external include files +# $(top_builddir)/lib is for libcurl's generated lib/curl_config.h file +# $(top_builddir)/src is for curl's generated src/curl_config.h file +# $(top_srcdir)/lib is for libcurl's lib/setup.h and other "borrowed" files +# $(top_srcdir)/src is for curl's src/setup.h and "curl-private" files +INCLUDES = -I$(top_builddir)/include/curl \ + -I$(top_builddir)/include \ + -I$(top_srcdir)/include \ + -I$(top_builddir)/lib \ + -I$(top_builddir)/src \ + -I$(top_srcdir)/lib \ + -I$(top_srcdir)/src + + +# libcurl has sources that provide functions named curlx_* that aren't part of +# the official API, but we re-use the code here to avoid duplication. +CURLX_ONES = $(top_srcdir)/lib/strtoofft.c \ + $(top_srcdir)/lib/strdup.c \ + $(top_srcdir)/lib/rawstr.c \ + $(top_srcdir)/lib/nonblock.c + +CURL_CFILES = main.c hugehelp.c urlglob.c writeout.c writeenv.c \ + getpass.c homedir.c curlutil.c os-specific.c xattr.c + +CURL_HFILES = hugehelp.h setup.h config-win32.h config-mac.h \ + config-riscos.h urlglob.h version.h os-specific.h \ + writeout.h writeenv.h getpass.h homedir.h curlutil.h \ + xattr.h + +curl_SOURCES = $(CURL_CFILES) $(CURLX_ONES) $(CURL_HFILES) +curl_LDADD = $(top_builddir)/lib/libcurl.la @CURL_LIBS@ +curl_DEPENDENCIES = $(top_builddir)/lib/libcurl.la +BUILT_SOURCES = hugehelp.c +CLEANFILES = hugehelp.c +EXTRA_DIST = mkhelp.pl makefile.dj Makefile.vc6 Makefile.b32 Makefile.m32 \ + curl_config.h.in macos/curl.mcp.xml.sit.hqx \ + macos/MACINSTALL.TXT macos/src/curl_GUSIConfig.cpp vc6curlsrc.dsp \ + macos/src/macos_main.cpp config-amigaos.h makefile.amiga curl.rc \ + Makefile.netware Makefile.inc Makefile.Watcom vc6curlsrc.dsw \ + CMakeLists.txt + +MANPAGE = $(top_srcdir)/docs/curl.1 +README = $(top_srcdir)/docs/MANUAL +MKHELP = $(top_srcdir)/src/mkhelp.pl +HUGE = hugehelp.c +all: $(BUILT_SOURCES) curl_config.h + $(MAKE) $(AM_MAKEFLAGS) all-am + +.SUFFIXES: +.SUFFIXES: .c .lo .o .obj +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(srcdir)/Makefile.inc $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ + && exit 0; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign src/Makefile'; \ + cd $(top_srcdir) && \ + $(AUTOMAKE) --foreign src/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +curl_config.h: stamp-h2 + @if test ! -f $@; then \ + rm -f stamp-h2; \ + $(MAKE) stamp-h2; \ + else :; fi + +stamp-h2: $(srcdir)/curl_config.h.in $(top_builddir)/config.status + @rm -f stamp-h2 + cd $(top_builddir) && $(SHELL) ./config.status src/curl_config.h +$(srcdir)/curl_config.h.in: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) + cd $(top_srcdir) && $(AUTOHEADER) + rm -f stamp-h2 + touch $@ + +distclean-hdr: + -rm -f curl_config.h stamp-h2 +install-binPROGRAMS: $(bin_PROGRAMS) + @$(NORMAL_INSTALL) + test -z "$(bindir)" || $(mkdir_p) "$(DESTDIR)$(bindir)" + @list='$(bin_PROGRAMS)'; for p in $$list; do \ + p1=`echo $$p|sed 's/$(EXEEXT)$$//'`; \ + if test -f $$p \ + || test -f $$p1 \ + ; then \ + f=`echo "$$p1" | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'`; \ + echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) --mode=install $(binPROGRAMS_INSTALL) '$$p' '$(DESTDIR)$(bindir)/$$f'"; \ + $(INSTALL_PROGRAM_ENV) $(LIBTOOL) --mode=install $(binPROGRAMS_INSTALL) "$$p" "$(DESTDIR)$(bindir)/$$f" || exit 1; \ + else :; fi; \ + done + +uninstall-binPROGRAMS: + @$(NORMAL_UNINSTALL) + @list='$(bin_PROGRAMS)'; for p in $$list; do \ + f=`echo "$$p" | sed 's,^.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/'`; \ + echo " rm -f '$(DESTDIR)$(bindir)/$$f'"; \ + rm -f "$(DESTDIR)$(bindir)/$$f"; \ + done + +clean-binPROGRAMS: + @list='$(bin_PROGRAMS)'; for p in $$list; do \ + f=`echo $$p|sed 's/$(EXEEXT)$$//'`; \ + echo " rm -f $$p $$f"; \ + rm -f $$p $$f ; \ + done +curl$(EXEEXT): $(curl_OBJECTS) $(curl_DEPENDENCIES) + @rm -f curl$(EXEEXT) + $(LINK) $(curl_LDFLAGS) $(curl_OBJECTS) $(curl_LDADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/curlutil.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/getpass.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/homedir.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/hugehelp.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/main.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/nonblock.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/os-specific.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rawstr.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/strdup.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/strtoofft.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/urlglob.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/writeenv.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/writeout.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xattr.Po@am__quote@ + +.c.o: +@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c $< + +.c.obj: +@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` + +.c.lo: +@am__fastdepCC_TRUE@ if $(LTCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $< + +strtoofft.o: $(top_srcdir)/lib/strtoofft.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT strtoofft.o -MD -MP -MF "$(DEPDIR)/strtoofft.Tpo" -c -o strtoofft.o `test -f '$(top_srcdir)/lib/strtoofft.c' || echo '$(srcdir)/'`$(top_srcdir)/lib/strtoofft.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/strtoofft.Tpo" "$(DEPDIR)/strtoofft.Po"; else rm -f "$(DEPDIR)/strtoofft.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$(top_srcdir)/lib/strtoofft.c' object='strtoofft.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o strtoofft.o `test -f '$(top_srcdir)/lib/strtoofft.c' || echo '$(srcdir)/'`$(top_srcdir)/lib/strtoofft.c + +strtoofft.obj: $(top_srcdir)/lib/strtoofft.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT strtoofft.obj -MD -MP -MF "$(DEPDIR)/strtoofft.Tpo" -c -o strtoofft.obj `if test -f '$(top_srcdir)/lib/strtoofft.c'; then $(CYGPATH_W) '$(top_srcdir)/lib/strtoofft.c'; else $(CYGPATH_W) '$(srcdir)/$(top_srcdir)/lib/strtoofft.c'; fi`; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/strtoofft.Tpo" "$(DEPDIR)/strtoofft.Po"; else rm -f "$(DEPDIR)/strtoofft.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$(top_srcdir)/lib/strtoofft.c' object='strtoofft.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o strtoofft.obj `if test -f '$(top_srcdir)/lib/strtoofft.c'; then $(CYGPATH_W) '$(top_srcdir)/lib/strtoofft.c'; else $(CYGPATH_W) '$(srcdir)/$(top_srcdir)/lib/strtoofft.c'; fi` + +strdup.o: $(top_srcdir)/lib/strdup.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT strdup.o -MD -MP -MF "$(DEPDIR)/strdup.Tpo" -c -o strdup.o `test -f '$(top_srcdir)/lib/strdup.c' || echo '$(srcdir)/'`$(top_srcdir)/lib/strdup.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/strdup.Tpo" "$(DEPDIR)/strdup.Po"; else rm -f "$(DEPDIR)/strdup.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$(top_srcdir)/lib/strdup.c' object='strdup.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o strdup.o `test -f '$(top_srcdir)/lib/strdup.c' || echo '$(srcdir)/'`$(top_srcdir)/lib/strdup.c + +strdup.obj: $(top_srcdir)/lib/strdup.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT strdup.obj -MD -MP -MF "$(DEPDIR)/strdup.Tpo" -c -o strdup.obj `if test -f '$(top_srcdir)/lib/strdup.c'; then $(CYGPATH_W) '$(top_srcdir)/lib/strdup.c'; else $(CYGPATH_W) '$(srcdir)/$(top_srcdir)/lib/strdup.c'; fi`; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/strdup.Tpo" "$(DEPDIR)/strdup.Po"; else rm -f "$(DEPDIR)/strdup.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$(top_srcdir)/lib/strdup.c' object='strdup.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o strdup.obj `if test -f '$(top_srcdir)/lib/strdup.c'; then $(CYGPATH_W) '$(top_srcdir)/lib/strdup.c'; else $(CYGPATH_W) '$(srcdir)/$(top_srcdir)/lib/strdup.c'; fi` + +rawstr.o: $(top_srcdir)/lib/rawstr.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT rawstr.o -MD -MP -MF "$(DEPDIR)/rawstr.Tpo" -c -o rawstr.o `test -f '$(top_srcdir)/lib/rawstr.c' || echo '$(srcdir)/'`$(top_srcdir)/lib/rawstr.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/rawstr.Tpo" "$(DEPDIR)/rawstr.Po"; else rm -f "$(DEPDIR)/rawstr.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$(top_srcdir)/lib/rawstr.c' object='rawstr.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o rawstr.o `test -f '$(top_srcdir)/lib/rawstr.c' || echo '$(srcdir)/'`$(top_srcdir)/lib/rawstr.c + +rawstr.obj: $(top_srcdir)/lib/rawstr.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT rawstr.obj -MD -MP -MF "$(DEPDIR)/rawstr.Tpo" -c -o rawstr.obj `if test -f '$(top_srcdir)/lib/rawstr.c'; then $(CYGPATH_W) '$(top_srcdir)/lib/rawstr.c'; else $(CYGPATH_W) '$(srcdir)/$(top_srcdir)/lib/rawstr.c'; fi`; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/rawstr.Tpo" "$(DEPDIR)/rawstr.Po"; else rm -f "$(DEPDIR)/rawstr.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$(top_srcdir)/lib/rawstr.c' object='rawstr.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o rawstr.obj `if test -f '$(top_srcdir)/lib/rawstr.c'; then $(CYGPATH_W) '$(top_srcdir)/lib/rawstr.c'; else $(CYGPATH_W) '$(srcdir)/$(top_srcdir)/lib/rawstr.c'; fi` + +nonblock.o: $(top_srcdir)/lib/nonblock.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT nonblock.o -MD -MP -MF "$(DEPDIR)/nonblock.Tpo" -c -o nonblock.o `test -f '$(top_srcdir)/lib/nonblock.c' || echo '$(srcdir)/'`$(top_srcdir)/lib/nonblock.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/nonblock.Tpo" "$(DEPDIR)/nonblock.Po"; else rm -f "$(DEPDIR)/nonblock.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$(top_srcdir)/lib/nonblock.c' object='nonblock.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o nonblock.o `test -f '$(top_srcdir)/lib/nonblock.c' || echo '$(srcdir)/'`$(top_srcdir)/lib/nonblock.c + +nonblock.obj: $(top_srcdir)/lib/nonblock.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT nonblock.obj -MD -MP -MF "$(DEPDIR)/nonblock.Tpo" -c -o nonblock.obj `if test -f '$(top_srcdir)/lib/nonblock.c'; then $(CYGPATH_W) '$(top_srcdir)/lib/nonblock.c'; else $(CYGPATH_W) '$(srcdir)/$(top_srcdir)/lib/nonblock.c'; fi`; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/nonblock.Tpo" "$(DEPDIR)/nonblock.Po"; else rm -f "$(DEPDIR)/nonblock.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$(top_srcdir)/lib/nonblock.c' object='nonblock.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o nonblock.obj `if test -f '$(top_srcdir)/lib/nonblock.c'; then $(CYGPATH_W) '$(top_srcdir)/lib/nonblock.c'; else $(CYGPATH_W) '$(srcdir)/$(top_srcdir)/lib/nonblock.c'; fi` + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +distclean-libtool: + -rm -f libtool +uninstall-info-am: + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + mkid -fID $$unique +tags: TAGS + +TAGS: $(HEADERS) $(SOURCES) curl_config.h.in $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) curl_config.h.in $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$tags $$unique; \ + fi +ctags: CTAGS +CTAGS: $(HEADERS) $(SOURCES) curl_config.h.in $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) curl_config.h.in $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + test -z "$(CTAGS_ARGS)$$tags$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$tags $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && cd $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) $$here + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(DISTFILES) + $(mkdir_p) $(distdir)/macos $(distdir)/macos/src + @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ + list='$(DISTFILES)'; for file in $$list; do \ + case $$file in \ + $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ + $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ + esac; \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test "$$dir" != "$$file" && test "$$dir" != "."; then \ + dir="/$$dir"; \ + $(mkdir_p) "$(distdir)$$dir"; \ + else \ + dir=''; \ + fi; \ + if test -d $$d/$$file; then \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ + fi; \ + cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ + else \ + test -f $(distdir)/$$file \ + || cp -p $$d/$$file $(distdir)/$$file \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: $(BUILT_SOURCES) + $(MAKE) $(AM_MAKEFLAGS) check-am +all-am: Makefile $(PROGRAMS) curl_config.h +installdirs: + for dir in "$(DESTDIR)$(bindir)"; do \ + test -z "$$dir" || $(mkdir_p) "$$dir"; \ + done +install: $(BUILT_SOURCES) + $(MAKE) $(AM_MAKEFLAGS) install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." + -test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES) +clean: clean-am + +clean-am: clean-binPROGRAMS clean-generic clean-libtool mostlyclean-am + +distclean: distclean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-hdr distclean-libtool distclean-tags + +dvi: dvi-am + +dvi-am: + +html: html-am + +info: info-am + +info-am: + +install-data-am: + +install-exec-am: install-binPROGRAMS + +install-info: install-info-am + +install-man: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: uninstall-binPROGRAMS uninstall-info-am + +.PHONY: CTAGS GTAGS all all-am check check-am clean clean-binPROGRAMS \ + clean-generic clean-libtool ctags distclean distclean-compile \ + distclean-generic distclean-hdr distclean-libtool \ + distclean-tags distdir dvi dvi-am html html-am info info-am \ + install install-am install-binPROGRAMS install-data \ + install-data-am install-exec install-exec-am install-info \ + install-info-am install-man install-strip installcheck \ + installcheck-am installdirs maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-compile \ + mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ + tags uninstall uninstall-am uninstall-binPROGRAMS \ + uninstall-info-am + + +# Here are the stuff to create a built-in manual + +# This generates the hugehelp.c file in both uncompressed and compressed formats +@HAVE_LIBZ_TRUE@@USE_MANUAL_TRUE@$(HUGE): $(README) $(MANPAGE) mkhelp.pl +@HAVE_LIBZ_TRUE@@USE_MANUAL_TRUE@ echo '#include "setup.h"' > $(HUGE) +@HAVE_LIBZ_TRUE@@USE_MANUAL_TRUE@ echo '#ifndef HAVE_LIBZ' >> $(HUGE) +@HAVE_LIBZ_TRUE@@USE_MANUAL_TRUE@ $(NROFF) $(MANPAGE) | $(PERL) $(MKHELP) $(README) >> $(HUGE) +@HAVE_LIBZ_TRUE@@USE_MANUAL_TRUE@ echo '#else' >> $(HUGE) +@HAVE_LIBZ_TRUE@@USE_MANUAL_TRUE@ $(NROFF) $(MANPAGE) | $(PERL) $(MKHELP) -c $(README) >> $(HUGE) +@HAVE_LIBZ_TRUE@@USE_MANUAL_TRUE@ echo '#endif /* HAVE_LIBZ */' >> $(HUGE) +# This generates the hugehelp.c file uncompressed only +@HAVE_LIBZ_FALSE@@USE_MANUAL_TRUE@$(HUGE): $(README) $(MANPAGE) mkhelp.pl +@HAVE_LIBZ_FALSE@@USE_MANUAL_TRUE@ echo '#include "setup.h"' > $(HUGE) +@HAVE_LIBZ_FALSE@@USE_MANUAL_TRUE@ $(NROFF) $(MANPAGE) | $(PERL) $(MKHELP) $(README) >> $(HUGE) + +# built-in manual has been disabled, make a blank file +@USE_MANUAL_FALSE@$(HUGE): +@USE_MANUAL_FALSE@ echo "/* built-in manual is disabled, blank function */" > $(HUGE) +@USE_MANUAL_FALSE@ echo '#include "hugehelp.h"' >> $(HUGE) +@USE_MANUAL_FALSE@ echo "void hugehelp(void) {}" >>$(HUGE) +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/mobicore/common/curl/src/Makefile.inc b/mobicore/common/curl/src/Makefile.inc new file mode 100644 index 0000000000000000000000000000000000000000..058c6d28d13ed516e9f65ed2433fae2abd8acc7d --- /dev/null +++ b/mobicore/common/curl/src/Makefile.inc @@ -0,0 +1,26 @@ +# ./src/Makefile.inc +# Using the backslash as line continuation character might be problematic +# with some make flavours, as Watcom's wmake showed us already. If we +# ever want to change this in a portable manner then we should consider +# this idea (posted to the libcurl list by Adam Kellas): +# CSRC1 = file1.c file2.c file3.c +# CSRC2 = file4.c file5.c file6.c +# CSOURCES = $(CSRC1) $(CSRC2) + +# libcurl has sources that provide functions named curlx_* that aren't part of +# the official API, but we re-use the code here to avoid duplication. +CURLX_ONES = $(top_srcdir)/lib/strtoofft.c \ + $(top_srcdir)/lib/strdup.c \ + $(top_srcdir)/lib/rawstr.c \ + $(top_srcdir)/lib/nonblock.c + +CURL_CFILES = main.c hugehelp.c urlglob.c writeout.c writeenv.c \ + getpass.c homedir.c curlutil.c os-specific.c xattr.c + +CURL_HFILES = hugehelp.h setup.h config-win32.h config-mac.h \ + config-riscos.h urlglob.h version.h os-specific.h \ + writeout.h writeenv.h getpass.h homedir.h curlutil.h \ + xattr.h + +curl_SOURCES = $(CURL_CFILES) $(CURLX_ONES) $(CURL_HFILES) + diff --git a/mobicore/common/curl/src/Makefile.m32 b/mobicore/common/curl/src/Makefile.m32 new file mode 100644 index 0000000000000000000000000000000000000000..f7d0d92d9514b7ec6bf2b290b7bfd480fcbd37cf --- /dev/null +++ b/mobicore/common/curl/src/Makefile.m32 @@ -0,0 +1,172 @@ +######################################################################### +# +## Makefile for building curl.exe with MingW32 (GCC-3.2 or later) +## and optionally OpenSSL (0.9.8), libssh2 (1.2), zlib (1.2.5) +## +## Usage: +## mingw32-make -f Makefile.m32 [SSL=1] [SSH2=1] [ZLIB=1] [IDN=1] [SSPI=1] [IPV6=1] [LDAPS=1] [RTMP=1] [DYN=1] +## +## Hint: you can also set environment vars to control the build, f.e.: +## set ZLIB_PATH=c:/zlib-1.2.5 +## set ZLIB=1 +## +## Comments to: Troy Engel or +## Joern Hartroth +######################################################################### + +# Edit the path below to point to the base of your Zlib sources. +ifndef ZLIB_PATH +ZLIB_PATH = ../../zlib-1.2.5 +endif +# Edit the path below to point to the base of your OpenSSL package. +ifndef OPENSSL_PATH +OPENSSL_PATH = ../../openssl-0.9.8q +endif +# Edit the path below to point to the base of your LibSSH2 package. +ifndef LIBSSH2_PATH +LIBSSH2_PATH = ../../libssh2-1.2.7 +endif +# Edit the path below to point to the base of your libidn package. +ifndef LIBIDN_PATH +LIBIDN_PATH = ../../libidn-1.18 +endif +# Edit the path below to point to the base of your librtmp package. +ifndef LIBRTMP_PATH +LIBRTMP_PATH = ../../librtmp-2.3 +endif +# Edit the path below to point to the base of your Novell LDAP NDK. +ifndef LDAP_SDK +LDAP_SDK = c:/novell/ndk/cldapsdk/win32 +endif + +# Edit the path below to point to the base of your c-ares package. +ifndef LIBCARES_PATH +LIBCARES_PATH = ../ares +endif + +CC = gcc +CFLAGS = -g -O2 +# comment LDFLAGS below to keep debug info +LDFLAGS = -s +RC = windres +RCFLAGS = --include-dir=../include -O COFF -i +RM = del /q /f 2>NUL +CP = copy + +# We may need these someday +# PERL = perl +# NROFF = nroff + +######################################################## +## Nothing more to do below this line! + +INCLUDES = -I. -I.. -I../include -I../lib +LINK = $(CC) $(LDFLAGS) -o $@ + +curl_PROGRAMS = curl.exe +ifdef DYN + curl_DEPENDENCIES = ../lib/libcurldll.a ../lib/libcurl.dll + curl_LDADD = -L../lib -lcurldll +else + curl_DEPENDENCIES = ../lib/libcurl.a + curl_LDADD = -L../lib -lcurl + CFLAGS += -DCURL_STATICLIB +endif +ifdef ARES + ifndef DYN + curl_DEPENDENCIES += $(LIBCARES_PATH)/libcares.a + endif + CFLAGS += -DUSE_ARES + curl_LDADD += -L$(LIBCARES_PATH) -lcares +endif +ifdef RTMP + CFLAGS += -DUSE_LIBRTMP + curl_LDADD += -L"$(LIBRTMP_PATH)/librtmp" -lrtmp -lwinmm +endif +ifdef SSH2 + CFLAGS += -DUSE_LIBSSH2 -DHAVE_LIBSSH2_H + curl_LDADD += -L$(LIBSSH2_PATH)/win32 -lssh2 +endif +ifdef SSL + CFLAGS += -DUSE_SSLEAY -DHAVE_OPENSSL_ENGINE_H + curl_LDADD += -L$(OPENSSL_PATH)/out -leay32 -lssl32 +endif +ifdef ZLIB + INCLUDES += -I"$(ZLIB_PATH)" + CFLAGS += -DHAVE_LIBZ -DHAVE_ZLIB_H + curl_LDADD += -L$(ZLIB_PATH) -lz +endif +ifdef IDN + INCLUDES += -I"$(LIBIDN_PATH)/include" + CFLAGS += -DUSE_LIBIDN + curl_LDADD += -L$(LIBIDN_PATH)/lib -lidn +endif +ifdef SSPI + CFLAGS += -DUSE_WINDOWS_SSPI +endif +ifdef IPV6 + CFLAGS += -DENABLE_IPV6 +endif +ifdef LDAPS + CFLAGS += -DHAVE_LDAP_SSL +endif +ifdef USE_LDAP_NOVELL + CFLAGS += -DCURL_HAS_NOVELL_LDAPSDK + curl_LDADD += -L"$(LDAP_SDK)/lib/mscvc" -lldapsdk -lldapssl -lldapx +endif +ifdef USE_LDAP_OPENLDAP + CFLAGS += -DCURL_HAS_OPENLDAP_LDAPSDK + curl_LDADD += -L"$(LDAP_SDK)/lib" -lldap -llber +endif +ifndef USE_LDAP_NOVELL +ifndef USE_LDAP_OPENLDAP +curl_LDADD += -lwldap32 +endif +endif +curl_LDADD += -lws2_32 +COMPILE = $(CC) $(INCLUDES) $(CFLAGS) + +# Makefile.inc provides the CSOURCES and HHEADERS defines +include Makefile.inc + +curl_OBJECTS := $(patsubst %.c,%.o,$(strip $(CURL_CFILES))) +ifdef DYN +curlx_OBJECTS := $(patsubst %.c,%.o,$(notdir $(strip $(CURLX_ONES)))) +curl_OBJECTS += $(curlx_OBJECTS) +vpath %.c ../lib +endif + +RESOURCE = curl.res + +.SUFFIXES: .rc .res + +all: curl.exe + +curl.exe: $(RESOURCE) $(curl_OBJECTS) $(curl_DEPENDENCIES) + -$(RM) $@ + $(LINK) $< $(curl_OBJECTS) $(curl_LDADD) + +# We don't have nroff normally under win32 +# hugehelp.c: ../README.curl ../curl.1 mkhelp.pl +# -$(RM) hugehelp.c +# $(NROFF) -man ../curl.1 | $(PERL) mkhelp.pl ../README.curl > hugehelp.c + +hugehelp.c: + @echo Creating $@ + @$(CP) hugehelp.c.cvs $@ + +.c.o: + $(COMPILE) -c $< + +.rc.res: + $(RC) $(RCFLAGS) $< -o $@ + +clean: +ifeq "$(wildcard hugehelp.c.cvs)" "hugehelp.c.cvs" + -$(RM) hugehelp.c +endif + -$(RM) $(curl_OBJECTS) $(RESOURCE) + +distclean vclean: clean + -$(RM) $(curl_PROGRAMS) + diff --git a/mobicore/common/curl/src/Makefile.netware b/mobicore/common/curl/src/Makefile.netware new file mode 100644 index 0000000000000000000000000000000000000000..81482891ca821960e440e9f63c652231676819a3 --- /dev/null +++ b/mobicore/common/curl/src/Makefile.netware @@ -0,0 +1,590 @@ +################################################################# +# +## Makefile for building curl.nlm (NetWare version - gnu make) +## Use: make -f Makefile.netware +## +## Comments to: Guenter Knauf http://www.gknw.net/phpbb +# +################################################################# + +# Edit the path below to point to the base of your Novell NDK. +ifndef NDKBASE +NDKBASE = c:/novell +endif + +# Edit the path below to point to the base of your Zlib sources. +ifndef ZLIB_PATH +ZLIB_PATH = ../../zlib-1.2.5 +endif + +# Edit the path below to point to the base of your OpenSSL package. +ifndef OPENSSL_PATH +OPENSSL_PATH = ../../openssl-0.9.8q +endif + +# Edit the path below to point to the base of your LibSSH2 package. +ifndef LIBSSH2_PATH +LIBSSH2_PATH = ../../libssh2-1.2.7 +endif + +# Edit the path below to point to the base of your libidn package. +ifndef LIBIDN_PATH +LIBIDN_PATH = ../../libidn-1.18 +endif + +# Edit the path below to point to the base of your librtmp package. +ifndef LIBRTMP_PATH +LIBRTMP_PATH = ../../librtmp-2.3 +endif + +# Edit the path below to point to the base of your c-ares package. +ifndef LIBCARES_PATH +LIBCARES_PATH = ../ares +endif + +ifndef INSTDIR +INSTDIR = ..$(DS)curl-$(LIBCURL_VERSION_STR)-bin-nw +endif + +# Edit the vars below to change NLM target settings. +TARGET = curl +VERSION = $(LIBCURL_VERSION) +COPYR = Copyright (C) $(LIBCURL_COPYRIGHT_STR) +DESCR = cURL $(LIBCURL_VERSION_STR) ($(LIBARCH)) - http://curl.haxx.se +MTSAFE = YES +STACK = 64000 +SCREEN = $(TARGET) commandline utility +# Comment the line below if you dont want to load protected automatically. +# LDRING = 3 + +# Uncomment the next line to enable linking with POSIX semantics. +# POSIXFL = 1 + +# Edit the var below to point to your lib architecture. +ifndef LIBARCH +LIBARCH = LIBC +endif + +# must be equal to NDEBUG or DEBUG, CURLDEBUG +ifndef DB +DB = NDEBUG +endif +# Optimization: -O or debugging: -g +ifeq ($(DB),NDEBUG) + OPT = -O2 + OBJDIR = release +else + OPT = -g + OBJDIR = debug +endif + +# The following lines defines your compiler. +ifdef CWFolder + METROWERKS = $(CWFolder) +endif +ifdef METROWERKS + # MWCW_PATH = $(subst \,/,$(METROWERKS))/Novell Support + MWCW_PATH = $(subst \,/,$(METROWERKS))/Novell Support/Metrowerks Support + CC = mwccnlm +else + CC = gcc +endif +PERL = perl +# Here you can find a native Win32 binary of the original awk: +# http://www.gknw.net/development/prgtools/awk-20070501.zip +AWK = awk +CP = cp -afv +MKDIR = mkdir +# RM = rm -f +# If you want to mark the target as MTSAFE you will need a tool for +# generating the xdc data for the linker; here's a minimal tool: +# http://www.gknw.net/development/prgtools/mkxdc.zip +MPKXDC = mkxdc + +# LIBARCH_U = $(shell $(AWK) 'BEGIN {print toupper(ARGV[1])}' $(LIBARCH)) +LIBARCH_L = $(shell $(AWK) 'BEGIN {print tolower(ARGV[1])}' $(LIBARCH)) + +# Include the version info retrieved from curlver.h +-include $(OBJDIR)/version.inc + +# Global flags for all compilers +CFLAGS += $(OPT) -D$(DB) -DNETWARE -DHAVE_CONFIG_H -nostdinc + +ifeq ($(CC),mwccnlm) +LD = mwldnlm +LDFLAGS = -nostdlib $(OBJS) $(PRELUDE) $(LDLIBS) -o $@ -commandfile +LIBEXT = lib +CFLAGS += -gccinc -inline off -opt nointrinsics -proc 586 +CFLAGS += -relax_pointers +#CFLAGS += -w on +ifeq ($(LIBARCH),LIBC) +ifeq ($(POSIXFL),1) + PRELUDE = $(NDK_LIBC)/imports/posixpre.o +else + PRELUDE = $(NDK_LIBC)/imports/libcpre.o +endif + CFLAGS += -align 4 +else + # PRELUDE = $(NDK_CLIB)/imports/clibpre.o + # to avoid the __init_* / __deinit_* whoes dont use prelude from NDK + PRELUDE = "$(MWCW_PATH)/libraries/runtime/prelude.obj" + # CFLAGS += -include "$(MWCW_PATH)/headers/nlm_clib_prefix.h" + CFLAGS += -align 1 +endif +else +LD = nlmconv +LDFLAGS = -T +LIBEXT = a +CFLAGS += -fno-builtin -fpcc-struct-return -fno-strict-aliasing +CFLAGS += -Wall # -pedantic +ifeq ($(LIBARCH),LIBC) +ifeq ($(POSIXFL),1) + PRELUDE = $(NDK_LIBC)/imports/posixpre.gcc.o +else + PRELUDE = $(NDK_LIBC)/imports/libcpre.gcc.o +endif +else + # PRELUDE = $(NDK_CLIB)/imports/clibpre.gcc.o + # to avoid the __init_* / __deinit_* whoes dont use prelude from NDK + # http://www.gknw.net/development/mk_nlm/gcc_pre.zip + PRELUDE = $(NDK_ROOT)/pre/prelude.o + CFLAGS += -include $(NDKBASE)/nlmconv/genlm.h +endif +endif + +NDK_ROOT = $(NDKBASE)/ndk +ifndef NDK_CLIB +NDK_CLIB = $(NDK_ROOT)/nwsdk +endif +ifndef NDK_LIBC +NDK_LIBC = $(NDK_ROOT)/libc +endif +ifndef NDK_LDAP +NDK_LDAP = $(NDK_ROOT)/cldapsdk/netware +endif +CURL_INC = ../include +CURL_LIB = ../lib + +INCLUDES = -I$(CURL_INC) -I$(CURL_LIB) + +ifdef LINK_STATIC + LDLIBS = $(CURL_LIB)/libcurl.$(LIBEXT) +ifdef WITH_ARES + LDLIBS += $(LIBCARES_PATH)/libcares.$(LIBEXT) +endif +else + MODULES = libcurl.nlm + IMPORTS = @$(CURL_LIB)/libcurl.imp +endif +ifdef WITH_SSH2 + INCLUDES += -I$(LIBSSH2_PATH)/include +ifdef LINK_STATIC + LDLIBS += $(LIBSSH2_PATH)/nw/libssh2.$(LIBEXT) +else + MODULES += libssh2.nlm + IMPORTS += @$(LIBSSH2_PATH)/nw/libssh2.imp +endif +endif +ifdef WITH_RTMP + # INCLUDES += -I$(LIBRTMP_PATH) +ifdef LINK_STATIC + LDLIBS += $(LIBRTMP_PATH)/librtmp/librtmp.$(LIBEXT) +endif +endif +ifdef WITH_SSL + INCLUDES += -I$(OPENSSL_PATH)/outinc_nw_$(LIBARCH_L) + LDLIBS += $(OPENSSL_PATH)/out_nw_$(LIBARCH_L)/ssl.$(LIBEXT) + LDLIBS += $(OPENSSL_PATH)/out_nw_$(LIBARCH_L)/crypto.$(LIBEXT) + IMPORTS += GetProcessSwitchCount RunningProcess +endif +ifdef WITH_ZLIB + INCLUDES += -I$(ZLIB_PATH) +ifdef LINK_STATIC + LDLIBS += $(ZLIB_PATH)/nw/$(LIBARCH)/libz.$(LIBEXT) +else + MODULES += libz.nlm + IMPORTS += @$(ZLIB_PATH)/nw/$(LIBARCH)/libz.imp +endif +endif +ifdef WITH_IDN + # INCLUDES += -I$(LIBIDN_PATH)/include + LDLIBS += $(LIBIDN_PATH)/lib/libidn.$(LIBEXT) +endif + +ifeq ($(LIBARCH),LIBC) + INCLUDES += -I$(NDK_LIBC)/include + # INCLUDES += -I$(NDK_LIBC)/include/nks + # INCLUDES += -I$(NDK_LIBC)/include/winsock + CFLAGS += -D_POSIX_SOURCE +else + INCLUDES += -I$(NDK_CLIB)/include/nlm + # INCLUDES += -I$(NDK_CLIB)/include +endif +ifndef DISABLE_LDAP + # INCLUDES += -I$(NDK_LDAP)/$(LIBARCH_L)/inc +endif +CFLAGS += $(INCLUDES) + +ifeq ($(MTSAFE),YES) + XDCOPT = -n +endif +ifeq ($(MTSAFE),NO) + XDCOPT = -u +endif +ifdef XDCOPT + XDCDATA = $(OBJDIR)/$(TARGET).xdc +endif + +ifeq ($(findstring /sh,$(SHELL)),/sh) +DL = ' +DS = / +PCT = % +#-include $(NDKBASE)/nlmconv/ncpfs.inc +else +DS = \\ +PCT = %% +endif + +# Makefile.inc provides the CSOURCES and HHEADERS defines +include Makefile.inc + +OBJX := $(patsubst %.c,$(OBJDIR)/%.o,$(notdir $(strip $(CURLX_ONES)))) +OBJS := $(patsubst %.c,$(OBJDIR)/%.o,$(strip $(CURL_CFILES))) +ifndef LINK_STATIC +OBJS += $(OBJX) +endif + +vpath %.c $(CURL_LIB) + +all: prebuild $(TARGET).nlm + +prebuild: $(OBJDIR) $(OBJDIR)/version.inc curl_config.h + +$(OBJDIR)/%.o: %.c +# @echo Compiling $< + $(CC) $(CFLAGS) -c $< -o $@ + +$(OBJDIR)/version.inc: $(CURL_INC)/curl/curlver.h $(OBJDIR) + @echo Creating $@ + @$(AWK) -f ../packages/NetWare/get_ver.awk $< > $@ + +install: $(INSTDIR) all + @-$(CP) ../docs/$(TARGET).pdf $(INSTDIR) + @-$(CP) ../docs/$(TARGET).html $(INSTDIR) + @$(CP) $(TARGET).nlm $(INSTDIR) + +clean: +ifeq "$(wildcard hugehelp.c.cvs)" "hugehelp.c.cvs" + -$(RM) hugehelp.c +endif + -$(RM) curl_config.h + -$(RM) -r $(OBJDIR) + +distclean vclean: clean + -$(RM) $(TARGET).nlm + +$(OBJDIR) $(INSTDIR): + @$(MKDIR) $@ + +$(TARGET).nlm: $(OBJS) $(OBJDIR)/$(TARGET).def $(XDCDATA) + @echo Linking $@ + @-$(RM) $@ + @$(LD) $(LDFLAGS) $(OBJDIR)/$(TARGET).def + +$(OBJDIR)/%.xdc: Makefile.netware + @echo Creating $@ + @$(MPKXDC) $(XDCOPT) $@ + +$(OBJDIR)/%.def: Makefile.netware + @echo $(DL)# DEF file for linking with $(LD)$(DL) > $@ + @echo $(DL)# Do not edit this file - it is created by make!$(DL) >> $@ + @echo $(DL)# All your changes will be lost!!$(DL) >> $@ + @echo $(DL)#$(DL) >> $@ + @echo $(DL)copyright "$(COPYR)"$(DL) >> $@ + @echo $(DL)description "$(DESCR)"$(DL) >> $@ + @echo $(DL)version $(VERSION)$(DL) >> $@ +ifdef NLMTYPE + @echo $(DL)type $(NLMTYPE)$(DL) >> $@ +endif +ifdef STACK + @echo $(DL)stack $(STACK)$(DL) >> $@ +endif +ifdef SCREEN + @echo $(DL)screenname "$(SCREEN)"$(DL) >> $@ +else + @echo $(DL)screenname "DEFAULT"$(DL) >> $@ +endif +ifneq ($(DB),NDEBUG) + @echo $(DL)debug$(DL) >> $@ +endif + @echo $(DL)threadname "$(TARGET)"$(DL) >> $@ +ifdef XDCDATA + @echo $(DL)xdcdata $(XDCDATA)$(DL) >> $@ +endif +ifeq ($(LDRING),0) + @echo $(DL)flag_on 16$(DL) >> $@ +endif +ifeq ($(LDRING),3) + @echo $(DL)flag_on 512$(DL) >> $@ +endif +ifeq ($(LIBARCH),CLIB) + @echo $(DL)start _Prelude$(DL) >> $@ + @echo $(DL)exit _Stop$(DL) >> $@ + @echo $(DL)import @$(NDK_CLIB)/imports/clib.imp$(DL) >> $@ + @echo $(DL)import @$(NDK_CLIB)/imports/threads.imp$(DL) >> $@ + @echo $(DL)import @$(NDK_CLIB)/imports/nlmlib.imp$(DL) >> $@ + @echo $(DL)import @$(NDK_CLIB)/imports/socklib.imp$(DL) >> $@ + @echo $(DL)module clib$(DL) >> $@ +ifndef DISABLE_LDAP + @echo $(DL)import @$(NDK_LDAP)/clib/imports/ldapsdk.imp$(DL) >> $@ + @echo $(DL)import @$(NDK_LDAP)/clib/imports/ldapssl.imp$(DL) >> $@ +# @echo $(DL)import @$(NDK_LDAP)/clib/imports/ldapx.imp$(DL) >> $@ + @echo $(DL)module ldapsdk ldapssl$(DL) >> $@ +endif +else +ifeq ($(POSIXFL),1) + @echo $(DL)flag_on 4194304$(DL) >> $@ +endif + @echo $(DL)flag_on 64$(DL) >> $@ + @echo $(DL)pseudopreemption$(DL) >> $@ +ifeq ($(findstring posixpre,$(PRELUDE)),posixpre) + @echo $(DL)start POSIX_Start$(DL) >> $@ + @echo $(DL)exit POSIX_Stop$(DL) >> $@ + @echo $(DL)check POSIX_CheckUnload$(DL) >> $@ +else + @echo $(DL)start _LibCPrelude$(DL) >> $@ + @echo $(DL)exit _LibCPostlude$(DL) >> $@ + @echo $(DL)check _LibCCheckUnload$(DL) >> $@ +endif + @echo $(DL)import @$(NDK_LIBC)/imports/libc.imp$(DL) >> $@ + @echo $(DL)import @$(NDK_LIBC)/imports/netware.imp$(DL) >> $@ + @echo $(DL)module libc$(DL) >> $@ +ifndef DISABLE_LDAP + @echo $(DL)import @$(NDK_LDAP)/libc/imports/lldapsdk.imp$(DL) >> $@ + @echo $(DL)import @$(NDK_LDAP)/libc/imports/lldapssl.imp$(DL) >> $@ +# @echo $(DL)import @$(NDK_LDAP)/libc/imports/lldapx.imp$(DL) >> $@ + @echo $(DL)module lldapsdk lldapssl$(DL) >> $@ +endif +endif +ifdef MODULES + @echo $(DL)module $(MODULES)$(DL) >> $@ +endif +ifdef EXPORTS + @echo $(DL)export $(EXPORTS)$(DL) >> $@ +endif +ifdef IMPORTS + @echo $(DL)import $(IMPORTS)$(DL) >> $@ +endif +ifeq ($(findstring nlmconv,$(LD)),nlmconv) + @echo $(DL)input $(PRELUDE)$(DL) >> $@ + @echo $(DL)input $(OBJS)$(DL) >> $@ +ifdef LDLIBS + @echo $(DL)input $(LDLIBS)$(DL) >> $@ +endif + @echo $(DL)output $(TARGET).nlm$(DL) >> $@ +endif + +curl_config.h: Makefile.netware + @echo Creating $@ + @echo $(DL)/* $@ for NetWare target.$(DL) > $@ + @echo $(DL)** Do not edit this file - it is created by make!$(DL) >> $@ + @echo $(DL)** All your changes will be lost!!$(DL) >> $@ + @echo $(DL)*/$(DL) >> $@ + @echo $(DL)#ifndef NETWARE$(DL) >> $@ + @echo $(DL)#error This $(notdir $@) is created for NetWare platform!$(DL) >> $@ + @echo $(DL)#endif$(DL) >> $@ + @echo $(DL)#define VERSION "$(LIBCURL_VERSION_STR)"$(DL) >> $@ + @echo $(DL)#define PACKAGE_BUGREPORT "a suitable curl mailing list => http://curl.haxx.se/mail/"$(DL) >> $@ +ifeq ($(LIBARCH),CLIB) + @echo $(DL)#define OS "i586-pc-clib-NetWare"$(DL) >> $@ + @echo $(DL)#define NETDB_USE_INTERNET 1$(DL) >> $@ + @echo $(DL)#define HAVE_STRICMP 1$(DL) >> $@ + @echo $(DL)#define HAVE_STRNICMP 1$(DL) >> $@ + @echo $(DL)#define RECV_TYPE_ARG1 int$(DL) >> $@ + @echo $(DL)#define RECV_TYPE_ARG2 char *$(DL) >> $@ + @echo $(DL)#define RECV_TYPE_ARG3 int$(DL) >> $@ + @echo $(DL)#define RECV_TYPE_ARG4 int$(DL) >> $@ + @echo $(DL)#define RECV_TYPE_RETV int$(DL) >> $@ + @echo $(DL)#define RECVFROM_TYPE_ARG1 int$(DL) >> $@ + @echo $(DL)#define RECVFROM_TYPE_ARG2 char$(DL) >> $@ + @echo $(DL)#define RECVFROM_TYPE_ARG3 int$(DL) >> $@ + @echo $(DL)#define RECVFROM_TYPE_ARG4 int$(DL) >> $@ + @echo $(DL)#define RECVFROM_TYPE_ARG5 struct sockaddr$(DL) >> $@ + @echo $(DL)#define RECVFROM_TYPE_ARG6 int$(DL) >> $@ + @echo $(DL)#define RECVFROM_TYPE_RETV int$(DL) >> $@ + @echo $(DL)#define SEND_QUAL_ARG2$(DL) >> $@ + @echo $(DL)#define SEND_TYPE_ARG1 int$(DL) >> $@ + @echo $(DL)#define SEND_TYPE_ARG2 char *$(DL) >> $@ + @echo $(DL)#define SEND_TYPE_ARG3 int$(DL) >> $@ + @echo $(DL)#define SEND_TYPE_ARG4 int$(DL) >> $@ + @echo $(DL)#define SEND_TYPE_RETV int$(DL) >> $@ + @echo $(DL)#define SIZEOF_SIZE_T 4$(DL) >> $@ + @echo $(DL)#define pressanykey PressAnyKeyToContinue$(DL) >> $@ +else + @echo $(DL)#define OS "i586-pc-libc-NetWare"$(DL) >> $@ + @echo $(DL)#define HAVE_FTRUNCATE 1$(DL) >> $@ + @echo $(DL)#define HAVE_GETTIMEOFDAY 1$(DL) >> $@ + @echo $(DL)#define HAVE_INTTYPES_H 1$(DL) >> $@ + @echo $(DL)#define HAVE_LONGLONG 1$(DL) >> $@ + @echo $(DL)#define HAVE_STDINT_H 1$(DL) >> $@ + @echo $(DL)#define HAVE_STRCASECMP 1$(DL) >> $@ + @echo $(DL)#define HAVE_STRLCAT 1$(DL) >> $@ + @echo $(DL)#define HAVE_STRLCPY 1$(DL) >> $@ + @echo $(DL)#define HAVE_STRTOLL 1$(DL) >> $@ + @echo $(DL)#define HAVE_SYS_PARAM_H 1$(DL) >> $@ + @echo $(DL)#define HAVE_SYS_SELECT_H 1$(DL) >> $@ + @echo $(DL)#define HAVE_TERMIOS_H 1$(DL) >> $@ + @echo $(DL)#define RECV_TYPE_ARG1 int$(DL) >> $@ + @echo $(DL)#define RECV_TYPE_ARG2 void *$(DL) >> $@ + @echo $(DL)#define RECV_TYPE_ARG3 size_t$(DL) >> $@ + @echo $(DL)#define RECV_TYPE_ARG4 int$(DL) >> $@ + @echo $(DL)#define RECV_TYPE_RETV ssize_t$(DL) >> $@ + @echo $(DL)#define RECVFROM_TYPE_ARG1 int$(DL) >> $@ + @echo $(DL)#define RECVFROM_TYPE_ARG2 void$(DL) >> $@ + @echo $(DL)#define RECVFROM_TYPE_ARG3 size_t$(DL) >> $@ + @echo $(DL)#define RECVFROM_TYPE_ARG4 int$(DL) >> $@ + @echo $(DL)#define RECVFROM_TYPE_ARG5 struct sockaddr$(DL) >> $@ + @echo $(DL)#define RECVFROM_TYPE_ARG6 size_t$(DL) >> $@ + @echo $(DL)#define RECVFROM_TYPE_RETV ssize_t$(DL) >> $@ + @echo $(DL)#define RECVFROM_TYPE_ARG2_IS_VOID 1$(DL) >> $@ + @echo $(DL)#define SEND_QUAL_ARG2$(DL) >> $@ + @echo $(DL)#define SEND_TYPE_ARG1 int$(DL) >> $@ + @echo $(DL)#define SEND_TYPE_ARG2 void *$(DL) >> $@ + @echo $(DL)#define SEND_TYPE_ARG3 size_t$(DL) >> $@ + @echo $(DL)#define SEND_TYPE_ARG4 int$(DL) >> $@ + @echo $(DL)#define SEND_TYPE_RETV ssize_t$(DL) >> $@ + @echo $(DL)#define SIZEOF_OFF_T 8$(DL) >> $@ + @echo $(DL)#define SIZEOF_SIZE_T 8$(DL) >> $@ + @echo $(DL)#define _LARGEFILE 1$(DL) >> $@ +ifdef ENABLE_IPV6 + @echo $(DL)#define ENABLE_IPV6 1$(DL) >> $@ + @echo $(DL)#define HAVE_AF_INET6 1$(DL) >> $@ + @echo $(DL)#define HAVE_PF_INET6 1$(DL) >> $@ + @echo $(DL)#define HAVE_FREEADDRINFO 1$(DL) >> $@ + @echo $(DL)#define HAVE_GETADDRINFO 1$(DL) >> $@ + @echo $(DL)#define HAVE_SOCKADDR_IN6_SIN6_SCOPE_ID 1$(DL) >> $@ + @echo $(DL)#define HAVE_STRUCT_ADDRINFO 1$(DL) >> $@ + @echo $(DL)#define HAVE_STRUCT_IN6_ADDR 1$(DL) >> $@ + @echo $(DL)#define HAVE_STRUCT_SOCKADDR_IN6 1$(DL) >> $@ + @echo $(DL)#define SIZEOF_STRUCT_IN6_ADDR 16$(DL) >> $@ +endif +endif + @echo $(DL)#define USE_MANUAL 1$(DL) >> $@ + @echo $(DL)#define HAVE_ARPA_INET_H 1$(DL) >> $@ + @echo $(DL)#define HAVE_ASSERT_H 1$(DL) >> $@ + @echo $(DL)#define HAVE_ERR_H 1$(DL) >> $@ + @echo $(DL)#define HAVE_FCNTL_H 1$(DL) >> $@ + @echo $(DL)#define HAVE_GETHOSTBYADDR 1$(DL) >> $@ + @echo $(DL)#define HAVE_GETHOSTBYNAME 1$(DL) >> $@ + @echo $(DL)#define HAVE_GETPROTOBYNAME 1$(DL) >> $@ + @echo $(DL)#define HAVE_GMTIME_R 1$(DL) >> $@ + @echo $(DL)#define HAVE_INET_ADDR 1$(DL) >> $@ + @echo $(DL)#define HAVE_IOCTL 1$(DL) >> $@ + @echo $(DL)#define HAVE_IOCTL_FIONBIO 1$(DL) >> $@ + @echo $(DL)#define HAVE_LIMITS_H 1$(DL) >> $@ + @echo $(DL)#define HAVE_LL 1$(DL) >> $@ + @echo $(DL)#define HAVE_LOCALE_H 1$(DL) >> $@ + @echo $(DL)#define HAVE_LOCALTIME_R 1$(DL) >> $@ + @echo $(DL)#define HAVE_MALLOC_H 1$(DL) >> $@ + @echo $(DL)#define HAVE_NETINET_IN_H 1$(DL) >> $@ + @echo $(DL)#define HAVE_RECV 1$(DL) >> $@ + @echo $(DL)#define HAVE_RECVFROM 1$(DL) >> $@ + @echo $(DL)#define HAVE_SELECT 1$(DL) >> $@ + @echo $(DL)#define HAVE_SEND 1$(DL) >> $@ + @echo $(DL)#define HAVE_SETJMP_H 1$(DL) >> $@ + @echo $(DL)#define HAVE_SETLOCALE 1$(DL) >> $@ + @echo $(DL)#define HAVE_SIGNAL 1$(DL) >> $@ + @echo $(DL)#define HAVE_SIGNAL_H 1$(DL) >> $@ + @echo $(DL)#define HAVE_SIG_ATOMIC_T 1$(DL) >> $@ + @echo $(DL)#define HAVE_SOCKET 1$(DL) >> $@ + @echo $(DL)#define HAVE_STDLIB_H 1$(DL) >> $@ + @echo $(DL)#define HAVE_STRDUP 1$(DL) >> $@ + @echo $(DL)#define HAVE_STRFTIME 1$(DL) >> $@ + @echo $(DL)#define HAVE_STRING_H 1$(DL) >> $@ + @echo $(DL)#define HAVE_STRSTR 1$(DL) >> $@ + @echo $(DL)#define HAVE_STRUCT_TIMEVAL 1$(DL) >> $@ + @echo $(DL)#define HAVE_SYS_IOCTL_H 1$(DL) >> $@ + @echo $(DL)#define HAVE_SYS_STAT_H 1$(DL) >> $@ + @echo $(DL)#define HAVE_SYS_TIME_H 1$(DL) >> $@ + @echo $(DL)#define HAVE_TIME_H 1$(DL) >> $@ + @echo $(DL)#define HAVE_UNAME 1$(DL) >> $@ + @echo $(DL)#define HAVE_UNISTD_H 1$(DL) >> $@ + @echo $(DL)#define HAVE_UTIME 1$(DL) >> $@ + @echo $(DL)#define HAVE_UTIME_H 1$(DL) >> $@ + @echo $(DL)#define HAVE_WRITEV 1$(DL) >> $@ + @echo $(DL)#define RETSIGTYPE void$(DL) >> $@ + @echo $(DL)#define SIZEOF_INT 4$(DL) >> $@ + @echo $(DL)#define SIZEOF_SHORT 2$(DL) >> $@ + @echo $(DL)#define SIZEOF_STRUCT_IN_ADDR 4$(DL) >> $@ + @echo $(DL)#define STDC_HEADERS 1$(DL) >> $@ + @echo $(DL)#define TIME_WITH_SYS_TIME 1$(DL) >> $@ +ifdef DISABLE_LDAP + @echo $(DL)#define CURL_DISABLE_LDAP 1$(DL) >> $@ +else + @echo $(DL)#define CURL_HAS_NOVELL_LDAPSDK 1$(DL) >> $@ +ifndef DISABLE_LDAPS + @echo $(DL)#define HAVE_LDAP_SSL 1$(DL) >> $@ +endif + @echo $(DL)#define HAVE_LDAP_SSL_H 1$(DL) >> $@ + @echo $(DL)#define HAVE_LDAP_URL_PARSE 1$(DL) >> $@ +endif +ifdef NW_WINSOCK + @echo $(DL)#define HAVE_CLOSESOCKET 1$(DL) >> $@ +else + @echo $(DL)#define USE_BSD_SOCKETS 1$(DL) >> $@ + @echo $(DL)#define HAVE_SYS_TYPES_H 1$(DL) >> $@ + @echo $(DL)#define HAVE_SYS_SOCKET_H 1$(DL) >> $@ + @echo $(DL)#define HAVE_SYS_SOCKIO_H 1$(DL) >> $@ + @echo $(DL)#define HAVE_NETDB_H 1$(DL) >> $@ +endif +ifdef WITH_ARES + @echo $(DL)#define USE_ARES 1$(DL) >> $@ +endif +ifdef WITH_ZLIB + @echo $(DL)#define HAVE_ZLIB_H 1$(DL) >> $@ + @echo $(DL)#define HAVE_LIBZ 1$(DL) >> $@ +endif +ifdef WITH_SSL + @echo $(DL)#define USE_SSLEAY 1$(DL) >> $@ + @echo $(DL)#define USE_OPENSSL 1$(DL) >> $@ + @echo $(DL)#define HAVE_OPENSSL_X509_H 1$(DL) >> $@ + @echo $(DL)#define HAVE_OPENSSL_SSL_H 1$(DL) >> $@ + @echo $(DL)#define HAVE_OPENSSL_RSA_H 1$(DL) >> $@ + @echo $(DL)#define HAVE_OPENSSL_PEM_H 1$(DL) >> $@ + @echo $(DL)#define HAVE_OPENSSL_ERR_H 1$(DL) >> $@ + @echo $(DL)#define HAVE_OPENSSL_CRYPTO_H 1$(DL) >> $@ + @echo $(DL)#define HAVE_OPENSSL_ENGINE_H 1$(DL) >> $@ + @echo $(DL)#define HAVE_LIBSSL 1$(DL) >> $@ + @echo $(DL)#define HAVE_LIBCRYPTO 1$(DL) >> $@ + @echo $(DL)#define OPENSSL_NO_KRB5 1$(DL) >> $@ +endif +ifdef WITH_SSH2 + @echo $(DL)#define USE_LIBSSH2 1$(DL) >> $@ + @echo $(DL)#define HAVE_LIBSSH2_H 1$(DL) >> $@ +endif +ifdef WITH_IDN + @echo $(DL)#define HAVE_LIBIDN 1$(DL) >> $@ + @echo $(DL)#define HAVE_TLD_H 1$(DL) >> $@ +endif +ifdef WITH_RTMP + @echo $(DL)#define USE_LIBRTMP 1$(DL) >> $@ +endif + @echo $(DL)#ifdef __GNUC__$(DL) >> $@ + @echo $(DL)#define HAVE_VARIADIC_MACROS_GCC 1$(DL) >> $@ + @echo $(DL)#else$(DL) >> $@ + @echo $(DL)#define HAVE_VARIADIC_MACROS_C99 1$(DL) >> $@ + @echo $(DL)#endif$(DL) >> $@ +ifdef CABUNDLE + @echo $(DL)#define CURL_CA_BUNDLE "$(CABUNDLE)"$(DL) >> $@ +else + @echo $(DL)#define CURL_CA_BUNDLE getenv("CURL_CA_BUNDLE")$(DL) >> $@ +endif + +hugehelp.c: + @echo Creating $@ + @$(CP) hugehelp.c.cvs $@ + +$(LIBCARES_PATH)/libcares.$(LIBEXT): + $(MAKE) -C $(LIBCARES_PATH) -f Makefile.netware lib + + diff --git a/mobicore/common/curl/src/Makefile.vc10 b/mobicore/common/curl/src/Makefile.vc10 new file mode 100644 index 0000000000000000000000000000000000000000..ebabb1ab12ad9ee8c3ff17ac61396c756343a282 --- /dev/null +++ b/mobicore/common/curl/src/Makefile.vc10 @@ -0,0 +1,305 @@ +############################################################# +# +## Makefile for building curl.exe with MSVC10 +## Use: nmake -f makefile.vc10 [release | debug] [CFG=release-ssl] +## (default is release) +## "nmake -f makefile.vc10 CFG=release-ssl" statically links OpenSSL +## into curl.exe producing a standalone SSL-enabled executable. +## +## Comments to: Troy Engel +## Updated by: Craig Davison +## release-ssl added by Miklos Nemeth +# +############################################################# + +PROGRAM_NAME = curl.exe + +!IFNDEF OPENSSL_PATH +OPENSSL_PATH = ../../openssl-0.9.8o +!ENDIF + +!IFNDEF ZLIB_PATH +ZLIB_PATH = ../../zlib-1.2.5 +!ENDIF + +!IFNDEF MACHINE +MACHINE = X86 +!ENDIF + +# USE_WINDOWS_SSPI uses windows libraries to allow NTLM authentication +# without an openssl installation and offers the ability to authenticate +# using the "current logged in user". Since at least with MSVC10 the sspi.h +# header is broken it is either required to install the Windows SDK, +# or to fix sspi.h with adding this define at the beginning of sspi.h: +# #define FreeCredentialHandle FreeCredentialsHandle +# +# If, for some reason the Windows SDK is installed but not installed +# in the default location, you can specify WINDOWS_SDK_PATH. +# It can be downloaded from: +# http://www.microsoft.com/msdownload/platformsdk/sdkupdate/ + +# WINDOWS_SSPI = 1 + +!IFDEF WINDOWS_SSPI +!IFNDEF WINDOWS_SDK_PATH +WINDOWS_SDK_PATH = "C:\Program Files\Microsoft SDK" +!ENDIF +!ENDIF + +######################################################## +## Nothing more to do below this line! +ZLIB_CFLAGS = /DHAVE_ZLIB_H /DHAVE_ZLIB /DHAVE_LIBZ /I "$(ZLIB_PATH)" +ZLIB_LFLAGS = "/LIBPATH:$(ZLIB_PATH)" +ZLIB_LIBS = zlib.lib +ZLIB_IMP_LIBS = zdll.lib + +SSL_CFLAGS = /DUSE_SSLEAY +SSL_LFLAGS = /LIBPATH:"$(OPENSSL_PATH)/out32" +SSL_IMP_LFLAGS = /LIBPATH:"$(OPENSSL_PATH)/out32dll" +SSL_LIBS = libeay32.lib ssleay32.lib gdi32.lib user32.lib advapi32.lib + +# Runtime library configuration +RTLIB = /MD +RTLIBD = /MDd + +!IF "$(RTLIBCFG)" == "static" +RTLIB = /MT +RTLIBD = /MTd +!ENDIF + +## Release +CCR = cl.exe $(RTLIB) /O2 /DNDEBUG +LINKR = link.exe /incremental:no /libpath:"../lib" +RCR = rc.exe /dDEBUGBUILD=0 + +## Debug +CCD = cl.exe $(RTLIBD) /Gm /ZI /Od /D_DEBUG /RTC1 +LINKD = link.exe /incremental:yes /debug /libpath:"../lib" +RCD = rc.exe /dDEBUGBUILD=1 + +CFLAGS = /I../lib /I../include /nologo /W3 /EHsc /DWIN32 /FD /c +LFLAGS = /nologo /out:$(PROGRAM_NAME) /subsystem:console /machine:$(MACHINE) +RESFLAGS = /i../include + +# This manifest thing is for VC8, enabled by the maketgz script that +# builds the VC8 version of this makefile. Left commented out in the VC10 +# version! +#MANIFESTTOOL = mt -manifest $(PROGRAM_NAME).manifest -outputresource:$(PROGRAM_NAME);1 + +!IFDEF WINDOWS_SSPI +CFLAGS = $(CFLAGS) /DUSE_WINDOWS_SSPI /I$(WINDOWS_SDK_PATH)\include +!ENDIF + +RELEASE_OBJS= \ + curlutilr.obj \ + getpassr.obj \ + homedirr.obj \ + hugehelpr.obj \ + mainr.obj \ + nonblockr.obj \ + os-specificr.obj \ + rawstrr.obj \ + strtoofftr.obj \ + urlglobr.obj \ + writeoutr.obj \ + xattrr.obj \ + curlr.res + +DEBUG_OBJS= \ + curlutild.obj \ + getpassd.obj \ + homedird.obj \ + hugehelpd.obj \ + maind.obj \ + nonblockd.obj \ + os-specificd.obj \ + rawstrd.obj \ + strtoofftd.obj \ + urlglobd.obj \ + writeoutd.obj \ + xattrd.obj \ + curld.res + +################################################# +# If CFG not specified, use static libs + +CFLAGS = $(CFLAGS) /DCURL_STATICLIB +LINKLIBS = libcurl.lib +LINKLIBS_DEBUG = libcurld.lib + +################################################# +# release dynamic library + +!IF "$(CFG)" == "release-dll" +LINKLIBS = libcurl_imp.lib +LINKLIBS_DEBUG = libcurld_imp.lib +!ENDIF + +################################################# +# release static library with zlib + +!IF "$(CFG)" == "release-zlib" +CFLAGS = $(CFLAGS) $(ZLIB_CFLAGS) /DCURL_STATICLIB +LINKLIBS = libcurl.lib $(ZLIB_LIBS) +LINKLIBS_DEBUG = libcurld.lib $(ZLIB_LIBS) +LFLAGS = $(LFLAGS) $(ZLIB_LFLAGS) +!ENDIF + +################################################# +# release static library with ssl + +!IF "$(CFG)" == "release-ssl" +CFLAGS = $(CFLAGS) $(SSL_CFLAGS) /DCURL_STATICLIB +LINKLIBS = libcurl.lib $(SSL_LIBS) +LINKLIBS_DEBUG = libcurld.lib $(SSL_LIBS) +LFLAGS = $(LFLAGS) $(SSL_LFLAGS) +!ENDIF + +################################################# +# release dynamic library with dynamic ssl + +!IF "$(CFG)" == "release-dll-ssl-dll" +CFLAGS = $(CFLAGS) $(SSL_CFLAGS) +LINKLIBS = libcurl_imp.lib $(SSL_LIBS) +LINKLIBS_DEBUG = libcurld_imp.lib $(SSL_LIBS) +LFLAGS = $(LFLAGS) $(SSL_IMP_LFLAGS) +!ENDIF + +################################################# +# release static library with ssl and zlib + +!IF "$(CFG)" == "release-ssl-zlib" +CFLAGS = $(CFLAGS) $(SSL_CFLAGS) $(ZLIB_CFLAGS) /DCURL_STATICLIB +LINKLIBS = libcurl.lib $(SSL_LIBS) $(ZLIB_LIBS) +LINKLIBS_DEBUG = libcurld.lib $(SSL_LIBS) $(ZLIB_LIBS) +LFLAGS = $(LFLAGS) $(SSL_LFLAGS) $(ZLIB_LFLAGS) +!ENDIF + +################################################# +# release static library with dynamic ssl + +!IF "$(CFG)" == "release-ssl-dll" +CFLAGS = $(CFLAGS) $(SSL_CFLAGS) /DCURL_STATICLIB +LINKLIBS = libcurl.lib $(SSL_LIBS) +LINKLIBS_DEBUG = libcurld.lib $(SSL_LIBS) +LFLAGS = $(LFLAGS) $(SSL_IMP_LFLAGS) +!ENDIF + +################################################# +# release static library with dynamic zlib + +!IF "$(CFG)" == "release-zlib-dll" +CFLAGS = $(CFLAGS) $(ZLIB_CFLAGS) /DCURL_STATICLIB +LINKLIBS = libcurl.lib $(ZLIB_IMP_LIBS) +LINKLIBS_DEBUG = libcurld.lib $(ZLIB_IMP_LIBS) +LFLAGS = $(LFLAGS) $(ZLIB_LFLAGS) +!ENDIF + +################################################# +# release dynamic library with dynamic zlib + +!IF "$(CFG)" == "release-dll-zlib-dll" +CFLAGS = $(CFLAGS) $(ZLIB_CFLAGS) +LINKLIBS = libcurl_imp.lib $(ZLIB_IMP_LIBS) +LINKLIBS_DEBUG = libcurld_imp.lib $(ZLIB_IMP_LIBS) +LFLAGS = $(LFLAGS) $(ZLIB_LFLAGS) +!ENDIF + +################################################# +# release static library with dynamic ssl and dynamic zlib + +!IF "$(CFG)" == "release-ssl-dll-zlib-dll" +CFLAGS = $(CFLAGS) $(SSL_CFLAGS) $(ZLIB_CFLAGS) /DCURL_STATICLIB +LINKLIBS = libcurl.lib $(SSL_LIBS) $(ZLIB_IMP_LIBS) +LINKLIBS_DEBUG = libcurld.lib $(SSL_LIBS) $(ZLIB_IMP_LIBS) +LFLAGS = $(LFLAGS) $(SSL_IMP_LFLAGS) $(ZLIB_LFLAGS) +!ENDIF + +################################################# +# release dynamic library with dynamic ssl and dynamic zlib + +!IF "$(CFG)" == "release-dll-ssl-dll-zlib-dll" +CFLAGS = $(CFLAGS) $(SSL_CFLAGS) $(ZLIB_CFLAGS) +LINKLIBS = libcurl_imp.lib $(SSL_LIBS) $(ZLIB_IMP_LIBS) +LINKLIBS_DEBUG = libcurld_imp.lib $(SSL_LIBS) $(ZLIB_IMP_LIBS) +LFLAGS = $(LFLAGS) $(SSL_IMP_LFLAGS) $(ZLIB_LFLAGS) +!ENDIF + + +LINKLIBS = $(LINKLIBS) ws2_32.lib wldap32.lib +LINKLIBS_DEBUG = $(LINKLIBS_DEBUG) ws2_32.lib wldap32.lib + +all : release + +release: $(RELEASE_OBJS) + $(LINKR) $(LFLAGS) $(LINKLIBS) $(RELEASE_OBJS) + $(MANIFESTTOOL) + +debug: $(DEBUG_OBJS) + $(LINKD) $(LFLAGS) $(LINKLIBS_DEBUG) $(DEBUG_OBJS) + $(MANIFESTTOOL) + +## Release +hugehelpr.obj: hugehelp.c + $(CCR) $(CFLAGS) /Zm200 /Fo"$@" hugehelp.c +writeoutr.obj: writeout.c + $(CCR) $(CFLAGS) /Fo"$@" writeout.c +urlglobr.obj: urlglob.c + $(CCR) $(CFLAGS) /Fo"$@" urlglob.c +getpassr.obj: getpass.c + $(CCR) $(CFLAGS) /Fo"$@" getpass.c +homedirr.obj: homedir.c + $(CCR) $(CFLAGS) /Fo"$@" homedir.c +curlutilr.obj: curlutil.c + $(CCR) $(CFLAGS) /Fo"$@" curlutil.c +os-specificr.obj: os-specific.c + $(CCR) $(CFLAGS) /Fo"$@" os-specific.c +nonblockr.obj: ../lib/nonblock.c + $(CCR) $(CFLAGS) /Fo"$@" ../lib/nonblock.c +rawstrr.obj: ../lib/rawstr.c + $(CCR) $(CFLAGS) /Fo"$@" ../lib/rawstr.c +strtoofftr.obj: ../lib/strtoofft.c + $(CCR) $(CFLAGS) /Fo"$@" ../lib/strtoofft.c +xattrr.obj: xattr.c + $(CCR) $(CFLAGS) /Fo"$@" xattr.c +mainr.obj: main.c + $(CCR) $(CFLAGS) /Fo"$@" main.c +curlr.res : curl.rc + $(RCR) $(RESFLAGS) /Fo"$@" curl.rc + +## Debug +hugehelpd.obj: hugehelp.c + $(CCD) $(CFLAGS) /Zm200 /Fo"$@" hugehelp.c +writeoutd.obj: writeout.c + $(CCD) $(CFLAGS) /Fo"$@" writeout.c +urlglobd.obj: urlglob.c + $(CCD) $(CFLAGS) /Fo"$@" urlglob.c +getpassd.obj: getpass.c + $(CCD) $(CFLAGS) /Fo"$@" getpass.c +homedird.obj: homedir.c + $(CCD) $(CFLAGS) /Fo"$@" homedir.c +curlutild.obj: curlutil.c + $(CCD) $(CFLAGS) /Fo"$@" curlutil.c +os-specificd.obj: os-specific.c + $(CCD) $(CFLAGS) /Fo"$@" os-specific.c +nonblockd.obj: ../lib/nonblock.c + $(CCD) $(CFLAGS) /Fo"$@" ../lib/nonblock.c +rawstrd.obj: ../lib/rawstr.c + $(CCD) $(CFLAGS) /Fo"$@" ../lib/rawstr.c +strtoofftd.obj: ../lib/strtoofft.c + $(CCD) $(CFLAGS) /Fo"$@" ../lib/strtoofft.c +xattrd.obj: xattr.c + $(CCD) $(CFLAGS) /Fo"$@" xattr.c +maind.obj: main.c + $(CCD) $(CFLAGS) /Fo"$@" main.c +curld.res : curl.rc + $(RCD) $(RESFLAGS) /Fo"$@" curl.rc + +clean: + @-erase $(PROGRAM_NAME) 2> NUL + @-erase $(RELEASE_OBJS) 2> NUL + @-erase $(DEBUG_OBJS) 2> NUL + @-erase *.idb 2> NUL + @-erase *.pdb 2> NUL + @-erase *.pch 2> NUL + @-erase *.ilk 2> NUL diff --git a/mobicore/common/curl/src/Makefile.vc6 b/mobicore/common/curl/src/Makefile.vc6 new file mode 100644 index 0000000000000000000000000000000000000000..da7a2a351e4ffea91351f610a5fbd29720eba9d1 --- /dev/null +++ b/mobicore/common/curl/src/Makefile.vc6 @@ -0,0 +1,305 @@ +############################################################# +# +## Makefile for building curl.exe with MSVC6 +## Use: nmake -f makefile.vc6 [release | debug] [CFG=release-ssl] +## (default is release) +## "nmake -f makefile.vc6 CFG=release-ssl" statically links OpenSSL +## into curl.exe producing a standalone SSL-enabled executable. +## +## Comments to: Troy Engel +## Updated by: Craig Davison +## release-ssl added by Miklos Nemeth +# +############################################################# + +PROGRAM_NAME = curl.exe + +!IFNDEF OPENSSL_PATH +OPENSSL_PATH = ../../openssl-0.9.8o +!ENDIF + +!IFNDEF ZLIB_PATH +ZLIB_PATH = ../../zlib-1.2.5 +!ENDIF + +!IFNDEF MACHINE +MACHINE = X86 +!ENDIF + +# USE_WINDOWS_SSPI uses windows libraries to allow NTLM authentication +# without an openssl installation and offers the ability to authenticate +# using the "current logged in user". Since at least with MSVC6 the sspi.h +# header is broken it is either required to install the Windows SDK, +# or to fix sspi.h with adding this define at the beginning of sspi.h: +# #define FreeCredentialHandle FreeCredentialsHandle +# +# If, for some reason the Windows SDK is installed but not installed +# in the default location, you can specify WINDOWS_SDK_PATH. +# It can be downloaded from: +# http://www.microsoft.com/msdownload/platformsdk/sdkupdate/ + +# WINDOWS_SSPI = 1 + +!IFDEF WINDOWS_SSPI +!IFNDEF WINDOWS_SDK_PATH +WINDOWS_SDK_PATH = "C:\Program Files\Microsoft SDK" +!ENDIF +!ENDIF + +######################################################## +## Nothing more to do below this line! +ZLIB_CFLAGS = /DHAVE_ZLIB_H /DHAVE_ZLIB /DHAVE_LIBZ /I "$(ZLIB_PATH)" +ZLIB_LFLAGS = "/LIBPATH:$(ZLIB_PATH)" +ZLIB_LIBS = zlib.lib +ZLIB_IMP_LIBS = zdll.lib + +SSL_CFLAGS = /DUSE_SSLEAY +SSL_LFLAGS = /LIBPATH:"$(OPENSSL_PATH)/out32" +SSL_IMP_LFLAGS = /LIBPATH:"$(OPENSSL_PATH)/out32dll" +SSL_LIBS = libeay32.lib ssleay32.lib gdi32.lib user32.lib advapi32.lib + +# Runtime library configuration +RTLIB = /MD +RTLIBD = /MDd + +!IF "$(RTLIBCFG)" == "static" +RTLIB = /MT +RTLIBD = /MTd +!ENDIF + +## Release +CCR = cl.exe $(RTLIB) /O2 /DNDEBUG +LINKR = link.exe /incremental:no /libpath:"../lib" +RCR = rc.exe /dDEBUGBUILD=0 + +## Debug +CCD = cl.exe $(RTLIBD) /Gm /ZI /Od /D_DEBUG /GZ +LINKD = link.exe /incremental:yes /debug /libpath:"../lib" +RCD = rc.exe /dDEBUGBUILD=1 + +CFLAGS = /I../lib /I../include /nologo /W3 /GX /DWIN32 /YX /FD /c +LFLAGS = /nologo /out:$(PROGRAM_NAME) /subsystem:console /machine:$(MACHINE) +RESFLAGS = /i../include + +# This manifest thing is for VC8, enabled by the maketgz script that +# builds the VC8 version of this makefile. Left commented out in the VC6 +# version! +#MANIFESTTOOL = mt -manifest $(PROGRAM_NAME).manifest -outputresource:$(PROGRAM_NAME);1 + +!IFDEF WINDOWS_SSPI +CFLAGS = $(CFLAGS) /DUSE_WINDOWS_SSPI /I$(WINDOWS_SDK_PATH)\include +!ENDIF + +RELEASE_OBJS= \ + curlutilr.obj \ + getpassr.obj \ + homedirr.obj \ + hugehelpr.obj \ + mainr.obj \ + nonblockr.obj \ + os-specificr.obj \ + rawstrr.obj \ + strtoofftr.obj \ + urlglobr.obj \ + writeoutr.obj \ + xattrr.obj \ + curlr.res + +DEBUG_OBJS= \ + curlutild.obj \ + getpassd.obj \ + homedird.obj \ + hugehelpd.obj \ + maind.obj \ + nonblockd.obj \ + os-specificd.obj \ + rawstrd.obj \ + strtoofftd.obj \ + urlglobd.obj \ + writeoutd.obj \ + xattrd.obj \ + curld.res + +################################################# +# If CFG not specified, use static libs + +CFLAGS = $(CFLAGS) /DCURL_STATICLIB +LINKLIBS = libcurl.lib +LINKLIBS_DEBUG = libcurld.lib + +################################################# +# release dynamic library + +!IF "$(CFG)" == "release-dll" +LINKLIBS = libcurl_imp.lib +LINKLIBS_DEBUG = libcurld_imp.lib +!ENDIF + +################################################# +# release static library with zlib + +!IF "$(CFG)" == "release-zlib" +CFLAGS = $(CFLAGS) $(ZLIB_CFLAGS) /DCURL_STATICLIB +LINKLIBS = libcurl.lib $(ZLIB_LIBS) +LINKLIBS_DEBUG = libcurld.lib $(ZLIB_LIBS) +LFLAGS = $(LFLAGS) $(ZLIB_LFLAGS) +!ENDIF + +################################################# +# release static library with ssl + +!IF "$(CFG)" == "release-ssl" +CFLAGS = $(CFLAGS) $(SSL_CFLAGS) /DCURL_STATICLIB +LINKLIBS = libcurl.lib $(SSL_LIBS) +LINKLIBS_DEBUG = libcurld.lib $(SSL_LIBS) +LFLAGS = $(LFLAGS) $(SSL_LFLAGS) +!ENDIF + +################################################# +# release dynamic library with dynamic ssl + +!IF "$(CFG)" == "release-dll-ssl-dll" +CFLAGS = $(CFLAGS) $(SSL_CFLAGS) +LINKLIBS = libcurl_imp.lib $(SSL_LIBS) +LINKLIBS_DEBUG = libcurld_imp.lib $(SSL_LIBS) +LFLAGS = $(LFLAGS) $(SSL_IMP_LFLAGS) +!ENDIF + +################################################# +# release static library with ssl and zlib + +!IF "$(CFG)" == "release-ssl-zlib" +CFLAGS = $(CFLAGS) $(SSL_CFLAGS) $(ZLIB_CFLAGS) /DCURL_STATICLIB +LINKLIBS = libcurl.lib $(SSL_LIBS) $(ZLIB_LIBS) +LINKLIBS_DEBUG = libcurld.lib $(SSL_LIBS) $(ZLIB_LIBS) +LFLAGS = $(LFLAGS) $(SSL_LFLAGS) $(ZLIB_LFLAGS) +!ENDIF + +################################################# +# release static library with dynamic ssl + +!IF "$(CFG)" == "release-ssl-dll" +CFLAGS = $(CFLAGS) $(SSL_CFLAGS) /DCURL_STATICLIB +LINKLIBS = libcurl.lib $(SSL_LIBS) +LINKLIBS_DEBUG = libcurld.lib $(SSL_LIBS) +LFLAGS = $(LFLAGS) $(SSL_IMP_LFLAGS) +!ENDIF + +################################################# +# release static library with dynamic zlib + +!IF "$(CFG)" == "release-zlib-dll" +CFLAGS = $(CFLAGS) $(ZLIB_CFLAGS) /DCURL_STATICLIB +LINKLIBS = libcurl.lib $(ZLIB_IMP_LIBS) +LINKLIBS_DEBUG = libcurld.lib $(ZLIB_IMP_LIBS) +LFLAGS = $(LFLAGS) $(ZLIB_LFLAGS) +!ENDIF + +################################################# +# release dynamic library with dynamic zlib + +!IF "$(CFG)" == "release-dll-zlib-dll" +CFLAGS = $(CFLAGS) $(ZLIB_CFLAGS) +LINKLIBS = libcurl_imp.lib $(ZLIB_IMP_LIBS) +LINKLIBS_DEBUG = libcurld_imp.lib $(ZLIB_IMP_LIBS) +LFLAGS = $(LFLAGS) $(ZLIB_LFLAGS) +!ENDIF + +################################################# +# release static library with dynamic ssl and dynamic zlib + +!IF "$(CFG)" == "release-ssl-dll-zlib-dll" +CFLAGS = $(CFLAGS) $(SSL_CFLAGS) $(ZLIB_CFLAGS) /DCURL_STATICLIB +LINKLIBS = libcurl.lib $(SSL_LIBS) $(ZLIB_IMP_LIBS) +LINKLIBS_DEBUG = libcurld.lib $(SSL_LIBS) $(ZLIB_IMP_LIBS) +LFLAGS = $(LFLAGS) $(SSL_IMP_LFLAGS) $(ZLIB_LFLAGS) +!ENDIF + +################################################# +# release dynamic library with dynamic ssl and dynamic zlib + +!IF "$(CFG)" == "release-dll-ssl-dll-zlib-dll" +CFLAGS = $(CFLAGS) $(SSL_CFLAGS) $(ZLIB_CFLAGS) +LINKLIBS = libcurl_imp.lib $(SSL_LIBS) $(ZLIB_IMP_LIBS) +LINKLIBS_DEBUG = libcurld_imp.lib $(SSL_LIBS) $(ZLIB_IMP_LIBS) +LFLAGS = $(LFLAGS) $(SSL_IMP_LFLAGS) $(ZLIB_LFLAGS) +!ENDIF + + +LINKLIBS = $(LINKLIBS) ws2_32.lib wldap32.lib +LINKLIBS_DEBUG = $(LINKLIBS_DEBUG) ws2_32.lib wldap32.lib + +all : release + +release: $(RELEASE_OBJS) + $(LINKR) $(LFLAGS) $(LINKLIBS) $(RELEASE_OBJS) + $(MANIFESTTOOL) + +debug: $(DEBUG_OBJS) + $(LINKD) $(LFLAGS) $(LINKLIBS_DEBUG) $(DEBUG_OBJS) + $(MANIFESTTOOL) + +## Release +hugehelpr.obj: hugehelp.c + $(CCR) $(CFLAGS) /Zm200 /Fo"$@" hugehelp.c +writeoutr.obj: writeout.c + $(CCR) $(CFLAGS) /Fo"$@" writeout.c +urlglobr.obj: urlglob.c + $(CCR) $(CFLAGS) /Fo"$@" urlglob.c +getpassr.obj: getpass.c + $(CCR) $(CFLAGS) /Fo"$@" getpass.c +homedirr.obj: homedir.c + $(CCR) $(CFLAGS) /Fo"$@" homedir.c +curlutilr.obj: curlutil.c + $(CCR) $(CFLAGS) /Fo"$@" curlutil.c +os-specificr.obj: os-specific.c + $(CCR) $(CFLAGS) /Fo"$@" os-specific.c +nonblockr.obj: ../lib/nonblock.c + $(CCR) $(CFLAGS) /Fo"$@" ../lib/nonblock.c +rawstrr.obj: ../lib/rawstr.c + $(CCR) $(CFLAGS) /Fo"$@" ../lib/rawstr.c +strtoofftr.obj: ../lib/strtoofft.c + $(CCR) $(CFLAGS) /Fo"$@" ../lib/strtoofft.c +xattrr.obj: xattr.c + $(CCR) $(CFLAGS) /Fo"$@" xattr.c +mainr.obj: main.c + $(CCR) $(CFLAGS) /Fo"$@" main.c +curlr.res : curl.rc + $(RCR) $(RESFLAGS) /Fo"$@" curl.rc + +## Debug +hugehelpd.obj: hugehelp.c + $(CCD) $(CFLAGS) /Zm200 /Fo"$@" hugehelp.c +writeoutd.obj: writeout.c + $(CCD) $(CFLAGS) /Fo"$@" writeout.c +urlglobd.obj: urlglob.c + $(CCD) $(CFLAGS) /Fo"$@" urlglob.c +getpassd.obj: getpass.c + $(CCD) $(CFLAGS) /Fo"$@" getpass.c +homedird.obj: homedir.c + $(CCD) $(CFLAGS) /Fo"$@" homedir.c +curlutild.obj: curlutil.c + $(CCD) $(CFLAGS) /Fo"$@" curlutil.c +os-specificd.obj: os-specific.c + $(CCD) $(CFLAGS) /Fo"$@" os-specific.c +nonblockd.obj: ../lib/nonblock.c + $(CCD) $(CFLAGS) /Fo"$@" ../lib/nonblock.c +rawstrd.obj: ../lib/rawstr.c + $(CCD) $(CFLAGS) /Fo"$@" ../lib/rawstr.c +strtoofftd.obj: ../lib/strtoofft.c + $(CCD) $(CFLAGS) /Fo"$@" ../lib/strtoofft.c +xattrd.obj: xattr.c + $(CCD) $(CFLAGS) /Fo"$@" xattr.c +maind.obj: main.c + $(CCD) $(CFLAGS) /Fo"$@" main.c +curld.res : curl.rc + $(RCD) $(RESFLAGS) /Fo"$@" curl.rc + +clean: + @-erase $(PROGRAM_NAME) 2> NUL + @-erase $(RELEASE_OBJS) 2> NUL + @-erase $(DEBUG_OBJS) 2> NUL + @-erase *.idb 2> NUL + @-erase *.pdb 2> NUL + @-erase *.pch 2> NUL + @-erase *.ilk 2> NUL diff --git a/mobicore/common/curl/src/Makefile.vc8 b/mobicore/common/curl/src/Makefile.vc8 new file mode 100644 index 0000000000000000000000000000000000000000..8ede3fe43dc86f97f196d6ca485b67e7d0e5d761 --- /dev/null +++ b/mobicore/common/curl/src/Makefile.vc8 @@ -0,0 +1,305 @@ +############################################################# +# +## Makefile for building curl.exe with MSVC8 +## Use: nmake -f makefile.vc6 [release | debug] [CFG=release-ssl] +## (default is release) +## "nmake -f makefile.vc6 CFG=release-ssl" statically links OpenSSL +## into curl.exe producing a standalone SSL-enabled executable. +## +## Comments to: Troy Engel +## Updated by: Craig Davison +## release-ssl added by Miklos Nemeth +# +############################################################# + +PROGRAM_NAME = curl.exe + +!IFNDEF OPENSSL_PATH +OPENSSL_PATH = ../../openssl-0.9.8o +!ENDIF + +!IFNDEF ZLIB_PATH +ZLIB_PATH = ../../zlib-1.2.5 +!ENDIF + +!IFNDEF MACHINE +MACHINE = X86 +!ENDIF + +# USE_WINDOWS_SSPI uses windows libraries to allow NTLM authentication +# without an openssl installation and offers the ability to authenticate +# using the "current logged in user". Since at least with MSVC8 the sspi.h +# header is broken it is either required to install the Windows SDK, +# or to fix sspi.h with adding this define at the beginning of sspi.h: +# #define FreeCredentialHandle FreeCredentialsHandle +# +# If, for some reason the Windows SDK is installed but not installed +# in the default location, you can specify WINDOWS_SDK_PATH. +# It can be downloaded from: +# http://www.microsoft.com/msdownload/platformsdk/sdkupdate/ + +# WINDOWS_SSPI = 1 + +!IFDEF WINDOWS_SSPI +!IFNDEF WINDOWS_SDK_PATH +WINDOWS_SDK_PATH = "C:\Program Files\Microsoft SDK" +!ENDIF +!ENDIF + +######################################################## +## Nothing more to do below this line! +ZLIB_CFLAGS = /DHAVE_ZLIB_H /DHAVE_ZLIB /DHAVE_LIBZ /I "$(ZLIB_PATH)" +ZLIB_LFLAGS = "/LIBPATH:$(ZLIB_PATH)" +ZLIB_LIBS = zlib.lib +ZLIB_IMP_LIBS = zdll.lib + +SSL_CFLAGS = /DUSE_SSLEAY +SSL_LFLAGS = /LIBPATH:"$(OPENSSL_PATH)/out32" +SSL_IMP_LFLAGS = /LIBPATH:"$(OPENSSL_PATH)/out32dll" +SSL_LIBS = libeay32.lib ssleay32.lib gdi32.lib user32.lib advapi32.lib + +# Runtime library configuration +RTLIB = /MD +RTLIBD = /MDd + +!IF "$(RTLIBCFG)" == "static" +RTLIB = /MT +RTLIBD = /MTd +!ENDIF + +## Release +CCR = cl.exe $(RTLIB) /O2 /DNDEBUG +LINKR = link.exe /incremental:no /libpath:"../lib" +RCR = rc.exe /dDEBUGBUILD=0 + +## Debug +CCD = cl.exe $(RTLIBD) /Gm /ZI /Od /D_DEBUG /RTC1 +LINKD = link.exe /incremental:yes /debug /libpath:"../lib" +RCD = rc.exe /dDEBUGBUILD=1 + +CFLAGS = /I../lib /I../include /nologo /W3 /EHsc /DWIN32 /FD /c +LFLAGS = /nologo /out:$(PROGRAM_NAME) /subsystem:console /machine:$(MACHINE) +RESFLAGS = /i../include + +# This manifest thing is for VC8, enabled by the maketgz script that +# builds the VC8 version of this makefile. Left commented out in the VC8 +# version! +#MANIFESTTOOL = mt -manifest $(PROGRAM_NAME).manifest -outputresource:$(PROGRAM_NAME);1 + +!IFDEF WINDOWS_SSPI +CFLAGS = $(CFLAGS) /DUSE_WINDOWS_SSPI /I$(WINDOWS_SDK_PATH)\include +!ENDIF + +RELEASE_OBJS= \ + curlutilr.obj \ + getpassr.obj \ + homedirr.obj \ + hugehelpr.obj \ + mainr.obj \ + nonblockr.obj \ + os-specificr.obj \ + rawstrr.obj \ + strtoofftr.obj \ + urlglobr.obj \ + writeoutr.obj \ + xattrr.obj \ + curlr.res + +DEBUG_OBJS= \ + curlutild.obj \ + getpassd.obj \ + homedird.obj \ + hugehelpd.obj \ + maind.obj \ + nonblockd.obj \ + os-specificd.obj \ + rawstrd.obj \ + strtoofftd.obj \ + urlglobd.obj \ + writeoutd.obj \ + xattrd.obj \ + curld.res + +################################################# +# If CFG not specified, use static libs + +CFLAGS = $(CFLAGS) /DCURL_STATICLIB +LINKLIBS = libcurl.lib +LINKLIBS_DEBUG = libcurld.lib + +################################################# +# release dynamic library + +!IF "$(CFG)" == "release-dll" +LINKLIBS = libcurl_imp.lib +LINKLIBS_DEBUG = libcurld_imp.lib +!ENDIF + +################################################# +# release static library with zlib + +!IF "$(CFG)" == "release-zlib" +CFLAGS = $(CFLAGS) $(ZLIB_CFLAGS) /DCURL_STATICLIB +LINKLIBS = libcurl.lib $(ZLIB_LIBS) +LINKLIBS_DEBUG = libcurld.lib $(ZLIB_LIBS) +LFLAGS = $(LFLAGS) $(ZLIB_LFLAGS) +!ENDIF + +################################################# +# release static library with ssl + +!IF "$(CFG)" == "release-ssl" +CFLAGS = $(CFLAGS) $(SSL_CFLAGS) /DCURL_STATICLIB +LINKLIBS = libcurl.lib $(SSL_LIBS) +LINKLIBS_DEBUG = libcurld.lib $(SSL_LIBS) +LFLAGS = $(LFLAGS) $(SSL_LFLAGS) +!ENDIF + +################################################# +# release dynamic library with dynamic ssl + +!IF "$(CFG)" == "release-dll-ssl-dll" +CFLAGS = $(CFLAGS) $(SSL_CFLAGS) +LINKLIBS = libcurl_imp.lib $(SSL_LIBS) +LINKLIBS_DEBUG = libcurld_imp.lib $(SSL_LIBS) +LFLAGS = $(LFLAGS) $(SSL_IMP_LFLAGS) +!ENDIF + +################################################# +# release static library with ssl and zlib + +!IF "$(CFG)" == "release-ssl-zlib" +CFLAGS = $(CFLAGS) $(SSL_CFLAGS) $(ZLIB_CFLAGS) /DCURL_STATICLIB +LINKLIBS = libcurl.lib $(SSL_LIBS) $(ZLIB_LIBS) +LINKLIBS_DEBUG = libcurld.lib $(SSL_LIBS) $(ZLIB_LIBS) +LFLAGS = $(LFLAGS) $(SSL_LFLAGS) $(ZLIB_LFLAGS) +!ENDIF + +################################################# +# release static library with dynamic ssl + +!IF "$(CFG)" == "release-ssl-dll" +CFLAGS = $(CFLAGS) $(SSL_CFLAGS) /DCURL_STATICLIB +LINKLIBS = libcurl.lib $(SSL_LIBS) +LINKLIBS_DEBUG = libcurld.lib $(SSL_LIBS) +LFLAGS = $(LFLAGS) $(SSL_IMP_LFLAGS) +!ENDIF + +################################################# +# release static library with dynamic zlib + +!IF "$(CFG)" == "release-zlib-dll" +CFLAGS = $(CFLAGS) $(ZLIB_CFLAGS) /DCURL_STATICLIB +LINKLIBS = libcurl.lib $(ZLIB_IMP_LIBS) +LINKLIBS_DEBUG = libcurld.lib $(ZLIB_IMP_LIBS) +LFLAGS = $(LFLAGS) $(ZLIB_LFLAGS) +!ENDIF + +################################################# +# release dynamic library with dynamic zlib + +!IF "$(CFG)" == "release-dll-zlib-dll" +CFLAGS = $(CFLAGS) $(ZLIB_CFLAGS) +LINKLIBS = libcurl_imp.lib $(ZLIB_IMP_LIBS) +LINKLIBS_DEBUG = libcurld_imp.lib $(ZLIB_IMP_LIBS) +LFLAGS = $(LFLAGS) $(ZLIB_LFLAGS) +!ENDIF + +################################################# +# release static library with dynamic ssl and dynamic zlib + +!IF "$(CFG)" == "release-ssl-dll-zlib-dll" +CFLAGS = $(CFLAGS) $(SSL_CFLAGS) $(ZLIB_CFLAGS) /DCURL_STATICLIB +LINKLIBS = libcurl.lib $(SSL_LIBS) $(ZLIB_IMP_LIBS) +LINKLIBS_DEBUG = libcurld.lib $(SSL_LIBS) $(ZLIB_IMP_LIBS) +LFLAGS = $(LFLAGS) $(SSL_IMP_LFLAGS) $(ZLIB_LFLAGS) +!ENDIF + +################################################# +# release dynamic library with dynamic ssl and dynamic zlib + +!IF "$(CFG)" == "release-dll-ssl-dll-zlib-dll" +CFLAGS = $(CFLAGS) $(SSL_CFLAGS) $(ZLIB_CFLAGS) +LINKLIBS = libcurl_imp.lib $(SSL_LIBS) $(ZLIB_IMP_LIBS) +LINKLIBS_DEBUG = libcurld_imp.lib $(SSL_LIBS) $(ZLIB_IMP_LIBS) +LFLAGS = $(LFLAGS) $(SSL_IMP_LFLAGS) $(ZLIB_LFLAGS) +!ENDIF + + +LINKLIBS = $(LINKLIBS) ws2_32.lib bufferoverflowu.lib wldap32.lib +LINKLIBS_DEBUG = $(LINKLIBS_DEBUG) ws2_32.lib bufferoverflowu.lib wldap32.lib + +all : release + +release: $(RELEASE_OBJS) + $(LINKR) $(LFLAGS) $(LINKLIBS) $(RELEASE_OBJS) + $(MANIFESTTOOL) + +debug: $(DEBUG_OBJS) + $(LINKD) $(LFLAGS) $(LINKLIBS_DEBUG) $(DEBUG_OBJS) + $(MANIFESTTOOL) + +## Release +hugehelpr.obj: hugehelp.c + $(CCR) $(CFLAGS) /Zm200 /Fo"$@" hugehelp.c +writeoutr.obj: writeout.c + $(CCR) $(CFLAGS) /Fo"$@" writeout.c +urlglobr.obj: urlglob.c + $(CCR) $(CFLAGS) /Fo"$@" urlglob.c +getpassr.obj: getpass.c + $(CCR) $(CFLAGS) /Fo"$@" getpass.c +homedirr.obj: homedir.c + $(CCR) $(CFLAGS) /Fo"$@" homedir.c +curlutilr.obj: curlutil.c + $(CCR) $(CFLAGS) /Fo"$@" curlutil.c +os-specificr.obj: os-specific.c + $(CCR) $(CFLAGS) /Fo"$@" os-specific.c +nonblockr.obj: ../lib/nonblock.c + $(CCR) $(CFLAGS) /Fo"$@" ../lib/nonblock.c +rawstrr.obj: ../lib/rawstr.c + $(CCR) $(CFLAGS) /Fo"$@" ../lib/rawstr.c +strtoofftr.obj: ../lib/strtoofft.c + $(CCR) $(CFLAGS) /Fo"$@" ../lib/strtoofft.c +xattrr.obj: xattr.c + $(CCR) $(CFLAGS) /Fo"$@" xattr.c +mainr.obj: main.c + $(CCR) $(CFLAGS) /Fo"$@" main.c +curlr.res : curl.rc + $(RCR) $(RESFLAGS) /Fo"$@" curl.rc + +## Debug +hugehelpd.obj: hugehelp.c + $(CCD) $(CFLAGS) /Zm200 /Fo"$@" hugehelp.c +writeoutd.obj: writeout.c + $(CCD) $(CFLAGS) /Fo"$@" writeout.c +urlglobd.obj: urlglob.c + $(CCD) $(CFLAGS) /Fo"$@" urlglob.c +getpassd.obj: getpass.c + $(CCD) $(CFLAGS) /Fo"$@" getpass.c +homedird.obj: homedir.c + $(CCD) $(CFLAGS) /Fo"$@" homedir.c +curlutild.obj: curlutil.c + $(CCD) $(CFLAGS) /Fo"$@" curlutil.c +os-specificd.obj: os-specific.c + $(CCD) $(CFLAGS) /Fo"$@" os-specific.c +nonblockd.obj: ../lib/nonblock.c + $(CCD) $(CFLAGS) /Fo"$@" ../lib/nonblock.c +rawstrd.obj: ../lib/rawstr.c + $(CCD) $(CFLAGS) /Fo"$@" ../lib/rawstr.c +strtoofftd.obj: ../lib/strtoofft.c + $(CCD) $(CFLAGS) /Fo"$@" ../lib/strtoofft.c +xattrd.obj: xattr.c + $(CCD) $(CFLAGS) /Fo"$@" xattr.c +maind.obj: main.c + $(CCD) $(CFLAGS) /Fo"$@" main.c +curld.res : curl.rc + $(RCD) $(RESFLAGS) /Fo"$@" curl.rc + +clean: + @-erase $(PROGRAM_NAME) 2> NUL + @-erase $(RELEASE_OBJS) 2> NUL + @-erase $(DEBUG_OBJS) 2> NUL + @-erase *.idb 2> NUL + @-erase *.pdb 2> NUL + @-erase *.pch 2> NUL + @-erase *.ilk 2> NUL diff --git a/mobicore/common/curl/src/Makefile.vc9 b/mobicore/common/curl/src/Makefile.vc9 new file mode 100644 index 0000000000000000000000000000000000000000..2d93e8b1050b577d4fdc21ae218c8ef8407a8e61 --- /dev/null +++ b/mobicore/common/curl/src/Makefile.vc9 @@ -0,0 +1,305 @@ +############################################################# +# +## Makefile for building curl.exe with MSVC9 +## Use: nmake -f makefile.vc9 [release | debug] [CFG=release-ssl] +## (default is release) +## "nmake -f makefile.vc9 CFG=release-ssl" statically links OpenSSL +## into curl.exe producing a standalone SSL-enabled executable. +## +## Comments to: Troy Engel +## Updated by: Craig Davison +## release-ssl added by Miklos Nemeth +# +############################################################# + +PROGRAM_NAME = curl.exe + +!IFNDEF OPENSSL_PATH +OPENSSL_PATH = ../../openssl-0.9.8o +!ENDIF + +!IFNDEF ZLIB_PATH +ZLIB_PATH = ../../zlib-1.2.5 +!ENDIF + +!IFNDEF MACHINE +MACHINE = X86 +!ENDIF + +# USE_WINDOWS_SSPI uses windows libraries to allow NTLM authentication +# without an openssl installation and offers the ability to authenticate +# using the "current logged in user". Since at least with MSVC9 the sspi.h +# header is broken it is either required to install the Windows SDK, +# or to fix sspi.h with adding this define at the beginning of sspi.h: +# #define FreeCredentialHandle FreeCredentialsHandle +# +# If, for some reason the Windows SDK is installed but not installed +# in the default location, you can specify WINDOWS_SDK_PATH. +# It can be downloaded from: +# http://www.microsoft.com/msdownload/platformsdk/sdkupdate/ + +# WINDOWS_SSPI = 1 + +!IFDEF WINDOWS_SSPI +!IFNDEF WINDOWS_SDK_PATH +WINDOWS_SDK_PATH = "C:\Program Files\Microsoft SDK" +!ENDIF +!ENDIF + +######################################################## +## Nothing more to do below this line! +ZLIB_CFLAGS = /DHAVE_ZLIB_H /DHAVE_ZLIB /DHAVE_LIBZ /I "$(ZLIB_PATH)" +ZLIB_LFLAGS = "/LIBPATH:$(ZLIB_PATH)" +ZLIB_LIBS = zlib.lib +ZLIB_IMP_LIBS = zdll.lib + +SSL_CFLAGS = /DUSE_SSLEAY +SSL_LFLAGS = /LIBPATH:"$(OPENSSL_PATH)/out32" +SSL_IMP_LFLAGS = /LIBPATH:"$(OPENSSL_PATH)/out32dll" +SSL_LIBS = libeay32.lib ssleay32.lib gdi32.lib user32.lib advapi32.lib + +# Runtime library configuration +RTLIB = /MD +RTLIBD = /MDd + +!IF "$(RTLIBCFG)" == "static" +RTLIB = /MT +RTLIBD = /MTd +!ENDIF + +## Release +CCR = cl.exe $(RTLIB) /O2 /DNDEBUG +LINKR = link.exe /incremental:no /libpath:"../lib" +RCR = rc.exe /dDEBUGBUILD=0 + +## Debug +CCD = cl.exe $(RTLIBD) /Gm /ZI /Od /D_DEBUG /RTC1 +LINKD = link.exe /incremental:yes /debug /libpath:"../lib" +RCD = rc.exe /dDEBUGBUILD=1 + +CFLAGS = /I../lib /I../include /nologo /W3 /EHsc /DWIN32 /FD /c +LFLAGS = /nologo /out:$(PROGRAM_NAME) /subsystem:console /machine:$(MACHINE) +RESFLAGS = /i../include + +# This manifest thing is for VC8, enabled by the maketgz script that +# builds the VC8 version of this makefile. Left commented out in the VC9 +# version! +#MANIFESTTOOL = mt -manifest $(PROGRAM_NAME).manifest -outputresource:$(PROGRAM_NAME);1 + +!IFDEF WINDOWS_SSPI +CFLAGS = $(CFLAGS) /DUSE_WINDOWS_SSPI /I$(WINDOWS_SDK_PATH)\include +!ENDIF + +RELEASE_OBJS= \ + curlutilr.obj \ + getpassr.obj \ + homedirr.obj \ + hugehelpr.obj \ + mainr.obj \ + nonblockr.obj \ + os-specificr.obj \ + rawstrr.obj \ + strtoofftr.obj \ + urlglobr.obj \ + writeoutr.obj \ + xattrr.obj \ + curlr.res + +DEBUG_OBJS= \ + curlutild.obj \ + getpassd.obj \ + homedird.obj \ + hugehelpd.obj \ + maind.obj \ + nonblockd.obj \ + os-specificd.obj \ + rawstrd.obj \ + strtoofftd.obj \ + urlglobd.obj \ + writeoutd.obj \ + xattrd.obj \ + curld.res + +################################################# +# If CFG not specified, use static libs + +CFLAGS = $(CFLAGS) /DCURL_STATICLIB +LINKLIBS = libcurl.lib +LINKLIBS_DEBUG = libcurld.lib + +################################################# +# release dynamic library + +!IF "$(CFG)" == "release-dll" +LINKLIBS = libcurl_imp.lib +LINKLIBS_DEBUG = libcurld_imp.lib +!ENDIF + +################################################# +# release static library with zlib + +!IF "$(CFG)" == "release-zlib" +CFLAGS = $(CFLAGS) $(ZLIB_CFLAGS) /DCURL_STATICLIB +LINKLIBS = libcurl.lib $(ZLIB_LIBS) +LINKLIBS_DEBUG = libcurld.lib $(ZLIB_LIBS) +LFLAGS = $(LFLAGS) $(ZLIB_LFLAGS) +!ENDIF + +################################################# +# release static library with ssl + +!IF "$(CFG)" == "release-ssl" +CFLAGS = $(CFLAGS) $(SSL_CFLAGS) /DCURL_STATICLIB +LINKLIBS = libcurl.lib $(SSL_LIBS) +LINKLIBS_DEBUG = libcurld.lib $(SSL_LIBS) +LFLAGS = $(LFLAGS) $(SSL_LFLAGS) +!ENDIF + +################################################# +# release dynamic library with dynamic ssl + +!IF "$(CFG)" == "release-dll-ssl-dll" +CFLAGS = $(CFLAGS) $(SSL_CFLAGS) +LINKLIBS = libcurl_imp.lib $(SSL_LIBS) +LINKLIBS_DEBUG = libcurld_imp.lib $(SSL_LIBS) +LFLAGS = $(LFLAGS) $(SSL_IMP_LFLAGS) +!ENDIF + +################################################# +# release static library with ssl and zlib + +!IF "$(CFG)" == "release-ssl-zlib" +CFLAGS = $(CFLAGS) $(SSL_CFLAGS) $(ZLIB_CFLAGS) /DCURL_STATICLIB +LINKLIBS = libcurl.lib $(SSL_LIBS) $(ZLIB_LIBS) +LINKLIBS_DEBUG = libcurld.lib $(SSL_LIBS) $(ZLIB_LIBS) +LFLAGS = $(LFLAGS) $(SSL_LFLAGS) $(ZLIB_LFLAGS) +!ENDIF + +################################################# +# release static library with dynamic ssl + +!IF "$(CFG)" == "release-ssl-dll" +CFLAGS = $(CFLAGS) $(SSL_CFLAGS) /DCURL_STATICLIB +LINKLIBS = libcurl.lib $(SSL_LIBS) +LINKLIBS_DEBUG = libcurld.lib $(SSL_LIBS) +LFLAGS = $(LFLAGS) $(SSL_IMP_LFLAGS) +!ENDIF + +################################################# +# release static library with dynamic zlib + +!IF "$(CFG)" == "release-zlib-dll" +CFLAGS = $(CFLAGS) $(ZLIB_CFLAGS) /DCURL_STATICLIB +LINKLIBS = libcurl.lib $(ZLIB_IMP_LIBS) +LINKLIBS_DEBUG = libcurld.lib $(ZLIB_IMP_LIBS) +LFLAGS = $(LFLAGS) $(ZLIB_LFLAGS) +!ENDIF + +################################################# +# release dynamic library with dynamic zlib + +!IF "$(CFG)" == "release-dll-zlib-dll" +CFLAGS = $(CFLAGS) $(ZLIB_CFLAGS) +LINKLIBS = libcurl_imp.lib $(ZLIB_IMP_LIBS) +LINKLIBS_DEBUG = libcurld_imp.lib $(ZLIB_IMP_LIBS) +LFLAGS = $(LFLAGS) $(ZLIB_LFLAGS) +!ENDIF + +################################################# +# release static library with dynamic ssl and dynamic zlib + +!IF "$(CFG)" == "release-ssl-dll-zlib-dll" +CFLAGS = $(CFLAGS) $(SSL_CFLAGS) $(ZLIB_CFLAGS) /DCURL_STATICLIB +LINKLIBS = libcurl.lib $(SSL_LIBS) $(ZLIB_IMP_LIBS) +LINKLIBS_DEBUG = libcurld.lib $(SSL_LIBS) $(ZLIB_IMP_LIBS) +LFLAGS = $(LFLAGS) $(SSL_IMP_LFLAGS) $(ZLIB_LFLAGS) +!ENDIF + +################################################# +# release dynamic library with dynamic ssl and dynamic zlib + +!IF "$(CFG)" == "release-dll-ssl-dll-zlib-dll" +CFLAGS = $(CFLAGS) $(SSL_CFLAGS) $(ZLIB_CFLAGS) +LINKLIBS = libcurl_imp.lib $(SSL_LIBS) $(ZLIB_IMP_LIBS) +LINKLIBS_DEBUG = libcurld_imp.lib $(SSL_LIBS) $(ZLIB_IMP_LIBS) +LFLAGS = $(LFLAGS) $(SSL_IMP_LFLAGS) $(ZLIB_LFLAGS) +!ENDIF + + +LINKLIBS = $(LINKLIBS) ws2_32.lib wldap32.lib +LINKLIBS_DEBUG = $(LINKLIBS_DEBUG) ws2_32.lib wldap32.lib + +all : release + +release: $(RELEASE_OBJS) + $(LINKR) $(LFLAGS) $(LINKLIBS) $(RELEASE_OBJS) + $(MANIFESTTOOL) + +debug: $(DEBUG_OBJS) + $(LINKD) $(LFLAGS) $(LINKLIBS_DEBUG) $(DEBUG_OBJS) + $(MANIFESTTOOL) + +## Release +hugehelpr.obj: hugehelp.c + $(CCR) $(CFLAGS) /Zm200 /Fo"$@" hugehelp.c +writeoutr.obj: writeout.c + $(CCR) $(CFLAGS) /Fo"$@" writeout.c +urlglobr.obj: urlglob.c + $(CCR) $(CFLAGS) /Fo"$@" urlglob.c +getpassr.obj: getpass.c + $(CCR) $(CFLAGS) /Fo"$@" getpass.c +homedirr.obj: homedir.c + $(CCR) $(CFLAGS) /Fo"$@" homedir.c +curlutilr.obj: curlutil.c + $(CCR) $(CFLAGS) /Fo"$@" curlutil.c +os-specificr.obj: os-specific.c + $(CCR) $(CFLAGS) /Fo"$@" os-specific.c +nonblockr.obj: ../lib/nonblock.c + $(CCR) $(CFLAGS) /Fo"$@" ../lib/nonblock.c +rawstrr.obj: ../lib/rawstr.c + $(CCR) $(CFLAGS) /Fo"$@" ../lib/rawstr.c +strtoofftr.obj: ../lib/strtoofft.c + $(CCR) $(CFLAGS) /Fo"$@" ../lib/strtoofft.c +xattrr.obj: xattr.c + $(CCR) $(CFLAGS) /Fo"$@" xattr.c +mainr.obj: main.c + $(CCR) $(CFLAGS) /Fo"$@" main.c +curlr.res : curl.rc + $(RCR) $(RESFLAGS) /Fo"$@" curl.rc + +## Debug +hugehelpd.obj: hugehelp.c + $(CCD) $(CFLAGS) /Zm200 /Fo"$@" hugehelp.c +writeoutd.obj: writeout.c + $(CCD) $(CFLAGS) /Fo"$@" writeout.c +urlglobd.obj: urlglob.c + $(CCD) $(CFLAGS) /Fo"$@" urlglob.c +getpassd.obj: getpass.c + $(CCD) $(CFLAGS) /Fo"$@" getpass.c +homedird.obj: homedir.c + $(CCD) $(CFLAGS) /Fo"$@" homedir.c +curlutild.obj: curlutil.c + $(CCD) $(CFLAGS) /Fo"$@" curlutil.c +os-specificd.obj: os-specific.c + $(CCD) $(CFLAGS) /Fo"$@" os-specific.c +nonblockd.obj: ../lib/nonblock.c + $(CCD) $(CFLAGS) /Fo"$@" ../lib/nonblock.c +rawstrd.obj: ../lib/rawstr.c + $(CCD) $(CFLAGS) /Fo"$@" ../lib/rawstr.c +strtoofftd.obj: ../lib/strtoofft.c + $(CCD) $(CFLAGS) /Fo"$@" ../lib/strtoofft.c +xattrd.obj: xattr.c + $(CCD) $(CFLAGS) /Fo"$@" xattr.c +maind.obj: main.c + $(CCD) $(CFLAGS) /Fo"$@" main.c +curld.res : curl.rc + $(RCD) $(RESFLAGS) /Fo"$@" curl.rc + +clean: + @-erase $(PROGRAM_NAME) 2> NUL + @-erase $(RELEASE_OBJS) 2> NUL + @-erase $(DEBUG_OBJS) 2> NUL + @-erase *.idb 2> NUL + @-erase *.pdb 2> NUL + @-erase *.pch 2> NUL + @-erase *.ilk 2> NUL diff --git a/mobicore/common/curl/src/config-amigaos.h b/mobicore/common/curl/src/config-amigaos.h new file mode 100644 index 0000000000000000000000000000000000000000..fba875dab06e7ac6b4714eb074cf2afac942a0b4 --- /dev/null +++ b/mobicore/common/curl/src/config-amigaos.h @@ -0,0 +1,69 @@ +#ifndef CURL_CONFIG_AMIGAOS_H +#define CURL_CONFIG_AMIGAOS_H +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) 1998 - 2007, Daniel Stenberg, , et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at http://curl.haxx.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ***************************************************************************/ + +#ifdef __AMIGA__ /* Any AmigaOS flavour */ + +/* Define to 1 if you want the built-in manual */ +#define USE_MANUAL 1 + +#define OS "AmigaOS" + +#define HAVE_CLOSESOCKET_CAMEL 1 +#define HAVE_UNISTD_H 1 +#define HAVE_STRDUP 1 +#define HAVE_UTIME 1 +#define HAVE_UTIME_H 1 +#define HAVE_SYS_TYPES_H 1 +#define HAVE_SYS_SOCKET_H 1 +#define HAVE_WRITABLE_ARGV 1 +#define HAVE_SYS_TIME_H 1 +#define HAVE_TIME_H 1 +#define TIME_WITH_SYS_TIME 1 +#define HAVE_STRUCT_TIMEVAL 1 + +#if 0 +# define HAVE_TERMIOS_H 1 +# define HAVE_FTRUNCATE 1 +#endif + +#define HAVE_PWD_H 1 + +#ifndef F_OK +# define F_OK 0 +#endif +#ifndef O_RDONLY +# define O_RDONLY 0x0000 /* open for reading only */ +#endif +#ifndef LONG_MAX +# define LONG_MAX 0x7fffffffL /* max value for a long */ +#endif +#ifndef LONG_MIN +# define LONG_MIN (-0x7fffffffL-1) /* min value for a long */ +#endif + +#define SIZEOF_INT 4 +#define SIZEOF_SHORT 2 + +#endif /* __AMIGA__ */ +#endif /* CURL_CONFIG_AMIGAOS_H */ diff --git a/mobicore/common/curl/src/config-mac.h b/mobicore/common/curl/src/config-mac.h new file mode 100644 index 0000000000000000000000000000000000000000..dc7f767aa7661fcea26e6584ddc9ac32a5c8e2a9 --- /dev/null +++ b/mobicore/common/curl/src/config-mac.h @@ -0,0 +1,35 @@ +#ifndef __SRC_CONFIG_MAC_H +#define __SRC_CONFIG_MAC_H + +/* =================================================================== */ +/* src/config-mac.h - Hand crafted config file for Mac OS 9 */ +/* =================================================================== */ +/* On Mac OS X you must run configure to generate curl_config.h file */ +/* =================================================================== */ + +/* Define to 1 if you want the built-in manual */ +#define USE_MANUAL 1 + +#define HAVE_UNISTD_H 1 +#define HAVE_FCNTL_H 1 +#define HAVE_UTIME_H 1 +#define HAVE_SYS_UTIME_H 1 + +#define HAVE_SETVBUF 1 +#define HAVE_UTIME 1 +#define HAVE_FTRUNCATE 1 + +#define HAVE_TIME_H 1 +#define HAVE_SYS_TIME_H 1 +#define TIME_WITH_SYS_TIME 1 +#define HAVE_STRUCT_TIMEVAL 1 + +#define SIZEOF_INT 4 +#define SIZEOF_SHORT 2 + +#define main(x,y) curl_main(x,y) + +/* we provide our own strdup prototype */ +char *strdup(char *s1); + +#endif /* __SRC_CONFIG_MAC_H */ diff --git a/mobicore/common/curl/src/config-riscos.h b/mobicore/common/curl/src/config-riscos.h new file mode 100644 index 0000000000000000000000000000000000000000..ba95f13d033187a70142fdb607e0f4a49df50798 --- /dev/null +++ b/mobicore/common/curl/src/config-riscos.h @@ -0,0 +1,379 @@ +/* curl_config.h.in. Generated automatically from configure.in by autoheader. */ +/* Name of this package! */ +#undef PACKAGE + +/* Version number of this archive. */ +#undef VERSION + +/* Define if you have the getpass function. */ +#undef HAVE_GETPASS + +/* Define cpu-machine-OS */ +#define OS "ARM-RISC OS" + +/* Define to 1 if you want the built-in manual */ +#define USE_MANUAL 1 + +/* Define if you have the gethostbyaddr_r() function with 5 arguments */ +#undef HAVE_GETHOSTBYADDR_R_5 + +/* Define if you have the gethostbyaddr_r() function with 7 arguments */ +#undef HAVE_GETHOSTBYADDR_R_7 + +/* Define if you have the gethostbyaddr_r() function with 8 arguments */ +#undef HAVE_GETHOSTBYADDR_R_8 + +/* Define if you have the gethostbyname_r() function with 3 arguments */ +#undef HAVE_GETHOSTBYNAME_R_3 + +/* Define if you have the gethostbyname_r() function with 5 arguments */ +#undef HAVE_GETHOSTBYNAME_R_5 + +/* Define if you have the gethostbyname_r() function with 6 arguments */ +#undef HAVE_GETHOSTBYNAME_R_6 + +/* Define if you need the _REENTRANT define for some functions */ +#undef NEED_REENTRANT + +/* Define if you have the Kerberos4 libraries (including -ldes) */ +#undef HAVE_KRB4 + +/* Define if you want to enable IPv6 support */ +#undef ENABLE_IPV6 + +/* Define if struct sockaddr_in6 has the sin6_scope_id member */ +#define HAVE_SOCKADDR_IN6_SIN6_SCOPE_ID 1 + +/* Define this to 'int' if ssize_t is not an available typedefed type */ +#undef ssize_t + +/* Define this as a suitable file to read random data from */ +#undef RANDOM_FILE + +/* Define this to your Entropy Gathering Daemon socket pathname */ +#undef EGD_SOCKET + +/* Define if you want to enable IPv6 support */ +#undef ENABLE_IPV6 + +/* Define if you have the header file. */ +#define HAVE_ALLOCA_H + +/* Define if you have the header file. */ +#define HAVE_ARPA_INET_H + +/* Define if you have the `closesocket' function. */ +#undef HAVE_CLOSESOCKET + +/* Define if you have the header file. */ +#undef HAVE_CRYPTO_H + +/* Define if you have the header file. */ +#undef HAVE_DES_H + +/* Define if you have the header file. */ +#undef HAVE_ERR_H + +/* Define if you have the header file. */ +#define HAVE_FCNTL_H + +/* Define if you have the `ftruncate' function. */ +#define HAVE_FTRUNCATE + +/* Define if getaddrinfo exists and works */ +#define HAVE_GETADDRINFO + +/* Define if you have the `geteuid' function. */ +#undef HAVE_GETEUID + +/* Define if you have the `gethostbyaddr' function. */ +#define HAVE_GETHOSTBYADDR + +/* Define if you have the `gethostbyaddr_r' function. */ +#undef HAVE_GETHOSTBYADDR_R + +/* Define if you have the `gethostbyname_r' function. */ +#undef HAVE_GETHOSTBYNAME_R + +/* Define if you have the `gethostname' function. */ +#define HAVE_GETHOSTNAME + +/* Define if you have the header file. */ +#define HAVE_GETOPT_H + +/* Define if you have the `getpass_r' function. */ +#undef HAVE_GETPASS_R + +/* Define if you have the `getpwuid' function. */ +#undef HAVE_GETPWUID + +/* Define if you have the `getservbyname' function. */ +#undef HAVE_GETSERVBYNAME + +/* Define if you have the `gettimeofday' function. */ +#define HAVE_GETTIMEOFDAY + +/* Define if you have the `timeval' struct. */ +#define HAVE_STRUCT_TIMEVAL + +/* Define if you have the `inet_addr' function. */ +#undef HAVE_INET_ADDR + +/* Define if you have the header file. */ +#define HAVE_INTTYPES_H + +/* Define if you have the header file. */ +#undef HAVE_IO_H + +/* Define if you have the `krb_get_our_ip_for_realm' function. */ +#undef HAVE_KRB_GET_OUR_IP_FOR_REALM + +/* Define if you have the header file. */ +#undef HAVE_KRB_H + +/* Define if you have the `crypto' library (-lcrypto). */ +#undef HAVE_LIBCRYPTO + +/* Define if you have the `nsl' library (-lnsl). */ +#undef HAVE_LIBNSL + +/* Define if you have the `resolv' library (-lresolv). */ +#undef HAVE_LIBRESOLV + +/* Define if you have the `resolve' library (-lresolve). */ +#undef HAVE_LIBRESOLVE + +/* Define if you have the `socket' library (-lsocket). */ +#undef HAVE_LIBSOCKET + +/* Define if you have the `ssl' library (-lssl). */ +#undef HAVE_LIBSSL + +/* Define if you have the `ucb' library (-lucb). */ +#undef HAVE_LIBUCB + +/* Define if you have the `localtime_r' function. */ +#undef HAVE_LOCALTIME_R + +/* Define if you have the header file. */ +#define HAVE_MALLOC_H + +/* Define to 1 if you need the malloc.h header file even with stdlib.h */ +/* #define NEED_MALLOC_H 1 */ + +/* Define if you have the header file. */ +#undef HAVE_MEMORY_H + +/* Define if you have the header file. */ +#define HAVE_NETDB_H + +/* Define if you have the header file. */ +#undef HAVE_NETINET_IF_ETHER_H + +/* Define if you have the header file. */ +#define HAVE_NETINET_IN_H + +/* Define if you have the header file. */ +#define HAVE_NET_IF_H + +/* Define if you have the header file. */ +#undef HAVE_OPENSSL_CRYPTO_H + +/* Define if you have the header file. */ +#undef HAVE_OPENSSL_ERR_H + +/* Define if you have the header file. */ +#undef HAVE_OPENSSL_PEM_H + +/* Define if you have the header file. */ +#undef HAVE_OPENSSL_RSA_H + +/* Define if you have the header file. */ +#undef HAVE_OPENSSL_SSL_H + +/* Define if you have the header file. */ +#undef HAVE_OPENSSL_X509_H + +/* Define if you have the header file. */ +#undef HAVE_PEM_H + +/* Define if you have the `perror' function. */ +#undef HAVE_PERROR + +/* Define if you have the header file. */ +#undef HAVE_PWD_H + +/* Define if you have the `RAND_egd' function. */ +#undef HAVE_RAND_EGD + +/* Define if you have the `RAND_screen' function. */ +#undef HAVE_RAND_SCREEN + +/* Define if you have the `RAND_status' function. */ +#undef HAVE_RAND_STATUS + +/* Define if you have the header file. */ +#undef HAVE_RSA_H + +/* Define if you have the `select' function. */ +#define HAVE_SELECT + +/* Define if you have the `setvbuf' function. */ +#undef HAVE_SETVBUF + +/* Define if you have the header file. */ +#define HAVE_SGTTY_H + +/* Define if you have the `sigaction' function. */ +#undef HAVE_SIGACTION + +/* Define if you have the `signal' function. */ +#define HAVE_SIGNAL + +/* Define if you have the `socket' function. */ +#define HAVE_SOCKET + +/* Define if you have the header file. */ +#undef HAVE_SSL_H + +/* Define if you have the header file. */ +#undef HAVE_STDINT_H + +/* Define if you have the header file. */ +#define HAVE_STDLIB_H + +/* Define if you have the `strcasecmp' function. */ +#undef HAVE_STRCASECMP + +/* Define if you have the `strcmpi' function. */ +#undef HAVE_STRCMPI + +/* Define if you have the `strdup' function. */ +#define HAVE_STRDUP + +/* Define if you have the `strftime' function. */ +#define HAVE_STRFTIME + +/* Define if you have the `stricmp' function. */ +#define HAVE_STRICMP + +/* Define if you have the header file. */ +#undef HAVE_STRINGS_H + +/* Define if you have the header file. */ +#define HAVE_STRING_H + +/* Define if you have the `strlcat' function. */ +#undef HAVE_STRLCAT + +/* Define if you have the `strlcpy' function. */ +#undef HAVE_STRLCPY + +/* Define if you have the `strstr' function. */ +#define HAVE_STRSTR + +/* Define if you have the `strtok_r' function. */ +#undef HAVE_STRTOK_R + +/* Define if you have the header file. */ +#undef HAVE_SYS_PARAM_H + +/* Define if you have the header file. */ +#undef HAVE_SYS_SELECT_H + +/* Define if you have the header file. */ +#define HAVE_SYS_SOCKET_H + +/* Define if you have the header file. */ +#undef HAVE_SYS_SOCKIO_H + +/* Define if you have the header file. */ +#undef HAVE_SYS_STAT_H + +/* Define if you have the header file. */ +#define HAVE_SYS_TIME_H + +/* Define if you have the header file. */ +#define HAVE_SYS_TYPES_H + +/* Define if you have the `tcgetattr' function. */ +#define HAVE_TCGETATTR + +/* Define if you have the `tcsetattr' function. */ +#define HAVE_TCSETATTR + +/* Define if you have the header file. */ +#define HAVE_TERMIOS_H + +/* Define if you have the header file. */ +#undef HAVE_TERMIO_H + +/* Define if you have the header file. */ +#undef HAVE_TIME_H + +/* Define if you have the `uname' function. */ +#define HAVE_UNAME + +/* Define if you have the header file. */ +#define HAVE_UNISTD_H + +/* Define if you have the header file. */ +#undef HAVE_WINSOCK_H + +/* Define if you have the header file. */ +#undef HAVE_X509_H + +/* Name of package */ +#undef PACKAGE + +/* Define as the return type of signal handlers (`int' or `void'). */ +#define RETSIGTYPE void + +/* The size of `int', as computed by sizeof. */ +#define SIZEOF_INT 4 + +/* The size of `long double', as computed by sizeof. */ +#undef SIZEOF_LONG_DOUBLE + +/* The size of `long long', as computed by sizeof. */ +#undef SIZEOF_LONG_LONG + +/* The size of `short', as computed by sizeof. */ +#define SIZEOF_SHORT 2 + +/* Define if you have the ANSI C header files. */ +#undef STDC_HEADERS + +/* Define if you can safely include both and . */ +#undef TIME_WITH_SYS_TIME + +/* Version number of package */ +#undef VERSION + +/* Define if on AIX 3. + System headers sometimes define this. + We just want to avoid a redefinition error message. */ +#ifndef _ALL_SOURCE +# undef _ALL_SOURCE +#endif + +/* Number of bits in a file offset, on hosts where this is settable. */ +#undef _FILE_OFFSET_BITS + +/* Define for large files, on AIX-style hosts. */ +#undef _LARGE_FILES + +/* Define to empty if `const' does not conform to ANSI C. */ +#undef const + +/* Define to `unsigned' if does not define. */ +#undef size_t + +/* Define to `int' if does not define. */ +#undef ssize_t + +/* Define if you have the ioctl function. */ +#define HAVE_IOCTL + +/* Define if you have a working ioctl FIONBIO function. */ +#define HAVE_IOCTL_FIONBIO diff --git a/mobicore/common/curl/src/config-win32.h b/mobicore/common/curl/src/config-win32.h new file mode 100644 index 0000000000000000000000000000000000000000..10a5eaf175243a6c69e1b69ff580880c20fd44dc --- /dev/null +++ b/mobicore/common/curl/src/config-win32.h @@ -0,0 +1,416 @@ +#ifndef __SRC_CONFIG_WIN32_H +#define __SRC_CONFIG_WIN32_H + +/* ================================================================ */ +/* src/config-win32.h - Hand crafted config file for windows */ +/* ================================================================ */ + +/* ---------------------------------------------------------------- */ +/* HEADER FILES */ +/* ---------------------------------------------------------------- */ + +/* Define if you have the header file. */ +#define HAVE_FCNTL_H 1 + +/* Define if you have the header file. */ +#define HAVE_IO_H 1 + +/* Define if you have the header file. */ +#define HAVE_LIMITS_H 1 + +/* Define if you have the header file. */ +#define HAVE_LOCALE_H 1 + +/* Define if you need the malloc.h header file even with stdlib.h */ +#if !defined(__SALFORDC__) && !defined(__POCC__) +#define NEED_MALLOC_H 1 +#endif + +/* Define if you have the header file. */ +#define HAVE_SIGNAL_H 1 + +/* Define if you have the header file. */ +#define HAVE_STDLIB_H 1 + +/* Define if you have the header file */ +/* #define HAVE_SYS_TIME_H 1 */ + +/* Define if you have the header file. */ +#define HAVE_SYS_TYPES_H 1 + +/* Define if you have the header file. */ +#ifndef __BORLANDC__ +#define HAVE_SYS_UTIME_H 1 +#endif + +/* Define if you have the header file. */ +#define HAVE_TIME_H 1 + +/* Define if you have the header file. */ +#if defined(__MINGW32__) || defined(__WATCOMC__) || defined(__LCC__) || \ + defined(__POCC__) +#define HAVE_UNISTD_H 1 +#endif + +/* Define if you have the header file. */ +#define HAVE_WINDOWS_H 1 + +/* Define if you have the header file. */ +#define HAVE_WINSOCK_H 1 + +/* Define if you have the header file. */ +#ifndef __SALFORDC__ +#define HAVE_WINSOCK2_H 1 +#endif + +/* Define if you have the header file. */ +#ifndef __SALFORDC__ +#define HAVE_WS2TCPIP_H 1 +#endif + +/* ---------------------------------------------------------------- */ +/* OTHER HEADER INFO */ +/* ---------------------------------------------------------------- */ + +/* Define if sig_atomic_t is an available typedef. */ +#define HAVE_SIG_ATOMIC_T 1 + +/* Define if you have the ANSI C header files. */ +#define STDC_HEADERS 1 + +/* Define if you can safely include both and . */ +/* #define TIME_WITH_SYS_TIME 1 */ + +/* ---------------------------------------------------------------- */ +/* FUNCTIONS */ +/* ---------------------------------------------------------------- */ + +/* Define if you have the ftruncate function. */ +#define HAVE_FTRUNCATE 1 + +/* Define if you have the ioctlsocket function. */ +#define HAVE_IOCTLSOCKET 1 + +/* Define if you have a working ioctlsocket FIONBIO function. */ +#define HAVE_IOCTLSOCKET_FIONBIO 1 + +/* Define if you have the setlocale function. */ +#define HAVE_SETLOCALE 1 + +/* Define if you have the setmode function. */ +#define HAVE_SETMODE 1 + +/* Define if you have the strcasecmp function. */ +/* #define HAVE_STRCASECMP 1 */ + +/* Define if you have the strdup function. */ +#define HAVE_STRDUP 1 + +/* Define if you have the stricmp function. */ +#define HAVE_STRICMP 1 + +/* Define if you have the strncasecmp function. */ +/* #define HAVE_STRNCASECMP 1 */ + +/* Define if you have the strnicmp function. */ +#define HAVE_STRNICMP 1 + +/* Define if you have the utime function */ +#ifndef __BORLANDC__ +#define HAVE_UTIME 1 +#endif + +/* Define if you have the recv function. */ +#define HAVE_RECV 1 + +/* Define to the type of arg 1 for recv. */ +#define RECV_TYPE_ARG1 SOCKET + +/* Define to the type of arg 2 for recv. */ +#define RECV_TYPE_ARG2 char * + +/* Define to the type of arg 3 for recv. */ +#define RECV_TYPE_ARG3 int + +/* Define to the type of arg 4 for recv. */ +#define RECV_TYPE_ARG4 int + +/* Define to the function return type for recv. */ +#define RECV_TYPE_RETV int + +/* Define if you have the recvfrom function. */ +#define HAVE_RECVFROM 1 + +/* Define to the type of arg 1 for recvfrom. */ +#define RECVFROM_TYPE_ARG1 SOCKET + +/* Define to the type pointed by arg 2 for recvfrom. */ +#define RECVFROM_TYPE_ARG2 char + +/* Define to the type of arg 3 for recvfrom. */ +#define RECVFROM_TYPE_ARG3 int + +/* Define to the type of arg 4 for recvfrom. */ +#define RECVFROM_TYPE_ARG4 int + +/* Define to the type pointed by arg 5 for recvfrom. */ +#define RECVFROM_TYPE_ARG5 struct sockaddr + +/* Define to the type pointed by arg 6 for recvfrom. */ +#define RECVFROM_TYPE_ARG6 int + +/* Define to the function return type for recvfrom. */ +#define RECVFROM_TYPE_RETV int + +/* Define if you have the send function. */ +#define HAVE_SEND 1 + +/* Define to the type of arg 1 for send. */ +#define SEND_TYPE_ARG1 SOCKET + +/* Define to the type qualifier of arg 2 for send. */ +#define SEND_QUAL_ARG2 const + +/* Define to the type of arg 2 for send. */ +#define SEND_TYPE_ARG2 char * + +/* Define to the type of arg 3 for send. */ +#define SEND_TYPE_ARG3 int + +/* Define to the type of arg 4 for send. */ +#define SEND_TYPE_ARG4 int + +/* Define to the function return type for send. */ +#define SEND_TYPE_RETV int + +/* ---------------------------------------------------------------- */ +/* TYPEDEF REPLACEMENTS */ +/* ---------------------------------------------------------------- */ + +/* Define this if in_addr_t is not an available 'typedefed' type */ +#define in_addr_t unsigned long + +/* Define as the return type of signal handlers (int or void). */ +#define RETSIGTYPE void + +/* Define ssize_t if it is not an available 'typedefed' type */ +#ifndef _SSIZE_T_DEFINED +# if (defined(__WATCOMC__) && (__WATCOMC__ >= 1240)) || \ + defined(__POCC__) || \ + defined(__MINGW32__) +# elif defined(_WIN64) +# define _SSIZE_T_DEFINED +# define ssize_t __int64 +# else +# define _SSIZE_T_DEFINED +# define ssize_t int +# endif +#endif + +/* ---------------------------------------------------------------- */ +/* TYPE SIZES */ +/* ---------------------------------------------------------------- */ + +/* The size of `int', as computed by sizeof. */ +#define SIZEOF_INT 4 + +/* The size of `long double', as computed by sizeof. */ +#define SIZEOF_LONG_DOUBLE 16 + +/* The size of `long long', as computed by sizeof. */ +/* #define SIZEOF_LONG_LONG 8 */ + +/* The size of `short', as computed by sizeof. */ +#define SIZEOF_SHORT 2 + +/* ---------------------------------------------------------------- */ +/* STRUCT RELATED */ +/* ---------------------------------------------------------------- */ + +/* Define this if you have struct sockaddr_storage */ +#ifndef __SALFORDC__ +#define HAVE_STRUCT_SOCKADDR_STORAGE 1 +#endif + +/* Define this if you have struct timeval */ +#define HAVE_STRUCT_TIMEVAL 1 + +/* Define this if struct sockaddr_in6 has the sin6_scope_id member */ +#define HAVE_SOCKADDR_IN6_SIN6_SCOPE_ID 1 + +/* ---------------------------------------------------------------- */ +/* Watt-32 tcp/ip SPECIFIC */ +/* ---------------------------------------------------------------- */ + +#ifdef USE_WATT32 + #include + #undef byte + #undef word + #undef USE_WINSOCK + #undef HAVE_WINSOCK_H + #undef HAVE_WINSOCK2_H + #undef HAVE_WS2TCPIP_H + #define HAVE_GETADDRINFO + #define HAVE_GETNAMEINFO + #define HAVE_SYS_IOCTL_H + #define HAVE_SYS_SOCKET_H + #define HAVE_NETINET_IN_H + #define HAVE_NETDB_H + #define HAVE_ARPA_INET_H + #define HAVE_FREEADDRINFO + #define SOCKET int +#endif + + +/* ---------------------------------------------------------------- */ +/* COMPILER SPECIFIC */ +/* ---------------------------------------------------------------- */ + +/* Undef keyword 'const' if it does not work. */ +/* #undef const */ + +/* Windows should not have HAVE_GMTIME_R defined */ +/* #undef HAVE_GMTIME_R */ + +/* Define if the compiler supports C99 variadic macro style. */ +#if defined(_MSC_VER) && (_MSC_VER >= 1400) +#define HAVE_VARIADIC_MACROS_C99 1 +#endif + +/* Define if the compiler supports the 'long long' data type. */ +#if defined(__MINGW32__) || defined(__WATCOMC__) +#define HAVE_LONGLONG 1 +#endif + +/* Define to avoid VS2005 complaining about portable C functions */ +#if defined(_MSC_VER) && (_MSC_VER >= 1400) +#define _CRT_SECURE_NO_DEPRECATE 1 +#define _CRT_NONSTDC_NO_DEPRECATE 1 +#endif + +/* VS2005 and later dafault size for time_t is 64-bit, unless */ +/* _USE_32BIT_TIME_T has been defined to get a 32-bit time_t. */ +#if defined(_MSC_VER) && (_MSC_VER >= 1400) +# ifndef _USE_32BIT_TIME_T +# define SIZEOF_TIME_T 8 +# else +# define SIZEOF_TIME_T 4 +# endif +#endif + +/* Officially, Microsoft's Windows SDK versions 6.X do not support Windows + 2000 as a supported build target. VS2008 default installations provide an + embedded Windows SDK v6.0A along with the claim that Windows 2000 is a + valid build target for VS2008. Popular belief is that binaries built using + Windows SDK versions 6.X and Windows 2000 as a build target are functional */ +#if defined(_MSC_VER) && (_MSC_VER >= 1500) +# define VS2008_MINIMUM_TARGET 0x0500 +#endif + +/* When no build target is specified VS2008 default build target is Windows + Vista, which leaves out even Winsows XP. If no build target has been given + for VS2008 we will target the minimum Officially supported build target, + which happens to be Windows XP. */ +#if defined(_MSC_VER) && (_MSC_VER >= 1500) +# define VS2008_DEFAULT_TARGET 0x0501 +#endif + +/* VS2008 default target settings and minimum build target check */ +#if defined(_MSC_VER) && (_MSC_VER >= 1500) +# ifndef _WIN32_WINNT +# define _WIN32_WINNT VS2008_DEFAULT_TARGET +# endif +# ifndef WINVER +# define WINVER VS2008_DEFAULT_TARGET +# endif +# if (_WIN32_WINNT < VS2008_MINIMUM_TARGET) || (WINVER < VS2008_MINIMUM_TARGET) +# error VS2008 does not support Windows build targets prior to Windows 2000 +# endif +#endif + +/* When no build target is specified Pelles C 5.00 and later default build + target is Windows Vista. We override default target to be Windows 2000. */ +#if defined(__POCC__) && (__POCC__ >= 500) +# ifndef _WIN32_WINNT +# define _WIN32_WINNT 0x0500 +# endif +# ifndef WINVER +# define WINVER 0x0500 +# endif +#endif + +/* Availability of freeaddrinfo, getaddrinfo and getnameinfo functions is + quite convoluted, compiler dependent and even build target dependent. */ +#if defined(HAVE_WS2TCPIP_H) +# if defined(__POCC__) +# define HAVE_FREEADDRINFO 1 +# define HAVE_GETADDRINFO 1 +# define HAVE_GETADDRINFO_THREADSAFE 1 +# define HAVE_GETNAMEINFO 1 +# elif defined(_WIN32_WINNT) && (_WIN32_WINNT >= 0x0501) +# define HAVE_FREEADDRINFO 1 +# define HAVE_GETADDRINFO 1 +# define HAVE_GETADDRINFO_THREADSAFE 1 +# define HAVE_GETNAMEINFO 1 +# elif defined(_MSC_VER) && (_MSC_VER >= 1200) +# define HAVE_FREEADDRINFO 1 +# define HAVE_GETADDRINFO 1 +# define HAVE_GETADDRINFO_THREADSAFE 1 +# define HAVE_GETNAMEINFO 1 +# endif +#endif + +#if defined(__POCC__) +# ifndef _MSC_VER +# error Microsoft extensions /Ze compiler option is required +# endif +# ifndef __POCC__OLDNAMES +# error Compatibility names /Go compiler option is required +# endif +#endif + +/* ---------------------------------------------------------------- */ +/* LARGE FILE SUPPORT */ +/* ---------------------------------------------------------------- */ + +#if defined(_MSC_VER) && !defined(_WIN32_WCE) +# if (_MSC_VER >= 900) && (_INTEGRAL_MAX_BITS >= 64) +# define USE_WIN32_LARGE_FILES +# else +# define USE_WIN32_SMALL_FILES +# endif +#endif + +#if defined(__MINGW32__) && !defined(USE_WIN32_LARGE_FILES) +# define USE_WIN32_LARGE_FILES +#endif + +#if defined(__WATCOMC__) && !defined(USE_WIN32_LARGE_FILES) +# define USE_WIN32_LARGE_FILES +#endif + +#if defined(__POCC__) +# undef USE_WIN32_LARGE_FILES +#endif + +#if !defined(USE_WIN32_LARGE_FILES) && !defined(USE_WIN32_SMALL_FILES) +# define USE_WIN32_SMALL_FILES +#endif + +/* ---------------------------------------------------------------- */ +/* ADDITIONAL DEFINITIONS */ +/* ---------------------------------------------------------------- */ + +/* Define cpu-machine-OS */ +#ifndef OS +#define OS "i386-pc-win32" +#endif + +/* Define to 1 if you want the built-in manual */ +#define USE_MANUAL 1 + +#if defined(__POCC__) +# define ENABLE_IPV6 1 +#endif + +#endif /* __SRC_CONFIG_WIN32_H */ diff --git a/mobicore/common/curl/src/curl.rc b/mobicore/common/curl/src/curl.rc new file mode 100644 index 0000000000000000000000000000000000000000..58e439d3b891cb5618940d83ca1534c2a6a23fcf --- /dev/null +++ b/mobicore/common/curl/src/curl.rc @@ -0,0 +1,63 @@ +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) 1998 - 2009, Daniel Stenberg, , et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at http://curl.haxx.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ***************************************************************************/ +#include +#include "version.h" + +LANGUAGE 0x09,0x01 + +#define RC_VERSION CURL_VERSION_MAJOR, CURL_VERSION_MINOR, CURL_VERSION_PATCH, 0 + +VS_VERSION_INFO VERSIONINFO + FILEVERSION RC_VERSION + PRODUCTVERSION RC_VERSION + FILEFLAGSMASK 0x3fL +#if defined(DEBUGBUILD) || defined(_DEBUG) + FILEFLAGS 1 +#else + FILEFLAGS 0 +#endif + FILEOS VOS__WINDOWS32 + FILETYPE VFT_APP + FILESUBTYPE 0x0L + +BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "040904b0" + BEGIN + VALUE "CompanyName", "cURL, http://curl.haxx.se/\0" + VALUE "FileDescription", "The cURL executable\0" + VALUE "FileVersion", CURL_VERSION "\0" + VALUE "InternalName", "curl\0" + VALUE "OriginalFilename", "curl.exe\0" + VALUE "ProductName", "The cURL executable\0" + VALUE "ProductVersion", CURL_VERSION "\0" + VALUE "LegalCopyright", " " CURL_COPYRIGHT "\0" + VALUE "License", "http://curl.haxx.se/docs/copyright.html\0" + END + END + + BLOCK "VarFileInfo" + BEGIN + VALUE "Translation", 0x409, 1200 + END +END diff --git a/mobicore/common/curl/src/curl_config.h b/mobicore/common/curl/src/curl_config.h new file mode 100644 index 0000000000000000000000000000000000000000..00f7c86d55ba334002002bcab78a0c4b96d7e80e --- /dev/null +++ b/mobicore/common/curl/src/curl_config.h @@ -0,0 +1,1022 @@ +/* src/curl_config.h. Generated from curl_config.h.in by configure. */ +/* lib/curl_config.h.in. Generated from configure.ac by autoheader. */ + +/* when building libcurl itself */ +/* #undef BUILDING_LIBCURL */ + +/* Location of default ca bundle */ +/* #undef CURL_CA_BUNDLE */ + +/* Location of default ca path */ +#define CURL_CA_PATH "/etc/ssl/certs/" + +/* to disable cookies support */ +#define CURL_DISABLE_COOKIES 1 + +/* to disable cryptographic authentication */ +/* #undef CURL_DISABLE_CRYPTO_AUTH */ + +/* to disable DICT */ +#define CURL_DISABLE_DICT 1 + +/* to disable FILE */ +#define CURL_DISABLE_FILE 1 + +/* to disable FTP */ +#define CURL_DISABLE_FTP 1 + +/* to disable Gopher */ +#define CURL_DISABLE_GOPHER 1 + +/* to disable HTTP */ +/* #undef CURL_DISABLE_HTTP */ + +/* to disable IMAP */ +#define CURL_DISABLE_IMAP 1 + +/* to disable LDAP */ +#define CURL_DISABLE_LDAP 1 + +/* to disable LDAPS */ +#define CURL_DISABLE_LDAPS 1 + +/* to disable POP3 */ +#define CURL_DISABLE_POP3 1 + +/* to disable proxies */ +/* #undef CURL_DISABLE_PROXY */ + +/* to disable RTSP */ +#define CURL_DISABLE_RTSP 1 + +/* to disable SMTP */ +#define CURL_DISABLE_SMTP 1 + +/* to disable TELNET */ +#define CURL_DISABLE_TELNET 1 + +/* to disable TFTP */ +#define CURL_DISABLE_TFTP 1 + +/* to disable verbose strings */ +/* #undef CURL_DISABLE_VERBOSE_STRINGS */ + +/* to make a symbol visible */ +/* #undef CURL_EXTERN_SYMBOL */ + +/* to enable hidden symbols */ +/* #undef CURL_HIDDEN_SYMBOLS */ + +/* Use Windows LDAP implementation */ +/* #undef CURL_LDAP_WIN */ + +/* when not building a shared library */ +/* #undef CURL_STATICLIB */ + +/* your Entropy Gathering Daemon socket pathname */ +/* #undef EGD_SOCKET */ + +/* Define if you want to enable IPv6 support */ +#define ENABLE_IPV6 1 + +/* Define to the type qualifier of arg 1 for getnameinfo. */ +#define GETNAMEINFO_QUAL_ARG1 const + +/* Define to the type of arg 1 for getnameinfo. */ +#define GETNAMEINFO_TYPE_ARG1 struct sockaddr * + +/* Define to the type of arg 2 for getnameinfo. */ +#define GETNAMEINFO_TYPE_ARG2 socklen_t + +/* Define to the type of args 4 and 6 for getnameinfo. */ +#define GETNAMEINFO_TYPE_ARG46 size_t + +/* Define to the type of arg 7 for getnameinfo. */ +#define GETNAMEINFO_TYPE_ARG7 int + +/* Specifies the number of arguments to getservbyport_r */ +/* #undef GETSERVBYPORT_R_ARGS */ + +/* Specifies the size of the buffer to pass to getservbyport_r */ +/* #undef GETSERVBYPORT_R_BUFSIZE */ + +/* Define to 1 if you have the alarm function. */ +#define HAVE_ALARM 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_ALLOCA_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_ARPA_INET_H 1 + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_ARPA_TFTP_H */ + +/* Define to 1 if you have the header file. */ +#define HAVE_ASSERT_H 1 + +/* Define to 1 if you have the basename function. */ +#define HAVE_BASENAME 1 + +/* Define to 1 if bool is an available type. */ +#define HAVE_BOOL_T 1 + +/* Define to 1 if you have the clock_gettime function and monotonic timer. */ +#define HAVE_CLOCK_GETTIME_MONOTONIC 1 + +/* Define to 1 if you have the closesocket function. */ +/* #undef HAVE_CLOSESOCKET */ + +/* Define to 1 if you have the CloseSocket camel case function. */ +/* #undef HAVE_CLOSESOCKET_CAMEL */ + +/* Define to 1 if you have the connect function. */ +#define HAVE_CONNECT 1 + +/* Define to 1 if you have the `CRYPTO_cleanup_all_ex_data' function. */ +#define HAVE_CRYPTO_CLEANUP_ALL_EX_DATA 1 + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_CRYPTO_H */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_DES_H */ + +/* Define to 1 if you have the header file. */ +#define HAVE_DLFCN_H 1 + +/* Define to 1 if you have the `ENGINE_cleanup' function. */ +/* #undef HAVE_ENGINE_CLEANUP */ + +/* Define to 1 if you have the `ENGINE_load_builtin_engines' function. */ +/* #undef HAVE_ENGINE_LOAD_BUILTIN_ENGINES */ + +/* Define to 1 if you have the header file. */ +#define HAVE_ERRNO_H 1 + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_ERR_H */ + +/* Define to 1 if you have the fcntl function. */ +#define HAVE_FCNTL 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_FCNTL_H 1 + +/* Define to 1 if you have a working fcntl O_NONBLOCK function. */ +#define HAVE_FCNTL_O_NONBLOCK 1 + +/* Define to 1 if you have the fdopen function. */ +#define HAVE_FDOPEN 1 + +/* Define to 1 if you have the `fork' function. */ +#define HAVE_FORK 1 + +/* Define to 1 if you have the freeaddrinfo function. */ +#define HAVE_FREEADDRINFO 1 + +/* Define to 1 if you have the freeifaddrs function. */ +/* #undef HAVE_FREEIFADDRS */ + +/* Define to 1 if you have the fsetxattr function. */ +/* #undef HAVE_FSETXATTR */ + +/* fsetxattr() takes 5 args */ +/* #undef HAVE_FSETXATTR_5 */ + +/* fsetxattr() takes 6 args */ +/* #undef HAVE_FSETXATTR_6 */ + +/* Define to 1 if you have the ftruncate function. */ +#define HAVE_FTRUNCATE 1 + +/* Define to 1 if you have a working getaddrinfo function. */ +#define HAVE_GETADDRINFO 1 + +/* Define to 1 if the getaddrinfo function is threadsafe. */ +#define HAVE_GETADDRINFO_THREADSAFE 1 + +/* Define to 1 if you have the `geteuid' function. */ +#define HAVE_GETEUID 1 + +/* Define to 1 if you have the gethostbyaddr function. */ +#define HAVE_GETHOSTBYADDR 1 + +/* Define to 1 if you have the gethostbyaddr_r function. */ +/* #undef HAVE_GETHOSTBYADDR_R */ + +/* gethostbyaddr_r() takes 5 args */ +/* #undef HAVE_GETHOSTBYADDR_R_5 */ + +/* gethostbyaddr_r() takes 7 args */ +/* #undef HAVE_GETHOSTBYADDR_R_7 */ + +/* gethostbyaddr_r() takes 8 args */ +/* #undef HAVE_GETHOSTBYADDR_R_8 */ + +/* Define to 1 if you have the gethostbyname function. */ +#define HAVE_GETHOSTBYNAME 1 + +/* Define to 1 if you have the gethostbyname_r function. */ +#define HAVE_GETHOSTBYNAME_R 1 + +/* gethostbyname_r() takes 3 args */ +/* #undef HAVE_GETHOSTBYNAME_R_3 */ + +/* gethostbyname_r() takes 5 args */ +/* #undef HAVE_GETHOSTBYNAME_R_5 */ + +/* gethostbyname_r() takes 6 args */ +#define HAVE_GETHOSTBYNAME_R_6 1 + +/* Define to 1 if you have the gethostname function. */ +#define HAVE_GETHOSTNAME 1 + +/* Define to 1 if you have a working getifaddrs function. */ +/* #undef HAVE_GETIFADDRS */ + +/* Define to 1 if you have the getnameinfo function. */ +#define HAVE_GETNAMEINFO 1 + +/* Define to 1 if you have the `getpass_r' function. */ +/* #undef HAVE_GETPASS_R */ + +/* Define to 1 if you have the `getppid' function. */ +#define HAVE_GETPPID 1 + +/* Define to 1 if you have the `getprotobyname' function. */ +#define HAVE_GETPROTOBYNAME 1 + +/* Define to 1 if you have the `getpwuid' function. */ +#define HAVE_GETPWUID 1 + +/* Define to 1 if you have the `getrlimit' function. */ +#define HAVE_GETRLIMIT 1 + +/* Define to 1 if you have the getservbyport_r function. */ +/* #undef HAVE_GETSERVBYPORT_R */ + +/* Define to 1 if you have the `gettimeofday' function. */ +#define HAVE_GETTIMEOFDAY 1 + +/* Define to 1 if you have a working glibc-style strerror_r function. */ +/* #undef HAVE_GLIBC_STRERROR_R */ + +/* Define to 1 if you have a working gmtime_r function. */ +#define HAVE_GMTIME_R 1 + +/* if you have the gssapi libraries */ +/* #undef HAVE_GSSAPI */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_GSSAPI_GSSAPI_GENERIC_H */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_GSSAPI_GSSAPI_H */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_GSSAPI_GSSAPI_KRB5_H */ + +/* if you have the GNU gssapi libraries */ +/* #undef HAVE_GSSGNU */ + +/* if you have the Heimdal gssapi libraries */ +/* #undef HAVE_GSSHEIMDAL */ + +/* if you have the MIT gssapi libraries */ +/* #undef HAVE_GSSMIT */ + +/* Define to 1 if you have the `idna_strerror' function. */ +/* #undef HAVE_IDNA_STRERROR */ + +/* Define to 1 if you have the `idn_free' function. */ +/* #undef HAVE_IDN_FREE */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_IDN_FREE_H */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_IFADDRS_H */ + +/* Define to 1 if you have the `inet_addr' function. */ +#define HAVE_INET_ADDR 1 + +/* Define to 1 if you have the inet_ntoa_r function. */ +/* #undef HAVE_INET_NTOA_R */ + +/* inet_ntoa_r() takes 2 args */ +/* #undef HAVE_INET_NTOA_R_2 */ + +/* inet_ntoa_r() takes 3 args */ +/* #undef HAVE_INET_NTOA_R_3 */ + +/* Define to 1 if you have a IPv6 capable working inet_ntop function. */ +#define HAVE_INET_NTOP 1 + +/* Define to 1 if you have a IPv6 capable working inet_pton function. */ +#define HAVE_INET_PTON 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_INTTYPES_H 1 + +/* Define to 1 if you have the ioctl function. */ +#define HAVE_IOCTL 1 + +/* Define to 1 if you have the ioctlsocket function. */ +/* #undef HAVE_IOCTLSOCKET */ + +/* Define to 1 if you have the IoctlSocket camel case function. */ +/* #undef HAVE_IOCTLSOCKET_CAMEL */ + +/* Define to 1 if you have a working IoctlSocket camel case FIONBIO function. + */ +/* #undef HAVE_IOCTLSOCKET_CAMEL_FIONBIO */ + +/* Define to 1 if you have a working ioctlsocket FIONBIO function. */ +/* #undef HAVE_IOCTLSOCKET_FIONBIO */ + +/* Define to 1 if you have a working ioctl FIONBIO function. */ +#define HAVE_IOCTL_FIONBIO 1 + +/* Define to 1 if you have a working ioctl SIOCGIFADDR function. */ +#define HAVE_IOCTL_SIOCGIFADDR 1 + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_IO_H */ + +/* if you have the Kerberos4 libraries (including -ldes) */ +/* #undef HAVE_KRB4 */ + +/* Define to 1 if you have the `krb_get_our_ip_for_realm' function. */ +/* #undef HAVE_KRB_GET_OUR_IP_FOR_REALM */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_KRB_H */ + +/* Define to 1 if you have the lber.h header file. */ +/* #undef HAVE_LBER_H */ + +/* Define to 1 if you have the ldapssl.h header file. */ +/* #undef HAVE_LDAPSSL_H */ + +/* Define to 1 if you have the ldap.h header file. */ +/* #undef HAVE_LDAP_H */ + +/* Define to 1 if you have the `ldap_init_fd' function. */ +/* #undef HAVE_LDAP_INIT_FD */ + +/* Use LDAPS implementation */ +/* #undef HAVE_LDAP_SSL */ + +/* Define to 1 if you have the ldap_ssl.h header file. */ +/* #undef HAVE_LDAP_SSL_H */ + +/* Define to 1 if you have the `ldap_url_parse' function. */ +/* #undef HAVE_LDAP_URL_PARSE */ + +/* Define to 1 if you have the `gcrypt' library (-lgcrypt). */ +/* #undef HAVE_LIBGCRYPT */ + +/* Define to 1 if you have the header file. */ +#define HAVE_LIBGEN_H 1 + +/* Define to 1 if you have the `idn' library (-lidn). */ +/* #undef HAVE_LIBIDN */ + +/* Define to 1 if you have the `resolv' library (-lresolv). */ +/* #undef HAVE_LIBRESOLV */ + +/* Define to 1 if you have the `resolve' library (-lresolve). */ +/* #undef HAVE_LIBRESOLVE */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_LIBRTMP_RTMP_H */ + +/* Define to 1 if you have the `ssh2' library (-lssh2). */ +/* #undef HAVE_LIBSSH2 */ + +/* Define to 1 if you have the `libssh2_exit' function. */ +/* #undef HAVE_LIBSSH2_EXIT */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_LIBSSH2_H */ + +/* Define to 1 if you have the `libssh2_init' function. */ +/* #undef HAVE_LIBSSH2_INIT */ + +/* Define to 1 if you have the `libssh2_scp_send64' function. */ +/* #undef HAVE_LIBSSH2_SCP_SEND64 */ + +/* Define to 1 if you have the `libssh2_session_handshake' function. */ +/* #undef HAVE_LIBSSH2_SESSION_HANDSHAKE */ + +/* Define to 1 if you have the `libssh2_version' function. */ +/* #undef HAVE_LIBSSH2_VERSION */ + +/* Define to 1 if you have the `ssl' library (-lssl). */ +#define HAVE_LIBSSL 1 + +/* if zlib is available */ +#define HAVE_LIBZ 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_LIMITS_H 1 + +/* if your compiler supports LL */ +#define HAVE_LL 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_LOCALE_H 1 + +/* Define to 1 if you have a working localtime_r function. */ +#define HAVE_LOCALTIME_R 1 + +/* Define to 1 if the compiler supports the 'long long' data type. */ +#define HAVE_LONGLONG 1 + +/* Define to 1 if you have the malloc.h header file. */ +#define HAVE_MALLOC_H 1 + +/* Define to 1 if you have the memory.h header file. */ +#define HAVE_MEMORY_H 1 + +/* Define to 1 if you have the memrchr function or macro. */ +#define HAVE_MEMRCHR 1 + +/* Define to 1 if you have the MSG_NOSIGNAL flag. */ +#define HAVE_MSG_NOSIGNAL 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_NETDB_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_NETINET_IN_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_NETINET_TCP_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_NET_IF_H 1 + +/* Define to 1 if NI_WITHSCOPEID exists and works. */ +/* #undef HAVE_NI_WITHSCOPEID */ + +/* if you have an old MIT gssapi library, lacking GSS_C_NT_HOSTBASED_SERVICE + */ +/* #undef HAVE_OLD_GSSMIT */ + +/* Define to 1 if you have the header file. */ +#define HAVE_OPENSSL_CRYPTO_H 1 + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_OPENSSL_ENGINE_H */ + +/* Define to 1 if you have the header file. */ +#define HAVE_OPENSSL_ERR_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_OPENSSL_PEM_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_OPENSSL_PKCS12_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_OPENSSL_RSA_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_OPENSSL_SSL_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_OPENSSL_X509_H 1 + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_PEM_H */ + +/* Define to 1 if you have the `perror' function. */ +#define HAVE_PERROR 1 + +/* Define to 1 if you have the `pipe' function. */ +#define HAVE_PIPE 1 + +/* if you have the function PK11_CreateGenericObject */ +/* #undef HAVE_PK11_CREATEGENERICOBJECT */ + +/* Define to 1 if you have a working poll function. */ +#define HAVE_POLL 1 + +/* If you have a fine poll */ +#define HAVE_POLL_FINE 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_POLL_H 1 + +/* Define to 1 if you have a working POSIX-style strerror_r function. */ +#define HAVE_POSIX_STRERROR_R 1 + +/* if you have */ +/* #undef HAVE_PTHREAD_H */ + +/* Define to 1 if you have the header file. */ +#define HAVE_PWD_H 1 + +/* Define to 1 if you have the `RAND_egd' function. */ +#define HAVE_RAND_EGD 1 + +/* Define to 1 if you have the `RAND_screen' function. */ +/* #undef HAVE_RAND_SCREEN */ + +/* Define to 1 if you have the `RAND_status' function. */ +#define HAVE_RAND_STATUS 1 + +/* Define to 1 if you have the recv function. */ +#define HAVE_RECV 1 + +/* Define to 1 if you have the recvfrom function. */ +#define HAVE_RECVFROM 1 + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_RSA_H */ + +/* Define to 1 if you have the select function. */ +#define HAVE_SELECT 1 + +/* Define to 1 if you have the send function. */ +#define HAVE_SEND 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SETJMP_H 1 + +/* Define to 1 if you have the `setlocale' function. */ +#define HAVE_SETLOCALE 1 + +/* Define to 1 if you have the `setmode' function. */ +/* #undef HAVE_SETMODE */ + +/* Define to 1 if you have the `setrlimit' function. */ +#define HAVE_SETRLIMIT 1 + +/* Define to 1 if you have the setsockopt function. */ +#define HAVE_SETSOCKOPT 1 + +/* Define to 1 if you have a working setsockopt SO_NONBLOCK function. */ +/* #undef HAVE_SETSOCKOPT_SO_NONBLOCK */ + +/* Define to 1 if you have the header file. */ +#define HAVE_SGTTY_H 1 + +/* Define to 1 if you have the sigaction function. */ +#define HAVE_SIGACTION 1 + +/* Define to 1 if you have the siginterrupt function. */ +#define HAVE_SIGINTERRUPT 1 + +/* Define to 1 if you have the signal function. */ +/* #undef HAVE_SIGNAL */ + +/* Define to 1 if you have the header file. */ +#define HAVE_SIGNAL_H 1 + +/* Define to 1 if you have the sigsetjmp function or macro. */ +#define HAVE_SIGSETJMP 1 + +/* Define to 1 if sig_atomic_t is an available typedef. */ +#define HAVE_SIG_ATOMIC_T 1 + +/* Define to 1 if sig_atomic_t is already defined as volatile. */ +/* #undef HAVE_SIG_ATOMIC_T_VOLATILE */ + +/* Define to 1 if struct sockaddr_in6 has the sin6_scope_id member */ +#define HAVE_SOCKADDR_IN6_SIN6_SCOPE_ID 1 + +/* Define to 1 if you have the socket function. */ +#define HAVE_SOCKET 1 + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_SOCKET_H */ + +/* Define this if you have the SPNEGO library fbopenssl */ +/* #undef HAVE_SPNEGO */ + +/* Define to 1 if you have the `SSL_get_shutdown' function. */ +#define HAVE_SSL_GET_SHUTDOWN 1 + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_SSL_H */ + +/* Define to 1 if you have the header file. */ +#define HAVE_STDBOOL_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STDINT_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STDIO_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STDLIB_H 1 + +/* Define to 1 if you have the strcasecmp function. */ +#define HAVE_STRCASECMP 1 + +/* Define to 1 if you have the strcasestr function. */ +#define HAVE_STRCASESTR 1 + +/* Define to 1 if you have the strcmpi function. */ +/* #undef HAVE_STRCMPI */ + +/* Define to 1 if you have the strdup function. */ +#define HAVE_STRDUP 1 + +/* Define to 1 if you have the strerror_r function. */ +#define HAVE_STRERROR_R 1 + +/* Define to 1 if you have the stricmp function. */ +/* #undef HAVE_STRICMP */ + +/* Define to 1 if you have the header file. */ +#define HAVE_STRINGS_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STRING_H 1 + +/* Define to 1 if you have the strlcat function. */ +#define HAVE_STRLCAT 1 + +/* Define to 1 if you have the `strlcpy' function. */ +/* #undef HAVE_STRLCPY */ + +/* Define to 1 if you have the strncasecmp function. */ +#define HAVE_STRNCASECMP 1 + +/* Define to 1 if you have the strncmpi function. */ +/* #undef HAVE_STRNCMPI */ + +/* Define to 1 if you have the strnicmp function. */ +/* #undef HAVE_STRNICMP */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_STROPTS_H */ + +/* Define to 1 if you have the strstr function. */ +#define HAVE_STRSTR 1 + +/* Define to 1 if you have the strtok_r function. */ +#define HAVE_STRTOK_R 1 + +/* Define to 1 if you have the strtoll function. */ +#define HAVE_STRTOLL 1 + +/* if struct sockaddr_storage is defined */ +#define HAVE_STRUCT_SOCKADDR_STORAGE 1 + +/* Define to 1 if you have the timeval struct. */ +#define HAVE_STRUCT_TIMEVAL 1 + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_SYS_FILIO_H */ + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_IOCTL_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_PARAM_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_POLL_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_RESOURCE_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_SELECT_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_SOCKET_H 1 + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_SYS_SOCKIO_H */ + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_STAT_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_TIME_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_TYPES_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_UIO_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_UN_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_UTIME_H 1 + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_SYS_XATTR_H */ + +/* Define to 1 if you have the header file. */ +#define HAVE_TERMIOS_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_TERMIO_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_TIME_H 1 + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_TLD_H */ + +/* Define to 1 if you have the `tld_strerror' function. */ +/* #undef HAVE_TLD_STRERROR */ + +/* Define to 1 if you have the `uname' function. */ +#define HAVE_UNAME 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_UNISTD_H 1 + +/* Define to 1 if you have the `utime' function. */ +#define HAVE_UTIME 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_UTIME_H 1 + +/* Define to 1 if compiler supports C99 variadic macro style. */ +#define HAVE_VARIADIC_MACROS_C99 1 + +/* Define to 1 if compiler supports old gcc variadic macro style. */ +#define HAVE_VARIADIC_MACROS_GCC 1 + +/* Define to 1 if you have the winber.h header file. */ +/* #undef HAVE_WINBER_H */ + +/* Define to 1 if you have the windows.h header file. */ +/* #undef HAVE_WINDOWS_H */ + +/* Define to 1 if you have the winldap.h header file. */ +/* #undef HAVE_WINLDAP_H */ + +/* Define to 1 if you have the winsock2.h header file. */ +/* #undef HAVE_WINSOCK2_H */ + +/* Define to 1 if you have the winsock.h header file. */ +/* #undef HAVE_WINSOCK_H */ + +/* Define this symbol if your OS supports changing the contents of argv */ +/* #undef HAVE_WRITABLE_ARGV */ + +/* Define to 1 if you have the writev function. */ +#define HAVE_WRITEV 1 + +/* Define to 1 if you have the ws2tcpip.h header file. */ +/* #undef HAVE_WS2TCPIP_H */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_X509_H */ + +/* if you have the zlib.h header file */ +#define HAVE_ZLIB_H 1 + +/* Define to the sub-directory in which libtool stores uninstalled libraries. + */ +#define LT_OBJDIR ".libs/" + +/* Define to 1 if you are building a native Windows target. */ +/* #undef NATIVE_WINDOWS */ + +/* Define to 1 if you need the lber.h header file even with ldap.h */ +/* #undef NEED_LBER_H */ + +/* Define to 1 if you need the malloc.h header file even with stdlib.h */ +/* #undef NEED_MALLOC_H */ + +/* Define to 1 if you need the memory.h header file even with stdlib.h */ +/* #undef NEED_MEMORY_H */ + +/* Define to 1 if _REENTRANT preprocessor symbol must be defined. */ +/* #undef NEED_REENTRANT */ + +/* Define to 1 if _THREAD_SAFE preprocessor symbol must be defined. */ +/* #undef NEED_THREAD_SAFE */ + +/* cpu-machine-OS */ +#define OS "arm-unknown-eabi" + +/* Name of package */ +#define PACKAGE "curl" + +/* Define to the address where bug reports for this package should be sent. */ +#define PACKAGE_BUGREPORT "a suitable curl mailing list: http://curl.haxx.se/mail/" + +/* Define to the full name of this package. */ +#define PACKAGE_NAME "curl" + +/* Define to the full name and version of this package. */ +#define PACKAGE_STRING "curl -" + +/* Define to the one symbol short name of this package. */ +#define PACKAGE_TARNAME "curl" + +/* Define to the home page for this package. */ +#define PACKAGE_URL "" + +/* Define to the version of this package. */ +#define PACKAGE_VERSION "-" + +/* a suitable file to read random data from */ +/* #undef RANDOM_FILE */ + +/* Define to the type of arg 1 for recvfrom. */ +/* #undef RECVFROM_TYPE_ARG1 */ + +/* Define to the type pointed by arg 2 for recvfrom. */ +/* #undef RECVFROM_TYPE_ARG2 */ + +/* Define to 1 if the type pointed by arg 2 for recvfrom is void. */ +/* #undef RECVFROM_TYPE_ARG2_IS_VOID */ + +/* Define to the type of arg 3 for recvfrom. */ +/* #undef RECVFROM_TYPE_ARG3 */ + +/* Define to the type of arg 4 for recvfrom. */ +/* #undef RECVFROM_TYPE_ARG4 */ + +/* Define to the type pointed by arg 5 for recvfrom. */ +/* #undef RECVFROM_TYPE_ARG5 */ + +/* Define to 1 if the type pointed by arg 5 for recvfrom is void. */ +/* #undef RECVFROM_TYPE_ARG5_IS_VOID */ + +/* Define to the type pointed by arg 6 for recvfrom. */ +/* #undef RECVFROM_TYPE_ARG6 */ + +/* Define to 1 if the type pointed by arg 6 for recvfrom is void. */ +/* #undef RECVFROM_TYPE_ARG6_IS_VOID */ + +/* Define to the function return type for recvfrom. */ +/* #undef RECVFROM_TYPE_RETV */ + +/* Define to the type of arg 1 for recv. */ +#define RECV_TYPE_ARG1 int + +/* Define to the type of arg 2 for recv. */ +#define RECV_TYPE_ARG2 void * + +/* Define to the type of arg 3 for recv. */ +#define RECV_TYPE_ARG3 size_t + +/* Define to the type of arg 4 for recv. */ +#define RECV_TYPE_ARG4 unsigned int + +/* Define to the function return type for recv. */ +#define RECV_TYPE_RETV ssize_t + +/* Define as the return type of signal handlers (`int' or `void'). */ +#define RETSIGTYPE void + +/* Define to the type qualifier of arg 5 for select. */ +#define SELECT_QUAL_ARG5 + +/* Define to the type of arg 1 for select. */ +#define SELECT_TYPE_ARG1 int + +/* Define to the type of args 2, 3 and 4 for select. */ +#define SELECT_TYPE_ARG234 fd_set * + +/* Define to the type of arg 5 for select. */ +#define SELECT_TYPE_ARG5 struct timeval * + +/* Define to the function return type for select. */ +#define SELECT_TYPE_RETV int + +/* Define to the type qualifier of arg 2 for send. */ +#define SEND_QUAL_ARG2 const + +/* Define to the type of arg 1 for send. */ +#define SEND_TYPE_ARG1 int + +/* Define to the type of arg 2 for send. */ +#define SEND_TYPE_ARG2 void * + +/* Define to the type of arg 3 for send. */ +#define SEND_TYPE_ARG3 size_t + +/* Define to the type of arg 4 for send. */ +#define SEND_TYPE_ARG4 unsigned int + +/* Define to the function return type for send. */ +#define SEND_TYPE_RETV ssize_t + +/* The size of `int', as computed by sizeof. */ +#define SIZEOF_INT 4 + +/* The size of `long', as computed by sizeof. */ +#define SIZEOF_LONG 4 + +/* The size of `off_t', as computed by sizeof. */ +#define SIZEOF_OFF_T 4 + +/* The size of `short', as computed by sizeof. */ +#define SIZEOF_SHORT 2 + +/* The size of `size_t', as computed by sizeof. */ +#define SIZEOF_SIZE_T 4 + +/* The size of `time_t', as computed by sizeof. */ +#define SIZEOF_TIME_T 4 + +/* The size of `void*', as computed by sizeof. */ +#define SIZEOF_VOIDP 4 + +/* Define to 1 if you have the ANSI C header files. */ +#define STDC_HEADERS 1 + +/* Define to the type of arg 3 for strerror_r. */ +#define STRERROR_R_TYPE_ARG3 size_t + +/* Define to 1 if you can safely include both and . */ +#define TIME_WITH_SYS_TIME 1 + +/* Define to enable c-ares support */ +/* #undef USE_ARES */ + +/* Define to disable non-blocking sockets. */ +/* #undef USE_BLOCKING_SOCKETS */ + +/* if GnuTLS is enabled */ +/* #undef USE_GNUTLS */ + +/* if librtmp is in use */ +/* #undef USE_LIBRTMP */ + +/* if libSSH2 is in use */ +/* #undef USE_LIBSSH2 */ + +/* If you want to build curl with the built-in manual */ +/* #undef USE_MANUAL */ + +/* if NSS is enabled */ +/* #undef USE_NSS */ + +/* Use OpenLDAP-specific code */ +/* #undef USE_OPENLDAP */ + +/* if OpenSSL is in use */ +#define USE_OPENSSL 1 + +/* if PolarSSL is enabled */ +/* #undef USE_POLARSSL */ + +/* if SSL is enabled */ +#define USE_SSLEAY 1 + +/* if you want POSIX threaded DNS lookup */ +/* #undef USE_THREADS_POSIX */ + +/* Define to 1 if you are building a Windows target without large file + support. */ +/* #undef USE_WIN32_LARGE_FILES */ + +/* to enable SSPI support */ +/* #undef USE_WINDOWS_SSPI */ + +/* Define to 1 if using yaSSL in OpenSSL compatibility mode. */ +/* #undef USE_YASSLEMUL */ + +/* Version number of package */ +#define VERSION "7.21.3" + +/* Define to avoid automatic inclusion of winsock.h */ +/* #undef WIN32_LEAN_AND_MEAN */ + +/* Define to 1 if OS is AIX. */ +#ifndef _ALL_SOURCE +/* # undef _ALL_SOURCE */ +#endif + +/* Number of bits in a file offset, on hosts where this is settable. */ +/* #undef _FILE_OFFSET_BITS */ + +/* Define for large files, on AIX-style hosts. */ +/* #undef _LARGE_FILES */ + +/* Define to empty if `const' does not conform to ANSI C. */ +/* #undef const */ + +/* Type to use in place of in_addr_t when system does not provide it. */ +/* #undef in_addr_t */ + +/* Define to `__inline__' or `__inline' if that's what the C compiler + calls it, or to nothing if 'inline' is not supported under any name. */ +#ifndef __cplusplus +/* #undef inline */ +#endif + +/* Define to `unsigned int' if does not define. */ +/* #undef size_t */ + +/* the signed version of size_t */ +/* #undef ssize_t */ diff --git a/mobicore/common/curl/src/curl_config.h.in b/mobicore/common/curl/src/curl_config.h.in new file mode 100644 index 0000000000000000000000000000000000000000..aaea103f2becd7b9d99629bd8c3659d3f22fb945 --- /dev/null +++ b/mobicore/common/curl/src/curl_config.h.in @@ -0,0 +1,1021 @@ +/* lib/curl_config.h.in. Generated from configure.ac by autoheader. */ + +/* when building libcurl itself */ +#undef BUILDING_LIBCURL + +/* Location of default ca bundle */ +#undef CURL_CA_BUNDLE + +/* Location of default ca path */ +#undef CURL_CA_PATH + +/* to disable cookies support */ +#undef CURL_DISABLE_COOKIES + +/* to disable cryptographic authentication */ +#undef CURL_DISABLE_CRYPTO_AUTH + +/* to disable DICT */ +#undef CURL_DISABLE_DICT + +/* to disable FILE */ +#undef CURL_DISABLE_FILE + +/* to disable FTP */ +#undef CURL_DISABLE_FTP + +/* to disable Gopher */ +#undef CURL_DISABLE_GOPHER + +/* to disable HTTP */ +#undef CURL_DISABLE_HTTP + +/* to disable IMAP */ +#undef CURL_DISABLE_IMAP + +/* to disable LDAP */ +#undef CURL_DISABLE_LDAP + +/* to disable LDAPS */ +#undef CURL_DISABLE_LDAPS + +/* to disable POP3 */ +#undef CURL_DISABLE_POP3 + +/* to disable proxies */ +#undef CURL_DISABLE_PROXY + +/* to disable RTSP */ +#undef CURL_DISABLE_RTSP + +/* to disable SMTP */ +#undef CURL_DISABLE_SMTP + +/* to disable TELNET */ +#undef CURL_DISABLE_TELNET + +/* to disable TFTP */ +#undef CURL_DISABLE_TFTP + +/* to disable verbose strings */ +#undef CURL_DISABLE_VERBOSE_STRINGS + +/* to make a symbol visible */ +#undef CURL_EXTERN_SYMBOL + +/* to enable hidden symbols */ +#undef CURL_HIDDEN_SYMBOLS + +/* Use Windows LDAP implementation */ +#undef CURL_LDAP_WIN + +/* when not building a shared library */ +#undef CURL_STATICLIB + +/* your Entropy Gathering Daemon socket pathname */ +#undef EGD_SOCKET + +/* Define if you want to enable IPv6 support */ +#undef ENABLE_IPV6 + +/* Define to the type qualifier of arg 1 for getnameinfo. */ +#undef GETNAMEINFO_QUAL_ARG1 + +/* Define to the type of arg 1 for getnameinfo. */ +#undef GETNAMEINFO_TYPE_ARG1 + +/* Define to the type of arg 2 for getnameinfo. */ +#undef GETNAMEINFO_TYPE_ARG2 + +/* Define to the type of args 4 and 6 for getnameinfo. */ +#undef GETNAMEINFO_TYPE_ARG46 + +/* Define to the type of arg 7 for getnameinfo. */ +#undef GETNAMEINFO_TYPE_ARG7 + +/* Specifies the number of arguments to getservbyport_r */ +#undef GETSERVBYPORT_R_ARGS + +/* Specifies the size of the buffer to pass to getservbyport_r */ +#undef GETSERVBYPORT_R_BUFSIZE + +/* Define to 1 if you have the alarm function. */ +#undef HAVE_ALARM + +/* Define to 1 if you have the header file. */ +#undef HAVE_ALLOCA_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_ARPA_INET_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_ARPA_TFTP_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_ASSERT_H + +/* Define to 1 if you have the basename function. */ +#undef HAVE_BASENAME + +/* Define to 1 if bool is an available type. */ +#undef HAVE_BOOL_T + +/* Define to 1 if you have the clock_gettime function and monotonic timer. */ +#undef HAVE_CLOCK_GETTIME_MONOTONIC + +/* Define to 1 if you have the closesocket function. */ +#undef HAVE_CLOSESOCKET + +/* Define to 1 if you have the CloseSocket camel case function. */ +#undef HAVE_CLOSESOCKET_CAMEL + +/* Define to 1 if you have the connect function. */ +#undef HAVE_CONNECT + +/* Define to 1 if you have the `CRYPTO_cleanup_all_ex_data' function. */ +#undef HAVE_CRYPTO_CLEANUP_ALL_EX_DATA + +/* Define to 1 if you have the header file. */ +#undef HAVE_CRYPTO_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_DES_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_DLFCN_H + +/* Define to 1 if you have the `ENGINE_cleanup' function. */ +#undef HAVE_ENGINE_CLEANUP + +/* Define to 1 if you have the `ENGINE_load_builtin_engines' function. */ +#undef HAVE_ENGINE_LOAD_BUILTIN_ENGINES + +/* Define to 1 if you have the header file. */ +#undef HAVE_ERRNO_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_ERR_H + +/* Define to 1 if you have the fcntl function. */ +#undef HAVE_FCNTL + +/* Define to 1 if you have the header file. */ +#undef HAVE_FCNTL_H + +/* Define to 1 if you have a working fcntl O_NONBLOCK function. */ +#undef HAVE_FCNTL_O_NONBLOCK + +/* Define to 1 if you have the fdopen function. */ +#undef HAVE_FDOPEN + +/* Define to 1 if you have the `fork' function. */ +#undef HAVE_FORK + +/* Define to 1 if you have the freeaddrinfo function. */ +#undef HAVE_FREEADDRINFO + +/* Define to 1 if you have the freeifaddrs function. */ +#undef HAVE_FREEIFADDRS + +/* Define to 1 if you have the fsetxattr function. */ +#undef HAVE_FSETXATTR + +/* fsetxattr() takes 5 args */ +#undef HAVE_FSETXATTR_5 + +/* fsetxattr() takes 6 args */ +#undef HAVE_FSETXATTR_6 + +/* Define to 1 if you have the ftruncate function. */ +#undef HAVE_FTRUNCATE + +/* Define to 1 if you have a working getaddrinfo function. */ +#undef HAVE_GETADDRINFO + +/* Define to 1 if the getaddrinfo function is threadsafe. */ +#undef HAVE_GETADDRINFO_THREADSAFE + +/* Define to 1 if you have the `geteuid' function. */ +#undef HAVE_GETEUID + +/* Define to 1 if you have the gethostbyaddr function. */ +#undef HAVE_GETHOSTBYADDR + +/* Define to 1 if you have the gethostbyaddr_r function. */ +#undef HAVE_GETHOSTBYADDR_R + +/* gethostbyaddr_r() takes 5 args */ +#undef HAVE_GETHOSTBYADDR_R_5 + +/* gethostbyaddr_r() takes 7 args */ +#undef HAVE_GETHOSTBYADDR_R_7 + +/* gethostbyaddr_r() takes 8 args */ +#undef HAVE_GETHOSTBYADDR_R_8 + +/* Define to 1 if you have the gethostbyname function. */ +#undef HAVE_GETHOSTBYNAME + +/* Define to 1 if you have the gethostbyname_r function. */ +#undef HAVE_GETHOSTBYNAME_R + +/* gethostbyname_r() takes 3 args */ +#undef HAVE_GETHOSTBYNAME_R_3 + +/* gethostbyname_r() takes 5 args */ +#undef HAVE_GETHOSTBYNAME_R_5 + +/* gethostbyname_r() takes 6 args */ +#undef HAVE_GETHOSTBYNAME_R_6 + +/* Define to 1 if you have the gethostname function. */ +#undef HAVE_GETHOSTNAME + +/* Define to 1 if you have a working getifaddrs function. */ +#undef HAVE_GETIFADDRS + +/* Define to 1 if you have the getnameinfo function. */ +#undef HAVE_GETNAMEINFO + +/* Define to 1 if you have the `getpass_r' function. */ +#undef HAVE_GETPASS_R + +/* Define to 1 if you have the `getppid' function. */ +#undef HAVE_GETPPID + +/* Define to 1 if you have the `getprotobyname' function. */ +#undef HAVE_GETPROTOBYNAME + +/* Define to 1 if you have the `getpwuid' function. */ +#undef HAVE_GETPWUID + +/* Define to 1 if you have the `getrlimit' function. */ +#undef HAVE_GETRLIMIT + +/* Define to 1 if you have the getservbyport_r function. */ +#undef HAVE_GETSERVBYPORT_R + +/* Define to 1 if you have the `gettimeofday' function. */ +#undef HAVE_GETTIMEOFDAY + +/* Define to 1 if you have a working glibc-style strerror_r function. */ +#undef HAVE_GLIBC_STRERROR_R + +/* Define to 1 if you have a working gmtime_r function. */ +#undef HAVE_GMTIME_R + +/* if you have the gssapi libraries */ +#undef HAVE_GSSAPI + +/* Define to 1 if you have the header file. */ +#undef HAVE_GSSAPI_GSSAPI_GENERIC_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_GSSAPI_GSSAPI_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_GSSAPI_GSSAPI_KRB5_H + +/* if you have the GNU gssapi libraries */ +#undef HAVE_GSSGNU + +/* if you have the Heimdal gssapi libraries */ +#undef HAVE_GSSHEIMDAL + +/* if you have the MIT gssapi libraries */ +#undef HAVE_GSSMIT + +/* Define to 1 if you have the `idna_strerror' function. */ +#undef HAVE_IDNA_STRERROR + +/* Define to 1 if you have the `idn_free' function. */ +#undef HAVE_IDN_FREE + +/* Define to 1 if you have the header file. */ +#undef HAVE_IDN_FREE_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_IFADDRS_H + +/* Define to 1 if you have the `inet_addr' function. */ +#undef HAVE_INET_ADDR + +/* Define to 1 if you have the inet_ntoa_r function. */ +#undef HAVE_INET_NTOA_R + +/* inet_ntoa_r() takes 2 args */ +#undef HAVE_INET_NTOA_R_2 + +/* inet_ntoa_r() takes 3 args */ +#undef HAVE_INET_NTOA_R_3 + +/* Define to 1 if you have a IPv6 capable working inet_ntop function. */ +#undef HAVE_INET_NTOP + +/* Define to 1 if you have a IPv6 capable working inet_pton function. */ +#undef HAVE_INET_PTON + +/* Define to 1 if you have the header file. */ +#undef HAVE_INTTYPES_H + +/* Define to 1 if you have the ioctl function. */ +#undef HAVE_IOCTL + +/* Define to 1 if you have the ioctlsocket function. */ +#undef HAVE_IOCTLSOCKET + +/* Define to 1 if you have the IoctlSocket camel case function. */ +#undef HAVE_IOCTLSOCKET_CAMEL + +/* Define to 1 if you have a working IoctlSocket camel case FIONBIO function. + */ +#undef HAVE_IOCTLSOCKET_CAMEL_FIONBIO + +/* Define to 1 if you have a working ioctlsocket FIONBIO function. */ +#undef HAVE_IOCTLSOCKET_FIONBIO + +/* Define to 1 if you have a working ioctl FIONBIO function. */ +#undef HAVE_IOCTL_FIONBIO + +/* Define to 1 if you have a working ioctl SIOCGIFADDR function. */ +#undef HAVE_IOCTL_SIOCGIFADDR + +/* Define to 1 if you have the header file. */ +#undef HAVE_IO_H + +/* if you have the Kerberos4 libraries (including -ldes) */ +#undef HAVE_KRB4 + +/* Define to 1 if you have the `krb_get_our_ip_for_realm' function. */ +#undef HAVE_KRB_GET_OUR_IP_FOR_REALM + +/* Define to 1 if you have the header file. */ +#undef HAVE_KRB_H + +/* Define to 1 if you have the lber.h header file. */ +#undef HAVE_LBER_H + +/* Define to 1 if you have the ldapssl.h header file. */ +#undef HAVE_LDAPSSL_H + +/* Define to 1 if you have the ldap.h header file. */ +#undef HAVE_LDAP_H + +/* Define to 1 if you have the `ldap_init_fd' function. */ +#undef HAVE_LDAP_INIT_FD + +/* Use LDAPS implementation */ +#undef HAVE_LDAP_SSL + +/* Define to 1 if you have the ldap_ssl.h header file. */ +#undef HAVE_LDAP_SSL_H + +/* Define to 1 if you have the `ldap_url_parse' function. */ +#undef HAVE_LDAP_URL_PARSE + +/* Define to 1 if you have the `gcrypt' library (-lgcrypt). */ +#undef HAVE_LIBGCRYPT + +/* Define to 1 if you have the header file. */ +#undef HAVE_LIBGEN_H + +/* Define to 1 if you have the `idn' library (-lidn). */ +#undef HAVE_LIBIDN + +/* Define to 1 if you have the `resolv' library (-lresolv). */ +#undef HAVE_LIBRESOLV + +/* Define to 1 if you have the `resolve' library (-lresolve). */ +#undef HAVE_LIBRESOLVE + +/* Define to 1 if you have the header file. */ +#undef HAVE_LIBRTMP_RTMP_H + +/* Define to 1 if you have the `ssh2' library (-lssh2). */ +#undef HAVE_LIBSSH2 + +/* Define to 1 if you have the `libssh2_exit' function. */ +#undef HAVE_LIBSSH2_EXIT + +/* Define to 1 if you have the header file. */ +#undef HAVE_LIBSSH2_H + +/* Define to 1 if you have the `libssh2_init' function. */ +#undef HAVE_LIBSSH2_INIT + +/* Define to 1 if you have the `libssh2_scp_send64' function. */ +#undef HAVE_LIBSSH2_SCP_SEND64 + +/* Define to 1 if you have the `libssh2_session_handshake' function. */ +#undef HAVE_LIBSSH2_SESSION_HANDSHAKE + +/* Define to 1 if you have the `libssh2_version' function. */ +#undef HAVE_LIBSSH2_VERSION + +/* Define to 1 if you have the `ssl' library (-lssl). */ +#undef HAVE_LIBSSL + +/* if zlib is available */ +#undef HAVE_LIBZ + +/* Define to 1 if you have the header file. */ +#undef HAVE_LIMITS_H + +/* if your compiler supports LL */ +#undef HAVE_LL + +/* Define to 1 if you have the header file. */ +#undef HAVE_LOCALE_H + +/* Define to 1 if you have a working localtime_r function. */ +#undef HAVE_LOCALTIME_R + +/* Define to 1 if the compiler supports the 'long long' data type. */ +#undef HAVE_LONGLONG + +/* Define to 1 if you have the malloc.h header file. */ +#undef HAVE_MALLOC_H + +/* Define to 1 if you have the memory.h header file. */ +#undef HAVE_MEMORY_H + +/* Define to 1 if you have the memrchr function or macro. */ +#undef HAVE_MEMRCHR + +/* Define to 1 if you have the MSG_NOSIGNAL flag. */ +#undef HAVE_MSG_NOSIGNAL + +/* Define to 1 if you have the header file. */ +#undef HAVE_NETDB_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_NETINET_IN_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_NETINET_TCP_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_NET_IF_H + +/* Define to 1 if NI_WITHSCOPEID exists and works. */ +#undef HAVE_NI_WITHSCOPEID + +/* if you have an old MIT gssapi library, lacking GSS_C_NT_HOSTBASED_SERVICE + */ +#undef HAVE_OLD_GSSMIT + +/* Define to 1 if you have the header file. */ +#undef HAVE_OPENSSL_CRYPTO_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_OPENSSL_ENGINE_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_OPENSSL_ERR_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_OPENSSL_PEM_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_OPENSSL_PKCS12_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_OPENSSL_RSA_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_OPENSSL_SSL_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_OPENSSL_X509_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_PEM_H + +/* Define to 1 if you have the `perror' function. */ +#undef HAVE_PERROR + +/* Define to 1 if you have the `pipe' function. */ +#undef HAVE_PIPE + +/* if you have the function PK11_CreateGenericObject */ +#undef HAVE_PK11_CREATEGENERICOBJECT + +/* Define to 1 if you have a working poll function. */ +#undef HAVE_POLL + +/* If you have a fine poll */ +#undef HAVE_POLL_FINE + +/* Define to 1 if you have the header file. */ +#undef HAVE_POLL_H + +/* Define to 1 if you have a working POSIX-style strerror_r function. */ +#undef HAVE_POSIX_STRERROR_R + +/* if you have */ +#undef HAVE_PTHREAD_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_PWD_H + +/* Define to 1 if you have the `RAND_egd' function. */ +#undef HAVE_RAND_EGD + +/* Define to 1 if you have the `RAND_screen' function. */ +#undef HAVE_RAND_SCREEN + +/* Define to 1 if you have the `RAND_status' function. */ +#undef HAVE_RAND_STATUS + +/* Define to 1 if you have the recv function. */ +#undef HAVE_RECV + +/* Define to 1 if you have the recvfrom function. */ +#undef HAVE_RECVFROM + +/* Define to 1 if you have the header file. */ +#undef HAVE_RSA_H + +/* Define to 1 if you have the select function. */ +#undef HAVE_SELECT + +/* Define to 1 if you have the send function. */ +#undef HAVE_SEND + +/* Define to 1 if you have the header file. */ +#undef HAVE_SETJMP_H + +/* Define to 1 if you have the `setlocale' function. */ +#undef HAVE_SETLOCALE + +/* Define to 1 if you have the `setmode' function. */ +#undef HAVE_SETMODE + +/* Define to 1 if you have the `setrlimit' function. */ +#undef HAVE_SETRLIMIT + +/* Define to 1 if you have the setsockopt function. */ +#undef HAVE_SETSOCKOPT + +/* Define to 1 if you have a working setsockopt SO_NONBLOCK function. */ +#undef HAVE_SETSOCKOPT_SO_NONBLOCK + +/* Define to 1 if you have the header file. */ +#undef HAVE_SGTTY_H + +/* Define to 1 if you have the sigaction function. */ +#undef HAVE_SIGACTION + +/* Define to 1 if you have the siginterrupt function. */ +#undef HAVE_SIGINTERRUPT + +/* Define to 1 if you have the signal function. */ +#undef HAVE_SIGNAL + +/* Define to 1 if you have the header file. */ +#undef HAVE_SIGNAL_H + +/* Define to 1 if you have the sigsetjmp function or macro. */ +#undef HAVE_SIGSETJMP + +/* Define to 1 if sig_atomic_t is an available typedef. */ +#undef HAVE_SIG_ATOMIC_T + +/* Define to 1 if sig_atomic_t is already defined as volatile. */ +#undef HAVE_SIG_ATOMIC_T_VOLATILE + +/* Define to 1 if struct sockaddr_in6 has the sin6_scope_id member */ +#undef HAVE_SOCKADDR_IN6_SIN6_SCOPE_ID + +/* Define to 1 if you have the socket function. */ +#undef HAVE_SOCKET + +/* Define to 1 if you have the header file. */ +#undef HAVE_SOCKET_H + +/* Define this if you have the SPNEGO library fbopenssl */ +#undef HAVE_SPNEGO + +/* Define to 1 if you have the `SSL_get_shutdown' function. */ +#undef HAVE_SSL_GET_SHUTDOWN + +/* Define to 1 if you have the header file. */ +#undef HAVE_SSL_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_STDBOOL_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_STDINT_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_STDIO_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_STDLIB_H + +/* Define to 1 if you have the strcasecmp function. */ +#undef HAVE_STRCASECMP + +/* Define to 1 if you have the strcasestr function. */ +#undef HAVE_STRCASESTR + +/* Define to 1 if you have the strcmpi function. */ +#undef HAVE_STRCMPI + +/* Define to 1 if you have the strdup function. */ +#undef HAVE_STRDUP + +/* Define to 1 if you have the strerror_r function. */ +#undef HAVE_STRERROR_R + +/* Define to 1 if you have the stricmp function. */ +#undef HAVE_STRICMP + +/* Define to 1 if you have the header file. */ +#undef HAVE_STRINGS_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_STRING_H + +/* Define to 1 if you have the strlcat function. */ +#undef HAVE_STRLCAT + +/* Define to 1 if you have the `strlcpy' function. */ +#undef HAVE_STRLCPY + +/* Define to 1 if you have the strncasecmp function. */ +#undef HAVE_STRNCASECMP + +/* Define to 1 if you have the strncmpi function. */ +#undef HAVE_STRNCMPI + +/* Define to 1 if you have the strnicmp function. */ +#undef HAVE_STRNICMP + +/* Define to 1 if you have the header file. */ +#undef HAVE_STROPTS_H + +/* Define to 1 if you have the strstr function. */ +#undef HAVE_STRSTR + +/* Define to 1 if you have the strtok_r function. */ +#undef HAVE_STRTOK_R + +/* Define to 1 if you have the strtoll function. */ +#undef HAVE_STRTOLL + +/* if struct sockaddr_storage is defined */ +#undef HAVE_STRUCT_SOCKADDR_STORAGE + +/* Define to 1 if you have the timeval struct. */ +#undef HAVE_STRUCT_TIMEVAL + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_FILIO_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_IOCTL_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_PARAM_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_POLL_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_RESOURCE_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_SELECT_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_SOCKET_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_SOCKIO_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_STAT_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_TIME_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_TYPES_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_UIO_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_UN_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_UTIME_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_XATTR_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_TERMIOS_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_TERMIO_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_TIME_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_TLD_H + +/* Define to 1 if you have the `tld_strerror' function. */ +#undef HAVE_TLD_STRERROR + +/* Define to 1 if you have the `uname' function. */ +#undef HAVE_UNAME + +/* Define to 1 if you have the header file. */ +#undef HAVE_UNISTD_H + +/* Define to 1 if you have the `utime' function. */ +#undef HAVE_UTIME + +/* Define to 1 if you have the header file. */ +#undef HAVE_UTIME_H + +/* Define to 1 if compiler supports C99 variadic macro style. */ +#undef HAVE_VARIADIC_MACROS_C99 + +/* Define to 1 if compiler supports old gcc variadic macro style. */ +#undef HAVE_VARIADIC_MACROS_GCC + +/* Define to 1 if you have the winber.h header file. */ +#undef HAVE_WINBER_H + +/* Define to 1 if you have the windows.h header file. */ +#undef HAVE_WINDOWS_H + +/* Define to 1 if you have the winldap.h header file. */ +#undef HAVE_WINLDAP_H + +/* Define to 1 if you have the winsock2.h header file. */ +#undef HAVE_WINSOCK2_H + +/* Define to 1 if you have the winsock.h header file. */ +#undef HAVE_WINSOCK_H + +/* Define this symbol if your OS supports changing the contents of argv */ +#undef HAVE_WRITABLE_ARGV + +/* Define to 1 if you have the writev function. */ +#undef HAVE_WRITEV + +/* Define to 1 if you have the ws2tcpip.h header file. */ +#undef HAVE_WS2TCPIP_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_X509_H + +/* if you have the zlib.h header file */ +#undef HAVE_ZLIB_H + +/* Define to the sub-directory in which libtool stores uninstalled libraries. + */ +#undef LT_OBJDIR + +/* Define to 1 if you are building a native Windows target. */ +#undef NATIVE_WINDOWS + +/* Define to 1 if you need the lber.h header file even with ldap.h */ +#undef NEED_LBER_H + +/* Define to 1 if you need the malloc.h header file even with stdlib.h */ +#undef NEED_MALLOC_H + +/* Define to 1 if you need the memory.h header file even with stdlib.h */ +#undef NEED_MEMORY_H + +/* Define to 1 if _REENTRANT preprocessor symbol must be defined. */ +#undef NEED_REENTRANT + +/* Define to 1 if _THREAD_SAFE preprocessor symbol must be defined. */ +#undef NEED_THREAD_SAFE + +/* cpu-machine-OS */ +#undef OS + +/* Name of package */ +#undef PACKAGE + +/* Define to the address where bug reports for this package should be sent. */ +#undef PACKAGE_BUGREPORT + +/* Define to the full name of this package. */ +#undef PACKAGE_NAME + +/* Define to the full name and version of this package. */ +#undef PACKAGE_STRING + +/* Define to the one symbol short name of this package. */ +#undef PACKAGE_TARNAME + +/* Define to the home page for this package. */ +#undef PACKAGE_URL + +/* Define to the version of this package. */ +#undef PACKAGE_VERSION + +/* a suitable file to read random data from */ +#undef RANDOM_FILE + +/* Define to the type of arg 1 for recvfrom. */ +#undef RECVFROM_TYPE_ARG1 + +/* Define to the type pointed by arg 2 for recvfrom. */ +#undef RECVFROM_TYPE_ARG2 + +/* Define to 1 if the type pointed by arg 2 for recvfrom is void. */ +#undef RECVFROM_TYPE_ARG2_IS_VOID + +/* Define to the type of arg 3 for recvfrom. */ +#undef RECVFROM_TYPE_ARG3 + +/* Define to the type of arg 4 for recvfrom. */ +#undef RECVFROM_TYPE_ARG4 + +/* Define to the type pointed by arg 5 for recvfrom. */ +#undef RECVFROM_TYPE_ARG5 + +/* Define to 1 if the type pointed by arg 5 for recvfrom is void. */ +#undef RECVFROM_TYPE_ARG5_IS_VOID + +/* Define to the type pointed by arg 6 for recvfrom. */ +#undef RECVFROM_TYPE_ARG6 + +/* Define to 1 if the type pointed by arg 6 for recvfrom is void. */ +#undef RECVFROM_TYPE_ARG6_IS_VOID + +/* Define to the function return type for recvfrom. */ +#undef RECVFROM_TYPE_RETV + +/* Define to the type of arg 1 for recv. */ +#undef RECV_TYPE_ARG1 + +/* Define to the type of arg 2 for recv. */ +#undef RECV_TYPE_ARG2 + +/* Define to the type of arg 3 for recv. */ +#undef RECV_TYPE_ARG3 + +/* Define to the type of arg 4 for recv. */ +#undef RECV_TYPE_ARG4 + +/* Define to the function return type for recv. */ +#undef RECV_TYPE_RETV + +/* Define as the return type of signal handlers (`int' or `void'). */ +#undef RETSIGTYPE + +/* Define to the type qualifier of arg 5 for select. */ +#undef SELECT_QUAL_ARG5 + +/* Define to the type of arg 1 for select. */ +#undef SELECT_TYPE_ARG1 + +/* Define to the type of args 2, 3 and 4 for select. */ +#undef SELECT_TYPE_ARG234 + +/* Define to the type of arg 5 for select. */ +#undef SELECT_TYPE_ARG5 + +/* Define to the function return type for select. */ +#undef SELECT_TYPE_RETV + +/* Define to the type qualifier of arg 2 for send. */ +#undef SEND_QUAL_ARG2 + +/* Define to the type of arg 1 for send. */ +#undef SEND_TYPE_ARG1 + +/* Define to the type of arg 2 for send. */ +#undef SEND_TYPE_ARG2 + +/* Define to the type of arg 3 for send. */ +#undef SEND_TYPE_ARG3 + +/* Define to the type of arg 4 for send. */ +#undef SEND_TYPE_ARG4 + +/* Define to the function return type for send. */ +#undef SEND_TYPE_RETV + +/* The size of `int', as computed by sizeof. */ +#undef SIZEOF_INT + +/* The size of `long', as computed by sizeof. */ +#undef SIZEOF_LONG + +/* The size of `off_t', as computed by sizeof. */ +#undef SIZEOF_OFF_T + +/* The size of `short', as computed by sizeof. */ +#undef SIZEOF_SHORT + +/* The size of `size_t', as computed by sizeof. */ +#undef SIZEOF_SIZE_T + +/* The size of `time_t', as computed by sizeof. */ +#undef SIZEOF_TIME_T + +/* The size of `void*', as computed by sizeof. */ +#undef SIZEOF_VOIDP + +/* Define to 1 if you have the ANSI C header files. */ +#undef STDC_HEADERS + +/* Define to the type of arg 3 for strerror_r. */ +#undef STRERROR_R_TYPE_ARG3 + +/* Define to 1 if you can safely include both and . */ +#undef TIME_WITH_SYS_TIME + +/* Define to enable c-ares support */ +#undef USE_ARES + +/* Define to disable non-blocking sockets. */ +#undef USE_BLOCKING_SOCKETS + +/* if GnuTLS is enabled */ +#undef USE_GNUTLS + +/* if librtmp is in use */ +#undef USE_LIBRTMP + +/* if libSSH2 is in use */ +#undef USE_LIBSSH2 + +/* If you want to build curl with the built-in manual */ +#undef USE_MANUAL + +/* if NSS is enabled */ +#undef USE_NSS + +/* Use OpenLDAP-specific code */ +#undef USE_OPENLDAP + +/* if OpenSSL is in use */ +#undef USE_OPENSSL + +/* if PolarSSL is enabled */ +#undef USE_POLARSSL + +/* if SSL is enabled */ +#undef USE_SSLEAY + +/* if you want POSIX threaded DNS lookup */ +#undef USE_THREADS_POSIX + +/* Define to 1 if you are building a Windows target without large file + support. */ +#undef USE_WIN32_LARGE_FILES + +/* to enable SSPI support */ +#undef USE_WINDOWS_SSPI + +/* Define to 1 if using yaSSL in OpenSSL compatibility mode. */ +#undef USE_YASSLEMUL + +/* Version number of package */ +#undef VERSION + +/* Define to avoid automatic inclusion of winsock.h */ +#undef WIN32_LEAN_AND_MEAN + +/* Define to 1 if OS is AIX. */ +#ifndef _ALL_SOURCE +# undef _ALL_SOURCE +#endif + +/* Number of bits in a file offset, on hosts where this is settable. */ +#undef _FILE_OFFSET_BITS + +/* Define for large files, on AIX-style hosts. */ +#undef _LARGE_FILES + +/* Define to empty if `const' does not conform to ANSI C. */ +#undef const + +/* Type to use in place of in_addr_t when system does not provide it. */ +#undef in_addr_t + +/* Define to `__inline__' or `__inline' if that's what the C compiler + calls it, or to nothing if 'inline' is not supported under any name. */ +#ifndef __cplusplus +#undef inline +#endif + +/* Define to `unsigned int' if does not define. */ +#undef size_t + +/* the signed version of size_t */ +#undef ssize_t diff --git a/mobicore/common/curl/src/curlutil.c b/mobicore/common/curl/src/curlutil.c new file mode 100644 index 0000000000000000000000000000000000000000..bca2db7aa3025e636a5472eda6923f691e82bb5b --- /dev/null +++ b/mobicore/common/curl/src/curlutil.c @@ -0,0 +1,134 @@ +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) 1998 - 2008, Daniel Stenberg, , et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at http://curl.haxx.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ***************************************************************************/ + +#include "setup.h" + +#include "curlutil.h" + +#if defined(WIN32) && !defined(MSDOS) + +struct timeval cutil_tvnow(void) +{ + /* + ** GetTickCount() is available on _all_ Windows versions from W95 up + ** to nowadays. Returns milliseconds elapsed since last system boot, + ** increases monotonically and wraps once 49.7 days have elapsed. + */ + struct timeval now; + DWORD milliseconds = GetTickCount(); + now.tv_sec = milliseconds / 1000; + now.tv_usec = (milliseconds % 1000) * 1000; + return now; +} + +#elif defined(HAVE_CLOCK_GETTIME_MONOTONIC) + +struct timeval cutil_tvnow(void) +{ + /* + ** clock_gettime() is granted to be increased monotonically when the + ** monotonic clock is queried. Time starting point is unspecified, it + ** could be the system start-up time, the Epoch, or something else, + ** in any case the time starting point does not change once that the + ** system has started up. + */ + struct timeval now; + struct timespec tsnow; + if(0 == clock_gettime(CLOCK_MONOTONIC, &tsnow)) { + now.tv_sec = tsnow.tv_sec; + now.tv_usec = tsnow.tv_nsec / 1000; + } + /* + ** Even when the configure process has truly detected monotonic clock + ** availability, it might happen that it is not actually available at + ** run-time. When this occurs simply fallback to other time source. + */ +#ifdef HAVE_GETTIMEOFDAY + else + (void)gettimeofday(&now, NULL); +#else + else { + now.tv_sec = (long)time(NULL); + now.tv_usec = 0; + } +#endif + return now; +} + +#elif defined(HAVE_GETTIMEOFDAY) + +struct timeval cutil_tvnow(void) +{ + /* + ** gettimeofday() is not granted to be increased monotonically, due to + ** clock drifting and external source time synchronization it can jump + ** forward or backward in time. + */ + struct timeval now; + (void)gettimeofday(&now, NULL); + return now; +} + +#else + +struct timeval cutil_tvnow(void) +{ + /* + ** time() returns the value of time in seconds since the Epoch. + */ + struct timeval now; + now.tv_sec = (long)time(NULL); + now.tv_usec = 0; + return now; +} + +#endif + +/* + * Make sure that the first argument is the more recent time, as otherwise + * we'll get a weird negative time-diff back... + * + * Returns: the time difference in number of milliseconds. + */ +long cutil_tvdiff(struct timeval newer, struct timeval older) +{ + return (newer.tv_sec-older.tv_sec)*1000+ + (newer.tv_usec-older.tv_usec)/1000; +} + +/* + * Same as cutil_tvdiff but with full usec resolution. + * + * Returns: the time difference in seconds with subsecond resolution. + */ +double cutil_tvdiff_secs(struct timeval newer, struct timeval older) +{ + return (double)(newer.tv_sec-older.tv_sec)+ + (double)(newer.tv_usec-older.tv_usec)/1000000.0; +} + +/* return the number of seconds in the given input timeval struct */ +long cutil_tvlong(struct timeval t1) +{ + return t1.tv_sec; +} + diff --git a/mobicore/common/curl/src/curlutil.h b/mobicore/common/curl/src/curlutil.h new file mode 100644 index 0000000000000000000000000000000000000000..a993a775e22df48950235e247c805eb9524b8056 --- /dev/null +++ b/mobicore/common/curl/src/curlutil.h @@ -0,0 +1,49 @@ +#ifndef __CURL_SRC_UTIL_H +#define __CURL_SRC_UTIL_H +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) 1998 - 2007, Daniel Stenberg, , et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at http://curl.haxx.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ***************************************************************************/ + +#include "setup.h" + + +struct timeval cutil_tvnow(void); + +/* + * Make sure that the first argument (t1) is the more recent time and t2 is + * the older time, as otherwise you get a weird negative time-diff back... + * + * Returns: the time difference in number of milliseconds. + */ +long cutil_tvdiff(struct timeval t1, struct timeval t2); + +/* + * Same as cutil_tvdiff but with full usec resolution. + * + * Returns: the time difference in seconds with subsecond resolution. + */ +double cutil_tvdiff_secs(struct timeval t1, struct timeval t2); + +long cutil_tvlong(struct timeval t1); + + +#endif /* __CURL_SRC_UTIL_H */ + diff --git a/mobicore/common/curl/src/getpass.c b/mobicore/common/curl/src/getpass.c new file mode 100644 index 0000000000000000000000000000000000000000..b441a5ad9dcb9732d27d82ecb27e0aadf98007e6 --- /dev/null +++ b/mobicore/common/curl/src/getpass.c @@ -0,0 +1,267 @@ +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) 1998 - 2010, Daniel Stenberg, , et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at http://curl.haxx.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ***************************************************************************/ + +/* This file is a reimplementation of the previous one, due to license + problems. */ + +#include "setup.h" + +#ifndef HAVE_GETPASS_R +/* this file is only for systems without getpass_r() */ + +#include +#include + +#ifdef HAVE_UNISTD_H +#include +#endif + +#include "getpass.h" + +#ifdef HAVE_FCNTL_H +#include +#endif +#ifdef HAVE_TERMIOS_H +#include +#else +#ifdef HAVE_TERMIO_H +#include +#endif +#endif + +/* The last #include file should be: */ +#if defined(CURLDEBUG) && defined(CURLTOOLDEBUG) +#include "memdebug.h" +#endif + +#ifdef __VMS +/* VMS implementation */ +#include descrip +#include starlet +#include iodef +/* #include iosbdef */ +char *getpass_r(const char *prompt, char *buffer, size_t buflen) +{ + long sts; + short chan; + + /* MSK, 23-JAN-2004, iosbdef.h wasn't in VAX V7.2 or CC 6.4 */ + /* distribution so I created this. May revert back later to */ + /* struct _iosb iosb; */ + struct _iosb + { + short int iosb$w_status; /* status */ + short int iosb$w_bcnt; /* byte count */ + int unused; /* unused */ + } iosb; + + $DESCRIPTOR(ttdesc, "TT"); + + buffer[0]='\0'; + sts = sys$assign(&ttdesc, &chan,0,0); + if (sts & 1) { + sts = sys$qiow(0, chan, + IO$_READPROMPT | IO$M_NOECHO, + &iosb, 0, 0, buffer, buflen, 0, 0, + prompt, strlen(prompt)); + + if((sts & 1) && (iosb.iosb$w_status&1)) + buffer[iosb.iosb$w_bcnt] = '\0'; + + sts = sys$dassgn(chan); + } + return buffer; /* we always return success */ +} +#define DONE +#endif /* __VMS */ + + +#ifdef WIN32 +/* Windows implementation */ +#include +#endif + +#ifdef __SYMBIAN32__ +#define getch() getchar() +#endif + +#if defined(WIN32) || defined(__SYMBIAN32__) + +char *getpass_r(const char *prompt, char *buffer, size_t buflen) +{ + size_t i; + fputs(prompt, stderr); + + for(i=0; i=1?2:1); + } +#ifndef __SYMBIAN32__ + /* since echo is disabled, print a newline */ + fputs("\n", stderr); +#endif + /* if user didn't hit ENTER, terminate buffer */ + if (i==buflen) + buffer[buflen-1]=0; + + return buffer; /* we always return success */ +} +#define DONE +#endif /* WIN32 || __SYMBIAN32__ */ + +#ifdef NETWARE +/* NetWare implementation */ +#ifdef __NOVELL_LIBC__ +#include +char *getpass_r(const char *prompt, char *buffer, size_t buflen) +{ + return getpassword(prompt, buffer, buflen); +} +#else +#include +char *getpass_r(const char *prompt, char *buffer, size_t buflen) +{ + size_t i = 0; + + printf("%s", prompt); + do { + buffer[i++] = getch(); + if (buffer[i-1] == '\b') { + /* remove this letter and if this is not the first key, + remove the previous one as well */ + if (i > 1) { + printf("\b \b"); + i = i - 2; + } else { + RingTheBell(); + i = i - 1; + } + } else if (buffer[i-1] != 13) { + putchar('*'); + } + } while ((buffer[i-1] != 13) && (i < buflen)); + buffer[i-1] = 0; + printf("\r\n"); + return buffer; +} +#endif /* __NOVELL_LIBC__ */ +#define DONE +#endif /* NETWARE */ + +#ifndef DONE /* not previously provided */ + +#ifdef HAVE_TERMIOS_H +#define struct_term struct termios +#else +#ifdef HAVE_TERMIO_H +#define struct_term struct termio +#else +#undef struct_term +#endif +#endif + +static bool ttyecho(bool enable, int fd) +{ +#ifdef struct_term + static struct_term withecho; + static struct_term noecho; +#endif + if(!enable) { + /* disable echo by extracting the current 'withecho' mode and remove the + ECHO bit and set back the struct */ +#ifdef HAVE_TERMIOS_H + tcgetattr(fd, &withecho); + noecho = withecho; + noecho.c_lflag &= ~ECHO; + tcsetattr(fd, TCSANOW, &noecho); +#else /* HAVE_TERMIOS_H */ +#ifdef HAVE_TERMIO_H + ioctl(fd, TCGETA, &withecho); + noecho = withecho; + noecho.c_lflag &= ~ECHO; + ioctl(fd, TCSETA, &noecho); +#else /* HAVE_TERMIO_H */ +/* neither HAVE_TERMIO_H nor HAVE_TERMIOS_H, we can't disable echo! */ + (void)fd; /* prevent compiler warning on unused variable */ + return FALSE; /* not disabled */ +#endif +#endif + return TRUE; /* disabled */ + } + else { + /* re-enable echo, assumes we disabled it before (and set the structs we + now use to reset the terminal status) */ +#ifdef HAVE_TERMIOS_H + tcsetattr(fd, TCSAFLUSH, &withecho); +#else /* HAVE_TERMIOS_H */ +#ifdef HAVE_TERMIO_H + ioctl(fd, TCSETA, &withecho); +#else +/* neither HAVE_TERMIO_H nor HAVE_TERMIOS_H */ + return FALSE; /* not enabled */ +#endif +#endif + return TRUE; /* enabled */ + } +} + +char *getpass_r(const char *prompt, /* prompt to display */ + char *password, /* buffer to store password in */ + size_t buflen) /* size of buffer to store password in */ +{ + ssize_t nread; + bool disabled; + int fd=open("/dev/tty", O_RDONLY); + if(-1 == fd) + fd = 1; /* use stdin if the tty couldn't be used */ + + disabled = ttyecho(FALSE, fd); /* disable terminal echo */ + + fputs(prompt, stderr); + nread=read(fd, password, buflen); + if(nread > 0) + password[--nread]=0; /* zero terminate where enter is stored */ + else + password[0]=0; /* got nothing */ + + if(disabled) { + /* if echo actually was disabled, add a newline */ + fputs("\n", stderr); + (void)ttyecho(TRUE, fd); /* enable echo */ + } + + if(1 != fd) + close(fd); + + return password; /* return pointer to buffer */ +} + +#endif /* DONE */ +#endif /* HAVE_GETPASS_R */ diff --git a/mobicore/common/curl/src/getpass.h b/mobicore/common/curl/src/getpass.h new file mode 100644 index 0000000000000000000000000000000000000000..3b29d47a1ffd26a299c1bfff4fe10477540db9d6 --- /dev/null +++ b/mobicore/common/curl/src/getpass.h @@ -0,0 +1,34 @@ +#ifndef __GETPASS_H +#define __GETPASS_H +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) 1998 - 2009, Daniel Stenberg, , et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at http://curl.haxx.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ***************************************************************************/ +#ifndef HAVE_GETPASS_R +/* If there's a system-provided function named like this, we trust it is + also found in one of the standard headers. */ + +/* + * Returning NULL will abort the continued operation! + */ +char* getpass_r(const char *prompt, char* buffer, size_t buflen ); +#endif + +#endif diff --git a/mobicore/common/curl/src/homedir.c b/mobicore/common/curl/src/homedir.c new file mode 100644 index 0000000000000000000000000000000000000000..ab1d369461d2e3768ec2f3ec68e70260373b7cef --- /dev/null +++ b/mobicore/common/curl/src/homedir.c @@ -0,0 +1,120 @@ +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) 1998 - 2009, Daniel Stenberg, , et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at http://curl.haxx.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ***************************************************************************/ + +#include "setup.h" + +#include +#include +#include + +#ifdef HAVE_PWD_H +#include +#endif +#ifdef HAVE_UNISTD_H +#include +#endif +#ifdef __VMS +#include +#endif + +#include "homedir.h" + +#if defined(CURLDEBUG) && defined(CURLTOOLDEBUG) +#include "memdebug.h" +#endif + +static +char *GetEnv(const char *variable, char do_expand) +{ + char *env = NULL; +#ifdef WIN32 + char buf1[1024], buf2[1024]; + DWORD rc; + + /* Don't use getenv(); it doesn't find variable added after program was + * started. Don't accept truncated results (i.e. rc >= sizeof(buf1)). */ + + rc = GetEnvironmentVariable(variable, buf1, sizeof(buf1)); + if (rc > 0 && rc < sizeof(buf1)) { + env = buf1; + variable = buf1; + } + if (do_expand && strchr(variable,'%')) { + /* buf2 == variable if not expanded */ + rc = ExpandEnvironmentStrings (variable, buf2, sizeof(buf2)); + if (rc > 0 && rc < sizeof(buf2) && + !strchr(buf2,'%')) /* no vars still unexpanded */ + env = buf2; + } +#else + (void)do_expand; +#ifdef __VMS + env = getenv(variable); + if (env && strcmp("HOME",variable) == 0) { + env = decc_translate_vms(env); + } +#else + /* no length control */ + env = getenv(variable); +#endif +#endif + return (env && env[0])?strdup(env):NULL; +} + +/* return the home directory of the current user as an allocated string */ +char *homedir(void) +{ + char *home; + + home = GetEnv("CURL_HOME", FALSE); + if(home) + return home; + + home = GetEnv("HOME", FALSE); + if(home) + return home; + +#if defined(HAVE_GETPWUID) && defined(HAVE_GETEUID) + { + struct passwd *pw = getpwuid(geteuid()); + + if (pw) { +#ifdef __VMS + home = decc_translate_vms(pw->pw_dir); +#else + home = pw->pw_dir; +#endif + if (home && home[0]) + home = strdup(home); + else + home = NULL; + } + } +#endif /* PWD-stuff */ +#ifdef WIN32 + home = GetEnv("APPDATA", TRUE); + if(!home) + home = GetEnv("%USERPROFILE%\\Application Data", TRUE); /* Normally only + on Win-2K/XP */ +#endif /* WIN32 */ + return home; +} diff --git a/mobicore/common/curl/src/homedir.h b/mobicore/common/curl/src/homedir.h new file mode 100644 index 0000000000000000000000000000000000000000..c88d517239bb39873ac510ea673ef2cb80bdb911 --- /dev/null +++ b/mobicore/common/curl/src/homedir.h @@ -0,0 +1,27 @@ +#ifndef HEADER_CURL_HOMEDIR_H +#define HEADER_CURL_HOMEDIR_H +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) 1998 - 2010, Daniel Stenberg, , et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at http://curl.haxx.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ***************************************************************************/ + +char *homedir(void); + +#endif /* HEADER_CURL_HOMEDIR_H */ diff --git a/mobicore/common/curl/src/hugehelp.c b/mobicore/common/curl/src/hugehelp.c new file mode 100644 index 0000000000000000000000000000000000000000..34bc301369114e53d880744085292115724e3b73 --- /dev/null +++ b/mobicore/common/curl/src/hugehelp.c @@ -0,0 +1,7115 @@ +#include "setup.h" +#ifndef HAVE_LIBZ +/* + * NEVER EVER edit this manually, fix the mkhelp.pl script instead! + * Generation time: Wed Dec 15 15:06:02 2010 + */ +#include "setup.h" +#ifdef USE_MANUAL +#include "hugehelp.h" +#include +void hugehelp(void) +{ + fputs( +" _ _ ____ _\n" +" Project ___| | | | _ \\| |\n" +" / __| | | | |_) | |\n" +" | (__| |_| | _ <| |___\n" +" \\___|\\___/|_| \\_\\_____|\n" +"\n" +"NAME\n" +" curl - transfer a URL\n" +"\n" +"SYNOPSIS\n" +" curl [options] [URL...]\n" +"\n" +"DESCRIPTION\n" +" curl is a tool to transfer data from or to a server, using one of the\n" +" supported protocols (DICT, FILE, FTP, FTPS, GOPHER, HTTP, HTTPS, IMAP,\n" +, stdout); + fputs( +" IMAPS, LDAP, LDAPS, POP3, POP3S, RTMP, RTSP, SCP, SFTP, SMTP, SMTPS,\n" +" TELNET and TFTP). The command is designed to work without user inter-\n" +" action.\n" +"\n" +" curl offers a busload of useful tricks like proxy support, user authen-\n" +" tication, FTP upload, HTTP post, SSL connections, cookies, file trans-\n" +" fer resume and more. As you will see below, the number of features will\n" +" make your head spin!\n" +"\n" +, stdout); + fputs( +" curl is powered by libcurl for all transfer-related features. See\n" +" libcurl(3) for details.\n" +"\n" +"URL\n" +" The URL syntax is protocol-dependent. You'll find a detailed descrip-\n" +" tion in RFC 3986.\n" +"\n" +" You can specify multiple URLs or parts of URLs by writing part sets\n" +" within braces as in:\n" +"\n" +" http://site.{one,two,three}.com\n" +"\n" +" or you can get sequences of alphanumeric series by using [] as in:\n" +"\n" +" ftp://ftp.numericals.com/file[1-100].txt\n" +, stdout); + fputs( +" ftp://ftp.numericals.com/file[001-100].txt (with leading zeros)\n" +" ftp://ftp.letters.com/file[a-z].txt\n" +"\n" +" Nested sequences are not supported, but you can use several ones next\n" +" to each other:\n" +"\n" +" http://any.org/archive[1996-1999]/vol[1-4]/part{a,b,c}.html\n" +"\n" +" You can specify any amount of URLs on the command line. They will be\n" +" fetched in a sequential manner in the specified order.\n" +"\n" +, stdout); + fputs( +" You can specify a step counter for the ranges to get every Nth number\n" +" or letter:\n" +"\n" +" http://www.numericals.com/file[1-100:10].txt\n" +" http://www.letters.com/file[a-z:2].txt\n" +"\n" +" If you specify URL without protocol:// prefix, curl will attempt to\n" +" guess what protocol you might want. It will then default to HTTP but\n" +" try other protocols based on often-used host name prefixes. For exam-\n" +, stdout); + fputs( +" ple, for host names starting with \"ftp.\" curl will assume you want to\n" +" speak FTP.\n" +"\n" +" curl will do its best to use what you pass to it as a URL. It is not\n" +" trying to validate it as a syntactically correct URL by any means but\n" +" is instead very liberal with what it accepts.\n" +"\n" +" Curl will attempt to re-use connections for multiple file transfers, so\n" +" that getting many files from the same server will not do multiple con-\n" +, stdout); + fputs( +" nects / handshakes. This improves speed. Of course this is only done on\n" +" files specified on a single command line and cannot be used between\n" +" separate curl invokes.\n" +"\n" +"PROGRESS METER\n" +" curl normally displays a progress meter during operations, indicating\n" +" the amount of transferred data, transfer speeds and estimated time\n" +" left, etc.\n" +"\n" +" curl displays this data to the terminal by default, so if you invoke\n" +, stdout); + fputs( +" curl to do an operation and it is about to write data to the terminal,\n" +" it disables the progress meter as otherwise it would mess up the output\n" +" mixing progress meter and response data.\n" +"\n" +" If you want a progress meter for HTTP POST or PUT requests, you need to\n" +" redirect the response output to a file, using shell redirect (>), -o\n" +" [file] or similar.\n" +"\n" +" It is not the same case for FTP upload as that operation does not spit\n" +, stdout); + fputs( +" out any response data to the terminal.\n" +"\n" +" If you prefer a progress \"bar\" instead of the regular meter, -# is your\n" +" friend.\n" +"OPTIONS\n" +" In general, all boolean options are enabled with --option and yet again\n" +" disabled with --no-option. That is, you use the exact same option name\n" +" but prefix it with \"no-\". However, in this list we mostly only list and\n" +" show the --option version of them. (This concept with --no options was\n" +, stdout); + fputs( +" added in 7.19.0. Previously most options were toggled on/off on\n" +" repeated use of the same command line option.)\n" +"\n" +" -a/--append\n" +" (FTP/SFTP) When used in an upload, this will tell curl to append\n" +" to the target file instead of overwriting it. If the file\n" +" doesn't exist, it will be created. Note that this flag is\n" +" ignored by some SSH servers (including OpenSSH).\n" +"\n" +" -A/--user-agent \n" +, stdout); + fputs( +" (HTTP) Specify the User-Agent string to send to the HTTP server.\n" +" Some badly done CGIs fail if this field isn't set to\n" +" \"Mozilla/4.0\". To encode blanks in the string, surround the\n" +" string with single quote marks. This can also be set with the\n" +" -H/--header option of course.\n" +"\n" +" If this option is set more than once, the last one will be the\n" +" one that's used.\n" +"\n" +" --anyauth\n" +, stdout); + fputs( +" (HTTP) Tells curl to figure out authentication method by itself,\n" +" and use the most secure one the remote site claims to support.\n" +" This is done by first doing a request and checking the response-\n" +" headers, thus possibly inducing an extra network round-trip.\n" +" This is used instead of setting a specific authentication\n" +" method, which you can do with --basic, --digest, --ntlm, and\n" +, stdout); + fputs( +" --negotiate.\n" +"\n" +" Note that using --anyauth is not recommended if you do uploads\n" +" from stdin, since it may require data to be sent twice and then\n" +" the client must be able to rewind. If the need should arise when\n" +" uploading from stdin, the upload operation will fail.\n" +"\n" +" -b/--cookie \n" +" (HTTP) Pass the data to the HTTP server as a cookie. It is sup-\n" +, stdout); + fputs( +" posedly the data previously received from the server in a \"Set-\n" +" Cookie:\" line. The data should be in the format \"NAME1=VALUE1;\n" +" NAME2=VALUE2\".\n" +"\n" +" If no '=' symbol is used in the line, it is treated as a file-\n" +" name to use to read previously stored cookie lines from, which\n" +" should be used in this session if they match. Using this method\n" +, stdout); + fputs( +" also activates the \"cookie parser\" which will make curl record\n" +" incoming cookies too, which may be handy if you're using this in\n" +" combination with the -L/--location option. The file format of\n" +" the file to read cookies from should be plain HTTP headers or\n" +" the Netscape/Mozilla cookie file format.\n" +"\n" +" NOTE that the file specified with -b/--cookie is only used as\n" +, stdout); + fputs( +" input. No cookies will be stored in the file. To store cookies,\n" +" use the -c/--cookie-jar option or you could even save the HTTP\n" +" headers to a file using -D/--dump-header!\n" +"\n" +" If this option is set more than once, the last one will be the\n" +" one that's used.\n" +"\n" +" -B/--use-ascii\n" +" Enable ASCII transfer when using FTP or LDAP. For FTP, this can\n" +, stdout); + fputs( +" also be enforced by using an URL that ends with \";type=A\". This\n" +" option causes data sent to stdout to be in text mode for win32\n" +" systems.\n" +"\n" +" --basic\n" +" (HTTP) Tells curl to use HTTP Basic authentication. This is the\n" +" default and this option is usually pointless, unless you use it\n" +" to override a previously set option that sets a different\n" +, stdout); + fputs( +" authentication method (such as --ntlm, --digest, or --negoti-\n" +" ate).\n" +"\n" +" --ciphers \n" +" (SSL) Specifies which ciphers to use in the connection. The list\n" +" of ciphers must specify valid ciphers. Read up on SSL cipher\n" +" list details on this URL:\n" +" http://www.openssl.org/docs/apps/ciphers.html\n" +"\n" +, stdout); + fputs( +" NSS ciphers are done differently than OpenSSL and GnuTLS. The\n" +" full list of NSS ciphers is in the NSSCipherSuite entry at this\n" +" URL: http://directory.fedora.redhat.com/docs/mod_nss.html#Direc-\n" +" tives\n" +"\n" +" If this option is used several times, the last one will override\n" +" the others.\n" +"\n" +" --compressed\n" +" (HTTP) Request a compressed response using one of the algorithms\n" +, stdout); + fputs( +" libcurl supports, and return the uncompressed document. If this\n" +" option is used and the server sends an unsupported encoding,\n" +" curl will report an error.\n" +"\n" +" --connect-timeout \n" +" Maximum time in seconds that you allow the connection to the\n" +" server to take. This only limits the connection phase, once\n" +" curl has connected this option is of no more use. See also the\n" +, stdout); + fputs( +" -m/--max-time option.\n" +"\n" +" If this option is used several times, the last one will be used.\n" +"\n" +" -c/--cookie-jar \n" +" Specify to which file you want curl to write all cookies after a\n" +" completed operation. Curl writes all cookies previously read\n" +" from a specified file as well as all cookies received from\n" +" remote server(s). If no cookies are known, no file will be writ-\n" +, stdout); + fputs( +" ten. The file will be written using the Netscape cookie file\n" +" format. If you set the file name to a single dash, \"-\", the\n" +" cookies will be written to stdout.\n" +"\n" +" NOTE If the cookie jar can't be created or written to, the whole\n" +" curl operation won't fail or even report an error clearly. Using\n" +" -v will get a warning displayed, but that is the only visible\n" +, stdout); + fputs( +" feedback you get about this possibly lethal situation.\n" +"\n" +" If this option is used several times, the last specified file\n" +" name will be used.\n" +"\n" +" -C/--continue-at \n" +" Continue/Resume a previous file transfer at the given offset.\n" +" The given offset is the exact number of bytes that will be\n" +" skipped, counting from the beginning of the source file before\n" +, stdout); + fputs( +" it is transferred to the destination. If used with uploads, the\n" +" FTP server command SIZE will not be used by curl.\n" +"\n" +" Use \"-C -\" to tell curl to automatically find out where/how to\n" +" resume the transfer. It then uses the given output/input files\n" +" to figure that out.\n" +"\n" +" If this option is used several times, the last one will be used.\n" +"\n" +" --create-dirs\n" +, stdout); + fputs( +" When used in conjunction with the -o option, curl will create\n" +" the necessary local directory hierarchy as needed. This option\n" +" creates the dirs mentioned with the -o option, nothing else. If\n" +" the -o file name uses no dir or if the dirs it mentions already\n" +" exist, no dir will be created.\n" +"\n" +" To create remote directories when using FTP or SFTP, try --ftp-\n" +" create-dirs.\n" +"\n" +, stdout); + fputs( +" --crlf (FTP) Convert LF to CRLF in upload. Useful for MVS (OS/390).\n" +"\n" +" --crlfile \n" +" (HTTPS/FTPS) Provide a file using PEM format with a Certificate\n" +" Revocation List that may specify peer certificates that are to\n" +" be considered revoked.\n" +"\n" +" If this option is used several times, the last one will be used.\n" +"\n" +" (Added in 7.19.7)\n" +"\n" +" -d/--data \n" +, stdout); + fputs( +" (HTTP) Sends the specified data in a POST request to the HTTP\n" +" server, in the same way that a browser does when a user has\n" +" filled in an HTML form and presses the submit button. This will\n" +" cause curl to pass the data to the server using the content-type\n" +" application/x-www-form-urlencoded. Compare to -F/--form.\n" +"\n" +" -d/--data is the same as --data-ascii. To post data purely\n" +, stdout); + fputs( +" binary, you should instead use the --data-binary option. To URL-\n" +" encode the value of a form field you may use --data-urlencode.\n" +"\n" +" If any of these options is used more than once on the same com-\n" +" mand line, the data pieces specified will be merged together\n" +" with a separating &-symbol. Thus, using '-d name=daniel -d\n" +" skill=lousy' would generate a post chunk that looks like\n" +, stdout); + fputs( +" 'name=daniel&skill=lousy'.\n" +"\n" +" If you start the data with the letter @, the rest should be a\n" +" file name to read the data from, or - if you want curl to read\n" +" the data from stdin. The contents of the file must already be\n" +" URL-encoded. Multiple files can also be specified. Posting data\n" +" from a file named 'foobar' would thus be done with --data @foo-\n" +" bar.\n" +"\n" +" --data-binary \n" +, stdout); + fputs( +" (HTTP) This posts data exactly as specified with no extra pro-\n" +" cessing whatsoever.\n" +"\n" +" If you start the data with the letter @, the rest should be a\n" +" filename. Data is posted in a similar manner as --data-ascii\n" +" does, except that newlines are preserved and conversions are\n" +" never done.\n" +"\n" +" If this option is used several times, the ones following the\n" +, stdout); + fputs( +" first will append data as described in -d/--data.\n" +"\n" +" --data-urlencode \n" +" (HTTP) This posts data, similar to the other --data options with\n" +" the exception that this performs URL-encoding. (Added in 7.18.0)\n" +" To be CGI-compliant, the part should begin with a name\n" +" followed by a separator and a content specification. The \n" +" part can be passed to curl using one of the following syntaxes:\n" +"\n" +, stdout); + fputs( +" content\n" +" This will make curl URL-encode the content and pass that\n" +" on. Just be careful so that the content doesn't contain\n" +" any = or @ symbols, as that will then make the syntax\n" +" match one of the other cases below!\n" +"\n" +" =content\n" +" This will make curl URL-encode the content and pass that\n" +" on. The preceding = symbol is not included in the data.\n" +"\n" +, stdout); + fputs( +" name=content\n" +" This will make curl URL-encode the content part and pass\n" +" that on. Note that the name part is expected to be URL-\n" +" encoded already.\n" +"\n" +" @filename\n" +" This will make curl load data from the given file\n" +" (including any newlines), URL-encode that data and pass\n" +" it on in the POST.\n" +"\n" +" name@filename\n" +, stdout); + fputs( +" This will make curl load data from the given file\n" +" (including any newlines), URL-encode that data and pass\n" +" it on in the POST. The name part gets an equal sign\n" +" appended, resulting in name=urlencoded-file-content. Note\n" +" that the name is expected to be URL-encoded already.\n" +"\n" +" --digest\n" +" (HTTP) Enables HTTP Digest authentication. This is a authentica-\n" +, stdout); + fputs( +" tion that prevents the password from being sent over the wire in\n" +" clear text. Use this in combination with the normal -u/--user\n" +" option to set user name and password. See also --ntlm, --negoti-\n" +" ate and --anyauth for related options.\n" +"\n" +" If this option is used several times, the following occurrences\n" +" make no difference.\n" +"\n" +" --disable-eprt\n" +, stdout); + fputs( +" (FTP) Tell curl to disable the use of the EPRT and LPRT commands\n" +" when doing active FTP transfers. Curl will normally always first\n" +" attempt to use EPRT, then LPRT before using PORT, but with this\n" +" option, it will use PORT right away. EPRT and LPRT are exten-\n" +" sions to the original FTP protocol, and may not work on all\n" +" servers, but they enable more functionality in a better way than\n" +, stdout); + fputs( +" the traditional PORT command.\n" +"\n" +" --eprt can be used to explicitly enable EPRT again and --no-eprt\n" +" is an alias for --disable-eprt.\n" +"\n" +" Disabling EPRT only changes the active behavior. If you want to\n" +" switch to passive mode you need to not use -P/--ftp-port or\n" +" force it with --ftp-pasv.\n" +"\n" +" --disable-epsv\n" +" (FTP) Tell curl to disable the use of the EPSV command when\n" +, stdout); + fputs( +" doing passive FTP transfers. Curl will normally always first\n" +" attempt to use EPSV before PASV, but with this option, it will\n" +" not try using EPSV.\n" +"\n" +" --epsv can be used to explicitly enable EPRT again and --no-epsv\n" +" is an alias for --disable-epsv.\n" +"\n" +" Disabling EPSV only changes the passive behavior. If you want to\n" +" switch to active mode you need to use -P/--ftp-port.\n" +"\n" +" -D/--dump-header \n" +, stdout); + fputs( +" Write the protocol headers to the specified file.\n" +"\n" +" This option is handy to use when you want to store the headers\n" +" that a HTTP site sends to you. Cookies from the headers could\n" +" then be read in a second curl invocation by using the\n" +" -b/--cookie option! The -c/--cookie-jar option is however a bet-\n" +" ter way to store cookies.\n" +"\n" +, stdout); + fputs( +" When used in FTP, the FTP server response lines are considered\n" +" being \"headers\" and thus are saved there.\n" +"\n" +" If this option is used several times, the last one will be used.\n" +"\n" +" -e/--referer \n" +" (HTTP) Sends the \"Referer Page\" information to the HTTP server.\n" +" This can also be set with the -H/--header flag of course. When\n" +" used with -L/--location you can append \";auto\" to the --referer\n" +, stdout); + fputs( +" URL to make curl automatically set the previous URL when it fol-\n" +" lows a Location: header. The \";auto\" string can be used alone,\n" +" even if you don't set an initial --referer.\n" +"\n" +" If this option is used several times, the last one will be used.\n" +"\n" +" --engine \n" +" Select the OpenSSL crypto engine to use for cipher operations.\n" +" Use --engine list to print a list of build-time supported\n" +, stdout); + fputs( +" engines. Note that not all (or none) of the engines may be\n" +" available at run-time.\n" +"\n" +" --environment\n" +" (RISC OS ONLY) Sets a range of environment variables, using the\n" +" names the -w option supports, to allow easier extraction of use-\n" +" ful information after having run curl.\n" +"\n" +" --egd-file \n" +" (SSL) Specify the path name to the Entropy Gathering Daemon\n" +, stdout); + fputs( +" socket. The socket is used to seed the random engine for SSL\n" +" connections. See also the --random-file option.\n" +"\n" +" -E/--cert \n" +" (SSL) Tells curl to use the specified certificate file when get-\n" +" ting a file with HTTPS or FTPS. The certificate must be in PEM\n" +" format. If the optional password isn't specified, it will be\n" +" queried for on the terminal. Note that this option assumes a\n" +, stdout); + fputs( +" \"certificate\" file that is the private key and the private cer-\n" +" tificate concatenated! See --cert and --key to specify them\n" +" independently.\n" +"\n" +" If curl is built against the NSS SSL library then this option\n" +" tells curl the nickname of the certificate to use within the NSS\n" +" database defined by the environment variable SSL_DIR (or by\n" +, stdout); + fputs( +" default /etc/pki/nssdb). If the NSS PEM PKCS#11 module (lib-\n" +" nsspem.so) is available then PEM files may be loaded.\n" +"\n" +" If this option is used several times, the last one will be used.\n" +"\n" +" --cert-type \n" +" (SSL) Tells curl what certificate type the provided certificate\n" +" is in. PEM, DER and ENG are recognized types. If not specified,\n" +" PEM is assumed.\n" +"\n" +, stdout); + fputs( +" If this option is used several times, the last one will be used.\n" +"\n" +" --cacert \n" +" (SSL) Tells curl to use the specified certificate file to verify\n" +" the peer. The file may contain multiple CA certificates. The\n" +" certificate(s) must be in PEM format. Normally curl is built to\n" +" use a default file for this, so this option is typically used to\n" +" alter that default file.\n" +"\n" +, stdout); + fputs( +" curl recognizes the environment variable named 'CURL_CA_BUNDLE'\n" +" if it is set, and uses the given path as a path to a CA cert\n" +" bundle. This option overrides that variable.\n" +"\n" +" The windows version of curl will automatically look for a CA\n" +" certs file named 'curl-ca-bundle.crt', either in the same direc-\n" +" tory as curl.exe, or in the Current Working Directory, or in any\n" +" folder along your PATH.\n" +"\n" +, stdout); + fputs( +" If curl is built against the NSS SSL library then this option\n" +" tells curl the nickname of the CA certificate to use within the\n" +" NSS database defined by the environment variable SSL_DIR (or by\n" +" default /etc/pki/nssdb). If the NSS PEM PKCS#11 module (lib-\n" +" nsspem.so) is available then PEM files may be loaded.\n" +"\n" +" If this option is used several times, the last one will be used.\n" +"\n" +, stdout); + fputs( +" --capath \n" +" (SSL) Tells curl to use the specified certificate directory to\n" +" verify the peer. The certificates must be in PEM format, and the\n" +" directory must have been processed using the c_rehash utility\n" +" supplied with openssl. Using --capath can allow curl to make\n" +" SSL-connections much more efficiently than using --cacert if the\n" +" --cacert file contains many CA certificates.\n" +"\n" +, stdout); + fputs( +" If this option is used several times, the last one will be used.\n" +"\n" +" -f/--fail\n" +" (HTTP) Fail silently (no output at all) on server errors. This\n" +" is mostly done to better enable scripts etc to better deal with\n" +" failed attempts. In normal cases when a HTTP server fails to\n" +" deliver a document, it returns an HTML document stating so\n" +" (which often also describes why and more). This flag will pre-\n" +, stdout); + fputs( +" vent curl from outputting that and return error 22.\n" +"\n" +" This method is not fail-safe and there are occasions where non-\n" +" successful response codes will slip through, especially when\n" +" authentication is involved (response codes 401 and 407).\n" +"\n" +" --ftp-account [data]\n" +" (FTP) When an FTP server asks for \"account data\" after user name\n" +" and password has been provided, this data is sent off using the\n" +, stdout); + fputs( +" ACCT command. (Added in 7.13.0)\n" +"\n" +" If this option is used twice, the second will override the pre-\n" +" vious use.\n" +"\n" +" --ftp-create-dirs\n" +" (FTP/SFTP) When an FTP or SFTP URL/operation uses a path that\n" +" doesn't currently exist on the server, the standard behavior of\n" +" curl is to fail. Using this option, curl will instead attempt to\n" +" create missing directories.\n" +"\n" +" --ftp-method [method]\n" +, stdout); + fputs( +" (FTP) Control what method curl should use to reach a file on a\n" +" FTP(S) server. The method argument should be one of the follow-\n" +" ing alternatives:\n" +"\n" +" multicwd\n" +" curl does a single CWD operation for each path part in\n" +" the given URL. For deep hierarchies this means very many\n" +" commands. This is how RFC1738 says it should be done.\n" +, stdout); + fputs( +" This is the default but the slowest behavior.\n" +"\n" +" nocwd curl does no CWD at all. curl will do SIZE, RETR, STOR\n" +" etc and give a full path to the server for all these com-\n" +" mands. This is the fastest behavior.\n" +"\n" +" singlecwd\n" +" curl does one CWD with the full target directory and then\n" +" operates on the file \"normally\" (like in the multicwd\n" +, stdout); + fputs( +" case). This is somewhat more standards compliant than\n" +" 'nocwd' but without the full penalty of 'multicwd'.\n" +" (Added in 7.15.1)\n" +"\n" +" --ftp-pasv\n" +" (FTP) Use passive mode for the data conection. Passive is the\n" +" internal default behavior, but using this option can be used to\n" +" override a previous -P/-ftp-port option. (Added in 7.11.0)\n" +"\n" +, stdout); + fputs( +" If this option is used several times, the following occurrences\n" +" make no difference. Undoing an enforced passive really isn't\n" +" doable but you must then instead enforce the correct -P/--ftp-\n" +" port again.\n" +"\n" +" Passive mode means that curl will try the EPSV command first and\n" +" then PASV, unless --disable-epsv is used.\n" +"\n" +" --ftp-alternative-to-user \n" +, stdout); + fputs( +" (FTP) If authenticating with the USER and PASS commands fails,\n" +" send this command. When connecting to Tumbleweed's Secure\n" +" Transport server over FTPS using a client certificate, using\n" +" \"SITE AUTH\" will tell the server to retrieve the username from\n" +" the certificate. (Added in 7.15.5)\n" +"\n" +" --ftp-skip-pasv-ip\n" +" (FTP) Tell curl to not use the IP address the server suggests in\n" +, stdout); + fputs( +" its response to curl's PASV command when curl connects the data\n" +" connection. Instead curl will re-use the same IP address it\n" +" already uses for the control connection. (Added in 7.14.2)\n" +"\n" +" This option has no effect if PORT, EPRT or EPSV is used instead\n" +" of PASV.\n" +"\n" +" --ftp-pret\n" +" (FTP) Tell curl to send a PRET command before PASV (and EPSV).\n" +, stdout); + fputs( +" Certain FTP servers, mainly drftpd, require this non-standard\n" +" command for directory listings as well as up and downloads in\n" +" PASV mode. (Added in 7.20.x)\n" +"\n" +" --ssl (FTP, POP3, IMAP, SMTP) Try to use SSL/TLS for the connection.\n" +" Reverts to a non-secure connection if the server doesn't support\n" +" SSL/TLS. See also --ftp-ssl-control and --ssl-reqd for differ-\n" +, stdout); + fputs( +" ent levels of encryption required. (Added in 7.20.0)\n" +"\n" +" This option was formerly known as --ftp-ssl (Added in 7.11.0)\n" +" and that can still be used but will be removed in a future ver-\n" +" sion.\n" +"\n" +" --ftp-ssl-control\n" +" (FTP) Require SSL/TLS for the FTP login, clear for transfer.\n" +" Allows secure authentication, but non-encrypted data transfers\n" +, stdout); + fputs( +" for efficiency. Fails the transfer if the server doesn't sup-\n" +" port SSL/TLS. (Added in 7.16.0)\n" +"\n" +" --ssl-reqd\n" +" (FTP, POP3, IMAP, SMTP) Require SSL/TLS for the connection.\n" +" Terminates the connection if the server doesn't support SSL/TLS.\n" +" (Added in 7.20.0)\n" +"\n" +" This option was formerly known as --ftp-ssl-reqd (added in\n" +" 7.15.5) and that can still be used but will be removed in a\n" +, stdout); + fputs( +" future version.\n" +"\n" +" --ftp-ssl-ccc\n" +" (FTP) Use CCC (Clear Command Channel) Shuts down the SSL/TLS\n" +" layer after authenticating. The rest of the control channel com-\n" +" munication will be unencrypted. This allows NAT routers to fol-\n" +" low the FTP transaction. The default mode is passive. See --ftp-\n" +" ssl-ccc-mode for other modes. (Added in 7.16.1)\n" +"\n" +" --ftp-ssl-ccc-mode [active/passive]\n" +, stdout); + fputs( +" (FTP) Use CCC (Clear Command Channel) Sets the CCC mode. The\n" +" passive mode will not initiate the shutdown, but instead wait\n" +" for the server to do it, and will not reply to the shutdown from\n" +" the server. The active mode initiates the shutdown and waits for\n" +" a reply from the server. (Added in 7.16.2)\n" +"\n" +" -F/--form \n" +" (HTTP) This lets curl emulate a filled-in form in which a user\n" +, stdout); + fputs( +" has pressed the submit button. This causes curl to POST data\n" +" using the Content-Type multipart/form-data according to RFC2388.\n" +" This enables uploading of binary files etc. To force the 'con-\n" +" tent' part to be a file, prefix the file name with an @ sign. To\n" +" just get the content part from a file, prefix the file name with\n" +" the symbol <. The difference between @ and < is then that @\n" +, stdout); + fputs( +" makes a file get attached in the post as a file upload, while\n" +" the < makes a text field and just get the contents for that text\n" +" field from a file.\n" +"\n" +" Example, to send your password file to the server, where 'pass-\n" +" word' is the name of the form-field to which /etc/passwd will be\n" +" the input:\n" +"\n" +" curl -F password=@/etc/passwd www.mypasswords.com\n" +"\n" +, stdout); + fputs( +" To read the file's content from stdin instead of a file, use -\n" +" where the file name should've been. This goes for both @ and <\n" +" constructs.\n" +"\n" +" You can also tell curl what Content-Type to use by using\n" +" 'type=', in a manner similar to:\n" +"\n" +" curl -F \"web=@index.html;type=text/html\" url.com\n" +"\n" +" or\n" +"\n" +" curl -F \"name=daniel;type=text/foo\" url.com\n" +"\n" +, stdout); + fputs( +" You can also explicitly change the name field of a file upload\n" +" part by setting filename=, like this:\n" +"\n" +" curl -F \"file=@localfile;filename=nameinpost\" url.com\n" +"\n" +" See further examples and details in the MANUAL.\n" +"\n" +" This option can be used multiple times.\n" +"\n" +" --form-string \n" +" (HTTP) Similar to --form except that the value string for the\n" +, stdout); + fputs( +" named parameter is used literally. Leading '@' and '<' charac-\n" +" ters, and the ';type=' string in the value have no special mean-\n" +" ing. Use this in preference to --form if there's any possibility\n" +" that the string value may accidentally trigger the '@' or '<'\n" +" features of --form.\n" +"\n" +" -g/--globoff\n" +" This option switches off the \"URL globbing parser\". When you set\n" +, stdout); + fputs( +" this option, you can specify URLs that contain the letters {}[]\n" +" without having them being interpreted by curl itself. Note that\n" +" these letters are not normal legal URL contents but they should\n" +" be encoded according to the URI standard.\n" +"\n" +" -G/--get\n" +" When used, this option will make all data specified with\n" +" -d/--data or --data-binary to be used in a HTTP GET request\n" +, stdout); + fputs( +" instead of the POST request that otherwise would be used. The\n" +" data will be appended to the URL with a '?' separator.\n" +"\n" +" If used in combination with -I, the POST data will instead be\n" +" appended to the URL with a HEAD request.\n" +"\n" +" If this option is used several times, the following occurrences\n" +" make no difference. This is because undoing a GET doesn't make\n" +, stdout); + fputs( +" sense, but you should then instead enforce the alternative\n" +" method you prefer.\n" +"\n" +" -h/--help\n" +" Usage help.\n" +"\n" +" -H/--header
\n" +" (HTTP) Extra header to use when getting a web page. You may\n" +" specify any number of extra headers. Note that if you should add\n" +" a custom header that has the same name as one of the internal\n" +, stdout); + fputs( +" ones curl would use, your externally set header will be used\n" +" instead of the internal one. This allows you to make even trick-\n" +" ier stuff than curl would normally do. You should not replace\n" +" internally set headers without knowing perfectly well what\n" +" you're doing. Remove an internal header by giving a replacement\n" +" without content on the right side of the colon, as in: -H\n" +" \"Host:\".\n" +"\n" +, stdout); + fputs( +" curl will make sure that each header you add/replace is sent\n" +" with the proper end-of-line marker, you should thus not add that\n" +" as a part of the header content: do not add newlines or carriage\n" +" returns, they will only mess things up for you.\n" +"\n" +" See also the -A/--user-agent and -e/--referer options.\n" +"\n" +" This option can be used multiple times to add/replace/remove\n" +" multiple headers.\n" +"\n" +, stdout); + fputs( +" --hostpubmd5 \n" +" Pass a string containing 32 hexadecimal digits. The string\n" +" should be the 128 bit MD5 checksum of the remote host's public\n" +" key, curl will refuse the connection with the host unless the\n" +" md5sums match. This option is only for SCP and SFTP transfers.\n" +" (Added in 7.17.1)\n" +"\n" +" --ignore-content-length\n" +" (HTTP) Ignore the Content-Length header. This is particularly\n" +, stdout); + fputs( +" useful for servers running Apache 1.x, which will report incor-\n" +" rect Content-Length for files larger than 2 gigabytes.\n" +"\n" +" -i/--include\n" +" (HTTP) Include the HTTP-header in the output. The HTTP-header\n" +" includes things like server-name, date of the document, HTTP-\n" +" version and more...\n" +"\n" +" --interface \n" +" Perform an operation using a specified interface. You can enter\n" +, stdout); + fputs( +" interface name, IP address or host name. An example could look\n" +" like:\n" +"\n" +" curl --interface eth0:1 http://www.netscape.com/\n" +"\n" +" If this option is used several times, the last one will be used.\n" +"\n" +" -I/--head\n" +" (HTTP/FTP/FILE) Fetch the HTTP-header only! HTTP-servers feature\n" +" the command HEAD which this uses to get nothing but the header\n" +" of a document. When used on a FTP or FILE file, curl displays\n" +, stdout); + fputs( +" the file size and last modification time only.\n" +"\n" +" -j/--junk-session-cookies\n" +" (HTTP) When curl is told to read cookies from a given file, this\n" +" option will make it discard all \"session cookies\". This will\n" +" basically have the same effect as if a new session is started.\n" +" Typical browsers always discard session cookies when they're\n" +" closed down.\n" +"\n" +" -J/--remote-header-name\n" +, stdout); + fputs( +" (HTTP) This option tells the -O/--remote-name option to use the\n" +" server-specified Content-Disposition filename instead of\n" +" extracting a filename from the URL.\n" +"\n" +" -k/--insecure\n" +" (SSL) This option explicitly allows curl to perform \"insecure\"\n" +" SSL connections and transfers. All SSL connections are attempted\n" +" to be made secure by using the CA certificate bundle installed\n" +, stdout); + fputs( +" by default. This makes all connections considered \"insecure\"\n" +" fail unless -k/--insecure is used.\n" +"\n" +" See this online resource for further details:\n" +" http://curl.haxx.se/docs/sslcerts.html\n" +"\n" +" --keepalive-time \n" +" This option sets the time a connection needs to remain idle\n" +" before sending keepalive probes and the time between individual\n" +, stdout); + fputs( +" keepalive probes. It is currently effective on operating systems\n" +" offering the TCP_KEEPIDLE and TCP_KEEPINTVL socket options\n" +" (meaning Linux, recent AIX, HP-UX and more). This option has no\n" +" effect if --no-keepalive is used. (Added in 7.18.0)\n" +"\n" +" If this option is used multiple times, the last occurrence sets\n" +" the amount.\n" +" --key \n" +, stdout); + fputs( +" (SSL/SSH) Private key file name. Allows you to provide your pri-\n" +" vate key in this separate file.\n" +"\n" +" If this option is used several times, the last one will be used.\n" +"\n" +" --key-type \n" +" (SSL) Private key file type. Specify which type your --key pro-\n" +" vided private key is. DER, PEM, and ENG are supported. If not\n" +" specified, PEM is assumed.\n" +"\n" +, stdout); + fputs( +" If this option is used several times, the last one will be used.\n" +"\n" +" --krb \n" +" (FTP) Enable Kerberos authentication and use. The level must be\n" +" entered and should be one of 'clear', 'safe', 'confidential', or\n" +" 'private'. Should you use a level that is not one of these,\n" +" 'private' will instead be used.\n" +"\n" +" This option requires a library built with kerberos4 or GSSAPI\n" +, stdout); + fputs( +" (GSS-Negotiate) support. This is not very common. Use -V/--ver-\n" +" sion to see if your curl supports it.\n" +"\n" +" If this option is used several times, the last one will be used.\n" +"\n" +" -K/--config \n" +" Specify which config file to read curl arguments from. The con-\n" +" fig file is a text file in which command line arguments can be\n" +" written which then will be used as if they were written on the\n" +, stdout); + fputs( +" actual command line. Options and their parameters must be speci-\n" +" fied on the same config file line, separated by whitespace,\n" +" colon, the equals sign or any combination thereof (however, the\n" +" preferred separator is the equals sign). If the parameter is to\n" +" contain whitespace, the parameter must be enclosed within\n" +" quotes. Within double quotes, the following escape sequences are\n" +, stdout); + fputs( +" available: \\\\, \\\", \\t, \\n, \\r and \\v. A backslash preceding any\n" +" other letter is ignored. If the first column of a config line is\n" +" a '#' character, the rest of the line will be treated as a com-\n" +" ment. Only write one option per physical line in the config\n" +" file.\n" +"\n" +" Specify the filename to -K/--config as '-' to make curl read the\n" +" file from stdin.\n" +"\n" +, stdout); + fputs( +" Note that to be able to specify a URL in the config file, you\n" +" need to specify it using the --url option, and not by simply\n" +" writing the URL on its own line. So, it could look similar to\n" +" this:\n" +"\n" +" url = \"http://curl.haxx.se/docs/\"\n" +"\n" +" Long option names can optionally be given in the config file\n" +" without the initial double dashes.\n" +"\n" +, stdout); + fputs( +" When curl is invoked, it always (unless -q is used) checks for a\n" +" default config file and uses it if found. The default config\n" +" file is checked for in the following places in this order:\n" +"\n" +" 1) curl tries to find the \"home dir\": It first checks for the\n" +" CURL_HOME and then the HOME environment variables. Failing that,\n" +" it uses getpwuid() on UNIX-like systems (which returns the home\n" +, stdout); + fputs( +" dir given the current user in your system). On Windows, it then\n" +" checks for the APPDATA variable, or as a last resort the '%USER-\n" +" PROFILE%\\Application Data'.\n" +"\n" +" 2) On windows, if there is no _curlrc file in the home dir, it\n" +" checks for one in the same dir the curl executable is placed. On\n" +" UNIX-like systems, it will simply try to load .curlrc from the\n" +" determined home dir.\n" +"\n" +, stdout); + fputs( +" # --- Example file ---\n" +" # this is a comment\n" +" url = \"curl.haxx.se\"\n" +" output = \"curlhere.html\"\n" +" user-agent = \"superagent/1.0\"\n" +"\n" +" # and fetch another URL too\n" +" url = \"curl.haxx.se/docs/manpage.html\"\n" +" -O\n" +" referer = \"http://nowhereatall.com/\"\n" +" # --- End of example file ---\n" +"\n" +" This option can be used multiple times to load multiple config\n" +" files.\n" +"\n" +, stdout); + fputs( +" --libcurl \n" +" Append this option to any ordinary curl command line, and you\n" +" will get a libcurl-using source code written to the file that\n" +" does the equivalent of what your command-line operation does!\n" +"\n" +" NOTE: this does not properly support -F and the sending of mul-\n" +" tipart formposts, so in those cases the output program will be\n" +" missing necessary calls to curl_formadd(3), and possibly more.\n" +"\n" +, stdout); + fputs( +" If this option is used several times, the last given file name\n" +" will be used. (Added in 7.16.1)\n" +"\n" +" --limit-rate \n" +" Specify the maximum transfer rate you want curl to use. This\n" +" feature is useful if you have a limited pipe and you'd like your\n" +" transfer not to use your entire bandwidth.\n" +"\n" +" The given speed is measured in bytes/second, unless a suffix is\n" +, stdout); + fputs( +" appended. Appending 'k' or 'K' will count the number as kilo-\n" +" bytes, 'm' or M' makes it megabytes, while 'g' or 'G' makes it\n" +" gigabytes. Examples: 200K, 3m and 1G.\n" +"\n" +" The given rate is the average speed counted during the entire\n" +" transfer. It means that curl might use higher transfer speeds in\n" +" short bursts, but over time it uses no more than the given rate.\n" +, stdout); + fputs( +" If you also use the -Y/--speed-limit option, that option will\n" +" take precedence and might cripple the rate-limiting slightly, to\n" +" help keeping the speed-limit logic working.\n" +"\n" +" If this option is used several times, the last one will be used.\n" +"\n" +" -l/--list-only\n" +" (FTP) When listing an FTP directory, this switch forces a name-\n" +" only view. Especially useful if you want to machine-parse the\n" +, stdout); + fputs( +" contents of an FTP directory since the normal directory view\n" +" doesn't use a standard look or format.\n" +"\n" +" This option causes an FTP NLST command to be sent. Some FTP\n" +" servers list only files in their response to NLST; they do not\n" +" include subdirectories and symbolic links.\n" +"\n" +" --local-port [-num]\n" +" Set a preferred number or range of local port numbers to use for\n" +, stdout); + fputs( +" the connection(s). Note that port numbers by nature are a\n" +" scarce resource that will be busy at times so setting this range\n" +" to something too narrow might cause unnecessary connection setup\n" +" failures. (Added in 7.15.2)\n" +"\n" +" -L/--location\n" +" (HTTP/HTTPS) If the server reports that the requested page has\n" +" moved to a different location (indicated with a Location: header\n" +, stdout); + fputs( +" and a 3XX response code), this option will make curl redo the\n" +" request on the new place. If used together with -i/--include or\n" +" -I/--head, headers from all requested pages will be shown. When\n" +" authentication is used, curl only sends its credentials to the\n" +" initial host. If a redirect takes curl to a different host, it\n" +" won't be able to intercept the user+password. See also --loca-\n" +, stdout); + fputs( +" tion-trusted on how to change this. You can limit the amount of\n" +" redirects to follow by using the --max-redirs option.\n" +"\n" +" When curl follows a redirect and the request is not a plain GET\n" +" (for example POST or PUT), it will do the following request with\n" +" a GET if the HTTP response was 301, 302, or 303. If the response\n" +" code was any other 3xx code, curl will re-send the following\n" +, stdout); + fputs( +" request using the same unmodified method.\n" +"\n" +" --location-trusted\n" +" (HTTP/HTTPS) Like -L/--location, but will allow sending the name\n" +" + password to all hosts that the site may redirect to. This may\n" +" or may not introduce a security breach if the site redirects you\n" +" to a site to which you'll send your authentication info (which\n" +" is plaintext in the case of HTTP Basic authentication).\n" +"\n" +" --mail-rcpt
\n" +, stdout); + fputs( +" (SMTP) Specify a single address that the given mail should get\n" +" sent to. This option can be used multiple times to specify many\n" +" recipients.\n" +"\n" +" (Added in 7.20.0)\n" +"\n" +" --mail-from
\n" +" (SMTP) Specify a single address that the given mail should get\n" +" sent from.\n" +"\n" +" (Added in 7.20.0)\n" +"\n" +" --max-filesize \n" +" Specify the maximum size (in bytes) of a file to download. If\n" +, stdout); + fputs( +" the file requested is larger than this value, the transfer will\n" +" not start and curl will return with exit code 63.\n" +"\n" +" NOTE: The file size is not always known prior to download, and\n" +" for such files this option has no effect even if the file trans-\n" +" fer ends up being larger than this given limit. This concerns\n" +" both FTP and HTTP transfers.\n" +"\n" +" -m/--max-time \n" +, stdout); + fputs( +" Maximum time in seconds that you allow the whole operation to\n" +" take. This is useful for preventing your batch jobs from hang-\n" +" ing for hours due to slow networks or links going down. See\n" +" also the --connect-timeout option.\n" +"\n" +" If this option is used several times, the last one will be used.\n" +"\n" +" -M/--manual\n" +" Manual. Display the huge help text.\n" +"\n" +" -n/--netrc\n" +, stdout); + fputs( +" Makes curl scan the .netrc (_netrc on Windows) file in the\n" +" user's home directory for login name and password. This is typi-\n" +" cally used for FTP on UNIX. If used with HTTP, curl will enable\n" +" user authentication. See netrc(4) or ftp(1) for details on the\n" +" file format. Curl will not complain if that file doesn't have\n" +" the right permissions (it should not be either world- or group-\n" +, stdout); + fputs( +" readable). The environment variable \"HOME\" is used to find the\n" +" home directory.\n" +"\n" +" A quick and very simple example of how to setup a .netrc to\n" +" allow curl to FTP to the machine host.domain.com with user name\n" +" 'myself' and password 'secret' should look similar to:\n" +"\n" +" machine host.domain.com login myself password secret\n" +"\n" +" --netrc-optional\n" +, stdout); + fputs( +" Very similar to --netrc, but this option makes the .netrc usage\n" +" optional and not mandatory as the --netrc option does.\n" +"\n" +" --negotiate\n" +" (HTTP) Enables GSS-Negotiate authentication. The GSS-Negotiate\n" +" method was designed by Microsoft and is used in their web appli-\n" +" cations. It is primarily meant as a support for Kerberos5\n" +" authentication but may be also used along with another authenti-\n" +, stdout); + fputs( +" cation method. For more information see IETF draft draft-brezak-\n" +" spnego-http-04.txt.\n" +"\n" +" If you want to enable Negotiate for your proxy authentication,\n" +" then use --proxy-negotiate.\n" +"\n" +" This option requires a library built with GSSAPI support. This\n" +" is not very common. Use -V/--version to see if your version sup-\n" +" ports GSS-Negotiate.\n" +"\n" +, stdout); + fputs( +" When using this option, you must also provide a fake -u/--user\n" +" option to activate the authentication code properly. Sending a\n" +" '-u :' is enough as the user name and password from the -u\n" +" option aren't actually used.\n" +"\n" +" If this option is used several times, the following occurrences\n" +" make no difference.\n" +"\n" +" -N/--no-buffer\n" +" Disables the buffering of the output stream. In normal work sit-\n" +, stdout); + fputs( +" uations, curl will use a standard buffered output stream that\n" +" will have the effect that it will output the data in chunks, not\n" +" necessarily exactly when the data arrives. Using this option\n" +" will disable that buffering.\n" +"\n" +" Note that this is the negated option name documented. You can\n" +" thus use --buffer to enforce the buffering.\n" +"\n" +" --no-keepalive\n" +, stdout); + fputs( +" Disables the use of keepalive messages on the TCP connection, as\n" +" by default curl enables them.\n" +"\n" +" Note that this is the negated option name documented. You can\n" +" thus use --keepalive to enforce keepalive.\n" +"\n" +" --no-sessionid\n" +" (SSL) Disable curl's use of SSL session-ID caching. By default\n" +" all transfers are done using the cache. Note that while nothing\n" +, stdout); + fputs( +" should ever get hurt by attempting to reuse SSL session-IDs,\n" +" there seem to be broken SSL implementations in the wild that may\n" +" require you to disable this in order for you to succeed. (Added\n" +" in 7.16.0)\n" +"\n" +" Note that this is the negated option name documented. You can\n" +" thus use --sessionid to enforce session-ID caching.\n" +"\n" +" --noproxy \n" +, stdout); + fputs( +" Comma-separated list of hosts which do not use a proxy, if one\n" +" is specified. The only wildcard is a single * character, which\n" +" matches all hosts, and effectively disables the proxy. Each name\n" +" in this list is matched as either a domain which contains the\n" +" hostname, or the hostname itself. For example, local.com would\n" +" match local.com, local.com:80, and www.local.com, but not\n" +, stdout); + fputs( +" www.notlocal.com. (Added in 7.19.4).\n" +"\n" +" --ntlm (HTTP) Enables NTLM authentication. The NTLM authentication\n" +" method was designed by Microsoft and is used by IIS web servers.\n" +" It is a proprietary protocol, reverse-engineered by clever peo-\n" +" ple and implemented in curl based on their efforts. This kind of\n" +" behavior should not be endorsed, you should encourage everyone\n" +, stdout); + fputs( +" who uses NTLM to switch to a public and documented authentica-\n" +" tion method instead, such as Digest.\n" +"\n" +" If you want to enable NTLM for your proxy authentication, then\n" +" use --proxy-ntlm.\n" +"\n" +" This option requires a library built with SSL support. Use\n" +" -V/--version to see if your curl supports NTLM.\n" +"\n" +" If this option is used several times, the following occurrences\n" +" make no difference.\n" +"\n" +, stdout); + fputs( +" -o/--output \n" +" Write output to instead of stdout. If you are using {} or\n" +" [] to fetch multiple documents, you can use '#' followed by a\n" +" number in the specifier. That variable will be replaced\n" +" with the current string for the URL being fetched. Like in:\n" +"\n" +" curl http://{one,two}.site.com -o \"file_#1.txt\"\n" +"\n" +" or use several variables like:\n" +"\n" +, stdout); + fputs( +" curl http://{site,host}.host[1-5].com -o \"#1_#2\"\n" +"\n" +" You may use this option as many times as the number of URLs you\n" +" have.\n" +"\n" +" See also the --create-dirs option to create the local directo-\n" +" ries dynamically. Specifying the output as '-' (a single dash)\n" +" will force the output to be done to stdout.\n" +"\n" +" -O/--remote-name\n" +" Write output to a local file named like the remote file we get.\n" +, stdout); + fputs( +" (Only the file part of the remote file is used, the path is cut\n" +" off.)\n" +"\n" +" The remote file name to use for saving is extracted from the\n" +" given URL, nothing else.\n" +"\n" +" You may use this option as many times as the number of URLs you\n" +" have.\n" +"\n" +" --remote-name-all\n" +" This option changes the default action for all given URLs to be\n" +, stdout); + fputs( +" dealt with as if -O/--remote-name were used for each one. So if\n" +" you want to disable that for a specific URL after --remote-name-\n" +" all has been used, you must use \"-o -\" or --no-remote-name.\n" +" (Added in 7.19.0)\n" +"\n" +" --pass \n" +" (SSL/SSH) Passphrase for the private key\n" +"\n" +" If this option is used several times, the last one will be used.\n" +"\n" +" --post301\n" +, stdout); + fputs( +" Tells curl to respect RFC 2616/10.3.2 and not convert POST\n" +" requests into GET requests when following a 301 redirection. The\n" +" non-RFC behaviour is ubiquitous in web browsers, so curl does\n" +" the conversion by default to maintain consistency. However, a\n" +" server may require a POST to remain a POST after such a redi-\n" +" rection. This option is meaningful only when using -L/--location\n" +, stdout); + fputs( +" (Added in 7.17.1)\n" +"\n" +" --post302\n" +" Tells curl to respect RFC 2616/10.3.2 and not convert POST\n" +" requests into GET requests when following a 302 redirection. The\n" +" non-RFC behaviour is ubiquitous in web browsers, so curl does\n" +" the conversion by default to maintain consistency. However, a\n" +" server may require a POST to remain a POST after such a redi-\n" +, stdout); + fputs( +" rection. This option is meaningful only when using -L/--location\n" +" (Added in 7.19.1)\n" +"\n" +" --proto \n" +" Tells curl to use the listed protocols for its initial\n" +" retrieval. Protocols are evaluated left to right, are comma sep-\n" +" arated, and are each a protocol name or 'all', optionally pre-\n" +" fixed by zero or more modifiers. Available modifiers are:\n" +"\n" +, stdout); + fputs( +" + Permit this protocol in addition to protocols already permit-\n" +" ted (this is the default if no modifier is used).\n" +"\n" +" - Deny this protocol, removing it from the list of protocols\n" +" already permitted.\n" +"\n" +" = Permit only this protocol (ignoring the list already permit-\n" +" ted), though subject to later modification by subsequent\n" +" entries in the comma separated list.\n" +"\n" +, stdout); + fputs( +" For example:\n" +"\n" +" --proto -ftps uses the default protocols, but disables ftps\n" +"\n" +" --proto -all,https,+http\n" +" only enables http and https\n" +"\n" +" --proto =http,https\n" +" also only enables http and https\n" +"\n" +" Unknown protocols produce a warning. This allows scripts to\n" +" safely rely on being able to disable potentially dangerous pro-\n" +, stdout); + fputs( +" tocols, without relying upon support for that protocol being\n" +" built into curl to avoid an error.\n" +"\n" +" This option can be used multiple times, in which case the effect\n" +" is the same as concatenating the protocols into one instance of\n" +" the option.\n" +"\n" +" (Added in 7.20.2)\n" +"\n" +" --proto-redir \n" +" Tells curl to use the listed protocols after a redirect. See\n" +, stdout); + fputs( +" --proto for how protocols are represented.\n" +"\n" +" (Added in 7.20.2)\n" +"\n" +" --proxy-anyauth\n" +" Tells curl to pick a suitable authentication method when commu-\n" +" nicating with the given proxy. This might cause an extra\n" +" request/response round-trip. (Added in 7.13.2)\n" +"\n" +" --proxy-basic\n" +" Tells curl to use HTTP Basic authentication when communicating\n" +, stdout); + fputs( +" with the given proxy. Use --basic for enabling HTTP Basic with a\n" +" remote host. Basic is the default authentication method curl\n" +" uses with proxies.\n" +"\n" +" --proxy-digest\n" +" Tells curl to use HTTP Digest authentication when communicating\n" +" with the given proxy. Use --digest for enabling HTTP Digest with\n" +" a remote host.\n" +"\n" +" --proxy-negotiate\n" +, stdout); + fputs( +" Tells curl to use HTTP Negotiate authentication when communicat-\n" +" ing with the given proxy. Use --negotiate for enabling HTTP\n" +" Negotiate with a remote host. (Added in 7.17.1)\n" +"\n" +" --proxy-ntlm\n" +" Tells curl to use HTTP NTLM authentication when communicating\n" +" with the given proxy. Use --ntlm for enabling NTLM with a remote\n" +" host.\n" +"\n" +" --proxy1.0 \n" +, stdout); + fputs( +" Use the specified HTTP 1.0 proxy. If the port number is not\n" +" specified, it is assumed at port 1080.\n" +"\n" +" The only difference between this and the HTTP proxy option\n" +" (-x/--proxy), is that attempts to use CONNECT through the proxy\n" +" will specify an HTTP 1.0 protocol instead of the default HTTP\n" +" 1.1.\n" +"\n" +" -p/--proxytunnel\n" +" When an HTTP proxy is used (-x/--proxy), this option will cause\n" +, stdout); + fputs( +" non-HTTP protocols to attempt to tunnel through the proxy\n" +" instead of merely using it to do HTTP-like operations. The tun-\n" +" nel approach is made with the HTTP proxy CONNECT request and\n" +" requires that the proxy allows direct connect to the remote port\n" +" number curl wants to tunnel through to.\n" +"\n" +" --pubkey \n" +" (SSH) Public key file name. Allows you to provide your public\n" +, stdout); + fputs( +" key in this separate file.\n" +"\n" +" If this option is used several times, the last one will be used.\n" +"\n" +" -P/--ftp-port
\n" +" (FTP) Reverses the default initiator/listener roles when con-\n" +" necting with FTP. This switch makes curl use active mode. In\n" +" practice, curl then tells the server to connect back to the\n" +" client's specified address and port, while passive mode asks the\n" +, stdout); + fputs( +" server to setup an IP address and port for it to connect to.\n" +"
should be one of:\n" +"\n" +" interface\n" +" i.e \"eth0\" to specify which interface's IP address you\n" +" want to use (Unix only)\n" +"\n" +" IP address\n" +" i.e \"192.168.10.1\" to specify the exact IP address\n" +"\n" +" host name\n" +" i.e \"my.host.domain\" to specify the machine\n" +"\n" +, stdout); + fputs( +" - make curl pick the same IP address that is already used\n" +" for the control connection\n" +"\n" +" If this option is used several times, the last one will be used. Dis-\n" +" able the use of PORT with --ftp-pasv. Disable the attempt to use the\n" +" EPRT command instead of PORT by using --disable-eprt. EPRT is really\n" +" PORT++.\n" +"\n" +" Starting in 7.19.5, you can append \":[start]-[end]\" to the right of the\n" +, stdout); + fputs( +" address, to tell curl what TCP port range to use. That means you spec-\n" +" ify a port range, from a lower to a higher number. A single number\n" +" works as well, but do note that it increases the risk of failure since\n" +" the port may not be available.\n" +"\n" +" -q If used as the first parameter on the command line, the curlrc\n" +" config file will not be read and used. See the -K/--config for\n" +" details on the default config file search path.\n" +"\n" +, stdout); + fputs( +" -Q/--quote \n" +" (FTP/SFTP) Send an arbitrary command to the remote FTP or SFTP\n" +" server. Quote commands are sent BEFORE the transfer takes place\n" +" (just after the initial PWD command in an FTP transfer, to be\n" +" exact). To make commands take place after a successful transfer,\n" +" prefix them with a dash '-'. To make commands be sent after\n" +, stdout); + fputs( +" libcurl has changed the working directory, just before the\n" +" transfer command(s), prefix the command with a '+' (this is only\n" +" supported for FTP). You may specify any number of commands. If\n" +" the server returns failure for one of the commands, the entire\n" +" operation will be aborted. You must send syntactically correct\n" +" FTP commands as RFC959 defines to FTP servers, or one of the\n" +, stdout); + fputs( +" commands listed below to SFTP servers. This option can be used\n" +" multiple times.\n" +"\n" +" SFTP is a binary protocol. Unlike for FTP, libcurl interprets\n" +" SFTP quote commands before sending them to the server. Follow-\n" +" ing is the list of all supported SFTP quote commands:\n" +"\n" +" chgrp group file\n" +" The chgrp command sets the group ID of the file named by\n" +, stdout); + fputs( +" the file operand to the group ID specified by the group\n" +" operand. The group operand is a decimal integer group ID.\n" +"\n" +" chmod mode file\n" +" The chmod command modifies the file mode bits of the\n" +" specified file. The mode operand is an octal integer mode\n" +" number.\n" +"\n" +" chown user file\n" +" The chown command sets the owner of the file named by the\n" +, stdout); + fputs( +" file operand to the user ID specified by the user oper-\n" +" and. The user operand is a decimal integer user ID.\n" +"\n" +" ln source_file target_file\n" +" The ln and symlink commands create a symbolic link at the\n" +" target_file location pointing to the source_file loca-\n" +" tion.\n" +"\n" +" mkdir directory_name\n" +" The mkdir command creates the directory named by the\n" +, stdout); + fputs( +" directory_name operand.\n" +"\n" +" pwd The pwd command returns the absolute pathname of the cur-\n" +" rent working directory.\n" +"\n" +" rename source target\n" +" The rename command renames the file or directory named by\n" +" the source operand to the destination path named by the\n" +" target operand.\n" +"\n" +" rm file\n" +, stdout); + fputs( +" The rm command removes the file specified by the file op-\n" +" erand.\n" +"\n" +" rmdir directory\n" +" The rmdir command removes the directory entry specified\n" +" by the directory operand, provided it is empty.\n" +"\n" +" symlink source_file target_file\n" +" See ln.\n" +"\n" +" --random-file \n" +" (SSL) Specify the path name to file containing what will be con-\n" +, stdout); + fputs( +" sidered as random data. The data is used to seed the random\n" +" engine for SSL connections. See also the --egd-file option.\n" +"\n" +" -r/--range \n" +" (HTTP/FTP/SFTP/FILE) Retrieve a byte range (i.e a partial docu-\n" +" ment) from a HTTP/1.1, FTP or SFTP server or a local FILE.\n" +" Ranges can be specified in a number of ways.\n" +"\n" +" 0-499 specifies the first 500 bytes\n" +"\n" +, stdout); + fputs( +" 500-999 specifies the second 500 bytes\n" +"\n" +" -500 specifies the last 500 bytes\n" +"\n" +" 9500- specifies the bytes from offset 9500 and forward\n" +"\n" +" 0-0,-1 specifies the first and last byte only(*)(H)\n" +"\n" +" 500-700,600-799\n" +" specifies 300 bytes from offset 500(H)\n" +"\n" +" 100-199,500-599\n" +" specifies two separate 100-byte ranges(*)(H)\n" +"\n" +, stdout); + fputs( +" (*) = NOTE that this will cause the server to reply with a multipart\n" +" response!\n" +"\n" +" Only digit characters (0-9) are valid in the 'start' and 'stop' fields\n" +" of the 'start-stop' range syntax. If a non-digit character is given in\n" +" the range, the server's response will be unspecified, depending on the\n" +" server's configuration.\n" +"\n" +" You should also be aware that many HTTP/1.1 servers do not have this\n" +, stdout); + fputs( +" feature enabled, so that when you attempt to get a range, you'll\n" +" instead get the whole document.\n" +"\n" +" FTP and SFTP range downloads only support the simple 'start-stop' syn-\n" +" tax (optionally with one of the numbers omitted). FTP use depends on\n" +" the extended FTP command SIZE.\n" +"\n" +" If this option is used several times, the last one will be used.\n" +"\n" +" --raw When used, it disables all internal HTTP decoding of content or\n" +, stdout); + fputs( +" transfer encodings and instead makes them passed on unaltered,\n" +" raw. (Added in 7.16.2)\n" +"\n" +" -R/--remote-time\n" +" When used, this will make libcurl attempt to figure out the\n" +" timestamp of the remote file, and if that is available make the\n" +" local file get that same timestamp.\n" +"\n" +" --resolve \n" +" Provide a custom address for a specific host and port pair.\n" +, stdout); + fputs( +" Using this, you can make the curl requests(s) use a specified\n" +" address and prevent the otherwise normally resolved address to\n" +" be used. Consider it a sort of /etc/hosts alternative provided\n" +" on the command line. The port number should be the number used\n" +" for the specific protocol the host will be used for. It means\n" +" you need several entries if you want to provide address for the\n" +, stdout); + fputs( +" same host but different ports.\n" +"\n" +" This option can be used many times to add many host names to\n" +" resolve.\n" +"\n" +" (Added in 7.21.3)\n" +"\n" +" --retry \n" +" If a transient error is returned when curl tries to perform a\n" +" transfer, it will retry this number of times before giving up.\n" +" Setting the number to 0 makes curl do no retries (which is the\n" +, stdout); + fputs( +" default). Transient error means either: a timeout, an FTP 4xx\n" +" response code or an HTTP 5xx response code.\n" +"\n" +" When curl is about to retry a transfer, it will first wait one\n" +" second and then for all forthcoming retries it will double the\n" +" waiting time until it reaches 10 minutes which then will be the\n" +" delay between the rest of the retries. By using --retry-delay\n" +, stdout); + fputs( +" you disable this exponential backoff algorithm. See also\n" +" --retry-max-time to limit the total time allowed for retries.\n" +" (Added in 7.12.3)\n" +"\n" +" If this option is used multiple times, the last occurrence\n" +" decide the amount.\n" +"\n" +" --retry-delay \n" +" Make curl sleep this amount of time before each retry when a\n" +" transfer has failed with a transient error (it changes the\n" +, stdout); + fputs( +" default backoff time algorithm between retries). This option is\n" +" only interesting if --retry is also used. Setting this delay to\n" +" zero will make curl use the default backoff time. (Added in\n" +" 7.12.3)\n" +"\n" +" If this option is used multiple times, the last occurrence\n" +" determines the amount.\n" +"\n" +" --retry-max-time \n" +" The retry timer is reset before the first transfer attempt.\n" +, stdout); + fputs( +" Retries will be done as usual (see --retry) as long as the timer\n" +" hasn't reached this given limit. Notice that if the timer hasn't\n" +" reached the limit, the request will be made and while perform-\n" +" ing, it may take longer than this given time period. To limit a\n" +" single request's maximum time, use -m/--max-time. Set this\n" +" option to zero to not timeout retries. (Added in 7.12.3)\n" +"\n" +, stdout); + fputs( +" If this option is used multiple times, the last occurrence\n" +" determines the amount.\n" +"\n" +" -s/--silent\n" +" Silent or quiet mode. Don't show progress meter or error mes-\n" +" sages. Makes Curl mute.\n" +"\n" +" -S/--show-error\n" +" When used with -s it makes curl show an error message if it\n" +" fails.\n" +"\n" +" --socks4 \n" +" Use the specified SOCKS4 proxy. If the port number is not speci-\n" +, stdout); + fputs( +" fied, it is assumed at port 1080. (Added in 7.15.2)\n" +"\n" +" This option overrides any previous use of -x/--proxy, as they\n" +" are mutually exclusive.\n" +"\n" +" If this option is used several times, the last one will be used.\n" +"\n" +" --socks4a \n" +" Use the specified SOCKS4a proxy. If the port number is not spec-\n" +" ified, it is assumed at port 1080. (Added in 7.18.0)\n" +"\n" +, stdout); + fputs( +" This option overrides any previous use of -x/--proxy, as they\n" +" are mutually exclusive.\n" +"\n" +" If this option is used several times, the last one will be used.\n" +"\n" +" --socks5-hostname \n" +" Use the specified SOCKS5 proxy (and let the proxy resolve the\n" +" host name). If the port number is not specified, it is assumed\n" +" at port 1080. (Added in 7.18.0)\n" +"\n" +, stdout); + fputs( +" This option overrides any previous use of -x/--proxy, as they\n" +" are mutually exclusive.\n" +"\n" +" If this option is used several times, the last one will be used.\n" +" (This option was previously wrongly documented and used as\n" +" --socks without the number appended.)\n" +"\n" +" --socks5 \n" +" Use the specified SOCKS5 proxy - but resolve the host name\n" +, stdout); + fputs( +" locally. If the port number is not specified, it is assumed at\n" +" port 1080.\n" +"\n" +" This option overrides any previous use of -x/--proxy, as they\n" +" are mutually exclusive.\n" +"\n" +" If this option is used several times, the last one will be used.\n" +" (This option was previously wrongly documented and used as\n" +" --socks without the number appended.)\n" +"\n" +, stdout); + fputs( +" This option (as well as --socks4) does not work with IPV6, FTPS\n" +" or LDAP.\n" +"\n" +" --socks5-gssapi-service \n" +" The default service name for a socks server is rcmd/server-fqdn.\n" +" This option allows you to change it.\n" +"\n" +" Examples:\n" +" --socks5 proxy-name --socks5-gssapi-service sockd would use\n" +" sockd/proxy-name\n" +" --socks5 proxy-name --socks5-gssapi-service sockd/real-name\n" +, stdout); + fputs( +" would use sockd/real-name for cases where the proxy-name does\n" +" not match the princpal name.\n" +" (Added in 7.19.4).\n" +"\n" +" --socks5-gssapi-nec\n" +" As part of the gssapi negotiation a protection mode is negoti-\n" +" ated. The rfc1961 says in section 4.3/4.4 it should be pro-\n" +" tected, but the NEC reference implementation does not. The\n" +" option --socks5-gssapi-nec allows the unprotected exchange of\n" +, stdout); + fputs( +" the protection mode negotiation. (Added in 7.19.4).\n" +"\n" +" --stderr \n" +" Redirect all writes to stderr to the specified file instead. If\n" +" the file name is a plain '-', it is instead written to stdout.\n" +" This option has no point when you're using a shell with decent\n" +" redirecting capabilities.\n" +"\n" +" If this option is used several times, the last one will be used.\n" +"\n" +" --tcp-nodelay\n" +, stdout); + fputs( +" Turn on the TCP_NODELAY option. See the curl_easy_setopt(3) man\n" +" page for details about this option. (Added in 7.11.2)\n" +"\n" +" -t/--telnet-option \n" +" Pass options to the telnet protocol. Supported options are:\n" +"\n" +" TTYPE= Sets the terminal type.\n" +"\n" +" XDISPLOC= Sets the X display location.\n" +"\n" +" NEW_ENV= Sets an environment variable.\n" +"\n" +" --tftp-blksize \n" +, stdout); + fputs( +" (TFTP) Set TFTP BLKSIZE option (must be >512). This is the block\n" +" size that curl will try to use when tranferring data to or from\n" +" a TFTP server. By default 512 bytes will be used.\n" +"\n" +" If this option is used several times, the last one will be used.\n" +"\n" +" (Added in 7.20.0)\n" +"\n" +" -T/--upload-file \n" +" This transfers the specified local file to the remote URL. If\n" +, stdout); + fputs( +" there is no file part in the specified URL, Curl will append the\n" +" local file name. NOTE that you must use a trailing / on the last\n" +" directory to really prove to Curl that there is no file name or\n" +" curl will think that your last directory name is the remote file\n" +" name to use. That will most likely cause the upload operation to\n" +" fail. If this is used on a HTTP(S) server, the PUT command will\n" +" be used.\n" +"\n" +, stdout); + fputs( +" Use the file name \"-\" (a single dash) to use stdin instead of a\n" +" given file. Alternately, the file name \".\" (a single period)\n" +" may be specified instead of \"-\" to use stdin in non-blocking\n" +" mode to allow reading server output while stdin is being\n" +" uploaded.\n" +"\n" +" You can specify one -T for each URL on the command line. Each -T\n" +, stdout); + fputs( +" + URL pair specifies what to upload and to where. curl also sup-\n" +" ports \"globbing\" of the -T argument, meaning that you can upload\n" +" multiple files to a single URL by using the same URL globbing\n" +" style supported in the URL, like this:\n" +"\n" +" curl -T \"{file1,file2}\" http://www.uploadtothissite.com\n" +"\n" +" or even\n" +"\n" +" curl -T \"img[1-1000].png\" ftp://ftp.picturemania.com/upload/\n" +"\n" +" --trace \n" +, stdout); + fputs( +" Enables a full trace dump of all incoming and outgoing data,\n" +" including descriptive information, to the given output file. Use\n" +" \"-\" as filename to have the output sent to stdout.\n" +"\n" +" This option overrides previous uses of -v/--verbose or --trace-\n" +" ascii.\n" +"\n" +" If this option is used several times, the last one will be used.\n" +"\n" +" --trace-ascii \n" +, stdout); + fputs( +" Enables a full trace dump of all incoming and outgoing data,\n" +" including descriptive information, to the given output file. Use\n" +" \"-\" as filename to have the output sent to stdout.\n" +"\n" +" This is very similar to --trace, but leaves out the hex part and\n" +" only shows the ASCII part of the dump. It makes smaller output\n" +" that might be easier to read for untrained humans.\n" +"\n" +, stdout); + fputs( +" This option overrides previous uses of -v/--verbose or --trace.\n" +"\n" +" If this option is used several times, the last one will be used.\n" +"\n" +" --trace-time\n" +" Prepends a time stamp to each trace or verbose line that curl\n" +" displays. (Added in 7.14.0)\n" +"\n" +" -u/--user \n" +" Specify the user name and password to use for server authentica-\n" +" tion. Overrides -n/--netrc and --netrc-optional.\n" +"\n" +, stdout); + fputs( +" If you just give the user name (without entering a colon) curl\n" +" will prompt for a password.\n" +"\n" +" If you use an SSPI-enabled curl binary and do NTLM authentica-\n" +" tion, you can force curl to pick up the user name and password\n" +" from your environment by simply specifying a single colon with\n" +" this option: \"-u :\".\n" +"\n" +" If this option is used several times, the last one will be used.\n" +"\n" +, stdout); + fputs( +" -U/--proxy-user \n" +" Specify the user name and password to use for proxy authentica-\n" +" tion.\n" +"\n" +" If you use an SSPI-enabled curl binary and do NTLM authentica-\n" +" tion, you can force curl to pick up the user name and password\n" +" from your environment by simply specifying a single colon with\n" +" this option: \"-U :\".\n" +"\n" +" If this option is used several times, the last one will be used.\n" +"\n" +, stdout); + fputs( +" --url \n" +" Specify a URL to fetch. This option is mostly handy when you\n" +" want to specify URL(s) in a config file.\n" +"\n" +" This option may be used any number of times. To control where\n" +" this URL is written, use the -o/--output or the -O/--remote-name\n" +" options.\n" +"\n" +" -v/--verbose\n" +" Makes the fetching more verbose/talkative. Mostly useful for\n" +, stdout); + fputs( +" debugging. A line starting with '>' means \"header data\" sent by\n" +" curl, '<' means \"header data\" received by curl that is hidden in\n" +" normal cases, and a line starting with '*' means additional info\n" +" provided by curl.\n" +"\n" +" Note that if you only want HTTP headers in the output,\n" +" -i/--include might be the option you're looking for.\n" +"\n" +" If you think this option still doesn't give you enough details,\n" +, stdout); + fputs( +" consider using --trace or --trace-ascii instead.\n" +"\n" +" This option overrides previous uses of --trace-ascii or --trace.\n" +"\n" +" Use -S/--silent to make curl quiet.\n" +"\n" +" -V/--version\n" +" Displays information about curl and the libcurl version it uses.\n" +" The first line includes the full version of curl, libcurl and\n" +" other 3rd party libraries linked with the executable.\n" +"\n" +, stdout); + fputs( +" The second line (starts with \"Protocols:\") shows all protocols\n" +" that libcurl reports to support.\n" +"\n" +" The third line (starts with \"Features:\") shows specific features\n" +" libcurl reports to offer. Available features include:\n" +"\n" +" IPv6 You can use IPv6 with this.\n" +"\n" +" krb4 Krb4 for FTP is supported.\n" +"\n" +" SSL HTTPS and FTPS are supported.\n" +"\n" +, stdout); + fputs( +" libz Automatic decompression of compressed files over HTTP is\n" +" supported.\n" +"\n" +" NTLM NTLM authentication is supported.\n" +"\n" +" GSS-Negotiate\n" +" Negotiate authentication and krb5 for FTP is supported.\n" +"\n" +" Debug This curl uses a libcurl built with Debug. This enables\n" +" more error-tracking and memory debugging etc. For curl-\n" +" developers only!\n" +"\n" +" AsynchDNS\n" +, stdout); + fputs( +" This curl uses asynchronous name resolves.\n" +"\n" +" SPNEGO SPNEGO Negotiate authentication is supported.\n" +"\n" +" Largefile\n" +" This curl supports transfers of large files, files larger\n" +" than 2GB.\n" +"\n" +" IDN This curl supports IDN - international domain names.\n" +"\n" +" SSPI SSPI is supported. If you use NTLM and set a blank user\n" +, stdout); + fputs( +" name, curl will authenticate with your current user and\n" +" password.\n" +"\n" +" -w/--write-out \n" +" Defines what to display on stdout after a completed and success-\n" +" ful operation. The format is a string that may contain plain\n" +" text mixed with any number of variables. The string can be spec-\n" +" ified as \"string\", to get read from a particular file you spec-\n" +, stdout); + fputs( +" ify it \"@filename\" and to tell curl to read the format from\n" +" stdin you write \"@-\".\n" +"\n" +" The variables present in the output format will be substituted\n" +" by the value or text that curl thinks fit, as described below.\n" +" All variables are specified as %{variable_name} and to output a\n" +" normal % you just write them as %%. You can output a newline by\n" +, stdout); + fputs( +" using \\n, a carriage return with \\r and a tab space with \\t.\n" +"\n" +" NOTE: The %-symbol is a special symbol in the win32-environment,\n" +" where all occurrences of % must be doubled when using this\n" +" option.\n" +"\n" +" The variables available at this point are:\n" +"\n" +" url_effective The URL that was fetched last. This is most mean-\n" +" ingful if you've told curl to follow location:\n" +, stdout); + fputs( +" headers.\n" +"\n" +" http_code The numerical response code that was found in the\n" +" last retrieved HTTP(S) or FTP(s) transfer. In\n" +" 7.18.2 the alias response_code was added to show\n" +" the same info.\n" +"\n" +" http_connect The numerical code that was found in the last\n" +" response (from a proxy) to a curl CONNECT\n" +, stdout); + fputs( +" request. (Added in 7.12.4)\n" +"\n" +" time_total The total time, in seconds, that the full opera-\n" +" tion lasted. The time will be displayed with mil-\n" +" lisecond resolution.\n" +"\n" +" time_namelookup\n" +" The time, in seconds, it took from the start\n" +" until the name resolving was completed.\n" +"\n" +, stdout); + fputs( +" time_connect The time, in seconds, it took from the start\n" +" until the TCP connect to the remote host (or\n" +" proxy) was completed.\n" +"\n" +" time_appconnect\n" +" The time, in seconds, it took from the start\n" +" until the SSL/SSH/etc connect/handshake to the\n" +" remote host was completed. (Added in 7.19.0)\n" +"\n" +, stdout); + fputs( +" time_pretransfer\n" +" The time, in seconds, it took from the start\n" +" until the file transfer was just about to begin.\n" +" This includes all pre-transfer commands and nego-\n" +" tiations that are specific to the particular pro-\n" +" tocol(s) involved.\n" +"\n" +" time_redirect The time, in seconds, it took for all redirection\n" +, stdout); + fputs( +" steps include name lookup, connect, pretransfer\n" +" and transfer before the final transaction was\n" +" started. time_redirect shows the complete execu-\n" +" tion time for multiple redirections. (Added in\n" +" 7.12.3)\n" +"\n" +" time_starttransfer\n" +" The time, in seconds, it took from the start\n" +, stdout); + fputs( +" until the first byte was just about to be trans-\n" +" ferred. This includes time_pretransfer and also\n" +" the time the server needed to calculate the\n" +" result.\n" +"\n" +" size_download The total amount of bytes that were downloaded.\n" +"\n" +" size_upload The total amount of bytes that were uploaded.\n" +"\n" +, stdout); + fputs( +" size_header The total amount of bytes of the downloaded head-\n" +" ers.\n" +"\n" +" size_request The total amount of bytes that were sent in the\n" +" HTTP request.\n" +"\n" +" speed_download The average download speed that curl measured for\n" +" the complete download. Bytes per second.\n" +"\n" +" speed_upload The average upload speed that curl measured for\n" +, stdout); + fputs( +" the complete upload. Bytes per second.\n" +"\n" +" content_type The Content-Type of the requested document, if\n" +" there was any.\n" +"\n" +" num_connects Number of new connects made in the recent trans-\n" +" fer. (Added in 7.12.3)\n" +"\n" +" num_redirects Number of redirects that were followed in the\n" +" request. (Added in 7.12.3)\n" +"\n" +, stdout); + fputs( +" redirect_url When a HTTP request was made without -L to follow\n" +" redirects, this variable will show the actual URL\n" +" a redirect would take you to. (Added in 7.18.2)\n" +"\n" +" ftp_entry_path The initial path libcurl ended up in when logging\n" +" on to the remote FTP server. (Added in 7.15.4)\n" +"\n" +" ssl_verify_result\n" +, stdout); + fputs( +" The result of the SSL peer certificate verifica-\n" +" tion that was requested. 0 means the verification\n" +" was successful. (Added in 7.19.0)\n" +"\n" +" If this option is used several times, the last one will be used.\n" +"\n" +" -x/--proxy \n" +" Use the specified HTTP proxy. If the port number is not speci-\n" +" fied, it is assumed at port 1080.\n" +"\n" +, stdout); + fputs( +" This option overrides existing environment variables that set\n" +" the proxy to use. If there's an environment variable setting a\n" +" proxy, you can set proxy to \"\" to override it.\n" +"\n" +" Note that all operations that are performed over a HTTP proxy\n" +" will transparently be converted to HTTP. It means that certain\n" +" protocol specific operations might not be available. This is not\n" +, stdout); + fputs( +" the case if you can tunnel through the proxy, as done with the\n" +" -p/--proxytunnel option.\n" +"\n" +" Starting with 7.14.1, the proxy host can be specified the exact\n" +" same way as the proxy environment variables, including the pro-\n" +" tocol prefix (http://) and the embedded user + password.\n" +"\n" +" If this option is used several times, the last one will be used.\n" +"\n" +" -X/--request \n" +, stdout); + fputs( +" (HTTP) Specifies a custom request method to use when communicat-\n" +" ing with the HTTP server. The specified request will be used\n" +" instead of the method otherwise used (which defaults to GET).\n" +" Read the HTTP 1.1 specification for details and explanations.\n" +" Common additional HTTP requests include PUT and DELETE, but\n" +" related technologies like WebDAV offers PROPFIND, COPY, MOVE and\n" +" more.\n" +"\n" +, stdout); + fputs( +" (FTP) Specifies a custom FTP command to use instead of LIST when\n" +" doing file lists with FTP.\n" +"\n" +" If this option is used several times, the last one will be used.\n" +"\n" +" -y/--speed-time