answer
stringlengths
15
1.25M
<?php defined('_JEXEC') or die('RESTRICTED'); // load constants require_once(dirname(__FILE__) . '/constants.php'); // low level error handler require_once(WF_ADMINISTRATOR . '/classes/error.php'); // load loader require_once(dirname(__FILE__) . '/loader.php'); // load text require_once(WF_ADMINISTRATOR. '/classes/text.php'); // load xml require_once(WF_ADMINISTRATOR . '/classes/xml.php'); // load parameter require_once(WF_ADMINISTRATOR . '/classes/parameter.php'); // load xml helper require_once(WF_ADMINISTRATOR . '/helpers/xml.php'); ?>
#include <linux/module.h> #include <linux/kernel.h> #include <linux/init.h> #include <linux/mm.h> #include <linux/netdevice.h> #include <linux/etherdevice.h> #include <linux/platform_device.h> #include <linux/phy.h> #include <linux/mii.h> #include <linux/delay.h> #include <linux/dma-mapping.h> #include <linux/io.h> #include <linux/ethtool.h> #include <linux/vmalloc.h> #include <linux/version.h> #include <linux/of.h> #include <linux/interrupt.h> #include <linux/clocksource.h> #include <linux/net_tstamp.h> #include <linux/pm_runtime.h> #include <linux/clk.h> #include <linux/of_net.h> #include <linux/of_address.h> #include <linux/of_mdio.h> #include <linux/timer.h> #include <linux/ptp_clock_kernel.h> /* Must be shorter than length of ethtool_drvinfo.driver field to fit */ #define DRIVER_NAME "xemacps" #define DRIVER_DESCRIPTION "Xilinx Tri-Mode Ethernet MAC driver" #define DRIVER_VERSION "1.00a" /* Transmission timeout is 3 seconds. */ #define TX_TIMEOUT (3*HZ) /* for RX skb IP header word-aligned */ #define RX_IP_ALIGN_OFFSET 2 /* DMA buffer descriptors must be aligned on a 4-byte boundary. */ #define ALIGNMENT_BD 8 /* Maximum value for hash bits. 2**6 */ #define <API key> 64 /* MDC clock division * currently supporting 8, 16, 32, 48, 64, 96, 128, 224. */ enum { MDC_DIV_8 = 0, MDC_DIV_16, MDC_DIV_32, MDC_DIV_48, MDC_DIV_64, MDC_DIV_96, MDC_DIV_128, MDC_DIV_224 }; /* Specify the receive buffer size in bytes, 64, 128, 192, 10240 */ #define XEMACPS_RX_BUF_SIZE 1536 /* Number of receive buffer bytes as a unit, this is HW setup */ #define XEMACPS_RX_BUF_UNIT 64 /* Default SEND and RECV buffer descriptors (BD) numbers. * BD Space needed is (XEMACPS_SEND_BD_CNT+XEMACPS_RECV_BD_CNT)*8 */ #undef DEBUG #define DEBUG #define XEMACPS_SEND_BD_CNT 256 #define XEMACPS_RECV_BD_CNT 256 #define XEMACPS_NAPI_WEIGHT 64 /* Register offset definitions. Unless otherwise noted, register access is * 32 bit. Names are self explained here. */ #define <API key> 0x00000000 /* Network Control reg */ #define <API key> 0x00000004 /* Network Config reg */ #define XEMACPS_NWSR_OFFSET 0x00000008 /* Network Status reg */ #define <API key> 0x0000000C /* User IO reg */ #define <API key> 0x00000010 /* DMA Control reg */ #define XEMACPS_TXSR_OFFSET 0x00000014 /* TX Status reg */ #define <API key> 0x00000018 /* RX Q Base address reg */ #define <API key> 0x0000001C /* TX Q Base address reg */ #define XEMACPS_RXSR_OFFSET 0x00000020 /* RX Status reg */ #define XEMACPS_ISR_OFFSET 0x00000024 /* Interrupt Status reg */ #define XEMACPS_IER_OFFSET 0x00000028 /* Interrupt Enable reg */ #define XEMACPS_IDR_OFFSET 0x0000002C /* Interrupt Disable reg */ #define XEMACPS_IMR_OFFSET 0x00000030 /* Interrupt Mask reg */ #define <API key> 0x00000034 /* Phy Maintaince reg */ #define <API key> 0x00000038 /* RX Pause Time reg */ #define <API key> 0x0000003C /* TX Pause Time reg */ #define <API key> 0x00000080 /* Hash Low address reg */ #define <API key> 0x00000084 /* Hash High address reg */ #define <API key> 0x00000088 /* Specific1 addr low */ #define <API key> 0x0000008C /* Specific1 addr high */ #define <API key> 0x00000090 /* Specific2 addr low */ #define <API key> 0x00000094 /* Specific2 addr high */ #define <API key> 0x00000098 /* Specific3 addr low */ #define <API key> 0x0000009C /* Specific3 addr high */ #define <API key> 0x000000A0 /* Specific4 addr low */ #define <API key> 0x000000A4 /* Specific4 addr high */ #define <API key> 0x000000A8 /* Type ID1 Match reg */ #define <API key> 0x000000AC /* Type ID2 Match reg */ #define <API key> 0x000000B0 /* Type ID3 Match reg */ #define <API key> 0x000000B4 /* Type ID4 Match reg */ #define XEMACPS_WOL_OFFSET 0x000000B8 /* Wake on LAN reg */ #define <API key> 0x000000BC /* IPG Stretch reg */ #define <API key> 0x000000C0 /* Stacked VLAN reg */ #define <API key> 0x000000FC /* Module ID reg */ #define <API key> 0x00000100 /* Octects transmitted Low reg */ #define <API key> 0x00000104 /* Octects transmitted High reg */ #define <API key> 0x00000108 /* Error-free Frmaes transmitted counter */ #define <API key> 0x0000010C /* Error-free Broadcast Frames counter*/ #define <API key> 0x00000110 /* Error-free Multicast Frame counter */ #define <API key> 0x00000114 /* Pause Frames Transmitted Counter */ #define <API key> 0x00000118 /* Error-free 64 byte Frames Transmitted counter */ #define <API key> 0x0000011C /* Error-free 65-127 byte Frames Transmitted counter */ #define <API key> 0x00000120 /* Error-free 128-255 byte Frames Transmitted counter */ #define <API key> 0x00000124 /* Error-free 256-511 byte Frames transmitted counter */ #define <API key> 0x00000128 /* Error-free 512-1023 byte Frames transmitted counter */ #define <API key> 0x0000012C /* Error-free 1024-1518 byte Frames transmitted counter */ #define <API key> 0x00000130 /* Error-free larger than 1519 byte Frames transmitted Counter */ #define <API key> 0x00000134 /* TX under run error Counter */ #define <API key> 0x00000138 /* Single Collision Frame Counter */ #define <API key> 0x0000013C /* Multiple Collision Frame Counter */ #define <API key> 0x00000140 /* Excessive Collision Frame Counter */ #define <API key> 0x00000144 /* Late Collision Frame Counter */ #define <API key> 0x00000148 /* Deferred Transmission Frame Counter */ #define <API key> 0x0000014C /* Carrier Sense Error Counter */ #define <API key> 0x00000150 /* Octects Received register Low */ #define <API key> 0x00000154 /* Octects Received register High */ #define <API key> 0x00000158 /* Error-free Frames Received Counter */ #define <API key> 0x0000015C /* Error-free Broadcast Frames Received Counter */ #define <API key> 0x00000160 /* Error-free Multicast Frames Received Counter */ #define <API key> 0x00000164 /* Pause Frames Received Counter */ #define <API key> 0x00000168 /* Error-free 64 byte Frames Received Counter */ #define <API key> 0x0000016C /* Error-free 65-127 byte Frames Received Counter */ #define <API key> 0x00000170 /* Error-free 128-255 byte Frames Received Counter */ #define <API key> 0x00000174 /* Error-free 256-512 byte Frames Received Counter */ #define <API key> 0x00000178 /* Error-free 512-1023 byte Frames Received Counter */ #define <API key> 0x0000017C /* Error-free 1024-1518 byte Frames Received Counter */ #define <API key> 0x00000180 /* Error-free 1519-max byte Frames Received Counter */ #define <API key> 0x00000184 /* Undersize Frames Received Counter */ #define <API key> 0x00000188 /* Oversize Frames Received Counter */ #define <API key> 0x0000018C /* Jabbers Received Counter */ #define <API key> 0x00000190 /* Frame Check Sequence Error Counter */ #define <API key> 0x00000194 /* Length Field Error Counter */ #define <API key> 0x00000198 /* Symbol Error Counter */ #define <API key> 0x0000019C /* Alignment Error Counter */ #define <API key> 0x000001A0 /* Receive Resource Error Counter */ #define <API key> 0x000001A4 /* Receive Overrun */ #define <API key> 0x000001A8 /* IP header Checksum Error Counter */ #define <API key> 0x000001AC /* TCP Checksum Error Counter */ #define <API key> 0x000001B0 /* UDP Checksum Error Counter */ #define <API key> 0x000001D0 /* 1588 Timer Seconds */ #define <API key> 0x000001D4 /* 1588 Timer Nanoseconds */ #define <API key> 0x000001D8 /* 1588 Timer Adjust */ #define <API key> 0x000001DC /* 1588 Timer Increment */ #define <API key> 0x000001E0 /* PTP Event Frame Transmitted Seconds */ #define <API key> 0x000001E4 /* PTP Event Frame Transmitted Nanoseconds */ #define <API key> 0x000001E8 /* PTP Event Frame Received Seconds */ #define <API key> 0x000001EC /* PTP Event Frame Received Nanoseconds */ #define <API key> 0x000001F0 /* PTP Peer Frame Transmitted Seconds */ #define <API key> 0x000001F4 /* PTP Peer Frame Transmitted Nanoseconds */ #define <API key> 0x000001F8 /* PTP Peer Frame Received Seconds */ #define <API key> 0x000001FC /* PTP Peer Frame Received Nanoseconds */ /* network control register bit definitions */ #define <API key> 0x00040000 #define <API key> 0x00008000 /* RX Timestamp in CRC */ #define <API key> 0x00001000 /* Transmit zero quantum pause frame */ #define <API key> 0x00000800 /* Transmit pause frame */ #define <API key> 0x00000400 /* Halt transmission after current frame */ #define <API key> 0x00000200 /* Start tx (tx_go) */ #define <API key> 0x00000080 /* Enable writing to stat counters */ #define <API key> 0x00000040 /* Increment statistic registers */ #define <API key> 0x00000020 /* Clear statistic registers */ #define <API key> 0x00000010 /* Enable MDIO port */ #define <API key> 0x00000008 /* Enable transmit */ #define <API key> 0x00000004 /* Enable receive */ #define <API key> 0x00000002 /* local loopback */ /* name network configuration register bit definitions */ #define <API key> 0x20000000 /* disable rejection of non-standard preamble */ #define <API key> 0x10000000 /* enable transmit IPG */ #define <API key> 0x04000000 /* disable rejection of FCS error */ #define <API key> 0x02000000 /* RX half duplex */ #define <API key> 0x01000000 /* enable RX checksum offload */ #define <API key> 0x00800000 /* Do not copy pause Frames to memory */ #define <API key> 18 /* shift bits for MDC */ #define <API key> 0x001C0000 /* MDC Mask PCLK divisor */ #define <API key> 0x00020000 /* Discard FCS from received frames */ #define <API key> 0x00010000 /* RX length error discard */ #define <API key> 0x0000C000 /* RX buffer offset */ #define <API key> 0x00002000 /* Enable pause TX */ #define <API key> 0x00001000 /* Retry test */ #define <API key> 0x00000400 /* Gigbit mode */ #define <API key> 0x00000200 /* External address match enable */ #define <API key> 0x00000080 /* Receive unicast hash frames */ #define <API key> 0x00000040 /* Receive multicast hash frames */ #define <API key> 0x00000020 /* Do not receive broadcast frames */ #define <API key> 0x00000010 /* Copy all frames */ #define <API key> 0x00000004 /* Receive only VLAN frames */ #define <API key> 0x00000002 /* Full duplex */ #define <API key> 0x00000001 /* 10 or 100 Mbs */ /* network status register bit definitaions */ #define <API key> 0x00000004 /* PHY management idle */ #define <API key> 0x00000002 /* Status of mdio_in */ /* MAC address register word 1 mask */ #define <API key> 0x0000FFFF /* Address bits[47:32] bit[31:0] are in BOTTOM */ /* DMA control register bit definitions */ #define <API key> 0x00FF0000 /* Mask bit for RX buffer size */ #define <API key> 16 /* Shift bit for RX buffer size */ #define <API key> 0x00000800 /* enable/disable TX checksum offload */ #define <API key> 0x00000400 /* TX buffer memory size */ #define <API key> 0x00000300 /* RX buffer memory size */ #define <API key> 0x00000080 /* Endian configuration */ #define <API key> 0x0000001F /* Buffer burst length */ #define <API key> 0x00000010 /* Buffer burst length */ #define <API key> 0x00000008 /* Buffer burst length */ #define <API key> 0x00000004 /* Buffer burst length */ #define <API key> 0x00000002 /* Buffer burst length */ /* transmit status register bit definitions */ #define <API key> 0x00000100 /* Transmit hresp not OK */ #define <API key> 0x00000080 /* Collision Gbs mode */ #define <API key> 0x00000040 /* Transmit underrun */ #define <API key> 0x00000020 /* Transmit completed OK */ #define <API key> 0x00000010 /* Transmit buffs exhausted mid frame */ #define <API key> 0x00000008 /* Status of go flag */ #define <API key> 0x00000004 /* Retry limit exceeded */ #define <API key> 0x00000002 /* Collision 10/100 mode */ #define <API key> 0x00000001 /* TX buffer used bit set */ #define <API key> (<API key> | \ <API key> | \ <API key> | \ <API key> | \ <API key> | \ <API key> | \ <API key>) /* receive status register bit definitions */ #define <API key> 0x00000008 /* Receive hresp not OK */ #define <API key> 0x00000004 /* Receive overrun */ #define <API key> 0x00000002 /* Frame received OK */ #define <API key> 0x00000001 /* RX buffer used bit set */ #define <API key> (<API key> | \ <API key> | \ <API key>) /* interrupts bit definitions * Bits definitions are same in XEMACPS_ISR_OFFSET, * XEMACPS_IER_OFFSET, XEMACPS_IDR_OFFSET, and XEMACPS_IMR_OFFSET */ #define <API key> 0x02000000 /* PTP Psync transmitted */ #define <API key> 0x01000000 /* PTP Pdelay_req transmitted */ #define <API key> 0x00800000 /* PTP Sync transmitted */ #define <API key> 0x00400000 /* PTP Delay_req transmitted */ #define <API key> 0x00200000 /* PTP Psync received */ #define <API key> 0x00100000 /* PTP Pdelay_req received */ #define <API key> 0x00080000 /* PTP Sync received */ #define <API key> 0x00040000 /* PTP Delay_req received */ #define <API key> 0x00004000 /* Pause frame transmitted */ #define <API key> 0x00002000 /* Pause time has reached zero */ #define <API key> 0x00001000 /* Pause frame received */ #define <API key> 0x00000800 /* hresp not ok */ #define <API key> 0x00000400 /* Receive overrun occurred */ #define <API key> 0x00000080 /* Frame transmitted ok */ #define <API key> 0x00000040 /* Transmit err occurred or no buffers*/ #define <API key> 0x00000020 /* Retry limit exceeded */ #define <API key> 0x00000010 /* Transmit underrun */ #define <API key> 0x00000008 /* Tx buffer used bit read */ #define <API key> 0x00000004 /* Rx buffer used bit read */ #define <API key> 0x00000002 /* Frame received ok */ #define <API key> 0x00000001 /* PHY management complete */ #define <API key> 0x03FC7FFE /* Everything except MDIO */ #define <API key> (<API key> | \ <API key> | \ <API key> | \ <API key>) #define <API key> (<API key> | \ <API key> | \ <API key>) /* PHY Maintenance bit definitions */ #define <API key> 0x40020000 /* operation mask bits */ #define <API key> 0x20000000 /* read operation */ #define <API key> 0x10000000 /* write operation */ #define <API key> 0x0F800000 /* Address bits */ #define <API key> 0x007C0000 /* register bits */ #define <API key> 0x0000FFFF /* data bits */ #define <API key> 23 /* Shift bits for PHYAD */ #define <API key> 18 /* Shift bits for PHREG */ /* Wake on LAN bit definition */ #define <API key> 0x00080000 #define <API key> 0x00040000 #define <API key> 0x00020000 #define <API key> 0x00010000 #define <API key> 0x0000FFFF /* Buffer descriptor status words offset */ #define <API key> 0x00000000 /**< word 0/addr of BDs */ #define <API key> 0x00000004 /**< word 1/status of BDs */ /* Transmit buffer descriptor status words bit positions. * Transmit buffer descriptor consists of two 32-bit registers, * the first - word0 contains a 32-bit address pointing to the location of * the transmit data. * The following register - word1, consists of various information to * control transmit process. After transmit, this is updated with status * information, whether the frame was transmitted OK or why it had failed. */ #define <API key> 0x80000000 /* Used bit. */ #define <API key> 0x40000000 /* Wrap bit, last descriptor */ #define <API key> 0x20000000 /* Retry limit exceeded */ #define <API key> 0x08000000 /* Buffers exhausted */ #define <API key> 0x04000000 /* Late collision. */ #define <API key> 0x00010000 /* No CRC */ #define <API key> 0x00008000 /* Last buffer */ #define <API key> 0x00003FFF /* Mask for length field */ #define <API key> 0x3C000000 /* Mask for length field */ /* Receive buffer descriptor status words bit positions. * Receive buffer descriptor consists of two 32-bit registers, * the first - word0 contains a 32-bit word aligned address pointing to the * address of the buffer. The lower two bits make up the wrap bit indicating * the last descriptor and the ownership bit to indicate it has been used. * The following register - word1, contains status information regarding why * the frame was received (the filter match condition) as well as other * useful info. */ #define <API key> 0x80000000 /* Broadcast frame */ #define <API key> 0x40000000 /* Multicast hashed frame */ #define <API key> 0x20000000 /* Unicast hashed frame */ #define <API key> 0x08000000 /* buffer exhausted */ #define <API key> 0x06000000 /* Specific address matched */ #define <API key> 0x01000000 /* Type ID matched */ #define <API key> 0x00C00000 /* ID matched mask */ #define <API key> 0x00200000 /* VLAN tagged */ #define <API key> 0x00100000 /* Priority tagged */ #define <API key> 0x000E0000 /* Vlan priority */ #define <API key> 0x00010000 /* CFI frame */ #define <API key> 0x00008000 /* End of frame. */ #define <API key> 0x00004000 /* Start of frame. */ #define <API key> 0x00003FFF /* Mask for length field */ #define <API key> 0x00000002 /* Wrap bit, last BD */ #define <API key> 0x00000001 /* Used bit.. */ #define <API key> 0xFFFFFFFC /* Mask for address */ #define <API key> 100 /* timeout value is msecs */ #define <API key> BMCR_FULLDPLX #define <API key> BMCR_SPEED1000 #define <API key> BMCR_SPEED100 #define <API key> 0x10 #ifdef <API key> #define NS_PER_SEC 1000000000ULL /* Nanoseconds per second */ /* Sum of Ethernet, IP and UDP header length */ #define <API key> 42 #define <API key> 28 /* Sum of IP and UDP header length */ #define <API key> 9 /* Protocol field offset */ #define <API key> 22 /* UDP dst port offset */ #define <API key> 0x13F /* Transport port for ptp */ #define XEMACPS_PTP_CC_MULT (1 << 31) #endif #define xemacps_read(base, reg) \ readl_relaxed(((void __iomem *)(base)) + (reg)) #define xemacps_write(base, reg, val) \ writel_relaxed((val), ((void __iomem *)(base)) + (reg)) struct ring_info { struct sk_buff *skb; dma_addr_t mapping; size_t len; }; /* DMA buffer descriptor structure. Each BD is two words */ struct xemacps_bd { u32 addr; u32 ctrl; }; /* Our private device data. */ struct net_local { void __iomem *baseaddr; struct clk *devclk; struct clk *aperclk; struct device_node *phy_node; struct device_node *gmii2rgmii_phy_node; struct ring_info *tx_skb; struct ring_info *rx_skb; struct xemacps_bd *rx_bd; struct xemacps_bd *tx_bd; dma_addr_t rx_bd_dma; /* physical address */ dma_addr_t tx_bd_dma; /* physical address */ u32 tx_bd_ci; u32 tx_bd_tail; u32 rx_bd_ci; u32 tx_bd_freecnt; spinlock_t tx_lock; spinlock_t rx_lock; spinlock_t nwctrlreg_lock; struct platform_device *pdev; struct net_device *ndev; /* this device */ struct tasklet_struct <API key>; struct workqueue_struct *<API key>; struct work_struct txtimeout_reinit; struct napi_struct napi; /* napi information for device */ struct net_device_stats stats; /* Statistics for this device */ struct timer_list gen_purpose_timer; /* Used for stats update */ struct mii_bus *mii_bus; struct phy_device *phy_dev; struct phy_device *gmii2rgmii_phy_dev; phy_interface_t phy_interface; unsigned int link; unsigned int speed; unsigned int duplex; /* RX ip/tcp/udp checksum */ unsigned ip_summed; unsigned int enetnum; unsigned int lastrxfrmscntr; #ifdef <API key> struct hwtstamp_config hwtstamp_config; struct ptp_clock *ptp_clock; struct ptp_clock_info ptp_caps; spinlock_t tmreg_lock; int phc_index; unsigned int tmr_add; struct cyclecounter cc; struct timecounter tc; struct timer_list time_keep; #endif }; #define to_net_local(_nb) container_of(_nb, struct net_local,\ clk_rate_change_nb) static struct net_device_ops netdev_ops; /** * xemacps_mdio_read - Read current value of phy register indicated by * phyreg. * @bus: mdio bus * @mii_id: mii id * @phyreg: phy register to be read * * Return: value read from specified phy register. * * note: This is for 802.3 clause 22 phys access. For 802.3 clause 45 phys * access, set bit 30 to be 1. e.g. change <API key> to * 0x00020000. */ static int xemacps_mdio_read(struct mii_bus *bus, int mii_id, int phyreg) { struct net_local *lp = bus->priv; u32 regval; int value; volatile u32 ipisr; regval = <API key>; regval |= <API key>; regval |= (mii_id << <API key>); regval |= (phyreg << <API key>); xemacps_write(lp->baseaddr, <API key>, regval); /* wait for end of transfer */ do { cpu_relax(); ipisr = xemacps_read(lp->baseaddr, XEMACPS_NWSR_OFFSET); } while ((ipisr & <API key>) == 0); value = xemacps_read(lp->baseaddr, <API key>) & <API key>; return value; } /** * xemacps_mdio_write - Write passed in value to phy register indicated * by phyreg. * @bus: mdio bus * @mii_id: mii id * @phyreg: phy register to be configured. * @value: value to be written to phy register. * Return: 0. This API requires to be int type or compile warning generated * * note: This is for 802.3 clause 22 phys access. For 802.3 clause 45 phys * access, set bit 30 to be 1. e.g. change <API key> to * 0x00020000. */ static int xemacps_mdio_write(struct mii_bus *bus, int mii_id, int phyreg, u16 value) { struct net_local *lp = bus->priv; u32 regval; volatile u32 ipisr; regval = <API key>; regval |= <API key>; regval |= (mii_id << <API key>); regval |= (phyreg << <API key>); regval |= value; xemacps_write(lp->baseaddr, <API key>, regval); /* wait for end of transfer */ do { cpu_relax(); ipisr = xemacps_read(lp->baseaddr, XEMACPS_NWSR_OFFSET); } while ((ipisr & <API key>) == 0); return 0; } /** * xemacps_mdio_reset - mdio reset. It seems to be required per open * source documentation phy.txt. But there is no reset in this device. * Provide function API for now. * @bus: mdio bus * * Return: Always 0 */ static int xemacps_mdio_reset(struct mii_bus *bus) { return 0; } /** * xemacps_set_freq - Set a clock to a new frequency * @clk: Pointer to the clock to change * @rate: New frequency in Hz * @dev: Pointer to the struct device */ static void xemacps_set_freq(struct clk *clk, long rate, struct device *dev) { rate = clk_round_rate(clk, rate); if (rate < 0) return; dev_info(dev, "Set clk to %ld Hz\n", rate); if (clk_set_rate(clk, rate)) dev_err(dev, "Setting new clock rate failed.\n"); } /** * xemacps_adjust_link - handles link status changes, such as speed, * duplex, up/down, ... * @ndev: network device */ static void xemacps_adjust_link(struct net_device *ndev) { struct net_local *lp = netdev_priv(ndev); struct phy_device *phydev = lp->phy_dev; struct phy_device *gmii2rgmii_phydev = lp->gmii2rgmii_phy_dev; int status_change = 0; u32 regval; u16 gmii2rgmii_reg = 0; if (phydev->link) { if ((lp->speed != phydev->speed) || (lp->duplex != phydev->duplex)) { regval = xemacps_read(lp->baseaddr, <API key>); regval &= ~(<API key> | <API key> | <API key>); if (phydev->duplex) { regval |= <API key>; gmii2rgmii_reg |= <API key>; } if (phydev->speed == SPEED_1000) { regval |= <API key>; gmii2rgmii_reg |= <API key>; xemacps_set_freq(lp->devclk, 125000000, &lp->pdev->dev); } else if (phydev->speed == SPEED_100) { regval |= <API key>; gmii2rgmii_reg |= <API key>; xemacps_set_freq(lp->devclk, 25000000, &lp->pdev->dev); } else if (phydev->speed == SPEED_10) { xemacps_set_freq(lp->devclk, 2500000, &lp->pdev->dev); } else { dev_err(&lp->pdev->dev, "%s: unknown PHY speed %d\n", __func__, phydev->speed); return; } xemacps_write(lp->baseaddr, <API key>, regval); if (gmii2rgmii_phydev != NULL) { xemacps_mdio_write(lp->mii_bus, gmii2rgmii_phydev->addr, <API key>, gmii2rgmii_reg); } lp->speed = phydev->speed; lp->duplex = phydev->duplex; status_change = 1; } } if (phydev->link != lp->link) { lp->link = phydev->link; status_change = 1; } if (status_change) { if (phydev->link) dev_info(&lp->pdev->dev, "link up (%d/%s)\n", phydev->speed, DUPLEX_FULL == phydev->duplex ? "FULL" : "HALF"); else dev_info(&lp->pdev->dev, "link down\n"); } } /** * xemacps_mii_probe - probe mii bus, find the right bus_id to register * phy callback function. * @ndev: network interface device structure * Return: 0 on success, negative value if error */ static int xemacps_mii_probe(struct net_device *ndev) { struct net_local *lp = netdev_priv(ndev); struct phy_device *phydev = NULL; if (!lp->phy_node) { dev_info(&lp->pdev->dev, "%s: no PHY setup\n", ndev->name); return 0; } phydev = of_phy_connect(lp->ndev, lp->phy_node, &xemacps_adjust_link, 0, lp->phy_interface); if (!phydev) { dev_err(&lp->pdev->dev, "%s: no PHY found\n", ndev->name); return -1; } dev_dbg(&lp->pdev->dev, "GEM: phydev %p, phydev->phy_id 0x%x, phydev->addr 0x%x\n", phydev, phydev->phy_id, phydev->addr); phydev->supported &= (PHY_GBIT_FEATURES | SUPPORTED_Pause | <API key>); phydev->advertising = phydev->supported; lp->link = 0; lp->speed = 0; lp->duplex = -1; lp->phy_dev = phydev; phy_start(lp->phy_dev); dev_dbg(&lp->pdev->dev, "phy_addr 0x%x, phy_id 0x%08x\n", lp->phy_dev->addr, lp->phy_dev->phy_id); dev_dbg(&lp->pdev->dev, "attach [%s] phy driver\n", lp->phy_dev->drv->name); if (lp->gmii2rgmii_phy_node) { phydev = of_phy_connect(lp->ndev, lp->gmii2rgmii_phy_node, NULL, 0, 0); if (!phydev) { dev_err(&lp->pdev->dev, "%s: no gmii to rgmii converter found\n", ndev->name); return -1; } lp->gmii2rgmii_phy_dev = phydev; } else lp->gmii2rgmii_phy_dev = NULL; return 0; } /** * xemacps_mii_init - Initialize and register mii bus to network device * @lp: local device instance pointer * Return: 0 on success, negative value if error */ static int xemacps_mii_init(struct net_local *lp) { int rc = -ENXIO, i; struct resource res; struct device_node *np = of_get_parent(lp->phy_node); struct device_node *npp; lp->mii_bus = mdiobus_alloc(); if (lp->mii_bus == NULL) { rc = -ENOMEM; goto err_out; } lp->mii_bus->name = "XEMACPS mii bus"; lp->mii_bus->read = &xemacps_mdio_read; lp->mii_bus->write = &xemacps_mdio_write; lp->mii_bus->reset = &xemacps_mdio_reset; lp->mii_bus->priv = lp; lp->mii_bus->parent = &lp->ndev->dev; lp->mii_bus->irq = kmalloc(sizeof(int)*PHY_MAX_ADDR, GFP_KERNEL); if (!lp->mii_bus->irq) { rc = -ENOMEM; goto <API key>; } for (i = 0; i < PHY_MAX_ADDR; i++) lp->mii_bus->irq[i] = PHY_POLL; npp = of_get_parent(np); <API key>(npp, 0, &res); snprintf(lp->mii_bus->id, MII_BUS_ID_SIZE, "%.8llx", (unsigned long long)res.start); if (lp->phy_node) { if (of_mdiobus_register(lp->mii_bus, np)) goto <API key>; } return 0; <API key>: kfree(lp->mii_bus->irq); <API key>: mdiobus_free(lp->mii_bus); err_out: return rc; } /** * <API key> - Update device's MAC address when configured * MAC address is not valid, reconfigure with a good one. * @lp: local device instance pointer */ static void <API key>(struct net_local *lp) { u32 regvall; u16 regvalh; u8 addr[6]; regvall = xemacps_read(lp->baseaddr, <API key>); regvalh = xemacps_read(lp->baseaddr, <API key>); addr[0] = regvall & 0xFF; addr[1] = (regvall >> 8) & 0xFF; addr[2] = (regvall >> 16) & 0xFF; addr[3] = (regvall >> 24) & 0xFF; addr[4] = regvalh & 0xFF; addr[5] = (regvalh >> 8) & 0xFF; if (is_valid_ether_addr(addr)) { memcpy(lp->ndev->dev_addr, addr, sizeof(addr)); } else { dev_info(&lp->pdev->dev, "invalid address, use assigned\n"); random_ether_addr(lp->ndev->dev_addr); dev_info(&lp->pdev->dev, "MAC updated %02x:%02x:%02x:%02x:%02x:%02x\n", lp->ndev->dev_addr[0], lp->ndev->dev_addr[1], lp->ndev->dev_addr[2], lp->ndev->dev_addr[3], lp->ndev->dev_addr[4], lp->ndev->dev_addr[5]); } } /** * xemacps_set_hwaddr - Set device's MAC address from ndev->dev_addr * @lp: local device instance pointer */ static void xemacps_set_hwaddr(struct net_local *lp) { u32 regvall = 0; u16 regvalh = 0; #ifdef __LITTLE_ENDIAN regvall = cpu_to_le32(*((u32 *)lp->ndev->dev_addr)); regvalh = cpu_to_le16(*((u16 *)(lp->ndev->dev_addr + 4))); #endif #ifdef __BIG_ENDIAN regvall = cpu_to_be32(*((u32 *)lp->ndev->dev_addr)); regvalh = cpu_to_be16(*((u16 *)(lp->ndev->dev_addr + 4))); #endif /* LADDRXH has to be wriiten latter than LADDRXL to enable * this address even if these 16 bits are zeros. */ xemacps_write(lp->baseaddr, <API key>, regvall); xemacps_write(lp->baseaddr, <API key>, regvalh); #ifdef DEBUG regvall = xemacps_read(lp->baseaddr, <API key>); regvalh = xemacps_read(lp->baseaddr, <API key>); dev_dbg(&lp->pdev->dev, "MAC 0x%08x, 0x%08x, %02x:%02x:%02x:%02x:%02x:%02x\n", regvall, regvalh, (regvall & 0xff), ((regvall >> 8) & 0xff), ((regvall >> 16) & 0xff), (regvall >> 24), (regvalh & 0xff), (regvalh >> 8)); #endif } /* * xemacps_reset_hw - Helper function to reset the underlying hardware. * This is called when we get into such deep trouble that we don't know * how to handle otherwise. * @lp: local device instance pointer */ static void xemacps_reset_hw(struct net_local *lp) { u32 regisr; /* make sure we have the buffer for ourselves */ wmb(); /* Have a clean start */ xemacps_write(lp->baseaddr, <API key>, 0); /* Clear statistic counters */ xemacps_write(lp->baseaddr, <API key>, <API key>); /* Clear TX and RX status */ xemacps_write(lp->baseaddr, XEMACPS_TXSR_OFFSET, ~0UL); xemacps_write(lp->baseaddr, XEMACPS_RXSR_OFFSET, ~0UL); /* Disable all interrupts */ xemacps_write(lp->baseaddr, XEMACPS_IDR_OFFSET, ~0UL); synchronize_irq(lp->ndev->irq); regisr = xemacps_read(lp->baseaddr, XEMACPS_ISR_OFFSET); xemacps_write(lp->baseaddr, XEMACPS_ISR_OFFSET, regisr); } #ifdef <API key> /** * xemacps_time_keep - Call timecounter_read every second to avoid timer overrun * @_data: Contains the device instance pointer * Return: None */ void xemacps_time_keep(unsigned long _data) { struct net_local *lp = (struct net_local *)_data; u64 ns; unsigned long flags; spin_lock_irqsave(&lp->tmreg_lock, flags); ns = timecounter_read(&lp->tc); <API key>(&lp->tmreg_lock, flags); mod_timer(&lp->time_keep, jiffies + HZ); } /** * xemacps_ptp_read - Read timestamp information from the timer counters * @lp: Local device instance pointer * @ts: Timespec structure to hold the current time value * Return: None */ static inline void xemacps_ptp_read(struct net_local *lp, struct timespec *ts) { ts->tv_sec = xemacps_read(lp->baseaddr, <API key>); ts->tv_nsec = xemacps_read(lp->baseaddr, <API key>); if (ts->tv_sec < xemacps_read(lp->baseaddr, <API key>)) ts->tv_nsec = xemacps_read(lp->baseaddr, <API key>); } /** * xemacps_read_clock - Read raw cycle counter (to be used by time counter) * @cc: Cyclecounter structure * Return: Hw time stamp */ static cycle_t xemacps_read_clock(const struct cyclecounter *cc) { struct net_local *lp = container_of(cc, struct net_local, cc); u64 stamp; struct timespec ts; xemacps_ptp_read(lp, &ts); stamp = ts.tv_sec * NS_PER_SEC + ts.tv_nsec; return stamp; } /** * xemacps_ptp_write - Update the currenrt time value to the timer counters * @lp: Local device instance pointer * @ts: Timespec structure to hold the time value * Return: None */ static inline void xemacps_ptp_write(struct net_local *lp, const struct timespec *ts) { xemacps_write(lp->baseaddr, <API key>, ts->tv_sec); xemacps_write(lp->baseaddr, <API key>, ts->tv_nsec); } /** * <API key> - Convert system time value to hw timestamp * @lp: Local device instance pointer * @shhwtstamps: Timestamp structure to update * @regval: Unsigned 64bit system time value. * Return: None */ static void <API key>(struct net_local *lp, struct <API key> *shhwtstamps, u64 regval) { u64 ns; ns = <API key>(&lp->tc, regval); memset(shhwtstamps, 0, sizeof(struct <API key>)); shhwtstamps->hwtstamp = ns_to_ktime(ns); } /** * xemacps_rx_hwtstamp - Read rx timestamp from hw and update it to the skbuff * @lp: Local device instance pointer * @skb: Pointer to the socket buffer * @msg_type: PTP message type * Return: None */ static void xemacps_rx_hwtstamp(struct net_local *lp, struct sk_buff *skb, unsigned msg_type) { u32 sec, nsec; u64 time64; if (msg_type) { /* PTP Peer Event Frame packets */ sec = xemacps_read(lp->baseaddr, <API key>); nsec = xemacps_read(lp->baseaddr, <API key>); } else { /* PTP Event Frame packets */ sec = xemacps_read(lp->baseaddr, <API key>); nsec = xemacps_read(lp->baseaddr, <API key>); } time64 = sec * NS_PER_SEC + nsec; <API key>(lp, skb_hwtstamps(skb), time64); } /** * xemacps_tx_hwtstamp - Read tx timestamp from hw and update it to the skbuff * @lp: Local device instance pointer * @skb: Pointer to the socket buffer * @msg_type: PTP message type * Return: None */ static void xemacps_tx_hwtstamp(struct net_local *lp, struct sk_buff *skb, unsigned msg_type) { u32 sec, nsec; u64 time64; if (msg_type) { /* PTP Peer Event Frame packets */ sec = xemacps_read(lp->baseaddr, <API key>); nsec = xemacps_read(lp->baseaddr, <API key>); } else { /* PTP Event Frame packets */ sec = xemacps_read(lp->baseaddr, <API key>); nsec = xemacps_read(lp->baseaddr, <API key>); } time64 = sec * NS_PER_SEC + nsec; <API key>(lp, skb_hwtstamps(skb), time64); skb_tstamp_tx(skb, skb_hwtstamps(skb)); } /** * xemacps_ptp_enable - Select the mode of operation * @ptp: PTP clock structure * @rq: Requested feature to change * @on: Whether to enable or disable the feature * Return: Always returns EOPNOTSUPP */ static int xemacps_ptp_enable(struct ptp_clock_info *ptp, struct ptp_clock_request *rq, int on) { return -EOPNOTSUPP; } /** * xemacps_ptp_gettime - Get the current time from the timer counter * @ptp: PTP clock structure * @ts: Timespec structure to hold the current time value * Return: Always returns zero */ static int xemacps_ptp_gettime(struct ptp_clock_info *ptp, struct timespec *ts) { unsigned long flags; struct net_local *lp = container_of(ptp, struct net_local, ptp_caps); u64 ns; u32 remainder; spin_lock_irqsave(&lp->tmreg_lock, flags); ns = timecounter_read(&lp->tc); <API key>(&lp->tmreg_lock, flags); ts->tv_sec = div_u64_rem(ns, NS_PER_SEC, &remainder); ts->tv_nsec = remainder; return 0; } /** * xemacps_ptp_settime - Reset the timercounter to use new base value * @ptp: PTP clock structure * @ts: Timespec structure to hold the current time value * Return: Always returns zero */ static int xemacps_ptp_settime(struct ptp_clock_info *ptp, const struct timespec *ts) { unsigned long flags; struct net_local *lp = container_of(ptp, struct net_local, ptp_caps); u64 ns; ns = ts->tv_sec * NS_PER_SEC; ns += ts->tv_nsec; spin_lock_irqsave(&lp->tmreg_lock, flags); timecounter_init(&lp->tc, &lp->cc, ns); <API key>(&lp->tmreg_lock, flags); return 0; } /** * xemacps_ptp_adjfreq - Adjust the clock freequency * @ptp: PTP clock info structure * @ppb: Frequency in parts per billion * Return: Always returns zero */ static int xemacps_ptp_adjfreq(struct ptp_clock_info *ptp, s32 ppb) { u64 diff; unsigned long flags; int neg_adj = 0; u32 mult = XEMACPS_PTP_CC_MULT; struct net_local *lp = container_of(ptp, struct net_local, ptp_caps); if (ppb < 0) { neg_adj = 1; ppb = -ppb; } diff = mult; diff *= ppb; diff = div_u64(diff, NS_PER_SEC); spin_lock_irqsave(&lp->tmreg_lock, flags); /* * dummy read to set cycle_last in tc to now. * So use adjusted mult to calculate when next call * timercounter_read. */ timecounter_read(&lp->tc); lp->cc.mult = neg_adj ? mult - diff : mult + diff; <API key>(&lp->tmreg_lock, flags); return 0; } /** * xemacps_ptp_adjtime - Adjust the timer counter value with delta * @ptp: PTP clock info structure * @delta: Delta value in nano seconds * Return: Always returns zero */ static int xemacps_ptp_adjtime(struct ptp_clock_info *ptp, s64 delta) { unsigned long flags; struct net_local *lp = container_of(ptp, struct net_local, ptp_caps); u64 now; spin_lock_irqsave(&lp->tmreg_lock, flags); now = timecounter_read(&lp->tc); now += delta; timecounter_init(&lp->tc, &lp->cc, now); <API key>(&lp->tmreg_lock, flags); return 0; } /** * xemacps_ptp_init - Initialize the clock and register with ptp sub system * @lp: Local device instance pointer * Return: None */ static void xemacps_ptp_init(struct net_local *lp) { struct timespec now; unsigned long rate; lp->ptp_caps.owner = THIS_MODULE; snprintf(lp->ptp_caps.name, 16, "zynq ptp"); lp->ptp_caps.n_alarm = 0; lp->ptp_caps.n_ext_ts = 0; lp->ptp_caps.n_per_out = 0; lp->ptp_caps.pps = 0; lp->ptp_caps.adjfreq = xemacps_ptp_adjfreq; lp->ptp_caps.adjtime = xemacps_ptp_adjtime; lp->ptp_caps.gettime = xemacps_ptp_gettime; lp->ptp_caps.settime = xemacps_ptp_settime; lp->ptp_caps.enable = xemacps_ptp_enable; rate = clk_get_rate(lp->aperclk); spin_lock_init(&lp->tmreg_lock); init_timer(&lp->time_keep); lp->time_keep.data = (unsigned long)lp; lp->time_keep.function = xemacps_time_keep; lp->time_keep.expires = jiffies + HZ; add_timer(&lp->time_keep); lp->ptp_caps.max_adj = rate; memset(&lp->cc, 0, sizeof(lp->cc)); lp->cc.read = xemacps_read_clock; lp->cc.mask = CLOCKSOURCE_MASK(64); lp->cc.mult = XEMACPS_PTP_CC_MULT; lp->cc.shift = 31; lp->tmr_add = (NS_PER_SEC/rate); xemacps_write(lp->baseaddr, <API key>, lp->tmr_add); getnstimeofday(&now); xemacps_ptp_write(lp, (const struct timespec *)&now); timecounter_init(&lp->tc, &lp->cc, ktime_to_ns(ktime_get_real())); lp->ptp_clock = ptp_clock_register(&lp->ptp_caps, &lp->pdev->dev); if (IS_ERR(lp->ptp_clock)) pr_err("ptp_clock_register failed\n"); lp->phc_index = ptp_clock_index(lp->ptp_clock); } /** * xemacps_ptp_close - Disable the ptp interface * @lp: Local device instance pointer * Return: None */ static void xemacps_ptp_close(struct net_local *lp) { /* Clear the time counters */ xemacps_write(lp->baseaddr, <API key>, 0x0); xemacps_write(lp->baseaddr, <API key>, 0x0); xemacps_write(lp->baseaddr, <API key>, 0x0); xemacps_write(lp->baseaddr, <API key>, 0x0); del_timer(&lp->time_keep); <API key>(lp->ptp_clock); /* Initialize hwstamp config */ lp->hwtstamp_config.rx_filter = <API key>; lp->hwtstamp_config.tx_type = HWTSTAMP_TX_OFF; } #endif /* <API key> */ /** * xemacps_rx - process received packets when napi called * @lp: local device instance pointer * @budget: NAPI budget * Return: number of BDs processed */ static int xemacps_rx(struct net_local *lp, int budget) { struct xemacps_bd *cur_p; u32 len; struct sk_buff *skb; struct sk_buff *new_skb; u32 new_skb_baddr; unsigned int numbdfree = 0; u32 size = 0; u32 packets = 0; u32 regval; cur_p = &lp->rx_bd[lp->rx_bd_ci]; regval = cur_p->addr; rmb(); while (numbdfree < budget) { if (!(regval & <API key>)) break; new_skb = netdev_alloc_skb(lp->ndev, XEMACPS_RX_BUF_SIZE); if (new_skb == NULL) { dev_err(&lp->ndev->dev, "no memory for new sk_buff\n"); break; } /* Get dma handle of skb->data */ new_skb_baddr = (u32) dma_map_single(lp->ndev->dev.parent, new_skb->data, XEMACPS_RX_BUF_SIZE, DMA_FROM_DEVICE); if (dma_mapping_error(lp->ndev->dev.parent, new_skb_baddr)) { dev_kfree_skb(new_skb); break; } /* the packet length */ len = cur_p->ctrl & <API key>; rmb(); skb = lp->rx_skb[lp->rx_bd_ci].skb; dma_unmap_single(lp->ndev->dev.parent, lp->rx_skb[lp->rx_bd_ci].mapping, lp->rx_skb[lp->rx_bd_ci].len, DMA_FROM_DEVICE); /* setup received skb and send it upstream */ skb_put(skb, len); /* Tell the skb how much data we got. */ skb->protocol = eth_type_trans(skb, lp->ndev); skb->ip_summed = lp->ip_summed; #ifdef <API key> if ((lp->hwtstamp_config.rx_filter == HWTSTAMP_FILTER_ALL) && (ntohs(skb->protocol) == ETH_P_IP)) { u8 transport_poto, msg_type; u16 dst_port; /* While the GEM can timestamp PTP packets, it does * not mark the RX descriptor to identify them. This * is entirely the wrong place to be parsing UDP * headers, but some minimal effort must be made. * NOTE: the below parsing of ip_proto and dest_port * depend on the use of Ethernet_II encapsulation, * IPv4 without any options. */ <API key>(skb, <API key>, &transport_poto, 1); if (transport_poto == IPPROTO_UDP) { <API key>(skb, <API key>, &dst_port, 2); if (ntohs(dst_port) == <API key>) { <API key>(skb, <API key>, &msg_type, 1); xemacps_rx_hwtstamp(lp, skb, msg_type & 0x2); } } } #endif /* <API key> */ size += len; packets++; netif_receive_skb(skb); cur_p->addr = (cur_p->addr & ~<API key>) | (new_skb_baddr); lp->rx_skb[lp->rx_bd_ci].skb = new_skb; lp->rx_skb[lp->rx_bd_ci].mapping = new_skb_baddr; lp->rx_skb[lp->rx_bd_ci].len = XEMACPS_RX_BUF_SIZE; cur_p->ctrl = 0; cur_p->addr &= (~<API key>); wmb(); lp->rx_bd_ci++; lp->rx_bd_ci = lp->rx_bd_ci % XEMACPS_RECV_BD_CNT; cur_p = &lp->rx_bd[lp->rx_bd_ci]; regval = cur_p->addr; rmb(); numbdfree++; } wmb(); lp->stats.rx_packets += packets; lp->stats.rx_bytes += size; return numbdfree; } /** * xemacps_rx_poll - NAPI poll routine * @napi: pointer to napi struct * @budget: NAPI budget * Return: number of BDs processed */ static int xemacps_rx_poll(struct napi_struct *napi, int budget) { struct net_local *lp = container_of(napi, struct net_local, napi); int work_done = 0; u32 regval; spin_lock(&lp->rx_lock); while (1) { regval = xemacps_read(lp->baseaddr, XEMACPS_RXSR_OFFSET); xemacps_write(lp->baseaddr, XEMACPS_RXSR_OFFSET, regval); if (regval & <API key>) dev_err(&lp->pdev->dev, "RX error 0x%x\n", regval); work_done += xemacps_rx(lp, budget - work_done); if (work_done >= budget) break; napi_complete(napi); /* We disabled RX interrupts in interrupt service * routine, now it is time to enable it back. */ xemacps_write(lp->baseaddr, XEMACPS_IER_OFFSET, <API key>); /* If a packet has come in between the last check of the BD * list and unmasking the interrupts, we may have missed the * interrupt, so reschedule here. */ if ((lp->rx_bd[lp->rx_bd_ci].addr & <API key>) && napi_reschedule(napi)) { xemacps_write(lp->baseaddr, XEMACPS_IDR_OFFSET, <API key>); continue; } break; } spin_unlock(&lp->rx_lock); return work_done; } /** * xemacps_tx_poll - tx bd reclaim tasklet handler * @data: pointer to network interface device structure */ static void xemacps_tx_poll(unsigned long data) { struct net_device *ndev = (struct net_device *)data; struct net_local *lp = netdev_priv(ndev); u32 regval; struct xemacps_bd *cur_p; u32 numbdsinhw; struct ring_info *rp; struct sk_buff *skb; unsigned long flags; u32 txbdcount = 0; bool isfrag = false; numbdsinhw = XEMACPS_SEND_BD_CNT - lp->tx_bd_freecnt; if (!numbdsinhw) return; regval = xemacps_read(lp->baseaddr, XEMACPS_TXSR_OFFSET); xemacps_write(lp->baseaddr, XEMACPS_TXSR_OFFSET, regval); dev_dbg(&lp->pdev->dev, "TX status 0x%x\n", regval); if (regval & (<API key> | <API key>)) dev_err(&lp->pdev->dev, "TX error 0x%x\n", regval); cur_p = &lp->tx_bd[lp->tx_bd_ci]; while (numbdsinhw) { if ((cur_p->ctrl & <API key>) != <API key>) { if (isfrag == false) break; } rp = &lp->tx_skb[lp->tx_bd_ci]; skb = rp->skb; lp->stats.tx_bytes += cur_p->ctrl & <API key>; #ifdef <API key> if (skb_shinfo(skb)->tx_flags & SKBTX_HW_TSTAMP) { u8 msg_type; <API key>(skb, <API key>, &msg_type, 1); xemacps_tx_hwtstamp(lp, skb, msg_type & 0x2); } #endif /* <API key> */ dma_unmap_single(&lp->pdev->dev, rp->mapping, rp->len, DMA_TO_DEVICE); rp->skb = NULL; dev_kfree_skb(skb); /* log tx completed packets, errors logs * are in other error counters. */ if (cur_p->ctrl & <API key>) { lp->stats.tx_packets++; isfrag = false; } else { isfrag = true; } /* Set used bit, preserve wrap bit; clear everything else. */ cur_p->ctrl |= <API key>; cur_p->ctrl &= (<API key> | <API key>); lp->tx_bd_ci++; lp->tx_bd_ci = lp->tx_bd_ci % XEMACPS_SEND_BD_CNT; cur_p = &lp->tx_bd[lp->tx_bd_ci]; numbdsinhw txbdcount++; } spin_lock(&lp->tx_lock); lp->tx_bd_freecnt += txbdcount; spin_unlock(&lp->tx_lock); if (numbdsinhw) { spin_lock_irqsave(&lp->nwctrlreg_lock, flags); regval = xemacps_read(lp->baseaddr, <API key>); regval |= <API key>; xemacps_write(lp->baseaddr, <API key>, regval); <API key>(&lp->nwctrlreg_lock, flags); } netif_wake_queue(ndev); } /** * xemacps_interrupt - interrupt main service routine * @irq: interrupt number * @dev_id: pointer to a network device structure * Return: IRQ_HANDLED or IRQ_NONE */ static irqreturn_t xemacps_interrupt(int irq, void *dev_id) { struct net_device *ndev = dev_id; struct net_local *lp = netdev_priv(ndev); u32 regisr; u32 regctrl; regisr = xemacps_read(lp->baseaddr, XEMACPS_ISR_OFFSET); if (unlikely(!regisr)) return IRQ_NONE; xemacps_write(lp->baseaddr, XEMACPS_ISR_OFFSET, regisr); while (regisr) { if (regisr & (<API key> | <API key>)) { tasklet_schedule(&lp-><API key>); } if (regisr & <API key>) { spin_lock(&lp->nwctrlreg_lock); regctrl = xemacps_read(lp->baseaddr, <API key>); regctrl |= <API key>; xemacps_write(lp->baseaddr, <API key>, regctrl); spin_unlock(&lp->nwctrlreg_lock); xemacps_write(lp->baseaddr, XEMACPS_IDR_OFFSET, <API key>); napi_schedule(&lp->napi); } if (regisr & <API key>) { xemacps_write(lp->baseaddr, XEMACPS_IDR_OFFSET, <API key>); napi_schedule(&lp->napi); } regisr = xemacps_read(lp->baseaddr, XEMACPS_ISR_OFFSET); xemacps_write(lp->baseaddr, XEMACPS_ISR_OFFSET, regisr); } return IRQ_HANDLED; } /* * Free all packets presently in the descriptor rings. */ static void xemacps_clean_rings(struct net_local *lp) { int i; for (i = 0; i < XEMACPS_RECV_BD_CNT; i++) { if (lp->rx_skb && lp->rx_skb[i].skb) { dma_unmap_single(lp->ndev->dev.parent, lp->rx_skb[i].mapping, lp->rx_skb[i].len, DMA_FROM_DEVICE); dev_kfree_skb(lp->rx_skb[i].skb); lp->rx_skb[i].skb = NULL; lp->rx_skb[i].mapping = 0; } } for (i = 0; i < XEMACPS_SEND_BD_CNT; i++) { if (lp->tx_skb && lp->tx_skb[i].skb) { dma_unmap_single(lp->ndev->dev.parent, lp->tx_skb[i].mapping, lp->tx_skb[i].len, DMA_TO_DEVICE); dev_kfree_skb(lp->tx_skb[i].skb); lp->tx_skb[i].skb = NULL; lp->tx_skb[i].mapping = 0; } } } /** * <API key> - Free allocated TX and RX BDs * @lp: local device instance pointer */ static void <API key>(struct net_local *lp) { int size; xemacps_clean_rings(lp); /* kfree(NULL) is safe, no need to check here */ kfree(lp->tx_skb); lp->tx_skb = NULL; kfree(lp->rx_skb); lp->rx_skb = NULL; size = XEMACPS_RECV_BD_CNT * sizeof(struct xemacps_bd); if (lp->rx_bd) { dma_free_coherent(&lp->pdev->dev, size, lp->rx_bd, lp->rx_bd_dma); lp->rx_bd = NULL; } size = XEMACPS_SEND_BD_CNT * sizeof(struct xemacps_bd); if (lp->tx_bd) { dma_free_coherent(&lp->pdev->dev, size, lp->tx_bd, lp->tx_bd_dma); lp->tx_bd = NULL; } } /** * <API key> - Allocate both TX and RX BDs * @lp: local device instance pointer * Return: 0 on success, negative value if error */ static int <API key>(struct net_local *lp) { int size; struct sk_buff *new_skb; u32 new_skb_baddr; u32 i; struct xemacps_bd *cur_p; u32 regval; lp->tx_skb = NULL; lp->rx_skb = NULL; lp->rx_bd = NULL; lp->tx_bd = NULL; /* Reset the indexes which are used for accessing the BDs */ lp->tx_bd_ci = 0; lp->tx_bd_tail = 0; lp->rx_bd_ci = 0; size = XEMACPS_SEND_BD_CNT * sizeof(struct ring_info); lp->tx_skb = kzalloc(size, GFP_KERNEL); if (!lp->tx_skb) goto err_out; size = XEMACPS_RECV_BD_CNT * sizeof(struct ring_info); lp->rx_skb = kzalloc(size, GFP_KERNEL); if (!lp->rx_skb) goto err_out; /* * Set up RX buffer descriptors. */ size = XEMACPS_RECV_BD_CNT * sizeof(struct xemacps_bd); lp->rx_bd = dma_alloc_coherent(&lp->pdev->dev, size, &lp->rx_bd_dma, GFP_KERNEL); if (!lp->rx_bd) goto err_out; dev_dbg(&lp->pdev->dev, "RX ring %d bytes at 0x%x mapped %p\n", size, lp->rx_bd_dma, lp->rx_bd); for (i = 0; i < XEMACPS_RECV_BD_CNT; i++) { cur_p = &lp->rx_bd[i]; new_skb = netdev_alloc_skb(lp->ndev, XEMACPS_RX_BUF_SIZE); if (new_skb == NULL) { dev_err(&lp->ndev->dev, "alloc_skb error %d\n", i); goto err_out; } /* Get dma handle of skb->data */ new_skb_baddr = (u32) dma_map_single(lp->ndev->dev.parent, new_skb->data, XEMACPS_RX_BUF_SIZE, DMA_FROM_DEVICE); if (dma_mapping_error(lp->ndev->dev.parent, new_skb_baddr)) goto err_out; /* set wrap bit for last BD */ regval = (new_skb_baddr & <API key>); if (i == XEMACPS_RECV_BD_CNT - 1) regval |= <API key>; cur_p->addr = regval; cur_p->ctrl = 0; wmb(); lp->rx_skb[i].skb = new_skb; lp->rx_skb[i].mapping = new_skb_baddr; lp->rx_skb[i].len = XEMACPS_RX_BUF_SIZE; } /* * Set up TX buffer descriptors. */ size = XEMACPS_SEND_BD_CNT * sizeof(struct xemacps_bd); lp->tx_bd = dma_alloc_coherent(&lp->pdev->dev, size, &lp->tx_bd_dma, GFP_KERNEL); if (!lp->tx_bd) goto err_out; dev_dbg(&lp->pdev->dev, "TX ring %d bytes at 0x%x mapped %p\n", size, lp->tx_bd_dma, lp->tx_bd); for (i = 0; i < XEMACPS_SEND_BD_CNT; i++) { cur_p = &lp->tx_bd[i]; /* set wrap bit for last BD */ cur_p->addr = 0; regval = <API key>; if (i == XEMACPS_SEND_BD_CNT - 1) regval |= <API key>; cur_p->ctrl = regval; } wmb(); lp->tx_bd_freecnt = XEMACPS_SEND_BD_CNT; dev_dbg(&lp->pdev->dev, "lp->tx_bd %p lp->tx_bd_dma %p lp->tx_skb %p\n", lp->tx_bd, (void *)lp->tx_bd_dma, lp->tx_skb); dev_dbg(&lp->pdev->dev, "lp->rx_bd %p lp->rx_bd_dma %p lp->rx_skb %p\n", lp->rx_bd, (void *)lp->rx_bd_dma, lp->rx_skb); return 0; err_out: <API key>(lp); return -ENOMEM; } /** * xemacps_init_hw - Initialize hardware to known good state * @lp: local device instance pointer */ static void xemacps_init_hw(struct net_local *lp) { u32 regval; xemacps_reset_hw(lp); xemacps_set_hwaddr(lp); /* network configuration */ regval = 0; regval |= <API key>; regval |= <API key>; regval |= <API key>; regval |= <API key>; regval |= <API key>; regval |= <API key>; regval |= <API key>; regval |= (MDC_DIV_224 << <API key>); if (lp->ndev->flags & IFF_PROMISC) /* copy all */ regval |= <API key>; if (!(lp->ndev->flags & IFF_BROADCAST)) /* No broadcast */ regval |= <API key>; xemacps_write(lp->baseaddr, <API key>, regval); /* Init TX and RX DMA Q address */ xemacps_write(lp->baseaddr, <API key>, lp->rx_bd_dma); xemacps_write(lp->baseaddr, <API key>, lp->tx_bd_dma); /* DMACR configurations */ regval = (((XEMACPS_RX_BUF_SIZE / XEMACPS_RX_BUF_UNIT) + ((XEMACPS_RX_BUF_SIZE % XEMACPS_RX_BUF_UNIT) ? 1 : 0)) << <API key>); regval |= <API key>; regval |= <API key>; regval |= <API key>; #ifdef __LITTLE_ENDIAN regval &= ~<API key>; #endif #ifdef __BIG_ENDIAN regval |= <API key>; #endif regval |= <API key>; xemacps_write(lp->baseaddr, <API key>, regval); /* Enable TX, RX and MDIO port */ regval = 0; regval |= <API key>; regval |= <API key>; regval |= <API key>; xemacps_write(lp->baseaddr, <API key>, regval); #ifdef <API key> /* Initialize the ptp clock */ xemacps_ptp_init(lp); #endif /* Enable interrupts */ regval = <API key>; xemacps_write(lp->baseaddr, XEMACPS_IER_OFFSET, regval); } /** * <API key> - Resets the Rx if there is no data * for a while (presently 100 msecs) * @data: Used for net_local instance pointer */ static void <API key>(unsigned long data) { struct net_local *lp = (struct net_local *)data; unsigned long regctrl; unsigned long tempcntr; unsigned long flags; tempcntr = xemacps_read(lp->baseaddr, <API key>); if ((!tempcntr) && (!(lp->lastrxfrmscntr))) { spin_lock_irqsave(&lp->nwctrlreg_lock, flags); regctrl = xemacps_read(lp->baseaddr, <API key>); regctrl &= (~<API key>); xemacps_write(lp->baseaddr, <API key>, regctrl); regctrl = xemacps_read(lp->baseaddr, <API key>); regctrl |= (<API key>); xemacps_write(lp->baseaddr, <API key>, regctrl); <API key>(&lp->nwctrlreg_lock, flags); } lp->lastrxfrmscntr = tempcntr; } /** * <API key> - Update the statistic structure entries from * the corresponding emacps hardware statistic registers * @data: Used for net_local instance pointer */ static void <API key>(unsigned long data) { struct net_local *lp = (struct net_local *)data; struct net_device_stats *nstat = &lp->stats; u32 cnt; cnt = xemacps_read(lp->baseaddr, <API key>); nstat->rx_errors += cnt; nstat->rx_length_errors += cnt; cnt = xemacps_read(lp->baseaddr, <API key>); nstat->rx_errors += cnt; nstat->rx_length_errors += cnt; cnt = xemacps_read(lp->baseaddr, <API key>); nstat->rx_errors += cnt; nstat->rx_length_errors += cnt; cnt = xemacps_read(lp->baseaddr, <API key>); nstat->rx_errors += cnt; nstat->rx_crc_errors += cnt; cnt = xemacps_read(lp->baseaddr, <API key>); nstat->rx_errors += cnt; nstat->rx_length_errors += cnt; cnt = xemacps_read(lp->baseaddr, <API key>); nstat->rx_errors += cnt; nstat->rx_frame_errors += cnt; cnt = xemacps_read(lp->baseaddr, <API key>); nstat->rx_errors += cnt; nstat->rx_missed_errors += cnt; cnt = xemacps_read(lp->baseaddr, <API key>); nstat->rx_errors += cnt; nstat->rx_fifo_errors += cnt; cnt = xemacps_read(lp->baseaddr, <API key>); nstat->tx_errors += cnt; nstat->tx_fifo_errors += cnt; cnt = xemacps_read(lp->baseaddr, <API key>); nstat->collisions += cnt; cnt = xemacps_read(lp->baseaddr, <API key>); nstat->collisions += cnt; cnt = xemacps_read(lp->baseaddr, <API key>); nstat->tx_errors += cnt; nstat->tx_aborted_errors += cnt; nstat->collisions += cnt; cnt = xemacps_read(lp->baseaddr, <API key>); nstat->tx_errors += cnt; nstat->collisions += cnt; cnt = xemacps_read(lp->baseaddr, <API key>); nstat->tx_errors += cnt; nstat->tx_carrier_errors += cnt; } /** * <API key> - Timer handler that is called at regular * intervals upon expiry of the gen_purpose_timer defined in net_local struct. * @data: Used for net_local instance pointer * * This timer handler is used to update the statistics by calling the API * <API key>. The statistics register can typically overflow pretty * quickly under heavy load conditions. This timer is used to periodically * read the stats registers and update the corresponding stats structure * entries. The stats registers when read reset to 0. */ static void <API key>(unsigned long data) { struct net_local *lp = (struct net_local *)data; <API key>(data); <API key>(data); mod_timer(&(lp->gen_purpose_timer), jiffies + msecs_to_jiffies(<API key>)); } /** * xemacps_open - Called when a network device is made active * @ndev: network interface device structure * Return: 0 on success, negative value if error * * The open entry point is called when a network interface is made active * by the system (IFF_UP). At this point all resources needed for transmit * and receive operations are allocated, the interrupt handler is * registered with OS, the watchdog timer is started, and the stack is * notified that the interface is ready. * * note: if error(s), allocated resources before error require to be * released or system issues (such as memory) leak might happen. */ static int xemacps_open(struct net_device *ndev) { struct net_local *lp = netdev_priv(ndev); int rc; dev_dbg(&lp->pdev->dev, "open\n"); if (!is_valid_ether_addr(ndev->dev_addr)) return -EADDRNOTAVAIL; rc = <API key>(lp); if (rc) { dev_err(&lp->pdev->dev, "Unable to allocate DMA memory, rc %d\n", rc); return rc; } rc = pm_runtime_get_sync(&lp->pdev->dev); if (rc < 0) { dev_err(&lp->pdev->dev, "pm_runtime_get_sync() failed, rc %d\n", rc); goto err_free_rings; } napi_enable(&lp->napi); xemacps_init_hw(lp); rc = xemacps_mii_probe(ndev); if (rc != 0) { dev_err(&lp->pdev->dev, "%s mii_probe fail.\n", lp->mii_bus->name); if (rc == (-2)) { mdiobus_unregister(lp->mii_bus); kfree(lp->mii_bus->irq); mdiobus_free(lp->mii_bus); } rc = -ENXIO; goto err_pm_put; } setup_timer(&(lp->gen_purpose_timer), <API key>, (unsigned long)lp); mod_timer(&(lp->gen_purpose_timer), jiffies + msecs_to_jiffies(<API key>)); netif_carrier_on(ndev); netif_start_queue(ndev); tasklet_enable(&lp-><API key>); return 0; err_pm_put: napi_disable(&lp->napi); xemacps_reset_hw(lp); pm_runtime_put(&lp->pdev->dev); err_free_rings: <API key>(lp); return rc; } /** * xemacps_close - disable a network interface * @ndev: network interface device structure * Return: 0 * * The close entry point is called when a network interface is de-activated * by OS. The hardware is still under the driver control, but needs to be * disabled. A global MAC reset is issued to stop the hardware, and all * transmit and receive resources are freed. */ static int xemacps_close(struct net_device *ndev) { struct net_local *lp = netdev_priv(ndev); del_timer_sync(&(lp->gen_purpose_timer)); netif_stop_queue(ndev); napi_disable(&lp->napi); tasklet_disable(&lp-><API key>); netif_carrier_off(ndev); if (lp->phy_dev) phy_disconnect(lp->phy_dev); if (lp->gmii2rgmii_phy_node) phy_disconnect(lp->gmii2rgmii_phy_dev); xemacps_reset_hw(lp); #ifdef <API key> xemacps_ptp_close(lp); #endif mdelay(500); <API key>(lp); pm_runtime_put(&lp->pdev->dev); return 0; } /** * <API key> - work queue scheduled for the tx timeout * handling. * @data: queue work structure */ static void <API key>(struct work_struct *data) { struct net_local *lp = container_of(data, struct net_local, txtimeout_reinit); int rc; netif_stop_queue(lp->ndev); napi_disable(&lp->napi); tasklet_disable(&lp-><API key>); spin_lock_bh(&lp->tx_lock); xemacps_reset_hw(lp); spin_unlock_bh(&lp->tx_lock); if (lp->phy_dev) phy_stop(lp->phy_dev); <API key>(lp); rc = <API key>(lp); if (rc) { dev_err(&lp->pdev->dev, "Unable to allocate DMA memory, rc %d\n", rc); return; } xemacps_init_hw(lp); lp->link = 0; lp->speed = 0; lp->duplex = -1; if (lp->phy_dev) phy_start(lp->phy_dev); napi_enable(&lp->napi); tasklet_enable(&lp-><API key>); lp->ndev->trans_start = jiffies; netif_wake_queue(lp->ndev); } /** * xemacps_tx_timeout - callback used when the transmitter has not made * any progress for dev->watchdog ticks. * @ndev: network interface device structure */ static void xemacps_tx_timeout(struct net_device *ndev) { struct net_local *lp = netdev_priv(ndev); dev_err(&lp->pdev->dev, "transmit timeout %lu ms, reseting...\n", TX_TIMEOUT * 1000UL / HZ); queue_work(lp-><API key>, &lp->txtimeout_reinit); } /** * <API key> - set network interface mac address * @ndev: network interface device structure * @addr: pointer to MAC address * Return: 0 on success, negative value if error */ static int <API key>(struct net_device *ndev, void *addr) { struct net_local *lp = netdev_priv(ndev); struct sockaddr *hwaddr = (struct sockaddr *)addr; if (netif_running(ndev)) return -EBUSY; if (!is_valid_ether_addr(hwaddr->sa_data)) return -EADDRNOTAVAIL; dev_dbg(&lp->pdev->dev, "hwaddr 0x%x 0x%x 0x%x 0x%x 0x%x 0x%x\n", hwaddr->sa_data[0], hwaddr->sa_data[1], hwaddr->sa_data[2], hwaddr->sa_data[3], hwaddr->sa_data[4], hwaddr->sa_data[5]); memcpy(ndev->dev_addr, hwaddr->sa_data, ndev->addr_len); xemacps_set_hwaddr(lp); return 0; } /** * xemacps_clear_csum - Clear the csum field for transport protocols * @skb: socket buffer * @ndev: network interface device structure * Return: 0 on success, other value if error */ static int xemacps_clear_csum(struct sk_buff *skb, struct net_device *ndev) { /* Only run for packets requiring a checksum. */ if (skb->ip_summed != CHECKSUM_PARTIAL) return 0; if (unlikely(skb_cow_head(skb, 0))) return -1; *(__sum16 *)(skb->head + skb->csum_start + skb->csum_offset) = 0; return 0; } /** * <API key> - unwind the tx fragment mapping * @lp: driver control structure * @fragcnt: fragment count */ static void <API key>(struct net_local *lp, int fragcnt) { struct xemacps_bd *cur_p; for (; fragcnt > 0; fragcnt cur_p = &lp->tx_bd[lp->tx_bd_freecnt]; dma_unmap_single(&lp->pdev->dev, cur_p->addr, (cur_p->ctrl & <API key>), DMA_TO_DEVICE); cur_p->ctrl |= <API key>; if (lp->tx_bd_freecnt) lp->tx_bd_freecnt else lp->tx_bd_freecnt = XEMACPS_SEND_BD_CNT - 1; } } /** * xemacps_start_xmit - transmit a packet (called by kernel) * @skb: socket buffer * @ndev: network interface device structure * Return: 0 on success, other value if error */ static int xemacps_start_xmit(struct sk_buff *skb, struct net_device *ndev) { struct net_local *lp = netdev_priv(ndev); dma_addr_t mapping; unsigned int nr_frags, len; int i; u32 regval; void *virt_addr; skb_frag_t *frag; struct xemacps_bd *cur_p; unsigned long flags; u32 bd_tail; nr_frags = skb_shinfo(skb)->nr_frags + 1; if (nr_frags > lp->tx_bd_freecnt) { netif_stop_queue(ndev); /* stop send queue */ return NETDEV_TX_BUSY; } if (xemacps_clear_csum(skb, ndev)) { kfree(skb); return NETDEV_TX_OK; } bd_tail = lp->tx_bd_tail; cur_p = &lp->tx_bd[bd_tail]; frag = &skb_shinfo(skb)->frags[0]; for (i = 0; i < nr_frags; i++) { if (i == 0) { len = skb_headlen(skb); mapping = dma_map_single(&lp->pdev->dev, skb->data, len, DMA_TO_DEVICE); } else { len = skb_frag_size(frag); virt_addr = skb_frag_address(frag); mapping = dma_map_single(&lp->pdev->dev, virt_addr, len, DMA_TO_DEVICE); frag++; skb_get(skb); } if (dma_mapping_error(&lp->pdev->dev, mapping)) { if (i) <API key>(lp, i); goto dma_err; } lp->tx_skb[lp->tx_bd_tail].skb = skb; lp->tx_skb[lp->tx_bd_tail].mapping = mapping; lp->tx_skb[lp->tx_bd_tail].len = len; cur_p->addr = mapping; /* preserve critical status bits */ regval = cur_p->ctrl; regval &= (<API key> | <API key>); /* update length field */ regval |= ((regval & ~<API key>) | len); /* commit second to last buffer to hardware */ if (i != 0) regval &= ~<API key>; /* last fragment of this packet? */ if (i == (nr_frags - 1)) regval |= <API key>; cur_p->ctrl = regval; lp->tx_bd_tail++; lp->tx_bd_tail = lp->tx_bd_tail % XEMACPS_SEND_BD_CNT; cur_p = &(lp->tx_bd[lp->tx_bd_tail]); } /* commit first buffer to hardware -- do this after * committing the other buffers to avoid an underrun */ cur_p = &lp->tx_bd[bd_tail]; regval = cur_p->ctrl; regval &= ~<API key>; cur_p->ctrl = regval; spin_lock_bh(&lp->tx_lock); lp->tx_bd_freecnt -= nr_frags; spin_unlock_bh(&lp->tx_lock); spin_lock_irqsave(&lp->nwctrlreg_lock, flags); regval = xemacps_read(lp->baseaddr, <API key>); xemacps_write(lp->baseaddr, <API key>, (regval | <API key>)); <API key>(&lp->nwctrlreg_lock, flags); ndev->trans_start = jiffies; return 0; dma_err: kfree_skb(skb); return NETDEV_TX_OK; } /* * Get the MAC Address bit from the specified position */ static unsigned get_bit(u8 *mac, unsigned bit) { unsigned byte; byte = mac[bit / 8]; byte >>= (bit & 0x7); byte &= 1; return byte; } /* * Calculate a GEM MAC Address hash index */ static unsigned calc_mac_hash(u8 *mac) { int index_bit, mac_bit; unsigned hash_index; hash_index = 0; mac_bit = 5; for (index_bit = 5; index_bit >= 0; index_bit hash_index |= (get_bit(mac, mac_bit) ^ get_bit(mac, mac_bit + 6) ^ get_bit(mac, mac_bit + 12) ^ get_bit(mac, mac_bit + 18) ^ get_bit(mac, mac_bit + 24) ^ get_bit(mac, mac_bit + 30) ^ get_bit(mac, mac_bit + 36) ^ get_bit(mac, mac_bit + 42)) << index_bit; mac_bit } return hash_index; } /** * <API key> - Add multicast addresses to the internal * multicast-hash table. Called from xemac_set_rx_mode(). * @ndev: network interface device structure * * The hash address register is 64 bits long and takes up two * locations in the memory map. The least significant bits are stored * in EMAC_HSL and the most significant bits in EMAC_HSH. * * The unicast hash enable and the multicast hash enable bits in the * network configuration register enable the reception of hash matched * frames. The destination address is reduced to a 6 bit index into * the 64 bit hash register using the following hash function. The * hash function is an exclusive or of every sixth bit of the * destination address. * * hi[5] = da[5] ^ da[11] ^ da[17] ^ da[23] ^ da[29] ^ da[35] ^ da[41] ^ da[47] * hi[4] = da[4] ^ da[10] ^ da[16] ^ da[22] ^ da[28] ^ da[34] ^ da[40] ^ da[46] * hi[3] = da[3] ^ da[09] ^ da[15] ^ da[21] ^ da[27] ^ da[33] ^ da[39] ^ da[45] * hi[2] = da[2] ^ da[08] ^ da[14] ^ da[20] ^ da[26] ^ da[32] ^ da[38] ^ da[44] * hi[1] = da[1] ^ da[07] ^ da[13] ^ da[19] ^ da[25] ^ da[31] ^ da[37] ^ da[43] * hi[0] = da[0] ^ da[06] ^ da[12] ^ da[18] ^ da[24] ^ da[30] ^ da[36] ^ da[42] * * da[0] represents the least significant bit of the first byte * received, that is, the multicast/unicast indicator, and da[47] * represents the most significant bit of the last byte received. If * the hash index, hi[n], points to a bit that is set in the hash * register then the frame will be matched according to whether the * frame is multicast or unicast. A multicast match will be signalled * if the multicast hash enable bit is set, da[0] is 1 and the hash * index points to a bit set in the hash register. A unicast match * will be signalled if the unicast hash enable bit is set, da[0] is 0 * and the hash index points to a bit set in the hash register. To * receive all multicast frames, the hash register should be set with * all ones and the multicast hash enable bit should be set in the * network configuration register. */ static void <API key>(struct net_device *ndev) { struct netdev_hw_addr *curr; u32 regvalh, regvall, hash_index; u8 *mc_addr; struct net_local *lp; lp = netdev_priv(ndev); regvalh = regvall = 0; <API key>(curr, ndev) { if (!curr) /* end of list */ break; mc_addr = curr->addr; hash_index = calc_mac_hash(mc_addr); if (hash_index >= <API key>) { dev_err(&lp->pdev->dev, "hash calculation out of range %d\n", hash_index); break; } if (hash_index < 32) regvall |= (1 << hash_index); else regvalh |= (1 << (hash_index - 32)); } xemacps_write(lp->baseaddr, <API key>, regvall); xemacps_write(lp->baseaddr, <API key>, regvalh); } /** * xemacps_set_rx_mode - enable/disable promiscuous and multicast modes * @ndev: network interface device structure */ static void xemacps_set_rx_mode(struct net_device *ndev) { struct net_local *lp = netdev_priv(ndev); u32 regval; regval = xemacps_read(lp->baseaddr, <API key>); /* promisc mode */ if (ndev->flags & IFF_PROMISC) regval |= <API key>; if (!(ndev->flags & IFF_PROMISC)) regval &= ~<API key>; /* All multicast mode */ if (ndev->flags & IFF_ALLMULTI) { regval |= <API key>; xemacps_write(lp->baseaddr, <API key>, ~0UL); xemacps_write(lp->baseaddr, <API key>, ~0UL); /* Specific multicast mode */ } else if ((ndev->flags & IFF_MULTICAST) && (netdev_mc_count(ndev) > 0)) { regval |= <API key>; <API key>(ndev); /* Disable multicast mode */ } else { xemacps_write(lp->baseaddr, <API key>, 0x0); xemacps_write(lp->baseaddr, <API key>, 0x0); regval &= ~<API key>; } /* broadcast mode */ if (ndev->flags & IFF_BROADCAST) regval &= ~<API key>; /* No broadcast */ if (!(ndev->flags & IFF_BROADCAST)) regval |= <API key>; xemacps_write(lp->baseaddr, <API key>, regval); } #define MIN_MTU 60 #define MAX_MTU 1500 /** * xemacps_change_mtu - Change maximum transfer unit * @ndev: network interface device structure * @new_mtu: new vlaue for maximum frame size * Return: 0 on success, negative value if error. */ static int xemacps_change_mtu(struct net_device *ndev, int new_mtu) { if ((new_mtu < MIN_MTU) || ((new_mtu + ndev->hard_header_len) > MAX_MTU)) return -EINVAL; ndev->mtu = new_mtu; /* change mtu in net_device structure */ return 0; } /** * <API key> - get device specific settings. * Usage: Issue "ethtool ethX" under linux prompt. * @ndev: network device * @ecmd: ethtool command structure * Return: 0 on success, negative value if error. */ static int <API key>(struct net_device *ndev, struct ethtool_cmd *ecmd) { struct net_local *lp = netdev_priv(ndev); struct phy_device *phydev = lp->phy_dev; if (!phydev) return -ENODEV; return phy_ethtool_gset(phydev, ecmd); } /** * <API key> - set device specific settings. * Usage: Issue "ethtool -s ethX speed 1000" under linux prompt * to change speed * @ndev: network device * @ecmd: ethtool command structure * Return: 0 on success, negative value if error. */ static int <API key>(struct net_device *ndev, struct ethtool_cmd *ecmd) { struct net_local *lp = netdev_priv(ndev); struct phy_device *phydev = lp->phy_dev; if (!phydev) return -ENODEV; return phy_ethtool_sset(phydev, ecmd); } /** * xemacps_get_drvinfo - report driver information * Usage: Issue "ethtool -i ethX" under linux prompt * @ndev: network device * @ed: device driver information structure */ static void xemacps_get_drvinfo(struct net_device *ndev, struct ethtool_drvinfo *ed) { struct net_local *lp = netdev_priv(ndev); memset(ed, 0, sizeof(struct ethtool_drvinfo)); strcpy(ed->driver, lp->pdev->dev.driver->name); strcpy(ed->version, DRIVER_VERSION); } /** * <API key> - get device dma ring information. * Usage: Issue "ethtool -g ethX" under linux prompt * @ndev: network device * @erp: ethtool ring parameter structure */ static void <API key>(struct net_device *ndev, struct ethtool_ringparam *erp) { memset(erp, 0, sizeof(struct ethtool_ringparam)); erp->rx_max_pending = XEMACPS_RECV_BD_CNT; erp->tx_max_pending = XEMACPS_SEND_BD_CNT; erp->rx_pending = 0; erp->tx_pending = 0; } /** * xemacps_get_wol - get device wake on lan status * Usage: Issue "ethtool ethX" under linux prompt * @ndev: network device * @ewol: wol status */ static void xemacps_get_wol(struct net_device *ndev, struct ethtool_wolinfo *ewol) { struct net_local *lp = netdev_priv(ndev); u32 regval; ewol->supported = WAKE_MAGIC | WAKE_ARP | WAKE_UCAST | WAKE_MCAST; regval = xemacps_read(lp->baseaddr, XEMACPS_WOL_OFFSET); if (regval | <API key>) ewol->wolopts |= WAKE_MCAST; if (regval | <API key>) ewol->wolopts |= WAKE_ARP; if (regval | <API key>) ewol->wolopts |= WAKE_UCAST; if (regval | <API key>) ewol->wolopts |= WAKE_MAGIC; } /** * xemacps_set_wol - set device wake on lan configuration * Usage: Issue "ethtool -s ethX wol u|m|b|g" under linux prompt to enable * specified type of packet. * Issue "ethtool -s ethX wol d" under linux prompt to disable this feature. * @ndev: network device * @ewol: wol status * Return: 0 on success, negative value if not supported */ static int xemacps_set_wol(struct net_device *ndev, struct ethtool_wolinfo *ewol) { struct net_local *lp = netdev_priv(ndev); u32 regval; if (ewol->wolopts & ~(WAKE_MAGIC | WAKE_ARP | WAKE_UCAST | WAKE_MCAST)) return -EOPNOTSUPP; regval = xemacps_read(lp->baseaddr, XEMACPS_WOL_OFFSET); regval &= ~(<API key> | <API key> | <API key> | <API key>); if (ewol->wolopts & WAKE_MAGIC) regval |= <API key>; if (ewol->wolopts & WAKE_ARP) regval |= <API key>; if (ewol->wolopts & WAKE_UCAST) regval |= <API key>; if (ewol->wolopts & WAKE_MCAST) regval |= <API key>; xemacps_write(lp->baseaddr, XEMACPS_WOL_OFFSET, regval); return 0; } /** * <API key> - get device pause status * Usage: Issue "ethtool -a ethX" under linux prompt * @ndev: network device * @epauseparm: pause parameter * * note: hardware supports only tx flow control */ static void <API key>(struct net_device *ndev, struct ethtool_pauseparam *epauseparm) { struct net_local *lp = netdev_priv(ndev); u32 regval; epauseparm->autoneg = 0; epauseparm->rx_pause = 0; regval = xemacps_read(lp->baseaddr, <API key>); epauseparm->tx_pause = regval & <API key>; } /** * <API key> - set device pause parameter(flow control) * Usage: Issue "ethtool -A ethX tx on|off" under linux prompt * @ndev: network device * @epauseparm: pause parameter * Return: 0 on success, negative value if not supported * * note: hardware supports only tx flow control */ static int <API key>(struct net_device *ndev, struct ethtool_pauseparam *epauseparm) { struct net_local *lp = netdev_priv(ndev); u32 regval; if (netif_running(ndev)) { dev_err(&lp->pdev->dev, "Please stop netif before apply configruation\n"); return -EFAULT; } regval = xemacps_read(lp->baseaddr, <API key>); if (epauseparm->tx_pause) regval |= <API key>; if (!(epauseparm->tx_pause)) regval &= ~<API key>; xemacps_write(lp->baseaddr, <API key>, regval); return 0; } /** * xemacps_get_stats - get device statistic raw data in 64bit mode * @ndev: network device * Return: Pointer to network device statistic */ static struct net_device_stats *xemacps_get_stats(struct net_device *ndev) { struct net_local *lp = netdev_priv(ndev); struct net_device_stats *nstat = &lp->stats; <API key>((unsigned long)lp); return nstat; } #ifdef <API key> /** * xemacps_get_ts_info - Get the interface timestamp capabilities * @dev: Network device * @info: Holds the interface timestamp capability info * Return: Always return zero */ static int xemacps_get_ts_info(struct net_device *dev, struct ethtool_ts_info *info) { struct net_local *lp = netdev_priv(dev); info->so_timestamping = <API key> | <API key> | <API key>; info->phc_index = lp->phc_index; info->tx_types = (1 << HWTSTAMP_TX_OFF) | (1 << HWTSTAMP_TX_ON); info->rx_filters = (1 << <API key>) | (1 << HWTSTAMP_FILTER_ALL); return 0; } #endif static struct ethtool_ops xemacps_ethtool_ops = { .get_settings = <API key>, .set_settings = <API key>, .get_drvinfo = xemacps_get_drvinfo, .get_link = ethtool_op_get_link, /* ethtool default */ .get_ringparam = <API key>, .get_wol = xemacps_get_wol, .set_wol = xemacps_set_wol, .get_pauseparam = <API key>, .set_pauseparam = <API key>, #ifdef <API key> .get_ts_info = xemacps_get_ts_info, #endif }; #ifdef <API key> static int <API key>(struct net_device *netdev, struct ifreq *ifr, int cmd) { struct hwtstamp_config config; struct net_local *lp; u32 regval; lp = netdev_priv(netdev); if (copy_from_user(&config, ifr->ifr_data, sizeof(config))) return -EFAULT; /* reserved for future extensions */ if (config.flags) return -EINVAL; if ((config.tx_type != HWTSTAMP_TX_OFF) && (config.tx_type != HWTSTAMP_TX_ON)) return -ERANGE; switch (config.rx_filter) { case <API key>: break; case <API key>: case <API key>: case <API key>: case HWTSTAMP_FILTER_ALL: case <API key>: case <API key>: case <API key>: case <API key>: case <API key>: case <API key>: case <API key>: case <API key>: case <API key>: config.rx_filter = HWTSTAMP_FILTER_ALL; regval = xemacps_read(lp->baseaddr, <API key>); xemacps_write(lp->baseaddr, <API key>, (regval | <API key>)); break; default: return -ERANGE; } config.tx_type = HWTSTAMP_TX_ON; lp->hwtstamp_config = config; return copy_to_user(ifr->ifr_data, &config, sizeof(config)) ? -EFAULT : 0; } #endif /* <API key> */ /** * xemacps_ioctl - ioctl entry point * @ndev: network device * @rq: interface request ioctl * @cmd: command code * * Called when user issues an ioctl request to the network device. * * Return: 0 on success, negative value if error */ static int xemacps_ioctl(struct net_device *ndev, struct ifreq *rq, int cmd) { struct net_local *lp = netdev_priv(ndev); struct phy_device *phydev = lp->phy_dev; if (!netif_running(ndev)) return -EINVAL; if (!phydev) return -ENODEV; switch (cmd) { case SIOCGMIIPHY: case SIOCGMIIREG: case SIOCSMIIREG: return phy_mii_ioctl(phydev, rq, cmd); #ifdef <API key> case SIOCSHWTSTAMP: return <API key>(ndev, rq, cmd); #endif default: dev_info(&lp->pdev->dev, "ioctl %d not implemented.\n", cmd); return -EOPNOTSUPP; } } /** * xemacps_probe - Platform driver probe * @pdev: Pointer to platform device structure * * Return: 0 on success, negative value if error */ static int xemacps_probe(struct platform_device *pdev) { struct resource *r_mem = NULL; struct resource *r_irq = NULL; struct net_device *ndev; struct net_local *lp; u32 regval = 0; int rc = -ENXIO; r_mem = <API key>(pdev, IORESOURCE_MEM, 0); r_irq = <API key>(pdev, IORESOURCE_IRQ, 0); if (!r_mem || !r_irq) { dev_err(&pdev->dev, "no IO resource defined.\n"); return -ENXIO; } ndev = alloc_etherdev(sizeof(*lp)); if (!ndev) { dev_err(&pdev->dev, "etherdev allocation failed.\n"); return -ENOMEM; } SET_NETDEV_DEV(ndev, &pdev->dev); lp = netdev_priv(ndev); lp->pdev = pdev; lp->ndev = ndev; spin_lock_init(&lp->tx_lock); spin_lock_init(&lp->rx_lock); spin_lock_init(&lp->nwctrlreg_lock); lp->baseaddr = <API key>(&pdev->dev, r_mem); if (IS_ERR(lp->baseaddr)) { rc = PTR_ERR(lp->baseaddr); goto err_out_free_netdev; } dev_dbg(&lp->pdev->dev, "BASEADDRESS hw: %p virt: %p\n", (void *)r_mem->start, lp->baseaddr); ndev->irq = platform_get_irq(pdev, 0); ndev->netdev_ops = &netdev_ops; ndev->watchdog_timeo = TX_TIMEOUT; ndev->ethtool_ops = &xemacps_ethtool_ops; ndev->base_addr = r_mem->start; ndev->features = NETIF_F_IP_CSUM | NETIF_F_SG; netif_napi_add(ndev, &lp->napi, xemacps_rx_poll, XEMACPS_NAPI_WEIGHT); lp->ip_summed = <API key>; rc = register_netdev(ndev); if (rc) { dev_err(&pdev->dev, "Cannot register net device, aborting.\n"); goto err_out_free_netdev; } if (ndev->irq == 54) lp->enetnum = 0; else lp->enetnum = 1; lp->aperclk = devm_clk_get(&pdev->dev, "aper_clk"); if (IS_ERR(lp->aperclk)) { dev_err(&pdev->dev, "aper_clk clock not found.\n"); rc = PTR_ERR(lp->aperclk); goto <API key>; } lp->devclk = devm_clk_get(&pdev->dev, "ref_clk"); if (IS_ERR(lp->devclk)) { dev_err(&pdev->dev, "ref_clk clock not found.\n"); rc = PTR_ERR(lp->devclk); goto <API key>; } rc = clk_prepare_enable(lp->aperclk); if (rc) { dev_err(&pdev->dev, "Unable to enable APER clock.\n"); goto <API key>; } rc = clk_prepare_enable(lp->devclk); if (rc) { dev_err(&pdev->dev, "Unable to enable device clock.\n"); goto <API key>; } lp->phy_node = of_parse_phandle(lp->pdev->dev.of_node, "phy-handle", 0); lp->gmii2rgmii_phy_node = of_parse_phandle(lp->pdev->dev.of_node, "<API key>", 0); rc = of_get_phy_mode(lp->pdev->dev.of_node); if (rc < 0) { dev_err(&lp->pdev->dev, "error in getting phy i/f\n"); goto err_out_clk_dis_all; } lp->phy_interface = rc; /* Set MDIO clock divider */ regval = (MDC_DIV_224 << <API key>); xemacps_write(lp->baseaddr, <API key>, regval); regval = <API key>; xemacps_write(lp->baseaddr, <API key>, regval); rc = xemacps_mii_init(lp); if (rc) { dev_err(&lp->pdev->dev, "error in xemacps_mii_init\n"); goto err_out_clk_dis_all; } <API key>(lp); tasklet_init(&lp-><API key>, xemacps_tx_poll, (unsigned long) ndev); tasklet_disable(&lp-><API key>); lp-><API key> = <API key>(DRIVER_NAME); INIT_WORK(&lp->txtimeout_reinit, <API key>); <API key>(pdev, ndev); <API key>(&pdev->dev); pm_runtime_enable(&pdev->dev); dev_info(&lp->pdev->dev, "pdev->id %d, baseaddr 0x%08lx, irq %d\n", pdev->id, ndev->base_addr, ndev->irq); rc = devm_request_irq(&pdev->dev, ndev->irq, &xemacps_interrupt, 0, ndev->name, ndev); if (rc) { dev_err(&lp->pdev->dev, "Unable to request IRQ %p, error %d\n", r_irq, rc); goto err_out_clk_dis_all; } return 0; err_out_clk_dis_all: <API key>(lp->devclk); <API key>: <API key>(lp->aperclk); <API key>: unregister_netdev(ndev); err_out_free_netdev: free_netdev(ndev); return rc; } /** * xemacps_remove - called when platform driver is unregistered * @pdev: Pointer to the platform device structure * * Return: 0 on success */ static int xemacps_remove(struct platform_device *pdev) { struct net_device *ndev = <API key>(pdev); struct net_local *lp; if (ndev) { lp = netdev_priv(ndev); mdiobus_unregister(lp->mii_bus); kfree(lp->mii_bus->irq); mdiobus_free(lp->mii_bus); unregister_netdev(ndev); if (!<API key>(&pdev->dev)) { <API key>(lp->devclk); <API key>(lp->aperclk); } else { clk_unprepare(lp->devclk); clk_unprepare(lp->aperclk); } free_netdev(ndev); } return 0; } #ifdef CONFIG_PM #ifdef CONFIG_PM_SLEEP /** * xemacps_suspend - Suspend event * @device: Pointer to device structure * * Return: 0 */ static int xemacps_suspend(struct device *device) { struct platform_device *pdev = container_of(device, struct platform_device, dev); struct net_device *ndev = <API key>(pdev); struct net_local *lp = netdev_priv(ndev); netif_device_detach(ndev); if (!<API key>(device)) { clk_disable(lp->devclk); clk_disable(lp->aperclk); } return 0; } /** * xemacps_resume - Resume after previous suspend * @device: Pointer to device structure * * Return: 0 on success, errno otherwise. */ static int xemacps_resume(struct device *device) { struct platform_device *pdev = container_of(device, struct platform_device, dev); struct net_device *ndev = <API key>(pdev); struct net_local *lp = netdev_priv(ndev); if (!<API key>(device)) { int ret; ret = clk_enable(lp->aperclk); if (ret) return ret; ret = clk_enable(lp->devclk); if (ret) { clk_disable(lp->aperclk); return ret; } } netif_device_attach(ndev); return 0; } #endif /* ! CONFIG_PM_SLEEP */ #ifdef CONFIG_PM_RUNTIME static int <API key>(struct device *dev) { return pm_schedule_suspend(dev, 1); } static int <API key>(struct device *device) { int ret; struct platform_device *pdev = container_of(device, struct platform_device, dev); struct net_device *ndev = <API key>(pdev); struct net_local *lp = netdev_priv(ndev); ret = clk_enable(lp->aperclk); if (ret) return ret; ret = clk_enable(lp->devclk); if (ret) { clk_disable(lp->aperclk); return ret; } return 0; } static int <API key>(struct device *device) { struct platform_device *pdev = container_of(device, struct platform_device, dev); struct net_device *ndev = <API key>(pdev); struct net_local *lp = netdev_priv(ndev); clk_disable(lp->devclk); clk_disable(lp->aperclk); return 0; } #endif /* CONFIG_PM_RUNTIME */ static const struct dev_pm_ops xemacps_dev_pm_ops = { <API key>(xemacps_suspend, xemacps_resume) SET_RUNTIME_PM_OPS(<API key>, <API key>, <API key>) }; #define XEMACPS_PM (&xemacps_dev_pm_ops) #else /* ! CONFIG_PM */ #define XEMACPS_PM NULL #endif /* ! CONFIG_PM */ static struct net_device_ops netdev_ops = { .ndo_open = xemacps_open, .ndo_stop = xemacps_close, .ndo_start_xmit = xemacps_start_xmit, .ndo_set_rx_mode = xemacps_set_rx_mode, .ndo_set_mac_address = <API key>, .ndo_do_ioctl = xemacps_ioctl, .ndo_change_mtu = xemacps_change_mtu, .ndo_tx_timeout = xemacps_tx_timeout, .ndo_get_stats = xemacps_get_stats, }; static struct of_device_id xemacps_of_match[] = { { .compatible = "xlnx,ps7-ethernet-1.00.a", }, { /* end of table */} }; MODULE_DEVICE_TABLE(of, xemacps_of_match); static struct platform_driver xemacps_driver = { .probe = xemacps_probe, .remove = xemacps_remove, .driver = { .name = DRIVER_NAME, .owner = THIS_MODULE, .of_match_table = xemacps_of_match, .pm = XEMACPS_PM, }, }; <API key>(xemacps_driver); MODULE_AUTHOR("Xilinx, Inc."); MODULE_DESCRIPTION("Xilinx Ethernet driver"); MODULE_LICENSE("GPL v2");
class abc { double sq (double i, int j) { int A [] = { 1, 2} ; return i * i; } public int add () { double test; test = sq (test); return test; } }
/* Generated on Wed Jul 27 06:19:25 EDT 2011 */ #include "codelet-rdft.h" #ifdef HAVE_FMA /* Generated by: ../../../genfft/gen_hc2c.native -fma -reorder-insns -<API key> -compact -variables 4 -pipeline-latency 4 -sign 1 -n 12 -dif -name hc2cb_12 -include hc2cb.h */ /* * This function contains 118 FP additions, 68 FP multiplications, * (or, 72 additions, 22 multiplications, 46 fused multiply/add), * 64 stack variables, 2 constants, and 48 memory accesses */ #include "hc2cb.h" static void hc2cb_12(R *Rp, R *Ip, R *Rm, R *Im, const R *W, stride rs, INT mb, INT me, INT ms) { DK(KP866025403, +0.<API key>); DK(KP500000000, +0.<API key>); { INT m; for (m = mb, W = W + ((mb - 1) * 22); m < me; m = m + 1, Rp = Rp + ms, Ip = Ip + ms, Rm = Rm - ms, Im = Im - ms, W = W + 22, <API key>(rs)) { E T1U, T1X, T1W, T1Y, T1V; { E T18, T20, T21, T1b, T2a, T1s, T29, T1p, TO, T11, To, Tb, Tg, T23, T1f; E Tl, Ty, Tt, T1i, T24, T1z, T2d, T1w, T2c; { E T5, Ta, TN, TI; { E T1, TE, T6, TM, T7, T1o, T4, T17, TH, T8, TJ, TK; T1 = Rp[0]; TE = Ip[0]; T6 = Rm[WS(rs, 5)]; TM = Im[WS(rs, 5)]; { E T2, T3, TF, TG; T2 = Rp[WS(rs, 4)]; T3 = Rm[WS(rs, 3)]; TF = Ip[WS(rs, 4)]; TG = Im[WS(rs, 3)]; T7 = Rm[WS(rs, 1)]; T1o = T2 - T3; T4 = T2 + T3; T17 = TF + TG; TH = TF - TG; T8 = Rp[WS(rs, 2)]; TJ = Ip[WS(rs, 2)]; TK = Im[WS(rs, 1)]; } { E T1r, T1a, T19, T1q, T9, TL, T16, T1n; T5 = T1 + T4; T16 = FNMS(KP500000000, T4, T1); T1r = T7 - T8; T9 = T7 + T8; T1a = TJ + TK; TL = TJ - TK; T18 = FNMS(KP866025403, T17, T16); T20 = FMA(KP866025403, T17, T16); T19 = FNMS(KP500000000, T9, T6); Ta = T6 + T9; TN = TL - TM; T1q = FMA(KP500000000, TL, TM); T1n = FNMS(KP500000000, TH, TE); TI = TE + TH; T21 = FNMS(KP866025403, T1a, T19); T1b = FMA(KP866025403, T1a, T19); T2a = FMA(KP866025403, T1r, T1q); T1s = FNMS(KP866025403, T1r, T1q); T29 = FNMS(KP866025403, T1o, T1n); T1p = FMA(KP866025403, T1o, T1n); } } { E Tc, Tp, Th, Tx, Ti, Tf, T1v, Ts, T1e, Tj, Tu, Tv; Tc = Rp[WS(rs, 3)]; TO = TI - TN; T11 = TI + TN; Tp = Ip[WS(rs, 3)]; To = T5 - Ta; Tb = T5 + Ta; Th = Rm[WS(rs, 2)]; Tx = Im[WS(rs, 2)]; { E Td, Te, Tq, Tr; Td = Rm[WS(rs, 4)]; Te = Rm[0]; Tq = Im[WS(rs, 4)]; Tr = Im[0]; Ti = Rp[WS(rs, 1)]; Tf = Td + Te; T1v = Td - Te; Ts = Tq + Tr; T1e = Tq - Tr; Tj = Rp[WS(rs, 5)]; Tu = Ip[WS(rs, 1)]; Tv = Ip[WS(rs, 5)]; } { E T1y, T1h, T1g, T1x, Tk, Tw, T1d, T1u; T1d = FNMS(KP500000000, Tf, Tc); Tg = Tc + Tf; Tk = Ti + Tj; T1y = Ti - Tj; Tw = Tu + Tv; T1h = Tv - Tu; T23 = FNMS(KP866025403, T1e, T1d); T1f = FMA(KP866025403, T1e, T1d); Tl = Th + Tk; T1g = FNMS(KP500000000, Tk, Th); T1x = FMA(KP500000000, Tw, Tx); Ty = Tw - Tx; Tt = Tp - Ts; T1u = FMA(KP500000000, Ts, Tp); T1i = FMA(KP866025403, T1h, T1g); T24 = FNMS(KP866025403, T1h, T1g); T1z = FNMS(KP866025403, T1y, T1x); T2d = FMA(KP866025403, T1y, T1x); T1w = FMA(KP866025403, T1v, T1u); T2c = FNMS(KP866025403, T1v, T1u); } } } { E TY, T13, TX, T10; { E Tn, T12, TC, Tm, TD, TS, TA, Tz; Tn = W[16]; T12 = Tt + Ty; Tz = Tt - Ty; TC = W[17]; Tm = Tg + Tl; TD = Tg - Tl; TS = To + Tz; TA = To - Tz; { E TV, TU, TW, TT; { E TQ, TR, TP, TB; TV = TO - TD; TP = TD + TO; Rp[0] = Tb + Tm; TB = Tn * TA; TQ = Tn * TP; TR = W[4]; Ip[WS(rs, 4)] = FNMS(TC, TP, TB); TU = W[5]; Im[WS(rs, 4)] = FMA(TC, TA, TQ); TW = TR * TV; TT = TR * TS; } Im[WS(rs, 1)] = FMA(TU, TS, TW); Ip[WS(rs, 1)] = FNMS(TU, TV, TT); TY = Tb - Tm; T13 = T11 - T12; TX = W[10]; T10 = W[11]; Rm[0] = T11 + T12; } } { E T1K, T1Q, T1P, T1L, T2o, T2u, T2t, T2p; { E T1E, T1D, T1H, T1F, T1G, T1t, T1k, T1A; { E T1c, TZ, T14, T1j; T1K = T18 - T1b; T1c = T18 + T1b; TZ = TX * TY; T14 = T10 * TY; T1j = T1f + T1i; T1Q = T1f - T1i; T1P = T1p + T1s; T1t = T1p - T1s; Rp[WS(rs, 3)] = FNMS(T10, T13, TZ); Rm[WS(rs, 3)] = FMA(TX, T13, T14); T1E = T1c + T1j; T1k = T1c - T1j; T1A = T1w - T1z; T1L = T1w + T1z; } { E T15, T1m, T1B, T1l, T1C; T15 = W[18]; T1m = W[19]; T1D = W[6]; T1H = T1t + T1A; T1B = T1t - T1A; T1l = T15 * T1k; T1C = T1m * T1k; T1F = T1D * T1E; T1G = W[7]; Rp[WS(rs, 5)] = FNMS(T1m, T1B, T1l); Rm[WS(rs, 5)] = FMA(T15, T1B, T1C); } { E T26, T2i, T2l, T2f, T1Z, T28; { E T22, T1I, T25, T2b, T2e; T22 = T20 + T21; T2o = T20 - T21; Rp[WS(rs, 2)] = FNMS(T1G, T1H, T1F); T1I = T1G * T1E; T2u = T23 - T24; T25 = T23 + T24; T2b = T29 - T2a; T2t = T29 + T2a; T2p = T2c + T2d; T2e = T2c - T2d; Rm[WS(rs, 2)] = FMA(T1D, T1H, T1I); T26 = T22 - T25; T2i = T22 + T25; T2l = T2b + T2e; T2f = T2b - T2e; } T1Z = W[2]; T28 = W[3]; { E T2h, T2k, T27, T2g, T2j, T2m; T2h = W[14]; T2k = W[15]; T27 = T1Z * T26; T2g = T28 * T26; T2j = T2h * T2i; T2m = T2k * T2i; Rp[WS(rs, 1)] = FNMS(T28, T2f, T27); Rm[WS(rs, 1)] = FMA(T1Z, T2f, T2g); Rp[WS(rs, 4)] = FNMS(T2k, T2l, T2j); Rm[WS(rs, 4)] = FMA(T2h, T2l, T2m); } } } { E T2y, T2B, T2A, T2C, T2z; { E T2n, T2q, T2v, T2s, T2r, T2x, T2w; T2n = W[8]; T2y = T2o + T2p; T2q = T2o - T2p; T2B = T2t - T2u; T2v = T2t + T2u; T2s = W[9]; T2r = T2n * T2q; T2x = W[20]; T2w = T2n * T2v; T2A = W[21]; Ip[WS(rs, 2)] = FNMS(T2s, T2v, T2r); T2C = T2x * T2B; T2z = T2x * T2y; Im[WS(rs, 2)] = FMA(T2s, T2q, T2w); } Im[WS(rs, 5)] = FMA(T2A, T2y, T2C); Ip[WS(rs, 5)] = FNMS(T2A, T2B, T2z); { E T1J, T1M, T1R, T1O, T1N, T1T, T1S; T1J = W[0]; T1U = T1K + T1L; T1M = T1K - T1L; T1X = T1P - T1Q; T1R = T1P + T1Q; T1O = W[1]; T1N = T1J * T1M; T1T = W[12]; T1S = T1J * T1R; T1W = W[13]; Ip[0] = FNMS(T1O, T1R, T1N); T1Y = T1T * T1X; T1V = T1T * T1U; Im[0] = FMA(T1O, T1M, T1S); } } } } } Im[WS(rs, 3)] = FMA(T1W, T1U, T1Y); Ip[WS(rs, 3)] = FNMS(T1W, T1X, T1V); } } } static const tw_instr twinstr[] = { {TW_FULL, 1, 12}, {TW_NEXT, 1, 0} }; static const hc2c_desc desc = { 12, "hc2cb_12", twinstr, &GENUS, {72, 22, 46, 0} }; void X(codelet_hc2cb_12) (planner *p) { X(khc2c_register) (p, hc2cb_12, &desc, HC2C_VIA_RDFT); } #else /* HAVE_FMA */ /* Generated by: ../../../genfft/gen_hc2c.native -compact -variables 4 -pipeline-latency 4 -sign 1 -n 12 -dif -name hc2cb_12 -include hc2cb.h */ /* * This function contains 118 FP additions, 60 FP multiplications, * (or, 88 additions, 30 multiplications, 30 fused multiply/add), * 39 stack variables, 2 constants, and 48 memory accesses */ #include "hc2cb.h" static void hc2cb_12(R *Rp, R *Ip, R *Rm, R *Im, const R *W, stride rs, INT mb, INT me, INT ms) { DK(KP500000000, +0.<API key>); DK(KP866025403, +0.<API key>); { INT m; for (m = mb, W = W + ((mb - 1) * 22); m < me; m = m + 1, Rp = Rp + ms, Ip = Ip + ms, Rm = Rm - ms, Im = Im - ms, W = W + 22, <API key>(rs)) { E T5, TH, T12, T1M, T1i, T1U, Tl, Ty, T1c, T1Y, T1s, T1Q, Ta, TM, T15; E T1N, T1l, T1V, Tg, Tt, T19, T1X, T1p, T1P; { E T1, TD, T4, T1g, TG, T11, T10, T1h; T1 = Rp[0]; TD = Ip[0]; { E T2, T3, TE, TF; T2 = Rp[WS(rs, 4)]; T3 = Rm[WS(rs, 3)]; T4 = T2 + T3; T1g = KP866025403 * (T2 - T3); TE = Ip[WS(rs, 4)]; TF = Im[WS(rs, 3)]; TG = TE - TF; T11 = KP866025403 * (TE + TF); } T5 = T1 + T4; TH = TD + TG; T10 = FNMS(KP500000000, T4, T1); T12 = T10 - T11; T1M = T10 + T11; T1h = FNMS(KP500000000, TG, TD); T1i = T1g + T1h; T1U = T1h - T1g; } { E Th, Tx, Tk, T1a, Tw, T1r, T1b, T1q; Th = Rm[WS(rs, 2)]; Tx = Im[WS(rs, 2)]; { E Ti, Tj, Tu, Tv; Ti = Rp[WS(rs, 1)]; Tj = Rp[WS(rs, 5)]; Tk = Ti + Tj; T1a = KP866025403 * (Ti - Tj); Tu = Ip[WS(rs, 1)]; Tv = Ip[WS(rs, 5)]; Tw = Tu + Tv; T1r = KP866025403 * (Tv - Tu); } Tl = Th + Tk; Ty = Tw - Tx; T1b = FMA(KP500000000, Tw, Tx); T1c = T1a - T1b; T1Y = T1a + T1b; T1q = FNMS(KP500000000, Tk, Th); T1s = T1q + T1r; T1Q = T1q - T1r; } { E T6, TL, T9, T1j, TK, T14, T13, T1k; T6 = Rm[WS(rs, 5)]; TL = Im[WS(rs, 5)]; { E T7, T8, TI, TJ; T7 = Rm[WS(rs, 1)]; T8 = Rp[WS(rs, 2)]; T9 = T7 + T8; T1j = KP866025403 * (T7 - T8); TI = Ip[WS(rs, 2)]; TJ = Im[WS(rs, 1)]; TK = TI - TJ; T14 = KP866025403 * (TI + TJ); } Ta = T6 + T9; TM = TK - TL; T13 = FNMS(KP500000000, T9, T6); T15 = T13 + T14; T1N = T13 - T14; T1k = FMA(KP500000000, TK, TL); T1l = T1j - T1k; T1V = T1j + T1k; } { E Tc, Tp, Tf, T17, Ts, T1o, T18, T1n; Tc = Rp[WS(rs, 3)]; Tp = Ip[WS(rs, 3)]; { E Td, Te, Tq, Tr; Td = Rm[WS(rs, 4)]; Te = Rm[0]; Tf = Td + Te; T17 = KP866025403 * (Td - Te); Tq = Im[WS(rs, 4)]; Tr = Im[0]; Ts = Tq + Tr; T1o = KP866025403 * (Tq - Tr); } Tg = Tc + Tf; Tt = Tp - Ts; T18 = FMA(KP500000000, Ts, Tp); T19 = T17 + T18; T1X = T18 - T17; T1n = FNMS(KP500000000, Tf, Tc); T1p = T1n + T1o; T1P = T1n - T1o; } { E Tb, Tm, TU, TW, TX, TY, TT, TV; Tb = T5 + Ta; Tm = Tg + Tl; TU = Tb - Tm; TW = TH + TM; TX = Tt + Ty; TY = TW - TX; Rp[0] = Tb + Tm; Rm[0] = TW + TX; TT = W[10]; TV = W[11]; Rp[WS(rs, 3)] = FNMS(TV, TY, TT * TU); Rm[WS(rs, 3)] = FMA(TV, TU, TT * TY); } { E TA, TQ, TO, TS; { E To, Tz, TC, TN; To = T5 - Ta; Tz = Tt - Ty; TA = To - Tz; TQ = To + Tz; TC = Tg - Tl; TN = TH - TM; TO = TC + TN; TS = TN - TC; } { E Tn, TB, TP, TR; Tn = W[16]; TB = W[17]; Ip[WS(rs, 4)] = FNMS(TB, TO, Tn * TA); Im[WS(rs, 4)] = FMA(Tn, TO, TB * TA); TP = W[4]; TR = W[5]; Ip[WS(rs, 1)] = FNMS(TR, TS, TP * TQ); Im[WS(rs, 1)] = FMA(TP, TS, TR * TQ); } } { E T28, T2e, T2c, T2g; { E T26, T27, T2a, T2b; T26 = T1M - T1N; T27 = T1X + T1Y; T28 = T26 - T27; T2e = T26 + T27; T2a = T1U + T1V; T2b = T1P - T1Q; T2c = T2a + T2b; T2g = T2a - T2b; } { E T25, T29, T2d, T2f; T25 = W[8]; T29 = W[9]; Ip[WS(rs, 2)] = FNMS(T29, T2c, T25 * T28); Im[WS(rs, 2)] = FMA(T25, T2c, T29 * T28); T2d = W[20]; T2f = W[21]; Ip[WS(rs, 5)] = FNMS(T2f, T2g, T2d * T2e); Im[WS(rs, 5)] = FMA(T2d, T2g, T2f * T2e); } } { E T1S, T22, T20, T24; { E T1O, T1R, T1W, T1Z; T1O = T1M + T1N; T1R = T1P + T1Q; T1S = T1O - T1R; T22 = T1O + T1R; T1W = T1U - T1V; T1Z = T1X - T1Y; T20 = T1W - T1Z; T24 = T1W + T1Z; } { E T1L, T1T, T21, T23; T1L = W[2]; T1T = W[3]; Rp[WS(rs, 1)] = FNMS(T1T, T20, T1L * T1S); Rm[WS(rs, 1)] = FMA(T1T, T1S, T1L * T20); T21 = W[14]; T23 = W[15]; Rp[WS(rs, 4)] = FNMS(T23, T24, T21 * T22); Rm[WS(rs, 4)] = FMA(T23, T22, T21 * T24); } } { E T1C, T1I, T1G, T1K; { E T1A, T1B, T1E, T1F; T1A = T12 + T15; T1B = T1p + T1s; T1C = T1A - T1B; T1I = T1A + T1B; T1E = T1i + T1l; T1F = T19 + T1c; T1G = T1E - T1F; T1K = T1E + T1F; } { E T1z, T1D, T1H, T1J; T1z = W[18]; T1D = W[19]; Rp[WS(rs, 5)] = FNMS(T1D, T1G, T1z * T1C); Rm[WS(rs, 5)] = FMA(T1D, T1C, T1z * T1G); T1H = W[6]; T1J = W[7]; Rp[WS(rs, 2)] = FNMS(T1J, T1K, T1H * T1I); Rm[WS(rs, 2)] = FMA(T1J, T1I, T1H * T1K); } } { E T1e, T1w, T1u, T1y; { E T16, T1d, T1m, T1t; T16 = T12 - T15; T1d = T19 - T1c; T1e = T16 - T1d; T1w = T16 + T1d; T1m = T1i - T1l; T1t = T1p - T1s; T1u = T1m + T1t; T1y = T1m - T1t; } { E TZ, T1f, T1v, T1x; TZ = W[0]; T1f = W[1]; Ip[0] = FNMS(T1f, T1u, TZ * T1e); Im[0] = FMA(TZ, T1u, T1f * T1e); T1v = W[12]; T1x = W[13]; Ip[WS(rs, 3)] = FNMS(T1x, T1y, T1v * T1w); Im[WS(rs, 3)] = FMA(T1v, T1y, T1x * T1w); } } } } } static const tw_instr twinstr[] = { {TW_FULL, 1, 12}, {TW_NEXT, 1, 0} }; static const hc2c_desc desc = { 12, "hc2cb_12", twinstr, &GENUS, {88, 30, 30, 0} }; void X(codelet_hc2cb_12) (planner *p) { X(khc2c_register) (p, hc2cb_12, &desc, HC2C_VIA_RDFT); } #endif /* HAVE_FMA */
#include "ScriptPCH.h" #define SPELL_BATTLE_SHOUT 31403 #define SPELL_CHARGE 60067 #define <API key> 19134 #define SPELL_WHIRLWIND_1 38619 #define SPELL_WHIRLWIND_2 38618 //not used //Yell #define SAY_AGGRO -1576024 #define SAY_KILL -1576025 #define SAY_DEATH -1576026 class <API key> : public CreatureScript { public: <API key>() : CreatureScript("<API key>") { } CreatureAI* GetAI(Creature* creature) const { return new <API key> (creature); } struct <API key> : public ScriptedAI { <API key>(Creature* c) : ScriptedAI(c) {} void Reset() {} void EnterCombat(Unit* /*who*/) {} void AttackStart(Unit* /*who*/) {} void MoveInLineOfSight(Unit* /*who*/) {} void UpdateAI(const uint32 /*diff*/) { //Return since we have no target if (!UpdateVictim()) return; <API key>(); } void JustDied(Unit* /*killer*/) {} }; }; void <API key>() { new <API key>(); }
# Robot Overlord # Robot Overlord is 3D control software for robots. It is intended to be easier than ROS. It was started by http: We would love to see your robot run in the app. Please joint our Discord channel and talk live with a human! https://discord.gg/Q5TZFmB Some of the robots it controls are: - Sixi 2+3, 6DOF arms - Arm3, a 3DOF arm - Thor, a 5DOF arm - Rotary Stewart Platforms, like flight simulators - Delta Robot 3, aka a Kossel - Spidee, a 6 legged crab-style walker. - Dog Robot, a generic 4 legged walker. # Video [![Click to watch](README.PNG)](https: # Why For our philosophy about RO, please see the Wiki: https://github.com/MarginallyClever/Robot-Overlord-App/wiki/Why-Robot-Overlord%3F ## Get Started! Steps to get started: 1. Install The latest OpenJDK (java software) 2. Install Eclipse (prorgramming interface) 3. Install Robot Overlord App Then you should be able to run the application. ## #Install The latest OpenJDK Get the Open Java Development Kit (OpenJDK) https://jdk.java.net/ . The latest version is the "ready to use" edition. *OSX*: Unarchive the OpenJDK tar, and place the resulting folder (i.e. jdk-12.jdk) into your /Library/Java/JavaVirtualMachines/ folder since this is the standard and expected location of JDK installs. You can also install anywhere you want in reality. *Windows*: https://stackoverflow.com/a/52531093 _untested_ *Linux*: https://linuxize.com/post/<API key>/ _untested_ Install Eclipse * Download Eclipse IDE: https: * install the latest. * Choose "Eclipse IDE for Java developers" Install Robot Overlord App * Goto https://github.com/MarginallyClever/Robot-Overlord-App/ * Fownload this zip file: https://github.com/MarginallyClever/Robot-Overlord-App/archive/refs/heads/master.zip and extract it. Note the folder for later. * Open Eclipse. If you see the "Welcome!" tab, close it. * Go to File > Import > Maven > Existing Maven Projects > Next > (folder from previous step) > Finish * Go to Window > Show View > Package Explorer * Right click on "Robot Overlord" in Package Explorer view and select > Maven > Update Project * select Run > Debug As > Java Application * select "Robot Overlord - com.marginallyclever.robotOverlord.RobotOverlord" and click OK. * Wait while the progress bar in the bottom right fills up. This is a one time thing. * "Errors exist...Proceed with launch?" Select Proceed. Application should now launch. ## Usage Camera movement: middle mouse button. Click and drag to move forward and back. shift+drag to orbit. roll the middle mouse to change the orbit distance. Double click any entity in the scene to select it, or use the entity panel in the top right. For robot arms, select an arm and then open the control panel. ## More If you're reading this, make an issue ticket and we will respond to it promptly.
<?php $event = $vars["entity"]; if(!empty($event)){ $files = json_decode($event->files); if(count($files) > 0) { $content = "<table class='elgg-table'>"; foreach($files as $file) { $content .= "<tr>"; $content .= "<td><a href='" . elgg_get_site_url() . "/events/event/file/" . $event->getGUID() . "/" . $file->file . "'>" . $file->title . "</a></td>"; $content .= "<td>" . elgg_view("output/confirmlink", array("href" => "action/event_manager/event/deletefile?guid=" . $event->getGUID() . "&file=" . $file->file, "text" => elgg_view_icon("delete"))) . "</td>"; $content .= "</tr>"; } $content .= '</table>'; echo elgg_view_module("info", elgg_echo("event_manager:edit:form:files"), $content); } }
#ifndef TREE_SSA_SCCVN_H #define TREE_SSA_SCCVN_H /* In tree-ssa-sccvn.c */ bool expressions_equal_p (tree, tree); /* TOP of the VN lattice. */ extern tree VN_TOP; /* N-ary operations in the hashtable consist of length operands, an opcode, and a type. Result is the value number of the operation, and hashcode is stored to avoid having to calculate it repeatedly. */ typedef struct vn_nary_op_s { /* Unique identify that all expressions with the same value have. */ unsigned int value_id; ENUM_BITFIELD(tree_code) opcode : 16; unsigned length : 16; hashval_t hashcode; tree result; tree type; tree op[1]; } *vn_nary_op_t; typedef const struct vn_nary_op_s *const_vn_nary_op_t; /* Return the size of a vn_nary_op_t with LENGTH operands. */ static inline size_t sizeof_vn_nary_op (unsigned int length) { return sizeof (struct vn_nary_op_s) + sizeof (tree) * length - sizeof (tree); } /* Phi nodes in the hashtable consist of their non-VN_TOP phi arguments, and the basic block the phi is in. Result is the value number of the operation, and hashcode is stored to avoid having to calculate it repeatedly. Phi nodes not in the same block are never considered equivalent. */ typedef struct vn_phi_s { /* Unique identifier that all expressions with the same value have. */ unsigned int value_id; hashval_t hashcode; vec<tree> phiargs; basic_block block; tree type; tree result; } *vn_phi_t; typedef const struct vn_phi_s *const_vn_phi_t; /* Reference operands only exist in reference operations structures. They consist of an opcode, type, and some number of operands. For a given opcode, some, all, or none of the operands may be used. The operands are there to store the information that makes up the portion of the addressing calculation that opcode performs. */ typedef struct <API key> { ENUM_BITFIELD(tree_code) opcode : 16; /* 1 for instrumented calls. */ unsigned with_bounds : 1; /* Dependence info, used for [TARGET_]MEM_REF only. */ unsigned short clique; unsigned short base; /* Constant offset this op adds or -1 if it is variable. */ HOST_WIDE_INT off; tree type; tree op0; tree op1; tree op2; } vn_reference_op_s; typedef vn_reference_op_s *vn_reference_op_t; typedef const vn_reference_op_s *<API key>; /* A reference operation in the hashtable is representation as the vuse, representing the memory state at the time of the operation, and a collection of operands that make up the addressing calculation. If two vn_reference_t's have the same set of operands, they access the same memory location. We also store the resulting value number, and the hashcode. */ typedef struct vn_reference_s { /* Unique identifier that all expressions with the same value have. */ unsigned int value_id; hashval_t hashcode; tree vuse; alias_set_type set; tree type; vec<vn_reference_op_s> operands; tree result; tree result_vdef; } *vn_reference_t; typedef const struct vn_reference_s *<API key>; typedef struct vn_constant_s { unsigned int value_id; hashval_t hashcode; tree constant; } *vn_constant_t; enum vn_kind { VN_NONE, VN_CONSTANT, VN_NARY, VN_REFERENCE, VN_PHI }; enum vn_kind vn_get_stmt_kind (gimple *); /* Hash the type TYPE using bits that distinguishes it in the types_compatible_p sense. */ static inline hashval_t vn_hash_type (tree type) { return (INTEGRAL_TYPE_P (type) + (INTEGRAL_TYPE_P (type) ? TYPE_PRECISION (type) + TYPE_UNSIGNED (type) : 0)); } /* Hash the constant CONSTANT with distinguishing type incompatible constants in the types_compatible_p sense. */ static inline hashval_t <API key> (tree constant) { inchash::hash hstate; inchash::add_expr (constant, hstate); hstate.merge_hash (vn_hash_type (TREE_TYPE (constant))); return hstate.end (); } /* Compare the constants C1 and C2 with distinguishing type incompatible constants in the types_compatible_p sense. */ static inline bool <API key> (tree c1, tree c2) { return (expressions_equal_p (c1, c2) && types_compatible_p (TREE_TYPE (c1), TREE_TYPE (c2))); } typedef struct vn_ssa_aux { /* Value number. This may be an SSA name or a constant. */ tree valnum; /* Statements to insert if needs_insertion is true. */ gimple_seq expr; /* Unique identifier that all expressions with the same value have. */ unsigned int value_id; /* SCC information. */ unsigned int dfsnum; unsigned int low; unsigned visited : 1; unsigned on_sccstack : 1; /* Whether the SSA_NAME has been value numbered already. This is only saying whether visit_use has been called on it at least once. It cannot be used to avoid visitation for SSA_NAME's involved in non-singleton SCC's. */ unsigned use_processed : 1; /* Whether the SSA_NAME has no defining statement and thus an insertion of such with EXPR as definition is required before a use can be created of it. */ unsigned needs_insertion : 1; } *vn_ssa_aux_t; enum vn_lookup_kind { VN_NOWALK, VN_WALK, VN_WALKREWRITE }; /* Return the value numbering info for an SSA_NAME. */ extern vn_ssa_aux_t VN_INFO (tree); extern vn_ssa_aux_t VN_INFO_GET (tree); tree vn_get_expr_for (tree); bool run_scc_vn (vn_lookup_kind); void free_scc_vn (void); tree vn_nary_op_lookup (tree, vn_nary_op_t *); tree <API key> (gimple *, vn_nary_op_t *); tree <API key> (unsigned int, enum tree_code, tree, tree *, vn_nary_op_t *); vn_nary_op_t vn_nary_op_insert (tree, tree); vn_nary_op_t <API key> (unsigned int, enum tree_code, tree, tree *, tree, unsigned int); bool <API key> (ao_ref *, alias_set_type, tree, vec<vn_reference_op_s> ); tree <API key> (tree, alias_set_type, tree, vec<vn_reference_op_s> , vn_reference_t *, vn_lookup_kind); tree vn_reference_lookup (tree, tree, vn_lookup_kind, vn_reference_t *); void <API key> (gcall *, vn_reference_t *, vn_reference_t); vn_reference_t <API key> (tree, alias_set_type, tree, vec<vn_reference_op_s> , tree, unsigned int); bool vn_nary_op_eq (const_vn_nary_op_t const vno1, const_vn_nary_op_t const vno2); bool vn_nary_may_trap (vn_nary_op_t); bool vn_reference_eq (<API key> const, <API key> const); unsigned int get_max_value_id (void); unsigned int get_next_value_id (void); unsigned int <API key> (tree); unsigned int <API key> (tree); bool value_id_constant_p (unsigned int); tree <API key> (vn_reference_t); /* Valueize NAME if it is an SSA name, otherwise just return it. */ static inline tree vn_valueize (tree name) { if (TREE_CODE (name) == SSA_NAME) { tree tem = VN_INFO (name)->valnum; return tem == VN_TOP ? name : tem; } return name; } #endif /* TREE_SSA_SCCVN_H */
/** @file * All the tables for the script compiler */ #ifndef <API key> #define <API key> #include "lib/script/event.h" // needed for _scr_user_types #include "lib/script/parse.h" // How many game ticks for one event tick #define SCR_TICKRATE 100 // The table of user types for the compiler extern TYPE_SYMBOL asTypeTable[]; // The table of script callable functions extern FUNC_SYMBOL asFuncTable[]; // The table of external variables extern VAR_SYMBOL asExternTable[]; // The table of object variables extern VAR_SYMBOL asObjTable[]; // The table of constant values extern CONST_SYMBOL asConstantTable[]; // Initialise the script system extern bool scrTabInitialise(void); // Shut down the script system extern void scrShutDown(void); #endif // <API key>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <HTML><HEAD><TITLE>Man page of HISTORY.CGI</TITLE> </HEAD><BODY> <H1>HISTORY.CGI</H1> Section: User Commands (1)<BR>Updated: Version Exp: 13 Dec 2011<BR><A HREF="#index">Index</A> <A HREF="../index.html">Return to Main Contents</A><HR> <A NAME="lbAB">&nbsp;</A> <H2>NAME</H2> history.cgi - CGI program to display service history <A NAME="lbAC">&nbsp;</A> <H2>SYNOPSIS</H2> <B>history.cgi</B> <P> <A NAME="lbAD">&nbsp;</A> <H2>DESCRIPTION</H2> <B>history.cgi</B> is invoked as a CGI script via the history.sh CGI wrapper. It is passed a QUERY_STRING environment variable with the following parameters: <P> <BR>&nbsp;&nbsp;&nbsp;HISTFILE&nbsp;(a&nbsp;Xymon&nbsp;service&nbsp;history&nbsp;file) <BR>&nbsp;&nbsp;&nbsp;ENTRIES&nbsp;(the&nbsp;number&nbsp;of&nbsp;entries&nbsp;to&nbsp;show) <BR>&nbsp; The following non-standard parameters are handled by the Xymon version of history.cgi: <P> <BR>&nbsp;&nbsp;&nbsp;IP&nbsp;(IP&nbsp;address&nbsp;of&nbsp;host&nbsp;-&nbsp;for&nbsp;display&nbsp;purposes&nbsp;only) <BR>&nbsp;&nbsp;&nbsp;PIXELS&nbsp;(width&nbsp;of&nbsp;colorbar&nbsp;when&nbsp;in&nbsp;pixel-mode) <BR>&nbsp;&nbsp;&nbsp;ENDTIME&nbsp;(when&nbsp;the&nbsp;colorbar&nbsp;begins,&nbsp;a&nbsp;time_t&nbsp;value) <BR>&nbsp;&nbsp;&nbsp;BARSUMS&nbsp;(which&nbsp;colorbars&nbsp;and&nbsp;summaries&nbsp;to&nbsp;show) <P> history.cgi analyses the service history file for changes that have occurred within the past 24 hours, and build a colorbar showing the status of the service over this period of time. A statistics summary is also produced, listing the amount of time for each status (green, yellow, red, purple, blue, clear). <P> Finally, a summary of the last N events is given, with links to the actual event logs. <P> Unlike the standard history.sh script, history.cgi provides a colorbar and statistics summaries also covering the past 1 week, 4 weeks and 1 year of data. Via links it is possible to browse the entire history of the service at the requested interval. <P> Note that since the resolution of the display is limited, events may be too short to show up on a colorbar; also, the exact placement of an event may not fully match up with the time-markers. <P> The graphs should correctly handle the display of months with different number of days, as well as the display of periods that involve beginning and end of Daylight Savings Time, if this occurs in your timezone. <P> All dates and times shown are in local time for the timezone defined on the Xymon server. <P> <P> <A NAME="lbAE">&nbsp;</A> <H2>PARAMETERS</H2> <DL COMPACT> <DT>HISTFILE<DD> Defines the host and service whose history is presented. <DT>ENTRIES<DD> The number of log-entries to show in the event log table. Default is 50; to view all log entries set this to &quot;ALL&quot;. <DT>IP<DD> The IP-address of the host. This is only used for the title of the document. <DT>PIXELS<DD> The width of the colorbar graph in pixels. If this is set to 0, a percentage-based graph will be shown, similar to the one provided by the standard history.sh script. Pixel-based graphs can have a higher resolution, but do not resize automatically to suit the size of a browser window. The default value for this parameter is defined at compile-time; 960 is a good value for displays with a 1024x768 resolution. <DT>BARSUMS<DD> Defines which colorbars and summaries to show. This is a number made up from a bitmask. The 1-day graph uses the value &quot;1&quot;; the 1-week graph uses the value &quot;2&quot;; the 4-week graph uses the value &quot;4&quot; and the 1-year graph the value &quot;8&quot;. To show multiple graph, add the values - e.g. &quot;6&quot; will show the 1-week and 4-weeks graphs, whereas &quot;15&quot; will show all the graphs. The default is defined at compile-time. <DT>ENDTIME<DD> The history display by default ends with the current time. Setting the ENDTIME parameter causes it to end at the time specified - this is given as a Unix &quot;time_t&quot; value, i.e. as the number of seconds elapsed since Jan 1 1970 00:00 UTC. <P> </DL> <A NAME="lbAF">&nbsp;</A> <H2>OPTIONS</H2> <DL COMPACT> <DT>--env=FILENAME<DD> Load the environment from FILENAME before executing the CGI. <P> </DL> <A NAME="lbAG">&nbsp;</A> <H2>SEE ALSO</H2> <A HREF="../man5/hosts.cfg.5.html">hosts.cfg</A>(5), <A HREF="../man5/xymonserver.cfg.5.html">xymonserver.cfg</A>(5) <P> <P> <HR> <A NAME="index">&nbsp;</A><H2>Index</H2> <DL> <DT><A HREF="#lbAB">NAME</A><DD> <DT><A HREF="#lbAC">SYNOPSIS</A><DD> <DT><A HREF="#lbAD">DESCRIPTION</A><DD> <DT><A HREF="#lbAE">PARAMETERS</A><DD> <DT><A HREF="#lbAF">OPTIONS</A><DD> <DT><A HREF="#lbAG">SEE ALSO</A><DD> </DL> <HR> This document was created by <A HREF="/cgi-bin/man/man2html">man2html</A>, using the manual pages.<BR> Time: 12:13:03 GMT, December 13, 2011 </BODY> </HTML>
#ifndef <API key> #define <API key> #include "os_aix.inline.hpp" #include "runtime/interfaceSupport.hpp" #include "thread_aix.inline.hpp" // Reconciliation History // mutex_solaris.inline.hpp 1.5 99/06/22 16:38:49 // End #endif // <API key>
#include <algorithm> #include <cmath> #ifdef PANDORA #include <stddef.h> #endif #include "base/display.h" #include "base/logging.h" #include "math/math_util.h" #include "gfx_es2/draw_buffer.h" #include "gfx_es2/glsl_program.h" #include "gfx_es2/gl_state.h" #include "gfx/texture_atlas.h" #include "gfx/gl_debug_log.h" #include "gfx/gl_common.h" #include "util/text/utf8.h" enum { // Enough? MAX_VERTS = 65536, }; // #define USE_VBO DrawBuffer::DrawBuffer() : count_(0), atlas(0) { verts_ = new Vertex[MAX_VERTS]; fontscalex = 1.0f; fontscaley = 1.0f; inited_ = false; } DrawBuffer::~DrawBuffer() { delete [] verts_; } void DrawBuffer::Init(bool registerAsHolder) { if (inited_) return; inited_ = true; glGenBuffers(1, (GLuint *)&vbo_); if (registerAsHolder) <API key>(this); } void DrawBuffer::Shutdown() { glDeleteBuffers(1, (GLuint *)&vbo_); vbo_ = 0; inited_ = false; <API key>(this); } void DrawBuffer::GLLost() { inited_ = false; Init(false); } void DrawBuffer::Begin(const GLSLProgram *program, DrawBufferMode dbmode) { Init(); program_ = program; count_ = 0; mode_ = dbmode; } void DrawBuffer::End() { // Currently does nothing, but call it! } void DrawBuffer::Flush(bool set_blend_state) { glsl_bind(program_); if (count_ == 0) return; #ifdef USE_VBO glBindBuffer(GL_ARRAY_BUFFER, vbo_); glBindBuffer(<API key>, 0); glBufferData(GL_ARRAY_BUFFER, sizeof(Vertex) * count_, verts_, GL_STREAM_DRAW); if (set_blend_state) { glstate.blend.enable(); glstate.blendFunc.set(GL_SRC_ALPHA, <API key>); } glUniform1i(program_->sampler0, 0); <API key>(program_->a_position); <API key>(program_->a_color); if (program_->a_texcoord0 != -1) <API key>(program_->a_texcoord0); GL_CHECK(); <API key>(program_->a_position, 3, GL_FLOAT, GL_FALSE, sizeof(Vertex), (void *)offsetof(Vertex, x)); <API key>(program_->a_color, 4, GL_UNSIGNED_BYTE, GL_TRUE, sizeof(Vertex), (void *)offsetof(Vertex, rgba)); if (program_->a_texcoord0 != -1) <API key>(program_->a_texcoord0, 2, GL_FLOAT, GL_FALSE, sizeof(Vertex), (void *)offsetof(Vertex, u)); glDrawArrays(mode_ == DBMODE_LINES ? GL_LINES : GL_TRIANGLES, 0, count_); GL_CHECK(); <API key>(program_->a_position); <API key>(program_->a_color); if (program_->a_texcoord0 != -1) <API key>(program_->a_texcoord0); GL_CHECK(); glBindBuffer(GL_ARRAY_BUFFER, 0); #else if (set_blend_state) { glstate.blend.enable(); glstate.blendFunc.set(GL_SRC_ALPHA, <API key>); } glBindBuffer(GL_ARRAY_BUFFER, 0); glUniform1i(program_->sampler0, 0); <API key>(program_->a_position); <API key>(program_->a_color); if (program_->a_texcoord0 != -1) <API key>(program_->a_texcoord0); GL_CHECK(); <API key>(program_->a_position, 3, GL_FLOAT, GL_FALSE, sizeof(Vertex), (void *)&verts_[0].x); <API key>(program_->a_color, 4, GL_UNSIGNED_BYTE, GL_TRUE, sizeof(Vertex), (void *)&verts_[0].rgba); if (program_->a_texcoord0 != -1) <API key>(program_->a_texcoord0, 2, GL_FLOAT, GL_FALSE, sizeof(Vertex), (void *)&verts_[0].u); glDrawArrays(mode_ == DBMODE_LINES ? GL_LINES : GL_TRIANGLES, 0, count_); GL_CHECK(); <API key>(program_->a_position); <API key>(program_->a_color); if (program_->a_texcoord0 != -1) <API key>(program_->a_texcoord0); GL_CHECK(); #endif count_ = 0; } void DrawBuffer::V(float x, float y, float z, uint32 color, float u, float v) { if (count_ >= MAX_VERTS) { FLOG("Overflowed the DrawBuffer"); return; } Vertex *vert = &verts_[count_++]; vert->x = x; vert->y = y; vert->z = z; vert->rgba = color; vert->u = u; vert->v = v; } void DrawBuffer::Rect(float x, float y, float w, float h, uint32 color, int align) { DoAlign(align, &x, &y, &w, &h); RectVGradient(x, y, w, h, color, color); } void DrawBuffer::RectVGradient(float x, float y, float w, float h, uint32 colorTop, uint32 colorBottom) { V(x, y, 0, colorTop, 0, 0); V(x + w, y, 0, colorTop, 1, 0); V(x + w, y + h, 0, colorBottom, 1, 1); V(x, y, 0, colorTop, 0, 0); V(x + w, y + h, 0, colorBottom, 1, 1); V(x, y + h, 0, colorBottom, 0, 1); } void DrawBuffer::MultiVGradient(float x, float y, float w, float h, GradientStop *stops, int numStops) { for (int i = 0; i < numStops - 1; i++) { float t0 = stops[i].t, t1 = stops[i+1].t; uint32_t c0 = stops[i].t, c1 = stops[i+1].t; RectVGradient(x, y + h * t0, w, h * (t1 - t0), c0, c1); } } void DrawBuffer::Rect(float x, float y, float w, float h, float u, float v, float uw, float uh, uint32 color) { V(x, y, 0, color, u, v); V(x + w, y, 0, color, u + uw, v); V(x + w, y + h, 0, color, u + uw, v + uh); V(x, y, 0, color, u, v); V(x + w, y + h, 0, color, u + uw, v + uh); V(x, y + h, 0, color, u, v + uh); } void DrawBuffer::MeasureImage(int atlas_image, float *w, float *h) { const AtlasImage &image = atlas->images[atlas_image]; *w = (float)image.w; *h = (float)image.h; } void DrawBuffer::DrawImage(int atlas_image, float x, float y, float scale, Color color, int align) { const AtlasImage &image = atlas->images[atlas_image]; float w = (float)image.w * scale; float h = (float)image.h * scale; if (align & ALIGN_HCENTER) x -= w / 2; if (align & ALIGN_RIGHT) x -= w; if (align & ALIGN_VCENTER) y -= h / 2; if (align & ALIGN_BOTTOM) y -= h; DrawImageStretch(atlas_image, x, y, x + w, y + h, color); } void DrawBuffer::DrawImageStretch(int atlas_image, float x1, float y1, float x2, float y2, Color color) { const AtlasImage &image = atlas->images[atlas_image]; V(x1, y1, color, image.u1, image.v1); V(x2, y1, color, image.u2, image.v1); V(x2, y2, color, image.u2, image.v2); V(x1, y1, color, image.u1, image.v1); V(x2, y2, color, image.u2, image.v2); V(x1, y2, color, image.u1, image.v2); } inline void rot(float *v, float angle, float xc, float yc) { v[0]-=xc; v[1]-=yc; float ca=cosf(angle),sa=sinf(angle); float t0 = v[0] * ca + v[1] * -sa; float t1 = v[0] * sa + v[1] * ca; v[0] = t0 + xc; v[1] = t1 + yc; } void DrawBuffer::DrawImageRotated(int atlas_image, float x, float y, float scale, float angle, Color color, bool mirror_h) { const AtlasImage &image = atlas->images[atlas_image]; float w = (float)image.w * scale; float h = (float)image.h * scale; float x1 = x - w / 2; float x2 = x + w / 2; float y1 = y - h / 2; float y2 = y + h / 2; float v[6][2] = { {x1, y1}, {x2, y1}, {x2, y2}, {x1, y1}, {x2, y2}, {x1, y2}, }; float u1 = image.u1; float u2 = image.u2; if (mirror_h) { float temp = u1; u1 = u2; u2 = temp; } const float uv[6][2] = { {u1, image.v1}, {u2, image.v1}, {u2, image.v2}, {u1, image.v1}, {u2, image.v2}, {u1, image.v2}, }; for (int i = 0; i < 6; i++) { rot(v[i], angle, x, y); V(v[i][0], v[i][1], 0, color, uv[i][0], uv[i][1]); } } // TODO: add arc support void DrawBuffer::Circle(float xc, float yc, float radius, float thickness, int segments, float startAngle, uint32 color, float u_mul) { float angleDelta = PI * 2 / segments; float uDelta = 1.0f / segments; float t2 = thickness / 2.0f; float r1 = radius + t2; float r2 = radius - t2; for (int i = 0; i < segments + 1; i++) { float angle1 = i * angleDelta; float angle2 = (i + 1) * angleDelta; float u1 = u_mul * i * uDelta; float u2 = u_mul * (i + 1) * uDelta; // TODO: get rid of one pair of cos/sin per loop, can reuse from last iteration float c1 = cosf(angle1), s1 = sinf(angle1), c2 = cosf(angle2), s2 = sinf(angle2); const float x[4] = {c1 * r1 + xc, c2 * r1 + xc, c1 * r2 + xc, c2 * r2 + xc}; const float y[4] = {s1 * r1 + yc, s2 * r1 + yc, s1 * r2 + yc, s2 * r2 + yc}; V(x[0], y[0], color, u1, 0); V(x[1], y[1], color, u2, 0); V(x[2], y[2], color, u1, 1); V(x[1], y[1], color, u2, 0); V(x[3], y[3], color, u2, 1); V(x[2], y[2], color, u1, 1); } } void DrawBuffer::DrawTexRect(float x1, float y1, float x2, float y2, float u1, float v1, float u2, float v2, Color color) { V(x1, y1, color, u1, v1); V(x2, y1, color, u2, v1); V(x2, y2, color, u2, v2); V(x1, y1, color, u1, v1); V(x2, y2, color, u2, v2); V(x1, y2, color, u1, v2); } void DrawBuffer::DrawImage4Grid(int atlas_image, float x1, float y1, float x2, float y2, Color color, float corner_scale) { const AtlasImage &image = atlas->images[atlas_image]; float u1 = image.u1, v1 = image.v1, u2 = image.u2, v2 = image.v2; float um = (u2 + u1) * 0.5f; float vm = (v2 + v1) * 0.5f; float iw2 = (image.w * 0.5f) * corner_scale; float ih2 = (image.h * 0.5f) * corner_scale; float xa = x1 + iw2; float xb = x2 - iw2; float ya = y1 + ih2; float yb = y2 - ih2; // Top row DrawTexRect(x1, y1, xa, ya, u1, v1, um, vm, color); DrawTexRect(xa, y1, xb, ya, um, v1, um, vm, color); DrawTexRect(xb, y1, x2, ya, um, v1, u2, vm, color); // Middle row DrawTexRect(x1, ya, xa, yb, u1, vm, um, vm, color); DrawTexRect(xa, ya, xb, yb, um, vm, um, vm, color); DrawTexRect(xb, ya, x2, yb, um, vm, u2, vm, color); // Bottom row DrawTexRect(x1, yb, xa, y2, u1, vm, um, v2, color); DrawTexRect(xa, yb, xb, y2, um, vm, um, v2, color); DrawTexRect(xb, yb, x2, y2, um, vm, u2, v2, color); } void DrawBuffer::DrawImage2GridH(int atlas_image, float x1, float y1, float x2, Color color, float corner_scale) { const AtlasImage &image = atlas->images[atlas_image]; float um = (image.u1 + image.u2) * 0.5f; float iw2 = (image.w * 0.5f) * corner_scale; float xa = x1 + iw2; float xb = x2 - iw2; float u1 = image.u1, v1 = image.v1, u2 = image.u2, v2 = image.v2; float y2 = y1 + image.h; DrawTexRect(x1, y1, xa, y2, u1, v1, um, v2, color); DrawTexRect(xa, y1, xb, y2, um, v1, um, v2, color); DrawTexRect(xb, y1, x2, y2, um, v1, u2, v2, color); } void DrawBuffer::MeasureText(int font, const char *text, float *w, float *h) { const AtlasFont &atlasfont = *atlas->fonts[font]; unsigned int cval; float wacc = 0; float maxX = 0.0f; int lines = 1; UTF8 utf(text); while (true) { if (utf.end()) break; cval = utf.next(); if (cval == '\n') { maxX = std::max(maxX, wacc); wacc = 0; lines++; continue; } const AtlasChar *c = atlasfont.getChar(cval); if (c) { wacc += c->wx * fontscalex; } } if (w) *w = std::max(wacc, maxX); if (h) *h = atlasfont.height * fontscaley * lines; } void DrawBuffer::DrawTextShadow(int font, const char *text, float x, float y, Color color, int flags) { uint32_t alpha = (color >> 1) & 0xFF000000; DrawText(font, text, x + 2, y + 2, alpha, flags); DrawText(font, text, x, y, color, flags); } void DrawBuffer::DoAlign(int flags, float *x, float *y, float *w, float *h) { if (flags & ALIGN_HCENTER) *x -= *w / 2; if (flags & ALIGN_RIGHT) *x -= *w; if (flags & ALIGN_VCENTER) *y -= *h / 2; if (flags & ALIGN_BOTTOM) *y -= *h; if (flags & (ROTATE_90DEG_LEFT | ROTATE_90DEG_RIGHT)) { std::swap(*w, *h); std::swap(*x, *y); } } // TODO: Unicode support. void DrawBuffer::DrawTextRect(int font, const char *text, float x, float y, float w, float h, Color color, int align) { if (align & ALIGN_HCENTER) { x += w / 2; } else if (align & ALIGN_RIGHT) { x += w; } if (align & ALIGN_VCENTER) { y += h / 2; } else if (align & ALIGN_BOTTOM) { y += h; } DrawText(font, text, x, y, color, align); } // ROTATE_* doesn't yet work right. void DrawBuffer::DrawText(int font, const char *text, float x, float y, Color color, int align) { const AtlasFont &atlasfont = *atlas->fonts[font]; unsigned int cval; float w, h; MeasureText(font, text, &w, &h); if (align) { DoAlign(align, &x, &y, &w, &h); } if (align & ROTATE_90DEG_LEFT) { x -= atlasfont.ascend*fontscaley; // y += h; } else y += atlasfont.ascend*fontscaley; float sx = x; UTF8 utf(text); while (true) { if (utf.end()) break; cval = utf.next(); if (cval == '\n') { y += atlasfont.height * fontscaley; x = sx; continue; } const AtlasChar *ch = atlasfont.getChar(cval); if (!ch) ch = atlasfont.getChar('?'); if (ch) { const AtlasChar &c = *ch; float cx1, cy1, cx2, cy2; if (align & ROTATE_90DEG_LEFT) { cy1 = y - c.ox * fontscalex; cx1 = x + c.oy * fontscaley; cy2 = y - (c.ox + c.pw) * fontscalex; cx2 = x + (c.oy + c.ph) * fontscaley; } else { cx1 = x + c.ox * fontscalex; cy1 = y + c.oy * fontscaley; cx2 = x + (c.ox + c.pw) * fontscalex; cy2 = y + (c.oy + c.ph) * fontscaley; } V(cx1, cy1, color, c.sx, c.sy); V(cx2, cy1, color, c.ex, c.sy); V(cx2, cy2, color, c.ex, c.ey); V(cx1, cy1, color, c.sx, c.sy); V(cx2, cy2, color, c.ex, c.ey); V(cx1, cy2, color, c.sx, c.ey); if (align & ROTATE_90DEG_LEFT) y -= c.wx * fontscalex; else x += c.wx * fontscalex; } } } void DrawBuffer::EnableBlend(bool enable) { glstate.blend.set(enable); glstate.blendFunc.set(GL_SRC_ALPHA, <API key>); } void DrawBuffer::SetClipRect(float x, float y, float w, float h) { // Sigh, OpenGL is upside down. glstate.scissorRect.set(x, dp_yres - y, w, h); glstate.scissorTest.enable(); } void DrawBuffer::NoClip() { glstate.scissorTest.disable(); }
#define pr_fmt(fmt) "nvmap: %s() " fmt, __func__ #include <linux/fdtable.h> #include <linux/list.h> #include <linux/slab.h> #include <linux/uaccess.h> #include <linux/export.h> #include <linux/nvmap.h> #include <linux/dma-buf.h> #include <linux/spinlock.h> #include <linux/mutex.h> #include <linux/atomic.h> #include <linux/debugfs.h> #include <linux/seq_file.h> #include <linux/stringify.h> #include <trace/events/nvmap.h> #include "nvmap_priv.h" #include "nvmap_ioctl.h" #ifdef CONFIG_IOMMU_API #define nvmap_masid_mapping(attach) <API key>((attach)->dev) #else #define nvmap_masid_mapping(attach) NULL #endif struct nvmap_handle_info { struct nvmap_handle *handle; struct list_head maps; struct mutex maps_lock; }; /** * List node for maps of nvmap handles via the dma_buf API. These store the * necessary info for stashing mappings. * * @mapping Mapping for which this SGT is valid - for supporting multi-asid. * @dir DMA direction. * @sgt The scatter gather table to stash. * @refs Reference counting. * @maps_entry Entry on a given attachment's list of maps. * @stash_entry Entry on the stash list. * @owner The owner of this struct. There can be only one. */ struct nvmap_handle_sgt { struct dma_iommu_mapping *mapping; enum dma_data_direction dir; struct sg_table *sgt; struct device *dev; atomic_t refs; struct list_head maps_entry; struct list_head stash_entry; /* lock the stash before accessing. */ struct nvmap_handle_info *owner; } <API key>; static DEFINE_MUTEX(<API key>); static LIST_HEAD(nvmap_stashed_maps); static struct kmem_cache *handle_sgt_cache; static struct dma_buf_ops nvmap_dma_buf_ops; /* * Initialize a kmem cache for allocating nvmap_handle_sgt's. */ int <API key>(void) { handle_sgt_cache = KMEM_CACHE(nvmap_handle_sgt, 0); if (IS_ERR_OR_NULL(handle_sgt_cache)) { pr_err("Failed to make kmem cache for nvmap_handle_sgt.\n"); return -ENOMEM; } return 0; } #ifdef <API key> struct nvmap_stash_stats { unsigned long long hits; unsigned long long all_hits; unsigned long long misses; unsigned long long evictions; unsigned long long stashed_iova; unsigned long long stashed_maps; }; static DEFINE_SPINLOCK(nvmap_stat_lock); static struct nvmap_stash_stats nvmap_stash_stats; #define stash_stat_inc(var) \ do { \ spin_lock(&nvmap_stat_lock); \ nvmap_stash_stats.var += 1; \ spin_unlock(&nvmap_stat_lock); \ } while (0) #define stash_stat_dec(var) \ do { \ spin_lock(&nvmap_stat_lock); \ nvmap_stash_stats.var -= 1; \ spin_unlock(&nvmap_stat_lock); \ } while (0) #define stash_stat_add_iova(handle) \ do { \ spin_lock(&nvmap_stat_lock); \ nvmap_stash_stats.stashed_iova += (handle)->size; \ spin_unlock(&nvmap_stat_lock); \ } while (0) #define stash_stat_sub_iova(handle) \ do { \ spin_lock(&nvmap_stat_lock); \ nvmap_stash_stats.stashed_iova -= (handle)->size; \ spin_unlock(&nvmap_stat_lock); \ } while (0) #else #define stash_stat_inc(var) #define stash_stat_dec(var) #define stash_stat_add_iova(handle) #define stash_stat_sub_iova(handle) #endif static int nvmap_dmabuf_attach(struct dma_buf *dmabuf, struct device *dev, struct dma_buf_attachment *attach) { struct nvmap_handle_info *info = dmabuf->priv; <API key>(dmabuf, dev); dev_dbg(dev, "%s() 0x%p\n", __func__, info->handle); return 0; } static void nvmap_dmabuf_detach(struct dma_buf *dmabuf, struct dma_buf_attachment *attach) { struct nvmap_handle_info *info = dmabuf->priv; <API key>(dmabuf, attach->dev); dev_dbg(attach->dev, "%s() 0x%p\n", __func__, info->handle); } /* * Add this sgt to the stash - should be called when the SGT's ref count hits * 0. */ static void <API key>(struct nvmap_handle_sgt *nvmap_sgt) { pr_debug("Adding mapping to stash.\n"); mutex_lock(&<API key>); list_add(&nvmap_sgt->stash_entry, &nvmap_stashed_maps); mutex_unlock(&<API key>); stash_stat_inc(stashed_maps); stash_stat_add_iova(nvmap_sgt->owner->handle); } /* * Make sure this mapping is no longer stashed - this corresponds to a "hit". If * the mapping is not stashed this is just a no-op. */ static void <API key>(struct nvmap_handle_sgt *nvmap_sgt) { mutex_lock(&<API key>); if (list_empty(&nvmap_sgt->stash_entry)) { mutex_unlock(&<API key>); return; } pr_debug("Removing map from stash.\n"); list_del_init(&nvmap_sgt->stash_entry); mutex_unlock(&<API key>); stash_stat_inc(hits); stash_stat_dec(stashed_maps); stash_stat_sub_iova(nvmap_sgt->owner->handle); } /* * Free an sgt completely. This will bypass the ref count. This also requires * the nvmap_sgt's owner's lock is already taken. */ static void <API key>(struct nvmap_handle_sgt *nvmap_sgt) { struct nvmap_handle_info *info = nvmap_sgt->owner; DEFINE_DMA_ATTRS(attrs); list_del(&nvmap_sgt->maps_entry); if (info->handle->heap_pgalloc) { dma_set_attr(<API key>, &attrs); dma_set_attr(<API key>, &attrs); dma_unmap_sg_attrs(nvmap_sgt->dev, nvmap_sgt->sgt->sgl, nvmap_sgt->sgt->nents, nvmap_sgt->dir, &attrs); } <API key>(NULL, info->handle, nvmap_sgt->sgt); WARN(atomic_read(&nvmap_sgt->refs), "nvmap: Freeing reffed SGT!"); kmem_cache_free(handle_sgt_cache, nvmap_sgt); } /* * Evict an entry from the IOVA stash. This does not do anything to the actual * mapping itself - this merely takes the passed nvmap_sgt out of the stash * and decrements the necessary cache stats. */ void <API key>(struct nvmap_handle_sgt *nvmap_sgt) { if (!list_empty(&nvmap_sgt->stash_entry)) list_del_init(&nvmap_sgt->stash_entry); stash_stat_dec(stashed_maps); stash_stat_sub_iova(nvmap_sgt->owner->handle); } /* * Locks the stash before doing the eviction. */ void <API key>(struct nvmap_handle_sgt *nvmap_sgt) { mutex_lock(&<API key>); <API key>(nvmap_sgt); mutex_unlock(&<API key>); } /* * Prepare an SGT for potential stashing later on. */ static int <API key>(struct dma_buf_attachment *attach, enum dma_data_direction dir, struct sg_table *sgt) { struct nvmap_handle_sgt *nvmap_sgt; struct nvmap_handle_info *info = attach->dmabuf->priv; pr_debug("Prepping SGT.\n"); nvmap_sgt = kmem_cache_alloc(handle_sgt_cache, GFP_KERNEL); if (IS_ERR_OR_NULL(nvmap_sgt)) { pr_err("Prepping SGT failed.\n"); return -ENOMEM; } nvmap_sgt->mapping = nvmap_masid_mapping(attach); nvmap_sgt->dir = dir; nvmap_sgt->sgt = sgt; nvmap_sgt->dev = attach->dev; nvmap_sgt->owner = info; INIT_LIST_HEAD(&nvmap_sgt->stash_entry); atomic_set(&nvmap_sgt->refs, 1); list_add(&nvmap_sgt->maps_entry, &info->maps); return 0; } /* * Called when an SGT is no longer being used by a device. This will not * necessarily free the SGT - instead it may stash the SGT. */ static void <API key>(struct dma_buf_attachment *attach, enum dma_data_direction dir, struct sg_table *sgt) { struct nvmap_handle_sgt *nvmap_sgt; struct nvmap_handle_info *info = attach->dmabuf->priv; pr_debug("Stashing SGT - if necessary.\n"); list_for_each_entry(nvmap_sgt, &info->maps, maps_entry) { if (nvmap_sgt->sgt == sgt) { if (!atomic_sub_and_test(1, &nvmap_sgt->refs)) goto done; /* * If we get here, the ref count is zero. Stash the * mapping. */ #ifdef <API key> <API key>(nvmap_sgt); #else <API key>(nvmap_sgt); #endif goto done; } } done: return; } /* * Checks if there is already a map for this attachment. If so increment the * ref count on said map and return the associated sg_table. Otherwise return * NULL. * * If it turns out there is a map, this also checks to see if the map needs to * be removed from the stash - if so, the map is removed. */ static struct sg_table *<API key>( struct dma_buf_attachment *attach, enum dma_data_direction dir) { struct nvmap_handle_sgt *nvmap_sgt; struct sg_table *sgt = NULL; struct nvmap_handle_info *info = attach->dmabuf->priv; pr_debug("Getting SGT from stash.\n"); list_for_each_entry(nvmap_sgt, &info->maps, maps_entry) { if (nvmap_masid_mapping(attach) != nvmap_sgt->mapping) continue; /* We have a hit. */ pr_debug("Stash hit (%s)!\n", dev_name(attach->dev)); sgt = nvmap_sgt->sgt; atomic_inc(&nvmap_sgt->refs); <API key>(nvmap_sgt); stash_stat_inc(all_hits); break; } if (!sgt) stash_stat_inc(misses); return sgt; } /* * If stashing is disabled then the stash related ops become no-ops. */ static struct sg_table *<API key>( struct dma_buf_attachment *attach, enum dma_data_direction dir) { struct nvmap_handle_info *info = attach->dmabuf->priv; int err, ents; struct sg_table *sgt; DEFINE_DMA_ATTRS(attrs); <API key>(attach->dmabuf, attach->dev); mutex_lock(&info->maps_lock); atomic_inc(&info->handle->pin); sgt = <API key>(attach, dir); if (sgt) goto cache_hit; sgt = __nvmap_sg_table(NULL, info->handle); if (IS_ERR(sgt)) { atomic_dec(&info->handle->pin); mutex_unlock(&info->maps_lock); return sgt; } if (info->handle->heap_pgalloc && info->handle->alloc) { dma_set_attr(<API key>, &attrs); dma_set_attr(<API key>, &attrs); ents = dma_map_sg_attrs(attach->dev, sgt->sgl, sgt->nents, dir, &attrs); if (ents <= 0) { err = -ENOMEM; goto err_map; } BUG_ON(ents != 1); } else if (!info->handle->alloc) { goto err_map; } if (<API key>(attach, dir, sgt)) { WARN(1, "No mem to prep sgt.\n"); err = -ENOMEM; goto err_prep; } cache_hit: #ifdef <API key> BUG_ON(attach->priv && attach->priv != sgt); #endif attach->priv = sgt; mutex_unlock(&info->maps_lock); return sgt; err_prep: dma_unmap_sg_attrs(attach->dev, sgt->sgl, sgt->nents, dir, &attrs); err_map: <API key>(NULL, info->handle, sgt); atomic_dec(&info->handle->pin); mutex_unlock(&info->maps_lock); return ERR_PTR(err); } static void <API key>(struct dma_buf_attachment *attach, struct sg_table *sgt, enum dma_data_direction dir) { struct nvmap_handle_info *info = attach->dmabuf->priv; <API key>(attach->dmabuf, attach->dev); mutex_lock(&info->maps_lock); if (!atomic_add_unless(&info->handle->pin, -1, 0)) { mutex_unlock(&info->maps_lock); WARN(1, "Unpinning handle that has yet to be pinned!\n"); return; } <API key>(attach, dir, sgt); mutex_unlock(&info->maps_lock); } static void <API key>(struct dma_buf *dmabuf) { struct nvmap_handle_info *info = dmabuf->priv; struct nvmap_handle_sgt *nvmap_sgt; <API key>(info->handle->owner ? info->handle->owner->name : "unknown", info->handle, dmabuf); mutex_lock(&info->maps_lock); while (!list_empty(&info->maps)) { nvmap_sgt = list_first_entry(&info->maps, struct nvmap_handle_sgt, maps_entry); <API key>(nvmap_sgt); <API key>(nvmap_sgt); } mutex_unlock(&info->maps_lock); dma_buf_detach(info->handle->dmabuf, info->handle->attachment); info->handle->dmabuf = NULL; nvmap_handle_put(info->handle); kfree(info); } static int <API key>(struct dma_buf *dmabuf, size_t start, size_t len, enum dma_data_direction dir) { struct nvmap_handle_info *info = dmabuf->priv; <API key>(dmabuf, start, len); return <API key>(NULL, info->handle, start, start + len, <API key>, false); } static void <API key>(struct dma_buf *dmabuf, size_t start, size_t len, enum dma_data_direction dir) { struct nvmap_handle_info *info = dmabuf->priv; <API key>(dmabuf, start, len); <API key>(NULL, info->handle, start, start + len, NVMAP_CACHE_OP_WB, false); } static void *nvmap_dmabuf_kmap(struct dma_buf *dmabuf, unsigned long page_num) { struct nvmap_handle_info *info = dmabuf->priv; <API key>(dmabuf); return __nvmap_kmap(info->handle, page_num); } static void nvmap_dmabuf_kunmap(struct dma_buf *dmabuf, unsigned long page_num, void *addr) { struct nvmap_handle_info *info = dmabuf->priv; <API key>(dmabuf); __nvmap_kunmap(info->handle, page_num, addr); } static void *<API key>(struct dma_buf *dmabuf, unsigned long page_num) { WARN(1, "%s() can't be called from atomic\n", __func__); return NULL; } static int nvmap_dmabuf_mmap(struct dma_buf *dmabuf, struct vm_area_struct *vma) { struct nvmap_handle_info *info = dmabuf->priv; <API key>(dmabuf); return __nvmap_map(info->handle, vma); } static void *nvmap_dmabuf_vmap(struct dma_buf *dmabuf) { struct nvmap_handle_info *info = dmabuf->priv; <API key>(dmabuf); return __nvmap_mmap(info->handle); } static void nvmap_dmabuf_vunmap(struct dma_buf *dmabuf, void *vaddr) { struct nvmap_handle_info *info = dmabuf->priv; <API key>(dmabuf); __nvmap_munmap(info->handle, vaddr); } static int <API key>(struct dma_buf *dmabuf, struct device *dev, void *priv, void (*delete)(void *priv)) { struct nvmap_handle_info *info; info = dmabuf->priv; info->handle->nvhost_priv = priv; info->handle->nvhost_priv_delete = delete; return 0; } static void *<API key>(struct dma_buf *dmabuf, struct device *dev) { void *priv; struct nvmap_handle_info *info; info = dmabuf->priv; priv = info->handle->nvhost_priv; return priv; } static struct dma_buf_ops nvmap_dma_buf_ops = { .attach = nvmap_dmabuf_attach, .detach = nvmap_dmabuf_detach, .map_dma_buf = <API key>, .unmap_dma_buf = <API key>, .release = <API key>, .begin_cpu_access = <API key>, .end_cpu_access = <API key>, .kmap_atomic = <API key>, .kmap = nvmap_dmabuf_kmap, .kunmap = nvmap_dmabuf_kunmap, .mmap = nvmap_dmabuf_mmap, .vmap = nvmap_dmabuf_vmap, .vunmap = nvmap_dmabuf_vunmap, .set_drvdata = <API key>, .get_drvdata = <API key>, }; /* * Make a dmabuf object for an nvmap handle. */ struct dma_buf *__nvmap_make_dmabuf(struct nvmap_client *client, struct nvmap_handle *handle) { int err; struct dma_buf *dmabuf; struct nvmap_handle_info *info; info = kzalloc(sizeof(*info), GFP_KERNEL); if (!info) { err = -ENOMEM; goto err_nomem; } info->handle = handle; INIT_LIST_HEAD(&info->maps); mutex_init(&info->maps_lock); dmabuf = dma_buf_export(info, &nvmap_dma_buf_ops, handle->size, O_RDWR); if (IS_ERR(dmabuf)) { err = PTR_ERR(dmabuf); goto err_export; } nvmap_handle_get(handle); <API key>(client->name, handle, dmabuf); return dmabuf; err_export: kfree(info); err_nomem: return ERR_PTR(err); } int __nvmap_dmabuf_fd(struct dma_buf *dmabuf, int flags) { int fd; if (!dmabuf || !dmabuf->file) return -EINVAL; /* Allocate fd from 1024 onwards to overcome * __FD_SETSIZE limitation issue for select(), * pselect() syscalls. */ fd = __alloc_fd(current->files, 1024, sysctl_nr_open, flags); if (fd < 0) return fd; fd_install(fd, dmabuf->file); return fd; } int nvmap_get_dmabuf_fd(struct nvmap_client *client, struct nvmap_handle *h) { int fd; struct dma_buf *dmabuf; dmabuf = <API key>(client, h); if (IS_ERR(dmabuf)) return PTR_ERR(dmabuf); fd = __nvmap_dmabuf_fd(dmabuf, O_CLOEXEC); if (fd < 0) goto err_out; return fd; err_out: dma_buf_put(dmabuf); return fd; } struct dma_buf *<API key>(struct nvmap_client *client, struct nvmap_handle *handle) { struct dma_buf *buf; handle = nvmap_handle_get(handle); if (!handle) return ERR_PTR(-EINVAL); buf = handle->dmabuf; if (WARN(!buf, "Attempting to get a freed dma_buf!\n")) { nvmap_handle_put(handle); return NULL; } get_dma_buf(buf); /* * Don't want to take out refs on the handle here. */ nvmap_handle_put(handle); return handle->dmabuf; } EXPORT_SYMBOL(<API key>); /* * You must dma_buf_put() the dma_buf object when you are done with * it. */ struct dma_buf *<API key>(struct nvmap_handle_ref *ref) { if (!virt_addr_valid(ref)) return ERR_PTR(-EINVAL); get_dma_buf(ref->handle->dmabuf); return ref->handle->dmabuf; } /* * Returns the nvmap handle ID associated with the passed dma_buf's fd. This * does not affect the ref count of the dma_buf. */ struct nvmap_handle *<API key>(struct nvmap_client *client, int fd) { struct nvmap_handle *handle = ERR_PTR(-EINVAL); struct dma_buf *dmabuf; struct nvmap_handle_info *info; dmabuf = dma_buf_get(fd); if (IS_ERR(dmabuf)) return ERR_CAST(dmabuf); if (dmabuf->ops == &nvmap_dma_buf_ops) { info = dmabuf->priv; handle = info->handle; } dma_buf_put(dmabuf); return handle; } int <API key>(struct file *filp, void __user *arg) { struct nvmap_create_handle op; struct nvmap_client *client = filp->private_data; struct nvmap_handle *handle; BUG_ON(!client); if (copy_from_user(&op, (void __user *)arg, sizeof(op))) return -EFAULT; handle = unmarshal_user_id(op.id); if (!handle) return -EINVAL; op.fd = nvmap_get_dmabuf_fd(client, handle); if (op.fd < 0) return op.fd; if (copy_to_user((void __user *)arg, &op, sizeof(op))) { sys_close(op.fd); return -EFAULT; } return 0; } int <API key>(struct dma_buf *dmabuf, u32 param, u64 *result) { struct nvmap_handle_info *info; if (dmabuf->ops != &nvmap_dma_buf_ops) return -EINVAL; if (WARN_ON(!virt_addr_valid(dmabuf))) return -EINVAL; info = dmabuf->priv; return <API key>(NULL, info->handle, param, result); } struct sg_table *<API key>(struct dma_buf *dmabuf) { struct nvmap_handle_info *info; if (WARN_ON(!virt_addr_valid(dmabuf))) return ERR_PTR(-EINVAL); info = dmabuf->priv; return __nvmap_sg_table(NULL, info->handle); } void <API key>(struct dma_buf *dmabuf, struct sg_table *sgt) { if (WARN_ON(!virt_addr_valid(sgt))) return; <API key>(NULL, NULL, sgt); } /* * List detailed info for all buffers allocated. */ static int <API key>(struct seq_file *s, void *data) { struct nvmap_handle_sgt *nvmap_sgt; struct nvmap_handle *handle; struct nvmap_client *client; const char *name; phys_addr_t addr; mutex_lock(&<API key>); list_for_each_entry(nvmap_sgt, &nvmap_stashed_maps, stash_entry) { handle = nvmap_sgt->owner->handle; client = nvmap_client_get(handle->owner); name = "unknown"; if (client) { if (strcmp(client->name, "user") == 0) name = client->task->comm; else name = client->name; } seq_printf(s, "%s: ", name); seq_printf(s, " flags = 0x%08lx, refs = %d\n", handle->flags, atomic_read(&handle->ref)); seq_printf(s, " device = %s\n", dev_name(handle->attachment->dev)); addr = sg_dma_address(nvmap_sgt->sgt->sgl); seq_printf(s, " IO addr = 0x%pa + 0x%zx\n", &addr, handle->size); /* Cleanup. */ nvmap_client_put(client); } mutex_unlock(&<API key>); return 0; } static int <API key>(struct inode *inode, struct file *file) { return single_open(file, <API key>, NULL); } static const struct file_operations <API key> = { .open = <API key>, .read = seq_read, .llseek = seq_lseek, .release = single_release, }; #define <API key>(trigger, name) \ <API key>(__nvmap_dmabuf_##name##_fops, NULL, \ trigger, "%llu"); #define <API key>(name, root) \ do { \ if (!debugfs_create_file(__stringify(name), S_IWUSR, root, \ NULL, &__nvmap_dmabuf_##name##_fops))\ return; \ } while (0) #ifdef <API key> /* * Clear the stash stats counting. */ static int <API key>(void *data, u64 val) { spin_lock(&nvmap_stat_lock); nvmap_stash_stats.hits = 0; nvmap_stash_stats.all_hits = 0; nvmap_stash_stats.misses = 0; nvmap_stash_stats.evictions = 0; spin_unlock(&nvmap_stat_lock); return 0; } <API key>(<API key>, clear_stats); #endif void <API key>(struct dentry *nvmap_root) { struct dentry *dmabuf_root; if (!nvmap_root) return; dmabuf_root = debugfs_create_dir("dmabuf", nvmap_root); if (!dmabuf_root) return; #if defined(<API key>) #define CACHE_STAT(root, stat) \ do { \ if (!debugfs_create_u64(__stringify(stat), S_IRUGO, \ root, &nvmap_stash_stats.stat)) \ return; \ } while (0) CACHE_STAT(dmabuf_root, hits); CACHE_STAT(dmabuf_root, all_hits); CACHE_STAT(dmabuf_root, misses); CACHE_STAT(dmabuf_root, evictions); CACHE_STAT(dmabuf_root, stashed_iova); CACHE_STAT(dmabuf_root, stashed_maps); <API key>(clear_stats, dmabuf_root); #endif #define DMABUF_INFO_FILE(root, file) \ do { \ if (!debugfs_create_file(__stringify(file), S_IRUGO, \ root, NULL, \ &nvmap_dmabuf_##file##_fops)) \ return; \ } while (0) DMABUF_INFO_FILE(dmabuf_root, stashes); }
<?php /* * * receive_data.php * */ header("Content-type:text/html;charset=utf8"); require '../../../wp-load.php'; require '../../../wp-admin/includes/admin.php'; do_action('admin_init'); $active_plugins = get_option('active_plugins'); $active_list = array_values($active_plugins); $uyan_actived = ''; foreach ($active_list as $val) { if (strstr($val, '<API key>')) { $uyan_actived = 'active'; } } if (!$uyan_actived) { echo 1; exit; } $_POST = json_decode(stripslashes($_POST['data']), true); $uyan_sync_token = empty($_POST['token']) ? '' : $_POST['token']; $wp_token = get_option('uyan_sync_token'); if (!$uyan_sync_token) { echo 2; exit; } if (!$wp_token) { echo 3; exit; } if ($uyan_sync_token != $wp_token) { echo 4; exit; } require dirname(__FILE__) . '/uyan_func.php'; // WPID $post_id = get_postid($_POST['su']); // wordpress $post_exists = $wpdb->get_var($wpdb->prepare("SELECT comment_count FROM $wpdb->posts WHERE ID = %d LIMIT 1", $post_id)); if ($post_exists === null) { echo 5; exit; } // wordpress $comments_exists = $wpdb->get_var($wpdb->prepare("SELECT COUNT(comment_ID) AS cnt FROM $wpdb->comments WHERE comment_post_ID = %d AND comment_date = %s AND comment_content = %s", $post_id, $_POST['time'], $_POST['cnt'])); if ($comments_exists) { echo 6; exit; } $author = array(); $status = 0; // URL, if ($_POST['status'] == 0) { // wordpress WP0 $status = 1; } elseif ($_POST['status'] == 1) { $status = 0; } elseif ($_POST['status'] == 2) { $status = 'spam'; } elseif ($_POST['status'] == 3) { $status = 'trash'; } $comment_fields = array( 'comment_post_ID' => $post_id, 'comment_date' => $_POST['time'], 'comment_date_gmt' => $_POST['time'], 'comment_content' => $_POST['cnt'], 'comment_agent' => 'YouYan Social Comment System', 'comment_approved' => $status, 'comment_author' => $_POST['uname'], '<API key>' => $_POST['email'], 'comment_author_url' => $_POST['ulink'], 'comment_author_IP' => $_POST['ip'], 'comment_parent' => $_POST['pid'] ? $_POST['pid'] : 0 ); $wpdb->insert($wpdb->prefix . "comments", $comment_fields); $post_exists += 1; $sql = "UPDATE $wpdb->posts SET comment_count=$post_exists WHERE ID = $post_id"; $wpdb->query($sql); echo json_encode(array('cid'=>$wpdb->insert_id, 'pid'=> $_POST['pid'])); ?>
#ifndef HASH_H #define HASH_H #include <limits.h> #ifdef <API key> #include "sfx.h" #endif /* * Blurb for inclusion into C++ translation units */ #ifdef __cplusplus extern "C" { #endif typedef unsigned long hashcount_t; #define HASHCOUNT_T_MAX ULONG_MAX typedef unsigned long hash_val_t; #define HASH_VAL_T_MAX ULONG_MAX extern int hash_val_t_bit; #ifndef HASH_VAL_T_BIT #define HASH_VAL_T_BIT ((int) hash_val_t_bit) #endif /* * Hash chain node structure. * Notes: * 1. This preprocessing directive is for debugging purposes. The effect is * that if the preprocessor symbol KAZLIB_OPAQUE_DEBUG is defined prior to the * inclusion of this header, then the structure shall be declared as having * the single member int __OPAQUE__. This way, any attempts by the * client code to violate the principles of information hiding (by accessing * the structure directly) can be diagnosed at translation time. However, * note the resulting compiled unit is not suitable for linking. * 2. This is a pointer to the next node in the chain. In the last node of a * chain, this pointer is null. * 3. This is a back-pointer to the primary pointer to this node. The primary * pointer is the previous node's next pointer to this node. If there is no * previous node, the primary pointer is the pointer that resides in the * hash table. This back-pointer lets us handle deletions easily without * searching the chain. * 4. The key is a pointer to some user supplied data that contains a unique * identifier for each hash node in a given table. The interpretation of * the data is up to the user. When creating or initializing a hash table, * the user must supply a pointer to a function for comparing two keys, * and a pointer to a function for hashing a key into a numeric value. * 5. The value is a user-supplied pointer to void which may refer to * any data object. It is not interpreted in any way by the hashing * module. * 6. The hashed key is stored in each node so that we don't have to rehash * each key when the table must grow or shrink. */ typedef struct hnode_t { #if defined(HASH_IMPLEMENTATION) || !defined(KAZLIB_OPAQUE_DEBUG) struct hnode_t *next; struct hnode_t **pself; void *key; void *data; hash_val_t hkey; #else int OPAQUE; #endif } hnode_t; /* * The comparison function pointer type. A comparison function takes two keys * and produces a value of -1 if the left key is less than the right key, a * value of 0 if the keys are equal, and a value of 1 if the left key is * greater than the right key. */ typedef int (*hash_comp_t)(const void *, const void *); /* * The hashing function performs some computation on a key and produces an * integral value of type hash_val_t based on that key. For best results, the * function should have a good randomness properties in *all* significant bits * over the set of keys that are being inserted into a given hash table. In * particular, the most significant bits of hash_val_t are most significant to * the hash module. Only as the hash table expands are less significant bits * examined. Thus a function that has good distribution in its upper bits but * not lower is preferrable to one that has poor distribution in the upper bits * but not the lower ones. */ typedef hash_val_t (*hash_fun_t)(const void *); /* * allocator functions */ typedef hnode_t *(*hnode_alloc_t)(void *); typedef void (*hnode_free_t)(hnode_t *, void *); typedef struct hash_t { #if defined(HASH_IMPLEMENTATION) || !defined(KAZLIB_OPAQUE_DEBUG) struct hnode_t **table; hashcount_t nchains; hashcount_t count; hashcount_t maxcount; hashcount_t highmark; hashcount_t lowmark; hash_comp_t compare; hash_fun_t hash; hnode_alloc_t allocnode; hnode_free_t freenode; void *context; hash_val_t mask; int dynamic; #else int OPAQUE; #endif } hash_t; /* * Hash scanner structure, used for traversals of the data structure. * Notes: * 1. Pointer to the hash table that is being traversed. * 2. Reference to the current chain in the table being traversed (the chain * that contains the next node that shall be retrieved). * 3. Pointer to the node that will be retrieved by the subsequent call to * hash_scan_next(). */ typedef struct hscan_t { #if defined(HASH_IMPLEMENTATION) || !defined(KAZLIB_OPAQUE_DEBUG) hash_t *hash; hash_val_t chain; hnode_t *next; #else int OPAQUE; #endif } hscan_t; extern hash_t *hash_create(hashcount_t, hash_comp_t, hash_fun_t); extern void hash_set_allocator(hash_t *, hnode_alloc_t, hnode_free_t, void *); extern void hash_destroy(hash_t *); extern void hash_free(hash_t *); extern hash_t *hash_init(hash_t *, hashcount_t, hash_comp_t, hash_fun_t, hnode_t **, hashcount_t); extern void hash_insert(hash_t *, hnode_t *, void *); extern hnode_t *hash_lookup(hash_t *, void *); extern hnode_t *hash_delete(hash_t *, hnode_t *); extern int hash_alloc_insert(hash_t *, void *, void *); extern void hash_delete_free(hash_t *, hnode_t *); extern void hnode_put(hnode_t *, void *); extern void *hnode_get(hnode_t *); extern void *hnode_getkey(hnode_t *); extern hashcount_t hash_count(hash_t *); extern hashcount_t hash_size(hash_t *); extern int hash_isfull(hash_t *); extern int hash_isempty(hash_t *); extern void hash_scan_begin(hscan_t *, hash_t *); extern hnode_t *hash_scan_next(hscan_t *); extern hnode_t *hash_scan_delete(hash_t *, hnode_t *); extern int hash_verify(hash_t *); extern hnode_t *hnode_create(void *); extern hnode_t *hnode_init(hnode_t *, void *); extern void hnode_destroy(hnode_t *); #if defined(HASH_IMPLEMENTATION) || !defined(KAZLIB_OPAQUE_DEBUG) #ifdef <API key> #define hash_isfull(H) (SFX_CHECK(H)->count == (H)->maxcount) #else #define hash_isfull(H) ((H)->count == (H)->maxcount) #endif #define hash_isempty(H) ((H)->count == 0) #define hash_count(H) ((H)->count) #define hash_size(H) ((H)->nchains) #define hnode_get(N) ((N)->data) #define hnode_getkey(N) ((N)->key) #define hnode_put(N, V) ((N)->data = (V)) #endif #ifdef __cplusplus } #endif #endif
<?php /** * Review order form * * @author WooThemes * @package WooCommerce/Templates * @version 2.3.0 */ if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly ?> <?php if ( ! is_ajax() ) : ?><div id="order_review"><?php endif; ?> <table class="shop_table"> <thead> <tr> <th class="product-name"><?php _e( 'Product', 'woocommerce' ); ?></th> <th class="product-total"><?php _e( 'Total', 'woocommerce' ); ?></th> </tr> </thead> <tfoot> <tr class="cart-subtotal"> <th><?php _e( 'Cart Subtotal', 'woocommerce' ); ?></th> <td><?php <API key>(); ?></td> </tr> <?php foreach ( WC()->cart->get_coupons( 'cart' ) as $code => $coupon ) : ?> <tr class="cart-discount coupon-<?php echo esc_attr( $code ); ?>"> <th><?php <API key>( $coupon ); ?></th> <td><?php <API key>( $coupon ); ?></td> </tr> <?php endforeach; ?> <?php if ( WC()->cart->needs_shipping() && WC()->cart->show_shipping() ) : ?> <?php do_action( '<API key>' ); ?> <?php <API key>(); ?> <?php do_action( '<API key>' ); ?> <?php endif; ?> <?php foreach ( WC()->cart->get_fees() as $fee ) : ?> <tr class="fee"> <th><?php echo esc_html( $fee->name ); ?></th> <td><?php <API key>( $fee ); ?></td> </tr> <?php endforeach; ?> <?php if ( WC()->cart->tax_display_cart === 'excl' ) : ?> <?php if ( get_option( '<API key>' ) === 'itemized' ) : ?> <?php foreach ( WC()->cart->get_tax_totals() as $code => $tax ) : ?> <tr class="tax-rate tax-rate-<?php echo sanitize_title( $code ); ?>"> <th><?php echo esc_html( $tax->label ); ?></th> <td><?php echo wp_kses_post( $tax->formatted_amount ); ?></td> </tr> <?php endforeach; ?> <?php else : ?> <tr class="tax-total"> <th><?php echo esc_html( WC()->countries->tax_or_vat() ); ?></th> <td><?php echo wc_price( WC()->cart->get_taxes_total() ); ?></td> </tr> <?php endif; ?> <?php endif; ?> <?php foreach ( WC()->cart->get_coupons( 'order' ) as $code => $coupon ) : ?> <tr class="order-discount coupon-<?php echo esc_attr( $code ); ?>"> <th><?php <API key>( $coupon ); ?></th> <td><?php <API key>( $coupon ); ?></td> </tr> <?php endforeach; ?> <?php do_action( '<API key>' ); ?> <tr class="order-total"> <th><?php _e( 'Order Total', 'woocommerce' ); ?></th> <td><?php <API key>(); ?></td> </tr> <?php do_action( '<API key>' ); ?> </tfoot> <tbody> <?php do_action( '<API key>' ); foreach ( WC()->cart->get_cart() as $cart_item_key => $cart_item ) { $_product = apply_filters( '<API key>', $cart_item['data'], $cart_item, $cart_item_key ); if ( $_product && $_product->exists() && $cart_item['quantity'] > 0 && apply_filters( '<API key>', true, $cart_item, $cart_item_key ) ) { ?> <tr class="<?php echo esc_attr( apply_filters( '<API key>', 'cart_item', $cart_item, $cart_item_key ) ); ?>"> <td class="product-name"> <?php // Avada edit ?> <span class="product-thumbnail"> <?php $thumbnail = apply_filters( '<API key>', $_product->get_image(), $cart_item, $cart_item_key ); if ( ! $_product->is_visible() ) echo $thumbnail; else printf( '<a href="%s">%s</a>', $_product->get_permalink(), $thumbnail ); ?> </span> <div class="product-info"> <?php // Avada edit ?> <?php echo apply_filters( '<API key>', $_product->get_title(), $cart_item, $cart_item_key ); ?> <?php echo apply_filters( '<API key>', ' <strong class="product-quantity">' . sprintf( '&times; %s', $cart_item['quantity'] ) . '</strong>', $cart_item, $cart_item_key ); ?> <?php echo WC()->cart->get_item_data( $cart_item ); ?> </div> </td> <td class="product-total"> <?php echo apply_filters( '<API key>', WC()->cart-><API key>( $_product, $cart_item['quantity'] ), $cart_item, $cart_item_key ); ?> </td> </tr> <?php } } do_action( '<API key>' ); ?> </tbody> </table> <?php if(version_compare(WC_VERSION, '2.3.7','<=')): ?> <?php do_action( '<API key>' ); ?> <div id="payment"> <?php if ( WC()->cart->needs_payment() ) : ?> <ul class="payment_methods methods"> <?php $available_gateways = WC()->payment_gateways-><API key>(); if ( ! empty( $available_gateways ) ) { // Chosen Method if ( isset( WC()->session-><API key> ) && isset( $available_gateways[ WC()->session-><API key> ] ) ) { $available_gateways[ WC()->session-><API key> ]->set_current(); } elseif ( isset( $available_gateways[ get_option( '<API key>' ) ] ) ) { $available_gateways[ get_option( '<API key>' ) ]->set_current(); } else { current( $available_gateways )->set_current(); } foreach ( $available_gateways as $gateway ) { ?> <li class="payment_method_<?php echo $gateway->id; ?>"> <input id="payment_method_<?php echo $gateway->id; ?>" type="radio" class="input-radio" name="payment_method" value="<?php echo esc_attr( $gateway->id ); ?>" <?php checked( $gateway->chosen, true ); ?> <API key>="<?php echo esc_attr( $gateway->order_button_text ); ?>" /> <label for="payment_method_<?php echo $gateway->id; ?>"><?php echo $gateway->get_title(); ?> <?php echo $gateway->get_icon(); ?></label> <?php if ( $gateway->has_fields() || $gateway->get_description() ) : echo '<div class="payment_box payment_method_' . $gateway->id . '" ' . ( $gateway->chosen ? '' : 'style="display:none;"' ) . '>'; $gateway->payment_fields(); echo '</div>'; endif; ?> </li> <?php } } else { if ( ! WC()->customer->get_country() ) $no_gateways_message = __( 'Please fill in your details above to see available payment methods.', 'woocommerce' ); else $no_gateways_message = __( 'Sorry, it seems that there are no available payment methods for your state. Please contact us if you require assistance or wish to make alternate arrangements.', 'woocommerce' ); echo '<p>' . apply_filters( '<API key>', $no_gateways_message ) . '</p>'; } ?> </ul> <?php endif; ?> <div class="form-row place-order"> <noscript><?php _e( 'Since your browser does not support JavaScript, or it is disabled, please ensure you click the <em>Update Totals</em> button before placing your order. You may be charged more than the amount stated above if you fail to do so.', 'woocommerce' ); ?><br/><input type="submit" class="button alt" name="<API key>" value="<?php _e( 'Update totals', 'woocommerce' ); ?>" /></noscript> <?php wp_nonce_field( '<API key>' ); ?> <?php do_action( '<API key>' ); ?> <?php $order_button_text = apply_filters( '<API key>', __( 'Place order', 'woocommerce' ) ); echo apply_filters( '<API key>', '<input type="submit" class="button alt" name="<API key>" id="place_order" value="' . esc_attr( $order_button_text ) . '" data-value="' . esc_attr( $order_button_text ) . '" />' ); ?> <?php if ( wc_get_page_id( 'terms' ) > 0 && apply_filters( '<API key>', true ) ) { $terms_is_checked = apply_filters( '<API key>', isset( $_POST['terms'] ) ); ?> <p class="form-row terms"> <?php // Avada edit ?> <input type="checkbox" class="input-checkbox" name="terms" <?php checked( $terms_is_checked, true ); ?> id="terms" /> <label for="terms" class="checkbox"><?php _e( 'I have read and accept the', 'Avada' ); ?> <a href="<?php echo esc_url( get_permalink(wc_get_page_id('terms')) ); ?>" target="_blank"><?php _e( 'terms &amp; conditions', 'Avada' ); ?></a></label> <?php // End Avada edit ?> </p> <?php } ?> <?php do_action( '<API key>' ); ?> </div> <div class="clear"></div> </div> <?php do_action( '<API key>' ); ?> <?php endif;?> <?php if ( ! is_ajax() ) : ?></div><?php endif; ?>
""" BoxDotNet Module """ import os, sys import traceback import md5 import logging log = logging.getLogger("modules.BoxDotNet") import conduit import conduit.utils as Utils import conduit.Web as Web import conduit.dataproviders.DataProvider as DataProvider import conduit.Exceptions as Exceptions from conduit.datatypes import Rid import conduit.datatypes.File as File Utils.<API key>(__file__, "BoxDotNetAPI") from boxdotnet import BoxDotNet from gettext import gettext as _ MODULES = { "BoxDotNetTwoWay" : { "type": "dataprovider" } } class BoxDotNetTwoWay(DataProvider.TwoWay): _name_ = _("Box.net") _description_ = _("Synchronize your Box.net files") _category_ = conduit.dataproviders.CATEGORY_FILES _module_type_ = "twoway" _in_type_ = "file" _out_type_ = "file" _icon_ = "boxdotnet" _configurable_ = True <TwitterConsumerkey>" def __init__(self, *args): DataProvider.TwoWay.__init__(self) self.<API key>( foldername = "", ) self.boxapi = None self.user_id = None self.token = None self.folder_id = None self.files = {} # File info related functions def _get_file_info(self, fileID): """ Returns the id, if the id is present in the configured folder """ self.files = self._get_files(self.folder_id) if self.files.has_key(fileID): log.debug("File [%s] does exist" % fileID) return fileID else: log.debug("File [%s] does not exist" % fileID) return None def _get_files(self,folderID): """ Gets a list of files present in the configured folder """ rsp = self.boxapi.get_account_tree (<TwitterConsumerkey>.API_KEY, auth_token=self.token, folder_id=folderID, params=['nozip']) files = {} try: for file in rsp.tree[0].folder[0].files[0].file: files[file.attrib['id']] = file.attrib['file_name'] finally: return files def _get_raw_file_url(self, fileID): """ Format an url that can be used for downloading a file """ return "http://box.net/api/1.0/download/%s/%s" % (self.token, fileID) # Upload functions def _upload_file (self, file_path, filename): """ Upload the file to box.net @returns: uid of the file """ rsp = self.boxapi.upload(file_path, auth_token=self.token, folder_id=self.folder_id, share=0, filename=filename ) uid = rsp.files[0].file[0].attrib['id'] return uid def _replace_file (self, fileID, url, name): """ Box.net automatically replaces files with same name, so we can use the plain upload method @returns: uid of the file """ return self._upload_file(url, name) # File info related functions def _get_folder_id(self): """ Returns a folder id for the configured folder name, it re-uses existing ones and creates a new folder if it isn't present """ id = None # see if folder already exists folders = self._get_folders() if folders.has_key (self.foldername): id = folders[self.foldername] # return if it does if id: return id # create otherwise else: return self._create_folder () def _get_folders(self): """ Returns a dictionary of name-id representing the upper-level folders """ rsp = self.boxapi.get_account_tree(<TwitterConsumerkey>.API_KEY, auth_token=self.token, folder_id=0, params=['nozip']) folders = {} try: # this might throw an exception if user has no folders yet for folder in rsp.tree[0].folder[0].folders[0].folder: folders[folder.attrib['name']] = folder.attrib['id'] finally: return folders def _create_folder(self): """ Create a top-level folder with the configured name, and return the id """ rsp = self.boxapi.create_folder(<TwitterConsumerkey>.API_KEY, auth_token=self.token, parent_id=0, name=self.foldername, share=0) return rsp.folder[0].folder_id[0].elementText # Authentication methods def _login(self): """ Logs the user in to box.net """ if self.boxapi == None: self.boxapi = BoxDotNet() # login if not done yet, we only login once to prevent # the browser for popping up each time if not self.token: # get the ticket and open login url self._set_ticket() url = BoxDotNet.get_login_url(self.ticket) #wait for log in Web.LoginMagic("Log into Box.net", url, login_function=self._try_login) def _try_login (self): """ Try to perform a login, return None if it does not succeed """ try: self._set_login_info(self.ticket) return self.token except: return None def _set_ticket(self): """ Get the ticket that can be used for logging in for real """ rsp = self.boxapi.get_ticket(api_key=self.API_KEY) self.ticket = rsp.ticket[0].elementText def _set_login_info (self, ticket): """ Get a token and the user id """ rsp = self.boxapi.get_auth_token(api_key=self.API_KEY, ticket=ticket) self.user_id = rsp.user[0].user_id[0].elementText self.token = rsp.auth_token[0].elementText self.ticket = None # Dataprovider Functions def refresh(self): DataProvider.TwoWay.refresh(self) self._login() # set folder id if not done yet or configuration changed folder_id = self._get_folder_id() if not self.folder_id or self.folder_id != folder_id: self.folder_id = folder_id self.files = self._get_files(self.folder_id) def put (self, file, overwrite, LUID=None): """ Puts the file in the sink, this uploads the file if it is not present yet or updates it if necessary """ DataProvider.TwoWay.put(self, file, overwrite, LUID) originalName = file.get_filename() #Gets the local URI (/foo/bar). If this is a remote file then #it is first transferred to the local filesystem fileURI = file.get_local_uri() mimeType = file.get_mimetype() if LUID == None: log.debug("Uploading file URI = %s, Mimetype = %s, Original Name = %s" % (fileURI, mimeType, originalName)) LUID = self._upload_file (fileURI, originalName) else: #check if a file exists at that UID id = self._get_file_info(LUID) if id != None: if overwrite == True: log.debug("Replacing file URI = %s, Mimetype = %s, Original Name = %s" % (fileURI, mimeType, originalName)) LUID = self._replace_file(LUID, fileURI, originalName) else: #Only upload the file if it is newer than the Remote one url = self._get_raw_file_url(id) remoteFile = File.File(url) #this is a limited test for equality type comparison comp = file.compare(remoteFile,True) log.debug("Compared %s with %s to check if they are the same (size). Result = %s" % (file.get_filename(),remoteFile.get_filename(),comp)) if comp != conduit.datatypes.COMPARISON_EQUAL: raise Exceptions.<API key>(comp, file, remoteFile) return self.get(LUID).get_rid() def delete(self, LUID): """ Simply call the delete method on the api """ self.boxapi.delete (<TwitterConsumerkey>.API_KEY, auth_token=self.token, target='file', target_id=LUID) def config_setup(self, config): def _login_finished(*args): folders = self._get_folders() folders_config.set_choices([(f,f) for f in folders]) def <API key>(button): conduit.GLOBALS.syncManager.<API key>( self, _login_finished, self._login) config.add_section(_("Folder")) folders_config = config.add_item(_("Folder name"), "combotext", config_name = "foldername", choices = [], ) config.add_item(_("Load folders"), "button", initial_value = <API key> ) def is_configured (self, isSource, isTwoWay): return len(self.foldername) > 0 def get_UID(self): return "%s-%s" % (self.user_id, self.foldername) def get(self, LUID): DataProvider.TwoWay.get(self, LUID) url = self._get_raw_file_url(LUID) f = File.File( URI= url, group= self.foldername ) try: #gnomevfs doesnt like unicode f.force_new_filename(str(self.files[LUID])) except KeyError: #occurs on put() returning get() because we have #not refreshed since. Not a problem because the point #of put returning get() is to make the rids() in the same #scheme, and not actually do something with the returned file. pass f.set_open_URI(url) f.set_UID(LUID) return f def get_all(self): DataProvider.TwoWay.get_all(self) return self.files.keys() def get_name(self): if len(self.foldername) > 0: return self.foldername else: return self._name_
#ifndef <API key> #define <API key> #include "SVGPathSeg.h" namespace KSVG { class <API key>; class <API key> : public SVGPathSeg { public: <API key>(); <API key>(const <API key> &); <API key> &operator=(const <API key> &other); <API key>(<API key> *); ~<API key>(); void setX(const float &); float x() const; void setY(const float &); float y() const; void setX1(const float &); float x1() const; void setY1(const float &); float y1() const; void setX2(const float &); float x2() const; void setY2(const float &); float y2() const; // Internal! - NOT PART OF THE SVG SPECIFICATION <API key> *handle() const { return impl; } private: <API key> *impl; }; class <API key>; class <API key> : public SVGPathSeg { public: <API key>(); <API key>(const <API key> &); <API key> &operator=(const <API key> &other); <API key>(<API key> *); ~<API key>(); void setX(const float &); float x() const; void setY(const float &); float y() const; void setX1(const float &); float x1() const; void setY1(const float &); float y1() const; void setX2(const float &); float x2() const; void setY2(const float &); float y2() const; // Internal! - NOT PART OF THE SVG SPECIFICATION <API key> *handle() const { return impl; } private: <API key> *impl; }; } #endif // vim:ts=4:noet
What is PubSub? PubSub is a design pattern which mostly promotes a loose coupling between two kinds of entities - publishers and subscribers. Like their names suggest, in the pubsub world we have publishers who fire events, and subscribers who wish to be notified about those events when publishers push data. There might be several subscribers, several publishers, and even several channels (or nodes) where the events are sent. Module Description This module implements [XEP-0060 (Publish-Subscribe)](http: Due to the complexity of the protocol, the PubSub engine makes successive calls to the `nodetree` and `node plugins` in order to check the validity of requests, perform the corresponding action and return a result or appropriate error. Such an architecture makes it much easier to write custom pubsub plugins and add new storage backends. It's all about tailoring PubSub to your needs! Options * `iqdisc` (default: `one_queue`) * `host` (string, default: `"pubsub.@HOST@"`): Subdomain for Pubsub service to reside under. `@HOST@` is replaced with each served domain. * `backend` (atom, default: `mnesia`) - Database backend to use. `mnesia` and `rdbms` are supported currently. * `access_create` (atom, default: `all`): Who is allowed to create pubsub nodes. * `max_items_node` (integer, default: `10`): Define the maximum number of items that can be stored in a node. * `<API key>` (integer, default: `undefined` - no limitation): The maximum number of subscriptions managed by a node. * `nodetree` (binary, default: `<<"tree">>`): Specifies the storage and organisation of the pubsub nodes. See the section below. * `<API key>` (boolean, default: `true`): specify whether or not we should get last published PEP items from users in our roster which are offline when we connect. The default option is `true` hence we will get only the last items from the online contacts. * `last_item_cache` (atom, default `false`): If enabled, PubSub will cache the last published items in the nodes. It may increase PubSub performance but at a price of an increased memory usage. Valid values are `mnesia`, `rdbms` and `false`. * `plugins` ([Plugin, ...], default: `[<<"flat">>]`): List of enabled pubsub plugins. * `pep_mapping` ([{Key, Value}, ...]): This permits creating a Key-Value list to define a custom node plugin on a given PEP namespace. E.g. pair `{"urn:xmpp:microblog:0", "mb"}` will use module `node_mb` instead of `node_pep` when the specified namespace is used. * `default_node_config` ([{Key, Value}, ...]): Overrides the default node configuration, regradless of the node plugin. Node configuration still uses the default configuration defined by the node plugin, and overrides any items by the value defined in this configurable list. * `item_publisher` (boolean, default: `false`): When enabled, a JID of the publisher will be saved in the item metadata. This effectively makes them an owner of this item. * `sync_broadcast` (boolean, default: `false`): If false, routing of notifications to subscribers is done in a separate Erlang process. As a consequence, some notifications *may* arrive to the subscribers in the wrong order (however, the two events would have to be published at the exact same time). # Cache Backend Caching is disabled by default. You may enable it by specifying the backend it should use. It is not coupled with the main DB backend, so it is possible to store the cached data in `mnesia`, while the actual PubSub information is kept in RDBMS (and vice versa!). Example Configuration {mod_pubsub, [{access_createnode, pubsub_createnode}, {<API key>, false}, {backend, rdbms}, {last_item_cache, mnesia}, {max_items_node, 1000}, {plugins, [<<"flat">>, <<"pep">>]} ]}, Nodetrees Called on `get`, `create` and `delete` node. Only one nodetree can be used per host and is shared by all node plugins. # `<<"tree">>` Stores nodes in a tree structure. Every node name must be formatted like a UNIX path (e.g. `/top/middle/leaf`). When a node is created, its direct ancestor must already exist, so in order to create `/top/middle/leaf`, `/top/middle` is needed. A user may create any top-level node. A user may create a subnode of a node, only if they own it or it was created by the service. # `<<"dag">>` Provides experimental support for [XEP-0248 (PubSub Collection Nodes)](http://xmpp.org/extensions/xep-0248.html). In this case you should also add the `<<"dag">>` node plugin as default, for example: `{plugins, [<<"dag">>,<<"flat">>,<<"hometree">>,<<"pep">>]}` Plugins They handle affiliations, subscriptions and items and also provide default node conguration and features. PubSub clients can define which plugin to use when creating a node by adding `type='plugin-name'` attribute to the create stanza element. If such an attribute is not specified, the default plugin will be the first on the plugin list. # `<<"flat">>` No node hierarchy. It handles the standard PubSub case. # `<<"hometree">>` Uses the exact same features as the flat plugin but additionally organises nodes in a tree. Basically it follows a scheme similar to the filesystem's structure. Every user can create nodes in their own home root: e.g `/home/user`. Each node can contain items and/or sub-nodes. # `<<"pep">>` Implementation of [XEP-0060 (Personal Eventing Protocol)](http://xmpp.org/extensions/xep-0163.html). In this case, items are not persisted but kept in an in-memory cache. When the `pep` plugin is enabled, a user can have their own node (exposed as their bare jid) with a common namespace. Requires module `mod_caps` to be enabled. # `<<"dag">>` Implementation of [XEP-0248 (PubSub Collection Nodes)](https://xmpp.org/extensions/xep-0248.html). Every node takes a place in a collection and becomes either a collection node (and have only sub-nodes) or a leaf node (contains only items). # `<<"push">>` Special node type that may be used as a target node for [XEP-0357 (Push Notifications)](https://xmpp.org/extensions/xep-0357.html) capable services (e.g. `<API key>`). For each published notification, a hook `push_notification` is run. You may enable as many modules that support this hook (all module with `mod_push_service_*` name prefix) as you like (see for example `<API key>`). This node type **requires** `publish-options` with at least `device_id` and `service` fields supplied. Metrics If you'd like to learn more about metrics in MongooseIM, please visit the [MongooseIM metrics](../<API key>/Mongoose-metrics.md) page. # Overall PubSub action metrics For every PubSub action, like node creation, subscription, publication the following metrics are available: * count - a spiral metric showing the number of given action invocations * errors - a spiral metric counting the errors for a given action * time - a histogram metric showing the time it took to finish the action in case of success Below there is a table describing all metrics related to PubSub actions | Name | Description (when it gets incremented) | | |`[HOST, pubsub, get, affiliations, TYPE]` | When node's affiliations are read | |`[HOST, pubsub, get, configure, TYPE]` | When node's configuration is read | |`[HOST, pubsub, get, default, TYPE]` | When node's defaults are read | |`[HOST, pubsub, get, items, TYPE]` | When node's items are read | |`[HOST, pubsub, get, options, TYPE]` | When node's options are read | |`[HOST, pubsub, get, subscriptions, TYPE]` | When node's subscriptions are read | |`[HOST, pubsub, set, affiliations, TYPE]` | When node's subscriptions are set | |`[HOST, pubsub, set, configure, TYPE]` | When node's configuration is set | |`[HOST, pubsub, set, create, TYPE]` | When node is created | |`[HOST, pubsub, set, delete, TYPE]` | When node is deleted | |`[HOST, pubsub, set, options, TYPE]` | When node's options are set | |`[HOST, pubsub, set, publish, TYPE]` | When an item is published | |`[HOST, pubsub, set, purge, TYPE]` | When node's items are purged | |`[HOST, pubsub, set, retract, TYPE]` | When node's items are retracted | |`[HOST, pubsub, set, subscribe, TYPE]` | When a subscriber subscribes to a node | |`[HOST, pubsub, set, subscriptions, TYPE]` | When a subscription is set (for instance accepted) | |`[HOST, pubsub, set, unsubscribe, TYPE]` | When a subscriber unsubscribes | Where: * `HOST` is the XMPP host for which `mod_pubsub` is running. Can be set to `global` if all metrics are set to be global. * `TYPE` is one of the following `count`, `errors`, `time` (described above the table) # Backend operations The are also more detailed metrics measuring execution time of backend operations. Metrics for these actions may be found under `mod_pubsub_db` subkey. | Backend action | Description (when it gets incremented) | | | `get_state` | User's state for a specific node is fetched. | | `get_states` | Node's states are fetched. | | `get_states_by_lus` | Nodes' states for user + domain are fetched. | | `get_states_by_bare` | Nodes' states for bare JID are fetched. | | `get_states_by_full` | Nodes' states for full JID are fetched. | | `<API key>` | State data for user's nodes is fetched. | | `create_node` | A node's owner is set. | | `del_node` | All data related to a node is removed. | | `get_items` | Node's items are fetched. | | `get_item` | A specific item from a node is fetched. | | `add_item` | An item is upserted into a node. | | `set_item` | An item is updated in a node. | | `del_item` | An item is deleted from a node. | | `del_items` | Specified items are deleted from a node. | | `set_node` | A node is upserted. | | `find_node_by_id` | A node is fetched by its ID. | | `find_nodes_by_key` | Nodes are fetched by key. | | `find_node_by_name` | A node is fetched by its name. | | `del_node` | A node is deleted. | | `get_subnodes` | Subnodes of a node are fetched. | | `get_subnodes_tree` | Full tree of subnodes of a node is fetched. | | `<API key>` | All parents of a node are fetched. |
//git describe version info static char *cGitVersion="GitVersion:"GitVersion; #include "mysqlrad.h" //Table Variables //Table Variables //uMonth: Primary Key static unsigned uMonth=0; //cLabel: Name of Archive Table Ex. tNov2009 static char cLabel[33]={""}; //uOwner: Record owner static unsigned uOwner=0; //uCreatedBy: uClient for last insert static unsigned uCreatedBy=0; #define ISM3FIELDS static long uCreatedDate=0; //uModBy: uClient for last update static unsigned uModBy=0; static long uModDate=0; #define VAR_LIST_tMonth "tMonth.uMonth,tMonth.cLabel,tMonth.uOwner,tMonth.uCreatedBy,tMonth.uCreatedDate,tMonth.uModBy,tMonth.uModDate" //Local only void Insert_tMonth(void); void Update_tMonth(char *cRowid); void <API key>(pentry entries[], int x); //In tMonthfunc.h file included below void <API key>(pentry entries[], int x); void ExttMonthCommands(pentry entries[], int x); void ExttMonthButtons(void); void ExttMonthNavBar(void); void ExttMonthGetHook(entry gentries[], int x); void ExttMonthSelect(void); void ExttMonthSelectRow(void); void ExttMonthListSelect(void); void ExttMonthListFilter(void); void ExttMonthAuxTable(void); #include "tmonthfunc.h" //Table Variables Assignment Function void ProcesstMonthVars(pentry entries[], int x) { register int i; for(i=0;i<x;i++) { if(!strcmp(entries[i].name,"uMonth")) sscanf(entries[i].val,"%u",&uMonth); else if(!strcmp(entries[i].name,"cLabel")) sprintf(cLabel,"%.32s",entries[i].val); else if(!strcmp(entries[i].name,"uOwner")) sscanf(entries[i].val,"%u",&uOwner); else if(!strcmp(entries[i].name,"uCreatedBy")) sscanf(entries[i].val,"%u",&uCreatedBy); else if(!strcmp(entries[i].name,"uCreatedDate")) sscanf(entries[i].val,"%lu",&uCreatedDate); else if(!strcmp(entries[i].name,"uModBy")) sscanf(entries[i].val,"%u",&uModBy); else if(!strcmp(entries[i].name,"uModDate")) sscanf(entries[i].val,"%lu",&uModDate); } //After so we can overwrite form data if needed. <API key>(entries,x); }//ProcesstMonthVars() void <API key>(pentry entries[], int x) { register int i; for(i=0;i<x;i++) { if(!strncmp(entries[i].name,"ED",2)) { sscanf(entries[i].name+2,"%u",&uMonth); guMode=2002; tMonth(""); } } }//void <API key>(pentry entries[], int x) int tMonthCommands(pentry entries[], int x) { ProcessControlVars(entries,x); ExttMonthCommands(entries,x); if(!strcmp(gcFunction,"tMonthTools")) { if(!strcmp(gcFind,LANG_NB_LIST)) { tMonthList(); } //Default ProcesstMonthVars(entries,x); tMonth(""); } else if(!strcmp(gcFunction,"tMonthList")) { ProcessControlVars(entries,x); <API key>(entries,x); tMonthList(); } return(0); }//tMonthCommands() void tMonth(const char *cResult) { MYSQL_RES *res; MYSQL_RES *res2; MYSQL_ROW field; //Internal skip reloading if(!cResult[0]) { if(guMode) ExttMonthSelectRow(); else ExttMonthSelect(); mysql_query(&gMysql,gcQuery); if(mysql_errno(&gMysql)) { if(strstr(mysql_error(&gMysql)," doesn't exist")) { CreatetMonth(); iDNS("New tMonth table created"); } else { htmlPlainTextError(mysql_error(&gMysql)); } } res=mysql_store_result(&gMysql); if((guI=mysql_num_rows(res))) { if(guMode==6) { sprintf(gcQuery,"SELECT _rowid FROM tMonth WHERE uMonth=%u" ,uMonth); mysql_query(&gMysql,gcQuery); res2=mysql_store_result(&gMysql); field=mysql_fetch_row(res2); sscanf(field[0],"%lu",&gluRowid); gluRowid++; } PageMachine("",0,""); if(!guMode) mysql_data_seek(res,gluRowid-1); field=mysql_fetch_row(res); sscanf(field[0],"%u",&uMonth); sprintf(cLabel,"%.32s",field[1]); sscanf(field[2],"%u",&uOwner); sscanf(field[3],"%u",&uCreatedBy); sscanf(field[4],"%lu",&uCreatedDate); sscanf(field[5],"%u",&uModBy); sscanf(field[6],"%lu",&uModDate); } }//Internal Skip Header_ism3(":: tMonth",1); printf("<table width=100%% cellspacing=0 cellpadding=0>\n"); printf("<tr><td colspan=2 align=right valign=center>"); printf("<input type=hidden name=gcFunction value=tMonthTools>"); printf("<input type=hidden name=gluRowid value=%lu>",gluRowid); if(guI) { if(guMode==6) //printf(" Found"); printf(LANG_NBR_FOUND); else if(guMode==5) //printf(" Modified"); printf(LANG_NBR_MODIFIED); else if(guMode==4) //printf(" New"); printf(LANG_NBR_NEW); printf(LANG_NBRF_SHOWING,gluRowid,guI); } else { if(!cResult[0]) //printf(" No records found"); printf(LANG_NBR_NORECS); } if(cResult[0]) printf("%s",cResult); printf("</td></tr>"); printf("<tr><td valign=top width=25%%>"); ExttMonthButtons(); printf("</td><td valign=top>"); OpenFieldSet("tMonth Record Data",100); if(guMode==2000 || guMode==2002) tMonthInput(1); else tMonthInput(0); CloseFieldSet(); //Bottom table printf("<tr><td colspan=2>"); ExttMonthAuxTable(); Footer_ism3(); }//end of tMonth(); void tMonthInput(unsigned uMode) { //uMonth OpenRow(<API key>,"black"); printf("<input title='%s' type=text name=uMonth value=%u size=16 maxlength=10 " ,<API key>,uMonth); if(guPermLevel>=20 && uMode) { printf("></td></tr>\n"); } else { printf("disabled></td></tr>\n"); printf("<input type=hidden name=uMonth value=%u >\n",uMonth); } //cLabel OpenRow(<API key>,"black"); printf("<input title='%s' type=text name=cLabel value=\"%s\" size=40 maxlength=32 " ,<API key>,EncodeDoubleQuotes(cLabel)); if(guPermLevel>=0 && uMode) { printf("></td></tr>\n"); } else { printf("disabled></td></tr>\n"); printf("<input type=hidden name=cLabel value=\"%s\">\n",EncodeDoubleQuotes(cLabel)); } //uOwner OpenRow(<API key>,"black"); if(guPermLevel>=20 && uMode) { printf("%s<input type=hidden name=uOwner value=%u >\n",ForeignKey(TCLIENT,"cLabel",uOwner),uOwner); } else { printf("%s<input type=hidden name=uOwner value=%u >\n",ForeignKey(TCLIENT,"cLabel",uOwner),uOwner); } //uCreatedBy OpenRow(<API key>,"black"); if(guPermLevel>=20 && uMode) { printf("%s<input type=hidden name=uCreatedBy value=%u >\n",ForeignKey(TCLIENT,"cLabel",uCreatedBy),uCreatedBy); } else { printf("%s<input type=hidden name=uCreatedBy value=%u >\n",ForeignKey(TCLIENT,"cLabel",uCreatedBy),uCreatedBy); } //uCreatedDate OpenRow(<API key>,"black"); if(uCreatedDate) printf("%s\n\n",ctime(&uCreatedDate)); else printf(" printf("<input type=hidden name=uCreatedDate value=%lu >\n",uCreatedDate); //uModBy OpenRow(<API key>,"black"); if(guPermLevel>=20 && uMode) { printf("%s<input type=hidden name=uModBy value=%u >\n",ForeignKey(TCLIENT,"cLabel",uModBy),uModBy); } else { printf("%s<input type=hidden name=uModBy value=%u >\n",ForeignKey(TCLIENT,"cLabel",uModBy),uModBy); } //uModDate OpenRow(<API key>,"black"); if(uModDate) printf("%s\n\n",ctime(&uModDate)); else printf(" printf("<input type=hidden name=uModDate value=%lu >\n",uModDate); printf("</tr>\n"); }//void tMonthInput(unsigned uMode) void NewtMonth(unsigned uMode) { register int i=0; MYSQL_RES *res; sprintf(gcQuery,"SELECT uMonth FROM tMonth\ WHERE uMonth=%u" ,uMonth); mysql_query(&gMysql,gcQuery); if(mysql_errno(&gMysql)) htmlPlainTextError(mysql_error(&gMysql)); res=mysql_store_result(&gMysql); i=mysql_num_rows(res); if(i) //tMonth("<blink>Record already exists"); tMonth(LANG_NBR_RECEXISTS); //insert query Insert_tMonth(); if(mysql_errno(&gMysql)) htmlPlainTextError(mysql_error(&gMysql)); //sprintf(gcQuery,"New record %u added"); uMonth=mysql_insert_id(&gMysql); #ifdef ISM3FIELDS uCreatedDate=luGetCreatedDate("tMonth",uMonth); iDNSLog(uMonth,"tMonth","New"); #endif if(!uMode) { sprintf(gcQuery,<API key>,uMonth); tMonth(gcQuery); } }//NewtMonth(unsigned uMode) void DeletetMonth(void) { #ifdef ISM3FIELDS sprintf(gcQuery,"DELETE FROM tMonth WHERE uMonth=%u AND ( uOwner=%u OR %u>9 )" ,uMonth,guLoginClient,guPermLevel); #else sprintf(gcQuery,"DELETE FROM tMonth WHERE uMonth=%u" ,uMonth); #endif mysql_query(&gMysql,gcQuery); if(mysql_errno(&gMysql)) htmlPlainTextError(mysql_error(&gMysql)); //tMonth("Record Deleted"); if(mysql_affected_rows(&gMysql)>0) { #ifdef ISM3FIELDS iDNSLog(uMonth,"tMonth","Del"); #endif tMonth(LANG_NBR_RECDELETED); } else { #ifdef ISM3FIELDS iDNSLog(uMonth,"tMonth","DelError"); #endif tMonth(<API key>); } }//void DeletetMonth(void) void Insert_tMonth(void) { //insert query sprintf(gcQuery,"INSERT INTO tMonth SET uMonth=%u,cLabel='%s',uOwner=%u,uCreatedBy=%u,uCreatedDate=UNIX_TIMESTAMP(NOW())", uMonth ,TextAreaSave(cLabel) ,uOwner ,uCreatedBy ); mysql_query(&gMysql,gcQuery); }//void Insert_tMonth(void) void Update_tMonth(char *cRowid) { //update query sprintf(gcQuery,"UPDATE tMonth SET uMonth=%u,cLabel='%s',uModBy=%u,uModDate=UNIX_TIMESTAMP(NOW()) WHERE _rowid=%s", uMonth ,TextAreaSave(cLabel) ,uModBy ,cRowid); mysql_query(&gMysql,gcQuery); }//void Update_tMonth(void) void ModtMonth(void) { register int i=0; MYSQL_RES *res; MYSQL_ROW field; #ifdef ISM3FIELDS unsigned uPreModDate=0; sprintf(gcQuery,"SELECT uMonth,uModDate FROM tMonth WHERE uMonth=%u" ,uMonth); #else sprintf(gcQuery,"SELECT uMonth FROM tMonth WHERE uMonth=%u" ,uMonth); #endif mysql_query(&gMysql,gcQuery); if(mysql_errno(&gMysql)) htmlPlainTextError(mysql_error(&gMysql)); res=mysql_store_result(&gMysql); i=mysql_num_rows(res); //if(i<1) tMonth("<blink>Record does not exist"); if(i<1) tMonth(<API key>); //if(i>1) tMonth("<blink>Multiple rows!"); if(i>1) tMonth(LANG_NBR_MULTRECS); field=mysql_fetch_row(res); #ifdef ISM3FIELDS sscanf(field[1],"%u",&uPreModDate); if(uPreModDate!=uModDate) tMonth(LANG_NBR_EXTMOD); #endif Update_tMonth(field[0]); if(mysql_errno(&gMysql)) htmlPlainTextError(mysql_error(&gMysql)); //sprintf(query,"record %s modified",field[0]); sprintf(gcQuery,<API key>,field[0]); #ifdef ISM3FIELDS uModDate=luGetModDate("tMonth",uMonth); iDNSLog(uMonth,"tMonth","Mod"); #endif tMonth(gcQuery); }//ModtMonth(void) void tMonthList(void) { MYSQL_RES *res; MYSQL_ROW field; ExttMonthListSelect(); mysql_query(&gMysql,gcQuery); if(mysql_error(&gMysql)[0]) htmlPlainTextError(mysql_error(&gMysql)); res=mysql_store_result(&gMysql); guI=mysql_num_rows(res); PageMachine("tMonthList",1,"");//1 is auto header list guMode. Opens table! //Filter select drop down ExttMonthListFilter(); printf("<input type=text size=16 name=gcCommand maxlength=98 value=\"%s\" >",gcCommand); printf("</table>\n"); printf("<table bgcolor=#9BC1B3 border=0 width=100%%>\n"); printf("<tr bgcolor=black><td><font face=arial,helvetica color=white>uMonth<td><font face=arial,helvetica color=white>cLabel<td><font face=arial,helvetica color=white>uOwner<td><font face=arial,helvetica color=white>uCreatedBy<td><font face=arial,helvetica color=white>uCreatedDate<td><font face=arial,helvetica color=white>uModBy<td><font face=arial,helvetica color=white>uModDate</tr>"); mysql_data_seek(res,guStart-1); for(guN=0;guN<(guEnd-guStart+1);guN++) { field=mysql_fetch_row(res); if(!field) { printf("<tr><td><font face=arial,helvetica>End of data</table>"); Footer_ism3(); } if(guN % 2) printf("<tr bgcolor=#BBE1D3>"); else printf("<tr>"); long luTime4=strtoul(field[4],NULL,10); char cBuf4[32]; if(luTime4) ctime_r(&luTime4,cBuf4); else sprintf(cBuf4," long luTime6=strtoul(field[6],NULL,10); char cBuf6[32]; if(luTime6) ctime_r(&luTime6,cBuf6); else sprintf(cBuf6," printf("<td><input type=submit name=ED%s value=Edit> %s<td>%s<td>%s<td>%s<td>%s<td>%s<td>%s</tr>" ,field[0] ,field[0] ,field[1] ,ForeignKey(TCLIENT,"cLabel",strtoul(field[2],NULL,10)) ,ForeignKey(TCLIENT,"cLabel",strtoul(field[3],NULL,10)) ,cBuf4 ,ForeignKey(TCLIENT,"cLabel",strtoul(field[5],NULL,10)) ,cBuf6 ); } printf("</table></form>\n"); Footer_ism3(); }//tMonthList() void CreatetMonth(void) { sprintf(gcQuery,"CREATE TABLE IF NOT EXISTS tMonth ( uMonth INT UNSIGNED PRIMARY KEY AUTO_INCREMENT, cLabel VARCHAR(32) NOT NULL DEFAULT '', UNIQUE (cLabel), uOwner INT UNSIGNED NOT NULL DEFAULT 0,index (uOwner), uCreatedBy INT UNSIGNED NOT NULL DEFAULT 0, uCreatedDate INT UNSIGNED NOT NULL DEFAULT 0, uModBy INT UNSIGNED NOT NULL DEFAULT 0, uModDate INT UNSIGNED NOT NULL DEFAULT 0 )"); mysql_query(&gMysql,gcQuery); if(mysql_errno(&gMysql)) htmlPlainTextError(mysql_error(&gMysql)); }//CreatetMonth()
<?php $useragent = isset( $_SERVER['HTTP_USER_AGENT'] ) ? $_SERVER['HTTP_USER_AGENT'] : ""; $mobble_detect = new Mobile_Detect(); $mobble_detect->setDetectionType( 'extended' ); function is_iphone() { global $mobble_detect; return $mobble_detect->isIphone(); } function is_ipad() { global $mobble_detect; return $mobble_detect->isIpad(); } function is_ipod() { global $mobble_detect; return $mobble_detect->is( 'iPod' ); } function is_android() { global $mobble_detect; return $mobble_detect->isAndroidOS(); } function is_blackberry() { global $mobble_detect; return $mobble_detect->isBlackBerry(); } function is_opera_mobile() { global $mobble_detect; return $mobble_detect->isOpera(); } function is_palm() { <API key>( 'is_palm', '1.2', 'is_webos' ); global $mobble_detect; return $mobble_detect->is( 'webOS' ); } function is_webos() { global $mobble_detect; return $mobble_detect->is( 'webOS' ); } function is_symbian() { global $mobble_detect; return $mobble_detect->is( 'Symbian' ); } function is_windows_mobile() { global $mobble_detect; return $mobble_detect->is( 'WindowsMobileOS' ) || $mobble_detect->is( 'WindowsPhoneOS' ); } function is_lg() { <API key>( 'is_lg', '1.2' ); global $useragent; return preg_match( '/LG/i', $useragent ); } function is_motorola() { global $mobble_detect; return $mobble_detect->is( 'Motorola' ); } function is_nokia() { <API key>( 'is_nokia', '1.2' ); global $useragent; return preg_match( '/Series60/i', $useragent ) || preg_match( '/Symbian/i', $useragent ) || preg_match( '/Nokia/i', $useragent ); } function is_samsung() { global $mobble_detect; return $mobble_detect->is( 'Samsung' ); } function <API key>() { <API key>( '<API key>', '1.2', 'is_samsung_tablet' ); return is_samsung_tablet(); } function is_samsung_tablet() { global $mobble_detect; return $mobble_detect->is( 'SamsungTablet' ); } function is_kindle() { global $mobble_detect; return $mobble_detect->is( 'Kindle' ); } function is_sony_ericsson() { global $mobble_detect; return $mobble_detect->is( 'Sony' ); } function is_nintendo() { global $useragent; return preg_match( '/Nintendo DSi/i', $useragent ) || preg_match( '/Nintendo DS/i', $useragent ); } function is_smartphone() { global $mobble_detect; $grade = $mobble_detect->mobileGrade(); if ( $grade == 'A' || $grade == 'B' ) { return true; } else { return false; } } function is_handheld() { return is_mobile() || is_iphone() || is_ipad() || is_ipod() || is_android() || is_blackberry() || is_opera_mobile() || is_webos() || is_symbian() || is_windows_mobile() || is_motorola() || is_samsung() || is_samsung_tablet() || is_sony_ericsson() || is_nintendo(); } function is_mobile() { global $mobble_detect; if ( is_tablet() ) return false; return $mobble_detect->isMobile(); } function is_ios() { global $mobble_detect; return $mobble_detect->isiOS(); } function is_tablet() { global $mobble_detect; return $mobble_detect->isTablet(); } <API key>( __FILE__, 'mobble_defaults' ); function mobble_defaults() { $tmp = get_option( 'mobble_body_class' ); if ( ! $tmp ) { update_option( 'mobble_body_class', 1 ); } } <API key>( __FILE__, 'mobble_clean' ); function mobble_clean() { delete_option( 'mobble_body_class' ); } if ( is_admin() ) { add_action( 'admin_menu', 'mobble_menu' ); add_action( 'admin_init', '<API key>' ); } function mobble_menu() { add_options_page( 'mobble', 'mobble', 'administrator', __FILE__, 'mobble_settings' ); } function mobble_settings() { define( 'MOBBLE_IMAGES_URL', plugins_url( '/', __FILE__ ) ); ?> <!-- flattr js --> <script type="text/javascript"> /* <![CDATA[ */ (function() { var s = document.createElement('script'), t = document.<API key>('script')[0]; s.type = 'text/javascript'; s.async = true; s.src = 'http://api.flattr.com/js/0.6/load.js?mode=auto'; t.parentNode.insertBefore(s, t); })(); </script> <style type="text/css"> .FlattrButton { position: relative; top: 3px !important; } .scottsweb-credit { padding: 10px 10px 10px 10px; background: #fff; border-bottom: 1px solid #e3e3e3; overflow: hidden; -<API key>: 5px; -moz-border-radius: 5px; -khtml-border-radius: 5px; border-radius: 5px; } .scottsweb-credit img { float: left; padding: 10px 11px 10px 5px; margin: 5px 5px 0 0; border-right: 1px solid #aaaaaa; } .scottsweb-credit p { float: left; padding: 5px 0; margin: 0 0 0 8px;} </style> <div class="wrap"> <div class="icon32" id="<API key>"></div> <h2>mobble</h2> <form method="post" action="options.php"> <?php settings_fields( '<API key>' ); ?> <table class="form-table"> <tr valign="top"> <th scope="row"><?php _e( 'Mobify body class?', 'mobble' ); ?></th> <td><label for="users_can_register"><input name="mobble_body_class" type="checkbox" id="mobble_body_class" value="1" <?php echo checked( 1, get_option( 'mobble_body_class' ), false ); ?> /><?php _e( '&nbsp;Add mobile information to your theme body class? e.g. &lt;body class="handheld android tablet"&gt;', 'mobble' ); ?></label> </td> </tr> </table> <p class="submit"> <input type="submit" class="button-primary" value="<?php _e( 'Save Changes', 'mobble' ) ?>" /> </p> </form> <div class="scottsweb-credit"> <a href="http://scott.ee" title="Scott Evans - Web Designer &amp; WordPress developer"><img src="<?php echo MOBBLE_URL; ?>/scott.ee.png" alt="scott logo"/></a> <p>Developed by <a href="http: </div> </div> <?php } function <API key>() { register_setting( '<API key>', 'mobble_body_class' ); } if ( ! is_admin() && get_option( 'mobble_body_class' ) ) { add_filter( 'body_class', 'mobble_body_class' ); } function mobble_body_class( $classes ) { global $is_lynx, $is_gecko, $is_IE, $is_opera, $is_NS4, $is_safari, $is_chrome, $mobble_detect; // top level if ( is_handheld() ) { $classes[] = "handheld"; }; if ( is_mobile() ) { $classes[] = "mobile"; }; if ( is_ios() ) { $classes[] = "ios"; }; if ( is_tablet() ) { $classes[] = "tablet"; }; // specific if ( is_iphone() ) { $classes[] = "iphone"; }; if ( is_ipad() ) { $classes[] = "ipad"; }; if ( is_ipod() ) { $classes[] = "ipod"; }; if ( is_android() ) { $classes[] = "android"; }; if ( is_blackberry() ) { $classes[] = "blackberry"; }; if ( is_opera_mobile() ) { $classes[] = "opera-mobile";} if ( is_webos() ) { $classes[] = "webos";} if ( is_symbian() ) { $classes[] = "symbian";} if ( is_windows_mobile() ) { $classes[] = "windows-mobile"; } //if (is_lg()) { $classes[] = "lg"; } if ( is_motorola() ) { $classes[] = "motorola"; } //if (is_smartphone()) { $classes[] = "smartphone"; } //if (is_nokia()) { $classes[] = "nokia"; } if ( is_samsung() ) { $classes[] = "samsung"; } if ( is_samsung_tablet() ) { $classes[] = "samsung-tablet"; } if ( is_sony_ericsson() ) { $classes[] = "sony-ericsson"; } if ( is_nintendo() ) { $classes[] = "nintendo"; } // bonus if ( ! is_handheld() ) { $classes[] = "desktop"; } if ( $is_lynx ) { $classes[] = "lynx"; } if ( $is_gecko ) { $classes[] = "gecko"; } if ( $mobble_detect->is( 'Gecko' ) ) { $classes[] = "gecko"; } if ( $is_opera ) { $classes[] = "opera"; } if ( $mobble_detect->is( 'Opera' ) ) { $classes[] = "opera"; } if ( $is_NS4 ) { $classes[] = "ns4"; } if ( $is_safari ) { $classes[] = "safari"; } if ( $mobble_detect->is( 'Safari' ) ) { $classes[] = "safari"; } if ( $is_chrome ) { $classes[] = "chrome"; } if ( $mobble_detect->is( 'Chrome' ) ) { $classes[] = "chrome"; } if ( $is_IE ) { $classes[] = "ie"; } if ( $mobble_detect->is( 'IE' ) ) { $classes[] = "ie"; } return $classes; } /* fin */
<div class="container" id="mainContent"> <div id="topOfPage"> </div> <h1> Add New Feedback Session </h1> <br> <div class="well well-plain"> <form action="/page/<API key>" class="form-group" id="<API key>" method="post"> <div class="row"> <h4 class="label-control col-md-2 text-md"> Create new </h4> <div class="col-md-5"> <div class="col-xs-10 tablet-no-padding" data-original-title="Select a session type here." data-placement="top" data-toggle="tooltip" title=""> <select class="form-control" id="sessionTemplateType" name="sessionTemplateType"> <option value="STANDARD"> session with my own questions </option> <option selected="" value="TEAMEVALUATION"> session using template: team peer evaluation </option> </select> </div> <div class="col-xs-1"> <h5> <a href="/instructorHelp.jsp#session-setup" rel="noopener noreferrer" target="_blank"> <span class="glyphicon glyphicon-info-sign"> </span> </a> </h5> </div> </div> <h4 class="label-control col-xs-12 col-md-1 text-md"> Or: </h4> <div class="col-xs-12 col-md-3"> <a class="btn btn-info" id="button_copy" style="vertical-align:middle;"> Copy from previous feedback sessions </a> </div> </div> <br> <div class="panel panel-primary"> <div class="panel-body"> <div class="row"> <div class="col-sm-12 col-md-6" data-original-title="Please select the course for which the feedback session is to be created." data-placement="top" data-toggle="tooltip" title=""> <div class="form-group"> <h5 class="col-sm-2 col-md-4"> <label class="control-label" for="courseid"> Course ID </label> </h5> <div class="col-sm-10 col-md-8"> <select class="form-control" id="courseid" name="courseid"> <option value="CFeedbackUiT.CS1101"> CFeedbackUiT.CS1101 </option> <option value="CFeedbackUiT.CS2104"> CFeedbackUiT.CS2104 </option> </select> </div> </div> </div> <div class="col-sm-12 col-md-6 <API key>" data-original-title="To change this, edit the course settings. <br><br>TEAMMATES automatically adjusts to match the current time offset in your area, including clock changes due to daylight saving time." data-placement="top" data-toggle="tooltip" title=""> <div class="form-group"> <h5 class="col-sm-2 col-md-4"> <label class="control-label" for="timezone"> Time Zone </label> </h5> <div class="col-sm-10 col-md-8"> <h5 class="form-control-static font-weight-normal" data-time-zone="" id="timezone"> Africa/Johannesburg </h5> </div> </div> </div> </div> <br class="hidden-xs"> <div class="row"> <div class="col-sm-12 col-md-6"> <div class="form-group"> <h5 class="col-sm-2 col-md-4"> <label class="control-label" for="coursename"> Course name </label> </h5> <div class="col-sm-10 col-md-8"> <input class="<API key>" data-name="Programming Methodology" data-time-zone="Africa/Johannesburg" id="CFeedbackUiT.CS1101" type="hidden"> <input class="<API key>" data-name="Programming Language Concepts" data-time-zone="UTC" id="CFeedbackUiT.CS2104" type="hidden"> <h5 class="form-control-static font-weight-normal" id="coursename"> Programming Methodology </h5> </div> </div> </div> </div> <br class="hidden-xs"> <div class="row"> <div class="col-sm-12 col-md-6" data-original-title="Enter the name of the feedback session e.g. Feedback Session 1." data-placement="top" data-toggle="tooltip" title=""> <div class="form-group"> <h5 class="col-sm-2 col-md-4"> <label class="control-label" for="fsname"> Session name </label> </h5> <div class="col-sm-10 col-md-8"> <input class="form-control" id="fsname" maxlength="38" name="fsname" placeholder="e.g. Feedback for Project Presentation 1" type="text" value=""> <div> <span id="charLeft-fsname"> 38 </span> characters left </div> </div> </div> </div> </div> <br class="hidden-xs"> <div class="row" id="instructionsRow"> <div class="col-sm-12" data-original-title="Enter instructions for this feedback session. e.g. Avoid comments which are too critical.<br> It will be displayed at the top of the page when users respond to the session." data-placement="top" data-toggle="tooltip" title=""> <div class="form-group"> <h5 class="col-sm-2 margin-top-0"> <label class="control-label" for="instructions"> Instructions </label> </h5> <div class="col-sm-10"> <div class="panel panel-default panel-body mce-content-body content-editor" contenteditable="true" id="instructions" spellcheck="false" style="position: relative;"> <p> Please answer all the given questions. </p> </div> <input name="instructions" type="hidden"> </div> </div> </div> </div> </div> </div> <div class="panel panel-primary" id="timeFramePanel"> <div class="panel-body"> <div class="row"> <div class="col-md-5" data-original-title="Please select the date and time for which users can start submitting responses for the feedback session." data-placement="top" data-toggle="tooltip" title=""> <div class="row"> <div class="col-xs-12"> <label class="label-control" for="startdate"> Submission opening time </label> </div> </div> <div class="row"> <div class="col-xs-6"> <input class="form-control col-sm-2 hasDatepicker" id="startdate" name="startdate" placeholder="Date" type="text" value=""> </div> <div class="col-xs-6"> <select class="form-control" id="starttime" name="starttime"> <option value="1"> 0100H </option> <option value="2"> 0200H </option> <option value="3"> 0300H </option> <option value="4"> 0400H </option> <option value="5"> 0500H </option> <option value="6"> 0600H </option> <option value="7"> 0700H </option> <option value="8"> 0800H </option> <option value="9"> 0900H </option> <option value="10"> 1000H </option> <option value="11"> 1100H </option> <option value="12"> 1200H </option> <option value="13"> 1300H </option> <option value="14"> 1400H </option> <option value="15"> 1500H </option> <option value="16"> 1600H </option> <option value="17"> 1700H </option> <option value="18"> 1800H </option> <option value="19"> 1900H </option> <option value="20"> 2000H </option> <option value="21"> 2100H </option> <option value="22"> 2200H </option> <option value="23"> 2300H </option> <option selected="" value="24"> 2359H </option> </select> </div> </div> </div> <div class="col-md-5 border-left-gray" data-original-title="Please select the date and time after which the feedback session will no longer accept submissions from users." data-placement="top" data-toggle="tooltip" title=""> <div class="row"> <div class="col-xs-12"> <label class="label-control" for="enddate"> Submission closing time </label> </div> </div> <div class="row"> <div class="col-xs-6"> <input class="form-control col-sm-2 hasDatepicker" id="enddate" name="enddate" placeholder="Date" type="text" value=""> </div> <div class="col-xs-6"> <select class="form-control" id="endtime" name="endtime"> <option value="1"> 0100H </option> <option value="2"> 0200H </option> <option value="3"> 0300H </option> <option value="4"> 0400H </option> <option value="5"> 0500H </option> <option value="6"> 0600H </option> <option value="7"> 0700H </option> <option value="8"> 0800H </option> <option value="9"> 0900H </option> <option value="10"> 1000H </option> <option value="11"> 1100H </option> <option value="12"> 1200H </option> <option value="13"> 1300H </option> <option value="14"> 1400H </option> <option value="15"> 1500H </option> <option value="16"> 1600H </option> <option value="17"> 1700H </option> <option value="18"> 1800H </option> <option value="19"> 1900H </option> <option value="20"> 2000H </option> <option value="21"> 2100H </option> <option value="22"> 2200H </option> <option value="23"> 2300H </option> <option selected="" value="24"> 2359H </option> </select> </div> </div> </div> <div class="col-md-2 border-left-gray" data-original-title="Please select the amount of time that the system will continue accepting <br>submissions after the specified deadline." data-placement="top" data-toggle="tooltip" title=""> <div class="row"> <div class="col-xs-12"> <label class="control-label" for="graceperiod"> Grace period </label> </div> </div> <div class="row"> <div class="col-xs-12"> <select class="form-control" id="graceperiod" name="graceperiod"> <option value="0"> 0 mins </option> <option value="5"> 5 mins </option> <option value="10"> 10 mins </option> <option selected="" value="15"> 15 mins </option> <option value="20"> 20 mins </option> <option value="25"> 25 mins </option> <option value="30"> 30 mins </option> </select> </div> </div> </div> </div> </div> </div> <div id="<API key>"> <div class="panel panel-primary" id="<API key>" style="display:none;"> <div class="panel-body"> <div class="row"> <div class="col-xs-12 col-md-6"> <div class="row"> <div class="col-xs-12" data-original-title="Please select when you want the questions for the feedback session to be visible to users who need to participate. Note that users cannot submit their responses until the submissions opening time set below." data-placement="top" data-toggle="tooltip" title=""> <label class="label-control"> Make session visible </label> </div> </div> <div class="row radio"> <h5 class="col-xs-2" data-original-title="Select this option to enter in a custom date and time for which the feedback session will become visible.<br>Note that you can make a session visible before it is open for submissions so that users can preview the questions." data-placement="top" data-toggle="tooltip" title=""> <label for="<API key>"> At </label> <input id="<API key>" name="<API key>" type="radio" value="custom"> </h5> <div class="col-xs-5"> <input class="form-control col-sm-2 hasDatepicker" disabled="" id="visibledate" name="visibledate" type="text" value=""> </div> <div class="col-xs-5"> <select class="form-control" disabled="" id="visibletime" name="visibletime"> <option value="1"> 0100H </option> <option value="2"> 0200H </option> <option value="3"> 0300H </option> <option value="4"> 0400H </option> <option value="5"> 0500H </option> <option value="6"> 0600H </option> <option value="7"> 0700H </option> <option value="8"> 0800H </option> <option value="9"> 0900H </option> <option value="10"> 1000H </option> <option value="11"> 1100H </option> <option value="12"> 1200H </option> <option value="13"> 1300H </option> <option value="14"> 1400H </option> <option value="15"> 1500H </option> <option value="16"> 1600H </option> <option value="17"> 1700H </option> <option value="18"> 1800H </option> <option value="19"> 1900H </option> <option value="20"> 2000H </option> <option value="21"> 2100H </option> <option value="22"> 2200H </option> <option value="23"> 2300H </option> <option selected="" value="24"> 2359H </option> </select> </div> </div> <div class="row radio"> <div class="col-xs-12" data-original-title="Select this option to have the feedback session become visible when it is open for submissions (as selected above)." data-placement="top" data-toggle="tooltip" title=""> <label for="<API key>"> Submission opening time </label> <input checked="" id="<API key>" name="<API key>" type="radio" value="atopen"> </div> </div> </div> <div class="col-xs-12 col-md-6 border-left-gray" id="<API key>"> <div class="row"> <div class="col-xs-12" data-original-title="Please select when the responses for the feedback session will be visible to the designated recipients.<br>You can select the response visibility for each type of user and question later." data-placement="top" data-toggle="tooltip" title=""> <label class="label-control"> Make responses visible </label> </div> </div> <div class="row radio"> <h5 class="col-xs-2" data-original-title="Select this option to use a custom time for when the responses of the feedback session<br>will be visible to the designated recipients." data-placement="top" data-toggle="tooltip" title=""> <label for="<API key>"> At </label> <input id="<API key>" name="<API key>" type="radio" value="custom"> </h5> <div class="col-xs-5"> <input class="form-control hasDatepicker" disabled="" id="publishdate" name="publishdate" type="text" value=""> </div> <div class="col-xs-5"> <select class="form-control" data-original-title="Select this option to enter in a custom date and time for which</br>the responses for this feedback session will become visible." data-placement="top" data-toggle="tooltip" disabled="" id="publishtime" name="publishtime" title=""> <option value="1"> 0100H </option> <option value="2"> 0200H </option> <option value="3"> 0300H </option> <option value="4"> 0400H </option> <option value="5"> 0500H </option> <option value="6"> 0600H </option> <option value="7"> 0700H </option> <option value="8"> 0800H </option> <option value="9"> 0900H </option> <option value="10"> 1000H </option> <option value="11"> 1100H </option> <option value="12"> 1200H </option> <option value="13"> 1300H </option> <option value="14"> 1400H </option> <option value="15"> 1500H </option> <option value="16"> 1600H </option> <option value="17"> 1700H </option> <option value="18"> 1800H </option> <option value="19"> 1900H </option> <option value="20"> 2000H </option> <option value="21"> 2100H </option> <option value="22"> 2200H </option> <option value="23"> 2300H </option> <option selected="" value="24"> 2359H </option> </select> </div> </div> <div class="row radio"> <div class="col-xs-12" data-original-title="Select this option to have the feedback responses be immediately visible<br>when the session becomes visible to users." data-placement="top" data-toggle="tooltip" title=""> <label for="<API key>"> Immediately </label> <input id="<API key>" name="<API key>" type="radio" value="atvisible"> </div> </div> <div class="row radio"> <div class="col-xs-12" data-original-title="Select this option if you intend to manually publish the responses for this session later on." data-placement="top" data-toggle="tooltip" title=""> <label for="<API key>"> Not now (publish manually) </label> <input checked="" id="<API key>" name="<API key>" type="radio" value="later"> </div> </div> </div> </div> </div> </div> <div class="panel panel-primary" id="sendEmailsForPanel" style="display:none;"> <div class="panel-body"> <div class="row"> <div class="col-md-12"> <label class="control-label"> Send emails for </label> </div> </div> <div class="row"> <div class="col-md-3" data-original-title="Select this option to automatically send an email to students to notify them when the session is open for submission." data-placement="top" data-toggle="tooltip" title=""> <div class="checkbox"> <label> Session opening reminder </label> <input checked="" disabled="" id="<API key>" name="sendreminderemail" type="checkbox" value="FEEDBACK_OPENING"> </div> </div> <div class="col-md-3" data-original-title="Select this option to automatically send an email to students to remind them to submit 24 hours before the end of the session." data-placement="top" data-toggle="tooltip" title=""> <div class="checkbox"> <label for="<API key>"> Session closing reminder </label> <input checked="" id="<API key>" name="sendreminderemail" type="checkbox" value="FEEDBACK_CLOSING"> </div> </div> <div class="col-md-4" data-original-title="Select this option to automatically send an email to students to notify them when the session results is published." data-placement="top" data-toggle="tooltip" title=""> <div class="checkbox"> <label for="<API key>"> Results published announcement </label> <input checked="" id="<API key>" name="sendreminderemail" type="checkbox" value="FEEDBACK_PUBLISHED"> </div> </div> </div> </div> </div> <div class="margin-bottom-15px text-muted" id="<API key>"> <span id="<API key>"> Session is visible at submission opening time, responses are only visible when you publish the results. </span> <a class="<API key> enable-edit-fs" data-done="[Done]" data-edit="[Edit]" id="<API key>"> [Change] </a> </div> <div class="margin-bottom-15px text-muted" id="<API key>"> <span id="<API key>"> Emails are sent when session opens (within 15 mins), 24 hrs before session closes and when results are published. </span> <a class="<API key> enable-edit-fs" data-done="[Done]" data-edit="[Edit]" id="<API key>"> [Change] </a> </div> </div> <div class="form-group"> <div class="row"> <div class="col-md-offset-5 col-md-3"> <button class="btn btn-primary" id="button_submit" type="submit"> Create Feedback Session </button> </div> </div> </div> <input name="user" type="hidden" value="CFeedbackUiT.instructor"> <input name="token" type="hidden" value="${sessionToken}"> </form> </div> <form action="/page/<API key>" class="ajaxForSessionsForm" id="ajaxForSessions" style="display:none;"> <input name="user" type="hidden" value="CFeedbackUiT.instructor"> <input name="isusingAjax" type="hidden" value="on"> </form> <br> <div id="<API key>" style="display: block;"> <div class="overflow-auto alert alert-success icon-success statusMessage"> The feedback session has been unpublished. </div> </div> <script defer="" src="/js/statusMessage.js" type="text/javascript"> </script> <br> <div class="" id="sessionList"> <table class="table-responsive table table-striped table-bordered" id="table-sessions"> <thead> <tr class="fill-primary"> <th class="<API key> <API key> toggle-sort" id="button_sortid"> Course ID <span class="icon-sort unsorted"> </span> </th> <th class="button-sort-none <API key> toggle-sort" id="button_sortname"> Session Name <span class="icon-sort unsorted"> </span> </th> <th> Submissions </th> <th> Responses </th> <th> <span class="tool-tip-decorate" data-original-title="Number of students submitted / Class size" data-placement="top" data-toggle="tooltip" title=""> Response Rate </span> </th> <th class="no-print"> Action(s) </th> </tr> </thead> <tbody> <tr class="sessionsRow" id="session0"> <td> CFeedbackUiT.CS2104 </td> <td> Awaiting Session </td> <td> <span class="tool-tip-decorate" data-original-title="The feedback session has been created, is visible, and is waiting to open." data-placement="top" data-toggle="tooltip" title=""> Awaiting </span> </td> <td> <span class="tool-tip-decorate" data-original-title="The responses for this session are not visible." data-placement="top" data-toggle="tooltip" title=""> Not Published </span> </td> <td class="<API key>"> <a href="/page/<API key>?courseid=CFeedbackUiT.CS2104&fsname=Awaiting+Session+%23&user=CFeedbackUiT.instructor" oncontextmenu="return false;"> Show </a> </td> <td class="no-print"> <a class="btn btn-default btn-xs btn-tm-actions <API key> margin-bottom-7px" data-original-title="Edit feedback session details" data-placement="top" data-toggle="tooltip" href="/page/<API key>?courseid=CFeedbackUiT.CS2104&fsname=Awaiting+Session+%23&editsessiondetails=true&user=CFeedbackUiT.instructor" title=""> Edit </a> <a class="btn btn-default btn-xs btn-tm-actions session-delete margin-bottom-7px" data-courseid="CFeedbackUiT.CS2104" data-fsname="Awaiting Session #" data-original-title="Delete the feedback session" data-placement="top" data-toggle="tooltip" href="/page/<API key>?courseid=CFeedbackUiT.CS2104&fsname=Awaiting+Session+%23&next=%2Fpage%<API key>&user=CFeedbackUiT.instructor&token=${sessionToken}" title=""> Delete </a> <div data-original-title="Copy feedback session details" data-placement="top" data-toggle="tooltip" style="display: inline-block; padding-right: 5px;" title=""> <a class="btn btn-default btn-xs btn-tm-actions <API key> margin-bottom-7px" data-actionlink="/page/<API key>?user=CFeedbackUiT.instructor" data-courseid="CFeedbackUiT.CS2104" data-fsname="Awaiting Session #" data-target="#fsCopyModal" data-toggle="modal" href="javascript:;" id="<API key>.CS2104-Awaiting Session #"> Copy </a> </div> <div data-original-title="Start submitting feedback" data-placement="top" data-toggle="tooltip" style="display: inline-block; padding-right: 5px;" title=""> <a class="btn btn-default btn-xs btn-tm-actions <API key> margin-bottom-7px" href="/page/<API key>?courseid=CFeedbackUiT.CS2104&fsname=Awaiting+Session+%23&user=CFeedbackUiT.instructor"> Submit </a> </div> <div data-original-title="View the submitted responses for this feedback session" data-placement="top" data-toggle="tooltip" style="display: inline-block; padding-right: 5px;" title=""> <div class="btn-group margin-bottom-7px"> <a class="btn btn-default btn-xs btn-tm-actions <API key>" href="/page/<API key>?courseid=CFeedbackUiT.CS2104&fsname=Awaiting+Session+%23&user=CFeedbackUiT.instructor"> Results </a> <button aria-expanded="false" class="btn btn-default btn-xs btn-tm-actions dropdown-toggle <API key>" data-toggle="dropdown" disabled="" type="button"> <span class="caret"> </span> </button> <ul class="dropdown-menu" role="menu"> <li> <a class="<API key>" href="/page/<API key>?courseid=CFeedbackUiT.CS2104&fsname=Awaiting+Session+%23&user=CFeedbackUiT.instructor"> View Results </a> </li> <li> <a class="<API key> disabled" data-fsname="Awaiting Session #" <API key>="true" href="javascript:;"> Publish Results </a> </li> <li> <a> <form action="/page/<API key>" method="post"> <input class="btn-tm-actions <API key>" name="fruploaddownloadbtn" style="border: none; padding: 0; background: none;" type="submit" value="Download Results"> <input name="user" type="hidden" value="CFeedbackUiT.instructor"> <input name="fsname" type="hidden" value="Awaiting Session <input name="courseid" type="hidden" value="CFeedbackUiT.CS2104"> <input name="frshowstats" type="hidden" value="true"> <input name="<API key>" type="hidden" value="true"> </form> </a> </li> </ul> </div> </div> <div data-original-title="Send e-mails to remind students and instructors who have not submitted their feedbacks to do so" data-placement="top" data-toggle="tooltip" style="display: inline-block; padding-right: 5px;" title=""> <div class="btn-group margin-bottom-7px"> <a class="btn btn-default btn-xs btn-tm-actions <API key> disabled" data-fsname="Awaiting Session #" href="javascript:;"> Remind </a> <button aria-expanded="false" class="btn btn-default btn-xs btn-tm-actions dropdown-toggle <API key>" data-toggle="dropdown" disabled="" type="button"> <span class="caret"> </span> </button> <ul class="dropdown-menu" role="menu"> <li> <a class="<API key>" data-fsname="Awaiting Session #" href="/page/<API key>?courseid=CFeedbackUiT.CS2104&fsname=Awaiting+Session+%23&next=%2Fpage%<API key>&user=CFeedbackUiT.instructor&token=${sessionToken}"> Remind all students </a> </li> <li> <a class="<API key>" data-actionlink="/page/<API key>?courseid=CFeedbackUiT.CS2104&fsname=Awaiting+Session+%23&user=CFeedbackUiT.instructor" data-courseid="CFeedbackUiT.CS2104" data-fsname="Awaiting Session #" data-target="#remindModal" data-toggle="modal" href="javascript:;"> Remind particular students </a> </li> </ul> </div> </div> </td> </tr> <tr class="sessionsRow" id="session1"> <td> CFeedbackUiT.CS1101 </td> <td> Open Session </td> <td> <span class="tool-tip-decorate" data-original-title="The feedback session has been created, is visible, and is open for submissions." data-placement="top" data-toggle="tooltip" title=""> Open </span> </td> <td> <span class="tool-tip-decorate" data-original-title="The responses for this session are not visible." data-placement="top" data-toggle="tooltip" title=""> Not Published </span> </td> <td class="<API key>"> <a href="/page/<API key>?courseid=CFeedbackUiT.CS1101&fsname=Open+Session+%23&user=CFeedbackUiT.instructor" oncontextmenu="return false;"> Show </a> </td> <td class="no-print"> <a class="btn btn-default btn-xs btn-tm-actions <API key> margin-bottom-7px" data-original-title="Edit feedback session details" data-placement="top" data-toggle="tooltip" href="/page/<API key>?courseid=CFeedbackUiT.CS1101&fsname=Open+Session+%23&editsessiondetails=true&user=CFeedbackUiT.instructor" title=""> Edit </a> <a class="btn btn-default btn-xs btn-tm-actions session-delete margin-bottom-7px" data-courseid="CFeedbackUiT.CS1101" data-fsname="Open Session #" data-original-title="Delete the feedback session" data-placement="top" data-toggle="tooltip" href="/page/<API key>?courseid=CFeedbackUiT.CS1101&fsname=Open+Session+%23&next=%2Fpage%<API key>&user=CFeedbackUiT.instructor&token=${sessionToken}" title=""> Delete </a> <div data-original-title="Copy feedback session details" data-placement="top" data-toggle="tooltip" style="display: inline-block; padding-right: 5px;" title=""> <a class="btn btn-default btn-xs btn-tm-actions <API key> margin-bottom-7px" data-actionlink="/page/<API key>?user=CFeedbackUiT.instructor" data-courseid="CFeedbackUiT.CS1101" data-fsname="Open Session #" data-target="#fsCopyModal" data-toggle="modal" href="javascript:;" id="<API key>.CS1101-Open Session #"> Copy </a> </div> <div data-original-title="Start submitting feedback" data-placement="top" data-toggle="tooltip" style="display: inline-block; padding-right: 5px;" title=""> <a class="btn btn-default btn-xs btn-tm-actions <API key> margin-bottom-7px" href="/page/<API key>?courseid=CFeedbackUiT.CS1101&fsname=Open+Session+%23&user=CFeedbackUiT.instructor"> Submit </a> </div> <div data-original-title="View the submitted responses for this feedback session" data-placement="top" data-toggle="tooltip" style="display: inline-block; padding-right: 5px;" title=""> <div class="btn-group margin-bottom-7px"> <a class="btn btn-default btn-xs btn-tm-actions <API key>" href="/page/<API key>?courseid=CFeedbackUiT.CS1101&fsname=Open+Session+%23&user=CFeedbackUiT.instructor"> Results </a> <button aria-expanded="false" class="btn btn-default btn-xs btn-tm-actions dropdown-toggle <API key>" data-toggle="dropdown" type="button"> <span class="caret"> </span> </button> <ul class="dropdown-menu" role="menu"> <li> <a class="<API key>" href="/page/<API key>?courseid=CFeedbackUiT.CS1101&fsname=Open+Session+%23&user=CFeedbackUiT.instructor"> View Results </a> </li> <li> <a class="<API key>" data-fsname="Open Session #" <API key>="true" href="/page/<API key>?courseid=CFeedbackUiT.CS1101&fsname=Open+Session+%23&next=%2Fpage%<API key>&user=CFeedbackUiT.instructor&token=${sessionToken}"> Publish Results </a> </li> <li> <a> <form action="/page/<API key>" method="post"> <input class="btn-tm-actions <API key>" name="fruploaddownloadbtn" style="border: none; padding: 0; background: none;" type="submit" value="Download Results"> <input name="user" type="hidden" value="CFeedbackUiT.instructor"> <input name="fsname" type="hidden" value="Open Session <input name="courseid" type="hidden" value="CFeedbackUiT.CS1101"> <input name="frshowstats" type="hidden" value="true"> <input name="<API key>" type="hidden" value="true"> </form> </a> </li> </ul> </div> </div> <div data-original-title="Send e-mails to remind students and instructors who have not submitted their feedbacks to do so" data-placement="top" data-toggle="tooltip" style="display: inline-block; padding-right: 5px;" title=""> <div class="btn-group margin-bottom-7px"> <a class="btn btn-default btn-xs btn-tm-actions <API key>" data-fsname="Open Session #" href="/page/<API key>?courseid=CFeedbackUiT.CS1101&fsname=Open+Session+%23&next=%2Fpage%<API key>&user=CFeedbackUiT.instructor&token=${sessionToken}"> Remind </a> <button aria-expanded="false" class="btn btn-default btn-xs btn-tm-actions dropdown-toggle <API key>" data-toggle="dropdown" type="button"> <span class="caret"> </span> </button> <ul class="dropdown-menu" role="menu"> <li> <a class="<API key>" data-fsname="Open Session #" href="/page/<API key>?courseid=CFeedbackUiT.CS1101&fsname=Open+Session+%23&next=%2Fpage%<API key>&user=CFeedbackUiT.instructor&token=${sessionToken}"> Remind all students </a> </li> <li> <a class="<API key>" data-actionlink="/page/<API key>?courseid=CFeedbackUiT.CS1101&fsname=Open+Session+%23&user=CFeedbackUiT.instructor" data-courseid="CFeedbackUiT.CS1101" data-fsname="Open Session #" data-target="#remindModal" data-toggle="modal" href="javascript:;"> Remind particular students </a> </li> </ul> </div> </div> </td> </tr> <tr class="sessionsRow" id="session2"> <td> CFeedbackUiT.CS2104 </td> <td> First Session </td> <td> <span class="tool-tip-decorate" data-original-title="The feedback session has been created, is visible, and has ended." data-placement="top" data-toggle="tooltip" title=""> Closed </span> </td> <td> <span class="tool-tip-decorate" data-original-title="The responses for this session are visible." data-placement="top" data-toggle="tooltip" title=""> Published </span> </td> <td class="<API key>"> <a href="/page/<API key>?courseid=CFeedbackUiT.CS2104&fsname=First+Session+%231&user=CFeedbackUiT.instructor" oncontextmenu="return false;"> Show </a> </td> <td class="no-print"> <a class="btn btn-default btn-xs btn-tm-actions <API key> margin-bottom-7px" data-original-title="Edit feedback session details" data-placement="top" data-toggle="tooltip" href="/page/<API key>?courseid=CFeedbackUiT.CS2104&fsname=First+Session+%231&editsessiondetails=true&user=CFeedbackUiT.instructor" title=""> Edit </a> <a class="btn btn-default btn-xs btn-tm-actions session-delete margin-bottom-7px" data-courseid="CFeedbackUiT.CS2104" data-fsname="First Session #1" data-original-title="Delete the feedback session" data-placement="top" data-toggle="tooltip" href="/page/<API key>?courseid=CFeedbackUiT.CS2104&fsname=First+Session+%231&next=%2Fpage%<API key>&user=CFeedbackUiT.instructor&token=${sessionToken}" title=""> Delete </a> <div data-original-title="Copy feedback session details" data-placement="top" data-toggle="tooltip" style="display: inline-block; padding-right: 5px;" title=""> <a class="btn btn-default btn-xs btn-tm-actions <API key> margin-bottom-7px" data-actionlink="/page/<API key>?user=CFeedbackUiT.instructor" data-courseid="CFeedbackUiT.CS2104" data-fsname="First Session #1" data-target="#fsCopyModal" data-toggle="modal" href="javascript:;" id="<API key>.CS2104-First Session #1"> Copy </a> </div> <div data-original-title="Start submitting feedback" data-placement="top" data-toggle="tooltip" style="display: inline-block; padding-right: 5px;" title=""> <a class="btn btn-default btn-xs btn-tm-actions <API key> margin-bottom-7px disabled" href="javascript:;"> Submit </a> </div> <div data-original-title="View the submitted responses for this feedback session" data-placement="top" data-toggle="tooltip" style="display: inline-block; padding-right: 5px;" title=""> <div class="btn-group margin-bottom-7px"> <a class="btn btn-default btn-xs btn-tm-actions <API key>" href="/page/<API key>?courseid=CFeedbackUiT.CS2104&fsname=First+Session+%231&user=CFeedbackUiT.instructor"> Results </a> <button aria-expanded="false" class="btn btn-default btn-xs btn-tm-actions dropdown-toggle <API key>" data-toggle="dropdown" type="button"> <span class="caret"> </span> </button> <ul class="dropdown-menu" role="menu"> <li> <a class="<API key>" href="/page/<API key>?courseid=CFeedbackUiT.CS2104&fsname=First+Session+%231&user=CFeedbackUiT.instructor"> View Results </a> </li> <li> <a class="<API key>" data-fsname="First Session #1" <API key>="true" href="/page/<API key>?courseid=CFeedbackUiT.CS2104&fsname=First+Session+%231&next=%2Fpage%<API key>&user=CFeedbackUiT.instructor&token=${sessionToken}"> Unpublish Results </a> </li> <li> <a class="<API key>" data-actionlink="/page/<API key>?courseid=CFeedbackUiT.CS2104&fsname=First+Session+%231&user=CFeedbackUiT.instructor" data-courseid="CFeedbackUiT.CS2104" data-fsname="First Session #1" data-target="#<API key>" data-toggle="modal" href="javascript:;"> Resend link to view results </a> </li> <li> <a> <form action="/page/<API key>" method="post"> <input class="btn-tm-actions <API key>" name="fruploaddownloadbtn" style="border: none; padding: 0; background: none;" type="submit" value="Download Results"> <input name="user" type="hidden" value="CFeedbackUiT.instructor"> <input name="fsname" type="hidden" value="First Session <input name="courseid" type="hidden" value="CFeedbackUiT.CS2104"> <input name="frshowstats" type="hidden" value="true"> <input name="<API key>" type="hidden" value="true"> </form> </a> </li> </ul> </div> </div> <div data-original-title="Send e-mails to remind students and instructors who have not submitted their feedbacks to do so" data-placement="top" data-toggle="tooltip" style="display: inline-block; padding-right: 5px;" title=""> <div class="btn-group margin-bottom-7px"> <a class="btn btn-default btn-xs btn-tm-actions <API key> disabled" data-fsname="First Session #1" href="javascript:;"> Remind </a> <button aria-expanded="false" class="btn btn-default btn-xs btn-tm-actions dropdown-toggle <API key>" data-toggle="dropdown" disabled="" type="button"> <span class="caret"> </span> </button> <ul class="dropdown-menu" role="menu"> <li> <a class="<API key>" data-fsname="First Session #1" href="/page/<API key>?courseid=CFeedbackUiT.CS2104&fsname=First+Session+%231&next=%2Fpage%<API key>&user=CFeedbackUiT.instructor&token=${sessionToken}"> Remind all students </a> </li> <li> <a class="<API key>" data-actionlink="/page/<API key>?courseid=CFeedbackUiT.CS2104&fsname=First+Session+%231&user=CFeedbackUiT.instructor" data-courseid="CFeedbackUiT.CS2104" data-fsname="First Session #1" data-target="#remindModal" data-toggle="modal" href="javascript:;"> Remind particular students </a> </li> </ul> </div> </div> </td> </tr> <tr class="sessionsRow" id="session3"> <td> CFeedbackUiT.CS1101 </td> <td> Manual Session </td> <td> <span class="tool-tip-decorate" data-original-title="The feedback session has been created, is visible, and has ended." data-placement="top" data-toggle="tooltip" title=""> Closed </span> </td> <td> <span class="tool-tip-decorate" data-original-title="The responses for this session are not visible." data-placement="top" data-toggle="tooltip" title=""> Not Published </span> </td> <td class="<API key>"> <a href="/page/<API key>?courseid=CFeedbackUiT.CS1101&fsname=Manual+Session+%231&user=CFeedbackUiT.instructor" oncontextmenu="return false;"> Show </a> </td> <td class="no-print"> <a class="btn btn-default btn-xs btn-tm-actions <API key> margin-bottom-7px" data-original-title="Edit feedback session details" data-placement="top" data-toggle="tooltip" href="/page/<API key>?courseid=CFeedbackUiT.CS1101&fsname=Manual+Session+%231&editsessiondetails=true&user=CFeedbackUiT.instructor" title=""> Edit </a> <a class="btn btn-default btn-xs btn-tm-actions session-delete margin-bottom-7px" data-courseid="CFeedbackUiT.CS1101" data-fsname="Manual Session #1" data-original-title="Delete the feedback session" data-placement="top" data-toggle="tooltip" href="/page/<API key>?courseid=CFeedbackUiT.CS1101&fsname=Manual+Session+%231&next=%2Fpage%<API key>&user=CFeedbackUiT.instructor&token=${sessionToken}" title=""> Delete </a> <div data-original-title="Copy feedback session details" data-placement="top" data-toggle="tooltip" style="display: inline-block; padding-right: 5px;" title=""> <a class="btn btn-default btn-xs btn-tm-actions <API key> margin-bottom-7px" data-actionlink="/page/<API key>?user=CFeedbackUiT.instructor" data-courseid="CFeedbackUiT.CS1101" data-fsname="Manual Session #1" data-target="#fsCopyModal" data-toggle="modal" href="javascript:;" id="<API key>.CS1101-Manual Session #1"> Copy </a> </div> <div data-original-title="Start submitting feedback" data-placement="top" data-toggle="tooltip" style="display: inline-block; padding-right: 5px;" title=""> <a class="btn btn-default btn-xs btn-tm-actions <API key> margin-bottom-7px disabled" href="javascript:;"> Submit </a> </div> <div data-original-title="View the submitted responses for this feedback session" data-placement="top" data-toggle="tooltip" style="display: inline-block; padding-right: 5px;" title=""> <div class="btn-group margin-bottom-7px"> <a class="btn btn-default btn-xs btn-tm-actions <API key>" href="/page/<API key>?courseid=CFeedbackUiT.CS1101&fsname=Manual+Session+%231&user=CFeedbackUiT.instructor"> Results </a> <button aria-expanded="false" class="btn btn-default btn-xs btn-tm-actions dropdown-toggle <API key>" data-toggle="dropdown" type="button"> <span class="caret"> </span> </button> <ul class="dropdown-menu" role="menu"> <li> <a class="<API key>" href="/page/<API key>?courseid=CFeedbackUiT.CS1101&fsname=Manual+Session+%231&user=CFeedbackUiT.instructor"> View Results </a> </li> <li> <a class="<API key>" data-fsname="Manual Session #1" <API key>="true" href="/page/<API key>?courseid=CFeedbackUiT.CS1101&fsname=Manual+Session+%231&next=%2Fpage%<API key>&user=CFeedbackUiT.instructor&token=${sessionToken}"> Publish Results </a> </li> <li> <a> <form action="/page/<API key>" method="post"> <input class="btn-tm-actions <API key>" name="fruploaddownloadbtn" style="border: none; padding: 0; background: none;" type="submit" value="Download Results"> <input name="user" type="hidden" value="CFeedbackUiT.instructor"> <input name="fsname" type="hidden" value="Manual Session <input name="courseid" type="hidden" value="CFeedbackUiT.CS1101"> <input name="frshowstats" type="hidden" value="true"> <input name="<API key>" type="hidden" value="true"> </form> </a> </li> </ul> </div> </div> <div data-original-title="Send e-mails to remind students and instructors who have not submitted their feedbacks to do so" data-placement="top" data-toggle="tooltip" style="display: inline-block; padding-right: 5px;" title=""> <div class="btn-group margin-bottom-7px"> <a class="btn btn-default btn-xs btn-tm-actions <API key> disabled" data-fsname="Manual Session #1" href="javascript:;"> Remind </a> <button aria-expanded="false" class="btn btn-default btn-xs btn-tm-actions dropdown-toggle <API key>" data-toggle="dropdown" disabled="" type="button"> <span class="caret"> </span> </button> <ul class="dropdown-menu" role="menu"> <li> <a class="<API key>" data-fsname="Manual Session #1" href="/page/<API key>?courseid=CFeedbackUiT.CS1101&fsname=Manual+Session+%231&next=%2Fpage%<API key>&user=CFeedbackUiT.instructor&token=${sessionToken}"> Remind all students </a> </li> <li> <a class="<API key>" data-actionlink="/page/<API key>?courseid=CFeedbackUiT.CS1101&fsname=Manual+Session+%231&user=CFeedbackUiT.instructor" data-courseid="CFeedbackUiT.CS1101" data-fsname="Manual Session #1" data-target="#remindModal" data-toggle="modal" href="javascript:;"> Remind particular students </a> </li> </ul> </div> </div> </td> </tr> </tbody> </table> <p class="col-md-12 text-muted"> Note: The table above doesn't contain sessions from archived courses and soft-deleted courses. To view sessions from an archived course, unarchive the course first; to view sessions from a soft-deleted course, restore the course first. </p> <br> <br> <br> <br> </div> <div aria-hidden="true" aria-labelledby="remindModal" class="modal fade" id="remindModal" role="dialog" tabindex="-1"> <div class="modal-dialog modal-lg"> <div class="modal-content"> <form action="/page/<API key>?next=%2Fpage%<API key>&token=${sessionToken}" method="post" name="form_remind_list" role="form"> <div class="modal-header"> <button aria-hidden="true" class="close" data-dismiss="modal" type="button"> × </button> <h4 class="modal-title"> Remind Particular Students <small> (Select the student(s) you want to remind) </small> </h4> <div> <input id="remindAll" type="checkbox"> <label class="remind-all" for="remindAll"> Select all respondents </label> <input id="remindNotSubmitted" type="checkbox"> <label for="remindNotSubmitted"> Select all respondents not yet submitted </label> </div> </div> <div class="modal-body"> <div class="form-group" id="studentList"> </div> </div> <div class="modal-footer"> <button class="btn btn-default" data-dismiss="modal" type="button"> Cancel </button> <input class="btn btn-primary <API key>" data-dismiss="modal" type="button" value="Remind"> <input name="user" type="hidden" value="CFeedbackUiT.instructor"> </div> </form> </div> </div> </div> <div aria-hidden="true" aria-labelledby="copyModalTitle" class="modal fade" id="copyModal" role="dialog" tabindex="-1"> <div class="modal-dialog"> <div class="modal-content"> <div class="modal-header"> <button class="close" data-dismiss="modal" type="button"> <span aria-hidden="true"> × </span> <span class="sr-only"> Close </span> </button> <h4 class="modal-title" id="copyModalTitle"> Creating a new session by copying a previous session </h4> </div> <div class="modal-body" id="copySessionsBody"> <form action="/page/<API key>" class="form" id="copyModalForm" method="post" role="form"> <div class="form-group"> <label class="control-label" for="modalCopiedCourseId"> Create in course </label> <select class="form-control" id="modalCopiedCourseId" name="copiedcourseid"> <option value="CFeedbackUiT.CS1101"> CFeedbackUiT.CS1101 </option> <option value="CFeedbackUiT.CS2104"> CFeedbackUiT.CS2104 </option> </select> </div> <div class="form-group"> <label class="control-label" for="<API key>"> Name for new session </label> <input class="form-control" id="<API key>" maxlength="38" name="copiedfsname" placeholder="e.g. Feedback for Project Presentation 1" type="text" value=""> </div> <label> Copy settings and questions from </label> <table class="table-responsive table table-bordered table-hover margin-0" id="copyTableModal"> <thead class="fill-primary"> <tr> <th style="width:20px;"> </th> <th> Course ID </th> <th> Feedback Session Name </th> </tr> </thead> <tbody> <tr style="cursor:pointer;"> <td> <input type="radio"> </td> <td> CFeedbackUiT.CS2104 </td> <td> Awaiting Session </td> </tr> <tr style="cursor:pointer;"> <td> <input type="radio"> </td> <td> CFeedbackUiT.CS1101 </td> <td> Open Session </td> </tr> <tr style="cursor:pointer;"> <td> <input type="radio"> </td> <td> CFeedbackUiT.CS2104 </td> <td> First Session </td> </tr> <tr style="cursor:pointer;"> <td> <input type="radio"> </td> <td> CFeedbackUiT.CS1101 </td> <td> Manual Session </td> </tr> </tbody> </table> <input id="modalSessionName" name="fsname" type="hidden" value=""> <input id="modalCourseId" name="courseid" type="hidden" value=""> <input name="user" type="hidden" value="CFeedbackUiT.instructor"> <input name="token" type="hidden" value="${sessionToken}"> </form> </div> <div class="modal-footer margin-0"> <button class="btn btn-primary" disabled="" id="button_copy_submit" type="button"> Copy </button> <button class="btn btn-default" data-dismiss="modal" type="button"> Cancel </button> </div> </div> </div> </div> <div aria-hidden="true" aria-labelledby="fsCopyModal" class="modal fade" id="fsCopyModal" role="dialog" tabindex="-1"> <div class="modal-dialog"> <div class="modal-content"> <form action="/page/<API key>?next=%2Fpage%<API key>&token=${sessionToken}" id="<API key>" method="post" role="form"> <div class="modal-header"> <button aria-hidden="true" class="close" data-dismiss="modal" type="button"> × </button> <h4 class="modal-title"> Copy this feedback session to other courses <br> <small> (Select the course(s) you want to copy this feedback session to) </small> </h4> </div> <div class="modal-body"> <div class="form-group" id="courseList"> </div> </div> <div class="modal-footer"> <button class="btn btn-default" data-dismiss="modal" type="button"> Cancel </button> <input class="btn btn-primary" id="fscopy_submit" type="submit" value="Copy"> <input name="user" type="hidden" value="CFeedbackUiT.instructor"> </div> </form> </div> </div> </div> <div aria-hidden="true" aria-labelledby="<API key>" class="modal fade" id="<API key>" role="dialog" tabindex="-1"> <div class="modal-dialog modal-lg"> <div class="modal-content"> <form action="/page/<API key>?next=%2Fpage%<API key>&token=${sessionToken}" method="post" name="form_email_list" role="form"> <div class="modal-header"> <button aria-hidden="true" class="close" data-dismiss="modal" type="button"> × </button> <h4 class="modal-title"> Resend Published Email <small> (Select the student(s) you want to resend the published email to) </small> </h4> </div> <div class="modal-body"> <div class="form-group" id="studentEmailList"> </div> </div> <div class="modal-footer"> <button class="btn btn-default" data-dismiss="modal" type="button"> Cancel </button> <input class="btn btn-primary <API key>" data-dismiss="modal" type="button" value="Send"> <input name="user" type="hidden" value="CFeedbackUiT.instructor"> </div> </form> </div> </div> </div> </div>
package accessories.plugins; import freemind.common.<API key>; import freemind.controller.<API key>; import freemind.controller.<API key>; import freemind.controller.actions.generated.instance.*; import freemind.extensions.HookRegistration; import freemind.main.FreeMind; import freemind.main.Resources; import freemind.main.Tools; import freemind.main.Tools.MindMapNodePair; import freemind.modes.MindMap; import freemind.modes.MindMapNode; import freemind.modes.ModeController; import freemind.modes.ModeController.<API key>; import freemind.modes.NodeAdapter; import freemind.modes.mindmapmode.MindMapController; import freemind.modes.mindmapmode.actions.NodeHookAction; import freemind.modes.mindmapmode.actions.xml.ActionFilter; import freemind.modes.mindmapmode.actions.xml.ActionPair; import freemind.modes.mindmapmode.hooks.<API key>; import freemind.view.mindmapview.NodeView; import javax.swing.*; import java.awt.datatransfer.Transferable; import java.util.*; /** * This is the "paste node as clone" action from the menu. * * @author foltin * @date 25.4.2011 */ public class ClonePasteAction extends <API key> { public ClonePasteAction() { } public void invoke(MindMapNode pNode) { super.invoke(pNode); Vector mindMapNodes = getMindMapNodes(); logger.fine("Clones for nodes: " + Tools.listToString(mindMapNodes)); // now, construct the plugin for those nodes: for (Iterator itPastedNodes = mindMapNodes.iterator(); itPastedNodes .hasNext(); ) { MindMapNode copiedNode = (MindMapNode) itPastedNodes.next(); ClonePlugin clonePlugin = ClonePlugin.getHook(copiedNode); // first the clone master if (clonePlugin == null) { int showResult = new <API key>( <API key>().getFrame().getJFrame(), <API key>().getSelectedView(), "choose_clone_type", "clone_type_question", <API key>(), new <API key>.<API key>( <API key>().getController(), FreeMind.<API key>), <API key>.<API key>) .show().getResult(); Properties properties = new Properties(); properties .setProperty( ClonePlugin.<API key>, showResult == JOptionPane.OK_OPTION ? ClonePlugin.CLONE_ITSELF_TRUE : ClonePlugin.CLONE_ITSELF_FALSE); Vector selecteds = Tools.<API key>(copiedNode); <API key>().addHook(copiedNode, selecteds, ClonePlugin.PLUGIN_LABEL, properties); } // finally, we construct a new one: Transferable copy = <API key>().copy(copiedNode, true); addNewClone(copiedNode, pNode, copy); } } public void addNewClone(MindMapNode originalNode, MindMapNode pDestinationNode, Transferable copy) { String originalNodeId = <API key>().getNodeID(originalNode); logger.fine("Original node " + originalNode + ", id " + originalNodeId); if (originalNode.isRoot()) { <API key>().getController().errorMessage( <API key>().getText( "<API key>")); return; } // insert clone: List listOfChilds = pDestinationNode.getChildren(); Vector listOfChildIds = new Vector(); for (Iterator it = listOfChilds.iterator(); it.hasNext(); ) { String nodeID = <API key>().getNodeID( (MindMapNode) it.next()); listOfChildIds.add(nodeID); logger.fine("Old child id:" + nodeID); } <API key>().paste(copy, pDestinationNode); } public Vector getMindMapNodes() { return getRegistration().getMindMapNodes(); } protected Registration getRegistration() { return (Registration) getPluginBaseClass(); } public interface <API key> { void propertiesChanged(CloneProperties pCloneProperties); } public static class CloneProperties { boolean mCloneItself = false; private HashSet mObserverSet = new HashSet(); protected static java.util.logging.Logger logger = null; public CloneProperties() { if (logger == null) { logger = Resources.getInstance().getLogger( this.getClass().getName()); } } public boolean isCloneItself() { return mCloneItself; } public void setCloneItself(boolean pCloneItself) { logger.finest("Setting mCloneItself to " + pCloneItself); boolean fire = false; if (pCloneItself != mCloneItself) { fire = true; } mCloneItself = pCloneItself; if (fire) { <API key>(); } } public void registerObserver(<API key> pObserver) { mObserverSet.add(pObserver); } public void deregisterObserver(<API key> pObserver) { mObserverSet.remove(pObserver); } private void <API key>() { for (Iterator it = mObserverSet.iterator(); it.hasNext(); ) { <API key> observer = (<API key>) it .next(); observer.propertiesChanged(this); } } } public static class Registration implements HookRegistration, <API key>, ActionFilter, <API key> { private static final String PLUGIN_NAME = "accessories/plugins/ClonePasteAction.properties"; private static ImageIcon sCloneIcon; private static ImageIcon sOriginalIcon; private static boolean sShowIcon = true; /** * Mapping of clone id (String) to a HashSet of {@link freemind.modes.MindMapNode}s */ private HashMap mCloneIdsMap = new HashMap(); /** * This is the reverse of mCloneIdsMap: {@link freemind.modes.MindMapNode} to cloneId. */ private HashMap mClonesMap = new HashMap(); /** * This is a storage cloneId to clone properties. */ private HashMap mClonePropertiesMap = new HashMap(); private final MindMapController controller; private final MindMap mMap; private final java.util.logging.Logger logger; private Vector <API key> = new Vector(); public Registration(ModeController controller, MindMap map) { this.controller = (MindMapController) controller; mMap = map; logger = controller.getFrame().getLogger(this.getClass().getName()); } public void register() { if (sCloneIcon == null) { sCloneIcon = new ImageIcon( controller.getResource("images/clone.png")); sOriginalIcon = new ImageIcon( controller.getResource("images/clone_original.png")); sShowIcon = Resources.getInstance().getBoolProperty( FreeMind.<API key>); } controller.getActionFactory().registerFilter(this); controller.<API key>(this, false); } public void deRegister() { controller.<API key>(this); controller.getActionFactory().deregisterFilter(this); } public boolean isEnabled(JMenuItem pItem, Action pAction) { if (controller == null) return false; String hookName = ((NodeHookAction) pAction).getHookName(); if (PLUGIN_NAME.equals(hookName)) { // only enabled, if nodes have been copied before. Vector mindMapNodes = getMindMapNodes(); // logger.warning("Nodes " + Tools.listToString(mindMapNodes)); return !mindMapNodes.isEmpty(); } List selecteds = controller.getSelecteds(); for (Iterator it = selecteds.iterator(); it.hasNext(); ) { MindMapNode node = (MindMapNode) it.next(); if (ClonePlugin.getHook(node) != null) { return true; } } return false; } public Vector getMindMapNodes() { Vector mindMapNodes = new Vector(); Transferable clipboardContents = controller.<API key>(); if (clipboardContents != null) { try { List transferData = (List) clipboardContents .getTransferData(<API key>.copyNodeIdsFlavor); for (Iterator it = transferData.iterator(); it.hasNext(); ) { String nodeId = (String) it.next(); MindMapNode node = controller.getNodeFromID(nodeId); mindMapNodes.add(node); } } catch (Exception e) { // e.printStackTrace(); // freemind.main.Resources.getInstance().logException(e); } } return mindMapNodes; } public String generateNewCloneId(String pProposedID) { return Tools.generateID(pProposedID, mCloneIdsMap, "CLONE_"); } /** * @param pCloneId * @return true, if the pCloneId is new (not already registered) */ public boolean registerClone(String pCloneId, ClonePlugin pPlugin) { boolean vectorPresent = mCloneIdsMap.containsKey(pCloneId); HashSet v = getHashSetToCloneId(pCloneId); MindMapNode node = pPlugin.getNode(); for (Iterator it = v.iterator(); it.hasNext(); ) { MindMapNode otherCloneNode = (MindMapNode) it.next(); ClonePlugin otherClone = ClonePlugin.getHook(otherCloneNode); if (otherClone == null) { it.remove(); logger.warning("Found clone node " + controller.getNodeID(otherCloneNode) + " which isn't a clone any more."); continue; } // inform all others otherClone.addClone(node); // inform this clone about its brothers pPlugin.addClone(otherCloneNode); } v.add(node); mClonesMap.put(node, pCloneId); selectShadowNode(node, true, node); if (!mClonePropertiesMap.containsKey(pCloneId)) { mClonePropertiesMap.put(pCloneId, new CloneProperties()); } return !vectorPresent; } public void deregisterClone(String pCloneId, ClonePlugin pPlugin) { HashSet cloneSet = getHashSetToCloneId(pCloneId); MindMapNode node = pPlugin.getNode(); cloneSet.remove(node); mClonesMap.remove(node); // inform all others for (Iterator it = cloneSet.iterator(); it.hasNext(); ) { MindMapNode otherCloneNode = (MindMapNode) it.next(); ClonePlugin otherClone = ClonePlugin.getHook(otherCloneNode); if (otherClone == null) { it.remove(); logger.warning("Found clone node " + controller.getNodeID(otherCloneNode) + " which isn't a clone any more."); continue; } otherClone.removeClone(node); } if (cloneSet.isEmpty()) { // remove entire clone mCloneIdsMap.remove(cloneSet); mClonePropertiesMap.remove(pCloneId); } } public CloneProperties getCloneProperties(String pCloneId) { if (mClonePropertiesMap.containsKey(pCloneId)) { return (CloneProperties) mClonePropertiesMap.get(pCloneId); } throw new <API key>( "Clone properties not found for " + pCloneId); } protected HashSet getHashSetToCloneId(String pCloneId) { HashSet v = null; if (!mCloneIdsMap.containsKey(pCloneId)) { v = new HashSet(); mCloneIdsMap.put(pCloneId, v); } else { v = (HashSet) mCloneIdsMap.get(pCloneId); } return v; } public ActionPair filterAction(ActionPair pair) { // shortcut for no clones for speed up. if (mCloneIdsMap.isEmpty()) { return pair; } XmlAction doAction = pair.getDoAction(); doAction = cloneAction(doAction); pair.setDoAction(doAction); return pair; } private XmlAction cloneAction(XmlAction doAction) { logger.fine("Found do action: " + doAction.getClass().getName()); if (doAction instanceof NodeAction) { NodeAction nodeAction = (NodeAction) doAction; MindMapNode node = controller.getNodeFromID(nodeAction .getNode()); // check for clone or original? doAction = cloneAction(nodeAction, node); } else { if (doAction instanceof CompoundAction) { CompoundAction compoundAction = (CompoundAction) doAction; List choiceList = compoundAction.getListChoiceList(); int index = 0; for (Iterator it = choiceList.iterator(); it.hasNext(); ) { XmlAction subAction = (XmlAction) it.next(); subAction = cloneAction(subAction); compoundAction.setAtChoice(index, subAction); index++; } } } return doAction; } private XmlAction cloneAction(NodeAction nodeAction, MindMapNode node) { List correspondingNodes = <API key>(nodeAction, node); if (correspondingNodes.isEmpty()) { return nodeAction; } // create new action: CompoundAction compound = new CompoundAction(); compound.addChoice(nodeAction); for (Iterator it = correspondingNodes.iterator(); it.hasNext(); ) { MindMapNodePair pair = (MindMapNodePair) it.next(); <API key>(nodeAction, pair, compound); } return compound; } private void <API key>(NodeAction nodeAction, MindMapNodePair <API key>, CompoundAction compound) { // deep copy: NodeAction copiedNodeAction = (NodeAction) Tools .deepCopy(nodeAction); // special cases: if (copiedNodeAction instanceof MoveNodesAction) { MoveNodesAction moveAction = (MoveNodesAction) copiedNodeAction; for (int i = 0; i < moveAction.<API key>() .size(); i++) { NodeListMember member = moveAction.getNodeListMember(i); <API key>(<API key>, moveAction, member); } } if (copiedNodeAction instanceof HookNodeAction) { HookNodeAction hookAction = (HookNodeAction) copiedNodeAction; for (int i = 0; i < hookAction.<API key>() .size(); i++) { NodeListMember member = hookAction.getNodeListMember(i); <API key>(<API key>, hookAction, member); } } if (copiedNodeAction instanceof NewNodeAction) { NewNodeAction newNodeAction = (NewNodeAction) copiedNodeAction; String newId = mMap.getLinkRegistry().generateUniqueID(null); newNodeAction.setNewId(newId); } copiedNodeAction.setNode(controller.getNodeID(<API key> .getCorresponding())); if (copiedNodeAction instanceof PasteNodeAction) { /* * difficult thing here: if something is pasted, the paste * action itself contains the node ids of the paste. The first * pasted action will get that node id. This should be the * corresponding node itself. This presumably corrects a bug * that the selection on move actions is changing. */ compound.addChoice(copiedNodeAction); } else { compound.addAtChoice(0, copiedNodeAction); } } public void <API key>( MindMapNodePair <API key>, NodeAction pAction, NodeListMember member) { NodeAdapter memberNode = controller.getNodeFromID(member.getNode()); List <API key> = <API key>(pAction, memberNode); if (!<API key>.isEmpty()) { // search for this clone: for (Iterator it = <API key>.iterator(); it .hasNext(); ) { MindMapNodePair pair = (MindMapNodePair) it .next(); if (pair.getCloneNode() == <API key> .getCloneNode()) { // found: member.setNode(controller.getNodeID(pair .getCorresponding())); break; } } } } /** * Method takes into account, that some actions are different. * * @param nodeAction * @param node * @return */ public List <API key>(NodeAction nodeAction, MindMapNode node) { boolean startWithParent = false; // Behavior for complete cloning. if (mClonesMap.containsKey(node)) { String cloneId = (String) mClonesMap.get(node); if (getCloneProperties(cloneId).isCloneItself()) { // Behavior for complete cloning if (nodeAction instanceof MoveNodesAction || nodeAction instanceof MoveNodeXmlAction || nodeAction instanceof DeleteNodeAction || nodeAction instanceof CutNodeAction) { // ok, there is an action for a clone itself. be // careful: // clone only, if parents are clones: startWithParent = true; } else if (nodeAction instanceof PasteNodeAction) { PasteNodeAction pna = (PasteNodeAction) nodeAction; if (pna.getAsSibling()) { // sibling means, that the paste goes below the // clone. // skip. startWithParent = true; } else { // here, the action changes the children, thus, they // are // subject to cloning. } } else if (nodeAction instanceof UndoPasteNodeAction) { UndoPasteNodeAction pna = (UndoPasteNodeAction) nodeAction; if (pna.getAsSibling()) { // sibling means, that the paste goes below the // clone. // skip. startWithParent = true; } else { // here, the action changes the children, thus, they // are // subject to cloning. } } } else { // Behavior for children cloning only /* * new node action belongs to the children, so clone it, * even, when node is the clone itself. */ if (nodeAction instanceof NewNodeAction) { // here, the action changes the children, thus, they are // subject to cloning. } else if (nodeAction instanceof PasteNodeAction) { PasteNodeAction pna = (PasteNodeAction) nodeAction; if (pna.getAsSibling()) { // sibling means, that the paste goes below the // clone. // skip. startWithParent = true; } else { // here, the action changes the children, thus, they // are // subject to cloning. } } else if (nodeAction instanceof UndoPasteNodeAction) { UndoPasteNodeAction pna = (UndoPasteNodeAction) nodeAction; if (pna.getAsSibling()) { // sibling means, that the paste goes below the // clone. // skip. startWithParent = true; } else { // here, the action changes the children, thus, they // are // subject to cloning. } } else { // ok, there is an action for a clone itself. be // careful: // clone only, if parents are clones: startWithParent = true; } } } List/* MindMapNodePair */correspondingNodes = <API key>( node, startWithParent); return correspondingNodes; } /** * This is the main method here. It returns to a given node its cloned * nodes on the other side. * * @param pNode is checked to be son of one of the clones/original. * @param pStartWithParent Sometimes, it is relevant, if only one of the parents is a * clone, eg. for all actions, that affect the clone itself, * thus not need to be cloned, but perhaps the clone is * itself a node inside of another clone! * @return a list of {@link freemind.main.Tools.MindMapNodePair}s where the first is the * corresponding node and the second is the clone. If the return * value is empty, the node isn't son of any. */ public List <API key>(MindMapNode pNode, boolean pStartWithParent) { // in case, no clones are present, this method returns very fast. if (mClonesMap.isEmpty()) { return Collections.EMPTY_LIST; } MindMapNode clone; { MindMapNode child; // code doubling to speed up. First check for a clone on the way // to root. if (pStartWithParent) { child = pNode.getParentNode(); } else { child = pNode; } while (!mClonesMap.containsKey(child)) { if (child.isRoot()) { // nothing found! return Collections.EMPTY_LIST; } child = child.getParentNode(); } clone = child; } MindMapNode child; // now, there is a clone on the way. Collect the indices. Vector indexVector = new Vector(); if (pStartWithParent) { addNodePosition(indexVector, pNode); child = pNode.getParentNode(); } else { child = pNode; } while (clone != child) { addNodePosition(indexVector, child); child = child.getParentNode(); } Vector returnValue = new Vector(); MindMapNode originalNode = child; HashSet targets = (HashSet) mCloneIdsMap.get(mClonesMap.get(child)); CloneLoop: for (Iterator itClone = targets.iterator(); itClone .hasNext(); ) { MindMapNode cloneNode = (MindMapNode) itClone.next(); MindMapNode target = cloneNode; if (cloneNode == originalNode) continue; for (int i = indexVector.size() - 1; i >= 0; --i) { int index = ((Integer) indexVector.get(i)).intValue(); if (target.getChildCount() <= index) { logger.warning("Index " + index + " in other tree not found from " + printNodeIds(targets) + " originating from " + printNodeId(cloneNode) + " start at parent " + pStartWithParent); // with crossed fingers. continue CloneLoop; } target = (MindMapNode) target.getChildAt(index); } // logger.fine("Found corresponding node " + printNodeId(target) // + " on clone " + printNodeId(cloneNode)); returnValue.add(new MindMapNodePair(target, cloneNode)); } return returnValue; } private void addNodePosition(Vector indexVector, MindMapNode child) { indexVector.add(new Integer(child.getParentNode().getChildPosition( child))); } /** * @param pCloneNode * @return */ private String printNodeId(MindMapNode pCloneNode) { try { return controller.getNodeID(pCloneNode) + ": '" + (pCloneNode.getShortText(controller)) + "'"; } catch (Exception e) { return "NOT FOUND: '" + pCloneNode + "'"; } } /** * @param pClones * @return */ private String printNodeIds(HashSet pClones) { Vector strings = new Vector(); for (Iterator it = pClones.iterator(); it.hasNext(); ) { MindMapNode pluginNode = (MindMapNode) it.next(); strings.add(printNodeId(pluginNode)); } return Tools.listToString(strings); } /** * Is sent when a node is selected. */ public void onFocusNode(NodeView node) { markShadowNode(node, true); } /** * Is sent when a node is deselected. */ public void onLostFocusNode(NodeView node) { markShadowNode(node, false); } public void markShadowNode(NodeView pNode, boolean pEnableShadow) { // at startup, the node is null. if (pNode == null || pNode.getModel() == null) { return; } if (!pEnableShadow) { if (!<API key>.isEmpty()) { for (Iterator it = <API key>.iterator(); it .hasNext(); ) { MindMapNode node = (MindMapNode) it.next(); if (mClonesMap.containsKey(node)) { setIcon(node, sOriginalIcon); } else { setIcon(node, null); } } <API key>.clear(); } } else { markShadowNode(pNode.getModel(), pEnableShadow); } } public void markShadowNode(MindMapNode model, boolean pEnableShadow) { <API key>.clear(); try { List/* pair of MindMapNodePair */shadowNodes = <API key>( model, false); for (Iterator it = shadowNodes.iterator(); it.hasNext(); ) { MindMapNodePair shadowNode = (MindMapNodePair) it .next(); MindMapNode correspondingNode = shadowNode .getCorresponding(); <API key>.add(correspondingNode); selectShadowNode(correspondingNode, pEnableShadow, shadowNode.getCloneNode()); } } catch (<API key> e) { Resources.getInstance().logException(e); } } private void selectShadowNode(MindMapNode node, boolean pEnableShadow, MindMapNode pCloneNode) { if (!sShowIcon) { return; } while (node != null) { ImageIcon i = pEnableShadow ? sCloneIcon : null; if (node == pCloneNode) { i = sOriginalIcon; } setIcon(node, i); if (node == pCloneNode) break; node = node.getParentNode(); // comment this out to get a complete marked path to the root of // the // clones. break; } } public void setIcon(MindMapNode node, ImageIcon i) { node.setStateIcon(ClonePlugin.PLUGIN_LABEL, i); controller.nodeRefresh(node); } /* * (non-Javadoc) * * @see * freemind.modes.ModeController.<API key>#onSelectionChange * (freemind.modes.MindMapNode, boolean) */ public void onSelectionChange(NodeView pNode, boolean pIsSelected) { } public void onUpdateNodeHook(MindMapNode pNode) { } public void onSaveNode(MindMapNode pNode) { } } }
<?php require_once 'PHP/CodeSniffer/Sniff.php'; class <API key> implements <API key> { /** * Returns an array of tokens this test wants to listen for. * * @return array */ public function register() { return array( T_CATCH, ); }//end register() /** * Processes this test, when one of its tokens is encountered. * * @param <API key> $phpcsFile All the tokens found in the document. * @param int $stackPtr The position of the current token in the * stack passed in $tokens. * * @return void */ public function process(<API key> $phpcsFile, $stackPtr) { $tokens = $phpcsFile->getTokens(); $scopeStart = $tokens[$stackPtr]['scope_opener']; $firstContent = $phpcsFile->findNext(T_WHITESPACE, ($scopeStart + 1), $tokens[$stackPtr]['scope_closer'], true); if ($firstContent === false) { $error = 'Empty CATCH statement must have a comment to explain why the exception is not handled'; $phpcsFile->addError($error, $scopeStart); } }//end process() }//end class ?>
#ifndef CLUSTER_BOMB_H #define CLUSTER_BOMB_H #include <list> #include "launcher.h" #include "../graphic/surface.h" #include "../gui/progress_bar.h" #include "../include/base.h" #include "../object/physical_obj.h" class ClusterBombConfig; class Cluster : public WeaponProjectile { public: Cluster(ClusterBombConfig& cfg, WeaponLauncher * p_launcher); void Refresh(); void Shoot(int n_x, int n_y); protected: void SignalOutOfMap(); void DoExplosion(); }; class ClusterBomb : public WeaponProjectile { public: ClusterBomb(ClusterBombConfig& cfg, WeaponLauncher * p_launcher); void Refresh(); protected: void DoExplosion(); void SignalOutOfMap(); }; class ClusterBombConfig : public <API key> { public: uint nb_fragments; public: ClusterBombConfig(); virtual void LoadXml(xmlpp::Element *elem); }; class ClusterLauncher : public WeaponLauncher { public: ClusterLauncher(); protected: WeaponProjectile * <API key>(); private: ClusterBombConfig& cfg() ; }; #endif
<?php defined('_JEXEC') or die; JHtml::_('bootstrap.tooltip'); ?> <ul itemscope itemtype="https://schema.org/BreadcrumbList" class="breadcrumb<?php echo $moduleclass_sfx; ?>"> <?php if ($params->get('showHere', 1)) : ?> <li> <?php echo JText::_('<API key>'); ?>&#160; </li> <?php else : ?> <li class="active"> <span class="divider icon-location"></span> </li> <?php endif; ?> <?php // Get rid of duplicated entries on trail including home page when using multilanguage for ($i = 0; $i < $count; $i++) { if ($i === 1 && !empty($list[$i]->link) && !empty($list[$i - 1]->link) && $list[$i]->link === $list[$i - 1]->link) { unset($list[$i]); } } // Find last and penultimate items in breadcrumbs list end($list); $last_item_key = key($list); prev($list); $penult_item_key = key($list); // Make a link if not the last item in the breadcrumbs $show_last = $params->get('showLast', 1); // Generate the trail foreach ($list as $key => $item) : if ($key !== $last_item_key) : // Render all but last item - along with separator ?> <li itemprop="itemListElement" itemscope itemtype="https://schema.org/ListItem"> <?php if (!empty($item->link)) : ?> <a itemprop="item" href="<?php echo $item->link; ?>" class="pathway"><span itemprop="name"><?php echo $item->name; ?></span></a> <?php else : ?> <span itemprop="name"> <?php echo $item->name; ?> </span> <?php endif; ?> <?php if (($key !== $penult_item_key) || $show_last) : ?> <span class="divider"> <?php echo $separator; ?> </span> <?php endif; ?> <meta itemprop="position" content="<?php echo $key + 1; ?>"> </li> <?php elseif ($show_last) : // Render last item if reqd. ?> <li itemprop="itemListElement" itemscope itemtype="https://schema.org/ListItem" class="active"> <span itemprop="name"> <?php echo $item->name; ?> </span> <meta itemprop="position" content="<?php echo $key + 1; ?>"> </li> <?php endif; endforeach; ?> </ul>
package bothack.prompts; /** Called when a guard finds the player in a vault. */ public interface IVaultGuardHandler { /** Called when a guard finds the player in a vault. * The prompt is escaped by default. If the bot doesn't drop its gold it will * be attacked. * @return "Croesus" to make the guard leave (leaving you possibly stuck in the vault) */ String whoAreYou(String prompt); }
/* User roles checklist */ .at-role-checkbox.no-toggle { margin: -1px 0 0 13px; } .field { border-bottom: 0px; padding: 3px 10px 0; /*clear: both one line option */ } .form-table { margin-top: -1.5em; padding: 0 15px; } .setingstab h2 { font-weight: bold; text-align: right; margin: 5px 10px -20px 0; color: #f5f5f5 !important; } .wrap h2, .subtitle { color: #fff; text-shadow: 1px 1px 4px #000 !important; padding-bottom: 30px; letter-spacing: 0.1em; } .at-label { margin: 0 0 -13px !important;/* float: left; one line option width: 50% one line option */ } .<API key> { /* one line option clear: both;*/ } .setingstab { margin-bottom: 6em; } .header_wrap { display:none } .header_wrap h2 { font-size: 3em; font-weight: bold; } .header_wrap .btn-info.btn { /*position: fixed;*/ } .footer_wrap .btn-info.btn { /*display: none;*/ } .desc-field { color: #838383; background-color: #FBFCEA; border: 1px solid #F1F1F1;/* float: right; one line option width: 50%; one line option */ margin-top: 3px; margin-bottom: 0; padding: 6px 14px; width: 92%; } /* Labels for checkboxes */ label.<API key>, label.<API key> { font-weight: 100 !important; margin: 0 !important; } label.<API key> { display: inline; } /* Adjust checkbox margin */ .at-checkbox_list.no-toggle { margin: 1px 5px 0 0; } /* Adjust checkbox vertical align */ .at-checkbox_list { vertical-align: 0 !important; margin: 3px 0; } .pad-15{ padding: 0 15px; } form { box-shadow: 0 0 15px rgba(0, 0, 0, .2) !important; -webkit-box-shadow: 0 0 15px rgba(0, 0, 0, .2) !important; -moz-box-shadow: 0 0 15px rgba(0, 0, 0, .2) !important; } h3, h4, .field p { margin: 1em 14px !important; } hr { margin: 5px 14px 0; height: 1px; border:none; background: #cccccc; width:100%; background: -webkit-gradient( linear, 0 0, 100% 0, from(rgba(50,50,50,0.01)), to(rgba(80,80,80,0.01)), color-stop(.5,#c9c9c9) ); background: -moz-linear-gradient( left, rgba(0,0,0,0.001) 0%, rgba(201,201,201,1) 50%, rgba(0,0,0,0.001) 100% ); background:-ms-linear-gradient(left, hsla(0,0%,0%,0) 0%, hsla(0,0%,0%,.75) 50%, hsla(0,0%,0%,0) 100%); background:-o-linear-gradient(left, hsla(0,0%,0%,0) 0%, hsla(0,0%,0%,.75) 50%, hsla(0,0%,0%,0) 100%); background:linear-gradient(left, hsla(0,0%,0%,0) 0%, hsla(0,0%,0%,.75) 50%, hsla(0,0%,0%,0) 100%); /* border: 0; height: 1px; background: #333; background: -webkit-gradient(linear, left top, right top, color-stop(0%,hsla(0,0%,0%,0)), color-stop(50%,hsla(0,0%,0%,.75)), color-stop(100%,hsla(0,0%,0%,0))); background: -<API key>(left, hsla(0,0%,0%,0) 0%, hsla(0,0%,0%,.75) 50%, hsla(0,0%,0%,0) 100%); background: -moz-linear-gradient(left, hsla(0,0%,0%,0) 0%, hsla(0,0%,0%,.75) 50%, hsla(0,0%,0%,0) 100%); background: -ms-linear-gradient(left, hsla(0,0%,0%,0) 0%, hsla(0,0%,0%,.75) 50%, hsla(0,0%,0%,0) 100%); background: -o-linear-gradient(left, hsla(0,0%,0%,0) 0%, hsla(0,0%,0%,.75) 50%, hsla(0,0%,0%,0) 100%); background: linear-gradient(left, hsla(0,0%,0%,0) 0%, hsla(0,0%,0%,.75) 50%, hsla(0,0%,0%,0) 100%); */ color: #ff6666; } /* special case for this page #admin_menus .at-label {width:100%}*/ /* META BOX */ #tabs { margin-top: 37px; } .panel_menu { width: 20%; } .sections { width: 78% } .wrap { border-radius: 0; background-color: #f5f4f4; border:0; width: 69% } /* Force line breaking in the menu items, specially in translated versions */ .nav_tab_link { width: 88%; } /* Hide update message */ .alert.alert-success {display: none} /* Hide help texts by default */ .desc-field {display: none} /*Hide auxiliary button Hide Plugin Help*/ /*#import_export .form-table, */.mtt-hidden, #import_export .<API key>:nth-child(1) {display:none} #import_export hr {margin-top:30px;background: white !important;} .update-last { padding: 0 0 1em 0; } .mtt-update { float: right; margin-top: 5px; padding: .8em 0 .3em; } #bsf-link:hover { -webkit-transform: scale(1.2); -moz-transform: scale(1.2); -o-transform: scale(1.2); -ms-transform: scale(1.2); transform-origin: 100% 0%; -ms-transform-origin: 100% 0%; /* IE 9 */ -<API key>: 100% 0%; /* Safari and Chrome */ -<API key>: 100% 0%; /* Firefox */ -o-transform-origin: 100% 0%; /* Opera */ cursor: progress; } .mtt-box { background: none repeat scroll 0 0 #FFFFFF; border: 1px solid #E1E1E1; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1); float: right; width: 25%; margin: 36px 1% 0 0; position: absolute; right: 1%; /* opacity:0.01;*/ } .mtt-box2 { margin-top: 260px; } .mtt-box .inner { padding: 15px 15px 0; } .mtt-box p.desc { margin: 1px 0 -9px 24px; width: 100% !important; } .mtt-box .footer { background: none repeat scroll 0 0 #F5F5F5; border-top: 1px solid #E1E1E1; overflow: hidden; padding: 10px; position: relative; } .mtt-box .footer ul.left { float: left; } .mtt-box .footer ul li { margin: 0; padding: 0; } .mtt-box .footer ul.left li { margin-left: 5px; } .mtt-box .footer ul.right { float: right; margin-right: 3px; } .mtt-box h2 { margin: .25em 0 .75em; padding: 0; } .mtt-box h3 { margin: 1.5em 0 0; } .mtt-box p { margin-top: 0.5em; } .mtt-box-half.left { width: 50%; float: left; } .mtt-box-half.right { width: 50%; height: 100%; right: 0; position: absolute; background: none repeat scroll 0 0 #F9F9F9; border-left: 1px solid #E1E1E1; } .mtt-box-half.right .inner { } .mtt-box select { width: 99%; height: auto !important; } /* exception in Dashboard */ .inside-pdash1 { border-top: solid #EBEBEB thin;; } .mtt-img { max-width: 100px; height: auto; } .mtt-img-span { margin-left: 42%; } #poststuff { margin-top: 30px; } h4 { font-size: 1.3em; margin: .6em 0 .5em; background-color: #eee; padding: 5px; } h3.h2 { font-family: "HelveticaNeue-Light", "Helvetica Neue Light", "Helvetica Neue", sans-serif; font-size: 23px; line-height: 29px; padding: 9px 15px 4px 0; margin: 0; font-weight: normal; } h3.h2 span { color: #ccc; } #alert_bar { background: #FFFCC4; } .h3-mtt {margin-bottom: -10px !important} /* EXPORT */ #export_code, #import_code { width: 100%; } .export_code, .import_code { margin-left: 15px; } #import_export h3 { font-size: 2em; margin: 1em 14px 0 !important; } label[for=import_code], label[for=export_code] { margin-bottom: -10px; } /* Credits tab */ /*mtt_verbose_plugin*/ ul.credits-thanks li { list-style: none; padding:0; margin:0; } ul.credits-thanks li { padding: 0 0 .5em 3em; text-indent: -1.5em; } ul.credits-thanks li:before { font-size: 2em; vertical-align: bottom; content: "• "; color: gold; /* or whatever color you prefer */ } #credits .field { width: 60%; padding-left: 3em; } ul.credits-thanks li:nth-child(even) { font-style: italic; } #stack-flair img { padding: 0 15px } .field p.menu-refresh-notice { font-style:italic; text-align:right; font-size:.9em; margin-top:-17px !important; color:#aaa } /* REPEATER FIELD */ .at-repater-block { border: 1px solid #EEE; margin: 4px 0px; padding: 9px; } .at-repeat { width: 95%; } .repeater-table, #<API key> textarea, #<API key> .at-text, #<API key> textarea, #<API key> .at-text { width: 100% !important; } #<API key> .at-field, #<API key> .at-field { border: 0; padding: 0; } .repeater-table{ margin-bottom: 15px; } #<API key> div.at-label { width: 20% !important; clear:none; float:left } #<API key> input.at-text { width: 70% !important; clear:right; float:left } #<API key> .at-field { line-height: 45px; } /* ROLES */ .at-role-checkbox.no-fancy { margin: 2px 15px 0 0; } .img-help { clear:both; margin-top: 10px; } .img-help img { box-shadow: 0 0 5px rgba(0, 0, 0, .2) !important; -webkit-box-shadow: 0 0 5px rgba(0, 0, 0, .2) !important; -moz-box-shadow: 0 0 5px rgba(0, 0, 0, .2) !important; } /* Maybe bug in APC upload image? .<API key>.button { float: left; }*/
<section id="<?php print $block_html_id; ?>" class="<?php print $classes; ?>"<?php print $attributes; ?>> <?php print render($title_prefix); ?> <?php if ($title): ?> <h2<?php print $title_attributes; ?>><?php print $title; ?></h2> <?php endif;?> <?php print render($title_suffix); ?> <div class="content"<?php print $content_attributes; ?>> <?php print $content ?> </div> </section> <!-- /.block -->
#include <sys/syslimits.h> /* The number of data keys per process. */ #define <API key> 128 /* This is the value this implementation supports. */ #define PTHREAD_KEYS_MAX 1024 /* Controlling the iterations of destructors for thread-specific data. */ #define <API key> 4 /* Number of iterations this implementation does. */ #define <API key> <API key> /* The number of threads per process. */ #define <API key> 64 /* We have no predefined limit on the number of threads. */ #undef PTHREAD_THREADS_MAX /* Maximum amount by which a process can descrease its asynchronous I/O priority level. */ #define AIO_PRIO_DELTA_MAX 20 /* Minimum size for a thread. We are free to choose a reasonable value. */ #define PTHREAD_STACK_MIN 16384 /* Maximum number of POSIX timers available. */ #define TIMER_MAX 256 /* Maximum number of timer expiration overruns. */ #define DELAYTIMER_MAX 2147483647 /* Maximum value the semaphore can have. */ #define SEM_VALUE_MAX (2147483647)
// NAnt - A .NET build tool // This program is free software; you can redistribute it and/or modify // (at your option) any later version. // This program is distributed in the hope that it will be useful, // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // Gert Driesen (driesen@users.sourceforge.net) namespace NAnt.DotNet.Types { <summary> Represents an embedded resource. </summary> <remarks> Do not yet expose this to build authors. </remarks> public class EmbeddedResource { <summary> Initializes a new instance of the <see cref="EmbeddedResource" /> with the specified file name and manifest resource name. </summary> <param name="file">The path of the compiled resource.</param> <param name="<API key>">The manifest resource name of the embedded resource.</param> public EmbeddedResource(string file, string <API key>) { _file = file; <API key> = <API key>; } <summary> Gets the physical location of the resource to embed. </summary> <value> The physical location of the resource to embed. </value> public string File { get { return _file; } } <summary> Gets the manifest resource name to use when embedding the resource. </summary> <value> The manifest resource name to use when embedding the resource. </value> public string <API key> { get { return <API key>; } } private readonly string _file; private readonly string <API key>; } }
<!DOCTYPE HTML PUBLIC "- <!-- NewPage --> <html lang="en"> <head> <!-- Generated by javadoc (version 1.7.0_121) on Thu Feb 02 18:54:43 CET 2017 --> <title>PropertySet.PropertyRef (Apache Ant API)</title> <meta name="date" content="2017-02-02"> <link rel="stylesheet" type="text/css" href="../../../../../stylesheet.css" title="Style"> </head> <body> <script type="text/javascript"><! try { if (location.href.indexOf('is-external=true') == -1) { parent.document.title="PropertySet.PropertyRef (Apache Ant API)"; } } catch(err) { } </script> <noscript> <div>JavaScript is disabled on your browser.</div> </noscript> <div class="topNav"><a name="navbar_top"> </a><a href="#skip-navbar_top" title="Skip navigation links"></a><a name="navbar_top_firstrow"> </a> <ul class="navList" title="Navigation"> <li><a href="../../../../../overview-summary.html">Overview</a></li> <li><a href="package-summary.html">Package</a></li> <li class="navBarCell1Rev">Class</li> <li><a href="package-tree.html">Tree</a></li> <li><a href="../../../../../deprecated-list.html">Deprecated</a></li> <li><a href="../../../../../index-all.html">Index</a></li> <li><a href="../../../../../help-doc.html">Help</a></li> </ul> </div> <div class="subNav"> <ul class="navList"> <li><a href="../../../../../org/apache/tools/ant/types/PropertySet.<API key>.html" title="class in org.apache.tools.ant.types"><span class="strong">Prev Class</span></a></li> <li><a href="../../../../../org/apache/tools/ant/types/Quantifier.html" title="class in org.apache.tools.ant.types"><span class="strong">Next Class</span></a></li> </ul> <ul class="navList"> <li><a href="../../../../../index.html?org/apache/tools/ant/types/PropertySet.PropertyRef.html" target="_top">Frames</a></li> <li><a href="PropertySet.PropertyRef.html" target="_top">No Frames</a></li> </ul> <ul class="navList" id="<API key>"> <li><a href="../../../../../allclasses-noframe.html">All Classes</a></li> </ul> <div> <script type="text/javascript"><! allClassesLink = document.getElementById("<API key>"); if(window==top) { allClassesLink.style.display = "block"; } else { allClassesLink.style.display = "none"; } </script> </div> <div> <ul class="subNavList"> <li>Summary:&nbsp;</li> <li>Nested&nbsp;|&nbsp;</li> <li>Field&nbsp;|&nbsp;</li> <li><a href="#constructor_summary">Constr</a>&nbsp;|&nbsp;</li> <li><a href="#method_summary">Method</a></li> </ul> <ul class="subNavList"> <li>Detail:&nbsp;</li> <li>Field&nbsp;|&nbsp;</li> <li><a href="#constructor_detail">Constr</a>&nbsp;|&nbsp;</li> <li><a href="#method_detail">Method</a></li> </ul> </div> <a name="skip-navbar_top"> </a></div> <div class="header"> <div class="subTitle">org.apache.tools.ant.types</div> <h2 title="Class PropertySet.PropertyRef" class="title">Class PropertySet.PropertyRef</h2> </div> <div class="contentContainer"> <ul class="inheritance"> <li>java.lang.Object</li> <li> <ul class="inheritance"> <li>org.apache.tools.ant.types.PropertySet.PropertyRef</li> </ul> </li> </ul> <div class="description"> <ul class="blockList"> <li class="blockList"> <dl> <dt>Enclosing class:</dt> <dd><a href="../../../../../org/apache/tools/ant/types/PropertySet.html" title="class in org.apache.tools.ant.types">PropertySet</a></dd> </dl> <hr> <br> <pre>public static class <span class="strong">PropertySet.PropertyRef</span> extends java.lang.Object</pre> <div class="block">This is a nested class containing a reference to some properties and optionally a source of properties.</div> </li> </ul> </div> <div class="summary"> <ul class="blockList"> <li class="blockList"> <ul class="blockList"> <li class="blockList"><a name="constructor_summary"> </a> <h3>Constructor Summary</h3> <table class="overviewSummary" border="0" cellpadding="3" cellspacing="0" summary="Constructor Summary table, listing constructors, and an explanation"> <caption><span>Constructors</span><span class="tabEnd">&nbsp;</span></caption> <tr> <th class="colOne" scope="col">Constructor and Description</th> </tr> <tr class="altColor"> <td class="colOne"><code><strong><a href="../../../../../org/apache/tools/ant/types/PropertySet.PropertyRef.html#PropertySet.PropertyRef()">PropertySet.PropertyRef</a></strong>()</code>&nbsp;</td> </tr> </table> </li> </ul> <ul class="blockList"> <li class="blockList"><a name="method_summary"> </a> <h3>Method Summary</h3> <table class="overviewSummary" border="0" cellpadding="3" cellspacing="0" summary="Method Summary table, listing methods, and an explanation"> <caption><span>Methods</span><span class="tabEnd">&nbsp;</span></caption> <tr> <th class="colFirst" scope="col">Modifier and Type</th> <th class="colLast" scope="col">Method and Description</th> </tr> <tr class="altColor"> <td class="colFirst"><code>void</code></td> <td class="colLast"><code><strong><a href="../../../../../org/apache/tools/ant/types/PropertySet.PropertyRef.html#setBuiltin(org.apache.tools.ant.types.PropertySet.<API key>)">setBuiltin</a></strong>(<a href="../../../../../org/apache/tools/ant/types/PropertySet.<API key>.html" title="class in org.apache.tools.ant.types">PropertySet.<API key></a>&nbsp;b)</code> <div class="block">Builtin property names - all, system or commandline.</div> </td> </tr> <tr class="rowColor"> <td class="colFirst"><code>void</code></td> <td class="colLast"><code><strong><a href="../../../../../org/apache/tools/ant/types/PropertySet.PropertyRef.html#setName(java.lang.String)">setName</a></strong>(java.lang.String&nbsp;name)</code> <div class="block">Set the name.</div> </td> </tr> <tr class="altColor"> <td class="colFirst"><code>void</code></td> <td class="colLast"><code><strong><a href="../../../../../org/apache/tools/ant/types/PropertySet.PropertyRef.html#setPrefix(java.lang.String)">setPrefix</a></strong>(java.lang.String&nbsp;prefix)</code> <div class="block">Set the prefix to use.</div> </td> </tr> <tr class="rowColor"> <td class="colFirst"><code>void</code></td> <td class="colLast"><code><strong><a href="../../../../../org/apache/tools/ant/types/PropertySet.PropertyRef.html#setRegex(java.lang.String)">setRegex</a></strong>(java.lang.String&nbsp;regex)</code> <div class="block">Set the regular expression to use to filter the properties.</div> </td> </tr> <tr class="altColor"> <td class="colFirst"><code>java.lang.String</code></td> <td class="colLast"><code><strong><a href="../../../../../org/apache/tools/ant/types/PropertySet.PropertyRef.html#toString()">toString</a></strong>()</code> <div class="block">A debug toString().</div> </td> </tr> </table> <ul class="blockList"> <li class="blockList"><a name="<API key>.lang.Object"> </a> <h3>Methods inherited from class&nbsp;java.lang.Object</h3> <code>clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait</code></li> </ul> </li> </ul> </li> </ul> </div> <div class="details"> <ul class="blockList"> <li class="blockList"> <ul class="blockList"> <li class="blockList"><a name="constructor_detail"> </a> <h3>Constructor Detail</h3> <a name="PropertySet.PropertyRef()"> </a> <ul class="blockListLast"> <li class="blockList"> <h4>PropertySet.PropertyRef</h4> <pre>public&nbsp;PropertySet.PropertyRef()</pre> </li> </ul> </li> </ul> <ul class="blockList"> <li class="blockList"><a name="method_detail"> </a> <h3>Method Detail</h3> <a name="setName(java.lang.String)"> </a> <ul class="blockList"> <li class="blockList"> <h4>setName</h4> <pre>public&nbsp;void&nbsp;setName(java.lang.String&nbsp;name)</pre> <div class="block">Set the name.</div> <dl><dt><span class="strong">Parameters:</span></dt><dd><code>name</code> - a <code>String</code> value.</dd></dl> </li> </ul> <a name="setRegex(java.lang.String)"> </a> <ul class="blockList"> <li class="blockList"> <h4>setRegex</h4> <pre>public&nbsp;void&nbsp;setRegex(java.lang.String&nbsp;regex)</pre> <div class="block">Set the regular expression to use to filter the properties.</div> <dl><dt><span class="strong">Parameters:</span></dt><dd><code>regex</code> - a regular expression.</dd></dl> </li> </ul> <a name="setPrefix(java.lang.String)"> </a> <ul class="blockList"> <li class="blockList"> <h4>setPrefix</h4> <pre>public&nbsp;void&nbsp;setPrefix(java.lang.String&nbsp;prefix)</pre> <div class="block">Set the prefix to use.</div> <dl><dt><span class="strong">Parameters:</span></dt><dd><code>prefix</code> - a <code>String</code> value.</dd></dl> </li> </ul> <a name="setBuiltin(org.apache.tools.ant.types.PropertySet.<API key>)"> </a> <ul class="blockList"> <li class="blockList"> <h4>setBuiltin</h4> <pre>public&nbsp;void&nbsp;setBuiltin(<a href="../../../../../org/apache/tools/ant/types/PropertySet.<API key>.html" title="class in org.apache.tools.ant.types">PropertySet.<API key></a>&nbsp;b)</pre> <div class="block">Builtin property names - all, system or commandline.</div> <dl><dt><span class="strong">Parameters:</span></dt><dd><code>b</code> - an enumerated <code><API key></code> value.</dd></dl> </li> </ul> <a name="toString()"> </a> <ul class="blockListLast"> <li class="blockList"> <h4>toString</h4> <pre>public&nbsp;java.lang.String&nbsp;toString()</pre> <div class="block">A debug toString().</div> <dl> <dt><strong>Overrides:</strong></dt> <dd><code>toString</code>&nbsp;in class&nbsp;<code>java.lang.Object</code></dd> <dt><span class="strong">Returns:</span></dt><dd>a string version of this object.</dd></dl> </li> </ul> </li> </ul> </li> </ul> </div> </div> <div class="bottomNav"><a name="navbar_bottom"> </a><a href="#skip-navbar_bottom" title="Skip navigation links"></a><a name="<API key>"> </a> <ul class="navList" title="Navigation"> <li><a href="../../../../../overview-summary.html">Overview</a></li> <li><a href="package-summary.html">Package</a></li> <li class="navBarCell1Rev">Class</li> <li><a href="package-tree.html">Tree</a></li> <li><a href="../../../../../deprecated-list.html">Deprecated</a></li> <li><a href="../../../../../index-all.html">Index</a></li> <li><a href="../../../../../help-doc.html">Help</a></li> </ul> </div> <div class="subNav"> <ul class="navList"> <li><a href="../../../../../org/apache/tools/ant/types/PropertySet.<API key>.html" title="class in org.apache.tools.ant.types"><span class="strong">Prev Class</span></a></li> <li><a href="../../../../../org/apache/tools/ant/types/Quantifier.html" title="class in org.apache.tools.ant.types"><span class="strong">Next Class</span></a></li> </ul> <ul class="navList"> <li><a href="../../../../../index.html?org/apache/tools/ant/types/PropertySet.PropertyRef.html" target="_top">Frames</a></li> <li><a href="PropertySet.PropertyRef.html" target="_top">No Frames</a></li> </ul> <ul class="navList" id="<API key>"> <li><a href="../../../../../allclasses-noframe.html">All Classes</a></li> </ul> <div> <script type="text/javascript"><! allClassesLink = document.getElementById("<API key>"); if(window==top) { allClassesLink.style.display = "block"; } else { allClassesLink.style.display = "none"; } </script> </div> <div> <ul class="subNavList"> <li>Summary:&nbsp;</li> <li>Nested&nbsp;|&nbsp;</li> <li>Field&nbsp;|&nbsp;</li> <li><a href="#constructor_summary">Constr</a>&nbsp;|&nbsp;</li> <li><a href="#method_summary">Method</a></li> </ul> <ul class="subNavList"> <li>Detail:&nbsp;</li> <li>Field&nbsp;|&nbsp;</li> <li><a href="#constructor_detail">Constr</a>&nbsp;|&nbsp;</li> <li><a href="#method_detail">Method</a></li> </ul> </div> <a name="skip-navbar_bottom"> </a></div> </body> </html>
#ifndef _GT9XX_CONFIG_H_ #define _GT9XX_CONFIG_H_ /*STEP_1(REQUIRED):Change config table.*/ /*TODO: puts the config info corresponded to your TP here, the following is just a sample config, send this config should cause the chip cannot work normally*/ #define CTP_CFG_GROUP1 {\ 0x50,0x38,0x04,0x80,0x07,0x05,0x35,0x01,0x01,0x08,\ 0x28,0x0F,0x55,0x32,0x03,0xF5,0x00,0x00,0xFF,0x7F,\ 0x00,0x00,0x05,0x15,0x16,0x20,0x14,0x8A,0x2A,0x0C,\ 0x2D,0x2B,0xB5,0x06,0x03,0x08,0x01,0xDB,0x33,0x11,\ 0x32,0x01,0x00,0x00,0x00,0x0C,0x00,0x32,0x00,0x00,\ 0x2B,0x1E,0x4B,0x94,0xC5,0x02,0x00,0x00,0x00,0x04,\ 0xA2,0x21,0x00,0x8B,0x27,0x00,0x76,0x2F,0x00,0x64,\ 0x39,0x00,0x56,0x44,0x00,0x56,0x18,0x30,0x50,0x00,\ 0xF0,0x4A,0x3A,0xFF,0xFF,0x27,0x00,0x00,0x00,0x00,\ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0F,\ 0x12,0x03,0x04,0x10,0x42,0xF8,0x0F,0x19,0x00,0x00,\ 0x46,0x28,0x02,0x04,0x06,0x08,0x0A,0x0C,0x0E,0x10,\ 0x12,0x14,0x16,0x18,0xFF,0xFF,0x00,0x00,0x00,0x00,\ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,\ 0xFF,0x00,0x12,0x10,0x0F,0x0C,0x0A,0x08,0x06,0x04,\ 0x02,0x00,0x16,0x18,0x1C,0x1D,0x1E,0x1F,0x20,0x21,\ 0x22,0x24,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0x00,0x00,\ 0x00,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,\ 0xFF,0xFF,0xFF,0xFF,0xC3,0x01\ } #define <API key> {\ 0x4A , 0x38 , 0x04 , 0x80 , 0x07 , 0x0A , 0x45 , 0x00 , \ 0x00 , 0x88 , 0x28 , 0x05 , 0x50 , 0x28 , 0x0F , 0x05 , \ 0x01 , 0x01 , 0x00 , 0x00 , 0x33 , 0x33 , 0x04 , 0x17 , \ 0x19 , 0x1E , 0x14 , 0x8F , 0x2F , 0x89 , 0x55 , 0x57 , \ 0xF4 , 0x0A , 0xC4 , 0x10 , 0x00 , 0x80 , 0x43 , 0x11 , \ 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , \ 0x00 , 0x03 , 0x02 , 0x32 , 0x5A , 0x85 , 0xD5 , 0x02 , \ 0x08 , 0x00 , 0x00 , 0x04 , 0xB8 , 0x35 , 0x00 , 0xA8 , \ 0x3B , 0x00 , 0x98 , 0x43 , 0x05 , 0x8B , 0x4B , 0x12 , \ 0x80 , 0x55 , 0x13 , 0x80 , 0x00 , 0x00 , 0x00 , 0x00 , \ 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x06 , \ 0x87 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0xE0 , 0x03 , \ 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , \ 0x00 , 0x1C , 0x50 , 0x00 , 0x00 , 0x00 , 0x00 , 0x32 , \ 0x0C , 0x0D , 0x0E , 0x0F , 0x10 , 0x11 , 0x14 , 0x15 , \ 0x16 , 0x01 , 0x00 , 0x05 , 0x04 , 0x07 , 0x06 , 0x09 , \ 0x08 , 0xFF , 0xFF , 0xFF , 0xFF , 0xFF , 0xFF , 0xFF , \ 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x02 , \ 0x04 , 0x06 , 0x07 , 0x08 , 0x0A , 0x0C , 0x0D , 0x0F , \ 0x10 , 0x11 , 0x12 , 0x13 , 0x14 , 0x19 , 0x1B , 0x1C , \ 0x1E , 0x1F , 0x20 , 0x21 , 0x22 , 0x23 , 0x24 , 0x25 , \ 0x29 , 0x28 , 0x27 , 0x26 , 0xFF , 0xFF , 0x00 , 0x00 , \ 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , \ 0xB7 , 0x0F , 0x19 , 0x04 , 0x26 , 0x01 , 0x10 , 0x53 , \ 0x08 , 0x14 , 0xCC , 0xCC , 0xCC , 0xCC , 0xCC , 0xCC , \ 0xCC , 0xCC , 0xCC , 0xCC , 0xCC , 0x23 , 0xC5 , 0xA8 , \ 0x02 , 0x14 , 0x7C , 0x06 , 0x30 , 0x32 , 0xD2 , 0xFA , \ 0x84 , 0xD5 , 0x83 , 0xDD , 0x81 , 0xE5 , 0x80 , 0xED , \ 0x7F , 0xF5 , 0xFC , 0x01\ } /*TODO puts your group2 config info here,if need.*/ #define CTP_CFG_GROUP2 {\ } /*TODO puts your group2 config info here,if need.*/ #define <API key> {\ } /*TODO puts your group3 config info here,if need.*/ #define CTP_CFG_GROUP3 {\ } /*TODO puts your group3 config info here,if need.*/ #define <API key> {\ } /* TODO: define your config for Sensor_ID == 3 here, if needed*/ #define CTP_CFG_GROUP4 {\ } /* TODO: define your config for Sensor_ID == 4 here, if needed*/ #define CTP_CFG_GROUP5 {\ } /* TODO: define your config for Sensor_ID == 5 here, if needed*/ #define CTP_CFG_GROUP6 {\ } #endif /* _GT9XX_CONFIG_H_ */
#include "renderer/image.h" #include <OpenImageIO/imageio.h> #include <OpenImageIO/imagebuf.h> #include <OpenImageIO/imagebufalgo.h> #include <math.h> // This clamps the resolution of the CDF functions used to sample the // environment map. It is a tradeoff between quality and performance: larger CDF // will capture more detail (e.g. small and bright pixels on the image which act // as point lights) but require more steps on the binary search thus degrading // performance. The smaller the map, the faster we'll find the region to sample // from, but we might miss high frequency detail on the original image. #define MAX_CDF_SIZE 512 Forward declaration float <API key>(const OpenImageIO::ImageBuf& image, float* functionU); bool <API key>( const float* rgbPixels, unsigned int imageWidth, unsigned int imageHeight, OpenImageIO::ImageBuf& result ); Load image and convert it to float RGB format. Return true if successful, false if an error occurred. bool loadImage(const std::string& path, unsigned int& outWidth, unsigned int& outHeight, std::vector<float>& outPixelData) { <API key> ImageBuf buf(path.c_str()); if (!buf.read()) return false; ImageSpec spec = buf.spec(); outWidth = (unsigned int)spec.width; outHeight = (unsigned int)spec.height; outPixelData.resize(outWidth * outHeight * 3); if( spec.nchannels == 3 ) { // the image is in the expected format. We can copy the pixels directly. return buf.get_pixels(0, outWidth, 0, outHeight, 0, 1, TypeDesc::FLOAT, &outPixelData[0]); } ImageBuf rgb; if (!ImageBufAlgo::channels(rgb, buf, 3, NULL, NULL, NULL, true)) return false; return rgb.get_pixels(0, outWidth, 0, outHeight, 0, 1, TypeDesc::FLOAT, &outPixelData[0]); } This method computes the distribution functions over a 2D image used to sample such image. We'll do this to perform importance sampling of the environment map. The implementation here matches that of PBRT 2 (Chapter 14.6.5). bool calculateCDF( const float* rgbPixels, unsigned int imageWidth, unsigned int imageHeight, std::vector<float>& cdfUData, unsigned int& cdfUDataWidth, unsigned int& cdfUDataHeight, std::vector<float>& cdfVData, float& <API key> ) { // First generate pixel intensities. <API key> OpenImageIO::ImageBuf filteredIntensities; if (!<API key>( rgbPixels, imageWidth, imageHeight, filteredIntensities )) return false; imageWidth = filteredIntensities.spec().width; imageHeight = filteredIntensities.spec().height; cdfUDataWidth = imageWidth + 1; cdfUDataHeight = imageHeight; const unsigned int cdfVNumElements = imageHeight + 1; cdfUData.resize( cdfUDataWidth * cdfUDataHeight ); cdfVData.resize( cdfVNumElements ); float* cdfU = &cdfUData[0]; float* cdfV = &cdfVData[0]; // The actual functions we generate the CDF from are: // Function U (2D) : pixel intensities // Function V (1D) : integral of intensities over each row std::vector<float> storageFuncU, storageFuncV; storageFuncU.resize( imageWidth * imageHeight ); storageFuncV.resize( imageHeight + 1 ); float* functionU = &storageFuncU[0]; float* functionV = &storageFuncV[0]; const float iW = (float)imageWidth; const float iH = (float)imageHeight; // first generate the data for Function U <API key> = <API key>( filteredIntensities, functionU ); // Now generate the CDF U. // Normalized 1D distributions in the rows of the 2D buffer, and the // marginal CDF in the 1D buffer. // Include the starting 0.0 and the ending 1.0 to avoid special cases during // the continuous sampling. // note this matches the original image dimensions, only CDFU is 1 element // longer const unsigned int functionUWidth = imageWidth; const unsigned int numStepsW = iW; // PBRT2 p.648. for (unsigned int y = 0; y < imageHeight; ++y) { unsigned int row = y * cdfUDataWidth; cdfU[row + 0] = 0.0f; // CDF starts at 0.0f. for (unsigned int x = 1; x <= imageWidth; ++x) { const float f = functionU[y * functionUWidth + x - 1] / numStepsW; unsigned int columnOffset = row + x; // this is not yet a CDF, but the step function integral. We'll turn // it into an actual CDF when we divide by rowIntegral. cdfU[columnOffset] = cdfU[columnOffset - 1] + f; } // The last CDF element contains the integral over the row. Note we have // not yet normalized the cdf. const float rowIntegral = cdfU[row + imageWidth]; // Store this as function values of the marginal CDF. functionV[y] = rowIntegral; // If all texels were black in this row, generate an equal distribution. if (rowIntegral > 0.0f) { for (unsigned int x = 1; x <= imageWidth; ++x) { cdfU[row + x] /= rowIntegral; } } else { for (unsigned int x = 1; x <= imageWidth; ++x) { cdfU[row + x] = (float)x / numStepsW; } } } // for y // Now do the same thing with the marginal CDF. cdfV[0] = 0.0f; // CDF starts at 0.0f. const unsigned int numStepsH = imageHeight; for (unsigned int y = 1; y <= imageHeight; ++y) { const float f = functionV[y - 1] / numStepsH; // step function integral. cdfV[y] = cdfV[y - 1] + f; } // Convert step function integral into CDF V. // The integral over this marginal CDF is in the last element. const float imageIntegral = cdfV[imageHeight]; functionV[imageHeight] = imageIntegral; // If all texels were black in the whole image, generate an equal distribution. if (imageIntegral > 0.0f) { for (unsigned int y = 1; y <= imageHeight; ++y) { cdfV[y] /= imageIntegral; } } else { for (unsigned int y = 1; y <= imageHeight; ++y) { cdfV[y] = (float)y / iH; } } return true; } bool <API key>( const float* rgbPixels, unsigned int imageWidth, unsigned int imageHeight, OpenImageIO::ImageBuf& result ) { // PBRT2 Page 726. // The CDF is generated over a slightly blurred version of the // original image. The reason is that we use linear blending of // texels during rendering, and that may mean that a black texel has // non-zero radiance near its center due to contribution of an // adjacent (non-black texel). If we simply copied the texel values // for the piecewise _CONSTANT_ CDF we sample from, the whole // surface of the texel would be black. This would not happen if we // used a piecewise linear CDF, but constant is easier/cheaper. To // solve this, we simply blur the source image function slightly // which addresses this problem and produces non-zero values for the // case described, guaranteed that the "almost" black pixel would be // sampled with >0 probability. <API key> ImageSpec spec(imageWidth, imageHeight, 3, TypeDesc::FLOAT); ImageBuf source(spec, (void*)rgbPixels); if (std::max(imageWidth, imageHeight) > MAX_CDF_SIZE) { // shrink image ImageBuf resized; unsigned int w = (unsigned int )((float)imageWidth / std::max(imageWidth, imageHeight) * MAX_CDF_SIZE); unsigned int h = (unsigned int )((float)imageHeight / std::max(imageWidth, imageHeight) * MAX_CDF_SIZE); ROI roi (0, w, 0, h, 0, 1, /*chans:*/ 0, source.nchannels()); ImageBufAlgo::resize(resized, source, "", 0, roi); source.swap(resized); } ImageBuf intensities; ImageBuf blurredIntensities; // Compute luminance via a weighted sum of R,G,B // (assuming Rec709 primaries and a linear scale) float lumaWeights[3] = { 0.2126f, 0.7152f, 0.0722f }; ROI roi = source.roi(); roi.chbegin = 0; roi.chend = 3; if (!ImageBufAlgo::channel_sum (intensities, source, lumaWeights, roi)) return false; // Blur the image with a 3x3 Gaussian kernel ImageBuf kernel; ImageBufAlgo::make_kernel (kernel, "gaussian", 3.0f, 3.0f); if (!ImageBufAlgo::convolve(blurredIntensities, intensities, kernel)) return false; result.swap(blurredIntensities); return true; } float <API key>(const OpenImageIO::ImageBuf& image, float* functionU) { unsigned int imageWidth = image.spec().width; unsigned int imageHeight = image.spec().height; const float iW = (float)imageWidth; const float iH = (float)imageHeight; const float iA = iW * iH; float textureTimesSinSum = 0; float value; for( unsigned int y = 0; y < imageHeight; ++y ) { // Scale distribution by the sine to get the sampling uniform. (Avoid // sampling more value near the poles.) // See PBRT2, chapter 14.6.5 on Infinite Area Lights, page 727. float sinTheta = (float)sin(M_PI * ((float)y + 0.5f) / iH); for( unsigned int x = 0; x < imageWidth; ++x ) { image.getpixel(x, y, &value, 1); value = std::max(0.f, value); functionU[y * imageWidth + x] = value * sinTheta; textureTimesSinSum += value * sinTheta; } } // The integral of the texture times a sin factor is used to calculate the // PDF. The idea is to reduce the oversampling that would otherwise occur at // the poles of the sampled sphere by 'toning down' the importance at such // poles with a sin factor. float <API key> = textureTimesSinSum / iA; // Roll the 2PI^2 factor required to calculate the jacobian on the area PDF // right into this constant to save the calculation. PBRT2 page 729. This is // taken into account in EnvironmentLight.cu <API key> *= 2.0f * M_PI * M_PI; return <API key>; }
#ifndef _ASM_THREAD_INFO_H #define _ASM_THREAD_INFO_H #ifdef __KERNEL__ #include <linux/config.h> #ifndef __ASSEMBLY__ #include <asm/processor.h> /* * low level task data that entry.S needs immediate access to * - this struct should fit entirely inside of one cache line * - this struct shares the supervisor stack pages * - if the contents of this structure are changed, the assembly constants * must also be changed */ struct thread_info { struct task_struct *task; /* main task structure */ struct exec_domain *exec_domain; /* execution domain */ unsigned long flags; /* low level flags */ __u32 cpu; /* current CPU */ int preempt_count; /* 0 => preemptable, <0 => BUG */ mm_segment_t addr_limit; /* thread address space: 0-0xBFFFFFFF for user-thead 0-0xFFFFFFFF for kernel-thread */ struct restart_block restart_block; }; /* * macros/functions for gaining access to the thread information structure * * preempt_count needs to be 1 initially, until the scheduler is functional. */ #define INIT_THREAD_INFO(tsk) \ { \ .task = &tsk, \ .exec_domain = &default_exec_domain, \ .flags = 0, \ .cpu = 0, \ .preempt_count = 1, \ .addr_limit = KERNEL_DS, \ .restart_block = { \ .fn = <API key>, \ }, \ } #define init_thread_info (init_thread_union.thread_info) #define init_stack (init_thread_union.stack) /* How to get the thread information struct from C. */ register struct thread_info *<API key> __asm__("$28"); #define current_thread_info() <API key> /* thread information allocation */ #if defined(<API key>) && defined(CONFIG_MIPS32) #define THREAD_SIZE_ORDER (1) #endif #if defined(<API key>) && defined(CONFIG_MIPS64) #define THREAD_SIZE_ORDER (2) #endif #ifdef <API key> #define THREAD_SIZE_ORDER (1) #endif #ifdef <API key> #define THREAD_SIZE_ORDER (0) #endif #ifdef <API key> #define THREAD_SIZE_ORDER (0) #endif #define THREAD_SIZE (PAGE_SIZE << THREAD_SIZE_ORDER) #define THREAD_MASK (THREAD_SIZE - 1UL) #ifdef <API key> #define alloc_thread_info(tsk) \ ({ \ struct thread_info *ret; \ \ ret = kmalloc(THREAD_SIZE, GFP_KERNEL); \ if (ret) \ memset(ret, 0, THREAD_SIZE); \ ret; \ }) #else #define alloc_thread_info(tsk) kmalloc(THREAD_SIZE, GFP_KERNEL) #endif #define free_thread_info(info) kfree(info) #define get_thread_info(ti) get_task_struct((ti)->task) #define put_thread_info(ti) put_task_struct((ti)->task) #endif /* !__ASSEMBLY__ */ #define PREEMPT_ACTIVE 0x10000000 /* * thread information flags * - these are process state flags that various assembly files may need to * access * - pending work-to-be-done flags are in LSW * - other flags in MSW */ #define TIF_NOTIFY_RESUME 1 /* resumption notification requested */ #define TIF_SIGPENDING 2 /* signal pending */ #define TIF_NEED_RESCHED 3 /* rescheduling necessary */ #define TIF_SYSCALL_AUDIT 4 /* syscall auditing active */ #define TIF_USEDFPU 16 /* FPU was used by this task this quantum (SMP) */ #define TIF_POLLING_NRFLAG 17 /* true if poll_idle() is polling TIF_NEED_RESCHED */ #define TIF_MEMDIE 18 #define TIF_SYSCALL_TRACE 31 /* syscall trace active */ #define _TIF_SYSCALL_TRACE (1<<TIF_SYSCALL_TRACE) #define _TIF_NOTIFY_RESUME (1<<TIF_NOTIFY_RESUME) #define _TIF_SIGPENDING (1<<TIF_SIGPENDING) #define _TIF_NEED_RESCHED (1<<TIF_NEED_RESCHED) #define _TIF_SYSCALL_AUDIT (1<<TIF_SYSCALL_AUDIT) #define _TIF_USEDFPU (1<<TIF_USEDFPU) #define _TIF_POLLING_NRFLAG (1<<TIF_POLLING_NRFLAG) #define _TIF_WORK_MASK 0x0000ffef /* work to do on interrupt/exception return */ #define _TIF_ALLWORK_MASK 0x8000ffff /* work to do on any return to u-space */ #endif /* __KERNEL__ */ #endif /* _ASM_THREAD_INFO_H */
#include <linux/module.h> #include <linux/init.h> #include <linux/firmware.h> #include <linux/slab.h> #include <linux/platform_device.h> #include <linux/device.h> #include <linux/printk.h> #include <linux/ratelimit.h> #include <linux/debugfs.h> #include <linux/io.h> #include <linux/bitops.h> #include <linux/delay.h> #include <linux/pm_runtime.h> #include <linux/kernel.h> #include <linux/gpio.h> #include <linux/spmi.h> #include <linux/of_gpio.h> #include <linux/regulator/consumer.h> #include <linux/mfd/wcd9xxx/pdata.h> #include <linux/mfd/wcd9xxx/core.h> #include <linux/qdsp6v2/apr.h> #include <linux/timer.h> #include <linux/workqueue.h> #include <linux/sched.h> #include <sound/q6afe-v2.h> #include <sound/pcm.h> #include <sound/pcm_params.h> #include <sound/soc.h> #include <sound/soc-dapm.h> #include <sound/tlv.h> #include <sound/q6core.h> #include <soc/qcom/subsystem_notif.h> #include "msm8x16-wcd.h" #include "wcd-mbhc-v2.h" #include "msm8916-wcd-irq.h" #include "<API key>.h" #define MSM8X16_WCD_RATES (SNDRV_PCM_RATE_8000 | <API key> |\ <API key> | <API key>) #define MSM8X16_WCD_FORMATS (<API key> |\ <API key>) #define NUM_DECIMATORS 2 #define NUM_INTERPOLATORS 3 #define BITS_PER_REG 8 #define <API key> 4 #define <API key> 0x08 #define <API key> 0x771C000 #define <API key> 0xf000 #define <API key> 0xf100 #define PMIC_SLAVE_ID_0 0 #define PMIC_SLAVE_ID_1 1 #define PMIC_MBG_OK 0x2C08 #define PMIC_LDO7_EN_CTL 0x4646 #define MASK_MSB_BIT 0x80 #define <API key> 40 #define <API key> 0x400 #define <API key> 64 #define BUS_DOWN 1 /* *50 Milliseconds sufficient for DSP bring up in the modem * after Sub System Restart */ #define <API key> 50 #define HPHL_PA_DISABLE (0x01 << 1) #define HPHR_PA_DISABLE (0x01 << 2) #define EAR_PA_DISABLE (0x01 << 3) #define SPKR_PA_DISABLE (0x01 << 4) enum { BOOST_SWITCH = 0, BOOST_ALWAYS, BYPASS_ALWAYS, BOOST_ON_FOREVER, }; #define EAR_PMD 0 #define EAR_PMU 1 #define SPK_PMD 2 #define SPK_PMU 3 #define MICBIAS_DEFAULT_VAL 1800000 #define MICBIAS_MIN_VAL 1600000 #define MICBIAS_STEP_SIZE 50000 #define <API key> 5000 #define MIN_BOOST_VOLTAGE 4000 #define MAX_BOOST_VOLTAGE 5550 #define BOOST_VOLTAGE_STEP 50 #define VOLTAGE_CONVERTER(value, min_value, step_size)\ ((value - min_value)/step_size); enum { AIF1_PB = 0, AIF1_CAP, NUM_CODEC_DAIS, }; enum { <API key> = 0, <API key>, <API key>, RX_MIX1_INP_SEL_RX1, RX_MIX1_INP_SEL_RX2, RX_MIX1_INP_SEL_RX3, }; static const <API key>(digital_gain, 0, 1, 0); static const <API key>(analog_gain, 0, 25, 1); static struct snd_soc_dai_driver msm8x16_wcd_i2s_dai[]; #define <API key>(x) \ mutex_lock_nested(&x, <API key>); #define <API key>(x) mutex_unlock(&x); /* Codec supports 2 IIR filters */ enum { IIR1 = 0, IIR2, IIR_MAX, }; /* Codec supports 5 bands */ enum { BAND1 = 0, BAND2, BAND3, BAND4, BAND5, BAND_MAX, }; struct hpf_work { struct msm8x16_wcd_priv *msm8x16_wcd; u32 decimator; u8 tx_hpf_cut_of_freq; struct delayed_work dwork; }; static struct hpf_work tx_hpf_work[NUM_DECIMATORS]; static char <API key>[][<API key>] = { "cdc-vdd-mic-bias", }; static unsigned long rx_digital_gain_reg[] = { <API key>, <API key>, <API key>, }; static unsigned long tx_digital_gain_reg[] = { <API key>, <API key>, }; enum { <API key> = 0, <API key>, <API key> }; struct msm8x16_wcd_spmi { struct spmi_device *spmi; int base; }; #ifndef <API key> static const struct wcd_mbhc_intr intr_ids = { .mbhc_sw_intr = <API key>, .mbhc_btn_press_intr = <API key>, .<API key> = <API key>, .mbhc_hs_ins_intr = <API key>, .mbhc_hs_rem_intr = <API key>, .hph_left_ocp = <API key>, .hph_right_ocp = <API key>, }; #endif static int <API key>(struct device *dev, struct <API key> *vreg, const char *vreg_name, bool ondemand); static struct msm8x16_wcd_pdata *<API key>( struct device *dev); static void <API key>(struct snd_soc_codec *codec); static void <API key>(struct snd_soc_codec *codec); static void <API key>(struct snd_soc_codec *codec, bool micbias1, bool micbias2); struct msm8x16_wcd_spmi msm8x16_wcd_modules[<API key>]; static void *<API key>; static struct snd_soc_codec *registered_codec; #ifndef <API key> static int <API key>(struct snd_soc_codec *codec, bool turn_on); static void <API key>(struct snd_soc_codec *codec); static void <API key>(struct snd_soc_codec *codec, bool enable); static void <API key>(s16 l, s16 r, uint32_t *zl, uint32_t *zr, bool high) { int64_t rl = 0, rr = 0; if (high) { pr_debug("%s: This plug has high range impedance", __func__); rl = (int)(((100*(l*400 - 200))/96) - 230); rr = (int)(((100*(r*400 - 200))/96) - 230); } else { pr_debug("%s: This plug has low range impedance", __func__); rl = (int)(((1000*(l*2 - 1))/1165) - (13/10)); rr = (int)(((1000*(r*2 - 1))/1165) - (13/10)); } *zl = rl; *zr = rr; } static struct firmware_cal *<API key>( struct snd_soc_codec *codec, enum wcd_cal_type type) { struct msm8x16_wcd_priv *msm8x16_wcd; struct firmware_cal *hwdep_cal; if (!codec) { pr_err("%s: NULL codec pointer\n", __func__); return NULL; } msm8x16_wcd = <API key>(codec); hwdep_cal = wcdcal_get_fw_cal(msm8x16_wcd->fw_data, type); if (!hwdep_cal) { dev_err(codec->dev, "%s: cal not sent by %d\n", __func__, type); return NULL; } return hwdep_cal; } static const struct wcd_mbhc_cb mbhc_cb = { .enable_mb_source = <API key>, .trim_btn_reg = <API key>, .compute_impedance = <API key>, .set_micbias_value = <API key>, .set_auto_zeroing = <API key>, .get_hwdep_fw_cal = <API key>, .set_cap_mode = <API key>, }; #endif static const uint32_t wcd_imped_val[] = {4, 8, 12, 16, 20, 24, 28, 32, 36, 40, 44, 48}; int <API key>(struct snd_soc_codec *codec, struct notifier_block *nblock) { struct msm8x16_wcd_priv *msm8x16_wcd = <API key>(codec); return <API key>(&msm8x16_wcd->notifier, nblock); } int <API key>(struct snd_soc_codec *codec, struct notifier_block *nblock) { struct msm8x16_wcd_priv *msm8x16_wcd = <API key>(codec); return <API key>(&msm8x16_wcd->notifier, nblock); } void <API key>(struct snd_soc_codec *codec, const enum wcd_notify_event event) { struct msm8x16_wcd_priv *msm8x16_wcd = <API key>(codec); pr_debug("%s: notifier call event %d\n", __func__, event); <API key>(&msm8x16_wcd->notifier, event, codec); } static int <API key>(u16 *reg, struct msm8x16_wcd_spmi **msm8x16_wcd) { int rtn = 0; int value = ((*reg & 0x0f00) >> 8) & 0x000f; *reg = *reg - (value * 0x100); switch (value) { case 0: case 1: *msm8x16_wcd = &msm8x16_wcd_modules[value]; break; default: rtn = -EINVAL; break; } return rtn; } static int <API key>(struct msm8x16_wcd *msm8x16_wcd, u16 reg, u8 *value, u32 bytes) { u32 temp = ((u32)(*value)) & 0x000000FF; u16 offset = (reg ^ 0x0200) & 0x0FFF; bool q6_state = false; q6_state = <API key>(); if (q6_state != true) { pr_debug("%s: q6 not ready %d\n", __func__, q6_state); return 0; } else pr_debug("%s: DSP is ready %d\n", __func__, q6_state); iowrite32(temp, msm8x16_wcd->dig_base + offset); return 0; } static int <API key>(struct msm8x16_wcd *msm8x16_wcd, u16 reg, u32 bytes, u8 *value) { u32 temp; u16 offset = (reg ^ 0x0200) & 0x0FFF; bool q6_state = false; q6_state = <API key>(); if (q6_state != true) { pr_debug("%s: q6 not ready %d\n", __func__, q6_state); return 0; } else pr_debug("%s: DSP is ready %d\n", __func__, q6_state); temp = ioread32(msm8x16_wcd->dig_base + offset); *value = (u8)temp; return 0; } static int <API key>(u16 reg, u8 *value, u32 bytes) { int ret; struct msm8x16_wcd_spmi *wcd = NULL; ret = <API key>(&reg, &wcd); if (ret) { pr_err("%s: Invalid register address\n", __func__); return ret; } if (wcd == NULL) { pr_err("%s: Failed to get device info\n", __func__); return -ENODEV; } ret = <API key>(wcd->spmi->ctrl, wcd->spmi->sid, wcd->base + reg, value, bytes); if (ret) pr_err("Unable to write to addr=%x, ret(%d)\n", reg, ret); /* Try again if the write fails */ if (ret != 0) { usleep(10); ret = <API key>(wcd->spmi->ctrl, wcd->spmi->sid, wcd->base + reg, value, 1); if (ret != 0) { pr_err("failed to write the device\n"); return ret; } } pr_debug("write sucess register = %x val = %x\n", reg, *value); return 0; } int <API key>(u16 reg, u32 bytes, u8 *dest) { int ret = 0; struct msm8x16_wcd_spmi *wcd = NULL; ret = <API key>(&reg, &wcd); if (ret) { pr_err("%s: Invalid register address\n", __func__); return ret; } if (wcd == NULL) { pr_err("%s: Failed to get device info\n", __func__); return -ENODEV; } ret = <API key>(wcd->spmi->ctrl, wcd->spmi->sid, wcd->base + reg, dest, bytes); if (ret != 0) { pr_err("failed to read the device\n"); return ret; } pr_debug("%s: reg 0x%x = 0x%x\n", __func__, reg, *dest); return 0; } int <API key>(unsigned short reg, int bytes, void *dest) { return <API key>(reg, bytes, dest); } int <API key>(unsigned short reg, int bytes, void *src) { return <API key>(reg, src, bytes); } static int <API key>(struct snd_soc_codec *codec, unsigned short reg) { int ret = -EINVAL; u8 temp = 0; struct msm8x16_wcd *msm8x16_wcd = codec->control_data; struct <API key> *pdata = NULL; pr_debug("%s reg = %x\n", __func__, reg); mutex_lock(&msm8x16_wcd->io_lock); pdata = <API key>(codec->card); if (<API key>(reg)) ret = <API key>(reg, 1, &temp); else if (<API key>(reg)) { mutex_lock(&pdata->cdc_mclk_mutex); if (atomic_read(&pdata->mclk_enabled) == false) { pdata->digital_cdc_clk.clk_val = pdata->mclk_freq; ret = <API key>( <API key>, &pdata->digital_cdc_clk); if (ret < 0) { pr_err("failed to enable the MCLK\n"); goto err; } pr_debug("%s: MCLK not enabled\n", __func__); ret = <API key>( msm8x16_wcd, reg, 1, &temp); atomic_set(&pdata->mclk_enabled, true); <API key>(&pdata->disable_mclk_work, 50); err: mutex_unlock(&pdata->cdc_mclk_mutex); mutex_unlock(&msm8x16_wcd->io_lock); return temp; } ret = <API key>(msm8x16_wcd, reg, 1, &temp); mutex_unlock(&pdata->cdc_mclk_mutex); } mutex_unlock(&msm8x16_wcd->io_lock); if (ret < 0) { dev_err(msm8x16_wcd->dev, "%s: codec read failed for reg 0x%x\n", __func__, reg); return ret; } else { dev_dbg(msm8x16_wcd->dev, "Read 0x%02x from 0x%x\n", temp, reg); } return temp; } static int <API key>(struct snd_soc_codec *codec, unsigned short reg, u8 val) { int ret = -EINVAL; struct msm8x16_wcd *msm8x16_wcd = codec->control_data; struct <API key> *pdata = NULL; mutex_lock(&msm8x16_wcd->io_lock); pdata = <API key>(codec->card); if (<API key>(reg)) ret = <API key>(reg, 1, &val); else if (<API key>(reg)) { mutex_lock(&pdata->cdc_mclk_mutex); if (atomic_read(&pdata->mclk_enabled) == false) { pr_debug("MCLK not enabled %s:\n", __func__); pdata->digital_cdc_clk.clk_val = pdata->mclk_freq; ret = <API key>( <API key>, &pdata->digital_cdc_clk); if (ret < 0) { pr_err("failed to enable the MCLK\n"); ret = 0; goto err; } ret = <API key>( msm8x16_wcd, reg, &val, 1); atomic_set(&pdata->mclk_enabled, true); <API key>(&pdata->disable_mclk_work, 50); err: mutex_unlock(&pdata->cdc_mclk_mutex); mutex_unlock(&msm8x16_wcd->io_lock); return ret; } ret = <API key>(msm8x16_wcd, reg, &val, 1); mutex_unlock(&pdata->cdc_mclk_mutex); } mutex_unlock(&msm8x16_wcd->io_lock); return ret; } static int <API key>(struct snd_soc_codec *codec, unsigned int reg) { dev_dbg(codec->dev, "%s: reg 0x%x\n", __func__, reg); return <API key>[reg]; } static int <API key>(struct snd_soc_codec *ssc, unsigned int reg) { return <API key>[reg]; } #ifdef <API key> extern int snd_ctrl_enabled; extern int snd_hax_reg_access(unsigned int); extern unsigned int snd_hax_cache_read(unsigned int); extern void snd_hax_cache_write(unsigned int, unsigned int); #endif #ifndef <API key> static #endif int msm8x16_wcd_write(struct snd_soc_codec *codec, unsigned int reg, unsigned int value) { int ret; #ifdef <API key> int val; #endif struct msm8x16_wcd_priv *msm8x16_wcd = <API key>(codec); dev_dbg(codec->dev, "%s: Write from reg 0x%x val 0x%x\n", __func__, reg, value); if (reg == SND_SOC_NOPM) return 0; BUG_ON(reg > <API key>); if (!<API key>(codec, reg)) { ret = snd_soc_cache_write(codec, reg, value); if (ret != 0) dev_err(codec->dev, "Cache write to %x failed: %d\n", reg, ret); } if (unlikely(test_bit(BUS_DOWN, &msm8x16_wcd->status_mask))) { printk_ratelimited(KERN_ERR "write 0x%02x while offline\n", reg); return -ENODEV; } else #ifdef <API key> if (!snd_ctrl_enabled) return <API key>(codec, reg, (u8)value); if (!snd_hax_reg_access(reg)) { if (!((val = snd_hax_cache_read(reg)) != -1)) { val = <API key>(codec->control_data, reg); } } else { snd_hax_cache_write(reg, value); val = value; } return <API key>(codec, reg, val); #else return <API key>(codec, reg, (u8)value); #endif } #ifdef <API key> EXPORT_SYMBOL(msm8x16_wcd_write); #endif #ifndef <API key> static #endif unsigned int msm8x16_wcd_read(struct snd_soc_codec *codec, unsigned int reg) { unsigned int val; int ret; struct msm8x16_wcd_priv *msm8x16_wcd = <API key>(codec); if (reg == SND_SOC_NOPM) return 0; BUG_ON(reg > <API key>); if (!<API key>(codec, reg) && <API key>(codec, reg) && reg < codec->driver->reg_cache_size) { ret = snd_soc_cache_read(codec, reg, &val); if (ret >= 0) { return val; } else dev_err(codec->dev, "Cache read from %x failed: %d\n", reg, ret); } if (unlikely(test_bit(BUS_DOWN, &msm8x16_wcd->status_mask))) { printk_ratelimited(KERN_ERR "write 0x%02x while offline\n", reg); return -ENODEV; } else val = <API key>(codec, reg); dev_dbg(codec->dev, "%s: Read from reg 0x%x val 0x%x\n", __func__, reg, val); return val; } #ifdef <API key> EXPORT_SYMBOL(msm8x16_wcd_read); #endif static void <API key>(struct snd_soc_codec *codec) { int ret; u8 dest; struct msm8x16_wcd_spmi *wcd = &msm8x16_wcd_modules[0]; ret = <API key>(wcd->spmi->ctrl, PMIC_SLAVE_ID_1, PMIC_LDO7_EN_CTL, &dest, 1); if (ret != 0) { pr_err("%s: failed to read the device:%d\n", __func__, ret); return; } else { pr_debug("%s: LDO state: 0x%x\n", __func__, dest); } if ((dest & MASK_MSB_BIT) == 0) { pr_err("LDO7 not enabled return!\n"); return; } ret = <API key>(wcd->spmi->ctrl, PMIC_SLAVE_ID_0, PMIC_MBG_OK, &dest, 1); if (ret != 0) { pr_err("%s: failed to read the device:%d\n", __func__, ret); return; } else { pr_debug("%s: PMIC BG state: 0x%x\n", __func__, dest); } if ((dest & MASK_MSB_BIT) == 0) { pr_err("PMIC MBG not ON, enable codec hw_en MB bit again\n"); snd_soc_write(codec, <API key>, 0x30); /* Allow 1ms for PMIC MBG state to be updated */ usleep_range(CODEC_DELAY_1_MS, CODEC_DELAY_1_1_MS); ret = <API key>(wcd->spmi->ctrl, PMIC_SLAVE_ID_0, PMIC_MBG_OK, &dest, 1); if (ret != 0) { pr_err("%s: failed to read the device:%d\n", __func__, ret); return; } if ((dest & MASK_MSB_BIT) == 0) { pr_err("PMIC MBG still not ON after retry return!\n"); return; } } snd_soc_update_bits(codec, <API key>, 0x0F, 0x0F); snd_soc_update_bits(codec, <API key>, 0xA5, 0xA5); snd_soc_update_bits(codec, <API key>, 0x0F, 0x0F); snd_soc_write(codec, <API key>, 0x30); snd_soc_write(codec, <API key>, 0x82); snd_soc_update_bits(codec, <API key>, 0x69, 0x69); snd_soc_update_bits(codec, <API key>, 0x01, 0x01); snd_soc_update_bits(codec, <API key>, 0x88, 0x88); snd_soc_update_bits(codec, <API key>, 0x03, 0x03); snd_soc_update_bits(codec, <API key>, 0xE1, 0xE1); snd_soc_update_bits(codec, <API key>, 0x20, 0x20); usleep_range(CODEC_DELAY_1_MS, CODEC_DELAY_1_1_MS); snd_soc_update_bits(codec, <API key>, 0xDF, 0xDF); usleep_range(CODEC_DELAY_1_MS, CODEC_DELAY_1_1_MS); } static void <API key>(struct snd_soc_codec *codec) { snd_soc_update_bits(codec, <API key>, 0xDF, 0x5F); snd_soc_update_bits(codec, <API key>, 0x20, 0x00); } static void <API key>(struct snd_soc_codec *codec) { snd_soc_update_bits(codec, <API key>, 0xA5, 0xA5); snd_soc_update_bits(codec, <API key>, 0x07, 0x07); snd_soc_update_bits(codec, <API key>, 0x02, 0x02); snd_soc_update_bits(codec, <API key>, 0x01, 0x00); snd_soc_update_bits(codec, <API key>, 0x40, 0x40); snd_soc_update_bits(codec, <API key>, 0x80, 0x80); snd_soc_update_bits(codec, <API key>, 0xDF, 0xDF); } static void <API key>(struct snd_soc_codec *codec) { snd_soc_update_bits(codec, <API key>, 0x80, 0x00); snd_soc_update_bits(codec, <API key>, 0x80, 0x00); snd_soc_update_bits(codec, <API key>, 0x02, 0x00); snd_soc_update_bits(codec, <API key>, 0x40, 0x00); } static void <API key>(struct snd_soc_codec *codec, int flag) { struct msm8x16_wcd_priv *msm8x16_wcd = <API key>(codec); if (flag == EAR_PMU) { switch (msm8x16_wcd->boost_option) { case BOOST_SWITCH: if (msm8x16_wcd->ear_pa_boost_set) { <API key>(codec); <API key>(codec); } break; case BOOST_ALWAYS: <API key>(codec); break; case BYPASS_ALWAYS: <API key>(codec); break; case BOOST_ON_FOREVER: <API key>(codec); break; default: pr_err("%s: invalid boost option: %d\n", __func__, msm8x16_wcd->boost_option); break; } } else if (flag == EAR_PMD) { switch (msm8x16_wcd->boost_option) { case BOOST_SWITCH: if (msm8x16_wcd->ear_pa_boost_set) <API key>(codec); break; case BOOST_ALWAYS: <API key>(codec); /* 80ms for EAR boost to settle down */ msleep(80); break; case BYPASS_ALWAYS: /* nothing to do as bypass on always */ break; case BOOST_ON_FOREVER: /* nothing to do as boost on forever */ break; default: pr_err("%s: invalid boost option: %d\n", __func__, msm8x16_wcd->boost_option); break; } } else if (flag == SPK_PMU) { switch (msm8x16_wcd->boost_option) { case BOOST_SWITCH: if (msm8x16_wcd->spk_boost_set) { <API key>(codec); <API key>(codec); } break; case BOOST_ALWAYS: <API key>(codec); break; case BYPASS_ALWAYS: <API key>(codec); break; case BOOST_ON_FOREVER: <API key>(codec); break; default: pr_err("%s: invalid boost option: %d\n", __func__, msm8x16_wcd->boost_option); break; } } else if (flag == SPK_PMD) { switch (msm8x16_wcd->boost_option) { case BOOST_SWITCH: if (msm8x16_wcd->spk_boost_set) { <API key>(codec); /* * Add 40 ms sleep for the spk * boost to settle down */ msleep(40); } break; case BOOST_ALWAYS: <API key>(codec); /* * Add 40 ms sleep for the spk * boost to settle down */ msleep(40); break; case BYPASS_ALWAYS: /* nothing to do as bypass on always */ break; case BOOST_ON_FOREVER: /* nothing to do as boost on forever */ break; default: pr_err("%s: invalid boost option: %d\n", __func__, msm8x16_wcd->boost_option); break; } } } static int get_codec_version(struct msm8x16_wcd_priv *msm8x16_wcd) { if (msm8x16_wcd->codec_version == CONGA) { return CONGA; } else if (msm8x16_wcd->pmic_rev == TOMBAK_2_0) { return TOMBAK_2_0; } else if (msm8x16_wcd->pmic_rev == TOMBAK_1_0) { return TOMBAK_1_0; } else { pr_err("%s: unsupported codec version\n", __func__); return UNSUPPORTED; } } static int <API key>(struct device *dev, struct <API key> *vreg, const char *vreg_name, bool ondemand) { int len, ret = 0; const __be32 *prop; char prop_name[<API key>]; struct device_node *regnode = NULL; u32 prop_val; snprintf(prop_name, <API key>, "%s-supply", vreg_name); regnode = of_parse_phandle(dev->of_node, prop_name, 0); if (!regnode) { dev_err(dev, "Looking up %s property in node %s failed\n", prop_name, dev->of_node->full_name); return -ENODEV; } dev_dbg(dev, "Looking up %s property in node %s\n", prop_name, dev->of_node->full_name); vreg->name = vreg_name; vreg->ondemand = ondemand; snprintf(prop_name, <API key>, "qcom,%s-voltage", vreg_name); prop = of_get_property(dev->of_node, prop_name, &len); if (!prop || (len != (2 * sizeof(__be32)))) { dev_err(dev, "%s %s property\n", prop ? "invalid format" : "no", prop_name); return -EINVAL; } else { vreg->min_uv = be32_to_cpup(&prop[0]); vreg->max_uv = be32_to_cpup(&prop[1]); } snprintf(prop_name, <API key>, "qcom,%s-current", vreg_name); ret = <API key>(dev->of_node, prop_name, &prop_val); if (ret) { dev_err(dev, "Looking up %s property in node %s failed", prop_name, dev->of_node->full_name); return -EFAULT; } vreg->optimum_ua = prop_val; dev_dbg(dev, "%s: vol=[%d %d]uV, curr=[%d]uA, ond %d\n\n", vreg->name, vreg->min_uv, vreg->max_uv, vreg->optimum_ua, vreg->ondemand); return 0; } static void <API key>(struct snd_soc_codec *codec) { struct msm8x16_wcd_priv *msm8x16_wcd_priv = <API key>(codec); const char *prop_name = "qcom,cdc-boost-voltage"; int boost_voltage, ret; ret = <API key>(codec->dev->of_node, prop_name, &boost_voltage); if (ret) { dev_dbg(codec->dev, "Looking up %s property in node %s failed\n", prop_name, codec->dev->of_node->full_name); boost_voltage = <API key>; } if (boost_voltage < MIN_BOOST_VOLTAGE || boost_voltage > MAX_BOOST_VOLTAGE) { dev_err(codec->dev, "Incorrect boost voltage. Reverting to default\n"); boost_voltage = <API key>; } msm8x16_wcd_priv->boost_voltage = VOLTAGE_CONVERTER(boost_voltage, MIN_BOOST_VOLTAGE, BOOST_VOLTAGE_STEP); dev_dbg(codec->dev, "Boost voltage value is: %d\n", boost_voltage); } static void <API key>(struct device *dev, struct <API key> *micbias) { const char *prop_name = "qcom,<API key>"; int ret; ret = <API key>(dev->of_node, prop_name, &micbias->cfilt1_mv); if (ret) { dev_dbg(dev, "Looking up %s property in node %s failed", prop_name, dev->of_node->full_name); micbias->cfilt1_mv = MICBIAS_DEFAULT_VAL; return; } return; } static struct msm8x16_wcd_pdata *<API key>( struct device *dev) { struct msm8x16_wcd_pdata *pdata; int ret, static_cnt, ond_cnt, idx, i; const char *name = NULL; const char *static_prop_name = "qcom,cdc-static-supplies"; const char *ond_prop_name = "qcom,<API key>"; pdata = devm_kzalloc(dev, sizeof(*pdata), GFP_KERNEL); if (!pdata) { dev_err(dev, "could not allocate memory for platform data\n"); return NULL; } static_cnt = <API key>(dev->of_node, static_prop_name); if (IS_ERR_VALUE(static_cnt)) { dev_err(dev, "%s: Failed to get static supplies %d\n", __func__, static_cnt); ret = -EINVAL; goto err; } /* On-demand supply list is an optional property */ ond_cnt = <API key>(dev->of_node, ond_prop_name); if (IS_ERR_VALUE(ond_cnt)) ond_cnt = 0; BUG_ON(static_cnt <= 0 || ond_cnt < 0); if ((static_cnt + ond_cnt) > ARRAY_SIZE(pdata->regulator)) { dev_err(dev, "%s: Num of supplies %u > max supported %zd\n", __func__, (static_cnt + ond_cnt), ARRAY_SIZE(pdata->regulator)); ret = -EINVAL; goto err; } for (idx = 0; idx < static_cnt; idx++) { ret = <API key>(dev->of_node, static_prop_name, idx, &name); if (ret) { dev_err(dev, "%s: of read string %s idx %d error %d\n", __func__, static_prop_name, idx, ret); goto err; } dev_dbg(dev, "%s: Found static cdc supply %s\n", __func__, name); ret = <API key>(dev, &pdata->regulator[idx], name, false); if (ret) { dev_err(dev, "%s:err parsing vreg for %s idx %d\n", __func__, name, idx); goto err; } } for (i = 0; i < ond_cnt; i++, idx++) { ret = <API key>(dev->of_node, ond_prop_name, i, &name); if (ret) { dev_err(dev, "%s: err parsing on_demand for %s idx %d\n", __func__, ond_prop_name, i); goto err; } dev_dbg(dev, "%s: Found on-demand cdc supply %s\n", __func__, name); ret = <API key>(dev, &pdata->regulator[idx], name, true); if (ret) { dev_err(dev, "%s: err parsing vreg on_demand for %s idx %d\n", __func__, name, idx); goto err; } } <API key>(dev, &pdata->micbias); return pdata; err: devm_kfree(dev, pdata); dev_err(dev, "%s: Failed to populate DT data ret = %d\n", __func__, ret); return NULL; } static int <API key>( struct snd_soc_dapm_widget *w, struct snd_kcontrol *kcontrol, int event) { int ret = 0; struct snd_soc_codec *codec = w->codec; struct msm8x16_wcd_priv *msm8x16_wcd = <API key>(codec); struct on_demand_supply *supply; if (w->shift >= <API key>) { dev_err(codec->dev, "%s: error index > MAX Demand supplies", __func__); ret = -EINVAL; goto out; } dev_dbg(codec->dev, "%s: supply: %s event: %d ref: %d\n", __func__, <API key>[w->shift], event, atomic_read(&msm8x16_wcd->on_demand_list[w->shift].ref)); supply = &msm8x16_wcd->on_demand_list[w->shift]; WARN_ONCE(!supply->supply, "%s isn't defined\n", <API key>[w->shift]); if (!supply->supply) { dev_err(codec->dev, "%s: err supply not present ond for %d", __func__, w->shift); goto out; } switch (event) { case <API key>: if (atomic_inc_return(&supply->ref) == 1) ret = regulator_enable(supply->supply); if (ret) dev_err(codec->dev, "%s: Failed to enable %s\n", __func__, <API key>[w->shift]); break; case <API key>: if (atomic_read(&supply->ref) == 0) { dev_dbg(codec->dev, "%s: %s supply has been disabled.\n", __func__, <API key>[w->shift]); goto out; } if (atomic_dec_return(&supply->ref) == 0) ret = regulator_disable(supply->supply); if (ret) dev_err(codec->dev, "%s: Failed to disable %s\n", __func__, <API key>[w->shift]); break; default: break; } out: return ret; } static int <API key>(struct snd_soc_dapm_widget *w, struct snd_kcontrol *kcontrol, int event) { struct snd_soc_codec *codec = w->codec; struct msm8x16_wcd_priv *msm8x16_wcd = <API key>(codec); dev_dbg(codec->dev, "%s: event = %d\n", __func__, event); switch (event) { case <API key>: if (!(strcmp(w->name, "EAR CP"))) { snd_soc_update_bits(codec, <API key>, 0x80, 0x80); <API key>(codec, EAR_PMU); } else { snd_soc_update_bits(codec, <API key>, 0xC0, 0xC0); } break; case <API key>: usleep_range(CODEC_DELAY_1_MS, CODEC_DELAY_1_1_MS); break; case <API key>: usleep_range(CODEC_DELAY_1_MS, CODEC_DELAY_1_1_MS); if (!(strcmp(w->name, "EAR CP"))) { snd_soc_update_bits(codec, <API key>, 0x80, 0x00); if (msm8x16_wcd->boost_option != BOOST_ALWAYS) { dev_dbg(codec->dev, "%s: boost_option:%d, tear down ear\n", __func__, msm8x16_wcd->boost_option); <API key>(codec, EAR_PMD); } } else { snd_soc_update_bits(codec, <API key>, 0x40, 0x00); if (msm8x16_wcd->rx_bias_count == 0) snd_soc_update_bits(codec, <API key>, 0x80, 0x00); dev_dbg(codec->dev, "%s: rx_bias_count = %d\n", __func__, msm8x16_wcd->rx_bias_count); } break; } return 0; } static int <API key>(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) { struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol); struct msm8x16_wcd_priv *msm8x16_wcd = <API key>(codec); ucontrol->value.integer.value[0] = (msm8x16_wcd->ear_pa_boost_set ? 1 : 0); dev_dbg(codec->dev, "%s: msm8x16_wcd->ear_pa_boost_set = %d\n", __func__, msm8x16_wcd->ear_pa_boost_set); return 0; } static int <API key>(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) { struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol); struct msm8x16_wcd_priv *msm8x16_wcd = <API key>(codec); dev_dbg(codec->dev, "%s: ucontrol->value.integer.value[0] = %ld\n", __func__, ucontrol->value.integer.value[0]); msm8x16_wcd->ear_pa_boost_set = (ucontrol->value.integer.value[0] ? true : false); return 0; } static int <API key>(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) { u8 ear_pa_gain; struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol); ear_pa_gain = snd_soc_read(codec, <API key>); ear_pa_gain = (ear_pa_gain >> 5) & 0x1; if (ear_pa_gain == 0x00) { ucontrol->value.integer.value[0] = 0; } else if (ear_pa_gain == 0x01) { ucontrol->value.integer.value[0] = 1; } else { dev_err(codec->dev, "%s: ERROR: Unsupported Ear Gain = 0x%x\n", __func__, ear_pa_gain); return -EINVAL; } ucontrol->value.integer.value[0] = ear_pa_gain; dev_dbg(codec->dev, "%s: ear_pa_gain = 0x%x\n", __func__, ear_pa_gain); return 0; } static int <API key>(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) { struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol); struct <API key> *pdata = NULL; pdata = <API key>(codec->card); dev_dbg(codec->dev, "%s: ucontrol->value.integer.value[0] = %ld\n", __func__, ucontrol->value.integer.value[0]); return pdata->lb_mode; } static int <API key>(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) { struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol); struct <API key> *pdata = NULL; pdata = <API key>(codec->card); dev_dbg(codec->dev, "%s: ucontrol->value.integer.value[0] = %ld\n", __func__, ucontrol->value.integer.value[0]); switch (ucontrol->value.integer.value[0]) { case 0: pdata->lb_mode = false; break; case 1: pdata->lb_mode = true; break; default: return -EINVAL; } return 0; } static int <API key>(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) { u8 ear_pa_gain; struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol); dev_dbg(codec->dev, "%s: ucontrol->value.integer.value[0] = %ld\n", __func__, ucontrol->value.integer.value[0]); switch (ucontrol->value.integer.value[0]) { case 0: ear_pa_gain = 0x00; break; case 1: ear_pa_gain = 0x20; break; default: return -EINVAL; } snd_soc_update_bits(codec, <API key>, 0x20, ear_pa_gain); return 0; } static int <API key>(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) { struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol); struct msm8x16_wcd_priv *msm8x16_wcd = <API key>(codec); if (msm8x16_wcd->boost_option == BOOST_SWITCH) { ucontrol->value.integer.value[0] = 0; } else if (msm8x16_wcd->boost_option == BOOST_ALWAYS) { ucontrol->value.integer.value[0] = 1; } else if (msm8x16_wcd->boost_option == BYPASS_ALWAYS) { ucontrol->value.integer.value[0] = 2; } else if (msm8x16_wcd->boost_option == BOOST_ON_FOREVER) { ucontrol->value.integer.value[0] = 3; } else { dev_err(codec->dev, "%s: ERROR: Unsupported Boost option= %d\n", __func__, msm8x16_wcd->boost_option); return -EINVAL; } dev_dbg(codec->dev, "%s: msm8x16_wcd->boost_option = %d\n", __func__, msm8x16_wcd->boost_option); return 0; } static int <API key>(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) { struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol); struct msm8x16_wcd_priv *msm8x16_wcd = <API key>(codec); dev_dbg(codec->dev, "%s: ucontrol->value.integer.value[0] = %ld\n", __func__, ucontrol->value.integer.value[0]); switch (ucontrol->value.integer.value[0]) { case 0: msm8x16_wcd->boost_option = BOOST_SWITCH; break; case 1: msm8x16_wcd->boost_option = BOOST_ALWAYS; break; case 2: msm8x16_wcd->boost_option = BYPASS_ALWAYS; <API key>(codec); break; case 3: msm8x16_wcd->boost_option = BOOST_ON_FOREVER; <API key>(codec); break; default: pr_err("%s: invalid boost option: %d\n", __func__, msm8x16_wcd->boost_option); return -EINVAL; } dev_dbg(codec->dev, "%s: msm8x16_wcd->boost_option_set = %d\n", __func__, msm8x16_wcd->boost_option); return 0; } static int <API key>(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) { struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol); struct msm8x16_wcd_priv *msm8x16_wcd = <API key>(codec); if (msm8x16_wcd->spk_boost_set == false) { ucontrol->value.integer.value[0] = 0; } else if (msm8x16_wcd->spk_boost_set == true) { ucontrol->value.integer.value[0] = 1; } else { dev_err(codec->dev, "%s: ERROR: Unsupported Speaker Boost = %d\n", __func__, msm8x16_wcd->spk_boost_set); return -EINVAL; } dev_dbg(codec->dev, "%s: msm8x16_wcd->spk_boost_set = %d\n", __func__, msm8x16_wcd->spk_boost_set); return 0; } static int <API key>(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) { struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol); struct msm8x16_wcd_priv *msm8x16_wcd = <API key>(codec); dev_dbg(codec->dev, "%s: ucontrol->value.integer.value[0] = %ld\n", __func__, ucontrol->value.integer.value[0]); switch (ucontrol->value.integer.value[0]) { case 0: msm8x16_wcd->spk_boost_set = false; break; case 1: msm8x16_wcd->spk_boost_set = true; break; default: return -EINVAL; } dev_dbg(codec->dev, "%s: msm8x16_wcd->spk_boost_set = %d\n", __func__, msm8x16_wcd->spk_boost_set); return 0; } static int <API key>(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) { struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol); struct msm8x16_wcd_priv *msm8x16_wcd = <API key>(codec); if (msm8x16_wcd->ext_spk_boost_set == false) ucontrol->value.integer.value[0] = 0; else ucontrol->value.integer.value[0] = 1; dev_dbg(codec->dev, "%s: msm8x16_wcd->ext_spk_boost_set = %d\n", __func__, msm8x16_wcd->ext_spk_boost_set); return 0; } static int <API key>(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) { struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol); struct msm8x16_wcd_priv *msm8x16_wcd = <API key>(codec); dev_dbg(codec->dev, "%s: ucontrol->value.integer.value[0] = %ld\n", __func__, ucontrol->value.integer.value[0]); switch (ucontrol->value.integer.value[0]) { case 0: msm8x16_wcd->ext_spk_boost_set = false; break; case 1: msm8x16_wcd->ext_spk_boost_set = true; break; default: return -EINVAL; } dev_dbg(codec->dev, "%s: msm8x16_wcd->spk_boost_set = %d\n", __func__, msm8x16_wcd->spk_boost_set); return 0; } static int <API key>( struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) { struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol); int iir_idx = ((struct <API key> *) kcontrol->private_value)->reg; int band_idx = ((struct <API key> *) kcontrol->private_value)->shift; ucontrol->value.integer.value[0] = (snd_soc_read(codec, (<API key> + 64 * iir_idx)) & (1 << band_idx)) != 0; dev_dbg(codec->dev, "%s: IIR #%d band #%d enable %d\n", __func__, iir_idx, band_idx, (uint32_t)ucontrol->value.integer.value[0]); return 0; } static int <API key>( struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) { struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol); int iir_idx = ((struct <API key> *) kcontrol->private_value)->reg; int band_idx = ((struct <API key> *) kcontrol->private_value)->shift; int value = ucontrol->value.integer.value[0]; /* Mask first 5 bits, 6-8 are reserved */ snd_soc_update_bits(codec, (<API key> + 64 * iir_idx), (1 << band_idx), (value << band_idx)); dev_dbg(codec->dev, "%s: IIR #%d band #%d enable %d\n", __func__, iir_idx, band_idx, ((snd_soc_read(codec, (<API key> + 64 * iir_idx)) & (1 << band_idx)) != 0)); return 0; } static uint32_t get_iir_band_coeff(struct snd_soc_codec *codec, int iir_idx, int band_idx, int coeff_idx) { uint32_t value = 0; /* Address does not automatically update if reading */ snd_soc_write(codec, (<API key> + 64 * iir_idx), ((band_idx * BAND_MAX + coeff_idx) * sizeof(uint32_t)) & 0x7F); value |= snd_soc_read(codec, (<API key> + 64 * iir_idx)); snd_soc_write(codec, (<API key> + 64 * iir_idx), ((band_idx * BAND_MAX + coeff_idx) * sizeof(uint32_t) + 1) & 0x7F); value |= (snd_soc_read(codec, (<API key> + 64 * iir_idx)) << 8); snd_soc_write(codec, (<API key> + 64 * iir_idx), ((band_idx * BAND_MAX + coeff_idx) * sizeof(uint32_t) + 2) & 0x7F); value |= (snd_soc_read(codec, (<API key> + 64 * iir_idx)) << 16); snd_soc_write(codec, (<API key> + 64 * iir_idx), ((band_idx * BAND_MAX + coeff_idx) * sizeof(uint32_t) + 3) & 0x7F); /* Mask bits top 2 bits since they are reserved */ value |= ((snd_soc_read(codec, (<API key> + 64 * iir_idx)) & 0x3f) << 24); return value; } static int <API key>( struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) { struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol); int iir_idx = ((struct <API key> *) kcontrol->private_value)->reg; int band_idx = ((struct <API key> *) kcontrol->private_value)->shift; ucontrol->value.integer.value[0] = get_iir_band_coeff(codec, iir_idx, band_idx, 0); ucontrol->value.integer.value[1] = get_iir_band_coeff(codec, iir_idx, band_idx, 1); ucontrol->value.integer.value[2] = get_iir_band_coeff(codec, iir_idx, band_idx, 2); ucontrol->value.integer.value[3] = get_iir_band_coeff(codec, iir_idx, band_idx, 3); ucontrol->value.integer.value[4] = get_iir_band_coeff(codec, iir_idx, band_idx, 4); dev_dbg(codec->dev, "%s: IIR #%d band #%d b0 = 0x%x\n" "%s: IIR #%d band #%d b1 = 0x%x\n" "%s: IIR #%d band #%d b2 = 0x%x\n" "%s: IIR #%d band #%d a1 = 0x%x\n" "%s: IIR #%d band #%d a2 = 0x%x\n", __func__, iir_idx, band_idx, (uint32_t)ucontrol->value.integer.value[0], __func__, iir_idx, band_idx, (uint32_t)ucontrol->value.integer.value[1], __func__, iir_idx, band_idx, (uint32_t)ucontrol->value.integer.value[2], __func__, iir_idx, band_idx, (uint32_t)ucontrol->value.integer.value[3], __func__, iir_idx, band_idx, (uint32_t)ucontrol->value.integer.value[4]); return 0; } static void set_iir_band_coeff(struct snd_soc_codec *codec, int iir_idx, int band_idx, uint32_t value) { snd_soc_write(codec, (<API key> + 64 * iir_idx), (value & 0xFF)); snd_soc_write(codec, (<API key> + 64 * iir_idx), (value >> 8) & 0xFF); snd_soc_write(codec, (<API key> + 64 * iir_idx), (value >> 16) & 0xFF); /* Mask top 2 bits, 7-8 are reserved */ snd_soc_write(codec, (<API key> + 64 * iir_idx), (value >> 24) & 0x3F); } static int <API key>( struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) { struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol); int iir_idx = ((struct <API key> *) kcontrol->private_value)->reg; int band_idx = ((struct <API key> *) kcontrol->private_value)->shift; /* Mask top bit it is reserved */ /* Updates addr automatically for each B2 write */ snd_soc_write(codec, (<API key> + 64 * iir_idx), (band_idx * BAND_MAX * sizeof(uint32_t)) & 0x7F); set_iir_band_coeff(codec, iir_idx, band_idx, ucontrol->value.integer.value[0]); set_iir_band_coeff(codec, iir_idx, band_idx, ucontrol->value.integer.value[1]); set_iir_band_coeff(codec, iir_idx, band_idx, ucontrol->value.integer.value[2]); set_iir_band_coeff(codec, iir_idx, band_idx, ucontrol->value.integer.value[3]); set_iir_band_coeff(codec, iir_idx, band_idx, ucontrol->value.integer.value[4]); dev_dbg(codec->dev, "%s: IIR #%d band #%d b0 = 0x%x\n" "%s: IIR #%d band #%d b1 = 0x%x\n" "%s: IIR #%d band #%d b2 = 0x%x\n" "%s: IIR #%d band #%d a1 = 0x%x\n" "%s: IIR #%d band #%d a2 = 0x%x\n", __func__, iir_idx, band_idx, get_iir_band_coeff(codec, iir_idx, band_idx, 0), __func__, iir_idx, band_idx, get_iir_band_coeff(codec, iir_idx, band_idx, 1), __func__, iir_idx, band_idx, get_iir_band_coeff(codec, iir_idx, band_idx, 2), __func__, iir_idx, band_idx, get_iir_band_coeff(codec, iir_idx, band_idx, 3), __func__, iir_idx, band_idx, get_iir_band_coeff(codec, iir_idx, band_idx, 4)); return 0; } static const char * const <API key>[] = { "DISABLE", "ENABLE"}; static const struct soc_enum <API key>[] = { SOC_ENUM_SINGLE_EXT(2, <API key>), }; static const char * const <API key>[] = { "DISABLE", "ENABLE"}; static const struct soc_enum <API key>[] = { SOC_ENUM_SINGLE_EXT(2, <API key>), }; static const char * const <API key>[] = { "POS_1P5_DB", "POS_6_DB"}; static const struct soc_enum <API key>[] = { SOC_ENUM_SINGLE_EXT(2, <API key>), }; static const char * const <API key>[] = { "BOOST_SWITCH", "BOOST_ALWAYS", "BYPASS_ALWAYS", "BOOST_ON_FOREVER"}; static const struct soc_enum <API key>[] = { SOC_ENUM_SINGLE_EXT(4, <API key>), }; static const char * const <API key>[] = { "DISABLE", "ENABLE"}; static const struct soc_enum <API key>[] = { SOC_ENUM_SINGLE_EXT(2, <API key>), }; static const char * const <API key>[] = { "DISABLE", "ENABLE"}; static const struct soc_enum <API key>[] = { SOC_ENUM_SINGLE_EXT(2, <API key>), }; /*cut of frequency for high pass filter*/ static const char * const cf_text[] = { "MIN_3DB_4Hz", "MIN_3DB_75Hz", "MIN_3DB_150Hz" }; static const struct soc_enum cf_dec1_enum = SOC_ENUM_SINGLE(<API key>, 4, 3, cf_text); static const struct soc_enum cf_dec2_enum = SOC_ENUM_SINGLE(<API key>, 4, 3, cf_text); static const struct soc_enum cf_rxmix1_enum = SOC_ENUM_SINGLE(<API key>, 0, 3, cf_text); static const struct soc_enum cf_rxmix2_enum = SOC_ENUM_SINGLE(<API key>, 0, 3, cf_text); static const struct soc_enum cf_rxmix3_enum = SOC_ENUM_SINGLE(<API key>, 0, 3, cf_text); static const struct snd_kcontrol_new <API key>[] = { SOC_ENUM_EXT("Boost Option", <API key>[0], <API key>, <API key>), SOC_ENUM_EXT("EAR PA Boost", <API key>[0], <API key>, <API key>), SOC_ENUM_EXT("EAR PA Gain", <API key>[0], <API key>, <API key>), SOC_ENUM_EXT("Speaker Boost", <API key>[0], <API key>, <API key>), SOC_ENUM_EXT("Ext Spk Boost", <API key>[0], <API key>, <API key>), SOC_ENUM_EXT("LOOPBACK Mode", <API key>[0], <API key>, <API key>), SOC_SINGLE_TLV("ADC1 Volume", <API key>, 3, 8, 0, analog_gain), SOC_SINGLE_TLV("ADC2 Volume", <API key>, 3, 8, 0, analog_gain), SOC_SINGLE_TLV("ADC3 Volume", <API key>, 3, 8, 0, analog_gain), SOC_SINGLE_SX_TLV("RX1 Digital Volume", <API key>, 0, -84, 40, digital_gain), SOC_SINGLE_SX_TLV("RX2 Digital Volume", <API key>, 0, -84, 40, digital_gain), SOC_SINGLE_SX_TLV("RX3 Digital Volume", <API key>, 0, -84, 40, digital_gain), SOC_SINGLE_SX_TLV("DEC1 Volume", <API key>, 0, -84, 40, digital_gain), SOC_SINGLE_SX_TLV("DEC2 Volume", <API key>, 0, -84, 40, digital_gain), SOC_SINGLE_SX_TLV("IIR1 INP1 Volume", <API key>, 0, -84, 40, digital_gain), SOC_SINGLE_SX_TLV("IIR1 INP2 Volume", <API key>, 0, -84, 40, digital_gain), SOC_SINGLE_SX_TLV("IIR1 INP3 Volume", <API key>, 0, -84, 40, digital_gain), SOC_SINGLE_SX_TLV("IIR1 INP4 Volume", <API key>, 0, -84, 40, digital_gain), SOC_SINGLE_SX_TLV("IIR2 INP1 Volume", <API key>, 0, -84, 40, digital_gain), SOC_ENUM("TX1 HPF cut off", cf_dec1_enum), SOC_ENUM("TX2 HPF cut off", cf_dec2_enum), SOC_SINGLE("TX1 HPF Switch", <API key>, 3, 1, 0), SOC_SINGLE("TX2 HPF Switch", <API key>, 3, 1, 0), SOC_SINGLE("RX1 HPF Switch", <API key>, 2, 1, 0), SOC_SINGLE("RX2 HPF Switch", <API key>, 2, 1, 0), SOC_SINGLE("RX3 HPF Switch", <API key>, 2, 1, 0), SOC_ENUM("RX1 HPF cut off", cf_rxmix1_enum), SOC_ENUM("RX2 HPF cut off", cf_rxmix2_enum), SOC_ENUM("RX3 HPF cut off", cf_rxmix3_enum), SOC_SINGLE_EXT("IIR1 Enable Band1", IIR1, BAND1, 1, 0, <API key>, <API key>), SOC_SINGLE_EXT("IIR1 Enable Band2", IIR1, BAND2, 1, 0, <API key>, <API key>), SOC_SINGLE_EXT("IIR1 Enable Band3", IIR1, BAND3, 1, 0, <API key>, <API key>), SOC_SINGLE_EXT("IIR1 Enable Band4", IIR1, BAND4, 1, 0, <API key>, <API key>), SOC_SINGLE_EXT("IIR1 Enable Band5", IIR1, BAND5, 1, 0, <API key>, <API key>), SOC_SINGLE_EXT("IIR2 Enable Band1", IIR2, BAND1, 1, 0, <API key>, <API key>), SOC_SINGLE_EXT("IIR2 Enable Band2", IIR2, BAND2, 1, 0, <API key>, <API key>), SOC_SINGLE_EXT("IIR2 Enable Band3", IIR2, BAND3, 1, 0, <API key>, <API key>), SOC_SINGLE_EXT("IIR2 Enable Band4", IIR2, BAND4, 1, 0, <API key>, <API key>), SOC_SINGLE_EXT("IIR2 Enable Band5", IIR2, BAND5, 1, 0, <API key>, <API key>), <API key>("IIR1 Band1", IIR1, BAND1, 255, 0, 5, <API key>, <API key>), <API key>("IIR1 Band2", IIR1, BAND2, 255, 0, 5, <API key>, <API key>), <API key>("IIR1 Band3", IIR1, BAND3, 255, 0, 5, <API key>, <API key>), <API key>("IIR1 Band4", IIR1, BAND4, 255, 0, 5, <API key>, <API key>), <API key>("IIR1 Band5", IIR1, BAND5, 255, 0, 5, <API key>, <API key>), <API key>("IIR2 Band1", IIR2, BAND1, 255, 0, 5, <API key>, <API key>), <API key>("IIR2 Band2", IIR2, BAND2, 255, 0, 5, <API key>, <API key>), <API key>("IIR2 Band3", IIR2, BAND3, 255, 0, 5, <API key>, <API key>), <API key>("IIR2 Band4", IIR2, BAND4, 255, 0, 5, <API key>, <API key>), <API key>("IIR2 Band5", IIR2, BAND5, 255, 0, 5, <API key>, <API key>), }; static int <API key>(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) { int ret; uint32_t zl, zr; bool hphr; struct <API key> *mc; struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol); struct msm8x16_wcd_priv *priv = <API key>(codec); mc = (struct <API key> *)(kcontrol->private_value); hphr = mc->shift; ret = <API key>(&priv->mbhc, &zl, &zr); if (ret) pr_debug("%s: Failed to get mbhc imped", __func__); pr_debug("%s: zl %u, zr %u\n", __func__, zl, zr); ucontrol->value.integer.value[0] = hphr ? zr : zl; return 0; } static const struct snd_kcontrol_new <API key>[] = { SOC_SINGLE_EXT("HPHL Impedance", 0, 0, UINT_MAX, 0, <API key>, NULL), SOC_SINGLE_EXT("HPHR Impedance", 0, 1, UINT_MAX, 0, <API key>, NULL), }; static const char * const rx_mix1_text[] = { "ZERO", "IIR1", "IIR2", "RX1", "RX2", "RX3" }; static const char * const rx_mix2_text[] = { "ZERO", "IIR1", "IIR2" }; static const char * const dec_mux_text[] = { "ZERO", "ADC1", "ADC2", "ADC3", "DMIC1", "DMIC2" }; static const char * const adc2_mux_text[] = { "ZERO", "INP2", "INP3" }; static const char * const rdac2_mux_text[] = { "ZERO", "RX2", "RX1" }; static const char * const iir_inp1_text[] = { "ZERO", "DEC1", "DEC2", "RX1", "RX2", "RX3" }; static const struct soc_enum adc2_enum = SOC_ENUM_SINGLE(0, 0, ARRAY_SIZE(adc2_mux_text), adc2_mux_text); /* RX1 MIX1 */ static const struct soc_enum <API key> = SOC_ENUM_SINGLE(<API key>, 0, 6, rx_mix1_text); static const struct soc_enum <API key> = SOC_ENUM_SINGLE(<API key>, 3, 6, rx_mix1_text); static const struct soc_enum <API key> = SOC_ENUM_SINGLE(<API key>, 0, 6, rx_mix1_text); /* RX1 MIX2 */ static const struct soc_enum <API key> = SOC_ENUM_SINGLE(<API key>, 0, 3, rx_mix2_text); /* RX2 MIX1 */ static const struct soc_enum <API key> = SOC_ENUM_SINGLE(<API key>, 0, 6, rx_mix1_text); static const struct soc_enum <API key> = SOC_ENUM_SINGLE(<API key>, 3, 6, rx_mix1_text); static const struct soc_enum <API key> = SOC_ENUM_SINGLE(<API key>, 0, 6, rx_mix1_text); /* RX2 MIX2 */ static const struct soc_enum <API key> = SOC_ENUM_SINGLE(<API key>, 0, 3, rx_mix2_text); /* RX3 MIX1 */ static const struct soc_enum <API key> = SOC_ENUM_SINGLE(<API key>, 0, 6, rx_mix1_text); static const struct soc_enum <API key> = SOC_ENUM_SINGLE(<API key>, 3, 6, rx_mix1_text); static const struct soc_enum <API key> = SOC_ENUM_SINGLE(<API key>, 0, 6, rx_mix1_text); /* DEC */ static const struct soc_enum dec1_mux_enum = SOC_ENUM_SINGLE(<API key>, 0, 6, dec_mux_text); static const struct soc_enum dec2_mux_enum = SOC_ENUM_SINGLE(<API key>, 3, 6, dec_mux_text); static const struct soc_enum rdac2_mux_enum = SOC_ENUM_SINGLE(<API key>, 0, 3, rdac2_mux_text); static const struct soc_enum iir1_inp1_mux_enum = SOC_ENUM_SINGLE(<API key>, 0, 6, iir_inp1_text); static const struct soc_enum iir2_inp1_mux_enum = SOC_ENUM_SINGLE(<API key>, 0, 6, iir_inp1_text); static const struct snd_kcontrol_new rx_mix1_inp1_mux = SOC_DAPM_ENUM("RX1 MIX1 INP1 Mux", <API key>); static const struct snd_kcontrol_new rx_mix1_inp2_mux = SOC_DAPM_ENUM("RX1 MIX1 INP2 Mux", <API key>); static const struct snd_kcontrol_new rx_mix1_inp3_mux = SOC_DAPM_ENUM("RX1 MIX1 INP3 Mux", <API key>); static const struct snd_kcontrol_new rx2_mix1_inp1_mux = SOC_DAPM_ENUM("RX2 MIX1 INP1 Mux", <API key>); static const struct snd_kcontrol_new rx2_mix1_inp2_mux = SOC_DAPM_ENUM("RX2 MIX1 INP2 Mux", <API key>); static const struct snd_kcontrol_new rx2_mix1_inp3_mux = SOC_DAPM_ENUM("RX2 MIX1 INP3 Mux", <API key>); static const struct snd_kcontrol_new rx3_mix1_inp1_mux = SOC_DAPM_ENUM("RX3 MIX1 INP1 Mux", <API key>); static const struct snd_kcontrol_new rx3_mix1_inp2_mux = SOC_DAPM_ENUM("RX3 MIX1 INP2 Mux", <API key>); static const struct snd_kcontrol_new rx3_mix1_inp3_mux = SOC_DAPM_ENUM("RX3 MIX1 INP3 Mux", <API key>); static const struct snd_kcontrol_new rx1_mix2_inp1_mux = SOC_DAPM_ENUM("RX1 MIX2 INP1 Mux", <API key>); static const struct snd_kcontrol_new rx2_mix2_inp1_mux = SOC_DAPM_ENUM("RX2 MIX2 INP1 Mux", <API key>); static const struct snd_kcontrol_new tx_adc2_mux = SOC_DAPM_ENUM_VIRT("ADC2 MUX Mux", adc2_enum); static int <API key>(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) { struct <API key> *wlist = snd_kcontrol_chip(kcontrol); struct snd_soc_dapm_widget *w = wlist->widgets[0]; struct snd_soc_codec *codec = w->codec; struct soc_enum *e = (struct soc_enum *)kcontrol->private_value; unsigned int dec_mux, decimator; char *dec_name = NULL; char *widget_name = NULL; char *temp; u16 tx_mux_ctl_reg; u8 adc_dmic_sel = 0x0; int ret = 0; char *dec_num; if (ucontrol->value.enumerated.item[0] > e->max - 1) { dev_err(codec->dev, "%s: Invalid enum value: %d\n", __func__, ucontrol->value.enumerated.item[0]); return -EINVAL; } dec_mux = ucontrol->value.enumerated.item[0]; widget_name = kstrndup(w->name, 15, GFP_KERNEL); if (!widget_name) { dev_err(codec->dev, "%s: failed to copy string\n", __func__); return -ENOMEM; } temp = widget_name; dec_name = strsep(&widget_name, " "); widget_name = temp; if (!dec_name) { dev_err(codec->dev, "%s: Invalid decimator = %s\n", __func__, w->name); ret = -EINVAL; goto out; } dec_num = strpbrk(dec_name, "12"); if (dec_num == NULL) { dev_err(codec->dev, "%s: Invalid DEC selected\n", __func__); ret = -EINVAL; goto out; } ret = kstrtouint(dec_num, 10, &decimator); if (ret < 0) { dev_err(codec->dev, "%s: Invalid decimator = %s\n", __func__, dec_name); ret = -EINVAL; goto out; } dev_dbg(w->dapm->dev, "%s(): widget = %s decimator = %u dec_mux = %u\n" , __func__, w->name, decimator, dec_mux); switch (decimator) { case 1: case 2: if ((dec_mux == 4) || (dec_mux == 5)) adc_dmic_sel = 0x1; else adc_dmic_sel = 0x0; break; default: dev_err(codec->dev, "%s: Invalid Decimator = %u\n", __func__, decimator); ret = -EINVAL; goto out; } tx_mux_ctl_reg = <API key> + 32 * (decimator - 1); snd_soc_update_bits(codec, tx_mux_ctl_reg, 0x1, adc_dmic_sel); ret = <API key>(kcontrol, ucontrol); out: kfree(widget_name); return ret; } #define <API key>(xname, xenum) \ { .iface = <API key>, .name = xname, \ .info = <API key>, \ .get = <API key>, \ .put = <API key>, \ .private_value = (unsigned long)&xenum } static const struct snd_kcontrol_new dec1_mux = <API key>("DEC1 MUX Mux", dec1_mux_enum); static const struct snd_kcontrol_new dec2_mux = <API key>("DEC2 MUX Mux", dec2_mux_enum); static const struct snd_kcontrol_new rdac2_mux = <API key>("RDAC2 MUX Mux", rdac2_mux_enum); static const struct snd_kcontrol_new iir1_inp1_mux = SOC_DAPM_ENUM("IIR1 INP1 Mux", iir1_inp1_mux_enum); static const char * const ear_text[] = { "ZERO", "Switch", }; static const struct soc_enum ear_enum = SOC_ENUM_SINGLE(0, 0, ARRAY_SIZE(ear_text), ear_text); static const struct snd_kcontrol_new ear_pa_mux[] = { SOC_DAPM_ENUM_VIRT("EAR_S", ear_enum) }; static const struct snd_kcontrol_new iir2_inp1_mux = SOC_DAPM_ENUM("IIR2 INP1 Mux", iir2_inp1_mux_enum); static const char * const hph_text[] = { "ZERO", "Switch", }; static const struct soc_enum hph_enum = SOC_ENUM_SINGLE(0, 0, ARRAY_SIZE(hph_text), hph_text); static const struct snd_kcontrol_new hphl_mux[] = { SOC_DAPM_ENUM_VIRT("HPHL", hph_enum) }; static const struct snd_kcontrol_new hphr_mux[] = { SOC_DAPM_ENUM_VIRT("HPHR", hph_enum) }; static const struct snd_kcontrol_new spkr_switch[] = { SOC_DAPM_SINGLE("Switch", <API key>, 7, 1, 0) }; static void <API key>(struct snd_soc_codec *codec, int enable) { struct msm8x16_wcd_priv *wcd8x16 = <API key>(codec); dev_dbg(codec->dev, "%s %d\n", __func__, enable); if (enable) { wcd8x16->adc_count++; snd_soc_update_bits(codec, <API key>, 0x20, 0x20); snd_soc_update_bits(codec, <API key>, 0x10, 0x10); } else { wcd8x16->adc_count if (!wcd8x16->adc_count) { snd_soc_update_bits(codec, <API key>, 0x10, 0x00); snd_soc_update_bits(codec, <API key>, 0x20, 0x0); } } } static int <API key>(struct snd_soc_dapm_widget *w, struct snd_kcontrol *kcontrol, int event) { struct snd_soc_codec *codec = w->codec; u16 adc_reg; u8 init_bit_shift; dev_dbg(codec->dev, "%s %d\n", __func__, event); adc_reg = <API key>; if (w->reg == <API key>) init_bit_shift = 5; else if ((w->reg == <API key>) || (w->reg == <API key>)) init_bit_shift = 4; else { dev_err(codec->dev, "%s: Error, invalid adc register\n", __func__); return -EINVAL; } switch (event) { case <API key>: <API key>(codec, 1); if (w->reg == <API key>) snd_soc_update_bits(codec, <API key>, 0x02, 0x02); /* * Add delay of 10 ms to give sufficient time for the voltage * to shoot up and settle so that the txfe init does not * happen when the input voltage is changing too much. */ usleep_range(10000, 10010); snd_soc_update_bits(codec, adc_reg, 1 << init_bit_shift, 1 << init_bit_shift); if (w->reg == <API key>) snd_soc_update_bits(codec, <API key>, 0x03, 0x00); else if ((w->reg == <API key>) || (w->reg == <API key>)) snd_soc_update_bits(codec, <API key>, 0x03, 0x00); usleep_range(CODEC_DELAY_1_MS, CODEC_DELAY_1_1_MS); break; case <API key>: /* * Add delay of 12 ms before deasserting the init * to reduce the tx pop */ usleep_range(12000, 12010); snd_soc_update_bits(codec, adc_reg, 1 << init_bit_shift, 0x00); usleep_range(CODEC_DELAY_1_MS, CODEC_DELAY_1_1_MS); break; case <API key>: <API key>(codec, 0); if (w->reg == <API key>) snd_soc_update_bits(codec, <API key>, 0x02, 0x00); if (w->reg == <API key>) snd_soc_update_bits(codec, <API key>, 0x03, 0x02); else if ((w->reg == <API key>) || (w->reg == <API key>)) snd_soc_update_bits(codec, <API key>, 0x03, 0x02); break; } return 0; } static int <API key>(struct snd_soc_dapm_widget *w, struct snd_kcontrol *kcontrol, int event) { struct snd_soc_codec *codec = w->codec; struct msm8x16_wcd_priv *msm8x16_wcd = <API key>(codec); dev_dbg(w->codec->dev, "%s %d %s\n", __func__, event, w->name); switch (event) { case <API key>: snd_soc_update_bits(codec, <API key>, 0x10, 0x10); snd_soc_update_bits(codec, <API key>, 0x01, 0x01); switch (msm8x16_wcd->boost_option) { case BOOST_SWITCH: if (!msm8x16_wcd->spk_boost_set) snd_soc_update_bits(codec, <API key>, 0x10, 0x10); break; case BOOST_ALWAYS: case BOOST_ON_FOREVER: break; case BYPASS_ALWAYS: snd_soc_update_bits(codec, <API key>, 0x10, 0x10); break; default: pr_err("%s: invalid boost option: %d\n", __func__, msm8x16_wcd->boost_option); break; } usleep_range(CODEC_DELAY_1_MS, CODEC_DELAY_1_1_MS); snd_soc_update_bits(codec, <API key>, 0xE0, 0xE0); if (get_codec_version(msm8x16_wcd) != TOMBAK_1_0) snd_soc_update_bits(codec, <API key>, 0x01, 0x01); break; case <API key>: usleep_range(CODEC_DELAY_1_MS, CODEC_DELAY_1_1_MS); switch (msm8x16_wcd->boost_option) { case BOOST_SWITCH: if (msm8x16_wcd->spk_boost_set) snd_soc_update_bits(codec, <API key>, 0xEF, 0xEF); else snd_soc_update_bits(codec, <API key>, 0x10, 0x00); break; case BOOST_ALWAYS: case BOOST_ON_FOREVER: snd_soc_update_bits(codec, <API key>, 0xEF, 0xEF); break; case BYPASS_ALWAYS: snd_soc_update_bits(codec, <API key>, 0x10, 0x00); break; default: pr_err("%s: invalid boost option: %d\n", __func__, msm8x16_wcd->boost_option); break; } snd_soc_update_bits(codec, <API key>, 0x01, 0x00); snd_soc_update_bits(codec, w->reg, 0x80, 0x80); break; case <API key>: snd_soc_update_bits(codec, <API key>, 0x01, 0x01); msm8x16_wcd->mute_mask |= SPKR_PA_DISABLE; /* * Add 1 ms sleep for the mute to take effect */ usleep_range(CODEC_DELAY_1_MS, CODEC_DELAY_1_1_MS); snd_soc_update_bits(codec, <API key>, 0x10, 0x10); <API key>(codec, SPK_PMD); snd_soc_update_bits(codec, w->reg, 0x80, 0x00); switch (msm8x16_wcd->boost_option) { case BOOST_SWITCH: if (msm8x16_wcd->spk_boost_set) snd_soc_update_bits(codec, <API key>, 0xEF, 0x69); break; case BOOST_ALWAYS: case BOOST_ON_FOREVER: snd_soc_update_bits(codec, <API key>, 0xEF, 0x69); break; case BYPASS_ALWAYS: break; default: pr_err("%s: invalid boost option: %d\n", __func__, msm8x16_wcd->boost_option); break; } break; case <API key>: snd_soc_update_bits(codec, <API key>, 0xE0, 0x00); usleep_range(CODEC_DELAY_1_MS, CODEC_DELAY_1_1_MS); snd_soc_update_bits(codec, <API key>, 0x01, 0x00); snd_soc_update_bits(codec, <API key>, 0x10, 0x00); if (get_codec_version(msm8x16_wcd) != TOMBAK_1_0) snd_soc_update_bits(codec, <API key>, 0x01, 0x00); snd_soc_update_bits(codec, <API key>, 0x10, 0x00); break; } return 0; } static int <API key>(struct snd_soc_dapm_widget *w, struct snd_kcontrol *kcontrol, int event) { struct snd_soc_codec *codec = w->codec; struct msm8x16_wcd_priv *msm8x16_wcd = <API key>(codec); struct <API key> *pdata = NULL; pdata = <API key>(codec->card); dev_dbg(w->codec->dev, "%s event %d w->name %s\n", __func__, event, w->name); switch (event) { case <API key>: snd_soc_update_bits(codec, w->reg, 0x80, 0x80); <API key>(codec, SPK_PMU); break; case <API key>: if (msm8x16_wcd->rx_bias_count == 0) snd_soc_update_bits(codec, <API key>, 0x80, 0x00); } return 0; } static int <API key>(struct snd_soc_dapm_widget *w, struct snd_kcontrol *kcontrol, int event) { struct snd_soc_codec *codec = w->codec; struct msm8x16_wcd_priv *msm8x16_wcd = <API key>(codec); u8 dmic_clk_en; u16 dmic_clk_reg; s32 *dmic_clk_cnt; unsigned int dmic; int ret; char *dec_num = strpbrk(w->name, "12"); if (dec_num == NULL) { dev_err(codec->dev, "%s: Invalid DMIC\n", __func__); return -EINVAL; } ret = kstrtouint(dec_num, 10, &dmic); if (ret < 0) { dev_err(codec->dev, "%s: Invalid DMIC line on the codec\n", __func__); return -EINVAL; } switch (dmic) { case 1: case 2: dmic_clk_en = 0x01; dmic_clk_cnt = &(msm8x16_wcd->dmic_1_2_clk_cnt); dmic_clk_reg = <API key>; dev_dbg(codec->dev, "%s() event %d DMIC%d dmic_1_2_clk_cnt %d\n", __func__, event, dmic, *dmic_clk_cnt); break; default: dev_err(codec->dev, "%s: Invalid DMIC Selection\n", __func__); return -EINVAL; } switch (event) { case <API key>: (*dmic_clk_cnt)++; if (*dmic_clk_cnt == 1) { snd_soc_update_bits(codec, dmic_clk_reg, 0x0E, 0x02); snd_soc_update_bits(codec, dmic_clk_reg, dmic_clk_en, dmic_clk_en); } if (dmic == 1) snd_soc_update_bits(codec, <API key>, 0x07, 0x01); if (dmic == 2) snd_soc_update_bits(codec, <API key>, 0x07, 0x01); break; case <API key>: (*dmic_clk_cnt) if (*dmic_clk_cnt == 0) snd_soc_update_bits(codec, dmic_clk_reg, dmic_clk_en, 0); break; } return 0; } #ifndef <API key> static void <API key>(struct snd_soc_codec *codec, bool enable) { struct msm8x16_wcd_priv *msm8x16_wcd = <API key>(codec); if (get_codec_version(msm8x16_wcd) < CONGA) { if (enable) /* * Set autozeroing for special headset detection and * buttons to work. */ snd_soc_update_bits(codec, <API key>, 0x18, 0x10); else snd_soc_update_bits(codec, <API key>, 0x18, 0x00); } else { pr_debug("%s: Auto Zeroing is not required from CONGA\n", __func__); } } static void <API key>(struct snd_soc_codec *codec) { struct msm8x16_wcd_priv *msm8x16_wcd = <API key>(codec); if (get_codec_version(msm8x16_wcd) == TOMBAK_1_0) { pr_debug("%s: This device needs to be trimmed\n", __func__); /* * Calculate the trim value for each device used * till is comes in production by hardware team */ snd_soc_update_bits(codec, <API key>, 0xA5, 0xA5); snd_soc_update_bits(codec, <API key>, 0xFF, 0x30); } else { pr_debug("%s: This device is trimmed at ATE\n", __func__); } } static int <API key>(struct snd_soc_codec *codec, bool turn_on) { int ret = 0; static int count; dev_dbg(codec->dev, "%s turn_on: %d count: %d\n", __func__, turn_on, count); if (turn_on) { if (!count) { ret = <API key>(&codec->dapm, "MICBIAS_REGULATOR"); snd_soc_dapm_sync(&codec->dapm); } count++; } else { if (count > 0) count if (!count) { ret = <API key>(&codec->dapm, "MICBIAS_REGULATOR"); snd_soc_dapm_sync(&codec->dapm); } } if (ret) dev_err(codec->dev, "%s: Failed to %s external micbias source\n", __func__, turn_on ? "enable" : "disabled"); else dev_dbg(codec->dev, "%s: %s external micbias source\n", __func__, turn_on ? "Enabled" : "Disabled"); return ret; } #endif static int <API key>(struct snd_soc_dapm_widget *w, struct snd_kcontrol *kcontrol, int event) { struct snd_soc_codec *codec = w->codec; u16 micb_int_reg; char *internal1_text = "Internal1"; char *internal2_text = "Internal2"; char *internal3_text = "Internal3"; char *external2_text = "External2"; char *external_text = "External"; bool micbias2; dev_dbg(codec->dev, "%s %d\n", __func__, event); switch (w->reg) { case <API key>: case <API key>: micb_int_reg = <API key>; break; default: dev_err(codec->dev, "%s: Error, invalid micbias register 0x%x\n", __func__, w->reg); return -EINVAL; } micbias2 = (snd_soc_read(codec, <API key>) & 0x80); switch (event) { case <API key>: if (strnstr(w->name, internal1_text, strlen(w->name))) { snd_soc_update_bits(codec, micb_int_reg, 0x80, 0x80); } else if (strnstr(w->name, internal2_text, strlen(w->name))) { snd_soc_update_bits(codec, micb_int_reg, 0x10, 0x10); snd_soc_update_bits(codec, w->reg, 0x60, 0x00); } else if (strnstr(w->name, internal3_text, strlen(w->name))) { snd_soc_update_bits(codec, micb_int_reg, 0x2, 0x2); } if (!strnstr(w->name, external_text, strlen(w->name))) snd_soc_update_bits(codec, <API key>, 0x05, 0x04); break; case <API key>: usleep_range(20000, 20100); if (strnstr(w->name, internal1_text, strlen(w->name))) { snd_soc_update_bits(codec, micb_int_reg, 0x40, 0x40); } else if (strnstr(w->name, internal2_text, strlen(w->name))) { snd_soc_update_bits(codec, micb_int_reg, 0x08, 0x08); <API key>(codec, <API key>); } else if (strnstr(w->name, internal3_text, strlen(w->name))) { snd_soc_update_bits(codec, micb_int_reg, 0x01, 0x01); } else if (strnstr(w->name, external2_text, strlen(w->name))) { <API key>(codec, <API key>); } if (w->reg == <API key>) <API key>(codec, true, micbias2); break; case <API key>: if (strnstr(w->name, internal1_text, strlen(w->name))) { snd_soc_update_bits(codec, micb_int_reg, 0xC0, 0x40); } else if (strnstr(w->name, internal2_text, strlen(w->name))) { <API key>(codec, <API key>); } else if (strnstr(w->name, internal3_text, strlen(w->name))) { snd_soc_update_bits(codec, micb_int_reg, 0x2, 0x0); } else if (strnstr(w->name, external2_text, strlen(w->name))) { /* * send micbias turn off event to mbhc driver and then * break, as no need to set MICB_1_EN register. */ <API key>(codec, <API key>); break; } if (w->reg == <API key>) <API key>(codec, false, micbias2); break; } return 0; } static void <API key>(struct work_struct *work) { struct delayed_work *hpf_delayed_work; struct hpf_work *hpf_work; struct msm8x16_wcd_priv *msm8x16_wcd; struct snd_soc_codec *codec; u16 tx_mux_ctl_reg; u8 hpf_cut_of_freq; hpf_delayed_work = to_delayed_work(work); hpf_work = container_of(hpf_delayed_work, struct hpf_work, dwork); msm8x16_wcd = hpf_work->msm8x16_wcd; codec = hpf_work->msm8x16_wcd->codec; hpf_cut_of_freq = hpf_work->tx_hpf_cut_of_freq; tx_mux_ctl_reg = <API key> + (hpf_work->decimator - 1) * 32; dev_dbg(codec->dev, "%s(): decimator %u hpf_cut_of_freq 0x%x\n", __func__, hpf_work->decimator, (unsigned int)hpf_cut_of_freq); snd_soc_update_bits(codec, <API key>, 0x51, 0x51); snd_soc_update_bits(codec, tx_mux_ctl_reg, 0x30, hpf_cut_of_freq << 4); } #define <API key> 0x30 #define CF_MIN_3DB_4HZ 0x0 #define CF_MIN_3DB_75HZ 0x1 #define CF_MIN_3DB_150HZ 0x2 static int <API key>(struct snd_soc_dapm_widget *w, struct snd_kcontrol *kcontrol, int event) { struct snd_soc_codec *codec = w->codec; struct <API key> *pdata = NULL; unsigned int decimator; struct msm8x16_wcd_priv *msm8x16_wcd = <API key>(codec); char *dec_name = NULL; char *widget_name = NULL; char *temp; int ret = 0, i; u16 dec_reset_reg, tx_vol_ctl_reg, tx_mux_ctl_reg; u8 dec_hpf_cut_of_freq; int offset; char *dec_num; pdata = <API key>(codec->card); dev_dbg(codec->dev, "%s %d\n", __func__, event); widget_name = kstrndup(w->name, 15, GFP_KERNEL); if (!widget_name) return -ENOMEM; temp = widget_name; dec_name = strsep(&widget_name, " "); widget_name = temp; if (!dec_name) { dev_err(codec->dev, "%s: Invalid decimator = %s\n", __func__, w->name); ret = -EINVAL; goto out; } dec_num = strpbrk(dec_name, "12"); if (dec_num == NULL) { dev_err(codec->dev, "%s: Invalid Decimator\n", __func__); ret = -EINVAL; goto out; } ret = kstrtouint(dec_num, 10, &decimator); if (ret < 0) { dev_err(codec->dev, "%s: Invalid decimator = %s\n", __func__, dec_name); ret = -EINVAL; goto out; } dev_dbg(codec->dev, "%s(): widget = %s dec_name = %s decimator = %u\n", __func__, w->name, dec_name, decimator); if (w->reg == <API key>) { dec_reset_reg = <API key>; offset = 0; } else { dev_err(codec->dev, "%s: Error, incorrect dec\n", __func__); ret = -EINVAL; goto out; } tx_vol_ctl_reg = <API key> + 32 * (decimator - 1); tx_mux_ctl_reg = <API key> + 32 * (decimator - 1); switch (event) { case <API key>: /* Enableable TX digital mute */ snd_soc_update_bits(codec, tx_vol_ctl_reg, 0x01, 0x01); for (i = 0; i < NUM_DECIMATORS; i++) { if (decimator == i + 1) msm8x16_wcd->dec_active[i] = true; } dec_hpf_cut_of_freq = snd_soc_read(codec, tx_mux_ctl_reg); dec_hpf_cut_of_freq = (dec_hpf_cut_of_freq & 0x30) >> 4; tx_hpf_work[decimator - 1].tx_hpf_cut_of_freq = dec_hpf_cut_of_freq; if ((dec_hpf_cut_of_freq != CF_MIN_3DB_150HZ)) { /* set cut of freq to CF_MIN_3DB_150HZ (0x1); */ snd_soc_update_bits(codec, tx_mux_ctl_reg, 0x30, CF_MIN_3DB_150HZ << 4); } break; case <API key>: /* enable HPF */ snd_soc_update_bits(codec, tx_mux_ctl_reg , 0x08, 0x00); if (tx_hpf_work[decimator - 1].tx_hpf_cut_of_freq != CF_MIN_3DB_150HZ) { <API key>(&tx_hpf_work[decimator - 1].dwork, msecs_to_jiffies(300)); } /* apply the digital gain after the decimator is enabled*/ if ((w->shift) < ARRAY_SIZE(tx_digital_gain_reg)) snd_soc_write(codec, tx_digital_gain_reg[w->shift + offset], snd_soc_read(codec, tx_digital_gain_reg[w->shift + offset]) ); if (pdata->lb_mode) { pr_debug("%s: loopback mode unmute the DEC\n", __func__); snd_soc_update_bits(codec, tx_vol_ctl_reg, 0x01, 0x00); } break; case <API key>: snd_soc_update_bits(codec, tx_vol_ctl_reg, 0x01, 0x01); msleep(20); snd_soc_update_bits(codec, tx_mux_ctl_reg, 0x08, 0x08); <API key>(&tx_hpf_work[decimator - 1].dwork); break; case <API key>: snd_soc_update_bits(codec, dec_reset_reg, 1 << w->shift, 1 << w->shift); snd_soc_update_bits(codec, dec_reset_reg, 1 << w->shift, 0x0); snd_soc_update_bits(codec, tx_mux_ctl_reg, 0x08, 0x08); snd_soc_update_bits(codec, tx_mux_ctl_reg, 0x30, (tx_hpf_work[decimator - 1].tx_hpf_cut_of_freq) << 4); snd_soc_update_bits(codec, tx_vol_ctl_reg, 0x01, 0x00); for (i = 0; i < NUM_DECIMATORS; i++) { if (decimator == i + 1) msm8x16_wcd->dec_active[i] = false; } break; } out: kfree(widget_name); return ret; } static int <API key>(struct snd_soc_dapm_widget *w, struct snd_kcontrol *kcontrol, int event) { struct snd_soc_codec *codec = w->codec; struct msm8x16_wcd_priv *msm8x16_wcd = <API key>(codec); int ret = 0; if (!msm8x16_wcd->ext_spk_boost_set) { dev_dbg(codec->dev, "%s: ext_boost not supported/disabled\n", __func__); return 0; } dev_dbg(codec->dev, "%s: %s %d\n", __func__, w->name, event); switch (event) { case <API key>: if (msm8x16_wcd->spkdrv_reg) { ret = regulator_enable(msm8x16_wcd->spkdrv_reg); if (ret) dev_err(codec->dev, "%s Failed to enable spkdrv reg %s\n", __func__, <API key>); } break; case <API key>: if (msm8x16_wcd->spkdrv_reg) { ret = regulator_disable(msm8x16_wcd->spkdrv_reg); if (ret) dev_err(codec->dev, "%s: Failed to disable spkdrv_reg %s\n", __func__, <API key>); } break; } return 0; } static int <API key>(struct snd_soc_dapm_widget *w, struct snd_kcontrol *kcontrol, int event) { struct snd_soc_codec *codec = w->codec; struct msm8x16_wcd_priv *msm8x16_wcd = <API key>(codec); dev_dbg(codec->dev, "%s %d %s\n", __func__, event, w->name); switch (event) { case <API key>: /* apply the digital gain after the interpolator is enabled*/ if ((w->shift) < ARRAY_SIZE(rx_digital_gain_reg)) snd_soc_write(codec, rx_digital_gain_reg[w->shift], snd_soc_read(codec, rx_digital_gain_reg[w->shift]) ); break; case <API key>: snd_soc_update_bits(codec, <API key>, 1 << w->shift, 1 << w->shift); snd_soc_update_bits(codec, <API key>, 1 << w->shift, 0x0); /* * disable the mute enabled during the PMD of this device */ if (msm8x16_wcd->mute_mask & HPHL_PA_DISABLE) { pr_debug("disabling HPHL mute\n"); snd_soc_update_bits(codec, <API key>, 0x01, 0x00); msm8x16_wcd->mute_mask &= ~(HPHL_PA_DISABLE); } if (msm8x16_wcd->mute_mask & HPHR_PA_DISABLE) { pr_debug("disabling HPHR mute\n"); snd_soc_update_bits(codec, <API key>, 0x01, 0x00); msm8x16_wcd->mute_mask &= ~(HPHR_PA_DISABLE); } if (msm8x16_wcd->mute_mask & SPKR_PA_DISABLE) { pr_debug("disabling SPKR mute\n"); snd_soc_update_bits(codec, <API key>, 0x01, 0x00); msm8x16_wcd->mute_mask &= ~(SPKR_PA_DISABLE); } if (msm8x16_wcd->mute_mask & EAR_PA_DISABLE) { pr_debug("disabling EAR mute\n"); snd_soc_update_bits(codec, <API key>, 0x01, 0x00); msm8x16_wcd->mute_mask &= ~(EAR_PA_DISABLE); } } return 0; } /* The register address is the same as other codec so it can use resmgr */ static int <API key>(struct snd_soc_dapm_widget *w, struct snd_kcontrol *kcontrol, int event) { struct snd_soc_codec *codec = w->codec; struct msm8x16_wcd_priv *msm8x16_wcd = <API key>(codec); dev_dbg(codec->dev, "%s %d\n", __func__, event); switch (event) { case <API key>: msm8x16_wcd->rx_bias_count++; if (msm8x16_wcd->rx_bias_count == 1) { snd_soc_update_bits(codec, <API key>, 0x80, 0x80); snd_soc_update_bits(codec, <API key>, 0x01, 0x01); } break; case <API key>: msm8x16_wcd->rx_bias_count if (msm8x16_wcd->rx_bias_count == 0) { snd_soc_update_bits(codec, <API key>, 0x01, 0x00); snd_soc_update_bits(codec, <API key>, 0x80, 0x00); } break; } dev_dbg(codec->dev, "%s rx_bias_count = %d\n", __func__, msm8x16_wcd->rx_bias_count); return 0; } #ifndef <API key> static uint32_t <API key>(uint32_t imped) { int i; for (i = 0; i < ARRAY_SIZE(wcd_imped_val) - 1; i++) { if (imped >= wcd_imped_val[i] && imped < wcd_imped_val[i + 1]) break; } pr_debug("%s: selected impedance value = %d\n", __func__, wcd_imped_val[i]); return wcd_imped_val[i]; } void wcd_imped_config(struct snd_soc_codec *codec, uint32_t imped, bool set_gain) { uint32_t value; struct msm8x16_wcd_priv *msm8x16_wcd = <API key>(codec); value = <API key>(imped); if (value < wcd_imped_val[0]) { pr_debug("%s, detected impedance is less than 4 Ohm\n", __func__); return; } if (value >= wcd_imped_val[ARRAY_SIZE(wcd_imped_val) - 1]) { pr_err("%s, invalid imped, greater than 48 Ohm\n = %d\n", __func__, value); return; } if (get_codec_version(msm8x16_wcd) < CONGA) { pr_debug("%s: Default gain is set\n", __func__); } else { /* * For 32Ohm load and higher loads, Set 0x19E bit 5 * to 1 (POS_6_DB_DI). For loads lower than 32Ohm * (such as 16Ohm load), Set 0x19E bit 5 to 0 * (POS_1P5_DB_DI) */ if (set_gain) { if (value >= 32) snd_soc_update_bits(codec, <API key>, 0x20, 0x20); else snd_soc_update_bits(codec, <API key>, 0x20, 0x00); } else { snd_soc_update_bits(codec, <API key>, 0x20, 0x00); } } pr_debug("%s: Exit\n", __func__); } #endif static int <API key>(struct snd_soc_dapm_widget *w, struct snd_kcontrol *kcontrol, int event) { struct snd_soc_codec *codec = w->codec; #ifndef <API key> uint32_t impedl, impedr; struct msm8x16_wcd_priv *msm8x16_wcd = <API key>(codec); int ret; ret = <API key>(&msm8x16_wcd->mbhc, &impedl, &impedr); #endif dev_dbg(codec->dev, "%s %s %d\n", __func__, w->name, event); switch (event) { case <API key>: snd_soc_update_bits(codec, <API key>, 0x02, 0x02); snd_soc_update_bits(codec, <API key>, 0x01, 0x01); snd_soc_update_bits(codec, <API key>, 0x02, 0x02); #ifndef <API key> if (!ret) wcd_imped_config(codec, impedl, true); else dev_err(codec->dev, "Failed to get mbhc impedance %d\n", ret); #endif break; case <API key>: snd_soc_update_bits(codec, <API key>, 0x02, 0x00); break; case <API key>: #ifndef <API key> wcd_imped_config(codec, impedl, false); #endif snd_soc_update_bits(codec, <API key>, 0x02, 0x00); snd_soc_update_bits(codec, <API key>, 0x01, 0x00); break; } return 0; } static int <API key>(struct snd_soc_dapm_widget *w, struct snd_kcontrol *kcontrol, int event) { struct snd_soc_codec *codec = w->codec; dev_dbg(codec->dev, "%s %s %d\n", __func__, w->name, event); switch (event) { case <API key>: snd_soc_update_bits(codec, <API key>, 0x02, 0x02); snd_soc_update_bits(codec, <API key>, 0x02, 0x02); snd_soc_update_bits(codec, <API key>, 0x01, 0x01); break; case <API key>: snd_soc_update_bits(codec, <API key>, 0x02, 0x00); break; case <API key>: snd_soc_update_bits(codec, <API key>, 0x01, 0x00); snd_soc_update_bits(codec, <API key>, 0x02, 0x00); break; } return 0; } static int <API key>(struct snd_soc_dapm_widget *w, struct snd_kcontrol *kcontrol, int event) { struct snd_soc_codec *codec = w->codec; struct msm8x16_wcd_priv *msm8x16_wcd = <API key>(codec); dev_dbg(codec->dev, "%s: %s event = %d\n", __func__, w->name, event); switch (event) { case <API key>: if (w->shift == 5) { snd_soc_update_bits(codec, <API key>, 0x04, 0x04); <API key>(codec, <API key>); } else if (w->shift == 4) { snd_soc_update_bits(codec, <API key>, 0x04, 0x04); <API key>(codec, <API key>); } snd_soc_update_bits(codec, <API key>, 0x20, 0x20); break; case <API key>: usleep_range(4000, 4100); if (w->shift == 5) snd_soc_update_bits(codec, <API key>, 0x01, 0x00); else if (w->shift == 4) snd_soc_update_bits(codec, <API key>, 0x01, 0x00); usleep_range(10000, 10100); break; case <API key>: if (w->shift == 5) { snd_soc_update_bits(codec, <API key>, 0x01, 0x01); msleep(20); msm8x16_wcd->mute_mask |= HPHL_PA_DISABLE; } else if (w->shift == 4) { snd_soc_update_bits(codec, <API key>, 0x01, 0x01); msleep(20); msm8x16_wcd->mute_mask |= HPHR_PA_DISABLE; } break; case <API key>: if (w->shift == 5) { clear_bit(<API key>, &msm8x16_wcd->mbhc.hph_pa_dac_state); snd_soc_update_bits(codec, <API key>, 0x04, 0x00); <API key>(codec, <API key>); } else if (w->shift == 4) { clear_bit(<API key>, &msm8x16_wcd->mbhc.hph_pa_dac_state); snd_soc_update_bits(codec, <API key>, 0x04, 0x00); <API key>(codec, <API key>); } usleep_range(4000, 4100); usleep_range(CODEC_DELAY_1_MS, CODEC_DELAY_1_1_MS); snd_soc_update_bits(codec, <API key>, 0x40, 0x40); dev_dbg(codec->dev, "%s: sleep 10 ms after %s PA disable.\n", __func__, w->name); usleep_range(10000, 10100); break; } return 0; } static const struct snd_soc_dapm_route audio_map[] = { {"RX_I2S_CLK", NULL, "CDC_CONN"}, {"I2S RX1", NULL, "RX_I2S_CLK"}, {"I2S RX2", NULL, "RX_I2S_CLK"}, {"I2S RX3", NULL, "RX_I2S_CLK"}, {"I2S TX1", NULL, "TX_I2S_CLK"}, {"I2S TX2", NULL, "TX_I2S_CLK"}, {"I2S TX1", NULL, "DEC1 MUX"}, {"I2S TX2", NULL, "DEC2 MUX"}, /* RDAC Connections */ {"HPHR DAC", NULL, "RDAC2 MUX"}, {"RDAC2 MUX", "RX1", "RX1 CHAIN"}, {"RDAC2 MUX", "RX2", "RX2 CHAIN"}, /* Earpiece (RX MIX1) */ {"EAR", NULL, "EAR_S"}, {"EAR_S", "Switch", "EAR PA"}, {"EAR PA", NULL, "RX_BIAS"}, {"EAR PA", NULL, "HPHL DAC"}, {"EAR PA", NULL, "HPHR DAC"}, {"EAR PA", NULL, "EAR CP"}, /* Headset (RX MIX1 and RX MIX2) */ {"HEADPHONE", NULL, "HPHL PA"}, {"HEADPHONE", NULL, "HPHR PA"}, {"HPHL PA", NULL, "HPHL"}, {"HPHR PA", NULL, "HPHR"}, {"HPHL", "Switch", "HPHL DAC"}, {"HPHR", "Switch", "HPHR DAC"}, {"HPHL PA", NULL, "CP"}, {"HPHL PA", NULL, "RX_BIAS"}, {"HPHR PA", NULL, "CP"}, {"HPHR PA", NULL, "RX_BIAS"}, {"HPHL DAC", NULL, "RX1 CHAIN"}, {"SPK_OUT", NULL, "SPK PA"}, {"SPK PA", NULL, "SPK_RX_BIAS"}, {"SPK PA", NULL, "SPK DAC"}, {"SPK DAC", "Switch", "RX3 CHAIN"}, {"SPK DAC", NULL, "VDD_SPKDRV"}, {"RX1 CHAIN", NULL, "RX1 CLK"}, {"RX2 CHAIN", NULL, "RX2 CLK"}, {"RX3 CHAIN", NULL, "RX3 CLK"}, {"RX1 CHAIN", NULL, "RX1 MIX2"}, {"RX2 CHAIN", NULL, "RX2 MIX2"}, {"RX3 CHAIN", NULL, "RX3 MIX1"}, {"RX1 MIX1", NULL, "RX1 MIX1 INP1"}, {"RX1 MIX1", NULL, "RX1 MIX1 INP2"}, {"RX1 MIX1", NULL, "RX1 MIX1 INP3"}, {"RX2 MIX1", NULL, "RX2 MIX1 INP1"}, {"RX2 MIX1", NULL, "RX2 MIX1 INP2"}, {"RX3 MIX1", NULL, "RX3 MIX1 INP1"}, {"RX3 MIX1", NULL, "RX3 MIX1 INP2"}, {"RX1 MIX2", NULL, "RX1 MIX1"}, {"RX1 MIX2", NULL, "RX1 MIX2 INP1"}, {"RX2 MIX2", NULL, "RX2 MIX1"}, {"RX2 MIX2", NULL, "RX2 MIX2 INP1"}, {"RX1 MIX1 INP1", "RX1", "I2S RX1"}, {"RX1 MIX1 INP1", "RX2", "I2S RX2"}, {"RX1 MIX1 INP1", "RX3", "I2S RX3"}, {"RX1 MIX1 INP1", "IIR1", "IIR1"}, {"RX1 MIX1 INP1", "IIR2", "IIR2"}, {"RX1 MIX1 INP2", "RX1", "I2S RX1"}, {"RX1 MIX1 INP2", "RX2", "I2S RX2"}, {"RX1 MIX1 INP2", "RX3", "I2S RX3"}, {"RX1 MIX1 INP2", "IIR1", "IIR1"}, {"RX1 MIX1 INP2", "IIR2", "IIR2"}, {"RX1 MIX1 INP3", "RX1", "I2S RX1"}, {"RX1 MIX1 INP3", "RX2", "I2S RX2"}, {"RX1 MIX1 INP3", "RX3", "I2S RX3"}, {"RX2 MIX1 INP1", "RX1", "I2S RX1"}, {"RX2 MIX1 INP1", "RX2", "I2S RX2"}, {"RX2 MIX1 INP1", "RX3", "I2S RX3"}, {"RX2 MIX1 INP1", "IIR1", "IIR1"}, {"RX2 MIX1 INP1", "IIR2", "IIR2"}, {"RX2 MIX1 INP2", "RX1", "I2S RX1"}, {"RX2 MIX1 INP2", "RX2", "I2S RX2"}, {"RX2 MIX1 INP2", "RX3", "I2S RX3"}, {"RX2 MIX1 INP2", "IIR1", "IIR1"}, {"RX2 MIX1 INP2", "IIR2", "IIR2"}, {"RX3 MIX1 INP1", "RX1", "I2S RX1"}, {"RX3 MIX1 INP1", "RX2", "I2S RX2"}, {"RX3 MIX1 INP1", "RX3", "I2S RX3"}, {"RX3 MIX1 INP1", "IIR1", "IIR1"}, {"RX3 MIX1 INP1", "IIR2", "IIR2"}, {"RX3 MIX1 INP2", "RX1", "I2S RX1"}, {"RX3 MIX1 INP2", "RX2", "I2S RX2"}, {"RX3 MIX1 INP2", "RX3", "I2S RX3"}, {"RX3 MIX1 INP2", "IIR1", "IIR1"}, {"RX3 MIX1 INP2", "IIR2", "IIR2"}, {"RX1 MIX2 INP1", "IIR1", "IIR1"}, {"RX2 MIX2 INP1", "IIR1", "IIR1"}, {"RX1 MIX2 INP1", "IIR2", "IIR2"}, {"RX2 MIX2 INP1", "IIR2", "IIR2"}, /* Decimator Inputs */ {"DEC1 MUX", "DMIC1", "DMIC1"}, {"DEC1 MUX", "DMIC2", "DMIC2"}, {"DEC1 MUX", "ADC1", "ADC1"}, {"DEC1 MUX", "ADC2", "ADC2"}, {"DEC1 MUX", "ADC3", "ADC3"}, {"DEC1 MUX", NULL, "CDC_CONN"}, {"DEC2 MUX", "DMIC1", "DMIC1"}, {"DEC2 MUX", "DMIC2", "DMIC2"}, {"DEC2 MUX", "ADC1", "ADC1"}, {"DEC2 MUX", "ADC2", "ADC2"}, {"DEC2 MUX", "ADC3", "ADC3"}, {"DEC2 MUX", NULL, "CDC_CONN"}, /* ADC Connections */ {"ADC2", NULL, "ADC2 MUX"}, {"ADC3", NULL, "ADC2 MUX"}, {"ADC2 MUX", "INP2", "ADC2_INP2"}, {"ADC2 MUX", "INP3", "ADC2_INP3"}, {"ADC1", NULL, "AMIC1"}, {"ADC2_INP2", NULL, "AMIC2"}, {"ADC2_INP3", NULL, "AMIC3"}, /* TODO: Fix this */ {"IIR1", NULL, "IIR1 INP1 MUX"}, {"IIR1 INP1 MUX", "DEC1", "DEC1 MUX"}, {"IIR1 INP1 MUX", "DEC2", "DEC2 MUX"}, {"IIR2", NULL, "IIR2 INP1 MUX"}, {"IIR2 INP1 MUX", "DEC1", "DEC1 MUX"}, {"IIR2 INP1 MUX", "DEC2", "DEC2 MUX"}, {"MIC BIAS Internal1", NULL, "INT_LDO_H"}, {"MIC BIAS Internal2", NULL, "INT_LDO_H"}, {"MIC BIAS External", NULL, "INT_LDO_H"}, {"MIC BIAS External2", NULL, "INT_LDO_H"}, {"MIC BIAS Internal1", NULL, "MICBIAS_REGULATOR"}, {"MIC BIAS Internal2", NULL, "MICBIAS_REGULATOR"}, {"MIC BIAS External", NULL, "MICBIAS_REGULATOR"}, {"MIC BIAS External2", NULL, "MICBIAS_REGULATOR"}, }; static int msm8x16_wcd_startup(struct snd_pcm_substream *substream, struct snd_soc_dai *dai) { dev_dbg(dai->codec->dev, "%s(): substream = %s stream = %d\n", __func__, substream->name, substream->stream); return 0; } static void <API key>(struct snd_pcm_substream *substream, struct snd_soc_dai *dai) { dev_dbg(dai->codec->dev, "%s(): substream = %s stream = %d\n" , __func__, substream->name, substream->stream); } static int <API key>(struct snd_soc_codec *codec, int enable) { struct <API key> *pdata = NULL; pdata = <API key>(codec->card); if (enable) { snd_soc_update_bits(codec, <API key>, 0x01, 0x01); snd_soc_update_bits(codec, <API key>, 0x03, 0x03); snd_soc_update_bits(codec, <API key>, 0x30, 0x30); snd_soc_update_bits(codec, <API key>, 0x80, 0x80); snd_soc_update_bits(codec, <API key>, 0x0C, 0x0C); if (pdata->mclk_freq == 12288000) snd_soc_update_bits(codec, <API key>, 0x01, 0x00); else if (pdata->mclk_freq == 9600000) snd_soc_update_bits(codec, <API key>, 0x01, 0x01); } else { snd_soc_update_bits(codec, <API key>, 0x0C, 0x00); snd_soc_update_bits(codec, <API key>, 0x03, 0x00); } return 0; } int <API key>(struct snd_soc_codec *codec, int mclk_enable, bool dapm) { struct msm8x16_wcd_priv *msm8x16_wcd = <API key>(codec); dev_dbg(codec->dev, "%s: mclk_enable = %u, dapm = %d\n", __func__, mclk_enable, dapm); if (mclk_enable) { msm8x16_wcd->mclk_enabled = true; <API key>(codec, 1); } else { if (!msm8x16_wcd->mclk_enabled) { dev_err(codec->dev, "Error, MCLK already diabled\n"); return -EINVAL; } msm8x16_wcd->mclk_enabled = false; <API key>(codec, 0); } return 0; } static int <API key>(struct snd_soc_dai *dai, int clk_id, unsigned int freq, int dir) { dev_dbg(dai->codec->dev, "%s\n", __func__); return 0; } static int <API key>(struct snd_soc_dai *dai, unsigned int fmt) { dev_dbg(dai->codec->dev, "%s\n", __func__); return 0; } static int <API key>(struct snd_soc_dai *dai, unsigned int tx_num, unsigned int *tx_slot, unsigned int rx_num, unsigned int *rx_slot) { dev_dbg(dai->codec->dev, "%s\n", __func__); return 0; } static int <API key>(struct snd_soc_dai *dai, unsigned int *tx_num, unsigned int *tx_slot, unsigned int *rx_num, unsigned int *rx_slot) { dev_dbg(dai->codec->dev, "%s\n", __func__); return 0; } static int <API key>(struct snd_soc_dai *dai, u8 rx_fs_rate_reg_val, u32 sample_rate) { return 0; } static int <API key>(struct snd_soc_dai *dai, u8 tx_fs_rate_reg_val, u32 sample_rate) { return 0; } static int <API key>(struct snd_pcm_substream *substream, struct snd_pcm_hw_params *params, struct snd_soc_dai *dai) { u8 tx_fs_rate, rx_fs_rate; int ret; dev_dbg(dai->codec->dev, "%s: dai_name = %s DAI-ID %x rate %d num_ch %d format %d\n", __func__, dai->name, dai->id, params_rate(params), params_channels(params), params_format(params)); switch (params_rate(params)) { case 8000: tx_fs_rate = 0x00; rx_fs_rate = 0x00; break; case 16000: tx_fs_rate = 0x01; rx_fs_rate = 0x20; break; case 32000: tx_fs_rate = 0x02; rx_fs_rate = 0x40; break; case 48000: tx_fs_rate = 0x03; rx_fs_rate = 0x60; break; case 96000: tx_fs_rate = 0x04; rx_fs_rate = 0x80; break; case 192000: tx_fs_rate = 0x05; rx_fs_rate = 0xA0; break; default: dev_err(dai->codec->dev, "%s: Invalid sampling rate %d\n", __func__, params_rate(params)); return -EINVAL; } switch (substream->stream) { case <API key>: ret = <API key>(dai, tx_fs_rate, params_rate(params)); if (ret < 0) { dev_err(dai->codec->dev, "%s: set decimator rate failed %d\n", __func__, ret); return ret; } break; case <API key>: ret = <API key>(dai, rx_fs_rate, params_rate(params)); if (ret < 0) { dev_err(dai->codec->dev, "%s: set decimator rate failed %d\n", __func__, ret); return ret; } break; default: dev_err(dai->codec->dev, "%s: Invalid stream type %d\n", __func__, substream->stream); return -EINVAL; } switch (params_format(params)) { case <API key>: snd_soc_update_bits(dai->codec, <API key>, 0x20, 0x20); break; case <API key>: snd_soc_update_bits(dai->codec, <API key>, 0x20, 0x00); break; default: dev_err(dai->codec->dev, "%s: wrong format selected\n", __func__); return -EINVAL; break; } return 0; } int <API key>(struct snd_soc_dai *dai, int mute) { struct snd_soc_codec *codec = NULL; u16 tx_vol_ctl_reg = 0; u8 decimator = 0, i; struct msm8x16_wcd_priv *msm8x16_wcd; pr_debug("%s: Digital Mute val = %d\n", __func__, mute); if (!dai || !dai->codec) { pr_err("%s: Invalid params\n", __func__); return -EINVAL; } codec = dai->codec; msm8x16_wcd = <API key>(codec); if (dai->id != AIF1_CAP) { dev_dbg(codec->dev, "%s: Not capture use case skip\n", __func__); return 0; } mute = (mute) ? 1 : 0; if (!mute) { /* * 15 ms is an emperical value for the mute time * that was arrived by checking the pop level * to be inaudible */ usleep_range(15000, 15010); } for (i = 0; i < NUM_DECIMATORS; i++) { if (msm8x16_wcd->dec_active[i]) decimator = i + 1; if (decimator && decimator <= NUM_DECIMATORS) { pr_debug("%s: Mute = %d Decimator = %d", __func__, mute, decimator); tx_vol_ctl_reg = <API key> + 32 * (decimator - 1); snd_soc_update_bits(codec, tx_vol_ctl_reg, 0x01, mute); } decimator = 0; } return 0; } static struct snd_soc_dai_ops msm8x16_wcd_dai_ops = { .startup = msm8x16_wcd_startup, .shutdown = <API key>, .hw_params = <API key>, .set_sysclk = <API key>, .set_fmt = <API key>, .set_channel_map = <API key>, .get_channel_map = <API key>, .digital_mute = <API key>, }; static struct snd_soc_dai_driver msm8x16_wcd_i2s_dai[] = { { .name = "msm8x16_wcd_i2s_rx1", .id = AIF1_PB, .playback = { .stream_name = "AIF1 Playback", .rates = MSM8X16_WCD_RATES, .formats = MSM8X16_WCD_FORMATS, .rate_max = 192000, .rate_min = 8000, .channels_min = 1, .channels_max = 3, }, .ops = &msm8x16_wcd_dai_ops, }, { .name = "msm8x16_wcd_i2s_tx1", .id = AIF1_CAP, .capture = { .stream_name = "AIF1 Capture", .rates = MSM8X16_WCD_RATES, .formats = MSM8X16_WCD_FORMATS, .rate_max = 192000, .rate_min = 8000, .channels_min = 1, .channels_max = 4, }, .ops = &msm8x16_wcd_dai_ops, }, }; static int <API key>(struct snd_soc_dapm_widget *w, struct snd_kcontrol *kcontrol, int event) { struct snd_soc_codec *codec = w->codec; switch (event) { case <API key>: dev_dbg(w->codec->dev, "%s: PMU:Sleeping 20ms after disabling mute\n", __func__); break; case <API key>: dev_dbg(w->codec->dev, "%s: PMD:Sleeping 20ms after disabling mute\n", __func__); snd_soc_update_bits(codec, w->reg, 1 << w->shift, 0x00); msleep(20); break; } return 0; } static int <API key>(struct snd_soc_dapm_widget *w, struct snd_kcontrol *kcontrol, int event) { struct snd_soc_codec *codec = w->codec; struct msm8x16_wcd_priv *msm8x16_wcd = <API key>(codec); switch (event) { case <API key>: dev_dbg(w->codec->dev, "%s: Sleeping 20ms after select EAR PA\n", __func__); snd_soc_update_bits(codec, <API key>, 0x80, 0x80); if (get_codec_version(msm8x16_wcd) < CONGA) snd_soc_update_bits(codec, <API key>, 0xFF, 0x2A); break; case <API key>: dev_dbg(w->codec->dev, "%s: Sleeping 20ms after enabling EAR PA\n", __func__); snd_soc_update_bits(codec, <API key>, 0x40, 0x40); usleep_range(7000, 7100); snd_soc_update_bits(codec, <API key>, 0x01, 0x00); break; case <API key>: snd_soc_update_bits(codec, <API key>, 0x01, 0x01); msleep(20); msm8x16_wcd->mute_mask |= EAR_PA_DISABLE; if (msm8x16_wcd->boost_option == BOOST_ALWAYS) { dev_dbg(w->codec->dev, "%s: boost_option:%d, tear down ear\n", __func__, msm8x16_wcd->boost_option); <API key>(codec, EAR_PMD); } break; case <API key>: dev_dbg(w->codec->dev, "%s: Sleeping 7ms after disabling EAR PA\n", __func__); snd_soc_update_bits(codec, <API key>, 0x40, 0x00); usleep_range(7000, 7100); /* * Reset pa select bit from ear to hph after ear pa * is disabled to reduce ear turn off pop */ snd_soc_update_bits(codec, <API key>, 0x80, 0x00); if (get_codec_version(msm8x16_wcd) < CONGA) snd_soc_update_bits(codec, <API key>, 0xFF, 0x16); break; } return 0; } static const struct snd_soc_dapm_widget <API key>[] = { /*RX stuff */ SND_SOC_DAPM_OUTPUT("EAR"), SND_SOC_DAPM_PGA_E("EAR PA", SND_SOC_NOPM, 0, 0, NULL, 0, <API key>, <API key> | <API key> | <API key> | <API key>), <API key>("EAR_S", SND_SOC_NOPM, 0, 0, ear_pa_mux), SND_SOC_DAPM_AIF_IN("I2S RX1", "AIF1 Playback", 0, SND_SOC_NOPM, 0, 0), SND_SOC_DAPM_AIF_IN("I2S RX2", "AIF1 Playback", 0, SND_SOC_NOPM, 0, 0), SND_SOC_DAPM_AIF_IN("I2S RX3", "AIF1 Playback", 0, SND_SOC_NOPM, 0, 0), SND_SOC_DAPM_SUPPLY("INT_LDO_H", SND_SOC_NOPM, 1, 0, NULL, 0), SND_SOC_DAPM_OUTPUT("HEADPHONE"), SND_SOC_DAPM_PGA_E("HPHL PA", <API key>, 5, 0, NULL, 0, <API key>, <API key> | <API key> | <API key> | <API key>), <API key>("HPHL", SND_SOC_NOPM, 0, 0, hphl_mux), <API key>("HPHL DAC", <API key>, 3, 0, NULL, 0, <API key>, <API key> | <API key> | <API key>), SND_SOC_DAPM_PGA_E("HPHR PA", <API key>, 4, 0, NULL, 0, <API key>, <API key> | <API key> | <API key> | <API key>), <API key>("HPHR", SND_SOC_NOPM, 0, 0, hphr_mux), <API key>("HPHR DAC", <API key>, 3, 0, NULL, 0, <API key>, <API key> | <API key> | <API key>), SND_SOC_DAPM_MIXER("SPK DAC", SND_SOC_NOPM, 0, 0, spkr_switch, ARRAY_SIZE(spkr_switch)), /* Speaker */ SND_SOC_DAPM_OUTPUT("SPK_OUT"), SND_SOC_DAPM_PGA_E("SPK PA", <API key>, 6, 0 , NULL, 0, <API key>, <API key> | <API key> | <API key> | <API key>), SND_SOC_DAPM_SUPPLY("VDD_SPKDRV", SND_SOC_NOPM, 0, 0, <API key>, <API key> | <API key>), SND_SOC_DAPM_MIXER("RX1 MIX1", SND_SOC_NOPM, 0, 0, NULL, 0), SND_SOC_DAPM_MIXER("RX2 MIX1", SND_SOC_NOPM, 0, 0, NULL, 0), <API key>("RX1 MIX2", <API key>, 0, 0, NULL, 0, <API key>, <API key> | <API key>), <API key>("RX2 MIX2", <API key>, 1, 0, NULL, 0, <API key>, <API key> | <API key>), <API key>("RX3 MIX1", <API key>, 2, 0, NULL, 0, <API key>, <API key> | <API key>), SND_SOC_DAPM_SUPPLY("RX1 CLK", <API key>, 0, 0, NULL, 0), SND_SOC_DAPM_SUPPLY("RX2 CLK", <API key>, 1, 0, NULL, 0), SND_SOC_DAPM_SUPPLY("RX3 CLK", <API key>, 2, 0, <API key>, <API key> | <API key>), <API key>("RX1 CHAIN", <API key>, 0, 0, NULL, 0, <API key>, <API key> | <API key>), <API key>("RX2 CHAIN", <API key>, 0, 0, NULL, 0, <API key>, <API key> | <API key>), <API key>("RX3 CHAIN", <API key>, 0, 0, NULL, 0, <API key>, <API key> | <API key>), SND_SOC_DAPM_MUX("RX1 MIX1 INP1", SND_SOC_NOPM, 0, 0, &rx_mix1_inp1_mux), SND_SOC_DAPM_MUX("RX1 MIX1 INP2", SND_SOC_NOPM, 0, 0, &rx_mix1_inp2_mux), SND_SOC_DAPM_MUX("RX1 MIX1 INP3", SND_SOC_NOPM, 0, 0, &rx_mix1_inp3_mux), SND_SOC_DAPM_MUX("RX2 MIX1 INP1", SND_SOC_NOPM, 0, 0, &rx2_mix1_inp1_mux), SND_SOC_DAPM_MUX("RX2 MIX1 INP2", SND_SOC_NOPM, 0, 0, &rx2_mix1_inp2_mux), SND_SOC_DAPM_MUX("RX2 MIX1 INP3", SND_SOC_NOPM, 0, 0, &rx2_mix1_inp3_mux), SND_SOC_DAPM_MUX("RX3 MIX1 INP1", SND_SOC_NOPM, 0, 0, &rx3_mix1_inp1_mux), SND_SOC_DAPM_MUX("RX3 MIX1 INP2", SND_SOC_NOPM, 0, 0, &rx3_mix1_inp2_mux), SND_SOC_DAPM_MUX("RX3 MIX1 INP3", SND_SOC_NOPM, 0, 0, &rx3_mix1_inp3_mux), SND_SOC_DAPM_MUX("RX1 MIX2 INP1", SND_SOC_NOPM, 0, 0, &rx1_mix2_inp1_mux), SND_SOC_DAPM_MUX("RX2 MIX2 INP1", SND_SOC_NOPM, 0, 0, &rx2_mix2_inp1_mux), SND_SOC_DAPM_SUPPLY("MICBIAS_REGULATOR", SND_SOC_NOPM, ON_DEMAND_MICBIAS, 0, <API key>, <API key> | <API key>), SND_SOC_DAPM_SUPPLY("CP", <API key>, 0, 0, <API key>, <API key> | <API key> | <API key>), SND_SOC_DAPM_SUPPLY("EAR CP", <API key>, 4, 0, <API key>, <API key> | <API key> | <API key>), <API key>("RX_BIAS", 1, SND_SOC_NOPM, 0, 0, <API key>, <API key> | <API key>), <API key>("SPK_RX_BIAS", 1, SND_SOC_NOPM, 0, 0, <API key>, <API key> | <API key>), <API key>("CDC_CONN", -2, <API key>, 2, 0, NULL, 0), SND_SOC_DAPM_INPUT("AMIC1"), <API key>("MIC BIAS Internal1", <API key>, 7, 0, <API key>, <API key> | <API key> | <API key>), <API key>("MIC BIAS Internal2", <API key>, 7, 0, <API key>, <API key> | <API key> | <API key>), <API key>("MIC BIAS Internal3", <API key>, 7, 0, <API key>, <API key> | <API key> | <API key>), SND_SOC_DAPM_ADC_E("ADC1", NULL, <API key>, 7, 0, <API key>, <API key> | <API key> | <API key>), SND_SOC_DAPM_ADC_E("ADC2_INP2", NULL, <API key>, 7, 0, <API key>, <API key> | <API key> | <API key>), SND_SOC_DAPM_ADC_E("ADC2_INP3", NULL, <API key>, 7, 0, <API key>, <API key> | <API key> | <API key>), SND_SOC_DAPM_MIXER("ADC2", SND_SOC_NOPM, 0, 0, NULL, 0), SND_SOC_DAPM_MIXER("ADC3", SND_SOC_NOPM, 0, 0, NULL, 0), <API key>("ADC2 MUX", SND_SOC_NOPM, 0, 0, &tx_adc2_mux), <API key>("MIC BIAS External", <API key>, 7, 0, <API key>, <API key> | <API key>), <API key>("MIC BIAS External2", <API key>, 7, 0, <API key>, <API key> | <API key>), SND_SOC_DAPM_INPUT("AMIC3"), SND_SOC_DAPM_MUX_E("DEC1 MUX", <API key>, 0, 0, &dec1_mux, <API key>, <API key> | <API key> | <API key> | <API key>), SND_SOC_DAPM_MUX_E("DEC2 MUX", <API key>, 1, 0, &dec2_mux, <API key>, <API key> | <API key> | <API key> | <API key>), SND_SOC_DAPM_MUX("RDAC2 MUX", SND_SOC_NOPM, 0, 0, &rdac2_mux), SND_SOC_DAPM_INPUT("AMIC2"), <API key>("I2S TX1", "AIF1 Capture", 0, SND_SOC_NOPM, 0, 0), <API key>("I2S TX2", "AIF1 Capture", 0, SND_SOC_NOPM, 0, 0), <API key>("I2S TX3", "AIF1 Capture", 0, SND_SOC_NOPM, 0, 0), /* Digital Mic Inputs */ SND_SOC_DAPM_ADC_E("DMIC1", NULL, SND_SOC_NOPM, 0, 0, <API key>, <API key> | <API key>), SND_SOC_DAPM_ADC_E("DMIC2", NULL, SND_SOC_NOPM, 0, 0, <API key>, <API key> | <API key>), /* Sidetone */ SND_SOC_DAPM_MUX("IIR1 INP1 MUX", SND_SOC_NOPM, 0, 0, &iir1_inp1_mux), SND_SOC_DAPM_PGA("IIR1", <API key>, 0, 0, NULL, 0), SND_SOC_DAPM_MUX("IIR2 INP1 MUX", SND_SOC_NOPM, 0, 0, &iir2_inp1_mux), SND_SOC_DAPM_PGA("IIR2", <API key>, 1, 0, NULL, 0), SND_SOC_DAPM_SUPPLY("RX_I2S_CLK", <API key>, 4, 0, NULL, 0), SND_SOC_DAPM_SUPPLY("TX_I2S_CLK", <API key>, 4, 0, NULL, 0), }; static const struct <API key> <API key>[] = { MSM8X16_WCD_REG_VAL(<API key>, 0x03), MSM8X16_WCD_REG_VAL(<API key>, 0x82), MSM8X16_WCD_REG_VAL(<API key>, 0xE1), }; static const struct <API key> <API key>[] = { MSM8X16_WCD_REG_VAL(<API key>, 0xA5), MSM8X16_WCD_REG_VAL(<API key>, 0x0F), MSM8X16_WCD_REG_VAL(<API key>, 0x4F), MSM8X16_WCD_REG_VAL(<API key>, 0x28), MSM8X16_WCD_REG_VAL(<API key>, 0x69), MSM8X16_WCD_REG_VAL(<API key>, 0x01), MSM8X16_WCD_REG_VAL(<API key>, 0x5F), MSM8X16_WCD_REG_VAL(<API key>, 0x88), MSM8X16_WCD_REG_VAL(<API key>, 0xA5), MSM8X16_WCD_REG_VAL(<API key>, 0x0F), MSM8X16_WCD_REG_VAL(<API key>, 0x82), MSM8X16_WCD_REG_VAL(<API key>, 0x03), MSM8X16_WCD_REG_VAL(<API key>, 0xE1), }; static const struct <API key> <API key>[] = { MSM8X16_WCD_REG_VAL(<API key>, 0x02), MSM8X16_WCD_REG_VAL(<API key>, 0xA5), MSM8X16_WCD_REG_VAL(<API key>, 0x0F), MSM8X16_WCD_REG_VAL(<API key>, 0xA5), MSM8X16_WCD_REG_VAL(<API key>, 0x0F), MSM8X16_WCD_REG_VAL(<API key>, 0x4C), MSM8X16_WCD_REG_VAL(<API key>, 0x28), MSM8X16_WCD_REG_VAL(<API key>, 0x69), MSM8X16_WCD_REG_VAL(<API key>, 0x01), MSM8X16_WCD_REG_VAL(<API key>, 0x0A), MSM8X16_WCD_REG_VAL(<API key>, 0x03), MSM8X16_WCD_REG_VAL(<API key>, 0xE1), }; static void <API key>(struct snd_soc_codec *codec) { u32 i, version; struct msm8x16_wcd_priv *msm8x16_wcd = <API key>(codec); version = get_codec_version(msm8x16_wcd); if (version == TOMBAK_1_0) { for (i = 0; i < ARRAY_SIZE(<API key>); i++) snd_soc_write(codec, <API key>[i].reg, <API key>[i].val); } else if (version == TOMBAK_2_0) { for (i = 0; i < ARRAY_SIZE(<API key>); i++) snd_soc_write(codec, <API key>[i].reg, <API key>[i].val); } else if (version == CONGA) { for (i = 0; i < ARRAY_SIZE(<API key>); i++) snd_soc_write(codec, <API key>[i].reg, <API key>[i].val); } } static const struct <API key> <API key>[] = { /* Initialize current threshold to 280MA * number of wait and run cycles to 4096 */ {<API key>, 0xFF, 0x12}, {<API key>, 0xFF, 0xFF}, }; static void <API key>(struct snd_soc_codec *codec) { u32 i; for (i = 0; i < ARRAY_SIZE(<API key>); i++) snd_soc_update_bits(codec, <API key>[i].reg, <API key>[i].mask, <API key>[i].val); } static int msm8x16_wcd_bringup(struct snd_soc_codec *codec) { snd_soc_write(codec, <API key>, 0x01); snd_soc_write(codec, <API key>, 0x01); return 0; } static struct regulator *<API key>( const struct msm8x16_wcd *msm8x16, const char *name) { int i; for (i = 0; i < msm8x16->num_of_supplies; i++) { if (msm8x16->supplies[i].supply && !strcmp(msm8x16->supplies[i].supply, name)) return msm8x16->supplies[i].consumer; } dev_err(msm8x16->dev, "Error: regulator not found\n"); return NULL; } static int <API key>(struct snd_soc_codec *codec) { struct <API key> *pdata = NULL; struct msm8x16_wcd_priv *msm8x16_wcd_priv = <API key>(codec); pdata = <API key>(codec->card); dev_dbg(codec->dev, "%s: device down!\n", __func__); msm8x16_wcd_write(codec, <API key>, 0x3); msm8x16_wcd_write(codec, <API key>, 0x3); /* Disable PA to avoid pop during codec bring up */ snd_soc_update_bits(codec, <API key>, 0x30, 0x00); snd_soc_update_bits(codec, <API key>, 0x80, 0x00); msm8x16_wcd_write(codec, <API key>, 0x20); msm8x16_wcd_write(codec, <API key>, 0x20); msm8x16_wcd_write(codec, <API key>, 0x12); msm8x16_wcd_write(codec, <API key>, 0x93); msm8x16_wcd_write(codec, <API key>, 0x1); msm8x16_wcd_write(codec, <API key>, 0x1); atomic_set(&pdata->mclk_enabled, false); set_bit(BUS_DOWN, &msm8x16_wcd_priv->status_mask); <API key>(codec->card, 0); return 0; } static int <API key>(struct snd_soc_codec *codec) { struct msm8x16_wcd_priv *msm8x16_wcd_priv = <API key>(codec); u32 reg; dev_dbg(codec->dev, "%s: device up!\n", __func__); mutex_lock(&codec->mutex); clear_bit(BUS_DOWN, &msm8x16_wcd_priv->status_mask); for (reg = 0; reg < ARRAY_SIZE(<API key>); reg++) if (<API key>[reg]) msm8x16_wcd_write(codec, reg, <API key>[reg]); if (codec->reg_def_copy) { pr_debug("%s: Update ASOC cache", __func__); kfree(codec->reg_cache); codec->reg_cache = kmemdup(codec->reg_def_copy, codec->reg_size, GFP_KERNEL); if (!codec->reg_cache) { pr_err("%s: Cache update failed!\n", __func__); mutex_unlock(&codec->mutex); return -ENOMEM; } } <API key>(codec->card, 1); /* delay is required to make sure sound card state updated */ usleep_range(5000, 5100); msm8x16_wcd_bringup(codec); <API key>(codec); <API key>(codec); <API key>(codec); <API key>(codec); <API key>(codec, false, false); #ifndef <API key> wcd_mbhc_stop(&msm8x16_wcd_priv->mbhc); wcd_mbhc_start(&msm8x16_wcd_priv->mbhc, msm8x16_wcd_priv->mbhc.mbhc_cfg); #endif mutex_unlock(&codec->mutex); return 0; } static int <API key>(struct notifier_block *nb, unsigned long value, void *priv) { bool timedout; unsigned long timeout; if (value == <API key>) <API key>(registered_codec); else if (value == <API key>) { dev_dbg(registered_codec->dev, "ADSP is about to power up. bring up codec\n"); if (!<API key>()) { dev_dbg(registered_codec->dev, "ADSP isn't ready\n"); timeout = jiffies + msecs_to_jiffies(<API key>); while (!(timedout = time_after(jiffies, timeout))) { if (!<API key>()) { dev_dbg(registered_codec->dev, "ADSP isn't ready\n"); } else { dev_dbg(registered_codec->dev, "ADSP is ready\n"); break; } } } else { dev_dbg(registered_codec->dev, "%s: DSP is ready\n", __func__); } <API key>(registered_codec); } return NOTIFY_OK; } static struct notifier_block <API key> = { .notifier_call = <API key>, .priority = -INT_MAX, }; int <API key>(struct snd_soc_codec *codec, struct wcd_mbhc_config *mbhc_cfg) { struct msm8x16_wcd_priv *msm8x16_wcd_priv = <API key>(codec); return wcd_mbhc_start(&msm8x16_wcd_priv->mbhc, mbhc_cfg); } EXPORT_SYMBOL(<API key>); void <API key>(struct snd_soc_codec *codec) { struct msm8x16_wcd_priv *msm8x16_wcd_priv = <API key>(codec); wcd_mbhc_stop(&msm8x16_wcd_priv->mbhc); } EXPORT_SYMBOL(<API key>); static void <API key>(struct snd_soc_codec *codec) { struct msm8x16_wcd *msm8x16 = codec->control_data; struct msm8x16_wcd_pdata *pdata = msm8x16->dev->platform_data; u8 reg_val; reg_val = VOLTAGE_CONVERTER(pdata->micbias.cfilt1_mv, MICBIAS_MIN_VAL, MICBIAS_STEP_SIZE); dev_dbg(codec->dev, "cfilt1_mv %d reg_val %x\n", (u32)pdata->micbias.cfilt1_mv, reg_val); snd_soc_update_bits(codec, <API key>, 0xF8, (reg_val << 3)); } static void <API key>(struct snd_soc_codec *codec) { struct msm8x16_wcd_priv *msm8x16_wcd_priv = <API key>(codec); snd_soc_update_bits(codec, <API key>, 0x1F, msm8x16_wcd_priv->boost_voltage); } static void <API key>(struct snd_soc_codec *codec, bool micbias1, bool micbias2) { struct <API key> *pdata = NULL; pdata = <API key>(codec->card); pr_debug("\n %s: micbias1 %x micbias2 = %d\n", __func__, micbias1, micbias2); if (micbias1 && micbias2) { if ((pdata->micbias1_cap_mode == MICBIAS_EXT_BYP_CAP) || (pdata->micbias2_cap_mode == MICBIAS_EXT_BYP_CAP)) snd_soc_update_bits(codec, <API key>, 0x40, (MICBIAS_EXT_BYP_CAP << 6)); else snd_soc_update_bits(codec, <API key>, 0x40, (<API key> << 6)); } else if (micbias2) { snd_soc_update_bits(codec, <API key>, 0x40, (pdata->micbias2_cap_mode << 6)); } else if (micbias1) { snd_soc_update_bits(codec, <API key>, 0x40, (pdata->micbias1_cap_mode << 6)); } else { snd_soc_update_bits(codec, <API key>, 0x40, 0x00); } } #ifdef <API key> struct snd_soc_codec *fauxsound_codec_ptr; EXPORT_SYMBOL(fauxsound_codec_ptr); int wcd9xxx_hw_revision; EXPORT_SYMBOL(wcd9xxx_hw_revision); #endif static int <API key>(struct snd_soc_codec *codec) { struct msm8x16_wcd_priv *msm8x16_wcd_priv; struct msm8x16_wcd *msm8x16_wcd; int i, ret; dev_dbg(codec->dev, "%s()\n", __func__); #ifdef <API key> pr_info("msm8x16_wcd codec probe...\n"); fauxsound_codec_ptr = codec; #endif msm8x16_wcd_priv = kzalloc(sizeof(struct msm8x16_wcd_priv), GFP_KERNEL); if (!msm8x16_wcd_priv) { dev_err(codec->dev, "Failed to allocate private data\n"); return -ENOMEM; } for (i = 0; i < NUM_DECIMATORS; i++) { tx_hpf_work[i].msm8x16_wcd = msm8x16_wcd_priv; tx_hpf_work[i].decimator = i + 1; INIT_DELAYED_WORK(&tx_hpf_work[i].dwork, <API key>); } codec->control_data = dev_get_drvdata(codec->dev); <API key>(codec, msm8x16_wcd_priv); msm8x16_wcd_priv->codec = codec; /* codec resmgr module init */ msm8x16_wcd = codec->control_data; msm8x16_wcd->dig_base = ioremap(<API key>, <API key>); if (msm8x16_wcd->dig_base == NULL) { dev_err(codec->dev, "%s ioremap failed\n", __func__); kfree(msm8x16_wcd_priv); return -ENOMEM; } msm8x16_wcd_priv->spkdrv_reg = <API key>(codec->control_data, <API key>); msm8x16_wcd_priv->pmic_rev = snd_soc_read(codec, <API key>); msm8x16_wcd_priv->codec_version = snd_soc_read(codec, <API key>); if (msm8x16_wcd_priv->codec_version == CONGA) { dev_dbg(codec->dev, "%s :Conga REV: %d\n", __func__, msm8x16_wcd_priv->codec_version); msm8x16_wcd_priv->ext_spk_boost_set = true; #ifdef <API key> // premaca@gmail.com - not sure about this wcd9xxx_hw_revision = 1; #endif } else { dev_dbg(codec->dev, "%s :PMIC REV: %d\n", __func__, msm8x16_wcd_priv->pmic_rev); } /* * set to default boost option BOOST_SWITCH, user mixer path can change * it to BOOST_ALWAYS or BOOST_BYPASS based on solution chosen. */ msm8x16_wcd_priv->boost_option = BOOST_SWITCH; <API key>(codec); <API key>(codec); <API key>(codec, <API key>, ARRAY_SIZE(<API key>)); msm8x16_wcd_bringup(codec); <API key>(codec); <API key>(codec); <API key>(codec); msm8x16_wcd_priv->on_demand_list[ON_DEMAND_MICBIAS].supply = <API key>( codec->control_data, <API key>[ON_DEMAND_MICBIAS]); atomic_set(&msm8x16_wcd_priv->on_demand_list[ON_DEMAND_MICBIAS].ref, 0); <API key>(&msm8x16_wcd_priv->notifier); msm8x16_wcd_priv->fw_data = kzalloc(sizeof(*(msm8x16_wcd_priv->fw_data)) , GFP_KERNEL); if (!msm8x16_wcd_priv->fw_data) { dev_err(codec->dev, "Failed to allocate fw_data\n"); iounmap(msm8x16_wcd->dig_base); kfree(msm8x16_wcd_priv); return -ENOMEM; } set_bit(WCD9XXX_ANC_CAL, msm8x16_wcd_priv->fw_data->cal_bit); set_bit(WCD9XXX_MAD_CAL, msm8x16_wcd_priv->fw_data->cal_bit); set_bit(WCD9XXX_MBHC_CAL, msm8x16_wcd_priv->fw_data->cal_bit); ret = <API key>(msm8x16_wcd_priv->fw_data, <API key>, codec); if (ret < 0) { dev_err(codec->dev, "%s hwdep failed %d\n", __func__, ret); iounmap(msm8x16_wcd->dig_base); kfree(msm8x16_wcd_priv->fw_data); kfree(msm8x16_wcd_priv); return ret; } #ifndef <API key> wcd_mbhc_init(&msm8x16_wcd_priv->mbhc, codec, &mbhc_cb, &intr_ids, true); #endif msm8x16_wcd_priv->mclk_enabled = false; msm8x16_wcd_priv->clock_active = false; msm8x16_wcd_priv->config_mode_active = false; /* Set initial MICBIAS voltage level */ <API key>(codec); /* Set initial cap mode */ <API key>(codec, false, false); registered_codec = codec; <API key> = <API key>("modem", &<API key>); if (!<API key>) { dev_err(codec->dev, "Failed to register modem state notifier\n" ); iounmap(msm8x16_wcd->dig_base); kfree(msm8x16_wcd_priv->fw_data); kfree(msm8x16_wcd_priv); registered_codec = NULL; return -ENOMEM; } return 0; } static int <API key>(struct snd_soc_codec *codec) { struct msm8x16_wcd_priv *msm8x16_wcd_priv = <API key>(codec); struct msm8x16_wcd *msm8x16_wcd; msm8x16_wcd = codec->control_data; msm8x16_wcd_priv->spkdrv_reg = NULL; msm8x16_wcd_priv->on_demand_list[ON_DEMAND_MICBIAS].supply = NULL; atomic_set(&msm8x16_wcd_priv->on_demand_list[ON_DEMAND_MICBIAS].ref, 0); iounmap(msm8x16_wcd->dig_base); kfree(msm8x16_wcd_priv->fw_data); kfree(msm8x16_wcd_priv); return 0; } static int <API key>( struct msm8x16_wcd *msm8x16, struct msm8x16_wcd_pdata *pdata) { int i; int ret = 0; for (i = 0; i < msm8x16->num_of_supplies; i++) { if (pdata->regulator[i].ondemand) continue; if (<API key>(msm8x16->supplies[i].consumer) <= 0) continue; ret = <API key>(msm8x16->supplies[i].consumer, pdata->regulator[i].min_uv, pdata->regulator[i].max_uv); if (ret) { dev_err(msm8x16->dev, "Setting volt failed for regulator %s err %d\n", msm8x16->supplies[i].supply, ret); } ret = <API key>(msm8x16->supplies[i].consumer, pdata->regulator[i].optimum_ua); dev_dbg(msm8x16->dev, "Regulator %s set optimum mode\n", msm8x16->supplies[i].supply); } return ret; } static int <API key>( struct msm8x16_wcd *msm8x16, struct msm8x16_wcd_pdata *pdata) { int i; int ret = 0; for (i = 0; i < msm8x16->num_of_supplies; i++) { if (pdata->regulator[i].ondemand) continue; if (<API key>(msm8x16->supplies[i].consumer) <= 0) continue; <API key>(msm8x16->supplies[i].consumer, 0, pdata->regulator[i].max_uv); <API key>(msm8x16->supplies[i].consumer, 0); dev_dbg(msm8x16->dev, "Regulator %s set optimum mode\n", msm8x16->supplies[i].supply); } return ret; } int msm8x16_wcd_suspend(struct snd_soc_codec *codec) { struct <API key> *pdata = NULL; struct msm8x16_wcd *msm8x16 = codec->control_data; struct msm8x16_wcd_pdata *msm8x16_pdata = msm8x16->dev->platform_data; pdata = <API key>(codec->card); pr_debug("%s: mclk cnt = %d, mclk_enabled = %d\n", __func__, atomic_read(&pdata->mclk_rsc_ref), atomic_read(&pdata->mclk_enabled)); if (atomic_read(&pdata->mclk_enabled) == true) { <API key>( &pdata->disable_mclk_work); mutex_lock(&pdata->cdc_mclk_mutex); if (atomic_read(&pdata->mclk_enabled) == true) { pdata->digital_cdc_clk.clk_val = 0; <API key>( <API key>, &pdata->digital_cdc_clk); atomic_set(&pdata->mclk_enabled, false); } mutex_unlock(&pdata->cdc_mclk_mutex); } <API key>(msm8x16, msm8x16_pdata); return 0; } int msm8x16_wcd_resume(struct snd_soc_codec *codec) { struct <API key> *pdata = NULL; struct msm8x16_wcd *msm8x16 = codec->control_data; struct msm8x16_wcd_pdata *msm8x16_pdata = msm8x16->dev->platform_data; pdata = <API key>(codec->card); <API key>(msm8x16, msm8x16_pdata); return 0; } static struct <API key> <API key> = { .probe = <API key>, .remove = <API key>, .read = msm8x16_wcd_read, .write = msm8x16_wcd_write, .suspend = msm8x16_wcd_suspend, .resume = msm8x16_wcd_resume, .readable_register = <API key>, .volatile_register = <API key>, .reg_cache_size = <API key>, .reg_cache_default = <API key>, .reg_word_size = 1, .controls = <API key>, .num_controls = ARRAY_SIZE(<API key>), .dapm_widgets = <API key>, .num_dapm_widgets = ARRAY_SIZE(<API key>), .dapm_routes = audio_map, .num_dapm_routes = ARRAY_SIZE(audio_map), }; static int <API key>(struct msm8x16_wcd *msm8x16, struct msm8x16_wcd_pdata *pdata) { int ret; int i; msm8x16->supplies = kzalloc(sizeof(struct regulator_bulk_data) * ARRAY_SIZE(pdata->regulator), GFP_KERNEL); if (!msm8x16->supplies) { ret = -ENOMEM; goto err; } msm8x16->num_of_supplies = 0; if (ARRAY_SIZE(pdata->regulator) > MAX_REGULATOR) { dev_err(msm8x16->dev, "%s: Array Size out of bound\n", __func__); ret = -EINVAL; goto err; } for (i = 0; i < ARRAY_SIZE(pdata->regulator); i++) { if (pdata->regulator[i].name) { msm8x16->supplies[i].supply = pdata->regulator[i].name; msm8x16->num_of_supplies++; } } ret = regulator_bulk_get(msm8x16->dev, msm8x16->num_of_supplies, msm8x16->supplies); if (ret != 0) { dev_err(msm8x16->dev, "Failed to get supplies: err = %d\n", ret); goto err_supplies; } for (i = 0; i < msm8x16->num_of_supplies; i++) { if (<API key>(msm8x16->supplies[i].consumer) <= 0) continue; ret = <API key>(msm8x16->supplies[i].consumer, pdata->regulator[i].min_uv, pdata->regulator[i].max_uv); if (ret) { dev_err(msm8x16->dev, "Setting regulator voltage failed for regulator %s err = %d\n", msm8x16->supplies[i].supply, ret); goto err_get; } ret = <API key>(msm8x16->supplies[i].consumer, pdata->regulator[i].optimum_ua); if (ret < 0) { dev_err(msm8x16->dev, "Setting regulator optimum mode failed for regulator %s err = %d\n", msm8x16->supplies[i].supply, ret); goto err_get; } else { ret = 0; } } return ret; err_get: regulator_bulk_free(msm8x16->num_of_supplies, msm8x16->supplies); err_supplies: kfree(msm8x16->supplies); err: return ret; } static int <API key>(struct msm8x16_wcd *msm8x16, struct msm8x16_wcd_pdata *pdata) { int i; int ret = 0; for (i = 0; i < msm8x16->num_of_supplies; i++) { if (pdata->regulator[i].ondemand) continue; ret = regulator_enable(msm8x16->supplies[i].consumer); if (ret) { dev_err(msm8x16->dev, "Failed to enable %s\n", msm8x16->supplies[i].supply); break; } else { dev_dbg(msm8x16->dev, "Enabled regulator %s\n", msm8x16->supplies[i].supply); } } while (ret && --i) if (!pdata->regulator[i].ondemand) regulator_disable(msm8x16->supplies[i].consumer); return ret; } static void <API key>(struct msm8x16_wcd *msm8x16, struct msm8x16_wcd_pdata *pdata) { int i; <API key>(msm8x16->num_of_supplies, msm8x16->supplies); for (i = 0; i < msm8x16->num_of_supplies; i++) { if (<API key>(msm8x16->supplies[i].consumer) <= 0) continue; <API key>(msm8x16->supplies[i].consumer, 0, pdata->regulator[i].max_uv); <API key>(msm8x16->supplies[i].consumer, 0); } regulator_bulk_free(msm8x16->num_of_supplies, msm8x16->supplies); kfree(msm8x16->supplies); } static int <API key>(struct msm8x16_wcd *msm8x16) { mutex_init(&msm8x16->io_lock); return 0; } static int <API key>(struct spmi_device *spmi) { int ret = 0; struct msm8x16_wcd *msm8x16 = NULL; struct msm8x16_wcd_pdata *pdata; struct resource *wcd_resource; int modem_state; dev_dbg(&spmi->dev, "%s(%d):slave ID = 0x%x\n", __func__, __LINE__, spmi->sid); modem_state = apr_get_modem_state(); if (modem_state != APR_SUBSYS_LOADED) { dev_dbg(&spmi->dev, "Modem is not loaded yet %d\n", modem_state); return -EPROBE_DEFER; } wcd_resource = spmi_get_resource(spmi, NULL, IORESOURCE_MEM, 0); if (!wcd_resource) { dev_err(&spmi->dev, "Unable to get Tombak base address\n"); return -ENXIO; } switch (wcd_resource->start) { case <API key>: msm8x16_wcd_modules[0].spmi = spmi; msm8x16_wcd_modules[0].base = (spmi->sid << 16) + wcd_resource->start; <API key>(msm8x16_wcd_modules[0].spmi, 0); device_init_wakeup(&spmi->dev, true); break; case <API key>: msm8x16_wcd_modules[1].spmi = spmi; msm8x16_wcd_modules[1].base = (spmi->sid << 16) + wcd_resource->start; <API key>(msm8x16_wcd_modules[1].spmi, 1); if (<API key>()) { dev_err(&spmi->dev, "%s: irq initialization failed\n", __func__); } else { dev_dbg(&spmi->dev, "%s: irq initialization passed\n", __func__); } goto rtn; default: ret = -EINVAL; goto rtn; } dev_dbg(&spmi->dev, "%s(%d):start addr = 0x%pK\n", __func__, __LINE__, &wcd_resource->start); if (wcd_resource->start != <API key>) goto rtn; if (spmi->dev.of_node) { dev_dbg(&spmi->dev, "%s:Platform data from device tree\n", __func__); pdata = <API key>(&spmi->dev); spmi->dev.platform_data = pdata; } else { dev_dbg(&spmi->dev, "%s:Platform data from board file\n", __func__); pdata = spmi->dev.platform_data; } if (pdata == NULL) { dev_err(&spmi->dev, "%s:Platform data failed to populate\n", __func__); goto rtn; } msm8x16 = kzalloc(sizeof(struct msm8x16_wcd), GFP_KERNEL); if (msm8x16 == NULL) { dev_err(&spmi->dev, "%s: error, allocation failed\n", __func__); ret = -ENOMEM; goto rtn; } msm8x16->dev = &spmi->dev; msm8x16->read_dev = <API key>; msm8x16->write_dev = <API key>; ret = <API key>(msm8x16, pdata); if (ret) { dev_err(&spmi->dev, "%s: Fail to enable Codec supplies\n", __func__); goto err_codec; } ret = <API key>(msm8x16, pdata); if (ret) { dev_err(&spmi->dev, "%s: Fail to enable Codec pre-reset supplies\n", __func__); goto err_codec; } usleep_range(5, 6); ret = <API key>(msm8x16); if (ret) { dev_err(&spmi->dev, "%s:<API key> failed with error %d\n", __func__, ret); goto err_supplies; } dev_set_drvdata(&spmi->dev, msm8x16); ret = <API key>(&spmi->dev, &<API key>, msm8x16_wcd_i2s_dai, ARRAY_SIZE(msm8x16_wcd_i2s_dai)); if (ret) { dev_err(&spmi->dev, "%s:<API key> failed with error %d\n", __func__, ret); } else { goto rtn; } err_supplies: <API key>(msm8x16, pdata); err_codec: kfree(msm8x16); rtn: return ret; } static void <API key>(struct msm8x16_wcd *msm8x16) { mutex_destroy(&msm8x16->io_lock); kfree(msm8x16); } static int <API key>(struct spmi_device *spmi) { struct msm8x16_wcd *msm8x16 = dev_get_drvdata(&spmi->dev); <API key>(msm8x16); return 0; } #ifdef CONFIG_PM static int <API key>(struct spmi_device *spmi) { struct resource *wcd_resource; wcd_resource = spmi_get_resource(spmi, NULL, IORESOURCE_MEM, 0); if (!wcd_resource) { dev_err(&spmi->dev, "Unable to get CDC SPMI resource\n"); return -ENXIO; } if (wcd_resource->start == <API key>) return wcd9xxx_spmi_resume(); return 0; } static int <API key>(struct spmi_device *spmi, pm_message_t pmesg) { struct resource *wcd_resource; wcd_resource = spmi_get_resource(spmi, NULL, IORESOURCE_MEM, 0); if (!wcd_resource) { dev_err(&spmi->dev, "Unable to get CDC SPMI resource\n"); return -ENXIO; } if (wcd_resource->start == <API key>) return <API key>(pmesg); return 0; } #endif static struct spmi_device_id <API key>[] = { {"wcd-spmi", <API key>}, {"wcd-spmi", <API key>}, {} }; static struct of_device_id <API key>[] = { { .compatible = "qcom,msm8x16_wcd_codec",}, { }, }; static struct spmi_driver wcd_spmi_driver = { .driver = { .owner = THIS_MODULE, .name = "wcd-spmi-core", .of_match_table = <API key> }, #ifdef CONFIG_PM .suspend = <API key>, .resume = <API key>, #endif .id_table = <API key>, .probe = <API key>, .remove = <API key>, }; static int __init <API key>(void) { <API key>(&wcd_spmi_driver); return 0; } module_init(<API key>); static void __exit <API key>(void) { <API key>(&wcd_spmi_driver); } module_exit(<API key>); MODULE_DESCRIPTION("MSM8x16 Audio codec driver"); MODULE_LICENSE("GPL v2"); MODULE_DEVICE_TABLE(of, <API key>);
#ifndef _H_DEMARSHAL #define _H_DEMARSHAL typedef void (*<API key>)(uint8_t *message); typedef uint8_t * (*<API key>)(uint8_t *message_start, uint8_t *message_end, uint16_t message_type, int minor, size_t *size_out, <API key> *free_message); <API key> <API key>(uint32_t channel, unsigned int *max_message_type); <API key> <API key>(uint32_t channel, unsigned int *max_message_type); #endif
#ifndef <API key> #define <API key> struct Waypoint; /** * Generic visitor for objects in the Waypoints container */ class WaypointVisitor { public: virtual void Visit(const Waypoint &wp) = 0; void operator()(const Waypoint &wp) { Visit(wp); } }; #endif
<?php // Security check to ensure this file is being included by a parent file. defined( '_JEXEC' ) or die; /** * Installation/Uninstallation script * */ class <API key> { const MIN_JOOMLA_VERSION = '2.5.6'; const MAX_JOOMLA_VERSION = '4'; public function install($parent) { // create a db table to register extensions using shlib // will allow those extensions to decide whether // to remove or not shlib when they are uninstalled themselves // id, extension, min_version, max_version, refuse_versions, accept_versions // n, com_sh404sef, [0|1.2], [0|3.4] // if an extension wants to install a new version of shlib, it must first check that // existing extensions can accept the new one // When uninstalling, the extension must unregister itself from the db // then decide whether to uninstall shlib (only if no other extension is using it) $this->_updateDbStructure(); $this->_hacks(); } public function uninstall($parent) { $db = JFactory::getDbo(); $db->dropTable('#__shlib_consumers' ); $db->dropTable('#__shlib_resources' ); } public function update($parent) { // create registration table, if it was not done upon initial install $this->_updateDbStructure(); $this->_hacks(); } public function preflight( $route, $installer) { if($route == 'install' || $route == 'update') { // check Joomla! version if(version_compare( JVERSION, self::MIN_JOOMLA_VERSION, '<') || version_compare( JVERSION, self::MAX_JOOMLA_VERSION, 'ge')) { JFactory::getApplication()->enqueueMessage( sprintf( 'shLib requires Joomla! version between %s and %s (you are using %s). Aborting installation', self::MIN_JOOMLA_VERSION, self::MAX_JOOMLA_VERSION, JVERSION)); return false; } } } public function postflight($type, $parent) { } /** * Things that don't fit elsewhere */ protected function _hacks() { // Josetta registration // First versions of Josetta used shLib, but a version prior // to the addition of the resource manager. Therefore when // installing an extension (sh404sef) using shLib on a site // running an old version of Josetta (pre-1.3.0), Josetta // does not register itself. Thus uninstalling sh404sef, in that example, // may result in uninstalling also shLIb, and breaking Josetta // so if Josetta is installed on that site, we make sure // there's an entry for it in the registration table $path = JPATH_ROOT . '/administrator/components/com_josetta/index.html'; jimport( 'joomla.filesystem.file'); if(JFile::exists( $path)) { try { // do we have a record? $db = JFactory::getDBO(); $query = $db->getQuery( true); $query->select( '*')->from('#__shlib_consumers'); $query->where( $db->quoteName('resource') . '=' . $db->quote( 'shlib')); $query->where( $db->quoteName('context') . '=' . $db->quote( 'com_josetta')); $existingRecord = $db->setQuery( $query)->loadObject(); // if not, create one if(empty( $existingRecord)) { $query->clear(); $query->insert( '#__shlib_consumers'); $query->set( $db->quoteName('resource') . '=' . $db->quote( 'shlib')); $query->set( $db->quoteName('context') . '=' . $db->quote( 'com_josetta')); $db->setQuery( $query)->execute(); } } catch (Exception $e) { if(class_exists( 'ShlSystem_Log') && method_exists( 'ShlSystem_Log', 'error')) { ShlSystem_Log::error( 'shlib', '%s::%s::%d: %s', __CLASS__, __METHOD__, __LINE__, $e->getMessage()); } return false; } } } /** * Create database table needed to register/unregister * resource shared by several extensions * * @throws Exception */ protected function _updateDbStructure() { $query1 = "CREATE TABLE IF NOT EXISTS `#__shlib_consumers` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `resource` varchar(50) NOT NULL DEFAULT '', `context` varchar(50) NOT NULL DEFAULT '', `min_version` varchar(20) NOT NULL DEFAULT '0', `max_version` varchar(20) NOT NULL DEFAULT '0', `refuse_versions` varchar(255) NOT NULL DEFAULT '', `accept_versions` varchar(255) NOT NULL DEFAULT '', PRIMARY KEY (`id`), KEY `idx_context` (`context`) ) DEFAULT CHARSET=utf8;"; $query2 = "CREATE TABLE IF NOT EXISTS `#__shlib_resources` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `resource` varchar(50) NOT NULL DEFAULT '', `current_version` varchar(20) NOT NULL DEFAULT '0', PRIMARY KEY (`id`), KEY `idx_resource` (`resource`) ) DEFAULT CHARSET=utf8;"; // run query try { $db = JFactory::getDBO(); $db->setQuery( $query1); $db->query(); $error = $db->getErrorNum(); if(!empty( $error)) { throw new Exception( $db->getErrorMsg()); } $db->setQuery( $query2); $db->query(); $error = $db->getErrorNum(); if(!empty( $error)) { throw new Exception( $db->getErrorMsg()); } } catch( Exception $e) { $app = JFactory::getApplication(); $app->enqueueMessage( 'Error while creating/upgrading the database : ' . $e->getMessage() . '.<br />shLib will probably not operate properly. Please uninstall it, then try again after checking your database server setup. Contact us in case this happens again.'); } } }
<fieldset id="<API key>" class=""> <h2><?php echo __('Mensaje') ?></h2> <div class="form-row"> <?php echo label_for('mensaje[id_usuario]', __($labels['mensaje{id_usuario}']).":", '') ?> <div class="content"> <?php $usuario = $mensaje->getUsuario(); echo $usuario ? $usuario->getNombreCompleto() : '-'; ?> </div> </div> <?php $usuario_actual = Usuario::getusuarioActual(); if ($mensaje->getIdUsuario() == $usuario_actual->getPrimaryKey()): ?> <div class="form-row"> <?php echo label_for('mensaje_destino[id_usuario]', __($labels['mensaje_destino{id_usuario}']).":", '') ?> <div class="content"> <?php $mensaje_destinos = $mensaje-><API key>(); ?> <ul class="sf_admin_checklist"> <?php foreach($mensaje_destinos as $md) : ?> <li><?php $destinatario = $md->getUsuario(); echo $destinatario ? $destinatario->getNombreCompleto() : '-';?></li> <?php endforeach;?> <ul> </div> </div> <?php endif ; ?> <div class="form-row"> <?php echo label_for('mensaje[asunto]', __($labels['mensaje{asunto}']).":", '') ?> <div class="content"> <?php $value = $mensaje->getAsunto(); echo $value ? $value : '&nbsp;'; ?> </div> </div> <div class="form-row"> <?php echo label_for('mensaje[cuerpo]', __($labels['mensaje{cuerpo}']).":", '') ?> <div class="content"> <?php $value = $mensaje->getCuerpo(); echo $value ? $value : '&nbsp;'; ?> </div> </div> <div class="form-row"> <?php echo label_for('mensaje[fecha]', __($labels['mensaje{fecha}']).":", '') ?> <div class="content"> <?php echo format_date($mensaje->getFecha() , 'f'); ?> </div> </div> </fieldset> <?php include_partial('leer_actions', array('mensaje' => $mensaje)) ?>
// MySQL Connectors. There are special exceptions to the terms and // conditions of the GPLv2 as it is applied to this software, see the // This program is free software; you can redistribute it and/or modify // This program is distributed in the hope that it will be useful, but // for more details. // with this program; if not, write to the Free Software Foundation, Inc., // 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA using System; using System.Transactions; using System.Collections; using System.Collections.Generic; using System.Data; using System.Threading; namespace MySql.Data.MySqlClient { <summary> Represents a single(not nested) TransactionScope </summary> internal class <API key> { public MySqlConnection connection; public Transaction baseTransaction; public MySqlTransaction simpleTransaction; public int rollbackThreadId; public <API key>(MySqlConnection con, Transaction trans, MySqlTransaction simpleTransaction) { connection = con; baseTransaction = trans; this.simpleTransaction = simpleTransaction; } public void Rollback(<API key> <API key>) { // prevent commands in main thread to run concurrently Driver driver = connection.driver; lock (driver) { rollbackThreadId = Thread.CurrentThread.ManagedThreadId; while (connection.Reader != null) { // wait for reader to finish. Maybe we should not wait // forever and cancel it after some time? System.Threading.Thread.Sleep(100); } simpleTransaction.Rollback(); <API key>.Aborted(); <API key>.<API key>(baseTransaction); driver.CurrentTransaction = null; if (connection.State == ConnectionState.Closed) connection.CloseFully(); rollbackThreadId = 0; } } public void SinglePhaseCommit(<API key> <API key>) { simpleTransaction.Commit(); <API key>.Committed(); <API key>.<API key>(baseTransaction); connection.driver.CurrentTransaction = null; if (connection.State == ConnectionState.Closed) connection.CloseFully(); } } internal sealed class <API key> : <API key>, <API key> { // Per-thread stack to manage nested transaction scopes [ThreadStatic] static Stack<<API key>> globalScopeStack; MySqlConnection connection; Transaction baseTransaction; Stack<<API key>> scopeStack; public <API key>(MySqlConnection connection, Transaction baseTransaction) { this.connection = connection; this.baseTransaction = baseTransaction; } public Transaction BaseTransaction { get { if (scopeStack.Count > 0) return scopeStack.Peek().baseTransaction; else return null; } } public bool InRollback { get { if (scopeStack.Count > 0) { <API key> currentScope = scopeStack.Peek(); if (currentScope.rollbackThreadId == Thread.CurrentThread.ManagedThreadId) { return true; } } return false; } } void <API key>.Initialize() { string valueName = Enum.GetName( typeof(System.Transactions.IsolationLevel), baseTransaction.IsolationLevel); System.Data.IsolationLevel dataLevel = (System.Data.IsolationLevel)Enum.Parse( typeof(System.Data.IsolationLevel), valueName); MySqlTransaction simpleTransaction = connection.BeginTransaction(dataLevel); // We need to save the per-thread scope stack locally. // We cannot always use thread static variable in rollback: when scope // times out, rollback is issued by another thread. if (globalScopeStack == null) { globalScopeStack = new Stack<<API key>>(); } scopeStack = globalScopeStack; scopeStack.Push(new <API key>(connection, baseTransaction, simpleTransaction)); } void <API key>.Rollback(<API key> <API key>) { <API key> current = scopeStack.Peek(); current.Rollback(<API key>); scopeStack.Pop(); } void <API key>.SinglePhaseCommit(<API key> <API key>) { scopeStack.Pop().SinglePhaseCommit(<API key>); } byte[] <API key>.Promote() { throw new <API key>(); } } internal class <API key> { private static Hashtable driversInUse = new Hashtable(); public static Driver <API key>(Transaction transaction) { lock (driversInUse.SyncRoot) { Driver d = (Driver)driversInUse[transaction.GetHashCode()]; return d; } } public static void <API key>(Driver driver) { lock (driversInUse.SyncRoot) { driversInUse[driver.CurrentTransaction.BaseTransaction.GetHashCode()] = driver; } } public static void <API key>(Transaction transaction) { lock (driversInUse.SyncRoot) { driversInUse.Remove(transaction.GetHashCode()); } } } }
package wutil import ( "math/rand" "sync" "time" ) // AnthaRandom is a thread-safe version of math/rand type AnthaRandom struct { mutex sync.Mutex rng *rand.Rand } // Intn returns, as an int, a non-negative pseudo-random number in [0,n). It panics if n <= 0. func (ar *AnthaRandom) Intn(n int) int { ar.mutex.Lock() defer ar.mutex.Unlock() return ar.rng.Intn(n) } // Int returns a non-negative pseudo-random int. func (ar *AnthaRandom) Int() int { ar.mutex.Lock() defer ar.mutex.Unlock() return ar.rng.Int() } // Float64 returns, as a float64, a pseudo-random number in [0.0,1.0). func (ar *AnthaRandom) Float64() float64 { ar.mutex.Lock() defer ar.mutex.Unlock() return ar.rng.Float64() } // Float32 returns, as a float32, a pseudo-random number in [0.0,1.0). func (ar *AnthaRandom) Float32() float32 { ar.mutex.Lock() defer ar.mutex.Unlock() return ar.rng.Float32() } // ExpFloat64 returns an exponentially distributed float64 in the range (0, +math.MaxFloat64] with an exponential distribution whose rate parameter (lambda) is 1 and whose mean is 1/lambda (1). func (ar *AnthaRandom) ExpFloat64() float64 { ar.mutex.Lock() defer ar.mutex.Unlock() return ar.rng.ExpFloat64() } // Int31 returns a non-negative pseudo-random 31-bit integer as an int32. func (ar *AnthaRandom) Int31() int32 { ar.mutex.Lock() defer ar.mutex.Unlock() return ar.rng.Int31() } // Int31n returns, as an int32, a non-negative pseudo-random number in [0,n). It panics if n <= 0. func (ar *AnthaRandom) Int31n(n int32) int32 { ar.mutex.Lock() defer ar.mutex.Unlock() return ar.rng.Int31n(n) } // Int63 returns a non-negative pseudo-random 63-bit integer as an int64. func (ar *AnthaRandom) Int63() int64 { ar.mutex.Lock() defer ar.mutex.Unlock() return ar.rng.Int63() } // Int63n returns, as an int64, a non-negative pseudo-random number in [0,n). It panics if n <= 0. func (ar *AnthaRandom) Int63n(n int64) int64 { ar.mutex.Lock() defer ar.mutex.Unlock() return ar.rng.Int63n(n) } // NormFloat64 returns a normally distributed float64 in the range [-math.MaxFloat64, +math.MaxFloat64] with standard normal distribution (mean = 0, stddev = 1). func (ar *AnthaRandom) NormFloat64() float64 { ar.mutex.Lock() defer ar.mutex.Unlock() return ar.rng.NormFloat64() } // Perm returns, as a slice of n ints, a pseudo-random permutation of the integers [0,n). func (ar *AnthaRandom) Perm(n int) []int { ar.mutex.Lock() defer ar.mutex.Unlock() return ar.rng.Perm(n) } // Read generates len(p) random bytes and writes them into p. It always returns len(p) and a nil error. Read should not be called concurrently with any other Rand method. func (ar *AnthaRandom) Read(p []byte) (n int, err error) { ar.mutex.Lock() defer ar.mutex.Unlock() return ar.rng.Read(p) } // Seed uses the provided seed value to initialize the generator to a deterministic state. Seed should not be called concurrently with any other Rand method. func (ar *AnthaRandom) Seed(seed int64) { ar.mutex.Lock() defer ar.mutex.Unlock() ar.rng.Seed(seed) } // Uint32 returns a pseudo-random 32-bit value as a uint32. func (ar *AnthaRandom) Uint32() uint32 { ar.mutex.Lock() defer ar.mutex.Unlock() return ar.rng.Uint32() } // Uint64 returns a pseudo-random 64-bit value as a uint64. func (ar *AnthaRandom) Uint64() uint64 { ar.mutex.Lock() defer ar.mutex.Unlock() return ar.rng.Uint64() } // NewAnthaRandom returns a thread-safe RNG func NewAnthaRandom(seed int64) *AnthaRandom { r := rand.New(rand.NewSource(seed)) ar := AnthaRandom{rng: r} return &ar } // shared RNG var ourRand *AnthaRandom // GetRandomWithSeed returns a random number generator, seeded with the seed provided if requested func GetRandomWithSeed(seed int64, reseed bool) *AnthaRandom { if reseed || ourRand == nil { ourRand = NewAnthaRandom(seed) } return ourRand } // GetRandom returns a random number generator, seeding it if it is not initialised func GetRandom() *AnthaRandom { if ourRand == nil { ourRand = NewAnthaRandom(time.Now().Unix()) } return ourRand }
<?php /** * @package modx * @subpackage sqlsrv */ require_once (dirname(dirname(__FILE__)) . '/modtemplatevar.class.php'); /** * @package modx * @subpackage sqlsrv */ class <API key> extends modTemplateVar { }
/* istanbul ignore file */ /* tslint:disable */ /* eslint-disable */ import type { Card } from './Card'; import type { Error } from './Error'; import type { Image } from './Image'; import type { MessagesNotice } from './MessagesNotice'; export type <API key> = { messagesNotices: Array<MessagesNotice>; /** * MessagesNotice */ description?: string; /** * MessagesNotice */ summary?: string; image?: Image; /** * Square icon png url */ avatar?: string; /** * Ex: ion-ios-person */ ionIcon?: string; /** * Embeddable list of study summaries with explanation at the top */ html?: string; /** * Array of error objects with message property */ errors?: Array<Error>; /** * Error message */ error?: string; /** * Error message */ errorMessage?: string; /** * ex. OK or ERROR */ status?: string; /** * true or false */ success?: boolean; /** * Response code such as 200 */ code?: number; /** * A super neat url you might want to share with your users! */ link?: string; card?: Card; }
#include "nm-sd-adapt.h" #include <errno.h> #include <net/ethernet.h> #include <net/if_arp.h> #include <stdio.h> #include <string.h> #include <sys/socket.h> #include <linux/filter.h> #include <linux/if_infiniband.h> #include <linux/if_packet.h> #include "dhcp-internal.h" #include "fd-util.h" #include "socket-util.h" static int _bind_raw_socket(int ifindex, union sockaddr_union *link, uint32_t xid, const uint8_t *mac_addr, size_t mac_addr_len, const uint8_t *bcast_addr, const struct ether_addr *eth_mac, uint16_t arp_type, uint8_t dhcp_hlen) { struct sock_filter filter[] = { BPF_STMT(BPF_LD + BPF_W + BPF_LEN, 0), /* A <- packet length */ BPF_JUMP(BPF_JMP + BPF_JGE + BPF_K, sizeof(DHCPPacket), 1, 0), /* packet >= DHCPPacket ? */ BPF_STMT(BPF_RET + BPF_K, 0), /* ignore */ BPF_STMT(BPF_LD + BPF_B + BPF_ABS, offsetof(DHCPPacket, ip.protocol)), /* A <- IP protocol */ BPF_JUMP(BPF_JMP + BPF_JEQ + BPF_K, IPPROTO_UDP, 1, 0), /* IP protocol == UDP ? */ BPF_STMT(BPF_RET + BPF_K, 0), /* ignore */ BPF_STMT(BPF_LD + BPF_B + BPF_ABS, offsetof(DHCPPacket, ip.frag_off)), /* A <- Flags */ BPF_STMT(BPF_ALU + BPF_AND + BPF_K, 0x20), /* A <- A & 0x20 (More Fragments bit) */ BPF_JUMP(BPF_JMP + BPF_JEQ + BPF_K, 0, 1, 0), /* A == 0 ? */ BPF_STMT(BPF_RET + BPF_K, 0), /* ignore */ BPF_STMT(BPF_LD + BPF_H + BPF_ABS, offsetof(DHCPPacket, ip.frag_off)), /* A <- Flags + Fragment offset */ BPF_STMT(BPF_ALU + BPF_AND + BPF_K, 0x1fff), /* A <- A & 0x1fff (Fragment offset) */ BPF_JUMP(BPF_JMP + BPF_JEQ + BPF_K, 0, 1, 0), /* A == 0 ? */ BPF_STMT(BPF_RET + BPF_K, 0), /* ignore */ BPF_STMT(BPF_LD + BPF_H + BPF_ABS, offsetof(DHCPPacket, udp.dest)), /* A <- UDP destination port */ BPF_JUMP(BPF_JMP + BPF_JEQ + BPF_K, DHCP_PORT_CLIENT, 1, 0), /* UDP destination port == DHCP client port ? */ BPF_STMT(BPF_RET + BPF_K, 0), /* ignore */ BPF_STMT(BPF_LD + BPF_B + BPF_ABS, offsetof(DHCPPacket, dhcp.op)), /* A <- DHCP op */ BPF_JUMP(BPF_JMP + BPF_JEQ + BPF_K, BOOTREPLY, 1, 0), /* op == BOOTREPLY ? */ BPF_STMT(BPF_RET + BPF_K, 0), /* ignore */ BPF_STMT(BPF_LD + BPF_B + BPF_ABS, offsetof(DHCPPacket, dhcp.htype)), /* A <- DHCP header type */ BPF_JUMP(BPF_JMP + BPF_JEQ + BPF_K, arp_type, 1, 0), /* header type == arp_type ? */ BPF_STMT(BPF_RET + BPF_K, 0), /* ignore */ BPF_STMT(BPF_LD + BPF_B + BPF_ABS, offsetof(DHCPPacket, dhcp.hlen)), /* A <- MAC address length */ BPF_JUMP(BPF_JMP + BPF_JEQ + BPF_K, dhcp_hlen, 1, 0), /* address length == dhcp_hlen ? */ BPF_STMT(BPF_RET + BPF_K, 0), /* ignore */ BPF_STMT(BPF_LD + BPF_W + BPF_ABS, offsetof(DHCPPacket, dhcp.xid)), /* A <- client identifier */ BPF_JUMP(BPF_JMP + BPF_JEQ + BPF_K, xid, 1, 0), /* client identifier == xid ? */ BPF_STMT(BPF_RET + BPF_K, 0), /* ignore */ BPF_STMT(BPF_LD + BPF_IMM, htobe32(*((unsigned int *) eth_mac))), /* A <- 4 bytes of client's MAC */ BPF_STMT(BPF_MISC + BPF_TAX, 0), /* X <- A */ BPF_STMT(BPF_LD + BPF_W + BPF_ABS, offsetof(DHCPPacket, dhcp.chaddr)), /* A <- 4 bytes of MAC from dhcp.chaddr */ BPF_STMT(BPF_ALU + BPF_XOR + BPF_X, 0), /* A xor X */ BPF_JUMP(BPF_JMP + BPF_JEQ + BPF_K, 0, 1, 0), /* A == 0 ? */ BPF_STMT(BPF_RET + BPF_K, 0), /* ignore */ BPF_STMT(BPF_LD + BPF_IMM, htobe16(*((unsigned short *) (((char *) eth_mac) + 4)))), /* A <- remainder of client's MAC */ BPF_STMT(BPF_MISC + BPF_TAX, 0), /* X <- A */ BPF_STMT(BPF_LD + BPF_H + BPF_ABS, offsetof(DHCPPacket, dhcp.chaddr) + 4), /* A <- remainder of MAC from dhcp.chaddr */ BPF_STMT(BPF_ALU + BPF_XOR + BPF_X, 0), /* A xor X */ BPF_JUMP(BPF_JMP + BPF_JEQ + BPF_K, 0, 1, 0), /* A == 0 ? */ BPF_STMT(BPF_RET + BPF_K, 0), /* ignore */ BPF_STMT(BPF_LD + BPF_W + BPF_ABS, offsetof(DHCPPacket, dhcp.magic)), /* A <- DHCP magic cookie */ BPF_JUMP(BPF_JMP + BPF_JEQ + BPF_K, DHCP_MAGIC_COOKIE, 1, 0), /* cookie == DHCP magic cookie ? */ BPF_STMT(BPF_RET + BPF_K, 0), /* ignore */ BPF_STMT(BPF_RET + BPF_K, 65535), /* return all */ }; struct sock_fprog fprog = { .len = ELEMENTSOF(filter), .filter = filter }; _cleanup_close_ int s = -1; int r, on = 1; assert(ifindex > 0); assert(link); s = socket(AF_PACKET, SOCK_DGRAM | SOCK_CLOEXEC | SOCK_NONBLOCK, 0); if (s < 0) return -errno; r = setsockopt(s, SOL_PACKET, PACKET_AUXDATA, &on, sizeof(on)); if (r < 0) return -errno; r = setsockopt(s, SOL_SOCKET, SO_ATTACH_FILTER, &fprog, sizeof(fprog)); if (r < 0) return -errno; link->ll.sll_family = AF_PACKET; link->ll.sll_protocol = htons(ETH_P_IP); link->ll.sll_ifindex = ifindex; link->ll.sll_hatype = htons(arp_type); link->ll.sll_halen = mac_addr_len; memcpy(link->ll.sll_addr, bcast_addr, mac_addr_len); r = bind(s, &link->sa, sizeof(link->ll)); if (r < 0) return -errno; r = s; s = -1; return r; } int <API key>(int ifindex, union sockaddr_union *link, uint32_t xid, const uint8_t *mac_addr, size_t mac_addr_len, uint16_t arp_type) { static const uint8_t eth_bcast[] = { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF }; /* Default broadcast address for IPoIB */ static const uint8_t ib_bcast[] = { 0x00, 0xff, 0xff, 0xff, 0xff, 0x12, 0x40, 0x1b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff }; struct ether_addr eth_mac = { { 0, 0, 0, 0, 0, 0 } }; const uint8_t *bcast_addr = NULL; uint8_t dhcp_hlen = 0; assert_return(mac_addr_len > 0, -EINVAL); if (arp_type == ARPHRD_ETHER) { assert_return(mac_addr_len == ETH_ALEN, -EINVAL); memcpy(&eth_mac, mac_addr, ETH_ALEN); bcast_addr = eth_bcast; dhcp_hlen = ETH_ALEN; } else if (arp_type == ARPHRD_INFINIBAND) { assert_return(mac_addr_len == INFINIBAND_ALEN, -EINVAL); bcast_addr = ib_bcast; } else return -EINVAL; return _bind_raw_socket(ifindex, link, xid, mac_addr, mac_addr_len, bcast_addr, &eth_mac, arp_type, dhcp_hlen); } int <API key>(be32_t address, uint16_t port) { union sockaddr_union src = { .in.sin_family = AF_INET, .in.sin_port = htobe16(port), .in.sin_addr.s_addr = address, }; _cleanup_close_ int s = -1; int r, on = 1, tos = IPTOS_CLASS_CS6; s = socket(AF_INET, SOCK_DGRAM | SOCK_CLOEXEC | SOCK_NONBLOCK, 0); if (s < 0) return -errno; r = setsockopt(s, IPPROTO_IP, IP_TOS, &tos, sizeof(tos)); if (r < 0) return -errno; r = setsockopt(s, SOL_SOCKET, SO_REUSEADDR, &on, sizeof(on)); if (r < 0) return -errno; if (address == INADDR_ANY) { r = setsockopt(s, IPPROTO_IP, IP_PKTINFO, &on, sizeof(on)); if (r < 0) return -errno; r = setsockopt(s, SOL_SOCKET, SO_BROADCAST, &on, sizeof(on)); if (r < 0) return -errno; } else { r = setsockopt(s, IPPROTO_IP, IP_FREEBIND, &on, sizeof(on)); if (r < 0) return -errno; } r = bind(s, &src.sa, sizeof(src.in)); if (r < 0) return -errno; r = s; s = -1; return r; } int <API key>(int s, const union sockaddr_union *link, const void *packet, size_t len) { int r; assert(link); assert(packet); assert(len); r = sendto(s, packet, len, 0, &link->sa, sizeof(link->ll)); if (r < 0) return -errno; return 0; } int <API key>(int s, be32_t address, uint16_t port, const void *packet, size_t len) { union sockaddr_union dest = { .in.sin_family = AF_INET, .in.sin_port = htobe16(port), .in.sin_addr.s_addr = address, }; int r; assert(s >= 0); assert(packet); assert(len); r = sendto(s, packet, len, 0, &dest.sa, sizeof(dest.in)); if (r < 0) return -errno; return 0; }
#include "c.h" static char prec[] = { #define xx(a,b,c,d,e,f,g) c, #define yy(a,b,c,d,e,f,g) c, #include "token.h" }; static int oper[] = { #define xx(a,b,c,d,e,f,g) d, #define yy(a,b,c,d,e,f,g) d, #include "token.h" }; float refinc = 1.0; static Tree expr2(void); static Tree expr3(int); static Tree nullcheck(Tree); static Tree postfix(Tree); static Tree unary(void); static Tree primary(void); static Type super(Type ty); static Type super(Type ty) { switch (ty->op) { case INT: if (ty->size < inttype->size) return inttype; break; case UNSIGNED: if (ty->size < unsignedtype->size) return unsignedtype; break; case POINTER: return unsignedptr; } return ty; } Tree expr(int tok) { static char stop[] = { IF, ID, '}', 0 }; Tree p = expr1(0); while (t == ',') { Tree q; t = gettok(); q = pointer(expr1(0)); p = tree(RIGHT, q->type, root(value(p)), q); } if (tok) test(tok, stop); return p; } Tree expr0(int tok) { return root(expr(tok)); } Tree expr1(int tok) { static char stop[] = { IF, ID, 0 }; Tree p = expr2(); if (t == '=' || (prec[t] >= 6 && prec[t] <= 8) || (prec[t] >= 11 && prec[t] <= 13)) { int op = t; t = gettok(); if (oper[op] == ASGN) p = asgntree(ASGN, p, value(expr1(0))); else { expect('='); p = incr(op, p, expr1(0)); } } if (tok) test(tok, stop); return p; } Tree incr(int op, Tree v, Tree e) { return asgntree(ASGN, v, (*optree[op])(oper[op], v, e)); } static Tree expr2(void) { Tree p = expr3(4); if (t == '?') { Tree l, r; Coordinate pts[2]; if (Aflag > 1 && isfunc(p->type)) warning("%s used in a conditional expression\n", funcname(p)); p = pointer(p); t = gettok(); pts[0] = src; l = pointer(expr(':')); pts[1] = src; r = pointer(expr2()); if (generic(p->op) != CNST && events.points) { apply(events.points, &pts[0], &l); apply(events.points, &pts[1], &r); } p = condtree(p, l, r); } return p; } Tree value(Tree p) { int op = generic(rightkid(p)->op); if (p->type != voidtype && (op==AND || op==OR || op==NOT || op==EQ || op==NE || op== LE || op==LT || op== GE || op==GT)) p = condtree(p, consttree(1, inttype), consttree(0, inttype)); return p; } static Tree expr3(int k) { int k1; Tree p = unary(); for (k1 = prec[t]; k1 >= k; k1 while (prec[t] == k1 && *cp != '=') { Tree r; Coordinate pt; int op = t; t = gettok(); pt = src; p = pointer(p); if (op == ANDAND || op == OROR) { r = pointer(expr3(k1)); if (events.points) apply(events.points, &pt, &r); } else r = pointer(expr3(k1 + 1)); p = (*optree[op])(oper[op], p, r); } return p; } static Tree unary(void) { Tree p; switch (t) { case '*': t = gettok(); p = unary(); p = pointer(p); if (isptr(p->type) && (isfunc(p->type->type) || isarray(p->type->type))) p = retype(p, p->type->type); else { if (YYnull) p = nullcheck(p); p = rvalue(p); } break; case '&': t = gettok(); p = unary(); if (isarray(p->type) || isfunc(p->type)) p = retype(p, ptr(p->type)); else p = lvalue(p); if (isaddrop(p->op) && p->u.sym->sclass == REGISTER) error("invalid operand of unary &; `%s' is declared register\n", p->u.sym->name); else if (isaddrop(p->op)) p->u.sym->addressed = 1; break; case '+': t = gettok(); p = unary(); p = pointer(p); if (isarith(p->type)) p = cast(p, promote(p->type)); else typeerror(ADD, p, NULL); break; case '-': t = gettok(); p = unary(); p = pointer(p); if (isarith(p->type)) { Type ty = promote(p->type); p = cast(p, ty); if (isunsigned(ty)) { warning("unsigned operand of unary -\n"); p = simplify(ADD, ty, simplify(BCOM, ty, p, NULL), cnsttree(ty, 1UL)); } else p = simplify(NEG, ty, p, NULL); } else typeerror(SUB, p, NULL); break; case '~': t = gettok(); p = unary(); p = pointer(p); if (isint(p->type)) { Type ty = promote(p->type); p = simplify(BCOM, ty, cast(p, ty), NULL); } else typeerror(BCOM, p, NULL); break; case '!': t = gettok(); p = unary(); p = pointer(p); if (isscalar(p->type)) p = simplify(NOT, inttype, cond(p), NULL); else typeerror(NOT, p, NULL); break; case INCR: t = gettok(); p = unary(); p = incr(INCR, pointer(p), consttree(1, inttype)); break; case DECR: t = gettok(); p = unary(); p = incr(DECR, pointer(p), consttree(1, inttype)); break; case TYPECODE: case SIZEOF: { int op = t; Type ty; p = NULL; t = gettok(); if (t == '(') { t = gettok(); if (istypename(t, tsym)) { ty = typename(); expect(')'); } else { p = postfix(expr(')')); ty = p->type; } } else { p = unary(); ty = p->type; } assert(ty); if (op == TYPECODE) p = cnsttree(inttype, (long)ty->op); else { if (isfunc(ty) || ty->size == 0) error("invalid type argument `%t' to `sizeof'\n", ty); else if (p && rightkid(p)->op == FIELD) error("`sizeof' applied to a bit field\n"); p = cnsttree(unsignedlong, (unsigned long)ty->size); } } break; case '(': t = gettok(); if (istypename(t, tsym)) { Type ty, ty1 = typename(), pty; expect(')'); ty = unqual(ty1); if (isenum(ty)) { Type ty2 = ty->type; if (isconst(ty1)) ty2 = qual(CONST, ty2); if (isvolatile(ty1)) ty2 = qual(VOLATILE, ty2); ty1 = ty2; ty = ty->type; } p = pointer(unary()); pty = p->type; if (isenum(pty)) pty = pty->type; if (isarith(pty) && isarith(ty) || isptr(pty) && isptr(ty)) { explicitCast++; p = cast(p, ty); explicitCast } else if (isptr(pty) && isint(ty) || isint(pty) && isptr(ty)) { if (Aflag >= 1 && ty->size < pty->size) warning("conversion from `%t' to `%t' is compiler dependent\n", p->type, ty); p = cast(p, ty); } else if (ty != voidtype) { error("cast from `%t' to `%t' is illegal\n", p->type, ty1); ty1 = inttype; } if (generic(p->op) == INDIR || ty->size == 0) p = tree(RIGHT, ty1, NULL, p); else p = retype(p, ty1); } else p = postfix(expr(')')); break; default: p = postfix(primary()); } return p; } static Tree postfix(Tree p) { for (;;) switch (t) { case INCR: p = tree(RIGHT, p->type, tree(RIGHT, p->type, p, incr(t, p, consttree(1, inttype))), p); t = gettok(); break; case DECR: p = tree(RIGHT, p->type, tree(RIGHT, p->type, p, incr(t, p, consttree(1, inttype))), p); t = gettok(); break; case '[': { Tree q; t = gettok(); q = expr(']'); if (YYnull) if (isptr(p->type)) p = nullcheck(p); else if (isptr(q->type)) q = nullcheck(q); p = (*optree['+'])(ADD, pointer(p), pointer(q)); if (isptr(p->type) && isarray(p->type->type)) p = retype(p, p->type->type); else p = rvalue(p); } break; case '(': { Type ty; Coordinate pt; p = pointer(p); if (isptr(p->type) && isfunc(p->type->type)) ty = p->type->type; else { error("found `%t' expected a function\n", p->type); ty = func(voidtype, NULL, 1); p = retype(p, ptr(ty)); } pt = src; t = gettok(); p = call(p, ty, pt); } break; case '.': t = gettok(); if (t == ID) { if (isstruct(p->type)) { Tree q = addrof(p); p = field(q, token); q = rightkid(q); if (isaddrop(q->op) && q->u.sym->temporary) p = tree(RIGHT, p->type, p, NULL); } else error("left operand of . has incompatible type `%t'\n", p->type); t = gettok(); } else error("field name expected\n"); break; case DEREF: t = gettok(); p = pointer(p); if (t == ID) { if (isptr(p->type) && isstruct(p->type->type)) { if (YYnull) p = nullcheck(p); p = field(p, token); } else error("left operand of -> has incompatible type `%t'\n", p->type); t = gettok(); } else error("field name expected\n"); break; default: return p; } } static Tree primary(void) { Tree p; assert(t != '('); switch (t) { case ICON: case FCON: p = tree(mkop(CNST,tsym->type), tsym->type, NULL, NULL); p->u.v = tsym->u.c.v; break; case SCON: if (ischar(tsym->type->type)) tsym->u.c.v.p = stringn(tsym->u.c.v.p, tsym->type->size); else tsym->u.c.v.p = memcpy(allocate((tsym->type->size/widechar->size)*sizeof (int), PERM), tsym->u.c.v.p, (tsym->type->size/widechar->size)*sizeof (int)); tsym = constant(tsym->type, tsym->u.c.v); if (tsym->u.c.loc == NULL) tsym->u.c.loc = genident(STATIC, tsym->type, GLOBAL); p = idtree(tsym->u.c.loc); break; case ID: if (tsym == NULL) { Symbol p = install(token, &identifiers, level, PERM); p->src = src; if (getchr() == '(') { Symbol q = lookup(token, externals); p->type = func(inttype, NULL, 1); p->sclass = EXTERN; if (Aflag >= 1) warning("missing prototype\n"); if (q && !eqtype(q->type, p->type, 1)) warning("implicit declaration of `%s' does not match previous declaration at %w\n", q->name, &q->src); if (q == NULL) { q = install(p->name, &externals, GLOBAL, PERM); q->type = p->type; q->sclass = EXTERN; q->src = src; (*IR->defsymbol)(q); } p->u.alias = q; } else { error("undeclared identifier `%s'\n", p->name); p->sclass = AUTO; p->type = inttype; if (p->scope == GLOBAL) (*IR->defsymbol)(p); else addlocal(p); } t = gettok(); if (xref) use(p, src); return idtree(p); } if (xref) use(tsym, src); if (tsym->sclass == ENUM) p = consttree(tsym->u.value, inttype); else { if (tsym->sclass == TYPEDEF) error("illegal use of type name `%s'\n", tsym->name); p = idtree(tsym); } break; case FIRSTARG: if (level > PARAM && cfunc && cfunc->u.f.callee[0]) p = idtree(cfunc->u.f.callee[0]); else { error("illegal use of `%k'\n", FIRSTARG); p = cnsttree(inttype, 0L); } break; default: error("illegal expression\n"); p = cnsttree(inttype, 0L); } t = gettok(); return p; } Tree idtree(Symbol p) { int op; Tree e; Type ty = p->type ? unqual(p->type) : voidptype; if (p->scope == GLOBAL || p->sclass == STATIC) op = ADDRG; else if (p->scope == PARAM) { op = ADDRF; if (isstruct(p->type) && !IR->wants_argb) { e = tree(mkop(op,voidptype), ptr(ptr(p->type)), NULL, NULL); e->u.sym = p; return rvalue(rvalue(e)); } } else if (p->sclass == EXTERN) { assert(p->u.alias); p = p->u.alias; op = ADDRG; } else op = ADDRL; p->ref += refinc; if (isarray(ty)) e = tree(mkop(op,voidptype), p->type, NULL, NULL); else if (isfunc(ty)) e = tree(mkop(op,funcptype), p->type, NULL, NULL); else e = tree(mkop(op,voidptype), ptr(p->type), NULL, NULL); e->u.sym = p; if (isptr(e->type)) e = rvalue(e); return e; } Tree rvalue(Tree p) { Type ty = deref(p->type); ty = unqual(ty); return tree(mkop(INDIR,ty), ty, p, NULL); } Tree lvalue(Tree p) { if (generic(p->op) != INDIR) { error("lvalue required\n"); return value(p); } else if (unqual(p->type) == voidtype) warning("`%t' used as an lvalue\n", p->type); return p->kids[0]; } Tree retype(Tree p, Type ty) { Tree q; if (p->type == ty) return p; q = tree(p->op, ty, p->kids[0], p->kids[1]); q->node = p->node; q->u = p->u; return q; } Tree rightkid(Tree p) { while (p && p->op == RIGHT) if (p->kids[1]) p = p->kids[1]; else if (p->kids[0]) p = p->kids[0]; else assert(0); assert(p); return p; } int hascall(Tree p) { if (p == 0) return 0; if (generic(p->op) == CALL || (IR->mulops_calls && (p->op == DIV+I || p->op == MOD+I || p->op == MUL+I || p->op == DIV+U || p->op == MOD+U || p->op == MUL+U))) return 1; return hascall(p->kids[0]) || hascall(p->kids[1]); } Type binary(Type xty, Type yty) { #define xx(t) if (xty == t || yty == t) return t xx(longdouble); xx(doubletype); xx(floattype); xx(unsignedlonglong); xx(longlong); xx(unsignedlong); if (xty == longtype && yty == unsignedtype || xty == unsignedtype && yty == longtype) if (longtype->size > unsignedtype->size) return longtype; else return unsignedlong; xx(longtype); xx(unsignedtype); return inttype; #undef xx } Tree pointer(Tree p) { if (isarray(p->type)) /* assert(p->op != RIGHT || p->u.sym == NULL), */ p = retype(p, atop(p->type)); else if (isfunc(p->type)) p = retype(p, ptr(p->type)); return p; } Tree cond(Tree p) { int op = generic(rightkid(p)->op); if (op == AND || op == OR || op == NOT || op == EQ || op == NE || op == LE || op == LT || op == GE || op == GT) return p; p = pointer(p); return (*optree[NEQ])(NE, p, consttree(0, inttype)); } Tree cast(Tree p, Type type) { Type src, dst; p = value(p); if (p->type == type) return p; dst = unqual(type); src = unqual(p->type); if (src->op != dst->op || src->size != dst->size) { switch (src->op) { case INT: if (src->size < inttype->size) p = simplify(CVI, inttype, p, NULL); break; case UNSIGNED: if (src->size < inttype->size) p = simplify(CVU, inttype, p, NULL); else if (src->size < unsignedtype->size) p = simplify(CVU, unsignedtype, p, NULL); break; case ENUM: p = retype(p, inttype); break; case POINTER: if (isint(dst) && src->size > dst->size) warning("conversion from `%t' to `%t' is undefined\n", p->type, type); p = simplify(CVP, super(src), p, NULL); break; case FLOAT: break; default: assert(0); } { src = unqual(p->type); dst = super(dst); if (src->op != dst->op) switch (src->op) { case INT: p = simplify(CVI, dst, p, NULL); break; case UNSIGNED: if (isfloat(dst)) { Type ssrc = signedint(src); Tree two = cnsttree(longdouble, (long double)2.0); p = (*optree['+'])(ADD, (*optree['*'])(MUL, two, simplify(CVU, ssrc, simplify(RSH, src, p, consttree(1, inttype)), NULL)), simplify(CVU, ssrc, simplify(BAND, src, p, consttree(1, unsignedtype)), NULL)); } else p = simplify(CVU, dst, p, NULL); break; case FLOAT: if (isunsigned(dst)) { Type sdst = signedint(dst); Tree c = cast(cnsttree(longdouble, (long double)sdst->u.sym->u.limits.max.i + 1), src); p = condtree( simplify(GE, src, p, c), (*optree['+'])(ADD, cast(cast(simplify(SUB, src, p, c), sdst), dst), cast(cnsttree(unsignedlong, (unsigned long)sdst->u.sym->u.limits.max.i + 1), dst)), simplify(CVF, sdst, p, NULL)); } else p = simplify(CVF, dst, p, NULL); break; default: assert(0); } dst = unqual(type); } } src = unqual(p->type); switch (src->op) { case INT: if (src->op != dst->op || src->size != dst->size) p = simplify(CVI, dst, p, NULL); break; case UNSIGNED: if (src->op != dst->op || src->size != dst->size) p = simplify(CVU, dst, p, NULL); break; case FLOAT: if (src->op != dst->op || src->size != dst->size) p = simplify(CVF, dst, p, NULL); break; case POINTER: if (src->op != dst->op) p = simplify(CVP, dst, p, NULL); else { if ((isfunc(src->type) && !isfunc(dst->type)) || (!isnullptr(p) && !isfunc(src->type) && isfunc(dst->type))) warning("conversion from `%t' to `%t' is compiler dependent\n", p->type, type); if (src->size != dst->size) p = simplify(CVP, dst, p, NULL); } break; default: assert(0); } return retype(p, type); } Tree field(Tree p, const char *name) { Field q; Type ty1, ty = p->type; if (isptr(ty)) ty = deref(ty); ty1 = ty; ty = unqual(ty); if ((q = fieldref(name, ty)) != NULL) { if (isarray(q->type)) { ty = q->type->type; if (isconst(ty1) && !isconst(ty)) ty = qual(CONST, ty); if (isvolatile(ty1) && !isvolatile(ty)) ty = qual(VOLATILE, ty); ty = array(ty, q->type->size/ty->size, q->type->align); } else { ty = q->type; if (isconst(ty1) && !isconst(ty)) ty = qual(CONST, ty); if (isvolatile(ty1) && !isvolatile(ty)) ty = qual(VOLATILE, ty); ty = ptr(ty); } if (YYcheck && !isaddrop(p->op) && q->offset > 0) /* omit */ p = nullcall(ty, YYcheck, p, consttree(q->offset, inttype)); /* omit */ else /* omit */ p = simplify(ADD+P, ty, p, consttree(q->offset, signedptr)); if (q->lsb) { p = tree(FIELD, ty->type, rvalue(p), NULL); p->u.field = q; } else if (!isarray(q->type)) p = rvalue(p); } else { error("unknown field `%s' of `%t'\n", name, ty); p = rvalue(retype(p, ptr(inttype))); } return p; } /* funcname - return name of function f or a function' */ char *funcname(Tree f) { if (isaddrop(f->op)) return stringf("`%s'", f->u.sym->name); return "a function"; } static Tree nullcheck(Tree p) { if (!needconst && YYnull && isptr(p->type)) { p = value(p); if (strcmp(YYnull->name, "_YYnull") == 0) { Symbol t1 = temporary(REGISTER, voidptype); p = tree(RIGHT, p->type, tree(OR, voidtype, cond(asgn(t1, cast(p, voidptype))), vcall(YYnull, voidtype, (file && *file ? pointer(idtree(mkstr(file)->u.c.loc)) : cnsttree(voidptype, NULL)), cnsttree(inttype, (long)lineno) , NULL)), idtree(t1)); } else p = nullcall(p->type, YYnull, p, cnsttree(inttype, 0L)); } return p; } Tree nullcall(Type pty, Symbol f, Tree p, Tree e) { Type ty; if (isarray(pty)) return retype(nullcall(atop(pty), f, p, e), pty); ty = unqual(unqual(p->type)->type); return vcall(f, pty, p, e, cnsttree(inttype, (long)ty->size), cnsttree(inttype, (long)ty->align), (file && *file ? pointer(idtree(mkstr(file)->u.c.loc)) : cnsttree(voidptype, NULL)), cnsttree(inttype, (long)lineno) , NULL); }
import com.sun.beans.finder.ConstructorFinder; import java.lang.reflect.Constructor; import java.util.ArrayList; import java.util.Collections; import java.util.List; /* * @test * @bug 8028054 * @summary Tests that cached constructors have synchronized access * @author Sergey Malenkov * @modules java.desktop/com.sun.beans.finder * java.activation * java.transaction * java.corba * java.xml.bind * @compile -XDignore.symbol.file <API key>.java * @run main/othervm --add-modules=java.activation,java.transaction,java.corba,java.xml.bind <API key> */ public class <API key> { public static void main(String[] args) throws Exception { List<Class<?>> classes = Task.getClasses(Integer.MAX_VALUE); List<Constructor> constructors = new ArrayList<>(); for (Class<?> type : classes) { Collections.addAll(constructors, type.getConstructors()); } Task.print("found " + constructors.size() + " constructors in " + classes.size() + " classes"); List<Task> tasks = new ArrayList<>(); for (int i = 0; i < 50; i++) { tasks.add(new Task<Constructor>(constructors) { @Override protected void process(Constructor constructor) throws <API key> { ConstructorFinder.findConstructor(constructor.getDeclaringClass(), constructor.getParameterTypes()); } }); } int alarm = 0; while (true) { int alive = 0; int working = 0; for (Task task : tasks) { if (task.isWorking()) { working++; alive++; } else if (task.isAlive()) { alive++; } } if (alive == 0) { break; } Task.print(working + " out of " + alive + " threads are working"); if ((working == 0) && (++alarm == 10)) { throw new RuntimeException("FAIL - DEADLOCK DETECTED"); } Thread.sleep(1000); } } }
#ifndef <API key> #define <API key> #include "SDMMD_Initialize.h" #include "SDMMD_Functions.h" #include "SDMMD_AMDevice.h" #include "<API key>.h" #include "SDMMD_Error.h" #include "SDMMD_MCP.h" #include "<API key>.h" #include "SDMMD_Applications.h" #include "SDMMD_Notification.h" #include "SDMMD_Debugger.h" #endif
#include <linux/module.h> #include <linux/kernel.h> #include <linux/errno.h> #include <linux/string.h> #include <linux/slab.h> #include <linux/delay.h> #include <linux/mm.h> #include <linux/fb.h> #include <linux/init.h> #include <linux/ioport.h> #include <linux/list.h> #include <linux/proc_fs.h> #include <linux/platform_device.h> #include <asm/sizes.h> #include <asm/io.h> #include <asm/uaccess.h> #include <asm/cacheflush.h> #include <plat/fb.h> #include <linux/aipc/i_util.h> #include <linux/aipc/lk_util.h> #include <linux/aipc/i_dsp.h> #include <plat/ambcache.h> #if defined(<API key>) #define DEBUG_BOSS_FB 0 #if DEBUG_BOSS_FB #define DEBUG_MSG_FB pr_notice #else #define DEBUG_MSG_FB(...) #endif #define CCF_NUM 2 #define DEFAULT_FB_NUM 2 extern void cc_rgb565_yuv565(u32 *src, u32 *dst, int pitch, int xres, int yres); struct boss_video_mem { void *mem; unsigned int size; void *curmem; unsigned int leftover; int partitions; }; /* * Extrapolated settings from BOSS (i.e., inherited from remote OS). * This frame buffer is going to modify some properties, pre-claim of DSP * states are kept here so that it has valid data to operate on and * restore to later. */ struct boss_fb { struct vdspdrv_osd original; /* Original setting pre-claim */ int video_plane; /* Original video plane on/off */ void *clut; /* Original CLUT pointer */ int width; int height; int pitch; int csc_en; unsigned int csc_parms[9]; void *ccf[CCF_NUM]; /* Color-converted frames */ int ccfi; /* Current color-converted frame */ int nccf; /* Number of color-converted frame */ void *smem_start; /* FB subsystem smem start phys addr */ void *smem_start_virt; /* FB subsystem smem start virt addr */ unsigned int smem_len; /* FB subsustem smem length */ int framesize; int smem_index; unsigned int ccflen; /* Color-conversion frame length */ int active; /* FB is active */ struct vdspdrv_osd bossed; /* BOSS setting post-claim */ }; static struct boss_video_mem G_boss_video_mem; static struct boss_fb G_boss_fb[2]; /* * Change color look-up table. */ static int <API key>(struct fb_cmap *cmap, struct fb_info *info) { struct <API key> *pfb = (struct <API key> *) info->par; struct boss_fb *boss_fb; int voutid; DEBUG_MSG_FB ("[ipc] <API key> (%d)\n", vdspdrv->active); if (vdspdrv->active == 0) return -EIO; /* * Set new color look-up table. */ voutid = info->node; boss_fb = &G_boss_fb[voutid]; if (boss_fb->active) { <API key>(voutid, pfb->clut_table); } return 0; } /* * Pan display (updated OSD pointer). */ static int <API key>(struct fb_var_screeninfo *var, struct fb_info *info) { struct <API key> *pfb = (struct <API key> *) info->par; struct boss_fb *boss_fb; int voutid = info->node; boss_fb = &G_boss_fb[voutid]; boss_fb->smem_index = var->yoffset / boss_fb->height; if (vdspdrv->active == 0) return -EIO; pfb->proc_wait_flag++; wake_up(&pfb->proc_wait); /* Update frame */ DEBUG_MSG_FB ("[ipc] <API key> (%d)\n", voutid); if (boss_fb->active) { void *src, *dst; int offset; offset = info->fix.line_length * var->yoffset; src = info->screen_base + offset; dst = boss_fb->ccf[boss_fb->ccfi]; DEBUG_MSG_FB ("[ipc] %dx%d, %d (%08x)\n", info->fix.line_length, var->yoffset, offset, offset); memcpy (dst, src, boss_fb->framesize); <API key> (dst, boss_fb->framesize); vdspdrv_osd_setbuf(voutid, dst); boss_fb->ccfi = (boss_fb->ccfi + 1) % boss_fb->nccf; } return 0; } /* * Activate our frame buffer to be displayed by the DSP. */ static int ambfb_activate(int voutid) { struct boss_fb *boss_fb = &G_boss_fb[voutid]; struct vdspdrv_osd *osd = vdspdrv_osd[voutid]; int i; DEBUG_MSG_FB ("[ipc] ambfb_activate (%d): %08x %08x\n", voutid, boss_fb, osd); /* * Refresh IPC data and check if vdspdrv is active. */ if (vdspdrv_refresh() < 0) return -EIO; else if (!vdspdrv->active) return -ENODEV; if (boss_fb->active) return -EAGAIN; if (vdspdrv_refresh_osd(voutid) < 0) return -EIO; /* Take over OSD from remote OS */ ipc_report_fb_owned(); /* Back up OSD settings */ memcpy(&boss_fb->original, osd, sizeof(*osd)); memcpy(&boss_fb->bossed, osd, sizeof(*osd)); /* Back up video plane, osd plane, and clut settings */ boss_fb->video_plane = <API key>(voutid); boss_fb->clut = <API key>(voutid); /* Force RGB565 mode */ boss_fb->bossed.colorformat = <API key>; boss_fb->bossed.bitsperpixel = 16; boss_fb->bossed.zbuf0 = (void *) ((u32) boss_fb->smem_start_virt + boss_fb->smem_index * boss_fb->framesize); boss_fb->bossed.width = boss_fb->width; boss_fb->bossed.height = boss_fb->height; boss_fb->bossed.pitch = boss_fb->pitch; boss_fb->bossed.rescaler_en = 0; boss_fb->bossed.input_width = 0;//boss_fb->width; boss_fb->bossed.input_height = 0;//boss_fb->height; boss_fb->bossed.csc_en = boss_fb->csc_en; for (i = 0; i < 9; i++) { boss_fb->bossed.csc_parms[i] = boss_fb->csc_parms[i]; } vdspdrv_osd_apply(voutid, &boss_fb->bossed); boss_fb->active = 1; DEBUG_MSG_FB ("[ipc] ambfb_activate (%d) END\n", voutid); return 0; } /* * Deactivate our frame buffer and restore pre-applied settings to DSP. */ static int ambfb_deactivate(int voutid) { struct boss_fb *boss_fb = &G_boss_fb[voutid]; DEBUG_MSG_FB ("[ipc] ambfb_deactivate (%d)\n", voutid); if (!boss_fb->active) return -EAGAIN; boss_fb->active = 0; /* Restore OSD settings */ vdspdrv_osd_apply(voutid, &boss_fb->original); /* Hand back OSD to remote OS */ <API key>(); DEBUG_MSG_FB ("[ipc] ambfb_deactivate (%d) END\n", voutid); return 0; } #if defined(CONFIG_PROC_FS) extern struct proc_dir_entry *proc_aipc; struct proc_fb { struct proc_dir_entry *dir; struct proc_dir_entry *status; struct proc_dir_entry *control; }; static struct proc_fb proc_fb[2]; static int <API key>(char *page, char **start, off_t off, int count, int *eof, void *data) { int len = 0; int id = (int) data; struct boss_fb *boss_fb = &G_boss_fb[id]; len += snprintf(page + len, PAGE_SIZE - len, "fb%d:\n", id); len += snprintf(page + len, PAGE_SIZE - len, "%d x %d\n", boss_fb->width, boss_fb->height); len += snprintf(page + len, PAGE_SIZE - len, "pitch: %d\n", boss_fb->pitch); len += snprintf(page + len, PAGE_SIZE - len, "active: %d\n", boss_fb->active); *eof = 1; return len; } static int <API key>(struct file *file, const char __user *buffer, unsigned long count, void *data) { int id = (int) data; char *buf; int val; buf = kmalloc(GFP_KERNEL, count); if (buf == NULL) return -ENOMEM; if (copy_from_user(buf, buffer, count)) return -EFAULT; if (sscanf(buf, "%d", &val) == 1) { if (val) ambfb_activate(id); else ambfb_deactivate(id); } kfree(buf); return count; } static void boss_fb_procfs_init(int voutid) { struct proc_fb *fb; char tmp[128]; fb = &proc_fb[voutid]; snprintf(tmp, sizeof(tmp), "fb%d", voutid); fb->dir = proc_mkdir(tmp, proc_aipc); if (fb->dir == NULL) return; fb->status = create_proc_entry("status", 0, fb->dir); if (fb->status) { fb->status->data = (void *) voutid; fb->status->read_proc = <API key>; fb->status->write_proc = NULL; } fb->control = create_proc_entry("control", 0, fb->dir); if (fb->control) { fb->control->data = (void *) voutid; fb->control->read_proc = NULL; fb->control->write_proc = <API key>; } } static void <API key>(int voutid) { struct proc_fb *fb; char tmp[128]; fb = &proc_fb[voutid]; if (fb->status) { remove_proc_entry("status", fb->dir); fb->status = NULL; } if (fb->control) { remove_proc_entry("control", fb->dir); } if (fb->dir) { snprintf(tmp, sizeof(tmp), "fb%d", voutid); remove_proc_entry(tmp, proc_aipc); fb->dir = NULL; } } #endif /* CONFIG_PROC_FS */ /* * Take over frame buffer control from remote OS. */ static int <API key>(int id) { DEBUG_MSG_FB ("[ipc] <API key> (%d)\n", id); ambfb_activate(id); DEBUG_MSG_FB ("[ipc] <API key> END\n"); return 0; } /* * Release frame buffer control to remote OS. */ static int <API key>(int id) { DEBUG_MSG_FB ("[ipc] <API key> (%d)\n", id); ambfb_deactivate(id); DEBUG_MSG_FB ("[ipc] <API key> END\n"); return 0; } /* * Install handlers for IPC frame-buffer takeover and release. */ static void <API key>(void) { unsigned long flags; local_irq_save(flags); fbreq_handler.takeover_req = <API key>; fbreq_handler.release_req = <API key>; local_irq_restore(flags); } /* * Remove handlers for IPC frame-buffer takeover and release. */ static void <API key>(void) { unsigned long flags; local_irq_save(flags); if (fbreq_handler.takeover_req == <API key>) fbreq_handler.takeover_req = NULL; if (fbreq_handler.release_req == <API key>) fbreq_handler.release_req = NULL; local_irq_restore(flags); } /* * Claim vdspdrv/osd resources. */ int ambfb_vdspdrv_claim(struct <API key> *pfb, int voutid) { int rval = 0; struct boss_fb *boss_fb = &G_boss_fb[voutid]; unsigned int bytesperpixel; unsigned int framesize, total_size; int colorformat; int fb_num = DEFAULT_FB_NUM; DEBUG_MSG_FB ("[ipc] ambfb_vdspdrv_claim (%d)\n", voutid); if (voutid == 0) <API key>(); /* * Refresh IPC data and check if vdspdrv is active. */ if (vdspdrv_refresh() < 0) return -EIO; else if (!vdspdrv->active) return -ENODEV; if (vdspdrv_refresh_osd(voutid) < 0) return -EIO; /* * Get the exclusive video memory that is reserved for Linux * from the IPC. */ if (G_boss_video_mem.mem == NULL) { rval = ipc_get_exfb(&G_boss_video_mem.mem, &G_boss_video_mem.size); if (rval < 0) return -EIO; DEBUG_MSG_FB ("[ipc] G_boss_video_mem: %08x %08x (%d)\n", G_boss_video_mem.mem, G_boss_video_mem.size, G_boss_video_mem.size); G_boss_video_mem.curmem = G_boss_video_mem.mem; G_boss_video_mem.leftover = G_boss_video_mem.size; } /* * Extrapolate width and height. */ boss_fb->width = pfb->screen_var.xres; boss_fb->height = pfb->screen_var.yres; colorformat = AMBFB_COLOR_RGB565; bytesperpixel = 2; if ((pfb->screen_var.yres_virtual != 0) && (pfb->screen_var.yres != 0)) { fb_num = pfb->screen_var.yres_virtual / pfb->screen_var.yres; } boss_fb->pitch = boss_fb->width * bytesperpixel; boss_fb->csc_en = 2; boss_fb->csc_parms[0] = 0x003f0275; boss_fb->csc_parms[1] = 0x1ea600bb; boss_fb->csc_parms[2] = 0x1f9901c2; boss_fb->csc_parms[3] = 0x1fd71e67; boss_fb->csc_parms[4] = 0x001001c2; boss_fb->csc_parms[5] = 0x00800080; boss_fb->csc_parms[6] = 0x00eb0010; boss_fb->csc_parms[7] = 0x00eb0010; boss_fb->csc_parms[8] = 0x00eb0010; framesize = boss_fb->pitch * boss_fb->height; boss_fb->framesize = framesize; if (framesize % PAGE_SIZE) { framesize /= PAGE_SIZE; framesize++; framesize *= PAGE_SIZE; } total_size = framesize * (fb_num + CCF_NUM); DEBUG_MSG_FB ("[ipc] osd: %dx%d (%d), %d, %08x\n", boss_fb->width, boss_fb->height, boss_fb->pitch, fb_num, total_size); /* * Allocate and partition video memory. */ if (G_boss_video_mem.leftover >= total_size) { int i; boss_fb->smem_start_virt = G_boss_video_mem.curmem; boss_fb->smem_start = (void *) ipc_virt_to_phys((u32) boss_fb->smem_start_virt); boss_fb->smem_len = framesize * fb_num; G_boss_video_mem.curmem += boss_fb->smem_len; G_boss_video_mem.leftover -= boss_fb->smem_len; DEBUG_MSG_FB ("[ipc] fb smem: %08x (%08x) %08x\n", boss_fb->smem_start_virt, boss_fb->smem_start, boss_fb->smem_len); boss_fb->ccfi = 0; boss_fb->nccf = CCF_NUM; for (i = 0; i < boss_fb->nccf; i++) { boss_fb->ccf[i] = G_boss_video_mem.curmem; G_boss_video_mem.curmem += framesize; G_boss_video_mem.leftover -= framesize; memset (boss_fb->ccf[i], 0, framesize); } } else { DEBUG_MSG_FB ("[ipc] fbmem is not enough.. %d < %d\n", G_boss_video_mem.leftover, total_size); return -ENOMEM; } /* * Set up FB subsystem parameters. */ pfb->use_prealloc = 1; pfb-><API key> = boss_fb->pitch; pfb->color_format = colorformat; pfb->screen_var.bits_per_pixel = bytesperpixel * 8; pfb->screen_var.xres = boss_fb->width; pfb->screen_var.xres_virtual = boss_fb->width; pfb->screen_var.yres = boss_fb->height; pfb->screen_var.yres_virtual = boss_fb->height * fb_num; pfb->screen_fix.smem_start = (u32) boss_fb->smem_start; pfb->screen_fix.smem_len = boss_fb->smem_len; pfb->screen_fix.line_length = boss_fb->pitch; /* Install and override fb_ops */ pfb->setcmap = <API key>; pfb->pan_display = <API key>; #if defined(CONFIG_PROC_FS) boss_fb_procfs_init(voutid); #endif return 0; } /* * Release and restore vdspdrv/osd resources. */ int <API key>(struct <API key> *pfb, int voutid) { DEBUG_MSG_FB ("[ipc] <API key> (%d)\n", voutid); if (voutid == 0) <API key>(); #if defined(CONFIG_PROC_FS) <API key>(voutid); #endif return 0; } MODULE_LICENSE("GPL"); MODULE_AUTHOR("Charles Chiou <cchiou@ambarella.com>"); MODULE_DESCRIPTION("Ambarella virtual frame buffer driver"); #endif /* <API key> */
/* * Changes: * David S. Miller : New socket lookup architecture. * This code is dedicated to John Dyson. * David S. Miller : Change semantics of established hash, * half is devoted to TIME_WAIT sockets * and the rest go in the other half. * Andi Kleen : Add support for syncookies and fixed * some bugs: ip options weren't passed to * the TCP layer, missed a check for an ACK bit. * Andi Kleen : Implemented fast path mtu discovery. * Fixed many serious bugs in the * open_request handling and moved * most of it into the af independent code. * Added tail drop and some other bugfixes. * Added new listen sematics. * Mike McLagan : Routing by source * Juan Jose Ciarlante: ip_dynaddr bits * Andi Kleen: various fixes. * Vitaly E. Lavrov : Transparent proxy revived after year coma. * Andi Kleen : Fix new listen. * Andi Kleen : Fix accept error reporting. */ #include <linux/config.h> #include <linux/types.h> #include <linux/fcntl.h> #include <linux/random.h> #include <linux/init.h> #include <linux/ipsec.h> #include <net/icmp.h> #include <net/tcp.h> #include <net/ipv6.h> #include <asm/segment.h> #include <linux/inet.h> #include <linux/stddef.h> extern int <API key>; extern int <API key>; extern int sysctl_tcp_sack; extern int <API key>; extern int sysctl_ip_dynaddr; extern __u32 sysctl_wmem_max; extern __u32 sysctl_rmem_max; /* Check TCP sequence numbers in ICMP packets. */ #define ICMP_MIN_LENGTH 8 /* Socket used for sending RSTs */ struct inode tcp_inode; struct socket *tcp_socket=&tcp_inode.u.socket_i; static void tcp_v4_send_reset(struct sk_buff *skb); void tcp_v4_send_check(struct sock *sk, struct tcphdr *th, int len, struct sk_buff *skb); /* This is for sockets with full identity only. Sockets here will always * be without wildcards and will have the following invariant: * TCP_ESTABLISHED <= sk->state < TCP_CLOSE * * First half of the table is for sockets not in TIME_WAIT, second half * is for TIME_WAIT sockets only. */ unsigned int tcp_ehash_size; struct sock **tcp_ehash; /* Ok, let's try this, I give up, we do need a local binding * TCP hash as well as the others for fast bind/connect. */ unsigned int tcp_bhash_size; struct tcp_bind_bucket **tcp_bhash; /* All sockets in TCP_LISTEN state will be in here. This is the only table * where wildcard'd TCP sockets can exist. Hash function here is just local * port number. */ struct sock *tcp_listening_hash[TCP_LHTABLE_SIZE]; /* Register cache. */ struct sock *tcp_regs[TCP_NUM_REGS]; /* * This array holds the first and last local port number. * For high-usage systems, use sysctl to change this to * 32768-61000 */ int <API key>[2] = { 1024, 4999 }; int tcp_port_rover = (1024 - 1); static __inline__ int tcp_hashfn(__u32 laddr, __u16 lport, __u32 faddr, __u16 fport) { return ((laddr ^ lport) ^ (faddr ^ fport)) & ((tcp_ehash_size/2) - 1); } static __inline__ int tcp_sk_hashfn(struct sock *sk) { __u32 laddr = sk->rcv_saddr; __u16 lport = sk->num; __u32 faddr = sk->daddr; __u16 fport = sk->dport; return tcp_hashfn(laddr, lport, faddr, fport); } /* Allocate and initialize a new TCP local port bind bucket. * Always runs inside the socket hashing lock. */ struct tcp_bind_bucket *tcp_bucket_create(unsigned short snum) { struct tcp_bind_bucket *tb; tb = kmem_cache_alloc(tcp_bucket_cachep, SLAB_ATOMIC); if(tb != NULL) { struct tcp_bind_bucket **head = &tcp_bhash[tcp_bhashfn(snum)]; tb->port = snum; tb->fastreuse = 0; tb->owners = NULL; if((tb->next = *head) != NULL) tb->next->pprev = &tb->next; *head = tb; tb->pprev = head; } return tb; } #ifdef <API key> /* Ensure that the bound bucket for the port exists. * Return 0 and bump bucket reference count on success. * * Must run in a BH atomic section. */ static __inline__ int __tcp_bucket_check(unsigned short snum) { struct tcp_bind_bucket *tb; tb = tcp_bhash[tcp_bhashfn(snum)]; for( ; (tb && (tb->port != snum)); tb = tb->next) ; if (tb == NULL) { if ((tb = tcp_bucket_create(snum)) == NULL) return 1; } return 0; } #endif static __inline__ void __tcp_inherit_port(struct sock *sk, struct sock *child) { struct tcp_bind_bucket *tb = (struct tcp_bind_bucket *)sk->prev; #ifdef <API key> if (child->num != sk->num) { unsigned short snum = child->num; for(tb = tcp_bhash[tcp_bhashfn(snum)]; tb && tb->port != snum; tb = tb->next) ; if (tb == NULL) tb = (struct tcp_bind_bucket *)sk->prev; } #endif if ((child->bind_next = tb->owners) != NULL) tb->owners->bind_pprev = &child->bind_next; tb->owners = child; child->bind_pprev = &tb->owners; child->prev = (struct sock *) tb; } __inline__ void tcp_inherit_port(struct sock *sk, struct sock *child) { SOCKHASH_LOCK(); __tcp_inherit_port(sk, child); SOCKHASH_UNLOCK(); } /* Obtain a reference to a local port for the given sock, * if snum is zero it means select any available local port. */ static int tcp_v4_get_port(struct sock *sk, unsigned short snum) { struct tcp_bind_bucket *tb; SOCKHASH_LOCK(); if (snum == 0) { int rover = tcp_port_rover; int low = <API key>[0]; int high = <API key>[1]; int remaining = (high - low) + 1; do { rover++; if ((rover < low) || (rover > high)) rover = low; tb = tcp_bhash[tcp_bhashfn(rover)]; for ( ; tb; tb = tb->next) if (tb->port == rover) goto next; break; next: ; /* Do nothing. */ } while (--remaining > 0); tcp_port_rover = rover; /* Exhausted local port range during search? */ if (remaining <= 0) goto fail; /* OK, here is the one we will use. */ snum = rover; tb = NULL; } else { for (tb = tcp_bhash[tcp_bhashfn(snum)]; tb != NULL; tb = tb->next) if (tb->port == snum) break; } if (tb != NULL && tb->owners != NULL) { if (tb->fastreuse != 0 && sk->reuse != 0) { goto success; } else { struct sock *sk2 = tb->owners; int sk_reuse = sk->reuse; for( ; sk2 != NULL; sk2 = sk2->bind_next) { if (sk->bound_dev_if == sk2->bound_dev_if) { if (!sk_reuse || !sk2->reuse || sk2->state == TCP_LISTEN) { if (!sk2->rcv_saddr || !sk->rcv_saddr || (sk2->rcv_saddr == sk->rcv_saddr)) break; } } } /* If we found a conflict, fail. */ if (sk2 != NULL) goto fail; } } if (tb == NULL && (tb = tcp_bucket_create(snum)) == NULL) goto fail; if (tb->owners == NULL) { if (sk->reuse && sk->state != TCP_LISTEN) tb->fastreuse = 1; else tb->fastreuse = 0; } else if (tb->fastreuse && ((sk->reuse == 0) || (sk->state == TCP_LISTEN))) tb->fastreuse = 0; success: sk->num = snum; if ((sk->bind_next = tb->owners) != NULL) tb->owners->bind_pprev = &sk->bind_next; tb->owners = sk; sk->bind_pprev = &tb->owners; sk->prev = (struct sock *) tb; SOCKHASH_UNLOCK(); return 0; fail: SOCKHASH_UNLOCK(); return 1; } /* Get rid of any references to a local port held by the * given sock. */ __inline__ void __tcp_put_port(struct sock *sk) { struct tcp_bind_bucket *tb; tb = (struct tcp_bind_bucket *) sk->prev; if (sk->bind_next) sk->bind_next->bind_pprev = sk->bind_pprev; *(sk->bind_pprev) = sk->bind_next; sk->prev = NULL; if (tb->owners == NULL) { if (tb->next) tb->next->pprev = tb->pprev; *(tb->pprev) = tb->next; kmem_cache_free(tcp_bucket_cachep, tb); } } void tcp_put_port(struct sock *sk) { SOCKHASH_LOCK(); __tcp_put_port(sk); SOCKHASH_UNLOCK(); } static __inline__ void __tcp_v4_hash(struct sock *sk) { struct sock **skp; if(sk->state == TCP_LISTEN) skp = &tcp_listening_hash[<API key>(sk)]; else skp = &tcp_ehash[(sk->hashent = tcp_sk_hashfn(sk))]; if((sk->next = *skp) != NULL) (*skp)->pprev = &sk->next; *skp = sk; sk->pprev = skp; } static void tcp_v4_hash(struct sock *sk) { if (sk->state != TCP_CLOSE) { SOCKHASH_LOCK(); __tcp_v4_hash(sk); SOCKHASH_UNLOCK(); } } static void tcp_v4_unhash(struct sock *sk) { SOCKHASH_LOCK(); if(sk->pprev) { if(sk->next) sk->next->pprev = sk->pprev; *sk->pprev = sk->next; sk->pprev = NULL; tcp_reg_zap(sk); __tcp_put_port(sk); } SOCKHASH_UNLOCK(); } /* Don't inline this cruft. Here are some nice properties to * exploit here. The BSD API does not allow a listening TCP * to specify the remote port nor the remote address for the * connection. So always assume those are both wildcarded * during the search since they can never be otherwise. */ static struct sock *<API key>(u32 daddr, unsigned short hnum, int dif) { struct sock *sk; struct sock *result = NULL; int score, hiscore; hiscore=0; for(sk = tcp_listening_hash[tcp_lhashfn(hnum)]; sk; sk = sk->next) { if(sk->num == hnum) { __u32 rcv_saddr = sk->rcv_saddr; score = 1; if(rcv_saddr) { if (rcv_saddr != daddr) continue; score++; } if (sk->bound_dev_if) { if (sk->bound_dev_if != dif) continue; score++; } if (score == 3) return sk; if (score > hiscore) { hiscore = score; result = sk; } } } return result; } /* Sockets in TCP_CLOSE state are _always_ taken out of the hash, so * we need not check it for TCP lookups anymore, thanks Alexey. -DaveM * It is assumed that this code only gets called from within NET_BH. */ static inline struct sock *__tcp_v4_lookup(struct tcphdr *th, u32 saddr, u16 sport, u32 daddr, u16 dport, int dif) { TCP_V4_ADDR_COOKIE(acookie, saddr, daddr) __u16 hnum = ntohs(dport); __u32 ports = TCP_COMBINED_PORTS(sport, hnum); struct sock *sk; int hash; /* Check TCP register quick cache first. */ sk = TCP_RHASH(sport); if(sk && TCP_IPV4_MATCH(sk, acookie, saddr, daddr, ports, dif)) goto hit; /* Optimize here for direct hit, only listening connections can * have wildcards anyways. */ hash = tcp_hashfn(daddr, hnum, saddr, sport); for(sk = tcp_ehash[hash]; sk; sk = sk->next) { if(TCP_IPV4_MATCH(sk, acookie, saddr, daddr, ports, dif)) { if (sk->state == TCP_ESTABLISHED) TCP_RHASH(sport) = sk; goto hit; /* You sunk my battleship! */ } } /* Must check for a TIME_WAIT'er before going to listener hash. */ for(sk = tcp_ehash[hash+(tcp_ehash_size/2)]; sk; sk = sk->next) if(TCP_IPV4_MATCH(sk, acookie, saddr, daddr, ports, dif)) goto hit; sk = <API key>(daddr, hnum, dif); hit: return sk; } __inline__ struct sock *tcp_v4_lookup(u32 saddr, u16 sport, u32 daddr, u16 dport, int dif) { return __tcp_v4_lookup(0, saddr, sport, daddr, dport, dif); } #ifdef <API key> /* Cleaned up a little and adapted to new bind bucket scheme. * Oddly, this should increase performance here for * transparent proxy, as tests within the inner loop have * been eliminated. -DaveM */ static struct sock *tcp_v4_proxy_lookup(unsigned short num, unsigned long raddr, unsigned short rnum, unsigned long laddr, struct device *dev, unsigned short pnum, int dif) { struct sock *s, *result = NULL; int badness = -1; u32 paddr = 0; unsigned short hnum = ntohs(num); unsigned short hpnum = ntohs(pnum); int firstpass = 1; if(dev && dev->ip_ptr) { struct in_device *idev = dev->ip_ptr; if(idev->ifa_list) paddr = idev->ifa_list->ifa_local; } /* This code must run only from NET_BH. */ { struct tcp_bind_bucket *tb = tcp_bhash[tcp_bhashfn(hnum)]; for( ; (tb && tb->port != hnum); tb = tb->next) ; if(tb == NULL) goto next; s = tb->owners; } pass2: for(; s; s = s->bind_next) { int score = 0; if(s->rcv_saddr) { if((s->num != hpnum || s->rcv_saddr != paddr) && (s->num != hnum || s->rcv_saddr != laddr)) continue; score++; } if(s->daddr) { if(s->daddr != raddr) continue; score++; } if(s->dport) { if(s->dport != rnum) continue; score++; } if(s->bound_dev_if) { if(s->bound_dev_if != dif) continue; score++; } if(score == 4 && s->num == hnum) { result = s; goto gotit; } else if(score > badness && (s->num == hpnum || s->rcv_saddr)) { result = s; badness = score; } } next: if(firstpass struct tcp_bind_bucket *tb = tcp_bhash[tcp_bhashfn(hpnum)]; for( ; (tb && tb->port != hpnum); tb = tb->next) ; if(tb) { s = tb->owners; goto pass2; } } gotit: return result; } #endif /* <API key> */ static inline __u32 <API key>(struct sock *sk, struct sk_buff *skb) { return <API key>(skb->nh.iph->daddr, skb->nh.iph->saddr, skb->h.th->dest, skb->h.th->source); } /* Check that a TCP address is unique, don't allow multiple * connects to/from the same address. Actually we can optimize * quite a bit, since the socket about to connect is still * in TCP_CLOSE, a tcp_bind_bucket for the local port he will * use will exist, with a NULL owners list. So check for that. * The good_socknum and verify_bind scheme we use makes this * work. */ static int <API key>(struct sock *sk) { struct tcp_bind_bucket *tb; unsigned short snum = sk->num; int retval = 1; /* Freeze the hash while we snoop around. */ SOCKHASH_LOCK(); tb = tcp_bhash[tcp_bhashfn(snum)]; for(; tb; tb = tb->next) { if(tb->port == snum && tb->owners != NULL) { /* Almost certainly the re-use port case, search the real hashes * so it actually scales. */ sk = __tcp_v4_lookup(NULL, sk->daddr, sk->dport, sk->rcv_saddr, htons(snum), sk->bound_dev_if); if((sk != NULL) && (sk->state != TCP_LISTEN)) retval = 0; break; } } SOCKHASH_UNLOCK(); return retval; } /* This will initiate an outgoing connection. */ int tcp_v4_connect(struct sock *sk, struct sockaddr *uaddr, int addr_len) { struct tcp_opt *tp = &(sk->tp_pinfo.af_tcp); struct sockaddr_in *usin = (struct sockaddr_in *) uaddr; struct sk_buff *buff; struct rtable *rt; u32 daddr, nexthop; int tmp; if (sk->state != TCP_CLOSE) return(-EISCONN); /* Don't allow a double connect. */ if (sk->daddr) return -EINVAL; if (addr_len < sizeof(struct sockaddr_in)) return(-EINVAL); if (usin->sin_family != AF_INET) { static int complained; if (usin->sin_family) return(-EAFNOSUPPORT); if (!complained++) printk(KERN_DEBUG "%s forgot to set AF_INET in %s\n", current->comm, __FUNCTION__); } nexthop = daddr = usin->sin_addr.s_addr; if (sk->opt && sk->opt->srr) { if (daddr == 0) return -EINVAL; nexthop = sk->opt->faddr; } tmp = ip_route_connect(&rt, nexthop, sk->saddr, RT_TOS(sk->ip_tos)|RTO_CONN|sk->localroute, sk->bound_dev_if); if (tmp < 0) return tmp; if (rt->rt_flags&(RTCF_MULTICAST|RTCF_BROADCAST)) { ip_rt_put(rt); return -ENETUNREACH; } dst_release(xchg(&sk->dst_cache, &rt->u.dst)); buff = sock_wmalloc(sk, (MAX_HEADER + sk->prot->max_header), 0, GFP_KERNEL); if (buff == NULL) return -ENOBUFS; /* Socket has no identity, so lock_sock() is useless. Also * since state==TCP_CLOSE (checked above) the socket cannot * possibly be in the hashes. TCP hash locking is only * needed while checking quickly for a unique address. * However, the socket does need to be (and is) locked * in tcp_connect(). * Perhaps this addresses all of ANK's concerns. 8-) -DaveM */ sk->dport = usin->sin_port; sk->daddr = rt->rt_dst; if (sk->opt && sk->opt->srr) sk->daddr = daddr; if (!sk->saddr) sk->saddr = rt->rt_src; sk->rcv_saddr = sk->saddr; if (!<API key>(sk)) { kfree_skb(buff); sk->daddr = 0; return -EADDRNOTAVAIL; } tp->write_seq = <API key>(sk->saddr, sk->daddr, sk->sport, usin->sin_port); tp->ext_header_len = 0; if (sk->opt) tp->ext_header_len = sk->opt->optlen; /* Reset mss clamp */ tp->mss_clamp = ~0; if (!ip_dont_fragment(sk, &rt->u.dst) && rt->u.dst.pmtu > 576 && rt->rt_dst != rt->rt_gateway) { /* Clamp mss at maximum of 536 and user_mss. Probably, user ordered to override tiny segment size in gatewayed case. */ tp->mss_clamp = max(tp->user_mss, 536); } tcp_connect(sk, buff, rt->u.dst.pmtu); return 0; } static int tcp_v4_sendmsg(struct sock *sk, struct msghdr *msg, int len) { int retval = -EINVAL; /* Do sanity checking for sendmsg/sendto/send. */ if (msg->msg_flags & ~(MSG_OOB|MSG_DONTROUTE|MSG_DONTWAIT|MSG_NOSIGNAL)) goto out; if (msg->msg_name) { struct sockaddr_in *addr=(struct sockaddr_in *)msg->msg_name; if (msg->msg_namelen < sizeof(*addr)) goto out; if (addr->sin_family && addr->sin_family != AF_INET) goto out; retval = -ENOTCONN; if(sk->state == TCP_CLOSE) goto out; retval = -EISCONN; if (addr->sin_port != sk->dport) goto out; if (addr->sin_addr.s_addr != sk->daddr) goto out; } retval = tcp_do_sendmsg(sk, msg); out: return retval; } /* * Do a linear search in the socket open_request list. * This should be replaced with a global hash table. */ static struct open_request *tcp_v4_search_req(struct tcp_opt *tp, struct iphdr *iph, struct tcphdr *th, struct open_request **prevp) { struct open_request *req, *prev; __u16 rport = th->source; /* assumption: the socket is not in use. * as we checked the user count on tcp_rcv and we're * running from a soft interrupt. */ prev = (struct open_request *) (&tp->syn_wait_queue); for (req = prev->dl_next; req; req = req->dl_next) { if (req->af.v4_req.rmt_addr == iph->saddr && req->af.v4_req.loc_addr == iph->daddr && req->rmt_port == rport #ifdef <API key> && req->lcl_port == th->dest #endif ) { *prevp = prev; return req; } prev = req; } return NULL; } /* * This routine does path mtu discovery as defined in RFC1191. */ static inline void do_pmtu_discovery(struct sock *sk, struct iphdr *ip, unsigned mtu) { struct tcp_opt *tp = &sk->tp_pinfo.af_tcp; if (atomic_read(&sk->sock_readers)) return; /* Don't interested in TCP_LISTEN and open_requests (SYN-ACKs * send out by Linux are always <576bytes so they should go through * unfragmented). */ if (sk->state == TCP_LISTEN) return; /* We don't check in the destentry if pmtu discovery is forbidden * on this route. We just assume that no packet_to_big packets * are send back when pmtu discovery is not active. * There is a small race when the user changes this flag in the * route, but I think that's acceptable. */ if (sk->dst_cache == NULL) return; ip_rt_update_pmtu(sk->dst_cache, mtu); if (sk->ip_pmtudisc != IP_PMTUDISC_DONT && tp->pmtu_cookie > sk->dst_cache->pmtu) { tcp_sync_mss(sk, sk->dst_cache->pmtu); /* Resend the TCP packet because it's * clear that the old packet has been * dropped. This is the new "fast" path mtu * discovery. */ <API key>(sk); } /* else let the usual retransmit timer handle it */ } /* * This routine is called by the ICMP module when it gets some * sort of error condition. If err < 0 then the socket should * be closed and the error returned to the user. If err > 0 * it's just the icmp type << 8 | icmp code. After adjustment * header points to the first 8 bytes of the tcp header. We need * to find the appropriate port. * * The locking strategy used here is very "optimistic". When * someone else accesses the socket the ICMP is just dropped * and for some paths there is no check at all. * A more general error queue to queue errors for later handling * is probably better. * * sk->err and sk->err_soft should be atomic_t. */ void tcp_v4_err(struct sk_buff *skb, unsigned char *dp, int len) { struct iphdr *iph = (struct iphdr*)dp; struct tcphdr *th; struct tcp_opt *tp; int type = skb->h.icmph->type; int code = skb->h.icmph->code; #if ICMP_MIN_LENGTH < 14 int no_flags = 0; #else #define no_flags 0 #endif struct sock *sk; __u32 seq; int err; if (len < (iph->ihl << 2) + ICMP_MIN_LENGTH) { icmp_statistics.IcmpInErrors++; return; } #if ICMP_MIN_LENGTH < 14 if (len < (iph->ihl << 2) + 14) no_flags = 1; #endif th = (struct tcphdr*)(dp+(iph->ihl<<2)); sk = tcp_v4_lookup(iph->daddr, th->dest, iph->saddr, th->source, skb->dev->ifindex); if (sk == NULL || sk->state == TCP_TIME_WAIT) { icmp_statistics.IcmpInErrors++; return; } tp = &sk->tp_pinfo.af_tcp; seq = ntohl(th->seq); if (sk->state != TCP_LISTEN && !between(seq, tp->snd_una, tp->snd_nxt)) { net_statistics.OutOfWindowIcmps++; return; } switch (type) { case ICMP_SOURCE_QUENCH: #ifndef OLD_SOURCE_QUENCH /* This is deprecated */ tp->snd_ssthresh = tcp_recalc_ssthresh(tp); tp->snd_cwnd = tp->snd_ssthresh; tp->snd_cwnd_cnt = 0; tp->high_seq = tp->snd_nxt; #endif return; case ICMP_PARAMETERPROB: err = EPROTO; break; case ICMP_DEST_UNREACH: if (code > NR_ICMP_UNREACH) return; if (code == ICMP_FRAG_NEEDED) { /* PMTU discovery (RFC1191) */ do_pmtu_discovery(sk, iph, ntohs(skb->h.icmph->un.frag.mtu)); return; } err = icmp_err_convert[code].errno; break; case ICMP_TIME_EXCEEDED: err = EHOSTUNREACH; break; default: return; } switch (sk->state) { struct open_request *req, *prev; case TCP_LISTEN: /* Prevent race conditions with accept() - * ICMP is unreliable. */ if (atomic_read(&sk->sock_readers)) { net_statistics.LockDroppedIcmps++; /* If too many ICMPs get dropped on busy * servers this needs to be solved differently. */ return; } /* The final ACK of the handshake should be already * handled in the new socket context, not here. * Strictly speaking - an ICMP error for the final * ACK should set the opening flag, but that is too * complicated right now. */ if (!no_flags && !th->syn && !th->ack) return; req = tcp_v4_search_req(tp, iph, th, &prev); if (!req) return; if (seq != req->snt_isn) { net_statistics.OutOfWindowIcmps++; return; } if (req->sk) { /* * Already in ESTABLISHED and a big socket is created, * set error code there. * The error will _not_ be reported in the accept(), * but only with the next operation on the socket after * accept. */ sk = req->sk; } else { /* * Still in SYN_RECV, just remove it silently. * There is no good way to pass the error to the newly * created socket, and POSIX does not want network * errors returned from accept(). */ tp->syn_backlog tcp_synq_unlink(tp, req, prev); req->class->destructor(req); tcp_openreq_free(req); return; } break; case TCP_SYN_SENT: case TCP_SYN_RECV: /* Cannot happen */ if (!no_flags && !th->syn) return; tcp_statistics.TcpAttemptFails++; sk->err = err; sk->zapped = 1; mb(); sk->error_report(sk); return; } /* If we've already connected we will keep trying * until we time out, or the user gives up. * * rfc1122 4.2.3.9 allows to consider as hard errors * only PROTO_UNREACH and PORT_UNREACH (well, FRAG_FAILED too, * but it is obsoleted by pmtu discovery). * * Note, that in modern internet, where routing is unreliable * and in each dark corner broken firewalls sit, sending random * errors ordered by their masters even this two messages finally lose * their original sense (even Linux sends invalid PORT_UNREACHs) * * Now we are in compliance with RFCs. * --ANK (980905) */ if (sk->ip_recverr) { /* This code isn't serialized with the socket code */ /* ANK (980927) ... which is harmless now, sk->err's may be safely lost. */ sk->err = err; mb(); sk->error_report(sk); /* Wake people up to see the error (see connect in sock.c) */ } else { /* Only an error on timeout */ sk->err_soft = err; mb(); } } /* This routine computes an IPv4 TCP checksum. */ void tcp_v4_send_check(struct sock *sk, struct tcphdr *th, int len, struct sk_buff *skb) { th->check = 0; th->check = tcp_v4_check(th, len, sk->saddr, sk->daddr, csum_partial((char *)th, th->doff<<2, skb->csum)); } /* * This routine will send an RST to the other tcp. * * Someone asks: why I NEVER use socket parameters (TOS, TTL etc.) * for reset. * Answer: if a packet caused RST, it is not for a socket * existing in our system, if it is matched to a socket, * it is just duplicate segment or bug in other side's TCP. * So that we build reply only basing on parameters * arrived with segment. * Exception: precedence violation. We do not implement it in any case. */ static void tcp_v4_send_reset(struct sk_buff *skb) { struct tcphdr *th = skb->h.th; struct tcphdr rth; struct ip_reply_arg arg; /* Never send a reset in response to a reset. */ if (th->rst) return; if (((struct rtable*)skb->dst)->rt_type != RTN_LOCAL) { #ifdef <API key> if (((struct rtable*)skb->dst)->rt_type == RTN_UNICAST) icmp_send(skb, ICMP_DEST_UNREACH, ICMP_PORT_UNREACH, 0); #endif return; } /* Swap the send and the receive. */ memset(&rth, 0, sizeof(struct tcphdr)); rth.dest = th->source; rth.source = th->dest; rth.doff = sizeof(struct tcphdr)/4; rth.rst = 1; if (th->ack) { rth.seq = th->ack_seq; } else { rth.ack = 1; rth.ack_seq = th->syn ? htonl(ntohl(th->seq)+1) : th->seq; } memset(&arg, 0, sizeof arg); arg.iov[0].iov_base = (unsigned char *)&rth; arg.iov[0].iov_len = sizeof rth; arg.csum = csum_tcpudp_nofold(skb->nh.iph->daddr, skb->nh.iph->saddr, /*XXX*/ sizeof(struct tcphdr), IPPROTO_TCP, 0); arg.n_iov = 1; arg.csumoffset = offsetof(struct tcphdr, check) / 2; ip_send_reply(tcp_socket->sk, skb, &arg, sizeof rth); tcp_statistics.TcpOutSegs++; tcp_statistics.TcpOutRsts++; } /* * Send an ACK for a socket less packet (needed for time wait) * * FIXME: Does not echo timestamps yet. * * Assumes that the caller did basic address and flag checks. */ static void tcp_v4_send_ack(struct sk_buff *skb, __u32 seq, __u32 ack, __u16 window) { struct tcphdr *th = skb->h.th; struct tcphdr rth; struct ip_reply_arg arg; /* Swap the send and the receive. */ memset(&rth, 0, sizeof(struct tcphdr)); rth.dest = th->source; rth.source = th->dest; rth.doff = sizeof(struct tcphdr)/4; rth.seq = seq; rth.ack_seq = ack; rth.ack = 1; rth.window = htons(window); memset(&arg, 0, sizeof arg); arg.iov[0].iov_base = (unsigned char *)&rth; arg.iov[0].iov_len = sizeof rth; arg.csum = csum_tcpudp_nofold(skb->nh.iph->daddr, skb->nh.iph->saddr, /*XXX*/ sizeof(struct tcphdr), IPPROTO_TCP, 0); arg.n_iov = 1; arg.csumoffset = offsetof(struct tcphdr, check) / 2; ip_send_reply(tcp_socket->sk, skb, &arg, sizeof rth); tcp_statistics.TcpOutSegs++; } #ifdef <API key> /* Seems, I never wrote nothing more stupid. I hope Gods will forgive me, but I cannot forgive myself 8) --ANK (981001) */ static struct sock *<API key>(struct sk_buff *skb) { struct iphdr *iph = skb->nh.iph; struct tcphdr *th = (struct tcphdr *)(skb->nh.raw + iph->ihl*4); struct sock *sk; int i; for (i=0; i<TCP_LHTABLE_SIZE; i++) { for(sk = tcp_listening_hash[i]; sk; sk = sk->next) { struct open_request *dummy; if (tcp_v4_search_req(&sk->tp_pinfo.af_tcp, iph, th, &dummy) && (!sk->bound_dev_if || sk->bound_dev_if == skb->dev->ifindex)) return sk; } } return NULL; } /* * Check whether a received TCP packet might be for one of our * connections. */ int tcp_chkaddr(struct sk_buff *skb) { struct iphdr *iph = skb->nh.iph; struct tcphdr *th = (struct tcphdr *)(skb->nh.raw + iph->ihl*4); struct sock *sk; sk = tcp_v4_lookup(iph->saddr, th->source, iph->daddr, th->dest, skb->dev->ifindex); if (!sk) return <API key>(skb) != NULL; if (sk->state == TCP_LISTEN) { struct open_request *dummy; if (tcp_v4_search_req(&sk->tp_pinfo.af_tcp, skb->nh.iph, th, &dummy) && (!sk->bound_dev_if || sk->bound_dev_if == skb->dev->ifindex)) return 1; } /* 0 means accept all LOCAL addresses here, not all the world... */ if (sk->rcv_saddr == 0) return 0; return 1; } #endif /* * Send a SYN-ACK after having received an ACK. * This still operates on a open_request only, not on a big * socket. */ static void tcp_v4_send_synack(struct sock *sk, struct open_request *req) { struct rtable *rt; struct ip_options *opt; struct sk_buff * skb; int mss; /* First, grab a route. */ opt = req->af.v4_req.opt; if(ip_route_output(&rt, ((opt && opt->srr) ? opt->faddr : req->af.v4_req.rmt_addr), req->af.v4_req.loc_addr, RT_TOS(sk->ip_tos) | RTO_CONN | sk->localroute, sk->bound_dev_if)) { ip_statistics.IpOutNoRoutes++; return; } if(opt && opt->is_strictroute && rt->rt_dst != rt->rt_gateway) { ip_rt_put(rt); ip_statistics.IpOutNoRoutes++; return; } mss = rt->u.dst.pmtu - sizeof(struct iphdr) - sizeof(struct tcphdr); skb = tcp_make_synack(sk, &rt->u.dst, req, mss); if (skb) { struct tcphdr *th = skb->h.th; #ifdef <API key> th->source = req->lcl_port; /* LVE */ #endif th->check = tcp_v4_check(th, skb->len, req->af.v4_req.loc_addr, req->af.v4_req.rmt_addr, csum_partial((char *)th, skb->len, skb->csum)); <API key>(skb, sk, req->af.v4_req.loc_addr, req->af.v4_req.rmt_addr, req->af.v4_req.opt); } ip_rt_put(rt); } /* * IPv4 open_request destructor. */ static void tcp_v4_or_free(struct open_request *req) { if(!req->sk && req->af.v4_req.opt) kfree_s(req->af.v4_req.opt, optlength(req->af.v4_req.opt)); } static inline void syn_flood_warning(struct sk_buff *skb) { static unsigned long warntime; if (jiffies - warntime > HZ*60) { warntime = jiffies; printk(KERN_INFO "possible SYN flooding on port %d. Sending cookies.\n", ntohs(skb->h.th->dest)); } } /* * Save and compile IPv4 options into the open_request if needed. */ static inline struct ip_options * tcp_v4_save_options(struct sock *sk, struct sk_buff *skb) { struct ip_options *opt = &(IPCB(skb)->opt); struct ip_options *dopt = NULL; if (opt && opt->optlen) { int opt_size = optlength(opt); dopt = kmalloc(opt_size, GFP_ATOMIC); if (dopt) { if (ip_options_echo(dopt, skb)) { kfree_s(dopt, opt_size); dopt = NULL; } } } return dopt; } /* * Maximum number of SYN_RECV sockets in queue per LISTEN socket. * One SYN_RECV socket costs about 80bytes on a 32bit machine. * It would be better to replace it with a global counter for all sockets * but then some measure against one socket starving all other sockets * would be needed. */ int <API key> = 128; struct or_calltable or_ipv4 = { tcp_v4_send_synack, tcp_v4_or_free, tcp_v4_send_reset }; #define BACKLOG(sk) ((sk)->tp_pinfo.af_tcp.syn_backlog) /* lvalue! */ #define BACKLOGMAX(sk) <API key> int tcp_v4_conn_request(struct sock *sk, struct sk_buff *skb, __u32 isn) { struct tcp_opt tp; struct open_request *req; struct tcphdr *th = skb->h.th; __u32 saddr = skb->nh.iph->saddr; __u32 daddr = skb->nh.iph->daddr; #ifdef CONFIG_SYN_COOKIES int want_cookie = 0; #else #define want_cookie 0 /* Argh, why doesn't gcc optimize this :( */ #endif /* If the socket is dead, don't accept the connection. */ if (sk->dead) goto dead; /* Never answer to SYNs send to broadcast or multicast */ if (((struct rtable *)skb->dst)->rt_flags & (RTCF_BROADCAST|RTCF_MULTICAST)) goto drop; /* XXX: Check against a global syn pool counter. */ if (BACKLOG(sk) > BACKLOGMAX(sk)) { #ifdef CONFIG_SYN_COOKIES if (<API key>) { syn_flood_warning(skb); want_cookie = 1; } else #endif goto drop; } else { if (isn == 0) isn = <API key>(sk, skb); BACKLOG(sk)++; } req = tcp_openreq_alloc(); if (req == NULL) { goto dropbacklog; } req->rcv_wnd = 0; /* So that tcp_send_synack() knows! */ req->rcv_isn = TCP_SKB_CB(skb)->seq; tp.tstamp_ok = tp.sack_ok = tp.wscale_ok = tp.snd_wscale = 0; tp.mss_clamp = 65535; tcp_parse_options(NULL, th, &tp, want_cookie); if (tp.mss_clamp == 65535) tp.mss_clamp = 576 - sizeof(struct iphdr) - sizeof(struct iphdr); if (sk->tp_pinfo.af_tcp.user_mss && sk->tp_pinfo.af_tcp.user_mss < tp.mss_clamp) tp.mss_clamp = sk->tp_pinfo.af_tcp.user_mss; req->mss = tp.mss_clamp; if (tp.saw_tstamp) req->ts_recent = tp.rcv_tsval; req->tstamp_ok = tp.tstamp_ok; req->sack_ok = tp.sack_ok; req->snd_wscale = tp.snd_wscale; req->wscale_ok = tp.wscale_ok; req->rmt_port = th->source; #ifdef <API key> req->lcl_port = th->dest ; /* LVE */ #endif req->af.v4_req.loc_addr = daddr; req->af.v4_req.rmt_addr = saddr; /* Note that we ignore the isn passed from the TIME_WAIT * state here. That's the price we pay for cookies. */ if (want_cookie) isn = <API key>(sk, skb, &req->mss); req->snt_isn = isn; req->af.v4_req.opt = tcp_v4_save_options(sk, skb); req->class = &or_ipv4; req->retrans = 0; req->sk = NULL; tcp_v4_send_synack(sk, req); if (want_cookie) { if (req->af.v4_req.opt) kfree(req->af.v4_req.opt); tcp_v4_or_free(req); tcp_openreq_free(req); } else { req->expires = jiffies + TCP_TIMEOUT_INIT; tcp_inc_slow_timer(TCP_SLT_SYNACK); tcp_synq_queue(&sk->tp_pinfo.af_tcp, req); } return 0; dead: SOCK_DEBUG(sk, "Reset on %p: Connect on dead socket.\n",sk); tcp_statistics.TcpAttemptFails++; return -ENOTCONN; /* send reset */ dropbacklog: if (!want_cookie) BACKLOG(sk) drop: tcp_statistics.TcpAttemptFails++; return 0; } /* This is not only more efficient than what we used to do, it eliminates * a lot of code duplication between IPv4/IPv6 SYN recv processing. -DaveM * * This function wants to be moved to a common for IPv[46] file. --ANK */ struct sock *<API key>(struct sock *sk, struct open_request *req, struct sk_buff *skb) { struct sock *newsk = sk_alloc(PF_INET, GFP_ATOMIC, 0); if(newsk != NULL) { struct tcp_opt *newtp; #ifdef CONFIG_FILTER struct sk_filter *filter; #endif memcpy(newsk, sk, sizeof(*newsk)); newsk->sklist_next = NULL; newsk->state = TCP_SYN_RECV; /* Clone the TCP header template */ newsk->dport = req->rmt_port; atomic_set(&newsk->sock_readers, 0); atomic_set(&newsk->rmem_alloc, 0); skb_queue_head_init(&newsk->receive_queue); atomic_set(&newsk->wmem_alloc, 0); skb_queue_head_init(&newsk->write_queue); atomic_set(&newsk->omem_alloc, 0); newsk->done = 0; newsk->proc = 0; skb_queue_head_init(&newsk->back_log); skb_queue_head_init(&newsk->error_queue); #ifdef CONFIG_FILTER if ((filter = newsk->filter) != NULL) sk_filter_charge(newsk, filter); #endif /* Now setup tcp_opt */ newtp = &(newsk->tp_pinfo.af_tcp); newtp->pred_flags = 0; newtp->rcv_nxt = req->rcv_isn + 1; newtp->snd_nxt = req->snt_isn + 1; newtp->snd_una = req->snt_isn + 1; newtp->srtt = 0; newtp->ato = 0; newtp->snd_wl1 = req->rcv_isn; newtp->snd_wl2 = req->snt_isn; /* RFC1323: The window in SYN & SYN/ACK segments * is never scaled. */ newtp->snd_wnd = ntohs(skb->h.th->window); newtp->max_window = newtp->snd_wnd; newtp->pending = 0; newtp->retransmits = 0; newtp->last_ack_sent = req->rcv_isn + 1; newtp->backoff = 0; newtp->mdev = TCP_TIMEOUT_INIT; /* So many TCP implementations out there (incorrectly) count the * initial SYN frame in their delayed-ACK and congestion control * algorithms that we must have the following bandaid to talk * efficiently to them. -DaveM */ newtp->snd_cwnd = 2; newtp->rto = TCP_TIMEOUT_INIT; newtp->packets_out = 0; newtp->fackets_out = 0; newtp->retrans_out = 0; newtp->high_seq = 0; newtp->snd_ssthresh = 0x7fffffff; newtp->snd_cwnd_cnt = 0; newtp->dup_acks = 0; newtp->delayed_acks = 0; init_timer(&newtp->retransmit_timer); newtp->retransmit_timer.function = &<API key>; newtp->retransmit_timer.data = (unsigned long) newsk; init_timer(&newtp->delack_timer); newtp->delack_timer.function = &tcp_delack_timer; newtp->delack_timer.data = (unsigned long) newsk; skb_queue_head_init(&newtp->out_of_order_queue); newtp->send_head = newtp->retrans_head = NULL; newtp->rcv_wup = req->rcv_isn + 1; newtp->write_seq = req->snt_isn + 1; newtp->copied_seq = req->rcv_isn + 1; newtp->saw_tstamp = 0; newtp->mss_clamp = req->mss; init_timer(&newtp->probe_timer); newtp->probe_timer.function = &tcp_probe_timer; newtp->probe_timer.data = (unsigned long) newsk; newtp->probes_out = 0; newtp->syn_seq = req->rcv_isn; newtp->fin_seq = req->rcv_isn; newtp->urg_data = 0; tcp_synq_init(newtp); newtp->syn_backlog = 0; if (skb->len >= 536) newtp->last_seg_size = skb->len; /* Back to base struct sock members. */ newsk->err = 0; newsk->ack_backlog = 0; newsk->max_ack_backlog = SOMAXCONN; newsk->priority = 0; /* IP layer stuff */ newsk->timeout = 0; init_timer(&newsk->timer); newsk->timer.function = &net_timer; newsk->timer.data = (unsigned long) newsk; newsk->socket = NULL; newtp->tstamp_ok = req->tstamp_ok; if((newtp->sack_ok = req->sack_ok) != 0) newtp->num_sacks = 0; newtp->window_clamp = req->window_clamp; newtp->rcv_wnd = req->rcv_wnd; newtp->wscale_ok = req->wscale_ok; if (newtp->wscale_ok) { newtp->snd_wscale = req->snd_wscale; newtp->rcv_wscale = req->rcv_wscale; } else { newtp->snd_wscale = newtp->rcv_wscale = 0; newtp->window_clamp = min(newtp->window_clamp,65535); } if (newtp->tstamp_ok) { newtp->ts_recent = req->ts_recent; newtp->ts_recent_stamp = tcp_time_stamp; newtp->tcp_header_len = sizeof(struct tcphdr) + <API key>; } else { newtp->tcp_header_len = sizeof(struct tcphdr); } } return newsk; } /* * The three way handshake has completed - we got a valid synack - * now create the new socket. */ struct sock * <API key>(struct sock *sk, struct sk_buff *skb, struct open_request *req, struct dst_entry *dst) { struct ip_options *opt = req->af.v4_req.opt; struct tcp_opt *newtp; struct sock *newsk; if (sk->ack_backlog > sk->max_ack_backlog) goto exit; /* head drop */ if (dst == NULL) { struct rtable *rt; if (ip_route_output(&rt, opt && opt->srr ? opt->faddr : req->af.v4_req.rmt_addr, req->af.v4_req.loc_addr, sk->ip_tos|RTO_CONN, 0)) return NULL; dst = &rt->u.dst; } #ifdef <API key> /* The new socket created for transparent proxy may fall * into a non-existed bind bucket because sk->num != newsk->num. * Ensure existance of the bucket now. The placement of the check * later will require to destroy just created newsk in the case of fail. * 1998/04/22 Andrey V. Savochkin <saw@msu.ru> */ if (__tcp_bucket_check(ntohs(skb->h.th->dest))) goto exit; #endif newsk = <API key>(sk, req, skb); if (!newsk) goto exit; sk->tp_pinfo.af_tcp.syn_backlog sk->ack_backlog++; newsk->dst_cache = dst; newtp = &(newsk->tp_pinfo.af_tcp); newsk->daddr = req->af.v4_req.rmt_addr; newsk->saddr = req->af.v4_req.loc_addr; newsk->rcv_saddr = req->af.v4_req.loc_addr; #ifdef <API key> newsk->num = ntohs(skb->h.th->dest); newsk->sport = req->lcl_port; #endif newsk->opt = req->af.v4_req.opt; newtp->ext_header_len = 0; if (newsk->opt) newtp->ext_header_len = newsk->opt->optlen; tcp_sync_mss(newsk, dst->pmtu); newtp->rcv_mss = newtp->mss_clamp; /* It would be better to use newtp->mss_clamp here */ if (newsk->rcvbuf < (3 * newtp->pmtu_cookie)) newsk->rcvbuf = min ((3 * newtp->pmtu_cookie), sysctl_rmem_max); if (newsk->sndbuf < (3 * newtp->pmtu_cookie)) newsk->sndbuf = min ((3 * newtp->pmtu_cookie), sysctl_wmem_max); /* We run in BH processing itself or within a BH atomic * sequence (backlog) so no locking is needed. */ __tcp_v4_hash(newsk); __tcp_inherit_port(sk, newsk); <API key>(newsk); sk->data_ready(sk, 0); /* Deliver SIGIO */ return newsk; exit: dst_release(dst); return NULL; } static void tcp_v4_rst_req(struct sock *sk, struct sk_buff *skb) { struct tcp_opt *tp = &sk->tp_pinfo.af_tcp; struct open_request *req, *prev; req = tcp_v4_search_req(tp,skb->nh.iph, skb->h.th, &prev); if (!req) return; /* Sequence number check required by RFC793 */ if (before(TCP_SKB_CB(skb)->seq, req->rcv_isn) || after(TCP_SKB_CB(skb)->seq, req->rcv_isn+1)) return; tcp_synq_unlink(tp, req, prev); if (req->sk) sk->ack_backlog else tp->syn_backlog req->class->destructor(req); tcp_openreq_free(req); net_statistics.EmbryonicRsts++; } /* Check for embryonic sockets (open_requests) We check packets with * only the SYN bit set against the open_request queue too: This * increases connection latency a bit, but is required to detect * retransmitted SYNs. */ static inline struct sock *tcp_v4_hnd_req(struct sock *sk,struct sk_buff *skb) { struct tcphdr *th = skb->h.th; u32 flg = ((u32 *)th)[3]; /* Check for RST */ if (flg & __constant_htonl(0x00040000)) { tcp_v4_rst_req(sk, skb); return NULL; } /* Check for SYN|ACK */ if (flg & __constant_htonl(0x00120000)) { struct open_request *req, *dummy; struct tcp_opt *tp = &(sk->tp_pinfo.af_tcp); /* Find possible connection requests. */ req = tcp_v4_search_req(tp, skb->nh.iph, th, &dummy); if (req) { sk = tcp_check_req(sk, skb, req); } #ifdef CONFIG_SYN_COOKIES else if ((flg & __constant_htonl(0x00120000))==__constant_htonl(0x00100000)) { sk = cookie_v4_check(sk, skb, &(IPCB(skb)->opt)); } #endif } return sk; } int tcp_v4_do_rcv(struct sock *sk, struct sk_buff *skb) { #ifdef CONFIG_FILTER struct sk_filter *filter = sk->filter; if (filter && sk_filter(skb, filter)) goto discard; #endif /* CONFIG_FILTER */ /* * This doesn't check if the socket has enough room for the packet. * Either process the packet _without_ queueing it and then free it, * or do the check later. */ skb_set_owner_r(skb, sk); if (sk->state == TCP_ESTABLISHED) { /* Fast path */ if (tcp_rcv_established(sk, skb, skb->h.th, skb->len)) goto reset; return 0; } if (sk->state == TCP_LISTEN) { struct sock *nsk; nsk = tcp_v4_hnd_req(sk, skb); if (!nsk) goto discard; /* * Queue it on the new socket if the new socket is active, * otherwise we just shortcircuit this and continue with * the new socket.. */ if (atomic_read(&nsk->sock_readers)) { skb_orphan(skb); __skb_queue_tail(&nsk->back_log, skb); return 0; } sk = nsk; } if (<API key>(sk, skb, skb->h.th, skb->len)) goto reset; return 0; reset: tcp_v4_send_reset(skb); discard: kfree_skb(skb); /* Be careful here. If this function gets more complicated and * gcc suffers from register pressure on the x86, sk (in %ebx) * might be destroyed here. This current version compiles correctly, * but you have been warned. */ return 0; } /* * From tcp_input.c */ int tcp_v4_rcv(struct sk_buff *skb, unsigned short len) { struct tcphdr *th; struct sock *sk; if (skb->pkt_type!=PACKET_HOST) goto discard_it; th = skb->h.th; /* Pull up the IP header. */ __skb_pull(skb, skb->h.raw - skb->data); /* Count it even if it's bad */ tcp_statistics.TcpInSegs++; len = skb->len; if (len < sizeof(struct tcphdr)) goto bad_packet; /* Try to use the device checksum if provided. */ switch (skb->ip_summed) { case CHECKSUM_NONE: skb->csum = csum_partial((char *)th, len, 0); case CHECKSUM_HW: if (tcp_v4_check(th,len,skb->nh.iph->saddr,skb->nh.iph->daddr,skb->csum)) { NETDEBUG(printk(KERN_DEBUG "TCPv4 bad checksum " "from %d.%d.%d.%d:%04x to %d.%d.%d.%d:%04x, " "len=%d/%d/%d\n", NIPQUAD(skb->nh.iph->saddr), ntohs(th->source), NIPQUAD(skb->nh.iph->daddr), ntohs(th->dest), len, skb->len, ntohs(skb->nh.iph->tot_len))); bad_packet: tcp_statistics.TcpInErrs++; goto discard_it; } default: ; /* <API key> */ } if((th->doff * 4) < sizeof(struct tcphdr) || len < (th->doff * 4)) goto bad_packet; #ifdef <API key> if (IPCB(skb)->redirport) sk = tcp_v4_proxy_lookup(th->dest, skb->nh.iph->saddr, th->source, skb->nh.iph->daddr, skb->dev, IPCB(skb)->redirport, skb->dev->ifindex); else { #endif sk = __tcp_v4_lookup(th, skb->nh.iph->saddr, th->source, skb->nh.iph->daddr, th->dest, skb->dev->ifindex); #ifdef <API key> if (!sk) sk = <API key>(skb); } #endif if (!sk) goto no_tcp_socket; if(!ipsec_sk_policy(sk,skb)) goto discard_it; TCP_SKB_CB(skb)->seq = ntohl(th->seq); TCP_SKB_CB(skb)->end_seq = (TCP_SKB_CB(skb)->seq + th->syn + th->fin + len - th->doff*4); TCP_SKB_CB(skb)->ack_seq = ntohl(th->ack_seq); skb->used = 0; if (sk->state == TCP_TIME_WAIT) goto do_time_wait; if (!atomic_read(&sk->sock_readers)) return tcp_v4_do_rcv(sk, skb); __skb_queue_tail(&sk->back_log, skb); return 0; no_tcp_socket: tcp_v4_send_reset(skb); discard_it: /* Discard frame. */ kfree_skb(skb); return 0; do_time_wait: /* Sorry for the ugly switch. 2.3 will have a better solution. */ switch (<API key>((struct tcp_tw_bucket *)sk, skb, th, skb->len)) { case TCP_TW_ACK: tcp_v4_send_ack(skb, ((struct tcp_tw_bucket *)sk)->snd_nxt, ((struct tcp_tw_bucket *)sk)->rcv_nxt, ((struct tcp_tw_bucket *)sk)->window); goto discard_it; case TCP_TW_RST: goto no_tcp_socket; default: goto discard_it; } } static void __tcp_v4_rehash(struct sock *sk) { struct sock **skp = &tcp_ehash[(sk->hashent = tcp_sk_hashfn(sk))]; SOCKHASH_LOCK(); if(sk->pprev) { if(sk->next) sk->next->pprev = sk->pprev; *sk->pprev = sk->next; sk->pprev = NULL; tcp_reg_zap(sk); } if((sk->next = *skp) != NULL) (*skp)->pprev = &sk->next; *skp = sk; sk->pprev = skp; SOCKHASH_UNLOCK(); } int <API key>(struct sock *sk) { struct rtable *rt = (struct rtable *)sk->dst_cache; __u32 new_saddr; int want_rewrite = sysctl_ip_dynaddr && sk->state == TCP_SYN_SENT; if(rt == NULL) return 0; /* Force route checking if want_rewrite. * The idea is good, the implementation is disguisting. * Well, if I made bind on this socket, you cannot randomly ovewrite * its source address. --ANK */ if (want_rewrite) { int tmp; struct rtable *new_rt; __u32 old_saddr = rt->rt_src; /* Query new route using another rt buffer */ tmp = ip_route_connect(&new_rt, rt->rt_dst, 0, RT_TOS(sk->ip_tos)|sk->localroute, sk->bound_dev_if); /* Only useful if different source addrs */ if (tmp == 0) { /* * Only useful if different source addrs */ if (new_rt->rt_src != old_saddr ) { dst_release(sk->dst_cache); sk->dst_cache = &new_rt->u.dst; rt = new_rt; goto do_rewrite; } dst_release(&new_rt->u.dst); } } if (rt->u.dst.obsolete) { int err; err = ip_route_output(&rt, rt->rt_dst, rt->rt_src, rt->key.tos|RTO_CONN, rt->key.oif); if (err) { sk->err_soft=-err; sk->error_report(sk); return -1; } dst_release(xchg(&sk->dst_cache, &rt->u.dst)); } return 0; do_rewrite: new_saddr = rt->rt_src; /* Ouch!, this should not happen. */ if (!sk->saddr || !sk->rcv_saddr) { printk(KERN_WARNING "<API key>(): not valid sock addrs: " "saddr=%08X rcv_saddr=%08X\n", ntohl(sk->saddr), ntohl(sk->rcv_saddr)); return 0; } if (new_saddr != sk->saddr) { if (sysctl_ip_dynaddr > 1) { printk(KERN_INFO "<API key>(): shifting sk->saddr " "from %d.%d.%d.%d to %d.%d.%d.%d\n", NIPQUAD(sk->saddr), NIPQUAD(new_saddr)); } sk->saddr = new_saddr; sk->rcv_saddr = new_saddr; /* XXX The only one ugly spot where we need to * XXX really change the sockets identity after * XXX it has entered the hashes. -DaveM */ __tcp_v4_rehash(sk); } return 0; } static struct sock * tcp_v4_get_sock(struct sk_buff *skb, struct tcphdr *th) { return tcp_v4_lookup(skb->nh.iph->saddr, th->source, skb->nh.iph->daddr, th->dest, skb->dev->ifindex); } static void v4_addr2sockaddr(struct sock *sk, struct sockaddr * uaddr) { struct sockaddr_in *sin = (struct sockaddr_in *) uaddr; sin->sin_family = AF_INET; sin->sin_addr.s_addr = sk->daddr; sin->sin_port = sk->dport; } struct tcp_func ipv4_specific = { ip_queue_xmit, tcp_v4_send_check, <API key>, tcp_v4_conn_request, <API key>, tcp_v4_get_sock, sizeof(struct iphdr), ip_setsockopt, ip_getsockopt, v4_addr2sockaddr, sizeof(struct sockaddr_in) }; /* NOTE: A lot of things set to zero explicitly by call to * sk_alloc() so need not be done here. */ static int tcp_v4_init_sock(struct sock *sk) { struct tcp_opt *tp = &(sk->tp_pinfo.af_tcp); skb_queue_head_init(&tp->out_of_order_queue); <API key>(sk); tp->rto = TCP_TIMEOUT_INIT; /*TCP_WRITE_TIME*/ tp->mdev = TCP_TIMEOUT_INIT; tp->mss_clamp = ~0; /* So many TCP implementations out there (incorrectly) count the * initial SYN frame in their delayed-ACK and congestion control * algorithms that we must have the following bandaid to talk * efficiently to them. -DaveM */ tp->snd_cwnd = 2; /* See <API key> for discussion of the * initialization of these values. */ tp->snd_cwnd_cnt = 0; tp->snd_ssthresh = 0x7fffffff; /* Infinity */ sk->state = TCP_CLOSE; sk->max_ack_backlog = SOMAXCONN; tp->rcv_mss = 536; sk->write_space = tcp_write_space; /* Init SYN queue. */ tcp_synq_init(tp); sk->tp_pinfo.af_tcp.af_specific = &ipv4_specific; return 0; } static int tcp_v4_destroy_sock(struct sock *sk) { struct tcp_opt *tp = &(sk->tp_pinfo.af_tcp); struct sk_buff *skb; <API key>(sk); if (sk->keepopen) tcp_dec_slow_timer(TCP_SLT_KEEPALIVE); /* Cleanup up the write buffer. */ while((skb = __skb_dequeue(&sk->write_queue)) != NULL) kfree_skb(skb); /* Cleans up our, hopefuly empty, out_of_order_queue. */ while((skb = __skb_dequeue(&tp->out_of_order_queue)) != NULL) kfree_skb(skb); /* Clean up a referenced TCP bind bucket, this only happens if a * port is allocated for a socket, but it never fully connects. */ if(sk->prev != NULL) tcp_put_port(sk); return 0; } struct proto tcp_prot = { (struct sock *)&tcp_prot, /* sklist_next */ (struct sock *)&tcp_prot, /* sklist_prev */ tcp_close, /* close */ tcp_v4_connect, /* connect */ tcp_accept, /* accept */ NULL, /* retransmit */ tcp_write_wakeup, /* write_wakeup */ tcp_read_wakeup, /* read_wakeup */ tcp_poll, /* poll */ tcp_ioctl, /* ioctl */ tcp_v4_init_sock, /* init */ tcp_v4_destroy_sock, /* destroy */ tcp_shutdown, /* shutdown */ tcp_setsockopt, /* setsockopt */ tcp_getsockopt, /* getsockopt */ tcp_v4_sendmsg, /* sendmsg */ tcp_recvmsg, /* recvmsg */ NULL, /* bind */ tcp_v4_do_rcv, /* backlog_rcv */ tcp_v4_hash, /* hash */ tcp_v4_unhash, /* unhash */ tcp_v4_get_port, /* get_port */ 128, /* max_header */ 0, /* retransmits */ "TCP", /* name */ 0, /* inuse */ 0 /* highestinuse */ }; __initfunc(void tcp_v4_init(struct net_proto_family *ops)) { int err; tcp_inode.i_mode = S_IFSOCK; tcp_inode.i_sock = 1; tcp_inode.i_uid = 0; tcp_inode.i_gid = 0; tcp_socket->inode = &tcp_inode; tcp_socket->state = SS_UNCONNECTED; tcp_socket->type=SOCK_RAW; if ((err=ops->create(tcp_socket, IPPROTO_TCP))<0) panic("Failed to create the TCP control socket.\n"); tcp_socket->sk->allocation=GFP_ATOMIC; tcp_socket->sk->num = 256; /* Don't receive any data */ tcp_socket->sk->ip_ttl = MAXTTL; }
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http: <html lang="en" xml:lang="en"> <head> <title>Error - Uverse.com</title> <link rel="stylesheet" type="text/css" href="http://uverseonline.att.net/web_files/NEXTGEN/web_files/css/screen.css" /> </head> <body> <div id="error"> <div class="content"> <h3>Error</h3> <p class="info">An error has occurred</p> <p>We apologize for the inconvenience. We are experiencing difficulty processing your request. Please try again in a few minutes. If the problem persists, please visit our <a href="http://uverseonline.att.net/faq">FAQ page</a> for further troubleshooting.</p> </div> </div> </body> </html>
<?php // Direct access security if (!defined('<API key>')){ die(); } if (!isset($fieldtype)){ $fieldtype="tmcp-field"; } if (isset($textbeforeprice) && $textbeforeprice!=''){ $textbeforeprice = '<span class="before-amount'.(!empty($hide_amount)?" ".$hide_amount:"").'">'.$textbeforeprice.'</span>'; } if (isset($textafterprice) && $textafterprice!=''){ $textafterprice = '<span class="after-amount'.(!empty($hide_amount)?" ".$hide_amount:"").'">'.$textafterprice.'</span>'; } if (!empty($class)){ $fieldtype .=" ".$class; } if (!isset($default_value)){ $default_value=""; } ?> <li class="tmcp-field-wrap"> <?php include('_quantity_start.php'); ?> <label for="<?php echo $id; ?>"></label> <textarea<?php if (isset($placeholder)){ echo ' placeholder="'.$placeholder.'"'; } if (isset($min_chars) && $min_chars!=''){ echo ' minlength="'.$min_chars.'"'; } if (isset($max_chars) && $max_chars!=''){ echo ' maxlength="'.$max_chars.'"'; } ?> class="<?php echo $fieldtype;?> tm-epo-field tmcp-textarea" name="<?php echo $name; ?>" data-price="" data-rules="<?php echo $rules; ?>" data-rulestype="<?php echo $rules_type; ?>" id="<?php echo $id; ?>" tabindex="<?php echo $tabindex; ?>" rows="5" cols="20"><?php if(isset($_POST[$name])){ echo stripslashes($_POST[$name]); }elseif (isset($_GET[$name])){ echo esc_attr(stripslashes($_GET[$name])); }else{ echo $default_value; } ?></textarea> <?php include('_price.php'); ?> <?php include('_quantity_end.php'); ?> <?php do_action( 'tm_after_element' , isset($tm_element_settings)?$tm_element_settings:array() ); ?> </li>
/** * \defgroup clock Clock interface * * The clock interface is the interface between the \ref timer "timer library" * and the platform specific clock functionality. The clock * interface must be implemented for each platform that uses the \ref * timer "timer library". * * The clock interface does only one this: it measures time. The clock * interface provides a macro, CLOCK_SECOND, which corresponds to one * second of system time. * * \sa \ref timer "Timer library" * * @{ */ #ifndef __CLOCK_H__ #define __CLOCK_H__ #include "clock-arch.h" /** * Initialize the clock library. * * This function initializes the clock library and should be called * from the main() function of the system. * */ void clock_init(void); /** * Get the current clock time. * * This function returns the current system clock time. * * \return The current clock time, measured in system ticks. */ clock_time_t clock_time(void); /** * A second, measured in system clock time. * * \hideinitializer */ #ifdef CLOCK_CONF_SECOND #define CLOCK_SECOND CLOCK_CONF_SECOND #else #define CLOCK_SECOND (clock_time_t)10 #endif #endif /* __CLOCK_H__ */
<?php namespace BroadworksOCIP\api\<API key>\OCISchemaUser; use BroadworksOCIP\api\<API key>\OCISchemaDataTypes\<API key>; use BroadworksOCIP\api\<API key>\OCISchemaDataTypes\FileResource; use BroadworksOCIP\api\<API key>\OCISchemaDataTypes\AccessDevice; use BroadworksOCIP\api\<API key>\OCISchemaDataTypes\UserId; use BroadworksOCIP\Builder\Types\ComplexInterface; use BroadworksOCIP\Builder\Types\ComplexType; use BroadworksOCIP\Response\ResponseOutput; use BroadworksOCIP\Client\Client; /** * Request to modify a user modifiable access device file. * The response is either a SuccessResponse or an ErrorResponse. */ class <API key> extends ComplexType implements ComplexInterface { public $elementName = '<API key>'; protected $userId; protected $accessDevice; protected $fileFormat; protected $uploadFile; public function __construct( $userId = '', $accessDevice = '', $fileFormat = '', $uploadFile = '' ) { $this->setUserId($userId); $this->setAccessDevice($accessDevice); $this->setFileFormat($fileFormat); $this->setUploadFile($uploadFile); } /** * @return mixed $response */ public function get(Client $client, $responseOutput = ResponseOutput::STD) { return $this->send($client, $responseOutput); } public function setUserId($userId = null) { $this->userId = ($userId InstanceOf UserId) ? $userId : new UserId($userId); $this->userId->setElementName('userId'); return $this; } /** * * @return UserId $userId */ public function getUserId() { return ($this->userId) ? $this->userId->getElementValue() : null; } public function setAccessDevice(AccessDevice $accessDevice = null) { $this->accessDevice = ($accessDevice InstanceOf AccessDevice) ? $accessDevice : new AccessDevice($accessDevice); $this->accessDevice->setElementName('accessDevice'); return $this; } /** * * @return AccessDevice $accessDevice */ public function getAccessDevice() { return $this->accessDevice; } public function setFileFormat($fileFormat = null) { $this->fileFormat = ($fileFormat InstanceOf <API key>) ? $fileFormat : new <API key>($fileFormat); $this->fileFormat->setElementName('fileFormat'); return $this; } /** * * @return <API key> $fileFormat */ public function getFileFormat() { return ($this->fileFormat) ? $this->fileFormat->getElementValue() : null; } public function setUploadFile(FileResource $uploadFile = null) { $this->uploadFile = ($uploadFile InstanceOf FileResource) ? $uploadFile : new FileResource($uploadFile); $this->uploadFile->setElementName('uploadFile'); return $this; } /** * * @return FileResource $uploadFile */ public function getUploadFile() { return $this->uploadFile; } }
<html> <head> <title>libao - function - ao_file_extension</title> <link rel=stylesheet href="style.css" type="text/css"> </head> <body bgcolor=white text=black link="#5555ff" alink="#5555ff" vlink="#5555ff"> <table border=0 width=100%> <tr> <td><p class=tiny>libao documentation</p></td> <td align=right><p class=tiny>libao version 1.1.0 - 20110221</p></td> </tr> </table> <h1>ao_file_extension</h1> <p><i>declared in "ao/ao.h";</i></p> <p>Returns the normal file extension associated with a particular driver (like "wav" or "au"). This is just an information function to allow library users to guess appropriate file names. You can safely ignore the recommended extension.</p> <br><br> <table border=0 color=black cellspacing=0 cellpadding=7> <tr bgcolor=#cccccc> <td> <pre><b> const char* ao_file_extension(int driver_id); </b></pre> </td> </tr> </table> <h3>Parameters</h3> <dl> <dt><i>driver_id</i></dt> <dd>The ID number of the driver as returned by either <a href="ao_driver_id.html">ao_driver_id()</a> or <a href="<API key>.html"><API key>()</a>.</dd> </dl> <h3>Return Values</h3> <blockquote> <li>pointer to string containing suggested file extension.</li> <li>NULL if this driver has no file extension associated with it or if this driver does not exist.</li> </blockquote> <p> <br><br> <hr noshade> <table border=0 width=100%> <tr valign=top> <td><p class=tiny>copyright &copy; 2001-2003 Stan Seibert, 2010-2011 Monty, 2011 Philipp Schafft</p></td> <td align=right><p class=tiny><a href="http: </tr><tr> <td><p class=tiny>libao documentation</p></td> <td align=right><p class=tiny>libao version 1.1.0 - 20111222</p></td> </tr> </table> </body> </html>
(function($) { "use strict"; // Important note! If you're adding CSS3 transition to slides, fadeInLoadedSlide should be disabled to avoid fade-conflicts. jQuery(document).ready(function($) { var si = $('#gallery-1').royalSlider({ addActiveClass: true, arrowsNav: false, controlNavigation: 'none', autoScaleSlider: true, <API key>: 960, <API key>: 340, loop: true, fadeinLoadedSlide: false, globalCaption: true, keyboardNavEnabled: true, globalCaptionInside: false, visibleNearby: { enabled: true, centerArea: 0.5, center: true, breakpoint: 650, <API key>: 0.64, <API key>: true } }).data('royalSlider'); // link to fifth slide from slider description. $('.slide4link').click(function(e) { si.goTo(4); return false; }); // create slide $('#simple-vertical').royalSlider({ arrowsNav: true, arrowsNavAutoHide: false, fadeinLoadedSlide: true, controlNavigation: 'none', imageScaleMode: 'fill', imageAlignCenter:true, loop: false, loopRewind: false, numImagesToPreload: 4, slidesOrientation: 'vertical', keyboardNavEnabled: true, video: { autoHideArrows:true, autoHideControlNav:true }, autoScaleSlider: true, <API key>: 1090, <API key>: 668, imgWidth: 1090, imgHeight: 668 }); }); if($('#testimonials').length){ // Randomise $('.testimonial-nav').each(function(){ var container = $(this), children = container.children('li'); children.sort(function(a,b){ var temp = parseInt( Math.random()*8 ); var isOddOrEven = temp%2; var isPosOrNeg = temp>5 ? 1 : -1; return( isOddOrEven*isPosOrNeg ); }) .appendTo(container); }); $('#testimonials .testimonial:eq(8),#testimonials .testimonial-nav a:eq(8)').addClass('active'); $('#testimonials .testimonial-nav a').hover(function(){ $('#testimonials .testimonial-nav a,#testimonials .testimonial').removeClass('active'); $(this).addClass('active'); $($(this).attr('href')).addClass('active'); }); $('#testimonials .testimonial-nav a').click(function(){ return false; }); } })(jQuery);
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http: <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <title> GnuDIP Release 2.3 - Credits </title> <base target="_blank"> </head> <body bgcolor=white> <table><tr valign=middle><td> <img align=middle src="gnudip/html/gnudip.jpg" alt="GnuDIP Logo" border=0 height=60 width=113> </td><td> <h1>GnuDIP Release 2.3 - Credits</h1> </table> <hr> <p> Release 2.3 of GnuDIP was written by <u><b>Creighton MacDonnell</b></u>. <p> This software is derived from GnuDIP Release 2.1.2, which was the work of <u><b>Mike Machado</b></u>. <p><hr> </body> </html>
/** @file spriteloader.hpp Base for loading sprites. */ #ifndef SPRITELOADER_HPP #define SPRITELOADER_HPP #include "../core/alloc_type.hpp" #include "../gfx_type.h" class SpriteLoader { public: struct CommonPixel { uint8 r; ///< Red-channel uint8 g; ///< Green-channel uint8 b; ///< Blue-channel uint8 a; ///< Alpha-channel uint8 m; ///< Remap-channel }; /** * Structure for passing information from the sprite loader to the blitter. * You can only use this struct once at a time when using AllocateData to * allocate the memory as that will always return the same memory address. * This to prevent thousands of malloc + frees just to load a sprite. */ struct Sprite { uint16 height; ///< Height of the sprite uint16 width; ///< Width of the sprite int16 x_offs; ///< The x-offset of where the sprite will be drawn int16 y_offs; ///< The y-offset of where the sprite will be drawn SpriteLoader::CommonPixel *data; ///< The sprite itself /** * Allocate the sprite data of this sprite. * @param size the minimum size of the data field. */ void AllocateData(size_t size) { this->data = Sprite::buffer.ZeroAllocate(size); } private: /** Allocated memory to pass sprite data around */ static ReusableBuffer<SpriteLoader::CommonPixel> buffer; }; /** * Load a sprite from the disk and return a sprite struct which is the same for all loaders. */ virtual bool LoadSprite(SpriteLoader::Sprite *sprite, uint8 file_slot, size_t file_pos, SpriteType sprite_type) = 0; virtual ~SpriteLoader() { } }; #endif /* SPRITELOADER_HPP */
#include "CClientProxy1_2.h" #include "CProtocolUtil.h" #include "CLog.h" // CClientProxy1_1 CClientProxy1_2::CClientProxy1_2(const CString& name, IStream* stream) : CClientProxy1_1(name, stream) { // do nothing } CClientProxy1_2::~CClientProxy1_2() { // do nothing } void CClientProxy1_2::mouseRelativeMove(SInt32 xRel, SInt32 yRel) { LOG((CLOG_DEBUG2 "send mouse relative move to \"%s\" %d,%d", getName().c_str(), xRel, yRel)); CProtocolUtil::writef(getStream(), kMsgDMouseRelMove, xRel, yRel); }
#ifndef <API key> #define <API key> #include <boost/shared_ptr.hpp> #include <boost/shared_array.hpp> #include <boost/<API key>.hpp> #include <time.h> #include <glibmm/threads.h> #include <boost/function.hpp> #include <boost/scoped_array.hpp> #include "ardour/source.h" #include "ardour/ardour.h" #include "ardour/readable.h" #include "pbd/stateful.h" #include "pbd/xml++.h" namespace ARDOUR { class LIBARDOUR_API AudioSource : virtual public Source, public ARDOUR::Readable, public boost::<API key><ARDOUR::AudioSource> { public: AudioSource (Session&, std::string name); AudioSource (Session&, const XMLNode&); virtual ~AudioSource (); framecnt_t readable_length() const { return _length; } virtual uint32_t n_channels() const { return 1; } virtual bool empty() const; framecnt_t length (framepos_t pos) const; void update_length (framecnt_t cnt); virtual framecnt_t available_peaks (double zoom) const; virtual framecnt_t read (Sample *dst, framepos_t start, framecnt_t cnt, int channel=0) const; virtual framecnt_t write (Sample *src, framecnt_t cnt); virtual float sample_rate () const = 0; virtual void <API key> (const Lock& lock); virtual bool can_truncate_peaks() const { return true; } void set_captured_for (std::string str) { _captured_for = str; } std::string captured_for() const { return _captured_for; } int read_peaks (PeakData *peaks, framecnt_t npeaks, framepos_t start, framecnt_t cnt, double <API key>) const; int build_peaks (); bool peaks_ready (boost::function<void()> callWhenReady, PBD::ScopedConnection** <API key>, PBD::EventLoop* event_loop) const; mutable PBD::Signal0<void> PeaksReady; mutable PBD::Signal2<void,framepos_t,framepos_t> PeakRangeReady; XMLNode& get_state (); int set_state (const XMLNode&, int version); int rename_peakfile (std::string newpath); void touch_peakfile (); static void <API key> (bool yn) { <API key> = yn; } static void set_build_peakfiles (bool yn) { _build_peakfiles = yn; } static bool get_build_peakfiles () { return _build_peakfiles; } virtual int setup_peakfile () { return 0; } int <API key> (); void <API key> (bool done = true); /** @return true if the each source sample s must be clamped to -1 < s < 1 */ virtual bool clamped_at_unity () const = 0; static void <API key> (framecnt_t framerate); protected: static bool <API key>; static bool _build_peakfiles; static size_t <API key>; /* these collections of working buffers for supporting playlist's reading from potentially nested/recursive sources assume SINGLE THREADED reads by the butler thread, or a lock around calls that use them. */ static std::vector<boost::shared_array<Sample> > _mixdown_buffers; static std::vector<boost::shared_array<gain_t> > _gain_buffers; static Glib::Threads::Mutex _level_buffer_lock; static void <API key> (uint32_t, framecnt_t); static void <API key> (uint32_t, framecnt_t); framecnt_t _length; std::string peakpath; std::string _captured_for; int initialize_peakfile (std::string path); int <API key> (); int <API key> (Sample* buf, framecnt_t first_frame, framecnt_t cnt, bool force, bool <API key>); void truncate_peakfile(); mutable off_t _peak_byte_max; // modified in <API key>() virtual framecnt_t read_unlocked (Sample *dst, framepos_t start, framecnt_t cnt) const = 0; virtual framecnt_t write_unlocked (Sample *dst, framecnt_t cnt) = 0; virtual std::string peak_path(std::string audio_path) = 0; virtual std::string <API key> (std::string /* missing_peak_path */, std::string audio_path) { return peak_path (audio_path); } virtual int read_peaks_with_fpp (PeakData *peaks, framecnt_t npeaks, framepos_t start, framecnt_t cnt, double <API key>, framecnt_t fpp) const; int <API key> (Sample* buf, framecnt_t first_frame, framecnt_t cnt, bool force, bool <API key>, framecnt_t frames_per_peak); private: bool _peaks_built; /** This mutex is used to protect both the _peaks_built * variable and also the emission (and handling) of the * PeaksReady signal. Holding the lock when emitting * PeaksReady means that _peaks_built cannot be changed * during the handling of the signal. */ mutable Glib::Threads::Mutex _peaks_ready_lock; int _peakfile_fd; framecnt_t peak_leftover_cnt; framecnt_t peak_leftover_size; Sample* peak_leftovers; framepos_t peak_leftover_frame; mutable bool _first_run; mutable double _last_scale; mutable off_t _last_map_off; mutable size_t <API key>; mutable boost::scoped_array<PeakData> peak_cache; }; } #endif /* <API key> */
/** * @file * Handles the current state of WML-events. This includes raising and firing, * as well as tracking the context for event firing. */ #include "../global.hpp" #include "pump.hpp" #include "conditional_wml.hpp" #include "handlers.hpp" #include "manager.hpp" #include "../<API key>.hpp" #include "../game_config.hpp" #include "../game_display.hpp" #include "../game_data.hpp" #include "../gettext.hpp" #include "../log.hpp" #include "../play_controller.hpp" #include "../scripting/game_lua_kernel.hpp" #include "../side_filter.hpp" #include "../unit.hpp" #include "../unit_map.hpp" #include "../whiteboard/manager.hpp" #include "../variable.hpp" #include "../resources.hpp" #include <boost/foreach.hpp> #include <iomanip> #include <iostream> static lg::log_domain log_engine("engine"); #define DBG_NG LOG_STREAM(debug, log_engine) #define LOG_NG LOG_STREAM(info, log_engine) #define ERR_NG LOG_STREAM(err, log_engine) static lg::log_domain log_wml("wml"); #define DBG_WML LOG_STREAM(debug, log_wml) #define LOG_WML LOG_STREAM(info, log_wml) #define WRN_WML LOG_STREAM(warn, log_wml) #define ERR_WML LOG_STREAM(err, log_wml) static lg::log_domain log_event_handler("event_handler"); #define DBG_EH LOG_STREAM(debug, log_event_handler) // std::getline might be broken in Visual Studio so show a warning #ifdef _MSC_VER #if _MSC_VER < 1300 #ifndef GETLINE_PATCHED #pragma message("warning: the std::getline implementation in your compiler might be broken.") #pragma message(" http://support.microsoft.com/default.aspx?scid=kb;EN-US;q240015") #endif #endif #endif // This file is in the game_events namespace. namespace game_events { namespace context { State when processing a particular flight of events or commands. struct state { bool mutated; bool skip_messages; explicit state(bool s, bool m = true) : mutated(m), skip_messages(s) {} }; class scoped { public: scoped(std::stack<context::state> & contexts, bool m = true); ~scoped(); private: std::stack<context::state> & contexts_; }; } struct pump_impl { std::vector<queued_event> events_queue; The value returned by wml_tracking(); size_t <API key>; std::stringstream wml_messages_stream; std::stack<context::state> contexts_; unsigned instance_count; manager * my_manager; pump_impl(manager & man) : events_queue() , <API key>(0) , wml_messages_stream() , contexts_() , instance_count(0) , my_manager(&man) { contexts_.push(context::state(false)); } }; namespace { // Types class pump_manager { public: pump_manager(pump_impl & ); ~pump_manager(); Allows iteration through the queued events. queued_event & next() { return queue_[pumped_count_++]; } Indicates the iteration is over. bool done() const { return pumped_count_ >= queue_.size(); } unsigned count() { return impl_.instance_count; } private: pump_impl & impl_; int x1_, x2_, y1_, y2_; Tracks the events to process. This isolates these events from any events that might be generated during the processing. std::vector<queued_event> queue_; Tracks how many events have been processed. size_t pumped_count_; }; } // end anonymous namespace (types) namespace { // Support functions pump_manager::pump_manager(pump_impl & impl) : impl_(impl), x1_(resources::gamedata->get_variable("x1")), x2_(resources::gamedata->get_variable("x2")), y1_(resources::gamedata->get_variable("y1")), y2_(resources::gamedata->get_variable("y2")), queue_(), // Filled later with a swap(). pumped_count_(0) { queue_.swap(impl_.events_queue); ++impl_.instance_count; } pump_manager::~pump_manager() { --impl_.instance_count; // Not sure what the correct thing to do is here. In princple, // discarding all events (i.e. clearing events_queue) seems like // the right thing to do in the face of an exception. However, the // previous functionality preserved the queue, so for now we will // restore it. if ( !done() ) { // The remainig events get inserted at the beginning of events_queue. std::vector<queued_event> temp; impl_.events_queue.swap(temp); impl_.events_queue.insert(impl_.events_queue.end(), queue_.begin() + pumped_count_, queue_.end()); impl_.events_queue.insert(impl_.events_queue.end(), temp.begin(), temp.end()); } // Restore the old values of the game variables. resources::gamedata->get_variable("y2") = y2_; resources::gamedata->get_variable("y1") = y1_; resources::gamedata->get_variable("x2") = x2_; resources::gamedata->get_variable("x1") = x1_; } } /** * Returns true iff the given event passes all its filters. */ bool t_pump::filter_event(const event_handler& handler, const queued_event& ev) { const unit_map *units = resources::units; unit_map::const_iterator unit1 = units->find(ev.loc1); unit_map::const_iterator unit2 = units->find(ev.loc2); vconfig filters(handler.get_config()); BOOST_FOREACH(const vconfig &condition, filters.get_children("filter_condition")) { if (!conditional_passed(condition)) { return false; } } BOOST_FOREACH(const vconfig &f, filters.get_children("filter_side")) { side_filter ssf(f, &resources::controller->gamestate()); if ( !ssf.match(resources::controller->current_side()) ) return false; } BOOST_FOREACH(const vconfig &f, filters.get_children("filter")) { if ( !ev.loc1.matches_unit_filter(unit1, f) ) { return false; } } vconfig::child_list special_filters = filters.get_children("filter_attack"); bool special_matches = special_filters.empty(); if ( !special_matches && unit1 != units->end() ) { const bool matches_unit = ev.loc1.matches_unit(unit1); const config & attack = ev.data.child("first"); BOOST_FOREACH(const vconfig &f, special_filters) { if ( f.empty() ) special_matches = true; else if ( !matches_unit ) return false; special_matches = special_matches || <API key>(attack, f); } } if(!special_matches) { return false; } BOOST_FOREACH(const vconfig &f, filters.get_children("filter_second")) { if ( !ev.loc2.matches_unit_filter(unit2, f) ) { return false; } } special_filters = filters.get_children("<API key>"); special_matches = special_filters.empty(); if ( !special_matches && unit2 != units->end() ) { const bool matches_unit = ev.loc2.matches_unit(unit2); const config & attack = ev.data.child("second"); BOOST_FOREACH(const vconfig &f, special_filters) { if ( f.empty() ) special_matches = true; else if ( !matches_unit ) return false; special_matches = special_matches || <API key>(attack, f); } } if(!special_matches) { return false; } // All filters passed. return true; } /** * Processes an event through a single event handler. * This includes checking event filters, but not checking that the event * name matches. * * @param[in,out] handler_p The handler to offer the event to. * This may be reset during processing. * @param[in] ev The event information. * * @returns true if the game state changed. */ bool t_pump::process_event(handler_ptr& handler_p, const queued_event& ev) { // We currently never pass a null pointer to this function, but to // guard against future modifications: if ( !handler_p ) return false; unit_map *units = resources::units; scoped_xy_unit first_unit("unit", ev.loc1.x, ev.loc1.y, *units); scoped_xy_unit second_unit("second_unit", ev.loc2.x, ev.loc2.y, *units); scoped_weapon_info first_weapon("weapon", ev.data.child("first")); scoped_weapon_info second_weapon("second_weapon", ev.data.child("second")); if ( !filter_event(*handler_p, ev) ) return false; // The event hasn't been filtered out, so execute the handler. ++impl_-><API key>; context::scoped evc(impl_->contexts_); assert(resources::lua_kernel != NULL); handler_p->handle_event(ev, handler_p, *resources::lua_kernel); // NOTE: handler_p may be null at this point! if(ev.name == "select") { resources::gamedata->last_selected = ev.loc1; } if(resources::screen != NULL) { resources::screen->maybe_rebuild(); } return context_mutated(); } /** * Helper function for show_wml_messages(), which gathers * the messages from a stringstream. */ void t_pump::<API key>(std::map<std::string, int>& msg_map, std::stringstream& source) { while(true) { std::string msg; std::getline(source, msg); if(source.eof()) { break; } if(msg == "") { continue; } if(msg_map.find(msg) == msg_map.end()) { msg_map[msg] = 1; } else { msg_map[msg]++; } } // Make sure the eof flag is cleared otherwise no new messages are shown source.clear(); } /** * Shows a summary of messages/errors generated so far by WML. * Identical messages are shown once, with (between parentheses) * the number of times that message was encountered. * The order in which the messages are shown does not need * to be the order in which these messages are encountered. * Messages are also written to std::cerr if to_cerr is true. */ void t_pump::show_wml_messages(std::stringstream& source, const std::string & caption, bool to_cerr) { // Get all unique messages in messages, // with the number of encounters for these messages std::map<std::string, int> messages; <API key>(messages, source); // Show the messages collected for(std::map<std::string, int>::const_iterator itor = messages.begin(); itor != messages.end(); ++itor ) { std::stringstream msg; msg << itor->first; if(itor->second > 1) { msg << " (" << itor->second << ")"; } resources::screen->get_chat_manager().add_chat_message(time(NULL), caption, 0, msg.str(), events::chat_handler::MESSAGE_PUBLIC, false); if ( to_cerr ) std::cerr << caption << ": " << msg.str() << '\n'; } } /** * Shows a summary of the errors encountered in WML so far, * to avoid a lot of the same messages to be shown. * Identical messages are shown once, with (between parentheses) * the number of times that message was encountered. * The order in which the messages are shown does not need * to be the order in which these messages are encountered. * Messages are always written to std::cerr. */ void t_pump::show_wml_errors() { static const std::string caption("Invalid WML found"); show_wml_messages(lg::wml_error, caption, true); } /** * Shows a summary of the messages generated so far by WML. * Identical messages are shown once, with (between parentheses) * the number of times that message was encountered. * The order in which the messages are shown does not need * to be the order in which these messages are encountered. */ void t_pump::show_wml_messages() { static const std::string caption("WML"); show_wml_messages(impl_->wml_messages_stream, caption, false); } void t_pump::put_wml_message(lg::logger& logger, const std::string& prefix, const std::string& message, bool in_chat) { logger(log_wml) << message << std::endl; if (in_chat) { impl_->wml_messages_stream << prefix << message << std::endl; } } context::scoped::scoped(std::stack<context::state> & contexts, bool m) : contexts_(contexts) { //The default context at least should always be on the stack assert(contexts_.size() > 0); bool skip_messages = (contexts_.size() > 1) && contexts_.top().skip_messages; contexts_.push(context::state(skip_messages, m)); } context::scoped::~scoped() { assert(contexts_.size() > 1); bool mutated = contexts_.top().mutated; contexts_.pop(); contexts_.top().mutated |= mutated; } bool t_pump::context_mutated() { assert(impl_->contexts_.size() > 0); return impl_->contexts_.top().mutated; } void t_pump::context_mutated(bool b) { assert(impl_->contexts_.size() > 0); impl_->contexts_.top().mutated = b; } bool t_pump::<API key>() { assert(impl_->contexts_.size() > 0); return impl_->contexts_.top().skip_messages; } void t_pump::<API key>(bool b) { assert(impl_->contexts_.size() > 0); impl_->contexts_.top().skip_messages = b; } /** * Helper function which determines whether a wml_message text can * really be pushed into the wml_messages_stream, and does it. */ void t_pump::put_wml_message(const std::string& logger, const std::string& message, bool in_chat) { if (logger == "err" || logger == "error") { put_wml_message(lg::err, _("Error: "), message, in_chat ); } else if (logger == "warn" || logger == "wrn" || logger == "warning") { put_wml_message(lg::warn, _("Warning: "), message, in_chat ); } else if ((logger == "debug" || logger == "dbg") && !lg::debug.dont_log(log_wml)) { put_wml_message(lg::debug, _("Debug: "), message, in_chat ); } else if (!lg::info.dont_log(log_wml)) { put_wml_message(lg::info, _("Info: "), message, in_chat ); } } bool t_pump::fire(const std::string& event, const entity_location& loc1, const entity_location& loc2, const config& data) { raise(event,loc1,loc2,data); return (*this)(); } void t_pump::raise(const std::string& event, const entity_location& loc1, const entity_location& loc2, const config& data) { if(resources::screen == NULL) return; DBG_EH << "raising event: " << event << "\n"; impl_->events_queue.push_back(queued_event(event, loc1, loc2, data)); } bool t_pump::operator()() { // Quick aborts: if(resources::screen == NULL) return false; assert(resources::lua_kernel != NULL); if ( impl_->events_queue.empty() ) { DBG_EH << "Processing queued events, but none found.\n"; return false; } if(impl_->instance_count >= game_config::max_loop) { ERR_NG << "game_events pump waiting to process new events because " << "recursion level would exceed maximum: " << game_config::max_loop << '\n'; return false; } if(!lg::debug.dont_log("event_handler")) { std::stringstream ss; BOOST_FOREACH(const queued_event& ev, impl_->events_queue) { ss << "name=" << ev.name << "; "; } DBG_EH << "processing queued events: " << ss.str() << "\n"; } const size_t old_wml_track = impl_-><API key>; // Ensure the whiteboard doesn't attempt to build its future unit map // while events are being processed. wb::real_map real_unit_map; pump_manager pump_instance(*impl_); context::scoped evc(impl_->contexts_, false); // Loop through the events we need to process. while ( !pump_instance.done() ) { queued_event & ev = pump_instance.next(); const std::string& event_name = ev.name; // Clear the unit cache, since the best clearing time is hard to figure out // due to status changes by WML. Every event will flush the cache. unit::clear_status_caches(); { // Block for context::scoped context::scoped evc(impl_->contexts_, false); if ( resources::lua_kernel->run_event(ev) ) { ++impl_-><API key>; } } // Initialize an iteration over event handlers matching this event. assert(impl_->my_manager); manager::iteration handler_iter(event_name, *impl_->my_manager); // If there are any matching event handlers, initialize variables. // Note: Initializing variables all the time would not be // functionally wrong, merely inefficient. So we do not have // to cache *handler_iter here. if ( *handler_iter ) { resources::gamedata->get_variable("x1") = ev.loc1.filter_x() + 1; resources::gamedata->get_variable("y1") = ev.loc1.filter_y() + 1; resources::gamedata->get_variable("x2") = ev.loc2.filter_x() + 1; resources::gamedata->get_variable("y2") = ev.loc2.filter_y() + 1; } // While there is a potential handler for this event name. while ( handler_ptr cur_handler = *handler_iter ) { DBG_EH << "processing event " << event_name << " with id="<< cur_handler->get_config()["id"] << "\n"; // Let this handler process our event. process_event(cur_handler, ev); // NOTE: cur_handler may be null at this point! ++handler_iter; } // Flush messages when finished iterating over event_handlers. flush_messages(); } if ( old_wml_track != impl_-><API key> ) // Notify the whiteboard of any event. // This is used to track when moves, recruits, etc. happen. resources::whiteboard->on_gamestate_change(); return context_mutated(); } void t_pump::flush_messages() { // Dialogs can only be shown if the display is not locked if (resources::screen && !resources::screen->video().update_locked()) { show_wml_errors(); show_wml_messages(); } } /** * This function can be used to detect when no WML/Lua has been executed. * * If two calls to this function return the same value, then one can * assume that the usual game mechanics have been followed, and code does * not have to account for all the things WML/Lua can do. If the return * values are different, then something unusual might have happened between * those calls. * * This is not intended as a precise metric. Rather, it is motivated by * how large the number of fired WML events is, compared to the (typical) * number of WML event handlers. It is intended for code that can benefit * from caching some aspect of the game state and that cannot rely on * [allow_undo] not being used when that state changes. */ size_t t_pump::wml_tracking() { return impl_-><API key>; } t_pump::t_pump(manager & man) : impl_(new pump_impl(man)) {} t_pump::~t_pump() {} } // end namespace game_events
<?php defined('_JEXEC') or die; jimport('joomla.application.component.modellist'); /** * Methods supporting a list of Confmgt records. */ class <API key> extends JModelList { /** * Constructor. * * @param array An optional associative array of configuration settings. * @see JController * @since 1.6 */ public function __construct($config = array()) { if (empty($config['filter_fields'])) { $config['filter_fields'] = array( ); } parent::__construct($config); } /** * Method to auto-populate the model state. * * Note. Calling getState in this method will result in recursion. */ protected function populateState($ordering = null, $direction = null) { // Initialise variables. $app = JFactory::getApplication('administrator'); // Load the filter state. $search = $app-><API key>($this->context . '.filter.search', 'filter_search'); $this->setState('filter.search', $search); $published = $app-><API key>($this->context . '.filter.state', 'filter_published', '', 'string'); $this->setState('filter.state', $published); // Load the parameters. $params = JComponentHelper::getParams('com_confmgt'); $this->setState('params', $params); // List state information. parent::populateState('a.id', 'asc'); } /** * Method to get a store id based on model configuration state. * * This is necessary because the model is used by the component and * different modules that might need different sets of data or different * ordering requirements. * * @param string $id A prefix for the store id. * @return string A store id. * @since 1.6 */ protected function getStoreId($id = '') { // Compile the store id. $id.= ':' . $this->getState('filter.search'); $id.= ':' . $this->getState('filter.state'); return parent::getStoreId($id); } /** * Build an SQL query to load the list data. * * @return JDatabaseQuery * @since 1.6 */ protected function getListQuery() { $db = $this->getDbo(); $query = $db->getQuery(true); return $query; } public function getItems() { $items = parent::getItems(); foreach ($items as $oneItem) { if (isset($oneItem->full_review_outcome)) { $values = explode(',', $oneItem->full_review_outcome); $textValue = array(); foreach ($values as $value){ $db = JFactory::getDbo(); $query = "select name, value from #<API key> WHERE value LIKE '" . $value . "'"; $db->setQuery($query); $results = $db->loadObject(); if ($results) { $textValue[] = $results->name; } } $oneItem->full_review_outcome = !empty($textValue) ? implode(', ', $textValue) : $oneItem->full_review_outcome; } if (isset($oneItem-><API key>)) { $values = explode(',', $oneItem-><API key>); $textValue = array(); foreach ($values as $value){ $db = JFactory::getDbo(); $query = "SELECT value, name FROM #<API key> WHERE name LIKE '" . $value . "'"; $db->setQuery($query); $results = $db->loadObject(); if ($results) { $textValue[] = $results->value; } } $oneItem-><API key> = !empty($textValue) ? implode(', ', $textValue) : $oneItem-><API key>; } } return $items; } }
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt #include <linux/kernel.h> #include <linux/module.h> #include <linux/platform_device.h> #include <linux/errno.h> #include <linux/io.h> #include <linux/interrupt.h> #include <linux/list.h> #include <linux/spinlock.h> #include <linux/slab.h> #include <linux/iommu.h> #include <linux/clk.h> #include <linux/err.h> #include <linux/of_iommu.h> #include <asm/cacheflush.h> #include <asm/sizes.h> #include "msm_iommu_hw-8xxx.h" #include "msm_iommu.h" #define MRC(reg, processor, op1, crn, crm, op2) \ __asm__ __volatile__ ( \ " mrc " #processor "," #op1 ", %0," #crn "," #crm "," #op2 "\n" \ : "=r" (reg)) /* bitmap of the page sizes currently supported */ #define MSM_IOMMU_PGSIZES (SZ_4K | SZ_64K | SZ_1M | SZ_16M) #define DUMMY_CONTEXT 1 DEFINE_SPINLOCK(msm_iommu_lock); static LIST_HEAD(qcom_iommu_devices); struct msm_priv { unsigned long *pgtable; struct list_head list_attached; struct iommu_domain domain; }; struct device *msm_iommu_get_ctx(const char *ctx_name) { return (struct device *) DUMMY_CONTEXT; } EXPORT_SYMBOL(msm_iommu_get_ctx); static struct msm_priv *to_msm_priv(struct iommu_domain *dom) { return container_of(dom, struct msm_priv, domain); } static int __enable_clocks(struct msm_iommu_dev *iommu) { int ret; ret = clk_enable(iommu->pclk); if (ret) goto fail; if (iommu->clk) { ret = clk_enable(iommu->clk); if (ret) clk_disable(iommu->pclk); } fail: return ret; } static void __disable_clocks(struct msm_iommu_dev *iommu) { if (iommu->clk) clk_disable(iommu->clk); clk_disable(iommu->pclk); } static void msm_iommu_reset(void __iomem *base, int ncb) { int ctx; SET_RPUE(base, 0); SET_RPUEIE(base, 0); SET_ESRRESTORE(base, 0); SET_TBE(base, 0); SET_CR(base, 0); SET_SPDMBE(base, 0); SET_TESTBUSCR(base, 0); SET_TLBRSW(base, 0); SET_GLOBAL_TLBIALL(base, 0); SET_RPU_ACR(base, 0); SET_TLBLKCRWE(base, 1); for (ctx = 0; ctx < ncb; ctx++) { SET_BPRCOSH(base, ctx, 0); SET_BPRCISH(base, ctx, 0); SET_BPRCNSH(base, ctx, 0); SET_BPSHCFG(base, ctx, 0); SET_BPMTCFG(base, ctx, 0); SET_ACTLR(base, ctx, 0); SET_SCTLR(base, ctx, 0); SET_FSRRESTORE(base, ctx, 0); SET_TTBR0(base, ctx, 0); SET_TTBR1(base, ctx, 0); SET_TTBCR(base, ctx, 0); SET_BFBCR(base, ctx, 0); SET_PAR(base, ctx, 0); SET_FAR(base, ctx, 0); SET_CTX_TLBIALL(base, ctx, 0); SET_TLBFLPTER(base, ctx, 0); SET_TLBSLPTER(base, ctx, 0); SET_TLBLKCR(base, ctx, 0); SET_CONTEXTIDR(base, ctx, 0); } } static int __flush_iotlb(struct iommu_domain *domain) { struct msm_priv *priv = to_msm_priv(domain); struct msm_iommu_dev *iommu = NULL; struct msm_iommu_ctx_dev *master; int ret = 0; #ifndef <API key> unsigned long *fl_table = priv->pgtable; int i; if (!list_empty(&priv->list_attached)) { dmac_flush_range(fl_table, fl_table + SZ_16K); for (i = 0; i < NUM_FL_PTE; i++) if ((fl_table[i] & 0x03) == FL_TYPE_TABLE) { void *sl_table = __va(fl_table[i] & FL_BASE_MASK); dmac_flush_range(sl_table, sl_table + SZ_4K); } } #endif list_for_each_entry(iommu, &priv->list_attached, dom_node) { ret = __enable_clocks(iommu); if (ret) goto fail; list_for_each_entry(master, &iommu->ctx_list, list) SET_CTX_TLBIALL(iommu->base, master->num, 0); __disable_clocks(iommu); } fail: return ret; } static int msm_iommu_alloc_ctx(unsigned long *map, int start, int end) { int idx; do { idx = find_next_zero_bit(map, end, start); if (idx == end) return -ENOSPC; } while (test_and_set_bit(idx, map)); return idx; } static void msm_iommu_free_ctx(unsigned long *map, int idx) { clear_bit(idx, map); } static void config_mids(struct msm_iommu_dev *iommu, struct msm_iommu_ctx_dev *master) { int mid, ctx, i; for (i = 0; i < master->num_mids; i++) { mid = master->mids[i]; ctx = master->num; SET_M2VCBR_N(iommu->base, mid, 0); SET_CBACR_N(iommu->base, ctx, 0); /* Set VMID = 0 */ SET_VMID(iommu->base, mid, 0); /* Set the context number for that MID to this context */ SET_CBNDX(iommu->base, mid, ctx); /* Set MID associated with this context bank to 0*/ SET_CBVMID(iommu->base, ctx, 0); /* Set the ASID for TLB tagging for this context */ SET_CONTEXTIDR_ASID(iommu->base, ctx, ctx); /* Set security bit override to be Non-secure */ SET_NSCFG(iommu->base, mid, 3); } } static void __reset_context(void __iomem *base, int ctx) { SET_BPRCOSH(base, ctx, 0); SET_BPRCISH(base, ctx, 0); SET_BPRCNSH(base, ctx, 0); SET_BPSHCFG(base, ctx, 0); SET_BPMTCFG(base, ctx, 0); SET_ACTLR(base, ctx, 0); SET_SCTLR(base, ctx, 0); SET_FSRRESTORE(base, ctx, 0); SET_TTBR0(base, ctx, 0); SET_TTBR1(base, ctx, 0); SET_TTBCR(base, ctx, 0); SET_BFBCR(base, ctx, 0); SET_PAR(base, ctx, 0); SET_FAR(base, ctx, 0); SET_CTX_TLBIALL(base, ctx, 0); SET_TLBFLPTER(base, ctx, 0); SET_TLBSLPTER(base, ctx, 0); SET_TLBLKCR(base, ctx, 0); } static void __program_context(void __iomem *base, int ctx, phys_addr_t pgtable) { __reset_context(base, ctx); /* Set up HTW mode */ /* TLB miss configuration: perform HTW on miss */ SET_TLBMCFG(base, ctx, 0x3); /* V2P configuration: HTW for access */ SET_V2PCFG(base, ctx, 0x3); SET_TTBCR(base, ctx, 0); SET_TTBR0_PA(base, ctx, (pgtable >> 14)); /* Invalidate the TLB for this context */ SET_CTX_TLBIALL(base, ctx, 0); /* Set interrupt number to "secure" interrupt */ SET_IRPTNDX(base, ctx, 0); /* Enable context fault interrupt */ SET_CFEIE(base, ctx, 1); /* Stall access on a context fault and let the handler deal with it */ SET_CFCFG(base, ctx, 1); /* Redirect all cacheable requests to L2 slave port. */ SET_RCISH(base, ctx, 1); SET_RCOSH(base, ctx, 1); SET_RCNSH(base, ctx, 1); /* Turn on BFB prefetch */ SET_BFBDFE(base, ctx, 1); #ifdef <API key> /* Configure page tables as inner-cacheable and shareable to reduce * the TLB miss penalty. */ SET_TTBR0_SH(base, ctx, 1); SET_TTBR1_SH(base, ctx, 1); SET_TTBR0_NOS(base, ctx, 1); SET_TTBR1_NOS(base, ctx, 1); SET_TTBR0_IRGNH(base, ctx, 0); /* WB, WA */ SET_TTBR0_IRGNL(base, ctx, 1); SET_TTBR1_IRGNH(base, ctx, 0); /* WB, WA */ SET_TTBR1_IRGNL(base, ctx, 1); SET_TTBR0_ORGN(base, ctx, 1); /* WB, WA */ SET_TTBR1_ORGN(base, ctx, 1); /* WB, WA */ #endif /* Enable the MMU */ SET_M(base, ctx, 1); } static struct iommu_domain *<API key>(unsigned type) { struct msm_priv *priv; if (type != <API key>) return NULL; priv = kzalloc(sizeof(*priv), GFP_KERNEL); if (!priv) goto fail_nomem; INIT_LIST_HEAD(&priv->list_attached); priv->pgtable = (unsigned long *)__get_free_pages(GFP_KERNEL, get_order(SZ_16K)); if (!priv->pgtable) goto fail_nomem; memset(priv->pgtable, 0, SZ_16K); priv->domain.geometry.aperture_start = 0; priv->domain.geometry.aperture_end = (1ULL << 32) - 1; priv->domain.geometry.force_aperture = true; return &priv->domain; fail_nomem: kfree(priv); return NULL; } static void <API key>(struct iommu_domain *domain) { struct msm_priv *priv; unsigned long flags; unsigned long *fl_table; int i; spin_lock_irqsave(&msm_iommu_lock, flags); priv = to_msm_priv(domain); fl_table = priv->pgtable; for (i = 0; i < NUM_FL_PTE; i++) if ((fl_table[i] & 0x03) == FL_TYPE_TABLE) free_page((unsigned long) __va(((fl_table[i]) & FL_BASE_MASK))); free_pages((unsigned long)priv->pgtable, get_order(SZ_16K)); priv->pgtable = NULL; kfree(priv); <API key>(&msm_iommu_lock, flags); } static int <API key>(struct iommu_domain *domain, struct device *dev) { int ret = 0; unsigned long flags; struct msm_iommu_dev *iommu; struct msm_priv *priv = to_msm_priv(domain); struct msm_iommu_ctx_dev *master; spin_lock_irqsave(&msm_iommu_lock, flags); list_for_each_entry(iommu, &qcom_iommu_devices, dev_node) { master = list_first_entry(&iommu->ctx_list, struct msm_iommu_ctx_dev, list); if (master->of_node == dev->of_node) { ret = __enable_clocks(iommu); if (ret) goto fail; list_for_each_entry(master, &iommu->ctx_list, list) { if (master->num) { dev_err(dev, "domain already attached"); ret = -EEXIST; goto fail; } master->num = msm_iommu_alloc_ctx(iommu->context_map, 0, iommu->ncb); if (IS_ERR_VALUE(master->num)) { ret = -ENODEV; goto fail; } config_mids(iommu, master); __program_context(iommu->base, master->num, __pa(priv->pgtable)); } __disable_clocks(iommu); list_add(&iommu->dom_node, &priv->list_attached); } } ret = __flush_iotlb(domain); fail: <API key>(&msm_iommu_lock, flags); return ret; } static void <API key>(struct iommu_domain *domain, struct device *dev) { struct msm_priv *priv = to_msm_priv(domain); unsigned long flags; struct msm_iommu_dev *iommu; struct msm_iommu_ctx_dev *master; int ret; spin_lock_irqsave(&msm_iommu_lock, flags); ret = __flush_iotlb(domain); if (ret) goto fail; list_for_each_entry(iommu, &priv->list_attached, dom_node) { ret = __enable_clocks(iommu); if (ret) goto fail; list_for_each_entry(master, &iommu->ctx_list, list) { msm_iommu_free_ctx(iommu->context_map, master->num); __reset_context(iommu->base, master->num); } __disable_clocks(iommu); } fail: <API key>(&msm_iommu_lock, flags); } static int msm_iommu_map(struct iommu_domain *domain, unsigned long va, phys_addr_t pa, size_t len, int prot) { struct msm_priv *priv; unsigned long flags; unsigned long *fl_table; unsigned long *fl_pte; unsigned long fl_offset; unsigned long *sl_table; unsigned long *sl_pte; unsigned long sl_offset; unsigned int pgprot; int ret = 0, tex = 0, sh; spin_lock_irqsave(&msm_iommu_lock, flags); sh = (prot & MSM_IOMMU_ATTR_SH) ? 1 : 0; if (prot & IOMMU_CACHE) tex = FL_BUFFERABLE | FL_CACHEABLE; if (tex < 0 || tex > NUM_TEX_CLASS - 1) { ret = -EINVAL; goto fail; } priv = to_msm_priv(domain); fl_table = priv->pgtable; if (len != SZ_16M && len != SZ_1M && len != SZ_64K && len != SZ_4K) { pr_debug("Bad size: %d\n", len); ret = -EINVAL; goto fail; } if (!fl_table) { pr_debug("Null page table\n"); ret = -EINVAL; goto fail; } if (len == SZ_16M || len == SZ_1M) { pgprot = sh ? FL_SHARED : 0; pgprot |= tex & 0x01 ? FL_BUFFERABLE : 0; pgprot |= tex & 0x02 ? FL_CACHEABLE : 0; pgprot |= tex & 0x04 ? FL_TEX0 : 0; } else { pgprot = sh ? SL_SHARED : 0; pgprot |= tex & 0x01 ? SL_BUFFERABLE : 0; pgprot |= tex & 0x02 ? SL_CACHEABLE : 0; pgprot |= tex & 0x04 ? SL_TEX0 : 0; } fl_offset = FL_OFFSET(va); /* Upper 12 bits */ fl_pte = fl_table + fl_offset; /* int pointers, 4 bytes */ if (len == SZ_16M) { int i = 0; for (i = 0; i < 16; i++) *(fl_pte+i) = (pa & 0xFF000000) | FL_SUPERSECTION | FL_AP1 | FL_AP0 | FL_TYPE_SECT | FL_SHARED | FL_NG | pgprot; } if (len == SZ_1M) *fl_pte = (pa & 0xFFF00000) | FL_AP1 | FL_AP0 | FL_NG | FL_TYPE_SECT | FL_SHARED | pgprot; /* Need a 2nd level table */ if ((len == SZ_4K || len == SZ_64K) && (*fl_pte) == 0) { unsigned long *sl; sl = (unsigned long *) __get_free_pages(GFP_ATOMIC, get_order(SZ_4K)); if (!sl) { pr_debug("Could not allocate second level table\n"); ret = -ENOMEM; goto fail; } memset(sl, 0, SZ_4K); *fl_pte = ((((int)__pa(sl)) & FL_BASE_MASK) | FL_TYPE_TABLE); } sl_table = (unsigned long *) __va(((*fl_pte) & FL_BASE_MASK)); sl_offset = SL_OFFSET(va); sl_pte = sl_table + sl_offset; if (len == SZ_4K) *sl_pte = (pa & SL_BASE_MASK_SMALL) | SL_AP0 | SL_AP1 | SL_NG | SL_SHARED | SL_TYPE_SMALL | pgprot; if (len == SZ_64K) { int i; for (i = 0; i < 16; i++) *(sl_pte+i) = (pa & SL_BASE_MASK_LARGE) | SL_AP0 | SL_NG | SL_AP1 | SL_SHARED | SL_TYPE_LARGE | pgprot; } ret = __flush_iotlb(domain); fail: <API key>(&msm_iommu_lock, flags); return ret; } static size_t msm_iommu_unmap(struct iommu_domain *domain, unsigned long va, size_t len) { struct msm_priv *priv; unsigned long flags; unsigned long *fl_table; unsigned long *fl_pte; unsigned long fl_offset; unsigned long *sl_table; unsigned long *sl_pte; unsigned long sl_offset; int i, ret = 0; spin_lock_irqsave(&msm_iommu_lock, flags); priv = to_msm_priv(domain); fl_table = priv->pgtable; if (len != SZ_16M && len != SZ_1M && len != SZ_64K && len != SZ_4K) { pr_debug("Bad length: %d\n", len); goto fail; } if (!fl_table) { pr_debug("Null page table\n"); goto fail; } fl_offset = FL_OFFSET(va); /* Upper 12 bits */ fl_pte = fl_table + fl_offset; /* int pointers, 4 bytes */ if (*fl_pte == 0) { pr_debug("First level PTE is 0\n"); goto fail; } /* Unmap supersection */ if (len == SZ_16M) for (i = 0; i < 16; i++) *(fl_pte+i) = 0; if (len == SZ_1M) *fl_pte = 0; sl_table = (unsigned long *) __va(((*fl_pte) & FL_BASE_MASK)); sl_offset = SL_OFFSET(va); sl_pte = sl_table + sl_offset; if (len == SZ_64K) { for (i = 0; i < 16; i++) *(sl_pte+i) = 0; } if (len == SZ_4K) *sl_pte = 0; if (len == SZ_4K || len == SZ_64K) { int used = 0; for (i = 0; i < NUM_SL_PTE; i++) if (sl_table[i]) used = 1; if (!used) { free_page((unsigned long)sl_table); *fl_pte = 0; } } ret = __flush_iotlb(domain); fail: <API key>(&msm_iommu_lock, flags); /* the IOMMU API requires us to return how many bytes were unmapped */ len = ret ? 0 : len; return len; } static phys_addr_t <API key>(struct iommu_domain *domain, dma_addr_t va) { struct msm_priv *priv; struct msm_iommu_dev *iommu; struct msm_iommu_ctx_dev *master; unsigned int par; unsigned long flags; phys_addr_t ret = 0; spin_lock_irqsave(&msm_iommu_lock, flags); priv = to_msm_priv(domain); iommu = list_first_entry(&priv->list_attached, struct msm_iommu_dev, dom_node); if (list_empty(&iommu->ctx_list)) goto fail; master = list_first_entry(&iommu->ctx_list, struct msm_iommu_ctx_dev, list); if (!master) goto fail; ret = __enable_clocks(iommu); if (ret) goto fail; /* Invalidate context TLB */ SET_CTX_TLBIALL(iommu->base, master->num, 0); SET_V2PPR(iommu->base, master->num, va & V2Pxx_VA); par = GET_PAR(iommu->base, master->num); /* We are dealing with a supersection */ if (GET_NOFAULT_SS(iommu->base, master->num)) ret = (par & 0xFF000000) | (va & 0x00FFFFFF); else /* Upper 20 bits from PAR, lower 12 from VA */ ret = (par & 0xFFFFF000) | (va & 0x00000FFF); if (GET_FAULT(iommu->base, master->num)) ret = 0; __disable_clocks(iommu); fail: <API key>(&msm_iommu_lock, flags); return ret; } static bool msm_iommu_capable(enum iommu_cap cap) { return false; } static void print_ctx_regs(void __iomem *base, int ctx) { unsigned int fsr = GET_FSR(base, ctx); pr_err("FAR = %08x PAR = %08x\n", GET_FAR(base, ctx), GET_PAR(base, ctx)); pr_err("FSR = %08x [%s%s%s%s%s%s%s%s%s%s]\n", fsr, (fsr & 0x02) ? "TF " : "", (fsr & 0x04) ? "AFF " : "", (fsr & 0x08) ? "APF " : "", (fsr & 0x10) ? "TLBMF " : "", (fsr & 0x20) ? "HTWDEEF " : "", (fsr & 0x40) ? "HTWSEEF " : "", (fsr & 0x80) ? "MHF " : "", (fsr & 0x10000) ? "SL " : "", (fsr & 0x40000000) ? "SS " : "", (fsr & 0x80000000) ? "MULTI " : ""); pr_err("FSYNR0 = %08x FSYNR1 = %08x\n", GET_FSYNR0(base, ctx), GET_FSYNR1(base, ctx)); pr_err("TTBR0 = %08x TTBR1 = %08x\n", GET_TTBR0(base, ctx), GET_TTBR1(base, ctx)); pr_err("SCTLR = %08x ACTLR = %08x\n", GET_SCTLR(base, ctx), GET_ACTLR(base, ctx)); } static void insert_iommu_master(struct device *dev, struct msm_iommu_dev *iommu, struct of_phandle_args *spec) { struct msm_iommu_ctx_dev *master; int sid; master = kzalloc(sizeof(*master), GFP_KERNEL); master->of_node = dev->of_node; list_add(&master->list, &iommu->ctx_list); for (sid = 0; sid < spec->args_count; sid++) master->mids[sid] = spec->args[sid]; master->num_mids = spec->args_count; } static int qcom_iommu_of_xlate(struct device *dev, struct of_phandle_args *spec) { struct msm_iommu_dev *iommu; unsigned long flags; spin_lock_irqsave(&msm_iommu_lock, flags); list_for_each_entry(iommu, &qcom_iommu_devices, dev_node) { if (iommu->dev->of_node == spec->np) break; } if (!iommu || (iommu->dev->of_node != spec->np)) return -ENODEV; insert_iommu_master(dev, iommu, spec); <API key>(&msm_iommu_lock, flags); return 0; } irqreturn_t <API key>(int irq, void *dev_id) { struct msm_iommu_dev *iommu = dev_id; unsigned int fsr; int i, ret; spin_lock(&msm_iommu_lock); if (!iommu) { pr_err("Invalid device ID in context interrupt handler\n"); goto fail; } pr_err("Unexpected IOMMU page fault!\n"); pr_err("base = %08x\n", (unsigned int)iommu->base); ret = __enable_clocks(iommu); if (ret) goto fail; for (i = 0; i < iommu->ncb; i++) { fsr = GET_FSR(iommu->base, i); if (fsr) { pr_err("Fault occurred in context %d.\n", i); pr_err("Interesting registers:\n"); print_ctx_regs(iommu->base, i); SET_FSR(iommu->base, i, 0x4000000F); } } __disable_clocks(iommu); fail: spin_unlock(&msm_iommu_lock); return 0; } static struct iommu_ops msm_iommu_ops = { .capable = msm_iommu_capable, .domain_alloc = <API key>, .domain_free = <API key>, .attach_dev = <API key>, .detach_dev = <API key>, .map = msm_iommu_map, .unmap = msm_iommu_unmap, .map_sg = <API key>, .iova_to_phys = <API key>, .pgsize_bitmap = MSM_IOMMU_PGSIZES, .of_xlate = qcom_iommu_of_xlate, }; static int msm_iommu_probe(struct platform_device *pdev) { struct resource *r; struct msm_iommu_dev *iommu; int ret, par, val; iommu = devm_kzalloc(&pdev->dev, sizeof(*iommu), GFP_KERNEL); if (!iommu) return -ENODEV; iommu->dev = &pdev->dev; INIT_LIST_HEAD(&iommu->ctx_list); iommu->pclk = devm_clk_get(iommu->dev, "smmu_pclk"); if (IS_ERR(iommu->pclk)) { dev_err(iommu->dev, "could not get smmu_pclk\n"); return PTR_ERR(iommu->pclk); } ret = clk_prepare(iommu->pclk); if (ret) { dev_err(iommu->dev, "could not prepare smmu_pclk\n"); return ret; } iommu->clk = devm_clk_get(iommu->dev, "iommu_clk"); if (IS_ERR(iommu->clk)) { dev_err(iommu->dev, "could not get iommu_clk\n"); clk_unprepare(iommu->pclk); return PTR_ERR(iommu->clk); } ret = clk_prepare(iommu->clk); if (ret) { dev_err(iommu->dev, "could not prepare iommu_clk\n"); clk_unprepare(iommu->pclk); return ret; } r = <API key>(pdev, IORESOURCE_MEM, 0); iommu->base = <API key>(iommu->dev, r); if (IS_ERR(iommu->base)) { dev_err(iommu->dev, "could not get iommu base\n"); ret = PTR_ERR(iommu->base); goto fail; } iommu->irq = platform_get_irq(pdev, 0); if (iommu->irq < 0) { dev_err(iommu->dev, "could not get iommu irq\n"); ret = -ENODEV; goto fail; } ret = <API key>(iommu->dev->of_node, "ncb", &val); if (ret) { dev_err(iommu->dev, "could not get ncb\n"); goto fail; } iommu->ncb = val; msm_iommu_reset(iommu->base, iommu->ncb); SET_M(iommu->base, 0, 1); SET_PAR(iommu->base, 0, 0); SET_V2PCFG(iommu->base, 0, 1); SET_V2PPR(iommu->base, 0, 0); par = GET_PAR(iommu->base, 0); SET_V2PCFG(iommu->base, 0, 0); SET_M(iommu->base, 0, 0); if (!par) { pr_err("Invalid PAR value detected\n"); ret = -ENODEV; goto fail; } ret = <API key>(iommu->dev, iommu->irq, NULL, <API key>, IRQF_ONESHOT | IRQF_SHARED, "<API key>", iommu); if (ret) { pr_err("Request IRQ %d failed with ret=%d\n", iommu->irq, ret); goto fail; } list_add(&iommu->dev_node, &qcom_iommu_devices); of_iommu_set_ops(pdev->dev.of_node, &msm_iommu_ops); <API key>(pdev, iommu); pr_info("device mapped at %p, irq %d with %d ctx banks\n", iommu->base, iommu->irq, iommu->ncb); return 0; fail: clk_unprepare(iommu->clk); clk_unprepare(iommu->pclk); return ret; } static const struct of_device_id msm_iommu_dt_match[] = { { .compatible = "qcom,iommu-v0"}, {} }; static int msm_iommu_remove(struct platform_device *pdev) { struct msm_iommu_dev *iommu = <API key>(pdev); clk_unprepare(iommu->clk); clk_unprepare(iommu->pclk); return 0; } static struct platform_driver msm_iommu_driver = { .driver = { .name = "msm_iommu", .of_match_table = msm_iommu_dt_match, }, .probe = msm_iommu_probe, .remove = msm_iommu_remove, }; static int __init <API key>(void) { int ret; ret = <API key>(&msm_iommu_driver); if (ret != 0) pr_err("Failed to register IOMMU driver\n"); return ret; } static void __exit <API key>(void) { <API key>(&msm_iommu_driver); } subsys_initcall(<API key>); module_exit(<API key>); static int __init msm_iommu_init(void) { bus_set_iommu(&platform_bus_type, &msm_iommu_ops); return 0; } static int __init msm_iommu_of_setup(struct device_node *np) { msm_iommu_init(); return 0; } IOMMU_OF_DECLARE(msm_iommu_of, "qcom,iommu-v0", msm_iommu_of_setup); MODULE_LICENSE("GPL v2"); MODULE_AUTHOR("Stepan Moskovchenko <stepanm@codeaurora.org>");
/** * \file * \brief Log C interface. */ #pragma once /** * \defgroup api_l4re_c_log Log interface * \ingroup api_l4re_c * \brief Log C interface. */ #include <l4/re/env.h> EXTERN_C_BEGIN /** * \ingroup api_l4re_c_log * \brief Write a null terminated string to the default log. * * \param string Text to print, null terminated. * * \return 0 for success, <0 on error * * \see L4Re::Log::print */ L4_CV L4_INLINE void l4re_log_print(char const *string) L4_NOTHROW; /** * \ingroup api_l4re_c_log * \brief Write a string of a given length to the default log. * * \param string Text to print, null terminated. * \param len Length of string in bytes. * * \return 0 for success, <0 on error * * \see L4Re::Log::printn */ L4_CV L4_INLINE void l4re_log_printn(char const *string, int len) L4_NOTHROW; /** * \ingroup api_l4re_c_log * \brief Write a null terminated string to a log. * * \param logcap Log capability (service). * \param string Text to print, null terminated. * * \return 0 for success, <0 on error * * \see L4Re::Log::print */ L4_CV void l4re_log_print_srv(const l4_cap_idx_t logcap, char const *string) L4_NOTHROW; /** * \ingroup api_l4re_c_log * \brief Write a string of a given length to a log. * * \param logcap Log capability (service). * \param string Text to print, null terminated. * \param len Length of string in bytes. * * \return 0 for success, <0 on error * * \see L4Re::Log::printn */ L4_CV void l4re_log_printn_srv(const l4_cap_idx_t logcap, char const *string, int len) L4_NOTHROW; L4_CV L4_INLINE void l4re_log_print(char const *string) L4_NOTHROW { l4re_log_print_srv(l4re_global_env->log, string); } L4_CV L4_INLINE void l4re_log_printn(char const *string, int len) L4_NOTHROW { l4re_log_printn_srv(l4re_global_env->log, string, len); } EXTERN_C_END
#include "AbstractSocket.hpp" namespace NL { AbstractSocket::AbstractSocket() { int socketId = socket(PF_INET, SOCK_STREAM, 0); if(socketId == -1) { DEBUG(std::cout << "AbstractSocket: Failed to initialize " << "socket - " << h_errno << std::endl;) throw Exception(); } init(socketId); } AbstractSocket::AbstractSocket(int socketId) { init(socketId); } void AbstractSocket::init(int socketId) { this->socketId = socketId; } unsigned int AbstractSocket::getSocketId() { return this->socketId; } void AbstractSocket::setReuseAddress(bool value) { if(value != reuseAddress) { // Set SO_REUSEADDR on a socket to true (1): // XXX: on Windows and sun this is a char instead of an int! #if defined(WIN32) || defined(sun) char optval = value ? '1': '0'; #else int optval = value ? 1 : 0 ; #endif if(setsockopt(getSocketId(), SOL_SOCKET, SO_REUSEADDR, &optval, sizeof(optval)) == -1) { DEBUG(std::cout << "AbstractSocket: setReuseAddress, " << "setsockopt failed - " << errno << std::endl;) throw Exception(); } this->reuseAddress = value; } } std::string &AbstractSocket::getAddress() { return ipAddress; } int AbstractSocket::getPort() { return port; } }
package org.jfree.chart.junit; import junit.framework.Test; import junit.framework.TestCase; import junit.framework.TestSuite; public class ChartPackageTests extends TestCase { /** * Returns a test suite to the JUnit test runner. * * @return The test suite. */ public static Test suite() { TestSuite suite = new TestSuite("org.jfree.chart"); suite.addTestSuite(AreaChartTests.class); suite.addTestSuite(BarChartTests.class); suite.addTestSuite(BarChart3DTests.class); suite.addTestSuite(ChartPanelTests.class); suite.addTestSuite(<API key>.class); suite.addTestSuite(GanttChartTests.class); suite.addTestSuite(JFreeChartTests.class); suite.addTestSuite(LegendItemTests.class); suite.addTestSuite(<API key>.class); suite.addTestSuite(LineChartTests.class); suite.addTestSuite(LineChart3DTests.class); suite.addTestSuite(MeterChartTests.class); suite.addTestSuite(PaintMapTests.class); suite.addTestSuite(PieChartTests.class); suite.addTestSuite(PieChart3DTests.class); suite.addTestSuite(ScatterPlotTests.class); suite.addTestSuite(<API key>.class); suite.addTestSuite(<API key>.class); suite.addTestSuite(<API key>.class); suite.addTestSuite(StrokeMapTests.class); suite.addTestSuite(<API key>.class); suite.addTestSuite(WaterfallChartTests.class); suite.addTestSuite(XYAreaChartTests.class); suite.addTestSuite(XYBarChartTests.class); suite.addTestSuite(XYLineChartTests.class); suite.addTestSuite(<API key>.class); suite.addTestSuite(XYStepChartTests.class); return suite; } }
<?php // Check to ensure this file is included in Joomla! defined('_JEXEC') or die(); jimport('joomla.application.component.model'); JLoader::register('SEFCache', JPATH_ROOT.'/components/com_sef/sef.cache.php'); class SEFModelURLs extends SEFModel { function __construct() { parent::__construct(); } function purge() { if( $this->_getTableWhere($table, $where) === false ) { return false; } $db =& JFactory::getDBO(); $sql = "DELETE FROM $table" . (!empty($where) ? " WHERE $where" : ''); $db->setQuery($sql); return $db->query(); } /** * 0 - SEF * 1 - 404 * 2 - Custom * 3 - Moved * 4 - Disabled * 5 - Not SEFed * 6 - Locked * 7 - Cached * * @param int $type * @return int */ function getCount($type = null) { if( $this->_getTableWhere($table, $where, $type) === false ) { return 0; } $db =& JFactory::getDBO(); $sql = "SELECT COUNT(*) FROM $table" . (!empty($where) ? " WHERE $where" : ''); $db->setQuery($sql); $this->_count = $db->loadResult(); return $this->_count; } function getStatistics() { $sefConfig =& SEFConfig::getConfig(); $stats = array(); $stat = new stdClass(); $stat->text = JText::_('<API key>'); $stat->value = $this->getCount(0); $stat->link = 'index.php?option=com_sef&controller=sefurls&viewmode=0'; $stats[] = $stat; $stat = new stdClass(); $stat->text = JText::_('<API key>'); $stat->value = $this->getCount(2); $stat->link = 'index.php?option=com_sef&controller=sefurls&viewmode=2'; $stats[] = $stat; $stat = new stdClass(); $stat->text = JText::_('COM_SEF_404_URLS'); $stat->value = $this->getCount(1); $stat->link = 'index.php?option=com_sef&controller=sefurls&viewmode=1'; $stats[] = $stat; $stat = new stdClass(); $stat->text = JText::_('COM_SEF_MOVED_URLS'); $stat->value = $this->getCount(3); $stat->link = 'index.php?option=com_sef&controller=movedurls'; $stats[] = $stat; $stat = new stdClass(); $stat->text = JText::_('COM_SEF_TOTAL_URLS'); $stat->value = $stats[0]->value + $stats[1]->value + $stats[2]->value + $stats[3]->value; $stats[] = $stat; $stat = new stdClass(); $stat->text = ''; $stats[] = $stat; $stat = new stdClass(); $stat->text = JText::_('<API key>'); $stat->value = $this->getCount(4); $stats[] = $stat; $stat = new stdClass(); $stat->text = JText::_('<API key>'); $stat->value = $this->getCount(5); $stats[] = $stat; $stat = new stdClass(); $stat->text = JText::_('COM_SEF_LOCKED_URLS'); $stat->value = $this->getCount(6); $stats[] = $stat; $stat = new stdClass(); $stat->text = JText::_('<API key>'); if ($sefConfig->useCache) { $cache =& sefCache::getInstance(); $stat->value = $cache->getCount(); } else { $stat->value = JText::_('<API key>'); } $stats[] = $stat; $stat = new stdClass(); $stat->text = ''; $stats[] = $stat; $stat = new stdClass(); $stat->text = JText::_('<API key>'); $stat->value = $this->getCount(7); $stat->link = 'index.php?option=com_sef&controller=logger'; $stats[] = $stat; return $stats; } function _getTableWhere(&$table, &$where, $type = null) { if (is_null($type)) { $type = JRequest::getInt('type', null); if (!is_null($type) && (($type < 0) || ($type > 3))) { // Can purge only types 0 - 3 $type = null; } } if( is_null($type) ) { return false; } if( ($type >= 0) && ($type <= 2) ) { $table = '`#__sefurls`'; if( $type == 0 ) { // Automatic SEF $where = "`dateadd` = '0000-00-00' AND `locked` = '0'"; } elseif( $type == 1 ) { // 404 $where = "`dateadd` > '0000-00-00' and `origurl` = '' AND `locked` = '0'"; } elseif( $type == 2 ) { // Custom $where = "`dateadd` > '0000-00-00' and `origurl` != '' AND `locked` = '0'"; } } elseif ( $type == 3 ) { // Moved $table = '`#__sefmoved`'; $where = ''; } elseif (($type >= 4) && ($type <= 6)) { $table = '`#__sefurls`'; if ($type == 4) { // Disabled $where = "`enabled` = '0'"; } elseif ($type == 5) { // Not SEFed $where = "`sef` = '0'"; } elseif ($type == 6) { // Locked $where = "`locked` = '1'"; } } elseif ($type == 7) { // Errors logged $table = '`#__seflog`'; $where = ''; } else { return false; } return true; } } ?>
package com.own.sky.test; import com.own.sky.coreengine.scenegraph.GameComponent; import com.own.sky.debug.Debug; import com.own.sky.inputengine.Keyboard; import com.own.sky.inputengine.KeyboardKeys; import com.own.sky.inputengine.Mouse; import com.own.sky.math.CoordinateSystem; import com.own.sky.renderingengine.concept.RenderingConcept; import com.own.sky.renderingengine.graphics.object.Transform; public class <API key> extends GameComponent { private KeyboardKeys debugKey; public <API key>(KeyboardKeys debugKey) { super(true, false, false); this.debugKey = debugKey; } @Override public void input(Mouse mouse, Keyboard keyboard) { Transform t = getGameObject().getTransform(); if (keyboard.isKeyPressed(debugKey)) { Debug.out(" Debug.out("Current translation: " + t.getTranslation()); Debug.out(" Debug.out("Current scale: " + t.getScale()); Debug.out(" Debug.out("Current rotation: " + t.getRotation()); Debug.out(" Debug.out("global xAxis: " + CoordinateSystem.CoordinateAxis.X_AXIS.getVector()); Debug.out("local xAxis: " + t.getRotation().getLocalXAxis()); Debug.out(" Debug.out("global yAxis: " + CoordinateSystem.CoordinateAxis.Y_AXIS.getVector()); Debug.out("local yAxis: " + t.getRotation().getLocalYAxis()); Debug.out(" Debug.out("global zAxis: " + CoordinateSystem.CoordinateAxis.Z_AXIS.getVector()); Debug.out("local zAxis: " + t.getRotation().getLocalZAxis()); Debug.out(" } } @Override public void update() { } @Override public void render(RenderingConcept renderingConcept) { } }
/* CSS for U-Design WooCommerce Integration */ .udesign-wc-cart h3.social_media_title { display: inline; font-weight: bold; } .social-media-area .udesign-wc-cart, .social-media-area .udesign-wc-cart a, .social-media-area .udesign-wc-cart h3.social_media_title { font-size: 12px !important; } .<API key> { margin-top: 5px;} .social-media-area .<API key> { margin-top: 7px;} body.woocommerce .breadcrumbs { display:none; } div#wc-breadcrumbs { font-size: 90%; margin: 10px 20px 25px; font-weight: bold; } div#wc-breadcrumbs a { font-weight: normal;} ul.products li.product a { text-decoration: none; overflow: hidden; outline: 0; } div.product div.images div.thumbnails a, #content div.product div.images div.thumbnails a { margin-bottom: 15px; } .woocommerce .related ul.products li.product, .woocommerce .related ul li.product, .woocommerce .upsells.products ul.products li.product, .woocommerce .upsells.products ul li.product, .woocommerce-page .related ul.products li.product, .woocommerce-page .related ul li.product, .woocommerce-page .upsells.products ul.products li.product, .woocommerce-page .upsells.products ul li.product { width: 30%; } .quantity input.qty, #content .quantity input.qty { font-weight: normal;} .woocommerce .cart-collaterals table { width: 100%;} .woocommerce .cart-collaterals table tr { background: url("../images/heading_underline.png") repeat-x scroll 0 100% transparent;} .woocommerce .cart-collaterals .cart_totals tr td, .woocommerce .cart-collaterals .cart_totals tr th, .woocommerce-page .cart-collaterals .cart_totals tr td, .woocommerce-page .cart-collaterals .cart_totals tr th, .woocommerce .<API key> .total, .woocommerce-page .<API key> .total { border-top: 0 none;} .<API key> .chzn-single { border: 1px solid #E1E1E1 !important; color: #717171; } form .form-row input.input-text, form .form-row textarea, .widget_login input#user_login, .widget_login input#user_pass, .<API key> input width: 100%; float:left; -webkit-box-sizing:border-box; -moz-box-sizing:border-box; box-sizing:border-box; box-shadow:inset 0 1px 4px 0 rgba(0,0,0,0.1); -webkit-box-shadow:inset 0 1px 4px 0 rgba(0,0,0,0.1); -moz-box-shadow:inset 0 1px 4px 0 rgba(0,0,0,0.1); border:1px solid #DDD9D9; padding:6px; margin:0 4px 0 0; outline:0; line-height:1.2em; color: #A4A4A4; } form.<API key> select.orderby { background-color:#FFF; filter:progid:dximagetransform.microsoft.gradient(startColorstr='#FFFFFF',endColorstr='#EEEEEE',GradientType=0); background-image:-webkit-gradient(linear,0% 0,0% 100%,color-stop(20%,#FFF),color-stop(50%,#F6F6F6),color-stop(52%,#EEE),color-stop(100%,#F4F4F4)); background-image:-<API key>(top,#FFF 20%,#F6F6F6 50%,#EEE 52%,#F4F4F4 100%); background-image:-moz-linear-gradient(top,#FFF 20%,#F6F6F6 50%,#EEE 52%,#F4F4F4 100%); background-image:-o-linear-gradient(top,#FFF 20%,#F6F6F6 50%,#EEE 52%,#F4F4F4 100%); background-image:-ms-linear-gradient(top,#FFF 20%,#F6F6F6 50%,#EEE 52%,#F4F4F4 100%); background-image:linear-gradient(top,#FFF 20%,#F6F6F6 50%,#EEE 52%,#F4F4F4 100%); -<API key>:5px;-moz-border-radius:5px;border-radius:5px; -moz-background-clip:padding; -<API key>:padding-box; background-clip:padding-box; border:1px solid #E1E1E1; -webkit-box-shadow:0 0 3px #FFF inset,0 1px 1px rgba(0,0,0,0.1); -moz-box-shadow:0 0 3px #FFF inset,0 1px 1px rgba(0,0,0,0.1); box-shadow:0 0 3px #FFF inset,0 1px 1px rgba(0,0,0,0.1); display:block; overflow:hidden; white-space:nowrap; position:relative; padding:7px 7px 6px 5px; color: #717171; text-decoration:none; height: 34px; line-height: 23px; cursor: pointer; } form.<API key> select.orderby option { padding:5px; } .woocommerce .<API key> { margin: 0 0 26px 10px; } .related.products { clear: both;} .related.products h2 { margin-bottom: 10px;} .woocommerce ul.products li.product .price .from { font-size: inherit; text-transform: inherit;} .woocommerce ul.products li.product .price .amount { font-weight: bold;} .woocommerce ul.products li.product .price del, .woocommerce div.product p.price del { font-size: inherit;} .woocommerce ul.products li.product .price del .amount, .woocommerce div.product p.price del .amount { font-weight: normal;} ul.products li.product h3 { padding: 0.2em 0;} ul.products li.product .price { margin-bottom: 0.8em;} .products mark.count { background-color: transparent; letter-spacing: 3px; } div.product form.cart, #content div.product form.cart { margin-top: 2em;} input.submitbutton { font-size:100%; margin:0; line-height:1em; cursor:pointer; position:relative; font-family:inherit; text-decoration:none; overflow:visible; padding:6px 10px; text-decoration:none; font-weight:bold; -<API key>:2px; -moz-border-radius:2px; border-radius:2px; left:auto; text-shadow:0 1px 0 #FFF; color:#5C5C5C !important; text-shadow:0 1px 0 rgba(255,255,255,0.8); border:1px solid #C4BFBF; background:#F5F4F4; background:-webkit-gradient(linear,left top,left bottom,from(#F5F4F4),to(#ddd9d9)); background:-<API key>(#F5F4F4,#DDD9D9); background:-moz-linear-gradient(center top,#F5F4F4 0%,#DDD9D9 100%); background:-moz-gradient(center top,#F5F4F4 0%,#DDD9D9 100%); -webkit-box-shadow:inset 0 -1px 0 rgba(0,0,0,0.075), inset 0 1px 0 rgba(255,255,255,0.3), 0 1px 2px rgba(0,0,0,0.1); -moz-box-shadow:inset 0 -1px 0 rgba(0,0,0,0.075), inset 0 1px 0 rgba(255,255,255,0.3), 0 1px 2px rgba(0,0,0,0.1); box-shadow:inset 0 -1px 0 rgba(0,0,0,0.075), inset 0 1px 0 rgba(255,255,255,0.3), 0 1px 2px rgba(0,0,0,0.1); } input.submitbutton:hover { background:#F5F4F4; background:-webkit-gradient(linear,left top,left bottom,from(#F5F4F4),to(#D1CCCC)); background:-<API key>(#F5F4F4,#D1CCCC); background:-moz-linear-gradient(center top,#F5F4F4 0%,#D1CCCC 100%); background:-moz-gradient(center top,#F5F4F4 0%,#D1CCCC 100%); text-decoration:none; } .<API key> input#searchsubmit { background: url("../images/product-search.png") no-repeat scroll 100% 0 transparent; border: 0 none; cursor: pointer; float: left; height: 17px; margin: 6px 0 0 -28px; padding: 0; text-indent: -9000px; width: 18px; } .<API key> input#s { width: 100%;} .<API key> form#searchform { margin:10px 0 40px;} .<API key> label.screen-reader-text {display:none;} .widget_login form { padding-top: 5px; } .widget_login input#user_login, .widget_login input#user_pass { float: right; width:60%;} .widget_login form input.submitbutton { display: inline-block; padding-right:5px; margin-top: 2px;} .widget_login form a { display: inline-block; padding-left:2px; } .widget_login form p { text-align: right; clear: both;} .widget_login input#user_login, .widget_login input#user_pass { margin:0 0 0 7px;} ul.products li.product { text-align: center;} table.cart a.remove, #content table.cart a.remove { border: 0 none; cursor: pointer; overflow: hidden; outline: 0; } .woocommerce ul.cart_list li, .woocommerce ul.product_list_widget li { background: url("../images/heading_underline.png") repeat-x scroll 0 100% transparent; padding: 6px 0 10px 70px; } .woocommerce ul.cart_list li img, .woocommerce ul.product_list_widget li img, .woocommerce-page ul.cart_list li img, .woocommerce-page ul.product_list_widget li img { width: 60px; float:left; margin-right:10px; margin-left:-70px; } #bottom .<API key> li, #bottom .widget_login li { list-style-type: none; margin-left: 0; width: 100%; background: url("../images/double-arrow.png") no-repeat scroll 3px 8px transparent; } #bottom .<API key> li li, #bottom .widget_login li li { background: url("../images/double-arrow.png") no-repeat scroll 13px 8px transparent; } #bottom .<API key> li li li, #bottom .widget_login li li li { background: url("../images/double-arrow.png") no-repeat scroll 23px 8px transparent; } #bottom .<API key> li li li li, #bottom .widget_login li li li li { background: url("../images/double-arrow.png") no-repeat scroll 33px 8px transparent; } #bottom .<API key> li a, #bottom .widget_login li a { padding: 2px 0 5px 20px; display: block; background: url("../images/heading_underline.png") repeat-x scroll 0 100% transparent; } .my_account_orders a.button { float:right;} .order-info mark { background-color:transparent; font-weight:bold;} .woocommerce ul.cart_list li dl dt, .woocommerce ul.product_list_widget li dl dt, .woocommerce-page ul.cart_list li dl dt, .woocommerce-page ul.product_list_widget li dl dt { clear: none; } .woocommerce .star-rating:before, .woocommerce-page .star-rating:before, .woocommerce .star-rating span:before, .woocommerce-page .star-rating span:before { font-size: 12px; }
#Rivalry Rivalry is similar to Amazon's "Customers who viewed this item also viewed..." except: 1. Rivalry is applicable to anything -- abstract ideas, people, brand, products, companies, countries, organizations, food, lifestyles, religion, ... the list goes on. 2. Rivalry's results encapsulate a product's entire industry -- not just a product's immediate rivals. 3. Rivalry creates a popularity ranking of products. Interesting Rivalry rankings #Cola Wars ` Enter the name of a product, brand, item, or otherwise distinct entity: pepsi 1. coke 2. pepsi 3. diet coke 4. coke zero 5. diet pepsi 6. pepsi max 7. coffee caffeine 8. coffee 9. soda 10. coca cola ` #Editor Wars ` Enter the name of a product, brand, item, or otherwise distinct entity: emacs 1. sublime 2. vim 3. atom 4. eclipse 5. ide 6. nano 7. riven 8. emacs 9. nasus 10. intellij ` #Luxury cars ` Enter the name of a product, brand, item, or otherwise distinct entity: audi 1. bmw 2. honda 3. audi 4. lexus 5. toyota 6. subaru 7. mercedes 8. porsche 9. acura 10. infiniti ` #Console Wars ` Enter the name of a product, brand, item, or otherwise distinct entity: xbox one 1. ps4 2. pc 3. wii u 4. xbox 360 5. xbox one 6. ps3 7. 360 8. ps4 graphics 9. 3ds xl 10. xbox 360 sales ` #Distro Wars ` Enter the name of a product, brand, item, or otherwise distinct entity: ubuntu 1. ubuntu 2. mint 3. windows 4. linux 5. windows 10 6. debian 7. centos 8. fedora 9. windows 8 10. windows 7 ` #Phone Wars ` Enter the name of a product, brand, item, or otherwise distinct entity: iphone 6 1. note 4 2. iphone 6 3. s6 4. lg g4 5. s5 6. iphone 6 plus 7. note 5 8. galaxy s5 9. s6 edge 10. note 3 ` #TV/Internet Providers ` Enter the name of a product, brand, item, or otherwise distinct entity: comcast 1. comcast 2. netflix 3. directv 4. at&t 5. dish 6. uverse 7. time warner 8. cable 9. charter 10. frontier ` #Language Wars ` Enter the name of a product, brand, item, or otherwise distinct entity: python 1. python 2. java 3. php 4. javascript 5. r 6. ruby 7. node.js 8. lion 9. perl 10. sas ` #Junk food ` Enter the name of a product, brand, item, or otherwise distinct entity: pizza 1. pizza 2. rice 3. burrito 4. french fries 5. pasta 6. bread 7. taco 8. burger 9. fries 10. fried chicken ` #Burger Wars ` Enter the name of a product, brand, item, or otherwise distinct entity: five guys 1. five guys 2. mcdonalds 3. in n out 4. batman 5. burger king 6. shake shack 7. wendy's 8. whataburger 9. sonic 10. subway ` Installation git clone https://github.com/william-truong/Rivalry.git pip install -r Rivalry/requirements.txt python Rivalry/Rivalry.py Key ideas * The key idea is to rank a product's competitors based on search frequency. * "The rival of my rival is my rival." * There are 'golden standards' that people will often compare things to -- Rivalry captures that and produces a ranking. Characteristics of search results * The industry of your search results will be centered around the target market of your product - For example -- if you type in 'Audi', your search results will be biased towards luxury vehicles (people tend to cross-shop Audis with BMWs moreso than Hondas), whereas if you type in 'Toyota', the resulting search results will be biased towards standard vehicles. * Keeping in mind the above, the ranking produced is very robust with respect to the input - For example -- whether you type in 'Coke', 'Pepsi', or 'Sprite', you will see Coke as #1 and Pepsi as #2. Things I would like to do: - [ ] Create a webpage allowing users to interact with a Rivalry agent - [ ] Create a graph that visually describes the web of rivalries within an industry Author: William Truong
package sun.security.pkcs11; import java.io.*; import java.lang.ref.*; import java.math.BigInteger; import java.util.*; import java.security.*; import java.security.interfaces.*; import java.security.spec.*; import javax.crypto.*; import javax.crypto.interfaces.*; import javax.crypto.spec.*; import sun.security.rsa.RSAPublicKeyImpl; import sun.security.internal.interfaces.TlsMasterSecret; import sun.security.pkcs11.wrapper.*; import static sun.security.pkcs11.wrapper.PKCS11Constants.*; import sun.security.util.DerValue; import sun.security.util.Length; import sun.security.util.ECUtil; /** * Key implementation classes. * * In PKCS#11, the components of private and secret keys may or may not * be accessible. If they are, we use the algorithm specific key classes * (e.g. DSAPrivateKey) for compatibility with existing applications. * If the components are not accessible, we use a generic class that * only implements PrivateKey (or SecretKey). Whether the components of a * key are extractable is automatically determined when the key object is * created. * * @author Andreas Sterbenz * @since 1.5 */ abstract class P11Key implements Key, Length { private static final long serialVersionUID = -<API key>; private final static String PUBLIC = "public"; private final static String PRIVATE = "private"; private final static String SECRET = "secret"; // type of key, one of (PUBLIC, PRIVATE, SECRET) final String type; // token instance final Token token; // algorithm name, returned by getAlgorithm(), etc. final String algorithm; // key id final long keyID; // effective key length of the key, e.g. 56 for a DES key final int keyLength; // flags indicating whether the key is a token object, sensitive, extractable final boolean tokenObject, sensitive, extractable; // phantom reference notification clean up for session keys private final SessionKeyRef sessionKeyRef; P11Key(String type, Session session, long keyID, String algorithm, int keyLength, CK_ATTRIBUTE[] attributes) { this.type = type; this.token = session.token; this.keyID = keyID; this.algorithm = algorithm; this.keyLength = keyLength; boolean tokenObject = false; boolean sensitive = false; boolean extractable = true; int n = (attributes == null) ? 0 : attributes.length; for (int i = 0; i < n; i++) { CK_ATTRIBUTE attr = attributes[i]; if (attr.type == CKA_TOKEN) { tokenObject = attr.getBoolean(); } else if (attr.type == CKA_SENSITIVE) { sensitive = attr.getBoolean(); } else if (attr.type == CKA_EXTRACTABLE) { extractable = attr.getBoolean(); } } this.tokenObject = tokenObject; this.sensitive = sensitive; this.extractable = extractable; if (tokenObject == false) { sessionKeyRef = new SessionKeyRef(this, keyID, session); } else { sessionKeyRef = null; } } // see JCA spec public final String getAlgorithm() { token.ensureValid(); return algorithm; } // see JCA spec public final byte[] getEncoded() { byte[] b = getEncodedInternal(); return (b == null) ? null : b.clone(); } abstract byte[] getEncodedInternal(); public boolean equals(Object obj) { if (this == obj) { return true; } // equals() should never throw exceptions if (token.isValid() == false) { return false; } if (obj instanceof Key == false) { return false; } String thisFormat = getFormat(); if (thisFormat == null) { // no encoding, key only equal to itself // XXX getEncoded() for unextractable keys will change that return false; } Key other = (Key)obj; if (thisFormat.equals(other.getFormat()) == false) { return false; } byte[] thisEnc = this.getEncodedInternal(); byte[] otherEnc; if (obj instanceof P11Key) { otherEnc = ((P11Key)other).getEncodedInternal(); } else { otherEnc = other.getEncoded(); } return MessageDigest.isEqual(thisEnc, otherEnc); } public int hashCode() { // hashCode() should never throw exceptions if (token.isValid() == false) { return 0; } byte[] b1 = getEncodedInternal(); if (b1 == null) { return 0; } int r = b1.length; for (int i = 0; i < b1.length; i++) { r += (b1[i] & 0xff) * 37; } return r; } protected Object writeReplace() throws <API key> { KeyRep.Type type; String format = getFormat(); if (isPrivate() && "PKCS#8".equals(format)) { type = KeyRep.Type.PRIVATE; } else if (isPublic() && "X.509".equals(format)) { type = KeyRep.Type.PUBLIC; } else if (isSecret() && "RAW".equals(format)) { type = KeyRep.Type.SECRET; } else { // XXX short term serialization for unextractable keys throw new <API key> ("Cannot serialize sensitive and unextractable keys"); } return new KeyRep(type, getAlgorithm(), format, getEncoded()); } public String toString() { token.ensureValid(); String s1 = token.provider.getName() + " " + algorithm + " " + type + " key, " + keyLength + " bits"; s1 += " (id " + keyID + ", " + (tokenObject ? "token" : "session") + " object"; if (isPublic()) { s1 += ")"; } else { s1 += ", " + (sensitive ? "" : "not ") + "sensitive"; s1 += ", " + (extractable ? "" : "un") + "extractable)"; } return s1; } /** * Return bit length of the key. */ @Override public int length() { return keyLength; } boolean isPublic() { return type == PUBLIC; } boolean isPrivate() { return type == PRIVATE; } boolean isSecret() { return type == SECRET; } void fetchAttributes(CK_ATTRIBUTE[] attributes) { Session tempSession = null; try { tempSession = token.getOpSession(); token.p11.C_GetAttributeValue(tempSession.id(), keyID, attributes); } catch (PKCS11Exception e) { throw new ProviderException(e); } finally { token.releaseSession(tempSession); } } private final static CK_ATTRIBUTE[] A0 = new CK_ATTRIBUTE[0]; private static CK_ATTRIBUTE[] getAttributes(Session session, long keyID, CK_ATTRIBUTE[] knownAttributes, CK_ATTRIBUTE[] desiredAttributes) { if (knownAttributes == null) { knownAttributes = A0; } for (int i = 0; i < desiredAttributes.length; i++) { // For each desired attribute, check to see if we have the value // available already. If everything is here, we save a native call. CK_ATTRIBUTE attr = desiredAttributes[i]; for (CK_ATTRIBUTE known : knownAttributes) { if ((attr.type == known.type) && (known.pValue != null)) { attr.pValue = known.pValue; break; // break inner for loop } } if (attr.pValue == null) { // nothing found, need to call C_GetAttributeValue() for (int j = 0; j < i; j++) { // clear values copied from knownAttributes desiredAttributes[j].pValue = null; } try { session.token.p11.C_GetAttributeValue (session.id(), keyID, desiredAttributes); } catch (PKCS11Exception e) { throw new ProviderException(e); } break; // break loop, goto return } } return desiredAttributes; } static SecretKey secretKey(Session session, long keyID, String algorithm, int keyLength, CK_ATTRIBUTE[] attributes) { attributes = getAttributes(session, keyID, attributes, new CK_ATTRIBUTE[] { new CK_ATTRIBUTE(CKA_TOKEN), new CK_ATTRIBUTE(CKA_SENSITIVE), new CK_ATTRIBUTE(CKA_EXTRACTABLE), }); return new P11SecretKey(session, keyID, algorithm, keyLength, attributes); } static SecretKey masterSecretKey(Session session, long keyID, String algorithm, int keyLength, CK_ATTRIBUTE[] attributes, int major, int minor) { attributes = getAttributes(session, keyID, attributes, new CK_ATTRIBUTE[] { new CK_ATTRIBUTE(CKA_TOKEN), new CK_ATTRIBUTE(CKA_SENSITIVE), new CK_ATTRIBUTE(CKA_EXTRACTABLE), }); return new <API key> (session, keyID, algorithm, keyLength, attributes, major, minor); } // we assume that all components of public keys are always accessible static PublicKey publicKey(Session session, long keyID, String algorithm, int keyLength, CK_ATTRIBUTE[] attributes) { switch (algorithm) { case "RSA": return new P11RSAPublicKey (session, keyID, algorithm, keyLength, attributes); case "DSA": return new P11DSAPublicKey (session, keyID, algorithm, keyLength, attributes); case "DH": return new P11DHPublicKey (session, keyID, algorithm, keyLength, attributes); case "EC": return new P11ECPublicKey (session, keyID, algorithm, keyLength, attributes); default: throw new ProviderException ("Unknown public key algorithm " + algorithm); } } static PrivateKey privateKey(Session session, long keyID, String algorithm, int keyLength, CK_ATTRIBUTE[] attributes) { attributes = getAttributes(session, keyID, attributes, new CK_ATTRIBUTE[] { new CK_ATTRIBUTE(CKA_TOKEN), new CK_ATTRIBUTE(CKA_SENSITIVE), new CK_ATTRIBUTE(CKA_EXTRACTABLE), }); if (attributes[1].getBoolean() || (attributes[2].getBoolean() == false)) { return new P11PrivateKey (session, keyID, algorithm, keyLength, attributes); } else { switch (algorithm) { case "RSA": // XXX better test for RSA CRT keys (single getAttributes() call) // we need to determine whether this is a CRT key // see if we can obtain the public exponent // this should also be readable for sensitive/extractable keys CK_ATTRIBUTE[] attrs2 = new CK_ATTRIBUTE[] { new CK_ATTRIBUTE(CKA_PUBLIC_EXPONENT), }; boolean crtKey; try { session.token.p11.C_GetAttributeValue (session.id(), keyID, attrs2); crtKey = (attrs2[0].pValue instanceof byte[]); } catch (PKCS11Exception e) { // ignore, assume not available crtKey = false; } if (crtKey) { return new P11RSAPrivateKey (session, keyID, algorithm, keyLength, attributes); } else { return new <API key> (session, keyID, algorithm, keyLength, attributes); } case "DSA": return new P11DSAPrivateKey (session, keyID, algorithm, keyLength, attributes); case "DH": return new P11DHPrivateKey (session, keyID, algorithm, keyLength, attributes); case "EC": return new P11ECPrivateKey (session, keyID, algorithm, keyLength, attributes); default: throw new ProviderException ("Unknown private key algorithm " + algorithm); } } } // class for sensitive and unextractable private keys private static final class P11PrivateKey extends P11Key implements PrivateKey { private static final long serialVersionUID = -<API key>; P11PrivateKey(Session session, long keyID, String algorithm, int keyLength, CK_ATTRIBUTE[] attributes) { super(PRIVATE, session, keyID, algorithm, keyLength, attributes); } // XXX temporary encoding for serialization purposes public String getFormat() { token.ensureValid(); return null; } byte[] getEncodedInternal() { token.ensureValid(); return null; } } private static class P11SecretKey extends P11Key implements SecretKey { private static final long serialVersionUID = -<API key>; private volatile byte[] encoded; P11SecretKey(Session session, long keyID, String algorithm, int keyLength, CK_ATTRIBUTE[] attributes) { super(SECRET, session, keyID, algorithm, keyLength, attributes); } public String getFormat() { token.ensureValid(); if (sensitive || (extractable == false)) { return null; } else { return "RAW"; } } byte[] getEncodedInternal() { token.ensureValid(); if (getFormat() == null) { return null; } byte[] b = encoded; if (b == null) { synchronized (this) { b = encoded; if (b == null) { Session tempSession = null; try { tempSession = token.getOpSession(); CK_ATTRIBUTE[] attributes = new CK_ATTRIBUTE[] { new CK_ATTRIBUTE(CKA_VALUE), }; token.p11.C_GetAttributeValue (tempSession.id(), keyID, attributes); b = attributes[0].getByteArray(); } catch (PKCS11Exception e) { throw new ProviderException(e); } finally { token.releaseSession(tempSession); } encoded = b; } } } return b; } } @SuppressWarnings("deprecation") private static class <API key> extends P11SecretKey implements TlsMasterSecret { private static final long serialVersionUID = -<API key>; private final int majorVersion, minorVersion; <API key>(Session session, long keyID, String algorithm, int keyLength, CK_ATTRIBUTE[] attributes, int major, int minor) { super(session, keyID, algorithm, keyLength, attributes); this.majorVersion = major; this.minorVersion = minor; } public int getMajorVersion() { return majorVersion; } public int getMinorVersion() { return minorVersion; } } // RSA CRT private key private static final class P11RSAPrivateKey extends P11Key implements RSAPrivateCrtKey { private static final long serialVersionUID = <API key>; private BigInteger n, e, d, p, q, pe, qe, coeff; private byte[] encoded; P11RSAPrivateKey(Session session, long keyID, String algorithm, int keyLength, CK_ATTRIBUTE[] attributes) { super(PRIVATE, session, keyID, algorithm, keyLength, attributes); } private synchronized void fetchValues() { token.ensureValid(); if (n != null) { return; } CK_ATTRIBUTE[] attributes = new CK_ATTRIBUTE[] { new CK_ATTRIBUTE(CKA_MODULUS), new CK_ATTRIBUTE(CKA_PUBLIC_EXPONENT), new CK_ATTRIBUTE(<API key>), new CK_ATTRIBUTE(CKA_PRIME_1), new CK_ATTRIBUTE(CKA_PRIME_2), new CK_ATTRIBUTE(CKA_EXPONENT_1), new CK_ATTRIBUTE(CKA_EXPONENT_2), new CK_ATTRIBUTE(CKA_COEFFICIENT), }; fetchAttributes(attributes); n = attributes[0].getBigInteger(); e = attributes[1].getBigInteger(); d = attributes[2].getBigInteger(); p = attributes[3].getBigInteger(); q = attributes[4].getBigInteger(); pe = attributes[5].getBigInteger(); qe = attributes[6].getBigInteger(); coeff = attributes[7].getBigInteger(); } public String getFormat() { token.ensureValid(); return "PKCS } synchronized byte[] getEncodedInternal() { token.ensureValid(); if (encoded == null) { fetchValues(); try { // XXX make constructor in SunRsaSign provider public // and call it directly KeyFactory factory = KeyFactory.getInstance ("RSA", P11Util.<API key>()); Key newKey = factory.translateKey(this); encoded = newKey.getEncoded(); } catch (<API key> e) { throw new ProviderException(e); } } return encoded; } public BigInteger getModulus() { fetchValues(); return n; } public BigInteger getPublicExponent() { fetchValues(); return e; } public BigInteger getPrivateExponent() { fetchValues(); return d; } public BigInteger getPrimeP() { fetchValues(); return p; } public BigInteger getPrimeQ() { fetchValues(); return q; } public BigInteger getPrimeExponentP() { fetchValues(); return pe; } public BigInteger getPrimeExponentQ() { fetchValues(); return qe; } public BigInteger getCrtCoefficient() { fetchValues(); return coeff; } } // RSA non-CRT private key private static final class <API key> extends P11Key implements RSAPrivateKey { private static final long serialVersionUID = <API key>; private BigInteger n, d; private byte[] encoded; <API key>(Session session, long keyID, String algorithm, int keyLength, CK_ATTRIBUTE[] attributes) { super(PRIVATE, session, keyID, algorithm, keyLength, attributes); } private synchronized void fetchValues() { token.ensureValid(); if (n != null) { return; } CK_ATTRIBUTE[] attributes = new CK_ATTRIBUTE[] { new CK_ATTRIBUTE(CKA_MODULUS), new CK_ATTRIBUTE(<API key>), }; fetchAttributes(attributes); n = attributes[0].getBigInteger(); d = attributes[1].getBigInteger(); } public String getFormat() { token.ensureValid(); return "PKCS } synchronized byte[] getEncodedInternal() { token.ensureValid(); if (encoded == null) { fetchValues(); try { // XXX make constructor in SunRsaSign provider public // and call it directly KeyFactory factory = KeyFactory.getInstance ("RSA", P11Util.<API key>()); Key newKey = factory.translateKey(this); encoded = newKey.getEncoded(); } catch (<API key> e) { throw new ProviderException(e); } } return encoded; } public BigInteger getModulus() { fetchValues(); return n; } public BigInteger getPrivateExponent() { fetchValues(); return d; } } private static final class P11RSAPublicKey extends P11Key implements RSAPublicKey { private static final long serialVersionUID = -826726289023854455L; private BigInteger n, e; private byte[] encoded; P11RSAPublicKey(Session session, long keyID, String algorithm, int keyLength, CK_ATTRIBUTE[] attributes) { super(PUBLIC, session, keyID, algorithm, keyLength, attributes); } private synchronized void fetchValues() { token.ensureValid(); if (n != null) { return; } CK_ATTRIBUTE[] attributes = new CK_ATTRIBUTE[] { new CK_ATTRIBUTE(CKA_MODULUS), new CK_ATTRIBUTE(CKA_PUBLIC_EXPONENT), }; fetchAttributes(attributes); n = attributes[0].getBigInteger(); e = attributes[1].getBigInteger(); } public String getFormat() { token.ensureValid(); return "X.509"; } synchronized byte[] getEncodedInternal() { token.ensureValid(); if (encoded == null) { fetchValues(); try { encoded = new RSAPublicKeyImpl(n, e).getEncoded(); } catch (InvalidKeyException e) { throw new ProviderException(e); } } return encoded; } public BigInteger getModulus() { fetchValues(); return n; } public BigInteger getPublicExponent() { fetchValues(); return e; } public String toString() { fetchValues(); return super.toString() + "\n modulus: " + n + "\n public exponent: " + e; } } private static final class P11DSAPublicKey extends P11Key implements DSAPublicKey { private static final long serialVersionUID = <API key>; private BigInteger y; private DSAParams params; private byte[] encoded; P11DSAPublicKey(Session session, long keyID, String algorithm, int keyLength, CK_ATTRIBUTE[] attributes) { super(PUBLIC, session, keyID, algorithm, keyLength, attributes); } private synchronized void fetchValues() { token.ensureValid(); if (y != null) { return; } CK_ATTRIBUTE[] attributes = new CK_ATTRIBUTE[] { new CK_ATTRIBUTE(CKA_VALUE), new CK_ATTRIBUTE(CKA_PRIME), new CK_ATTRIBUTE(CKA_SUBPRIME), new CK_ATTRIBUTE(CKA_BASE), }; fetchAttributes(attributes); y = attributes[0].getBigInteger(); params = new DSAParameterSpec( attributes[1].getBigInteger(), attributes[2].getBigInteger(), attributes[3].getBigInteger() ); } public String getFormat() { token.ensureValid(); return "X.509"; } synchronized byte[] getEncodedInternal() { token.ensureValid(); if (encoded == null) { fetchValues(); try { Key key = new sun.security.provider.DSAPublicKey (y, params.getP(), params.getQ(), params.getG()); encoded = key.getEncoded(); } catch (InvalidKeyException e) { throw new ProviderException(e); } } return encoded; } public BigInteger getY() { fetchValues(); return y; } public DSAParams getParams() { fetchValues(); return params; } public String toString() { fetchValues(); return super.toString() + "\n y: " + y + "\n p: " + params.getP() + "\n q: " + params.getQ() + "\n g: " + params.getG(); } } private static final class P11DSAPrivateKey extends P11Key implements DSAPrivateKey { private static final long serialVersionUID = <API key>; private BigInteger x; private DSAParams params; private byte[] encoded; P11DSAPrivateKey(Session session, long keyID, String algorithm, int keyLength, CK_ATTRIBUTE[] attributes) { super(PRIVATE, session, keyID, algorithm, keyLength, attributes); } private synchronized void fetchValues() { token.ensureValid(); if (x != null) { return; } CK_ATTRIBUTE[] attributes = new CK_ATTRIBUTE[] { new CK_ATTRIBUTE(CKA_VALUE), new CK_ATTRIBUTE(CKA_PRIME), new CK_ATTRIBUTE(CKA_SUBPRIME), new CK_ATTRIBUTE(CKA_BASE), }; fetchAttributes(attributes); x = attributes[0].getBigInteger(); params = new DSAParameterSpec( attributes[1].getBigInteger(), attributes[2].getBigInteger(), attributes[3].getBigInteger() ); } public String getFormat() { token.ensureValid(); return "PKCS } synchronized byte[] getEncodedInternal() { token.ensureValid(); if (encoded == null) { fetchValues(); try { Key key = new sun.security.provider.DSAPrivateKey (x, params.getP(), params.getQ(), params.getG()); encoded = key.getEncoded(); } catch (InvalidKeyException e) { throw new ProviderException(e); } } return encoded; } public BigInteger getX() { fetchValues(); return x; } public DSAParams getParams() { fetchValues(); return params; } } private static final class P11DHPrivateKey extends P11Key implements DHPrivateKey { private static final long serialVersionUID = -<API key>; private BigInteger x; private DHParameterSpec params; private byte[] encoded; P11DHPrivateKey(Session session, long keyID, String algorithm, int keyLength, CK_ATTRIBUTE[] attributes) { super(PRIVATE, session, keyID, algorithm, keyLength, attributes); } private synchronized void fetchValues() { token.ensureValid(); if (x != null) { return; } CK_ATTRIBUTE[] attributes = new CK_ATTRIBUTE[] { new CK_ATTRIBUTE(CKA_VALUE), new CK_ATTRIBUTE(CKA_PRIME), new CK_ATTRIBUTE(CKA_BASE), }; fetchAttributes(attributes); x = attributes[0].getBigInteger(); params = new DHParameterSpec( attributes[1].getBigInteger(), attributes[2].getBigInteger() ); } public String getFormat() { token.ensureValid(); return "PKCS } synchronized byte[] getEncodedInternal() { token.ensureValid(); if (encoded == null) { fetchValues(); try { DHPrivateKeySpec spec = new DHPrivateKeySpec (x, params.getP(), params.getG()); KeyFactory kf = KeyFactory.getInstance ("DH", P11Util.getSunJceProvider()); Key key = kf.generatePrivate(spec); encoded = key.getEncoded(); } catch (<API key> e) { throw new ProviderException(e); } } return encoded; } public BigInteger getX() { fetchValues(); return x; } public DHParameterSpec getParams() { fetchValues(); return params; } public int hashCode() { if (token.isValid() == false) { return 0; } fetchValues(); return Objects.hash(x, params.getP(), params.getG()); } public boolean equals(Object obj) { if (this == obj) return true; // equals() should never throw exceptions if (token.isValid() == false) { return false; } if (!(obj instanceof DHPrivateKey)) { return false; } fetchValues(); DHPrivateKey other = (DHPrivateKey) obj; DHParameterSpec otherParams = other.getParams(); return ((this.x.compareTo(other.getX()) == 0) && (this.params.getP().compareTo(otherParams.getP()) == 0) && (this.params.getG().compareTo(otherParams.getG()) == 0)); } } private static final class P11DHPublicKey extends P11Key implements DHPublicKey { static final long serialVersionUID = -598383872153843657L; private BigInteger y; private DHParameterSpec params; private byte[] encoded; P11DHPublicKey(Session session, long keyID, String algorithm, int keyLength, CK_ATTRIBUTE[] attributes) { super(PUBLIC, session, keyID, algorithm, keyLength, attributes); } private synchronized void fetchValues() { token.ensureValid(); if (y != null) { return; } CK_ATTRIBUTE[] attributes = new CK_ATTRIBUTE[] { new CK_ATTRIBUTE(CKA_VALUE), new CK_ATTRIBUTE(CKA_PRIME), new CK_ATTRIBUTE(CKA_BASE), }; fetchAttributes(attributes); y = attributes[0].getBigInteger(); params = new DHParameterSpec( attributes[1].getBigInteger(), attributes[2].getBigInteger() ); } public String getFormat() { token.ensureValid(); return "X.509"; } synchronized byte[] getEncodedInternal() { token.ensureValid(); if (encoded == null) { fetchValues(); try { DHPublicKeySpec spec = new DHPublicKeySpec (y, params.getP(), params.getG()); KeyFactory kf = KeyFactory.getInstance ("DH", P11Util.getSunJceProvider()); Key key = kf.generatePublic(spec); encoded = key.getEncoded(); } catch (<API key> e) { throw new ProviderException(e); } } return encoded; } public BigInteger getY() { fetchValues(); return y; } public DHParameterSpec getParams() { fetchValues(); return params; } public String toString() { fetchValues(); return super.toString() + "\n y: " + y + "\n p: " + params.getP() + "\n g: " + params.getG(); } public int hashCode() { if (token.isValid() == false) { return 0; } fetchValues(); return Objects.hash(y, params.getP(), params.getG()); } public boolean equals(Object obj) { if (this == obj) return true; // equals() should never throw exceptions if (token.isValid() == false) { return false; } if (!(obj instanceof DHPublicKey)) { return false; } fetchValues(); DHPublicKey other = (DHPublicKey) obj; DHParameterSpec otherParams = other.getParams(); return ((this.y.compareTo(other.getY()) == 0) && (this.params.getP().compareTo(otherParams.getP()) == 0) && (this.params.getG().compareTo(otherParams.getG()) == 0)); } } private static final class P11ECPrivateKey extends P11Key implements ECPrivateKey { private static final long serialVersionUID = -<API key>; private BigInteger s; private ECParameterSpec params; private byte[] encoded; P11ECPrivateKey(Session session, long keyID, String algorithm, int keyLength, CK_ATTRIBUTE[] attributes) { super(PRIVATE, session, keyID, algorithm, keyLength, attributes); } private synchronized void fetchValues() { token.ensureValid(); if (s != null) { return; } CK_ATTRIBUTE[] attributes = new CK_ATTRIBUTE[] { new CK_ATTRIBUTE(CKA_VALUE), new CK_ATTRIBUTE(CKA_EC_PARAMS, params), }; fetchAttributes(attributes); s = attributes[0].getBigInteger(); try { params = P11ECKeyFactory.decodeParameters (attributes[1].getByteArray()); } catch (Exception e) { throw new RuntimeException("Could not parse key values", e); } } public String getFormat() { token.ensureValid(); return "PKCS } synchronized byte[] getEncodedInternal() { token.ensureValid(); if (encoded == null) { fetchValues(); try { Key key = ECUtil.<API key>(s, params); encoded = key.getEncoded(); } catch (<API key> e) { throw new ProviderException(e); } } return encoded; } public BigInteger getS() { fetchValues(); return s; } public ECParameterSpec getParams() { fetchValues(); return params; } } private static final class P11ECPublicKey extends P11Key implements ECPublicKey { private static final long serialVersionUID = -<API key>; private ECPoint w; private ECParameterSpec params; private byte[] encoded; P11ECPublicKey(Session session, long keyID, String algorithm, int keyLength, CK_ATTRIBUTE[] attributes) { super(PUBLIC, session, keyID, algorithm, keyLength, attributes); } private synchronized void fetchValues() { token.ensureValid(); if (w != null) { return; } CK_ATTRIBUTE[] attributes = new CK_ATTRIBUTE[] { new CK_ATTRIBUTE(CKA_EC_POINT), new CK_ATTRIBUTE(CKA_EC_PARAMS), }; fetchAttributes(attributes); try { params = P11ECKeyFactory.decodeParameters (attributes[1].getByteArray()); byte[] ecKey = attributes[0].getByteArray(); // Check whether the X9.63 encoding of an EC point is wrapped // in an ASN.1 OCTET STRING if (!token.config.<API key>()) { DerValue wECPoint = new DerValue(ecKey); if (wECPoint.getTag() != DerValue.tag_OctetString) { throw new IOException("Could not DER decode EC point." + " Unexpected tag: " + wECPoint.getTag()); } w = P11ECKeyFactory.decodePoint (wECPoint.getDataBytes(), params.getCurve()); } else { w = P11ECKeyFactory.decodePoint(ecKey, params.getCurve()); } } catch (Exception e) { throw new RuntimeException("Could not parse key values", e); } } public String getFormat() { token.ensureValid(); return "X.509"; } synchronized byte[] getEncodedInternal() { token.ensureValid(); if (encoded == null) { fetchValues(); try { return ECUtil.<API key>(w, params); } catch (<API key> e) { throw new ProviderException(e); } } return encoded; } public ECPoint getW() { fetchValues(); return w; } public ECParameterSpec getParams() { fetchValues(); return params; } public String toString() { fetchValues(); return super.toString() + "\n public x coord: " + w.getAffineX() + "\n public y coord: " + w.getAffineY() + "\n parameters: " + params; } } } /* * NOTE: Must use PhantomReference here and not WeakReference * otherwise the key maybe cleared before other objects which * still use these keys during finalization such as SSLSocket. */ final class SessionKeyRef extends PhantomReference<P11Key> implements Comparable<SessionKeyRef> { private static ReferenceQueue<P11Key> refQueue = new ReferenceQueue<P11Key>(); private static Set<SessionKeyRef> refList = Collections.<API key>(new TreeSet<SessionKeyRef>()); static ReferenceQueue<P11Key> referenceQueue() { return refQueue; } private static void <API key>() { while (true) { SessionKeyRef next = (SessionKeyRef) refQueue.poll(); if (next == null) break; next.dispose(); } } // handle to the native key private long keyID; private Session session; SessionKeyRef(P11Key key , long keyID, Session session) { super(key, refQueue); this.keyID = keyID; this.session = session; this.session.addObject(); refList.add(this); // TBD: run at some interval and not every time? <API key>(); } private void dispose() { refList.remove(this); if (session.token.isValid()) { Session newSession = null; try { newSession = session.token.getOpSession(); session.token.p11.C_DestroyObject(newSession.id(), keyID); } catch (PKCS11Exception e) { // ignore } finally { this.clear(); session.token.releaseSession(newSession); session.removeObject(); } } } public int compareTo(SessionKeyRef other) { if (this.keyID == other.keyID) { return 0; } else { return (this.keyID < other.keyID) ? -1 : 1; } } }
/** * ScriptData * SDName: Boss_Archaedas * SD%Complete: 100 * SDComment: None * SDCategory: Uldaman * EndScriptData */ #include "precompiled.h" #include "uldaman.h" enum { <API key> = 10347, SPELL_GROUND_TREMOR = 6524, <API key> = 10252, // awaken all 7076 npcs <API key> = 10258, // awaken 2 npcs 10120 <API key> = 10259, // awaken random npc 7309 or 7077 SAY_AGGRO = -1070001, SAY_AWAKE_GUARDIANS = -1070002, SAY_AWAKE_WARDERS = -1070003, SAY_UNIT_SLAIN = -1070004, EMOTE_BREAKS_FREE = -1070005, }; struct MANGOS_DLL_DECL boss_archaedasAI : public ScriptedAI { boss_archaedasAI(Creature* pCreature) : ScriptedAI(pCreature) { m_pInstance = (instance_uldaman*)pCreature->GetInstanceData(); Reset(); } instance_uldaman* m_pInstance; uint32 m_uiAwakeningTimer; uint32 m_uiAwakeDwarfTimer; uint32 m_uiTremorTimer; uint8 m_uiSubevent; bool m_bDwarvesAwaken; uint8 m_uiHpPhaseCheck; void Reset() override { m_uiAwakeningTimer = 1000; m_uiSubevent = 0; m_uiAwakeDwarfTimer = 10000; m_uiTremorTimer = urand(7000, 14000); m_bDwarvesAwaken = false; m_uiHpPhaseCheck = 1; DoCastSpellIfCan(m_creature, SPELL_FREEZE_ANIM); m_creature->SetFlag(UNIT_FIELD_FLAGS, <API key>); } void Aggro(Unit* /*pWho*/) override { if (m_pInstance) { m_pInstance->SetData(TYPE_ARCHAEDAS, IN_PROGRESS); } } void KilledUnit(Unit* /*pVictim*/) override { DoScriptText(SAY_UNIT_SLAIN, m_creature); } void JustDied(Unit* /*pKiller*/) override { // open door to vault (handled by instance script) if (m_pInstance) { m_pInstance->SetData(TYPE_ARCHAEDAS, DONE); } } void JustReachedHome() override { if (m_pInstance) { m_pInstance->SetData(TYPE_ARCHAEDAS, FAIL); } } void UpdateAI(const uint32 uiDiff) override { // so many things are based in this script on instance data // so if we don't have access to it better do nothing if (!m_pInstance) { return; } // OOC Intro part triggered by Altar activation if (m_pInstance->GetData(TYPE_ARCHAEDAS) == SPECIAL) { if (m_uiAwakeningTimer <= uiDiff) { switch (m_uiSubevent) { case 0: DoCastSpellIfCan(m_creature, <API key>); m_uiAwakeningTimer = 2000; break; case 1: DoScriptText(EMOTE_BREAKS_FREE, m_creature); m_uiAwakeningTimer = 3000; break; case 2: DoScriptText(SAY_AGGRO, m_creature); m_creature-><API key>(SPELL_FREEZE_ANIM); m_creature->RemoveFlag(UNIT_FIELD_FLAGS, <API key>); // Attack player if (Player* pPlayer = m_creature->GetMap()->GetPlayer(m_pInstance->GetGuid(DATA_EVENT_STARTER))) { AttackStart(pPlayer); } else { EnterEvadeMode(); } break; default: break; } ++m_uiSubevent; } else { m_uiAwakeningTimer -= uiDiff; } } if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) { return; } // Phase switch if (m_creature->GetHealthPercent() < 100.0f - 33.4f * (float)m_uiHpPhaseCheck) { if (DoCastSpellIfCan(m_creature, m_uiHpPhaseCheck == 1 ? <API key> : <API key>) == CAST_OK) { DoScriptText(m_uiHpPhaseCheck == 1 ? SAY_AWAKE_GUARDIANS : SAY_AWAKE_WARDERS, m_creature); ++m_uiHpPhaseCheck; } } // Awake random Dwarf if (!m_bDwarvesAwaken && m_creature->GetHealthPercent() >= 33.0f) { if (m_uiAwakeDwarfTimer < uiDiff) { if (Creature* pEarthen = m_pInstance-><API key>(m_creature)) { if (DoCastSpellIfCan(pEarthen, <API key>) == CAST_OK) { m_uiAwakeDwarfTimer = urand(9000, 12000); } } else { m_bDwarvesAwaken = true; } } else { m_uiAwakeDwarfTimer -= uiDiff; } } if (m_uiTremorTimer < uiDiff) { if (DoCastSpellIfCan(m_creature, SPELL_GROUND_TREMOR) == CAST_OK) { m_uiTremorTimer = urand(8000, 17000); } } else { m_uiTremorTimer -= uiDiff; } <API key>(); } }; CreatureAI* <API key>(Creature* pCreature) { return new boss_archaedasAI(pCreature); } bool <API key>(Unit* /*pCaster*/, uint32 uiSpellId, SpellEffectIndex uiEffIndex, Creature* pCreatureTarget, ObjectGuid /*originalCasterGuid*/) { // always check spellid and effectindex if (uiSpellId == <API key> && uiEffIndex == EFFECT_INDEX_0) { if (pCreatureTarget->GetEntry() == NPC_VAULT_WARDER) { pCreatureTarget-><API key>(SPELL_STONED); ScriptedInstance* pInstance = (ScriptedInstance*)pCreatureTarget->GetInstanceData(); if (!pInstance) { return true; } if (Creature* pArchaedas = pInstance-><API key>(NPC_ARCHAEDAS)) { pCreatureTarget->AI()->AttackStart(pArchaedas->getVictim()); } return true; } } return false; } bool <API key>(const Aura* pAura, bool bApply) { if (bApply) { return true; } if ((pAura->GetId() == <API key> || pAura->GetId() == <API key>) && pAura->GetEffIndex() == EFFECT_INDEX_0) { if (Creature* pTarget = (Creature*)pAura->GetTarget()) { pTarget-><API key>(SPELL_STONED); ScriptedInstance* pInstance = (ScriptedInstance*)pTarget->GetInstanceData(); if (!pInstance) { return true; } if (Creature* pArchaedas = pInstance-><API key>(NPC_ARCHAEDAS)) { pTarget->AI()->AttackStart(pArchaedas->getVictim()); } } } return true; } void <API key>() { Script* pNewScript; pNewScript = new Script; pNewScript->Name = "boss_archaedas"; pNewScript->GetAI = &<API key>; pNewScript->RegisterSelf(); pNewScript = new Script; pNewScript->Name = "mob_archaeras_add"; pNewScript->pEffectDummyNPC = &<API key>; pNewScript->pEffectAuraDummy = &<API key>; pNewScript->RegisterSelf(); }
# This program is distributed under the terms of the package <API key>::L10N::fr; use strict; use warnings; use base '<API key>::L10N::en_us'; use vars qw( %Lexicon ); %Lexicon = ( ## mt-static/plugins/<API key>/extension.js 'Insert Boilerplate' => 'Insérez le texte formaté', # Translate - New ## mt-static/plugins/<API key>/langs/template.js 'Boilerplate' => 'Texte formaté', # Translate - New 'Select Boilerplate' => 'Sélectionnez le texte formaté', # Translate - New ## mt-static/plugins/TinyMCE/tiny_mce/plugins/mt_fullscreen/langs/plugin.js 'Fullscreen' => 'Plein écran', ## plugins/<API key>/config.yaml 'Add the "Insert Boilerplate" button to the TinyMCE.' => 'Ajoute le bouton "Insérer du texte formaté" à TinyMCE.', # Translate - New ## plugins/<API key>/lib/<API key>/App.pm 'Cannot load boilerplate.' => 'Impossible de charger le texte formaté.', # Translate - New ## plugins/<API key>/tmpl/extension.tmpl 'Select a Boilerplate' => 'Sélectionnez un texte formaté', # Translate - New ); 1;
<?php // $Id: index.php,v 1.7.2.3 2009/08/31 22:00:00 mudrd8mz Exp $ /** * This page lists all the instances of vimoodle in a particular course * * @author Your Name <your@email.address> * @version $Id: index.php,v 1.7.2.3 2009/08/31 22:00:00 mudrd8mz Exp $ * @package mod/vimoodle */ Replace vimoodle with the name of your module and remove this line require_once(dirname(dirname(dirname(__FILE__))).'/config.php'); require_once(dirname(__FILE__).'/lib.php'); $id = required_param('id', PARAM_INT); // course if (! $course = get_record('course', 'id', $id)) { error('Course ID is incorrect'); } <API key>($course); add_to_log($course->id, 'vimoodle', 'view all', "index.php?id=$course->id", ''); Get all required stringsvimoodle $strvimoodles = get_string('modulenameplural', 'vimoodle'); $strvimoodle = get_string('modulename', 'vimoodle'); Print the header $navlinks = array(); $navlinks[] = array('name' => $strvimoodles, 'link' => '', 'type' => 'activity'); $navigation = build_navigation($navlinks); print_header_simple($strvimoodles, '', $navigation, '', '', true, '', navmenu($course)); Get all the appropriate data if (! $vimoodles = <API key>('vimoodle', $course)) { notice('There are no instances of vimoodle', "../../course/view.php?id=$course->id"); die; } Print the list of instances (your module will probably extend this) $timenow = time(); $strname = get_string('name'); $strweek = get_string('week'); $strtopic = get_string('topic'); if ($course->format == 'weeks') { $table->head = array ($strweek, $strname); $table->align = array ('center', 'left'); } else if ($course->format == 'topics') { $table->head = array ($strtopic, $strname); $table->align = array ('center', 'left', 'left', 'left'); } else { $table->head = array ($strname); $table->align = array ('left', 'left', 'left'); } foreach ($vimoodles as $vimoodle) { if (!$vimoodle->visible) { //Show dimmed if the mod is hidden $link = '<a class="dimmed" href="view.php?id='.$vimoodle->coursemodule.'">'.format_string($vimoodle->name).'</a>'; } else { //Show normal if the mod is visible $link = '<a href="view.php?id='.$vimoodle->coursemodule.'">'.format_string($vimoodle->name).'</a>'; } if ($course->format == 'weeks' or $course->format == 'topics') { $table->data[] = array ($vimoodle->section, $link); } else { $table->data[] = array ($link); } } print_heading($strvimoodles); print_table($table); Finish the page print_footer($course); ?>
#include <stdio.h> #include <math.h> #include <limits.h> #include <assert.h> #include "vpx_config.h" #include "vp8_rtcd.h" #include "./vpx_dsp_rtcd.h" #include "tokenize.h" #include "treewriter.h" #include "onyx_int.h" #include "modecosts.h" #include "encodeintra.h" #include "pickinter.h" #include "vp8/common/entropymode.h" #include "vp8/common/reconinter.h" #include "vp8/common/reconintra.h" #include "vp8/common/reconintra4x4.h" #include "vp8/common/findnearmv.h" #include "vp8/common/quant_common.h" #include "encodemb.h" #include "vp8/encoder/quantize.h" #include "vpx_dsp/variance.h" #include "mcomp.h" #include "rdopt.h" #include "vpx_mem/vpx_mem.h" #include "vp8/common/systemdependent.h" #if <API key> #include "denoising.h" #endif extern void <API key>(VP8_COMP *cpi, MACROBLOCK *x); #define MAXF(a,b) (((a) > (b)) ? (a) : (b)) typedef struct <API key> { int rate2; int rate_y; int rate_uv; int distortion2; int distortion_uv; } RATE_DISTORTION; typedef struct best_mode_struct { int yrd; int rd; int intra_rd; MB_MODE_INFO mbmode; union b_mode_info bmodes[16]; PARTITION_INFO partition; } BEST_MODE; static const int auto_speed_thresh[17] = { 1000, 200, 150, 130, 150, 125, 120, 115, 115, 115, 115, 115, 115, 115, 115, 115, 105 }; const MB_PREDICTION_MODE vp8_mode_order[MAX_MODES] = { ZEROMV, DC_PRED, NEARESTMV, NEARMV, ZEROMV, NEARESTMV, ZEROMV, NEARESTMV, NEARMV, NEARMV, V_PRED, H_PRED, TM_PRED, NEWMV, NEWMV, NEWMV, SPLITMV, SPLITMV, SPLITMV, B_PRED, }; /* This table determines the search order in reference frame priority order, * which may not necessarily match INTRA,LAST,GOLDEN,ARF */ const int vp8_ref_frame_order[MAX_MODES] = { 1, 0, 1, 1, 2, 2, 3, 3, 2, 3, 0, 0, 0, 1, 2, 3, 1, 2, 3, 0, }; static void fill_token_costs( int c[BLOCK_TYPES][COEF_BANDS][PREV_COEF_CONTEXTS][MAX_ENTROPY_TOKENS], const vp8_prob p[BLOCK_TYPES][COEF_BANDS][PREV_COEF_CONTEXTS][ENTROPY_NODES] ) { int i, j, k; for (i = 0; i < BLOCK_TYPES; i++) for (j = 0; j < COEF_BANDS; j++) for (k = 0; k < PREV_COEF_CONTEXTS; k++) /* check for pt=0 and band > 1 if block type 0 * and 0 if blocktype 1 */ if (k == 0 && j > (i == 0)) vp8_cost_tokens2(c[i][j][k], p [i][j][k], vp8_coef_tree, 2); else vp8_cost_tokens(c[i][j][k], p [i][j][k], vp8_coef_tree); } static const int rd_iifactor[32] = { 4, 4, 3, 2, 1, 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 }; /* values are now correlated to quantizer */ static const int sad_per_bit16lut[QINDEX_RANGE] = { 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 10, 10, 10, 10, 10, 10, 10, 10, 11, 11, 11, 11, 11, 11, 12, 12, 12, 12, 12, 12, 13, 13, 13, 13, 14, 14 }; static const int sad_per_bit4lut[QINDEX_RANGE] = { 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 8, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 10, 10, 10, 10, 10, 10, 10, 10, 11, 11, 11, 11, 11, 11, 11, 11, 12, 12, 12, 12, 12, 12, 12, 12, 13, 13, 13, 13, 13, 13, 13, 14, 14, 14, 14, 14, 15, 15, 15, 15, 16, 16, 16, 16, 17, 17, 17, 18, 18, 18, 19, 19, 19, 20, 20, 20, }; void <API key>(VP8_COMP *cpi, int QIndex) { cpi->mb.sadperbit16 = sad_per_bit16lut[QIndex]; cpi->mb.sadperbit4 = sad_per_bit4lut[QIndex]; } void <API key>(VP8_COMP *cpi, MACROBLOCK *x, int Qvalue) { int q; int i; double capped_q = (Qvalue < 160) ? (double)Qvalue : 160.0; double rdconst = 2.80; <API key>(); /* Further tests required to see if optimum is different * for key frames, golden frames and arf frames. */ cpi->RDMULT = (int)(rdconst * (capped_q * capped_q)); /* Extend rate multiplier along side quantizer zbin increases */ if (cpi->mb.zbin_over_quant > 0) { double oq_factor; double modq; /* Experimental code using the same basic equation as used for Q above * The units of cpi->mb.zbin_over_quant are 1/128 of Q bin size */ oq_factor = 1.0 + ((double)0.0015625 * cpi->mb.zbin_over_quant); modq = (int)((double)capped_q * oq_factor); cpi->RDMULT = (int)(rdconst * (modq * modq)); } if (cpi->pass == 2 && (cpi->common.frame_type != KEY_FRAME)) { if (cpi->twopass.next_iiratio > 31) cpi->RDMULT += (cpi->RDMULT * rd_iifactor[31]) >> 4; else cpi->RDMULT += (cpi->RDMULT * rd_iifactor[cpi->twopass.next_iiratio]) >> 4; } cpi->mb.errorperbit = (cpi->RDMULT / 110); cpi->mb.errorperbit += (cpi->mb.errorperbit==0); <API key>(cpi); for (i = 0; i < MAX_MODES; i++) { x-><API key>[i] = 0; } q = (int)pow(Qvalue, 1.25); if (q < 8) q = 8; if (cpi->RDMULT > 1000) { cpi->RDDIV = 1; cpi->RDMULT /= 100; for (i = 0; i < MAX_MODES; i++) { if (cpi->sf.thresh_mult[i] < INT_MAX) { x->rd_threshes[i] = cpi->sf.thresh_mult[i] * q / 100; } else { x->rd_threshes[i] = INT_MAX; } cpi->rd_baseline_thresh[i] = x->rd_threshes[i]; } } else { cpi->RDDIV = 100; for (i = 0; i < MAX_MODES; i++) { if (cpi->sf.thresh_mult[i] < (INT_MAX / q)) { x->rd_threshes[i] = cpi->sf.thresh_mult[i] * q; } else { x->rd_threshes[i] = INT_MAX; } cpi->rd_baseline_thresh[i] = x->rd_threshes[i]; } } { /* build token cost array for the type of frame we have now */ FRAME_CONTEXT *l = &cpi->lfc_n; if(cpi->common.<API key>) l = &cpi->lfc_a; else if(cpi->common.<API key>) l = &cpi->lfc_g; fill_token_costs( cpi->mb.token_costs, (const vp8_prob( *)[8][3][11]) l->coef_probs ); /* fill_token_costs( cpi->mb.token_costs, (const vp8_prob( *)[8][3][11]) cpi->common.fc.coef_probs); */ /* TODO make these mode costs depend on last,alt or gold too. (jbb) */ vp8_init_mode_costs(cpi); } } void <API key>(VP8_COMP *cpi) { int <API key> = (int)(1000000 / cpi->framerate); <API key> = <API key> * (16 - cpi->oxcf.cpu_used) / 16; #if 0 if (0) { FILE *f; f = fopen("speed.stt", "a"); fprintf(f, " %8ld %10ld %10ld %10ld\n", cpi->common.current_video_frame, cpi->Speed, <API key>, cpi->avg_pick_mode_time); fclose(f); } #endif if (cpi->avg_pick_mode_time < <API key> && (cpi->avg_encode_time - cpi->avg_pick_mode_time) < <API key>) { if (cpi->avg_pick_mode_time == 0) { cpi->Speed = 4; } else { if (<API key> * 100 < cpi->avg_encode_time * 95) { cpi->Speed += 2; cpi->avg_pick_mode_time = 0; cpi->avg_encode_time = 0; if (cpi->Speed > 16) { cpi->Speed = 16; } } if (<API key> * 100 > cpi->avg_encode_time * auto_speed_thresh[cpi->Speed]) { cpi->Speed -= 1; cpi->avg_pick_mode_time = 0; cpi->avg_encode_time = 0; /* In real-time mode, cpi->speed is in [4, 16]. */ if (cpi->Speed < 4) { cpi->Speed = 4; } } } } else { cpi->Speed += 4; if (cpi->Speed > 16) cpi->Speed = 16; cpi->avg_pick_mode_time = 0; cpi->avg_encode_time = 0; } } int vp8_block_error_c(short *coeff, short *dqcoeff) { int i; int error = 0; for (i = 0; i < 16; i++) { int this_diff = coeff[i] - dqcoeff[i]; error += this_diff * this_diff; } return error; } int vp8_mbblock_error_c(MACROBLOCK *mb, int dc) { BLOCK *be; BLOCKD *bd; int i, j; int berror, error = 0; for (i = 0; i < 16; i++) { be = &mb->block[i]; bd = &mb->e_mbd.block[i]; berror = 0; for (j = dc; j < 16; j++) { int this_diff = be->coeff[j] - bd->dqcoeff[j]; berror += this_diff * this_diff; } error += berror; } return error; } int vp8_mbuverror_c(MACROBLOCK *mb) { BLOCK *be; BLOCKD *bd; int i; int error = 0; for (i = 16; i < 24; i++) { be = &mb->block[i]; bd = &mb->e_mbd.block[i]; error += vp8_block_error_c(be->coeff, bd->dqcoeff); } return error; } int VP8_UVSSE(MACROBLOCK *x) { unsigned char *uptr, *vptr; unsigned char *upred_ptr = (*(x->block[16].base_src) + x->block[16].src); unsigned char *vpred_ptr = (*(x->block[20].base_src) + x->block[20].src); int uv_stride = x->block[16].src_stride; unsigned int sse1 = 0; unsigned int sse2 = 0; int mv_row = x->e_mbd.mode_info_context->mbmi.mv.as_mv.row; int mv_col = x->e_mbd.mode_info_context->mbmi.mv.as_mv.col; int offset; int pre_stride = x->e_mbd.pre.uv_stride; if (mv_row < 0) mv_row -= 1; else mv_row += 1; if (mv_col < 0) mv_col -= 1; else mv_col += 1; mv_row /= 2; mv_col /= 2; offset = (mv_row >> 3) * pre_stride + (mv_col >> 3); uptr = x->e_mbd.pre.u_buffer + offset; vptr = x->e_mbd.pre.v_buffer + offset; if ((mv_row | mv_col) & 7) { <API key>(uptr, pre_stride, mv_col & 7, mv_row & 7, upred_ptr, uv_stride, &sse2); <API key>(vptr, pre_stride, mv_col & 7, mv_row & 7, vpred_ptr, uv_stride, &sse1); sse2 += sse1; } else { vpx_variance8x8(uptr, pre_stride, upred_ptr, uv_stride, &sse2); vpx_variance8x8(vptr, pre_stride, vpred_ptr, uv_stride, &sse1); sse2 += sse1; } return sse2; } static int cost_coeffs(MACROBLOCK *mb, BLOCKD *b, int type, ENTROPY_CONTEXT *a, ENTROPY_CONTEXT *l) { int c = !type; /* start at coef 0, unless Y with Y2 */ int eob = (int)(*b->eob); int pt ; /* surrounding block/prev coef predictor */ int cost = 0; short *qcoeff_ptr = b->qcoeff; <API key>(pt, *a, *l); assert(eob <= 16); for (; c < eob; c++) { const int v = qcoeff_ptr[<API key>[c]]; const int t = <API key>[v].Token; cost += mb->token_costs [type] [vp8_coef_bands[c]] [pt] [t]; cost += <API key>[v]; pt = <API key>[t]; } if (c < 16) cost += mb->token_costs [type] [vp8_coef_bands[c]] [pt] [DCT_EOB_TOKEN]; pt = (c != !type); /* is eob first coefficient; */ *a = *l = pt; return cost; } static int vp8_rdcost_mby(MACROBLOCK *mb) { int cost = 0; int b; MACROBLOCKD *x = &mb->e_mbd; <API key> t_above, t_left; ENTROPY_CONTEXT *ta; ENTROPY_CONTEXT *tl; memcpy(&t_above, mb->e_mbd.above_context, sizeof(<API key>)); memcpy(&t_left, mb->e_mbd.left_context, sizeof(<API key>)); ta = (ENTROPY_CONTEXT *)&t_above; tl = (ENTROPY_CONTEXT *)&t_left; for (b = 0; b < 16; b++) cost += cost_coeffs(mb, x->block + b, PLANE_TYPE_Y_NO_DC, ta + vp8_block2above[b], tl + vp8_block2left[b]); cost += cost_coeffs(mb, x->block + 24, PLANE_TYPE_Y2, ta + vp8_block2above[24], tl + vp8_block2left[24]); return cost; } static void macro_block_yrd( MACROBLOCK *mb, int *Rate, int *Distortion) { int b; MACROBLOCKD *const x = &mb->e_mbd; BLOCK *const mb_y2 = mb->block + 24; BLOCKD *const x_y2 = x->block + 24; short *Y2DCPtr = mb_y2->src_diff; BLOCK *beptr; int d; vp8_subtract_mby( mb->src_diff, *(mb->block[0].base_src), mb->block[0].src_stride, mb->e_mbd.predictor, 16); /* Fdct and building the 2nd order block */ for (beptr = mb->block; beptr < mb->block + 16; beptr += 2) { mb->short_fdct8x4(beptr->src_diff, beptr->coeff, 32); *Y2DCPtr++ = beptr->coeff[0]; *Y2DCPtr++ = beptr->coeff[16]; } /* 2nd order fdct */ mb->short_walsh4x4(mb_y2->src_diff, mb_y2->coeff, 8); /* Quantization */ for (b = 0; b < 16; b++) { mb->quantize_b(&mb->block[b], &mb->e_mbd.block[b]); } /* DC predication and Quantization of 2nd Order block */ mb->quantize_b(mb_y2, x_y2); /* Distortion */ d = vp8_mbblock_error(mb, 1) << 2; d += vp8_block_error(mb_y2->coeff, x_y2->dqcoeff); *Distortion = (d >> 4); /* rate */ *Rate = vp8_rdcost_mby(mb); } static void copy_predictor(unsigned char *dst, const unsigned char *predictor) { const unsigned int *p = (const unsigned int *)predictor; unsigned int *d = (unsigned int *)dst; d[0] = p[0]; d[4] = p[4]; d[8] = p[8]; d[12] = p[12]; } static int <API key>( MACROBLOCK *x, BLOCK *be, BLOCKD *b, B_PREDICTION_MODE *best_mode, const int *bmode_costs, ENTROPY_CONTEXT *a, ENTROPY_CONTEXT *l, int *bestrate, int *bestratey, int *bestdistortion) { B_PREDICTION_MODE mode; int best_rd = INT_MAX; int rate = 0; int distortion; ENTROPY_CONTEXT ta = *a, tempa = *a; ENTROPY_CONTEXT tl = *l, templ = *l; /* * The predictor buffer is a 2d buffer with a stride of 16. Create * a temp buffer that meets the stride requirements, but we are only * interested in the left 4x4 block * */ DECLARE_ALIGNED(16, unsigned char, best_predictor[16*4]); DECLARE_ALIGNED(16, short, best_dqcoeff[16]); int dst_stride = x->e_mbd.dst.y_stride; unsigned char *dst = x->e_mbd.dst.y_buffer + b->offset; unsigned char *Above = dst - dst_stride; unsigned char *yleft = dst - 1; unsigned char top_left = Above[-1]; for (mode = B_DC_PRED; mode <= B_HU_PRED; mode++) { int this_rd; int ratey; rate = bmode_costs[mode]; <API key>(Above, yleft, dst_stride, mode, b->predictor, 16, top_left); vp8_subtract_b(be, b, 16); x->short_fdct4x4(be->src_diff, be->coeff, 32); x->quantize_b(be, b); tempa = ta; templ = tl; ratey = cost_coeffs(x, b, <API key>, &tempa, &templ); rate += ratey; distortion = vp8_block_error(be->coeff, b->dqcoeff) >> 2; this_rd = RDCOST(x->rdmult, x->rddiv, rate, distortion); if (this_rd < best_rd) { *bestrate = rate; *bestratey = ratey; *bestdistortion = distortion; best_rd = this_rd; *best_mode = mode; *a = tempa; *l = templ; copy_predictor(best_predictor, b->predictor); memcpy(best_dqcoeff, b->dqcoeff, 32); } } b->bmi.as_mode = *best_mode; <API key>(best_dqcoeff, best_predictor, 16, dst, dst_stride); return best_rd; } static int <API key>(MACROBLOCK *mb, int *Rate, int *rate_y, int *Distortion, int best_rd) { MACROBLOCKD *const xd = &mb->e_mbd; int i; int cost = mb->mbmode_cost [xd->frame_type] [B_PRED]; int distortion = 0; int tot_rate_y = 0; int64_t total_rd = 0; <API key> t_above, t_left; ENTROPY_CONTEXT *ta; ENTROPY_CONTEXT *tl; const int *bmode_costs; memcpy(&t_above, mb->e_mbd.above_context, sizeof(<API key>)); memcpy(&t_left, mb->e_mbd.left_context, sizeof(<API key>)); ta = (ENTROPY_CONTEXT *)&t_above; tl = (ENTROPY_CONTEXT *)&t_left; <API key>(xd, xd->dst.y_buffer - xd->dst.y_stride + 16); bmode_costs = mb->inter_bmode_costs; for (i = 0; i < 16; i++) { MODE_INFO *const mic = xd->mode_info_context; const int mis = xd->mode_info_stride; B_PREDICTION_MODE <API key>(best_mode); int <API key>(r), <API key>(ry), <API key>(d); if (mb->e_mbd.frame_type == KEY_FRAME) { const B_PREDICTION_MODE A = above_block_mode(mic, i, mis); const B_PREDICTION_MODE L = left_block_mode(mic, i); bmode_costs = mb->bmode_costs[A][L]; } total_rd += <API key>( mb, mb->block + i, xd->block + i, &best_mode, bmode_costs, ta + vp8_block2above[i], tl + vp8_block2left[i], &r, &ry, &d); cost += r; distortion += d; tot_rate_y += ry; mic->bmi[i].as_mode = best_mode; if(total_rd >= (int64_t)best_rd) break; } if(total_rd >= (int64_t)best_rd) return INT_MAX; *Rate = cost; *rate_y = tot_rate_y; *Distortion = distortion; return RDCOST(mb->rdmult, mb->rddiv, cost, distortion); } static int <API key>(MACROBLOCK *x, int *Rate, int *rate_y, int *Distortion) { MB_PREDICTION_MODE mode; MB_PREDICTION_MODE <API key>(mode_selected); int rate, ratey; int distortion; int best_rd = INT_MAX; int this_rd; MACROBLOCKD *xd = &x->e_mbd; /* Y Search for 16x16 intra prediction mode */ for (mode = DC_PRED; mode <= TM_PRED; mode++) { xd->mode_info_context->mbmi.mode = mode; <API key>(xd, xd->dst.y_buffer - xd->dst.y_stride, xd->dst.y_buffer - 1, xd->dst.y_stride, xd->predictor, 16); macro_block_yrd(x, &ratey, &distortion); rate = ratey + x->mbmode_cost[xd->frame_type] [xd->mode_info_context->mbmi.mode]; this_rd = RDCOST(x->rdmult, x->rddiv, rate, distortion); if (this_rd < best_rd) { mode_selected = mode; best_rd = this_rd; *Rate = rate; *rate_y = ratey; *Distortion = distortion; } } xd->mode_info_context->mbmi.mode = mode_selected; return best_rd; } static int rd_cost_mbuv(MACROBLOCK *mb) { int b; int cost = 0; MACROBLOCKD *x = &mb->e_mbd; <API key> t_above, t_left; ENTROPY_CONTEXT *ta; ENTROPY_CONTEXT *tl; memcpy(&t_above, mb->e_mbd.above_context, sizeof(<API key>)); memcpy(&t_left, mb->e_mbd.left_context, sizeof(<API key>)); ta = (ENTROPY_CONTEXT *)&t_above; tl = (ENTROPY_CONTEXT *)&t_left; for (b = 16; b < 24; b++) cost += cost_coeffs(mb, x->block + b, PLANE_TYPE_UV, ta + vp8_block2above[b], tl + vp8_block2left[b]); return cost; } static int rd_inter16x16_uv(VP8_COMP *cpi, MACROBLOCK *x, int *rate, int *distortion, int fullpixel) { (void)cpi; (void)fullpixel; <API key>(&x->e_mbd); vp8_subtract_mbuv(x->src_diff, x->src.u_buffer, x->src.v_buffer, x->src.uv_stride, &x->e_mbd.predictor[256], &x->e_mbd.predictor[320], 8); vp8_transform_mbuv(x); vp8_quantize_mbuv(x); *rate = rd_cost_mbuv(x); *distortion = vp8_mbuverror(x) / 4; return RDCOST(x->rdmult, x->rddiv, *rate, *distortion); } static int rd_inter4x4_uv(VP8_COMP *cpi, MACROBLOCK *x, int *rate, int *distortion, int fullpixel) { (void)cpi; (void)fullpixel; <API key>(&x->e_mbd); vp8_subtract_mbuv(x->src_diff, x->src.u_buffer, x->src.v_buffer, x->src.uv_stride, &x->e_mbd.predictor[256], &x->e_mbd.predictor[320], 8); vp8_transform_mbuv(x); vp8_quantize_mbuv(x); *rate = rd_cost_mbuv(x); *distortion = vp8_mbuverror(x) / 4; return RDCOST(x->rdmult, x->rddiv, *rate, *distortion); } static void <API key>(MACROBLOCK *x, int *rate, int *rate_tokenonly, int *distortion) { MB_PREDICTION_MODE mode; MB_PREDICTION_MODE <API key>(mode_selected); int best_rd = INT_MAX; int <API key>(d), <API key>(r); int rate_to; MACROBLOCKD *xd = &x->e_mbd; for (mode = DC_PRED; mode <= TM_PRED; mode++) { int this_rate; int this_distortion; int this_rd; xd->mode_info_context->mbmi.uv_mode = mode; <API key>(xd, xd->dst.u_buffer - xd->dst.uv_stride, xd->dst.v_buffer - xd->dst.uv_stride, xd->dst.u_buffer - 1, xd->dst.v_buffer - 1, xd->dst.uv_stride, &xd->predictor[256], &xd->predictor[320], 8); vp8_subtract_mbuv(x->src_diff, x->src.u_buffer, x->src.v_buffer, x->src.uv_stride, &xd->predictor[256], &xd->predictor[320], 8); vp8_transform_mbuv(x); vp8_quantize_mbuv(x); rate_to = rd_cost_mbuv(x); this_rate = rate_to + x->intra_uv_mode_cost[xd->frame_type][xd->mode_info_context->mbmi.uv_mode]; this_distortion = vp8_mbuverror(x) / 4; this_rd = RDCOST(x->rdmult, x->rddiv, this_rate, this_distortion); if (this_rd < best_rd) { best_rd = this_rd; d = this_distortion; r = this_rate; *rate_tokenonly = rate_to; mode_selected = mode; } } *rate = r; *distortion = d; xd->mode_info_context->mbmi.uv_mode = mode_selected; } int vp8_cost_mv_ref(MB_PREDICTION_MODE m, const int near_mv_ref_ct[4]) { vp8_prob p [VP8_MVREFS-1]; assert(NEARESTMV <= m && m <= SPLITMV); vp8_mv_ref_probs(p, near_mv_ref_ct); return vp8_cost_token(vp8_mv_ref_tree, p, <API key> + (m - NEARESTMV)); } void <API key>(MACROBLOCK *x, MB_PREDICTION_MODE mb, int_mv *mv) { x->e_mbd.mode_info_context->mbmi.mode = mb; x->e_mbd.mode_info_context->mbmi.mv.as_int = mv->as_int; } static int labels2mode( MACROBLOCK *x, int const *labelings, int which_label, B_PREDICTION_MODE this_mode, int_mv *this_mv, int_mv *best_ref_mv, int *mvcost[2] ) { MACROBLOCKD *const xd = & x->e_mbd; MODE_INFO *const mic = xd->mode_info_context; const int mis = xd->mode_info_stride; int cost = 0; int thismvcost = 0; /* We have to be careful retrieving previously-encoded motion vectors. Ones from this macroblock have to be pulled from the BLOCKD array as they have not yet made it to the bmi array in our MB_MODE_INFO. */ int i = 0; do { BLOCKD *const d = xd->block + i; const int row = i >> 2, col = i & 3; B_PREDICTION_MODE m; if (labelings[i] != which_label) continue; if (col && labelings[i] == labelings[i-1]) m = LEFT4X4; else if (row && labelings[i] == labelings[i-4]) m = ABOVE4X4; else { /* the only time we should do costing for new motion vector * or mode is when we are on a new label (jbb May 08, 2007) */ switch (m = this_mode) { case NEW4X4 : thismvcost = vp8_mv_bit_cost(this_mv, best_ref_mv, mvcost, 102); break; case LEFT4X4: this_mv->as_int = col ? d[-1].bmi.mv.as_int : left_block_mv(mic, i); break; case ABOVE4X4: this_mv->as_int = row ? d[-4].bmi.mv.as_int : above_block_mv(mic, i, mis); break; case ZERO4X4: this_mv->as_int = 0; break; default: break; } if (m == ABOVE4X4) /* replace above with left if same */ { int_mv left_mv; left_mv.as_int = col ? d[-1].bmi.mv.as_int : left_block_mv(mic, i); if (left_mv.as_int == this_mv->as_int) m = LEFT4X4; } cost = x->inter_bmode_costs[ m]; } d->bmi.mv.as_int = this_mv->as_int; x->partition_info->bmi[i].mode = m; x->partition_info->bmi[i].mv.as_int = this_mv->as_int; } while (++i < 16); cost += thismvcost ; return cost; } static int rdcost_mbsegment_y(MACROBLOCK *mb, const int *labels, int which_label, ENTROPY_CONTEXT *ta, ENTROPY_CONTEXT *tl) { int cost = 0; int b; MACROBLOCKD *x = &mb->e_mbd; for (b = 0; b < 16; b++) if (labels[ b] == which_label) cost += cost_coeffs(mb, x->block + b, <API key>, ta + vp8_block2above[b], tl + vp8_block2left[b]); return cost; } static unsigned int <API key>(MACROBLOCK *x, int const *labels, int which_label) { int i; unsigned int distortion = 0; int pre_stride = x->e_mbd.pre.y_stride; unsigned char *base_pre = x->e_mbd.pre.y_buffer; for (i = 0; i < 16; i++) { if (labels[i] == which_label) { BLOCKD *bd = &x->e_mbd.block[i]; BLOCK *be = &x->block[i]; <API key>(bd, 16, base_pre, pre_stride, x->e_mbd.subpixel_predict); vp8_subtract_b(be, bd, 16); x->short_fdct4x4(be->src_diff, be->coeff, 32); x->quantize_b(be, bd); distortion += vp8_block_error(be->coeff, bd->dqcoeff); } } return distortion; } static const unsigned int <API key>[4] = {3, 3, 2, 0}; typedef struct { int_mv *ref_mv; int_mv mvp; int segment_rd; int segment_num; int r; int d; int segment_yrate; B_PREDICTION_MODE modes[16]; int_mv mvs[16]; unsigned char eobs[16]; int mvthresh; int *mdcounts; int_mv sv_mvp[4]; /* save 4 mvp from 8x8 */ int sv_istep[2]; /* save 2 initial step_param for 16x8/8x16 */ } BEST_SEG_INFO; static void rd_check_segment(VP8_COMP *cpi, MACROBLOCK *x, BEST_SEG_INFO *bsi, unsigned int segmentation) { int i; int const *labels; int br = 0; int bd = 0; B_PREDICTION_MODE this_mode; int label_count; int this_segment_rd = 0; int label_mv_thresh; int rate = 0; int sbr = 0; int sbd = 0; int segmentyrate = 0; <API key> *v_fn_ptr; <API key> t_above, t_left; ENTROPY_CONTEXT *ta; ENTROPY_CONTEXT *tl; <API key> t_above_b, t_left_b; ENTROPY_CONTEXT *ta_b; ENTROPY_CONTEXT *tl_b; memcpy(&t_above, x->e_mbd.above_context, sizeof(<API key>)); memcpy(&t_left, x->e_mbd.left_context, sizeof(<API key>)); ta = (ENTROPY_CONTEXT *)&t_above; tl = (ENTROPY_CONTEXT *)&t_left; ta_b = (ENTROPY_CONTEXT *)&t_above_b; tl_b = (ENTROPY_CONTEXT *)&t_left_b; br = 0; bd = 0; v_fn_ptr = &cpi->fn_ptr[segmentation]; labels = vp8_mbsplits[segmentation]; label_count = vp8_mbsplit_count[segmentation]; /* 64 makes this threshold really big effectively making it so that we * very rarely check mvs on segments. setting this to 1 would make mv * thresh roughly equal to what it is for macroblocks */ label_mv_thresh = 1 * bsi->mvthresh / label_count ; /* Segmentation method overheads */ rate = vp8_cost_token(vp8_mbsplit_tree, vp8_mbsplit_probs, <API key> + segmentation); rate += vp8_cost_mv_ref(SPLITMV, bsi->mdcounts); this_segment_rd += RDCOST(x->rdmult, x->rddiv, rate, 0); br += rate; for (i = 0; i < label_count; i++) { int_mv mode_mv[B_MODE_COUNT]; int best_label_rd = INT_MAX; B_PREDICTION_MODE mode_selected = ZERO4X4; int bestlabelyrate = 0; /* search for the best motion vector on this segment */ for (this_mode = LEFT4X4; this_mode <= NEW4X4 ; this_mode ++) { int this_rd; int distortion; int labelyrate; <API key> t_above_s, t_left_s; ENTROPY_CONTEXT *ta_s; ENTROPY_CONTEXT *tl_s; memcpy(&t_above_s, &t_above, sizeof(<API key>)); memcpy(&t_left_s, &t_left, sizeof(<API key>)); ta_s = (ENTROPY_CONTEXT *)&t_above_s; tl_s = (ENTROPY_CONTEXT *)&t_left_s; if (this_mode == NEW4X4) { int sseshift; int num00; int step_param = 0; int further_steps; int n; int thissme; int bestsme = INT_MAX; int_mv temp_mv; BLOCK *c; BLOCKD *e; /* Is the best so far sufficiently good that we cant justify * doing a new motion search. */ if (best_label_rd < label_mv_thresh) break; if(cpi->compressor_speed) { if (segmentation == BLOCK_8X16 || segmentation == BLOCK_16X8) { bsi->mvp.as_int = bsi->sv_mvp[i].as_int; if (i==1 && segmentation == BLOCK_16X8) bsi->mvp.as_int = bsi->sv_mvp[2].as_int; step_param = bsi->sv_istep[i]; } /* use previous block's result as next block's MV * predictor. */ if (segmentation == BLOCK_4X4 && i>0) { bsi->mvp.as_int = x->e_mbd.block[i-1].bmi.mv.as_int; if (i==4 || i==8 || i==12) bsi->mvp.as_int = x->e_mbd.block[i-4].bmi.mv.as_int; step_param = 2; } } further_steps = (MAX_MVSEARCH_STEPS - 1) - step_param; { int sadpb = x->sadperbit4; int_mv mvp_full; mvp_full.as_mv.row = bsi->mvp.as_mv.row >>3; mvp_full.as_mv.col = bsi->mvp.as_mv.col >>3; /* find first label */ n = vp8_mbsplit_offset[segmentation][i]; c = &x->block[n]; e = &x->e_mbd.block[n]; { bestsme = cpi->diamond_search_sad(x, c, e, &mvp_full, &mode_mv[NEW4X4], step_param, sadpb, &num00, v_fn_ptr, x->mvcost, bsi->ref_mv); n = num00; num00 = 0; while (n < further_steps) { n++; if (num00) num00 else { thissme = cpi->diamond_search_sad(x, c, e, &mvp_full, &temp_mv, step_param + n, sadpb, &num00, v_fn_ptr, x->mvcost, bsi->ref_mv); if (thissme < bestsme) { bestsme = thissme; mode_mv[NEW4X4].as_int = temp_mv.as_int; } } } } sseshift = <API key>[segmentation]; /* Should we do a full search (best quality only) */ if ((cpi->compressor_speed == 0) && (bestsme >> sseshift) > 4000) { /* Check if mvp_full is within the range. */ vp8_clamp_mv(&mvp_full, x->mv_col_min, x->mv_col_max, x->mv_row_min, x->mv_row_max); thissme = cpi->full_search_sad(x, c, e, &mvp_full, sadpb, 16, v_fn_ptr, x->mvcost, bsi->ref_mv); if (thissme < bestsme) { bestsme = thissme; mode_mv[NEW4X4].as_int = e->bmi.mv.as_int; } else { /* The full search result is actually worse so * re-instate the previous best vector */ e->bmi.mv.as_int = mode_mv[NEW4X4].as_int; } } } if (bestsme < INT_MAX) { int disto; unsigned int sse; cpi-><API key>(x, c, e, &mode_mv[NEW4X4], bsi->ref_mv, x->errorperbit, v_fn_ptr, x->mvcost, &disto, &sse); } } /* NEW4X4 */ rate = labels2mode(x, labels, i, this_mode, &mode_mv[this_mode], bsi->ref_mv, x->mvcost); /* Trap vectors that reach beyond the UMV borders */ if (((mode_mv[this_mode].as_mv.row >> 3) < x->mv_row_min) || ((mode_mv[this_mode].as_mv.row >> 3) > x->mv_row_max) || ((mode_mv[this_mode].as_mv.col >> 3) < x->mv_col_min) || ((mode_mv[this_mode].as_mv.col >> 3) > x->mv_col_max)) { continue; } distortion = <API key>(x, labels, i) / 4; labelyrate = rdcost_mbsegment_y(x, labels, i, ta_s, tl_s); rate += labelyrate; this_rd = RDCOST(x->rdmult, x->rddiv, rate, distortion); if (this_rd < best_label_rd) { sbr = rate; sbd = distortion; bestlabelyrate = labelyrate; mode_selected = this_mode; best_label_rd = this_rd; memcpy(ta_b, ta_s, sizeof(<API key>)); memcpy(tl_b, tl_s, sizeof(<API key>)); } } /*for each 4x4 mode*/ memcpy(ta, ta_b, sizeof(<API key>)); memcpy(tl, tl_b, sizeof(<API key>)); labels2mode(x, labels, i, mode_selected, &mode_mv[mode_selected], bsi->ref_mv, x->mvcost); br += sbr; bd += sbd; segmentyrate += bestlabelyrate; this_segment_rd += best_label_rd; if (this_segment_rd >= bsi->segment_rd) break; } /* for each label */ if (this_segment_rd < bsi->segment_rd) { bsi->r = br; bsi->d = bd; bsi->segment_yrate = segmentyrate; bsi->segment_rd = this_segment_rd; bsi->segment_num = segmentation; /* store everything needed to come back to this!! */ for (i = 0; i < 16; i++) { bsi->mvs[i].as_mv = x->partition_info->bmi[i].mv.as_mv; bsi->modes[i] = x->partition_info->bmi[i].mode; bsi->eobs[i] = x->e_mbd.eobs[i]; } } } static void vp8_cal_step_param(int sr, int *sp) { int step = 0; if (sr > MAX_FIRST_STEP) sr = MAX_FIRST_STEP; else if (sr < 1) sr = 1; while (sr>>=1) step++; *sp = MAX_MVSEARCH_STEPS - 1 - step; } static int <API key>(VP8_COMP *cpi, MACROBLOCK *x, int_mv *best_ref_mv, int best_rd, int *mdcounts, int *returntotrate, int *returnyrate, int *returndistortion, int mvthresh) { int i; BEST_SEG_INFO bsi; memset(&bsi, 0, sizeof(bsi)); bsi.segment_rd = best_rd; bsi.ref_mv = best_ref_mv; bsi.mvp.as_int = best_ref_mv->as_int; bsi.mvthresh = mvthresh; bsi.mdcounts = mdcounts; for(i = 0; i < 16; i++) { bsi.modes[i] = ZERO4X4; } if(cpi->compressor_speed == 0) { /* for now, we will keep the original segmentation order when in best quality mode */ rd_check_segment(cpi, x, &bsi, BLOCK_16X8); rd_check_segment(cpi, x, &bsi, BLOCK_8X16); rd_check_segment(cpi, x, &bsi, BLOCK_8X8); rd_check_segment(cpi, x, &bsi, BLOCK_4X4); } else { int sr; rd_check_segment(cpi, x, &bsi, BLOCK_8X8); if (bsi.segment_rd < best_rd) { int col_min = ((best_ref_mv->as_mv.col+7)>>3) - MAX_FULL_PEL_VAL; int row_min = ((best_ref_mv->as_mv.row+7)>>3) - MAX_FULL_PEL_VAL; int col_max = (best_ref_mv->as_mv.col>>3) + MAX_FULL_PEL_VAL; int row_max = (best_ref_mv->as_mv.row>>3) + MAX_FULL_PEL_VAL; int tmp_col_min = x->mv_col_min; int tmp_col_max = x->mv_col_max; int tmp_row_min = x->mv_row_min; int tmp_row_max = x->mv_row_max; /* Get intersection of UMV window and valid MV window to reduce # of checks in diamond search. */ if (x->mv_col_min < col_min ) x->mv_col_min = col_min; if (x->mv_col_max > col_max ) x->mv_col_max = col_max; if (x->mv_row_min < row_min ) x->mv_row_min = row_min; if (x->mv_row_max > row_max ) x->mv_row_max = row_max; /* Get 8x8 result */ bsi.sv_mvp[0].as_int = bsi.mvs[0].as_int; bsi.sv_mvp[1].as_int = bsi.mvs[2].as_int; bsi.sv_mvp[2].as_int = bsi.mvs[8].as_int; bsi.sv_mvp[3].as_int = bsi.mvs[10].as_int; /* Use 8x8 result as 16x8/8x16's predictor MV. Adjust search range according to the closeness of 2 MV. */ /* block 8X16 */ { sr = MAXF((abs(bsi.sv_mvp[0].as_mv.row - bsi.sv_mvp[2].as_mv.row))>>3, (abs(bsi.sv_mvp[0].as_mv.col - bsi.sv_mvp[2].as_mv.col))>>3); vp8_cal_step_param(sr, &bsi.sv_istep[0]); sr = MAXF((abs(bsi.sv_mvp[1].as_mv.row - bsi.sv_mvp[3].as_mv.row))>>3, (abs(bsi.sv_mvp[1].as_mv.col - bsi.sv_mvp[3].as_mv.col))>>3); vp8_cal_step_param(sr, &bsi.sv_istep[1]); rd_check_segment(cpi, x, &bsi, BLOCK_8X16); } /* block 16X8 */ { sr = MAXF((abs(bsi.sv_mvp[0].as_mv.row - bsi.sv_mvp[1].as_mv.row))>>3, (abs(bsi.sv_mvp[0].as_mv.col - bsi.sv_mvp[1].as_mv.col))>>3); vp8_cal_step_param(sr, &bsi.sv_istep[0]); sr = MAXF((abs(bsi.sv_mvp[2].as_mv.row - bsi.sv_mvp[3].as_mv.row))>>3, (abs(bsi.sv_mvp[2].as_mv.col - bsi.sv_mvp[3].as_mv.col))>>3); vp8_cal_step_param(sr, &bsi.sv_istep[1]); rd_check_segment(cpi, x, &bsi, BLOCK_16X8); } /* If 8x8 is better than 16x8/8x16, then do 4x4 search */ /* Not skip 4x4 if speed=0 (good quality) */ if (cpi->sf.<API key> || bsi.segment_num == BLOCK_8X8) /* || (<API key>.segment_rd) < sv_segment_rd8x8>>5) */ { bsi.mvp.as_int = bsi.sv_mvp[0].as_int; rd_check_segment(cpi, x, &bsi, BLOCK_4X4); } /* restore UMV window */ x->mv_col_min = tmp_col_min; x->mv_col_max = tmp_col_max; x->mv_row_min = tmp_row_min; x->mv_row_max = tmp_row_max; } } /* set it to the best */ for (i = 0; i < 16; i++) { BLOCKD *bd = &x->e_mbd.block[i]; bd->bmi.mv.as_int = bsi.mvs[i].as_int; *bd->eob = bsi.eobs[i]; } *returntotrate = bsi.r; *returndistortion = bsi.d; *returnyrate = bsi.segment_yrate; /* save partitions */ x->e_mbd.mode_info_context->mbmi.partitioning = bsi.segment_num; x->partition_info->count = vp8_mbsplit_count[bsi.segment_num]; for (i = 0; i < x->partition_info->count; i++) { int j; j = vp8_mbsplit_offset[bsi.segment_num][i]; x->partition_info->bmi[i].mode = bsi.modes[j]; x->partition_info->bmi[i].mv.as_mv = bsi.mvs[j].as_mv; } /* * used to set x->e_mbd.mode_info_context->mbmi.mv.as_int */ x->partition_info->bmi[15].mv.as_int = bsi.mvs[15].as_int; return bsi.segment_rd; } /* The improved MV prediction */ void vp8_mv_pred ( VP8_COMP *cpi, MACROBLOCKD *xd, const MODE_INFO *here, int_mv *mvp, int refframe, int *ref_frame_sign_bias, int *sr, int near_sadidx[] ) { const MODE_INFO *above = here - xd->mode_info_stride; const MODE_INFO *left = here - 1; const MODE_INFO *aboveleft = above - 1; int_mv near_mvs[8]; int near_ref[8]; int_mv mv; int vcnt=0; int find=0; int mb_offset; int mvx[8]; int mvy[8]; int i; mv.as_int = 0; if(here->mbmi.ref_frame != INTRA_FRAME) { near_mvs[0].as_int = near_mvs[1].as_int = near_mvs[2].as_int = near_mvs[3].as_int = near_mvs[4].as_int = near_mvs[5].as_int = near_mvs[6].as_int = near_mvs[7].as_int = 0; near_ref[0] = near_ref[1] = near_ref[2] = near_ref[3] = near_ref[4] = near_ref[5] = near_ref[6] = near_ref[7] = 0; /* read in 3 nearby block's MVs from current frame as prediction * candidates. */ if (above->mbmi.ref_frame != INTRA_FRAME) { near_mvs[vcnt].as_int = above->mbmi.mv.as_int; mv_bias(ref_frame_sign_bias[above->mbmi.ref_frame], refframe, &near_mvs[vcnt], ref_frame_sign_bias); near_ref[vcnt] = above->mbmi.ref_frame; } vcnt++; if (left->mbmi.ref_frame != INTRA_FRAME) { near_mvs[vcnt].as_int = left->mbmi.mv.as_int; mv_bias(ref_frame_sign_bias[left->mbmi.ref_frame], refframe, &near_mvs[vcnt], ref_frame_sign_bias); near_ref[vcnt] = left->mbmi.ref_frame; } vcnt++; if (aboveleft->mbmi.ref_frame != INTRA_FRAME) { near_mvs[vcnt].as_int = aboveleft->mbmi.mv.as_int; mv_bias(ref_frame_sign_bias[aboveleft->mbmi.ref_frame], refframe, &near_mvs[vcnt], ref_frame_sign_bias); near_ref[vcnt] = aboveleft->mbmi.ref_frame; } vcnt++; /* read in 5 nearby block's MVs from last frame. */ if(cpi->common.last_frame_type != KEY_FRAME) { mb_offset = (-xd->mb_to_top_edge/128 + 1) * (xd->mode_info_stride +1) + (-xd->mb_to_left_edge/128 +1) ; /* current in last frame */ if (cpi->lf_ref_frame[mb_offset] != INTRA_FRAME) { near_mvs[vcnt].as_int = cpi->lfmv[mb_offset].as_int; mv_bias(cpi-><API key>[mb_offset], refframe, &near_mvs[vcnt], ref_frame_sign_bias); near_ref[vcnt] = cpi->lf_ref_frame[mb_offset]; } vcnt++; /* above in last frame */ if (cpi->lf_ref_frame[mb_offset - xd->mode_info_stride-1] != INTRA_FRAME) { near_mvs[vcnt].as_int = cpi->lfmv[mb_offset - xd->mode_info_stride-1].as_int; mv_bias(cpi-><API key>[mb_offset - xd->mode_info_stride-1], refframe, &near_mvs[vcnt], ref_frame_sign_bias); near_ref[vcnt] = cpi->lf_ref_frame[mb_offset - xd->mode_info_stride-1]; } vcnt++; /* left in last frame */ if (cpi->lf_ref_frame[mb_offset-1] != INTRA_FRAME) { near_mvs[vcnt].as_int = cpi->lfmv[mb_offset -1].as_int; mv_bias(cpi-><API key>[mb_offset -1], refframe, &near_mvs[vcnt], ref_frame_sign_bias); near_ref[vcnt] = cpi->lf_ref_frame[mb_offset - 1]; } vcnt++; /* right in last frame */ if (cpi->lf_ref_frame[mb_offset +1] != INTRA_FRAME) { near_mvs[vcnt].as_int = cpi->lfmv[mb_offset +1].as_int; mv_bias(cpi-><API key>[mb_offset +1], refframe, &near_mvs[vcnt], ref_frame_sign_bias); near_ref[vcnt] = cpi->lf_ref_frame[mb_offset +1]; } vcnt++; /* below in last frame */ if (cpi->lf_ref_frame[mb_offset + xd->mode_info_stride +1] != INTRA_FRAME) { near_mvs[vcnt].as_int = cpi->lfmv[mb_offset + xd->mode_info_stride +1].as_int; mv_bias(cpi-><API key>[mb_offset + xd->mode_info_stride +1], refframe, &near_mvs[vcnt], ref_frame_sign_bias); near_ref[vcnt] = cpi->lf_ref_frame[mb_offset + xd->mode_info_stride +1]; } vcnt++; } for(i=0; i< vcnt; i++) { if(near_ref[near_sadidx[i]] != INTRA_FRAME) { if(here->mbmi.ref_frame == near_ref[near_sadidx[i]]) { mv.as_int = near_mvs[near_sadidx[i]].as_int; find = 1; if (i < 3) *sr = 3; else *sr = 2; break; } } } if(!find) { for(i=0; i<vcnt; i++) { mvx[i] = near_mvs[i].as_mv.row; mvy[i] = near_mvs[i].as_mv.col; } insertsortmv(mvx, vcnt); insertsortmv(mvy, vcnt); mv.as_mv.row = mvx[vcnt/2]; mv.as_mv.col = mvy[vcnt/2]; /* sr is set to 0 to allow calling function to decide the search * range. */ *sr = 0; } } /* Set up return values */ mvp->as_int = mv.as_int; vp8_clamp_mv2(mvp, xd); } void vp8_cal_sad(VP8_COMP *cpi, MACROBLOCKD *xd, MACROBLOCK *x, int recon_yoffset, int near_sadidx[]) { /* near_sad indexes: * 0-cf above, 1-cf left, 2-cf aboveleft, * 3-lf current, 4-lf above, 5-lf left, 6-lf right, 7-lf below */ int near_sad[8] = {0}; BLOCK *b = &x->block[0]; unsigned char *src_y_ptr = *(b->base_src); /* calculate sad for current frame 3 nearby MBs. */ if( xd->mb_to_top_edge==0 && xd->mb_to_left_edge ==0) { near_sad[0] = near_sad[1] = near_sad[2] = INT_MAX; }else if(xd->mb_to_top_edge==0) { /* only has left MB for sad calculation. */ near_sad[0] = near_sad[2] = INT_MAX; near_sad[1] = cpi->fn_ptr[BLOCK_16X16].sdf(src_y_ptr, b->src_stride, xd->dst.y_buffer - 16,xd->dst.y_stride); }else if(xd->mb_to_left_edge ==0) { /* only has left MB for sad calculation. */ near_sad[1] = near_sad[2] = INT_MAX; near_sad[0] = cpi->fn_ptr[BLOCK_16X16].sdf(src_y_ptr, b->src_stride, xd->dst.y_buffer - xd->dst.y_stride *16,xd->dst.y_stride); }else { near_sad[0] = cpi->fn_ptr[BLOCK_16X16].sdf(src_y_ptr, b->src_stride, xd->dst.y_buffer - xd->dst.y_stride *16,xd->dst.y_stride); near_sad[1] = cpi->fn_ptr[BLOCK_16X16].sdf(src_y_ptr, b->src_stride, xd->dst.y_buffer - 16,xd->dst.y_stride); near_sad[2] = cpi->fn_ptr[BLOCK_16X16].sdf(src_y_ptr, b->src_stride, xd->dst.y_buffer - xd->dst.y_stride *16 -16,xd->dst.y_stride); } if(cpi->common.last_frame_type != KEY_FRAME) { /* calculate sad for last frame 5 nearby MBs. */ unsigned char *pre_y_buffer = cpi->common.yv12_fb[cpi->common.lst_fb_idx].y_buffer + recon_yoffset; int pre_y_stride = cpi->common.yv12_fb[cpi->common.lst_fb_idx].y_stride; if(xd->mb_to_top_edge==0) near_sad[4] = INT_MAX; if(xd->mb_to_left_edge ==0) near_sad[5] = INT_MAX; if(xd->mb_to_right_edge ==0) near_sad[6] = INT_MAX; if(xd->mb_to_bottom_edge==0) near_sad[7] = INT_MAX; if(near_sad[4] != INT_MAX) near_sad[4] = cpi->fn_ptr[BLOCK_16X16].sdf(src_y_ptr, b->src_stride, pre_y_buffer - pre_y_stride *16, pre_y_stride); if(near_sad[5] != INT_MAX) near_sad[5] = cpi->fn_ptr[BLOCK_16X16].sdf(src_y_ptr, b->src_stride, pre_y_buffer - 16, pre_y_stride); near_sad[3] = cpi->fn_ptr[BLOCK_16X16].sdf(src_y_ptr, b->src_stride, pre_y_buffer, pre_y_stride); if(near_sad[6] != INT_MAX) near_sad[6] = cpi->fn_ptr[BLOCK_16X16].sdf(src_y_ptr, b->src_stride, pre_y_buffer + 16, pre_y_stride); if(near_sad[7] != INT_MAX) near_sad[7] = cpi->fn_ptr[BLOCK_16X16].sdf(src_y_ptr, b->src_stride, pre_y_buffer + pre_y_stride *16, pre_y_stride); } if(cpi->common.last_frame_type != KEY_FRAME) { insertsortsad(near_sad, near_sadidx, 8); }else { insertsortsad(near_sad, near_sadidx, 3); } } static void rd_update_mvcount(MACROBLOCK *x, int_mv *best_ref_mv) { if (x->e_mbd.mode_info_context->mbmi.mode == SPLITMV) { int i; for (i = 0; i < x->partition_info->count; i++) { if (x->partition_info->bmi[i].mode == NEW4X4) { x->MVcount[0][mv_max+((x->partition_info->bmi[i].mv.as_mv.row - best_ref_mv->as_mv.row) >> 1)]++; x->MVcount[1][mv_max+((x->partition_info->bmi[i].mv.as_mv.col - best_ref_mv->as_mv.col) >> 1)]++; } } } else if (x->e_mbd.mode_info_context->mbmi.mode == NEWMV) { x->MVcount[0][mv_max+((x->e_mbd.mode_info_context->mbmi.mv.as_mv.row - best_ref_mv->as_mv.row) >> 1)]++; x->MVcount[1][mv_max+((x->e_mbd.mode_info_context->mbmi.mv.as_mv.col - best_ref_mv->as_mv.col) >> 1)]++; } } static int <API key>(int mdcounts[4], RATE_DISTORTION* rd, int* disable_skip, VP8_COMP *cpi, MACROBLOCK *x) { MB_PREDICTION_MODE this_mode = x->e_mbd.mode_info_context->mbmi.mode; BLOCK *b = &x->block[0]; MACROBLOCKD *xd = &x->e_mbd; int distortion; <API key>(&x->e_mbd, x->e_mbd.predictor, 16); if (cpi->active_map_enabled && x->active_ptr[0] == 0) { x->skip = 1; } else if (x->encode_breakout) { unsigned int sse; unsigned int var; unsigned int threshold = (xd->block[0].dequant[1] * xd->block[0].dequant[1] >>4); if(threshold < x->encode_breakout) threshold = x->encode_breakout; var = vpx_variance16x16 (*(b->base_src), b->src_stride, x->e_mbd.predictor, 16, &sse); if (sse < threshold) { unsigned int q2dc = xd->block[24].dequant[0]; /* If theres is no codeable 2nd order dc or a very small uniform pixel change change */ if ((sse - var < q2dc * q2dc >>4) || (sse /2 > var && sse-var < 64)) { /* Check u and v to make sure skip is ok */ unsigned int sse2 = VP8_UVSSE(x); if (sse2 * 2 < threshold) { x->skip = 1; rd->distortion2 = sse + sse2; rd->rate2 = 500; /* for best_yrd calculation */ rd->rate_uv = 0; rd->distortion_uv = sse2; *disable_skip = 1; return RDCOST(x->rdmult, x->rddiv, rd->rate2, rd->distortion2); } } } } /* Add in the Mv/mode cost */ rd->rate2 += vp8_cost_mv_ref(this_mode, mdcounts); /* Y cost and distortion */ macro_block_yrd(x, &rd->rate_y, &distortion); rd->rate2 += rd->rate_y; rd->distortion2 += distortion; /* UV cost and distortion */ rd_inter16x16_uv(cpi, x, &rd->rate_uv, &rd->distortion_uv, cpi->common.full_pixel); rd->rate2 += rd->rate_uv; rd->distortion2 += rd->distortion_uv; return INT_MAX; } static int <API key>(int this_rd, RATE_DISTORTION* rd, int* other_cost, int disable_skip, int uv_intra_tteob, int intra_rd_penalty, VP8_COMP *cpi, MACROBLOCK *x) { MB_PREDICTION_MODE this_mode = x->e_mbd.mode_info_context->mbmi.mode; /* Where skip is allowable add in the default per mb cost for the no * skip case. where we then decide to skip we have to delete this and * replace it with the cost of signalling a skip */ if (cpi->common.mb_no_coeff_skip) { *other_cost += vp8_cost_bit(cpi->prob_skip_false, 0); rd->rate2 += *other_cost; } /* Estimate the reference frame signaling cost and add it * to the rolling cost variable. */ rd->rate2 += x->ref_frame_cost[x->e_mbd.mode_info_context->mbmi.ref_frame]; if (!disable_skip) { /* Test for the condition where skip block will be activated * because there are no non zero coefficients and make any * necessary adjustment for rate */ if (cpi->common.mb_no_coeff_skip) { int i; int tteob; int has_y2_block = (this_mode!=SPLITMV && this_mode!=B_PRED); tteob = 0; if(has_y2_block) tteob += x->e_mbd.eobs[24]; for (i = 0; i < 16; i++) tteob += (x->e_mbd.eobs[i] > has_y2_block); if (x->e_mbd.mode_info_context->mbmi.ref_frame) { for (i = 16; i < 24; i++) tteob += x->e_mbd.eobs[i]; } else tteob += uv_intra_tteob; if (tteob == 0) { rd->rate2 -= (rd->rate_y + rd->rate_uv); /* for best_yrd calculation */ rd->rate_uv = 0; /* Back out no skip flag costing and add in skip flag costing */ if (cpi->prob_skip_false) { int prob_skip_cost; prob_skip_cost = vp8_cost_bit(cpi->prob_skip_false, 1); prob_skip_cost -= (int)vp8_cost_bit(cpi->prob_skip_false, 0); rd->rate2 += prob_skip_cost; *other_cost += prob_skip_cost; } } } /* Calculate the final RD estimate for this mode */ this_rd = RDCOST(x->rdmult, x->rddiv, rd->rate2, rd->distortion2); if (this_rd < INT_MAX && x->e_mbd.mode_info_context->mbmi.ref_frame == INTRA_FRAME) this_rd += intra_rd_penalty; } return this_rd; } static void update_best_mode(BEST_MODE* best_mode, int this_rd, RATE_DISTORTION* rd, int other_cost, MACROBLOCK *x) { MB_PREDICTION_MODE this_mode = x->e_mbd.mode_info_context->mbmi.mode; other_cost += x->ref_frame_cost[x->e_mbd.mode_info_context->mbmi.ref_frame]; /* Calculate the final y RD estimate for this mode */ best_mode->yrd = RDCOST(x->rdmult, x->rddiv, (rd->rate2-rd->rate_uv-other_cost), (rd->distortion2-rd->distortion_uv)); best_mode->rd = this_rd; memcpy(&best_mode->mbmode, &x->e_mbd.mode_info_context->mbmi, sizeof(MB_MODE_INFO)); memcpy(&best_mode->partition, x->partition_info, sizeof(PARTITION_INFO)); if ((this_mode == B_PRED) || (this_mode == SPLITMV)) { int i; for (i = 0; i < 16; i++) { best_mode->bmodes[i] = x->e_mbd.block[i].bmi; } } } void <API key>(VP8_COMP *cpi, MACROBLOCK *x, int recon_yoffset, int recon_uvoffset, int *returnrate, int *returndistortion, int *returnintra, int mb_row, int mb_col) { BLOCK *b = &x->block[0]; BLOCKD *d = &x->e_mbd.block[0]; MACROBLOCKD *xd = &x->e_mbd; int_mv best_ref_mv_sb[2]; int_mv mode_mv_sb[2][MB_MODE_COUNT]; int_mv best_ref_mv; int_mv *mode_mv; MB_PREDICTION_MODE this_mode; int num00; int best_mode_index = 0; BEST_MODE best_mode; int i; int mode_index; int mdcounts[4]; int rate; RATE_DISTORTION rd; int uv_intra_rate, uv_intra_distortion, <API key>; int uv_intra_tteob = 0; int uv_intra_done = 0; MB_PREDICTION_MODE uv_intra_mode = 0; int_mv mvp; int near_sadidx[8] = {0, 1, 2, 3, 4, 5, 6, 7}; int saddone=0; /* search range got from mv_pred(). It uses step_param levels. (0-7) */ int sr=0; unsigned char *plane[4][3]; int ref_frame_map[4]; int sign_bias = 0; int intra_rd_penalty = 10* vp8_dc_quant(cpi->common.base_qindex, cpi->common.y1dc_delta_q); #if <API key> unsigned int zero_mv_sse = UINT_MAX, best_sse = UINT_MAX, best_rd_sse = UINT_MAX; #endif mode_mv = mode_mv_sb[sign_bias]; best_ref_mv.as_int = 0; best_mode.rd = INT_MAX; best_mode.yrd = INT_MAX; best_mode.intra_rd = INT_MAX; memset(mode_mv_sb, 0, sizeof(mode_mv_sb)); memset(&best_mode.mbmode, 0, sizeof(best_mode.mbmode)); memset(&best_mode.bmodes, 0, sizeof(best_mode.bmodes)); /* Setup search priorities */ <API key>(cpi, ref_frame_map); /* Check to see if there is at least 1 valid reference frame that we need * to calculate near_mvs. */ if (ref_frame_map[1] > 0) { sign_bias = <API key>(&x->e_mbd, x->e_mbd.mode_info_context, mode_mv_sb, best_ref_mv_sb, mdcounts, ref_frame_map[1], cpi->common.ref_frame_sign_bias); mode_mv = mode_mv_sb[sign_bias]; best_ref_mv.as_int = best_ref_mv_sb[sign_bias].as_int; } <API key>(cpi, plane, recon_yoffset, recon_uvoffset); *returnintra = INT_MAX; /* Count of the number of MBs tested so far this frame */ x->mbs_tested_so_far++; x->skip = 0; for (mode_index = 0; mode_index < MAX_MODES; mode_index++) { int this_rd = INT_MAX; int disable_skip = 0; int other_cost = 0; int this_ref_frame = ref_frame_map[vp8_ref_frame_order[mode_index]]; /* Test best rd so far against threshold for trying this mode. */ if (best_mode.rd <= x->rd_threshes[mode_index]) continue; if (this_ref_frame < 0) continue; /* These variables hold are rolling total cost and distortion for * this mode */ rd.rate2 = 0; rd.distortion2 = 0; this_mode = vp8_mode_order[mode_index]; x->e_mbd.mode_info_context->mbmi.mode = this_mode; x->e_mbd.mode_info_context->mbmi.ref_frame = this_ref_frame; /* Only consider ZEROMV/ALTREF_FRAME for alt ref frame, * unless ARNR filtering is enabled in which case we want * an unfiltered alternative */ if (cpi-><API key> && (cpi->oxcf.arnr_max_frames == 0)) { if (this_mode != ZEROMV || x->e_mbd.mode_info_context->mbmi.ref_frame != ALTREF_FRAME) continue; } /* everything but intra */ if (x->e_mbd.mode_info_context->mbmi.ref_frame) { x->e_mbd.pre.y_buffer = plane[this_ref_frame][0]; x->e_mbd.pre.u_buffer = plane[this_ref_frame][1]; x->e_mbd.pre.v_buffer = plane[this_ref_frame][2]; if (sign_bias != cpi->common.ref_frame_sign_bias[this_ref_frame]) { sign_bias = cpi->common.ref_frame_sign_bias[this_ref_frame]; mode_mv = mode_mv_sb[sign_bias]; best_ref_mv.as_int = best_ref_mv_sb[sign_bias].as_int; } } /* Check to see if the testing frequency for this mode is at its * max If so then prevent it from being tested and increase the * threshold for its testing */ if (x-><API key>[mode_index] && (cpi->mode_check_freq[mode_index] > 1)) { if (x->mbs_tested_so_far <= cpi->mode_check_freq[mode_index] * x-><API key>[mode_index]) { /* Increase the threshold for coding this mode to make it * less likely to be chosen */ x->rd_thresh_mult[mode_index] += 4; if (x->rd_thresh_mult[mode_index] > MAX_THRESHMULT) x->rd_thresh_mult[mode_index] = MAX_THRESHMULT; x->rd_threshes[mode_index] = (cpi->rd_baseline_thresh[mode_index] >> 7) * x->rd_thresh_mult[mode_index]; continue; } } /* We have now reached the point where we are going to test the * current mode so increment the counter for the number of times * it has been tested */ x-><API key>[mode_index] ++; /* Experimental code. Special case for gf and arf zeromv modes. * Increase zbin size to supress noise */ if (x-><API key>) { if ( this_ref_frame == INTRA_FRAME ) x->zbin_mode_boost = 0; else { if (vp8_mode_order[mode_index] == ZEROMV) { if (this_ref_frame != LAST_FRAME) x->zbin_mode_boost = <API key>; else x->zbin_mode_boost = <API key>; } else if (vp8_mode_order[mode_index] == SPLITMV) x->zbin_mode_boost = 0; else x->zbin_mode_boost = MV_ZBIN_BOOST; } <API key>(cpi, x); } if(!uv_intra_done && this_ref_frame == INTRA_FRAME) { <API key>(x, &uv_intra_rate, &<API key>, &uv_intra_distortion); uv_intra_mode = x->e_mbd.mode_info_context->mbmi.uv_mode; /* * Total of the eobs is used later to further adjust rate2. Since uv * block's intra eobs will be overwritten when we check inter modes, * we need to save uv_intra_tteob here. */ for (i = 16; i < 24; i++) uv_intra_tteob += x->e_mbd.eobs[i]; uv_intra_done = 1; } switch (this_mode) { case B_PRED: { int tmp_rd; /* Note the rate value returned here includes the cost of * coding the BPRED mode: x->mbmode_cost[x->e_mbd.frame_type][BPRED] */ int distortion; tmp_rd = <API key>(x, &rate, &rd.rate_y, &distortion, best_mode.yrd); rd.rate2 += rate; rd.distortion2 += distortion; if(tmp_rd < best_mode.yrd) { rd.rate2 += uv_intra_rate; rd.rate_uv = <API key>; rd.distortion2 += uv_intra_distortion; rd.distortion_uv = uv_intra_distortion; } else { this_rd = INT_MAX; disable_skip = 1; } } break; case SPLITMV: { int tmp_rd; int this_rd_thresh; int distortion; this_rd_thresh = (vp8_ref_frame_order[mode_index] == 1) ? x->rd_threshes[THR_NEW1] : x->rd_threshes[THR_NEW3]; this_rd_thresh = (vp8_ref_frame_order[mode_index] == 2) ? x->rd_threshes[THR_NEW2] : this_rd_thresh; tmp_rd = <API key>(cpi, x, &best_ref_mv, best_mode.yrd, mdcounts, &rate, &rd.rate_y, &distortion, this_rd_thresh) ; rd.rate2 += rate; rd.distortion2 += distortion; /* If even the 'Y' rd value of split is higher than best so far * then dont bother looking at UV */ if (tmp_rd < best_mode.yrd) { /* Now work out UV cost and add it in */ rd_inter4x4_uv(cpi, x, &rd.rate_uv, &rd.distortion_uv, cpi->common.full_pixel); rd.rate2 += rd.rate_uv; rd.distortion2 += rd.distortion_uv; } else { this_rd = INT_MAX; disable_skip = 1; } } break; case DC_PRED: case V_PRED: case H_PRED: case TM_PRED: { int distortion; x->e_mbd.mode_info_context->mbmi.ref_frame = INTRA_FRAME; <API key>(xd, xd->dst.y_buffer - xd->dst.y_stride, xd->dst.y_buffer - 1, xd->dst.y_stride, xd->predictor, 16); macro_block_yrd(x, &rd.rate_y, &distortion) ; rd.rate2 += rd.rate_y; rd.distortion2 += distortion; rd.rate2 += x->mbmode_cost[x->e_mbd.frame_type][x->e_mbd.mode_info_context->mbmi.mode]; rd.rate2 += uv_intra_rate; rd.rate_uv = <API key>; rd.distortion2 += uv_intra_distortion; rd.distortion_uv = uv_intra_distortion; } break; case NEWMV: { int thissme; int bestsme = INT_MAX; int step_param = cpi->sf.first_step; int further_steps; int n; int do_refine=1; /* If last step (1-away) of n-step search doesn't pick the center point as the best match, we will do a final 1-away diamond refining search */ int sadpb = x->sadperbit16; int_mv mvp_full; int col_min = ((best_ref_mv.as_mv.col+7)>>3) - MAX_FULL_PEL_VAL; int row_min = ((best_ref_mv.as_mv.row+7)>>3) - MAX_FULL_PEL_VAL; int col_max = (best_ref_mv.as_mv.col>>3) + MAX_FULL_PEL_VAL; int row_max = (best_ref_mv.as_mv.row>>3) + MAX_FULL_PEL_VAL; int tmp_col_min = x->mv_col_min; int tmp_col_max = x->mv_col_max; int tmp_row_min = x->mv_row_min; int tmp_row_max = x->mv_row_max; if(!saddone) { vp8_cal_sad(cpi,xd,x, recon_yoffset ,&near_sadidx[0] ); saddone = 1; } vp8_mv_pred(cpi, &x->e_mbd, x->e_mbd.mode_info_context, &mvp, x->e_mbd.mode_info_context->mbmi.ref_frame, cpi->common.ref_frame_sign_bias, &sr, &near_sadidx[0]); mvp_full.as_mv.col = mvp.as_mv.col>>3; mvp_full.as_mv.row = mvp.as_mv.row>>3; /* Get intersection of UMV window and valid MV window to * reduce # of checks in diamond search. */ if (x->mv_col_min < col_min ) x->mv_col_min = col_min; if (x->mv_col_max > col_max ) x->mv_col_max = col_max; if (x->mv_row_min < row_min ) x->mv_row_min = row_min; if (x->mv_row_max > row_max ) x->mv_row_max = row_max; /* adjust search range according to sr from mv prediction */ if(sr > step_param) step_param = sr; /* Initial step/diamond search */ { bestsme = cpi->diamond_search_sad(x, b, d, &mvp_full, &d->bmi.mv, step_param, sadpb, &num00, &cpi->fn_ptr[BLOCK_16X16], x->mvcost, &best_ref_mv); mode_mv[NEWMV].as_int = d->bmi.mv.as_int; /* Further step/diamond searches as necessary */ further_steps = (cpi->sf.<API key> - 1) - step_param; n = num00; num00 = 0; /* If there won't be more n-step search, check to see if refining search is needed. */ if (n > further_steps) do_refine = 0; while (n < further_steps) { n++; if (num00) num00 else { thissme = cpi->diamond_search_sad(x, b, d, &mvp_full, &d->bmi.mv, step_param + n, sadpb, &num00, &cpi->fn_ptr[BLOCK_16X16], x->mvcost, &best_ref_mv); /* check to see if refining search is needed. */ if (num00 > (further_steps-n)) do_refine = 0; if (thissme < bestsme) { bestsme = thissme; mode_mv[NEWMV].as_int = d->bmi.mv.as_int; } else { d->bmi.mv.as_int = mode_mv[NEWMV].as_int; } } } } /* final 1-away diamond refining search */ if (do_refine == 1) { int search_range; search_range = 8; thissme = cpi->refining_search_sad(x, b, d, &d->bmi.mv, sadpb, search_range, &cpi->fn_ptr[BLOCK_16X16], x->mvcost, &best_ref_mv); if (thissme < bestsme) { bestsme = thissme; mode_mv[NEWMV].as_int = d->bmi.mv.as_int; } else { d->bmi.mv.as_int = mode_mv[NEWMV].as_int; } } x->mv_col_min = tmp_col_min; x->mv_col_max = tmp_col_max; x->mv_row_min = tmp_row_min; x->mv_row_max = tmp_row_max; if (bestsme < INT_MAX) { int dis; /* TODO: use dis in distortion calculation later. */ unsigned int sse; cpi-><API key>(x, b, d, &d->bmi.mv, &best_ref_mv, x->errorperbit, &cpi->fn_ptr[BLOCK_16X16], x->mvcost, &dis, &sse); } mode_mv[NEWMV].as_int = d->bmi.mv.as_int; /* Add the new motion vector cost to our rolling cost variable */ rd.rate2 += vp8_mv_bit_cost(&mode_mv[NEWMV], &best_ref_mv, x->mvcost, 96); } case NEARESTMV: case NEARMV: /* Clip "next_nearest" so that it does not extend to far out * of image */ vp8_clamp_mv2(&mode_mv[this_mode], xd); /* Do not bother proceeding if the vector (from newmv, nearest * or near) is 0,0 as this should then be coded using the zeromv * mode. */ if (((this_mode == NEARMV) || (this_mode == NEARESTMV)) && (mode_mv[this_mode].as_int == 0)) continue; case ZEROMV: /* Trap vectors that reach beyond the UMV borders * Note that ALL New MV, Nearest MV Near MV and Zero MV code * drops through to this point because of the lack of break * statements in the previous two cases. */ if (((mode_mv[this_mode].as_mv.row >> 3) < x->mv_row_min) || ((mode_mv[this_mode].as_mv.row >> 3) > x->mv_row_max) || ((mode_mv[this_mode].as_mv.col >> 3) < x->mv_col_min) || ((mode_mv[this_mode].as_mv.col >> 3) > x->mv_col_max)) continue; <API key>(x, this_mode, &mode_mv[this_mode]); this_rd = <API key>(mdcounts, &rd, &disable_skip, cpi, x); break; default: break; } this_rd = <API key>(this_rd, &rd, &other_cost, disable_skip, uv_intra_tteob, intra_rd_penalty, cpi, x); /* Keep record of best intra distortion */ if ((x->e_mbd.mode_info_context->mbmi.ref_frame == INTRA_FRAME) && (this_rd < best_mode.intra_rd) ) { best_mode.intra_rd = this_rd; *returnintra = rd.distortion2 ; } #if <API key> if (cpi->oxcf.noise_sensitivity) { unsigned int sse; <API key>(x,&cpi->fn_ptr[BLOCK_16X16],&sse, mode_mv[this_mode]); if (sse < best_rd_sse) best_rd_sse = sse; /* Store for later use by denoiser. */ if (this_mode == ZEROMV && sse < zero_mv_sse ) { zero_mv_sse = sse; x-><API key> = x->e_mbd.mode_info_context->mbmi.ref_frame; } /* Store the best NEWMV in x for later use in the denoiser. */ if (x->e_mbd.mode_info_context->mbmi.mode == NEWMV && sse < best_sse) { best_sse = sse; <API key>(x,&cpi->fn_ptr[BLOCK_16X16],&best_sse, mode_mv[this_mode]); x->best_sse_inter_mode = NEWMV; x->best_sse_mv = x->e_mbd.mode_info_context->mbmi.mv; x-><API key> = x->e_mbd.mode_info_context->mbmi.need_to_clamp_mvs; x-><API key> = x->e_mbd.mode_info_context->mbmi.ref_frame; } } #endif /* Did this mode help.. i.i is it the new best mode */ if (this_rd < best_mode.rd || x->skip) { /* Note index of best mode so far */ best_mode_index = mode_index; *returnrate = rd.rate2; *returndistortion = rd.distortion2; if (this_mode <= B_PRED) { x->e_mbd.mode_info_context->mbmi.uv_mode = uv_intra_mode; /* required for left and above block mv */ x->e_mbd.mode_info_context->mbmi.mv.as_int = 0; } update_best_mode(&best_mode, this_rd, &rd, other_cost, x); /* Testing this mode gave rise to an improvement in best error * score. Lower threshold a bit for next time */ x->rd_thresh_mult[mode_index] = (x->rd_thresh_mult[mode_index] >= (MIN_THRESHMULT + 2)) ? x->rd_thresh_mult[mode_index] - 2 : MIN_THRESHMULT; } /* If the mode did not help improve the best error case then raise * the threshold for testing that mode next time around. */ else { x->rd_thresh_mult[mode_index] += 4; if (x->rd_thresh_mult[mode_index] > MAX_THRESHMULT) x->rd_thresh_mult[mode_index] = MAX_THRESHMULT; } x->rd_threshes[mode_index] = (cpi->rd_baseline_thresh[mode_index] >> 7) * x->rd_thresh_mult[mode_index]; if (x->skip) break; } /* Reduce the activation RD thresholds for the best choice mode */ if ((cpi->rd_baseline_thresh[best_mode_index] > 0) && (cpi->rd_baseline_thresh[best_mode_index] < (INT_MAX >> 2))) { int best_adjustment = (x->rd_thresh_mult[best_mode_index] >> 2); x->rd_thresh_mult[best_mode_index] = (x->rd_thresh_mult[best_mode_index] >= (MIN_THRESHMULT + best_adjustment)) ? x->rd_thresh_mult[best_mode_index] - best_adjustment : MIN_THRESHMULT; x->rd_threshes[best_mode_index] = (cpi->rd_baseline_thresh[best_mode_index] >> 7) * x->rd_thresh_mult[best_mode_index]; } #if <API key> if (cpi->oxcf.noise_sensitivity) { int block_index = mb_row * cpi->common.mb_cols + mb_col; if (x->best_sse_inter_mode == DC_PRED) { /* No best MV found. */ x->best_sse_inter_mode = best_mode.mbmode.mode; x->best_sse_mv = best_mode.mbmode.mv; x-><API key> = best_mode.mbmode.need_to_clamp_mvs; x-><API key> = best_mode.mbmode.ref_frame; best_sse = best_rd_sse; } <API key>(&cpi->denoiser, x, best_sse, zero_mv_sse, recon_yoffset, recon_uvoffset, &cpi->common.lf_info, mb_row, mb_col, block_index, 0); /* Reevaluate ZEROMV after denoising. */ if (best_mode.mbmode.ref_frame == INTRA_FRAME && x-><API key> != INTRA_FRAME) { int this_rd = INT_MAX; int disable_skip = 0; int other_cost = 0; int this_ref_frame = x-><API key>; rd.rate2 = x->ref_frame_cost[this_ref_frame] + vp8_cost_mv_ref(ZEROMV, mdcounts); rd.distortion2 = 0; /* set up the proper prediction buffers for the frame */ x->e_mbd.mode_info_context->mbmi.ref_frame = this_ref_frame; x->e_mbd.pre.y_buffer = plane[this_ref_frame][0]; x->e_mbd.pre.u_buffer = plane[this_ref_frame][1]; x->e_mbd.pre.v_buffer = plane[this_ref_frame][2]; x->e_mbd.mode_info_context->mbmi.mode = ZEROMV; x->e_mbd.mode_info_context->mbmi.uv_mode = DC_PRED; x->e_mbd.mode_info_context->mbmi.mv.as_int = 0; this_rd = <API key>(mdcounts, &rd, &disable_skip, cpi, x); this_rd = <API key>(this_rd, &rd, &other_cost, disable_skip, uv_intra_tteob, intra_rd_penalty, cpi, x); if (this_rd < best_mode.rd || x->skip) { *returnrate = rd.rate2; *returndistortion = rd.distortion2; update_best_mode(&best_mode, this_rd, &rd, other_cost, x); } } } #endif if (cpi-><API key> && (best_mode.mbmode.mode != ZEROMV || best_mode.mbmode.ref_frame != ALTREF_FRAME)) { x->e_mbd.mode_info_context->mbmi.mode = ZEROMV; x->e_mbd.mode_info_context->mbmi.ref_frame = ALTREF_FRAME; x->e_mbd.mode_info_context->mbmi.mv.as_int = 0; x->e_mbd.mode_info_context->mbmi.uv_mode = DC_PRED; x->e_mbd.mode_info_context->mbmi.mb_skip_coeff = (cpi->common.mb_no_coeff_skip); x->e_mbd.mode_info_context->mbmi.partitioning = 0; return; } /* macroblock modes */ memcpy(&x->e_mbd.mode_info_context->mbmi, &best_mode.mbmode, sizeof(MB_MODE_INFO)); if (best_mode.mbmode.mode == B_PRED) { for (i = 0; i < 16; i++) xd->mode_info_context->bmi[i].as_mode = best_mode.bmodes[i].as_mode; } if (best_mode.mbmode.mode == SPLITMV) { for (i = 0; i < 16; i++) xd->mode_info_context->bmi[i].mv.as_int = best_mode.bmodes[i].mv.as_int; memcpy(x->partition_info, &best_mode.partition, sizeof(PARTITION_INFO)); x->e_mbd.mode_info_context->mbmi.mv.as_int = x->partition_info->bmi[15].mv.as_int; } if (sign_bias != cpi->common.ref_frame_sign_bias[xd->mode_info_context->mbmi.ref_frame]) best_ref_mv.as_int = best_ref_mv_sb[!sign_bias].as_int; rd_update_mvcount(x, &best_ref_mv); } void <API key>(MACROBLOCK *x, int *rate_) { int error4x4, error16x16; int rate4x4, rate16x16 = 0, rateuv; int dist4x4, dist16x16, distuv; int rate; int rate4x4_tokenonly = 0; int rate16x16_tokenonly = 0; int rateuv_tokenonly = 0; x->e_mbd.mode_info_context->mbmi.ref_frame = INTRA_FRAME; <API key>(x, &rateuv, &rateuv_tokenonly, &distuv); rate = rateuv; error16x16 = <API key>(x, &rate16x16, &rate16x16_tokenonly, &dist16x16); error4x4 = <API key>(x, &rate4x4, &rate4x4_tokenonly, &dist4x4, error16x16); if (error4x4 < error16x16) { x->e_mbd.mode_info_context->mbmi.mode = B_PRED; rate += rate4x4; } else { rate += rate16x16; } *rate_ = rate; }
/* { dg-add-options stack_size } */ #ifdef STACK_SIZE #if STACK_SIZE < 8*100*100 #define SKIP #endif #endif #ifndef SKIP double x[100][100]; int main () { int i; i = 99; x[i][0] = 42; if (x[99][0] != 42) abort (); exit (0); } #else int main () { exit (0); } #endif
#include "resources/cursor.h" #include "debug.h" namespace Cursor { static const StrToCursor hoverCursors[] = { {"select", CURSOR_POINTER}, {"pointer", CURSOR_POINTER}, {"lr", <API key>}, {"rl", <API key>}, {"resizeAcross", <API key>}, {"ud", CURSOR_RESIZE_DOWN}, {"du", CURSOR_RESIZE_DOWN}, {"resizeDown", CURSOR_RESIZE_DOWN}, {"ldru", <API key>}, {"ruld", <API key>}, {"ld", <API key>}, {"ru", <API key>}, {"resizeDownLeft", <API key>}, {"lurd", <API key>}, {"rdlu", <API key>}, {"rd", <API key>}, {"lu", <API key>}, {"resizeDownRight", <API key>}, {"attack", CURSOR_FIGHT}, {"fight", CURSOR_FIGHT}, {"take", CURSOR_PICKUP}, {"pickup", CURSOR_PICKUP}, {"talk", CURSOR_TALK}, {"action", CURSOR_ACTION}, {"left", CURSOR_LEFT}, {"up", CURSOR_UP}, {"right", CURSOR_RIGHT}, {"down", CURSOR_DOWN} }; Cursor stringToCursor(const std::string &name) { for (size_t f = 0; f < sizeof(hoverCursors) / sizeof(StrToCursor); f ++) { if (hoverCursors[f].str == name) return hoverCursors[f].cursor; } return CURSOR_POINTER; } } // namespace Cursor
<?php class Span extends <API key> { public $markup; function __construct( $id, $settings ) { parent::__construct( $id, $settings ); $this->set_attributes(); $markup = $this->create_markup(); if ( get_option( 'rwp_debug_mode', 'off' ) == 'on' ) { $markup = $this-><API key>( $markup ); } $this->markup = $markup; } protected function set_attributes() { $default_attributes = array( 'picture_span' => array( 'data-alt' => (isset($this->settings['attributes']['img']['alt'])) ? $this->settings['attributes']['img']['alt'] : $this->get_image_meta('alt') ), 'src_span' => array() ); if ( isset($this->settings['attributes']) ) { $this->settings['attributes'] = <API key>($default_attributes, $this->settings['attributes']); } else { $this->settings['attributes'] = $default_attributes; } } protected function create_markup() { $<API key> = $this->create_attributes($this->settings['attributes']['picture_span']); $src_span_attributes = $this->create_attributes($this->settings['attributes']['src_span']); $markup = '<span data-picture '.$<API key>.'>'; $markup .= '<span data-src="'.$this->images[0]['src'].'" '.$src_span_attributes.'></span>'; for ($i=1; $i < count($this->images); $i++) { $media_attribute = $this->media_attribute( $this->images[$i] ); $markup .= '<span data-src="'.$this->images[$i]['src'].'" '.$media_attribute.' '.$src_span_attributes.'></span>'; } $markup .= '<noscript>'; $markup .= '<img src="'.$this->images[0]['src'].'" alt="'.$this->get_image_meta('alt').'">'; $markup .= '</noscript>'; $markup .= '</span>'; return $markup; } protected function media_attribute( $image ) { if ( gettype($image['media_query']) == 'array' ) { return 'data-media="('.$image['media_query']['property'] . ': ' . $image['media_query']['value'].')"'; } return 'data-media="('.$image['media_query'].')"'; } }
## Domain Registry Interface, .CZ policies ## This file is part of Net::DRI ## Net::DRI is free software; you can redistribute it and/or modify ## (at your option) any later version. package Net::DRI::DRD::CZ; use strict; use warnings; use base qw/Net::DRI::DRD/; use DateTime::Duration; =pod =head1 NAME Net::DRI::DRD::CZ - .CZ policies for Net::DRI =head1 DESCRIPTION Please see the README file for details. =head1 SUPPORT For now, support questions should be sent to: E<lt>development@sygroup.chE<gt> Please also see the SUPPORT file in the distribution. =head1 SEE ALSO E<lt>http: =head1 AUTHOR Tonnerre Lombard, E<lt>tonnerre.lombard@sygroup.chE<gt> =head1 COPYRIGHT Copyright (c) 2008,2009 Tonnerre Lombard <tonnerre.lombard@sygroup.ch>. (c) 2011 Patrick Mevzek <netdri@dotandco.com>. All rights reserved. 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 of the License, or (at your option) any later version. See the LICENSE file that comes with this distribution for more details. =cut sub new { my $class=shift; my $self=$class->SUPER::new(@_); $self->{info}->{host_as_attr}=0; $self->{info}->{contact_i18n}=2; return $self; } sub periods { return map { DateTime::Duration->new(years => $_) } (1..10); } sub name { return 'CZ'; } sub tlds { return ('cz'); } sub object_types { return ('domain','contact','ns'); } sub profile_types { return qw/epp/; } sub <API key> { my ($self,$type)=@_; return ('Net::DRI::Transport::Socket',{},'Net::DRI::Protocol::EPP::Extensions::CZ',{}) if $type eq 'epp'; return; } 1;
#ifndef _bq24158_SW_H_ #define _bq24158_SW_H_ #include <mt-plat/mt_typedefs.h> #include <linux/kernel.h> #include <linux/mm.h> #include <linux/mm_types.h> #include <linux/module.h> #include <linux/types.h> #include <linux/slab.h> #include <linux/vmalloc.h> #include <linux/gpio.h> #include <linux/device.h> #ifdef CONFIG_OF #include <linux/of.h> #include <linux/of_irq.h> #include <linux/of_address.h> #include <linux/of_device.h> #include <linux/regulator/consumer.h> #include <linux/clk.h> #include <linux/pinctrl/consumer.h> #include <linux/of_gpio.h> #endif //#define <API key> extern unsigned int charger_enable_pin; #define bq24158_CON0 0x00 #define bq24158_CON1 0x01 #define bq24158_CON2 0x02 #define bq24158_CON3 0x03 #define bq24158_CON4 0x04 #define bq24158_CON5 0x05 #define bq24158_CON6 0x06 #define bq24158_REG_NUM 7 //CON0 #define CON0_TMR_RST_MASK 0x01 #define CON0_TMR_RST_SHIFT 7 #define CON0_OTG_MASK 0x01 #define CON0_OTG_SHIFT 7 #define CON0_EN_STAT_MASK 0x01 #define CON0_EN_STAT_SHIFT 6 #define CON0_STAT_MASK 0x03 #define CON0_STAT_SHIFT 4 #define CON0_BOOST_MASK 0x01 #define CON0_BOOST_SHIFT 3 #define CON0_FAULT_MASK 0x07 #define CON0_FAULT_SHIFT 0 //CON1 #define CON1_LIN_LIMIT_MASK 0x03 #define <API key> 6 #define CON1_LOW_V_MASK 0x03 #define CON1_LOW_V_SHIFT 4 #define CON1_TE_MASK 0x01 #define CON1_TE_SHIFT 3 #define CON1_CE_MASK 0x01 #define CON1_CE_SHIFT 2 #define CON1_HZ_MODE_MASK 0x01 #define CON1_HZ_MODE_SHIFT 1 #define CON1_OPA_MODE_MASK 0x01 #define CON1_OPA_MODE_SHIFT 0 //CON2 #define CON2_OREG_MASK 0x3F #define CON2_OREG_SHIFT 2 #define CON2_OTG_PL_MASK 0x01 #define CON2_OTG_PL_SHIFT 1 #define CON2_OTG_EN_MASK 0x01 #define CON2_OTG_EN_SHIFT 0 //CON3 #define <API key> 0x07 #define <API key> 5 #define CON3_PIN_MASK 0x03 #define CON3_PIN_SHIFT 3 #define CON3_REVISION_MASK 0x07 #define CON3_REVISION_SHIFT 0 //CON4 #define CON4_RESET_MASK 0x01 #define CON4_RESET_SHIFT 7 #define CON4_I_CHR_MASK 0x07 #define CON4_I_CHR_SHIFT 4 #define CON4_I_TERM_MASK 0x07 #define CON4_I_TERM_SHIFT 0 //CON5 #define CON5_DIS_VREG_MASK 0x01 #define CON5_DIS_VREG_SHIFT 6 #define CON5_IO_LEVEL_MASK 0x01 #define CON5_IO_LEVEL_SHIFT 5 #define CON5_SP_STATUS_MASK 0x01 #define <API key> 4 #define CON5_EN_LEVEL_MASK 0x01 #define CON5_EN_LEVEL_SHIFT 3 #define CON5_VSP_MASK 0x07 #define CON5_VSP_SHIFT 0 //CON6 #define CON6_ISAFE_MASK 0x07 #define CON6_ISAFE_SHIFT 4 #define CON6_VSAFE_MASK 0x0F #define CON6_VSAFE_SHIFT 0 extern void bq24158_set_tmr_rst(u32 val); extern u32 <API key>(void); extern void bq24158_set_en_stat(u32 val); extern u32 <API key>(void); extern u32 <API key>(void); extern u32 <API key>(void); extern void <API key>(u32 val); extern void bq24158_set_v_low(u32 val); extern void bq24158_set_te(u32 val); extern void bq24158_set_ce(u32 val); extern void bq24158_set_hz_mode(u32 val); extern void <API key>(u32 val); extern void bq24158_set_oreg(u32 val); extern void bq24158_set_otg_pl(u32 val); extern void bq24158_set_otg_en(u32 val); extern u32 <API key>(void); extern u32 bq24158_get_pn(void); extern u32 <API key>(void); extern void bq24158_set_reset(u32 val); extern void <API key>(u32 val); extern void bq24158_set_iterm(u32 val); extern void <API key>(u32 val); extern void <API key>(u32 val); extern u32 <API key>(void); extern u32 <API key>(void); extern void bq24158_set_vsp(u32 val); extern void bq24158_set_i_safe(u32 val); extern void bq24158_set_v_safe(u32 val); extern void <API key>(void); extern u32 <API key> (u8 RegNum, u8 val); extern u32 <API key> (u8 RegNum, u8 *val, u8 MASK, u8 SHIFT); extern u32 <API key> (u8 RegNum, u8 val, u8 MASK, u8 SHIFT); #endif // _bq24158_SW_H_
#include "config.h" #if ENABLE(WEBGL) #include "<API key>.h" namespace WebCore { <API key>::<API key>(<API key>& context) : WebGLExtension(context) { } <API key>::~<API key>() = default; WebGLExtension::ExtensionName <API key>::getName() const { return <API key>; } } // namespace WebCore #endif // ENABLE(WEBGL)
const Service = require('./service.js'); class SirenService extends Service { setSiren (trigger) { return new Promise((resolve, reject) => { if (trigger) { this.deviceEmit('siren', {chirp: 2}); } resolve(); }); } } SirenService.type = 'siren'; SirenService.friendly_type = 'Siren'; SirenService.indefinite_article = 'A'; SirenService.state_definitions = new Map() .set('trigger', { type: 'boolean', setter: 'setSiren' }); module.exports = SirenService;
<?php namespace eZ\Publish\Core\MVC\Symfony\Event\Tests; use eZ\Publish\API\Repository\Values\Content\ContentInfo; use eZ\Publish\Core\MVC\Symfony\Event\<API key>; use eZ\Publish\Core\Repository\Values\Content\Location; use PHPUnit\Framework\TestCase; class <API key> extends TestCase { public function testConstruct() { $contentInfo = new ContentInfo(); $event = new <API key>($contentInfo); $this->assertSame($contentInfo, $event->getContentInfo()); } public function <API key>() { $contentInfo = new ContentInfo(); $event = new <API key>($contentInfo); $locations = [new Location(), new Location()]; $event->addLocationToClear($locations[0]); $event->addLocationToClear($locations[1]); $this->assertSame($locations, $event->getLocationsToClear()); } public function setLocationsToClear() { $contentInfo = new ContentInfo(); $event = new <API key>($contentInfo); $initialLocations = [new Location(), new Location()]; $event->addLocationToClear($initialLocations[0]); $event->addLocationToClear($initialLocations[1]); $this->assertSame($initialLocations, $event->getLocationsToClear()); $otherLocations = [new Location(), new Location()]; $event->setLocationsToClear($otherLocations); $this->assertSame($otherLocations, $event->getLocationsToClear()); } }
package org.fix4j.test.properties; import org.fix4j.test.util.Keyable; import java.util.LinkedHashMap; import java.util.Map; public enum <API key> implements Keyable<String> { <API key>("fix4j.default.fix.msg.wait.timeout.ms", "2000"), POLL_PERIOD_MS("fix4j.poll.period.ms", "100"), <API key>("fix4j.size.of.recently.sent.messages", "5"), <API key>("fix4j.size.of.discarded.messages", "5"), <API key>("fix4j.display.incoming.message.flags", "true"), <API key>("fix4j.fast.fail.on.trigger.of.incoming.message.flag", "true"), <API key>("fix4j.fast.fail.on.trigger.of.outbound.message.flag", "true"), FIX_FIELD_DELIM("fix4j.fix.field.delim", "(\\||\\^A|\\u0001)"), <API key>("fix4j.default.messages.to.ignore", "35=0"); private final String defaultValue; private final String key; private <API key>(final String key, final String defaultValue) { this.defaultValue = defaultValue; this.key = key; } @Override public String getKey() { return key; } public static PropertySource <API key>(){ final Map<String, String> properties = new LinkedHashMap<>(<API key>.values().length); for (final <API key> key : values()) { properties.put(key.getKey(), key.defaultValue); } return new MapPropertySource(properties, "DefaultValues"); } public String getDefaultValue() { return defaultValue; } }
package com.pi4j.example; import java.io.IOException; import com.pi4j.gpio.extension.pcf.PCF8574GpioProvider; import com.pi4j.gpio.extension.pcf.PCF8574Pin; import com.pi4j.io.gpio.GpioController; import com.pi4j.io.gpio.GpioFactory; import com.pi4j.io.gpio.GpioPinDigitalInput; import com.pi4j.io.gpio.<API key>; import com.pi4j.io.gpio.PinState; import com.pi4j.io.gpio.event.<API key>; import com.pi4j.io.gpio.event.<API key>; import com.pi4j.io.i2c.I2CBus; public class PCF8574GpioExample { public static void main(String args[]) throws <API key>, IOException { System.out.println("<--Pi4J--> PCF8574 GPIO Example ... started."); // create gpio controller final GpioController gpio = GpioFactory.getInstance(); // create custom MCP23017 GPIO provider final PCF8574GpioProvider gpioProvider = new PCF8574GpioProvider(I2CBus.BUS_1, PCF8574GpioProvider.PCF8574A_0x3F); // provision gpio input pins from MCP23017 GpioPinDigitalInput myInputs[] = { gpio.<API key>(gpioProvider, PCF8574Pin.GPIO_00), gpio.<API key>(gpioProvider, PCF8574Pin.GPIO_01), gpio.<API key>(gpioProvider, PCF8574Pin.GPIO_02) }; // create and register gpio pin listener gpio.addListener(new <API key>() { @Override public void <API key>(<API key> event) { // display pin state on console System.out.println(" --> GPIO PIN STATE CHANGE: " + event.getPin() + " = " + event.getState()); } }, myInputs); // provision gpio output pins and make sure they are all LOW at startup <API key> myOutputs[] = { gpio.<API key>(gpioProvider, PCF8574Pin.GPIO_04, PinState.LOW), gpio.<API key>(gpioProvider, PCF8574Pin.GPIO_05, PinState.LOW), gpio.<API key>(gpioProvider, PCF8574Pin.GPIO_06, PinState.LOW) }; // on program shutdown, set the pins back to their default state: HIGH gpio.setShutdownOptions(true, PinState.HIGH, myOutputs); // keep program running for 20 seconds for (int count = 0; count < 10; count++) { gpio.setState(true, myOutputs); Thread.sleep(1000); gpio.setState(false, myOutputs); Thread.sleep(1000); } // stop all GPIO activity/threads by shutting down the GPIO controller // (this method will forcefully shutdown all GPIO monitoring threads and scheduled tasks) gpio.shutdown(); } }
using EasyCrypto; using System; using System.IO; using System.Security.Cryptography; using System.Text; namespace Ombi.Helpers { public static class StringCipher { <summary> Decrypts the specified cipher text. </summary> <param name="cipherText">The cipher text.</param> <param name="passPhrase">The pass phrase.</param> <returns></returns> public static string Decrypt(string cipherText, string passPhrase) { var fullCipher = Convert.FromBase64String(cipherText); var iv = new byte[16]; var cipher = new byte[16]; Buffer.BlockCopy(fullCipher, 0, iv, 0, iv.Length); Buffer.BlockCopy(fullCipher, iv.Length, cipher, 0, iv.Length); var key = Encoding.UTF8.GetBytes(passPhrase); using (var aesAlg = Aes.Create()) { using (var decryptor = aesAlg.CreateDecryptor(key, iv)) { string result; using (var msDecrypt = new MemoryStream(cipher)) { using (var csDecrypt = new CryptoStream(msDecrypt, decryptor, CryptoStreamMode.Read)) { using (var srDecrypt = new StreamReader(csDecrypt)) { result = srDecrypt.ReadToEnd(); } } } return result; } } } <summary> Encrypts the specified plain text. </summary> <param name="plainText">The plain text.</param> <param name="passPhrase">The pass phrase.</param> <returns></returns> public static string Encrypt(string plainText, string passPhrase) { var key = Encoding.UTF8.GetBytes(passPhrase); using (var aesAlg = Aes.Create()) { using (var encryptor = aesAlg.CreateEncryptor(key, aesAlg.IV)) { using (var msEncrypt = new MemoryStream()) { using (var csEncrypt = new CryptoStream(msEncrypt, encryptor, CryptoStreamMode.Write)) using (var swEncrypt = new StreamWriter(csEncrypt)) { swEncrypt.Write(plainText); } var iv = aesAlg.IV; var decryptedContent = msEncrypt.ToArray(); var result = new byte[iv.Length + decryptedContent.Length]; Buffer.BlockCopy(iv, 0, result, 0, iv.Length); Buffer.BlockCopy(decryptedContent, 0, result, iv.Length, decryptedContent.Length); return Convert.ToBase64String(result); } } } } public static string EncryptString(string text, string keyString) { var t = Encoding.UTF8.GetBytes(text); var result = Convert.ToBase64String(t); return result; } public static string DecryptString(string cipherText, string keyString) { var textAsBytes = Convert.FromBase64String(cipherText); var result = Encoding.UTF8.GetString(textAsBytes); return result; } } }
#include "cache.h" #include <stdio.h> #include <stdlib.h> #include <string.h> #include <errno.h> #include <glib.h> #include <pthread.h> struct cache { int on; unsigned stat_timeout; unsigned dir_timeout; unsigned link_timeout; struct <API key> *next_oper; GHashTable *table; pthread_mutex_t lock; time_t last_cleaned; }; struct cache cache; struct node { struct stat stat; int not_found; time_t stat_valid; char **dir; time_t dir_valid; char *link; time_t link_valid; time_t valid; }; struct <API key> { const char *path; fuse_dirh_t h; fuse_dirfil_t filler; GPtrArray *dir; }; static void free_node(gpointer node_) { struct node *node = (struct node *) node_; g_strfreev(node->dir); g_free(node); } static int cache_clean_entry(void *key_, struct node *node, time_t *now) { (void) key_; if (*now > node->valid) return TRUE; else return FALSE; } static void cache_clean(void) { time_t now = time(NULL); if (now > cache.last_cleaned + <API key> && (g_hash_table_size(cache.table) > MAX_CACHE_SIZE || now > cache.last_cleaned + <API key>)) { <API key>(cache.table, (GHRFunc) cache_clean_entry, &now); cache.last_cleaned = now; } } static struct node *cache_lookup(const char *path) { return (struct node *) g_hash_table_lookup(cache.table, path); } static void cache_purge(const char *path) { g_hash_table_remove(cache.table, path); } static void cache_purge_parent(const char *path) { const char *s = strrchr(path, '/'); if (s) { if (s == path) g_hash_table_remove(cache.table, "/"); else { char *parent = g_strndup(path, s - path); cache_purge(parent); g_free(parent); } } } static void cache_invalidate(const char *path) { pthread_mutex_lock(&cache.lock); cache_purge(path); <API key>(&cache.lock); } static void <API key>(const char *path) { pthread_mutex_lock(&cache.lock); cache_purge(path); cache_purge_parent(path); <API key>(&cache.lock); } static void cache_do_rename(const char *from, const char *to) { pthread_mutex_lock(&cache.lock); cache_purge(from); cache_purge(to); cache_purge_parent(from); cache_purge_parent(to); <API key>(&cache.lock); } static struct node *cache_get(const char *path) { struct node *node = cache_lookup(path); if (node == NULL) { char *pathcopy = g_strdup(path); node = g_new0(struct node, 1); g_hash_table_insert(cache.table, pathcopy, node); } return node; } void cache_add_attr(const char *path, const struct stat *stbuf) { struct node *node; time_t now; pthread_mutex_lock(&cache.lock); node = cache_get(path); now = time(NULL); if (stbuf) { node->stat = *stbuf; node->not_found = 0; } else { node->not_found = 1; } node->stat_valid = time(NULL) + cache.stat_timeout; if (node->stat_valid > node->valid) node->valid = node->stat_valid; cache_clean(); <API key>(&cache.lock); } void cache_add_dir(const char *path, char **dir) { struct node *node; time_t now; pthread_mutex_lock(&cache.lock); node = cache_get(path); now = time(NULL); g_strfreev(node->dir); node->dir = dir; node->not_found = 0; node->dir_valid = time(NULL) + cache.dir_timeout; if (node->dir_valid > node->valid) node->valid = node->dir_valid; cache_clean(); <API key>(&cache.lock); } static size_t my_strnlen(const char *s, size_t maxsize) { const char *p; for (p = s; maxsize && *p; maxsize return p - s; } void cache_add_link(const char *path, const char *link, size_t size) { struct node *node; time_t now; pthread_mutex_lock(&cache.lock); node = cache_get(path); now = time(NULL); g_free(node->link); node->link = g_strndup(link, my_strnlen(link, size-1)); node->not_found = 0; node->link_valid = time(NULL) + cache.link_timeout; if (node->link_valid > node->valid) node->valid = node->link_valid; cache_clean(); <API key>(&cache.lock); } static int cache_get_attr(const char *path, struct stat *stbuf) { struct node *node; int err = -EAGAIN; pthread_mutex_lock(&cache.lock); node = cache_lookup(path); if (node != NULL) { time_t now = time(NULL); if (node->stat_valid - now >= 0) { if (node->not_found) { err = -ENOENT; } else { *stbuf = node->stat; err = 0; } } } <API key>(&cache.lock); return err; } static int cache_getattr(const char *path, struct stat *stbuf) { int err = cache_get_attr(path, stbuf); if (err == -EAGAIN) { err = cache.next_oper->oper.getattr(path, stbuf); if (!err) cache_add_attr(path, stbuf); else if (err == -ENOENT) cache_add_attr(path, NULL); } return err; } static int cache_readlink(const char *path, char *buf, size_t size) { struct node *node; int err; pthread_mutex_lock(&cache.lock); node = cache_lookup(path); if (node != NULL) { time_t now = time(NULL); if (node->link_valid - now >= 0) { strncpy(buf, node->link, size-1); buf[size-1] = '\0'; <API key>(&cache.lock); return 0; } } <API key>(&cache.lock); err = cache.next_oper->oper.readlink(path, buf, size); if (!err) cache_add_link(path, buf, size); return err; } static int cache_dirfill(fuse_cache_dirh_t ch, const char *name, const struct stat *stbuf) { int err = ch->filler(ch->h, name, 0, 0); if (!err) { char *fullpath; g_ptr_array_add(ch->dir, g_strdup(name)); fullpath = g_strdup_printf("%s/%s", !ch->path[1] ? "" : ch->path, name); cache_add_attr(fullpath, stbuf); g_free(fullpath); } return err; } static int cache_getdir(const char *path, fuse_dirh_t h, fuse_dirfil_t filler) { struct <API key> ch; int err; char **dir; struct node *node; pthread_mutex_lock(&cache.lock); node = cache_lookup(path); if (node != NULL && node->dir != NULL) { time_t now = time(NULL); if (node->dir_valid - now >= 0) { for(dir = node->dir; *dir != NULL; dir++) filler(h, *dir, 0, 0); <API key>(&cache.lock); return 0; } } <API key>(&cache.lock); ch.path = path; ch.h = h; ch.filler = filler; ch.dir = g_ptr_array_new(); err = cache.next_oper->cache_getdir(path, &ch, cache_dirfill); g_ptr_array_add(ch.dir, NULL); dir = (char **) ch.dir->pdata; if (!err) cache_add_dir(path, dir); else g_strfreev(dir); g_ptr_array_free(ch.dir, FALSE); return err; } static int cache_unity_dirfill(fuse_cache_dirh_t ch, const char *name, const struct stat *stbuf) { (void) stbuf; return ch->filler(ch->h, name, 0, 0); } static int cache_unity_getdir(const char *path, fuse_dirh_t h, fuse_dirfil_t filler) { struct <API key> ch; ch.h = h; ch.filler = filler; return cache.next_oper->cache_getdir(path, &ch, cache_unity_dirfill); } static int cache_mknod(const char *path, mode_t mode, dev_t rdev) { int err = cache.next_oper->oper.mknod(path, mode, rdev); if (!err) <API key>(path); return err; } static int cache_mkdir(const char *path, mode_t mode) { int err = cache.next_oper->oper.mkdir(path, mode); if (!err) <API key>(path); return err; } static int cache_unlink(const char *path) { int err = cache.next_oper->oper.unlink(path); if (!err) <API key>(path); return err; } static int cache_rmdir(const char *path) { int err = cache.next_oper->oper.rmdir(path); if (!err) <API key>(path); return err; } static int cache_symlink(const char *from, const char *to) { int err = cache.next_oper->oper.symlink(from, to); if (!err) <API key>(to); return err; } static int cache_rename(const char *from, const char *to) { int err = cache.next_oper->oper.rename(from, to); if (!err) cache_do_rename(from, to); return err; } static int cache_link(const char *from, const char *to) { int err = cache.next_oper->oper.link(from, to); if (!err) { cache_invalidate(from); <API key>(to); } return err; } static int cache_chmod(const char *path, mode_t mode) { int err = cache.next_oper->oper.chmod(path, mode); if (!err) cache_invalidate(path); return err; } static int cache_chown(const char *path, uid_t uid, gid_t gid) { int err = cache.next_oper->oper.chown(path, uid, gid); if (!err) cache_invalidate(path); return err; } static int cache_truncate(const char *path, off_t size) { int err = cache.next_oper->oper.truncate(path, size); if (!err) cache_invalidate(path); return err; } static int cache_utime(const char *path, struct utimbuf *buf) { int err = cache.next_oper->oper.utime(path, buf); if (!err) cache_invalidate(path); return err; } static int cache_write(const char *path, const char *buf, size_t size, off_t offset, struct fuse_file_info *fi) { int res = cache.next_oper->oper.write(path, buf, size, offset, fi); if (res >= 0) cache_invalidate(path); return res; } #if FUSE_VERSION >= 25 static int cache_create(const char *path, mode_t mode, struct fuse_file_info *fi) { int err = cache.next_oper->oper.create(path, mode, fi); if (!err) <API key>(path); return err; } static int cache_ftruncate(const char *path, off_t size, struct fuse_file_info *fi) { int err = cache.next_oper->oper.ftruncate(path, size, fi); if (!err) cache_invalidate(path); return err; } static int cache_fgetattr(const char *path, struct stat *stbuf, struct fuse_file_info *fi) { int err = cache_get_attr(path, stbuf); if (err == -EAGAIN) { err = cache.next_oper->oper.fgetattr(path, stbuf, fi); if (!err) cache_add_attr(path, stbuf); else if (err == -ENOENT) cache_add_attr(path, NULL); } return err; } #endif static void cache_unity_fill(struct <API key> *oper, struct fuse_operations *cache_oper) { #if FUSE_VERSION >= 23 cache_oper->init = oper->oper.init; #endif cache_oper->getattr = oper->oper.getattr; cache_oper->readlink = oper->oper.readlink; cache_oper->getdir = cache_unity_getdir; cache_oper->mknod = oper->oper.mknod; cache_oper->mkdir = oper->oper.mkdir; cache_oper->symlink = oper->oper.symlink; cache_oper->unlink = oper->oper.unlink; cache_oper->rmdir = oper->oper.rmdir; cache_oper->rename = oper->oper.rename; cache_oper->link = oper->oper.link; cache_oper->chmod = oper->oper.chmod; cache_oper->chown = oper->oper.chown; cache_oper->truncate = oper->oper.truncate; cache_oper->utime = oper->oper.utime; cache_oper->open = oper->oper.open; cache_oper->read = oper->oper.read; cache_oper->write = oper->oper.write; cache_oper->flush = oper->oper.flush; cache_oper->release = oper->oper.release; cache_oper->fsync = oper->oper.fsync; cache_oper->statfs = oper->oper.statfs; cache_oper->setxattr = oper->oper.setxattr; cache_oper->getxattr = oper->oper.getxattr; cache_oper->listxattr = oper->oper.listxattr; cache_oper->removexattr = oper->oper.removexattr; #if FUSE_VERSION >= 25 cache_oper->create = oper->oper.create; cache_oper->ftruncate = oper->oper.ftruncate; cache_oper->fgetattr = oper->oper.fgetattr; #endif } struct fuse_operations *cache_init(struct <API key> *oper) { static struct fuse_operations cache_oper; cache.next_oper = oper; cache_unity_fill(oper, &cache_oper); if (cache.on) { cache_oper.getattr = oper->oper.getattr ? cache_getattr : NULL; cache_oper.readlink = oper->oper.readlink ? cache_readlink : NULL; cache_oper.getdir = oper->cache_getdir ? cache_getdir : NULL; cache_oper.mknod = oper->oper.mknod ? cache_mknod : NULL; cache_oper.mkdir = oper->oper.mkdir ? cache_mkdir : NULL; cache_oper.symlink = oper->oper.symlink ? cache_symlink : NULL; cache_oper.unlink = oper->oper.unlink ? cache_unlink : NULL; cache_oper.rmdir = oper->oper.rmdir ? cache_rmdir : NULL; cache_oper.rename = oper->oper.rename ? cache_rename : NULL; cache_oper.link = oper->oper.link ? cache_link : NULL; cache_oper.chmod = oper->oper.chmod ? cache_chmod : NULL; cache_oper.chown = oper->oper.chown ? cache_chown : NULL; cache_oper.truncate = oper->oper.truncate ? cache_truncate : NULL; cache_oper.utime = oper->oper.utime ? cache_utime : NULL; cache_oper.write = oper->oper.write ? cache_write : NULL; #if FUSE_VERSION >= 25 cache_oper.create = oper->oper.create ? cache_create : NULL; cache_oper.ftruncate = oper->oper.ftruncate ? cache_ftruncate : NULL; cache_oper.fgetattr = oper->oper.fgetattr ? cache_fgetattr : NULL; #endif pthread_mutex_init(&cache.lock, NULL); cache.table = <API key>(g_str_hash, g_str_equal, g_free, free_node); if (cache.table == NULL) { fprintf(stderr, "failed to create cache\n"); return NULL; } } return &cache_oper; } static const struct fuse_opt cache_opts[] = { { "cache=yes", offsetof(struct cache, on), 1 }, { "cache=no", offsetof(struct cache, on), 0 }, { "cache_timeout=%u", offsetof(struct cache, stat_timeout), 0 }, { "cache_timeout=%u", offsetof(struct cache, dir_timeout), 0 }, { "cache_timeout=%u", offsetof(struct cache, link_timeout), 0 }, { "cache_stat_timeout=%u", offsetof(struct cache, stat_timeout), 0 }, { "cache_dir_timeout=%u", offsetof(struct cache, dir_timeout), 0 }, { "cache_link_timeout=%u", offsetof(struct cache, link_timeout), 0 }, FUSE_OPT_END }; int cache_parse_options(struct fuse_args *args) { cache.stat_timeout = <API key>; cache.dir_timeout = <API key>; cache.link_timeout = <API key>; cache.on = 1; return fuse_opt_parse(args, &cache, cache_opts, NULL); }
#include "hardware.h" static void *cdc_entry = NULL; static uint8_t cdc_flags = 0; #ifndef <API key> #define <API key> 0xEF #endif static const struct <API key> dev = { .bLength = USB_DT_DEVICE_SIZE, .bDescriptorType = USB_DT_DEVICE, .bcdUSB = 0x0200, .bDeviceClass = <API key>, .bDeviceSubClass = 2, .bDeviceProtocol = 1, .bMaxPacketSize0 = 64, .idVendor = 0x1029, .idProduct = 0x2016, .bcdDevice = 0x0200, .iManufacturer = 1, .iProduct = 2, .iSerialNumber = 3, .bNumConfigurations = 1, }; /* * This notification endpoint isn't implemented. According to CDC spec it's * optional, but its absence causes a NULL pointer dereference in the * Linux cdc_acm driver. */ static const struct <API key> comm_endp[] = {{ .bLength = <API key>, .bDescriptorType = USB_DT_ENDPOINT, .bEndpointAddress = 0x83, .bmAttributes = <API key>, .wMaxPacketSize = 16, .bInterval = 255, }}; static const struct <API key> data_endp[] = {{ .bLength = <API key>, .bDescriptorType = USB_DT_ENDPOINT, .bEndpointAddress = 0x01, .bmAttributes = <API key>, .wMaxPacketSize = 64, .bInterval = 1, }, { .bLength = <API key>, .bDescriptorType = USB_DT_ENDPOINT, .bEndpointAddress = 0x82, .bmAttributes = <API key>, .wMaxPacketSize = 64, .bInterval = 1, }}; static const struct <API key> msc_endp[] = {{ .bLength = <API key>, .bDescriptorType = USB_DT_ENDPOINT, .bEndpointAddress = 0x04, .bmAttributes = <API key>, .wMaxPacketSize = 64, .bInterval = 0, }, { .bLength = <API key>, .bDescriptorType = USB_DT_ENDPOINT, .bEndpointAddress = 0x85, .bmAttributes = <API key>, .wMaxPacketSize = 64, .bInterval = 0, }}; static const struct { struct <API key> header; struct <API key> call_mgmt; struct <API key> acm; struct <API key> cdc_union; } __attribute__((packed)) <API key> = { .header = { .bFunctionLength = sizeof(struct <API key>), .bDescriptorType = CS_INTERFACE, .bDescriptorSubtype = USB_CDC_TYPE_HEADER, .bcdCDC = 0x0110, }, .call_mgmt = { .bFunctionLength = sizeof(struct <API key>), .bDescriptorType = CS_INTERFACE, .bDescriptorSubtype = <API key>, .bmCapabilities = 0, .bDataInterface = 1, }, .acm = { .bFunctionLength = sizeof(struct <API key>), .bDescriptorType = CS_INTERFACE, .bDescriptorSubtype = USB_CDC_TYPE_ACM, .bmCapabilities = 0, }, .cdc_union = { .bFunctionLength = sizeof(struct <API key>), .bDescriptorType = CS_INTERFACE, .bDescriptorSubtype = USB_CDC_TYPE_UNION, .bControlInterface = 0, .<API key> = 1, } }; static const struct <API key> comm_iface[] = {{ .bLength = <API key>, .bDescriptorType = USB_DT_INTERFACE, .bInterfaceNumber = 0, .bAlternateSetting = 0, .bNumEndpoints = 1, .bInterfaceClass = USB_CLASS_CDC, .bInterfaceSubClass = <API key>, .bInterfaceProtocol = USB_CDC_PROTOCOL_AT, .iInterface = 0, .endpoint = comm_endp, .extra = &<API key>, .extralen = sizeof(<API key>) }}; static const struct <API key> data_iface[] = {{ .bLength = <API key>, .bDescriptorType = USB_DT_INTERFACE, .bInterfaceNumber = 1, .bAlternateSetting = 0, .bNumEndpoints = 2, .bInterfaceClass = USB_CLASS_DATA, .bInterfaceSubClass = 0, .bInterfaceProtocol = 0, .iInterface = 0, .endpoint = data_endp, }}; static const struct <API key> msc_iface[] = {{ .bLength = <API key>, .bDescriptorType = USB_DT_INTERFACE, .bInterfaceNumber = 2, .bAlternateSetting = 0, .bNumEndpoints = 2, .bInterfaceClass = USB_CLASS_MSC, .bInterfaceSubClass = <API key>, .bInterfaceProtocol = <API key>, .iInterface = 0, .endpoint = msc_endp, }}; static const struct usb_interface ifaces[] = {{ .num_altsetting = 1, .altsetting = comm_iface, }, { .num_altsetting = 1, .altsetting = data_iface, }, { .num_altsetting = 1, .altsetting = msc_iface, }}; static const struct <API key> config = { .bLength = <API key>, .bDescriptorType = <API key>, .wTotalLength = 0, .bNumInterfaces = 3, .bConfigurationValue = 1, .iConfiguration = 0, .bmAttributes = 0x80, .bMaxPower = 0x32, .interface = ifaces, }; static const char *usb_strings[] = { "Cupkee", "Cupkee-Iface", "SN:", }; /* Buffer to be used for control requests. */ uint8_t usbd_control_buffer[128]; static usbd_device *usb_hnd; static int <API key>(usbd_device *usbd_dev, struct usb_setup_data *req, uint8_t **buf, uint16_t *len, void (**complete)(usbd_device *usbd_dev, struct usb_setup_data *req)) { (void)complete; (void)buf; (void)usbd_dev; switch (req->bRequest) { case <API key>: { } return USBD_REQ_HANDLED; case <API key>: if (*len < sizeof(struct usb_cdc_line_coding)) return USBD_REQ_NOTSUPP; return USBD_REQ_HANDLED; } return USBD_REQ_NOTSUPP; } static inline int cdc_send_byte(uint8_t c) { return <API key>(usb_hnd, 0x82, &c, 1); } static inline int cdc_recv_byte(uint8_t *c) { return usbd_ep_read_packet(usb_hnd, 0x01, c, 1); } static void cdcacm_data_rx_cb(usbd_device *usbd_dev, uint8_t ep) { (void)usbd_dev; (void)ep; if (cdc_flags & HW_FL_RXE) { uint8_t data; while (1 == cdc_recv_byte(&data)) { if (1 != cupkee_device_push(cdc_entry, 1, &data)) { cdc_flags &= ~HW_FL_RXE; break; } } } } static void cdcacm_data_tx_cb(usbd_device *usbd_dev, uint8_t ep) { (void)usbd_dev; (void)ep; if (cdc_flags & HW_FL_TXE) { uint8_t data; while (1 == cupkee_device_pull(cdc_entry, 1, &data)) { if (1 != cdc_send_byte(data)) { cupkee_unshift(cdc_entry, data); cdc_flags &= ~HW_FL_TXE; break; } } } } static void cdcacm_set_config(usbd_device *usbd_dev, uint16_t wValue) { (void)wValue; usbd_ep_setup(usbd_dev, 0x01, <API key>, 64, cdcacm_data_rx_cb); usbd_ep_setup(usbd_dev, 0x82, <API key>, 64, cdcacm_data_tx_cb); usbd_ep_setup(usbd_dev, 0x83, <API key>, 16, NULL); <API key>( usbd_dev, USB_REQ_TYPE_CLASS | <API key>, USB_REQ_TYPE_TYPE | <API key>, <API key>); } static int cdc_reset(int instance) { (void) instance; return 0; } static int cdc_setup(int instance, void *entry) { if (instance == 0) { cdc_entry = entry; cdc_flags |= HW_FL_RXE | HW_FL_TXE; } return 0; } static int cdc_request(int instance) { if (instance == 0 && cdc_flags == 0) { cdc_flags = HW_FL_USED; return 0; } else { return -CUPKEE_ERESOURCE; } } static int cdc_release(int instance) { if (instance == 0) { cdc_flags = 0; return 0; } else { return -CUPKEE_EINVAL; } } static int cdc_write(int instance, size_t n, const void *data) { (void) instance; if (n && data) { const uint8_t *ptr = data; size_t i = 0; for (i = 0; i < n; i++) { while (!cdc_send_byte(ptr[i])) ; } return i; } cdc_flags |= HW_FL_TXE; return 0; } static int cdc_read(int instance, size_t n, void *data) { (void) instance; if (n && data) { uint8_t *ptr = data; size_t i; for (i = 0; i < n; i++) { while (!cdc_recv_byte(ptr + i)) ; } return i; } cdc_flags |= HW_FL_RXE; return 0; } static const cupkee_driver_t cdc_driver = { .request = cdc_request, .release = cdc_release, .reset = cdc_reset, .setup = cdc_setup, .read = cdc_read, .write = cdc_write, }; static const <API key> hw_device_cdc = { .name = "usb-cdc", .inst_max = 1, .conf_init = NULL, .driver = &cdc_driver }; void hw_setup_usb(void) { usb_hnd = usbd_init(&<API key>, &dev, &config, usb_strings, 3, usbd_control_buffer, sizeof(usbd_control_buffer)); <API key>(usb_hnd, cdcacm_set_config); usb_msc_init(usb_hnd, 0x85, 64, 0x04, 64, "cupkee", "cupdisk", "0.01", <API key>, cupkee_sysdisk_read, <API key>); cdc_entry = NULL; cdc_flags = 0; //_usbd_reset(usb_hnd); <API key>(&hw_device_cdc); } void hw_poll_usb(void) { usbd_poll(usb_hnd); }
/* Do not modify this file. */ /* It is created automatically by the ASN.1 to Wireshark dissector compiler */ /* packet-cmip.c */ /* ../../tools/asn2wrs.py -b -p cmip -c ./cmip.cnf -s ./<API key> -D . -O ../../epan/dissectors CMIP-1.asn <API key>.asn <API key>.asn ../x721/<API key>.asn ../ros/<API key>.asn ../ros/<API key>.asn */ /* Input file: <API key>.c */ #line 1 "../../asn1/cmip/<API key>.c" #ifdef HAVE_CONFIG_H # include "config.h" #endif #include <glib.h> #include <epan/packet.h> #include <epan/oids.h> #include <epan/asn1.h> #include "packet-ber.h" #include "packet-acse.h" #include "packet-x509if.h" #include "packet-cmip.h" #define PNAME "X711 CMIP" #define PSNAME "CMIP" #define PFNAME "cmip" /* XXX some stuff we need until we can get rid of it */ #include "packet-ses.h" #include "packet-pres.h" /* Initialize the protocol and registered fields */ static int proto_cmip = -1; static int <API key> = -1; static int <API key> = -1; static int <API key> = -1; static int hf_cmip_errorId_OID = -1; static int <API key> = -1; static int hf_Destination = -1; static int hf_NameBinding = -1; static int hf_ObjectClass = -1; #line 1 "../../asn1/cmip/packet-cmip-hf.c" static int <API key> = -1; /* BaseManagedObjectId */ static int <API key> = -1; /* EventTypeId */ static int <API key> = -1; /* ObjectClass */ static int <API key> = -1; /* ActiveDestination */ static int <API key> = -1; /* AdditionalText */ static int <API key> = -1; /* <API key> */ static int <API key> = -1; /* Allomorphs */ static int <API key> = -1; /* AdministrativeState */ static int <API key> = -1; /* <API key> */ static int <API key> = -1; /* AttributeList */ static int <API key> = -1; /* <API key> */ static int <API key> = -1; /* AlarmStatus */ static int <API key> = -1; /* AvailabilityStatus */ static int <API key> = -1; /* BackedUpStatus */ static int <API key> = -1; /* <API key> */ static int <API key> = -1; /* <API key> */ static int <API key> = -1; /* <API key> */ static int <API key> = -1; /* ConfirmedMode */ static int <API key> = -1; /* ControlStatus */ static int <API key> = -1; /* <API key> */ static int <API key> = -1; /* CurrentLogSize */ static int <API key> = -1; /* Destination */ static int <API key> = -1; /* <API key> */ static int <API key> = -1; /* EventTime */ static int <API key> = -1; /* GroupObjects */ static int <API key> = -1; /* IntervalsOfDay */ static int <API key> = -1; /* LifecycleState */ static int <API key> = -1; /* LogFullAction */ static int <API key> = -1; /* LoggingTime */ static int <API key> = -1; /* LogRecordId */ static int <API key> = -1; /* MaxLogSize */ static int <API key> = -1; /* MonitoredAttributes */ static int <API key> = -1; /* NameBinding */ static int <API key> = -1; /* <API key> */ static int <API key> = -1; /* NumberOfRecords */ static int <API key> = -1; /* OperationalState */ static int <API key> = -1; /* Packages */ static int <API key> = -1; /* PerceivedSeverity */ static int <API key> = -1; /* PrioritisedObject */ static int <API key> = -1; /* ProbableCause */ static int <API key> = -1; /* ProceduralStatus */ static int <API key> = -1; /* <API key> */ static int <API key> = -1; /* SecurityAlarmCause */ static int <API key> = -1; /* <API key> */ static int <API key> = -1; /* <API key> */ static int <API key> = -1; /* ServiceProvider */ static int <API key> = -1; /* ServiceUser */ static int <API key> = -1; /* SimpleNameType */ static int <API key> = -1; /* SourceIndicator */ static int <API key> = -1; /* SpecificProblems */ static int <API key> = -1; /* StandbyStatus */ static int <API key> = -1; /* StartTime */ static int <API key> = -1; /* StopTime */ static int <API key> = -1; /* SupportedFeatures */ static int <API key> = -1; /* SystemId */ static int <API key> = -1; /* SystemTitle */ static int <API key> = -1; /* ThresholdInfo */ static int <API key> = -1; /* TrendIndication */ static int <API key> = -1; /* UnknownStatus */ static int <API key> = -1; /* UsageState */ static int <API key> = -1; /* WeekMask */ static int <API key> = -1; /* AttributeId */ static int <API key> = -1; /* ObjectClass */ static int <API key> = -1; /* ObjectInstance */ static int hf_cmip_currentTime = -1; /* GeneralizedTime */ static int <API key> = -1; /* ActionErrorInfo */ static int <API key> = -1; /* <API key> */ static int <API key> = -1; /* T_actionErrorInfo */ static int hf_cmip_actionType = -1; /* ActionTypeId */ static int <API key> = -1; /* NoSuchArgument */ static int <API key> = -1; /* <API key> */ static int <API key> = -1; /* T_actionInfoArg */ static int <API key> = -1; /* T_actionReplyInfo */ static int hf_cmip_actionReply = -1; /* ActionReply */ static int <API key> = -1; /* <API key> */ static int hf_cmip_localForm = -1; /* INTEGER */ static int hf_cmip_attributeid = -1; /* AttributeId */ static int hf_cmip_value = -1; /* AttributeValue */ static int <API key> = -1; /* <API key> */ static int <API key> = -1; /* ModifyOperator */ static int hf_cmip_attributeId = -1; /* AttributeId */ static int <API key> = -1; /* T_attributeValue */ static int <API key> = -1; /* <API key> */ static int <API key> = -1; /* <API key> */ static int <API key> = -1; /* <API key> */ static int hf_cmip_id = -1; /* T_id */ static int <API key> = -1; /* <API key> */ static int <API key> = -1; /* ObjectClass */ static int <API key> = -1; /* ObjectInstance */ static int hf_cmip_item = -1; /* FilterItem */ static int hf_cmip_and = -1; /* SET_OF_CMISFilter */ static int hf_cmip_and_item = -1; /* CMISFilter */ static int hf_cmip_or = -1; /* SET_OF_CMISFilter */ static int hf_cmip_or_item = -1; /* CMISFilter */ static int hf_cmip_not = -1; /* CMISFilter */ static int hf_cmip_scope = -1; /* Scope */ static int hf_cmip_filter = -1; /* CMISFilter */ static int hf_cmip_sync = -1; /* CMISSync */ static int <API key> = -1; /* <API key> */ static int <API key> = -1; /* ObjectInstance */ static int <API key> = -1; /* AccessControl */ static int <API key> = -1; /* ObjectInstance */ static int <API key> = -1; /* SET_OF_Attribute */ static int <API key> = -1; /* Attribute */ static int <API key> = -1; /* T_deleteErrorInfo */ static int hf_cmip_eventType = -1; /* EventTypeId */ static int <API key> = -1; /* T_eventReplyInfo */ static int hf_cmip_eventTime = -1; /* GeneralizedTime */ static int <API key> = -1; /* <API key> */ static int hf_cmip_eventReply = -1; /* EventReply */ static int <API key> = -1; /* <API key> */ static int hf_cmip_equality = -1; /* Attribute */ static int hf_cmip_substrings = -1; /* T_substrings */ static int <API key> = -1; /* T_substrings_item */ static int <API key> = -1; /* Attribute */ static int hf_cmip_anyString = -1; /* Attribute */ static int hf_cmip_finalString = -1; /* Attribute */ static int <API key> = -1; /* Attribute */ static int hf_cmip_lessOrEqual = -1; /* Attribute */ static int <API key> = -1; /* AttributeId */ static int hf_cmip_subsetOf = -1; /* Attribute */ static int hf_cmip_supersetOf = -1; /* Attribute */ static int <API key> = -1; /* Attribute */ static int <API key> = -1; /* AttributeIdError */ static int hf_cmip_attribute = -1; /* Attribute */ static int hf_cmip_getInfoList = -1; /* <API key> */ static int <API key> = -1; /* GetInfoStatus */ static int hf_cmip_actionValue = -1; /* ActionInfo */ static int hf_cmip_eventValue = -1; /* T_eventValue */ static int hf_cmip_eventInfo = -1; /* T_eventInfo */ static int hf_cmip_getResult = -1; /* GetResult */ static int <API key> = -1; /* GetListError */ static int hf_cmip_setResult = -1; /* SetResult */ static int <API key> = -1; /* SetListError */ static int <API key> = -1; /* ActionResult */ static int <API key> = -1; /* ProcessingFailure */ static int <API key> = -1; /* DeleteResult */ static int hf_cmip_actionError = -1; /* ActionError */ static int hf_cmip_deleteError = -1; /* DeleteError */ static int hf_cmip_actionId = -1; /* T_actionId */ static int hf_cmip_eventId = -1; /* T_eventId */ static int <API key> = -1; /* <API key> */ static int <API key> = -1; /* <API key> */ static int <API key> = -1; /* DistinguishedName */ static int <API key> = -1; /* OCTET_STRING */ static int <API key> = -1; /* RDNSequence */ static int <API key> = -1; /* SpecificErrorInfo */ static int <API key> = -1; /* <API key> */ static int <API key> = -1; /* <API key> */ static int <API key> = -1; /* T_namedNumbers */ static int <API key> = -1; /* INTEGER */ static int <API key> = -1; /* INTEGER */ static int <API key> = -1; /* AttributeError */ static int hf_cmip_setInfoList = -1; /* <API key> */ static int <API key> = -1; /* SetInfoStatus */ static int hf_cmip_errorId = -1; /* T_errorId */ static int hf_cmip_errorInfo = -1; /* T_errorInfo */ static int hf_cmip_abortSource = -1; /* CMIPAbortSource */ static int hf_cmip_userInfo = -1; /* EXTERNAL */ static int <API key> = -1; /* ProtocolVersion */ static int <API key> = -1; /* FunctionalUnits */ static int <API key> = -1; /* EXTERNAL */ static int <API key> = -1; /* ManagementExtension */ static int <API key> = -1; /* ObjectClass */ static int <API key> = -1; /* AttributeId */ static int <API key> = -1; /* Attribute */ static int <API key> = -1; /* <API key> */ static int <API key> = -1; /* T_oldAttributeValue */ static int <API key> = -1; /* T_newAttributeValue */ static int <API key> = -1; /* AlarmStatus_item */ static int <API key> = -1; /* <API key> */ static int <API key> = -1; /* AE_title */ static int hf_cmip_objectName = -1; /* ObjectInstance */ static int hf_cmip_noObject = -1; /* NULL */ static int <API key> = -1; /* INTEGER_0_100 */ static int <API key> = -1; /* ControlStatus_item */ static int <API key> = -1; /* <API key> */ static int <API key> = -1; /* <API key> */ static int <API key> = -1; /* <API key> */ static int <API key> = -1; /* ObjectInstance */ static int hf_cmip_single = -1; /* AE_title */ static int hf_cmip_multiple = -1; /* SET_OF_AE_title */ static int <API key> = -1; /* AE_title */ static int <API key> = -1; /* ObjectInstance */ static int <API key> = -1; /* IntervalsOfDay_item */ static int <API key> = -1; /* Time24 */ static int hf_cmip_intervalEnd = -1; /* Time24 */ static int <API key> = -1; /* <API key> */ static int <API key> = -1; /* BOOLEAN */ static int hf_cmip_information = -1; /* T_information */ static int <API key> = -1; /* Attribute */ static int hf_cmip_integer = -1; /* INTEGER */ static int hf_cmip_real = -1; /* REAL */ static int <API key> = -1; /* OBJECT_IDENTIFIER */ static int <API key> = -1; /* <API key> */ static int hf_cmip_object = -1; /* ObjectInstance */ static int hf_cmip_priority = -1; /* T_priority */ static int hf_cmip_globalValue = -1; /* OBJECT_IDENTIFIER */ static int hf_cmip_localValue = -1; /* INTEGER */ static int <API key> = -1; /* <API key> */ static int <API key> = -1; /* SpecificIdentifier */ static int hf_cmip_mechanism = -1; /* OBJECT_IDENTIFIER */ static int hf_cmip_application = -1; /* AE_title */ static int <API key> = -1; /* <API key> */ static int hf_cmip_details = -1; /* T_details */ static int hf_cmip_number = -1; /* INTEGER */ static int hf_cmip_string = -1; /* GraphicString */ static int hf_cmip_oi = -1; /* OBJECT_IDENTIFIER */ static int hf_cmip_int = -1; /* INTEGER */ static int <API key> = -1; /* SpecificIdentifier */ static int hf_cmip_specific = -1; /* GeneralizedTime */ static int hf_cmip_continual = -1; /* NULL */ static int <API key> = -1; /* <API key> */ static int <API key> = -1; /* T_featureIdentifier */ static int hf_cmip_featureInfo = -1; /* T_featureInfo */ static int hf_cmip_name = -1; /* GraphicString */ static int hf_cmip_nothing = -1; /* NULL */ static int hf_cmip_oid = -1; /* OBJECT_IDENTIFIER */ static int hf_cmip_hour = -1; /* INTEGER_0_23 */ static int hf_cmip_minute = -1; /* INTEGER_0_59 */ static int <API key> = -1; /* AttributeId */ static int <API key> = -1; /* ObservedValue */ static int <API key> = -1; /* ThresholdLevelInd */ static int hf_cmip_armTime = -1; /* GeneralizedTime */ static int hf_cmip_up = -1; /* T_up */ static int hf_cmip_high = -1; /* ObservedValue */ static int hf_cmip_low = -1; /* ObservedValue */ static int hf_cmip_down = -1; /* T_down */ static int <API key> = -1; /* WeekMask_item */ static int hf_cmip_daysOfWeek = -1; /* T_daysOfWeek */ static int <API key> = -1; /* IntervalsOfDay */ static int hf_cmip_local = -1; /* T_local */ static int hf_cmip_global = -1; /* OBJECT_IDENTIFIER */ static int hf_cmip_invoke = -1; /* Invoke */ static int <API key> = -1; /* ReturnResult */ static int hf_cmip_returnError = -1; /* ReturnError */ static int hf_cmip_reject = -1; /* Reject */ static int hf_cmip_invokeId = -1; /* InvokeId */ static int hf_cmip_linkedId = -1; /* T_linkedId */ static int <API key> = -1; /* T_linkedIdPresent */ static int hf_cmip_absent = -1; /* NULL */ static int hf_cmip_opcode = -1; /* Code */ static int hf_cmip_argument = -1; /* InvokeArgument */ static int hf_cmip_result = -1; /* T_result */ static int <API key> = -1; /* ResultArgument */ static int hf_cmip_errcode = -1; /* Code */ static int hf_cmip_parameter = -1; /* T_parameter */ static int hf_cmip_problem = -1; /* T_problem */ static int hf_cmip_general = -1; /* GeneralProblem */ static int <API key> = -1; /* InvokeProblem */ static int <API key> = -1; /* ReturnResultProblem */ static int <API key> = -1; /* ReturnErrorProblem */ static int hf_cmip_present = -1; /* INTEGER */ static int <API key> = -1; /* CMISSync */ static int hf_cmip_actionInfo = -1; /* ActionInfo */ static int <API key> = -1; /* SET_OF_AttributeId */ static int <API key> = -1; /* AttributeId */ static int <API key> = -1; /* T_modificationList */ static int <API key> = -1; /* <API key> */ static int <API key> = -1; /* T_attributevalue */ static int <API key> = -1; /* InvokeId_present */ /* named bits */ static int <API key> = -1; static int <API key> = -1; static int <API key> = -1; static int <API key> = -1; static int <API key> = -1; static int <API key> = -1; static int <API key> = -1; static int <API key> = -1; static int <API key> = -1; static int <API key> = -1; static int <API key> = -1; static int <API key> = -1; static int <API key> = -1; static int <API key> = -1; #line 59 "../../asn1/cmip/<API key>.c" /* Initialize the subtree pointers */ static gint ett_cmip = -1; #line 1 "../../asn1/cmip/packet-cmip-ett.c" static gint <API key> = -1; static gint <API key> = -1; static gint <API key> = -1; static gint <API key> = -1; static gint <API key> = -1; static gint ett_cmip_ActionInfo = -1; static gint <API key> = -1; static gint <API key> = -1; static gint <API key> = -1; static gint ett_cmip_Attribute = -1; static gint <API key> = -1; static gint <API key> = -1; static gint <API key> = -1; static gint <API key> = -1; static gint <API key> = -1; static gint ett_cmip_CMISFilter = -1; static gint <API key> = -1; static gint <API key> = -1; static gint <API key> = -1; static gint <API key> = -1; static gint <API key> = -1; static gint <API key> = -1; static gint <API key> = -1; static gint <API key> = -1; static gint <API key> = -1; static gint ett_cmip_EventReply = -1; static gint <API key> = -1; static gint <API key> = -1; static gint <API key> = -1; static gint ett_cmip_FilterItem = -1; static gint <API key> = -1; static gint <API key> = -1; static gint <API key> = -1; static gint <API key> = -1; static gint <API key> = -1; static gint <API key> = -1; static gint ett_cmip_GetResult = -1; static gint <API key> = -1; static gint <API key> = -1; static gint <API key> = -1; static gint <API key> = -1; static gint <API key> = -1; static gint ett_cmip_T_actionId = -1; static gint ett_cmip_T_eventId = -1; static gint <API key> = -1; static gint <API key> = -1; static gint <API key> = -1; static gint <API key> = -1; static gint <API key> = -1; static gint <API key> = -1; static gint ett_cmip_Scope = -1; static gint <API key> = -1; static gint <API key> = -1; static gint <API key> = -1; static gint <API key> = -1; static gint ett_cmip_SetResult = -1; static gint <API key> = -1; static gint <API key> = -1; static gint <API key> = -1; static gint <API key> = -1; static gint <API key> = -1; static gint <API key> = -1; static gint ett_cmip_Allomorphs = -1; static gint <API key> = -1; static gint <API key> = -1; static gint <API key> = -1; static gint <API key> = -1; static gint <API key> = -1; static gint <API key> = -1; static gint <API key> = -1; static gint <API key> = -1; static gint <API key> = -1; static gint <API key> = -1; static gint <API key> = -1; static gint <API key> = -1; static gint <API key> = -1; static gint <API key> = -1; static gint <API key> = -1; static gint <API key> = -1; static gint <API key> = -1; static gint <API key> = -1; static gint <API key> = -1; static gint <API key> = -1; static gint <API key> = -1; static gint ett_cmip_Packages = -1; static gint <API key> = -1; static gint <API key> = -1; static gint <API key> = -1; static gint <API key> = -1; static gint <API key> = -1; static gint <API key> = -1; static gint <API key> = -1; static gint <API key> = -1; static gint <API key> = -1; static gint <API key> = -1; static gint ett_cmip_StopTime = -1; static gint <API key> = -1; static gint <API key> = -1; static gint ett_cmip_SystemId = -1; static gint <API key> = -1; static gint ett_cmip_Time24 = -1; static gint <API key> = -1; static gint <API key> = -1; static gint ett_cmip_T_up = -1; static gint ett_cmip_T_down = -1; static gint ett_cmip_WeekMask = -1; static gint <API key> = -1; static gint <API key> = -1; static gint ett_cmip_Code = -1; static gint ett_cmip_ROS = -1; static gint ett_cmip_Invoke = -1; static gint ett_cmip_T_linkedId = -1; static gint <API key> = -1; static gint ett_cmip_T_result = -1; static gint <API key> = -1; static gint ett_cmip_Reject = -1; static gint ett_cmip_T_problem = -1; static gint ett_cmip_InvokeId = -1; static gint <API key> = -1; static gint <API key> = -1; static gint <API key> = -1; #line 63 "../../asn1/cmip/<API key>.c" static guint32 opcode; /* Dissector table */ static dissector_table_t <API key>; #line 1 "../../asn1/cmip/packet-cmip-table.c" /* CMIP OPERATIONS */ static const value_string cmip_Opcode_vals[] = { { 6, "m_Action" }, { 7, "m_Action_Confirmed" }, { 10, "m_CancelGet" }, { 8, "m_Create" }, { 9, "m_Delete" }, { 0, "m_EventReport" }, { 1, "<API key>" }, { 3, "m_Get" }, { 2, "m_Linked_Reply" }, { 4, "m_Set" }, { 5, "m_Set_Confirmed" }, { 0, NULL } }; /* CMIP ERRORS */ static const value_string <API key>[] = { { 2, "accessDenied" }, { 19, "<API key>" }, { 20, "<API key>" }, { 11, "<API key>" }, { 7, "getListError" }, { 15, "<API key>" }, { 6, "<API key>" }, { 4, "invalidFilter" }, { 17, "<API key>" }, { 16, "invalidScope" }, { 18, "<API key>" }, { 21, "mistypedOperation" }, { 9, "noSuchAction" }, { 14, "noSuchArgument" }, { 5, "noSuchAttribute" }, { 13, "noSuchEventType" }, { 22, "noSuchInvokeId" }, { 0, "noSuchObjectClass" }, { 1, "<API key>" }, { 12, "<API key>" }, { 23, "operationCancelled" }, { 10, "processingFailure" }, { 8, "setListError" }, { 3, "syncNotSupported" }, { 0, NULL } }; #line 70 "../../asn1/cmip/<API key>.c" static int opcode_type; #define OPCODE_INVOKE 1 #define <API key> 2 #define OPCODE_RETURN_ERROR 3 #define OPCODE_REJECT 4 static int attributeform; #define <API key> 0 #define <API key> 1 static int attribute_local_id; static const char *<API key>; static const char *<API key>; static const char *<API key>; static int objectclassform; #define <API key> 0 #define <API key> 1 static const char *<API key>; #line 1 "../../asn1/cmip/packet-cmip-val.h" #define smi2AttributeID "2.9.3.2.7" #define smi2AttributeGroup "2.9.3.2.8" #define arfProbableCause "2.9.3.2.0.0" #define adapterError arfProbableCause".1" #define <API key> arfProbableCause".2" #define bandwidthReduced arfProbableCause".3" #define <API key> arfProbableCause".4" #define <API key> arfProbableCause".5" #define <API key> arfProbableCause".6" #define <API key> arfProbableCause".7" #define congestion arfProbableCause".8" #define corruptData arfProbableCause".9" #define <API key> arfProbableCause".10" #define dataSetOrModemError arfProbableCause".11" #define degradedSignal arfProbableCause".12" #define <API key> arfProbableCause".13" #define enclosureDoorOpen arfProbableCause".14" #define <API key> arfProbableCause".15" #define excessiveVibration arfProbableCause".16" #define fileError arfProbableCause".17" #define fireDetected arfProbableCause".18" #define floodDetected arfProbableCause".19" #define framingError arfProbableCause".20" #define <API key> arfProbableCause".21" #define <API key> arfProbableCause".22" #define <API key> arfProbableCause".23" #define inputDeviceError arfProbableCause".24" #define lANError arfProbableCause".25" #define leakDetected arfProbableCause".26" #define <API key> arfProbableCause".27" #define lossOfFrame arfProbableCause".28" #define lossOfSignal arfProbableCause".29" #define <API key> arfProbableCause".30" #define multiplexerProblem arfProbableCause".31" #define outOfMemory arfProbableCause".32" #define ouputDeviceError arfProbableCause".33" #define performanceDegraded arfProbableCause".34" #define powerProblem arfProbableCause".35" #define <API key> arfProbableCause".36" #define processorProblem arfProbableCause".37" #define pumpFailure arfProbableCause".38" #define queueSizeExceeded arfProbableCause".39" #define receiveFailure arfProbableCause".40" #define receiverFailure arfProbableCause".41" #define <API key> arfProbableCause".42" #define <API key> arfProbableCause".43" #define <API key> arfProbableCause".44" #define <API key> arfProbableCause".45" #define softwareError arfProbableCause".46" #define <API key> arfProbableCause".47" #define <API key> arfProbableCause".48" #define <API key> arfProbableCause".49" #define <API key> arfProbableCause".50" #define thresholdCrossed arfProbableCause".51" #define timingProblem arfProbableCause".52" #define toxicLeakDetected arfProbableCause".53" #define transmitFailure arfProbableCause".54" #define transmitterFailure arfProbableCause".55" #define <API key> arfProbableCause".56" #define versionMismatch arfProbableCause".57" #define <API key> "2.9.3.2.0.2" #define noActionRequired <API key>".1" #define <API key> <API key>".2" #define securityAlarmCause "2.9.3.2.0.1" #define <API key> securityAlarmCause".1" #define <API key> securityAlarmCause".2" #define cableTamper securityAlarmCause".3" #define delayedInformation securityAlarmCause".4" #define denialOfService securityAlarmCause".5" #define <API key> securityAlarmCause".6" #define informationMissing securityAlarmCause".7" #define <API key> securityAlarmCause".8" #define <API key> securityAlarmCause".9" #define intrusionDetection securityAlarmCause".10" #define keyExpired securityAlarmCause".11" #define <API key> securityAlarmCause".12" #define outOfHoursActivity securityAlarmCause".13" #define outOfService securityAlarmCause".14" #define proceduralError securityAlarmCause".15" #define un<API key> securityAlarmCause".16" #define <API key> securityAlarmCause".17" #define unspecifiedReason securityAlarmCause".18" #define <API key> [] #define noInvokeId NULL #line 93 "../../asn1/cmip/<API key>.c" #line 1 "../../asn1/cmip/packet-cmip-fn.c" /* CMISFilter -> CMISFilter/and -> CMISFilter */ /* CMISFilter -> CMISFilter */ static int <API key>(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_); static int <API key>(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { #line 266 "../../asn1/cmip/cmip.cnf" attributeform = <API key>; offset = <API key>(implicit_tag, actx, tree, tvb, offset, hf_index, &<API key>); return offset; } static int <API key>(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { #line 270 "../../asn1/cmip/cmip.cnf" attributeform = <API key>; offset = dissect_ber_integer(implicit_tag, actx, tree, tvb, offset, hf_index, &attribute_local_id); return offset; } static const value_string <API key>[] = { { 0, "globalForm" }, { 1, "localForm" }, { 0, NULL } }; static const ber_choice_t AttributeId_choice[] = { { 0, &<API key>, BER_CLASS_CON, 0, BER_FLAGS_IMPLTAG, <API key> }, { 1, &<API key>, BER_CLASS_CON, 1, BER_FLAGS_IMPLTAG, <API key> }, { 0, NULL, 0, 0, 0, NULL } }; static int <API key>(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { offset = dissect_ber_choice(actx, tree, tvb, offset, AttributeId_choice, hf_index, <API key>, NULL); return offset; } static const ber_sequence_t <API key>[1] = { { &<API key>, BER_CLASS_ANY/*choice*/, -1/*choice*/, BER_FLAGS_NOOWNTAG|BER_FLAGS_NOTCHKTAG, <API key> }, }; static int <API key>(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { offset = dissect_ber_set_of(implicit_tag, actx, tree, tvb, offset, <API key>, hf_index, <API key>); return offset; } static int <API key>(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { offset = <API key>(implicit_tag, tree, tvb, offset, actx, hf_index, NULL); return offset; } static int <API key>(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { #line 430 "../../asn1/cmip/cmip.cnf" objectclassform = <API key>; offset = <API key>(implicit_tag, actx, tree, tvb, offset, hf_index, &<API key>); return offset; } static int <API key>(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { #line 435 "../../asn1/cmip/cmip.cnf" objectclassform = <API key>; offset = dissect_ber_integer(implicit_tag, actx, tree, tvb, offset, hf_index, NULL); return offset; } const value_string <API key>[] = { { 0, "globalForm" }, { 1, "localForm" }, { 0, NULL } }; static const ber_choice_t ObjectClass_choice[] = { { 0, &<API key>, BER_CLASS_CON, 0, BER_FLAGS_IMPLTAG, <API key> }, { 1, &<API key>, BER_CLASS_CON, 1, BER_FLAGS_IMPLTAG, <API key> }, { 0, NULL, 0, 0, 0, NULL } }; int <API key>(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { offset = dissect_ber_choice(actx, tree, tvb, offset, ObjectClass_choice, hf_index, <API key>, NULL); return offset; } static int dissect_cmip_T_id(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { offset = <API key>(implicit_tag, actx, tree, tvb, offset, hf_index, &<API key>); return offset; } static int <API key>(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { #line 286 "../../asn1/cmip/cmip.cnf" offset=<API key>(<API key>, tvb, offset, actx->pinfo, tree); return offset; } static const ber_sequence_t <API key>[] = { { &hf_cmip_id , BER_CLASS_UNI, BER_UNI_TAG_OID, BER_FLAGS_NOOWNTAG, dissect_cmip_T_id }, { &<API key>, BER_CLASS_ANY, 0, BER_FLAGS_NOOWNTAG, <API key> }, { NULL, 0, 0, 0, NULL } }; static int <API key>(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { offset = <API key>(implicit_tag, actx, tree, tvb, offset, <API key>, hf_index, <API key>); return offset; } static const ber_sequence_t <API key>[1] = { { &<API key>, BER_CLASS_UNI, <API key>, BER_FLAGS_NOOWNTAG, <API key> }, }; static int <API key>(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { offset = dissect_ber_set_of(implicit_tag, actx, tree, tvb, offset, <API key>, hf_index, <API key>); return offset; } static const ber_sequence_t <API key>[1] = { { &<API key>, BER_CLASS_UNI, BER_UNI_TAG_SET, BER_FLAGS_NOOWNTAG, <API key> }, }; int <API key>(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { offset = <API key>(implicit_tag, actx, tree, tvb, offset, <API key>, hf_index, <API key>); return offset; } static int <API key>(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { offset = <API key>(implicit_tag, tvb, offset, actx, tree, hf_index); return offset; } static int <API key>(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { offset = <API key>(implicit_tag, actx, tree, tvb, offset, hf_index, NULL); return offset; } const value_string <API key>[] = { { 2, "distinguishedName" }, { 3, "nonSpecificForm" }, { 4, "<API key>" }, { 0, NULL } }; static const ber_choice_t <API key>[] = { { 2, &<API key>, BER_CLASS_CON, 2, BER_FLAGS_IMPLTAG, <API key> }, { 3, &<API key>, BER_CLASS_CON, 3, BER_FLAGS_IMPLTAG, <API key> }, { 4, &<API key>, BER_CLASS_CON, 4, BER_FLAGS_IMPLTAG, <API key> }, { 0, NULL, 0, 0, 0, NULL } }; int <API key>(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { offset = dissect_ber_choice(actx, tree, tvb, offset, <API key>, hf_index, <API key>, NULL); return offset; } static const value_string cmip_CMISSync_vals[] = { { 0, "bestEffort" }, { 1, "atomic" }, { 0, NULL } }; static int <API key>(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { offset = dissect_ber_integer(implicit_tag, actx, tree, tvb, offset, hf_index, NULL); return offset; } static const value_string <API key>[] = { { 0, "baseObject" }, { 1, "firstLevelOnly" }, { 2, "wholeSubtree" }, { 0, NULL } }; static int <API key>(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { offset = dissect_ber_integer(implicit_tag, actx, tree, tvb, offset, hf_index, NULL); return offset; } static int <API key>(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { offset = dissect_ber_integer(implicit_tag, actx, tree, tvb, offset, hf_index, NULL); return offset; } static const value_string cmip_Scope_vals[] = { { 0, "namedNumbers" }, { 1, "individualLevels" }, { 2, "baseToNthLevel" }, { 0, NULL } }; static const ber_choice_t Scope_choice[] = { { 0, &<API key> , BER_CLASS_UNI, BER_UNI_TAG_INTEGER, BER_FLAGS_NOOWNTAG, <API key> }, { 1, &<API key>, BER_CLASS_CON, 1, BER_FLAGS_IMPLTAG, <API key> }, { 2, &<API key> , BER_CLASS_CON, 2, BER_FLAGS_IMPLTAG, <API key> }, { 0, NULL, 0, 0, 0, NULL } }; static int dissect_cmip_Scope(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { offset = dissect_ber_choice(actx, tree, tvb, offset, Scope_choice, hf_index, ett_cmip_Scope, NULL); return offset; } static int <API key>(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { #line 274 "../../asn1/cmip/cmip.cnf" if(attributeform==<API key>){ offset=<API key>(<API key>, tvb, offset, actx->pinfo, tree); } else if (dissector_try_uint(<API key>, attribute_local_id, tvb, actx->pinfo, tree)) { offset=tvb_length (tvb); } else { offset=dissect_unknown_ber(actx->pinfo, tvb, offset, tree); } return offset; } static const ber_sequence_t Attribute_sequence[] = { { &hf_cmip_attributeid , BER_CLASS_ANY/*choice*/, -1/*choice*/, BER_FLAGS_NOOWNTAG|BER_FLAGS_NOTCHKTAG, <API key> }, { &hf_cmip_value , BER_CLASS_ANY, 0, BER_FLAGS_NOOWNTAG, <API key> }, { NULL, 0, 0, 0, NULL } }; int <API key>(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { offset = <API key>(implicit_tag, actx, tree, tvb, offset, Attribute_sequence, hf_index, ett_cmip_Attribute); return offset; } static const value_string <API key>[] = { { 0, "initialString" }, { 1, "anyString" }, { 2, "finalString" }, { 0, NULL } }; static const ber_choice_t <API key>[] = { { 0, &<API key> , BER_CLASS_CON, 0, BER_FLAGS_IMPLTAG, <API key> }, { 1, &hf_cmip_anyString , BER_CLASS_CON, 1, BER_FLAGS_IMPLTAG, <API key> }, { 2, &hf_cmip_finalString , BER_CLASS_CON, 2, BER_FLAGS_IMPLTAG, <API key> }, { 0, NULL, 0, 0, 0, NULL } }; static int <API key>(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { offset = dissect_ber_choice(actx, tree, tvb, offset, <API key>, hf_index, <API key>, NULL); return offset; } static const ber_sequence_t <API key>[1] = { { &<API key>, BER_CLASS_ANY/*choice*/, -1/*choice*/, BER_FLAGS_NOOWNTAG|BER_FLAGS_NOTCHKTAG, <API key> }, }; static int <API key>(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { offset = <API key>(implicit_tag, actx, tree, tvb, offset, <API key>, hf_index, <API key>); return offset; } static const value_string <API key>[] = { { 0, "equality" }, { 1, "substrings" }, { 2, "greaterOrEqual" }, { 3, "lessOrEqual" }, { 4, "present" }, { 5, "subsetOf" }, { 6, "supersetOf" }, { 7, "<API key>" }, { 0, NULL } }; static const ber_choice_t FilterItem_choice[] = { { 0, &hf_cmip_equality , BER_CLASS_CON, 0, BER_FLAGS_IMPLTAG, <API key> }, { 1, &hf_cmip_substrings , BER_CLASS_CON, 1, BER_FLAGS_IMPLTAG, <API key> }, { 2, &<API key> , BER_CLASS_CON, 2, BER_FLAGS_IMPLTAG, <API key> }, { 3, &hf_cmip_lessOrEqual , BER_CLASS_CON, 3, BER_FLAGS_IMPLTAG, <API key> }, { 4, &<API key>, BER_CLASS_CON, 4, BER_FLAGS_IMPLTAG, <API key> }, { 5, &hf_cmip_subsetOf , BER_CLASS_CON, 5, BER_FLAGS_IMPLTAG, <API key> }, { 6, &hf_cmip_supersetOf , BER_CLASS_CON, 6, BER_FLAGS_IMPLTAG, <API key> }, { 7, &<API key>, BER_CLASS_CON, 7, BER_FLAGS_IMPLTAG, <API key> }, { 0, NULL, 0, 0, 0, NULL } }; static int <API key>(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { offset = dissect_ber_choice(actx, tree, tvb, offset, FilterItem_choice, hf_index, ett_cmip_FilterItem, NULL); return offset; } static const ber_sequence_t <API key>[1] = { { &hf_cmip_and_item , BER_CLASS_ANY/*choice*/, -1/*choice*/, BER_FLAGS_NOOWNTAG|BER_FLAGS_NOTCHKTAG, <API key> }, }; static int <API key>(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { offset = dissect_ber_set_of(implicit_tag, actx, tree, tvb, offset, <API key>, hf_index, <API key>); return offset; } static const value_string <API key>[] = { { 8, "item" }, { 9, "and" }, { 10, "or" }, { 11, "not" }, { 0, NULL } }; static const ber_choice_t CMISFilter_choice[] = { { 8, &hf_cmip_item , BER_CLASS_CON, 8, BER_FLAGS_IMPLTAG, <API key> }, { 9, &hf_cmip_and , BER_CLASS_CON, 9, BER_FLAGS_IMPLTAG, <API key> }, { 10, &hf_cmip_or , BER_CLASS_CON, 10, BER_FLAGS_IMPLTAG, <API key> }, { 11, &hf_cmip_not , BER_CLASS_CON, 11, BER_FLAGS_IMPLTAG, <API key> }, { 0, NULL, 0, 0, 0, NULL } }; static int <API key>(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { offset = dissect_ber_choice(actx, tree, tvb, offset, CMISFilter_choice, hf_index, ett_cmip_CMISFilter, NULL); return offset; } static int <API key>(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { offset = <API key>(implicit_tag, actx, tree, tvb, offset, <API key>, &<API key>); return offset; } static const value_string <API key>[] = { { 2, "globalForm" }, { 3, "localForm" }, { 0, NULL } }; static const ber_choice_t ActionTypeId_choice[] = { { 2, &<API key>, BER_CLASS_CON, 2, BER_FLAGS_IMPLTAG, <API key> }, { 3, &hf_cmip_localForm , BER_CLASS_CON, 3, BER_FLAGS_IMPLTAG, <API key> }, { 0, NULL, 0, 0, 0, NULL } }; static int <API key>(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { offset = dissect_ber_choice(actx, tree, tvb, offset, ActionTypeId_choice, hf_index, <API key>, NULL); return offset; } static int <API key>(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { #line 441 "../../asn1/cmip/cmip.cnf" offset=<API key>(<API key>, tvb, offset, actx->pinfo, tree); return offset; } static const ber_sequence_t ActionInfo_sequence[] = { { &hf_cmip_actionType , BER_CLASS_ANY/*choice*/, -1/*choice*/, BER_FLAGS_NOOWNTAG|BER_FLAGS_NOTCHKTAG, <API key> }, { &<API key> , BER_CLASS_CON, 4, BER_FLAGS_OPTIONAL|BER_FLAGS_IMPLTAG, <API key> }, { NULL, 0, 0, 0, NULL } }; static int <API key>(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { offset = <API key>(implicit_tag, actx, tree, tvb, offset, ActionInfo_sequence, hf_index, ett_cmip_ActionInfo); return offset; } static const ber_sequence_t <API key>[] = { { &<API key>, BER_CLASS_ANY/*choice*/, -1/*choice*/, BER_FLAGS_NOOWNTAG|BER_FLAGS_NOTCHKTAG, <API key> }, { &<API key>, BER_CLASS_ANY/*choice*/, -1/*choice*/, BER_FLAGS_NOOWNTAG|BER_FLAGS_NOTCHKTAG, <API key> }, { &<API key> , BER_CLASS_CON, 5, BER_FLAGS_OPTIONAL|BER_FLAGS_IMPLTAG, <API key> }, { &<API key>, BER_CLASS_CON, 6, BER_FLAGS_OPTIONAL|BER_FLAGS_IMPLTAG, <API key> }, { &hf_cmip_scope , BER_CLASS_CON, 7, BER_FLAGS_OPTIONAL|BER_FLAGS_IMPLTAG|BER_FLAGS_NOTCHKTAG, dissect_cmip_Scope }, { &hf_cmip_filter , BER_CLASS_ANY/*choice*/, -1/*choice*/, BER_FLAGS_OPTIONAL|BER_FLAGS_NOOWNTAG|BER_FLAGS_NOTCHKTAG, <API key> }, { &hf_cmip_actionInfo , BER_CLASS_CON, 12, BER_FLAGS_IMPLTAG, <API key> }, { NULL, 0, 0, 0, NULL } }; static int <API key>(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { offset = <API key>(implicit_tag, actx, tree, tvb, offset, <API key>, hf_index, <API key>); return offset; } static int <API key>(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { offset = <API key>(implicit_tag, actx, tree, tvb, offset, hf_index); return offset; } static const value_string <API key>[] = { { 2, "accessDenied" }, { 9, "noSuchAction" }, { 14, "noSuchArgument" }, { 15, "<API key>" }, { 0, NULL } }; static int <API key>(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { offset = dissect_ber_integer(implicit_tag, actx, tree, tvb, offset, hf_index, NULL); return offset; } static const ber_sequence_t T_actionId_sequence[] = { { &<API key>, BER_CLASS_ANY/*choice*/, -1/*choice*/, BER_FLAGS_OPTIONAL|BER_FLAGS_NOOWNTAG|BER_FLAGS_NOTCHKTAG, <API key> }, { &hf_cmip_actionType , BER_CLASS_ANY/*choice*/, -1/*choice*/, BER_FLAGS_NOOWNTAG|BER_FLAGS_NOTCHKTAG, <API key> }, { NULL, 0, 0, 0, NULL } }; static int <API key>(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { offset = <API key>(implicit_tag, actx, tree, tvb, offset, T_actionId_sequence, hf_index, ett_cmip_T_actionId); return offset; } static int <API key>(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { offset = <API key>(implicit_tag, actx, tree, tvb, offset, <API key>, &<API key>); return offset; } static const value_string <API key>[] = { { 6, "globalForm" }, { 7, "localForm" }, { 0, NULL } }; static const ber_choice_t EventTypeId_choice[] = { { 6, &<API key>, BER_CLASS_CON, 6, BER_FLAGS_IMPLTAG, <API key> }, { 7, &hf_cmip_localForm , BER_CLASS_CON, 7, BER_FLAGS_IMPLTAG, <API key> }, { 0, NULL, 0, 0, 0, NULL } }; static int <API key>(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { offset = dissect_ber_choice(actx, tree, tvb, offset, EventTypeId_choice, hf_index, <API key>, NULL); return offset; } static const ber_sequence_t T_eventId_sequence[] = { { &<API key>, BER_CLASS_ANY/*choice*/, -1/*choice*/, BER_FLAGS_OPTIONAL|BER_FLAGS_NOOWNTAG|BER_FLAGS_NOTCHKTAG, <API key> }, { &hf_cmip_eventType , BER_CLASS_ANY/*choice*/, -1/*choice*/, BER_FLAGS_NOOWNTAG|BER_FLAGS_NOTCHKTAG, <API key> }, { NULL, 0, 0, 0, NULL } }; static int <API key>(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { offset = <API key>(implicit_tag, actx, tree, tvb, offset, T_eventId_sequence, hf_index, ett_cmip_T_eventId); return offset; } static const value_string <API key>[] = { { 0, "actionId" }, { 1, "eventId" }, { 0, NULL } }; static const ber_choice_t <API key>[] = { { 0, &hf_cmip_actionId , BER_CLASS_CON, 0, BER_FLAGS_IMPLTAG, <API key> }, { 1, &hf_cmip_eventId , BER_CLASS_CON, 1, BER_FLAGS_IMPLTAG, <API key> }, { 0, NULL, 0, 0, 0, NULL } }; static int <API key>(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { offset = dissect_ber_choice(actx, tree, tvb, offset, <API key>, hf_index, <API key>, NULL); return offset; } static int <API key>(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { #line 471 "../../asn1/cmip/cmip.cnf" offset=<API key>(<API key>, tvb, offset, actx->pinfo, tree); return offset; } static const ber_sequence_t <API key>[] = { { &hf_cmip_eventType , BER_CLASS_ANY/*choice*/, -1/*choice*/, BER_FLAGS_NOOWNTAG|BER_FLAGS_NOTCHKTAG, <API key> }, { &hf_cmip_eventInfo , BER_CLASS_CON, 8, BER_FLAGS_OPTIONAL|BER_FLAGS_IMPLTAG, <API key> }, { NULL, 0, 0, 0, NULL } }; static int <API key>(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { offset = <API key>(implicit_tag, actx, tree, tvb, offset, <API key>, hf_index, <API key>); return offset; } static const value_string <API key>[] = { { 0, "actionValue" }, { 1, "eventValue" }, { 0, NULL } }; static const ber_choice_t <API key>[] = { { 0, &hf_cmip_actionValue , BER_CLASS_CON, 0, BER_FLAGS_IMPLTAG, <API key> }, { 1, &hf_cmip_eventValue , BER_CLASS_CON, 1, BER_FLAGS_IMPLTAG, <API key> }, { 0, NULL, 0, 0, 0, NULL } }; static int <API key>(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { offset = dissect_ber_choice(actx, tree, tvb, offset, <API key>, hf_index, <API key>, NULL); return offset; } static const value_string <API key>[] = { { 0, "actionType" }, { 1, "actionArgument" }, { 2, "argumentValue" }, { 0, NULL } }; static const ber_choice_t <API key>[] = { { 0, &hf_cmip_actionType , BER_CLASS_ANY/*choice*/, -1/*choice*/, BER_FLAGS_NOOWNTAG, <API key> }, { 1, &<API key> , BER_CLASS_CON, 0, BER_FLAGS_IMPLTAG, <API key> }, { 2, &<API key> , BER_CLASS_CON, 1, BER_FLAGS_IMPLTAG, <API key> }, { 0, NULL, 0, 0, 0, NULL } }; static int <API key>(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { offset = dissect_ber_choice(actx, tree, tvb, offset, <API key>, hf_index, <API key>, NULL); return offset; } static const ber_sequence_t <API key>[] = { { &<API key>, BER_CLASS_UNI, <API key>, BER_FLAGS_NOOWNTAG, <API key> }, { &<API key>, BER_CLASS_ANY/*choice*/, -1/*choice*/, BER_FLAGS_NOOWNTAG|BER_FLAGS_NOTCHKTAG, <API key> }, { NULL, 0, 0, 0, NULL } }; static int <API key>(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { offset = <API key>(implicit_tag, actx, tree, tvb, offset, <API key>, hf_index, <API key>); return offset; } static const ber_sequence_t <API key>[] = { { &<API key>, BER_CLASS_ANY/*choice*/, -1/*choice*/, BER_FLAGS_OPTIONAL|BER_FLAGS_NOOWNTAG|BER_FLAGS_NOTCHKTAG, <API key> }, { &<API key>, BER_CLASS_ANY/*choice*/, -1/*choice*/, BER_FLAGS_OPTIONAL|BER_FLAGS_NOOWNTAG|BER_FLAGS_NOTCHKTAG, <API key> }, { &hf_cmip_currentTime , BER_CLASS_CON, 5, BER_FLAGS_OPTIONAL|BER_FLAGS_IMPLTAG, <API key> }, { &<API key>, BER_CLASS_CON, 6, BER_FLAGS_IMPLTAG, <API key> }, { NULL, 0, 0, 0, NULL } }; static int <API key>(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { offset = <API key>(implicit_tag, actx, tree, tvb, offset, <API key>, hf_index, <API key>); return offset; } static int <API key>(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { #line 474 "../../asn1/cmip/cmip.cnf" offset=<API key>(<API key>, tvb, offset, actx->pinfo, tree); return offset; } static const ber_sequence_t <API key>[] = { { &hf_cmip_actionType , BER_CLASS_ANY/*choice*/, -1/*choice*/, BER_FLAGS_NOOWNTAG|BER_FLAGS_NOTCHKTAG, <API key> }, { &<API key>, BER_CLASS_CON, 4, BER_FLAGS_IMPLTAG, <API key> }, { NULL, 0, 0, 0, NULL } }; static int <API key>(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { offset = <API key>(implicit_tag, actx, tree, tvb, offset, <API key>, hf_index, <API key>); return offset; } static const ber_sequence_t <API key>[] = { { &<API key>, BER_CLASS_ANY/*choice*/, -1/*choice*/, BER_FLAGS_OPTIONAL|BER_FLAGS_NOOWNTAG|BER_FLAGS_NOTCHKTAG, <API key> }, { &<API key>, BER_CLASS_ANY/*choice*/, -1/*choice*/, BER_FLAGS_OPTIONAL|BER_FLAGS_NOOWNTAG|BER_FLAGS_NOTCHKTAG, <API key> }, { &hf_cmip_currentTime , BER_CLASS_CON, 5, BER_FLAGS_OPTIONAL|BER_FLAGS_IMPLTAG, <API key> }, { &hf_cmip_actionReply , BER_CLASS_CON, 6, BER_FLAGS_OPTIONAL|BER_FLAGS_IMPLTAG, <API key> }, { NULL, 0, 0, 0, NULL } }; static int <API key>(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { offset = <API key>(implicit_tag, actx, tree, tvb, offset, <API key>, hf_index, <API key>); return offset; } static const value_string <API key>[] = { { 2, "accessDenied" }, { 5, "noSuchAttribute" }, { 6, "<API key>" }, { 24, "invalidOperation" }, { 25, "invalidOperator" }, { 0, NULL } }; static int <API key>(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { offset = dissect_ber_integer(implicit_tag, actx, tree, tvb, offset, hf_index, NULL); return offset; } static const value_string <API key>[] = { { 0, "replace" }, { 1, "addValues" }, { 2, "removeValues" }, { 3, "setToDefault" }, { 0, NULL } }; static int <API key>(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { offset = dissect_ber_integer(implicit_tag, actx, tree, tvb, offset, hf_index, NULL); return offset; } static int <API key>(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { #line 468 "../../asn1/cmip/cmip.cnf" offset=<API key>(<API key>, tvb, offset, actx->pinfo, tree); return offset; } static const ber_sequence_t <API key>[] = { { &<API key>, BER_CLASS_UNI, <API key>, BER_FLAGS_NOOWNTAG, <API key> }, { &<API key> , BER_CLASS_CON, 2, BER_FLAGS_OPTIONAL|BER_FLAGS_IMPLTAG, <API key> }, { &hf_cmip_attributeId , BER_CLASS_ANY/*choice*/, -1/*choice*/, BER_FLAGS_NOOWNTAG|BER_FLAGS_NOTCHKTAG, <API key> }, { &<API key> , BER_CLASS_ANY, 0, BER_FLAGS_OPTIONAL|BER_FLAGS_NOOWNTAG, <API key> }, { NULL, 0, 0, 0, NULL } }; static int <API key>(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { offset = <API key>(implicit_tag, actx, tree, tvb, offset, <API key>, hf_index, <API key>); return offset; } static const value_string <API key>[] = { { 2, "accessDenied" }, { 5, "noSuchAttribute" }, { 0, NULL } }; static int <API key>(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { offset = dissect_ber_integer(implicit_tag, actx, tree, tvb, offset, hf_index, NULL); return offset; } static const ber_sequence_t <API key>[] = { { &<API key>, BER_CLASS_UNI, <API key>, BER_FLAGS_NOOWNTAG, <API key> }, { &hf_cmip_attributeId , BER_CLASS_ANY/*choice*/, -1/*choice*/, BER_FLAGS_NOOWNTAG|BER_FLAGS_NOTCHKTAG, <API key> }, { NULL, 0, 0, 0, NULL } }; static int <API key>(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { offset = <API key>(implicit_tag, actx, tree, tvb, offset, <API key>, hf_index, <API key>); return offset; } static const ber_sequence_t <API key>[] = { { &<API key>, BER_CLASS_ANY/*choice*/, -1/*choice*/, BER_FLAGS_NOOWNTAG|BER_FLAGS_NOTCHKTAG, <API key> }, { &<API key>, BER_CLASS_ANY/*choice*/, -1/*choice*/, BER_FLAGS_NOOWNTAG|BER_FLAGS_NOTCHKTAG, <API key> }, { NULL, 0, 0, 0, NULL } }; static int <API key>(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { offset = <API key>(implicit_tag, actx, tree, tvb, offset, <API key>, hf_index, <API key>); return offset; } static const ber_sequence_t <API key>[] = { { &hf_cmip_scope , BER_CLASS_CON, 0, BER_FLAGS_OPTIONAL|BER_FLAGS_IMPLTAG|BER_FLAGS_NOTCHKTAG, dissect_cmip_Scope }, { &hf_cmip_filter , BER_CLASS_CON, 1, BER_FLAGS_OPTIONAL|BER_FLAGS_IMPLTAG|BER_FLAGS_NOTCHKTAG, <API key> }, { &hf_cmip_sync , BER_CLASS_CON, 2, BER_FLAGS_OPTIONAL|BER_FLAGS_IMPLTAG, <API key> }, { NULL, 0, 0, 0, NULL } }; static int <API key>(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { offset = dissect_ber_set(implicit_tag, actx, tree, tvb, offset, <API key>, hf_index, <API key>); return offset; } static const value_string <API key>[] = { { 0, "<API key>" }, { 1, "<API key>" }, { 0, NULL } }; static const ber_choice_t <API key>[] = { { 0, &<API key>, BER_CLASS_ANY/*choice*/, -1/*choice*/, BER_FLAGS_NOOWNTAG, <API key> }, { 1, &<API key>, BER_CLASS_CON, 8, BER_FLAGS_IMPLTAG, <API key> }, { 0, NULL, 0, 0, 0, NULL } }; static int <API key>(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { offset = dissect_ber_choice(actx, tree, tvb, offset, <API key>, hf_index, <API key>, NULL); return offset; } static const ber_sequence_t <API key>[1] = { { &<API key>, BER_CLASS_UNI, <API key>, BER_FLAGS_NOOWNTAG, <API key> }, }; static int <API key>(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { offset = dissect_ber_set_of(implicit_tag, actx, tree, tvb, offset, <API key>, hf_index, <API key>); return offset; } static const ber_sequence_t <API key>[] = { { &<API key>, BER_CLASS_ANY/*choice*/, -1/*choice*/, BER_FLAGS_NOOWNTAG|BER_FLAGS_NOTCHKTAG, <API key> }, { &<API key>, BER_CLASS_ANY/*choice*/, -1/*choice*/, BER_FLAGS_OPTIONAL|BER_FLAGS_NOOWNTAG|BER_FLAGS_NOTCHKTAG, <API key> }, { &<API key> , BER_CLASS_CON, 5, BER_FLAGS_OPTIONAL|BER_FLAGS_IMPLTAG, <API key> }, { &<API key>, BER_CLASS_CON, 6, BER_FLAGS_OPTIONAL|BER_FLAGS_IMPLTAG|BER_FLAGS_NOTCHKTAG, <API key> }, { &<API key> , BER_CLASS_CON, 7, BER_FLAGS_OPTIONAL|BER_FLAGS_IMPLTAG, <API key> }, { NULL, 0, 0, 0, NULL } }; static int <API key>(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { offset = <API key>(implicit_tag, actx, tree, tvb, offset, <API key>, hf_index, <API key>); return offset; } static const ber_sequence_t <API key>[] = { { &<API key>, BER_CLASS_ANY/*choice*/, -1/*choice*/, BER_FLAGS_OPTIONAL|BER_FLAGS_NOOWNTAG|BER_FLAGS_NOTCHKTAG, <API key> }, { &<API key>, BER_CLASS_ANY/*choice*/, -1/*choice*/, BER_FLAGS_OPTIONAL|BER_FLAGS_NOOWNTAG|BER_FLAGS_NOTCHKTAG, <API key> }, { &hf_cmip_currentTime , BER_CLASS_CON, 5, BER_FLAGS_OPTIONAL|BER_FLAGS_IMPLTAG, <API key> }, { &<API key> , BER_CLASS_CON, 6, BER_FLAGS_OPTIONAL|BER_FLAGS_IMPLTAG, <API key> }, { NULL, 0, 0, 0, NULL } }; static int <API key>(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { offset = <API key>(implicit_tag, actx, tree, tvb, offset, <API key>, hf_index, <API key>); return offset; } static const ber_sequence_t <API key>[] = { { &<API key>, BER_CLASS_ANY/*choice*/, -1/*choice*/, BER_FLAGS_NOOWNTAG|BER_FLAGS_NOTCHKTAG, <API key> }, { &<API key>, BER_CLASS_ANY/*choice*/, -1/*choice*/, BER_FLAGS_NOOWNTAG|BER_FLAGS_NOTCHKTAG, <API key> }, { &<API key> , BER_CLASS_CON, 5, BER_FLAGS_OPTIONAL|BER_FLAGS_IMPLTAG, <API key> }, { &<API key>, BER_CLASS_CON, 6, BER_FLAGS_OPTIONAL|BER_FLAGS_IMPLTAG, <API key> }, { &hf_cmip_scope , BER_CLASS_CON, 7, BER_FLAGS_OPTIONAL|BER_FLAGS_IMPLTAG|BER_FLAGS_NOTCHKTAG, dissect_cmip_Scope }, { &hf_cmip_filter , BER_CLASS_ANY/*choice*/, -1/*choice*/, BER_FLAGS_OPTIONAL|BER_FLAGS_NOOWNTAG|BER_FLAGS_NOTCHKTAG, <API key> }, { NULL, 0, 0, 0, NULL } }; static int <API key>(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { offset = <API key>(implicit_tag, actx, tree, tvb, offset, <API key>, hf_index, <API key>); return offset; } static const value_string <API key>[] = { { 2, "accessDenied" }, { 0, NULL } }; static int <API key>(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { offset = dissect_ber_integer(implicit_tag, actx, tree, tvb, offset, hf_index, NULL); return offset; } static const ber_sequence_t <API key>[] = { { &<API key>, BER_CLASS_ANY/*choice*/, -1/*choice*/, BER_FLAGS_OPTIONAL|BER_FLAGS_NOOWNTAG|BER_FLAGS_NOTCHKTAG, <API key> }, { &<API key>, BER_CLASS_ANY/*choice*/, -1/*choice*/, BER_FLAGS_OPTIONAL|BER_FLAGS_NOOWNTAG|BER_FLAGS_NOTCHKTAG, <API key> }, { &hf_cmip_currentTime , BER_CLASS_CON, 5, BER_FLAGS_OPTIONAL|BER_FLAGS_IMPLTAG, <API key> }, { &<API key>, BER_CLASS_CON, 6, BER_FLAGS_IMPLTAG, <API key> }, { NULL, 0, 0, 0, NULL } }; static int <API key>(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { offset = <API key>(implicit_tag, actx, tree, tvb, offset, <API key>, hf_index, <API key>); return offset; } static const ber_sequence_t <API key>[] = { { &<API key>, BER_CLASS_ANY/*choice*/, -1/*choice*/, BER_FLAGS_OPTIONAL|BER_FLAGS_NOOWNTAG|BER_FLAGS_NOTCHKTAG, <API key> }, { &<API key>, BER_CLASS_ANY/*choice*/, -1/*choice*/, BER_FLAGS_OPTIONAL|BER_FLAGS_NOOWNTAG|BER_FLAGS_NOTCHKTAG, <API key> }, { &hf_cmip_currentTime , BER_CLASS_CON, 5, BER_FLAGS_OPTIONAL|BER_FLAGS_IMPLTAG, <API key> }, { NULL, 0, 0, 0, NULL } }; static int <API key>(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { offset = <API key>(implicit_tag, actx, tree, tvb, offset, <API key>, hf_index, <API key>); return offset; } static int <API key>(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { #line 450 "../../asn1/cmip/cmip.cnf" offset=<API key>(<API key>, tvb, offset, actx->pinfo, tree); return offset; } static const ber_sequence_t EventReply_sequence[] = { { &hf_cmip_eventType , BER_CLASS_ANY/*choice*/, -1/*choice*/, BER_FLAGS_NOOWNTAG|BER_FLAGS_NOTCHKTAG, <API key> }, { &<API key> , BER_CLASS_CON, 8, BER_FLAGS_OPTIONAL|BER_FLAGS_IMPLTAG, <API key> }, { NULL, 0, 0, 0, NULL } }; static int <API key>(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { offset = <API key>(implicit_tag, actx, tree, tvb, offset, EventReply_sequence, hf_index, ett_cmip_EventReply); return offset; } static int <API key>(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { #line 447 "../../asn1/cmip/cmip.cnf" offset=<API key>(<API key>, tvb, offset, actx->pinfo, tree); return offset; } static const ber_sequence_t <API key>[] = { { &<API key>, BER_CLASS_ANY/*choice*/, -1/*choice*/, BER_FLAGS_NOOWNTAG|BER_FLAGS_NOTCHKTAG, <API key> }, { &<API key>, BER_CLASS_ANY/*choice*/, -1/*choice*/, BER_FLAGS_NOOWNTAG|BER_FLAGS_NOTCHKTAG, <API key> }, { &hf_cmip_eventTime , BER_CLASS_CON, 5, BER_FLAGS_OPTIONAL|BER_FLAGS_IMPLTAG, <API key> }, { &hf_cmip_eventType , BER_CLASS_ANY/*choice*/, -1/*choice*/, BER_FLAGS_NOOWNTAG|BER_FLAGS_NOTCHKTAG, <API key> }, { &<API key>, BER_CLASS_CON, 8, BER_FLAGS_OPTIONAL|BER_FLAGS_IMPLTAG, <API key> }, { NULL, 0, 0, 0, NULL } }; static int <API key>(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { offset = <API key>(implicit_tag, actx, tree, tvb, offset, <API key>, hf_index, <API key>); return offset; } static const ber_sequence_t <API key>[] = { { &<API key>, BER_CLASS_ANY/*choice*/, -1/*choice*/, BER_FLAGS_OPTIONAL|BER_FLAGS_NOOWNTAG|BER_FLAGS_NOTCHKTAG, <API key> }, { &<API key>, BER_CLASS_ANY/*choice*/, -1/*choice*/, BER_FLAGS_OPTIONAL|BER_FLAGS_NOOWNTAG|BER_FLAGS_NOTCHKTAG, <API key> }, { &hf_cmip_currentTime , BER_CLASS_CON, 5, BER_FLAGS_OPTIONAL|BER_FLAGS_IMPLTAG, <API key> }, { &hf_cmip_eventReply , BER_CLASS_UNI, <API key>, BER_FLAGS_OPTIONAL|BER_FLAGS_NOOWNTAG, <API key> }, { NULL, 0, 0, 0, NULL } }; static int <API key>(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { offset = <API key>(implicit_tag, actx, tree, tvb, offset, <API key>, hf_index, <API key>); return offset; } static const ber_sequence_t <API key>[1] = { { &<API key>, BER_CLASS_ANY/*choice*/, -1/*choice*/, BER_FLAGS_NOOWNTAG|BER_FLAGS_NOTCHKTAG, <API key> }, }; static int <API key>(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { offset = dissect_ber_set_of(implicit_tag, actx, tree, tvb, offset, <API key>, hf_index, <API key>); return offset; } static const ber_sequence_t <API key>[] = { { &<API key>, BER_CLASS_ANY/*choice*/, -1/*choice*/, BER_FLAGS_NOOWNTAG|BER_FLAGS_NOTCHKTAG, <API key> }, { &<API key>, BER_CLASS_ANY/*choice*/, -1/*choice*/, BER_FLAGS_NOOWNTAG|BER_FLAGS_NOTCHKTAG, <API key> }, { &<API key> , BER_CLASS_CON, 5, BER_FLAGS_OPTIONAL|BER_FLAGS_IMPLTAG, <API key> }, { &<API key>, BER_CLASS_CON, 6, BER_FLAGS_OPTIONAL|BER_FLAGS_IMPLTAG, <API key> }, { &hf_cmip_scope , BER_CLASS_CON, 7, BER_FLAGS_OPTIONAL|BER_FLAGS_IMPLTAG|BER_FLAGS_NOTCHKTAG, dissect_cmip_Scope }, { &hf_cmip_filter , BER_CLASS_ANY/*choice*/, -1/*choice*/, BER_FLAGS_OPTIONAL|BER_FLAGS_NOOWNTAG|BER_FLAGS_NOTCHKTAG, <API key> }, { &<API key>, BER_CLASS_CON, 12, BER_FLAGS_OPTIONAL|BER_FLAGS_IMPLTAG, <API key> }, { NULL, 0, 0, 0, NULL } }; static int <API key>(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { offset = <API key>(implicit_tag, actx, tree, tvb, offset, <API key>, hf_index, <API key>); return offset; } static const value_string <API key>[] = { { 0, "attributeIdError" }, { 1, "attribute" }, { 0, NULL } }; static const ber_choice_t <API key>[] = { { 0, &<API key>, BER_CLASS_CON, 0, BER_FLAGS_IMPLTAG, <API key> }, { 1, &hf_cmip_attribute , BER_CLASS_CON, 1, BER_FLAGS_IMPLTAG, <API key> }, { 0, NULL, 0, 0, 0, NULL } }; static int <API key>(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { offset = dissect_ber_choice(actx, tree, tvb, offset, <API key>, hf_index, <API key>, NULL); return offset; } static const ber_sequence_t <API key>[1] = { { &<API key>, BER_CLASS_ANY/*choice*/, -1/*choice*/, BER_FLAGS_NOOWNTAG|BER_FLAGS_NOTCHKTAG, <API key> }, }; static int <API key>(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { offset = dissect_ber_set_of(implicit_tag, actx, tree, tvb, offset, <API key>, hf_index, <API key>); return offset; } static const ber_sequence_t <API key>[] = { { &<API key>, BER_CLASS_ANY/*choice*/, -1/*choice*/, BER_FLAGS_OPTIONAL|BER_FLAGS_NOOWNTAG|BER_FLAGS_NOTCHKTAG, <API key> }, { &<API key>, BER_CLASS_ANY/*choice*/, -1/*choice*/, BER_FLAGS_OPTIONAL|BER_FLAGS_NOOWNTAG|BER_FLAGS_NOTCHKTAG, <API key> }, { &hf_cmip_currentTime , BER_CLASS_CON, 5, BER_FLAGS_OPTIONAL|BER_FLAGS_IMPLTAG, <API key> }, { &hf_cmip_getInfoList , BER_CLASS_CON, 6, BER_FLAGS_IMPLTAG, <API key> }, { NULL, 0, 0, 0, NULL } }; static int <API key>(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { offset = <API key>(implicit_tag, actx, tree, tvb, offset, <API key>, hf_index, <API key>); return offset; } static const ber_sequence_t GetResult_sequence[] = { { &<API key>, BER_CLASS_ANY/*choice*/, -1/*choice*/, BER_FLAGS_OPTIONAL|BER_FLAGS_NOOWNTAG|BER_FLAGS_NOTCHKTAG, <API key> }, { &<API key>, BER_CLASS_ANY/*choice*/, -1/*choice*/, BER_FLAGS_OPTIONAL|BER_FLAGS_NOOWNTAG|BER_FLAGS_NOTCHKTAG, <API key> }, { &hf_cmip_currentTime , BER_CLASS_CON, 5, BER_FLAGS_OPTIONAL|BER_FLAGS_IMPLTAG, <API key> }, { &<API key> , BER_CLASS_CON, 6, BER_FLAGS_OPTIONAL|BER_FLAGS_IMPLTAG, <API key> }, { NULL, 0, 0, 0, NULL } }; static int <API key>(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { offset = <API key>(implicit_tag, actx, tree, tvb, offset, GetResult_sequence, hf_index, ett_cmip_GetResult); return offset; } static int dissect_cmip_NULL(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { offset = dissect_ber_null(implicit_tag, actx, tree, tvb, offset, hf_index); return offset; } static const value_string cmip_InvokeId_vals[] = { { 0, "present" }, { 1, "absent" }, { 0, NULL } }; static const ber_choice_t InvokeId_choice[] = { { 0, &hf_cmip_present , BER_CLASS_UNI, BER_UNI_TAG_INTEGER, BER_FLAGS_NOOWNTAG, <API key> }, { 1, &hf_cmip_absent , BER_CLASS_UNI, BER_UNI_TAG_NULL, BER_FLAGS_NOOWNTAG, dissect_cmip_NULL }, { 0, NULL, 0, 0, 0, NULL } }; static int <API key>(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { offset = dissect_ber_choice(actx, tree, tvb, offset, InvokeId_choice, hf_index, ett_cmip_InvokeId, NULL); return offset; } int <API key>(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { offset = <API key>(implicit_tag, tvb, offset, actx, tree, hf_index); return offset; } static const ber_sequence_t SetResult_sequence[] = { { &<API key>, BER_CLASS_ANY/*choice*/, -1/*choice*/, BER_FLAGS_OPTIONAL|BER_FLAGS_NOOWNTAG|BER_FLAGS_NOTCHKTAG, <API key> }, { &<API key>, BER_CLASS_ANY/*choice*/, -1/*choice*/, BER_FLAGS_OPTIONAL|BER_FLAGS_NOOWNTAG|BER_FLAGS_NOTCHKTAG, <API key> }, { &hf_cmip_currentTime , BER_CLASS_CON, 5, BER_FLAGS_OPTIONAL|BER_FLAGS_IMPLTAG, <API key> }, { &<API key> , BER_CLASS_CON, 6, BER_FLAGS_OPTIONAL|BER_FLAGS_IMPLTAG, <API key> }, { NULL, 0, 0, 0, NULL } }; static int <API key>(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { offset = <API key>(implicit_tag, actx, tree, tvb, offset, SetResult_sequence, hf_index, ett_cmip_SetResult); return offset; } static const value_string <API key>[] = { { 0, "attributeError" }, { 1, "attribute" }, { 0, NULL } }; static const ber_choice_t <API key>[] = { { 0, &<API key> , BER_CLASS_CON, 0, BER_FLAGS_IMPLTAG, <API key> }, { 1, &hf_cmip_attribute , BER_CLASS_CON, 1, BER_FLAGS_IMPLTAG, <API key> }, { 0, NULL, 0, 0, 0, NULL } }; static int <API key>(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { offset = dissect_ber_choice(actx, tree, tvb, offset, <API key>, hf_index, <API key>, NULL); return offset; } static const ber_sequence_t <API key>[1] = { { &<API key>, BER_CLASS_ANY/*choice*/, -1/*choice*/, BER_FLAGS_NOOWNTAG|BER_FLAGS_NOTCHKTAG, <API key> }, }; static int <API key>(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { offset = dissect_ber_set_of(implicit_tag, actx, tree, tvb, offset, <API key>, hf_index, <API key>); return offset; } static const ber_sequence_t <API key>[] = { { &<API key>, BER_CLASS_ANY/*choice*/, -1/*choice*/, BER_FLAGS_OPTIONAL|BER_FLAGS_NOOWNTAG|BER_FLAGS_NOTCHKTAG, <API key> }, { &<API key>, BER_CLASS_ANY/*choice*/, -1/*choice*/, BER_FLAGS_OPTIONAL|BER_FLAGS_NOOWNTAG|BER_FLAGS_NOTCHKTAG, <API key> }, { &hf_cmip_currentTime , BER_CLASS_CON, 5, BER_FLAGS_OPTIONAL|BER_FLAGS_IMPLTAG, <API key> }, { &hf_cmip_setInfoList , BER_CLASS_CON, 6, BER_FLAGS_IMPLTAG, <API key> }, { NULL, 0, 0, 0, NULL } }; static int <API key>(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { offset = <API key>(implicit_tag, actx, tree, tvb, offset, <API key>, hf_index, <API key>); return offset; } static int <API key>(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { offset = <API key>(implicit_tag, actx, tree, tvb, offset, hf_cmip_errorId_OID, &<API key>); return offset; } static int <API key>(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { #line 465 "../../asn1/cmip/cmip.cnf" offset=<API key>(<API key>, tvb, offset, actx->pinfo, tree); return offset; } static const ber_sequence_t <API key>[] = { { &hf_cmip_errorId , BER_CLASS_UNI, BER_UNI_TAG_OID, BER_FLAGS_NOOWNTAG, <API key> }, { &hf_cmip_errorInfo , BER_CLASS_ANY, 0, BER_FLAGS_NOOWNTAG, <API key> }, { NULL, 0, 0, 0, NULL } }; static int <API key>(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { offset = <API key>(implicit_tag, actx, tree, tvb, offset, <API key>, hf_index, <API key>); return offset; } static const ber_sequence_t <API key>[] = { { &<API key>, BER_CLASS_ANY/*choice*/, -1/*choice*/, BER_FLAGS_NOOWNTAG|BER_FLAGS_NOTCHKTAG, <API key> }, { &<API key>, BER_CLASS_ANY/*choice*/, -1/*choice*/, BER_FLAGS_OPTIONAL|BER_FLAGS_NOOWNTAG|BER_FLAGS_NOTCHKTAG, <API key> }, { &<API key>, BER_CLASS_CON, 5, BER_FLAGS_IMPLTAG, <API key> }, { NULL, 0, 0, 0, NULL } }; static int <API key>(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { offset = <API key>(implicit_tag, actx, tree, tvb, offset, <API key>, hf_index, <API key>); return offset; } static const value_string <API key>[] = { { 0, "getResult" }, { 1, "getListError" }, { 2, "setResult" }, { 3, "setListError" }, { 4, "actionResult" }, { 5, "processingFailure" }, { 6, "deleteResult" }, { 7, "actionError" }, { 8, "deleteError" }, { 0, NULL } }; static const ber_choice_t <API key>[] = { { 0, &hf_cmip_getResult , BER_CLASS_CON, 0, BER_FLAGS_IMPLTAG, <API key> }, { 1, &<API key> , BER_CLASS_CON, 1, BER_FLAGS_IMPLTAG, <API key> }, { 2, &hf_cmip_setResult , BER_CLASS_CON, 2, BER_FLAGS_IMPLTAG, <API key> }, { 3, &<API key> , BER_CLASS_CON, 3, BER_FLAGS_IMPLTAG, <API key> }, { 4, &<API key> , BER_CLASS_CON, 4, BER_FLAGS_IMPLTAG, <API key> }, { 5, &<API key>, BER_CLASS_CON, 5, BER_FLAGS_IMPLTAG, <API key> }, { 6, &<API key> , BER_CLASS_CON, 6, BER_FLAGS_IMPLTAG, <API key> }, { 7, &hf_cmip_actionError , BER_CLASS_CON, 7, BER_FLAGS_IMPLTAG, <API key> }, { 8, &hf_cmip_deleteError , BER_CLASS_CON, 8, BER_FLAGS_IMPLTAG, <API key> }, { 0, NULL, 0, 0, 0, NULL } }; static int <API key>(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { offset = dissect_ber_choice(actx, tree, tvb, offset, <API key>, hf_index, <API key>, NULL); return offset; } static const ber_sequence_t <API key>[] = { { &<API key>, BER_CLASS_ANY/*choice*/, -1/*choice*/, BER_FLAGS_NOOWNTAG|BER_FLAGS_NOTCHKTAG, <API key> }, { &hf_cmip_actionType , BER_CLASS_ANY/*choice*/, -1/*choice*/, BER_FLAGS_NOOWNTAG|BER_FLAGS_NOTCHKTAG, <API key> }, { NULL, 0, 0, 0, NULL } }; static int <API key>(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { offset = <API key>(implicit_tag, actx, tree, tvb, offset, <API key>, hf_index, <API key>); return offset; } static const ber_sequence_t <API key>[] = { { &<API key>, BER_CLASS_ANY/*choice*/, -1/*choice*/, BER_FLAGS_NOOWNTAG|BER_FLAGS_NOTCHKTAG, <API key> }, { &hf_cmip_eventType , BER_CLASS_ANY/*choice*/, -1/*choice*/, BER_FLAGS_NOOWNTAG|BER_FLAGS_NOTCHKTAG, <API key> }, { NULL, 0, 0, 0, NULL } }; static int <API key>(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { offset = <API key>(implicit_tag, actx, tree, tvb, offset, <API key>, hf_index, <API key>); return offset; } static int <API key>(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { #line 453 "../../asn1/cmip/cmip.cnf" if(attributeform==<API key>){ offset=<API key>(<API key>, tvb, offset, actx->pinfo, tree); } else if (dissector_try_uint(<API key>, attribute_local_id, tvb, actx->pinfo, tree)) { offset=tvb_length (tvb); } else { offset=dissect_unknown_ber(actx->pinfo, tvb, offset, tree); } return offset; } static const ber_sequence_t <API key>[] = { { &<API key> , BER_CLASS_CON, 2, BER_FLAGS_OPTIONAL|BER_FLAGS_IMPLTAG, <API key> }, { &hf_cmip_attributeId , BER_CLASS_ANY/*choice*/, -1/*choice*/, BER_FLAGS_NOOWNTAG|BER_FLAGS_NOTCHKTAG, <API key> }, { &<API key> , BER_CLASS_ANY, 0, BER_FLAGS_OPTIONAL|BER_FLAGS_NOOWNTAG, <API key> }, { NULL, 0, 0, 0, NULL } }; static int <API key>(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { offset = <API key>(implicit_tag, actx, tree, tvb, offset, <API key>, hf_index, <API key>); return offset; } static const ber_sequence_t <API key>[1] = { { &<API key>, BER_CLASS_UNI, <API key>, BER_FLAGS_NOOWNTAG, <API key> }, }; static int <API key>(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { offset = dissect_ber_set_of(implicit_tag, actx, tree, tvb, offset, <API key>, hf_index, <API key>); return offset; } static const ber_sequence_t <API key>[] = { { &<API key>, BER_CLASS_ANY/*choice*/, -1/*choice*/, BER_FLAGS_NOOWNTAG|BER_FLAGS_NOTCHKTAG, <API key> }, { &<API key>, BER_CLASS_ANY/*choice*/, -1/*choice*/, BER_FLAGS_NOOWNTAG|BER_FLAGS_NOTCHKTAG, <API key> }, { &<API key> , BER_CLASS_CON, 5, BER_FLAGS_OPTIONAL|BER_FLAGS_IMPLTAG, <API key> }, { &<API key>, BER_CLASS_CON, 6, BER_FLAGS_OPTIONAL|BER_FLAGS_IMPLTAG, <API key> }, { &hf_cmip_scope , BER_CLASS_CON, 7, BER_FLAGS_OPTIONAL|BER_FLAGS_IMPLTAG|BER_FLAGS_NOTCHKTAG, dissect_cmip_Scope }, { &hf_cmip_filter , BER_CLASS_ANY/*choice*/, -1/*choice*/, BER_FLAGS_OPTIONAL|BER_FLAGS_NOOWNTAG|BER_FLAGS_NOTCHKTAG, <API key> }, { &<API key>, BER_CLASS_CON, 12, BER_FLAGS_IMPLTAG, <API key> }, { NULL, 0, 0, 0, NULL } }; static int <API key>(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { offset = <API key>(implicit_tag, actx, tree, tvb, offset, <API key>, hf_index, <API key>); return offset; } static const value_string <API key>[] = { { 0, "cmiseServiceUser" }, { 1, "<API key>" }, { 0, NULL } }; static int <API key>(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { #line 230 "../../asn1/cmip/cmip.cnf" guint32 value; offset = dissect_ber_integer(implicit_tag, actx, tree, tvb, offset, hf_index, &value); col_append_fstr(actx->pinfo->cinfo, COL_INFO, " AbortSource:%s", val_to_str(value, <API key>, " Unknown AbortSource:%d")); return offset; } static int <API key>(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { offset = <API key>(implicit_tag, tree, tvb, offset, actx, hf_index, NULL); return offset; } static const ber_sequence_t <API key>[] = { { &hf_cmip_abortSource , BER_CLASS_CON, 0, BER_FLAGS_IMPLTAG, <API key> }, { &hf_cmip_userInfo , BER_CLASS_CON, 1, BER_FLAGS_OPTIONAL|BER_FLAGS_IMPLTAG, <API key> }, { NULL, 0, 0, 0, NULL } }; int <API key>(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { #line 222 "../../asn1/cmip/cmip.cnf" col_append_str(actx->pinfo->cinfo, COL_INFO, "CMIP-A-ABORT"); offset = <API key>(implicit_tag, actx, tree, tvb, offset, <API key>, hf_index, <API key>); return offset; } static const asn_namedbit <API key>[] = { { 0, &<API key>, -1, -1, "<API key>", NULL }, { 1, &<API key>, -1, -1, "filter", NULL }, { 2, &<API key>, -1, -1, "multipleReply", NULL }, { 3, &<API key>, -1, -1, "extendedService", NULL }, { 4, &<API key>, -1, -1, "cancelGet", NULL }, { 0, NULL, 0, 0, NULL, NULL } }; static int <API key>(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { offset = <API key>(implicit_tag, actx, tree, tvb, offset, <API key>, hf_index, <API key>, NULL); return offset; } static const asn_namedbit <API key>[] = { { 0, &<API key>, -1, -1, "version1", NULL }, { 1, &<API key>, -1, -1, "version2", NULL }, { 0, NULL, 0, 0, NULL, NULL } }; static int <API key>(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { offset = <API key>(implicit_tag, actx, tree, tvb, offset, <API key>, hf_index, <API key>, NULL); return offset; } static const ber_sequence_t <API key>[] = { { &<API key>, BER_CLASS_CON, 0, BER_FLAGS_OPTIONAL|BER_FLAGS_IMPLTAG, <API key> }, { &<API key>, BER_CLASS_CON, 1, BER_FLAGS_OPTIONAL|BER_FLAGS_IMPLTAG, <API key> }, { &<API key>, BER_CLASS_CON, 2, BER_FLAGS_OPTIONAL|BER_FLAGS_IMPLTAG, <API key> }, { &hf_cmip_userInfo , BER_CLASS_CON, 3, BER_FLAGS_OPTIONAL|BER_FLAGS_IMPLTAG, <API key> }, { NULL, 0, 0, 0, NULL } }; int <API key>(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { #line 226 "../../asn1/cmip/cmip.cnf" col_append_str(actx->pinfo->cinfo, COL_INFO, "CMIP-A-ASSOCIATE"); offset = <API key>(implicit_tag, actx, tree, tvb, offset, <API key>, hf_index, <API key>); return offset; } static const ber_sequence_t <API key>[1] = { { &<API key> , BER_CLASS_ANY/*choice*/, -1/*choice*/, BER_FLAGS_NOOWNTAG, <API key> }, }; static int <API key>(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { offset = dissect_ber_set_of(implicit_tag, actx, tree, tvb, offset, <API key>, hf_index, <API key>); return offset; } static const value_string <API key>[] = { { 0, "single" }, { 1, "multiple" }, { 0, NULL } }; static const ber_choice_t Destination_choice[] = { { 0, &hf_cmip_single , BER_CLASS_ANY/*choice*/, -1/*choice*/, BER_FLAGS_NOOWNTAG, <API key> }, { 1, &hf_cmip_multiple , BER_CLASS_UNI, BER_UNI_TAG_SET, BER_FLAGS_NOOWNTAG, <API key> }, { 0, NULL, 0, 0, 0, NULL } }; static int <API key>(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { offset = dissect_ber_choice(actx, tree, tvb, offset, Destination_choice, hf_index, <API key>, NULL); return offset; } static int <API key>(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { offset = <API key>(implicit_tag, tvb, offset, actx, tree, hf_index); return offset; } static int <API key>(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { offset = <API key>(implicit_tag, <API key>, actx, tree, tvb, offset, hf_index, NULL); return offset; } static int <API key>(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { offset = <API key>(implicit_tag, actx, tree, tvb, offset, hf_index, &<API key>); return offset; } static int <API key>(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { offset = dissect_ber_boolean(implicit_tag, actx, tree, tvb, offset, hf_index, NULL); return offset; } static int <API key>(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { #line 481 "../../asn1/cmip/cmip.cnf" offset=<API key>(<API key>, tvb, offset, actx->pinfo, tree); return offset; } static const ber_sequence_t <API key>[] = { { &<API key>, BER_CLASS_UNI, BER_UNI_TAG_OID, BER_FLAGS_NOOWNTAG, <API key> }, { &<API key> , BER_CLASS_CON, 1, BER_FLAGS_OPTIONAL|BER_FLAGS_IMPLTAG, <API key> }, { &hf_cmip_information , BER_CLASS_CON, 2, BER_FLAGS_IMPLTAG, <API key> }, { NULL, 0, 0, 0, NULL } }; static int <API key>(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { offset = <API key>(implicit_tag, actx, tree, tvb, offset, <API key>, hf_index, <API key>); return offset; } static const ber_sequence_t <API key>[1] = { { &<API key>, BER_CLASS_UNI, <API key>, BER_FLAGS_NOOWNTAG, <API key> }, }; int <API key>(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { offset = dissect_ber_set_of(implicit_tag, actx, tree, tvb, offset, <API key>, hf_index, <API key>); return offset; } static const ber_sequence_t Allomorphs_set_of[1] = { { &<API key>, BER_CLASS_ANY/*choice*/, -1/*choice*/, BER_FLAGS_NOOWNTAG|BER_FLAGS_NOTCHKTAG, <API key> }, }; static int <API key>(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { offset = dissect_ber_set_of(implicit_tag, actx, tree, tvb, offset, Allomorphs_set_of, hf_index, ett_cmip_Allomorphs); return offset; } const value_string <API key>[] = { { 0, "locked" }, { 1, "unlocked" }, { 2, "shuttingDown" }, { 0, NULL } }; int <API key>(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { offset = dissect_ber_integer(implicit_tag, actx, tree, tvb, offset, hf_index, NULL); return offset; } static const ber_sequence_t <API key>[1] = { { &<API key>, BER_CLASS_ANY/*choice*/, -1/*choice*/, BER_FLAGS_NOOWNTAG|BER_FLAGS_NOTCHKTAG, <API key> }, }; static int <API key>(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { offset = dissect_ber_set_of(implicit_tag, actx, tree, tvb, offset, <API key>, hf_index, <API key>); return offset; } static const ber_sequence_t <API key>[1] = { { &<API key>, BER_CLASS_UNI, <API key>, BER_FLAGS_NOOWNTAG, <API key> }, }; int <API key>(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { offset = dissect_ber_set_of(implicit_tag, actx, tree, tvb, offset, <API key>, hf_index, <API key>); return offset; } static int <API key>(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { #line 484 "../../asn1/cmip/cmip.cnf" offset=<API key>(<API key>, tvb, offset, actx->pinfo, tree); return offset; } static int <API key>(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { #line 487 "../../asn1/cmip/cmip.cnf" offset=<API key>(<API key>, tvb, offset, actx->pinfo, tree); return offset; } static const ber_sequence_t <API key>[] = { { &hf_cmip_attributeId , BER_CLASS_ANY/*choice*/, -1/*choice*/, BER_FLAGS_NOOWNTAG|BER_FLAGS_NOTCHKTAG, <API key> }, { &<API key>, BER_CLASS_CON, 1, BER_FLAGS_OPTIONAL|BER_FLAGS_IMPLTAG, <API key> }, { &<API key>, BER_CLASS_CON, 2, BER_FLAGS_IMPLTAG, <API key> }, { NULL, 0, 0, 0, NULL } }; static int <API key>(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { offset = <API key>(implicit_tag, actx, tree, tvb, offset, <API key>, hf_index, <API key>); return offset; } static const ber_sequence_t <API key>[1] = { { &<API key>, BER_CLASS_UNI, <API key>, BER_FLAGS_NOOWNTAG, <API key> }, }; static int <API key>(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { offset = dissect_ber_set_of(implicit_tag, actx, tree, tvb, offset, <API key>, hf_index, <API key>); return offset; } static const value_string <API key>[] = { { 0, "underRepair" }, { 1, "critical" }, { 2, "major" }, { 3, "minor" }, { 4, "alarmOutstanding" }, { 0, NULL } }; static int <API key>(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { offset = dissect_ber_integer(implicit_tag, actx, tree, tvb, offset, hf_index, NULL); return offset; } static const ber_sequence_t AlarmStatus_set_of[1] = { { &<API key>, BER_CLASS_UNI, BER_UNI_TAG_INTEGER, BER_FLAGS_NOOWNTAG, <API key> }, }; static int <API key>(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { offset = dissect_ber_set_of(implicit_tag, actx, tree, tvb, offset, AlarmStatus_set_of, hf_index, <API key>); return offset; } static const value_string <API key>[] = { { 0, "inTest" }, { 1, "failed" }, { 2, "powerOff" }, { 3, "offLine" }, { 4, "offDuty" }, { 5, "dependency" }, { 6, "degraded" }, { 7, "notInstalled" }, { 8, "logFull" }, { 0, NULL } }; static int <API key>(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { offset = dissect_ber_integer(implicit_tag, actx, tree, tvb, offset, hf_index, NULL); return offset; } static const ber_sequence_t <API key>[1] = { { &<API key>, BER_CLASS_UNI, BER_UNI_TAG_INTEGER, BER_FLAGS_NOOWNTAG, <API key> }, }; int <API key>(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { offset = dissect_ber_set_of(implicit_tag, actx, tree, tvb, offset, <API key>, hf_index, <API key>); return offset; } static int <API key>(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { offset = dissect_ber_boolean(implicit_tag, actx, tree, tvb, offset, hf_index, NULL); return offset; } static const ber_sequence_t <API key>[1] = { { &<API key>, BER_CLASS_ANY/*choice*/, -1/*choice*/, BER_FLAGS_NOOWNTAG, <API key> }, }; static int <API key>(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { offset = <API key>(implicit_tag, actx, tree, tvb, offset, <API key>, hf_index, <API key>); return offset; } static const value_string <API key>[] = { { 0, "objectName" }, { 1, "noObject" }, { 0, NULL } }; static const ber_choice_t <API key>[] = { { 0, &hf_cmip_objectName , BER_CLASS_ANY/*choice*/, -1/*choice*/, BER_FLAGS_NOOWNTAG, <API key> }, { 1, &hf_cmip_noObject , BER_CLASS_UNI, BER_UNI_TAG_NULL, BER_FLAGS_NOOWNTAG, dissect_cmip_NULL }, { 0, NULL, 0, 0, 0, NULL } }; static int <API key>(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { offset = dissect_ber_choice(actx, tree, tvb, offset, <API key>, hf_index, <API key>, NULL); return offset; } static int <API key>(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { offset = dissect_ber_integer(implicit_tag, actx, tree, tvb, offset, hf_index, NULL); return offset; } static const ber_sequence_t <API key>[1] = { { &<API key>, BER_CLASS_UNI, BER_UNI_TAG_INTEGER, BER_FLAGS_NOOWNTAG, <API key> }, }; static int <API key>(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { offset = dissect_ber_set_of(implicit_tag, actx, tree, tvb, offset, <API key>, hf_index, <API key>); return offset; } static int <API key>(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { offset = dissect_ber_boolean(implicit_tag, actx, tree, tvb, offset, hf_index, NULL); return offset; } static const value_string <API key>[] = { { 0, "subjectToTest" }, { 1, "<API key>" }, { 2, "reservedForTest" }, { 3, "suspended" }, { 0, NULL } }; static int <API key>(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { offset = dissect_ber_integer(implicit_tag, actx, tree, tvb, offset, hf_index, NULL); return offset; } static const ber_sequence_t <API key>[1] = { { &<API key>, BER_CLASS_UNI, BER_UNI_TAG_INTEGER, BER_FLAGS_NOOWNTAG, <API key> }, }; static int <API key>(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { offset = dissect_ber_set_of(implicit_tag, actx, tree, tvb, offset, <API key>, hf_index, <API key>); return offset; } static int <API key>(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { offset = dissect_ber_integer(implicit_tag, actx, tree, tvb, offset, hf_index, NULL); return offset; } static const ber_sequence_t <API key>[1] = { { &<API key>, BER_CLASS_UNI, BER_UNI_TAG_INTEGER, BER_FLAGS_NOOWNTAG, <API key> }, }; static int <API key>(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { offset = dissect_ber_set_of(implicit_tag, actx, tree, tvb, offset, <API key>, hf_index, <API key>); return offset; } static const ber_sequence_t <API key>[] = { { &<API key>, BER_CLASS_UNI, BER_UNI_TAG_SET, BER_FLAGS_NOOWNTAG, <API key> }, { &<API key>, BER_CLASS_ANY/*choice*/, -1/*choice*/, BER_FLAGS_OPTIONAL|BER_FLAGS_NOOWNTAG|BER_FLAGS_NOTCHKTAG, <API key> }, { NULL, 0, 0, 0, NULL } }; static int <API key>(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { offset = <API key>(implicit_tag, actx, tree, tvb, offset, <API key>, hf_index, <API key>); return offset; } static const ber_sequence_t <API key>[1] = { { &<API key>, BER_CLASS_UNI, <API key>, BER_FLAGS_NOOWNTAG, <API key> }, }; static int <API key>(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { offset = dissect_ber_set_of(implicit_tag, actx, tree, tvb, offset, <API key>, hf_index, <API key>); return offset; } static int <API key>(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { offset = dissect_ber_integer(implicit_tag, actx, tree, tvb, offset, hf_index, NULL); return offset; } static int <API key>(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { offset = <API key>(implicit_tag, tvb, offset, actx, tree, hf_index); return offset; } static int <API key>(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { offset = <API key>(implicit_tag, actx, tree, tvb, offset, hf_index); return offset; } static const ber_sequence_t GroupObjects_set_of[1] = { { &<API key>, BER_CLASS_ANY/*choice*/, -1/*choice*/, BER_FLAGS_NOOWNTAG|BER_FLAGS_NOTCHKTAG, <API key> }, }; static int <API key>(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { offset = dissect_ber_set_of(implicit_tag, actx, tree, tvb, offset, GroupObjects_set_of, hf_index, <API key>); return offset; } static int <API key>(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { offset = dissect_ber_integer(implicit_tag, actx, tree, tvb, offset, hf_index, NULL); return offset; } static int <API key>(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { offset = dissect_ber_integer(implicit_tag, actx, tree, tvb, offset, hf_index, NULL); return offset; } static const ber_sequence_t Time24_sequence[] = { { &hf_cmip_hour , BER_CLASS_UNI, BER_UNI_TAG_INTEGER, BER_FLAGS_NOOWNTAG, <API key> }, { &hf_cmip_minute , BER_CLASS_UNI, BER_UNI_TAG_INTEGER, BER_FLAGS_NOOWNTAG, <API key> }, { NULL, 0, 0, 0, NULL } }; static int dissect_cmip_Time24(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { offset = <API key>(implicit_tag, actx, tree, tvb, offset, Time24_sequence, hf_index, ett_cmip_Time24); return offset; } static const ber_sequence_t <API key>[] = { { &<API key> , BER_CLASS_UNI, <API key>, BER_FLAGS_NOOWNTAG, dissect_cmip_Time24 }, { &hf_cmip_intervalEnd , BER_CLASS_UNI, <API key>, BER_FLAGS_NOOWNTAG, dissect_cmip_Time24 }, { NULL, 0, 0, 0, NULL } }; static int <API key>(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { offset = <API key>(implicit_tag, actx, tree, tvb, offset, <API key>, hf_index, <API key>); return offset; } static const ber_sequence_t <API key>[1] = { { &<API key>, BER_CLASS_UNI, <API key>, BER_FLAGS_NOOWNTAG, <API key> }, }; static int <API key>(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { offset = dissect_ber_set_of(implicit_tag, actx, tree, tvb, offset, <API key>, hf_index, <API key>); return offset; } static const value_string <API key>[] = { { 0, "planned" }, { 1, "installed" }, { 2, "pendingRemoval" }, { 0, NULL } }; static int <API key>(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { offset = dissect_ber_integer(implicit_tag, actx, tree, tvb, offset, hf_index, NULL); return offset; } static const value_string <API key>[] = { { 0, "wrap" }, { 1, "halt" }, { 0, NULL } }; static int <API key>(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { offset = dissect_ber_integer(implicit_tag, actx, tree, tvb, offset, hf_index, NULL); return offset; } static int <API key>(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { offset = <API key>(implicit_tag, actx, tree, tvb, offset, hf_index); return offset; } static int <API key>(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { offset = <API key>(implicit_tag, <API key>, actx, tree, tvb, offset, hf_index, NULL); return offset; } static const value_string <API key>[] = { { 0, "number" }, { 1, "string" }, { 0, NULL } }; static const ber_choice_t <API key>[] = { { 0, &hf_cmip_number , BER_CLASS_UNI, BER_UNI_TAG_INTEGER, BER_FLAGS_NOOWNTAG, <API key> }, { 1, &hf_cmip_string , BER_CLASS_UNI, <API key>, BER_FLAGS_NOOWNTAG, <API key> }, { 0, NULL, 0, 0, 0, NULL } }; static int <API key>(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { offset = dissect_ber_choice(actx, tree, tvb, offset, <API key>, hf_index, <API key>, NULL); return offset; } static int <API key>(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { offset = <API key>(implicit_tag, tvb, offset, actx, tree, hf_index); return offset; } static const value_string <API key>[] = { { 0, "unlimited" }, { 0, NULL } }; static int <API key>(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { offset = dissect_ber_integer(implicit_tag, actx, tree, tvb, offset, hf_index, NULL); return offset; } static const ber_sequence_t <API key>[1] = { { &<API key>, BER_CLASS_UNI, <API key>, BER_FLAGS_NOOWNTAG, <API key> }, }; static int <API key>(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { offset = dissect_ber_set_of(implicit_tag, actx, tree, tvb, offset, <API key>, hf_index, <API key>); return offset; } static int <API key>(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { offset = <API key>(implicit_tag, actx, tree, tvb, offset, hf_index, NULL); return offset; } static int <API key>(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { offset = dissect_ber_integer(implicit_tag, actx, tree, tvb, offset, hf_index, NULL); return offset; } static int dissect_cmip_REAL(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { offset = dissect_ber_real(implicit_tag, actx, tree, tvb, offset, hf_index, NULL); return offset; } static const value_string <API key>[] = { { 0, "integer" }, { 1, "real" }, { 0, NULL } }; static const ber_choice_t <API key>[] = { { 0, &hf_cmip_integer , BER_CLASS_UNI, BER_UNI_TAG_INTEGER, BER_FLAGS_NOOWNTAG, <API key> }, { 1, &hf_cmip_real , BER_CLASS_UNI, BER_UNI_TAG_REAL, BER_FLAGS_NOOWNTAG, dissect_cmip_REAL }, { 0, NULL, 0, 0, 0, NULL } }; static int <API key>(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { offset = dissect_ber_choice(actx, tree, tvb, offset, <API key>, hf_index, <API key>, NULL); return offset; } static const value_string <API key>[] = { { 0, "disabled" }, { 1, "enabled" }, { 0, NULL } }; static int <API key>(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { offset = dissect_ber_integer(implicit_tag, actx, tree, tvb, offset, hf_index, NULL); return offset; } static int <API key>(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { offset = <API key>(implicit_tag, actx, tree, tvb, offset, hf_index, NULL); return offset; } static const ber_sequence_t Packages_set_of[1] = { { &<API key> , BER_CLASS_UNI, BER_UNI_TAG_OID, BER_FLAGS_NOOWNTAG, <API key> }, }; static int <API key>(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { offset = dissect_ber_set_of(implicit_tag, actx, tree, tvb, offset, Packages_set_of, hf_index, ett_cmip_Packages); return offset; } static const value_string <API key>[] = { { 0, "indeterminate" }, { 1, "critical" }, { 2, "major" }, { 3, "minor" }, { 4, "warning" }, { 5, "cleared" }, { 0, NULL } }; static int <API key>(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { offset = dissect_ber_integer(implicit_tag, actx, tree, tvb, offset, hf_index, NULL); return offset; } static const value_string <API key>[] = { { 0, "highest" }, { 127, "lowest" }, { 0, NULL } }; static int <API key>(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { offset = dissect_ber_integer(implicit_tag, actx, tree, tvb, offset, hf_index, NULL); return offset; } static const ber_sequence_t <API key>[] = { { &hf_cmip_object , BER_CLASS_ANY/*choice*/, -1/*choice*/, BER_FLAGS_NOOWNTAG|BER_FLAGS_NOTCHKTAG, <API key> }, { &hf_cmip_priority , BER_CLASS_UNI, BER_UNI_TAG_INTEGER, BER_FLAGS_NOOWNTAG, <API key> }, { NULL, 0, 0, 0, NULL } }; static int <API key>(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { offset = <API key>(implicit_tag, actx, tree, tvb, offset, <API key>, hf_index, <API key>); return offset; } static const ber_sequence_t <API key>[1] = { { &<API key>, BER_CLASS_UNI, <API key>, BER_FLAGS_NOOWNTAG, <API key> }, }; static int <API key>(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { offset = dissect_ber_set_of(implicit_tag, actx, tree, tvb, offset, <API key>, hf_index, <API key>); return offset; } const value_string <API key>[] = { { 0, "globalValue" }, { 1, "localValue" }, { 0, NULL } }; static const ber_choice_t <API key>[] = { { 0, &hf_cmip_globalValue , BER_CLASS_UNI, BER_UNI_TAG_OID, BER_FLAGS_NOOWNTAG, <API key> }, { 1, &hf_cmip_localValue , BER_CLASS_UNI, BER_UNI_TAG_INTEGER, BER_FLAGS_NOOWNTAG, <API key> }, { 0, NULL, 0, 0, 0, NULL } }; int <API key>(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { offset = dissect_ber_choice(actx, tree, tvb, offset, <API key>, hf_index, <API key>, NULL); return offset; } static const value_string <API key>[] = { { 0, "<API key>" }, { 1, "notInitialized" }, { 2, "initializing" }, { 3, "reporting" }, { 4, "terminating" }, { 0, NULL } }; static int <API key>(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { offset = dissect_ber_integer(implicit_tag, actx, tree, tvb, offset, hf_index, NULL); return offset; } static const ber_sequence_t <API key>[1] = { { &<API key>, BER_CLASS_UNI, BER_UNI_TAG_INTEGER, BER_FLAGS_NOOWNTAG, <API key> }, }; static int <API key>(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { offset = dissect_ber_set_of(implicit_tag, actx, tree, tvb, offset, <API key>, hf_index, <API key>); return offset; } static const value_string <API key>[] = { { 0, "oi" }, { 1, "int" }, { 0, NULL } }; static const ber_choice_t <API key>[] = { { 0, &hf_cmip_oi , BER_CLASS_UNI, BER_UNI_TAG_OID, BER_FLAGS_NOOWNTAG, <API key> }, { 1, &hf_cmip_int , BER_CLASS_UNI, BER_UNI_TAG_INTEGER, BER_FLAGS_NOOWNTAG, <API key> }, { 0, NULL, 0, 0, 0, NULL } }; static int <API key>(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { offset = dissect_ber_choice(actx, tree, tvb, offset, <API key>, hf_index, <API key>, NULL); return offset; } static const ber_sequence_t <API key>[1] = { { &<API key>, BER_CLASS_ANY/*choice*/, -1/*choice*/, BER_FLAGS_NOOWNTAG|BER_FLAGS_NOTCHKTAG, <API key> }, }; static int <API key>(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { offset = dissect_ber_set_of(implicit_tag, actx, tree, tvb, offset, <API key>, hf_index, <API key>); return offset; } static int <API key>(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { offset = <API key>(implicit_tag, actx, tree, tvb, offset, hf_index, NULL); return offset; } static int <API key>(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { offset = <API key>(implicit_tag, tvb, offset, actx, tree, hf_index); return offset; } static const value_string <API key>[] = { { 0, "mechanism" }, { 1, "object" }, { 2, "application" }, { 0, NULL } }; static const ber_choice_t <API key>[] = { { 0, &hf_cmip_mechanism , BER_CLASS_CON, 0, BER_FLAGS_IMPLTAG, <API key> }, { 1, &hf_cmip_object , BER_CLASS_CON, 1, BER_FLAGS_IMPLTAG, <API key> }, { 2, &hf_cmip_application , BER_CLASS_CON, 2, BER_FLAGS_IMPLTAG, <API key> }, { 0, NULL, 0, 0, 0, NULL } }; static int <API key>(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { offset = dissect_ber_choice(actx, tree, tvb, offset, <API key>, hf_index, <API key>, NULL); return offset; } static int <API key>(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { offset = <API key>(implicit_tag, actx, tree, tvb, offset, hf_index, &<API key>); return offset; } static int <API key>(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { #line 492 "../../asn1/cmip/cmip.cnf" offset=<API key>(<API key>, tvb, offset, actx->pinfo, tree); return offset; } static const ber_sequence_t <API key>[] = { { &<API key>, BER_CLASS_UNI, BER_UNI_TAG_OID, BER_FLAGS_NOOWNTAG, <API key> }, { &hf_cmip_details , BER_CLASS_ANY, 0, BER_FLAGS_NOOWNTAG, <API key> }, { NULL, 0, 0, 0, NULL } }; static int <API key>(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { offset = <API key>(implicit_tag, actx, tree, tvb, offset, <API key>, hf_index, <API key>); return offset; } static int <API key>(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { offset = <API key>(implicit_tag, tvb, offset, actx, tree, hf_index); return offset; } static const value_string <API key>[] = { { 0, "resourceOperation" }, { 1, "managementOperation" }, { 2, "unknown" }, { 0, NULL } }; static int <API key>(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { offset = dissect_ber_integer(implicit_tag, actx, tree, tvb, offset, hf_index, NULL); return offset; } static const ber_sequence_t <API key>[1] = { { &<API key>, BER_CLASS_ANY/*choice*/, -1/*choice*/, BER_FLAGS_NOOWNTAG|BER_FLAGS_NOTCHKTAG, <API key> }, }; static int <API key>(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { offset = dissect_ber_set_of(implicit_tag, actx, tree, tvb, offset, <API key>, hf_index, <API key>); return offset; } static const value_string <API key>[] = { { 0, "hotStandby" }, { 1, "coldStandby" }, { 2, "providingService" }, { 0, NULL } }; static int <API key>(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { offset = dissect_ber_integer(implicit_tag, actx, tree, tvb, offset, hf_index, NULL); return offset; } static int <API key>(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { offset = <API key>(implicit_tag, actx, tree, tvb, offset, hf_index); return offset; } static const value_string cmip_StopTime_vals[] = { { 0, "specific" }, { 1, "continual" }, { 0, NULL } }; static const ber_choice_t StopTime_choice[] = { { 0, &hf_cmip_specific , BER_CLASS_UNI, <API key>, BER_FLAGS_NOOWNTAG, <API key> }, { 1, &hf_cmip_continual , BER_CLASS_UNI, BER_UNI_TAG_NULL, BER_FLAGS_NOOWNTAG, dissect_cmip_NULL }, { 0, NULL, 0, 0, 0, NULL } }; static int <API key>(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { offset = dissect_ber_choice(actx, tree, tvb, offset, StopTime_choice, hf_index, ett_cmip_StopTime, NULL); return offset; } static int <API key>(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { offset = <API key>(implicit_tag, actx, tree, tvb, offset, hf_index, &<API key>); return offset; } static int <API key>(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { #line 497 "../../asn1/cmip/cmip.cnf" offset=<API key>(<API key>, tvb, offset, actx->pinfo, tree); return offset; } static const ber_sequence_t <API key>[] = { { &<API key>, BER_CLASS_UNI, BER_UNI_TAG_OID, BER_FLAGS_NOOWNTAG, <API key> }, { &hf_cmip_featureInfo , BER_CLASS_ANY, 0, BER_FLAGS_NOOWNTAG, <API key> }, { NULL, 0, 0, 0, NULL } }; static int <API key>(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { offset = <API key>(implicit_tag, actx, tree, tvb, offset, <API key>, hf_index, <API key>); return offset; } static const ber_sequence_t <API key>[1] = { { &<API key>, BER_CLASS_UNI, <API key>, BER_FLAGS_NOOWNTAG, <API key> }, }; static int <API key>(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { offset = dissect_ber_set_of(implicit_tag, actx, tree, tvb, offset, <API key>, hf_index, <API key>); return offset; } static const value_string cmip_SystemId_vals[] = { { 0, "name" }, { 1, "number" }, { 2, "nothing" }, { 0, NULL } }; static const ber_choice_t SystemId_choice[] = { { 0, &hf_cmip_name , BER_CLASS_UNI, <API key>, BER_FLAGS_NOOWNTAG, <API key> }, { 1, &hf_cmip_number , BER_CLASS_UNI, BER_UNI_TAG_INTEGER, BER_FLAGS_NOOWNTAG, <API key> }, { 2, &hf_cmip_nothing , BER_CLASS_UNI, BER_UNI_TAG_NULL, BER_FLAGS_NOOWNTAG, dissect_cmip_NULL }, { 0, NULL, 0, 0, 0, NULL } }; static int <API key>(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { offset = dissect_ber_choice(actx, tree, tvb, offset, SystemId_choice, hf_index, ett_cmip_SystemId, NULL); return offset; } static const value_string <API key>[] = { { 0, "distinguishedName" }, { 1, "oid" }, { 2, "nothing" }, { 0, NULL } }; static const ber_choice_t SystemTitle_choice[] = { { 0, &<API key>, BER_CLASS_UNI, <API key>, BER_FLAGS_NOOWNTAG, <API key> }, { 1, &hf_cmip_oid , BER_CLASS_UNI, BER_UNI_TAG_OID, BER_FLAGS_NOOWNTAG, <API key> }, { 2, &hf_cmip_nothing , BER_CLASS_UNI, BER_UNI_TAG_NULL, BER_FLAGS_NOOWNTAG, dissect_cmip_NULL }, { 0, NULL, 0, 0, 0, NULL } }; static int <API key>(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { offset = dissect_ber_choice(actx, tree, tvb, offset, SystemTitle_choice, hf_index, <API key>, NULL); return offset; } static const ber_sequence_t T_up_sequence[] = { { &hf_cmip_high , BER_CLASS_ANY/*choice*/, -1/*choice*/, BER_FLAGS_NOOWNTAG|BER_FLAGS_NOTCHKTAG, <API key> }, { &hf_cmip_low , BER_CLASS_ANY/*choice*/, -1/*choice*/, BER_FLAGS_OPTIONAL|BER_FLAGS_NOOWNTAG|BER_FLAGS_NOTCHKTAG, <API key> }, { NULL, 0, 0, 0, NULL } }; static int dissect_cmip_T_up(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { offset = <API key>(implicit_tag, actx, tree, tvb, offset, T_up_sequence, hf_index, ett_cmip_T_up); return offset; } static const ber_sequence_t T_down_sequence[] = { { &hf_cmip_high , BER_CLASS_ANY/*choice*/, -1/*choice*/, BER_FLAGS_NOOWNTAG|BER_FLAGS_NOTCHKTAG, <API key> }, { &hf_cmip_low , BER_CLASS_ANY/*choice*/, -1/*choice*/, BER_FLAGS_NOOWNTAG|BER_FLAGS_NOTCHKTAG, <API key> }, { NULL, 0, 0, 0, NULL } }; static int dissect_cmip_T_down(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { offset = <API key>(implicit_tag, actx, tree, tvb, offset, T_down_sequence, hf_index, ett_cmip_T_down); return offset; } static const value_string <API key>[] = { { 1, "up" }, { 2, "down" }, { 0, NULL } }; static const ber_choice_t <API key>[] = { { 1, &hf_cmip_up , BER_CLASS_CON, 1, BER_FLAGS_IMPLTAG, dissect_cmip_T_up }, { 2, &hf_cmip_down , BER_CLASS_CON, 2, BER_FLAGS_IMPLTAG, dissect_cmip_T_down }, { 0, NULL, 0, 0, 0, NULL } }; static int <API key>(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { offset = dissect_ber_choice(actx, tree, tvb, offset, <API key>, hf_index, <API key>, NULL); return offset; } static const ber_sequence_t <API key>[] = { { &<API key>, BER_CLASS_ANY/*choice*/, -1/*choice*/, BER_FLAGS_NOOWNTAG|BER_FLAGS_NOTCHKTAG, <API key> }, { &<API key> , BER_CLASS_ANY/*choice*/, -1/*choice*/, BER_FLAGS_NOOWNTAG|BER_FLAGS_NOTCHKTAG, <API key> }, { &<API key> , BER_CLASS_CON, 1, BER_FLAGS_OPTIONAL|BER_FLAGS_IMPLTAG|BER_FLAGS_NOTCHKTAG, <API key> }, { &hf_cmip_armTime , BER_CLASS_CON, 2, BER_FLAGS_OPTIONAL|BER_FLAGS_IMPLTAG, <API key> }, { NULL, 0, 0, 0, NULL } }; static int <API key>(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { offset = <API key>(implicit_tag, actx, tree, tvb, offset, <API key>, hf_index, <API key>); return offset; } static const value_string <API key>[] = { { 0, "lessSevere" }, { 1, "noChange" }, { 2, "moreSevere" }, { 0, NULL } }; static int <API key>(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { offset = dissect_ber_integer(implicit_tag, actx, tree, tvb, offset, hf_index, NULL); return offset; } static int <API key>(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { offset = dissect_ber_boolean(implicit_tag, actx, tree, tvb, offset, hf_index, NULL); return offset; } static const value_string <API key>[] = { { 0, "idle" }, { 1, "active" }, { 2, "busy" }, { 0, NULL } }; static int <API key>(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { offset = dissect_ber_integer(implicit_tag, actx, tree, tvb, offset, hf_index, NULL); return offset; } static const asn_namedbit T_daysOfWeek_bits[] = { { 0, &<API key>, -1, -1, "sunday", NULL }, { 1, &<API key>, -1, -1, "monday", NULL }, { 2, &<API key>, -1, -1, "tuesday", NULL }, { 3, &<API key>, -1, -1, "wednesday", NULL }, { 4, &<API key>, -1, -1, "thursday", NULL }, { 5, &<API key>, -1, -1, "friday", NULL }, { 6, &<API key>, -1, -1, "saturday", NULL }, { 0, NULL, 0, 0, NULL, NULL } }; static int <API key>(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { offset = <API key>(implicit_tag, actx, tree, tvb, offset, T_daysOfWeek_bits, hf_index, <API key>, NULL); return offset; } static const ber_sequence_t <API key>[] = { { &hf_cmip_daysOfWeek , BER_CLASS_UNI, <API key>, BER_FLAGS_NOOWNTAG, <API key> }, { &<API key> , BER_CLASS_UNI, BER_UNI_TAG_SET, BER_FLAGS_NOOWNTAG, <API key> }, { NULL, 0, 0, 0, NULL } }; static int <API key>(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { offset = <API key>(implicit_tag, actx, tree, tvb, offset, <API key>, hf_index, <API key>); return offset; } static const ber_sequence_t WeekMask_set_of[1] = { { &<API key> , BER_CLASS_UNI, <API key>, BER_FLAGS_NOOWNTAG, <API key> }, }; static int <API key>(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { offset = dissect_ber_set_of(implicit_tag, actx, tree, tvb, offset, WeekMask_set_of, hf_index, ett_cmip_WeekMask); return offset; } static int <API key>(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { #line 237 "../../asn1/cmip/cmip.cnf" offset = dissect_ber_integer(implicit_tag, actx, tree, tvb, offset, hf_index, &opcode); if(opcode_type== OPCODE_RETURN_ERROR){ col_append_fstr(actx->pinfo->cinfo, COL_INFO, "%s", val_to_str(opcode, <API key>, " Unknown Opcode:%d")); }else{ col_append_fstr(actx->pinfo->cinfo, COL_INFO, "%s", val_to_str(opcode, cmip_Opcode_vals, " Unknown Opcode:%d")); } return offset; } static const value_string cmip_Code_vals[] = { { 0, "local" }, { 1, "global" }, { 0, NULL } }; static const ber_choice_t Code_choice[] = { { 0, &hf_cmip_local , BER_CLASS_UNI, BER_UNI_TAG_INTEGER, BER_FLAGS_NOOWNTAG, <API key> }, { 1, &hf_cmip_global , BER_CLASS_UNI, BER_UNI_TAG_OID, BER_FLAGS_NOOWNTAG, <API key> }, { 0, NULL, 0, 0, 0, NULL } }; static int dissect_cmip_Code(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { offset = dissect_ber_choice(actx, tree, tvb, offset, Code_choice, hf_index, ett_cmip_Code, NULL); return offset; } static int <API key>(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { offset = dissect_ber_integer(implicit_tag, actx, tree, tvb, offset, hf_index, NULL); return offset; } static int <API key>(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { offset = <API key>(implicit_tag, tvb, offset, actx, tree, hf_index); return offset; } static const value_string <API key>[] = { { 0, "present" }, { 1, "absent" }, { 0, NULL } }; static const ber_choice_t T_linkedId_choice[] = { { 0, &<API key>, BER_CLASS_CON, 0, BER_FLAGS_IMPLTAG, <API key> }, { 1, &hf_cmip_absent , BER_CLASS_CON, 1, BER_FLAGS_IMPLTAG, dissect_cmip_NULL }, { 0, NULL, 0, 0, 0, NULL } }; static int <API key>(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { offset = dissect_ber_choice(actx, tree, tvb, offset, T_linkedId_choice, hf_index, ett_cmip_T_linkedId, NULL); return offset; } static int <API key>(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { #line 289 "../../asn1/cmip/cmip.cnf" switch(opcode){ case 0: /* M-eventreport */ offset = <API key>(FALSE, tvb, offset, actx, tree, -1); break; case 1: /* <API key> */ offset = <API key>(FALSE, tvb, offset, actx, tree, -1); break; case 2: /* M-linkedreply */ offset = <API key>(FALSE, tvb, offset, actx, tree, -1); break; case 3: /* M-get */ offset = <API key>(FALSE, tvb, offset,actx, tree, -1); break; case 4: /* M-set */ offset = <API key>(FALSE, tvb, offset,actx, tree, -1); break; case 5: /* M-set-confirmed */ offset = <API key>(FALSE, tvb, offset,actx, tree, -1); break; case 6: /* M-action*/ offset = <API key>(FALSE, tvb, offset, actx, tree, -1); break; case 7: /* M-action-confirmed*/ offset = <API key>(FALSE, tvb, offset, actx, tree, -1); break; case 8: /* M-create*/ offset = <API key>(FALSE, tvb, offset, actx, tree, -1); break; case 9: /* M-delete*/ offset = <API key>(FALSE, tvb, offset, actx, tree, -1); break; case 10: /* M-cancelget */ offset = <API key>(FALSE, tvb, offset, actx, tree, -1); break; } return offset; } static const ber_sequence_t Invoke_sequence[] = { { &hf_cmip_invokeId , BER_CLASS_ANY/*choice*/, -1/*choice*/, BER_FLAGS_NOOWNTAG|BER_FLAGS_NOTCHKTAG, <API key> }, { &hf_cmip_linkedId , BER_CLASS_ANY/*choice*/, -1/*choice*/, BER_FLAGS_OPTIONAL|BER_FLAGS_NOOWNTAG|BER_FLAGS_NOTCHKTAG, <API key> }, { &hf_cmip_opcode , BER_CLASS_ANY/*choice*/, -1/*choice*/, BER_FLAGS_NOOWNTAG|BER_FLAGS_NOTCHKTAG, dissect_cmip_Code }, { &hf_cmip_argument , BER_CLASS_ANY, 0, BER_FLAGS_OPTIONAL|BER_FLAGS_NOOWNTAG, <API key> }, { NULL, 0, 0, 0, NULL } }; static int dissect_cmip_Invoke(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { #line 246 "../../asn1/cmip/cmip.cnf" opcode_type=OPCODE_INVOKE; col_prepend_fstr(actx->pinfo->cinfo, COL_INFO, "Invoke "); offset = <API key>(implicit_tag, actx, tree, tvb, offset, Invoke_sequence, hf_index, ett_cmip_Invoke); return offset; } static int <API key>(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { #line 327 "../../asn1/cmip/cmip.cnf" switch(opcode){ case 0: /* M-eventreport*/ break; /* No return data */ case 1: /* <API key> */ offset = <API key>(FALSE, tvb, offset, actx, tree, -1); break; case 2: /* M-linkedreply*/ break; /* No return data */ case 3: /* M-get */ offset = <API key>(FALSE, tvb, offset, actx, tree, -1); break; case 4: /* M-set */ break; /* No return data */ case 5: /* M-set-confirmed*/ offset = <API key>(FALSE, tvb, offset, actx, tree, -1); break; case 6: /* M-action*/ break; /* No return data */ case 7: /* M-action-confirmed*/ offset = <API key>(FALSE, tvb, offset, actx, tree, -1); break; case 8: /* M-create*/ offset = <API key>(FALSE, tvb, offset, actx, tree, -1); break; case 9: /* M-delete*/ offset = <API key>(FALSE, tvb, offset, actx, tree, -1); break; case 10: /* M-cancelget */ break; /* doe this one return any data? */ } /*XXX add more types here */ return offset; } static const ber_sequence_t T_result_sequence[] = { { &hf_cmip_opcode , BER_CLASS_ANY/*choice*/, -1/*choice*/, BER_FLAGS_NOOWNTAG|BER_FLAGS_NOTCHKTAG, dissect_cmip_Code }, { &<API key> , BER_CLASS_ANY, 0, BER_FLAGS_NOOWNTAG, <API key> }, { NULL, 0, 0, 0, NULL } }; static int <API key>(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { offset = <API key>(implicit_tag, actx, tree, tvb, offset, T_result_sequence, hf_index, ett_cmip_T_result); return offset; } static const ber_sequence_t <API key>[] = { { &hf_cmip_invokeId , BER_CLASS_ANY/*choice*/, -1/*choice*/, BER_FLAGS_NOOWNTAG|BER_FLAGS_NOTCHKTAG, <API key> }, { &hf_cmip_result , BER_CLASS_UNI, <API key>, BER_FLAGS_OPTIONAL|BER_FLAGS_NOOWNTAG, <API key> }, { NULL, 0, 0, 0, NULL } }; static int <API key>(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { #line 251 "../../asn1/cmip/cmip.cnf" opcode_type=<API key>; col_prepend_fstr(actx->pinfo->cinfo, COL_INFO, "ReturnResult "); offset = <API key>(implicit_tag, actx, tree, tvb, offset, <API key>, hf_index, <API key>); return offset; } static int <API key>(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { #line 361 "../../asn1/cmip/cmip.cnf" switch(opcode){ case 19: /* <API key> */ <API key>(FALSE, tvb, offset, actx, tree, -1); break; case 20: /* <API key> */ <API key>(FALSE, tvb, offset, actx, tree, -1); break; case 11: /* <API key> */ <API key>(FALSE, tvb, offset, actx, tree, -1); break; case 7: /* getListError */ <API key>(FALSE, tvb, offset, actx, tree, -1); break; case 15: /* <API key> */ <API key>(FALSE, tvb, offset, actx, tree, -1); break; case 6: /* <API key> */ <API key>(FALSE, tvb, offset, actx, tree, -1); break; case 4: /* invalidFilter */ <API key>(FALSE, tvb, offset, actx, tree, -1); break; case 17: /* <API key> */ <API key>(FALSE, tvb, offset, actx, tree, -1); break; case 16: /* invalidScope */ dissect_cmip_Scope(FALSE, tvb, offset, actx, tree, -1); break; case 18: /* <API key> */ /* Hmmm SET OF AttributeId */ <API key>(FALSE, tvb, offset, actx, tree, -1); break; case 9: /* noSuchAction */ <API key>(FALSE, tvb, offset, actx, tree, -1); break; case 14: /* noSuchArgument */ <API key>(FALSE, tvb, offset, actx, tree, -1); break; case 5: /* noSuchAttribute */ <API key>(FALSE, tvb, offset, actx, tree, -1); break; case 13: /* noSuchEventType */ <API key>(FALSE, tvb, offset, actx, tree, -1); break; case 22: /* noSuchInvokeId */ <API key>(FALSE, tvb, offset, actx, tree, -1); break; case 0: /* noSuchObjectClass */ <API key>(FALSE, tvb, offset, actx, tree, -1); break; case 1:/* <API key> */ <API key>(FALSE, tvb, offset, actx, tree, -1); break; case 12: /* <API key> */ <API key>(FALSE, tvb, offset, actx, tree, -1); break; case 10: /* processingFailure OPTIONAL TRUE*/ <API key>(FALSE, tvb, offset, actx, tree, -1); break; case 8: /* setListError */ <API key>(FALSE, tvb, offset, actx, tree, -1); break; case 3:/* syncNotSupported */ <API key>(FALSE, tvb, offset, actx, tree, -1); break; } return offset; } static const ber_sequence_t <API key>[] = { { &hf_cmip_invokeId , BER_CLASS_ANY/*choice*/, -1/*choice*/, BER_FLAGS_NOOWNTAG|BER_FLAGS_NOTCHKTAG, <API key> }, { &hf_cmip_errcode , BER_CLASS_ANY/*choice*/, -1/*choice*/, BER_FLAGS_NOOWNTAG|BER_FLAGS_NOTCHKTAG, dissect_cmip_Code }, { &hf_cmip_parameter , BER_CLASS_ANY, 0, BER_FLAGS_OPTIONAL|BER_FLAGS_NOOWNTAG, <API key> }, { NULL, 0, 0, 0, NULL } }; static int <API key>(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { #line 256 "../../asn1/cmip/cmip.cnf" opcode_type=OPCODE_RETURN_ERROR; col_prepend_fstr(actx->pinfo->cinfo, COL_INFO, "ReturnError "); offset = <API key>(implicit_tag, actx, tree, tvb, offset, <API key>, hf_index, <API key>); return offset; } static const value_string <API key>[] = { { 0, "unrecognizedPDU" }, { 1, "mistypedPDU" }, { 2, "badlyStructuredPDU" }, { 0, NULL } }; static int <API key>(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { offset = dissect_ber_integer(implicit_tag, actx, tree, tvb, offset, hf_index, NULL); return offset; } static const value_string <API key>[] = { { 0, "duplicateInvocation" }, { 1, "<API key>" }, { 2, "mistypedArgument" }, { 3, "resourceLimitation" }, { 4, "releaseInProgress" }, { 5, "<API key>" }, { 6, "<API key>" }, { 7, "<API key>" }, { 0, NULL } }; static int <API key>(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { offset = dissect_ber_integer(implicit_tag, actx, tree, tvb, offset, hf_index, NULL); return offset; } static const value_string <API key>[] = { { 0, "<API key>" }, { 1, "<API key>" }, { 2, "mistypedResult" }, { 0, NULL } }; static int <API key>(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { offset = dissect_ber_integer(implicit_tag, actx, tree, tvb, offset, hf_index, NULL); return offset; } static const value_string <API key>[] = { { 0, "<API key>" }, { 1, "<API key>" }, { 2, "unrecognizedError" }, { 3, "unexpectedError" }, { 4, "mistypedParameter" }, { 0, NULL } }; static int <API key>(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { offset = dissect_ber_integer(implicit_tag, actx, tree, tvb, offset, hf_index, NULL); return offset; } static const value_string cmip_T_problem_vals[] = { { 0, "general" }, { 1, "invoke" }, { 2, "returnResult" }, { 3, "returnError" }, { 0, NULL } }; static const ber_choice_t T_problem_choice[] = { { 0, &hf_cmip_general , BER_CLASS_CON, 0, BER_FLAGS_IMPLTAG, <API key> }, { 1, &<API key> , BER_CLASS_CON, 1, BER_FLAGS_IMPLTAG, <API key> }, { 2, &<API key>, BER_CLASS_CON, 2, BER_FLAGS_IMPLTAG, <API key> }, { 3, &<API key>, BER_CLASS_CON, 3, BER_FLAGS_IMPLTAG, <API key> }, { 0, NULL, 0, 0, 0, NULL } }; static int <API key>(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { offset = dissect_ber_choice(actx, tree, tvb, offset, T_problem_choice, hf_index, ett_cmip_T_problem, NULL); return offset; } static const ber_sequence_t Reject_sequence[] = { { &hf_cmip_invokeId , BER_CLASS_ANY/*choice*/, -1/*choice*/, BER_FLAGS_NOOWNTAG|BER_FLAGS_NOTCHKTAG, <API key> }, { &hf_cmip_problem , BER_CLASS_ANY/*choice*/, -1/*choice*/, BER_FLAGS_NOOWNTAG|BER_FLAGS_NOTCHKTAG, <API key> }, { NULL, 0, 0, 0, NULL } }; static int dissect_cmip_Reject(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { #line 261 "../../asn1/cmip/cmip.cnf" opcode_type=OPCODE_REJECT; col_prepend_fstr(actx->pinfo->cinfo, COL_INFO, "Reject "); offset = <API key>(implicit_tag, actx, tree, tvb, offset, Reject_sequence, hf_index, ett_cmip_Reject); return offset; } const value_string cmip_ROS_vals[] = { { 1, "invoke" }, { 2, "returnResult" }, { 3, "returnError" }, { 4, "reject" }, { 0, NULL } }; static const ber_choice_t ROS_choice[] = { { 1, &hf_cmip_invoke , BER_CLASS_CON, 1, BER_FLAGS_IMPLTAG, dissect_cmip_Invoke }, { 2, &<API key> , BER_CLASS_CON, 2, BER_FLAGS_IMPLTAG, <API key> }, { 3, &hf_cmip_returnError , BER_CLASS_CON, 3, BER_FLAGS_IMPLTAG, <API key> }, { 4, &hf_cmip_reject , BER_CLASS_CON, 4, BER_FLAGS_IMPLTAG, dissect_cmip_Reject }, { 0, NULL, 0, 0, 0, NULL } }; int dissect_cmip_ROS(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { offset = dissect_ber_choice(actx, tree, tvb, offset, ROS_choice, hf_index, ett_cmip_ROS, NULL); return offset; } static void <API key>(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_tree *tree _U_) { asn1_ctx_t asn1_ctx; asn1_ctx_init(&asn1_ctx, ASN1_ENC_BER, TRUE, pinfo); <API key>(FALSE, tvb, 0, &asn1_ctx, tree, <API key>); } static void <API key>(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_tree *tree _U_) { asn1_ctx_t asn1_ctx; asn1_ctx_init(&asn1_ctx, ASN1_ENC_BER, TRUE, pinfo); <API key>(FALSE, tvb, 0, &asn1_ctx, tree, <API key>); } static void <API key>(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_tree *tree _U_) { asn1_ctx_t asn1_ctx; asn1_ctx_init(&asn1_ctx, ASN1_ENC_BER, TRUE, pinfo); <API key>(FALSE, tvb, 0, &asn1_ctx, tree, <API key>); } static void <API key>(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_tree *tree _U_) { asn1_ctx_t asn1_ctx; asn1_ctx_init(&asn1_ctx, ASN1_ENC_BER, TRUE, pinfo); <API key>(FALSE, tvb, 0, &asn1_ctx, tree, <API key>); } static void <API key>(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_tree *tree _U_) { asn1_ctx_t asn1_ctx; asn1_ctx_init(&asn1_ctx, ASN1_ENC_BER, TRUE, pinfo); <API key>(FALSE, tvb, 0, &asn1_ctx, tree, <API key>); } static void <API key>(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_tree *tree _U_) { asn1_ctx_t asn1_ctx; asn1_ctx_init(&asn1_ctx, ASN1_ENC_BER, TRUE, pinfo); <API key>(FALSE, tvb, 0, &asn1_ctx, tree, <API key>); } static void <API key>(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_tree *tree _U_) { asn1_ctx_t asn1_ctx; asn1_ctx_init(&asn1_ctx, ASN1_ENC_BER, TRUE, pinfo); <API key>(FALSE, tvb, 0, &asn1_ctx, tree, <API key>); } static void <API key>(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_tree *tree _U_) { asn1_ctx_t asn1_ctx; asn1_ctx_init(&asn1_ctx, ASN1_ENC_BER, TRUE, pinfo); <API key>(FALSE, tvb, 0, &asn1_ctx, tree, <API key>); } static void <API key>(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_tree *tree _U_) { asn1_ctx_t asn1_ctx; asn1_ctx_init(&asn1_ctx, ASN1_ENC_BER, TRUE, pinfo); <API key>(FALSE, tvb, 0, &asn1_ctx, tree, <API key>); } static void <API key>(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_tree *tree _U_) { asn1_ctx_t asn1_ctx; asn1_ctx_init(&asn1_ctx, ASN1_ENC_BER, TRUE, pinfo); <API key>(FALSE, tvb, 0, &asn1_ctx, tree, <API key>); } static void <API key>(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_tree *tree _U_) { asn1_ctx_t asn1_ctx; asn1_ctx_init(&asn1_ctx, ASN1_ENC_BER, TRUE, pinfo); <API key>(FALSE, tvb, 0, &asn1_ctx, tree, <API key>); } static void <API key>(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_tree *tree _U_) { asn1_ctx_t asn1_ctx; asn1_ctx_init(&asn1_ctx, ASN1_ENC_BER, TRUE, pinfo); <API key>(FALSE, tvb, 0, &asn1_ctx, tree, <API key>); } static void <API key>(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_tree *tree _U_) { asn1_ctx_t asn1_ctx; asn1_ctx_init(&asn1_ctx, ASN1_ENC_BER, TRUE, pinfo); <API key>(FALSE, tvb, 0, &asn1_ctx, tree, <API key>); } static void <API key>(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_tree *tree _U_) { asn1_ctx_t asn1_ctx; asn1_ctx_init(&asn1_ctx, ASN1_ENC_BER, TRUE, pinfo); <API key>(FALSE, tvb, 0, &asn1_ctx, tree, <API key>); } static void <API key>(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_tree *tree _U_) { asn1_ctx_t asn1_ctx; asn1_ctx_init(&asn1_ctx, ASN1_ENC_BER, TRUE, pinfo); <API key>(FALSE, tvb, 0, &asn1_ctx, tree, <API key>); } static void <API key>(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_tree *tree _U_) { asn1_ctx_t asn1_ctx; asn1_ctx_init(&asn1_ctx, ASN1_ENC_BER, TRUE, pinfo); <API key>(FALSE, tvb, 0, &asn1_ctx, tree, <API key>); } static void <API key>(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_tree *tree _U_) { asn1_ctx_t asn1_ctx; asn1_ctx_init(&asn1_ctx, ASN1_ENC_BER, TRUE, pinfo); <API key>(FALSE, tvb, 0, &asn1_ctx, tree, <API key>); } static void <API key>(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_tree *tree _U_) { asn1_ctx_t asn1_ctx; asn1_ctx_init(&asn1_ctx, ASN1_ENC_BER, TRUE, pinfo); <API key>(FALSE, tvb, 0, &asn1_ctx, tree, <API key>); } static void <API key>(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_tree *tree _U_) { asn1_ctx_t asn1_ctx; asn1_ctx_init(&asn1_ctx, ASN1_ENC_BER, TRUE, pinfo); <API key>(FALSE, tvb, 0, &asn1_ctx, tree, <API key>); } static void <API key>(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_tree *tree _U_) { asn1_ctx_t asn1_ctx; asn1_ctx_init(&asn1_ctx, ASN1_ENC_BER, TRUE, pinfo); <API key>(FALSE, tvb, 0, &asn1_ctx, tree, <API key>); } static void <API key>(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_tree *tree _U_) { asn1_ctx_t asn1_ctx; asn1_ctx_init(&asn1_ctx, ASN1_ENC_BER, TRUE, pinfo); <API key>(FALSE, tvb, 0, &asn1_ctx, tree, <API key>); } static void <API key>(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_tree *tree _U_) { asn1_ctx_t asn1_ctx; asn1_ctx_init(&asn1_ctx, ASN1_ENC_BER, TRUE, pinfo); <API key>(FALSE, tvb, 0, &asn1_ctx, tree, <API key>); } static void <API key>(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_tree *tree _U_) { asn1_ctx_t asn1_ctx; asn1_ctx_init(&asn1_ctx, ASN1_ENC_BER, TRUE, pinfo); <API key>(FALSE, tvb, 0, &asn1_ctx, tree, <API key>); } static void <API key>(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_tree *tree _U_) { asn1_ctx_t asn1_ctx; asn1_ctx_init(&asn1_ctx, ASN1_ENC_BER, TRUE, pinfo); <API key>(FALSE, tvb, 0, &asn1_ctx, tree, <API key>); } static void <API key>(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_tree *tree _U_) { asn1_ctx_t asn1_ctx; asn1_ctx_init(&asn1_ctx, ASN1_ENC_BER, TRUE, pinfo); <API key>(FALSE, tvb, 0, &asn1_ctx, tree, <API key>); } static void <API key>(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_tree *tree _U_) { asn1_ctx_t asn1_ctx; asn1_ctx_init(&asn1_ctx, ASN1_ENC_BER, TRUE, pinfo); <API key>(FALSE, tvb, 0, &asn1_ctx, tree, <API key>); } static void <API key>(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_tree *tree _U_) { asn1_ctx_t asn1_ctx; asn1_ctx_init(&asn1_ctx, ASN1_ENC_BER, TRUE, pinfo); <API key>(FALSE, tvb, 0, &asn1_ctx, tree, <API key>); } static void <API key>(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_tree *tree _U_) { asn1_ctx_t asn1_ctx; asn1_ctx_init(&asn1_ctx, ASN1_ENC_BER, TRUE, pinfo); <API key>(FALSE, tvb, 0, &asn1_ctx, tree, <API key>); } static void <API key>(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_tree *tree _U_) { asn1_ctx_t asn1_ctx; asn1_ctx_init(&asn1_ctx, ASN1_ENC_BER, TRUE, pinfo); <API key>(FALSE, tvb, 0, &asn1_ctx, tree, <API key>); } static void <API key>(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_tree *tree _U_) { asn1_ctx_t asn1_ctx; asn1_ctx_init(&asn1_ctx, ASN1_ENC_BER, TRUE, pinfo); <API key>(FALSE, tvb, 0, &asn1_ctx, tree, <API key>); } static void <API key>(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_tree *tree _U_) { asn1_ctx_t asn1_ctx; asn1_ctx_init(&asn1_ctx, ASN1_ENC_BER, TRUE, pinfo); <API key>(FALSE, tvb, 0, &asn1_ctx, tree, <API key>); } static void <API key>(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_tree *tree _U_) { asn1_ctx_t asn1_ctx; asn1_ctx_init(&asn1_ctx, ASN1_ENC_BER, TRUE, pinfo); <API key>(FALSE, tvb, 0, &asn1_ctx, tree, <API key>); } static void <API key>(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_tree *tree _U_) { asn1_ctx_t asn1_ctx; asn1_ctx_init(&asn1_ctx, ASN1_ENC_BER, TRUE, pinfo); <API key>(FALSE, tvb, 0, &asn1_ctx, tree, <API key>); } static void <API key>(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_tree *tree _U_) { asn1_ctx_t asn1_ctx; asn1_ctx_init(&asn1_ctx, ASN1_ENC_BER, TRUE, pinfo); <API key>(FALSE, tvb, 0, &asn1_ctx, tree, <API key>); } static void <API key>(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_tree *tree _U_) { asn1_ctx_t asn1_ctx; asn1_ctx_init(&asn1_ctx, ASN1_ENC_BER, TRUE, pinfo); <API key>(FALSE, tvb, 0, &asn1_ctx, tree, <API key>); } static void <API key>(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_tree *tree _U_) { asn1_ctx_t asn1_ctx; asn1_ctx_init(&asn1_ctx, ASN1_ENC_BER, TRUE, pinfo); <API key>(FALSE, tvb, 0, &asn1_ctx, tree, <API key>); } static void <API key>(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_tree *tree _U_) { asn1_ctx_t asn1_ctx; asn1_ctx_init(&asn1_ctx, ASN1_ENC_BER, TRUE, pinfo); <API key>(FALSE, tvb, 0, &asn1_ctx, tree, <API key>); } static void <API key>(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_tree *tree _U_) { asn1_ctx_t asn1_ctx; asn1_ctx_init(&asn1_ctx, ASN1_ENC_BER, TRUE, pinfo); <API key>(FALSE, tvb, 0, &asn1_ctx, tree, <API key>); } static void <API key>(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_tree *tree _U_) { asn1_ctx_t asn1_ctx; asn1_ctx_init(&asn1_ctx, ASN1_ENC_BER, TRUE, pinfo); <API key>(FALSE, tvb, 0, &asn1_ctx, tree, <API key>); } static void <API key>(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_tree *tree _U_) { asn1_ctx_t asn1_ctx; asn1_ctx_init(&asn1_ctx, ASN1_ENC_BER, TRUE, pinfo); <API key>(FALSE, tvb, 0, &asn1_ctx, tree, <API key>); } static void <API key>(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_tree *tree _U_) { asn1_ctx_t asn1_ctx; asn1_ctx_init(&asn1_ctx, ASN1_ENC_BER, TRUE, pinfo); <API key>(FALSE, tvb, 0, &asn1_ctx, tree, <API key>); } static void <API key>(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_tree *tree _U_) { asn1_ctx_t asn1_ctx; asn1_ctx_init(&asn1_ctx, ASN1_ENC_BER, TRUE, pinfo); <API key>(FALSE, tvb, 0, &asn1_ctx, tree, <API key>); } static void <API key>(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_tree *tree _U_) { asn1_ctx_t asn1_ctx; asn1_ctx_init(&asn1_ctx, ASN1_ENC_BER, TRUE, pinfo); <API key>(FALSE, tvb, 0, &asn1_ctx, tree, <API key>); } static void <API key>(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_tree *tree _U_) { asn1_ctx_t asn1_ctx; asn1_ctx_init(&asn1_ctx, ASN1_ENC_BER, TRUE, pinfo); <API key>(FALSE, tvb, 0, &asn1_ctx, tree, <API key>); } static void <API key>(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_tree *tree _U_) { asn1_ctx_t asn1_ctx; asn1_ctx_init(&asn1_ctx, ASN1_ENC_BER, TRUE, pinfo); <API key>(FALSE, tvb, 0, &asn1_ctx, tree, <API key>); } static void <API key>(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_tree *tree _U_) { asn1_ctx_t asn1_ctx; asn1_ctx_init(&asn1_ctx, ASN1_ENC_BER, TRUE, pinfo); <API key>(FALSE, tvb, 0, &asn1_ctx, tree, <API key>); } static void <API key>(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_tree *tree _U_) { asn1_ctx_t asn1_ctx; asn1_ctx_init(&asn1_ctx, ASN1_ENC_BER, TRUE, pinfo); <API key>(FALSE, tvb, 0, &asn1_ctx, tree, <API key>); } static void <API key>(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_tree *tree _U_) { asn1_ctx_t asn1_ctx; asn1_ctx_init(&asn1_ctx, ASN1_ENC_BER, TRUE, pinfo); <API key>(FALSE, tvb, 0, &asn1_ctx, tree, <API key>); } static void <API key>(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_tree *tree _U_) { asn1_ctx_t asn1_ctx; asn1_ctx_init(&asn1_ctx, ASN1_ENC_BER, TRUE, pinfo); <API key>(FALSE, tvb, 0, &asn1_ctx, tree, <API key>); } static void <API key>(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_tree *tree _U_) { asn1_ctx_t asn1_ctx; asn1_ctx_init(&asn1_ctx, ASN1_ENC_BER, TRUE, pinfo); <API key>(FALSE, tvb, 0, &asn1_ctx, tree, <API key>); } static void <API key>(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_tree *tree _U_) { asn1_ctx_t asn1_ctx; asn1_ctx_init(&asn1_ctx, ASN1_ENC_BER, TRUE, pinfo); <API key>(FALSE, tvb, 0, &asn1_ctx, tree, <API key>); } static void <API key>(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_tree *tree _U_) { asn1_ctx_t asn1_ctx; asn1_ctx_init(&asn1_ctx, ASN1_ENC_BER, TRUE, pinfo); <API key>(FALSE, tvb, 0, &asn1_ctx, tree, <API key>); } static void <API key>(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_tree *tree _U_) { asn1_ctx_t asn1_ctx; asn1_ctx_init(&asn1_ctx, ASN1_ENC_BER, TRUE, pinfo); <API key>(FALSE, tvb, 0, &asn1_ctx, tree, <API key>); } static void <API key>(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_tree *tree _U_) { asn1_ctx_t asn1_ctx; asn1_ctx_init(&asn1_ctx, ASN1_ENC_BER, TRUE, pinfo); <API key>(FALSE, tvb, 0, &asn1_ctx, tree, <API key>); } static void <API key>(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_tree *tree _U_) { asn1_ctx_t asn1_ctx; asn1_ctx_init(&asn1_ctx, ASN1_ENC_BER, TRUE, pinfo); <API key>(FALSE, tvb, 0, &asn1_ctx, tree, <API key>); } static void <API key>(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_tree *tree _U_) { asn1_ctx_t asn1_ctx; asn1_ctx_init(&asn1_ctx, ASN1_ENC_BER, TRUE, pinfo); <API key>(FALSE, tvb, 0, &asn1_ctx, tree, <API key>); } static void <API key>(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_tree *tree _U_) { asn1_ctx_t asn1_ctx; asn1_ctx_init(&asn1_ctx, ASN1_ENC_BER, TRUE, pinfo); <API key>(FALSE, tvb, 0, &asn1_ctx, tree, <API key>); } static void <API key>(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_tree *tree _U_) { asn1_ctx_t asn1_ctx; asn1_ctx_init(&asn1_ctx, ASN1_ENC_BER, TRUE, pinfo); <API key>(FALSE, tvb, 0, &asn1_ctx, tree, <API key>); } static void <API key>(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_tree *tree _U_) { asn1_ctx_t asn1_ctx; asn1_ctx_init(&asn1_ctx, ASN1_ENC_BER, TRUE, pinfo); <API key>(FALSE, tvb, 0, &asn1_ctx, tree, <API key>); } static void <API key>(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_tree *tree _U_) { asn1_ctx_t asn1_ctx; asn1_ctx_init(&asn1_ctx, ASN1_ENC_BER, TRUE, pinfo); <API key>(FALSE, tvb, 0, &asn1_ctx, tree, <API key>); } static void <API key>(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_tree *tree _U_) { asn1_ctx_t asn1_ctx; asn1_ctx_init(&asn1_ctx, ASN1_ENC_BER, TRUE, pinfo); <API key>(FALSE, tvb, 0, &asn1_ctx, tree, <API key>); } #line 94 "../../asn1/cmip/<API key>.c" /* XXX this one should be broken out later and moved into the conformance file */ static void dissect_cmip(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree) { static struct <API key>* session; proto_item *item = NULL; proto_tree *tree = NULL; asn1_ctx_t asn1_ctx; asn1_ctx_init(&asn1_ctx, ASN1_ENC_BER, TRUE, pinfo); session = (struct <API key>*)pinfo->private_data; /* do we have spdu type from the session dissector? */ if( !session ){ proto_tree_add_text(tree, tvb, 0, -1, "Internal error:can't get spdu type from session dissector."); return; } else { if(session->spdu_type == 0 ) { proto_tree_add_text(tree, tvb, 0, -1, "Internal error:wrong spdu type %x from session dissector.",session->spdu_type); return; } } if(parent_tree){ item = proto_tree_add_item(parent_tree, proto_cmip, tvb, 0, -1, ENC_NA); tree = <API key>(item, ett_cmip); } col_set_str(pinfo->cinfo, COL_PROTOCOL, "CMIP"); col_clear(pinfo->cinfo, COL_INFO); switch(session->spdu_type){ case <API key>: case <API key>: case SES_DISCONNECT: case SES_FINISH: case SES_REFUSE: <API key>(FALSE,tvb,0,&asn1_ctx,tree,-1); break; case SES_ABORT: <API key>(FALSE,tvb,0,&asn1_ctx,tree,-1); break; case SES_DATA_TRANSFER: dissect_cmip_ROS(FALSE,tvb,0,&asn1_ctx,tree,-1); break; default: ; } } void proto_register_cmip(void) { /* List of fields */ static hf_register_info hf[] = { { &<API key>, { "actionType", "cmip.actionType_OID", FT_STRING, BASE_NONE, NULL, 0, NULL, HFILL }}, { &<API key>, { "eventType", "cmip.eventType_OID", FT_STRING, BASE_NONE, NULL, 0, NULL, HFILL }}, { &<API key>, { "attributeId", "cmip.attributeId_OID", FT_STRING, BASE_NONE, NULL, 0, NULL, HFILL }}, { &hf_cmip_errorId_OID, { "errorId", "cmip.errorId_OID", FT_STRING, BASE_NONE, NULL, 0, NULL, HFILL }}, { &<API key>, { "<API key>", "cmip.<API key>", FT_UINT32, BASE_DEC, NULL, 0, NULL, HFILL }}, { &hf_Destination, { "Destination", "cmip.Destination", FT_UINT32, BASE_DEC, NULL, 0, NULL, HFILL }}, { &hf_NameBinding, { "NameBinding", "cmip.NameBinding", FT_STRING, BASE_NONE, NULL, 0, NULL, HFILL }}, { &hf_ObjectClass, { "ObjectClass", "cmip.ObjectClass", FT_UINT32, BASE_DEC, VALS(<API key>), 0, NULL, HFILL }}, #line 1 "../../asn1/cmip/packet-cmip-hfarr.c" { &<API key>, { "BaseManagedObjectId", "cmip.BaseManagedObjectId", FT_NONE, BASE_NONE, NULL, 0, NULL, HFILL }}, { &<API key>, { "EventTypeId", "cmip.EventTypeId", FT_UINT32, BASE_DEC, VALS(<API key>), 0, NULL, HFILL }}, { &<API key>, { "ObjectClass", "cmip.ObjectClass", FT_UINT32, BASE_DEC, VALS(<API key>), 0, NULL, HFILL }}, { &<API key>, { "ActiveDestination", "cmip.ActiveDestination", FT_UINT32, BASE_DEC, VALS(<API key>), 0, NULL, HFILL }}, { &<API key>, { "AdditionalText", "cmip.AdditionalText", FT_STRING, BASE_NONE, NULL, 0, NULL, HFILL }}, { &<API key>, { "<API key>", "cmip.<API key>", FT_UINT32, BASE_DEC, NULL, 0, NULL, HFILL }}, { &<API key>, { "Allomorphs", "cmip.Allomorphs", FT_UINT32, BASE_DEC, NULL, 0, NULL, HFILL }}, { &<API key>, { "AdministrativeState", "cmip.AdministrativeState", FT_UINT32, BASE_DEC, VALS(<API key>), 0, NULL, HFILL }}, { &<API key>, { "<API key>", "cmip.<API key>", FT_UINT32, BASE_DEC, NULL, 0, NULL, HFILL }}, { &<API key>, { "AttributeList", "cmip.AttributeList", FT_UINT32, BASE_DEC, NULL, 0, NULL, HFILL }}, { &<API key>, { "<API key>", "cmip.<API key>", FT_UINT32, BASE_DEC, NULL, 0, NULL, HFILL }}, { &<API key>, { "AlarmStatus", "cmip.AlarmStatus", FT_UINT32, BASE_DEC, NULL, 0, NULL, HFILL }}, { &<API key>, { "AvailabilityStatus", "cmip.AvailabilityStatus", FT_UINT32, BASE_DEC, NULL, 0, NULL, HFILL }}, { &<API key>, { "BackedUpStatus", "cmip.BackedUpStatus", FT_BOOLEAN, BASE_NONE, NULL, 0, NULL, HFILL }}, { &<API key>, { "<API key>", "cmip.<API key>", FT_UINT32, BASE_DEC, NULL, 0, NULL, HFILL }}, { &<API key>, { "<API key>", "cmip.<API key>", FT_UINT32, BASE_DEC, VALS(<API key>), 0, NULL, HFILL }}, { &<API key>, { "<API key>", "cmip.<API key>", FT_UINT32, BASE_DEC, NULL, 0, NULL, HFILL }}, { &<API key>, { "ConfirmedMode", "cmip.ConfirmedMode", FT_BOOLEAN, BASE_NONE, NULL, 0, NULL, HFILL }}, { &<API key>, { "ControlStatus", "cmip.ControlStatus", FT_UINT32, BASE_DEC, NULL, 0, NULL, HFILL }}, { &<API key>, { "<API key>", "cmip.<API key>", FT_UINT32, BASE_DEC, NULL, 0, NULL, HFILL }}, { &<API key>, { "CurrentLogSize", "cmip.CurrentLogSize", FT_INT32, BASE_DEC, NULL, 0, NULL, HFILL }}, { &<API key>, { "Destination", "cmip.Destination", FT_UINT32, BASE_DEC, VALS(<API key>), 0, NULL, HFILL }}, { &<API key>, { "<API key>", "cmip.<API key>", FT_UINT32, BASE_DEC, VALS(<API key>), 0, NULL, HFILL }}, { &<API key>, { "EventTime", "cmip.EventTime", FT_STRING, BASE_NONE, NULL, 0, NULL, HFILL }}, { &<API key>, { "GroupObjects", "cmip.GroupObjects", FT_UINT32, BASE_DEC, NULL, 0, NULL, HFILL }}, { &<API key>, { "IntervalsOfDay", "cmip.IntervalsOfDay", FT_UINT32, BASE_DEC, NULL, 0, NULL, HFILL }}, { &<API key>, { "LifecycleState", "cmip.LifecycleState", FT_UINT32, BASE_DEC, VALS(<API key>), 0, NULL, HFILL }}, { &<API key>, { "LogFullAction", "cmip.LogFullAction", FT_UINT32, BASE_DEC, VALS(<API key>), 0, NULL, HFILL }}, { &<API key>, { "LoggingTime", "cmip.LoggingTime", FT_STRING, BASE_NONE, NULL, 0, NULL, HFILL }}, { &<API key>, { "LogRecordId", "cmip.LogRecordId", FT_UINT32, BASE_DEC, VALS(<API key>), 0, NULL, HFILL }}, { &<API key>, { "MaxLogSize", "cmip.MaxLogSize", FT_INT32, BASE_DEC, VALS(<API key>), 0, NULL, HFILL }}, { &<API key>, { "MonitoredAttributes", "cmip.MonitoredAttributes", FT_UINT32, BASE_DEC, NULL, 0, NULL, HFILL }}, { &<API key>, { "NameBinding", "cmip.NameBinding", FT_OID, BASE_NONE, NULL, 0, NULL, HFILL }}, { &<API key>, { "<API key>", "cmip.<API key>", FT_INT32, BASE_DEC, NULL, 0, NULL, HFILL }}, { &<API key>, { "NumberOfRecords", "cmip.NumberOfRecords", FT_INT32, BASE_DEC, NULL, 0, NULL, HFILL }}, { &<API key>, { "OperationalState", "cmip.OperationalState", FT_UINT32, BASE_DEC, VALS(<API key>), 0, NULL, HFILL }}, { &<API key>, { "Packages", "cmip.Packages", FT_UINT32, BASE_DEC, NULL, 0, NULL, HFILL }}, { &<API key>, { "PerceivedSeverity", "cmip.PerceivedSeverity", FT_UINT32, BASE_DEC, VALS(<API key>), 0, NULL, HFILL }}, { &<API key>, { "PrioritisedObject", "cmip.PrioritisedObject", FT_UINT32, BASE_DEC, NULL, 0, NULL, HFILL }}, { &<API key>, { "ProbableCause", "cmip.ProbableCause", FT_UINT32, BASE_DEC, VALS(<API key>), 0, NULL, HFILL }}, { &<API key>, { "ProceduralStatus", "cmip.ProceduralStatus", FT_UINT32, BASE_DEC, NULL, 0, NULL, HFILL }}, { &<API key>, { "<API key>", "cmip.<API key>", FT_UINT32, BASE_DEC, NULL, 0, NULL, HFILL }}, { &<API key>, { "SecurityAlarmCause", "cmip.SecurityAlarmCause", FT_OID, BASE_NONE, NULL, 0, NULL, HFILL }}, { &<API key>, { "<API key>", "cmip.<API key>", FT_UINT32, BASE_DEC, VALS(<API key>), 0, NULL, HFILL }}, { &<API key>, { "<API key>", "cmip.<API key>", FT_UINT32, BASE_DEC, VALS(<API key>), 0, NULL, HFILL }}, { &<API key>, { "ServiceProvider", "cmip.ServiceProvider", FT_NONE, BASE_NONE, NULL, 0, NULL, HFILL }}, { &<API key>, { "ServiceUser", "cmip.ServiceUser", FT_NONE, BASE_NONE, NULL, 0, NULL, HFILL }}, { &<API key>, { "SimpleNameType", "cmip.SimpleNameType", FT_UINT32, BASE_DEC, VALS(<API key>), 0, NULL, HFILL }}, { &<API key>, { "SourceIndicator", "cmip.SourceIndicator", FT_UINT32, BASE_DEC, VALS(<API key>), 0, NULL, HFILL }}, { &<API key>, { "SpecificProblems", "cmip.SpecificProblems", FT_UINT32, BASE_DEC, NULL, 0, NULL, HFILL }}, { &<API key>, { "StandbyStatus", "cmip.StandbyStatus", FT_INT32, BASE_DEC, VALS(<API key>), 0, NULL, HFILL }}, { &<API key>, { "StartTime", "cmip.StartTime", FT_STRING, BASE_NONE, NULL, 0, NULL, HFILL }}, { &<API key>, { "StopTime", "cmip.StopTime", FT_UINT32, BASE_DEC, VALS(cmip_StopTime_vals), 0, NULL, HFILL }}, { &<API key>, { "SupportedFeatures", "cmip.SupportedFeatures", FT_UINT32, BASE_DEC, NULL, 0, NULL, HFILL }}, { &<API key>, { "SystemId", "cmip.SystemId", FT_UINT32, BASE_DEC, VALS(cmip_SystemId_vals), 0, NULL, HFILL }}, { &<API key>, { "SystemTitle", "cmip.SystemTitle", FT_UINT32, BASE_DEC, VALS(<API key>), 0, NULL, HFILL }}, { &<API key>, { "ThresholdInfo", "cmip.ThresholdInfo", FT_NONE, BASE_NONE, NULL, 0, NULL, HFILL }}, { &<API key>, { "TrendIndication", "cmip.TrendIndication", FT_UINT32, BASE_DEC, VALS(<API key>), 0, NULL, HFILL }}, { &<API key>, { "UnknownStatus", "cmip.UnknownStatus", FT_BOOLEAN, BASE_NONE, NULL, 0, NULL, HFILL }}, { &<API key>, { "UsageState", "cmip.UsageState", FT_UINT32, BASE_DEC, VALS(<API key>), 0, NULL, HFILL }}, { &<API key>, { "WeekMask", "cmip.WeekMask", FT_UINT32, BASE_DEC, NULL, 0, NULL, HFILL }}, { &<API key>, { "AttributeId", "cmip.AttributeId", FT_UINT32, BASE_DEC, VALS(<API key>), 0, NULL, HFILL }}, { &<API key>, { "managedObjectClass", "cmip.managedObjectClass", FT_UINT32, BASE_DEC, VALS(<API key>), 0, "ObjectClass", HFILL }}, { &<API key>, { "<API key>", "cmip.<API key>", FT_UINT32, BASE_DEC, VALS(<API key>), 0, "ObjectInstance", HFILL }}, { &hf_cmip_currentTime, { "currentTime", "cmip.currentTime", FT_STRING, BASE_NONE, NULL, 0, "GeneralizedTime", HFILL }}, { &<API key>, { "actionErrorInfo", "cmip.actionErrorInfo", FT_NONE, BASE_NONE, NULL, 0, NULL, HFILL }}, { &<API key>, { "errorStatus", "cmip.errorStatus", FT_UINT32, BASE_DEC, VALS(<API key>), 0, "<API key>", HFILL }}, { &<API key>, { "errorInfo", "cmip.errorInfo", FT_UINT32, BASE_DEC, VALS(<API key>), 0, "T_actionErrorInfo", HFILL }}, { &hf_cmip_actionType, { "actionType", "cmip.actionType", FT_UINT32, BASE_DEC, VALS(<API key>), 0, "ActionTypeId", HFILL }}, { &<API key>, { "actionArgument", "cmip.actionArgument", FT_UINT32, BASE_DEC, VALS(<API key>), 0, "NoSuchArgument", HFILL }}, { &<API key>, { "argumentValue", "cmip.argumentValue", FT_UINT32, BASE_DEC, VALS(<API key>), 0, "<API key>", HFILL }}, { &<API key>, { "actionInfoArg", "cmip.actionInfoArg", FT_NONE, BASE_NONE, NULL, 0, NULL, HFILL }}, { &<API key>, { "actionReplyInfo", "cmip.actionReplyInfo", FT_NONE, BASE_NONE, NULL, 0, NULL, HFILL }}, { &hf_cmip_actionReply, { "actionReply", "cmip.actionReply", FT_NONE, BASE_NONE, NULL, 0, NULL, HFILL }}, { &<API key>, { "globalForm", "cmip.globalForm", FT_OID, BASE_NONE, NULL, 0, "<API key>", HFILL }}, { &hf_cmip_localForm, { "localForm", "cmip.localForm", FT_INT32, BASE_DEC, NULL, 0, "INTEGER", HFILL }}, { &hf_cmip_attributeid, { "id", "cmip.id", FT_UINT32, BASE_DEC, VALS(<API key>), 0, "AttributeId", HFILL }}, { &hf_cmip_value, { "value", "cmip.value", FT_NONE, BASE_NONE, NULL, 0, "AttributeValue", HFILL }}, { &<API key>, { "errorStatus", "cmip.errorStatus", FT_UINT32, BASE_DEC, VALS(<API key>), 0, "<API key>", HFILL }}, { &<API key>, { "modifyOperator", "cmip.modifyOperator", FT_INT32, BASE_DEC, VALS(<API key>), 0, NULL, HFILL }}, { &hf_cmip_attributeId, { "attributeId", "cmip.attributeId", FT_UINT32, BASE_DEC, VALS(<API key>), 0, NULL, HFILL }}, { &<API key>, { "attributeValue", "cmip.attributeValue", FT_NONE, BASE_NONE, NULL, 0, NULL, HFILL }}, { &<API key>, { "globalForm", "cmip.globalForm", FT_OID, BASE_NONE, NULL, 0, "<API key>", HFILL }}, { &<API key>, { "localForm", "cmip.localForm", FT_INT32, BASE_DEC, NULL, 0, "<API key>", HFILL }}, { &<API key>, { "errorStatus", "cmip.errorStatus", FT_UINT32, BASE_DEC, VALS(<API key>), 0, "<API key>", HFILL }}, { &hf_cmip_id, { "id", "cmip.id", FT_OID, BASE_NONE, NULL, 0, NULL, HFILL }}, { &<API key>, { "value", "cmip.value", FT_NONE, BASE_NONE, NULL, 0, "<API key>", HFILL }}, { &<API key>, { "<API key>", "cmip.<API key>", FT_UINT32, BASE_DEC, VALS(<API key>), 0, "ObjectClass", HFILL }}, { &<API key>, { "<API key>", "cmip.<API key>", FT_UINT32, BASE_DEC, VALS(<API key>), 0, "ObjectInstance", HFILL }}, { &hf_cmip_item, { "item", "cmip.item", FT_UINT32, BASE_DEC, VALS(<API key>), 0, "FilterItem", HFILL }}, { &hf_cmip_and, { "and", "cmip.and", FT_UINT32, BASE_DEC, NULL, 0, "SET_OF_CMISFilter", HFILL }}, { &hf_cmip_and_item, { "CMISFilter", "cmip.CMISFilter", FT_UINT32, BASE_DEC, VALS(<API key>), 0, NULL, HFILL }}, { &hf_cmip_or, { "or", "cmip.or", FT_UINT32, BASE_DEC, NULL, 0, "SET_OF_CMISFilter", HFILL }}, { &hf_cmip_or_item, { "CMISFilter", "cmip.CMISFilter", FT_UINT32, BASE_DEC, VALS(<API key>), 0, NULL, HFILL }}, { &hf_cmip_not, { "not", "cmip.not", FT_UINT32, BASE_DEC, VALS(<API key>), 0, "CMISFilter", HFILL }}, { &hf_cmip_scope, { "scope", "cmip.scope", FT_UINT32, BASE_DEC, VALS(cmip_Scope_vals), 0, NULL, HFILL }}, { &hf_cmip_filter, { "filter", "cmip.filter", FT_UINT32, BASE_DEC, VALS(<API key>), 0, "CMISFilter", HFILL }}, { &hf_cmip_sync, { "sync", "cmip.sync", FT_UINT32, BASE_DEC, VALS(cmip_CMISSync_vals), 0, "CMISSync", HFILL }}, { &<API key>, { "<API key>", "cmip.<API key>", FT_UINT32, BASE_DEC, VALS(<API key>), 0, NULL, HFILL }}, { &<API key>, { "<API key>", "cmip.<API key>", FT_UINT32, BASE_DEC, VALS(<API key>), 0, "ObjectInstance", HFILL }}, { &<API key>, { "accessControl", "cmip.accessControl", FT_NONE, BASE_NONE, NULL, 0, NULL, HFILL }}, { &<API key>, { "<API key>", "cmip.<API key>", FT_UINT32, BASE_DEC, VALS(<API key>), 0, "ObjectInstance", HFILL }}, { &<API key>, { "attributeList", "cmip.attributeList", FT_UINT32, BASE_DEC, NULL, 0, "SET_OF_Attribute", HFILL }}, { &<API key>, { "Attribute", "cmip.Attribute", FT_NONE, BASE_NONE, NULL, 0, NULL, HFILL }}, { &<API key>, { "deleteErrorInfo", "cmip.deleteErrorInfo", FT_UINT32, BASE_DEC, VALS(<API key>), 0, NULL, HFILL }}, { &hf_cmip_eventType, { "eventType", "cmip.eventType", FT_UINT32, BASE_DEC, VALS(<API key>), 0, "EventTypeId", HFILL }}, { &<API key>, { "eventReplyInfo", "cmip.eventReplyInfo", FT_NONE, BASE_NONE, NULL, 0, NULL, HFILL }}, { &hf_cmip_eventTime, { "eventTime", "cmip.eventTime", FT_STRING, BASE_NONE, NULL, 0, "GeneralizedTime", HFILL }}, { &<API key>, { "eventInfo", "cmip.eventInfo", FT_NONE, BASE_NONE, NULL, 0, "<API key>", HFILL }}, { &hf_cmip_eventReply, { "eventReply", "cmip.eventReply", FT_NONE, BASE_NONE, NULL, 0, NULL, HFILL }}, { &<API key>, { "globalForm", "cmip.globalForm", FT_OID, BASE_NONE, NULL, 0, "<API key>", HFILL }}, { &hf_cmip_equality, { "equality", "cmip.equality", FT_NONE, BASE_NONE, NULL, 0, "Attribute", HFILL }}, { &hf_cmip_substrings, { "substrings", "cmip.substrings", FT_UINT32, BASE_DEC, NULL, 0, NULL, HFILL }}, { &<API key>, { "substrings item", "cmip.substrings_item", FT_UINT32, BASE_DEC, VALS(<API key>), 0, NULL, HFILL }}, { &<API key>, { "initialString", "cmip.initialString", FT_NONE, BASE_NONE, NULL, 0, "Attribute", HFILL }}, { &hf_cmip_anyString, { "anyString", "cmip.anyString", FT_NONE, BASE_NONE, NULL, 0, "Attribute", HFILL }}, { &hf_cmip_finalString, { "finalString", "cmip.finalString", FT_NONE, BASE_NONE, NULL, 0, "Attribute", HFILL }}, { &<API key>, { "greaterOrEqual", "cmip.greaterOrEqual", FT_NONE, BASE_NONE, NULL, 0, "Attribute", HFILL }}, { &hf_cmip_lessOrEqual, { "lessOrEqual", "cmip.lessOrEqual", FT_NONE, BASE_NONE, NULL, 0, "Attribute", HFILL }}, { &<API key>, { "present", "cmip.present", FT_UINT32, BASE_DEC, VALS(<API key>), 0, "AttributeId", HFILL }}, { &hf_cmip_subsetOf, { "subsetOf", "cmip.subsetOf", FT_NONE, BASE_NONE, NULL, 0, "Attribute", HFILL }}, { &hf_cmip_supersetOf, { "supersetOf", "cmip.supersetOf", FT_NONE, BASE_NONE, NULL, 0, "Attribute", HFILL }}, { &<API key>, { "<API key>", "cmip.<API key>", FT_NONE, BASE_NONE, NULL, 0, "Attribute", HFILL }}, { &<API key>, { "attributeIdError", "cmip.attributeIdError", FT_NONE, BASE_NONE, NULL, 0, NULL, HFILL }}, { &hf_cmip_attribute, { "attribute", "cmip.attribute", FT_NONE, BASE_NONE, NULL, 0, NULL, HFILL }}, { &hf_cmip_getInfoList, { "getInfoList", "cmip.getInfoList", FT_UINT32, BASE_DEC, NULL, 0, "<API key>", HFILL }}, { &<API key>, { "GetInfoStatus", "cmip.GetInfoStatus", FT_UINT32, BASE_DEC, VALS(<API key>), 0, NULL, HFILL }}, { &hf_cmip_actionValue, { "actionValue", "cmip.actionValue", FT_NONE, BASE_NONE, NULL, 0, "ActionInfo", HFILL }}, { &hf_cmip_eventValue, { "eventValue", "cmip.eventValue", FT_NONE, BASE_NONE, NULL, 0, NULL, HFILL }}, { &hf_cmip_eventInfo, { "eventInfo", "cmip.eventInfo", FT_NONE, BASE_NONE, NULL, 0, NULL, HFILL }}, { &hf_cmip_getResult, { "getResult", "cmip.getResult", FT_NONE, BASE_NONE, NULL, 0, NULL, HFILL }}, { &<API key>, { "getListError", "cmip.getListError", FT_NONE, BASE_NONE, NULL, 0, NULL, HFILL }}, { &hf_cmip_setResult, { "setResult", "cmip.setResult", FT_NONE, BASE_NONE, NULL, 0, NULL, HFILL }}, { &<API key>, { "setListError", "cmip.setListError", FT_NONE, BASE_NONE, NULL, 0, NULL, HFILL }}, { &<API key>, { "actionResult", "cmip.actionResult", FT_NONE, BASE_NONE, NULL, 0, NULL, HFILL }}, { &<API key>, { "processingFailure", "cmip.processingFailure", FT_NONE, BASE_NONE, NULL, 0, NULL, HFILL }}, { &<API key>, { "deleteResult", "cmip.deleteResult", FT_NONE, BASE_NONE, NULL, 0, NULL, HFILL }}, { &hf_cmip_actionError, { "actionError", "cmip.actionError", FT_NONE, BASE_NONE, NULL, 0, NULL, HFILL }}, { &hf_cmip_deleteError, { "deleteError", "cmip.deleteError", FT_NONE, BASE_NONE, NULL, 0, NULL, HFILL }}, { &hf_cmip_actionId, { "actionId", "cmip.actionId", FT_NONE, BASE_NONE, NULL, 0, NULL, HFILL }}, { &hf_cmip_eventId, { "eventId", "cmip.eventId", FT_NONE, BASE_NONE, NULL, 0, NULL, HFILL }}, { &<API key>, { "globalForm", "cmip.globalForm", FT_OID, BASE_NONE, NULL, 0, "<API key>", HFILL }}, { &<API key>, { "localForm", "cmip.localForm", FT_INT32, BASE_DEC, NULL, 0, "<API key>", HFILL }}, { &<API key>, { "distinguishedName", "cmip.distinguishedName", FT_UINT32, BASE_DEC, NULL, 0, NULL, HFILL }}, { &<API key>, { "nonSpecificForm", "cmip.nonSpecificForm", FT_BYTES, BASE_NONE, NULL, 0, "OCTET_STRING", HFILL }}, { &<API key>, { "<API key>", "cmip.<API key>", FT_UINT32, BASE_DEC, NULL, 0, "RDNSequence", HFILL }}, { &<API key>, { "specificErrorInfo", "cmip.specificErrorInfo", FT_NONE, BASE_NONE, NULL, 0, NULL, HFILL }}, { &<API key>, { "<API key>", "cmip.<API key>", FT_UINT32, BASE_DEC, NULL, 0, NULL, HFILL }}, { &<API key>, { "<API key>", "cmip.<API key>", FT_NONE, BASE_NONE, NULL, 0, NULL, HFILL }}, { &<API key>, { "namedNumbers", "cmip.namedNumbers", FT_INT32, BASE_DEC, VALS(<API key>), 0, NULL, HFILL }}, { &<API key>, { "individualLevels", "cmip.individualLevels", FT_INT32, BASE_DEC, NULL, 0, "INTEGER", HFILL }}, { &<API key>, { "baseToNthLevel", "cmip.baseToNthLevel", FT_INT32, BASE_DEC, NULL, 0, "INTEGER", HFILL }}, { &<API key>, { "attributeError", "cmip.attributeError", FT_NONE, BASE_NONE, NULL, 0, NULL, HFILL }}, { &hf_cmip_setInfoList, { "setInfoList", "cmip.setInfoList", FT_UINT32, BASE_DEC, NULL, 0, "<API key>", HFILL }}, { &<API key>, { "SetInfoStatus", "cmip.SetInfoStatus", FT_UINT32, BASE_DEC, VALS(<API key>), 0, NULL, HFILL }}, { &hf_cmip_errorId, { "errorId", "cmip.errorId", FT_OID, BASE_NONE, NULL, 0, NULL, HFILL }}, { &hf_cmip_errorInfo, { "errorInfo", "cmip.errorInfo", FT_NONE, BASE_NONE, NULL, 0, NULL, HFILL }}, { &hf_cmip_abortSource, { "abortSource", "cmip.abortSource", FT_UINT32, BASE_DEC, VALS(<API key>), 0, "CMIPAbortSource", HFILL }}, { &hf_cmip_userInfo, { "userInfo", "cmip.userInfo", FT_NONE, BASE_NONE, NULL, 0, "EXTERNAL", HFILL }}, { &<API key>, { "protocolVersion", "cmip.protocolVersion", FT_BYTES, BASE_NONE, NULL, 0, NULL, HFILL }}, { &<API key>, { "functionalUnits", "cmip.functionalUnits", FT_BYTES, BASE_NONE, NULL, 0, NULL, HFILL }}, { &<API key>, { "accessControl", "cmip.accessControl", FT_NONE, BASE_NONE, NULL, 0, "EXTERNAL", HFILL }}, { &<API key>, { "ManagementExtension", "cmip.ManagementExtension", FT_NONE, BASE_NONE, NULL, 0, NULL, HFILL }}, { &<API key>, { "ObjectClass", "cmip.ObjectClass", FT_UINT32, BASE_DEC, VALS(<API key>), 0, NULL, HFILL }}, { &<API key>, { "AttributeId", "cmip.AttributeId", FT_UINT32, BASE_DEC, VALS(<API key>), 0, NULL, HFILL }}, { &<API key>, { "Attribute", "cmip.Attribute", FT_NONE, BASE_NONE, NULL, 0, NULL, HFILL }}, { &<API key>, { "<API key> item", "cmip.<API key>", FT_NONE, BASE_NONE, NULL, 0, NULL, HFILL }}, { &<API key>, { "oldAttributeValue", "cmip.oldAttributeValue", FT_NONE, BASE_NONE, NULL, 0, NULL, HFILL }}, { &<API key>, { "newAttributeValue", "cmip.newAttributeValue", FT_NONE, BASE_NONE, NULL, 0, NULL, HFILL }}, { &<API key>, { "AlarmStatus item", "cmip.AlarmStatus_item", FT_INT32, BASE_DEC, VALS(<API key>), 0, NULL, HFILL }}, { &<API key>, { "AvailabilityStatus item", "cmip.<API key>", FT_INT32, BASE_DEC, VALS(<API key>), 0, NULL, HFILL }}, { &<API key>, { "AE-title", "cmip.AE_title", FT_UINT32, BASE_DEC, VALS(acse_AE_title_vals), 0, NULL, HFILL }}, { &hf_cmip_objectName, { "objectName", "cmip.objectName", FT_UINT32, BASE_DEC, VALS(<API key>), 0, "ObjectInstance", HFILL }}, { &hf_cmip_noObject, { "noObject", "cmip.noObject", FT_NONE, BASE_NONE, NULL, 0, NULL, HFILL }}, { &<API key>, { "<API key> item", "cmip.<API key>", FT_UINT32, BASE_DEC, NULL, 0, "INTEGER_0_100", HFILL }}, { &<API key>, { "ControlStatus item", "cmip.ControlStatus_item", FT_INT32, BASE_DEC, VALS(<API key>), 0, NULL, HFILL }}, { &<API key>, { "<API key> item", "cmip.<API key>", FT_NONE, BASE_NONE, NULL, 0, NULL, HFILL }}, { &<API key>, { "<API key>", "cmip.<API key>", FT_UINT32, BASE_DEC, NULL, 0, "<API key>", HFILL }}, { &<API key>, { "<API key>", "cmip.<API key>", FT_INT32, BASE_DEC, NULL, 0, NULL, HFILL }}, { &<API key>, { "sourceObjectInst", "cmip.sourceObjectInst", FT_UINT32, BASE_DEC, VALS(<API key>), 0, "ObjectInstance", HFILL }}, { &hf_cmip_single, { "single", "cmip.single", FT_UINT32, BASE_DEC, VALS(acse_AE_title_vals), 0, "AE_title", HFILL }}, { &hf_cmip_multiple, { "multiple", "cmip.multiple", FT_UINT32, BASE_DEC, NULL, 0, "SET_OF_AE_title", HFILL }}, { &<API key>, { "AE-title", "cmip.AE_title", FT_UINT32, BASE_DEC, VALS(acse_AE_title_vals), 0, NULL, HFILL }}, { &<API key>, { "ObjectInstance", "cmip.ObjectInstance", FT_UINT32, BASE_DEC, VALS(<API key>), 0, NULL, HFILL }}, { &<API key>, { "IntervalsOfDay item", "cmip.IntervalsOfDay_item", FT_NONE, BASE_NONE, NULL, 0, NULL, HFILL }}, { &<API key>, { "intervalStart", "cmip.intervalStart", FT_NONE, BASE_NONE, NULL, 0, "Time24", HFILL }}, { &hf_cmip_intervalEnd, { "intervalEnd", "cmip.intervalEnd", FT_NONE, BASE_NONE, NULL, 0, "Time24", HFILL }}, { &<API key>, { "identifier", "cmip.identifier", FT_OID, BASE_NONE, NULL, 0, "<API key>", HFILL }}, { &<API key>, { "significance", "cmip.significance", FT_BOOLEAN, BASE_NONE, NULL, 0, "BOOLEAN", HFILL }}, { &hf_cmip_information, { "information", "cmip.information", FT_NONE, BASE_NONE, NULL, 0, NULL, HFILL }}, { &<API key>, { "Attribute", "cmip.Attribute", FT_NONE, BASE_NONE, NULL, 0, NULL, HFILL }}, { &hf_cmip_integer, { "integer", "cmip.integer", FT_INT32, BASE_DEC, NULL, 0, NULL, HFILL }}, { &hf_cmip_real, { "real", "cmip.real", FT_DOUBLE, BASE_NONE, NULL, 0, NULL, HFILL }}, { &<API key>, { "Packages item", "cmip.Packages_item", FT_OID, BASE_NONE, NULL, 0, "OBJECT_IDENTIFIER", HFILL }}, { &<API key>, { "PrioritisedObject item", "cmip.<API key>", FT_NONE, BASE_NONE, NULL, 0, NULL, HFILL }}, { &hf_cmip_object, { "object", "cmip.object", FT_UINT32, BASE_DEC, VALS(<API key>), 0, "ObjectInstance", HFILL }}, { &hf_cmip_priority, { "priority", "cmip.priority", FT_INT32, BASE_DEC, VALS(<API key>), 0, NULL, HFILL }}, { &hf_cmip_globalValue, { "globalValue", "cmip.globalValue", FT_OID, BASE_NONE, NULL, 0, "OBJECT_IDENTIFIER", HFILL }}, { &hf_cmip_localValue, { "localValue", "cmip.localValue", FT_INT32, BASE_DEC, NULL, 0, "INTEGER", HFILL }}, { &<API key>, { "ProceduralStatus item", "cmip.<API key>", FT_INT32, BASE_DEC, VALS(<API key>), 0, NULL, HFILL }}, { &<API key>, { "SpecificIdentifier", "cmip.SpecificIdentifier", FT_UINT32, BASE_DEC, VALS(<API key>), 0, NULL, HFILL }}, { &hf_cmip_mechanism, { "mechanism", "cmip.mechanism", FT_OID, BASE_NONE, NULL, 0, "OBJECT_IDENTIFIER", HFILL }}, { &hf_cmip_application, { "application", "cmip.application", FT_UINT32, BASE_DEC, VALS(acse_AE_title_vals), 0, "AE_title", HFILL }}, { &<API key>, { "identifier", "cmip.identifier", FT_OID, BASE_NONE, NULL, 0, "<API key>", HFILL }}, { &hf_cmip_details, { "details", "cmip.details", FT_NONE, BASE_NONE, NULL, 0, NULL, HFILL }}, { &hf_cmip_number, { "number", "cmip.number", FT_INT32, BASE_DEC, NULL, 0, "INTEGER", HFILL }}, { &hf_cmip_string, { "string", "cmip.string", FT_STRING, BASE_NONE, NULL, 0, "GraphicString", HFILL }}, { &hf_cmip_oi, { "oi", "cmip.oi", FT_OID, BASE_NONE, NULL, 0, "OBJECT_IDENTIFIER", HFILL }}, { &hf_cmip_int, { "int", "cmip.int", FT_INT32, BASE_DEC, NULL, 0, "INTEGER", HFILL }}, { &<API key>, { "SpecificIdentifier", "cmip.SpecificIdentifier", FT_UINT32, BASE_DEC, VALS(<API key>), 0, NULL, HFILL }}, { &hf_cmip_specific, { "specific", "cmip.specific", FT_STRING, BASE_NONE, NULL, 0, "GeneralizedTime", HFILL }}, { &hf_cmip_continual, { "continual", "cmip.continual", FT_NONE, BASE_NONE, NULL, 0, NULL, HFILL }}, { &<API key>, { "SupportedFeatures item", "cmip.<API key>", FT_NONE, BASE_NONE, NULL, 0, NULL, HFILL }}, { &<API key>, { "featureIdentifier", "cmip.featureIdentifier", FT_OID, BASE_NONE, NULL, 0, NULL, HFILL }}, { &hf_cmip_featureInfo, { "featureInfo", "cmip.featureInfo", FT_NONE, BASE_NONE, NULL, 0, NULL, HFILL }}, { &hf_cmip_name, { "name", "cmip.name", FT_STRING, BASE_NONE, NULL, 0, "GraphicString", HFILL }}, { &hf_cmip_nothing, { "nothing", "cmip.nothing", FT_NONE, BASE_NONE, NULL, 0, NULL, HFILL }}, { &hf_cmip_oid, { "oid", "cmip.oid", FT_OID, BASE_NONE, NULL, 0, "OBJECT_IDENTIFIER", HFILL }}, { &hf_cmip_hour, { "hour", "cmip.hour", FT_UINT32, BASE_DEC, NULL, 0, "INTEGER_0_23", HFILL }}, { &hf_cmip_minute, { "minute", "cmip.minute", FT_UINT32, BASE_DEC, NULL, 0, "INTEGER_0_59", HFILL }}, { &<API key>, { "triggeredThreshold", "cmip.triggeredThreshold", FT_UINT32, BASE_DEC, VALS(<API key>), 0, "AttributeId", HFILL }}, { &<API key>, { "observedValue", "cmip.observedValue", FT_UINT32, BASE_DEC, VALS(<API key>), 0, NULL, HFILL }}, { &<API key>, { "thresholdLevel", "cmip.thresholdLevel", FT_UINT32, BASE_DEC, VALS(<API key>), 0, "ThresholdLevelInd", HFILL }}, { &hf_cmip_armTime, { "armTime", "cmip.armTime", FT_STRING, BASE_NONE, NULL, 0, "GeneralizedTime", HFILL }}, { &hf_cmip_up, { "up", "cmip.up", FT_NONE, BASE_NONE, NULL, 0, NULL, HFILL }}, { &hf_cmip_high, { "high", "cmip.high", FT_UINT32, BASE_DEC, VALS(<API key>), 0, "ObservedValue", HFILL }}, { &hf_cmip_low, { "low", "cmip.low", FT_UINT32, BASE_DEC, VALS(<API key>), 0, "ObservedValue", HFILL }}, { &hf_cmip_down, { "down", "cmip.down", FT_NONE, BASE_NONE, NULL, 0, NULL, HFILL }}, { &<API key>, { "WeekMask item", "cmip.WeekMask_item", FT_NONE, BASE_NONE, NULL, 0, NULL, HFILL }}, { &hf_cmip_daysOfWeek, { "daysOfWeek", "cmip.daysOfWeek", FT_BYTES, BASE_NONE, NULL, 0, NULL, HFILL }}, { &<API key>, { "intervalsOfDay", "cmip.intervalsOfDay", FT_UINT32, BASE_DEC, NULL, 0, NULL, HFILL }}, { &hf_cmip_local, { "local", "cmip.local", FT_INT32, BASE_DEC, NULL, 0, NULL, HFILL }}, { &hf_cmip_global, { "global", "cmip.global", FT_OID, BASE_NONE, NULL, 0, "OBJECT_IDENTIFIER", HFILL }}, { &hf_cmip_invoke, { "invoke", "cmip.invoke", FT_NONE, BASE_NONE, NULL, 0, NULL, HFILL }}, { &<API key>, { "returnResult", "cmip.returnResult", FT_NONE, BASE_NONE, NULL, 0, NULL, HFILL }}, { &hf_cmip_returnError, { "returnError", "cmip.returnError", FT_NONE, BASE_NONE, NULL, 0, NULL, HFILL }}, { &hf_cmip_reject, { "reject", "cmip.reject", FT_NONE, BASE_NONE, NULL, 0, NULL, HFILL }}, { &hf_cmip_invokeId, { "invokeId", "cmip.invokeId", FT_UINT32, BASE_DEC, VALS(cmip_InvokeId_vals), 0, NULL, HFILL }}, { &hf_cmip_linkedId, { "linkedId", "cmip.linkedId", FT_UINT32, BASE_DEC, VALS(<API key>), 0, NULL, HFILL }}, { &<API key>, { "present", "cmip.present", FT_INT32, BASE_DEC, NULL, 0, "T_linkedIdPresent", HFILL }}, { &hf_cmip_absent, { "absent", "cmip.absent", FT_NONE, BASE_NONE, NULL, 0, NULL, HFILL }}, { &hf_cmip_opcode, { "opcode", "cmip.opcode", FT_UINT32, BASE_DEC, VALS(cmip_Code_vals), 0, "Code", HFILL }}, { &hf_cmip_argument, { "argument", "cmip.argument", FT_NONE, BASE_NONE, NULL, 0, "InvokeArgument", HFILL }}, { &hf_cmip_result, { "result", "cmip.result", FT_NONE, BASE_NONE, NULL, 0, NULL, HFILL }}, { &<API key>, { "result", "cmip.result", FT_NONE, BASE_NONE, NULL, 0, "ResultArgument", HFILL }}, { &hf_cmip_errcode, { "errcode", "cmip.errcode", FT_UINT32, BASE_DEC, VALS(cmip_Code_vals), 0, "Code", HFILL }}, { &hf_cmip_parameter, { "parameter", "cmip.parameter", FT_NONE, BASE_NONE, NULL, 0, NULL, HFILL }}, { &hf_cmip_problem, { "problem", "cmip.problem", FT_UINT32, BASE_DEC, VALS(cmip_T_problem_vals), 0, NULL, HFILL }}, { &hf_cmip_general, { "general", "cmip.general", FT_INT32, BASE_DEC, VALS(<API key>), 0, "GeneralProblem", HFILL }}, { &<API key>, { "invoke", "cmip.invoke", FT_INT32, BASE_DEC, VALS(<API key>), 0, "InvokeProblem", HFILL }}, { &<API key>, { "returnResult", "cmip.returnResult", FT_INT32, BASE_DEC, VALS(<API key>), 0, "ReturnResultProblem", HFILL }}, { &<API key>, { "returnError", "cmip.returnError", FT_INT32, BASE_DEC, VALS(<API key>), 0, "ReturnErrorProblem", HFILL }}, { &hf_cmip_present, { "present", "cmip.present", FT_INT32, BASE_DEC, NULL, 0, "INTEGER", HFILL }}, { &<API key>, { "synchronization", "cmip.synchronization", FT_UINT32, BASE_DEC, VALS(cmip_CMISSync_vals), 0, "CMISSync", HFILL }}, { &hf_cmip_actionInfo, { "actionInfo", "cmip.actionInfo", FT_NONE, BASE_NONE, NULL, 0, NULL, HFILL }}, { &<API key>, { "attributeIdList", "cmip.attributeIdList", FT_UINT32, BASE_DEC, NULL, 0, "SET_OF_AttributeId", HFILL }}, { &<API key>, { "AttributeId", "cmip.AttributeId", FT_UINT32, BASE_DEC, VALS(<API key>), 0, NULL, HFILL }}, { &<API key>, { "modificationList", "cmip.modificationList", FT_UINT32, BASE_DEC, NULL, 0, NULL, HFILL }}, { &<API key>, { "modificationList item", "cmip.<API key>", FT_NONE, BASE_NONE, NULL, 0, "<API key>", HFILL }}, { &<API key>, { "attributeValue", "cmip.attributeValue", FT_NONE, BASE_NONE, NULL, 0, NULL, HFILL }}, { &<API key>, { "InvokeId.present", "cmip.InvokeId_present", FT_INT32, BASE_DEC, NULL, 0, "InvokeId_present", HFILL }}, { &<API key>, { "<API key>", "cmip.<API key>", FT_BOOLEAN, 8, NULL, 0x80, NULL, HFILL }}, { &<API key>, { "filter", "cmip.filter", FT_BOOLEAN, 8, NULL, 0x40, NULL, HFILL }}, { &<API key>, { "multipleReply", "cmip.multipleReply", FT_BOOLEAN, 8, NULL, 0x20, NULL, HFILL }}, { &<API key>, { "extendedService", "cmip.extendedService", FT_BOOLEAN, 8, NULL, 0x10, NULL, HFILL }}, { &<API key>, { "cancelGet", "cmip.cancelGet", FT_BOOLEAN, 8, NULL, 0x08, NULL, HFILL }}, { &<API key>, { "version1", "cmip.version1", FT_BOOLEAN, 8, NULL, 0x80, NULL, HFILL }}, { &<API key>, { "version2", "cmip.version2", FT_BOOLEAN, 8, NULL, 0x40, NULL, HFILL }}, { &<API key>, { "sunday", "cmip.sunday", FT_BOOLEAN, 8, NULL, 0x80, NULL, HFILL }}, { &<API key>, { "monday", "cmip.monday", FT_BOOLEAN, 8, NULL, 0x40, NULL, HFILL }}, { &<API key>, { "tuesday", "cmip.tuesday", FT_BOOLEAN, 8, NULL, 0x20, NULL, HFILL }}, { &<API key>, { "wednesday", "cmip.wednesday", FT_BOOLEAN, 8, NULL, 0x10, NULL, HFILL }}, { &<API key>, { "thursday", "cmip.thursday", FT_BOOLEAN, 8, NULL, 0x08, NULL, HFILL }}, { &<API key>, { "friday", "cmip.friday", FT_BOOLEAN, 8, NULL, 0x04, NULL, HFILL }}, { &<API key>, { "saturday", "cmip.saturday", FT_BOOLEAN, 8, NULL, 0x02, NULL, HFILL }}, #line 188 "../../asn1/cmip/<API key>.c" }; /* List of subtrees */ static gint *ett[] = { &ett_cmip, #line 1 "../../asn1/cmip/packet-cmip-ettarr.c" &<API key>, &<API key>, &<API key>, &<API key>, &<API key>, &ett_cmip_ActionInfo, &<API key>, &<API key>, &<API key>, &ett_cmip_Attribute, &<API key>, &<API key>, &<API key>, &<API key>, &<API key>, &ett_cmip_CMISFilter, &<API key>, &<API key>, &<API key>, &<API key>, &<API key>, &<API key>, &<API key>, &<API key>, &<API key>, &ett_cmip_EventReply, &<API key>, &<API key>, &<API key>, &ett_cmip_FilterItem, &<API key>, &<API key>, &<API key>, &<API key>, &<API key>, &<API key>, &ett_cmip_GetResult, &<API key>, &<API key>, &<API key>, &<API key>, &<API key>, &ett_cmip_T_actionId, &ett_cmip_T_eventId, &<API key>, &<API key>, &<API key>, &<API key>, &<API key>, &<API key>, &ett_cmip_Scope, &<API key>, &<API key>, &<API key>, &<API key>, &ett_cmip_SetResult, &<API key>, &<API key>, &<API key>, &<API key>, &<API key>, &<API key>, &ett_cmip_Allomorphs, &<API key>, &<API key>, &<API key>, &<API key>, &<API key>, &<API key>, &<API key>, &<API key>, &<API key>, &<API key>, &<API key>, &<API key>, &<API key>, &<API key>, &<API key>, &<API key>, &<API key>, &<API key>, &<API key>, &<API key>, &<API key>, &ett_cmip_Packages, &<API key>, &<API key>, &<API key>, &<API key>, &<API key>, &<API key>, &<API key>, &<API key>, &<API key>, &<API key>, &ett_cmip_StopTime, &<API key>, &<API key>, &ett_cmip_SystemId, &<API key>, &ett_cmip_Time24, &<API key>, &<API key>, &ett_cmip_T_up, &ett_cmip_T_down, &ett_cmip_WeekMask, &<API key>, &<API key>, &ett_cmip_Code, &ett_cmip_ROS, &ett_cmip_Invoke, &ett_cmip_T_linkedId, &<API key>, &ett_cmip_T_result, &<API key>, &ett_cmip_Reject, &ett_cmip_T_problem, &ett_cmip_InvokeId, &<API key>, &<API key>, &<API key>, #line 194 "../../asn1/cmip/<API key>.c" }; /* Register protocol */ proto_cmip = <API key>(PNAME, PSNAME, PFNAME); /* Register fields and subtrees */ <API key>(proto_cmip, hf, array_length(hf)); <API key>(ett, array_length(ett)); #line 1 "../../asn1/cmip/packet-cmip-dis-tab.c" <API key>("2.9.2.21.7.13", <API key>, proto_cmip, "BaseManagedObjectId(13)"); <API key>("2.9.3.2.7.1", <API key>, proto_cmip, "discriminatorId(1)"); <API key>("2.9.3.2.7.2", <API key>, proto_cmip, "logId(2)"); <API key>("2.9.3.2.7.3", <API key>, proto_cmip, "logRecordId(3)"); <API key>("2.9.3.2.7.4", <API key>, proto_cmip, "systemId(4)"); <API key>("2.9.3.2.7.5", <API key>, proto_cmip, "systemTitle(5)"); <API key>("2.9.3.2.7.6", <API key>, proto_cmip, "<API key>(6)"); <API key>("2.9.3.2.7.7", <API key>, proto_cmip, "additionalText(7)"); <API key>("2.9.3.2.7.8", <API key>, proto_cmip, "<API key>(8)"); <API key>("2.9.3.2.7.9", <API key>, proto_cmip, "attributeList(9)"); <API key>("2.9.3.2.7.10", <API key>, proto_cmip, "<API key>(10)"); <API key>("2.9.3.2.7.11", <API key>, proto_cmip, "backedUpStatus(11)"); <API key>("2.9.3.2.7.12", <API key>, proto_cmip, "<API key>(12)"); <API key>("2.9.3.2.7.13", <API key>, proto_cmip, "eventTime(13)"); <API key>("2.9.3.2.7.14", <API key>, proto_cmip, "eventType(14)"); <API key>("2.9.3.2.7.15", <API key>, proto_cmip, "monitoredAttributes(15)"); <API key>("2.9.3.2.7.16", <API key>, proto_cmip, "<API key>(16)"); <API key>("2.9.3.2.7.17", <API key>, proto_cmip, "perceivedSeverity(17)"); <API key>("2.9.3.2.7.18", <API key>, proto_cmip, "probableCause(18)"); <API key>("2.9.3.2.7.19", <API key>, proto_cmip, "<API key>(19)"); <API key>("2.9.3.2.7.20", <API key>, proto_cmip, "<API key>(20)"); <API key>("2.9.3.2.7.21", <API key>, proto_cmip, "securityAlarmCause(21)"); <API key>("2.9.3.2.7.22", <API key>, proto_cmip, "<API key>(22)"); <API key>("2.9.3.2.7.23", <API key>, proto_cmip, "<API key>(23)"); <API key>("2.9.3.2.7.24", <API key>, proto_cmip, "serviceProvider(24)"); <API key>("2.9.3.2.7.25", <API key>, proto_cmip, "serviceUser(25)"); <API key>("2.9.3.2.7.26", <API key>, proto_cmip, "sourceIndicator(26)"); <API key>("2.9.3.2.7.27", <API key>, proto_cmip, "specificProblems(27)"); <API key>("2.9.3.2.7.28", <API key>, proto_cmip, "<API key>(28)"); <API key>("2.9.3.2.7.29", <API key>, proto_cmip, "thresholdInfo(29)"); <API key>("2.9.3.2.7.30", <API key>, proto_cmip, "trendIndication(30)"); <API key>("2.9.3.2.7.31", <API key>, proto_cmip, "administrativeState(31)"); <API key>("2.9.3.2.7.32", <API key>, proto_cmip, "alarmStatus(32)"); <API key>("2.9.3.2.7.33", <API key>, proto_cmip, "availabilityStatus(33)"); <API key>("2.9.3.2.7.34", <API key>, proto_cmip, "controlStatus(34)"); <API key>("2.9.3.2.7.35", <API key>, proto_cmip, "operationalState(35)"); <API key>("2.9.3.2.7.36", <API key>, proto_cmip, "proceduralStatus(36)"); <API key>("2.9.3.2.7.37", <API key>, proto_cmip, "standbyStatus(37)"); <API key>("2.9.3.2.7.38", <API key>, proto_cmip, "unknownStatus(38)"); <API key>("2.9.3.2.7.39", <API key>, proto_cmip, "usageState(39)"); <API key>("2.9.3.2.7.40", <API key>, proto_cmip, "backUpObject(40)"); <API key>("2.9.3.2.7.41", <API key>, proto_cmip, "backedUpObject(41)"); <API key>("2.9.3.2.7.42", <API key>, proto_cmip, "member(42)"); <API key>("2.9.3.2.7.43", <API key>, proto_cmip, "owner(43)"); <API key>("2.9.3.2.7.44", <API key>, proto_cmip, "peer(44)"); <API key>("2.9.3.2.7.45", <API key>, proto_cmip, "primary(45)"); <API key>("2.9.3.2.7.46", <API key>, proto_cmip, "providerObject(46)"); <API key>("2.9.3.2.7.47", <API key>, proto_cmip, "secondary(47)"); <API key>("2.9.3.2.7.48", <API key>, proto_cmip, "userObject(48)"); <API key>("2.9.3.2.7.49", <API key>, proto_cmip, "activeDestination(49)"); <API key>("2.9.3.2.7.50", <API key>, proto_cmip, "allomorphs(50)"); <API key>("2.9.3.2.7.51", <API key>, proto_cmip, "<API key>(51)"); <API key>("2.9.3.2.7.52", <API key>, proto_cmip, "<API key>(52)"); <API key>("2.9.3.2.7.53", <API key>, proto_cmip, "confirmedMode(53)"); <API key>("2.9.3.2.7.54", <API key>, proto_cmip, "currentLogSize(54)"); <API key>("2.9.3.2.7.55", <API key>, proto_cmip, "destination(55)"); <API key>("2.9.3.2.7.56", <API key>, proto_cmip, "<API key>(56)"); <API key>("2.9.3.2.7.57", <API key>, proto_cmip, "intervalsOfDay(57)"); <API key>("2.9.3.2.7.58", <API key>, proto_cmip, "logFullAction(58)"); <API key>("2.9.3.2.7.59", <API key>, proto_cmip, "loggingTime(59)"); <API key>("2.9.3.2.7.62", <API key>, proto_cmip, "maxLogSize(62)"); <API key>("2.9.3.2.7.63", <API key>, proto_cmip, "nameBinding(63)"); <API key>("2.9.3.2.7.64", <API key>, proto_cmip, "numberOfRecords(64)"); <API key>("2.9.3.2.7.65", <API key>, proto_cmip, "objectClass(65)"); <API key>("2.9.3.2.7.66", <API key>, proto_cmip, "packages(66)"); <API key>("2.9.3.2.7.68", <API key>, proto_cmip, "startTime(68)"); <API key>("2.9.3.2.7.69", <API key>, proto_cmip, "stopTime(69)"); <API key>("2.9.3.2.7.70", <API key>, proto_cmip, "supportedFeatures(70)"); <API key>("2.9.3.2.7.71", <API key>, proto_cmip, "weekMask(71)"); <API key>("2.9.3.2.7.115", <API key>, proto_cmip, "lifecycleState(115)"); #line 203 "../../asn1/cmip/<API key>.c" oid_add_from_string("discriminatorId(1)","2.9.3.2.7.1"); <API key> = <API key>("cmip.attribute_id", "CMIP Attribute Id", FT_UINT32, BASE_DEC); } void <API key>(void) { <API key>("2.9.0.0.2", dissect_cmip, proto_cmip, "cmip"); <API key>("2.9.1.1.4", dissect_cmip, proto_cmip, "joint-iso-itu-t(2) ms(9) cmip(1) cmip-pci(1) abstractSyntax(4)"); oid_add_from_string("2.9.3.2.3.1","managedObjectClass(3) alarmRecord(1)"); oid_add_from_string("2.9.3.2.3.2","managedObjectClass(3) <API key>(2)"); oid_add_from_string("2.9.3.2.3.3","managedObjectClass(3) discriminator(3)"); oid_add_from_string("2.9.3.2.3.4","managedObjectClass(3) <API key>(4)"); oid_add_from_string("2.9.3.2.3.5","managedObjectClass(3) eventLogRecord(5)"); oid_add_from_string("2.9.3.2.3.6","managedObjectClass(3) log(6)"); oid_add_from_string("2.9.3.2.3.7","managedObjectClass(3) logRecord(7)"); oid_add_from_string("2.9.3.2.3.8","managedObjectClass(3) <API key>(8)"); oid_add_from_string("2.9.3.2.3.9","managedObjectClass(3) <API key>(9)"); oid_add_from_string("2.9.3.2.3.10","managedObjectClass(3) <API key>(10)"); oid_add_from_string("2.9.3.2.3.11","managedObjectClass(3) <API key>(11)"); oid_add_from_string("2.9.3.2.3.12","managedObjectClass(3) stateChangeRecord(12)"); oid_add_from_string("2.9.3.2.3.13","managedObjectClass(3) system(13)"); oid_add_from_string("2.9.3.2.3.14","managedObjectClass(3) top(14)"); oid_add_from_string("2.9.3.2.4.14","<API key>(14)"); oid_add_from_string("2.9.1.1.4","joint-iso-itu-t(2) ms(9) cmip(1) cmip-pci(1) abstractSyntax(4)"); /*#include "packet-cmip-dis-tab.c" */ }
#include "pub_core_basics.h" #include "pub_core_debuglog.h" #include "pub_core_vki.h" #include "pub_core_vkiscnums.h" #include "pub_core_libcbase.h" #include "pub_core_libcassert.h" #include "pub_core_syscall.h" #include "pub_core_libcsignal.h" /* self */ /* IMPORTANT: on Darwin it is essential to use the _nocancel versions of syscalls rather than the vanilla version, if a _nocancel version is available. See docs/internals/Darwin-notes.txt for the reason why. */ /* sigemptyset, sigfullset, sigaddset and sigdelset return 0 on success and -1 on error. */ /* In the sigset routines below, be aware that _VKI_NSIG_BPW can be either 32 or 64, and hence the sig[] words can either be 32- or 64-bits. And which they are it doesn't necessarily follow from the host word size. */ Int VG_(sigfillset)( vki_sigset_t* set ) { Int i; if (set == NULL) return -1; for (i = 0; i < _VKI_NSIG_WORDS; i++) set->sig[i] = ~0; return 0; } Int VG_(sigemptyset)( vki_sigset_t* set ) { Int i; if (set == NULL) return -1; for (i = 0; i < _VKI_NSIG_WORDS; i++) set->sig[i] = 0; return 0; } Bool VG_(isemptysigset)( const vki_sigset_t* set ) { Int i; vg_assert(set != NULL); for (i = 0; i < _VKI_NSIG_WORDS; i++) if (set->sig[i] != 0) return False; return True; } Bool VG_(isfullsigset)( const vki_sigset_t* set ) { Int i; vg_assert(set != NULL); for (i = 0; i < _VKI_NSIG_WORDS; i++) if (set->sig[i] != ~0) return False; return True; } Bool VG_(iseqsigset)( const vki_sigset_t* set1, const vki_sigset_t* set2 ) { Int i; vg_assert(set1 != NULL && set2 != NULL); for (i = 0; i < _VKI_NSIG_WORDS; i++) if (set1->sig[i] != set2->sig[i]) return False; return True; } Int VG_(sigaddset)( vki_sigset_t* set, Int signum ) { if (set == NULL) return -1; if (signum < 1 || signum > _VKI_NSIG) return -1; signum set->sig[signum / _VKI_NSIG_BPW] |= (1ULL << (signum % _VKI_NSIG_BPW)); return 0; } Int VG_(sigdelset)( vki_sigset_t* set, Int signum ) { if (set == NULL) return -1; if (signum < 1 || signum > _VKI_NSIG) return -1; signum set->sig[signum / _VKI_NSIG_BPW] &= ~(1ULL << (signum % _VKI_NSIG_BPW)); return 0; } Int VG_(sigismember) ( const vki_sigset_t* set, Int signum ) { if (set == NULL) return 0; if (signum < 1 || signum > _VKI_NSIG) return 0; signum if (1 & ((set->sig[signum / _VKI_NSIG_BPW]) >> (signum % _VKI_NSIG_BPW))) return 1; else return 0; } /* Add all signals in src to dst. */ void VG_(sigaddset_from_set)( vki_sigset_t* dst, vki_sigset_t* src ) { Int i; vg_assert(dst != NULL && src != NULL); for (i = 0; i < _VKI_NSIG_WORDS; i++) dst->sig[i] |= src->sig[i]; } /* Remove all signals in src from dst. */ void VG_(sigdelset_from_set)( vki_sigset_t* dst, vki_sigset_t* src ) { Int i; vg_assert(dst != NULL && src != NULL); for (i = 0; i < _VKI_NSIG_WORDS; i++) dst->sig[i] &= ~(src->sig[i]); } /* dst = dst `intersect` src. */ void VG_(sigintersectset)( vki_sigset_t* dst, vki_sigset_t* src ) { Int i; vg_assert(dst != NULL && src != NULL); for (i = 0; i < _VKI_NSIG_WORDS; i++) dst->sig[i] &= src->sig[i]; } /* dst = ~src */ void VG_(sigcomplementset)( vki_sigset_t* dst, vki_sigset_t* src ) { Int i; vg_assert(dst != NULL && src != NULL); for (i = 0; i < _VKI_NSIG_WORDS; i++) dst->sig[i] = ~ src->sig[i]; } /* The functions sigaction, sigprocmask, sigpending and sigsuspend return 0 on success and -1 on error. */ Int VG_(sigprocmask)( Int how, const vki_sigset_t* set, vki_sigset_t* oldset) { # if defined(VGO_linux) # if defined(__NR_rt_sigprocmask) SysRes res = VG_(do_syscall4)(__NR_rt_sigprocmask, how, (UWord)set, (UWord)oldset, _VKI_NSIG_WORDS * sizeof(UWord)); # else SysRes res = VG_(do_syscall3)(__NR_sigprocmask, how, (UWord)set, (UWord)oldset); # endif # elif defined(VGO_darwin) /* On Darwin, __NR_sigprocmask appears to affect the entire process, not just this thread. Hence need to use <API key> instead. */ SysRes res = VG_(do_syscall3)(<API key>, how, (UWord)set, (UWord)oldset); # else # error "Unknown OS" # endif return sr_isError(res) ? -1 : 0; } #if defined(VGO_darwin) /* A helper function for sigaction on Darwin. */ static void darwin_signal_demux(void* a1, UWord a2, UWord a3, void* a4, void* a5) { VG_(debugLog)(2, "libcsignal", "PRE demux sig, a2 = %lu, signo = %lu\n", a2, a3); if (a2 == 1) ((void(*)(int))a1) (a3); else ((void(*)(int,void*,void*))a1) (a3,a4,a5); VG_(debugLog)(2, "libcsignal", "POST demux sig, a2 = %lu, signo = %lu\n", a2, a3); VG_(do_syscall2)(__NR_sigreturn, (UWord)a5, 0x1E); /* NOTREACHED */ __asm__ __volatile__("ud2"); } #endif Int VG_(sigaction) ( Int signum, const vki_sigaction_toK_t* act, <API key>* oldact) { # if defined(VGO_linux) /* Normal case: vki_sigaction_toK_t and <API key> are identical types. */ SysRes res = VG_(do_syscall4)(__NR_rt_sigaction, signum, (UWord)act, (UWord)oldact, _VKI_NSIG_WORDS * sizeof(UWord)); return sr_isError(res) ? -1 : 0; # elif defined(VGO_darwin) /* If we're passing a new action to the kernel, make a copy of the new action, install our own sa_tramp field in it, and ignore whatever we were provided with. This is OK because all the sigaction requests come from m_signals, and are not directly what the client program requested, so there is no chance that we will inadvertantly ignore the sa_tramp field requested by the client. (In fact m_signals does ignore it when building signal frames for the client, but that's a completely different matter). If we're receiving an old action from the kernel, be very paranoid and make sure the kernel doesn't trash bits of memory that we don't expect it to. */ SysRes res; vki_sigaction_toK_t actCopy; struct { ULong before[2]; <API key> oa; ULong after[2]; } oldactCopy; vki_sigaction_toK_t* real_act; <API key>* real_oldact; real_act = act ? &actCopy : NULL; real_oldact = oldact ? &oldactCopy.oa : NULL; VG_(memset)(&oldactCopy, 0x55, sizeof(oldactCopy)); if (real_act) { *real_act = *act; real_act->sa_tramp = (void*)&darwin_signal_demux; } res = VG_(do_syscall3)(__NR_sigaction, signum, (UWord)real_act, (UWord)real_oldact); if (real_oldact) { vg_assert(oldactCopy.before[0] == <API key>); vg_assert(oldactCopy.before[1] == <API key>); vg_assert(oldactCopy.after[0] == <API key>); vg_assert(oldactCopy.after[1] == <API key>); *oldact = *real_oldact; } return sr_isError(res) ? -1 : 0; # else # error "Unsupported OS" # endif } /* See explanation in pub_core_libcsignal.h. */ void VG_(<API key>)( <API key>* fromK, /*OUT*/vki_sigaction_toK_t* toK ) { # if defined(VGO_linux) *toK = *fromK; # elif defined(VGO_darwin) toK->ksa_handler = fromK->ksa_handler; toK->sa_tramp = NULL; /* the cause of all the difficulty */ toK->sa_mask = fromK->sa_mask; toK->sa_flags = fromK->sa_flags; # else # error "Unsupported OS" # endif } Int VG_(kill)( Int pid, Int signo ) { # if defined(VGO_linux) SysRes res = VG_(do_syscall2)(__NR_kill, pid, signo); # elif defined(VGO_darwin) SysRes res = VG_(do_syscall3)(__NR_kill, pid, signo, 1/*posix-compliant*/); # else # error "Unsupported OS" # endif return sr_isError(res) ? -1 : 0; } Int VG_(tkill)( Int lwpid, Int signo ) { # if defined(__NR_tkill) SysRes res = VG_(mk_SysRes_Error)(VKI_ENOSYS); res = VG_(do_syscall2)(__NR_tkill, lwpid, signo); if (sr_isError(res) && sr_Err(res) == VKI_ENOSYS) res = VG_(do_syscall2)(__NR_kill, lwpid, signo); return sr_isError(res) ? -1 : 0; # elif defined(VGO_darwin) // Note that the __pthread_kill syscall takes a Mach thread, not a pthread. SysRes res; res = VG_(do_syscall2)(__NR___pthread_kill, lwpid, signo); return sr_isError(res) ? -1 : 0; # else # error "Unsupported plat" # endif } /* A cut-down version of POSIX sigtimedwait: poll for pending signals mentioned in the sigset_t, and if any are present, select one arbitrarily, return its number (which must be > 0), and put auxiliary info about it in the siginfo_t, and make it <API key>. If none are pending, return zero. The _zero refers to the fact that there is zero timeout, so if no signals are pending it returns immediately. Perhaps a better name would be 'sigpoll'. Returns -1 on error, 0 if no signals pending, and n > 0 if signal n was selected. The Linux implementation is trivial: do the corresponding syscall. The Darwin implementation is horrible and probably broken in a dozen obscure ways. I suspect it's only thread-safe because V forces single-threadedness. */ #if defined(VGO_linux) Int VG_(sigtimedwait_zero)( const vki_sigset_t *set, vki_siginfo_t *info ) { static const struct vki_timespec zero = { 0, 0 }; SysRes res = VG_(do_syscall4)(<API key>, (UWord)set, (UWord)info, (UWord)&zero, sizeof(*set)); return sr_isError(res) ? -1 : sr_Res(res); } #elif defined(VGO_darwin) //static void show_set ( HChar* str, const vki_sigset_t* set ) { // Int i; // VG_(printf)("%s { ", str); // for (i = 1; i <= _VKI_NSIG; i++) { // if (VG_(sigismember)(set, i)) // VG_(printf)("%u ", i); // VG_(printf)("}\n"); /* The general idea is: - use sigpending to find out which signals are pending - choose one - temporarily set its handler to <API key> - use sigsuspend atomically unblock it and wait for the signal. Upon return, sigsuspend restores the signal mask to what it was to start with. - Restore the handler for the signal to whatever it was before. */ /* A signal handler which does nothing (it doesn't need to). It does however check that it's not handing a sync signal for which returning is meaningless. */ static void <API key> ( Int sig ) { /* XXX this is wrong -- get rid of these. We could get _any_ signal here */ vg_assert(sig != VKI_SIGILL); vg_assert(sig != VKI_SIGSEGV); vg_assert(sig != VKI_SIGBUS); vg_assert(sig != VKI_SIGTRAP); /* do nothing */ } Int VG_(sigtimedwait_zero)( const vki_sigset_t *set, vki_siginfo_t *info ) { const Bool debug = False; Int i, ir; SysRes sr; vki_sigset_t pending, blocked, allbutone; vki_sigaction_toK_t sa, saved_sa2; <API key> saved_sa; //show_set("STWZ: looking for", set); /* Find out what's pending: Darwin sigpending */ sr = VG_(do_syscall1)(__NR_sigpending, (UWord)&pending); vg_assert(!sr_isError(sr)); /* don't try for signals not in 'set' */ /* pending = pending `intersect` set */ VG_(sigintersectset)(&pending, (vki_sigset_t*)set); /* don't try for signals not blocked at the moment */ ir = VG_(sigprocmask)(VKI_SIG_SETMASK, NULL, &blocked); vg_assert(ir == 0); /* pending = pending `intersect` blocked */ VG_(sigintersectset)(&pending, &blocked); /* decide which signal we're going to snarf */ for (i = 1; i < _VKI_NSIG; i++) if (VG_(sigismember)(&pending,i)) break; if (i == _VKI_NSIG) return 0; if (debug) VG_(debugLog)(0, "libcsignal", "sigtimedwait_zero: snarfing signal %d\n", i ); /* fetch signal i. pre: i is blocked and pending pre: we are the only thread running */ /* Set up alternative signal handler */ VG_(sigfillset)(&sa.sa_mask); sa.ksa_handler = &<API key>; sa.sa_flags = 0; ir = VG_(sigaction)(i, &sa, &saved_sa); vg_assert(ir == 0); /* Switch signal masks and wait for the signal. This should happen immediately, since we've already established it is pending and blocked. */ VG_(sigfillset)(&allbutone); VG_(sigdelset)(&allbutone, i); /* Note: pass the sig mask by value here, not reference (!) */ vg_assert(_VKI_NSIG_WORDS == 1); sr = VG_(do_syscall3)(<API key>, (UWord)allbutone.sig[0], 0,0); if (debug) VG_(debugLog)(0, "libcsignal", "sigtimedwait_zero: sigsuspend got " "res: %s %#lx\n", sr_isError(sr) ? "FAIL" : "SUCCESS", sr_isError(sr) ? sr_Err(sr) : sr_Res(sr)); vg_assert(sr_isError(sr)); vg_assert(sr_Err(sr) == VKI_EINTR); /* Restore signal's handler to whatever it was before */ VG_(<API key>)( &saved_sa, &saved_sa2 ); ir = VG_(sigaction)(i, &saved_sa2, NULL); vg_assert(ir == 0); /* This is bogus - we could get more info from the sighandler. */ VG_(memset)( info, 0, sizeof(*info) ); info->si_signo = i; return i; } #else # error "Unknown OS" #endif
#include <linux/interrupt.h> #include <linux/mfd/pm8xxx/pm8921.h> #include <linux/mfd/pm8xxx/pm8xxx-adc.h> #include <linux/leds.h> #include <linux/leds-pm8xxx.h> #include <linux/msm_ssbi.h> #include <asm/mach-types.h> #include <mach/msm_bus_board.h> #include <mach/restart.h> #include "devices.h" #include "board-8960.h" struct pm8xxx_gpio_init { unsigned gpio; struct pm_gpio config; }; struct pm8xxx_mpp_init { unsigned mpp; struct <API key> config; }; #define PM8XXX_GPIO_INIT(_gpio, _dir, _buf, _val, _pull, _vin, _out_strength, \ _func, _inv, _disable) \ { \ .gpio = <API key>(_gpio), \ .config = { \ .direction = _dir, \ .output_buffer = _buf, \ .output_value = _val, \ .pull = _pull, \ .vin_sel = _vin, \ .out_strength = _out_strength, \ .function = _func, \ .inv_int_pol = _inv, \ .disable_pin = _disable, \ } \ } #define PM8XXX_MPP_INIT(_mpp, _type, _level, _control) \ { \ .mpp = <API key>(_mpp), \ .config = { \ .type = PM8XXX_MPP_TYPE_##_type, \ .level = _level, \ .control = PM8XXX_MPP_##_control, \ } \ } #define PM8XXX_GPIO_DISABLE(_gpio) \ PM8XXX_GPIO_INIT(_gpio, PM_GPIO_DIR_IN, 0, 0, 0, PM_GPIO_VIN_S4, \ 0, 0, 0, 1) #define PM8XXX_GPIO_OUTPUT(_gpio, _val) \ PM8XXX_GPIO_INIT(_gpio, PM_GPIO_DIR_OUT, <API key>, _val, \ PM_GPIO_PULL_NO, PM_GPIO_VIN_S4, \ <API key>, \ PM_GPIO_FUNC_NORMAL, 0, 0) #define PM8XXX_GPIO_INPUT(_gpio, _pull) \ PM8XXX_GPIO_INIT(_gpio, PM_GPIO_DIR_IN, <API key>, 0, \ _pull, PM_GPIO_VIN_S4, \ PM_GPIO_STRENGTH_NO, \ PM_GPIO_FUNC_NORMAL, 0, 0) #define <API key>(_gpio, _val, _func) \ PM8XXX_GPIO_INIT(_gpio, PM_GPIO_DIR_OUT, <API key>, _val, \ PM_GPIO_PULL_NO, PM_GPIO_VIN_S4, \ <API key>, \ _func, 0, 0) #define <API key>(_gpio, _val, _vin) \ PM8XXX_GPIO_INIT(_gpio, PM_GPIO_DIR_OUT, <API key>, _val, \ PM_GPIO_PULL_NO, _vin, \ <API key>, \ PM_GPIO_FUNC_NORMAL, 0, 0) #define <API key>(_gpio, _val, _out_strength) \ PM8XXX_GPIO_INIT(_gpio, PM_GPIO_DIR_OUT, <API key>, _val, \ PM_GPIO_PULL_NO, PM_GPIO_VIN_S4, \ _out_strength, \ PM_GPIO_FUNC_NORMAL, 0, 0) /* Initial PM8921 GPIO configurations */ static struct pm8xxx_gpio_init pm8921_gpios[] __initdata = { <API key>(6, 1, PM_GPIO_VIN_VPH), /* MHL power EN_N */ PM8XXX_GPIO_DISABLE(7), /* Disable NFC */ PM8XXX_GPIO_INPUT(16, PM_GPIO_PULL_UP_30), /* SD_CARD_WP */ /* External regulator shared by display and touchscreen on LiQUID */ PM8XXX_GPIO_OUTPUT(17, 0), /* DISP 3.3 V Boost */ PM8XXX_GPIO_OUTPUT(18, 0), /* TABLA SPKR_LEFT_EN=off */ PM8XXX_GPIO_OUTPUT(19, 0), /* TABLA SPKR_RIGHT_EN=off */ PM8XXX_GPIO_DISABLE(22), /* Disable NFC */ <API key>(25, 0, PM_GPIO_FUNC_2), /* TN_CLK */ PM8XXX_GPIO_INPUT(26, PM_GPIO_PULL_UP_30), /* SD_CARD_DET_N */ PM8XXX_GPIO_OUTPUT(43, 1), /* DISP_RESET_N */ PM8XXX_GPIO_OUTPUT(42, 0), /* USB 5V reg enable */ /* TABLA CODEC RESET */ <API key>(34, 0, <API key>) }; /* Initial PM8921 MPP configurations */ static struct pm8xxx_mpp_init pm8921_mpps[] __initdata = { /* External 5V regulator enable; shared by HDMI and USB_OTG switches. */ PM8XXX_MPP_INIT(7, D_INPUT, <API key>, DIN_TO_INT), PM8XXX_MPP_INIT(PM8XXX_AMUX_MPP_8, A_INPUT, <API key>, DOUT_CTRL_LOW), }; void __init <API key>(void) { int i, rc; for (i = 0; i < ARRAY_SIZE(pm8921_gpios); i++) { rc = pm8xxx_gpio_config(pm8921_gpios[i].gpio, &pm8921_gpios[i].config); if (rc) { pr_err("%s: pm8xxx_gpio_config: rc=%d\n", __func__, rc); break; } } for (i = 0; i < ARRAY_SIZE(pm8921_mpps); i++) { rc = pm8xxx_mpp_config(pm8921_mpps[i].mpp, &pm8921_mpps[i].config); if (rc) { pr_err("%s: pm8xxx_mpp_config: rc=%d\n", __func__, rc); break; } } } static struct pm8xxx_adc_amux <API key>[] = { {"vcoin", CHANNEL_VCOIN, CHAN_PATH_SCALING2, AMUX_RSV1, <API key>, ADC_SCALE_DEFAULT}, {"vbat", CHANNEL_VBAT, CHAN_PATH_SCALING2, AMUX_RSV1, <API key>, ADC_SCALE_DEFAULT}, {"dcin", CHANNEL_DCIN, CHAN_PATH_SCALING4, AMUX_RSV1, <API key>, ADC_SCALE_DEFAULT}, {"ichg", CHANNEL_ICHG, CHAN_PATH_SCALING1, AMUX_RSV1, <API key>, ADC_SCALE_DEFAULT}, {"vph_pwr", CHANNEL_VPH_PWR, CHAN_PATH_SCALING2, AMUX_RSV1, <API key>, ADC_SCALE_DEFAULT}, {"ibat", CHANNEL_IBAT, CHAN_PATH_SCALING1, AMUX_RSV1, <API key>, ADC_SCALE_DEFAULT}, {"batt_therm", CHANNEL_BATT_THERM, CHAN_PATH_SCALING1, AMUX_RSV2, <API key>, <API key>}, {"batt_id", CHANNEL_BATT_ID, CHAN_PATH_SCALING1, AMUX_RSV1, <API key>, ADC_SCALE_DEFAULT}, {"usbin", CHANNEL_USBIN, CHAN_PATH_SCALING3, AMUX_RSV1, <API key>, ADC_SCALE_DEFAULT}, {"pmic_therm", CHANNEL_DIE_TEMP, CHAN_PATH_SCALING1, AMUX_RSV1, <API key>, <API key>}, {"625mv", CHANNEL_625MV, CHAN_PATH_SCALING1, AMUX_RSV1, <API key>, ADC_SCALE_DEFAULT}, {"125v", CHANNEL_125V, CHAN_PATH_SCALING1, AMUX_RSV1, <API key>, ADC_SCALE_DEFAULT}, {"chg_temp", CHANNEL_CHG_TEMP, CHAN_PATH_SCALING1, AMUX_RSV1, <API key>, ADC_SCALE_DEFAULT}, {"pa_therm1", ADC_MPP_1_AMUX8, CHAN_PATH_SCALING1, AMUX_RSV1, <API key>, ADC_SCALE_PA_THERM}, {"xo_therm", CHANNEL_MUXOFF, CHAN_PATH_SCALING1, AMUX_RSV0, <API key>, ADC_SCALE_XOTHERM}, {"pa_therm0", ADC_MPP_1_AMUX3, CHAN_PATH_SCALING1, AMUX_RSV1, <API key>, ADC_SCALE_PA_THERM}, }; static struct <API key> pm8xxx_adc_data = { .adc_vdd_reference = 1800, /* milli-voltage for this adc */ .bitresolution = 15, .bipolar = 0, }; static struct <API key> pm8xxx_adc_pdata = { .adc_channel = <API key>, .<API key> = ARRAY_SIZE(<API key>), .adc_prop = &pm8xxx_adc_data, .adc_mpp_base = <API key>(1), }; static struct <API key> pm8xxx_irq_pdata __devinitdata = { .irq_base = PM8921_IRQ_BASE, .devirq = MSM_GPIO_TO_INT(104), .irq_trigger_flag = IRQF_TRIGGER_LOW, }; static struct <API key> pm8xxx_gpio_pdata __devinitdata = { .gpio_base = <API key>(1), }; static struct <API key> pm8xxx_mpp_pdata __devinitdata = { .mpp_base = <API key>(1), }; static struct <API key> pm8xxx_rtc_pdata __devinitdata = { .rtc_write_enable = false, .rtc_alarm_powerup = false, }; static struct <API key> pm8xxx_pwrkey_pdata = { .pull_up = 1, .<API key> = 15625, .wakeup = 1, }; /* Rotate lock key is not available so use F1 */ #define KEY_ROTATE_LOCK KEY_F1 static const unsigned int keymap_liquid[] = { KEY(0, 0, KEY_VOLUMEUP), KEY(0, 1, KEY_VOLUMEDOWN), KEY(1, 3, KEY_ROTATE_LOCK), KEY(1, 4, KEY_HOME), }; static struct matrix_keymap_data keymap_data_liquid = { .keymap_size = ARRAY_SIZE(keymap_liquid), .keymap = keymap_liquid, }; static struct <API key> keypad_data_liquid = { .input_name = "keypad_8960_liquid", .input_phys_device = "keypad_8960/input0", .num_rows = 2, .num_cols = 5, .rows_gpio_start = <API key>(9), .cols_gpio_start = <API key>(1), .debounce_ms = 15, .scan_delay_ms = 32, .row_hold_ns = 91500, .wakeup = 1, .keymap_data = &keymap_data_liquid, }; static const unsigned int keymap[] = { KEY(0, 0, KEY_VOLUMEUP), KEY(0, 1, KEY_VOLUMEDOWN), KEY(0, 2, KEY_CAMERA_FOCUS), KEY(0, 3, KEY_CAMERA_SNAPSHOT), }; static struct matrix_keymap_data keymap_data = { .keymap_size = ARRAY_SIZE(keymap), .keymap = keymap, }; static struct <API key> keypad_data = { .input_name = "keypad_8960", .input_phys_device = "keypad_8960/input0", .num_rows = 1, .num_cols = 5, .rows_gpio_start = <API key>(9), .cols_gpio_start = <API key>(1), .debounce_ms = 15, .scan_delay_ms = 32, .row_hold_ns = 91500, .wakeup = 1, .keymap_data = &keymap_data, }; static const unsigned int keymap_sim[] = { KEY(0, 0, KEY_7), KEY(0, 1, KEY_DOWN), KEY(0, 2, KEY_UP), KEY(0, 3, KEY_RIGHT), KEY(0, 4, KEY_ENTER), KEY(0, 5, KEY_L), KEY(0, 6, KEY_BACK), KEY(0, 7, KEY_M), KEY(1, 0, KEY_LEFT), KEY(1, 1, KEY_SEND), KEY(1, 2, KEY_1), KEY(1, 3, KEY_4), KEY(1, 4, KEY_CLEAR), KEY(1, 5, KEY_MSDOS), KEY(1, 6, KEY_SPACE), KEY(1, 7, KEY_COMMA), KEY(2, 0, KEY_6), KEY(2, 1, KEY_5), KEY(2, 2, KEY_8), KEY(2, 3, KEY_3), KEY(2, 4, KEY_NUMERIC_STAR), KEY(2, 5, KEY_UP), KEY(2, 6, KEY_DOWN), KEY(2, 7, KEY_LEFTSHIFT), KEY(3, 0, KEY_9), KEY(3, 1, KEY_NUMERIC_POUND), KEY(3, 2, KEY_0), KEY(3, 3, KEY_2), KEY(3, 4, KEY_SLEEP), KEY(3, 5, KEY_F1), KEY(3, 6, KEY_F2), KEY(3, 7, KEY_F3), KEY(4, 0, KEY_BACK), KEY(4, 1, KEY_HOME), KEY(4, 2, KEY_MENU), KEY(4, 3, KEY_VOLUMEUP), KEY(4, 4, KEY_VOLUMEDOWN), KEY(4, 5, KEY_F4), KEY(4, 6, KEY_F5), KEY(4, 7, KEY_F6), KEY(5, 0, KEY_R), KEY(5, 1, KEY_T), KEY(5, 2, KEY_Y), KEY(5, 3, KEY_LEFTALT), KEY(5, 4, KEY_KPENTER), KEY(5, 5, KEY_Q), KEY(5, 6, KEY_W), KEY(5, 7, KEY_E), KEY(6, 0, KEY_F), KEY(6, 1, KEY_G), KEY(6, 2, KEY_H), KEY(6, 3, KEY_CAPSLOCK), KEY(6, 4, KEY_PAGEUP), KEY(6, 5, KEY_A), KEY(6, 6, KEY_S), KEY(6, 7, KEY_D), KEY(7, 0, KEY_V), KEY(7, 1, KEY_B), KEY(7, 2, KEY_N), KEY(7, 3, KEY_MENU), KEY(7, 4, KEY_PAGEDOWN), KEY(7, 5, KEY_Z), KEY(7, 6, KEY_X), KEY(7, 7, KEY_C), KEY(8, 0, KEY_P), KEY(8, 1, KEY_J), KEY(8, 2, KEY_K), KEY(8, 3, KEY_INSERT), KEY(8, 4, KEY_LINEFEED), KEY(8, 5, KEY_U), KEY(8, 6, KEY_I), KEY(8, 7, KEY_O), KEY(9, 0, KEY_4), KEY(9, 1, KEY_5), KEY(9, 2, KEY_6), KEY(9, 3, KEY_7), KEY(9, 4, KEY_8), KEY(9, 5, KEY_1), KEY(9, 6, KEY_2), KEY(9, 7, KEY_3), KEY(10, 0, KEY_F7), KEY(10, 1, KEY_F8), KEY(10, 2, KEY_F9), KEY(10, 3, KEY_F10), KEY(10, 4, KEY_FN), KEY(10, 5, KEY_9), KEY(10, 6, KEY_0), KEY(10, 7, KEY_DOT), KEY(11, 0, KEY_LEFTCTRL), KEY(11, 1, KEY_F11), KEY(11, 2, KEY_ENTER), KEY(11, 3, KEY_SEARCH), KEY(11, 4, KEY_DELETE), KEY(11, 5, KEY_RIGHT), KEY(11, 6, KEY_LEFT), KEY(11, 7, KEY_RIGHTSHIFT), KEY(0, 0, KEY_VOLUMEUP), KEY(0, 1, KEY_VOLUMEDOWN), KEY(0, 2, KEY_CAMERA_SNAPSHOT), KEY(0, 3, KEY_CAMERA_FOCUS), }; static int <API key>[] = { 1100, 700, 600, 325, }; #define MAX_VOLTAGE_MV 4200 #define CHG_TERM_MA 100 static struct <API key> pm8921_chg_pdata __devinitdata = { .update_time = 60000, .max_voltage = MAX_VOLTAGE_MV, .min_voltage = 3200, .uvd_thresh_voltage = 4050, .alarm_low_mv = 3400, .alarm_high_mv = 4000, .<API key> = 60, .<API key> = 99, .term_current = CHG_TERM_MA, .cool_temp = 10, .warm_temp = 45, .temp_check_period = 1, .max_bat_chg_current = 1100, .<API key> = 350, .<API key> = 350, .cool_bat_voltage = 4100, .warm_bat_voltage = 4100, .thermal_mitigation = <API key>, .thermal_levels = ARRAY_SIZE(<API key>), .rconn_mohm = 18, }; static struct <API key> pm8xxx_misc_pdata = { .priority = 0, }; static struct <API key> pm8921_bms_pdata __devinitdata = { .battery_type = BATT_UNKNOWN, .r_sense_uohm = 10000, .v_cutoff = 3400, .max_voltage_uv = MAX_VOLTAGE_MV * 1000, .rconn_mohm = 18, .<API key> = 20, .<API key> = 25, .chg_term_ua = CHG_TERM_MA * 1000, .<API key> = 20000, .low_voltage_calc_ms = 1000, }; #define <API key> 4 /* I = 4mA */ #define <API key> 1 /* I = 1mA */ #define <API key> 1000 #define <API key> 20 /** * <API key> shall be used when LED shall not be * driven using PWM feature. */ #define <API key> -1 static struct led_info <API key>[] = { { .name = "led:red", .flags = PM8XXX_ID_LED_0, .default_trigger = "battery-charging", }, { .name = "led:green", .flags = PM8XXX_ID_LED_0, .default_trigger = "battery-full", }, { .name = "led:blue", .flags = PM8XXX_ID_LED_2, .default_trigger = "notification", }, }; static struct pm8xxx_led_config <API key>[] = { [0] = { .id = PM8XXX_ID_LED_0, .mode = <API key>, .max_current = <API key>, }, [1] = { .id = PM8XXX_ID_LED_1, .mode = <API key>, .max_current = <API key>, }, [2] = { .id = PM8XXX_ID_LED_2, .mode = <API key>, .max_current = <API key>, }, }; static struct led_platform_data <API key> = { .num_leds = ARRAY_SIZE(<API key>), .leds = <API key>, }; static struct <API key> <API key> = { .led_core = &<API key>, .configs = <API key>, .num_configs = ARRAY_SIZE(<API key>), }; static struct led_info pm8921_led_info[] = { [0] = { .name = "led:battery_charging", .default_trigger = "battery-charging", }, [1] = { .name = "led:battery_full", .default_trigger = "battery-full", }, }; static struct led_platform_data <API key> = { .num_leds = ARRAY_SIZE(pm8921_led_info), .leds = pm8921_led_info, }; static int <API key>[56] = { 1, 4, 8, 12, 16, 20, 24, 28, 32, 36, 40, 44, 46, 52, 56, 60, 64, 68, 72, 76, 80, 84, 88, 92, 96, 100, 100, 100, 98, 95, 92, 88, 84, 82, 78, 74, 70, 66, 62, 58, 58, 54, 50, 48, 42, 38, 34, 30, 26, 22, 14, 10, 6, 4, 1 }; /* * Note: There is a bug in LPG module that results in incorrect * behavior of pattern when LUT index 0 is used. So effectively * there are 63 usable LUT entries. */ static struct <API key> <API key> = { .duty_pcts = (int *)&<API key>, .num_duty_pcts = ARRAY_SIZE(<API key>), .duty_ms = <API key>, .start_idx = 1, }; static struct pm8xxx_led_config pm8921_led_configs[] = { [0] = { .id = PM8XXX_ID_LED_0, .mode = <API key>, .max_current = <API key>, .pwm_channel = 5, .pwm_period_us = <API key>, .pwm_duty_cycles = &<API key>, }, [1] = { .id = PM8XXX_ID_LED_1, .mode = <API key>, .max_current = <API key>, .pwm_channel = 4, .pwm_period_us = <API key>, }, }; static struct <API key> pm8xxx_leds_pdata = { .led_core = &<API key>, .configs = pm8921_led_configs, .num_configs = ARRAY_SIZE(pm8921_led_configs), }; static struct <API key> pm8xxx_ccadc_pdata = { .r_sense_uohm = 10000, .calib_delay_ms = 600000, }; /** * <API key> shall be used when no LPG * channel should be in DTEST mode. */ #define <API key> (-1) static struct <API key> pm8xxx_pwm_pdata = { .dtest_channel = <API key>, }; static struct <API key> <API key> __devinitdata = { .irq_pdata = &pm8xxx_irq_pdata, .gpio_pdata = &pm8xxx_gpio_pdata, .mpp_pdata = &pm8xxx_mpp_pdata, .rtc_pdata = &pm8xxx_rtc_pdata, .pwrkey_pdata = &pm8xxx_pwrkey_pdata, .keypad_pdata = &keypad_data, .misc_pdata = &pm8xxx_misc_pdata, .regulator_pdatas = <API key>, .charger_pdata = &pm8921_chg_pdata, .bms_pdata = &pm8921_bms_pdata, .adc_pdata = &pm8xxx_adc_pdata, .leds_pdata = &pm8xxx_leds_pdata, .ccadc_pdata = &pm8xxx_ccadc_pdata, .pwm_pdata = &pm8xxx_pwm_pdata, }; static struct <API key> <API key> __devinitdata = { .controller_type = <API key>, .slave = { .name = "pm8921-core", .platform_data = &<API key>, }, }; void __init msm8960_init_pmic(void) { pmic_reset_irq = PM8921_IRQ_BASE + PM8921_RESOUT_IRQ; <API key>.dev.platform_data = &<API key>; <API key>.num_regulators = <API key>; if (<API key>()) { <API key>.keypad_pdata = &keypad_data_liquid; <API key>.leds_pdata = &<API key>; <API key>.bms_pdata->battery_type = BATT_DESAY; } else if (<API key>()) { <API key>.bms_pdata->battery_type = BATT_PALLADIUM; } else if (<API key>()) { pm8921_chg_pdata.has_dc_supply = true; } if (<API key>()) pm8921_bms_pdata.rconn_mohm = 20; if (!<API key>() && !<API key>() && !<API key>()) pm8921_chg_pdata.<API key> = 1; }
// This file may be used under the terms of the GNU General Public // this file. // INCLUDING THE WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR // A PARTICULAR PURPOSE. // End: #pragma once #include <carve/carve.hpp> #include <carve/geom3d.hpp> #include <gloop/gl.hpp> #include <gloop/glu.hpp> #include <gloop/glut.hpp> class Option { public: bool isChecked(); void setChecked(bool value); }; class OptionGroup { public: Option* createOption(const char *caption, bool initialValue); }; class Scene { static GLvoid s_drag(int x, int y); static GLvoid s_click(int button, int state, int x, int y); static GLvoid s_key(unsigned char k, int x, int y); static GLvoid s_draw(); static GLvoid s_resize(int w, int h); carve::geom3d::Vector CAM_LOOK; double CAM_ROT; double CAM_ELEVATION; double CAM_DIST; carve::geom3d::Vector CAM_LOOK_REAL; double CAM_DIST_REAL; int WIDTH; int HEIGHT; bool initialised; bool disp_grid; bool disp_axes; GLvoid _drag(int x, int y); GLvoid _click(int button, int state, int x, int y); GLvoid _key(unsigned char k, int x, int y); GLvoid _draw(); GLvoid _resize(int w, int h); virtual void _init(); void updateDisplay(); protected: virtual bool key(unsigned char k, int x, int y); virtual GLvoid draw(); virtual void click(int button, int state, int x, int y); public: Scene(int argc, char **argv); virtual ~Scene(); virtual void run(); void init(); carve::geom3d::Ray getRay(int x, int y); void zoomTo(carve::geom3d::Vector pos, double dist); OptionGroup* createOptionGroup(const char *title); };
/** * \file adec-pts-mgt.h * \brief Function prototypes of Pts manage. * \version 1.0.0 * \date 2011-03-08 */ #ifndef ADEC_PTS_H #define ADEC_PTS_H #include <audio-dec.h> ADEC_BEGIN_DECLS #define TSYNC_PCRSCR "/sys/class/tsync/pts_pcrscr" #define TSYNC_EVENT "/sys/class/tsync/event" #define TSYNC_APTS "/sys/class/tsync/pts_audio" #define TSYNC_VPTS "/sys/class/tsync/pts_video" #define TSYNC_ENABLE "/sys/class/tsync/enable" #define <API key> (90000*15/100) #define <API key> (90000*3) #define REFRESH_PTS_TIME_MS (1000/10) #define abs(x) ({ \ long __x = (x); \ (__x < 0) ? -__x : __x; \ }) unsigned long adec_calc_pts(aml_audio_dec_t *audec); int adec_pts_start(aml_audio_dec_t *audec); int adec_pts_pause(void); int adec_pts_resume(void); int adec_refresh_pts(aml_audio_dec_t *audec); int avsync_en(int e); int track_switch_pts(aml_audio_dec_t *audec); ADEC_END_DECLS #endif
<!DOCTYPE HTML PUBLIC "- <!-- NewPage --> <html lang="es"> <head> <!-- Generated by javadoc (version 1.7.0_25) on Sat Oct 17 13:50:07 CST 2015 --> <title>Laboratorio</title> <meta name="date" content="2015-10-17"> <link rel="stylesheet" type="text/css" href="../stylesheet.css" title="Style"> </head> <body> <script type="text/javascript"><! if (location.href.indexOf('is-external=true') == -1) { parent.document.title="Laboratorio"; } </script> <noscript> <div>JavaScript is disabled on your browser.</div> </noscript> <div class="topNav"><a name="navbar_top"> </a><a href="#skip-navbar_top" title="Skip navigation links"></a><a name="navbar_top_firstrow"> </a> <ul class="navList" title="Navigation"> <li><a href="../a/package-summary.html">Package</a></li> <li class="navBarCell1Rev">Class</li> <li><a href="package-tree.html">Tree</a></li> <li><a href="../deprecated-list.html">Deprecated</a></li> <li><a href="../index-all.html">Index</a></li> <li><a href="../help-doc.html">Help</a></li> </ul> </div> <div class="subNav"> <ul class="navList"> <li>Prev Class</li> <li>Next Class</li> </ul> <ul class="navList"> <li><a href="../index.html?a/Laboratorio.html" target="_top">Frames</a></li> <li><a href="Laboratorio.html" target="_top">No Frames</a></li> </ul> <ul class="navList" id="<API key>"> <li><a href="../allclasses-noframe.html">All Classes</a></li> </ul> <div> <script type="text/javascript"><! allClassesLink = document.getElementById("<API key>"); if(window==top) { allClassesLink.style.display = "block"; } else { allClassesLink.style.display = "none"; } </script> </div> <div> <ul class="subNavList"> <li>Summary:&nbsp;</li> <li>Nested&nbsp;|&nbsp;</li> <li>Field&nbsp;|&nbsp;</li> <li><a href="#constructor_summary">Constr</a>&nbsp;|&nbsp;</li> <li><a href="#method_summary">Method</a></li> </ul> <ul class="subNavList"> <li>Detail:&nbsp;</li> <li>Field&nbsp;|&nbsp;</li> <li><a href="#constructor_detail">Constr</a>&nbsp;|&nbsp;</li> <li><a href="#method_detail">Method</a></li> </ul> </div> <a name="skip-navbar_top"> </a></div> <div class="header"> <div class="subTitle">a</div> <h2 title="Class Laboratorio" class="title">Class Laboratorio</h2> </div> <div class="contentContainer"> <ul class="inheritance"> <li>java.lang.Object</li> <li> <ul class="inheritance"> <li>a.Laboratorio</li> </ul> </li> </ul> <div class="description"> <ul class="blockList"> <li class="blockList"> <hr> <br> <pre>public class <span class="strong">Laboratorio</span> extends java.lang.Object</pre> <div class="block">En esta clase se aplicaran los conceptos estudiados en esta lección y se creara una aplicación para calcular el sueldo a final de mes de un empleado. Se utilizara la clase NumberFormat y Scanner para formatear los numeros y capturar datos del teclado.</div> <dl><dt><span class="strong">See Also:</span></dt><dd><a href="http://docs.oracle.com/javase/7/docs/api/java/text/NumberFormat.html">Documentacion clase NumberFormat</a>, <a href="http://docs.oracle.com/javase/7/docs/api/java/util/Locale.html">Documentacion Clase Locale</a></dd></dl> </li> </ul> </div> <div class="summary"> <ul class="blockList"> <li class="blockList"> <ul class="blockList"> <li class="blockList"><a name="constructor_summary"> </a> <h3>Constructor Summary</h3> <table class="overviewSummary" border="0" cellpadding="3" cellspacing="0" summary="Constructor Summary table, listing constructors, and an explanation"> <caption><span>Constructors</span><span class="tabEnd">&nbsp;</span></caption> <tr> <th class="colOne" scope="col">Constructor and Description</th> </tr> <tr class="altColor"> <td class="colOne"><code><strong><a href="../a/Laboratorio.html#Laboratorio()">Laboratorio</a></strong>()</code>&nbsp;</td> </tr> </table> </li> </ul> <ul class="blockList"> <li class="blockList"><a name="method_summary"> </a> <h3>Method Summary</h3> <table class="overviewSummary" border="0" cellpadding="3" cellspacing="0" summary="Method Summary table, listing methods, and an explanation"> <caption><span>Methods</span><span class="tabEnd">&nbsp;</span></caption> <tr> <th class="colFirst" scope="col">Modifier and Type</th> <th class="colLast" scope="col">Method and Description</th> </tr> <tr class="altColor"> <td class="colFirst"><code>static void</code></td> <td class="colLast"><code><strong><a href="../a/Laboratorio.html#main(java.lang.String[])">main</a></strong>(java.lang.String[]&nbsp;args)</code>&nbsp;</td> </tr> </table> <ul class="blockList"> <li class="blockList"><a name="<API key>.lang.Object"> </a> <h3>Methods inherited from class&nbsp;java.lang.Object</h3> <code>clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait</code></li> </ul> </li> </ul> </li> </ul> </div> <div class="details"> <ul class="blockList"> <li class="blockList"> <ul class="blockList"> <li class="blockList"><a name="constructor_detail"> </a> <h3>Constructor Detail</h3> <a name="Laboratorio()"> </a> <ul class="blockListLast"> <li class="blockList"> <h4>Laboratorio</h4> <pre>public&nbsp;Laboratorio()</pre> </li> </ul> </li> </ul> <ul class="blockList"> <li class="blockList"><a name="method_detail"> </a> <h3>Method Detail</h3> <a name="main(java.lang.String[])"> </a> <ul class="blockListLast"> <li class="blockList"> <h4>main</h4> <pre>public static&nbsp;void&nbsp;main(java.lang.String[]&nbsp;args)</pre> </li> </ul> </li> </ul> </li> </ul> </div> </div> <div class="bottomNav"><a name="navbar_bottom"> </a><a href="#skip-navbar_bottom" title="Skip navigation links"></a><a name="<API key>"> </a> <ul class="navList" title="Navigation"> <li><a href="../a/package-summary.html">Package</a></li> <li class="navBarCell1Rev">Class</li> <li><a href="package-tree.html">Tree</a></li> <li><a href="../deprecated-list.html">Deprecated</a></li> <li><a href="../index-all.html">Index</a></li> <li><a href="../help-doc.html">Help</a></li> </ul> </div> <div class="subNav"> <ul class="navList"> <li>Prev Class</li> <li>Next Class</li> </ul> <ul class="navList"> <li><a href="../index.html?a/Laboratorio.html" target="_top">Frames</a></li> <li><a href="Laboratorio.html" target="_top">No Frames</a></li> </ul> <ul class="navList" id="<API key>"> <li><a href="../allclasses-noframe.html">All Classes</a></li> </ul> <div> <script type="text/javascript"><! allClassesLink = document.getElementById("<API key>"); if(window==top) { allClassesLink.style.display = "block"; } else { allClassesLink.style.display = "none"; } </script> </div> <div> <ul class="subNavList"> <li>Summary:&nbsp;</li> <li>Nested&nbsp;|&nbsp;</li> <li>Field&nbsp;|&nbsp;</li> <li><a href="#constructor_summary">Constr</a>&nbsp;|&nbsp;</li> <li><a href="#method_summary">Method</a></li> </ul> <ul class="subNavList"> <li>Detail:&nbsp;</li> <li>Field&nbsp;|&nbsp;</li> <li><a href="#constructor_detail">Constr</a>&nbsp;|&nbsp;</li> <li><a href="#method_detail">Method</a></li> </ul> </div> <a name="skip-navbar_bottom"> </a></div> </body> </html>
#ifndef <API key> #define <API key> #import "TLMetaScheme.h" @protocol TGRawHttpActor <NSObject> - (void)httpRequestSuccess:(NSString *)url response:(NSData *)response; - (void)httpRequestFailed:(NSString *)url; @optional - (void)httpRequestProgress:(NSString *)url progress:(float)progress; @end @protocol TGRawHttpFileActor <NSObject> - (void)<API key>:(NSString *)url; - (void)<API key>:(NSString *)url; @end @protocol TGFileUploadActor <NSObject> - (void)<API key>:(int)partId; - (void)<API key>:(int)partId; @end @protocol TGFileDownloadActor <NSObject> - (void)fileDownloadSuccess:(int64_t)volumeId fileId:(int)fileId secret:(int64_t)secret data:(NSData *)data; - (void)fileDownloadFailed:(int64_t)volumeId fileId:(int)fileId secret:(int64_t)secret; - (void)<API key>:(int64_t)volumeId fileId:(int)fileId secret:(int64_t)secret progress:(float)progress; @optional - (void)<API key>:(TLInputFileLocation *)location offset:(int)offset length:(int)length packetLength:(int)packetLength progress:(float)progress; - (void)<API key>:(TLInputFileLocation *)location offset:(int)offset length:(int)length data:(NSData *)data; - (void)<API key>:(TLInputFileLocation *)location offset:(int)offset length:(int)length; @end @protocol <API key> <NSObject> - (void)<API key>:(<API key> *)settings; - (void)<API key>; @end @protocol <API key> <NSObject> - (void)<API key>:(NSArray *)uids; - (void)<API key>:(NSArray *)uids; @end @protocol <API key> <NSObject> - (void)locateSuccess:(TLcontacts_Located *)locatedContacts; - (void)locateFailed; @end @protocol <API key> <NSObject> - (void)deleteMemberSuccess:(<API key> *)statedMessage; - (void)deleteMemberFailed; @end #endif
<?php ?> <h3><?php _e('Adverts received from server', 'adrotate'); ?></h3> <p><?php _e('These adverts are circulating in the pool of active adverts, served from AdRotate server.', 'adrotate'); ?></p> <table class="widefat" style="margin-top: .5em"> <thead> <tr> <th width="2%"><center><?php _e('ID', 'adrotate'); ?></center></th> <th width="13%"><?php _e('Added / Updated', 'adrotate'); ?></th> <th width="13%"><?php _e('Start / End', 'adrotate'); ?></th> <th><?php _e('Title', 'adrotate'); ?></th> <th width="5%"><center><?php _e('Weight', 'adrotate'); ?></center></th> <th width="5%"><center><?php _e('Shown', 'adrotate'); ?></center></th> <th width="5%"><center><?php _e('Today', 'adrotate'); ?></center></th> <th width="5%"><center><?php _e('Clicks', 'adrotate'); ?></center></th> <th width="5%"><center><?php _e('Today', 'adrotate'); ?></center></th> <th width="7%"><center><?php _e('CTR', 'adrotate'); ?></center></th> </tr> </thead> <tbody> <?php if ($activebanners) { $class = ''; foreach($activebanners as $banner) { $stats = adrotate_stats($banner['id']); $stats_today = adrotate_stats($banner['id'], $today); $grouplist = <API key>($banner['id']); $ctr = adrotate_ctr($stats['clicks'], $stats['impressions']); if($adrotate_debug['dashboard'] == true) { echo "<tr><td>&nbsp;</td><td><strong>[DEBUG]</strong></td><td colspan='10'><pre>"; echo "Ad Specs: <pre>"; print_r($banner); echo "</pre></td></tr>"; } if($class != 'alternate') { $class = 'alternate'; } else { $class = ''; } ?> <tr id='adrotateindex' class='<?php echo $class; ?>'> <td><center><?php echo $banner['id'];?></center></td> <td><?php echo date_i18n("F d, Y", $banner['added']);?><br /><?php echo date_i18n("F d, Y", $banner['updated']);?></td> <td><?php echo date_i18n("F d, Y", $banner['firstactive']);?><br /><span style="color: <?php echo <API key>($banner['lastactive']);?>;"><?php echo date_i18n("F d, Y", $banner['lastactive']);?></span></td> <td> <strong><?php echo stripslashes(html_entity_decode($banner['title']));?></strong> <span style="color:#999;"><?php if(strlen($grouplist) > 0) echo '<br /><span style="font-weight:bold;">Groups:</span> '.$grouplist; ?></span> </td> <td><center><?php echo $banner['weight']; ?></center></td> <td><center><?php echo $stats['impressions']; ?></center></td> <td><center><?php echo $stats_today['impressions']; ?></center></td> <td><center><?php echo $stats['clicks']; ?></center></td> <td><center><?php echo $stats_today['clicks']; ?></center></td> <td><center><?php echo $ctr; ?> %</center></td> </tr> <?php } ?> <?php } else { ?> <tr id='no-groups'> <th class="check-column">&nbsp;</th> <td colspan="10"><em><?php _e('No ads received yet!', 'adrotate'); ?></em></td> </tr> <?php } ?> </tbody> </table>
<?php require 'Segment.php'; class OdfException extends Exception {} class Odf { const DELIMITER_LEFT = '{'; const DELIMITER_RIGHT = '}'; const PIXEL_TO_CM = 0.026458333; private $file; private $contentXml; private $tmpfile; private $images = array(); private $vars = array(); private $segments = array(); /** * Constructeur de classe * * @param string $filename nom du fichier odt * @throws OdfException */ public function __construct($filename) { if (! class_exists('ZipArchive')) { throw new OdfException('Zip extension not loaded - check your php settings, PHP5.2 minimum with zip extension is required'); } $this->file = new ZipArchive(); if ($this->file->open($filename) !== true) { throw new OdfException("Error while Opening the file '$filename' - Check your odt file"); } if (($this->contentXml = $this->file->getFromName('content.xml')) === false) { throw new OdfException("Nothing to parse - check that the content.xml file is correctly formed"); } $tmp = tempnam(null, md5(uniqid())) . '.odt'; copy($filename, $tmp); $this->tmpfile = $tmp; } public function setVars($key, $value, $encode = true) { if (strpos($this->contentXml, self::DELIMITER_LEFT . $key . self::DELIMITER_RIGHT) === false) { throw new OdfException("var $key not found in the document"); } $value = $encode ? utf8_encode(htmlspecialchars($value)) : utf8_encode($value); $this->vars[self::DELIMITER_LEFT . $key . self::DELIMITER_RIGHT] = $value; return $this; } /** * Affecte une variable de template en tant qu'image * * @param string $key nom de la variable dans le template * @param string $value chemin vers une image * @throws OdfException * @return odf */ public function setImage($key, $value) { $filename = strtok(strrchr($value, '/'), '/.'); $file = substr(strrchr($value, '/'), 1); $size = @getimagesize($value); if ($size === false) { throw new OdfException("Invalid image"); } list ($width, $height) = $size; $width *= self::PIXEL_TO_CM; $height *= self::PIXEL_TO_CM; $xml = <<<IMG <draw:frame draw:style-name="fr1" draw:name="$filename" text:anchor-type="char" svg:width="{$width}cm" svg:height="{$height}cm" draw:z-index="3"><draw:image xlink:href="Pictures/$file" xlink:type="simple" xlink:show="embed" xlink:actuate="onLoad"/></draw:frame> IMG; $this->images[$value] = $file; $this->setVars($key, $xml, false); return $this; } private function _parse() { $this->contentXml = str_replace(array_keys($this->vars), array_values($this->vars), $this->contentXml); } public function mergeSegment(Segment $segment) { if (! array_key_exists($segment->getName(), $this->segments)) { throw new OdfException($segment->getName() . 'cannot be parsed, has it been set yet ?'); } $string = $segment->getName(); $reg = '@<text:p[^>]*>\[!--\sBEGIN\s' . $string . '\s--\](.*)\[!--.+END\s' . $string . '\s--\]<\/text:p>@smU'; $this->contentXml = preg_replace($reg, $segment->getXmlParsed(), $this->contentXml); return $this; } /** * Affiche toutes les variables de templates actuelles * * @return string */ public function printVars() { return print_r('<pre>' . print_r($this->vars, true) . '</pre>', true); } public function __toString() { return $this->contentXml; } public function <API key>() { return '<pre>' . print_r(implode(' ', array_keys($this->segments)), true) . '</pre>'; } public function setSegment($segment) { if (array_key_exists($segment, $this->segments)) { return $this->segments[$segment]; } $reg = "#\[!--\sBEGIN\s$segment\s--\]<\/text:p>(.*)<text:p\s.*>\[!--\sEND\s$segment\s--\]#sm"; if (preg_match($reg, html_entity_decode($this->contentXml), $m) == 0) { throw new OdfException("'$segment' segment not found in the document"); } $this->segments[$segment] = new Segment($segment, $m[1]); return $this->segments[$segment]; } public function saveToDisk($file = null) { if ($file !== null && is_string($file)) { $this->file->open($this->tmpfile, ZIPARCHIVE::CREATE); $this->_save(); copy($this->tmpfile, $file); } else { $this->_save(); } } /** * Sauvegarde interne * * @throws OdfException * @return void */ private function _save() { $this->_parse(); if (! $this->file->addFromString('content.xml', $this->contentXml)) { throw new OdfException('Error during file export'); } foreach ($this->images as $imageKey => $imageValue) { $this->file->addFile($imageKey, 'Pictures/' . $imageValue); } $this->file->close(); // seems to bug on windows CLI sometimes } public function <API key>() { $this->file->open($this->tmpfile, ZIPARCHIVE::CREATE); $this->_save(); if (headers_sent($filename, $linenum)) { throw new OdfException("headers already sent ($filename at $linenum)"); } header('Content-type: multipart/x-zip'); header("Content-Disposition: attachment; filename=" . md5(uniqid()) . ".odt"); readfile($this->tmpfile); } }
#include <limits.h> #include "system_utils.h" unsigned long int get_free_memory() { FILE* fd_memory = NULL; long int free_memory; char str_memory[15]; size_t res; res = system("free | grep Mem | awk '{ print $4 }' > /tmp/free_memory"); fd_memory = fopen("/tmp/free_memory", "r"); if (fd_memory == NULL) { LOG_FATAL("Free memory cannot be obtained.\n"); } char *res_f = fgets(str_memory, 15, fd_memory); if (!res_f) { return 0; } sscanf(str_memory, "%lu", &free_memory); LOG_DEBUG_F("free memory (KB): %li\n", free_memory); fclose(fd_memory); return free_memory; } unsigned long int <API key>(int process, int batch_size, int max_list_length) { unsigned long int list_memory = max_list_length * batch_size; if (process == FASTQ_QC) { LOG_DEBUG_F("required memory (KB): %li\n", <API key> * list_memory / 1000); return <API key> * list_memory / 1000; } else if (process == FASTQ_PREPRO) { LOG_DEBUG_F("required memory (KB): %li\n", <API key> * list_memory / 1000); return <API key> * list_memory / 1000; } else { return 0; } } int <API key>(char* input_filename) { int <API key>; struct stat st; stat(input_filename, &st); <API key> = (int)(1.4 * (st.st_size / <API key>) / 12); //security margin: 1.4, nts of chromosome 1: 1/12 *total nts return <API key>; } /* int <API key>() { FILE* fd_cpu_num_cores = NULL; int <API key>; char cpu_num_cores[2]; char log_message[50]; fd_cpu_num_cores = popen("cat /proc/cpuinfo | grep processor | wc -l", "r"); if (fd_cpu_num_cores == NULL) { LOG_DEBUG("Num of CPU cores cannot be obtained.\n"); } fgets(cpu_num_cores, 2, fd_cpu_num_cores); sscanf(cpu_num_cores, "%i", &<API key>); <API key> = max((<API key> - 2), 1); sprintf(log_message, "<API key>: %i\n", <API key>); LOG_DEBUG(log_message); pclose(fd_cpu_num_cores); return <API key>; } */ size_t <API key>() { FILE* fd_cpu_num_cores = NULL; const unsigned int MAX_LINE = 1024; size_t <API key> = 0; char line[MAX_LINE]; fd_cpu_num_cores = fopen("/proc/cpuinfo", "r"); if (fd_cpu_num_cores == NULL) { printf("Num of CPU cores cannot be obtained.\n"); return 0; } while (fgets(line, MAX_LINE, fd_cpu_num_cores)) { if (!strncmp("processor", line, 9)) { <API key>++; } } LOG_DEBUG_F("<API key>: %zu", <API key>); fclose(fd_cpu_num_cores); return <API key>; } int <API key>() { int <API key> = 0; #ifdef CUDA_VERSION <API key> = 16 * <API key>(); #endif return <API key>; } int <API key>(int process, int max_list_length) { unsigned long int optimal_batch_size = 0; unsigned long int gpu_global_memory = ULLONG_MAX; #ifdef CUDA_VERSION gpu_global_memory = <API key>(); #endif unsigned long int free_memory = get_free_memory(); if (process == FASTQ_QC) { optimal_batch_size = (1000 * free_memory) / (<API key> * max_list_length); } else if (process == FASTQ_PREPRO) { optimal_batch_size = (1000 * free_memory) / (<API key> * max_list_length); } else if (process == BAM_QC) { optimal_batch_size = 1000 * free_memory / <API key>; } unsigned long int size = min(optimal_batch_size, (gpu_global_memory / 2)); return (int) size; }
// Parameter.h // Implementation of the Class Parameter #if !defined(PARAMETER_H_) #define PARAMETER_H_ #include <iostream> class Parameter { public: Parameter(); virtual ~Parameter(); }; #endif // !defined(PARAMETER_H_)
<!DOCTYPE HTML PUBLIC "- <!--NewPage <HTML> <HEAD> <!-- Generated by javadoc (build 1.6.0_22) on Sun May 01 02:05:53 CEST 2011 --> <TITLE> <API key> </TITLE> <META NAME="date" CONTENT="2011-05-01"> <LINK REL ="stylesheet" TYPE="text/css" HREF="../../../stylesheet.css" TITLE="Style"> <SCRIPT type="text/javascript"> function windowTitle() { if (location.href.indexOf('is-external=true') == -1) { parent.document.title="<API key>"; } } </SCRIPT> <NOSCRIPT> </NOSCRIPT> </HEAD> <BODY BGCOLOR="white" onload="windowTitle();"> <HR> <A NAME="navbar_top"></A> <A HREF="#skip-navbar_top" title="Skip navigation links"></A> <TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY=""> <TR> <TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A NAME="navbar_top_firstrow"></A> <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY=""> <TR ALIGN="center" VALIGN="top"> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> &nbsp;<FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A>&nbsp;</TD> </TR> </TABLE> </TD> <TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM> TIDNotifJ API</EM> </TD> </TR> <TR> <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> &nbsp;<A HREF="../../../org/omg/CosNotifyComm/<API key>.html" title="interface in org.omg.CosNotifyComm"><B>PREV CLASS</B></A>&nbsp; &nbsp;<A HREF="../../../org/omg/CosNotifyComm/<API key>.html" title="class in org.omg.CosNotifyComm"><B>NEXT CLASS</B></A></FONT></TD> <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> <A HREF="../../../index.html?org/omg/CosNotifyComm/<API key>.html" target="_top"><B>FRAMES</B></A> &nbsp; &nbsp;<A HREF="<API key>.html" target="_top"><B>NO FRAMES</B></A> &nbsp; &nbsp;<SCRIPT type="text/javascript"> <! if(window==top) { document.writeln('<A HREF="../../../allclasses-noframe.html"><B>All Classes</B></A>'); } </SCRIPT> <NOSCRIPT> <A HREF="../../../allclasses-noframe.html"><B>All Classes</B></A> </NOSCRIPT> </FONT></TD> </TR> <TR> <TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2"> SUMMARY:&nbsp;NESTED&nbsp;|&nbsp;FIELD&nbsp;|&nbsp;<A HREF="#constructor_summary">CONSTR</A>&nbsp;|&nbsp;<A HREF="#method_summary">METHOD</A></FONT></TD> <TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2"> DETAIL:&nbsp;FIELD&nbsp;|&nbsp;<A HREF="#constructor_detail">CONSTR</A>&nbsp;|&nbsp;<A HREF="#method_detail">METHOD</A></FONT></TD> </TR> </TABLE> <A NAME="skip-navbar_top"></A> <HR> <H2> <FONT SIZE="-1"> org.omg.CosNotifyComm</FONT> <BR> Class <API key></H2> <PRE> java.lang.Object <IMG SRC="../../../resources/inherit.gif" ALT="extended by ">org.omg.PortableServer.Servant <IMG SRC="../../../resources/inherit.gif" ALT="extended by ">org.omg.PortableServer.<API key> <IMG SRC="../../../resources/inherit.gif" ALT="extended by "><B>org.omg.CosNotifyComm.<API key></B> </PRE> <DL> <DT><B>All Implemented Interfaces:</B> <DD><A HREF="../../../org/omg/CosNotifyComm/<API key>.html" title="interface in org.omg.CosNotifyComm"><API key></A>, <A HREF="../../../org/omg/CosNotifyComm/<API key>.html" title="interface in org.omg.CosNotifyComm"><API key></A></DD> </DL> <DL> <DT><B>Direct Known Subclasses:</B> <DD><A HREF="../../../org/omg/CosNotifyComm/<API key>.html" title="class in org.omg.CosNotifyComm"><API key></A></DD> </DL> <HR> <DL> <DT><PRE>public abstract class <B><API key></B><DT>extends org.omg.PortableServer.<API key><DT>implements <A HREF="../../../org/omg/CosNotifyComm/<API key>.html" title="interface in org.omg.CosNotifyComm"><API key></A></DL> </PRE> <P> <HR> <P> <A NAME="constructor_summary"></A> <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"> <TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2"> <B>Constructor Summary</B></FONT></TH> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD><CODE><B><A HREF="../../../org/omg/CosNotifyComm/<API key>.html#<API key>()"><API key></A></B>()</CODE> <BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</TD> </TR> </TABLE> &nbsp; <A NAME="method_summary"></A> <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"> <TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2"> <B>Method Summary</B></FONT></TH> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>&nbsp;java.lang.String[]</CODE></FONT></TD> <TD><CODE><B><A HREF="../../../org/omg/CosNotifyComm/<API key>.html#_all_interfaces(org.omg.PortableServer.POA, byte[])">_all_interfaces</A></B>(org.omg.PortableServer.POA&nbsp;poa, byte[]&nbsp;objectID)</CODE> <BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>&nbsp;<A HREF="../../../org/omg/CosNotifyComm/<API key>.html" title="interface in org.omg.CosNotifyComm"><API key></A></CODE></FONT></TD> <TD><CODE><B><A HREF="../../../org/omg/CosNotifyComm/<API key>.html#_this()">_this</A></B>()</CODE> <BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>&nbsp;<A HREF="../../../org/omg/CosNotifyComm/<API key>.html" title="interface in org.omg.CosNotifyComm"><API key></A></CODE></FONT></TD> <TD><CODE><B><A HREF="../../../org/omg/CosNotifyComm/<API key>.html#_this(org.omg.CORBA.ORB)">_this</A></B>(org.omg.CORBA.ORB&nbsp;orb)</CODE> <BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>&nbsp;void</CODE></FONT></TD> <TD><CODE><B><A HREF="../../../org/omg/CosNotifyComm/<API key>.html#invoke(org.omg.CORBA.ServerRequest)">invoke</A></B>(org.omg.CORBA.ServerRequest&nbsp;_request)</CODE> <BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</TD> </TR> </TABLE> &nbsp;<A NAME="<API key>.omg.PortableServer.Servant"></A> <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> <TR BGCOLOR="#EEEEFF" CLASS="<API key>"> <TH ALIGN="left"><B>Methods inherited from class org.omg.PortableServer.Servant</B></TH> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD><CODE>_default_POA, _get_delegate, _get_interface_def, _is_a, _non_existent, _object_id, _orb, _poa, _set_delegate, _this_object, _this_object</CODE></TD> </TR> </TABLE> &nbsp;<A NAME="<API key>.lang.Object"></A> <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> <TR BGCOLOR="#EEEEFF" CLASS="<API key>"> <TH ALIGN="left"><B>Methods inherited from class java.lang.Object</B></TH> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD><CODE>equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait</CODE></TD> </TR> </TABLE> &nbsp;<A NAME="<API key>.omg.CosNotifyComm.<API key>"></A> <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> <TR BGCOLOR="#EEEEFF" CLASS="<API key>"> <TH ALIGN="left"><B>Methods inherited from interface org.omg.CosNotifyComm.<A HREF="../../../org/omg/CosNotifyComm/<API key>.html" title="interface in org.omg.CosNotifyComm"><API key></A></B></TH> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD><CODE><A HREF="../../../org/omg/CosNotifyComm/<API key>.html#<API key>()"><API key></A></CODE></TD> </TR> </TABLE> &nbsp;<A NAME="<API key>.omg.CosNotifyComm.<API key>"></A> <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> <TR BGCOLOR="#EEEEFF" CLASS="<API key>"> <TH ALIGN="left"><B>Methods inherited from interface org.omg.CosNotifyComm.<A HREF="../../../org/omg/CosNotifyComm/<API key>.html" title="interface in org.omg.CosNotifyComm"><API key></A></B></TH> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD><CODE><A HREF="../../../org/omg/CosNotifyComm/<API key>.html#offer_change(org.omg.CosNotification._EventType[], org.omg.CosNotification._EventType[])">offer_change</A></CODE></TD> </TR> </TABLE> &nbsp; <P> <A NAME="constructor_detail"></A> <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"> <TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2"> <B>Constructor Detail</B></FONT></TH> </TR> </TABLE> <A NAME="<API key>()"></A><H3> <API key></H3> <PRE> public <B><API key></B>()</PRE> <DL> </DL> <A NAME="method_detail"></A> <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"> <TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2"> <B>Method Detail</B></FONT></TH> </TR> </TABLE> <A NAME="_this()"></A><H3> _this</H3> <PRE> public <A HREF="../../../org/omg/CosNotifyComm/<API key>.html" title="interface in org.omg.CosNotifyComm"><API key></A> <B>_this</B>()</PRE> <DL> <DD><DL> </DL> </DD> <DD><DL> </DL> </DD> </DL> <HR> <A NAME="_this(org.omg.CORBA.ORB)"></A><H3> _this</H3> <PRE> public <A HREF="../../../org/omg/CosNotifyComm/<API key>.html" title="interface in org.omg.CosNotifyComm"><API key></A> <B>_this</B>(org.omg.CORBA.ORB&nbsp;orb)</PRE> <DL> <DD><DL> </DL> </DD> <DD><DL> </DL> </DD> </DL> <HR> <A NAME="_all_interfaces(org.omg.PortableServer.POA, byte[])"></A><H3> _all_interfaces</H3> <PRE> public java.lang.String[] <B>_all_interfaces</B>(org.omg.PortableServer.POA&nbsp;poa, byte[]&nbsp;objectID)</PRE> <DL> <DD><DL> <DT><B>Specified by:</B><DD><CODE>_all_interfaces</CODE> in class <CODE>org.omg.PortableServer.Servant</CODE></DL> </DD> <DD><DL> </DL> </DD> </DL> <HR> <A NAME="invoke(org.omg.CORBA.ServerRequest)"></A><H3> invoke</H3> <PRE> public void <B>invoke</B>(org.omg.CORBA.ServerRequest&nbsp;_request)</PRE> <DL> <DD><DL> <DT><B>Specified by:</B><DD><CODE>invoke</CODE> in class <CODE>org.omg.PortableServer.<API key></CODE></DL> </DD> <DD><DL> </DL> </DD> </DL> <HR> <A NAME="navbar_bottom"></A> <A HREF="#skip-navbar_bottom" title="Skip navigation links"></A> <TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY=""> <TR> <TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A NAME="<API key>"></A> <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY=""> <TR ALIGN="center" VALIGN="top"> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> &nbsp;<FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A>&nbsp;</TD> </TR> </TABLE> </TD> <TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM> TIDNotifJ API</EM> </TD> </TR> <TR> <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> &nbsp;<A HREF="../../../org/omg/CosNotifyComm/<API key>.html" title="interface in org.omg.CosNotifyComm"><B>PREV CLASS</B></A>&nbsp; &nbsp;<A HREF="../../../org/omg/CosNotifyComm/<API key>.html" title="class in org.omg.CosNotifyComm"><B>NEXT CLASS</B></A></FONT></TD> <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> <A HREF="../../../index.html?org/omg/CosNotifyComm/<API key>.html" target="_top"><B>FRAMES</B></A> &nbsp; &nbsp;<A HREF="<API key>.html" target="_top"><B>NO FRAMES</B></A> &nbsp; &nbsp;<SCRIPT type="text/javascript"> <! if(window==top) { document.writeln('<A HREF="../../../allclasses-noframe.html"><B>All Classes</B></A>'); } </SCRIPT> <NOSCRIPT> <A HREF="../../../allclasses-noframe.html"><B>All Classes</B></A> </NOSCRIPT> </FONT></TD> </TR> <TR> <TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2"> SUMMARY:&nbsp;NESTED&nbsp;|&nbsp;FIELD&nbsp;|&nbsp;<A HREF="#constructor_summary">CONSTR</A>&nbsp;|&nbsp;<A HREF="#method_summary">METHOD</A></FONT></TD> <TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2"> DETAIL:&nbsp;FIELD&nbsp;|&nbsp;<A HREF="#constructor_detail">CONSTR</A>&nbsp;|&nbsp;<A HREF="#method_detail">METHOD</A></FONT></TD> </TR> </TABLE> <A NAME="skip-navbar_bottom"></A> <HR> </BODY> </HTML>