diff --git a/CXM_message_constants.anubis b/CXM_message_constants.anubis deleted file mode 100644 index e60aed4..0000000 --- a/CXM_message_constants.anubis +++ /dev/null @@ -1,228 +0,0 @@ -/* - * - * User: David RENÉ - * Date: 07/04/2007 - * Time: 16:06 - * © David RENÉ - * - */ - -public define Word32 _NO_NAME_MSG = 0x00000000. - -// **************** MAILBOX PROTOCOL *************** - -public define Word32 _C_SCAN_FOR_BOXES = 0x33770001. // Ask Boxes to publish their informations -public define Word32 _C_PUBLISH_BOX_STATUS = 0x33770002. // Used by Boxes to publish their informations -public define Word32 _C_SHUTDOWN_BOX = 0x33770003. // Used to ask a box to shutdown -public define Word32 _CXM_SET_BOX_NETWORK_PARAMS = 0x33770004. // Define network configuration of boxes -public define Word32 _CXM_RESET_ADMIN_PWD = 0x33770005. // Ask the MailFountain to reset the admin pwd. -public define Word32 _CXM_FULL_RESET = 0x33770006. // Ask the MailFountain to proceed to a full reset of its data. After that, the MailFountain is totally empty (mail, config, domain, logs, etc...) -public define Word32 _CXM_FORCE_PUBLISH_MF_CONFIG = 0x33770007. // Ask the MailFountain to proceed a Config publishing to DomainManager - - // **************** PACKAGE BUILDER *************** - -public define Word32 _CXM_PKG_MSG_BASIS = 0x33770400. // -public define Word32 _CXM_PKG_CONTAINER = 0x33770401. -public define Word32 _CXM_PKG_HEADER_PART = 0x33770402. // Header Message for Script -public define Word32 _CXM_PKG_SCRIPT_PART = 0x33770403. // Main Message for Script -public define Word32 _CXM_PKG_S_ADD_FILE = 0x33770404. // script action to add file in the destination -public define Word32 _CXM_PKG_S_RUN = 0x33770405. // script action to run a command -public define Word32 _CXM_PKG_INDEX_PART = 0x33770440. // ID of package Index part -public define Word32 _CXM_PKG_IDX_ENTRY = 0x33770441. // Index entry information - - // **************** UPDATE SERVICE *************** - -public define Word32 _CXM_UPDATE_SERVICE_MSG_BASIS = 0x33770800. // -public define Word32 _CXM_UPD_SERVICE_ID = 0x33770801. -public define Word32 _CXM_UPD_HAS_UPDATE = 0x33770802. // -public define Word32 _CXM_UPD_LIST_CLASS_FILES = 0x33770803. // List the files contained in the class path -public define Word32 _CXM_UPD_GET_CLASS_FILE = 0x33770804. // get the file contained in the class path. Return info for download - - // **************** SERVICE NEGOCIATION *************** - -public define Word32 _CXM_SERVICE_NEGOCIATION_BASIS = 0x33770C00. // -public define Word32 _CXM_REQUEST_FOR_SERVICE = 0x33770C01. // -public define Word32 _CXM_LOGIN = 0x33770C02. // - - // **************** GENERIC PROTOCOL *************** - -public define Word32 _CXM_GENERIC_PROTOCOL_BASIS = 0x33771000. // -public define Word32 _CXM_ACK = 0x33771001. // -public define Word32 _CXM_ACK_RESULT_MSG = 0x33771002. // -public define Word32 _CXM_GET_FILE_REF = 0x33771003. //get local or remote file without FTP service - - // **************** FTP SERVICE *************** - -public define Word32 _CXM_FTP_SERVICE_MSG_BASIS = 0x33771400. // -public define Word32 _CXM_FTP_SERVICE_ID = 0x33771401. -public define Word32 _CXM_FTP_GET_FILE = 0x33771402. -public define Word32 _CXM_FTP_START_TRANSFERT = 0x33771403. -public define Word32 _CXM_FTP_DATA = 0x33771404. - - // ************** LOGGER SERVICE ************** - -public define Word32 _CXM_LOGGER_SERVICE_MSG_BASIS = 0x33771800. // -public define Word32 _CXM_LOGGER_SERVICE_ID = 0x33771801. -public define Word32 _CXM_LOGGER_LOG = 0x33771802. -public define Word32 _CXM_LOGGER_REGISTER_UID = 0x33771803. -public define Word32 _CXM_LOGGER_REGISTER_LOG = 0x33771804. - - // ************** DOMAIN SERVICE ************** - -// MF <-> DomainManager -public define Word32 _CXM_DOMAIN_SERVICE_MSG_BASIS = 0x33771C00. // -public define Word32 _CXM_DOMAIN_SERVICE_ID = 0x33771C01. -public define Word32 _CXM_DOMAIN_PUBLISH_MF_CONFIG = 0x33771C02. -public define Word32 _CXM_DOMAIN_GET_NAME = 0x33771C03. -public define Word32 _CXM_DOMAIN_GET_MY_IP = 0x33771C04. -public define Word32 _CXM_DOMAIN_PUBLISH_MY_IP = 0x33771C05. -public define Word32 _CXM_DOMAIN_PUBLISH_DYN_TEST = 0x33771C06. -public define Word32 _CXM_DOMAIN_GET_STATUS = 0x33771C07. -public define Word32 _CXM_DOMAIN_GET_DOMAIN_INFO = 0x33771C08. -public define Word32 _CXM_DOMAIN_CRITICAL_ALERT = 0x33771C09. -public define Word32 _CXM_DOMAIN_COMMAND_RESULT = 0x33771C0A. - - -// DomainManager <-> Gandi -public define Word32 _CXM_GANDI_SERVICE_ID = 0x33771D00. -public define Word32 _CXM_GANDI_CHECK_AVAILABILITY = 0x33771D01. // 'NAME' (String): Base names (without extension) of the wanted domains - // --> CXM_ACK with 'DOMAINS' (String): Array of avaiblable domains -public define Word32 _CXM_GANDI_CREATE_CONTACT = 0x33771D02. // 'CLASS' (String): - // 'FIRSTNAME', 'LASTNAME', 'ADDRESS', 'ZIPCODE', 'CITY', 'COUNTRY', 'PHONE', 'EMAIL' (String) - // --> CXM_ACK with 'CONTACT_HANDLE' (String): Created handle for this contact -public define Word32 _CXM_GANDI_CREATE_DOMAIN = 0x33771D03. // 'DOMAIN' (String): Domain full name - // 'OWNER' (String): Owner handle - // --> CXM_ACK with 'DOMAIN_HANDLE' (String): Created handle for this domain - // ************** MF INSTALLER SERVICE ************** - -public define Word32 _CXM_INSTALLER_SERVICE_MSG_BASIS= 0x33772000. -public define Word32 _CXM_INSTALLER_SERVICE_ID = 0x33772001. -public define Word32 _CXM_INSTALLER_REGISTER_APP_ID = 0x33772002. -public define Word32 _CXM_INSTALLER_GET_NEW_SERIALS = 0x33772003. -public define Word32 _CXM_INSTALLER_CONFIRM_SERIALS_PUBLICATION = 0x33772004. -public define Word32 _CXM_INSTALLER_GET_MODELS = 0x33772005. // returns the MF models list - -// ************************************************* -// ************* MF API ************* - -// ************* ADMIN SERVICE ************* - -public define Word32 _CXM_ADMIN_SERVICE_MSG_BASIS = 0x33772100. -public define Word32 _CXM_ADMIN_SERVICE_ID = 0x33772100. -public define Word32 _CXM_ADMIN_CREATE_ACCOUNT = 0x33772101. -public define Word32 _CXM_ADMIN_DELETE_ACCOUNT = 0x33772102. - - - - -// ************* MAILINGS SERVICE ************* - -public define Word32 _CXM_MAILING_SERVICE_MSG_BASIS = 0x33772200. -public define Word32 _CXM_MAILING_SERVICE_ID = 0x33772200. // same as MSG_BASIS - -public define Word32 _CXM_MAILING_CREATE_CONTACT = 0x33772201. -public define Word32 _CXM_MAILING_UPDATE_CONTACT = 0x33772202. -public define Word32 _CXM_MAILING_DELETE_CONTACT = 0x33772203. -public define Word32 _CXM_MAILING_CHECK_CONTACT = 0x33772204. - -public define Word32 _CXM_MAILING_CREATE_MAILING = 0x33772211. -public define Word32 _CXM_MAILING_UPDATE_MAILING = 0x33772212. -public define Word32 _CXM_MAILING_DELETE_MAILING = 0x33772213. -public define Word32 _CXM_MAILING_GET_MAILING = 0x33772214. - -public define Word32 _CXM_MAILING_ADD_CONTACT_TO_MAILING = 0x33772221. -public define Word32 _CXM_MAILING_REMOVE_CONTACT_FROM_MAILING = 0x33772222. - - -// ************* DIRECTORY SERVICE ************* - -public define Word32 _CXM_DIRECTORY_SERVICE_MSG_BASIS = 0x33772300. - -// ************* BACKUP SERVICE ************* - -public define Word32 _CXM_BACKUP_SERVICE_MSG_BASIS = 0x33772400. -public define Word32 _CXM_BACKUP_SERVICE_ID = 0x33772401. -public define Word32 _CXM_BACKUP_GET_STATUS = 0x33772402. /// Get backup status for a given MF (can subscribe, subscribed, subscription end date...) -public define Word32 _CXM_BACKUP_STARTING_BACKUP = 0x33772403. /// Notify BackupService that backup process is starting -public define Word32 _CXM_BACKUP_FINISHING_BACKUP = 0x33772404. /// Notify BackupService that backup process is finishing -public define Word32 _CXM_BACKUP_STARTING_RESTORE = 0x33772405. /// Notify BackupService that restore process is starting -public define Word32 _CXM_BACKUP_FINISHING_RESTORE = 0x33772406. /// Notify BackupService that restore process is finishing - -// ************* STATISTICS SERVICE ************* - -public define Word32 _CXM_STATS_SERVICE_MSG_BASIS = 0x33772500. - -// ************* SUPERVISER SERVICE ************* - -public define Word32 _CXM_SUPERVISER_SERVICE_MSG_BASIS = 0x33772600. -public define Word32 _CXM_SUPERVISER_SERVICE_ID = 0x33772600. -public define Word32 _CXM_SUPERVISER_GET_STATUS = 0x33772601. - -// ************* OTHER MESSAGES ************* - -public define Word32 _CXM_MF_MODEL = 1296912196. // 'MMOD' -public define Word32 _CXM_MF_LICENSE = 1296845123. // 'MLIC' - -// ************* TEGAMIGAWA SERVICE ************* - -public define Word32 _CXM_TEGAMIGAWA_SERVICE_MSG_BASIS = 0x33772700. -public define Word32 _CXM_TEGAMIGAWA_SERVICE_ID = 0x33772700. -public define Word32 _CXM_TEGAMIGAWA_REGISTER_CLIENT = 0x33772701. - -// *************** KAIWA SERVICE *************** - -public define Word32 _CXM_KAIWA_SERVICE_MSG_BASIS = 0x33772800. -public define Word32 _CXM_KAIWA_SERVICE_ID = 0x33772800. -public define Word32 _CXM_KAIWA_REGISTER_CLIENT = 0x33772801. -public define Word32 _CXM_KAIWA_FRIEND_REQUEST = 0x33772802. -public define Word32 _CXM_KAIWA_ADD_FRIEND = 0x33772803. -public define Word32 _CXM_KAIWA_REMOVE_FRIEND = 0x33772804. -public define Word32 _CXM_KAIWA_BLOCK_FRIEND = 0x33772805. -public define Word32 _CXM_KAIWA_ONLINE_STATUS = 0x33772806. -public define Word32 _CXM_KAIWA_SEND_MESSAGE = 0x33772807. -public define Word32 _CXM_KAIWA_RECEIVE_MESSAGE = 0x33772808. - -// ************* MAIL SERVICE ************* - -public define Word32 _CXM_MF_MAIL_SERVICE_MSG_BASIS = 0x33772900. -public define Word32 _CXM_MF_MAIL_SERVICE_ID = 0x33772900. -public define Word32 _CXM_MF_MAIL_SEND_MAIL = 0x33772901. - -// ************************************************* -// ************* BASILIK SERVICES ************* -public define Word32 _CXM_BSLK_MSG_BASIS = 0x33780000. -public define Word32 _CXM_BSLK_SERVICE_ID = 0x33780000. -public define Word32 _CXM_BSLKLP_SERVICE_ID = 0x33781000. -public define Word32 _CXM_BSLKLP_LOG = 0x33781001. - - - -// ************************************************* -// ********* HAYAMIKI RESERVED SPACE ********** - -public define Word32 _CXM_HK_MSG_BASIS = 0x33790000. -public define Word32 _HK_DATABASE = 0x33790400. -public define Word32 _HK_APP = 0x33790401. -public define Word32 _HK_TABLE = 0x33790402. -public define Word32 _HK_MODEL = 0x33790403. -public define Word32 _HK_COLUMN = 0x33790404. -public define Word32 _HK_COLUMN_ATTRIBUTES = 0X33790405. -public define Word32 _HK_FIELD = 0x33790406. - -public define Word32 _HK_ICON = 0x33790410. -public define Word32 _HK_HELP_TEXT = 0x33790411. -public define Word32 _HK_MODEL_DISPLAY = 0x33790412. -public define Word32 _HK_LIST_VIEW = 0x33790413. -public define Word32 _HK_EDIT_VIEW = 0x33790414. -public define Word32 _HK_APP_NAME = 0x33790415. - -public define Word32 _CXM_HK_MSG_END = 0x3379FFFF. - -// ************************************************* -// ********* ANUBIX RESERVED SPACE ********** - -public define Word32 _RMT_ANUBIX_MSG_BASIS = 0x33800000. -public define Word32 _RMT_ANUBIX_CORE_SERVICE_ID = 0x33800000. -public define Word32 _RMT_ANUBIX_CORE_AUTH = 0x33800001. - -public define Word32 _RMT_ANUBIX_MSG_END = 0x3380FFFF. diff --git a/asterisk/ami.anubis b/asterisk/ami.anubis index 6fab15e..a86e268 100644 --- a/asterisk/ami.anubis +++ b/asterisk/ami.anubis @@ -13,7 +13,7 @@ read network/dns.anubis transmit xlib/asterisk/ami_types.anubis transmit xlib/asterisk/ami_commands.anubis -transmit xlib/web/CXM_http_get_common.anubis +transmit xlib/web/http_get_common.anubis define Maybe(List(String)) receive diff --git a/database/db_types.anubis b/database/db_types.anubis index 03199fb..24d5c50 100644 --- a/database/db_types.anubis +++ b/database/db_types.anubis @@ -14,7 +14,7 @@ transmit xlib/database/types/db_date.anubis transmit xlib/database/types/db_time.anubis transmit xlib/database/types/db_datetime.anubis transmit xlib/database/types/db_integer.anubis -transmit xlib/web/CXM_json.anubis +transmit xlib/web/json.anubis /* DB_id will is deprecated. Please use next version below all upper case */ //public type DB_id: diff --git a/message_constants.anubis b/message_constants.anubis new file mode 100644 index 0000000..e60aed4 --- /dev/null +++ b/message_constants.anubis @@ -0,0 +1,228 @@ +/* + * + * User: David RENÉ + * Date: 07/04/2007 + * Time: 16:06 + * © David RENÉ + * + */ + +public define Word32 _NO_NAME_MSG = 0x00000000. + +// **************** MAILBOX PROTOCOL *************** + +public define Word32 _C_SCAN_FOR_BOXES = 0x33770001. // Ask Boxes to publish their informations +public define Word32 _C_PUBLISH_BOX_STATUS = 0x33770002. // Used by Boxes to publish their informations +public define Word32 _C_SHUTDOWN_BOX = 0x33770003. // Used to ask a box to shutdown +public define Word32 _CXM_SET_BOX_NETWORK_PARAMS = 0x33770004. // Define network configuration of boxes +public define Word32 _CXM_RESET_ADMIN_PWD = 0x33770005. // Ask the MailFountain to reset the admin pwd. +public define Word32 _CXM_FULL_RESET = 0x33770006. // Ask the MailFountain to proceed to a full reset of its data. After that, the MailFountain is totally empty (mail, config, domain, logs, etc...) +public define Word32 _CXM_FORCE_PUBLISH_MF_CONFIG = 0x33770007. // Ask the MailFountain to proceed a Config publishing to DomainManager + + // **************** PACKAGE BUILDER *************** + +public define Word32 _CXM_PKG_MSG_BASIS = 0x33770400. // +public define Word32 _CXM_PKG_CONTAINER = 0x33770401. +public define Word32 _CXM_PKG_HEADER_PART = 0x33770402. // Header Message for Script +public define Word32 _CXM_PKG_SCRIPT_PART = 0x33770403. // Main Message for Script +public define Word32 _CXM_PKG_S_ADD_FILE = 0x33770404. // script action to add file in the destination +public define Word32 _CXM_PKG_S_RUN = 0x33770405. // script action to run a command +public define Word32 _CXM_PKG_INDEX_PART = 0x33770440. // ID of package Index part +public define Word32 _CXM_PKG_IDX_ENTRY = 0x33770441. // Index entry information + + // **************** UPDATE SERVICE *************** + +public define Word32 _CXM_UPDATE_SERVICE_MSG_BASIS = 0x33770800. // +public define Word32 _CXM_UPD_SERVICE_ID = 0x33770801. +public define Word32 _CXM_UPD_HAS_UPDATE = 0x33770802. // +public define Word32 _CXM_UPD_LIST_CLASS_FILES = 0x33770803. // List the files contained in the class path +public define Word32 _CXM_UPD_GET_CLASS_FILE = 0x33770804. // get the file contained in the class path. Return info for download + + // **************** SERVICE NEGOCIATION *************** + +public define Word32 _CXM_SERVICE_NEGOCIATION_BASIS = 0x33770C00. // +public define Word32 _CXM_REQUEST_FOR_SERVICE = 0x33770C01. // +public define Word32 _CXM_LOGIN = 0x33770C02. // + + // **************** GENERIC PROTOCOL *************** + +public define Word32 _CXM_GENERIC_PROTOCOL_BASIS = 0x33771000. // +public define Word32 _CXM_ACK = 0x33771001. // +public define Word32 _CXM_ACK_RESULT_MSG = 0x33771002. // +public define Word32 _CXM_GET_FILE_REF = 0x33771003. //get local or remote file without FTP service + + // **************** FTP SERVICE *************** + +public define Word32 _CXM_FTP_SERVICE_MSG_BASIS = 0x33771400. // +public define Word32 _CXM_FTP_SERVICE_ID = 0x33771401. +public define Word32 _CXM_FTP_GET_FILE = 0x33771402. +public define Word32 _CXM_FTP_START_TRANSFERT = 0x33771403. +public define Word32 _CXM_FTP_DATA = 0x33771404. + + // ************** LOGGER SERVICE ************** + +public define Word32 _CXM_LOGGER_SERVICE_MSG_BASIS = 0x33771800. // +public define Word32 _CXM_LOGGER_SERVICE_ID = 0x33771801. +public define Word32 _CXM_LOGGER_LOG = 0x33771802. +public define Word32 _CXM_LOGGER_REGISTER_UID = 0x33771803. +public define Word32 _CXM_LOGGER_REGISTER_LOG = 0x33771804. + + // ************** DOMAIN SERVICE ************** + +// MF <-> DomainManager +public define Word32 _CXM_DOMAIN_SERVICE_MSG_BASIS = 0x33771C00. // +public define Word32 _CXM_DOMAIN_SERVICE_ID = 0x33771C01. +public define Word32 _CXM_DOMAIN_PUBLISH_MF_CONFIG = 0x33771C02. +public define Word32 _CXM_DOMAIN_GET_NAME = 0x33771C03. +public define Word32 _CXM_DOMAIN_GET_MY_IP = 0x33771C04. +public define Word32 _CXM_DOMAIN_PUBLISH_MY_IP = 0x33771C05. +public define Word32 _CXM_DOMAIN_PUBLISH_DYN_TEST = 0x33771C06. +public define Word32 _CXM_DOMAIN_GET_STATUS = 0x33771C07. +public define Word32 _CXM_DOMAIN_GET_DOMAIN_INFO = 0x33771C08. +public define Word32 _CXM_DOMAIN_CRITICAL_ALERT = 0x33771C09. +public define Word32 _CXM_DOMAIN_COMMAND_RESULT = 0x33771C0A. + + +// DomainManager <-> Gandi +public define Word32 _CXM_GANDI_SERVICE_ID = 0x33771D00. +public define Word32 _CXM_GANDI_CHECK_AVAILABILITY = 0x33771D01. // 'NAME' (String): Base names (without extension) of the wanted domains + // --> CXM_ACK with 'DOMAINS' (String): Array of avaiblable domains +public define Word32 _CXM_GANDI_CREATE_CONTACT = 0x33771D02. // 'CLASS' (String): + // 'FIRSTNAME', 'LASTNAME', 'ADDRESS', 'ZIPCODE', 'CITY', 'COUNTRY', 'PHONE', 'EMAIL' (String) + // --> CXM_ACK with 'CONTACT_HANDLE' (String): Created handle for this contact +public define Word32 _CXM_GANDI_CREATE_DOMAIN = 0x33771D03. // 'DOMAIN' (String): Domain full name + // 'OWNER' (String): Owner handle + // --> CXM_ACK with 'DOMAIN_HANDLE' (String): Created handle for this domain + // ************** MF INSTALLER SERVICE ************** + +public define Word32 _CXM_INSTALLER_SERVICE_MSG_BASIS= 0x33772000. +public define Word32 _CXM_INSTALLER_SERVICE_ID = 0x33772001. +public define Word32 _CXM_INSTALLER_REGISTER_APP_ID = 0x33772002. +public define Word32 _CXM_INSTALLER_GET_NEW_SERIALS = 0x33772003. +public define Word32 _CXM_INSTALLER_CONFIRM_SERIALS_PUBLICATION = 0x33772004. +public define Word32 _CXM_INSTALLER_GET_MODELS = 0x33772005. // returns the MF models list + +// ************************************************* +// ************* MF API ************* + +// ************* ADMIN SERVICE ************* + +public define Word32 _CXM_ADMIN_SERVICE_MSG_BASIS = 0x33772100. +public define Word32 _CXM_ADMIN_SERVICE_ID = 0x33772100. +public define Word32 _CXM_ADMIN_CREATE_ACCOUNT = 0x33772101. +public define Word32 _CXM_ADMIN_DELETE_ACCOUNT = 0x33772102. + + + + +// ************* MAILINGS SERVICE ************* + +public define Word32 _CXM_MAILING_SERVICE_MSG_BASIS = 0x33772200. +public define Word32 _CXM_MAILING_SERVICE_ID = 0x33772200. // same as MSG_BASIS + +public define Word32 _CXM_MAILING_CREATE_CONTACT = 0x33772201. +public define Word32 _CXM_MAILING_UPDATE_CONTACT = 0x33772202. +public define Word32 _CXM_MAILING_DELETE_CONTACT = 0x33772203. +public define Word32 _CXM_MAILING_CHECK_CONTACT = 0x33772204. + +public define Word32 _CXM_MAILING_CREATE_MAILING = 0x33772211. +public define Word32 _CXM_MAILING_UPDATE_MAILING = 0x33772212. +public define Word32 _CXM_MAILING_DELETE_MAILING = 0x33772213. +public define Word32 _CXM_MAILING_GET_MAILING = 0x33772214. + +public define Word32 _CXM_MAILING_ADD_CONTACT_TO_MAILING = 0x33772221. +public define Word32 _CXM_MAILING_REMOVE_CONTACT_FROM_MAILING = 0x33772222. + + +// ************* DIRECTORY SERVICE ************* + +public define Word32 _CXM_DIRECTORY_SERVICE_MSG_BASIS = 0x33772300. + +// ************* BACKUP SERVICE ************* + +public define Word32 _CXM_BACKUP_SERVICE_MSG_BASIS = 0x33772400. +public define Word32 _CXM_BACKUP_SERVICE_ID = 0x33772401. +public define Word32 _CXM_BACKUP_GET_STATUS = 0x33772402. /// Get backup status for a given MF (can subscribe, subscribed, subscription end date...) +public define Word32 _CXM_BACKUP_STARTING_BACKUP = 0x33772403. /// Notify BackupService that backup process is starting +public define Word32 _CXM_BACKUP_FINISHING_BACKUP = 0x33772404. /// Notify BackupService that backup process is finishing +public define Word32 _CXM_BACKUP_STARTING_RESTORE = 0x33772405. /// Notify BackupService that restore process is starting +public define Word32 _CXM_BACKUP_FINISHING_RESTORE = 0x33772406. /// Notify BackupService that restore process is finishing + +// ************* STATISTICS SERVICE ************* + +public define Word32 _CXM_STATS_SERVICE_MSG_BASIS = 0x33772500. + +// ************* SUPERVISER SERVICE ************* + +public define Word32 _CXM_SUPERVISER_SERVICE_MSG_BASIS = 0x33772600. +public define Word32 _CXM_SUPERVISER_SERVICE_ID = 0x33772600. +public define Word32 _CXM_SUPERVISER_GET_STATUS = 0x33772601. + +// ************* OTHER MESSAGES ************* + +public define Word32 _CXM_MF_MODEL = 1296912196. // 'MMOD' +public define Word32 _CXM_MF_LICENSE = 1296845123. // 'MLIC' + +// ************* TEGAMIGAWA SERVICE ************* + +public define Word32 _CXM_TEGAMIGAWA_SERVICE_MSG_BASIS = 0x33772700. +public define Word32 _CXM_TEGAMIGAWA_SERVICE_ID = 0x33772700. +public define Word32 _CXM_TEGAMIGAWA_REGISTER_CLIENT = 0x33772701. + +// *************** KAIWA SERVICE *************** + +public define Word32 _CXM_KAIWA_SERVICE_MSG_BASIS = 0x33772800. +public define Word32 _CXM_KAIWA_SERVICE_ID = 0x33772800. +public define Word32 _CXM_KAIWA_REGISTER_CLIENT = 0x33772801. +public define Word32 _CXM_KAIWA_FRIEND_REQUEST = 0x33772802. +public define Word32 _CXM_KAIWA_ADD_FRIEND = 0x33772803. +public define Word32 _CXM_KAIWA_REMOVE_FRIEND = 0x33772804. +public define Word32 _CXM_KAIWA_BLOCK_FRIEND = 0x33772805. +public define Word32 _CXM_KAIWA_ONLINE_STATUS = 0x33772806. +public define Word32 _CXM_KAIWA_SEND_MESSAGE = 0x33772807. +public define Word32 _CXM_KAIWA_RECEIVE_MESSAGE = 0x33772808. + +// ************* MAIL SERVICE ************* + +public define Word32 _CXM_MF_MAIL_SERVICE_MSG_BASIS = 0x33772900. +public define Word32 _CXM_MF_MAIL_SERVICE_ID = 0x33772900. +public define Word32 _CXM_MF_MAIL_SEND_MAIL = 0x33772901. + +// ************************************************* +// ************* BASILIK SERVICES ************* +public define Word32 _CXM_BSLK_MSG_BASIS = 0x33780000. +public define Word32 _CXM_BSLK_SERVICE_ID = 0x33780000. +public define Word32 _CXM_BSLKLP_SERVICE_ID = 0x33781000. +public define Word32 _CXM_BSLKLP_LOG = 0x33781001. + + + +// ************************************************* +// ********* HAYAMIKI RESERVED SPACE ********** + +public define Word32 _CXM_HK_MSG_BASIS = 0x33790000. +public define Word32 _HK_DATABASE = 0x33790400. +public define Word32 _HK_APP = 0x33790401. +public define Word32 _HK_TABLE = 0x33790402. +public define Word32 _HK_MODEL = 0x33790403. +public define Word32 _HK_COLUMN = 0x33790404. +public define Word32 _HK_COLUMN_ATTRIBUTES = 0X33790405. +public define Word32 _HK_FIELD = 0x33790406. + +public define Word32 _HK_ICON = 0x33790410. +public define Word32 _HK_HELP_TEXT = 0x33790411. +public define Word32 _HK_MODEL_DISPLAY = 0x33790412. +public define Word32 _HK_LIST_VIEW = 0x33790413. +public define Word32 _HK_EDIT_VIEW = 0x33790414. +public define Word32 _HK_APP_NAME = 0x33790415. + +public define Word32 _CXM_HK_MSG_END = 0x3379FFFF. + +// ************************************************* +// ********* ANUBIX RESERVED SPACE ********** + +public define Word32 _RMT_ANUBIX_MSG_BASIS = 0x33800000. +public define Word32 _RMT_ANUBIX_CORE_SERVICE_ID = 0x33800000. +public define Word32 _RMT_ANUBIX_CORE_AUTH = 0x33800001. + +public define Word32 _RMT_ANUBIX_MSG_END = 0x3380FFFF. diff --git a/net_services/CXM_generic_client.anubis b/net_services/CXM_generic_client.anubis index f1a8546..4d52d37 100644 --- a/net_services/CXM_generic_client.anubis +++ b/net_services/CXM_generic_client.anubis @@ -13,9 +13,9 @@ read network/dns.anubis //transmit xlib/net_services_protocols/logger_service.anubis -transmit xlib/CXM_message_constants.anubis -transmit xlib/net_services/CXM_net_services.anubis -transmit xlib/net_services/CXM_generic_protocol.anubis +transmit xlib/message_constants.anubis +transmit xlib/net_services/net_services.anubis +transmit xlib/net_services/generic_protocol.anubis // --Generic types--------------------------------------------------------------------- public type NetServiceAnswer: diff --git a/net_services_protocols/logger_client.anubis b/net_services_protocols/logger_client.anubis index 3f173f5..921c88d 100644 --- a/net_services_protocols/logger_client.anubis +++ b/net_services_protocols/logger_client.anubis @@ -9,7 +9,7 @@ transmit system/logger.anubis read system/message_transceiver.anubis read system/parameter/inifile.anubis -read xlib/CXM_message_constants.anubis +read xlib/message_constants.anubis define One local_net_logger diff --git a/net_services_protocols/logger_service_deprecated.anubis b/net_services_protocols/logger_service_deprecated.anubis index f45a030..0a2136d 100644 --- a/net_services_protocols/logger_service_deprecated.anubis +++ b/net_services_protocols/logger_service_deprecated.anubis @@ -18,9 +18,9 @@ read system/message_transceiver.anubis read system/files.anubis -read xlib/CXM_message_constants.anubis -read xlib/net_services/CXM_net_services.anubis -read xlib/net_services/CXM_generic_protocol.anubis +read xlib/message_constants.anubis +read xlib/net_services/net_services.anubis +read xlib/net_services/generic_protocol.anubis // Special non-existing file. This is a work arround for a impossibility to define global configuration in anubis. // So this file allows you to specify on which UDP port the logger server is listening. diff --git a/unit_test/test.anubis b/unit_test/test.anubis index 047f60d..5a91e9f 100644 --- a/unit_test/test.anubis +++ b/unit_test/test.anubis @@ -7,9 +7,9 @@ */ -read xlib/web/CXM_multihost_http_server.anubis -read xlib/web/CXM_web_arg_utils.anubis -read xlib/web/CXM_web_dump.anubis +read xlib/web/multihost_http_server.anubis +read xlib/web/web_arg_utils.anubis +read xlib/web/web_dump.anubis read tools/string.anubis global define One diff --git a/web/CXM_common.anubis b/web/CXM_common.anubis deleted file mode 100644 index e6faa50..0000000 --- a/web/CXM_common.anubis +++ /dev/null @@ -1,297 +0,0 @@ - - *Project* The Anubis Project - *Title* Some common stuff for the web. - - *Copyright* - Copyright © Alain Prouté 2003~2007. - © David RENÉ 2007~2019 - - - *Authors:* - Alain Prouté - David RENÉ - - *Public* - *Name* HTTP_header - *Description* - -transmit tools/basis.anubis -transmit system/string.anubis -read system/logger.anubis -/** - * The type 'HTTP_header' describes HTTP headers, which are just pairs '(name,value)'. - */ - -public type HTTP_header: - http_header( - String name, - String value - ) -. - -public define Maybe(String) - http_header_value - ( - List(HTTP_header) l, - String name - )= - if l is - { - [ ] then failure, - [h . t] then if h is - { - http_header(n, v) then //print("DEBUG: http_header_value --> HEADER = " + n + ":" + v + "\n"); - if insensitive_equal(name, n) then success(v) - else http_header_value(t, name), - } - } -. - -public define String - http_header_value - ( - List(HTTP_header) l, - String name, - String default - )= - if http_header_value(l, name) is - { - failure then default, - success(result) then result - } -. - -public define List(String) - to_List_String - ( - List(HTTP_header) l - )= - map((HTTP_header h) |-> h.name +": "+h.value, l ). - -public define String - to_String - ( - List(HTTP_header) l - )= - join("\n\r",to_List_String(l)). - - -public type HTTP_Info: - http_info - ( - Word32 ip_address, // IP address of the client - String hostname, // hostname requested by the client - String uri, // URI requested by the client - List(HTTP_header) http_headers, // HTTP headers sent by the client - Bool is_https - //One -> String generate_trust_ticket // may be used against denial of - // service attacks - ). - - *Name* Web_arg - *Description* - - The type 'Web_arg' describes 'web arguments'. A web argument is either a pair - '(name,value)' (for example it may be 'web_arg("password","foobar")', if the client - clicks on the submit button of a form containing a password input field named - 'password'), or an uploaded file. In this last case, it is a triplet containing the - name of the file upload input field, the value of this input field (name of the - uploaded file), and the name of the temporary file as saved by the server in its - 'upload temporary directory'; see 'web/http_server.anubis' and the 'upload' Web_item in - 'web/html.anubis'). - -public type Web_arg: - web_arg( - String name, - String value - ), - upload ( - String name, // name of corresponding 'upload' Web_item - String value, // name of uploaded file - String temp_file_path) // temporary file path (relative to server directory) -. - - *Name* Web_arg_value - *Description* - Of course, within the body of a 'web page' operation, you may want to recover the value - of a particular web argument. To that end, use the operation 'web_arg_value', which - takes 2 argument: - - - the list of all web arguments (the operand of the web page operation), - - the name of the argument whose value is wanted. - - This operation has the following return type: - -public type Web_arg_value: - not_found, - found(String value). - - *Name* Web_arg_value - *Description* - If the requested argument name is not found in the list, 'not_found' is - returned. Otherwise, the value returned by 'web_arg_value' has the form 'found(v)', - where 'v' is the value of the argument. - - The operation 'web_arg_value' is defined below. - -public define Web_arg_value - web_arg_value - ( - List(Web_arg) l, - String name - )= - if l is - { - [ ] then not_found, - [h . t] then if h is - { - web_arg(n,v) then - if name=n - then found(v) - else web_arg_value(t,name), - - upload(n,v,tfn) then - if name=n - then found(v) - else web_arg_value(t,name) - } - } -. - -public define Web_arg_value - web_arg_value_not_null - ( - List(Web_arg) lwa, - String name, - ) = - if web_arg_value(lwa, name) is - { - not_found then not_found - found(str) then - if str = "" then - not_found - else - found(str) - }. - - *Ignore* - -public define Maybe((String,String)) - file_upload_value - ( - List(Web_arg) l, - String name - )= - if l is - { - [ ] then failure, - [h . t] then - if h is - { - web_arg(_,_) then file_upload_value(t,name), - upload(n,v,tfn) then - if n = name - then success((v,tfn)) - else file_upload_value(t,name) - } - }. - -public define List((String,String)) - file_upload_value - ( - List(Web_arg) l, - String name, - List((String,String)) new_list - ) = - if l is - { - [ ] then new_list, - [h . t] then if h is - { - web_arg(_,_) then file_upload_value(t,name, new_list), - upload(n,v,tfn) then - if n = name - then file_upload_value(t,name, [(v,tfn) . new_list]) - else file_upload_value(t,name, new_list) - } - }. - - -public type Redirection: - redirect(String required_uri, // URI required by the client - String required_host, // value of 'Host' HTTP header sent by the client - String corresponding_uri). // URI which will be served to the client - -public type Redirections: - redirection_list(List(Redirection) redirections), - redirection_fn((String input_uri, // URI required by the client - String host) -> String f). // value of 'Host' HTTP header sent by the client - - - Now, you may also want to recover web argument values which have been encoded (by - 'web_arg_encode'). In this case, use the following: - -read CXM_web_arg_encode.anubis - - -public define Maybe($T) - decode_web_arg_value - ( - List(Web_arg) l, - String name - ) = - if web_arg_value(l,name) is - { - not_found then failure, - found(v) then web_arg_decode(v) - }. - -public define List(String) - web_arg_list_values - ( - List(Web_arg) l, - String name - ) = - if l is - { - [] then [], - [h . t] then - if h is web_arg(n, v) then - if n = name then - [ v . web_arg_list_values(t, name)] - else - web_arg_list_values(t, name) - else - web_arg_list_values(t, name) - - } - . - -public define String - detect_browser_language - ( - HTTP_Info http_info, - String default_language, - (LogLevel, String) -> One logger - ) = - //logger(logInfo,"Detecting language... "); - if http_header_value(http_info.http_headers, "Accept-Language") is - { - failure then logger(logDebug, "FAILED: unable to find 'Accept-Language' header, use the default one ["+default_language+"]."); default_language , - success(value) then - if split_by_token(value, ',') is - { - [] then logger(logDebug, "FAILED: language header is empty, use the default one ["+default_language+"]."); default_language, - [h . _] then - //TODO real managment of language and country like fr-be for - // belgium french. - //but now we only extract the language and forget the country - if split_by_token(trim(h), '-') is - { - [] then default_language, - [browser_lang . _] then - logger(logDebug, "Language = " + browser_lang);browser_lang - } - } - } -. diff --git a/web/CXM_cookies.anubis b/web/CXM_cookies.anubis deleted file mode 100644 index 7e2ca0c..0000000 --- a/web/CXM_cookies.anubis +++ /dev/null @@ -1,751 +0,0 @@ - - *Project* The Anubis Project - - *Title* Managing Cookies. - - *Copyright* Copyright (c) Alain Prouté 2001. - - - *Author* Alain Prouté - - - - -read tools/basis.anubis -read system/string.anubis -read CXM_common.anubis -read CXM_http_get_common.anubis - - - *Overview* - Cookies are defined in RFC 2109. Here is the corresponding Anubis type: - - Each cookie has an server name (the name of the server who constructed the cookie), a - name, a value, and several attributes. - -public type Cookie: - cookie(String server_name, // of the server who sent the cookie - String name, // of the cookie - String value, // of the cookie - // attributes: - Maybe(String) comment, // cookies may have human readable comments - Maybe(String) domain, // domain name as sent by the server - Int validity, // cookie still valid if this is > now - Maybe(String) path, // server path for which the cookie is valid - Bool secure, // if true, do not send this cookie over an insecure link - Int version). // Cookie version (normally 1: rfc 2109) - - - Cookies are sent by servers through 'Set-Cookie' HTTP headers. The function - 'get_cookies' retrieves a list of cookies from a list of HTTP headers. - -public define List(Cookie) - get_cookies - ( - String server_name, // name of server who sent the cookies - List(HTTP_header) headers // HTTP headers sent by this server - ). - -public define Maybe(Cookie) - find_cookie - ( - String name, - List(Cookie) cookies - ). - - - - - - Normally, this function is used on the list of HTTP headers returned by either - 'http_get' of 'https_get'. - - - Before they can be sent back to their origin server, cookies must be reformated, in - order to produce 'Cookie' HTTP headers: - -public define List(HTTP_header) - reformat_cookies - ( - String server_name, - String uri, - List(Cookie) cookies - ). - - The result of 'reformat_cookies' may be appended to the list of headers given as - argument to 'http_get' or to 'https_get'. - - In the meantime, you may examine and maybe discard cookies, you may 'save' them into a - file, and 'retrieve' them later. - - - - - ------- That all for the public part. ------------------------------------------------- - - - Here is the syntax of a 'Set-Cookie' header (according to RFC 2109): - - set-cookie = "Set-Cookie:" cookies - cookies = 1#cookie - cookie = NAME "=" VALUE *(";" cookie-av) - NAME = token - VALUE = value - value = token | quoted-string - cookie-av = "Comment" "=" value - | "Domain" "=" value - | "Max-Age" "=" value - | "Path" "=" value - | "Secure" - | "Version" "=" 1*DIGIT - - - According to RFC 2616 (obsolating RFC 2068) defining HTTP 1.1, 'control characters' are - 0 to 31 and DEL (127). A 'separator' is one of: - - ( ) < > @ , ; : \ " / [ ] ? = { } 32(space) and 9(tab) " - - Now, a token is a non empty sequence of ASCII characters (0 to 127), but not including - any control character or any separator. As a consequence, characters admissible in a - 'RFC 2616 token' are: - - 33 ! - 35 to 39 # $ & ' - 42 43 * + - 45 46 - . - 48 to 57 0 ... 9 - 65 to 90 A ... Z - 94 to 122 ^ _ ` a ... z - 124 126 | ~ - -define Bool - is_token_char - ( - Word8 c - ) = - if c +< 33 then false else - if c +< 34 then true else - if c +< 35 then false else - if c +< 40 then true else - if c +< 42 then false else - if c +< 44 then true else - if c +< 45 then false else - if c +< 47 then true else - if c +< 48 then false else - if c +< 58 then true else - if c +< 65 then false else - if c +< 91 then true else - if c +< 94 then false else - if c +< 123 then true else - if c +< 124 then false else - if c = 124 then true else - c = 126. - - value char are token added of =, (, ) - -define Bool - is_value_char - ( - Word8 c - ) = - if c +< 33 then false else // space in not allowed in value - if c +< 34 then true else - if c +< 35 then false else // " is not allowed in value - if c +< 44 then true else - if c +< 45 then false else // , is not allowed in value - //if c +< 47 then true else - //if c +< 48 then false else - if c +< 59 then true else - if c +< 60 then false else // ; not allowed in value - //if c +< 62 then true else - //if c +< 65 then false else - //if c +< 91 then true else - //if c +< 94 then false else - //if c +< 123 then true else - //if c +< 124 then false else - //if c = 124 then true else - //c = 126. - if c +< 127 then true - else - false. - - From the grammar, it is clear that atomic entities (called 'tokens' by YACC) are: - - - tokens (in the sens of RFC 2616) some of which have to be recognized as keywords - - quoted strings - - equal sign - - colon - - semi-colon - - Hence, the following type: - -public type Atom: - end_of_input, - error, - comment, - domain, - max_age, - path, - secure, - version, - token(String), - quoted_string(String), - equals, - colon, - semi_colon. - - - variable List(Atom) unput_atoms = []. - -type CookieToolBox: - tool_box(Var(List(Atom)) unput_atoms, - Var(String) input, - Var(Int) index, - Var(String) server_name - ). - -define One - unput_atom - ( - CookieToolBox tbx, - Atom a - ) = - unput_atoms(tbx) <- [a . *unput_atoms(tbx)]. - -define Atom - recognize_keyword - ( - String s - ) = - with l = to_lower(s), - if l = "comment" then comment else - if l = "domain" then domain else - if l = "max-age" then max_age else - if l = "path" then path else - if l = "secure" then secure else - if l = "version" then version else - token(s). - - - variable String input = "". From which cookies will be read. - variable Int index = 0. Current position within 'input'. - -define Maybe(Word8) - next_char - ( - CookieToolBox tbx - ) = - if tbx is tool_box(_, input, index, _) then - if nth(*index,*input) is - { - failure then failure, - success(c) then - index <- *index+1; - success(c) - }. - -define One - unput_char - ( - CookieToolBox tbx - ) = - if tbx is tool_box(_, _, index, _) then - index <- *index-1. - -define Atom - read_token - ( - CookieToolBox tbx, - List(Word8) so_far, // contains at least 1 character - (Word8) -> Bool is_valid_char - ) = - if next_char(tbx) is - { - failure then recognize_keyword(implode(reverse(so_far))), - success(c) then - if is_valid_char(c) - then read_token(tbx,[c . so_far], is_valid_char) - else unput_char(tbx); recognize_keyword(implode(reverse(so_far))) - }. - -define Atom - read_quoted_string - ( - CookieToolBox tbx, - List(Word8) so_far - ) = - if next_char(tbx) is - { - failure then quoted_string(implode(reverse(so_far))), - success(c) then - if c = '\"' - then quoted_string(implode(reverse(so_far))) - else read_quoted_string(tbx,[c . so_far]) - }. - -define Bool - is_blank - ( - Word8 c - ) = - c +=< ' '. - - Reading an atom from the input: - -define Atom - read_atom - ( - CookieToolBox tbx, - ) = - if *unput_atoms(tbx) is - { - [ ] then - if next_char(tbx) is - { - failure then end_of_input, - success(c) then - if is_blank(c) then read_atom(tbx) else // skip blanks - if is_token_char(c) then read_token(tbx,[c], is_token_char) else - if c = '\"' then read_quoted_string(tbx,[]) else - if c = '=' then equals else - if c = ':' then colon else - if c = ';' then semi_colon else - error - }, - [h . t] then - unput_atoms(tbx) <- t; h - }. - -define Atom - read_value - ( - CookieToolBox tbx - ) = - if *unput_atoms(tbx) is - { - [ ] then - if next_char(tbx) is - { - failure then end_of_input, - success(c) then - if is_blank(c) then read_value(tbx) else // skip blanks - if is_value_char(c) then read_token(tbx,[c], is_value_char) else - if c = '\"' then read_quoted_string(tbx,[]) else - if c = ';' then semi_colon else - //println("cookie read value char ["+c+"] is an error"); - error - }, - [h . t] then - unput_atoms(tbx) <- t; h - }. - - Reading an attribute-value pair. - -type AttrVal: - comment(String), - domain(String), - max_age(String), - path(String), - secure, - version(String). - -define String - read_eq_value - ( - CookieToolBox tbx - ) = - with e = read_atom(tbx), - if e is equals then - ( - with a = read_atom(tbx), - if a is token(n) then n else - if a is quoted_string(s) then s else - unput_atom(tbx,a); "" - ) - else unput_atom(tbx,e); "". - - -define Maybe(AttrVal) - read_attr_val - ( - CookieToolBox tbx - ) = - if read_atom(tbx) is semi_colon then - with a = read_atom(tbx), - if a is - { - end_of_input then failure, - error then failure, - comment then success(comment(read_eq_value(tbx))), - domain then success(domain(read_eq_value(tbx))), - max_age then success(max_age(read_eq_value(tbx))), - path then success(path(read_eq_value(tbx))), - secure then success(secure), - version then success(version(read_eq_value(tbx))), - token(_) then unput_atom(tbx,a); failure, - quoted_string(_) then unput_atom(tbx,a); failure, - equals then unput_atom(tbx,a); failure, - colon then unput_atom(tbx,a); failure, - semi_colon then unput_atom(tbx,a); failure, - } - else failure. - - - Getting attributes from a List(AttrVal). - -define Maybe(String) - get_comment - ( - List(AttrVal) l - ) = - if l is - { - [ ] then failure, - [h . t] then if h is comment(c) - then success(c) - else get_comment(t) - }. - -define Maybe(String) - get_domain - ( - List(AttrVal) l - ) = - if l is - { - [ ] then failure, - [h . t] then if h is domain(s) - then success(s) - else get_domain(t) - }. - -define Int - get_validity - ( - List(AttrVal) l - ) = - if l is - { - [ ] then 0, - [h . t] then if h is max_age(a) - then if decimal_scan(a) is - { - failure then 0, - success(n) then n+now - } - else get_validity(t) - }. - -define Maybe(String) - get_path - ( - List(AttrVal) l - ) = - if l is - { - [ ] then failure, - [h . t] then if h is path(p) - then success(p) - else get_path(t) - }. - -define Bool - get_secure - ( - List(AttrVal) l - ) = - if l is - { - [ ] then false, - [h . t] then if h is secure - then true - else get_secure(t) - }. - -define Int - get_version - ( - List(AttrVal) l - ) = - if l is - { - [ ] then 0, - [h . t] then if h is version(v) - then if decimal_scan(v) is - { - failure then 0, - success(n) then n - } - else get_version(t) - }. - - - Reading a cookie: - - variable String server_name = "". - -define Maybe(Cookie) - read_cookie_n_e_v - ( - CookieToolBox tbx, - String name, - String value, - List(AttrVal) so_far - ) = - if read_attr_val(tbx) is - { - failure then - success(cookie( - *server_name(tbx), - name, - value, - get_comment(so_far), - get_domain(so_far), - get_validity(so_far), - get_path(so_far), - get_secure(so_far), - get_version(so_far) - )), - - success(av) then read_cookie_n_e_v(tbx,name,value,[av . so_far]) - }. - -define Maybe(Cookie) - read_cookie_n_e - ( - CookieToolBox tbx, - String name - ) = - with a = read_value(tbx), - if a is token(value) then - //println("read_cookie_n_e name["+name+"] value ["+value+"]"); - read_cookie_n_e_v(tbx,name,value,[]) else - if a is quoted_string(value) then read_cookie_n_e_v(tbx,name,value,[]) else - unput_atom(tbx,a); failure. - -define Maybe(Cookie) - read_cookie_n - ( - CookieToolBox tbx, // bis repetita placent - String name - ) = - with a = read_atom(tbx), - if a is equals - then read_cookie_n_e(tbx,name) - else unput_atom(tbx,a); failure. - - -define Maybe(Cookie) - read_cookie - ( - CookieToolBox tbx - ) = - with a = read_atom(tbx), - if a is token(name) - then read_cookie_n(tbx,name) - else unput_atom(tbx,a); failure. - - -define List(Cookie) - read_cookies - ( - CookieToolBox tbx, - List(Cookie) so_far - ) = - if read_cookie(tbx) is - { - failure then so_far, - success(c) then read_cookies(tbx,[c . so_far]) - }. - - -define List(Cookie) - get_cookies - ( - String svn, - HTTP_header h - ) = - if h is http_header(n,v) then - if to_lower(n) = "set-cookie" - then read_cookies(tool_box(var([]),var(v),var(0),var(svn)),[]) - else []. - -public define List(Cookie) - get_cookies - ( - String server_name, - List(HTTP_header) headers - ) = - if headers is - { - [ ] then [ ], - [h . t] then - append(get_cookies(server_name,h),get_cookies(server_name,t)) - }. - -define List(Cookie) - server_get_cookies - ( - HTTP_header h - ) = - if h is http_header(n,v) then - if to_lower(n) = "cookie" - then read_cookies(tool_box(var([]),var(v),var(0),var("")),[]) - else []. - -public define List(Cookie) - server_get_cookies - ( - // String server_name, - List(HTTP_header) headers - ) = - if headers is - { - [ ] then [ ], - [h . t] then - append(server_get_cookies(h), server_get_cookies(t)) - }. - -public define Maybe(Cookie) - find_cookie - ( - String name, - List(Cookie) cookies - ) - = - if cookies is - { - [] then failure, - [h . t] then - if h is cookie(s, n, v, _, _, _, _, _, _) then - if name = n then success(h) - else find_cookie(name, t) - }. - -public define String - get_cookie_value - ( - String name, - List(Cookie) cookies - ) - = - if find_cookie(name, cookies) is - { - failure then "", - success(c) then if c is cookie(_, _, v, _, _, _, _, _, _) then v - }. - - *** Reformating cookies. ************************************************************** - - Cookies should be resent reformated according to the following grammar (copy-pasted - from RFC 2109): - - cookie = "Cookie:" cookie-version - 1*((";" | ",") cookie-value) - cookie-value = NAME "=" VALUE [";" path] [";" domain] - cookie-version = "$Version" "=" value - NAME = attr - VALUE = value - path = "$Path" "=" value - domain = "$Domain" "=" value - - -define HTTP_header - reformat_cookie - ( - Cookie c - ) = - if c is cookie(sn,n,v,mbc,mbd,vld,mbp,sec,ver) then - http_header("Cookie", - "$Version=" + to_decimal(ver) + - ";" + n + "=\"" + v + "\"" + - if mbp is - { - failure then "", - success(p) then ";$Path=\"" + p + "\"" - } + - if mbd is - { - failure then "", - success(d) then ";$Domain=\"" + d + "\"" - } - ). - - - According to RFC 2109, a cookie may be sent to a server if: - - (1) server name in the cookie is the name of the server, - (2) if 'Path' attribute is present, its value must match the URI, - (3) the cookie is still valid (validity = 0 means indefinitely valid). - - define Bool - path_match - ( - Maybe(String) cookie_path, - String uri - ) = - if cookie_path is - { - failure then true, - success(p) then - - }. - - - Checking if the path matches: - - -define Bool - path_match - ( - Maybe(String) mbp, - String uri - ) = - true. - - - The next function verifies if a cookie satisfies the rules. - -define Bool - may_resend_cookie - ( - String server_name, - String uri, - Cookie c - ) = - if c is cookie(sn,n,v,mbc,mbd,vld,mbp,sec,ver) then - if sn = server_name - then ( - if path_match(mbp,uri) - then ( - if vld = 0 then true else vld > now - ) - else false - ) - else false. - - - The next function reformat all cookies which satisfy the 'resend' rules. - -public define List(HTTP_header) - reformat_cookies - ( - String server_name, - String uri, - List(Cookie) cookies - ) = - if cookies is - { - [ ] then [ ], - [h . t] then - if may_resend_cookie(server_name,uri,h) - then [reformat_cookie(h) . reformat_cookies(server_name,uri,t)] - else reformat_cookies(server_name,uri,t) - }. - - - - - - See test_cookies.anubis for a test of this program. - diff --git a/web/CXM_form.anubis b/web/CXM_form.anubis deleted file mode 100644 index 4737364..0000000 --- a/web/CXM_form.anubis +++ /dev/null @@ -1,998 +0,0 @@ -/* - * Created by PyramIDE. - * User: フランスのトトロ - * Date: 07/12/2014 - * Time: 16:49 - * © David RENÉ - */ - -// ************************************************************************************* -// *** Generic form -// ************************************************************************************* -read tools/basis.anubis -read system/string.anubis -read xlib/web/CXM_common.anubis -read xlib/web/CXM_web_arg_utils.anubis -read xlib/web/CXM_making_a_web_site.anubis -read xlib/web/CXM_html_tooltip.anubis -read xlib/web/CXM_widgets.anubis -read xlib/web/widgets/specialized_elements.anubis - -public type Mandatory: // used to mark fields as mandatory. - mandatory, - non_mandatory. - -public type Width: - small, //10 char - narrow_small, //20 char - narrow, //50 char - wide, //70 char - custom(Int). - -public type FormFieldWidth: - auto, - custom(Int). - -public type CXM_Form_Field: - no_field, // empty field - - //--- title field --------------------------------------------------------------------- - title( - String text - ), - - //--- message field ------------------------------------------------------------------- - message( - String text - ), - - //--- text input field ---------------------------------------------------------------- - input( - List(CoreAttrs) options, - HTML_Label label, - HTML_Id id, - WebArgName web_arg_name, - InitialValue init_value, - Width width, - Mandatory mandatory - ), - - input_readonly( - List(CoreAttrs) options, - HTML_Label label, - HTML_Id id, - WebArgName web_arg_name, - InitialValue init_value, - Width width - ), - - //--- text area field ----------------------------------------------------------------- - text_area( - List(TextAreaOption) options, - HTML_Label label, - HTML_Id id, - WebArgName web_arg_name, - InitialValue init_value, - Width width, - Int height, - Mandatory mandatory - ), - - //--- password input field ------------------------------------------------------------ - password_input( - List(CoreAttrs) options, - HTML_Label label, - HTML_Id id, - WebArgName web_arg_name, - InitialValue init_value, - Width width, - Mandatory mandatory), - - //--- phone field ------------------------------------------------------------ - phone_input( - Maybe(List(CoreAttrs)) sms_icon_options, //if there is sms available it's success with the options (generally the js call to edit sms) - List(CoreAttrs) phone_icon_options, - List(CoreAttrs) text_options, - HTML_Label label, - HTML_Id id, - WebArgName web_arg_name, - InitialValue init_value, - Phone_Type phone_type, - Width width, - Mandatory mandatory), - - //--- email field ------------------------------------------------------------ - email_input( - List(CoreAttrs) icon_options, - List(CoreAttrs) options, - HTML_Label label, - HTML_Id id, - WebArgName web_arg_name, - InitialValue init_value, - Width width, - Mandatory mandatory), - - //--- url field ------------------------------------------------------------ - url_input( - List(CoreAttrs) icon_options, - List(CoreAttrs) options, - HTML_Label label, - HTML_Id id, - WebArgName web_arg_name, - InitialValue init_value, - Width width, - Mandatory mandatory), - - //--- hidden field ------------------------------------------------------------ - hidden( - HTML_Id id, - WebArgName web_arg_name, - WebArgValue init_value - ), - //--- explanation field --------------------------------------------------------------- - explain( - String text - ), - - //--- selector field ------------------------------------------------------------------ - selector( - List(CoreAttrs) options, - HTML_Label label, - HTML_Id id, - WebArgName web_arg_name, - Int size, - List(String) items, - Maybe(InitialValue) selected, - Mandatory mandatory - ), - - selector_c( - List(CoreAttrs) options, - HTML_Label label, - HTML_Id id, - WebArgName web_arg_name, - Int size, - List((List(CoreAttrs), WebArgValue, String)) items, - Maybe(InitialValue) selected, - Mandatory mandatory - ), - - selector_hide_show (List(CoreAttrs) options, - HTML_Label label, - HTML_Id id, - WebArgName web_arg_name, - Int size, - List((List(CoreAttrs), WebArgValue, String, HTML_Partial_Content)) items, - Maybe(InitialValue) selected, - Mandatory mandatory), - - //--- checkbox field ------------------------------------------------------------------ - checkbox (List(CoreAttrs) options, - HTML_Label label, - HTML_Id id, - WebArgName web_arg_name, - Bool checked, - Mandatory mandatory), - - // the same one, but with the tag on the right of the checkbox - checkboxr( - List(CoreAttrs) options, - HTML_Label label, - HTML_Id id, - WebArgName web_arg_name, - Bool checked, - Mandatory mandatory - ), - - //checkbox_hide_show - checkbox_hide_show( - List(CoreAttrs) options, - HTML_Label label, - WebArgName web_arg_name, - Bool checked, - List(CXM_Form_Field) fields - ), - - //--- radio-button field -------------------------------------------------------------- - radio_button( - List(CoreAttrs) options, - HTML_Label label, - HTML_Id id, - WebArgName web_arg_name, - WebArgValue web_arg_value, - Bool checked, - Mandatory mandatory - ), - //radio_button_hide_show - radio_button_hide_show( - List(CoreAttrs) options, - HTML_Label label, - WebArgName web_arg_name, - WebArgValue web_arg_value, - Bool checked, - List(CXM_Form_Field) fields - ), - // the same one, but with the tag on the right of the radio_button - radio_buttonr (List(CoreAttrs) options, - HTML_Label label, - HTML_Id id, - WebArgName web_arg_name, - WebArgValue web_arg_value, - Bool checked, - Mandatory mandatory), - - radio_button_list( - List(CoreAttrs) options, - HTML_Label label, - HTML_Id id, - WebArgName web_arg_name, - List((WebArgValue, String)) web_arg_value, - Maybe(InitialValue) selected, - Mandatory mandatory, - Bool is_wide), - -// //--- fields table -------------------------------------------------------------------- -// fields_table (String tag, -// List(FormField) fields), -// -// //--- fields line --------------------------------------------------------------------- -// fields_line (String tag, -// List(FormField) fields), - one_line_fields (List(CXM_Form_Field) fields), - -// -// //--- preview field ------------------------------------------------------------------- -// preview (String html_text), - - //--- upload field ------------------------------------------------------------------- - upload (List(CoreAttrs) options, - HTML_Label label, - HTML_Id id, - WebArgName name, - Width width, - Mandatory mandatory), - - raw_in_form (HTML_In_Form html), - label_for ( String label, - HTML_Id id, - HTML_In_Form input), - div (List(CoreAttrs), List(HTML_In_Form) contents), - div (List(CoreAttrs), List(CXM_Form_Field) fields), - partial (HTML_Partial_Content p_content), - br, - hr (List(CoreAttrs) options), -// input_with_help (CXM_Form_Field field, -// Maybe(String) help_title, -// String help_text, -// Int width), - - fieldset (List(CoreAttrs) options, - String legend, - List(CXM_Form_Field) fields), - - blank_space, - blank_space (HtmlClass class), - - //--- submit button ------------------------------------------------------------------- - submit (List(CoreAttrs) options, - HtmlClass class, - WEB_Action_Name action_name, - Maybe(String) label, - String button_text, - List((String,String)) extra_operands), - empty. - -// ////////////////////////////////////////////// -// Alternate constructors: - -public define CXM_Form_Field - fieldset - ( - HTML_Id fieldSetId, - List(CXM_Form_Field) fields - ) = - fieldset([id(fieldSetId.id)], "", fields). - -public define CXM_Form_Field - fieldset - ( - List(CXM_Form_Field) fields - ) = - fieldset([], "", fields). - -public define CXM_Form_Field - fieldset - ( - String legend, - List(CXM_Form_Field) fields - ) = - fieldset([], legend, fields). - -public define CXM_Form_Field - input(WebArgName n, InitialValue init_value, Width width) - = input([], no_label, html_Id(n.name), n, init_value, width, non_mandatory). - -public define CXM_Form_Field - input(HTML_Label label, WebArgName n, InitialValue init_value, Width width) - = input([], label, html_Id(n.name), n, init_value, width, non_mandatory). - -public define CXM_Form_Field - input(HTML_Label label, WebArgName n, InitialValue init_value, Width width, Mandatory mand) - = input([], label, html_Id(n.name), n, init_value, width, mand). - -public define CXM_Form_Field - input(HTML_Label label, HTML_Id id, WebArgName n, InitialValue init_value, Width width, Mandatory mand) - = input([], label, id, n, init_value, width, mand). - -public define CXM_Form_Field - input(List(CoreAttrs) options, HTML_Label label, WebArgName n, InitialValue init_value, Width width, Mandatory mand) - = input(options, label, html_Id(n.name), n, init_value, width, mand). - -public define CXM_Form_Field - input_readonly(HTML_Label label, WebArgName n, InitialValue init_value, Width width) - = input_readonly([], label, html_Id(n.name), n, init_value, width). - -public define CXM_Form_Field - password_input(HTML_Label label, WebArgName n, InitialValue init_value, Width width, Mandatory mand) - = password_input([], label, html_Id(n.name), n, init_value, width, mand). - -public define CXM_Form_Field - checkbox(HTML_Label label, WebArgName n, Bool checked, Mandatory mand) - = checkbox([], label, html_Id(n.name), n, checked, mand). - -public define CXM_Form_Field - checkboxr(HTML_Label label, WebArgName n, Bool checked, Mandatory mand) - = checkboxr([], label, html_Id(n.name), n, checked, mand). - -public define CXM_Form_Field - radio_button(HTML_Label label, WebArgName n, WebArgValue value, Bool checked, Mandatory mand) - = radio_button([], label, html_Id(n.name), n, value, checked, mand). - -public define CXM_Form_Field - radio_buttonr(HTML_Label label, WebArgName n, WebArgValue value, Bool checked, Mandatory mand) - = radio_buttonr([], label, html_Id(n.name), n, value, checked, mand). - -public define CXM_Form_Field - submit(WEB_Action_Name action_name, HtmlClass class, Maybe(String) label, String button_text, List((String,String)) extra_operands) - = submit([], class, action_name, label, button_text, extra_operands). - -public define CXM_Form_Field - submit(WEB_Action_Name action_name, Maybe(String) label, String button_text, List((String,String)) extra_operands) - = submit([], htmlClass(""), action_name, label, button_text, extra_operands). - -public define CXM_Form_Field - submit(WEB_Action_Name action_name, Maybe(String) label, String button_text) - = submit([], htmlClass(""), action_name, label, button_text, []). - -public define CXM_Form_Field //Helper for older project wich use only String as Action name - submit(String _action_name, Maybe(String) label, String button_text, List((String,String)) extra_operands) - = submit([], htmlClass(""), action_name(_action_name), label, button_text, extra_operands). - - -public define CXM_Form_Field - upload(HTML_Label label, HTML_Id id, WebArgName name, Width width) - = upload([], label, id, name, width, non_mandatory). - -public define CXM_Form_Field - upload(HTML_Label label, HTML_Id id, WebArgName name, Width width, Mandatory mand) - = upload([], label, id, name, width, mand). - - public define CXM_Form_Field - input_with_help (CXM_Form_Field field, String help_text) - = input_with_help (field, failure, help_text, 250). - - public define CXM_Form_Field - input_with_help (CXM_Form_Field field, String help_text, Int width) - = input_with_help (field, failure, help_text, width). - -public define CXM_Form_Field - ip_input - ( - String label, - HTML_Id id, - WebArgName wan_prefix, - String ip - )= - label_for( - label, - id, - ip_input(id, wan_prefix, ip) - ). - - -public define CXM_Form_Field - partial_ip_input - ( - String label, - HTML_Id id, - WebArgName wan_prefix, - List(String) ip_fixed_part, - String ip - )= - label_for( - label, - id, - partial_ip_input(id, wan_prefix, ip_fixed_part, ip) - ). - -public define CXM_Form_Field - hidden - ( - WebArgName web_arg_name, - WebArgValue value - )= - hidden(html_Id(""), web_arg_name, value). - -public define CXM_Form_Field - hr - = - hr([]) -. - -public define CXM_Form_Field - div - ( - List(CoreAttrs) attrs, - HTML_In_Form content - )= - div(attrs, [content]) -. - -public define CXM_Form_Field - div - ( - HTML_In_Form content - )= - div([], [content]) -. - //--- explanation field --------------------- - -// ////////////////////////////////////////////////////////// - -define (List((List(CoreAttrs), WebArgValue, String)), List(HTML_Partial_Content)) - construct_selector_hide_show - ( - String div_id, - List((List(CoreAttrs), WebArgValue, String, HTML_Partial_Content)) items, - List((List(CoreAttrs), WebArgValue, String)) so_far_1, - List(HTML_Partial_Content) so_far_2, - Int n - ) = - if items is - { - [] then (so_far_1, so_far_2), - [h . t] then - since h is (cores, wav, label, content), - with linked_element = div_id + n, - construct_selector_hide_show(div_id, t, [([data("linked_element", linked_element) . cores], wav, label) . so_far_1], [ partial_content([], div([id(linked_element), style("display: none")], content)) . so_far_2 ], n + 1) - }. - -define (List((List(CoreAttrs), WebArgValue, String)), List(HTML_Partial_Content)) - construct_selector_hide_show - ( - String div_id, - List((List(CoreAttrs), WebArgValue, String, HTML_Partial_Content)) items - ) = construct_selector_hide_show(div_id, items, [], [], 0). - -public define HTML_In_Form - format_div_CXM_Form_Field - ( - List(CXM_Form_Field) field, - List(Web_arg) lwa, - String _class, - Bool b_with_label - ). - - -public define HTML_In_Form - format_CXM_Form_Field - ( - CXM_Form_Field ff, //CXM_Form_Field to format - List(Web_arg) lwa, //web arguments of the session, can be useful for the current drawing - String _class, - Bool b_with_label //if false, no need to show/generate label - ) = - with star = (HTML_Label l, Mandatory m) - |-> - (HTML_Label) - if b_with_label then - if m is - { - mandatory then - if l is - { - no_label then l, - label(str, help) then label(str + "*", help), - } - non_mandatory then l - } - else - no_label - , - pixels = (Width width) - |-> - if width is - { - small then 10, - narrow_small then 20, - narrow then 50, - wide then 70, - custom(n) then n - }, - - - if ff is - { - no_field then - empty, - - title(t) then - literal("