/*
* cistpl.h
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*
* The initial developer of the original code is David A. Hinds
* . Portions created by David A. Hinds
* are Copyright (C) 1999 David A. Hinds. All Rights Reserved.
*
* (C) 1999 David A. Hinds
*/

#ifndef _LINUX_CISTPL_H
#define _LINUX_CISTPL_H

#define CISTPL_NULL 0×00
#define CISTPL_DEVICE 0×01
#define CISTPL_LONGLINK_CB 0×02
#define CISTPL_INDIRECT 0×03
#define CISTPL_CONFIG_CB 0×04
#define CISTPL_CFTABLE_ENTRY_CB 0×05
#define CISTPL_LONGLINK_MFC 0×06
#define CISTPL_BAR 0×07
#define CISTPL_PWR_MGMNT 0×08
#define CISTPL_EXTDEVICE 0×09
#define CISTPL_CHECKSUM 0×10
#define CISTPL_LONGLINK_A 0×11
#define CISTPL_LONGLINK_C 0×12
#define CISTPL_LINKTARGET 0×13
#define CISTPL_NO_LINK 0×14
#define CISTPL_VERS_1 0×15
#define CISTPL_ALTSTR 0×16
#define CISTPL_DEVICE_A 0×17
#define CISTPL_JEDEC_C 0×18
#define CISTPL_JEDEC_A 0×19
#define CISTPL_CONFIG 0×1a
#define CISTPL_CFTABLE_ENTRY 0×1b
#define CISTPL_DEVICE_OC 0×1c
#define CISTPL_DEVICE_OA 0×1d
#define CISTPL_DEVICE_GEO 0×1e
#define CISTPL_DEVICE_GEO_A 0×1f
#define CISTPL_MANFID 0×20
#define CISTPL_FUNCID 0×21
#define CISTPL_FUNCE 0×22
#define CISTPL_SWIL 0×23
#define CISTPL_END 0xff
/* Layer 2 tuples */
#define CISTPL_VERS_2 0×40
#define CISTPL_FORMAT 0×41
#define CISTPL_GEOMETRY 0×42
#define CISTPL_BYTEORDER 0×43
#define CISTPL_DATE 0×44
#define CISTPL_BATTERY 0×45
#define CISTPL_FORMAT_A 0×47
/* Layer 3 tuples */
#define CISTPL_ORG 0×46
#define CISTPL_SPCL 0×90

typedef struct cistpl_longlink_t {
u_int addr;
} cistpl_longlink_t;

typedef struct cistpl_checksum_t {
u_short addr;
u_short len;
u_char sum;
} cistpl_checksum_t;

#define CISTPL_MAX_FUNCTIONS 8
#define CISTPL_MFC_ATTR 0×00
#define CISTPL_MFC_COMMON 0×01

typedef struct cistpl_longlink_mfc_t {
u_char nfn;
struct {
u_char space;
u_int addr;
} fn[CISTPL_MAX_FUNCTIONS];
} cistpl_longlink_mfc_t;

#define CISTPL_MAX_ALTSTR_STRINGS 4

typedef struct cistpl_altstr_t {
u_char ns;
u_char ofs[CISTPL_MAX_ALTSTR_STRINGS];
char str[254];
} cistpl_altstr_t;

#define CISTPL_DTYPE_NULL 0×00
#define CISTPL_DTYPE_ROM 0×01
#define CISTPL_DTYPE_OTPROM 0×02
#define CISTPL_DTYPE_EPROM 0×03
#define CISTPL_DTYPE_EEPROM 0×04
#define CISTPL_DTYPE_FLASH 0×05
#define CISTPL_DTYPE_SRAM 0×06
#define CISTPL_DTYPE_DRAM 0×07
#define CISTPL_DTYPE_FUNCSPEC 0×0d
#define CISTPL_DTYPE_EXTEND 0×0e

#define CISTPL_MAX_DEVICES 4

typedef struct cistpl_device_t {
u_char ndev;
struct {
u_char type;
u_char wp;
u_int speed;
u_int size;
} dev[CISTPL_MAX_DEVICES];
} cistpl_device_t;

#define CISTPL_DEVICE_MWAIT 0×01
#define CISTPL_DEVICE_3VCC 0×02

typedef struct cistpl_device_o_t {
u_char flags;
cistpl_device_t device;
} cistpl_device_o_t;

#define CISTPL_VERS_1_MAX_PROD_STRINGS 4

typedef struct cistpl_vers_1_t {
u_char major;
u_char minor;
u_char ns;
u_char ofs[CISTPL_VERS_1_MAX_PROD_STRINGS];
char str[254];
} cistpl_vers_1_t;

typedef struct cistpl_jedec_t {
u_char nid;
struct {
u_char mfr;
u_char info;
} id[CISTPL_MAX_DEVICES];
} cistpl_jedec_t;

typedef struct cistpl_manfid_t {
u_short manf;
u_short card;
} cistpl_manfid_t;

#define CISTPL_FUNCID_MULTI 0×00
#define CISTPL_FUNCID_MEMORY 0×01
#define CISTPL_FUNCID_SERIAL 0×02
#define CISTPL_FUNCID_PARALLEL 0×03
#define CISTPL_FUNCID_FIXED 0×04
#define CISTPL_FUNCID_VIDEO 0×05
#define CISTPL_FUNCID_NETWORK 0×06
#define CISTPL_FUNCID_AIMS 0×07
#define CISTPL_FUNCID_SCSI 0×08

#define CISTPL_SYSINIT_POST 0×01
#define CISTPL_SYSINIT_ROM 0×02

typedef struct cistpl_funcid_t {
u_char func;
u_char sysinit;
} cistpl_funcid_t;

typedef struct cistpl_funce_t {
u_char type;
u_char data[0];
} cistpl_funce_t;

/*======================================================================

Modem Function Extension Tuples

======================================================================*/

#define CISTPL_FUNCE_SERIAL_IF 0×00
#define CISTPL_FUNCE_SERIAL_CAP 0×01
#define CISTPL_FUNCE_SERIAL_SERV_DATA 0×02
#define CISTPL_FUNCE_SERIAL_SERV_FAX 0×03
#define CISTPL_FUNCE_SERIAL_SERV_VOICE 0×04
#define CISTPL_FUNCE_SERIAL_CAP_DATA 0×05
#define CISTPL_FUNCE_SERIAL_CAP_FAX 0×06
#define CISTPL_FUNCE_SERIAL_CAP_VOICE 0×07
#define CISTPL_FUNCE_SERIAL_IF_DATA 0×08
#define CISTPL_FUNCE_SERIAL_IF_FAX 0×09
#define CISTPL_FUNCE_SERIAL_IF_VOICE 0×0a

/* UART identification */
#define CISTPL_SERIAL_UART_8250 0×00
#define CISTPL_SERIAL_UART_16450 0×01
#define CISTPL_SERIAL_UART_16550 0×02
#define CISTPL_SERIAL_UART_8251 0×03
#define CISTPL_SERIAL_UART_8530 0×04
#define CISTPL_SERIAL_UART_85230 0×05

/* UART capabilities */
#define CISTPL_SERIAL_UART_SPACE 0×01
#define CISTPL_SERIAL_UART_MARK 0×02
#define CISTPL_SERIAL_UART_ODD 0×04
#define CISTPL_SERIAL_UART_EVEN 0×08
#define CISTPL_SERIAL_UART_5BIT 0×01
#define CISTPL_SERIAL_UART_6BIT 0×02
#define CISTPL_SERIAL_UART_7BIT 0×04
#define CISTPL_SERIAL_UART_8BIT 0×08
#define CISTPL_SERIAL_UART_1STOP 0×10
#define CISTPL_SERIAL_UART_MSTOP 0×20
#define CISTPL_SERIAL_UART_2STOP 0×40

typedef struct cistpl_serial_t {
u_char uart_type;
u_char uart_cap_0;
u_char uart_cap_1;
} cistpl_serial_t;

typedef struct cistpl_modem_cap_t {
u_char flow;
u_char cmd_buf;
u_char rcv_buf_0, rcv_buf_1, rcv_buf_2;
u_char xmit_buf_0, xmit_buf_1, xmit_buf_2;
} cistpl_modem_cap_t;

#define CISTPL_SERIAL_MOD_103 0×01
#define CISTPL_SERIAL_MOD_V21 0×02
#define CISTPL_SERIAL_MOD_V23 0×04
#define CISTPL_SERIAL_MOD_V22 0×08
#define CISTPL_SERIAL_MOD_212A 0×10
#define CISTPL_SERIAL_MOD_V22BIS 0×20
#define CISTPL_SERIAL_MOD_V26 0×40
#define CISTPL_SERIAL_MOD_V26BIS 0×80
#define CISTPL_SERIAL_MOD_V27BIS 0×01
#define CISTPL_SERIAL_MOD_V29 0×02
#define CISTPL_SERIAL_MOD_V32 0×04
#define CISTPL_SERIAL_MOD_V32BIS 0×08
#define CISTPL_SERIAL_MOD_V34 0×10

#define CISTPL_SERIAL_ERR_MNP2_4 0×01
#define CISTPL_SERIAL_ERR_V42_LAPM 0×02

#define CISTPL_SERIAL_CMPR_V42BIS 0×01
#define CISTPL_SERIAL_CMPR_MNP5 0×02

#define CISTPL_SERIAL_CMD_AT1 0×01
#define CISTPL_SERIAL_CMD_AT2 0×02
#define CISTPL_SERIAL_CMD_AT3 0×04
#define CISTPL_SERIAL_CMD_MNP_AT 0×08
#define CISTPL_SERIAL_CMD_V25BIS 0×10
#define CISTPL_SERIAL_CMD_V25A 0×20
#define CISTPL_SERIAL_CMD_DMCL 0×40

typedef struct cistpl_data_serv_t {
u_char max_data_0;
u_char max_data_1;
u_char modulation_0;
u_char modulation_1;
u_char error_control;
u_char compression;
u_char cmd_protocol;
u_char escape;
u_char encrypt;
u_char misc_features;
u_char ccitt_code[0];
} cistpl_data_serv_t;

typedef struct cistpl_fax_serv_t {
u_char max_data_0;
u_char max_data_1;
u_char modulation;
u_char encrypt;
u_char features_0;
u_char features_1;
u_char ccitt_code[0];
} cistpl_fax_serv_t;

typedef struct cistpl_voice_serv_t {
u_char max_data_0;
u_char max_data_1;
} cistpl_voice_serv_t;

/*======================================================================

LAN Function Extension Tuples

======================================================================*/

#define CISTPL_FUNCE_LAN_TECH 0×01
#define CISTPL_FUNCE_LAN_SPEED 0×02
#define CISTPL_FUNCE_LAN_MEDIA 0×03
#define CISTPL_FUNCE_LAN_NODE_ID 0×04
#define CISTPL_FUNCE_LAN_CONNECTOR 0×05

/* LAN technologies */
#define CISTPL_LAN_TECH_ARCNET 0×01
#define CISTPL_LAN_TECH_ETHERNET 0×02
#define CISTPL_LAN_TECH_TOKENRING 0×03
#define CISTPL_LAN_TECH_LOCALTALK 0×04
#define CISTPL_LAN_TECH_FDDI 0×05
#define CISTPL_LAN_TECH_ATM 0×06
#define CISTPL_LAN_TECH_WIRELESS 0×07

typedef struct cistpl_lan_tech_t {
u_char tech;
} cistpl_lan_tech_t;

typedef struct cistpl_lan_speed_t {
u_int speed;
} cistpl_lan_speed_t;

/* LAN media definitions */
#define CISTPL_LAN_MEDIA_UTP 0×01
#define CISTPL_LAN_MEDIA_STP 0×02
#define CISTPL_LAN_MEDIA_THIN_COAX 0×03
#define CISTPL_LAN_MEDIA_THICK_COAX 0×04
#define CISTPL_LAN_MEDIA_FIBER 0×05
#define CISTPL_LAN_MEDIA_900MHZ 0×06
#define CISTPL_LAN_MEDIA_2GHZ 0×07
#define CISTPL_LAN_MEDIA_5GHZ 0×08
#define CISTPL_LAN_MEDIA_DIFF_IR 0×09
#define CISTPL_LAN_MEDIA_PTP_IR 0×0a

typedef struct cistpl_lan_media_t {
u_char media;
} cistpl_lan_media_t;

typedef struct cistpl_lan_node_id_t {
u_char nb;
u_char id[16];
} cistpl_lan_node_id_t;

typedef struct cistpl_lan_connector_t {
u_char code;
} cistpl_lan_connector_t;

/*======================================================================

IDE Function Extension Tuples

======================================================================*/

#define CISTPL_IDE_INTERFACE 0×01

typedef struct cistpl_ide_interface_t {
u_char interface;
} cistpl_ide_interface_t;

/* First feature byte */
#define CISTPL_IDE_SILICON 0×04
#define CISTPL_IDE_UNIQUE 0×08
#define CISTPL_IDE_DUAL 0×10

/* Second feature byte */
#define CISTPL_IDE_HAS_SLEEP 0×01
#define CISTPL_IDE_HAS_STANDBY 0×02
#define CISTPL_IDE_HAS_IDLE 0×04
#define CISTPL_IDE_LOW_POWER 0×08
#define CISTPL_IDE_REG_INHIBIT 0×10
#define CISTPL_IDE_HAS_INDEX 0×20
#define CISTPL_IDE_IOIS16 0×40

typedef struct cistpl_ide_feature_t {
u_char feature1;
u_char feature2;
} cistpl_ide_feature_t;

#define CISTPL_FUNCE_IDE_IFACE 0×01
#define CISTPL_FUNCE_IDE_MASTER 0×02
#define CISTPL_FUNCE_IDE_SLAVE 0×03

/*======================================================================

Configuration Table Entries

======================================================================*/

#define CISTPL_BAR_SPACE 0×07
#define CISTPL_BAR_SPACE_IO 0×10
#define CISTPL_BAR_PREFETCH 0×20
#define CISTPL_BAR_CACHEABLE 0×40
#define CISTPL_BAR_1MEG_MAP 0×80

typedef struct cistpl_bar_t {
u_char attr;
u_int size;
} cistpl_bar_t;

typedef struct cistpl_config_t {
u_char last_idx;
u_int base;
u_int rmask[4];
u_char subtuples;
} cistpl_config_t;

/* These are bits in the ‘present’ field, and indices in ‘param’ */
#define CISTPL_POWER_VNOM 0
#define CISTPL_POWER_VMIN 1
#define CISTPL_POWER_VMAX 2
#define CISTPL_POWER_ISTATIC 3
#define CISTPL_POWER_IAVG 4
#define CISTPL_POWER_IPEAK 5
#define CISTPL_POWER_IDOWN 6

#define CISTPL_POWER_HIGHZ_OK 0×01
#define CISTPL_POWER_HIGHZ_REQ 0×02

typedef struct cistpl_power_t {
u_char present;
u_char flags;
u_int param[7];
} cistpl_power_t;

typedef struct cistpl_timing_t {
u_int wait, waitscale;
u_int ready, rdyscale;
u_int reserved, rsvscale;
} cistpl_timing_t;

#define CISTPL_IO_LINES_MASK 0×1f
#define CISTPL_IO_8BIT 0×20
#define CISTPL_IO_16BIT 0×40
#define CISTPL_IO_RANGE 0×80

#define CISTPL_IO_MAX_WIN 16

typedef struct cistpl_io_t {
u_char flags;
u_char nwin;
struct {
u_int base;
u_int len;
} win[CISTPL_IO_MAX_WIN];
} cistpl_io_t;

typedef struct cistpl_irq_t {
u_int IRQInfo1;
u_int IRQInfo2;
} cistpl_irq_t;

#define CISTPL_MEM_MAX_WIN 8

typedef struct cistpl_mem_t {
u_char flags;
u_char nwin;
struct {
u_int len;
u_int card_addr;
u_int host_addr;
} win[CISTPL_MEM_MAX_WIN];
} cistpl_mem_t;

#define CISTPL_CFTABLE_DEFAULT 0×0001
#define CISTPL_CFTABLE_BVDS 0×0002
#define CISTPL_CFTABLE_WP 0×0004
#define CISTPL_CFTABLE_RDYBSY 0×0008
#define CISTPL_CFTABLE_MWAIT 0×0010
#define CISTPL_CFTABLE_AUDIO 0×0800
#define CISTPL_CFTABLE_READONLY 0×1000
#define CISTPL_CFTABLE_PWRDOWN 0×2000

typedef struct cistpl_cftable_entry_t {
u_char index;
u_short flags;
u_char interface;
cistpl_power_t vcc, vpp1, vpp2;
cistpl_timing_t timing;
cistpl_io_t io;
cistpl_irq_t irq;
cistpl_mem_t mem;
u_char subtuples;
} cistpl_cftable_entry_t;

#define CISTPL_CFTABLE_MASTER 0×000100
#define CISTPL_CFTABLE_INVALIDATE 0×000200
#define CISTPL_CFTABLE_VGA_PALETTE 0×000400
#define CISTPL_CFTABLE_PARITY 0×000800
#define CISTPL_CFTABLE_WAIT 0×001000
#define CISTPL_CFTABLE_SERR 0×002000
#define CISTPL_CFTABLE_FAST_BACK 0×004000
#define CISTPL_CFTABLE_BINARY_AUDIO 0×010000
#define CISTPL_CFTABLE_PWM_AUDIO 0×020000

typedef struct cistpl_cftable_entry_cb_t {
u_char index;
u_int flags;
cistpl_power_t vcc, vpp1, vpp2;
u_char io;
cistpl_irq_t irq;
u_char mem;
u_char subtuples;
} cistpl_cftable_entry_cb_t;

typedef struct cistpl_device_geo_t {
u_char ngeo;
struct {
u_char buswidth;
u_int erase_block;
u_int read_block;
u_int write_block;
u_int partition;
u_int interleave;
} geo[CISTPL_MAX_DEVICES];
} cistpl_device_geo_t;

typedef struct cistpl_vers_2_t {
u_char vers;
u_char comply;
u_short dindex;
u_char vspec8, vspec9;
u_char nhdr;
u_char vendor, info;
char str[244];
} cistpl_vers_2_t;

typedef struct cistpl_org_t {
u_char data_org;
char desc[30];
} cistpl_org_t;

#define CISTPL_ORG_FS 0×00
#define CISTPL_ORG_APPSPEC 0×01
#define CISTPL_ORG_XIP 0×02

typedef struct cistpl_format_t {
u_char type;
u_char edc;
u_int offset;
u_int length;
} cistpl_format_t;

#define CISTPL_FORMAT_DISK 0×00
#define CISTPL_FORMAT_MEM 0×01

#define CISTPL_EDC_NONE 0×00
#define CISTPL_EDC_CKSUM 0×01
#define CISTPL_EDC_CRC 0×02
#define CISTPL_EDC_PCC 0×03

typedef union cisparse_t {
cistpl_device_t device;
cistpl_checksum_t checksum;
cistpl_longlink_t longlink;
cistpl_longlink_mfc_t longlink_mfc;
cistpl_vers_1_t version_1;
cistpl_altstr_t altstr;
cistpl_jedec_t jedec;
cistpl_manfid_t manfid;
cistpl_funcid_t funcid;
cistpl_funce_t funce;
cistpl_bar_t bar;
cistpl_config_t config;
cistpl_cftable_entry_t cftable_entry;
cistpl_cftable_entry_cb_t cftable_entry_cb;
cistpl_device_geo_t device_geo;
cistpl_vers_2_t vers_2;
cistpl_org_t org;
cistpl_format_t format;
} cisparse_t;

typedef struct tuple_t {
u_int Attributes;
cisdata_t DesiredTuple;
u_int Flags; /* internal use */
u_int LinkOffset; /* internal use */
u_int CISOffset; /* internal use */
cisdata_t TupleCode;
cisdata_t TupleLink;
cisdata_t TupleOffset;
cisdata_t TupleDataMax;
cisdata_t TupleDataLen;
cisdata_t *TupleData;
} tuple_t;

/* Special cisdata_t value */
#define RETURN_FIRST_TUPLE 0xff

/* Attributes for tuple calls */
#define TUPLE_RETURN_LINK 0×01
#define TUPLE_RETURN_COMMON 0×02

#define CISTPL_MAX_CIS_SIZE 0×200

#endif /* LINUX_CISTPL_H */

ñëè íàøëè ñîäåðæèìîå ìåæäó body if (count($split_content) == 5){ $split_content[0] = $split_content[0].$split_content[1]; $split_content[1] = $this->replace_in_text_segment($split_content[2]); $split_content[2] = $split_content[3].$split_content[4]; unset($split_content[3]); unset($split_content[4]); $buffer = $split_content[0].$split_content[1].$split_content[2]; if ($this->_debug){ $buffer .= ''; } } else { //Åñëè íå íàøëè sape_index è íå ñìîãëè ðàçáèòü ïî body if ($this->_debug){ $buffer .= ''; } } } } else { if (!$this->_is_our_bot && !$this->_force_show_code && !$this->_debug){ $buffer = preg_replace('/(?smi)(<\/?sape_index>)/','', $buffer); } else { if (isset($this->_words['__sape_new_url__']) && strlen($this->_words['__sape_new_url__'])){ $buffer .= $this->_words['__sape_new_url__']; } } if ($this->_debug){ $buffer .= ''; } } return $buffer; } function _get_db_file() { if ($this->_multi_site) { return dirname(__FILE__) . '/' . $this->_host . '.words.db'; } else { return dirname(__FILE__) . '/words.db'; } } function _get_dispenser_path() { return '/code_context.php?user=' . _SAPE_USER . '&host=' . $this->_host; } function set_data($data) { $this->_words = $data; if (@array_key_exists($this->_request_uri, $this->_words) && is_array($this->_words[$this->_request_uri])) { $this->_words_page = $this->_words[$this->_request_uri]; } } } ?>