/******************************************************************************
 * mod_uploader / mod_uploader.h
 ******************************************************************************
 * Copyright (C) 2005 Tetsuya Kimata <kimata@acapulco.dyndns.org>
 *
 * All rights reserved.
 *
 * This software is provided 'as-is', without any express or implied
 * warranty.  In no event will the authors be held liable for any
 * damages arising from the use of this software.
 *
 * Permission is granted to anyone to use this software for any
 * purpose, including commercial applications, and to alter it and
 * redistribute it freely, subject to the following restrictions:
 *
 * 1. The origin of this software must not be misrepresented; you must
 *    not claim that you wrote the original software. If you use this
 *    software in a product, an acknowledgment in the product
 *    documentation would be appreciated but is not required.
 *
 * 2. Altered source versions must be plainly marked as such, and must
 *    not be misrepresented as being the original software.
 *
 * 3. This notice may not be removed or altered from any source
 *    distribution.
 *
 * $Id: mod_uploader.h.in 658 2005-09-08 16:17:34Z svn $
 *****************************************************************************/

#ifndef MOD_UPLOADER_H
#define MOD_UPLOADER_H

#include "http_protocol.h"
#include "http_request.h"
#include "http_log.h"

#include "ap_config.h"
#include "ap_release.h"
#include "apr_file_info.h"
#include "apr_strings.h"
#include "apr_global_mutex.h"
#include "apr_shm.h"

#undef strtoul

#undef PACKAGE_BUGREPORT
#undef PACKAGE_NAME
#undef PACKAGE_STRING
#undef PACKAGE_TARNAME
#undef PACKAGE_VERSION

#include "mod_uploader_data.h"

#include <iostream>

#ifdef HAVE_CONFIG_H
#include "mod_uploader_config.h"
#endif

const apr_size_t MAX_COMMAND_LENGTH         = 512;
const apr_size_t MAX_COMMAND_NUMBER         = 4;

const apr_size_t SYSTEM_KEY_NUMBER          = 10;

const char FILE_KEY[]                       = "FILE";
const char FILE_LIST_KEY[]                  = "FILE_LIST";
const char PAGE_NUMBER_KEY[]                = "PAGE_NUMBER";
const char CURRENT_PAGE_KEY[]               = "CURRENT_PAGE";
const char TOTAL_FILE_SIZE_KEY[]            = "TOTAL_FILE_SIZE";
const char TOTAL_FILE_SIZE_LIMIT_KEY[]      = "TOTAL_FILE_SIEZE_LIMIT";
const char TOTAL_FILE_NUMBER_KEY[]          = "TOTAL_FILE_NUMBER";
const char MAX_FILE_SIZE_KEY[]              = "MAX_FILE_SIZE";

const char THUMB_LIST_KEY[]                 = "THUMB_LIST";
const char THUMB_NUMBER_KEY[]               = "THUMB_NUMBER";

const char ERROR_MESSAGE_KEY[]              = "ERROR_MESSAGE";

const char URL_PARAM[]                      = "Url";
const char FILE_DIRECTORY_PARAM[]           = "FileDirectory";
const char THUMB_DIRECTORY_PARAM[]          = "ThumbDirectory";
const char TMP_DIRECTORY_PARAM[]            = "TmpDirectory";
const char VIEW_TEMPLATE_FILE_PARAM[]       = "ViewTemplateFile";
const char PROGRESS_TEMPLATE_FILE_PARAM[]   = "ProgressTemplateFile";
const char DOWNLOAD_TEMPLATE_FILE_PARAM[]   = "DownloadTemplateFile";
const char THUMB_TEMPLATE_FILE_PARAM[]      = "ThumbTemplateFile";
const char ERROR_TEMPLATE_FILE_PARAM[]      = "ErrorTemplateFile";
const char MAX_FILE_SIZE_PARAM[]            = "MaxFileSize";
const char TOTAL_FILE_SIZE_LIMIT_PARAM[]    = "TotalFileSizeLimit";
const char TOTAL_FILE_NUMBER_LIMIT_PARAM[]  = "TotalFileNumberLimit";
const char PER_PAGE_ITEM_NUMBER_PARAM[]     = "PerPageItemNumber";

const char ACCEPT_ENCODING[]                = "Accept-Encoding";
const char GZIP[]                           = "gzip";

const char UPLOAD_COMMAND[]                 = "upload";
const char PROGRESS_COMMAND[]               = "progress";
const char PROGRESS_DATA_COMMAND[]          = "progress_data";
const char DOWNLOAD_COMMAND[]               = "download";
const char REMOVE_COMMAND[]                 = "remove";
const char RSS_COMMAND[]                    = "rss";
const char THUMBNAIL_COMMAND[]              = "thumbnail";
const char IMAGE_COMMAND[]                  = "image";

const char IE_NAME_CODE[]                   = "@IE_NAME_CODE@";
const char FIREFOX_NAME_CODE[]              = "utf-8";


const char USER_DATA_KEY[]                  = PACKAGE_NAME;
const apr_size_t MAX_ERROR_MESSAGE          = 1024;

const char UPLOAD_LOCK_NAME[]               = "." PACKAGE_NAME ".upload_lock";
const char PROGRESS_LOCK_NAME[]             = "." PACKAGE_NAME ".progress_lock";

const char POSTER_LIST_NAME[]               = "." PACKAGE_NAME ".poster_list";
const char PROGRESS_LIST_NAME[]             = "." PACKAGE_NAME ".progress_list";

const apr_size_t POSTER_LIST_NUMBER         = 16;
const apr_size_t PROGRESS_LIST_NUMBER       = 32;

#ifdef DEBUG
const apr_size_t POST_INTERVAL_SEC          = 0;
#else
const apr_size_t POST_INTERVAL_SEC          = UPLOAD_POST_INTERVAL_SEC;
#endif
const apr_size_t PROGRESS_HOLD_SEC          = 30;

// Apache 2.0 系の場合は，AP_NEED_SET_MUTEX_PERMS の define を試みる．
#ifndef AP_SERVER_MAJORVERSION_NUMBER
#if !defined(OS2) && !defined(WIN32) && !defined(BEOS) && !defined(NETWARE)
#define AP_NEED_SET_MUTEX_PERMS
#endif
#endif

#endif

// Local Variables:
// mode: c++
// buffer-file-coding-system: euc-japan-dos
// End:
